@9000ai/cli 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,8 @@
1
- ## What's new in v0.5.2
1
+ ## What's new in v0.5.3
2
2
 
3
- - `9000ai init --force` now compares file content only updates changed system files
3
+ - `9000ai update` sync skills after npm update, shows what changed
4
+ - `9000ai init --force` — smart diff, only updates changed system files
4
5
  - User data (profile/, claims/, inbox/, projects/) is never overwritten
5
- - postinstall shows which skill files were added or updated
6
- - Hub SKILL.md: added system update instructions
7
6
 
8
7
  ## v0.5.0
9
8
 
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerUpdateCommand(program: Command): void;
@@ -0,0 +1,84 @@
1
+ import { existsSync, mkdirSync, cpSync, readFileSync, readdirSync, statSync } from "fs";
2
+ import { dirname, join, relative } from "path";
3
+ import { homedir } from "os";
4
+ import { fileURLToPath } from "url";
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ export function registerUpdateCommand(program) {
7
+ program
8
+ .command("update")
9
+ .description("Sync skills to latest version after npm update")
10
+ .action(() => {
11
+ const src = join(__dirname, "..", "skills");
12
+ const dest = join(homedir(), ".9000ai", "skills");
13
+ if (!existsSync(src)) {
14
+ console.error("Error: Skills not found in package. Reinstall: npm install -g @9000ai/cli");
15
+ process.exit(1);
16
+ }
17
+ // Diff before copy
18
+ const created = [];
19
+ const updated = [];
20
+ function diffDir(srcDir, destDir) {
21
+ if (!existsSync(srcDir))
22
+ return;
23
+ for (const entry of readdirSync(srcDir)) {
24
+ const s = join(srcDir, entry);
25
+ const d = join(destDir, entry);
26
+ if (statSync(s).isDirectory()) {
27
+ diffDir(s, d);
28
+ }
29
+ else {
30
+ const rel = relative(dest, d);
31
+ if (!existsSync(d)) {
32
+ created.push(rel);
33
+ }
34
+ else {
35
+ try {
36
+ if (!readFileSync(s).equals(readFileSync(d))) {
37
+ updated.push(rel);
38
+ }
39
+ }
40
+ catch {
41
+ updated.push(rel);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ diffDir(src, dest);
48
+ // Copy
49
+ mkdirSync(dest, { recursive: true });
50
+ cpSync(src, dest, { recursive: true, force: true });
51
+ // Read version
52
+ let version = "unknown";
53
+ try {
54
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
55
+ version = pkg.version;
56
+ }
57
+ catch { }
58
+ // Read changelog
59
+ let changelog = "";
60
+ try {
61
+ changelog = readFileSync(join(__dirname, "..", "CHANGELOG.md"), "utf-8");
62
+ }
63
+ catch { }
64
+ // Output
65
+ console.log(`@9000ai/cli v${version}\n`);
66
+ if (created.length > 0 || updated.length > 0) {
67
+ if (created.length > 0) {
68
+ console.log(`New files:`);
69
+ created.forEach((f) => console.log(` + ${f}`));
70
+ }
71
+ if (updated.length > 0) {
72
+ console.log(`Updated files:`);
73
+ updated.forEach((f) => console.log(` ~ ${f}`));
74
+ }
75
+ console.log("");
76
+ }
77
+ else {
78
+ console.log(`Skills: already up to date\n`);
79
+ }
80
+ if (changelog) {
81
+ console.log(changelog);
82
+ }
83
+ });
84
+ }
package/dist/index.js CHANGED
@@ -9,11 +9,12 @@ import { registerTaskCommands } from "./commands/task.js";
9
9
  import { registerFeedbackCommands } from "./commands/feedback.js";
10
10
  import { registerSkillCommands } from "./commands/skill.js";
11
11
  import { registerInitCommand } from "./commands/init.js";
12
+ import { registerUpdateCommand } from "./commands/update.js";
12
13
  const program = new Command();
13
14
  program
14
15
  .name("9000ai")
15
16
  .description("9000AI Toolbox CLI — unified interface for 9000AI platform")
16
- .version("0.5.2");
17
+ .version("0.5.3");
17
18
  registerConfigCommands(program);
18
19
  registerAuthCommands(program);
19
20
  registerSearchCommands(program);
@@ -23,6 +24,7 @@ registerTaskCommands(program);
23
24
  registerFeedbackCommands(program);
24
25
  registerSkillCommands(program);
25
26
  registerInitCommand(program);
27
+ registerUpdateCommand(program);
26
28
  program.parseAsync(process.argv).catch((err) => {
27
29
  console.error(err);
28
30
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@9000ai/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "9000AI Toolbox CLI — unified command-line interface for 9000AI platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -118,13 +118,19 @@ output-format: routing-only
118
118
  ## 更新系统
119
119
 
120
120
  ```bash
121
- # 更新 CLI skills
122
- npm update -g @9000ai/cli
121
+ npm update -g @9000ai/cli && 9000ai update
122
+ ```
123
+
124
+ 第一条更新 CLI,第二条同步 skills 并显示更新内容。
125
+
126
+ 项目目录的模板也要同步时:
123
127
 
124
- # 同步最新模板到项目目录(profile/ 不会被覆盖)
128
+ ```bash
125
129
  9000ai init --path <项目目录> --force
126
130
  ```
127
131
 
132
+ profile/ 和 claims/ 等用户数据不会被覆盖。
133
+
128
134
  ## 参考文档
129
135
 
130
136
  需要更详细的使用规范时查阅: