@mindexed/cfact 1.1.15 → 1.1.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.
- package/bin/cfact.js +62 -11
- package/package.json +12 -2
package/bin/cfact.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* cfact — the installer front door for the PINNED, VENDORED engine.
|
|
4
4
|
*
|
|
5
5
|
* WHY THIS EXISTS (the third resolution mode — ADR-0093)
|
|
6
6
|
* ------------------------------------------------------
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
*
|
|
25
25
|
* WHAT IT DOES
|
|
26
26
|
* ------------
|
|
27
|
-
* init —
|
|
27
|
+
* init — create .claude in a git repository that has none (CHG-628), then
|
|
28
|
+
* materialise .claude/engine at a pinned version, then wire the
|
|
28
29
|
* consumer (pointer-symlinks, MCP entry, docs) via setup-local.sh
|
|
29
30
|
* in its --vendored-engine mode.
|
|
30
31
|
* update — re-materialise at a (new) pinned version and re-wire.
|
|
@@ -166,7 +167,7 @@ class DieError extends Error {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
function die(msg, code = 1) {
|
|
169
|
-
console.error(`❌
|
|
170
|
+
console.error(`❌ cfact: ${msg}`);
|
|
170
171
|
process.exitCode = code;
|
|
171
172
|
throw new DieError(msg, code);
|
|
172
173
|
}
|
|
@@ -285,6 +286,8 @@ Usage:
|
|
|
285
286
|
Materialises .claude/engine as REAL FILES at a pinned version (never a clone or
|
|
286
287
|
symlink of the private repo), then wires the consumer (pointer-symlinks, the
|
|
287
288
|
agentic-os MCP entry, the docs folder) via the engine's own setup-local.sh.
|
|
289
|
+
init creates .claude when the target is a git repository that has none; update, and
|
|
290
|
+
any other target without one, refuses.
|
|
288
291
|
|
|
289
292
|
Version & channel:
|
|
290
293
|
--version <v> engine version to pin to (e.g. 3.6). OPTIONAL — when
|
|
@@ -324,9 +327,9 @@ the DEFAULT — you do not have to pass --channel at all. Override it with
|
|
|
324
327
|
installer fetches <base>/cfact-engine-<version>.tar.gz. GitHub Releases is
|
|
325
328
|
the opt-in token-based fallback (--channel ${GITHUB_CHANNEL_LABEL}).
|
|
326
329
|
|
|
327
|
-
Run this from the CONSUMER directory, never from inside the
|
|
330
|
+
Run this from the CONSUMER directory, never from inside the cfact engine repo:
|
|
328
331
|
npm resolves the repo's own package.json bin entry there and reports
|
|
329
|
-
"'
|
|
332
|
+
"'cfact' is not recognized", which reads as a broken package. Passing an
|
|
330
333
|
explicit consumer path does NOT help — resolution happens before the path is read.
|
|
331
334
|
|
|
332
335
|
Forwarded to the engine's setup-local.sh (vendored mode):
|
|
@@ -1739,17 +1742,54 @@ function installStagedEngine({ enginePath, stageDir, tmpDir, fsImpl = fs, platfo
|
|
|
1739
1742
|
fsImpl.rmSync(backup, { recursive: true, force: true });
|
|
1740
1743
|
} catch (e) {
|
|
1741
1744
|
// The new engine is already in place; failing the run over a leftover would lie about what happened.
|
|
1742
|
-
console.warn(`⚠️
|
|
1745
|
+
console.warn(`⚠️ cfact: the update succeeded, but ${backup} could not be removed (${e.code || e.message}). Delete it by hand once nothing holds it open.`);
|
|
1743
1746
|
}
|
|
1744
1747
|
quietRm(tmpDir);
|
|
1745
1748
|
}
|
|
1746
1749
|
|
|
1747
1750
|
|
|
1751
|
+
// --- the consumer's .claude directory (CHG-628, FF-602) ----------------------
|
|
1752
|
+
// A fresh project has no .claude yet, so `init` creates it, but only where the
|
|
1753
|
+
// target is a git repository (its root: a `.git` entry, which is a file in a
|
|
1754
|
+
// linked worktree or submodule). `update` re-installs into an existing consumer
|
|
1755
|
+
// and never creates one. Returns true when the caller must create the directory,
|
|
1756
|
+
// false when a usable one exists, and dies naming the remedy otherwise.
|
|
1757
|
+
// lstat first, so a dangling `.claude` symlink is never mistaken for "missing"
|
|
1758
|
+
// and written through; a symlink that resolves to a directory is used as before.
|
|
1759
|
+
function claudeDirNeedsCreating(consumerRoot, command) {
|
|
1760
|
+
const claudeDir = path.join(consumerRoot, '.claude');
|
|
1761
|
+
let link = null;
|
|
1762
|
+
try {
|
|
1763
|
+
link = fs.lstatSync(claudeDir);
|
|
1764
|
+
} catch (e) {
|
|
1765
|
+
if (e.code !== 'ENOENT' && e.code !== 'ENOTDIR') die(`cannot inspect '${claudeDir}' — ${e.message}`);
|
|
1766
|
+
}
|
|
1767
|
+
if (link) {
|
|
1768
|
+
let usable = false;
|
|
1769
|
+
try { usable = fs.statSync(claudeDir).isDirectory(); } catch { /* dangling or unreadable link */ }
|
|
1770
|
+
if (!usable) {
|
|
1771
|
+
die(`'${claudeDir}' exists but is not a directory (a file, or a symlink that leads nowhere). Move or remove it, then re-run.`);
|
|
1772
|
+
}
|
|
1773
|
+
return false;
|
|
1774
|
+
}
|
|
1775
|
+
if (command !== 'init') {
|
|
1776
|
+
die(
|
|
1777
|
+
`'${claudeDir}' not found — update re-installs into a consumer that already has one. For a first ` +
|
|
1778
|
+
`install run \`npx @mindexed/cfact init\`, or run inside the consumer repo, or pass its path.`
|
|
1779
|
+
);
|
|
1780
|
+
}
|
|
1781
|
+
if (!fs.existsSync(path.join(consumerRoot, '.git'))) {
|
|
1782
|
+
die(
|
|
1783
|
+
`'${claudeDir}' not found, and '${consumerRoot}' is not the root of a git repository, so init does not ` +
|
|
1784
|
+
`create it. Run \`git init\` there first, or pass the consumer repo's path.`
|
|
1785
|
+
);
|
|
1786
|
+
}
|
|
1787
|
+
return true;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1748
1790
|
async function materialise(opts) {
|
|
1749
1791
|
const consumerRoot = path.resolve(opts.consumer || process.cwd());
|
|
1750
|
-
|
|
1751
|
-
die(`'${consumerRoot}/.claude' not found — run inside a consumer repo, or pass its path.`);
|
|
1752
|
-
}
|
|
1792
|
+
const createClaudeDir = claudeDirNeedsCreating(consumerRoot, opts.command);
|
|
1753
1793
|
const enginePath = path.join(consumerRoot, '.claude', 'engine');
|
|
1754
1794
|
|
|
1755
1795
|
// Never clobber a maintainer's live co-dev symlink (mode 1). That is a
|
|
@@ -1779,7 +1819,7 @@ async function materialise(opts) {
|
|
|
1779
1819
|
` If you really want the vendored engine here, remove the LINK first:\n` +
|
|
1780
1820
|
` ${removeCmd}\n` +
|
|
1781
1821
|
` ⚠️ Do NOT use a recursive delete (rm -rf / Remove-Item -Recurse). It can ` +
|
|
1782
|
-
`follow the link into the maintainer's
|
|
1822
|
+
`follow the link into the maintainer's engine clone and delete that ` +
|
|
1783
1823
|
`repo's contents instead of the link.\n` +
|
|
1784
1824
|
` Then confirm the clone is intact before re-running.`
|
|
1785
1825
|
);
|
|
@@ -1923,6 +1963,17 @@ async function materialise(opts) {
|
|
|
1923
1963
|
}
|
|
1924
1964
|
|
|
1925
1965
|
enforceRequires({ requires: resolveRequires(pin), stageDir, consumerRoot });
|
|
1966
|
+
// Created last, once the tarball is verified, so a refused run leaves no empty .claude. Not
|
|
1967
|
+
// recursive on purpose: anything that appeared at that path since the check (a symlink included)
|
|
1968
|
+
// fails here instead of being installed into.
|
|
1969
|
+
if (createClaudeDir) {
|
|
1970
|
+
try {
|
|
1971
|
+
fs.mkdirSync(path.join(consumerRoot, '.claude'));
|
|
1972
|
+
} catch (e) {
|
|
1973
|
+
die(`could not create '${path.join(consumerRoot, '.claude')}' — ${e.message}`);
|
|
1974
|
+
}
|
|
1975
|
+
info(' created .claude (a first install into a git repository)');
|
|
1976
|
+
}
|
|
1926
1977
|
installStagedEngine({ enginePath, stageDir, tmpDir });
|
|
1927
1978
|
|
|
1928
1979
|
// THE PIN RECORDS THE RELEASE THAT WAS FETCHED, NOT THE ENGINE'S MATRIX
|
|
@@ -2183,7 +2234,7 @@ if (require.main === module) {
|
|
|
2183
2234
|
// failing code, still WITHOUT a hard process.exit (same Windows-handle
|
|
2184
2235
|
// reason as die()).
|
|
2185
2236
|
if (e instanceof DieError) return;
|
|
2186
|
-
console.error(`❌
|
|
2237
|
+
console.error(`❌ cfact: ${e && e.stack ? e.stack : String(e)}`);
|
|
2187
2238
|
process.exitCode = 1;
|
|
2188
2239
|
});
|
|
2189
2240
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindexed/cfact",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "Clean Orthogonal Architecture Software Factory Framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claude-factory": "bin/cfact.js",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"test:engine-health": "node scripts/test-engine-health.js",
|
|
72
72
|
"test:attestation": "node scripts/test-attestation.js",
|
|
73
73
|
"test:verify-attestation": "node scripts/test-verify-attestation.js",
|
|
74
|
+
"test:store-resolver": "node scripts/test-store-resolver.js",
|
|
74
75
|
"test:node-floor": "node scripts/test-node-floor.js",
|
|
75
76
|
"test:session-binding-schema": "node scripts/test-session-binding-schema.js",
|
|
76
77
|
"test:budget-schema": "node scripts/test-budget-schema.js",
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
"test:zone-coverage": "node scripts/test-zone-coverage.js",
|
|
94
95
|
"test:workflow-spine": "node scripts/test-workflow-spine.js",
|
|
95
96
|
"test:architecture-size-gate": "node scripts/test-architecture-size-gate.js",
|
|
97
|
+
"test:unit-recorded-files": "node scripts/test-unit-recorded-files.js",
|
|
96
98
|
"test:size-gate-attribution": "node scripts/test-size-gate-attribution.js",
|
|
97
99
|
"test:command-shape": "node scripts/test-command-shape.js",
|
|
98
100
|
"test:change-record": "node scripts/test-change-record.js",
|
|
@@ -201,7 +203,8 @@
|
|
|
201
203
|
"test:grants-definer-declaration": "node scripts/test-grants-definer-declaration.js",
|
|
202
204
|
"test:default-ship-pipeline": "node scripts/test-default-ship-pipeline.js",
|
|
203
205
|
"test:credential-slots": "node scripts/test-credential-slots.js",
|
|
204
|
-
"test": "
|
|
206
|
+
"test:rls-schemas": "node scripts/test-rls-schemas.js",
|
|
207
|
+
"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:tresia-mcp-entry && 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:harmful-code && npm run test:migration-grants-check && npm run test:migration-append-only-check && npm run test:profile-paths && npm run test:registry-gate && npm run test:capability-schema && npm run test:integrations-registry && npm run test:claim-schema && npm run test:session-binding-schema && npm run test:budget-schema && npm run test:engine-health && npm run test:attestation && npm run test:verify-attestation && npm run test:node-floor && npm run test:runner-launch-schema && npm run test:approval-vocabulary && npm run test:human-only-verbs && 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-adr-cannot-evaluate && 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:engine-host && npm run test:zone-coverage && npm run test:workflow-spine && npm run test:architecture-size-gate && npm run test:unit-recorded-files && npm run test:size-gate-attribution && npm run test:command-shape && npm run test:change-record && npm run test:engine-write-lock && npm run test:engine-lock-wiring && npm run test:installer-publish-drift && npm run test:grants-authored && npm run test:test-capability && npm run test:installer-lifecycle && npm run test:outside-consumer-mcp-gate && npm run test:relay-fallback && npm run test:gate-three-state && npm run test:check-doc-links-vendored && 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:rule-record-core-check && npm run test:external-standard-drift && npm run test:session-branch && npm run test:installer-shadowing && npm run test:installer-latest && npm run test:feature-record && npm run test:feature-store && npm run test:feature-store-port && npm run test:approval-hash && npm run test:write-contract && npm run test:write-field && npm run test:record-hash && npm run test:id-floor-contract && npm run test:feature-field-classes && npm run test:bench-store-read && npm run test:feature-store-samples && npm run test:sync-relay-quiet && npm run test:sync-relay-cli && npm run test:feature-record-v2 && npm run test:feature-initial && npm run test:feature-v2-switch && npm run test:fresh-project-mint-layout && npm run test:feature-completeness && npm run test:experience-context && npm run test:feature-scope-merge && npm run test:feature-mint-contract && npm run test:org-manifest && npm run test:org-manifest-denies && npm run test:intake-seed && npm run test:intake-seed-prefill && npm run test:design-brief-from-seed && npm run test:design-brief-regeneration && npm run test:audit-sot-brand-source && npm run test:audit-sot-surfaces && npm run test:audit-sot-tenancy-model && npm run test:audit-sot-completeness && npm run test:audit-sot-placeholder && npm run test:sot-ladder && npm run test:sot-design-promotion && npm run test:screen-binding && npm run test:flow-step-action && npm run test:feature-history && npm run test:feature-rekey && npm run test:agent-note-dispatch && npm run test:subagent-reply-guard && npm run test:migrations-block && npm run test:stage-loop-next-action && npm run test:transition-phase-flags && npm run test:workflow-flag-allowlist && npm run test:check-record-text &&npm run test:consumer-docs-migration && npm run test:sot-templates-pointer && npm run test:sot-template-schemas && npm run test:test-command-gate && npm run test:changelog-adr-refs && npm run test:generate-ci && npm run test:verification-targets && npm run test:known-frictions-staleness && npm run test:generate-known-frictions && npm run test:artifact-timestamps && npm run test:regen-writes-nothing && npm run test:map-fingerprint && npm run test:derived-map-contract && 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:three-state-reads && npm run test:list-feature-files && npm run test:feature-write-guard && npm run test:feature-write-lock && npm run test:trailer-lib && npm run test:ci-parity && npm run test:context-subject && npm run test:generate-project-analysis && npm run test:generate-feature-card && npm run test:zone-view && npm run test:generate-codex-agents && npm run test:generate-agent-cards && npm run test:generate-capability-map && npm run test:capability-catalogue-gate && npm run test:generate-framework-graph && npm run test:unrecorded-scope && npm run test:profile-reinstated-zones && npm run test:sot-zone-path-override && 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:pre-push-gate-reach && npm run test:git-identity-check && npm run test:mcp-server-name-constant && npm run test:design-audit && npm run test:grants-definer-declaration && npm run test:default-ship-pipeline && npm run test:credential-slots && npm run test:rls-schemas && npm run test:licence-holder && npm run test:engine-promotion-rungs-workflow && npm run test:engine-release-workflows && npm run test:split-acceptance && npm run test:private-names && npm run test:migrate-feature-records && npm run test:depends-on-enforcement && npm run test:v2-depends-on && npm run test:record-artifacts-removal && npm run test:feature-queue && npm run test:design-approval-completeness && npm run test:approach-task-shape && npm run test:record-caps-all-at-once && npm run test:local-stack-probe && npm run test:machine-sessions && npm run test:integration-adapters && npm run test:sync-env-registry && npm run test:sot-store && npm run test:env-mapping && npm run test:design-audit-gate && npm run test:candidate-flows && npm run test:design-motion-audit && npm run test:design-screens && npm run test:feature-source-notes && npm run test:code-review-log-schema && npm run test:note-alignment && npm run test:design-motion-inputs && npm run test:requirement-promotion && npm run test:programme-note-admission && npm run test:ux-baseline && npm run test:note-promotion-gate && npm run test:proposal-acceptance-mint && npm run test:maintainer-screen-judge && npm run test:ux-qa-review-gate && npm run test:ui-touch-import-only && npm run test:git-lock && npm run test:hook-blocking-exit-code && npm run test:depends-on-revision-form && npm run test:dependency-edit-keeps-approval && npm run test:add-subtopic && npm run test:zone-entry-merge && npm run test:revision-flag-agreement && npm run test:workflow-capabilities && npm run test:workflow-verb-state && npm run test:run-test-chain && npm run test:check-workflows && npm run test:subtopic-origin-narrowing && npm run test:record-artifacts-status-and-unit && npm run test:evidence-owed-and-no-change && npm run test:recorded-by-feat-qualified && npm run test:git-committed-claims-and-renames && npm run test:sot-amendment && npm run test:audit-sot-out-idempotent && npm run test:wiring-check && npm run test:escalation-dedupe && npm run test:failure-attribution && npm run test:record-note-retraction && npm run test:delegate-config-reader && npm run test:delegate-exemption && npm run test:org-provenance && npm run test:moved-tool-docs && npm run test:engine-release && npm run test:tresia-manifest && npm run test:pin-requires && npm run test:store-protocol && npm run test:feature-store-acyclic && npm run test:store-resolver && npm run test:state-reader-slice && npm run test:child-process-store && npm run test:store-bypass-probe && npm run test:withdraw-revision && npm run test:workflow-events-store && npm run test:agent-on-grant-guidance && npm run test:plan-commands-ask-first && npm run test:tracking-state-matches-prose && npm run test:electron-shell-zones",
|
|
205
208
|
"test:test-command-gate": "node scripts/test-test-command-gate.js",
|
|
206
209
|
"test:changelog-adr-refs": "node scripts/test-changelog-adr-refs.js",
|
|
207
210
|
"test:known-frictions-staleness": "node scripts/test-known-frictions-staleness.js",
|
|
@@ -250,6 +253,8 @@
|
|
|
250
253
|
"test:machine-sessions": "node scripts/test-machine-sessions.js",
|
|
251
254
|
"test:integration-adapters": "node scripts/test-integration-adapters.js",
|
|
252
255
|
"test:sync-env-registry": "node scripts/test-sync-env-registry.js",
|
|
256
|
+
"test:sot-store": "node scripts/test-sot-store.js",
|
|
257
|
+
"test:env-mapping": "node scripts/test-env-mapping.js",
|
|
253
258
|
"test:design-audit-gate": "node scripts/test-design-audit-gate.js",
|
|
254
259
|
"test:candidate-flows": "node scripts/test-candidate-flows.js",
|
|
255
260
|
"test:design-motion-audit": "node scripts/test-design-motion-audit.js",
|
|
@@ -277,10 +282,15 @@
|
|
|
277
282
|
"test:failure-attribution": "node scripts/test-failure-attribution.js",
|
|
278
283
|
"test:tresia-manifest": "node scripts/test-tresia-manifest.js",
|
|
279
284
|
"test:write-field": "node scripts/test-write-field.js",
|
|
285
|
+
"test:record-hash": "node scripts/test-record-hash.js",
|
|
280
286
|
"test:pin-requires": "node scripts/test-pin-requires.js",
|
|
281
287
|
"test:store-protocol": "node scripts/test-store-protocol.js",
|
|
282
288
|
"test:feature-store-acyclic": "node scripts/test-feature-store-acyclic.js",
|
|
283
289
|
"test:state-reader-slice": "node scripts/test-state-reader-slice.js",
|
|
290
|
+
"test:child-process-store": "node scripts/test-child-process-store.js",
|
|
291
|
+
"test:store-bypass-probe": "node scripts/test-store-bypass-probe.js",
|
|
292
|
+
"test:withdraw-revision": "node scripts/test-withdraw-revision.js",
|
|
293
|
+
"test:workflow-events-store": "node scripts/test-workflow-events-store.js",
|
|
284
294
|
"test:record-note-retraction": "node scripts/test-record-note-retraction.js",
|
|
285
295
|
"test:proposal-acceptance-mint": "node scripts/test-proposal-acceptance-mint.js",
|
|
286
296
|
"test:maintainer-screen-judge": "node scripts/test-maintainer-screen-judge.js",
|