@coze-arch/cli 0.0.14 → 0.0.16

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.
@@ -7,3 +7,6 @@ cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
9
  pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+ if command -v coze > /dev/null 2>&1 && coze check-bins --help > /dev/null 2>&1; then
11
+ coze check-bins --fix
12
+ fi
@@ -7,6 +7,9 @@ cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
9
  pnpm install --prefer-frozen-lockfile --prefer-offline
10
+ if command -v coze > /dev/null 2>&1 && coze check-bins --help > /dev/null 2>&1; then
11
+ coze check-bins --fix
12
+ fi
10
13
 
11
14
  echo "Preparing Nuxt project..."
12
15
  pnpm exec nuxt prepare
@@ -197,9 +197,6 @@ importers:
197
197
  '@supabase/supabase-js':
198
198
  specifier: 2.95.3
199
199
  version: 2.95.3
200
- better-sqlite3:
201
- specifier: ^11.9.1
202
- version: 11.10.0
203
200
  coze-coding-dev-sdk:
204
201
  specifier: ^0.7.16
205
202
  version: 0.7.16(openai@6.16.0(ws@8.19.0)(zod@4.3.5))(ws@8.19.0)
@@ -234,9 +231,6 @@ importers:
234
231
  '@nestjs/schematics':
235
232
  specifier: ^10.2.3
236
233
  version: 10.2.3(chokidar@3.6.0)(typescript@5.9.3)
237
- '@types/better-sqlite3':
238
- specifier: ^7.6.13
239
- version: 7.6.13
240
234
  '@types/express':
241
235
  specifier: 5.0.6
242
236
  version: 5.0.6
@@ -15586,6 +15580,7 @@ snapshots:
15586
15580
  '@types/better-sqlite3@7.6.13':
15587
15581
  dependencies:
15588
15582
  '@types/node': 22.19.6
15583
+ optional: true
15589
15584
 
15590
15585
  '@types/body-parser@1.19.6':
15591
15586
  dependencies:
@@ -16921,6 +16916,7 @@ snapshots:
16921
16916
  dependencies:
16922
16917
  bindings: 1.5.0
16923
16918
  prebuild-install: 7.1.3
16919
+ optional: true
16924
16920
 
16925
16921
  big-integer@1.6.52: {}
16926
16922
 
@@ -16936,6 +16932,7 @@ snapshots:
16936
16932
  bindings@1.5.0:
16937
16933
  dependencies:
16938
16934
  file-uri-to-path: 1.0.0
16935
+ optional: true
16939
16936
 
16940
16937
  bl@1.2.3:
16941
16938
  dependencies:
@@ -17239,7 +17236,8 @@ snapshots:
17239
17236
  dependencies:
17240
17237
  readdirp: 5.0.0
17241
17238
 
17242
- chownr@1.1.4: {}
17239
+ chownr@1.1.4:
17240
+ optional: true
17243
17241
 
17244
17242
  chroma-js@2.6.0: {}
17245
17243
 
@@ -17735,6 +17733,7 @@ snapshots:
17735
17733
  decompress-response@6.0.0:
17736
17734
  dependencies:
17737
17735
  mimic-response: 3.1.0
17736
+ optional: true
17738
17737
 
17739
17738
  decompress-tar@4.1.1:
17740
17739
  dependencies:
@@ -18491,7 +18490,8 @@ snapshots:
18491
18490
 
18492
18491
  exif-parser@0.1.12: {}
18493
18492
 
18494
- expand-template@2.0.3: {}
18493
+ expand-template@2.0.3:
18494
+ optional: true
18495
18495
 
18496
18496
  express@4.21.2:
18497
18497
  dependencies:
@@ -18679,7 +18679,8 @@ snapshots:
18679
18679
 
18680
18680
  file-type@8.1.0: {}
18681
18681
 
18682
- file-uri-to-path@1.0.0: {}
18682
+ file-uri-to-path@1.0.0:
18683
+ optional: true
18683
18684
 
18684
18685
  filename-reserved-regex@2.0.0: {}
18685
18686
 
@@ -18963,7 +18964,8 @@ snapshots:
18963
18964
 
18964
18965
  git-clone@0.1.0: {}
18965
18966
 
18966
- github-from-package@0.0.0: {}
18967
+ github-from-package@0.0.0:
18968
+ optional: true
18967
18969
 
