@llm-dev-ops/agentics-cli 2.7.1 → 2.7.2
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/pipeline/auto-chain.d.ts +28 -2
- package/dist/pipeline/auto-chain.d.ts.map +1 -1
- package/dist/pipeline/auto-chain.js +66 -4
- package/dist/pipeline/auto-chain.js.map +1 -1
- package/dist/pipeline/enterprise/agent-error-capture.d.ts +76 -0
- package/dist/pipeline/enterprise/agent-error-capture.d.ts.map +1 -0
- package/dist/pipeline/enterprise/agent-error-capture.js +141 -0
- package/dist/pipeline/enterprise/agent-error-capture.js.map +1 -0
- package/dist/pipeline/enterprise/pass-executor.d.ts.map +1 -1
- package/dist/pipeline/enterprise/pass-executor.js +52 -0
- package/dist/pipeline/enterprise/pass-executor.js.map +1 -1
- package/dist/pipeline/enterprise/pipeline-orchestrator.d.ts.map +1 -1
- package/dist/pipeline/enterprise/pipeline-orchestrator.js +15 -0
- package/dist/pipeline/enterprise/pipeline-orchestrator.js.map +1 -1
- package/dist/pipeline/enterprise/types.d.ts +21 -0
- package/dist/pipeline/enterprise/types.d.ts.map +1 -1
- package/dist/pipeline/gate/feature-flags.d.ts +30 -0
- package/dist/pipeline/gate/feature-flags.d.ts.map +1 -0
- package/dist/pipeline/gate/feature-flags.js +37 -0
- package/dist/pipeline/gate/feature-flags.js.map +1 -0
- package/dist/pipeline/gate/phase-dependency-gate.d.ts +86 -0
- package/dist/pipeline/gate/phase-dependency-gate.d.ts.map +1 -1
- package/dist/pipeline/gate/phase-dependency-gate.js +263 -41
- package/dist/pipeline/gate/phase-dependency-gate.js.map +1 -1
- package/dist/pipeline/local-fallback/phase1-consensus-reader.d.ts +33 -0
- package/dist/pipeline/local-fallback/phase1-consensus-reader.d.ts.map +1 -0
- package/dist/pipeline/local-fallback/phase1-consensus-reader.js +99 -0
- package/dist/pipeline/local-fallback/phase1-consensus-reader.js.map +1 -0
- package/dist/pipeline/local-fallback/phase3-local-fallback.d.ts +26 -0
- package/dist/pipeline/local-fallback/phase3-local-fallback.d.ts.map +1 -0
- package/dist/pipeline/local-fallback/phase3-local-fallback.js +127 -0
- package/dist/pipeline/local-fallback/phase3-local-fallback.js.map +1 -0
- package/dist/pipeline/local-fallback/phase4-local-fallback.d.ts +21 -0
- package/dist/pipeline/local-fallback/phase4-local-fallback.d.ts.map +1 -0
- package/dist/pipeline/local-fallback/phase4-local-fallback.js +240 -0
- package/dist/pipeline/local-fallback/phase4-local-fallback.js.map +1 -0
- package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts +28 -0
- package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts.map +1 -0
- package/dist/pipeline/local-fallback/phase5a-local-fallback.js +166 -0
- package/dist/pipeline/local-fallback/phase5a-local-fallback.js.map +1 -0
- package/dist/pipeline/phases/prompt-generator.d.ts.map +1 -1
- package/dist/pipeline/phases/prompt-generator.js +209 -1
- package/dist/pipeline/phases/prompt-generator.js.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.d.ts +8 -28
- package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.js +87 -0
- package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
- package/dist/pipeline/swarm-orchestrator.d.ts +47 -0
- package/dist/pipeline/swarm-orchestrator.d.ts.map +1 -1
- package/dist/pipeline/swarm-orchestrator.js +130 -3
- package/dist/pipeline/swarm-orchestrator.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-094 Decision 8 — Phase-1 consensus reader for local fallback
|
|
3
|
+
* generators. Reads Phase-1 simulator outputs (which Phase 1 writes flat to
|
|
4
|
+
* `<runDir>/`) and exposes them as a typed, normalized shape.
|
|
5
|
+
*
|
|
6
|
+
* Consumed by the phase3/4/5a local fallback generators. Resilient to
|
|
7
|
+
* partial Phase-1 output: any file may be missing; missing fields are left
|
|
8
|
+
* undefined and the caller decides what to synthesize from what's present.
|
|
9
|
+
*
|
|
10
|
+
* Honours both layouts:
|
|
11
|
+
* - flat (production): <runDir>/manifest.json
|
|
12
|
+
* - subdir (test fixture): <runDir>/phase1/manifest.json
|
|
13
|
+
*/
|
|
14
|
+
import * as fs from 'node:fs';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
/**
|
|
17
|
+
* Read Phase-1 outputs from `runDir`. Tries flat layout first (production),
|
|
18
|
+
* then subdir (legacy/test). Returns `undefined` only when nothing
|
|
19
|
+
* Phase-1-shaped exists; otherwise populates whichever fields were found.
|
|
20
|
+
*/
|
|
21
|
+
export function readPhase1Consensus(runDir) {
|
|
22
|
+
const tryRead = (rel) => {
|
|
23
|
+
for (const candidate of [path.join(runDir, rel), path.join(runDir, 'phase1', rel)]) {
|
|
24
|
+
try {
|
|
25
|
+
const stat = fs.statSync(candidate);
|
|
26
|
+
if (stat.isFile() && stat.size > 0)
|
|
27
|
+
return fs.readFileSync(candidate, 'utf8');
|
|
28
|
+
}
|
|
29
|
+
catch { /* try next */ }
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
const tryReadJson = (rel) => {
|
|
34
|
+
const raw = tryRead(rel);
|
|
35
|
+
if (!raw)
|
|
36
|
+
return undefined;
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(raw);
|
|
39
|
+
return (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
|
|
40
|
+
? parsed
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const manifest = tryReadJson('manifest.json');
|
|
48
|
+
const executiveSummary = tryRead('executive-summary.md');
|
|
49
|
+
const decisionMemo = tryRead('decision-memo.md');
|
|
50
|
+
const riskAssessment = tryReadJson('risk-assessment.json');
|
|
51
|
+
const scenario = tryReadJson('scenario.json');
|
|
52
|
+
// engineering/architecture-decisions.md is the consensus output written by
|
|
53
|
+
// some Phase-1 paths; the local fallback uses it when present to seed ADRs.
|
|
54
|
+
let architectureDecisions;
|
|
55
|
+
try {
|
|
56
|
+
architectureDecisions = fs.readFileSync(path.join(runDir, 'engineering', 'architecture-decisions.md'), 'utf8');
|
|
57
|
+
}
|
|
58
|
+
catch { /* missing is fine */ }
|
|
59
|
+
// Detect language from manifest.project.language; default to typescript.
|
|
60
|
+
let projectLanguage;
|
|
61
|
+
if (manifest && typeof manifest === 'object') {
|
|
62
|
+
const project = manifest['project'];
|
|
63
|
+
if (project && typeof project === 'object') {
|
|
64
|
+
const lang = project['language'];
|
|
65
|
+
if (typeof lang === 'string' && lang.trim().length > 0) {
|
|
66
|
+
projectLanguage = lang.trim();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Return undefined only if NOTHING phase-1-shaped was found.
|
|
71
|
+
if (!manifest && !executiveSummary && !decisionMemo &&
|
|
72
|
+
!riskAssessment && !scenario && !architectureDecisions) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
runDir,
|
|
77
|
+
manifest,
|
|
78
|
+
executiveSummary,
|
|
79
|
+
decisionMemo,
|
|
80
|
+
riskAssessment,
|
|
81
|
+
scenario,
|
|
82
|
+
architectureDecisions,
|
|
83
|
+
projectLanguage,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Extract the user-facing scenario query from a Phase-1 consensus. */
|
|
87
|
+
export function extractScenarioQuery(c) {
|
|
88
|
+
if (c.scenario && typeof c.scenario['summary'] === 'string') {
|
|
89
|
+
return c.scenario['summary'];
|
|
90
|
+
}
|
|
91
|
+
if (c.scenario && typeof c.scenario['query'] === 'string') {
|
|
92
|
+
return c.scenario['query'];
|
|
93
|
+
}
|
|
94
|
+
if (c.manifest && typeof c.manifest['scenario'] === 'string') {
|
|
95
|
+
return c.manifest['scenario'];
|
|
96
|
+
}
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=phase1-consensus-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase1-consensus-reader.js","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase1-consensus-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAclC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;QAClD,KAAK,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;YACnF,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;gBACpC,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC;oBAAE,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAChF,CAAC;YAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,GAAW,EAAuC,EAAE;QACvE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,GAAG;YAAE,OAAO,SAAS,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;YAC1C,OAAO,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAA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AAC,gBAAgB,IAAI,CAAC,YAAY;QAC/C,CAAC,cAAc,IAAI,CAAC,QAAQ,IAAI,CAAC,qBAAqB,EACtD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,QAAQ;QACR,qBAAqB;QACrB,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,oBAAoB,CAAC,CAAkB;IACrD,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC5D,OAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAY,CAAC;IAC3C,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1D,OAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAY,CAAC;IACzC,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAY,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-094 Decision 8 — Phase 3 local fallback generator.
|
|
3
|
+
*
|
|
4
|
+
* Consumes Phase-1 simulator consensus and produces a minimal SPARC
|
|
5
|
+
* specification: `phase3/sparc/specification.md` and a mirror at
|
|
6
|
+
* `engineering/sparc-specification.md` so downstream gates that accept
|
|
7
|
+
* either path are satisfied.
|
|
8
|
+
*
|
|
9
|
+
* Output is intentionally short (Functional Requirements + glossary) and
|
|
10
|
+
* tagged `quality: degraded` so consumers know the provenance. Pseudocode,
|
|
11
|
+
* refinement, and completion artifacts are NOT produced — those remain
|
|
12
|
+
* Ruflo's responsibility on the healthy path.
|
|
13
|
+
*/
|
|
14
|
+
export interface LocalFallbackResult {
|
|
15
|
+
readonly success: boolean;
|
|
16
|
+
readonly filesWritten: string[];
|
|
17
|
+
readonly reason?: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run the Phase-3 fallback. Idempotent: re-runs over an existing fallback
|
|
22
|
+
* just overwrite the same files. Best-effort: a failed write produces
|
|
23
|
+
* `success: false` but never throws.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runPhase3LocalFallback(runDir: string): LocalFallbackResult;
|
|
26
|
+
//# sourceMappingURL=phase3-local-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase3-local-fallback.d.ts","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase3-local-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAwC1E"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-094 Decision 8 — Phase 3 local fallback generator.
|
|
3
|
+
*
|
|
4
|
+
* Consumes Phase-1 simulator consensus and produces a minimal SPARC
|
|
5
|
+
* specification: `phase3/sparc/specification.md` and a mirror at
|
|
6
|
+
* `engineering/sparc-specification.md` so downstream gates that accept
|
|
7
|
+
* either path are satisfied.
|
|
8
|
+
*
|
|
9
|
+
* Output is intentionally short (Functional Requirements + glossary) and
|
|
10
|
+
* tagged `quality: degraded` so consumers know the provenance. Pseudocode,
|
|
11
|
+
* refinement, and completion artifacts are NOT produced — those remain
|
|
12
|
+
* Ruflo's responsibility on the healthy path.
|
|
13
|
+
*/
|
|
14
|
+
import * as fs from 'node:fs';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
import { readPhase1Consensus, extractScenarioQuery } from './phase1-consensus-reader.js';
|
|
17
|
+
/**
|
|
18
|
+
* Run the Phase-3 fallback. Idempotent: re-runs over an existing fallback
|
|
19
|
+
* just overwrite the same files. Best-effort: a failed write produces
|
|
20
|
+
* `success: false` but never throws.
|
|
21
|
+
*/
|
|
22
|
+
export function runPhase3LocalFallback(runDir) {
|
|
23
|
+
const consensus = readPhase1Consensus(runDir);
|
|
24
|
+
if (!consensus) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
filesWritten: [],
|
|
28
|
+
reason: 'no-phase1-consensus',
|
|
29
|
+
message: 'Phase-3 local fallback: no Phase-1 consensus on disk',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const filesWritten = [];
|
|
33
|
+
const sparcMd = buildSparcSpecificationMarkdown(consensus);
|
|
34
|
+
try {
|
|
35
|
+
const phase3SparcDir = path.join(runDir, 'phase3', 'sparc');
|
|
36
|
+
fs.mkdirSync(phase3SparcDir, { recursive: true });
|
|
37
|
+
const phase3Path = path.join(phase3SparcDir, 'specification.md');
|
|
38
|
+
fs.writeFileSync(phase3Path, sparcMd, 'utf8');
|
|
39
|
+
filesWritten.push('phase3/sparc/specification.md');
|
|
40
|
+
const engineeringDir = path.join(runDir, 'engineering');
|
|
41
|
+
fs.mkdirSync(engineeringDir, { recursive: true });
|
|
42
|
+
const engPath = path.join(engineeringDir, 'sparc-specification.md');
|
|
43
|
+
fs.writeFileSync(engPath, sparcMd, 'utf8');
|
|
44
|
+
filesWritten.push('engineering/sparc-specification.md');
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
filesWritten,
|
|
50
|
+
reason: 'write-error',
|
|
51
|
+
message: `Phase-3 local fallback: write failed — ${err.message}`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
filesWritten,
|
|
57
|
+
message: `Phase-3 local fallback: wrote ${filesWritten.length} SPARC artifact(s) (degraded)`,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function buildSparcSpecificationMarkdown(c) {
|
|
61
|
+
const lines = [];
|
|
62
|
+
const query = extractScenarioQuery(c) || '(no scenario recorded)';
|
|
63
|
+
lines.push('---');
|
|
64
|
+
lines.push('title: SPARC Specification (Phase-1 fallback)');
|
|
65
|
+
lines.push('quality: degraded');
|
|
66
|
+
lines.push('generator: local-fallback');
|
|
67
|
+
lines.push('source: phase1-consensus');
|
|
68
|
+
lines.push('---');
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push('# SPARC Specification');
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push('> Generated by local fallback (Ruflo unavailable). Quality: **degraded**.');
|
|
73
|
+
lines.push('> The full SPARC chain (specification, pseudocode, architecture, refinement,');
|
|
74
|
+
lines.push('> completion) is not produced in fallback mode — only this specification stub.');
|
|
75
|
+
lines.push('');
|
|
76
|
+
lines.push('## Brief');
|
|
77
|
+
lines.push('');
|
|
78
|
+
lines.push(query);
|
|
79
|
+
lines.push('');
|
|
80
|
+
if (c.executiveSummary) {
|
|
81
|
+
lines.push('## Functional Requirements (extracted from executive summary)');
|
|
82
|
+
lines.push('');
|
|
83
|
+
lines.push(c.executiveSummary.trim());
|
|
84
|
+
lines.push('');
|
|
85
|
+
}
|
|
86
|
+
else if (c.decisionMemo) {
|
|
87
|
+
lines.push('## Functional Requirements (extracted from decision memo)');
|
|
88
|
+
lines.push('');
|
|
89
|
+
lines.push(c.decisionMemo.trim());
|
|
90
|
+
lines.push('');
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// We must produce something non-empty over the gate's minBytes threshold.
|
|
94
|
+
lines.push('## Functional Requirements');
|
|
95
|
+
lines.push('');
|
|
96
|
+
lines.push('Functional requirements derived from the brief. Implement the system');
|
|
97
|
+
lines.push('described above following standard layered architecture conventions:');
|
|
98
|
+
lines.push('analysis layer, decision layer, integration layer, and persistence layer');
|
|
99
|
+
lines.push('with explicit boundaries and unit-tested pure functions.');
|
|
100
|
+
lines.push('');
|
|
101
|
+
}
|
|
102
|
+
if (c.decisionMemo) {
|
|
103
|
+
lines.push('## Architectural Rationale');
|
|
104
|
+
lines.push('');
|
|
105
|
+
lines.push(c.decisionMemo.trim());
|
|
106
|
+
lines.push('');
|
|
107
|
+
}
|
|
108
|
+
lines.push('## Pseudocode');
|
|
109
|
+
lines.push('');
|
|
110
|
+
lines.push('_Not produced in local-fallback mode. Ruflo authors pseudocode on the healthy path._');
|
|
111
|
+
lines.push('');
|
|
112
|
+
lines.push('## Architecture');
|
|
113
|
+
lines.push('');
|
|
114
|
+
lines.push('Single-service flat layout under `src/`. Bounded contexts are inferred at');
|
|
115
|
+
lines.push('the implementation prompt stage from Phase-1 consensus when no DDD is available.');
|
|
116
|
+
lines.push('');
|
|
117
|
+
lines.push('## Refinement');
|
|
118
|
+
lines.push('');
|
|
119
|
+
lines.push('_Not produced in local-fallback mode._');
|
|
120
|
+
lines.push('');
|
|
121
|
+
lines.push('## Completion');
|
|
122
|
+
lines.push('');
|
|
123
|
+
lines.push('_Not produced in local-fallback mode. Build phase consumes this spec directly._');
|
|
124
|
+
lines.push('');
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=phase3-local-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase3-local-fallback.js","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase3-local-fallback.ts"],"names":[],"mappings":"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QACf,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;IACnG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IACxF,KAAK,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAC/F,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACrD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAC9F,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-094 Decision 8 — Phase 4 local fallback generator.
|
|
3
|
+
*
|
|
4
|
+
* Produces minimal Architecture Decision Records, a domain model, and a
|
|
5
|
+
* bounded-contexts manifest from Phase-1 simulator consensus. Output is
|
|
6
|
+
* tagged `quality: degraded` and is sufficient to satisfy the Phase 5a
|
|
7
|
+
* gate's any-of clause (the prompt generator's Phase-1 fallback branch
|
|
8
|
+
* also accepts these as inputs).
|
|
9
|
+
*/
|
|
10
|
+
import type { LocalFallbackResult } from './phase3-local-fallback.js';
|
|
11
|
+
/**
|
|
12
|
+
* Run the Phase-4 fallback. Writes:
|
|
13
|
+
* - phase4/adrs/ADR-001-system-decomposition.md
|
|
14
|
+
* - phase4/adrs/ADR-002-integration-surface.md
|
|
15
|
+
* - phase4/adrs/adr-index.json
|
|
16
|
+
* - phase4/ddd/bounded-contexts.json
|
|
17
|
+
* - phase4/ddd/domain-model.md
|
|
18
|
+
* - engineering/architecture-decisions.md (consensus surface form)
|
|
19
|
+
*/
|
|
20
|
+
export declare function runPhase4LocalFallback(runDir: string): LocalFallbackResult;
|
|
21
|
+
//# sourceMappingURL=phase4-local-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase4-local-fallback.d.ts","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase4-local-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CA8E1E"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-094 Decision 8 — Phase 4 local fallback generator.
|
|
3
|
+
*
|
|
4
|
+
* Produces minimal Architecture Decision Records, a domain model, and a
|
|
5
|
+
* bounded-contexts manifest from Phase-1 simulator consensus. Output is
|
|
6
|
+
* tagged `quality: degraded` and is sufficient to satisfy the Phase 5a
|
|
7
|
+
* gate's any-of clause (the prompt generator's Phase-1 fallback branch
|
|
8
|
+
* also accepts these as inputs).
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import { readPhase1Consensus } from './phase1-consensus-reader.js';
|
|
13
|
+
/**
|
|
14
|
+
* Run the Phase-4 fallback. Writes:
|
|
15
|
+
* - phase4/adrs/ADR-001-system-decomposition.md
|
|
16
|
+
* - phase4/adrs/ADR-002-integration-surface.md
|
|
17
|
+
* - phase4/adrs/adr-index.json
|
|
18
|
+
* - phase4/ddd/bounded-contexts.json
|
|
19
|
+
* - phase4/ddd/domain-model.md
|
|
20
|
+
* - engineering/architecture-decisions.md (consensus surface form)
|
|
21
|
+
*/
|
|
22
|
+
export function runPhase4LocalFallback(runDir) {
|
|
23
|
+
const consensus = readPhase1Consensus(runDir);
|
|
24
|
+
if (!consensus) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
filesWritten: [],
|
|
28
|
+
reason: 'no-phase1-consensus',
|
|
29
|
+
message: 'Phase-4 local fallback: no Phase-1 consensus on disk',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const filesWritten = [];
|
|
33
|
+
try {
|
|
34
|
+
// ── ADRs ──────────────────────────────────────────────────────────────
|
|
35
|
+
const adrsDir = path.join(runDir, 'phase4', 'adrs');
|
|
36
|
+
fs.mkdirSync(adrsDir, { recursive: true });
|
|
37
|
+
const adrs = buildMinimalADRs(consensus);
|
|
38
|
+
for (const adr of adrs) {
|
|
39
|
+
const filename = `ADR-${String(adr.number).padStart(3, '0')}-${adr.slug}.md`;
|
|
40
|
+
fs.writeFileSync(path.join(adrsDir, filename), adr.body, 'utf8');
|
|
41
|
+
filesWritten.push(`phase4/adrs/${filename}`);
|
|
42
|
+
}
|
|
43
|
+
fs.writeFileSync(path.join(adrsDir, 'adr-index.json'), JSON.stringify({ generator: 'local-fallback', quality: 'degraded', adrs: adrs.map(a => ({
|
|
44
|
+
id: `ADR-${String(a.number).padStart(3, '0')}`, title: a.title, file: `ADR-${String(a.number).padStart(3, '0')}-${a.slug}.md`,
|
|
45
|
+
})) }, null, 2), 'utf8');
|
|
46
|
+
filesWritten.push('phase4/adrs/adr-index.json');
|
|
47
|
+
// ── DDD ───────────────────────────────────────────────────────────────
|
|
48
|
+
const dddDir = path.join(runDir, 'phase4', 'ddd');
|
|
49
|
+
fs.mkdirSync(dddDir, { recursive: true });
|
|
50
|
+
const boundedContexts = buildMinimalBoundedContexts(consensus);
|
|
51
|
+
fs.writeFileSync(path.join(dddDir, 'bounded-contexts.json'), JSON.stringify(boundedContexts, null, 2), 'utf8');
|
|
52
|
+
filesWritten.push('phase4/ddd/bounded-contexts.json');
|
|
53
|
+
fs.writeFileSync(path.join(dddDir, 'domain-model.md'), buildDomainModelMarkdown(consensus, boundedContexts), 'utf8');
|
|
54
|
+
filesWritten.push('phase4/ddd/domain-model.md');
|
|
55
|
+
// ── Engineering surface (mirror) ──────────────────────────────────────
|
|
56
|
+
const engDir = path.join(runDir, 'engineering');
|
|
57
|
+
fs.mkdirSync(engDir, { recursive: true });
|
|
58
|
+
fs.writeFileSync(path.join(engDir, 'architecture-decisions.md'), buildEngineeringConsensusMarkdown(consensus, adrs), 'utf8');
|
|
59
|
+
filesWritten.push('engineering/architecture-decisions.md');
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
filesWritten,
|
|
65
|
+
reason: 'write-error',
|
|
66
|
+
message: `Phase-4 local fallback: write failed — ${err.message}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
filesWritten,
|
|
72
|
+
message: `Phase-4 local fallback: wrote ${filesWritten.length} architecture artifacts (degraded)`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function buildMinimalADRs(c) {
|
|
76
|
+
const decisionMemo = c.decisionMemo?.trim() ?? '';
|
|
77
|
+
// ADR-001 — System decomposition. Always emitted as the seed decision.
|
|
78
|
+
const adr1Body = [
|
|
79
|
+
'---',
|
|
80
|
+
'id: ADR-001',
|
|
81
|
+
'title: System Decomposition (Phase-1 fallback)',
|
|
82
|
+
'status: Proposed',
|
|
83
|
+
'quality: degraded',
|
|
84
|
+
'generator: local-fallback',
|
|
85
|
+
'source: phase1-consensus',
|
|
86
|
+
'---',
|
|
87
|
+
'',
|
|
88
|
+
'# ADR-001: System Decomposition',
|
|
89
|
+
'',
|
|
90
|
+
'> Generated by local fallback (Ruflo unavailable). Quality: **degraded**.',
|
|
91
|
+
'',
|
|
92
|
+
'## Context',
|
|
93
|
+
'',
|
|
94
|
+
decisionMemo || 'Phase-1 simulator consensus indicates a single-service decomposition is appropriate for this scenario; bounded contexts are inferred from the brief at implementation time.',
|
|
95
|
+
'',
|
|
96
|
+
'## Decision',
|
|
97
|
+
'',
|
|
98
|
+
'Single-service architecture with three internal layers — analysis, decision, integration — separated by explicit interfaces. Persistence and external IO live behind narrow ports so the analysis and decision layers stay testable without a network or database.',
|
|
99
|
+
'',
|
|
100
|
+
'## Consequences',
|
|
101
|
+
'',
|
|
102
|
+
'- **Positive:** Minimal coordination cost; fast to ship; easy to reason about.',
|
|
103
|
+
'- **Negative:** No bounded-context boundaries enforced at the module-system level; future split requires refactoring.',
|
|
104
|
+
'',
|
|
105
|
+
].join('\n');
|
|
106
|
+
// ADR-002 — Integration surface. Always emitted because most scenarios
|
|
107
|
+
// we serve involve at least one external surface (ERP, webhook, etc.).
|
|
108
|
+
const adr2Body = [
|
|
109
|
+
'---',
|
|
110
|
+
'id: ADR-002',
|
|
111
|
+
'title: Integration Surface (Phase-1 fallback)',
|
|
112
|
+
'status: Proposed',
|
|
113
|
+
'quality: degraded',
|
|
114
|
+
'generator: local-fallback',
|
|
115
|
+
'source: phase1-consensus',
|
|
116
|
+
'---',
|
|
117
|
+
'',
|
|
118
|
+
'# ADR-002: Integration Surface',
|
|
119
|
+
'',
|
|
120
|
+
'> Generated by local fallback (Ruflo unavailable). Quality: **degraded**.',
|
|
121
|
+
'',
|
|
122
|
+
'## Context',
|
|
123
|
+
'',
|
|
124
|
+
'External integrations (ERP, REST APIs, webhooks) require an explicit surface so the integration layer is testable without live endpoints.',
|
|
125
|
+
'',
|
|
126
|
+
'## Decision',
|
|
127
|
+
'',
|
|
128
|
+
'Define one `IntegrationPort` interface per external surface. Adapters live under `src/integration/`. Adapters MUST validate inbound payloads, propagate correlation IDs end-to-end, and surface meaningful errors as typed `AppError` subclasses.',
|
|
129
|
+
'',
|
|
130
|
+
'## Consequences',
|
|
131
|
+
'',
|
|
132
|
+
'- **Positive:** Clear contract for future adapters; easy to mock in tests.',
|
|
133
|
+
'- **Negative:** One interface per surface adds boilerplate when surfaces are simple.',
|
|
134
|
+
'',
|
|
135
|
+
].join('\n');
|
|
136
|
+
return [
|
|
137
|
+
{ number: 1, slug: 'system-decomposition', title: 'System Decomposition (Phase-1 fallback)', body: adr1Body },
|
|
138
|
+
{ number: 2, slug: 'integration-surface', title: 'Integration Surface (Phase-1 fallback)', body: adr2Body },
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
function buildMinimalBoundedContexts(_c) {
|
|
142
|
+
return {
|
|
143
|
+
generator: 'local-fallback',
|
|
144
|
+
quality: 'degraded',
|
|
145
|
+
contexts: [
|
|
146
|
+
{
|
|
147
|
+
name: 'Analysis',
|
|
148
|
+
description: 'Pure functions that compute analytical outputs from inbound data.',
|
|
149
|
+
aggregates: ['AnalysisResult'],
|
|
150
|
+
layer: 'core',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'Decision',
|
|
154
|
+
description: 'Decision-making layer — consumes Analysis output and emits actionable recommendations.',
|
|
155
|
+
aggregates: ['Decision'],
|
|
156
|
+
layer: 'core',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'Integration',
|
|
160
|
+
description: 'Outbound integration with external surfaces (ERP, webhook).',
|
|
161
|
+
aggregates: ['IntegrationCall', 'IntegrationReceipt'],
|
|
162
|
+
layer: 'edge',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
contextMap: [
|
|
166
|
+
{ upstream: 'Analysis', downstream: 'Decision', relationship: 'Customer-Supplier' },
|
|
167
|
+
{ upstream: 'Decision', downstream: 'Integration', relationship: 'Open Host Service' },
|
|
168
|
+
],
|
|
169
|
+
ubiquitousLanguage: [
|
|
170
|
+
{ term: 'AnalysisResult', definition: 'Output of the Analysis layer; immutable record of computed metrics.' },
|
|
171
|
+
{ term: 'Decision', definition: 'Output of the Decision layer; recommended next action with rationale.' },
|
|
172
|
+
{ term: 'IntegrationCall', definition: 'A request emitted to an external surface with a correlation ID.' },
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function buildDomainModelMarkdown(c, m) {
|
|
177
|
+
const lines = [];
|
|
178
|
+
lines.push('---');
|
|
179
|
+
lines.push('title: Domain Model (Phase-1 fallback)');
|
|
180
|
+
lines.push('quality: degraded');
|
|
181
|
+
lines.push('generator: local-fallback');
|
|
182
|
+
lines.push('---');
|
|
183
|
+
lines.push('');
|
|
184
|
+
lines.push('# Domain Model');
|
|
185
|
+
lines.push('');
|
|
186
|
+
lines.push('> Generated by local fallback (Ruflo unavailable). Quality: **degraded**.');
|
|
187
|
+
lines.push('');
|
|
188
|
+
lines.push('## Bounded Contexts');
|
|
189
|
+
lines.push('');
|
|
190
|
+
for (const ctx of m.contexts) {
|
|
191
|
+
lines.push(`### ${ctx.name} (${ctx.layer})`);
|
|
192
|
+
lines.push('');
|
|
193
|
+
lines.push(ctx.description);
|
|
194
|
+
lines.push('');
|
|
195
|
+
lines.push(`**Aggregates:** ${ctx.aggregates.join(', ')}`);
|
|
196
|
+
lines.push('');
|
|
197
|
+
}
|
|
198
|
+
lines.push('## Context Map');
|
|
199
|
+
lines.push('');
|
|
200
|
+
for (const r of m.contextMap) {
|
|
201
|
+
lines.push(`- ${r.upstream} → ${r.downstream} (${r.relationship})`);
|
|
202
|
+
}
|
|
203
|
+
lines.push('');
|
|
204
|
+
if (c.executiveSummary) {
|
|
205
|
+
lines.push('## Source — Phase-1 Executive Summary');
|
|
206
|
+
lines.push('');
|
|
207
|
+
lines.push(c.executiveSummary.trim());
|
|
208
|
+
lines.push('');
|
|
209
|
+
}
|
|
210
|
+
return lines.join('\n');
|
|
211
|
+
}
|
|
212
|
+
function buildEngineeringConsensusMarkdown(c, adrs) {
|
|
213
|
+
const lines = [];
|
|
214
|
+
lines.push('---');
|
|
215
|
+
lines.push('title: Architecture Decisions (engineering consensus, Phase-1 fallback)');
|
|
216
|
+
lines.push('quality: degraded');
|
|
217
|
+
lines.push('generator: local-fallback');
|
|
218
|
+
lines.push('---');
|
|
219
|
+
lines.push('');
|
|
220
|
+
lines.push('# Architecture Decisions — Consensus');
|
|
221
|
+
lines.push('');
|
|
222
|
+
lines.push('> Generated by local fallback (Ruflo unavailable). Quality: **degraded**.');
|
|
223
|
+
lines.push('');
|
|
224
|
+
for (const adr of adrs) {
|
|
225
|
+
lines.push(`## ADR-${String(adr.number).padStart(3, '0')}: ${adr.title}`);
|
|
226
|
+
lines.push('');
|
|
227
|
+
// Strip the frontmatter and reuse the prose body.
|
|
228
|
+
const body = adr.body.replace(/^---[\s\S]*?---\n*/, '').trim();
|
|
229
|
+
lines.push(body);
|
|
230
|
+
lines.push('');
|
|
231
|
+
}
|
|
232
|
+
if (c.decisionMemo) {
|
|
233
|
+
lines.push('## Phase-1 Decision Memo (raw)');
|
|
234
|
+
lines.push('');
|
|
235
|
+
lines.push(c.decisionMemo.trim());
|
|
236
|
+
lines.push('');
|
|
237
|
+
}
|
|
238
|
+
return lines.join('\n');
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=phase4-local-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase4-local-fallback.js","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase4-local-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OA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minimal implementation prompts (`prompts/impl-001-*.md`) and
|
|
5
|
+
* `prompts/execution-plan.json` from Phase-1 simulator consensus when Ruflo
|
|
6
|
+
* is unavailable. Output is sufficient to satisfy ADR-094 Decision 3's
|
|
7
|
+
* Phase 5b hard-block (`phase5a/execution-plan.json` ≥ 50 bytes).
|
|
8
|
+
*
|
|
9
|
+
* The prompt-generator already has its own Phase-1 fallback path
|
|
10
|
+
* (ADR-094 D2). This module exists for the case where the gate's Ruflo
|
|
11
|
+
* invocation hits us before the prompt-generator runs — typically via
|
|
12
|
+
* `runPrimaryPhaseExecution(phase5a-prompts, ...)` on the unavailable path.
|
|
13
|
+
*
|
|
14
|
+
* For consistency with the prompt-generator, output paths and the prompt
|
|
15
|
+
* frontmatter shape match D2's output.
|
|
16
|
+
*/
|
|
17
|
+
import type { LocalFallbackResult } from './phase3-local-fallback.js';
|
|
18
|
+
/**
|
|
19
|
+
* Run the Phase-5a fallback. Writes:
|
|
20
|
+
* - phase5a/execution-plan.json
|
|
21
|
+
* - prompts/impl-001-phase1-consensus.md
|
|
22
|
+
*
|
|
23
|
+
* If `phase5a/execution-plan.json` already exists (e.g. from the
|
|
24
|
+
* prompt-generator's D2 path), this is a no-op success — we never overwrite
|
|
25
|
+
* a richer execution plan with a fallback one.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runPhase5aLocalFallback(runDir: string): LocalFallbackResult;
|
|
28
|
+
//# sourceMappingURL=phase5a-local-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase5a-local-fallback.d.ts","sourceRoot":"","sources":["../../../src/pipeline/local-fallback/phase5a-local-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAyE3E"}
|