@gluecharm-lab/easyspecs-cli 0.0.27 → 0.1.1
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/README.md +1 -1
- package/commands.md +13 -11
- package/dist/main.cjs +213 -90
- package/dist/main.cjs.map +3 -3
- package/error-code.md +75 -81
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -10640,17 +10640,53 @@ var fs62 = __toESM(require("node:fs"));
|
|
|
10640
10640
|
var path59 = __toESM(require("node:path"));
|
|
10641
10641
|
|
|
10642
10642
|
// src/cli/exitCodes.ts
|
|
10643
|
+
var OsExit = {
|
|
10644
|
+
/** Unknown / unclassified factory failure */
|
|
10645
|
+
factoryUnknown: 49,
|
|
10646
|
+
/** Rollup: multiple failed generate_context phases with distinct OS codes in one run */
|
|
10647
|
+
factoryMultiPhaseRollup: 59,
|
|
10648
|
+
createAnalysisWorktree: 50,
|
|
10649
|
+
materializeOpenCodeAgents: 51,
|
|
10650
|
+
synthesisConvergence: 52,
|
|
10651
|
+
referenceCoverage: 53,
|
|
10652
|
+
zeroReferenceRemediation: 54,
|
|
10653
|
+
referenceCoverageExecutionReport: 55,
|
|
10654
|
+
linkMappingPipeline: 56,
|
|
10655
|
+
assembleApplicationContextIndex: 57,
|
|
10656
|
+
backendContextSync: 58,
|
|
10657
|
+
driftEmptyBundle: 60,
|
|
10658
|
+
driftUnresolvedReferenceRoot: 61,
|
|
10659
|
+
driftManifestFailed: 62,
|
|
10660
|
+
driftReportWriteFailed: 63,
|
|
10661
|
+
driftIndexPatchFailed: 64,
|
|
10662
|
+
diagnoseReferenceCoveragePipeline: 70,
|
|
10663
|
+
diagnoseReferenceCoverageThreshold: 71,
|
|
10664
|
+
diagnoseCoordinationDuplicatesPolicy: 72,
|
|
10665
|
+
diagnoseCoordinationDuplicatesEngine: 73,
|
|
10666
|
+
diagnoseCoverageReport: 74,
|
|
10667
|
+
diagnoseZeroReferenceReadCoverage: 75,
|
|
10668
|
+
diagnoseZeroReferenceLinkMapping: 76,
|
|
10669
|
+
diagnoseZeroReferencePool: 77,
|
|
10670
|
+
contextLinkGraph: 78,
|
|
10671
|
+
resumeSynthesisIndex: 79,
|
|
10672
|
+
runSynthesisPipeline: 80,
|
|
10673
|
+
aceLearnTrace: 81,
|
|
10674
|
+
aceAutoLearnPool: 82,
|
|
10675
|
+
updateContextFactory: 83
|
|
10676
|
+
};
|
|
10643
10677
|
var ExitCode = {
|
|
10644
10678
|
ok: 0,
|
|
10645
10679
|
usage: 2,
|
|
10646
10680
|
misconfiguration: 3,
|
|
10647
10681
|
opencode: 4,
|
|
10648
|
-
validation: 5,
|
|
10649
10682
|
auth: 6,
|
|
10650
10683
|
upload: 7,
|
|
10651
10684
|
cancelled: 8,
|
|
10652
10685
|
internal: 99
|
|
10653
10686
|
};
|
|
10687
|
+
function failureExitIdFromParts(exitCode, minor) {
|
|
10688
|
+
return `${String(exitCode)}.${String(minor)}`;
|
|
10689
|
+
}
|
|
10654
10690
|
function describeExitCode(code) {
|
|
10655
10691
|
switch (code) {
|
|
10656
10692
|
case ExitCode.ok:
|
|
@@ -10661,8 +10697,6 @@ function describeExitCode(code) {
|
|
|
10661
10697
|
return "Configuration or repo layout problem \u2014 fix `.easyspecs/config.json`, paths, or prerequisites, then retry.";
|
|
10662
10698
|
case ExitCode.opencode:
|
|
10663
10699
|
return "OpenCode (agent runner) failed \u2014 check `opencode` install, credentials, and stderr from the tool run.";
|
|
10664
|
-
case ExitCode.validation:
|
|
10665
|
-
return "Validation or factory pipeline did not succeed \u2014 see `error` above and logs for the failing phase (synthesis, coverage, remediation, index, etc.).";
|
|
10666
10700
|
case ExitCode.auth:
|
|
10667
10701
|
return "Authentication failed or session missing \u2014 run `easyspecs-cli auth login` or fix CI credentials in config.";
|
|
10668
10702
|
case ExitCode.upload:
|
|
@@ -10671,6 +10705,66 @@ function describeExitCode(code) {
|
|
|
10671
10705
|
return "Operation was cancelled (abort/stop).";
|
|
10672
10706
|
case ExitCode.internal:
|
|
10673
10707
|
return "Unexpected internal CLI error \u2014 retry; if it persists, report with full stderr and `--verbose` output.";
|
|
10708
|
+
case OsExit.factoryUnknown:
|
|
10709
|
+
return "Factory pipeline failed (phase could not be classified). See `error` and logs; retry with --verbose.";
|
|
10710
|
+
case OsExit.factoryMultiPhaseRollup:
|
|
10711
|
+
return "Multiple factory pipeline phases failed in one run. Inspect `factoryFailures` for each phase.";
|
|
10712
|
+
case OsExit.createAnalysisWorktree:
|
|
10713
|
+
return "Analysis Git worktree could not be prepared. Check disk space, permissions, and a valid Git checkout.";
|
|
10714
|
+
case OsExit.materializeOpenCodeAgents:
|
|
10715
|
+
return "OpenCode agent files could not be installed into the analysis worktree.";
|
|
10716
|
+
case OsExit.synthesisConvergence:
|
|
10717
|
+
return "Context synthesis did not finish successfully. Inspect OpenCode logs and workstation output.";
|
|
10718
|
+
case OsExit.referenceCoverage:
|
|
10719
|
+
return "Reference coverage could not be computed or written. Check coverage JSON and schema.";
|
|
10720
|
+
case OsExit.zeroReferenceRemediation:
|
|
10721
|
+
return "Zero-reference remediation did not complete. Inspect remediation logs and outputs.";
|
|
10722
|
+
case OsExit.referenceCoverageExecutionReport:
|
|
10723
|
+
return "Coverage execution report could not be generated. Ensure coverage inputs exist.";
|
|
10724
|
+
case OsExit.linkMappingPipeline:
|
|
10725
|
+
return "Context link graph could not be updated. Check coordination JSON and markdown.";
|
|
10726
|
+
case OsExit.assembleApplicationContextIndex:
|
|
10727
|
+
return "Application context index could not be assembled or failed schema validation.";
|
|
10728
|
+
case OsExit.backendContextSync:
|
|
10729
|
+
return "Upload or cloud sync after analysis did not succeed.";
|
|
10730
|
+
case OsExit.driftEmptyBundle:
|
|
10731
|
+
return "Context drift: reference bundle was empty or could not be read.";
|
|
10732
|
+
case OsExit.driftUnresolvedReferenceRoot:
|
|
10733
|
+
return "Context drift: reference root document could not be resolved.";
|
|
10734
|
+
case OsExit.driftManifestFailed:
|
|
10735
|
+
return "Context drift: comparison manifest could not be built.";
|
|
10736
|
+
case OsExit.driftReportWriteFailed:
|
|
10737
|
+
return "Context drift: report markdown could not be written.";
|
|
10738
|
+
case OsExit.driftIndexPatchFailed:
|
|
10739
|
+
return "Context drift: reference index could not be updated with the drift link.";
|
|
10740
|
+
case OsExit.diagnoseReferenceCoveragePipeline:
|
|
10741
|
+
return "diagnose reference-coverage: pipeline or write failed.";
|
|
10742
|
+
case OsExit.diagnoseReferenceCoverageThreshold:
|
|
10743
|
+
return "diagnose reference-coverage: percentNonReferenced exceeded the configured threshold.";
|
|
10744
|
+
case OsExit.diagnoseCoordinationDuplicatesPolicy:
|
|
10745
|
+
return "diagnose coordination-duplicates: strict mode reported duplicates or orphan markdown.";
|
|
10746
|
+
case OsExit.diagnoseCoordinationDuplicatesEngine:
|
|
10747
|
+
return "diagnose coordination-duplicates: scan or I/O failed.";
|
|
10748
|
+
case OsExit.diagnoseCoverageReport:
|
|
10749
|
+
return "diagnose coverage-report: report generation failed.";
|
|
10750
|
+
case OsExit.diagnoseZeroReferenceReadCoverage:
|
|
10751
|
+
return "diagnose zero-reference: could not read coverage / zero-reference inputs.";
|
|
10752
|
+
case OsExit.diagnoseZeroReferenceLinkMapping:
|
|
10753
|
+
return "diagnose zero-reference: link mapping after remediation failed.";
|
|
10754
|
+
case OsExit.diagnoseZeroReferencePool:
|
|
10755
|
+
return "diagnose zero-reference: remediation pool reported failures or cancellation.";
|
|
10756
|
+
case OsExit.contextLinkGraph:
|
|
10757
|
+
return "context link-graph: link mapping pipeline failed.";
|
|
10758
|
+
case OsExit.resumeSynthesisIndex:
|
|
10759
|
+
return "run synthesis resume-*: index assembly after remediation failed.";
|
|
10760
|
+
case OsExit.runSynthesisPipeline:
|
|
10761
|
+
return "run synthesis: pipeline did not complete successfully.";
|
|
10762
|
+
case OsExit.aceLearnTrace:
|
|
10763
|
+
return "ace learn: processing a trace failed.";
|
|
10764
|
+
case OsExit.aceAutoLearnPool:
|
|
10765
|
+
return "ace auto-learn: one or more learn runs failed.";
|
|
10766
|
+
case OsExit.updateContextFactory:
|
|
10767
|
+
return "update context: factory run did not succeed.";
|
|
10674
10768
|
default:
|
|
10675
10769
|
return `Non-zero exit (${String(code)}) \u2014 see stderr and any JSON \`error\` field for detail.`;
|
|
10676
10770
|
}
|
|
@@ -10707,7 +10801,7 @@ function createEasyspecsCliProgram() {
|
|
|
10707
10801
|
program2.command("help").description("Show help");
|
|
10708
10802
|
program2.command("version").description("Print CLI version");
|
|
10709
10803
|
const workstation = program2.command("workstation").description("Host inventory for AI workstation sizing");
|
|
10710
|
-
workstation.command("info").description("Print CPU, RAM, and SRS-
|
|
10804
|
+
workstation.command("info").description("Print CPU, RAM, and SRS-69 N_sys (macOS and Linux only; use global --json)").allowUnknownOption(false);
|
|
10711
10805
|
program2.command("doctor").description("Check readiness and/or inspect configuration").option("--readiness", "Print readiness summary (default)").option("--inspect-config", "Print redacted merged configuration");
|
|
10712
10806
|
const auth = program2.command("auth").description("Authentication");
|
|
10713
10807
|
auth.command("login").description("Log in").option("--email <email>", "Email address").option("--password <password>", "Password").option("--session-path <path>", "Session JSON path override for this run").option("--ci", "Use easyspecs.auth.ciLogin from config when argv credentials are omitted");
|
|
@@ -11245,6 +11339,8 @@ var import_node_child_process2 = require("node:child_process");
|
|
|
11245
11339
|
var ABSOLUTE_MAX_CONCURRENT_AI = 64;
|
|
11246
11340
|
|
|
11247
11341
|
// src/config/machineConcurrentAiFromHost.ts
|
|
11342
|
+
var AGENTS_PER_PHYSICAL_CORE = 1;
|
|
11343
|
+
var RAM_GIB_PER_AGENT = 8;
|
|
11248
11344
|
function clampProductConcurrentLimits(n) {
|
|
11249
11345
|
if (!Number.isFinite(n)) {
|
|
11250
11346
|
return DEFAULT_MAX_CONCURRENT_AI;
|
|
@@ -11261,13 +11357,9 @@ function machineConcurrentAiCapFromHost(profile) {
|
|
|
11261
11357
|
if (!Number.isFinite(rGib) || rGib <= 0) {
|
|
11262
11358
|
return 1;
|
|
11263
11359
|
}
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
} else {
|
|
11268
|
-
nCpuFloat = 100 + 8.5 * (p - 11);
|
|
11269
|
-
}
|
|
11270
|
-
const ramFactor = Math.min(1, rGib / (4 * p));
|
|
11360
|
+
const nCpuFloat = AGENTS_PER_PHYSICAL_CORE * p;
|
|
11361
|
+
const ramRefGib = RAM_GIB_PER_AGENT * p;
|
|
11362
|
+
const ramFactor = Math.min(1, rGib / ramRefGib);
|
|
11271
11363
|
const nFloat = nCpuFloat * ramFactor;
|
|
11272
11364
|
const rounded = Math.round(nFloat);
|
|
11273
11365
|
return Math.max(1, rounded);
|
|
@@ -21614,9 +21706,19 @@ var FACTORY_PIPELINE_EXIT_CONDITIONS = {
|
|
|
21614
21706
|
function factoryFailureDisplayId(row2) {
|
|
21615
21707
|
return row2.failureExitId;
|
|
21616
21708
|
}
|
|
21709
|
+
function parseMajorFromFailureExitId(id) {
|
|
21710
|
+
const m = /^(\d+)\.\d+$/.exec(id.trim());
|
|
21711
|
+
if (!m) {
|
|
21712
|
+
return void 0;
|
|
21713
|
+
}
|
|
21714
|
+
const n = Number(m[1]);
|
|
21715
|
+
return Number.isFinite(n) ? n : void 0;
|
|
21716
|
+
}
|
|
21617
21717
|
function normalizeFactoryFailureRow(r) {
|
|
21618
|
-
const failureExitId = r.failureExitId ?? r.validationExitId ??
|
|
21619
|
-
const
|
|
21718
|
+
const failureExitId = r.failureExitId ?? r.validationExitId ?? failureExitIdFromParts(OsExit.factoryUnknown, 0);
|
|
21719
|
+
const exitCodeFromField = typeof r.exitCode === "number" ? r.exitCode : void 0;
|
|
21720
|
+
const exitCodeFromId = parseMajorFromFailureExitId(failureExitId);
|
|
21721
|
+
const exitCode = exitCodeFromField ?? exitCodeFromId ?? OsExit.factoryUnknown;
|
|
21620
21722
|
const factory = r.factory ?? "generate_context";
|
|
21621
21723
|
const base = {
|
|
21622
21724
|
factory,
|
|
@@ -21627,10 +21729,7 @@ function normalizeFactoryFailureRow(r) {
|
|
|
21627
21729
|
...typeof r.detail === "string" ? { detail: r.detail } : {},
|
|
21628
21730
|
...typeof r.validationSubcode === "string" ? { validationSubcode: r.validationSubcode } : {}
|
|
21629
21731
|
};
|
|
21630
|
-
|
|
21631
|
-
return { ...base, validationExitId: r.validationExitId ?? failureExitId };
|
|
21632
|
-
}
|
|
21633
|
-
return base;
|
|
21732
|
+
return { ...base, validationExitId: r.validationExitId ?? failureExitId };
|
|
21634
21733
|
}
|
|
21635
21734
|
var FACTORY_VALIDATION_PHASE_ORDER = [
|
|
21636
21735
|
"create_analysis_worktree",
|
|
@@ -21646,29 +21745,29 @@ var FACTORY_VALIDATION_PHASE_ORDER = [
|
|
|
21646
21745
|
var DETAIL_MAX = 600;
|
|
21647
21746
|
var ERROR_JOIN_MAX = 900;
|
|
21648
21747
|
var ADDITIONAL_APPEND_MAX = 200;
|
|
21649
|
-
var
|
|
21650
|
-
unknown_factory_phase:
|
|
21651
|
-
create_analysis_worktree:
|
|
21652
|
-
materialize_opencode_agents:
|
|
21653
|
-
synthesis_convergence:
|
|
21654
|
-
reference_coverage:
|
|
21655
|
-
zero_reference_remediation_convergence:
|
|
21656
|
-
reference_coverage_execution_report:
|
|
21657
|
-
link_mapping_pipeline:
|
|
21658
|
-
assemble_application_context_index:
|
|
21659
|
-
backend_context_sync:
|
|
21748
|
+
var PHASE_TO_OS_EXIT = {
|
|
21749
|
+
unknown_factory_phase: OsExit.factoryUnknown,
|
|
21750
|
+
create_analysis_worktree: OsExit.createAnalysisWorktree,
|
|
21751
|
+
materialize_opencode_agents: OsExit.materializeOpenCodeAgents,
|
|
21752
|
+
synthesis_convergence: OsExit.synthesisConvergence,
|
|
21753
|
+
reference_coverage: OsExit.referenceCoverage,
|
|
21754
|
+
zero_reference_remediation_convergence: OsExit.zeroReferenceRemediation,
|
|
21755
|
+
reference_coverage_execution_report: OsExit.referenceCoverageExecutionReport,
|
|
21756
|
+
link_mapping_pipeline: OsExit.linkMappingPipeline,
|
|
21757
|
+
assemble_application_context_index: OsExit.assembleApplicationContextIndex,
|
|
21758
|
+
backend_context_sync: OsExit.backendContextSync
|
|
21660
21759
|
};
|
|
21661
|
-
var
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21760
|
+
var TITLE_BY_PHASE = {
|
|
21761
|
+
unknown_factory_phase: "EasySpecs stopped: the failing pipeline phase could not be identified. Retry with --verbose; report this outcome if it persists.",
|
|
21762
|
+
create_analysis_worktree: "Could not prepare the analysis Git worktree (temporary checkout). Check disk space, repo permissions, and that the project is a valid Git checkout.",
|
|
21763
|
+
materialize_opencode_agents: "Could not install OpenCode agent files into the analysis worktree. Check bundled extension assets and disk permissions under the worktree path.",
|
|
21764
|
+
synthesis_convergence: "Context synthesis did not finish: required context files are still missing or invalid after retries. Inspect OpenCode errors and workstation logs for this phase.",
|
|
21765
|
+
reference_coverage: "Reference coverage could not be computed or written. Check coverage-reference-validation.json prerequisites and disk/schema errors.",
|
|
21766
|
+
zero_reference_remediation_convergence: "Zero-reference remediation did not complete successfully. Inspect remediation logs and zero-reference outputs for this checkout.",
|
|
21767
|
+
reference_coverage_execution_report: "Reference coverage execution report could not be generated. Ensure coverage inputs exist from the coverage phase; see coverage-reference-validation.json.",
|
|
21768
|
+
link_mapping_pipeline: "Context link graph (navigation links) could not be updated. Check coordination JSON and markdown under .gluecharm/context.",
|
|
21769
|
+
assemble_application_context_index: "Application context index could not be assembled or failed schema validation. Inspect index-application-context.json and preceding context files.",
|
|
21770
|
+
backend_context_sync: "Upload / cloud sync after analysis did not succeed. Check auth, project id, network, and upload error details."
|
|
21672
21771
|
};
|
|
21673
21772
|
var READABLE_PHASE_LABEL = {
|
|
21674
21773
|
create_analysis_worktree: "Analysis worktree",
|
|
@@ -21702,11 +21801,11 @@ function inferValidationSubcode(phase, detail) {
|
|
|
21702
21801
|
}
|
|
21703
21802
|
return void 0;
|
|
21704
21803
|
}
|
|
21705
|
-
function
|
|
21706
|
-
return
|
|
21804
|
+
function phaseToSemanticOsExitForGenerateContext(phase) {
|
|
21805
|
+
return PHASE_TO_OS_EXIT[phase] ?? OsExit.factoryUnknown;
|
|
21707
21806
|
}
|
|
21708
|
-
function
|
|
21709
|
-
return
|
|
21807
|
+
function titleForGenerateContextPhase(phase) {
|
|
21808
|
+
return TITLE_BY_PHASE[phase] ?? TITLE_BY_PHASE.unknown_factory_phase;
|
|
21710
21809
|
}
|
|
21711
21810
|
function readableLabelForFactoryPhase(phase) {
|
|
21712
21811
|
return READABLE_PHASE_LABEL[phase] ?? phase;
|
|
@@ -21715,33 +21814,53 @@ function phaseIndex(key) {
|
|
|
21715
21814
|
const i = FACTORY_VALIDATION_PHASE_ORDER.indexOf(key);
|
|
21716
21815
|
return i >= 0 ? i : 999;
|
|
21717
21816
|
}
|
|
21817
|
+
function finalizeFactoryFailuresForProcessExit(rows) {
|
|
21818
|
+
if (rows.length === 0) {
|
|
21819
|
+
return [];
|
|
21820
|
+
}
|
|
21821
|
+
const candidates = [...new Set(rows.map((r) => r.exitCode))];
|
|
21822
|
+
const processExit = candidates.length > 1 ? OsExit.factoryMultiPhaseRollup : candidates[0] ?? OsExit.factoryUnknown;
|
|
21823
|
+
return rows.map((r, i) => {
|
|
21824
|
+
const minor = processExit === OsExit.factoryMultiPhaseRollup ? i : 0;
|
|
21825
|
+
const fid = failureExitIdFromParts(processExit, minor);
|
|
21826
|
+
return {
|
|
21827
|
+
...r,
|
|
21828
|
+
exitCode: processExit,
|
|
21829
|
+
failureExitId: fid,
|
|
21830
|
+
validationExitId: fid
|
|
21831
|
+
};
|
|
21832
|
+
});
|
|
21833
|
+
}
|
|
21718
21834
|
function buildFactoryFailuresFromRows(phases) {
|
|
21719
21835
|
const failed = phases.filter((p) => p.status === "failed");
|
|
21720
21836
|
failed.sort((a, b) => phaseIndex(a.key) - phaseIndex(b.key));
|
|
21721
|
-
|
|
21722
|
-
const
|
|
21837
|
+
const semantic = failed.map((p) => {
|
|
21838
|
+
const os7 = phaseToSemanticOsExitForGenerateContext(p.key);
|
|
21723
21839
|
const sub = inferValidationSubcode(p.key, p.detail);
|
|
21840
|
+
const fid = failureExitIdFromParts(os7, 0);
|
|
21724
21841
|
return {
|
|
21725
21842
|
factory: "generate_context",
|
|
21726
21843
|
phase: p.key,
|
|
21727
|
-
exitCode:
|
|
21728
|
-
failureExitId:
|
|
21729
|
-
validationExitId:
|
|
21730
|
-
title:
|
|
21844
|
+
exitCode: os7,
|
|
21845
|
+
failureExitId: fid,
|
|
21846
|
+
validationExitId: fid,
|
|
21847
|
+
title: titleForGenerateContextPhase(p.key),
|
|
21731
21848
|
detail: trimDetail(p.detail),
|
|
21732
21849
|
...sub !== void 0 ? { validationSubcode: sub } : {}
|
|
21733
21850
|
};
|
|
21734
21851
|
});
|
|
21852
|
+
return finalizeFactoryFailuresForProcessExit(semantic);
|
|
21735
21853
|
}
|
|
21736
21854
|
function syntheticUnknownFactoryFailure(message) {
|
|
21855
|
+
const fid = failureExitIdFromParts(OsExit.factoryUnknown, 0);
|
|
21737
21856
|
return [
|
|
21738
21857
|
{
|
|
21739
21858
|
factory: "generate_context",
|
|
21740
21859
|
phase: "unknown_factory_phase",
|
|
21741
|
-
exitCode:
|
|
21742
|
-
failureExitId:
|
|
21743
|
-
validationExitId:
|
|
21744
|
-
title:
|
|
21860
|
+
exitCode: OsExit.factoryUnknown,
|
|
21861
|
+
failureExitId: fid,
|
|
21862
|
+
validationExitId: fid,
|
|
21863
|
+
title: titleForGenerateContextPhase("unknown_factory_phase"),
|
|
21745
21864
|
detail: trimDetail(message)
|
|
21746
21865
|
}
|
|
21747
21866
|
];
|
|
@@ -21749,7 +21868,8 @@ function syntheticUnknownFactoryFailure(message) {
|
|
|
21749
21868
|
function primaryFailureAliases(failures) {
|
|
21750
21869
|
const last = failures[failures.length - 1];
|
|
21751
21870
|
if (!last) {
|
|
21752
|
-
|
|
21871
|
+
const fid = failureExitIdFromParts(OsExit.factoryUnknown, 0);
|
|
21872
|
+
return { failurePhase: "unknown_factory_phase", validationExitId: fid };
|
|
21753
21873
|
}
|
|
21754
21874
|
return {
|
|
21755
21875
|
failurePhase: last.phase,
|
|
@@ -21769,7 +21889,7 @@ function exitMeaningFromFactoryFailures(failures) {
|
|
|
21769
21889
|
function composeFactoryValidationError(orchestratorMessage, failures) {
|
|
21770
21890
|
const m = orchestratorMessage?.trim() ?? "";
|
|
21771
21891
|
if (failures.length <= 1) {
|
|
21772
|
-
return m.length > 0 ? m : failures[0]?.title ?? "
|
|
21892
|
+
return m.length > 0 ? m : failures[0]?.title ?? "Factory pipeline failed.";
|
|
21773
21893
|
}
|
|
21774
21894
|
const extraIds = failures.slice(1).map((f) => factoryFailureDisplayId(f)).join(", ");
|
|
21775
21895
|
let appendix = `(+${String(failures.length - 1)} additional phase failure(s): ${extraIds})`;
|
|
@@ -25375,9 +25495,6 @@ function buildFactoryDepsHeadless(input) {
|
|
|
25375
25495
|
|
|
25376
25496
|
// src/cli/failureExitRegistry.ts
|
|
25377
25497
|
var DRIFT_FACTORY = "context_drift";
|
|
25378
|
-
function failureExitIdFromParts(exitCode, minor) {
|
|
25379
|
-
return `${String(exitCode)}.${String(minor)}`;
|
|
25380
|
-
}
|
|
25381
25498
|
var DRIFT_META = {
|
|
25382
25499
|
INVALID_REFERENCE_PATH: {
|
|
25383
25500
|
phase: "resolve_reference_bundle",
|
|
@@ -25393,20 +25510,20 @@ var DRIFT_META = {
|
|
|
25393
25510
|
},
|
|
25394
25511
|
EMPTY_BUNDLE: {
|
|
25395
25512
|
phase: "resolve_reference_bundle",
|
|
25396
|
-
exitCode:
|
|
25397
|
-
minor:
|
|
25513
|
+
exitCode: OsExit.driftEmptyBundle,
|
|
25514
|
+
minor: 0,
|
|
25398
25515
|
title: "Reference bundle was empty or could not be read for drift analysis."
|
|
25399
25516
|
},
|
|
25400
25517
|
UNRESOLVED_REFERENCE_ROOT: {
|
|
25401
25518
|
phase: "resolve_reference_root",
|
|
25402
|
-
exitCode:
|
|
25403
|
-
minor:
|
|
25519
|
+
exitCode: OsExit.driftUnresolvedReferenceRoot,
|
|
25520
|
+
minor: 0,
|
|
25404
25521
|
title: "Reference root document could not be resolved. Use --index or ensure an index markdown exists."
|
|
25405
25522
|
},
|
|
25406
25523
|
MANIFEST_FAILED: {
|
|
25407
25524
|
phase: "build_comparison_manifest",
|
|
25408
|
-
exitCode:
|
|
25409
|
-
minor:
|
|
25525
|
+
exitCode: OsExit.driftManifestFailed,
|
|
25526
|
+
minor: 0,
|
|
25410
25527
|
title: "Comparison manifest could not be built for drift analysis."
|
|
25411
25528
|
},
|
|
25412
25529
|
AGENT_FAILED: {
|
|
@@ -25423,14 +25540,14 @@ var DRIFT_META = {
|
|
|
25423
25540
|
},
|
|
25424
25541
|
REPORT_WRITE_FAILED: {
|
|
25425
25542
|
phase: "validate_and_render_report",
|
|
25426
|
-
exitCode:
|
|
25427
|
-
minor:
|
|
25543
|
+
exitCode: OsExit.driftReportWriteFailed,
|
|
25544
|
+
minor: 0,
|
|
25428
25545
|
title: "Drift report markdown could not be written under the analysis worktree."
|
|
25429
25546
|
},
|
|
25430
25547
|
INDEX_PATCH_FAILED: {
|
|
25431
25548
|
phase: "update_reference_index",
|
|
25432
|
-
exitCode:
|
|
25433
|
-
minor:
|
|
25549
|
+
exitCode: OsExit.driftIndexPatchFailed,
|
|
25550
|
+
minor: 0,
|
|
25434
25551
|
title: "Reference root markdown could not be updated with the drift report link."
|
|
25435
25552
|
},
|
|
25436
25553
|
PROMOTE_FAILED: {
|
|
@@ -25486,10 +25603,7 @@ function contextDriftFactoryFailureRow(code, error) {
|
|
|
25486
25603
|
title: meta.title,
|
|
25487
25604
|
detail
|
|
25488
25605
|
};
|
|
25489
|
-
|
|
25490
|
-
return { ...base, validationExitId: failureExitId };
|
|
25491
|
-
}
|
|
25492
|
-
return base;
|
|
25606
|
+
return { ...base, validationExitId: failureExitId };
|
|
25493
25607
|
}
|
|
25494
25608
|
|
|
25495
25609
|
// src/cli/factoryValidationStderr.ts
|
|
@@ -28397,7 +28511,7 @@ function formatCliStderrLine(line, useAnsi) {
|
|
|
28397
28511
|
}
|
|
28398
28512
|
|
|
28399
28513
|
// src/cli/main.ts
|
|
28400
|
-
var PKG_VERSION = "0.
|
|
28514
|
+
var PKG_VERSION = "0.1.1";
|
|
28401
28515
|
function isNonEmptyFactoryFailureArray(x) {
|
|
28402
28516
|
if (!Array.isArray(x) || x.length === 0) {
|
|
28403
28517
|
return false;
|
|
@@ -28414,6 +28528,12 @@ function isNonEmptyFactoryFailureArray(x) {
|
|
|
28414
28528
|
}
|
|
28415
28529
|
return true;
|
|
28416
28530
|
}
|
|
28531
|
+
function processExitFromNormalizedFactoryFailures(rows) {
|
|
28532
|
+
return rows?.length ? rows[0].exitCode : OsExit.factoryUnknown;
|
|
28533
|
+
}
|
|
28534
|
+
function isContextDriftSrs70ValidationExit(code) {
|
|
28535
|
+
return code >= OsExit.driftEmptyBundle && code <= OsExit.driftIndexPatchFailed;
|
|
28536
|
+
}
|
|
28417
28537
|
function isEasyspecsConfigReadError(e) {
|
|
28418
28538
|
return e instanceof EasyspecsConfigInvalidJsonError || e instanceof EasyspecsConfigSchemaError;
|
|
28419
28539
|
}
|
|
@@ -29014,7 +29134,7 @@ async function main() {
|
|
|
29014
29134
|
finish(ExitCode.cancelled, { ok: false, error: "Remediation cancelled.", analysisWorktreePath: analysisRoot });
|
|
29015
29135
|
}
|
|
29016
29136
|
if (!poolRes.indexOk) {
|
|
29017
|
-
finish(
|
|
29137
|
+
finish(OsExit.resumeSynthesisIndex, {
|
|
29018
29138
|
ok: false,
|
|
29019
29139
|
error: poolRes.indexError ?? "Index failed after remediation.",
|
|
29020
29140
|
analysisWorktreePath: analysisRoot
|
|
@@ -29031,7 +29151,7 @@ async function main() {
|
|
|
29031
29151
|
finish(ExitCode.cancelled, { ok: false, error: "Remediation cancelled.", analysisWorktreePath: analysisRoot });
|
|
29032
29152
|
}
|
|
29033
29153
|
if (!poolRes.indexOk) {
|
|
29034
|
-
finish(
|
|
29154
|
+
finish(OsExit.resumeSynthesisIndex, {
|
|
29035
29155
|
ok: false,
|
|
29036
29156
|
error: poolRes.indexError ?? "Index failed after remediation.",
|
|
29037
29157
|
analysisWorktreePath: analysisRoot
|
|
@@ -29084,7 +29204,7 @@ async function main() {
|
|
|
29084
29204
|
adHocCreatedAtIso: (/* @__PURE__ */ new Date()).toISOString()
|
|
29085
29205
|
});
|
|
29086
29206
|
}
|
|
29087
|
-
finish(result.cancelled ? ExitCode.cancelled :
|
|
29207
|
+
finish(result.cancelled ? ExitCode.cancelled : OsExit.runSynthesisPipeline, {
|
|
29088
29208
|
ok: false,
|
|
29089
29209
|
error: result.error ?? "run synthesis failed",
|
|
29090
29210
|
cancelled: result.cancelled === true,
|
|
@@ -29112,14 +29232,14 @@ async function main() {
|
|
|
29112
29232
|
const d = res.document;
|
|
29113
29233
|
const maxPct = repoConfig.easyspecs?.diagnose?.zeroReference?.maxPercentNonReferenced;
|
|
29114
29234
|
if (maxPct !== null && maxPct !== void 0 && Number.isFinite(maxPct) && d.metrics.percentNonReferenced > maxPct) {
|
|
29115
|
-
finish(
|
|
29235
|
+
finish(OsExit.diagnoseReferenceCoverageThreshold, {
|
|
29116
29236
|
ok: false,
|
|
29117
29237
|
error: `percentNonReferenced ${String(d.metrics.percentNonReferenced)} > ${String(maxPct)}`
|
|
29118
29238
|
});
|
|
29119
29239
|
}
|
|
29120
29240
|
finish(ExitCode.ok, { ok: true, percentNonReferenced: d.metrics.percentNonReferenced });
|
|
29121
29241
|
} else {
|
|
29122
|
-
finish(
|
|
29242
|
+
finish(OsExit.diagnoseReferenceCoveragePipeline, { ok: false, error: res.error ?? "coverage failed" });
|
|
29123
29243
|
}
|
|
29124
29244
|
}
|
|
29125
29245
|
if (sub === "coordination-duplicates") {
|
|
@@ -29133,7 +29253,7 @@ async function main() {
|
|
|
29133
29253
|
if (res.ok) {
|
|
29134
29254
|
const strict = repoConfig.easyspecs?.diagnose?.coordinationDuplicates?.strict !== false;
|
|
29135
29255
|
const bad = strict && ((res.groupCount ?? 0) > 0 || (res.orphanMarkdownCount ?? 0) > 0);
|
|
29136
|
-
finish(bad ?
|
|
29256
|
+
finish(bad ? OsExit.diagnoseCoordinationDuplicatesPolicy : ExitCode.ok, {
|
|
29137
29257
|
ok: !bad,
|
|
29138
29258
|
groupCount: res.groupCount,
|
|
29139
29259
|
orphanMarkdownCount: res.orphanMarkdownCount,
|
|
@@ -29143,7 +29263,7 @@ async function main() {
|
|
|
29143
29263
|
groupsByList: res.groupsByList
|
|
29144
29264
|
});
|
|
29145
29265
|
}
|
|
29146
|
-
finish(
|
|
29266
|
+
finish(OsExit.diagnoseCoordinationDuplicatesEngine, { ok: false, error: res.message ?? "duplicates failed" });
|
|
29147
29267
|
}
|
|
29148
29268
|
if (sub === "coverage-report") {
|
|
29149
29269
|
const rootAbs = resolveAnalysisRoot(repoRoot, rootKind, worktree);
|
|
@@ -29155,7 +29275,7 @@ async function main() {
|
|
|
29155
29275
|
if (rep.ok) {
|
|
29156
29276
|
finish(ExitCode.ok, { ok: true, reportPath: rep.outputAbsolutePath });
|
|
29157
29277
|
} else {
|
|
29158
|
-
finish(
|
|
29278
|
+
finish(OsExit.diagnoseCoverageReport, { ok: false, error: rep.error ?? "report failed" });
|
|
29159
29279
|
}
|
|
29160
29280
|
}
|
|
29161
29281
|
if (sub === "missing-artefacts") {
|
|
@@ -29185,7 +29305,7 @@ async function main() {
|
|
|
29185
29305
|
requireMinimalGluecharmLayoutAt(analysisRoot);
|
|
29186
29306
|
const cov = readNonReferencedFilesFromRepositoryRoot(analysisRoot);
|
|
29187
29307
|
if (!cov.ok) {
|
|
29188
|
-
finish(
|
|
29308
|
+
finish(OsExit.diagnoseZeroReferenceReadCoverage, { ok: false, error: cov.error });
|
|
29189
29309
|
} else {
|
|
29190
29310
|
const zrPaths = cov.paths;
|
|
29191
29311
|
if (zrPaths.length === 0) {
|
|
@@ -29214,7 +29334,7 @@ async function main() {
|
|
|
29214
29334
|
const ctxDir = path59.join(analysisRoot, ".gluecharm", "context");
|
|
29215
29335
|
const lg = runLinkMappingPipeline(ctxDir, { log: (line) => logErr(flags, line) });
|
|
29216
29336
|
if (!lg.ok) {
|
|
29217
|
-
finish(
|
|
29337
|
+
finish(OsExit.diagnoseZeroReferenceLinkMapping, {
|
|
29218
29338
|
ok: false,
|
|
29219
29339
|
completed: poolRes.completed,
|
|
29220
29340
|
failures: poolRes.failures,
|
|
@@ -29224,7 +29344,7 @@ async function main() {
|
|
|
29224
29344
|
});
|
|
29225
29345
|
}
|
|
29226
29346
|
}
|
|
29227
|
-
finish(bad ?
|
|
29347
|
+
finish(bad ? OsExit.diagnoseZeroReferencePool : ExitCode.ok, {
|
|
29228
29348
|
ok: !bad,
|
|
29229
29349
|
completed: poolRes.completed,
|
|
29230
29350
|
failures: poolRes.failures,
|
|
@@ -29246,7 +29366,7 @@ async function main() {
|
|
|
29246
29366
|
log: (line) => logErr(flags, line)
|
|
29247
29367
|
});
|
|
29248
29368
|
if (!res.ok) {
|
|
29249
|
-
finish(
|
|
29369
|
+
finish(OsExit.contextLinkGraph, {
|
|
29250
29370
|
ok: false,
|
|
29251
29371
|
contextDir: contextDir2,
|
|
29252
29372
|
error: res.error,
|
|
@@ -29309,7 +29429,7 @@ async function main() {
|
|
|
29309
29429
|
factoryFailures: [row2],
|
|
29310
29430
|
error: composeFactoryValidationError(dres.error, [row2])
|
|
29311
29431
|
};
|
|
29312
|
-
if (driftExit
|
|
29432
|
+
if (isContextDriftSrs70ValidationExit(driftExit)) {
|
|
29313
29433
|
Object.assign(envelope, primaryFailureAliases([row2]));
|
|
29314
29434
|
}
|
|
29315
29435
|
finish(driftExit, envelope);
|
|
@@ -29411,7 +29531,10 @@ async function main() {
|
|
|
29411
29531
|
Object.assign(analysisEnvelope, primaryFailureAliases(res.factoryFailures));
|
|
29412
29532
|
analysisEnvelope.error = composeFactoryValidationError(res.message, res.factoryFailures);
|
|
29413
29533
|
}
|
|
29414
|
-
finish(
|
|
29534
|
+
finish(
|
|
29535
|
+
res.ok ? ExitCode.ok : res.cancelled ? ExitCode.cancelled : processExitFromNormalizedFactoryFailures(res.factoryFailures),
|
|
29536
|
+
analysisEnvelope
|
|
29537
|
+
);
|
|
29415
29538
|
}
|
|
29416
29539
|
if (pos[0] === "update" && pos[1] === "context") {
|
|
29417
29540
|
for (const a of pos.slice(2)) {
|
|
@@ -29439,7 +29562,7 @@ async function main() {
|
|
|
29439
29562
|
log: (line) => logErr(flags, line)
|
|
29440
29563
|
});
|
|
29441
29564
|
const { exitOk, ...payload } = ures;
|
|
29442
|
-
const code = exitOk ? ExitCode.ok : ures.code === "MISSING_BASELINE" ? ExitCode.usage :
|
|
29565
|
+
const code = exitOk ? ExitCode.ok : ures.code === "MISSING_BASELINE" ? ExitCode.usage : OsExit.updateContextFactory;
|
|
29443
29566
|
finish(code, payload);
|
|
29444
29567
|
}
|
|
29445
29568
|
if (pos[0] === "download" && pos[1] === "context") {
|
|
@@ -29702,7 +29825,7 @@ async function main() {
|
|
|
29702
29825
|
diagnosticLog: (line) => logErr(flags, line)
|
|
29703
29826
|
});
|
|
29704
29827
|
if (!res.ok) {
|
|
29705
|
-
finish(
|
|
29828
|
+
finish(OsExit.aceLearnTrace, { ok: false, error: res.message });
|
|
29706
29829
|
}
|
|
29707
29830
|
okCount += 1;
|
|
29708
29831
|
}
|
|
@@ -29728,7 +29851,7 @@ async function main() {
|
|
|
29728
29851
|
diagnosticLog: (line) => logErr(flags, line)
|
|
29729
29852
|
}
|
|
29730
29853
|
});
|
|
29731
|
-
finish(pool.failed ?
|
|
29854
|
+
finish(pool.failed ? OsExit.aceAutoLearnPool : ExitCode.ok, {
|
|
29732
29855
|
ok: pool.failed === 0,
|
|
29733
29856
|
completed: pool.completed,
|
|
29734
29857
|
failed: pool.failed,
|