18968
18970
  glob-parent@5.1.2:
18969
18971
  dependencies:
@@ -20214,7 +20216,8 @@ snapshots:
20214
20216
 
20215
20217
  mimic-response@1.0.1: {}
20216
20218
 
20217
- mimic-response@3.1.0: {}
20219
+ mimic-response@3.1.0:
20220
+ optional: true
20218
20221
 
20219
20222
  min-document@2.19.2:
20220
20223
  dependencies:
@@ -20446,7 +20449,8 @@ snapshots:
20446
20449
 
20447
20450
  mkdir-p@0.0.7: {}
20448
20451
 
20449
- mkdirp-classic@0.5.3: {}
20452
+ mkdirp-classic@0.5.3:
20453
+ optional: true
20450
20454
 
20451
20455
  mkdirp@0.5.6:
20452
20456
  dependencies:
@@ -20503,7 +20507,8 @@ snapshots:
20503
20507
 
20504
20508
  nanoid@3.3.11: {}
20505
20509
 
20506
- napi-build-utils@2.0.0: {}
20510
+ napi-build-utils@2.0.0:
20511
+ optional: true
20507
20512
 
20508
20513
  natural-compare@1.4.0: {}
20509
20514
 
@@ -20545,6 +20550,7 @@ snapshots:
20545
20550
  node-abi@3.87.0:
20546
20551
  dependencies:
20547
20552
  semver: 7.7.4
20553
+ optional: true
20548
20554
 
20549
20555
  node-abort-controller@3.1.1: {}
20550
20556
 
@@ -21505,6 +21511,7 @@ snapshots:
21505
21511
  simple-get: 4.0.1
21506
21512
  tar-fs: 2.1.4
21507
21513
  tunnel-agent: 0.6.0
21514
+ optional: true
21508
21515
 
21509
21516
  prelude-ls@1.2.1: {}
21510
21517
 
@@ -22232,13 +22239,15 @@ snapshots:
22232
22239
 
22233
22240
  signal-exit@4.1.0: {}
22234
22241
 
22235
- simple-concat@1.0.1: {}
22242
+ simple-concat@1.0.1:
22243
+ optional: true
22236
22244
 
22237
22245
  simple-get@4.0.1:
22238
22246
  dependencies:
22239
22247
  decompress-response: 6.0.0
22240
22248
  once: 1.4.0
22241
22249
  simple-concat: 1.0.1
22250
+ optional: true
22242
22251
 
22243
22252
  simple-plist@1.3.1:
22244
22253
  dependencies:
@@ -22650,6 +22659,7 @@ snapshots:
22650
22659
  mkdirp-classic: 0.5.3
22651
22660
  pump: 3.0.3
22652
22661
  tar-stream: 2.2.0
22662
+ optional: true
22653
22663
 
22654
22664
  tar-stream@1.6.2:
22655
22665
  dependencies:
@@ -17,7 +17,6 @@
17
17
  "@nestjs/core": "^10.4.15",
18
18
  "@nestjs/platform-express": "^10.4.15",
19
19
  "@supabase/supabase-js": "2.95.3",
20
- "better-sqlite3": "^11.9.1",
21
20
  "coze-coding-dev-sdk": "^0.7.16",
22
21
  "dotenv": "^17.2.3",
23
22
  "drizzle-kit": "^0.31.8",
@@ -31,7 +30,6 @@
31
30
  "devDependencies": {
32
31
  "@nestjs/cli": "^10.4.9",
33
32
  "@nestjs/schematics": "^10.2.3",
34
- "@types/better-sqlite3": "^7.6.13",
35
33
  "@types/express": "5.0.6",
36
34
  "@types/node": "^22.10.2",
37
35
  "drizzle-kit": "^0.31.8",
@@ -126,6 +126,43 @@
126
126
  "additionalProperties": false
127
127
  }
128
128
  },
