mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
feat: The method to modify and update skills
This commit is contained in:
@@ -5,7 +5,8 @@ import { defineCommand, getConfigDir } from "bailian-cli-core";
|
||||
import { CLI_VERSION } from "../version.ts";
|
||||
import { NPM_PACKAGE, fetchLatestVersion } from "../utils/update-checker.ts";
|
||||
|
||||
const SKILL_NAME = "bailian-cli";
|
||||
const SKILL_SOURCE = "modelstudioai/cli";
|
||||
const SKILL_INSTALL_CMD = `npx skills add ${SKILL_SOURCE} --all -g -y`;
|
||||
|
||||
/** Build the install command */
|
||||
function detectInstallCommand(): { cmd: string; label: string } {
|
||||
@@ -16,11 +17,13 @@ function updateAgentSkill(colors: { green: string; yellow: string; reset: string
|
||||
const { green, yellow, reset } = colors;
|
||||
process.stderr.write("\nUpdating agent skill...\n");
|
||||
try {
|
||||
execSync(`npx skills update ${SKILL_NAME} -g -y`, { stdio: "inherit" });
|
||||
// Reinstall (not `skills update`) into ~/.agents/skills/ and sync to all agent apps.
|
||||
// `--all` on `skills add` means --skill '*' --agent '*' -y (Cursor, Claude Code, etc.).
|
||||
execSync(SKILL_INSTALL_CMD, { stdio: "inherit" });
|
||||
process.stderr.write(`${green}\u2713 Agent skill updated.${reset}\n`);
|
||||
} catch {
|
||||
process.stderr.write(
|
||||
`${yellow}Agent skill update skipped. Run manually: npx skills update ${SKILL_NAME} -g -y${reset}\n`,
|
||||
`${yellow}Agent skill update skipped. Run manually: ${SKILL_INSTALL_CMD}${reset}\n`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +48,7 @@ export default defineCommand({
|
||||
|
||||
if (latest && latest === CLI_VERSION) {
|
||||
process.stderr.write(`${green}\u2713 Already up to date (${CLI_VERSION}).${reset}\n`);
|
||||
updateAgentSkill({ green, yellow, reset });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ Offer reporting when **none** of EXCLUDE applies **and** any of the following ho
|
||||
|
||||
### Before offering to report
|
||||
|
||||
1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-agent--do-first) — run `bl update` and `npx skills update bailian-cli -g -y` if mismatched.
|
||||
1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-agent--do-first) — run `bl update` and `npx skills add modelstudioai/cli --all -g -y` if mismatched.
|
||||
2. Confirm `bl auth status` is healthy (for commands that need auth).
|
||||
3. Retry once with `--verbose` if stderr was thin.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Run this flow **once per session**, before the first `bl` command.
|
||||
2. **CLI version** — `bl --version` (output `bl X.Y.Z`; compare only `X.Y.Z`).
|
||||
3. If the two strings **differ**, refresh the skill first:
|
||||
```bash
|
||||
npx skills update bailian-cli -g -y
|
||||
npx skills add modelstudioai/cli --all -g -y
|
||||
```
|
||||
|
||||
Do not trust a stale `reference/` when versions mismatch — flags may be wrong.
|
||||
@@ -36,7 +36,7 @@ bl update
|
||||
```
|
||||
|
||||
`bl update` upgrades `bailian-cli` via npm and, on success, also runs
|
||||
`npx skills update bailian-cli -g -y` to keep the skill in lockstep.
|
||||
`npx skills add modelstudioai/cli --all -g -y` to keep the skill in lockstep across all agent apps.
|
||||
|
||||
## 3. Update policy — always ask first
|
||||
|
||||
|
||||
Reference in New Issue
Block a user