@coze-arch/cli 0.0.15-alpha.76f8e3 → 0.0.15-alpha.b666ad

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.
Files changed (2) hide show
  1. package/lib/cli.js +37 -9
  2. package/package.json +1 -1
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.15-alpha.76f8e3";
2110
+ var version = "0.0.15-alpha.b666ad";
2111
2111
  var description = "coze coding devtools cli";
2112
2112
  var license = "MIT";
2113
2113
  var author = "fanwenjie.fe@bytedance.com";
@@ -8008,8 +8008,18 @@ const registerCommand$2 = program => {
8008
8008
  });
8009
8009
  };
8010
8010
 
8011
+ const d = debug('coze-init-cli:check-bins');
8012
+
8013
+
8014
+
8015
+
8016
+
8017
+
8018
+
8011
8019
  const checkBins = async (cwd, fix) => {
8012
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8020
+ d('starting check, cwd=%s fix=%s', cwd, fix);
8021
+
8022
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- fallback {} ensures non-null
8013
8023
  const pkgJson = safeJsonParse
8014
8024
 
8015
8025
 
@@ -8020,7 +8030,10 @@ const checkBins = async (cwd, fix) => {
8020
8030
  ...pkgJson.devDependencies,
8021
8031
  });
8022
8032
 
8033
+ d('found %d total dependencies to scan', allDeps.length);
8034
+
8023
8035
  const binDir = path.join(cwd, 'node_modules', '.bin');
8036
+ d('bin directory: %s', binDir);
8024
8037
  const missing = [];
8025
8038
 
8026
8039
  await Promise.all(
@@ -8031,13 +8044,16 @@ const checkBins = async (cwd, fix) => {
8031
8044
  path.join(cwd, 'node_modules', depName, 'package.json'),
8032
8045
  'utf8',
8033
8046
  );
8034
- } catch (e) {
8047
+ } catch (err) {
8048
+ d('dep %s not found in node_modules: %s', depName, err);
8049
+ missing.push({ dep: depName, bin: '', reason: 'missing-package' });
8035
8050
  return;
8036
8051
  }
8037
8052
  const depPkg = safeJsonParse(
8038
8053
  rawContent,
8039
8054
  );
8040
8055
  if (!depPkg) {
8056
+ d('skipping %s: failed to parse package.json', depName);
8041
8057
  return;
8042
8058
  }
8043
8059
 
@@ -8047,22 +8063,28 @@ const checkBins = async (cwd, fix) => {
8047
8063
 
8048
8064
  const bins =
8049
8065
  typeof depPkg.bin === 'string'
8050
- ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8066
+ ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- split always has ≥1 element
8051
8067
  { [depName.split('/').pop()]: depPkg.bin }
8052
8068
  : depPkg.bin;
8053
8069
 
8070
+ d('%s declares bins: %o', depName, Object.keys(bins));
8071
+
8054
8072
  await Promise.all(
8055
8073
  Object.keys(bins).map(async binName => {
8056
8074
  try {
8057
8075
  await fs$1.access(path.join(binDir, binName));
8058
- } catch (e2) {
8059
- missing.push({ dep: depName, bin: binName });
8076
+ d('bin present: %s', binName);
8077
+ } catch (err) {
8078
+ d('bin missing: %s (from %s): %s', binName, depName, err);
8079
+ missing.push({ dep: depName, bin: binName, reason: 'missing-bin' });
8060
8080
  }
8061
8081
  }),
8062
8082
  );
8063
8083
  }),
8064
8084
  );
8065
8085
 
8086
+ d('scan complete, missing=%d', missing.length);
8087
+
8066
8088
  if (missing.length === 0) {
8067
8089
  logger.success(
8068
8090
  'check-bins: all bin entries present, skipping force install.',
@@ -8070,9 +8092,13 @@ const checkBins = async (cwd, fix) => {
8070
8092
  return;
8071
8093
  }
8072
8094
 
8073
- logger.warn('check-bins: missing bin entries detected:');
8074
- for (const { dep, bin } of missing) {
8075
- logger.warn(` ${dep} -> .bin/${bin}`);
8095
+ logger.warn('check-bins: missing or broken dependencies detected:');
8096
+ for (const { dep, bin, reason } of missing) {
8097
+ if (reason === 'missing-package') {
8098
+ logger.warn(` ${dep} -> (package not found in node_modules)`);
8099
+ } else {
8100
+ logger.warn(` ${dep} -> .bin/${bin}`);
8101
+ }
8076
8102
  }
8077
8103
 
8078
8104
  if (!fix) {
@@ -8083,7 +8109,9 @@ const checkBins = async (cwd, fix) => {
8083
8109
  }
8084
8110
 
8085
8111
  logger.info('check-bins: running pnpm i --force to fix...');
8112
+ d('executing: pnpm i --force');
8086
8113
  child_process.execSync('pnpm i --force', { stdio: 'inherit', cwd });
8114
+ d('pnpm i --force completed');
8087
8115
  };
8088
8116
 
8089
8117
  const registerCommand$1 = program => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.15-alpha.76f8e3",
3
+ "version": "0.0.15-alpha.b666ad",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",