129
+ {
130
+ "name": "test-only",
131
+ "description": "Test template showcasing all template hooks and features",
132
+ "location": "./test-only",
133
+ "paramsSchema": {
134
+ "type": "object",
135
+ "properties": {
136
+ "appName": {
137
+ "type": "string",
138
+ "minLength": 1,
139
+ "pattern": "^[a-z0-9-]+$",
140
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
141
+ },
142
+ "port": {
143
+ "type": "number",
144
+ "default": 5000,
145
+ "minimum": 1024,
146
+ "maximum": 65535,
147
+ "description": "Development server port"
148
+ },
149
+ "includeTests": {
150
+ "type": "boolean",
151
+ "default": true,
152
+ "nullable": true,
153
+ "description": "Include test files"
154
+ },
155
+ "addCopyright": {
156
+ "type": "boolean",
157
+ "default": false,
158
+ "nullable": true,
159
+ "description": "Add copyright header to source files"
160
+ }
161
+ },
162
+ "required": [],
163
+ "additionalProperties": false
164
+ }
165
+ },
129
166
  {
130
167
  "name": "vite",
131
168
  "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
@@ -7,3 +7,6 @@ cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
9
  pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+ if command -v coze > /dev/null 2>&1 && coze check-bins --help > /dev/null 2>&1; then
11
+ coze check-bins --fix
12
+ fi
package/lib/cli.js CHANGED
@@ -2107,7 +2107,7 @@ const EventBuilder = {
2107
2107
  };
2108
2108
 
2109
2109
  var name = "@coze-arch/cli";
2110
- var version = "0.0.14";
2110
+ var version = "0.0.16";
2111
2111
  var description = "coze coding devtools cli";
2112
2112
  var license = "MIT";
2113
2113
  var author = "fanwenjie.fe@bytedance.com";
@@ -2839,7 +2839,7 @@ const executeWarmup = async (options) => {
2839
2839
  /**
2840
2840
  * 注册 warmup 命令到 program
2841
2841
  */
2842
- const registerCommand$5 = program => {
2842
+ const registerCommand$6 = program => {
2843
2843
  program
2844
2844
  .command('warmup')
2845
2845
  .description('Pre-install dependencies for templates to speed up init')
@@ -3251,7 +3251,7 @@ const executeUpdate = (
3251
3251
  /**
3252
3252
  * 注册 update 命令到 program
3253
3253
  */
3254
- const registerCommand$4 = program => {
3254
+ const registerCommand$5 = program => {
3255
3255
  program
3256
3256
  .command('update <package>')
3257
3257
  .description('Update a package dependency')
@@ -6802,7 +6802,7 @@ const executePatch = async (
6802
6802
  }
6803
6803
  };
6804
6804
 
6805
- const registerCommand$3 = program => {
6805
+ const registerCommand$4 = program => {
6806
6806
  program
6807
6807
  .command('patch')
6808
6808
  .description('Apply template patches for existing projects')
@@ -7073,7 +7073,7 @@ const executeRun = async (
7073
7073
  /**
7074
7074
  * 注册 dev/build/start 命令到 program
7075
7075
  */
7076
- const registerCommand$2 = program => {
7076
+ const registerCommand$3 = program => {
7077
7077
  // dev 命令
7078
7078
  program
7079
7079
  .command('dev')
@@ -7980,7 +7980,7 @@ const executeRoutes = async (
7980
7980
  /**
7981
7981
  * Register routes command to program
7982
7982
  */
7983
- const registerCommand$1 = program => {
7983
+ const registerCommand$2 = program => {
7984
7984
  program
7985
7985
  .command('routes')
7986
7986
  .description('Generate routes manifest for the current project')
@@ -7997,6 +7997,131 @@ const registerCommand$1 = program => {
7997
7997
  });
7998
7998
  };
7999
7999
 
8000
+ const d = debug('coze-init-cli:check-bins');
8001
+
8002
+
8003
+
8004
+
8005
+
8006
+
8007
+
8008
+ const checkBins = async (cwd, fix) => {
8009
+ d('starting check, cwd=%s fix=%s', cwd, fix);
8010
+
8011
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- fallback {} ensures non-null
8012
+ const pkgJson = safeJsonParse
8013
+
8014
+
8015
+ (await fs$1.readFile(path.join(cwd, 'package.json'), 'utf8'), {});
8016
+
8017
+ const allDeps = Object.keys({
8018
+ ...pkgJson.dependencies,
8019
+ ...pkgJson.devDependencies,
8020
+ });
8021
+
8022
+ d('found %d total dependencies to scan', allDeps.length);
8023
+
8024
+ const binDir = path.join(cwd, 'node_modules', '.bin');
8025
+ d('bin directory: %s', binDir);
8026
+ const missing = [];
8027
+
8028
+ await Promise.all(
8029
+ allDeps.map(async depName => {
8030
+ let rawContent;
8031
+ try {
8032
+ rawContent = await fs$1.readFile(
8033
+ path.join(cwd, 'node_modules', depName, 'package.json'),
8034
+ 'utf8',
8035
+ );
8036
+ } catch (err) {
8037
+ d('dep %s not found in node_modules: %s', depName, err);
8038
+ missing.push({ dep: depName, bin: '', reason: 'missing-package' });
8039
+ return;
8040
+ }
8041
+ const depPkg = safeJsonParse(
8042
+ rawContent,
8043
+ );
8044
+ if (!depPkg) {
8045
+ d('skipping %s: failed to parse package.json', depName);
8046
+ return;
8047
+ }
8048
+
8049
+ if (!depPkg.bin) {
8050
+ return;
8051
+ }
8052
+
8053
+ const bins =
8054
+ typeof depPkg.bin === 'string'
8055
+ ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- split always has ≥1 element
8056
+ { [depName.split('/').pop()]: depPkg.bin }
8057
+ : depPkg.bin;
8058
+
8059
+ d('%s declares bins: %o', depName, Object.keys(bins));
8060
+
8061
+ await Promise.all(
8062
+ Object.keys(bins).map(async binName => {
8063
+ try {
8064
+ await fs$1.access(path.join(binDir, binName));
8065
+ d('bin present: %s', binName);
8066
+ } catch (err) {
8067
+ d('bin missing: %s (from %s): %s', binName, depName, err);
8068
+ missing.push({ dep: depName, bin: binName, reason: 'missing-bin' });
8069
+ }
8070
+ }),
8071
+ );
8072
+ }),
8073
+ );
8074
+
8075
+ d('scan complete, missing=%d', missing.length);
8076
+
8077
+ if (missing.length === 0) {
8078
+ logger.success(
8079
+ 'check-bins: all bin entries present, skipping force install.',
8080
+ );
8081
+ return;
8082
+ }
8083
+
8084
+ logger.warn('check-bins: missing or broken dependencies detected:');
8085
+ for (const { dep, bin, reason } of missing) {
8086
+ if (reason === 'missing-package') {
8087
+ logger.warn(` ${dep} -> (package not found in node_modules)`);
8088
+ } else {
8089
+ logger.warn(` ${dep} -> .bin/${bin}`);
8090
+ }
8091
+ }
8092
+
8093
+ if (!fix) {
8094
+ logger.error(
8095
+ 'check-bins: missing bin entries found, run with --fix to repair.',
8096
+ );
8097
+ process.exit(1);
8098
+ }
8099
+
8100
+ logger.info('check-bins: running pnpm i --force to fix...');
8101
+ d('executing: pnpm i --force');
8102
+ child_process.execSync('pnpm i --force', { stdio: 'inherit', cwd });
8103
+ d('pnpm i --force completed');
8104
+ };
8105
+
8106
+ const registerCommand$1 = program => {
8107
+ program
8108
+ .command('check-bins')
8109
+ .description(
8110
+ 'Verify all bin entries from dependencies exist in node_modules/.bin, run pnpm i --force if any are missing',
8111
+ )
8112
+ .option('-c, --cwd <path>', 'Working directory to check', process.cwd())
8113
+ .option('--fix', 'Run pnpm i --force to repair missing bin entries', false)
8114
+ .action(async (options) => {
8115
+ try {
8116
+ await checkBins(options.cwd, options.fix);
8117
+ } catch (err) {
8118
+ logger.warn(
8119
+ `check-bins: skipped due to error: ${err instanceof Error ? err.message : String(err)}`,
8120
+ );
8121
+ }
8122
+ });
8123
+ };
8124
+
8000
8125
  /**
8001
8126
  * 在后台启动一个独立的子进程
8002
8127
  * 类似于 `setsid command args >/dev/null 2>&1 &`
@@ -9324,10 +9449,11 @@ const registerCommand = program => {
9324
9449
 
9325
9450
  const commands = [
9326
9451
  registerCommand,
9327
- registerCommand$2,
9328
- registerCommand$5,
9329
9452
  registerCommand$3,
9453
+ registerCommand$6,
9330
9454
  registerCommand$4,
9455
+ registerCommand$5,
9456
+ registerCommand$2,
9331
9457
  registerCommand$1,
9332
9458
  ];
9333
9459
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",