@mindexed/cfact 1.1.6 → 1.1.7

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/bin/cfact.js +20 -6
  2. package/package.json +6 -2
package/bin/cfact.js CHANGED
@@ -1267,9 +1267,22 @@ function extractTarball(tarball, destDir) {
1267
1267
  // --- the two commands -------------------------------------------------------
1268
1268
  // Windows (and any host that locks an open directory) refuses to rename a tree another process holds a handle in.
1269
1269
  // Node surfaces it as one of these codes depending on the API and the lock; all three mean "something has it open".
1270
- const CLOSE_AND_RERUN = 'Close Claude Code, Antigravity and any terminal or editor open inside .claude/engine, then re-run this command.';
1270
+ // The holder is NOT a fixed program (CHG-296, FF-392): the measured one was a running dev server and its desktop app, both
1271
+ // reading the project's engine, while the earlier wording blamed Claude Code and cost several failed runs and a needless
1272
+ // session restart. The installer cannot name the holder, so it lists the likely kinds and, on Windows, says how to find it.
1273
+ const CLOSE_AND_RERUN = 'Likely holders: a dev server or desktop app that reads .claude/engine, an editor with a file from it open, or a terminal whose current directory is inside it. Stop or close whichever applies, then re-run this command.';
1271
1274
  const LOCK_ERROR_CODES = new Set(['EPERM', 'EBUSY', 'EACCES']);
1272
1275
 
1276
+ /**
1277
+ * Extra guidance for finding the holder, platform-specific. Windows only: Resource Monitor is the tool that can name the
1278
+ * process, and npx.ps1 being refused by the default PowerShell execution policy stops the documented one-liner before the
1279
+ * installer starts, so the re-run advice offers npx.cmd. `platform` is a parameter so it is testable off Windows.
1280
+ */
1281
+ function lockHolderGuidance(platform = process.platform) {
1282
+ if (platform !== 'win32') return '';
1283
+ return ' To find the holder: Resource Monitor > CPU > Associated Handles, search for "engine". If PowerShell refuses to run npx (npx.ps1 blocked by the execution policy), run the same command with npx.cmd instead.';
1284
+ }
1285
+
1273
1286
  /**
1274
1287
  * True when `e` is the "another program holds this directory open" family of errors (CHG-288, FF-389).
1275
1288
  * Exported so the classification is testable without a Windows machine.
@@ -1287,8 +1300,8 @@ function isLockError(e) {
1287
1300
  * swap is same-filesystem renames (atomic, no partial state), and a failed final rename restores the backup. Deleting
1288
1301
  * the old engine first (as an earlier version did) risked a mid-copy failure leaving nothing behind.
1289
1302
  *
1290
- * The first rename moves the CURRENT engine aside. On Windows it throws EPERM while a Claude Code or Antigravity session
1291
- * holds a handle inside `.claude/engine`; it was unguarded, so the consumer got a raw stack and a stray untracked
1303
+ * The first rename moves the CURRENT engine aside. On Windows it throws EPERM while any program (a dev server, a desktop
1304
+ * app, an editor, a terminal) holds a handle inside `.claude/engine`; it was unguarded, so the consumer got a raw stack and a stray untracked
1292
1305
  * `.claude/.engine.incoming`. It is now translated into the one instruction that fixes it, and the failure leaves the
1293
1306
  * old engine untouched (the rename never happened) and the staging directories removed. A translated catch rather than
1294
1307
  * a dry rename-and-restore probe, deliberately: a probe can succeed and the real rename still fail (a handle opened in
@@ -1296,7 +1309,7 @@ function isLockError(e) {
1296
1309
  *
1297
1310
  * `fsImpl` is injectable so the failure paths are testable without a locked directory.
1298
1311
  */
1299
- function installStagedEngine({ enginePath, stageDir, tmpDir, fsImpl = fs }) {
1312
+ function installStagedEngine({ enginePath, stageDir, tmpDir, fsImpl = fs, platform = process.platform }) {
1300
1313
  const engineParent = path.dirname(enginePath);
1301
1314
  const incoming = path.join(engineParent, '.engine.incoming');
1302
1315
  const backup = path.join(engineParent, '.engine.backup');
@@ -1314,7 +1327,7 @@ function installStagedEngine({ enginePath, stageDir, tmpDir, fsImpl = fs }) {
1314
1327
  fsImpl.rmSync(backup, { recursive: true, force: true });
1315
1328
  } catch (e) {
1316
1329
  abort(isLockError(e)
1317
- ? `cannot clear the leftovers of an earlier update next to ${enginePath} (${e.code}): another program holds them open. ${CLOSE_AND_RERUN}`
1330
+ ? `cannot clear the leftovers of an earlier update next to ${enginePath} (${e.code}): another program holds them open. ${CLOSE_AND_RERUN}${lockHolderGuidance(platform)}`
1318
1331
  : `cannot clear the leftovers of an earlier update next to ${enginePath} — ${e.message}`);
1319
1332
  }
1320
1333
  try {
@@ -1332,7 +1345,7 @@ function installStagedEngine({ enginePath, stageDir, tmpDir, fsImpl = fs }) {
1332
1345
  fsImpl.renameSync(enginePath, backup);
1333
1346
  } catch (e) {
1334
1347
  abort(isLockError(e)
1335
- ? `cannot replace ${enginePath} (${e.code}): another program is holding it open, most often a running Claude Code or Antigravity session. ${CLOSE_AND_RERUN}${e.code === 'EACCES' ? ' (EACCES can also mean you lack write permission on .claude/; if closing them changes nothing, check that.)' : ''} Your current engine was not touched.`
1348
+ ? `cannot replace ${enginePath} (${e.code}): another program is holding it open. ${CLOSE_AND_RERUN}${lockHolderGuidance(platform)}${e.code === 'EACCES' ? ' (EACCES can also mean you lack write permission on .claude/; if closing them changes nothing, check that.)' : ''} Your current engine was not touched.`
1336
1349
  : `cannot move the current engine aside — ${e.message}. Your current engine was not touched.`);
1337
1350
  }
1338
1351
  }
@@ -1782,5 +1795,6 @@ module.exports = {
1782
1795
  describeUpdateOutcome,
1783
1796
  requiredNextSteps,
1784
1797
  isLockError,
1798
+ lockHolderGuidance,
1785
1799
  installStagedEngine,
1786
1800
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindexed/cfact",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Clean Orthogonal Architecture Software Factory Framework",
5
5
  "bin": {
6
6
  "claude-factory": "bin/cfact.js",
@@ -86,6 +86,7 @@
86
86
  "test:feature-v2-switch": "node scripts/test-feature-v2-switch.js",
87
87
  "test:feature-completeness": "node scripts/test-feature-completeness.js",
88
88
  "test:feature-history": "node scripts/test-feature-history.js",
89
+ "test:feature-rekey": "node scripts/test-feature-rekey.js",
89
90
  "test:agent-note-dispatch": "node scripts/test-agent-note-dispatch.js",
90
91
  "test:check-record-text": "node scripts/test-check-record-text.js",
91
92
  "test:feature-write-guard": "node scripts/test-feature-write-guard.js",
@@ -122,13 +123,16 @@
122
123
  "test:pre-push-unit-ref": "node scripts/test-pre-push-unit-ref.js",
123
124
  "test:design-audit": "node scripts/test-design-audit.js",
124
125
  "test:grants-definer-declaration": "node scripts/test-grants-definer-declaration.js",
125
- "test": "npm run test:dc-generator && npm run test:substance-generator && npm run test:json-flush && npm run test:installer-exit && npm run test:installer-channel && npm run test:installer-update-messaging && npm run test:installer-wiring && npm run test:tar-invocation && npm run test:framework-agents-mcp && npm run test:controller-gates && npm run test:controller-single-file-attribution && npm run test:parse-ast && npm run test:git-tree-sweep && npm run test:secrets-two-stage && npm run test:migration-grants-check && npm run test:profile-paths && npm run test:registry-gate && npm run test:rule-resolver && npm run test:adr-template-edges && npm run test:adr-path-constants && npm run test:resolver-topology && npm run test:graph-strip && npm run test:graph-registry && npm run test:graph-memory-substrate && npm run test:document-freshness && npm run test:frontmatter-readers && npm run test:tarball-reproducible && npm run test:release-version && npm run test:consumer-checklist && npm run test:engine-host && npm run test:zone-coverage && npm run test:workflow-spine && npm run test:architecture-size-gate && npm run test:command-shape && npm run test:change-record && npm run test:engine-write-lock && npm run test:installer-publish-drift && npm run test:grants-authored && npm run test:test-capability && npm run test:installer-lifecycle && npm run test:gate-three-state && npm run test:refresh-compliance && npm run test:gate-coverage && npm run test:policy-lib && npm run test:validate-zone-denylist-bypass && npm run test:validate-zone-ledger-score && npm run test:rules-carrier-schema && npm run test:rule-record-schema && npm run test:rule-record-concerns-check && npm run test:external-standard-drift && npm run test:session-branch && npm run test:installer-shadowing && npm run test:feature-record && npm run test:feature-store && npm run test:feature-record-v2 && npm run test:feature-v2-switch && npm run test:feature-completeness && npm run test:feature-history && npm run test:agent-note-dispatch && npm run test:check-record-text && npm run test:consumer-docs-migration && npm run test:npm-deprecation && npm run test:sot-templates-pointer && npm run test:test-command-gate && npm run test:changelog-adr-refs && npm run test:generate-ci && npm run test:known-frictions-staleness && npm run test:artifact-timestamps && npm run test:generate-flow-map && npm run test:generate-zone-map && npm run test:generate-infra-map && npm run test:generate-erd && npm run test:surfaces-layerpaths && npm run test:surfaces-hostmodules && npm run test:list-feature-files && npm run test:feature-write-guard && npm run test:context-subject && npm run test:generate-project-analysis && npm run test:generate-feature-card && npm run test:generate-codex-agents && npm run test:generate-agent-cards && npm run test:generate-framework-graph && npm run test:unrecorded-scope && npm run test:profile-reinstated-zones && npm run test:contract-claims && npm run test:plan-crosscheck && npm run test:consumer-alignment && npm run test:check-consumer-alignment && npm run test:design-levels && npm run test:pre-push-unit-ref && npm run test:design-audit && npm run test:grants-definer-declaration",
126
+ "test:default-ship-pipeline": "node scripts/test-default-ship-pipeline.js",
127
+ "test:credential-slots": "node scripts/test-credential-slots.js",
128
+ "test": "npm run test:dc-generator && npm run test:substance-generator && npm run test:json-flush && npm run test:installer-exit && npm run test:installer-channel && npm run test:installer-update-messaging && npm run test:installer-wiring && npm run test:tar-invocation && npm run test:framework-agents-mcp && npm run test:controller-gates && npm run test:controller-single-file-attribution && npm run test:parse-ast && npm run test:git-tree-sweep && npm run test:secrets-two-stage && npm run test:migration-grants-check && npm run test:profile-paths && npm run test:registry-gate && npm run test:rule-resolver && npm run test:adr-template-edges && npm run test:adr-path-constants && npm run test:resolver-topology && npm run test:graph-strip && npm run test:graph-registry && npm run test:graph-memory-substrate && npm run test:document-freshness && npm run test:frontmatter-readers && npm run test:tarball-reproducible && npm run test:release-version && npm run test:consumer-checklist && npm run test:engine-host && npm run test:zone-coverage && npm run test:workflow-spine && npm run test:architecture-size-gate && npm run test:command-shape && npm run test:change-record && npm run test:engine-write-lock && npm run test:installer-publish-drift && npm run test:grants-authored && npm run test:test-capability && npm run test:installer-lifecycle && npm run test:gate-three-state && npm run test:refresh-compliance && npm run test:gate-coverage && npm run test:policy-lib && npm run test:validate-zone-denylist-bypass && npm run test:validate-zone-ledger-score && npm run test:rules-carrier-schema && npm run test:rule-record-schema && npm run test:rule-record-concerns-check && npm run test:external-standard-drift && npm run test:session-branch && npm run test:installer-shadowing && npm run test:feature-record && npm run test:feature-store && npm run test:feature-record-v2 && npm run test:feature-v2-switch && npm run test:feature-completeness && npm run test:feature-history && npm run test:feature-rekey && npm run test:agent-note-dispatch && npm run test:check-record-text && npm run test:consumer-docs-migration && npm run test:npm-deprecation && npm run test:sot-templates-pointer && npm run test:test-command-gate && npm run test:changelog-adr-refs && npm run test:generate-ci && npm run test:known-frictions-staleness && npm run test:artifact-timestamps && npm run test:generate-flow-map && npm run test:generate-zone-map && npm run test:generate-infra-map && npm run test:generate-legal-map && npm run test:generate-erd && npm run test:surfaces-layerpaths && npm run test:surfaces-hostmodules && npm run test:list-feature-files && npm run test:feature-write-guard && npm run test:context-subject && npm run test:generate-project-analysis && npm run test:generate-feature-card && npm run test:generate-codex-agents && npm run test:generate-agent-cards && npm run test:generate-framework-graph && npm run test:unrecorded-scope && npm run test:profile-reinstated-zones && npm run test:contract-claims && npm run test:plan-crosscheck && npm run test:consumer-alignment && npm run test:check-consumer-alignment && npm run test:design-levels && npm run test:pre-push-unit-ref && npm run test:design-audit && npm run test:grants-definer-declaration && npm run test:default-ship-pipeline && npm run test:credential-slots",
126
129
  "test:test-command-gate": "node scripts/test-test-command-gate.js",
127
130
  "test:changelog-adr-refs": "node scripts/test-changelog-adr-refs.js",
128
131
  "test:known-frictions-staleness": "node scripts/test-known-frictions-staleness.js",
129
132
  "test:generate-flow-map": "node scripts/test-generate-flow-map.js",
130
133
  "test:generate-zone-map": "node scripts/test-generate-zone-map.js",
131
134
  "test:generate-infra-map": "node scripts/test-generate-infra-map.js",
135
+ "test:generate-legal-map": "node scripts/test-generate-legal-map.js",
132
136
  "test:generate-agent-cards": "node scripts/test-generate-agent-cards.js",
133
137
  "test:generate-framework-graph": "node scripts/test-generate-framework-graph.js",
134
138
  "test:unrecorded-scope": "node scripts/test-unrecorded-scope.js",