@ornexus/neocortex 4.60.68 → 4.60.70
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/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1194 -1194
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +3 -3
- package/packages/client/dist/adapters/adapter-registry.js +1 -108
- package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
- package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
- package/packages/client/dist/adapters/codex-adapter.js +2 -80
- package/packages/client/dist/adapters/cursor-adapter.js +4 -115
- package/packages/client/dist/adapters/gemini-adapter.js +2 -71
- package/packages/client/dist/adapters/grok-adapter.js +2 -42
- package/packages/client/dist/adapters/index.js +1 -22
- package/packages/client/dist/adapters/platform-detector.js +1 -212
- package/packages/client/dist/adapters/target-adapter.js +0 -12
- package/packages/client/dist/adapters/vscode-adapter.js +2 -72
- package/packages/client/dist/agent/refresh-stubs.js +2 -417
- package/packages/client/dist/agent/update-agent-yaml.js +1 -102
- package/packages/client/dist/agent/update-description.js +1 -251
- package/packages/client/dist/cache/crypto-utils.js +1 -78
- package/packages/client/dist/cache/encrypted-cache.js +1 -108
- package/packages/client/dist/cache/in-memory-asset-cache.js +1 -73
- package/packages/client/dist/cache/index.js +1 -13
- package/packages/client/dist/cache/protected-pi-boundary.js +1 -44
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -127
- package/packages/client/dist/checkpoint/index.js +1 -11
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -32
- package/packages/client/dist/cli.js +3 -290
- package/packages/client/dist/commands/activate.js +8 -394
- package/packages/client/dist/commands/architecture-answers.js +7 -274
- package/packages/client/dist/commands/architecture-memory-terminal.js +4 -253
- package/packages/client/dist/commands/architecture-non-ui-continuation.js +1 -100
- package/packages/client/dist/commands/architecture-root-binding.js +1 -51
- package/packages/client/dist/commands/cache-status.js +2 -112
- package/packages/client/dist/commands/config.js +1 -88
- package/packages/client/dist/commands/doctor.js +2 -635
- package/packages/client/dist/commands/invoke.d.ts +6 -0
- package/packages/client/dist/commands/invoke.js +142 -7140
- package/packages/client/dist/commands/legacy-epic-terminal.js +1 -71
- package/packages/client/dist/commands/legacy-story-branch.js +1 -96
- package/packages/client/dist/commands/legacy-story-pr.js +1 -276
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -285
- package/packages/client/dist/commands/mutation-qa-gate.js +1 -54
- package/packages/client/dist/commands/mutation-qa-git.js +1 -41
- package/packages/client/dist/commands/mutation-qa-policy.js +1 -102
- package/packages/client/dist/commands/mutation-qa-run.js +3 -219
- package/packages/client/dist/commands/mutation-qa-verdict.js +1 -149
- package/packages/client/dist/commands/mutation-qa.js +1 -220
- package/packages/client/dist/commands/native-agent.js +2 -136
- package/packages/client/dist/commands/planning-diagnosis.js +1 -43
- package/packages/client/dist/commands/planning-generation.js +1 -53
- package/packages/client/dist/commands/planning-memory.js +1 -40
- package/packages/client/dist/commands/planning-research.js +1 -42
- package/packages/client/dist/commands/private-session.js +1 -75
- package/packages/client/dist/commands/property-qa.js +1 -139
- package/packages/client/dist/commands/qa-control.js +1 -16
- package/packages/client/dist/commands/qa-scan-browser-launch.js +1 -55
- package/packages/client/dist/commands/qa-scan-browser-route.js +1 -28
- package/packages/client/dist/commands/qa-scan-capture.js +5 -663
- package/packages/client/dist/commands/qa-scan-discovery.js +3 -376
- package/packages/client/dist/commands/qa-scan-review.js +5 -826
- package/packages/client/dist/commands/qa-synthetic-backend-capture.js +1 -266
- package/packages/client/dist/commands/qa-synthetic-backend-review.js +1 -297
- package/packages/client/dist/commands/qa-synthetic-backend.js +2 -340
- package/packages/client/dist/commands/qa-synthetic-broker-port.js +1 -85
- package/packages/client/dist/commands/qa-synthetic-browser.js +1 -39
- package/packages/client/dist/commands/refactor-characterization.js +21 -671
- package/packages/client/dist/commands/refactor-commit.js +13 -399
- package/packages/client/dist/commands/refactor-control.js +3 -142
- package/packages/client/dist/commands/refactor-cpp-assertions.js +3 -93
- package/packages/client/dist/commands/refactor-review.js +5 -283
- package/packages/client/dist/commands/refactor-root.js +7 -588
- package/packages/client/dist/commands/refresh-memory.js +3 -156
- package/packages/client/dist/commands/shared-architecture-non-ui.js +1 -24
- package/packages/client/dist/commands/story-checkpoint.js +1 -171
- package/packages/client/dist/config/profile-directory.js +1 -13
- package/packages/client/dist/config/resolver-selection.js +1 -278
- package/packages/client/dist/config/secure-config.js +12 -281
- package/packages/client/dist/config.js +2 -223
- package/packages/client/dist/constants.js +1 -25
- package/packages/client/dist/context/context-collector.js +2 -222
- package/packages/client/dist/context/context-sanitizer.js +1 -145
- package/packages/client/dist/continuity/autonomous-governance.js +1 -285
- package/packages/client/dist/continuity/continuity-client-state-store.js +1 -1587
- package/packages/client/dist/continuity/invoke-hooks.js +1 -129
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +2 -12
- package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +2 -12
- package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +2 -12
- package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +2 -12
- package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +2 -12
- package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +2 -10
- package/packages/client/dist/continuity/native-agent-store.js +1 -69
- package/packages/client/dist/continuity/native-agent-types.js +1 -90
- package/packages/client/dist/continuity/outbox.js +1 -117
- package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -172
- package/packages/client/dist/continuity/sqlite-store.js +81 -2536
- package/packages/client/dist/effects/invoke-effect-gateways.js +1 -62
- package/packages/client/dist/errors/error-messages.js +2 -228
- package/packages/client/dist/errors/frontmatter-diagnostics.js +1 -125
- package/packages/client/dist/evidence/collector.js +1 -347
- package/packages/client/dist/evidence/index.js +1 -1
- package/packages/client/dist/evidence/types.js +0 -2
- package/packages/client/dist/fs/atomic-state-replace.js +1 -152
- package/packages/client/dist/generated/command-registry.generated.js +1 -4076
- package/packages/client/dist/generated/public-projections.generated.js +1 -149
- package/packages/client/dist/git/direct-yolo-c01-retry.js +4 -138
- package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -1234
- package/packages/client/dist/git/git-lifecycle-step-ids.js +1 -14
- package/packages/client/dist/git/git-lifecycle-store.js +9 -1938
- package/packages/client/dist/git/legacy-story-branch-checkpoint.js +9 -259
- package/packages/client/dist/git/legacy-story-branch-setup.js +4 -348
- package/packages/client/dist/git/legacy-story-pr.js +70 -3538
- package/packages/client/dist/git/secure-filesystem-boundary.js +5 -182
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -284
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -237
- package/packages/client/dist/i18n/first-run.js +2 -60
- package/packages/client/dist/index.js +1 -47
- package/packages/client/dist/invocation/invoke-input.js +1 -24
- package/packages/client/dist/license/index.js +1 -5
- package/packages/client/dist/license/license-client.js +1 -304
- package/packages/client/dist/machine/fingerprint.js +2 -163
- package/packages/client/dist/machine/index.js +1 -5
- package/packages/client/dist/memory/project-memory-path-scope.js +1 -62
- package/packages/client/dist/memory/project-memory-writer.js +40 -1007
- package/packages/client/dist/memory/shared-project-memory-types.js +2 -253
- package/packages/client/dist/migrations/project-identity-capability.js +1 -50
- package/packages/client/dist/migrations/project-identity.js +7 -493
- package/packages/client/dist/migrations/state-json.js +4 -344
- package/packages/client/dist/policy/architecture-policy.js +2 -184
- package/packages/client/dist/policy/index.js +1 -7
- package/packages/client/dist/policy/shared-policy-types.js +0 -38
- package/packages/client/dist/policy/subagent-approval-policy.js +1 -55
- package/packages/client/dist/private-execution/clean-baseline.js +2 -279
- package/packages/client/dist/private-execution/codex-executor.js +4 -574
- package/packages/client/dist/private-execution/codex-host-runtime.js +1 -137
- package/packages/client/dist/private-execution/codex-lifecycle-guard.js +1 -97
- package/packages/client/dist/private-execution/codex-scoped-permissions.js +1 -128
- package/packages/client/dist/private-execution/delivery.js +13 -410
- package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -294
- package/packages/client/dist/private-execution/frozen-handoff.js +6 -19
- package/packages/client/dist/private-execution/implementation-validation.js +2 -106
- package/packages/client/dist/private-execution/isolated-admission.js +23 -1432
- package/packages/client/dist/private-execution/isolated-session.js +5 -725
- package/packages/client/dist/private-execution/isolated-workspace.js +1 -122
- package/packages/client/dist/private-execution/pact-consumer-runtime.js +3 -409
- package/packages/client/dist/private-execution/pact-test-source.js +1 -258
- package/packages/client/dist/private-execution/pact-toolchain.js +3 -290
- package/packages/client/dist/private-execution/pact-write-set.js +1 -172
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -406
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +5 -462
- package/packages/client/dist/private-execution/planning-memory-checkpoint.js +3 -139
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -325
- package/packages/client/dist/private-execution/private-report-store.js +1 -42
- package/packages/client/dist/private-execution/property-test-candidate.js +1 -103
- package/packages/client/dist/private-execution/property-test-choices.js +3 -147
- package/packages/client/dist/private-execution/property-test-plan.js +7 -271
- package/packages/client/dist/private-execution/property-test-review.js +4 -258
- package/packages/client/dist/private-execution/property-test-runtime.js +9 -372
- package/packages/client/dist/private-execution/property-test-source.js +1 -139
- package/packages/client/dist/private-execution/root-checkpoint.js +1 -80
- package/packages/client/dist/private-execution/root-memory-git-evidence.js +3 -135
- package/packages/client/dist/private-execution/root-memory-recovery.js +1 -93
- package/packages/client/dist/private-execution/root-memory-request.js +1 -29
- package/packages/client/dist/private-execution/root-memory-scope.js +1 -178
- package/packages/client/dist/private-execution/root-memory-writer.js +1 -102
- package/packages/client/dist/private-execution/session-lease.js +1 -63
- package/packages/client/dist/private-execution/shared-private-admission-types.js +1 -50
- package/packages/client/dist/private-execution/shared-project-validation.js +1 -66
- package/packages/client/dist/private-execution/shared-root-memory-types.js +1 -61
- package/packages/client/dist/private-execution/ux-source-validation.js +1 -372
- package/packages/client/dist/private-execution/ux-write-set.js +2 -191
- package/packages/client/dist/resilience/circuit-breaker.js +1 -170
- package/packages/client/dist/resilience/degradation-manager.js +1 -164
- package/packages/client/dist/resilience/freshness-indicator.js +1 -100
- package/packages/client/dist/resilience/index.js +1 -8
- package/packages/client/dist/resilience/recovery-detector.js +1 -74
- package/packages/client/dist/resolvers/asset-resolver.js +0 -13
- package/packages/client/dist/resolvers/local-resolver.js +8 -255
- package/packages/client/dist/resolvers/remote-resolver.js +1 -233
- package/packages/client/dist/runner/binary.js +1 -404
- package/packages/client/dist/runner/cli.js +17 -1571
- package/packages/client/dist/runner/headless/adapters.js +1 -49
- package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -79
- package/packages/client/dist/runner/headless/continuous-story-workspace.js +11 -1628
- package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +1 -69
- package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +2 -110
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +8 -1236
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +2 -318
- package/packages/client/dist/runner/headless/fake-adapter.js +1 -62
- package/packages/client/dist/runner/headless/managed-profile.js +1 -132
- package/packages/client/dist/runner/headless/opencode-adapter.js +2 -145
- package/packages/client/dist/runner/headless/prepared-story-bundle.js +1 -43
- package/packages/client/dist/runner/headless/resolver.js +1 -231
- package/packages/client/dist/runner/headless/run-yolo.js +1 -885
- package/packages/client/dist/runner/headless/run-yoloop.js +2 -2574
- package/packages/client/dist/runner/headless/types.js +2 -574
- package/packages/client/dist/runner/local-console.js +13 -396
- package/packages/client/dist/runner/portal-sync-worker.js +1 -1487
- package/packages/client/dist/runner/project-identity.js +1 -106
- package/packages/client/dist/runner/scheduler.js +7 -995
- package/packages/client/dist/runner-cli.js +2 -18
- package/packages/client/dist/state/invocation-shape.js +1 -13
- package/packages/client/dist/state/project-state-snapshot.js +1 -1677
- package/packages/client/dist/state/state-json-repair.js +3 -785
- package/packages/client/dist/state/structural-dag-projection.js +1 -118
- package/packages/client/dist/telemetry/index.js +1 -5
- package/packages/client/dist/telemetry/offline-queue.js +1 -131
- package/packages/client/dist/tier/index.js +1 -5
- package/packages/client/dist/tier/tier-aware-client.js +1 -405
- package/packages/client/dist/types/index.js +1 -38
- package/packages/client/dist/version.js +1 -27
- package/packages/client/dist/yolo/change-evidence-collector.js +1 -126
- package/packages/client/dist/yolo/invoke-envelope-capability.js +1 -62
- package/packages/client/dist/yolo/spec-envelope-collector.js +5 -185
- package/packages/client/dist/yoloop/discovery-hook.js +2 -300
- package/packages/client/dist/yoloop/index.js +1 -8
- package/packages/client/dist/yoloop/invoke-hooks.js +12 -669
- package/packages/client/dist/yoloop/shared-discover-epics.js +1 -1007
- package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -33
- package/packages/client/dist/yoloop/target-normalization.js +1 -180
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1723
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +1 -1
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +2 -2
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +2 -2
- package/targets-stubs/codex/AGENTS.md +1 -1
- package/targets-stubs/cursor/agent.md +2 -2
- package/targets-stubs/gemini-cli/agent.md +2 -2
- package/targets-stubs/opencode/neocortex-root.md +1 -1
- package/targets-stubs/vscode/neocortex.agent.md +2 -2
|
@@ -1,127 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Reads `.neocortex/checkpoint-pending.json` (written by agent per P109.04
|
|
5
|
-
* step prompt instructions), validates shape against ImplementCheckpointSnapshot
|
|
6
|
-
* (P109.02), and consumes (deletes) the file to prevent re-send.
|
|
7
|
-
*
|
|
8
|
-
* Cross-refs: P107.02 (architecture-policy reader pattern), P101.06 (atomic
|
|
9
|
-
* file ops), P63.01 (UTF-8 BOM strip), P103.06 (CRLF normalize).
|
|
10
|
-
*/
|
|
11
|
-
import { promises as fs } from 'node:fs';
|
|
12
|
-
import path from 'node:path';
|
|
13
|
-
import { MAX_SNAPSHOT_SIZE_BYTES } from './shared-checkpoint-types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Canonical pending-checkpoint path (relative to projectRoot).
|
|
16
|
-
* Matches P109.04 step prompt instruction literal.
|
|
17
|
-
*/
|
|
18
|
-
export const CHECKPOINT_PENDING_PATH = '.neocortex/checkpoint-pending.json';
|
|
19
|
-
/**
|
|
20
|
-
* Size buffer over the server-enforced MAX_SNAPSHOT_SIZE_BYTES to account for
|
|
21
|
-
* JSON structural overhead (field names, quotes, commas). Guards against
|
|
22
|
-
* pathological huge files before parse attempts.
|
|
23
|
-
*/
|
|
24
|
-
const SIZE_BUFFER_BYTES = 10000;
|
|
25
|
-
const VALID_PHASES = ['FASE_1', 'FASE_2', 'FASE_3', 'FASE_4'];
|
|
26
|
-
/**
|
|
27
|
-
* Pure validation (zero I/O). Deterministic.
|
|
28
|
-
*
|
|
29
|
-
* Checks all required fields of ImplementCheckpointSnapshot shape. Extra fields
|
|
30
|
-
* are ignored (forward-compat). Does NOT enforce MAX_SNAPSHOT_SIZE_BYTES on
|
|
31
|
-
* snapshotMd length -- that is the reader's responsibility and server's
|
|
32
|
-
* final truncation (P109.06).
|
|
33
|
-
*/
|
|
34
|
-
export function validateSnapshot(candidate) {
|
|
35
|
-
if (candidate === null || typeof candidate !== 'object') {
|
|
36
|
-
return { valid: false, errors: ['payload must be object'] };
|
|
37
|
-
}
|
|
38
|
-
const obj = candidate;
|
|
39
|
-
const errors = [];
|
|
40
|
-
if (typeof obj.storyId !== 'string' || obj.storyId.length === 0) {
|
|
41
|
-
errors.push('storyId must be non-empty string');
|
|
42
|
-
}
|
|
43
|
-
if (typeof obj.turn !== 'number' || !Number.isFinite(obj.turn) || obj.turn < 0) {
|
|
44
|
-
errors.push('turn must be non-negative finite number');
|
|
45
|
-
}
|
|
46
|
-
if (!Array.isArray(obj.filesModified) ||
|
|
47
|
-
!obj.filesModified.every((x) => typeof x === 'string')) {
|
|
48
|
-
errors.push('filesModified must be string[]');
|
|
49
|
-
}
|
|
50
|
-
if (!Array.isArray(obj.testsModified) ||
|
|
51
|
-
!obj.testsModified.every((x) => typeof x === 'string')) {
|
|
52
|
-
errors.push('testsModified must be string[]');
|
|
53
|
-
}
|
|
54
|
-
if (typeof obj.currentPhase !== 'string' ||
|
|
55
|
-
!VALID_PHASES.includes(obj.currentPhase)) {
|
|
56
|
-
errors.push(`currentPhase must be one of ${VALID_PHASES.join('|')}`);
|
|
57
|
-
}
|
|
58
|
-
if (typeof obj.snapshotMd !== 'string') {
|
|
59
|
-
errors.push('snapshotMd must be string');
|
|
60
|
-
}
|
|
61
|
-
return { valid: errors.length === 0, errors: Object.freeze(errors) };
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Read + validate + consume (delete) the pending checkpoint file.
|
|
65
|
-
*
|
|
66
|
-
* Fail-soft contract:
|
|
67
|
-
* - ENOENT (common case -- no checkpoint pending) -> undefined, silent.
|
|
68
|
-
* - Any other read error -> undefined + console.warn.
|
|
69
|
-
* - Malformed JSON or schema invalid -> undefined + console.warn.
|
|
70
|
-
* - Oversized file -> undefined + console.warn.
|
|
71
|
-
* - Unlink failure -> caller still receives snapshot; warn logged.
|
|
72
|
-
*
|
|
73
|
-
* **File consume is critical (AC4)**: after first successful read (regardless
|
|
74
|
-
* of validation outcome), the file is deleted to prevent re-send on next
|
|
75
|
-
* invoke. This avoids infinite checkpoint-loop scenarios from malformed
|
|
76
|
-
* agent-produced content.
|
|
77
|
-
*/
|
|
78
|
-
export async function readAndConsumeCheckpoint(projectRoot) {
|
|
79
|
-
const fullPath = path.join(projectRoot, CHECKPOINT_PENDING_PATH);
|
|
80
|
-
let raw;
|
|
81
|
-
try {
|
|
82
|
-
raw = await fs.readFile(fullPath, 'utf-8');
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
if (err.code === 'ENOENT') {
|
|
86
|
-
// Common case: no checkpoint pending. Silent (zero warn).
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
// eslint-disable-next-line no-console
|
|
90
|
-
console.warn(`[Neocortex] checkpoint read failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
// Consume before returning so the enclosing capability drains the physical
|
|
94
|
-
// unlink before an invocation receipt can complete.
|
|
95
|
-
try {
|
|
96
|
-
await fs.unlink(fullPath);
|
|
97
|
-
}
|
|
98
|
-
catch (unlinkErr) {
|
|
99
|
-
// eslint-disable-next-line no-console
|
|
100
|
-
console.warn(`[Neocortex] checkpoint unlink failed: ${unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr)}`);
|
|
101
|
-
}
|
|
102
|
-
// Encoding defense: BOM strip (P63.01) + CRLF normalize (P103.06).
|
|
103
|
-
const normalized = raw.replace(/^/, '').replace(/\r\n/g, '\n');
|
|
104
|
-
// Size guard (AC5): reject pathologically large files before parse.
|
|
105
|
-
if (normalized.length > MAX_SNAPSHOT_SIZE_BYTES + SIZE_BUFFER_BYTES) {
|
|
106
|
-
// eslint-disable-next-line no-console
|
|
107
|
-
console.warn(`[Neocortex] checkpoint oversized (${normalized.length} bytes), skipping`);
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
let parsed;
|
|
111
|
-
try {
|
|
112
|
-
parsed = JSON.parse(normalized);
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
// eslint-disable-next-line no-console
|
|
116
|
-
console.warn(`[Neocortex] checkpoint malformed JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
const validation = validateSnapshot(parsed);
|
|
120
|
-
if (!validation.valid) {
|
|
121
|
-
// eslint-disable-next-line no-console
|
|
122
|
-
console.warn(`[Neocortex] checkpoint schema invalid: ${validation.errors.join('; ')}`);
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
// Safe to cast after validation.
|
|
126
|
-
return parsed;
|
|
127
|
-
}
|
|
1
|
+
import{promises as a}from"node:fs";import f from"node:path";import{MAX_SNAPSHOT_SIZE_BYTES as u}from"./shared-checkpoint-types.js";const d=".neocortex/checkpoint-pending.json",p=1e4,c=["FASE_1","FASE_2","FASE_3","FASE_4"];function l(o){if(o===null||typeof o!="object")return{valid:!1,errors:["payload must be object"]};const e=o,n=[];return(typeof e.storyId!="string"||e.storyId.length===0)&&n.push("storyId must be non-empty string"),(typeof e.turn!="number"||!Number.isFinite(e.turn)||e.turn<0)&&n.push("turn must be non-negative finite number"),(!Array.isArray(e.filesModified)||!e.filesModified.every(t=>typeof t=="string"))&&n.push("filesModified must be string[]"),(!Array.isArray(e.testsModified)||!e.testsModified.every(t=>typeof t=="string"))&&n.push("testsModified must be string[]"),(typeof e.currentPhase!="string"||!c.includes(e.currentPhase))&&n.push(`currentPhase must be one of ${c.join("|")}`),typeof e.snapshotMd!="string"&&n.push("snapshotMd must be string"),{valid:n.length===0,errors:Object.freeze(n)}}async function y(o){const e=f.join(o,d);let n;try{n=await a.readFile(e,"utf-8")}catch(r){if(r.code==="ENOENT")return;console.warn(`[Neocortex] checkpoint read failed: ${r instanceof Error?r.message:String(r)}`);return}try{await a.unlink(e)}catch(r){console.warn(`[Neocortex] checkpoint unlink failed: ${r instanceof Error?r.message:String(r)}`)}const t=n.replace(/^/,"").replace(/\r\n/g,`
|
|
2
|
+
`);if(t.length>u+p){console.warn(`[Neocortex] checkpoint oversized (${t.length} bytes), skipping`);return}let i;try{i=JSON.parse(t)}catch(r){console.warn(`[Neocortex] checkpoint malformed JSON: ${r instanceof Error?r.message:String(r)}`);return}const s=l(i);if(!s.valid){console.warn(`[Neocortex] checkpoint schema invalid: ${s.errors.join("; ")}`);return}return i}export{d as CHECKPOINT_PENDING_PATH,y as readAndConsumeCheckpoint,l as validateSnapshot};
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Epic P109.05: Checkpoint client-side module barrel.
|
|
3
|
-
*
|
|
4
|
-
* Exports the fail-soft reader + validator + canonical path const.
|
|
5
|
-
* Re-exports wire-format types from local SSoT-Shadow inline (P117.01) so
|
|
6
|
-
* the published client tarball never references `@neocortex/shared` at
|
|
7
|
-
* runtime. Type identity stays in sync with `@neocortex/shared` via
|
|
8
|
-
* `checkpoint-shared-sync.test.ts` drift test.
|
|
9
|
-
*/
|
|
10
|
-
export * from './checkpoint-client-reader.js';
|
|
11
|
-
export { MAX_SNAPSHOT_SIZE_BYTES } from './shared-checkpoint-types.js';
|
|
1
|
+
export*from"./checkpoint-client-reader.js";import{MAX_SNAPSHOT_SIZE_BYTES as _}from"./shared-checkpoint-types.js";export{_ as MAX_SNAPSHOT_SIZE_BYTES};
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* P117.01: Inlined byte-identical types from `@neocortex/shared/checkpoints`.
|
|
3
|
-
*
|
|
4
|
-
* SSoT-Shadow pattern (P92.01 server precedent — server `shared-types.ts` does
|
|
5
|
-
* the same for tier-config). Client tarball is published standalone via
|
|
6
|
-
* `@ornexus/neocortex` and does NOT include `@neocortex/shared` as a runtime
|
|
7
|
-
* dependency (workspace package, excluded from tarball per `.npmignore` +
|
|
8
|
-
* `tsconfig.build.json`). Any non-erased import of `@neocortex/shared` in
|
|
9
|
-
* `packages/client/dist/**` causes runtime `ERR_MODULE_NOT_FOUND` on globally
|
|
10
|
-
* installed `@ornexus/neocortex`.
|
|
11
|
-
*
|
|
12
|
-
* Live regression reproduced 2026-04-25 (Epic P117 origin):
|
|
13
|
-
* `[Neocortex] checkpoint hook failed: Cannot find package '@neocortex/shared'
|
|
14
|
-
* imported from .../checkpoint/checkpoint-client-reader.js. Proceeding without
|
|
15
|
-
* checkpoint.`
|
|
16
|
-
*
|
|
17
|
-
* Sync responsibility: `shared-types-sync.test.ts` (P117.01 describe block) +
|
|
18
|
-
* `checkpoint-shared-sync.test.ts` (client-side drift test). Drift test fails
|
|
19
|
-
* CI if these diverge from SSoT.
|
|
20
|
-
*
|
|
21
|
-
* Defense-in-depth: `validate-pre-publish.js` ships
|
|
22
|
-
* `validateClientNoSharedImport()` (P117.01) scanning client dist for
|
|
23
|
-
* `@neocortex/shared` runtime references — match = exit 1 (publish blocked).
|
|
24
|
-
*
|
|
25
|
-
* DO NOT EDIT WITHOUT also editing `packages/shared/src/checkpoints/types.ts`.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Snapshot size guard: prevents PG bloat from pathological code-paste scenarios.
|
|
29
|
-
* Truncate snapshot_md at this byte count (P109.06 enforces).
|
|
30
|
-
*/
|
|
31
|
-
export const MAX_SNAPSHOT_SIZE_BYTES = 50000;
|
|
32
|
-
// === END P117.01 ===
|
|
1
|
+
const S=5e4;export{S as MAX_SNAPSHOT_SIZE_BYTES};
|
|
@@ -1,34 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* @license FSL-1.1
|
|
4
|
-
* Copyright (c) 2026 OrNexus AI
|
|
5
|
-
*
|
|
6
|
-
* This file is part of Neocortex CLI, licensed under the
|
|
7
|
-
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
8
|
-
*
|
|
9
|
-
* Change Date: February 20, 2029
|
|
10
|
-
* Change License: MIT
|
|
11
|
-
*
|
|
12
|
-
* See the LICENSE file in the project root for full license text.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* @neocortex/client - CLI Entry Point
|
|
16
|
-
*
|
|
17
|
-
* Routes subcommands to their respective handlers:
|
|
18
|
-
* neocortex-client invoke --args "..."
|
|
19
|
-
* neocortex-client activate YOUR-LICENSE-KEY
|
|
20
|
-
* neocortex-client config status
|
|
21
|
-
* neocortex-client cache-status
|
|
22
|
-
* neocortex-client doctor [--offline] [--json]
|
|
23
|
-
* neocortex-client --help
|
|
24
|
-
* neocortex-client --version
|
|
25
|
-
*
|
|
26
|
-
* Story 46.2 - AC1-AC7
|
|
27
|
-
*/
|
|
28
|
-
import { getClientVersion } from './version.js';
|
|
29
|
-
// ── Version Resolution ─────────────────────────────────────────────────────
|
|
30
|
-
// ── Help Text ──────────────────────────────────────────────────────────────
|
|
31
|
-
const HELP_TEXT = `
|
|
2
|
+
import{getClientVersion as p}from"./version.js";const l=`
|
|
32
3
|
neocortex-client - Neocortex Client CLI
|
|
33
4
|
|
|
34
5
|
Usage:
|
|
@@ -243,263 +214,5 @@ Invocation payload boundary:
|
|
|
243
214
|
|
|
244
215
|
License:
|
|
245
216
|
Licensed under BSL-1.1 (Business Source License 1.1)
|
|
246
|
-
`.trim();
|
|
247
|
-
|
|
248
|
-
// ── npm Lifecycle Guard ──────────────────────────────────────────────────
|
|
249
|
-
// Epic 67 - Story 67.2: On Windows, npm lifecycle can invoke bin entries
|
|
250
|
-
// with stray arguments like "pm", "install", "postinstall" etc.
|
|
251
|
-
// Silently ignore these to avoid "Unknown command" warnings during npm install.
|
|
252
|
-
const NPM_LIFECYCLE_ARGS = new Set([
|
|
253
|
-
'pm', 'install', 'postinstall', 'preinstall', 'prepublish',
|
|
254
|
-
'postpublish', 'preuninstall', 'postuninstall', 'preprepare',
|
|
255
|
-
'prepare', 'postprepare',
|
|
256
|
-
]);
|
|
257
|
-
async function main() {
|
|
258
|
-
const args = process.argv.slice(2);
|
|
259
|
-
const command = args[0];
|
|
260
|
-
// Silently exit if invoked with npm lifecycle arguments (Epic 67 - Story 67.2)
|
|
261
|
-
if (command && NPM_LIFECYCLE_ARGS.has(command.toLowerCase())) {
|
|
262
|
-
process.exit(0);
|
|
263
|
-
}
|
|
264
|
-
if (!command || command === '--help' || command === '-h') {
|
|
265
|
-
console.log(HELP_TEXT);
|
|
266
|
-
process.exit(0);
|
|
267
|
-
}
|
|
268
|
-
if (command === '--version' || command === '-v') {
|
|
269
|
-
// Epic P72 - Story P72.04: include BSL-1.1 license notice in --version output.
|
|
270
|
-
// Printed to stderr so scripts that parse `neocortex-client --version` continue
|
|
271
|
-
// to work correctly (they consume stdout only).
|
|
272
|
-
console.log(getClientVersion());
|
|
273
|
-
process.stderr.write('Licensed under BSL-1.1 (Business Source License 1.1)\n');
|
|
274
|
-
process.exit(0);
|
|
275
|
-
}
|
|
276
|
-
const subArgs = args.slice(1);
|
|
277
|
-
switch (command) {
|
|
278
|
-
case 'invoke': {
|
|
279
|
-
const { invokeCliHandler, flushInvokeCliOutput } = await import('./commands/invoke.js');
|
|
280
|
-
const exitCode = await invokeCliHandler(subArgs);
|
|
281
|
-
const outputComplete = await flushInvokeCliOutput();
|
|
282
|
-
// Let pending stdout/stderr writes and HTTP handles finish closing.
|
|
283
|
-
// A forced exit can race libuv's async-handle teardown on Windows.
|
|
284
|
-
process.exitCode = outputComplete ? exitCode : 1;
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
case 'activate': {
|
|
288
|
-
const { activate } = await import('./commands/activate.js');
|
|
289
|
-
// Parse activate args
|
|
290
|
-
let licenseKey;
|
|
291
|
-
let serverUrl;
|
|
292
|
-
let nonInteractive = false;
|
|
293
|
-
for (let i = 0; i < subArgs.length; i++) {
|
|
294
|
-
const arg = subArgs[i];
|
|
295
|
-
if (arg === '--server-url') {
|
|
296
|
-
serverUrl = subArgs[++i];
|
|
297
|
-
}
|
|
298
|
-
else if (arg === '--non-interactive') {
|
|
299
|
-
nonInteractive = true;
|
|
300
|
-
}
|
|
301
|
-
else if (arg === '--help' || arg === '-h') {
|
|
302
|
-
console.log(HELP_TEXT);
|
|
303
|
-
process.exit(0);
|
|
304
|
-
}
|
|
305
|
-
else if (!arg.startsWith('-')) {
|
|
306
|
-
licenseKey = arg;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (!licenseKey) {
|
|
310
|
-
console.error('Error: License key is required.');
|
|
311
|
-
console.error('Usage: neocortex-client activate <license-key>');
|
|
312
|
-
console.error('Example: neocortex-client activate NX-PRO-ABC-123');
|
|
313
|
-
process.exit(1);
|
|
314
|
-
}
|
|
315
|
-
try {
|
|
316
|
-
const result = await activate({
|
|
317
|
-
licenseKey,
|
|
318
|
-
serverUrl,
|
|
319
|
-
nonInteractive,
|
|
320
|
-
});
|
|
321
|
-
if (result.success) {
|
|
322
|
-
console.log(result.message);
|
|
323
|
-
process.exit(0);
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
console.error(result.message);
|
|
327
|
-
process.exit(1);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
catch (err) {
|
|
331
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
332
|
-
console.error(`Activation failed: ${message}`);
|
|
333
|
-
process.exit(1);
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
case 'cache-status': {
|
|
338
|
-
// cache-status requires initialized circuit breaker and telemetry queue.
|
|
339
|
-
// For CLI use, we provide a simplified status report.
|
|
340
|
-
console.log('Cache status requires an active client session.');
|
|
341
|
-
console.log('Use this command within a running Neocortex client context.');
|
|
342
|
-
process.exit(0);
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
case 'doctor': {
|
|
346
|
-
const { doctorCliHandler } = await import('./commands/doctor.js');
|
|
347
|
-
const exitCode = await doctorCliHandler(subArgs);
|
|
348
|
-
process.exit(exitCode);
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
case 'config': {
|
|
352
|
-
const { configCliHandler } = await import('./commands/config.js');
|
|
353
|
-
const exitCode = await configCliHandler(subArgs);
|
|
354
|
-
process.exit(exitCode);
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
case 'refresh-memory': {
|
|
358
|
-
const { refreshMemoryCliHandler } = await import('./commands/refresh-memory.js');
|
|
359
|
-
const exitCode = await refreshMemoryCliHandler(subArgs);
|
|
360
|
-
process.exit(exitCode);
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
case 'architecture-memory': {
|
|
364
|
-
const { architectureMemoryTerminalCliHandler } = await import('./commands/architecture-memory-terminal.js');
|
|
365
|
-
const exitCode = await architectureMemoryTerminalCliHandler(subArgs);
|
|
366
|
-
process.exit(exitCode);
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
case 'planning-diagnosis': {
|
|
370
|
-
const { planningDiagnosisCliHandler } = await import('./commands/planning-diagnosis.js');
|
|
371
|
-
const exitCode = await planningDiagnosisCliHandler(subArgs);
|
|
372
|
-
process.exit(exitCode);
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
case 'planning-research': {
|
|
376
|
-
const { planningResearchCliHandler } = await import('./commands/planning-research.js');
|
|
377
|
-
const exitCode = await planningResearchCliHandler(subArgs);
|
|
378
|
-
process.exit(exitCode);
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
case 'private-session': {
|
|
382
|
-
const { privateSessionCliHandler } = await import('./commands/private-session.js');
|
|
383
|
-
const exitCode = await privateSessionCliHandler(subArgs);
|
|
384
|
-
process.exit(exitCode);
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
case 'planning-memory': {
|
|
388
|
-
const { planningMemoryCliHandler } = await import('./commands/planning-memory.js');
|
|
389
|
-
const exitCode = await planningMemoryCliHandler(subArgs);
|
|
390
|
-
process.exit(exitCode);
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
case 'planning-generation': {
|
|
394
|
-
const { planningGenerationCliHandler } = await import('./commands/planning-generation.js');
|
|
395
|
-
const exitCode = await planningGenerationCliHandler(subArgs);
|
|
396
|
-
process.exit(exitCode);
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
case 'story-checkpoint': {
|
|
400
|
-
const { storyCheckpointCliHandler } = await import('./commands/story-checkpoint.js');
|
|
401
|
-
const exitCode = await storyCheckpointCliHandler(subArgs);
|
|
402
|
-
process.exit(exitCode);
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
case 'legacy-story-branch': {
|
|
406
|
-
const { legacyStoryBranchCliHandler } = await import('./commands/legacy-story-branch.js');
|
|
407
|
-
const exitCode = await legacyStoryBranchCliHandler(subArgs);
|
|
408
|
-
process.exit(exitCode);
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
case 'legacy-story-pr': {
|
|
412
|
-
const { legacyStoryPrCliHandler } = await import('./commands/legacy-story-pr.js');
|
|
413
|
-
const exitCode = await legacyStoryPrCliHandler(subArgs);
|
|
414
|
-
process.exit(exitCode);
|
|
415
|
-
break;
|
|
416
|
-
}
|
|
417
|
-
case 'legacy-epic-terminal': {
|
|
418
|
-
const { legacyEpicTerminalCliHandler } = await import('./commands/legacy-epic-terminal.js');
|
|
419
|
-
const exitCode = await legacyEpicTerminalCliHandler(subArgs);
|
|
420
|
-
process.exit(exitCode);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
case 'mutation-qa': {
|
|
424
|
-
const { mutationQaCliHandler } = await import('./commands/mutation-qa.js');
|
|
425
|
-
const exitCode = await mutationQaCliHandler(subArgs);
|
|
426
|
-
process.exit(exitCode);
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
case 'property-qa': {
|
|
430
|
-
const { propertyQaCliHandler } = await import('./commands/property-qa.js');
|
|
431
|
-
const exitCode = await propertyQaCliHandler(subArgs);
|
|
432
|
-
process.exit(exitCode);
|
|
433
|
-
break;
|
|
434
|
-
}
|
|
435
|
-
case 'qa-synthetic-backend': {
|
|
436
|
-
const { syntheticBackendCliHandler } = await import('./commands/qa-synthetic-backend.js');
|
|
437
|
-
process.exitCode = await syntheticBackendCliHandler(args.slice(1));
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
case 'qa-scan-review': {
|
|
441
|
-
const { qaScanReviewCliHandler } = await import('./commands/qa-scan-review.js');
|
|
442
|
-
const exitCode = await qaScanReviewCliHandler(subArgs);
|
|
443
|
-
process.exit(exitCode);
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
case 'qa-root': {
|
|
447
|
-
const { qaControlCliHandler } = await import('./commands/qa-control.js');
|
|
448
|
-
process.exit(await qaControlCliHandler(subArgs));
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
case 'refactor-root': {
|
|
452
|
-
if (subArgs[0] === 'control') {
|
|
453
|
-
const { refactorControlCliHandler } = await import('./commands/refactor-control.js');
|
|
454
|
-
process.exit(await refactorControlCliHandler(subArgs));
|
|
455
|
-
}
|
|
456
|
-
if (subArgs[0] === 'characterize') {
|
|
457
|
-
const { refactorCharacterizationCliHandler } = await import('./commands/refactor-characterization.js');
|
|
458
|
-
process.exit(refactorCharacterizationCliHandler(subArgs));
|
|
459
|
-
}
|
|
460
|
-
if (subArgs[0] === 'review-accept' || subArgs[0] === 'review-status') {
|
|
461
|
-
const { refactorReviewCliHandler } = await import('./commands/refactor-review.js');
|
|
462
|
-
process.exit(await refactorReviewCliHandler(subArgs));
|
|
463
|
-
}
|
|
464
|
-
if (subArgs[0]?.startsWith('commit-')) {
|
|
465
|
-
const { refactorCommitCliHandler } = await import('./commands/refactor-commit.js');
|
|
466
|
-
process.exit(refactorCommitCliHandler(subArgs));
|
|
467
|
-
}
|
|
468
|
-
const { refactorRootCliHandler } = await import('./commands/refactor-root.js');
|
|
469
|
-
const exitCode = refactorRootCliHandler(subArgs);
|
|
470
|
-
process.exit(exitCode);
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
case 'native-agent': {
|
|
474
|
-
const { nativeAgentCliHandler } = await import('./commands/native-agent.js');
|
|
475
|
-
const exitCode = await nativeAgentCliHandler(subArgs);
|
|
476
|
-
process.exit(exitCode);
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
case 'architecture-answers': {
|
|
480
|
-
const { architectureAnswersCliHandler } = await import('./commands/architecture-answers.js');
|
|
481
|
-
const exitCode = await architectureAnswersCliHandler(subArgs);
|
|
482
|
-
process.exit(exitCode);
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
case 'update': {
|
|
486
|
-
// P86.08: Redirect to `neocortex update` which handles npm install -g
|
|
487
|
-
console.log('To update Neocortex, run:');
|
|
488
|
-
console.log(' neocortex update');
|
|
489
|
-
console.log('');
|
|
490
|
-
console.log('Or manually:');
|
|
491
|
-
console.log(' npm install -g @ornexus/neocortex@latest');
|
|
492
|
-
process.exit(0);
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
default: {
|
|
496
|
-
console.error(`Unknown command: ${command}`);
|
|
497
|
-
console.error('Run "neocortex-client --help" for usage information.');
|
|
498
|
-
process.exit(1);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
main().catch((err) => {
|
|
503
|
-
console.error(`Fatal error: ${err instanceof Error ? err.message : String(err)}`);
|
|
504
|
-
process.exit(1);
|
|
505
|
-
});
|
|
217
|
+
`.trim(),d=new Set(["pm","install","postinstall","preinstall","prepublish","postpublish","preuninstall","postuninstall","preprepare","prepare","postprepare"]);async function m(){const c=process.argv.slice(2),n=c[0];n&&d.has(n.toLowerCase())&&process.exit(0),(!n||n==="--help"||n==="-h")&&(console.log(l),process.exit(0)),(n==="--version"||n==="-v")&&(console.log(p()),process.stderr.write(`Licensed under BSL-1.1 (Business Source License 1.1)
|
|
218
|
+
`),process.exit(0));const o=c.slice(1);switch(n){case"invoke":{const{invokeCliHandler:e,flushInvokeCliOutput:t}=await import("./commands/invoke.js"),r=await e(o),s=await t();process.exitCode=s?r:1;break}case"activate":{const{activate:e}=await import("./commands/activate.js");let t,r,s=!1;for(let a=0;a<o.length;a++){const i=o[a];i==="--server-url"?r=o[++a]:i==="--non-interactive"?s=!0:i==="--help"||i==="-h"?(console.log(l),process.exit(0)):i.startsWith("-")||(t=i)}t||(console.error("Error: License key is required."),console.error("Usage: neocortex-client activate <license-key>"),console.error("Example: neocortex-client activate NX-PRO-ABC-123"),process.exit(1));try{const a=await e({licenseKey:t,serverUrl:r,nonInteractive:s});a.success?(console.log(a.message),process.exit(0)):(console.error(a.message),process.exit(1))}catch(a){const i=a instanceof Error?a.message:String(a);console.error(`Activation failed: ${i}`),process.exit(1)}break}case"cache-status":{console.log("Cache status requires an active client session."),console.log("Use this command within a running Neocortex client context."),process.exit(0);break}case"doctor":{const{doctorCliHandler:e}=await import("./commands/doctor.js"),t=await e(o);process.exit(t);break}case"config":{const{configCliHandler:e}=await import("./commands/config.js"),t=await e(o);process.exit(t);break}case"refresh-memory":{const{refreshMemoryCliHandler:e}=await import("./commands/refresh-memory.js"),t=await e(o);process.exit(t);break}case"architecture-memory":{const{architectureMemoryTerminalCliHandler:e}=await import("./commands/architecture-memory-terminal.js"),t=await e(o);process.exit(t);break}case"planning-diagnosis":{const{planningDiagnosisCliHandler:e}=await import("./commands/planning-diagnosis.js"),t=await e(o);process.exit(t);break}case"planning-research":{const{planningResearchCliHandler:e}=await import("./commands/planning-research.js"),t=await e(o);process.exit(t);break}case"private-session":{const{privateSessionCliHandler:e}=await import("./commands/private-session.js"),t=await e(o);process.exit(t);break}case"planning-memory":{const{planningMemoryCliHandler:e}=await import("./commands/planning-memory.js"),t=await e(o);process.exit(t);break}case"planning-generation":{const{planningGenerationCliHandler:e}=await import("./commands/planning-generation.js"),t=await e(o);process.exit(t);break}case"story-checkpoint":{const{storyCheckpointCliHandler:e}=await import("./commands/story-checkpoint.js"),t=await e(o);process.exit(t);break}case"legacy-story-branch":{const{legacyStoryBranchCliHandler:e}=await import("./commands/legacy-story-branch.js"),t=await e(o);process.exit(t);break}case"legacy-story-pr":{const{legacyStoryPrCliHandler:e}=await import("./commands/legacy-story-pr.js"),t=await e(o);process.exit(t);break}case"legacy-epic-terminal":{const{legacyEpicTerminalCliHandler:e}=await import("./commands/legacy-epic-terminal.js"),t=await e(o);process.exit(t);break}case"mutation-qa":{const{mutationQaCliHandler:e}=await import("./commands/mutation-qa.js"),t=await e(o);process.exit(t);break}case"property-qa":{const{propertyQaCliHandler:e}=await import("./commands/property-qa.js"),t=await e(o);process.exit(t);break}case"qa-synthetic-backend":{const{syntheticBackendCliHandler:e}=await import("./commands/qa-synthetic-backend.js");process.exitCode=await e(c.slice(1));break}case"qa-scan-review":{const{qaScanReviewCliHandler:e}=await import("./commands/qa-scan-review.js"),t=await e(o);process.exit(t);break}case"qa-root":{const{qaControlCliHandler:e}=await import("./commands/qa-control.js");process.exit(await e(o));break}case"refactor-root":{if(o[0]==="control"){const{refactorControlCliHandler:r}=await import("./commands/refactor-control.js");process.exit(await r(o))}if(o[0]==="characterize"){const{refactorCharacterizationCliHandler:r}=await import("./commands/refactor-characterization.js");process.exit(r(o))}if(o[0]==="review-accept"||o[0]==="review-status"){const{refactorReviewCliHandler:r}=await import("./commands/refactor-review.js");process.exit(await r(o))}if(o[0]?.startsWith("commit-")){const{refactorCommitCliHandler:r}=await import("./commands/refactor-commit.js");process.exit(r(o))}const{refactorRootCliHandler:e}=await import("./commands/refactor-root.js"),t=e(o);process.exit(t);break}case"native-agent":{const{nativeAgentCliHandler:e}=await import("./commands/native-agent.js"),t=await e(o);process.exit(t);break}case"architecture-answers":{const{architectureAnswersCliHandler:e}=await import("./commands/architecture-answers.js"),t=await e(o);process.exit(t);break}case"update":{console.log("To update Neocortex, run:"),console.log(" neocortex update"),console.log(""),console.log("Or manually:"),console.log(" npm install -g @ornexus/neocortex@latest"),process.exit(0);break}default:console.error(`Unknown command: ${n}`),console.error('Run "neocortex-client --help" for usage information.'),process.exit(1)}}m().catch(c=>{console.error(`Fatal error: ${c instanceof Error?c.message:String(c)}`),process.exit(1)});
|