archctx 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/catalog.yaml +2 -2
- package/bin/archctx.mjs +98 -121
- package/package.json +1 -1
package/assets/catalog.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "archcontext.practice-catalog-manifest/v1",
|
|
3
3
|
"catalogVersion": "2026.06.0",
|
|
4
|
-
"productVersion": "0.5.
|
|
4
|
+
"productVersion": "0.5.7",
|
|
5
5
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
6
6
|
"entries": [
|
|
7
7
|
{
|
|
@@ -389,5 +389,5 @@
|
|
|
389
389
|
"structurizr.dsl",
|
|
390
390
|
"twelve-factor"
|
|
391
391
|
],
|
|
392
|
-
"catalogDigest": "sha256:
|
|
392
|
+
"catalogDigest": "sha256:35eeb95a2e4270ef948c699bf3049f4abcdc09f7639751485eb04dd5f81e2aa7"
|
|
393
393
|
}
|
package/bin/archctx.mjs
CHANGED
|
@@ -1213,7 +1213,7 @@ function productVersionManifest() {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
};
|
|
1215
1215
|
}
|
|
1216
|
-
var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.5.
|
|
1216
|
+
var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.5.7", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.0", ARCHCONTEXT_NODE_RANGE = ">=22.22 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v1", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-07-11.explorer-view-v2";
|
|
1217
1217
|
|
|
1218
1218
|
// packages/contracts/src/refactor.ts
|
|
1219
1219
|
function refactorProposalDigest(proposal) {
|
|
@@ -1302,6 +1302,12 @@ function architectureTargetDeltaInvariantIssues(delta, prefix = "targetDelta") {
|
|
|
1302
1302
|
issues.push(`${prefix}.completionCriteria must contain at least one outcome`);
|
|
1303
1303
|
if (delta.benefitLedger.rollbackPoint.trim() === "")
|
|
1304
1304
|
issues.push(`${prefix}.benefitLedger.rollbackPoint must not be empty`);
|
|
1305
|
+
const temporaryRelations = new Set(delta.migrationState.temporaryRelations);
|
|
1306
|
+
for (const relation of delta.targetState.requiredRelations) {
|
|
1307
|
+
if (temporaryRelations.has(relation)) {
|
|
1308
|
+
issues.push(`${prefix}.targetState.requiredRelations must not contain migration-only relation: ${relation}`);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1305
1311
|
if (architectureTargetDeltaInterventionId(delta) !== delta.interventionId) {
|
|
1306
1312
|
issues.push(`${prefix}.interventionId must be derived from the authored delta`);
|
|
1307
1313
|
}
|
|
@@ -2552,7 +2558,7 @@ var init_src2 = __esm(() => {
|
|
|
2552
2558
|
|
|
2553
2559
|
// node_modules/.bun/@colbymchenry+codegraph@1.5.0/node_modules/@colbymchenry/codegraph/npm-sdk.js
|
|
2554
2560
|
var require_npm_sdk = __commonJS(function(exports, module) {
|
|
2555
|
-
var __dirname = "/
|
|
2561
|
+
var __dirname = "/Users/ancienttwo/Projects/arch-context/.claude/worktrees/release-0.5.7/node_modules/.bun/@colbymchenry+codegraph@1.5.0/node_modules/@colbymchenry/codegraph";
|
|
2556
2562
|
var path = __require("path");
|
|
2557
2563
|
var os = __require("os");
|
|
2558
2564
|
var fs = __require("fs");
|
|
@@ -6502,9 +6508,6 @@ import { readdirSync as readdirSync2, readFileSync as readFileSync2, realpathSyn
|
|
|
6502
6508
|
import { relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
6503
6509
|
var LANDSCAPE_FILE = ".archcontext/landscape.yaml";
|
|
6504
6510
|
var ADAPTER_PROTECTED_NATIVE_FIELDS = ["evidence", "verification", "constraint", "intervention"];
|
|
6505
|
-
function createInterventionId(task) {
|
|
6506
|
-
return `intervention.${task.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "architecture-change"}`;
|
|
6507
|
-
}
|
|
6508
6511
|
var DEFAULT_IGNORES2 = new Set([
|
|
6509
6512
|
".git",
|
|
6510
6513
|
".codegraph",
|
|
@@ -22770,58 +22773,38 @@ function isBenignPath(path) {
|
|
|
22770
22773
|
init_src();
|
|
22771
22774
|
function detectArchitecturePressure(input) {
|
|
22772
22775
|
const taskHaystack = input.task.toLowerCase();
|
|
22773
|
-
const
|
|
22774
|
-
|
|
22775
|
-
...(input.files ?? []).map((subject) => ({ subject, kind: "path" }))
|
|
22776
|
-
].filter((item) => !isBenignSubject(item.subject));
|
|
22777
|
-
const structuralHaystack = structuralItems.map((item) => item.subject).join(" ").toLowerCase();
|
|
22776
|
+
const migrationReviewDate2 = input.migrationReviewDate === undefined ? undefined : requireIsoDate(input.migrationReviewDate, "migrationReviewDate");
|
|
22777
|
+
const now = input.now === undefined ? undefined : requireIsoDate(input.now, "now");
|
|
22778
22778
|
const signals = [];
|
|
22779
|
-
addHeuristic(/duplicate|same responsibility|copy/.test(taskHaystack), "duplicate-responsibility"
|
|
22780
|
-
addHeuristic(/owner|lifecycle/.test(taskHaystack) && /two|multiple|split/.test(taskHaystack), "multiple-lifecycle-owner"
|
|
22781
|
-
addHeuristic(/wrapper|adapter|mapper|fallback/.test(taskHaystack), "unjustified-wrapper-adapter"
|
|
22779
|
+
addHeuristic(/duplicate|same responsibility|copy/.test(taskHaystack), "duplicate-responsibility");
|
|
22780
|
+
addHeuristic(/owner|lifecycle/.test(taskHaystack) && /two|multiple|split/.test(taskHaystack), "multiple-lifecycle-owner");
|
|
22781
|
+
addHeuristic(/wrapper|adapter|mapper|fallback/.test(taskHaystack), "unjustified-wrapper-adapter");
|
|
22782
22782
|
const strongDualTrack = /v1|v2|legacy|deprecated/.test(taskHaystack);
|
|
22783
22783
|
const weakDualTrack = /\bold\b|\bnew\b/.test(taskHaystack);
|
|
22784
|
-
addHeuristic(strongDualTrack || weakDualTrack, "dual-track-business-concept"
|
|
22785
|
-
addHeuristic(/direct db|cross boundary|payment credential|forbidden data/.test(taskHaystack), "cross-boundary-data-access"
|
|
22786
|
-
addHeuristic(/cycle|hotspot|too many callers/.test(taskHaystack), "cycle-or-hotspot"
|
|
22787
|
-
addHeuristic(/api|contract|schema|event|public/.test(taskHaystack), "contract-after-implementation"
|
|
22788
|
-
addHeuristic(/migration|cleanup|remove old|dual path/.test(taskHaystack), "migration-without-target-state"
|
|
22789
|
-
addHeuristic(/temporary|cleanup later/.test(taskHaystack), "temporary-state-without-removal"
|
|
22790
|
-
addHeuristic(/token|credential|permission|scope|secret|key/.test(taskHaystack), "broad-permission-scope"
|
|
22791
|
-
addHeuristic(/dependency|package|lockfile|version/.test(taskHaystack), "unpinned-runtime-dependency"
|
|
22792
|
-
addObserved(
|
|
22793
|
-
|
|
22794
|
-
addObserved(/duplicate|copy|copied/.test(structuralHaystack), "duplicate-responsibility", "medium", matchingSubjects(structuralItems, /duplicate|copy|copied/i));
|
|
22795
|
-
addObserved(/owner|lifecycle/.test(structuralHaystack) && /two|multiple|split/.test([taskHaystack, structuralHaystack].join(" ")), "multiple-lifecycle-owner", "high", matchingSubjects(structuralItems, /owner|lifecycle|module|service/i));
|
|
22796
|
-
addObserved(/hotspot|too many callers/.test(structuralHaystack), "cycle-or-hotspot", "medium", matchingSubjects(structuralItems, /hotspot|caller/i));
|
|
22797
|
-
addObserved(/boundary|layer|module|domain/.test(structuralHaystack) && hasImportEdge(input.edges), "boundary-crossing-import", "high", edgeSubjects(input.edges, "imports"));
|
|
22798
|
-
addObserved(/cycle|circular/.test(structuralHaystack) || hasBidirectionalImport(input.edges), "dependency-cycle", "high", edgeSubjects(input.edges, "imports"));
|
|
22799
|
-
addObserved(/direct db|database|credential|payment|forbidden data/.test(structuralHaystack) || hasDataEdge(input.edges), "cross-boundary-data-access", "high", [...matchingSubjects(structuralItems, /db|database|credential|payment|data/i), ...edgeSubjects(input.edges, "reads", "writes")]);
|
|
22800
|
-
addObserved(/queue|worker|external|client|server|route/.test(structuralHaystack) && !/telemetry|trace|metric|log/.test(structuralHaystack), "runtime-boundary-without-observability", "medium", matchingSubjects(structuralItems, /queue|worker|external|client|server|route/i));
|
|
22801
|
-
addObserved(/adr|decision|policy|contract|architecture/.test(structuralHaystack), "architecture-intervention", "medium", matchingSubjects(structuralItems, /adr|decision|policy|contract|architecture/i));
|
|
22802
|
-
addObserved(/owner|team|lifecycle/.test(structuralHaystack), "missing-owner", "medium", matchingSubjects(structuralItems, /owner|team|lifecycle/i));
|
|
22803
|
-
if (input.migrationReviewDate && input.now && input.migrationReviewDate < input.now) {
|
|
22784
|
+
addHeuristic(strongDualTrack || weakDualTrack, "dual-track-business-concept");
|
|
22785
|
+
addHeuristic(/direct db|cross boundary|payment credential|forbidden data/.test(taskHaystack), "cross-boundary-data-access");
|
|
22786
|
+
addHeuristic(/cycle|hotspot|too many callers/.test(taskHaystack), "cycle-or-hotspot");
|
|
22787
|
+
addHeuristic(/api|contract|schema|event|public/.test(taskHaystack), "contract-after-implementation");
|
|
22788
|
+
addHeuristic(/migration|cleanup|remove old|dual path/.test(taskHaystack), "migration-without-target-state");
|
|
22789
|
+
addHeuristic(/temporary|cleanup later/.test(taskHaystack), "temporary-state-without-removal");
|
|
22790
|
+
addHeuristic(/token|credential|permission|scope|secret|key/.test(taskHaystack), "broad-permission-scope");
|
|
22791
|
+
addHeuristic(/dependency|package|lockfile|version/.test(taskHaystack), "unpinned-runtime-dependency");
|
|
22792
|
+
addObserved(hasBidirectionalImport(input.edges), "dependency-cycle", "high", edgeSubjects(input.edges, "imports"));
|
|
22793
|
+
if (migrationReviewDate2 && now && migrationReviewDate2 < now) {
|
|
22804
22794
|
signals.push({
|
|
22805
22795
|
type: "overdue-migration-state",
|
|
22806
22796
|
severity: "high",
|
|
22807
|
-
evidence: [
|
|
22797
|
+
evidence: [migrationReviewDate2],
|
|
22808
22798
|
evidenceKind: "observed",
|
|
22809
|
-
evidenceDetails: [practiceEvidence2("runtime-check", "observed",
|
|
22799
|
+
evidenceDetails: [practiceEvidence2("runtime-check", "observed", migrationReviewDate2)]
|
|
22810
22800
|
});
|
|
22811
22801
|
}
|
|
22812
|
-
|
|
22813
|
-
if (evidence.confidence === "verified" && /test|verified/i.test(evidence.summary)) {
|
|
22814
|
-
addObserved(true, "architecture-intervention", "medium", [evidence.id], evidence.confidence);
|
|
22815
|
-
}
|
|
22816
|
-
}
|
|
22817
|
-
const rawScore = Math.min(100, signals.reduce((sum, signal) => sum + (signal.severity === "high" ? 25 : signal.severity === "medium" ? 15 : 5), 0));
|
|
22818
|
-
const heuristicOnly = signals.length > 0 && signals.every((signal) => signal.evidenceKind === "heuristic");
|
|
22819
|
-
const score = heuristicOnly ? Math.min(rawScore, 25) : rawScore;
|
|
22802
|
+
const score = scorePressureSignals(signals);
|
|
22820
22803
|
return { level: score >= 60 ? "high" : score >= 30 ? "medium" : "low", score, signals };
|
|
22821
|
-
function addHeuristic(condition, type
|
|
22804
|
+
function addHeuristic(condition, type) {
|
|
22822
22805
|
if (!condition)
|
|
22823
22806
|
return;
|
|
22824
|
-
signals.push({ type, severity, evidence: ["task-text"], evidenceKind: "heuristic", evidenceDetails: [practiceEvidence2("task-text", "heuristic", input.task)] });
|
|
22807
|
+
signals.push({ type, severity: "low", evidence: ["task-text"], evidenceKind: "heuristic", evidenceDetails: [practiceEvidence2("task-text", "heuristic", input.task)] });
|
|
22825
22808
|
}
|
|
22826
22809
|
function addObserved(condition, type, severity, evidence, strength = "observed") {
|
|
22827
22810
|
if (!condition)
|
|
@@ -22836,6 +22819,12 @@ function detectArchitecturePressure(input) {
|
|
|
22836
22819
|
});
|
|
22837
22820
|
}
|
|
22838
22821
|
}
|
|
22822
|
+
function scorePressureSignals(signals) {
|
|
22823
|
+
const observedSignals = signals.filter((signal) => signal.evidenceKind === "observed");
|
|
22824
|
+
const scoredSignals = observedSignals.length > 0 ? observedSignals : signals;
|
|
22825
|
+
const rawScore = Math.min(100, scoredSignals.reduce((sum, signal) => sum + (signal.severity === "high" ? 25 : signal.severity === "medium" ? 15 : 5), 0));
|
|
22826
|
+
return observedSignals.length === 0 ? Math.min(rawScore, 25) : rawScore;
|
|
22827
|
+
}
|
|
22839
22828
|
function practiceEvidence2(kind, strength, subject) {
|
|
22840
22829
|
return {
|
|
22841
22830
|
kind,
|
|
@@ -22845,17 +22834,14 @@ function practiceEvidence2(kind, strength, subject) {
|
|
|
22845
22834
|
observedAt: "1970-01-01T00:00:00.000Z"
|
|
22846
22835
|
};
|
|
22847
22836
|
}
|
|
22848
|
-
function
|
|
22849
|
-
|
|
22850
|
-
}
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
}
|
|
22854
|
-
|
|
22855
|
-
return
|
|
22856
|
-
}
|
|
22857
|
-
function hasDataEdge(edges) {
|
|
22858
|
-
return (edges ?? []).some((edge) => edge.kind === "reads" || edge.kind === "writes");
|
|
22837
|
+
function requireIsoDate(value, field) {
|
|
22838
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
22839
|
+
throw new Error(`Invalid ${field}: expected a valid YYYY-MM-DD date`);
|
|
22840
|
+
const parsed = new Date(`${value}T00:00:00.000Z`);
|
|
22841
|
+
if (Number.isNaN(parsed.getTime()) || parsed.toISOString().slice(0, 10) !== value) {
|
|
22842
|
+
throw new Error(`Invalid ${field}: expected a valid YYYY-MM-DD date`);
|
|
22843
|
+
}
|
|
22844
|
+
return value;
|
|
22859
22845
|
}
|
|
22860
22846
|
function hasBidirectionalImport(edges) {
|
|
22861
22847
|
const imports = new Set((edges ?? []).filter((edge) => edge.kind === "imports").map((edge) => `${edge.source}->${edge.target}`));
|
|
@@ -22870,10 +22856,11 @@ function edgeSubjects(edges, ...kinds) {
|
|
|
22870
22856
|
|
|
22871
22857
|
// packages/core/refactor-decision/src/index.ts
|
|
22872
22858
|
function computeRefactorConfidence(input) {
|
|
22873
|
-
|
|
22874
|
-
|
|
22859
|
+
validateReadinessEvidence(input);
|
|
22860
|
+
let score = input.callerCoverage === undefined ? 0 : Math.round(input.callerCoverage * 70);
|
|
22861
|
+
if (input.testsAvailable === true)
|
|
22875
22862
|
score += 15;
|
|
22876
|
-
if (input.rollbackAvailable)
|
|
22863
|
+
if (input.rollbackAvailable === true)
|
|
22877
22864
|
score += 15;
|
|
22878
22865
|
if ((input.externalConsumers?.length ?? 0) > 0)
|
|
22879
22866
|
score -= 20;
|
|
@@ -22883,15 +22870,20 @@ function computeRefactorConfidence(input) {
|
|
|
22883
22870
|
return {
|
|
22884
22871
|
level: score >= 70 ? "high" : score >= 40 ? "medium" : "low",
|
|
22885
22872
|
score,
|
|
22886
|
-
coverage: [`caller-coverage:${input.callerCoverage}`],
|
|
22873
|
+
coverage: input.callerCoverage === undefined ? [] : [`caller-coverage:${input.callerCoverage}`],
|
|
22887
22874
|
externalConsumers: input.externalConsumers ?? [],
|
|
22888
22875
|
persistedData: input.persistedData ?? [],
|
|
22889
|
-
rollbackPoints:
|
|
22876
|
+
rollbackPoints: [],
|
|
22877
|
+
evidence: {
|
|
22878
|
+
callerCoverage: input.callerCoverage ?? null,
|
|
22879
|
+
testsAvailable: input.testsAvailable ?? null,
|
|
22880
|
+
rollbackAvailable: input.rollbackAvailable ?? null
|
|
22881
|
+
}
|
|
22890
22882
|
};
|
|
22891
22883
|
}
|
|
22892
|
-
function decidePosture(pressure,
|
|
22884
|
+
function decidePosture(pressure, _confidence) {
|
|
22893
22885
|
if (pressure.level === "high") {
|
|
22894
|
-
return
|
|
22886
|
+
return "proof-required";
|
|
22895
22887
|
}
|
|
22896
22888
|
if (pressure.level === "medium")
|
|
22897
22889
|
return "structural";
|
|
@@ -22900,42 +22892,20 @@ function decidePosture(pressure, confidence) {
|
|
|
22900
22892
|
function createProofPoint(task) {
|
|
22901
22893
|
return {
|
|
22902
22894
|
description: `Prove the smallest end-to-end path for: ${task}`,
|
|
22903
|
-
successCriteria: ["one-owner-observed", "no-fallback-path", "current-tests-pass"],
|
|
22895
|
+
successCriteria: ["accountable-target-proposal-authored", "one-owner-observed", "no-fallback-path", "current-tests-pass"],
|
|
22904
22896
|
falsifiers: ["untracked-external-consumer", "unacceptable-migration-risk"]
|
|
22905
22897
|
};
|
|
22906
22898
|
}
|
|
22907
|
-
function
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
},
|
|
22918
|
-
migrationState: {
|
|
22919
|
-
active: true,
|
|
22920
|
-
compatibilityContracts: [],
|
|
22921
|
-
cleanupBy: "next-release",
|
|
22922
|
-
temporaryRelations: ["relation.temporary-migration"]
|
|
22923
|
-
},
|
|
22924
|
-
constraints: {
|
|
22925
|
-
real: [...input.confidence.externalConsumers, ...input.confidence.persistedData],
|
|
22926
|
-
inherited: ["internal-callers", "legacy-layout"]
|
|
22927
|
-
},
|
|
22928
|
-
proofPoint,
|
|
22929
|
-
killList: [
|
|
22930
|
-
{ id: "remove-legacy-wrapper", target: "symbol.legacyWrapper", required: true },
|
|
22931
|
-
{ id: "remove-fallback-mapper", target: "symbol.fallbackMapper", required: true }
|
|
22932
|
-
],
|
|
22933
|
-
benefitLedger: {
|
|
22934
|
-
benefits: ["single lifecycle owner", "bounded migration cleanup", "fewer compatibility paths"],
|
|
22935
|
-
costs: ["larger coordinated change"],
|
|
22936
|
-
rollbackPoint: input.confidence.rollbackPoints[0] ?? "git"
|
|
22937
|
-
}
|
|
22938
|
-
};
|
|
22899
|
+
function validateReadinessEvidence(input) {
|
|
22900
|
+
if (input.callerCoverage !== undefined && (!Number.isFinite(input.callerCoverage) || input.callerCoverage < 0 || input.callerCoverage > 1)) {
|
|
22901
|
+
throw new TypeError("callerCoverage must be a finite ratio between 0 and 1");
|
|
22902
|
+
}
|
|
22903
|
+
if (input.testsAvailable !== undefined && typeof input.testsAvailable !== "boolean") {
|
|
22904
|
+
throw new TypeError("testsAvailable must be a boolean");
|
|
22905
|
+
}
|
|
22906
|
+
if (input.rollbackAvailable !== undefined && typeof input.rollbackAvailable !== "boolean") {
|
|
22907
|
+
throw new TypeError("rollbackAvailable must be a boolean");
|
|
22908
|
+
}
|
|
22939
22909
|
}
|
|
22940
22910
|
|
|
22941
22911
|
// packages/core/context-compiler/src/index.ts
|
|
@@ -22990,11 +22960,8 @@ async function compileTaskContext(input) {
|
|
|
22990
22960
|
edges: codeContext.edges,
|
|
22991
22961
|
observedEvidence: codeContext.evidence
|
|
22992
22962
|
});
|
|
22993
|
-
const confidence = computeRefactorConfidence({
|
|
22994
|
-
|
|
22995
|
-
testsAvailable: codeContext.evidence.some((evidence) => evidence.confidence === "verified"),
|
|
22996
|
-
rollbackAvailable: true
|
|
22997
|
-
});
|
|
22963
|
+
const confidence = computeRefactorConfidence(input.readinessEvidence ?? {});
|
|
22964
|
+
const readinessUnknowns = refactorReadinessUnknowns(confidence);
|
|
22998
22965
|
const posture = decidePosture(pressure, confidence);
|
|
22999
22966
|
const resources = [
|
|
23000
22967
|
...ledgerReadback?.resource ? [ledgerReadback.resource] : [],
|
|
@@ -23027,7 +22994,7 @@ async function compileTaskContext(input) {
|
|
|
23027
22994
|
constraints: practiceGuidance.constraints,
|
|
23028
22995
|
decisions: practiceGuidance.decisions,
|
|
23029
22996
|
realConstraints: practiceGuidance.realConstraints,
|
|
23030
|
-
unknowns: practiceGuidance.unknowns,
|
|
22997
|
+
unknowns: unique3([...practiceGuidance.unknowns, ...readinessUnknowns]),
|
|
23031
22998
|
recommendedTargetState: {
|
|
23032
22999
|
practiceCatalogDigest: practiceGuidance.catalogDigest,
|
|
23033
23000
|
topPracticeIds: practiceGuidance.matches.map((match) => match.practiceId)
|
|
@@ -23045,7 +23012,7 @@ async function compileTaskContext(input) {
|
|
|
23045
23012
|
constraints: trimmedPracticeGuidance.constraints,
|
|
23046
23013
|
decisions: trimmedPracticeGuidance.decisions,
|
|
23047
23014
|
realConstraints: trimmedPracticeGuidance.realConstraints,
|
|
23048
|
-
unknowns: trimmedPracticeGuidance.unknowns,
|
|
23015
|
+
unknowns: unique3([...trimmedPracticeGuidance.unknowns, ...readinessUnknowns]),
|
|
23049
23016
|
requiredCheckpoints: unique3(["before-task-complete", ...trimmedPracticeGuidance.requiredCheckpoints]),
|
|
23050
23017
|
resources: [...resources, ...trimmedPracticeGuidance.resources],
|
|
23051
23018
|
practiceGuidance: trimmedPracticeGuidance
|
|
@@ -23095,11 +23062,8 @@ async function compileLandscapeTaskContext(input) {
|
|
|
23095
23062
|
edges: codeContext.edges,
|
|
23096
23063
|
observedEvidence: codeContext.evidence
|
|
23097
23064
|
});
|
|
23098
|
-
const confidence = computeRefactorConfidence({
|
|
23099
|
-
|
|
23100
|
-
testsAvailable: codeContext.evidence.some((evidence) => evidence.confidence === "verified"),
|
|
23101
|
-
rollbackAvailable: true
|
|
23102
|
-
});
|
|
23065
|
+
const confidence = computeRefactorConfidence(input.readinessEvidence ?? {});
|
|
23066
|
+
const readinessUnknowns = refactorReadinessUnknowns(confidence);
|
|
23103
23067
|
const posture = decidePosture(pressure, confidence);
|
|
23104
23068
|
const landscapeHash = landscapeDigest(input.landscape, input.relations);
|
|
23105
23069
|
const resources = [
|
|
@@ -23134,7 +23098,7 @@ async function compileLandscapeTaskContext(input) {
|
|
|
23134
23098
|
constraints: practiceGuidance.constraints,
|
|
23135
23099
|
decisions: practiceGuidance.decisions,
|
|
23136
23100
|
realConstraints: unique3(["cross-repo-content-local-only", "git-worktree-is-collaboration-boundary", ...practiceGuidance.realConstraints]),
|
|
23137
|
-
unknowns: [],
|
|
23101
|
+
unknowns: unique3([...practiceGuidance.unknowns, ...readinessUnknowns]),
|
|
23138
23102
|
recommendedTargetState: {
|
|
23139
23103
|
activeRepositories: activeRepositoryIds,
|
|
23140
23104
|
practiceCatalogDigest: practiceGuidance.catalogDigest,
|
|
@@ -23153,6 +23117,7 @@ async function compileLandscapeTaskContext(input) {
|
|
|
23153
23117
|
constraints: trimmedPracticeGuidance.constraints,
|
|
23154
23118
|
decisions: trimmedPracticeGuidance.decisions,
|
|
23155
23119
|
realConstraints: unique3(["cross-repo-content-local-only", "git-worktree-is-collaboration-boundary", ...trimmedPracticeGuidance.realConstraints]),
|
|
23120
|
+
unknowns: unique3([...trimmedPracticeGuidance.unknowns, ...readinessUnknowns]),
|
|
23156
23121
|
requiredCheckpoints: unique3(["before-task-complete", "landscape-scope-review", ...trimmedPracticeGuidance.requiredCheckpoints]),
|
|
23157
23122
|
resources: [...resources, ...trimmedPracticeGuidance.resources],
|
|
23158
23123
|
practiceGuidance: trimmedPracticeGuidance
|
|
@@ -23174,6 +23139,13 @@ async function compileLandscapeTaskContext(input) {
|
|
|
23174
23139
|
maxBytes: input.budget.maxBytes
|
|
23175
23140
|
});
|
|
23176
23141
|
}
|
|
23142
|
+
function refactorReadinessUnknowns(confidence) {
|
|
23143
|
+
return [
|
|
23144
|
+
...confidence.evidence.callerCoverage === null ? ["refactor-readiness:caller-coverage-unknown"] : [],
|
|
23145
|
+
...confidence.evidence.testsAvailable === null ? ["refactor-readiness:tests-available-unknown"] : [],
|
|
23146
|
+
...confidence.evidence.rollbackAvailable === null ? ["refactor-readiness:rollback-available-unknown"] : []
|
|
23147
|
+
];
|
|
23148
|
+
}
|
|
23177
23149
|
function finalizeContext(context, digests) {
|
|
23178
23150
|
const withMetadata = {
|
|
23179
23151
|
...context,
|
|
@@ -23487,13 +23459,23 @@ function isCompatibilityFinding(finding) {
|
|
|
23487
23459
|
|
|
23488
23460
|
// packages/core/application/src/index.ts
|
|
23489
23461
|
async function prepareTask(input) {
|
|
23462
|
+
const confidence = computeRefactorConfidence({
|
|
23463
|
+
callerCoverage: input.callerCoverage,
|
|
23464
|
+
testsAvailable: input.testsAvailable,
|
|
23465
|
+
rollbackAvailable: input.rollbackAvailable
|
|
23466
|
+
});
|
|
23490
23467
|
const context = await compileTaskContext({
|
|
23491
23468
|
workspace: input.workspace,
|
|
23492
23469
|
task: input.task,
|
|
23493
23470
|
codeFacts: input.codeFacts,
|
|
23494
23471
|
modelStore: input.modelStore,
|
|
23495
23472
|
architectureLedger: input.architectureLedger,
|
|
23496
|
-
budget: input.budget ?? { maxBytes: 12288, maxItems: 12 }
|
|
23473
|
+
budget: input.budget ?? { maxBytes: 12288, maxItems: 12 },
|
|
23474
|
+
readinessEvidence: {
|
|
23475
|
+
callerCoverage: input.callerCoverage,
|
|
23476
|
+
testsAvailable: input.testsAvailable,
|
|
23477
|
+
rollbackAvailable: input.rollbackAvailable
|
|
23478
|
+
}
|
|
23497
23479
|
});
|
|
23498
23480
|
const pressure = {
|
|
23499
23481
|
level: context.architecturePressure.level,
|
|
@@ -23506,11 +23488,6 @@ async function prepareTask(input) {
|
|
|
23506
23488
|
evidenceDetails: []
|
|
23507
23489
|
}))
|
|
23508
23490
|
};
|
|
23509
|
-
const confidence = computeRefactorConfidence({
|
|
23510
|
-
callerCoverage: input.callerCoverage ?? 0.8,
|
|
23511
|
-
testsAvailable: input.testsAvailable ?? true,
|
|
23512
|
-
rollbackAvailable: input.rollbackAvailable ?? true
|
|
23513
|
-
});
|
|
23514
23491
|
const posture = decidePosture(pressure, confidence);
|
|
23515
23492
|
return {
|
|
23516
23493
|
context,
|
|
@@ -23518,7 +23495,7 @@ async function prepareTask(input) {
|
|
|
23518
23495
|
confidence,
|
|
23519
23496
|
posture,
|
|
23520
23497
|
proofPoint: posture === "proof-required" ? createProofPoint(input.task) : undefined,
|
|
23521
|
-
intervention:
|
|
23498
|
+
intervention: undefined
|
|
23522
23499
|
};
|
|
23523
23500
|
}
|
|
23524
23501
|
async function checkpointTask(input) {
|
|
@@ -34742,8 +34719,8 @@ class ArchctxDaemon {
|
|
|
34742
34719
|
});
|
|
34743
34720
|
return okEnvelope("refactor.record", {
|
|
34744
34721
|
schemaVersion: "archcontext.runtime-refactor-record/v1",
|
|
34745
|
-
repository:
|
|
34746
|
-
worktree:
|
|
34722
|
+
repository: gitScope.repository,
|
|
34723
|
+
worktree: gitScope.worktree,
|
|
34747
34724
|
assessmentDigest: registered.assessment.assessmentDigest,
|
|
34748
34725
|
runId: built.plan.run.runId,
|
|
34749
34726
|
catalogDigest: built.plan.run.catalogDigest,
|
|
@@ -40997,7 +40974,7 @@ async function runArchitectureDocsProjectionCommand(args2, cwd, daemon) {
|
|
|
40997
40974
|
});
|
|
40998
40975
|
}
|
|
40999
40976
|
if (subcommand === "adopt") {
|
|
41000
|
-
return runArchitectureDocsAdoptionCommand(args2, root, daemon, projection3, profile, generatedAt
|
|
40977
|
+
return runArchitectureDocsAdoptionCommand(args2, root, daemon, projection3, profile, generatedAt);
|
|
41001
40978
|
}
|
|
41002
40979
|
if (projection3.plan.rejected.length > 0) {
|
|
41003
40980
|
return errorEnvelope("docs.plan", "AC_PRECONDITION_FAILED", `Architecture documentation projection requires explicit adoption or ownership repair: ${projection3.plan.rejected.map((diff) => `${diff.path} (${diff.reasonCode})`).join(", ")}`);
|
|
@@ -41133,7 +41110,7 @@ function architectureProjectionProfile(args2) {
|
|
|
41133
41110
|
}
|
|
41134
41111
|
return profile;
|
|
41135
41112
|
}
|
|
41136
|
-
async function runArchitectureDocsAdoptionCommand(args2, root, daemon, projection3, profile, generatedAt,
|
|
41113
|
+
async function runArchitectureDocsAdoptionCommand(args2, root, daemon, projection3, profile, generatedAt, protocolRequest) {
|
|
41137
41114
|
if (profile !== REPO_HARNESS_PROJECTION_PROFILE) {
|
|
41138
41115
|
return errorEnvelope("docs.adopt", "AC_SCHEMA_INVALID", `docs adopt requires --profile ${REPO_HARNESS_PROJECTION_PROFILE}`);
|
|
41139
41116
|
}
|
|
@@ -41353,7 +41330,7 @@ async function runProjectionProtocolCommand(args2, cwd, daemon) {
|
|
|
41353
41330
|
expectedWorktreeDigest,
|
|
41354
41331
|
"--task-session-id",
|
|
41355
41332
|
request.requestId
|
|
41356
|
-
], root, daemon, projection3, REPO_HARNESS_PROJECTION_PROFILE, generatedAt, request
|
|
41333
|
+
], root, daemon, projection3, REPO_HARNESS_PROJECTION_PROFILE, generatedAt, request);
|
|
41357
41334
|
if (!adopted.ok)
|
|
41358
41335
|
return adopted;
|
|
41359
41336
|
return adopted;
|