@hongmaple0820/scale-engine 0.15.1 → 0.17.0
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/agents/LeadershipPresets.d.ts +16 -0
- package/dist/agents/LeadershipPresets.js +152 -0
- package/dist/agents/LeadershipPresets.js.map +1 -0
- package/dist/api/cli.js +774 -8
- package/dist/api/cli.js.map +1 -1
- package/dist/artifact/types.d.ts +4 -0
- package/dist/artifact/types.js.map +1 -1
- package/dist/cli/phaseCommands.d.ts +14 -0
- package/dist/cli/phaseCommands.js +187 -6
- package/dist/cli/phaseCommands.js.map +1 -1
- package/dist/cli/vibeCommands.d.ts +20 -0
- package/dist/cli/vibeCommands.js +150 -173
- package/dist/cli/vibeCommands.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts/VibeTemplateGallery.d.ts +25 -0
- package/dist/prompts/VibeTemplateGallery.js +295 -0
- package/dist/prompts/VibeTemplateGallery.js.map +1 -0
- package/dist/skills/SkillRepository.d.ts +63 -0
- package/dist/skills/SkillRepository.js +365 -0
- package/dist/skills/SkillRepository.js.map +1 -0
- package/dist/tools/ToolCapabilityRegistry.d.ts +46 -0
- package/dist/tools/ToolCapabilityRegistry.js +223 -0
- package/dist/tools/ToolCapabilityRegistry.js.map +1 -0
- package/dist/tools/ToolEvidenceGate.d.ts +39 -0
- package/dist/tools/ToolEvidenceGate.js +117 -0
- package/dist/tools/ToolEvidenceGate.js.map +1 -0
- package/dist/tools/ToolEvidenceStore.d.ts +58 -0
- package/dist/tools/ToolEvidenceStore.js +129 -0
- package/dist/tools/ToolEvidenceStore.js.map +1 -0
- package/dist/tools/ToolOrchestrator.d.ts +67 -0
- package/dist/tools/ToolOrchestrator.js +246 -0
- package/dist/tools/ToolOrchestrator.js.map +1 -0
- package/dist/tools/ToolPolicy.d.ts +33 -0
- package/dist/tools/ToolPolicy.js +157 -0
- package/dist/tools/ToolPolicy.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/workflow/ContextGovernance.d.ts +51 -0
- package/dist/workflow/ContextGovernance.js +233 -0
- package/dist/workflow/ContextGovernance.js.map +1 -0
- package/dist/workflow/DiagnosticLoop.d.ts +40 -0
- package/dist/workflow/DiagnosticLoop.js +105 -0
- package/dist/workflow/DiagnosticLoop.js.map +1 -0
- package/dist/workflow/EngineeringStandards.d.ts +69 -0
- package/dist/workflow/EngineeringStandards.js +348 -6
- package/dist/workflow/EngineeringStandards.js.map +1 -1
- package/dist/workflow/GovernanceTemplatePacks.js +11 -9
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/GovernanceTemplates.js +15 -4
- package/dist/workflow/GovernanceTemplates.js.map +1 -1
- package/dist/workflow/TaskArtifactScaffolder.d.ts +22 -0
- package/dist/workflow/TaskArtifactScaffolder.js +55 -0
- package/dist/workflow/TaskArtifactScaffolder.js.map +1 -1
- package/dist/workflow/TddLoop.d.ts +47 -0
- package/dist/workflow/TddLoop.js +76 -0
- package/dist/workflow/TddLoop.js.map +1 -0
- package/dist/workflow/WorkflowGuidance.d.ts +26 -0
- package/dist/workflow/WorkflowGuidance.js +173 -0
- package/dist/workflow/WorkflowGuidance.js.map +1 -0
- package/dist/workflow/WorkflowOpenTasks.d.ts +16 -0
- package/dist/workflow/WorkflowOpenTasks.js +37 -0
- package/dist/workflow/WorkflowOpenTasks.js.map +1 -0
- package/dist/workflow/index.d.ts +5 -0
- package/dist/workflow/index.js +5 -0
- package/dist/workflow/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, normalize } from 'node:path';
|
|
3
|
+
const CONTEXT_CANDIDATES = ['CONTEXT.md', 'docs/CONTEXT.md'];
|
|
4
|
+
const CONTEXT_MAP_CANDIDATES = ['CONTEXT-MAP.md', 'docs/CONTEXT-MAP.md'];
|
|
5
|
+
export function analyzeContextGovernance(input) {
|
|
6
|
+
const projectDir = input.projectDir;
|
|
7
|
+
const contextPath = firstExisting(projectDir, CONTEXT_CANDIDATES);
|
|
8
|
+
const contextMapPath = firstExisting(projectDir, CONTEXT_MAP_CANDIDATES);
|
|
9
|
+
const findings = [];
|
|
10
|
+
const terms = contextPath ? parseContextTerms(readFileSync(contextPath, 'utf-8')) : [];
|
|
11
|
+
const contextMap = contextMapPath ? parseContextMap(readFileSync(contextMapPath, 'utf-8')) : new Map();
|
|
12
|
+
const moduleDocs = resolveModuleDocs(projectDir, input.changedFiles ?? [], contextMap);
|
|
13
|
+
if (!contextPath) {
|
|
14
|
+
findings.push({
|
|
15
|
+
code: 'missing-context-doc',
|
|
16
|
+
severity: 'error',
|
|
17
|
+
message: 'Missing CONTEXT.md. Domain language, aliases, and rejected meanings are not durable.',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!contextMapPath) {
|
|
21
|
+
findings.push({
|
|
22
|
+
code: 'missing-context-map',
|
|
23
|
+
severity: 'error',
|
|
24
|
+
message: 'Missing CONTEXT-MAP.md. Module ownership and product/architecture document links are not durable.',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
for (const doc of moduleDocs) {
|
|
28
|
+
if (!doc.productDocExists || !doc.architectureDocExists) {
|
|
29
|
+
findings.push({
|
|
30
|
+
code: 'missing-module-doc',
|
|
31
|
+
severity: 'error',
|
|
32
|
+
path: doc.moduleName,
|
|
33
|
+
message: `Module ${doc.moduleName} is touched but product or architecture docs are missing.`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const questions = buildContextQuestions(input.request, findings, moduleDocs);
|
|
38
|
+
const requiredArtifacts = unique([
|
|
39
|
+
!contextPath ? 'CONTEXT.md' : undefined,
|
|
40
|
+
!contextMapPath ? 'CONTEXT-MAP.md' : undefined,
|
|
41
|
+
...moduleDocs.flatMap(doc => [
|
|
42
|
+
doc.productDocExists ? undefined : doc.productDocPath,
|
|
43
|
+
doc.architectureDocExists ? undefined : doc.architectureDocPath,
|
|
44
|
+
]),
|
|
45
|
+
].filter(Boolean));
|
|
46
|
+
return {
|
|
47
|
+
ok: !findings.some(finding => finding.severity === 'error'),
|
|
48
|
+
projectDir,
|
|
49
|
+
request: input.request,
|
|
50
|
+
contextPath,
|
|
51
|
+
contextMapPath,
|
|
52
|
+
terms,
|
|
53
|
+
moduleDocs,
|
|
54
|
+
findings,
|
|
55
|
+
questions,
|
|
56
|
+
requiredArtifacts,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function renderContextGrillPrompt(report) {
|
|
60
|
+
const lines = [];
|
|
61
|
+
lines.push('# Context Grill');
|
|
62
|
+
lines.push('');
|
|
63
|
+
lines.push(`Request: ${report.request}`);
|
|
64
|
+
lines.push(`Status: ${report.ok ? 'ready' : 'blocked'}`);
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push('## Evidence');
|
|
67
|
+
lines.push(`- CONTEXT.md: ${report.contextPath ?? 'missing'}`);
|
|
68
|
+
lines.push(`- CONTEXT-MAP.md: ${report.contextMapPath ?? 'missing'}`);
|
|
69
|
+
if (report.terms.length > 0)
|
|
70
|
+
lines.push(`- Terms: ${report.terms.join(', ')}`);
|
|
71
|
+
for (const finding of report.findings) {
|
|
72
|
+
lines.push(`- [${finding.severity.toUpperCase()}] ${finding.code}: ${finding.message}`);
|
|
73
|
+
}
|
|
74
|
+
lines.push('');
|
|
75
|
+
lines.push('## Questions');
|
|
76
|
+
for (const question of report.questions) {
|
|
77
|
+
const marker = question.blocking ? 'BLOCKING' : 'CHECK';
|
|
78
|
+
lines.push(`- [${marker}] ${question.question}`);
|
|
79
|
+
lines.push(` Reason: ${question.reason}`);
|
|
80
|
+
}
|
|
81
|
+
return lines.join('\n');
|
|
82
|
+
}
|
|
83
|
+
export function writeContextGovernanceTemplates(input) {
|
|
84
|
+
const projectName = input.projectName ?? 'Project';
|
|
85
|
+
const files = new Map([
|
|
86
|
+
['CONTEXT.md', contextTemplate(projectName)],
|
|
87
|
+
['docs/CONTEXT-MAP.md', contextMapTemplate(projectName)],
|
|
88
|
+
]);
|
|
89
|
+
const created = [];
|
|
90
|
+
const skipped = [];
|
|
91
|
+
for (const [relativePath, content] of files) {
|
|
92
|
+
const filePath = join(input.projectDir, relativePath);
|
|
93
|
+
if (existsSync(filePath) && !input.force) {
|
|
94
|
+
skipped.push(filePath);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
98
|
+
writeFileSync(filePath, content, 'utf-8');
|
|
99
|
+
created.push(filePath);
|
|
100
|
+
}
|
|
101
|
+
return { created, skipped };
|
|
102
|
+
}
|
|
103
|
+
function firstExisting(projectDir, candidates) {
|
|
104
|
+
return candidates.map(candidate => join(projectDir, candidate)).find(path => existsSync(path));
|
|
105
|
+
}
|
|
106
|
+
function parseContextTerms(content) {
|
|
107
|
+
const terms = [];
|
|
108
|
+
for (const line of content.split(/\r?\n/)) {
|
|
109
|
+
if (!line.trim().startsWith('|'))
|
|
110
|
+
continue;
|
|
111
|
+
if (/\|\s*Term\s*\|/i.test(line) || /^\|\s*-+/.test(line.trim()))
|
|
112
|
+
continue;
|
|
113
|
+
const parts = line.split('|').map(part => part.trim()).filter(Boolean);
|
|
114
|
+
if (parts.length >= 2 && parts[0] !== '---')
|
|
115
|
+
terms.push(parts[0]);
|
|
116
|
+
}
|
|
117
|
+
return unique(terms);
|
|
118
|
+
}
|
|
119
|
+
function parseContextMap(content) {
|
|
120
|
+
const map = new Map();
|
|
121
|
+
for (const line of content.split(/\r?\n/)) {
|
|
122
|
+
if (!line.trim().startsWith('|'))
|
|
123
|
+
continue;
|
|
124
|
+
if (/\|\s*Module\s*\|/i.test(line) || /^\|\s*-+/.test(line.trim()))
|
|
125
|
+
continue;
|
|
126
|
+
const parts = line.split('|').map(part => part.trim()).filter(Boolean);
|
|
127
|
+
if (parts.length < 4 || parts[0] === '---')
|
|
128
|
+
continue;
|
|
129
|
+
map.set(parts[0], {
|
|
130
|
+
moduleName: parts[0],
|
|
131
|
+
productDocPath: parts[2],
|
|
132
|
+
architectureDocPath: parts[3],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return map;
|
|
136
|
+
}
|
|
137
|
+
function resolveModuleDocs(projectDir, changedFiles, contextMap) {
|
|
138
|
+
const modules = unique(changedFiles.map(inferModuleName).filter(Boolean));
|
|
139
|
+
return modules.map(moduleName => {
|
|
140
|
+
const mapped = contextMap.get(moduleName);
|
|
141
|
+
const productDocPath = mapped?.productDocPath ?? `docs/modules/${moduleName}/product.md`;
|
|
142
|
+
const architectureDocPath = mapped?.architectureDocPath ?? `docs/modules/${moduleName}/architecture.md`;
|
|
143
|
+
return {
|
|
144
|
+
moduleName,
|
|
145
|
+
productDocPath,
|
|
146
|
+
architectureDocPath,
|
|
147
|
+
productDocExists: existsSync(join(projectDir, productDocPath)),
|
|
148
|
+
architectureDocExists: existsSync(join(projectDir, architectureDocPath)),
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function inferModuleName(filePath) {
|
|
153
|
+
const normalized = normalize(filePath).replace(/\\/g, '/');
|
|
154
|
+
const parts = normalized.split('/').filter(Boolean);
|
|
155
|
+
const roots = new Set(['src', 'app', 'lib', 'services', 'packages', 'modules']);
|
|
156
|
+
if (parts.length >= 2 && roots.has(parts[0]))
|
|
157
|
+
return parts[1];
|
|
158
|
+
return parts[0];
|
|
159
|
+
}
|
|
160
|
+
function buildContextQuestions(request, findings, moduleDocs) {
|
|
161
|
+
const questions = [];
|
|
162
|
+
if (findings.some(finding => finding.code === 'missing-context-doc')) {
|
|
163
|
+
questions.push({
|
|
164
|
+
id: 'context-domain-language',
|
|
165
|
+
topic: 'domain-language',
|
|
166
|
+
question: 'Which domain terms, aliases, and forbidden meanings must be captured before implementation?',
|
|
167
|
+
reason: 'Without a project glossary, agents can invent inconsistent product language.',
|
|
168
|
+
blocking: true,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (findings.some(finding => finding.code === 'missing-context-map' || finding.code === 'missing-module-doc')) {
|
|
172
|
+
questions.push({
|
|
173
|
+
id: 'context-module-boundary',
|
|
174
|
+
topic: 'module-boundary',
|
|
175
|
+
question: `Which module owns ${moduleDocs.map(doc => doc.moduleName).join(', ') || 'this change'}, and which product/architecture docs must be updated?`,
|
|
176
|
+
reason: 'Module ownership and document links prevent stale specs and cross-module conflicts.',
|
|
177
|
+
blocking: true,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (/\btenant|auth|permission|security|token|quota|delete|payment|migration\b/i.test(request)) {
|
|
181
|
+
questions.push({
|
|
182
|
+
id: 'context-risk-boundary',
|
|
183
|
+
topic: 'risk-and-rollback',
|
|
184
|
+
question: 'What tenant/user isolation, authorization, rollback, and audit evidence is required?',
|
|
185
|
+
reason: 'The request touches a security or data-boundary concern.',
|
|
186
|
+
blocking: true,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
questions.push({
|
|
190
|
+
id: 'context-acceptance-evidence',
|
|
191
|
+
topic: 'acceptance-evidence',
|
|
192
|
+
question: 'Which command output, test report, screenshot, or product artifact will prove this is done?',
|
|
193
|
+
reason: 'Completion claims must be tied to durable evidence.',
|
|
194
|
+
blocking: false,
|
|
195
|
+
});
|
|
196
|
+
return questions;
|
|
197
|
+
}
|
|
198
|
+
function contextTemplate(projectName) {
|
|
199
|
+
return [
|
|
200
|
+
'# CONTEXT.md',
|
|
201
|
+
'',
|
|
202
|
+
`Project: ${projectName}`,
|
|
203
|
+
'',
|
|
204
|
+
'| Term | Definition | Examples | Aliases | Source |',
|
|
205
|
+
'|------|------------|----------|---------|--------|',
|
|
206
|
+
'| User | Person or service account using the product | login user | account | product |',
|
|
207
|
+
'',
|
|
208
|
+
'## Rejected Meanings',
|
|
209
|
+
'',
|
|
210
|
+
'- Record terms that agents must not reinterpret.',
|
|
211
|
+
'',
|
|
212
|
+
].join('\n');
|
|
213
|
+
}
|
|
214
|
+
function contextMapTemplate(projectName) {
|
|
215
|
+
return [
|
|
216
|
+
'# CONTEXT-MAP.md',
|
|
217
|
+
'',
|
|
218
|
+
`Project: ${projectName}`,
|
|
219
|
+
'',
|
|
220
|
+
'| Module | Owner | Product Doc | Architecture Doc |',
|
|
221
|
+
'| --- | --- | --- | --- |',
|
|
222
|
+
'| example | team | docs/modules/example/product.md | docs/modules/example/architecture.md |',
|
|
223
|
+
'',
|
|
224
|
+
'## Cross-Module Rules',
|
|
225
|
+
'',
|
|
226
|
+
'- Record ownership, upstream/downstream dependencies, and document update triggers here.',
|
|
227
|
+
'',
|
|
228
|
+
].join('\n');
|
|
229
|
+
}
|
|
230
|
+
function unique(items) {
|
|
231
|
+
return [...new Set(items)];
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=ContextGovernance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextGovernance.js","sourceRoot":"","sources":["../../src/workflow/ContextGovernance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AA0DpD,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAA;AAC5D,MAAM,sBAAsB,GAAG,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAA;AAExE,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;IACnC,MAAM,WAAW,GAAG,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAA;IACjE,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAA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EAAE,IAAI;SACf,CAAC,CAAA;IACJ,CAAC;IACD,SAAS,CAAC,IAAI,CAAC;QACb,EAAE,EAAE,6BAA6B;QACjC,KAAK,EAAE,qBAAqB;QAC5B,QAAQ,EAAE,6FAA6F;QACvG,MAAM,EAAE,qDAAqD;QAC7D,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAA;IACF,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,WAAmB;IAC1C,OAAO;QACL,cAAc;QACd,EAAE;QACF,YAAY,WAAW,EAAE;QACzB,EAAE;QACF,qDAAqD;QACrD,qDAAqD;QACrD,yFAAyF;QACzF,EAAE;QACF,sBAAsB;QACtB,EAAE;QACF,kDAAkD;QAClD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,WAAmB;IAC7C,OAAO;QACL,kBAAkB;QAClB,EAAE;QACF,YAAY,WAAW,EAAE;QACzB,EAAE;QACF,qDAAqD;QACrD,2BAA2B;QAC3B,6FAA6F;QAC7F,EAAE;QACF,uBAAuB;QACvB,EAAE;QACF,0FAA0F;QAC1F,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,SAAS,MAAM,CAAI,KAAU;IAC3B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface DiagnosticLoopInput {
|
|
2
|
+
taskId: string;
|
|
3
|
+
symptom: string;
|
|
4
|
+
reproductionCommand?: string;
|
|
5
|
+
expectedFailure?: string;
|
|
6
|
+
changedFiles?: string[];
|
|
7
|
+
verificationCommands?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface DiagnosticHypothesis {
|
|
10
|
+
id: string;
|
|
11
|
+
statement: string;
|
|
12
|
+
evidenceToCollect: string;
|
|
13
|
+
falsification: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DiagnosticInstrumentationStep {
|
|
16
|
+
description: string;
|
|
17
|
+
target: string;
|
|
18
|
+
cleanupRequired: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DiagnosticLoop {
|
|
21
|
+
taskId: string;
|
|
22
|
+
symptom: string;
|
|
23
|
+
reproduction: {
|
|
24
|
+
command?: string;
|
|
25
|
+
expectedFailure?: string;
|
|
26
|
+
};
|
|
27
|
+
changedFiles: string[];
|
|
28
|
+
hypotheses: DiagnosticHypothesis[];
|
|
29
|
+
instrumentationPlan: DiagnosticInstrumentationStep[];
|
|
30
|
+
verificationCommands: string[];
|
|
31
|
+
cleanupChecklist: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface DiagnosticValidation {
|
|
34
|
+
ready: boolean;
|
|
35
|
+
blockers: string[];
|
|
36
|
+
warnings: string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function createDiagnosticLoop(input: DiagnosticLoopInput): DiagnosticLoop;
|
|
39
|
+
export declare function validateDiagnosticLoop(loop: DiagnosticLoop): DiagnosticValidation;
|
|
40
|
+
export declare function renderDiagnosticLoopMarkdown(loop: DiagnosticLoop): string;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export function createDiagnosticLoop(input) {
|
|
2
|
+
const changedFiles = input.changedFiles ?? [];
|
|
3
|
+
return {
|
|
4
|
+
taskId: input.taskId,
|
|
5
|
+
symptom: input.symptom,
|
|
6
|
+
reproduction: {
|
|
7
|
+
command: input.reproductionCommand,
|
|
8
|
+
expectedFailure: input.expectedFailure,
|
|
9
|
+
},
|
|
10
|
+
changedFiles,
|
|
11
|
+
hypotheses: createHypotheses(input.symptom, changedFiles),
|
|
12
|
+
instrumentationPlan: createInstrumentationPlan(changedFiles),
|
|
13
|
+
verificationCommands: input.verificationCommands ?? compact([input.reproductionCommand]),
|
|
14
|
+
cleanupChecklist: [
|
|
15
|
+
'Remove debug logs, temporary traces, and noisy console output before review.',
|
|
16
|
+
'Delete temporary scripts, fixtures, screenshots, and local-only data after evidence is captured.',
|
|
17
|
+
'Keep only durable verification evidence referenced by the task artifact.',
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function validateDiagnosticLoop(loop) {
|
|
22
|
+
const blockers = [];
|
|
23
|
+
const warnings = [];
|
|
24
|
+
if (!loop.reproduction.command)
|
|
25
|
+
blockers.push('Missing reproduction command; debugging cannot start from a verified failure.');
|
|
26
|
+
if (!loop.reproduction.expectedFailure)
|
|
27
|
+
blockers.push('Missing expected failure; the reproduction must identify the wrong behavior.');
|
|
28
|
+
if (loop.hypotheses.length < 3)
|
|
29
|
+
blockers.push('At least three falsifiable hypotheses are required.');
|
|
30
|
+
if (loop.verificationCommands.length === 0)
|
|
31
|
+
blockers.push('Missing verification commands for the final fix.');
|
|
32
|
+
if (!loop.instrumentationPlan.some(step => step.cleanupRequired))
|
|
33
|
+
warnings.push('No cleanup-required instrumentation step was recorded.');
|
|
34
|
+
return {
|
|
35
|
+
ready: blockers.length === 0,
|
|
36
|
+
blockers,
|
|
37
|
+
warnings,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function renderDiagnosticLoopMarkdown(loop) {
|
|
41
|
+
const lines = [];
|
|
42
|
+
lines.push(`# Diagnostic Loop: ${loop.taskId}`);
|
|
43
|
+
lines.push('');
|
|
44
|
+
lines.push(`Symptom: ${loop.symptom}`);
|
|
45
|
+
lines.push('');
|
|
46
|
+
lines.push('## Reproduction');
|
|
47
|
+
lines.push(`- Command: ${loop.reproduction.command ?? 'MISSING'}`);
|
|
48
|
+
lines.push(`- Expected failure: ${loop.reproduction.expectedFailure ?? 'MISSING'}`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push('## Hypotheses');
|
|
51
|
+
for (const hypothesis of loop.hypotheses) {
|
|
52
|
+
lines.push(`- ${hypothesis.id}: ${hypothesis.statement}`);
|
|
53
|
+
lines.push(` Evidence: ${hypothesis.evidenceToCollect}`);
|
|
54
|
+
lines.push(` Falsify by: ${hypothesis.falsification}`);
|
|
55
|
+
}
|
|
56
|
+
lines.push('');
|
|
57
|
+
lines.push('## Instrumentation');
|
|
58
|
+
for (const step of loop.instrumentationPlan) {
|
|
59
|
+
lines.push(`- ${step.description} (${step.target}) cleanup=${step.cleanupRequired}`);
|
|
60
|
+
}
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push('## Cleanup');
|
|
63
|
+
for (const item of loop.cleanupChecklist)
|
|
64
|
+
lines.push(`- ${item}`);
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push('## Verification');
|
|
67
|
+
for (const command of loop.verificationCommands)
|
|
68
|
+
lines.push(`- ${command}`);
|
|
69
|
+
return lines.join('\n');
|
|
70
|
+
}
|
|
71
|
+
function createHypotheses(symptom, changedFiles) {
|
|
72
|
+
const scope = changedFiles.length > 0 ? changedFiles.join(', ') : 'the touched module';
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
id: 'H1',
|
|
76
|
+
statement: `The failing behavior is caused by an incorrect contract or route boundary in ${scope}.`,
|
|
77
|
+
evidenceToCollect: 'Compare the failing request, public interface, and registered handler or exported API.',
|
|
78
|
+
falsification: 'A direct contract check shows the request and handler agree.',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'H2',
|
|
82
|
+
statement: `The state transition or persistence path behind "${symptom}" is incomplete.`,
|
|
83
|
+
evidenceToCollect: 'Trace the minimal state read/write path and capture before/after values with redacted data.',
|
|
84
|
+
falsification: 'State changes are correct and durable across the reproduction.',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'H3',
|
|
88
|
+
statement: 'The issue is caused by configuration, dependency, environment, or fixture drift.',
|
|
89
|
+
evidenceToCollect: 'Record active config, dependency version, feature flag, and fixture setup used by the reproduction.',
|
|
90
|
+
falsification: 'The failure reproduces with a clean, documented configuration.',
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
function createInstrumentationPlan(changedFiles) {
|
|
95
|
+
const targets = changedFiles.length > 0 ? changedFiles : ['affected module'];
|
|
96
|
+
return targets.slice(0, 3).map(target => ({
|
|
97
|
+
description: 'Add the smallest temporary trace needed to prove or disprove one hypothesis.',
|
|
98
|
+
target,
|
|
99
|
+
cleanupRequired: true,
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
function compact(items) {
|
|
103
|
+
return items.filter((item) => item !== undefined);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=DiagnosticLoop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticLoop.js","sourceRoot":"","sources":["../../src/workflow/DiagnosticLoop.ts"],"names":[],"mappings":"AA0CA,MAAM,UAAU,oBAAoB,CAAC,KAA0B;IAC7D,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,EAAE,CAAA;IAC7C,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE;YACZ,OAAO,EAAE,KAAK,CAAC,mBAAmB;YAClC,eAAe,EAAE,KAAK,CAAC,eAAe;SACvC;QACD,YAAY;QACZ,UAAU,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC;QACzD,mBAAmB,EAAE,yBAAyB,CAAC,YAAY,CAAC;QAC5D,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACxF,gBAAgB,EAAE;YAChB,8EAA8E;YAC9E,kGAAkG;YAClG,0EAA0E;SAC3E;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAoB;IACzD,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO;QAAE,QAAQ,CAAC,I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,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAA;IACtF,OAAO;QACL;YACE,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,gFAAgF,KAAK,GAAG;YACnG,iBAAiB,EAAE,wFAAwF;YAC3G,aAAa,EAAE,8DAA8D;SAC9E;QACD;YACE,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,oDAAoD,OAAO,kBAAkB;YACxF,iBAAiB,EAAE,6FAA6F;YAChH,aAAa,EAAE,gEAAgE;SAChF;QACD;YACE,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,kFAAkF;YAC7F,iBAAiB,EAAE,qGAAqG;YACxH,aAAa,EAAE,gEAAgE;SAChF;KACF,CAAA;AACH,CAAC;AAED,SAAS,yBAAyB,CAAC,YAAsB;IACvD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAC5E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,WAAW,EAAE,8EAA8E;QAC3F,MAAM;QACN,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC,CAAA;AACL,CAAC;AAED,SAAS,OAAO,CAAI,KAA2B;IAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAa,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;AAC9D,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type EngineeringStandardCategory = 'logging' | 'security' | 'database' | 'architecture' | 'code-quality' | 'framework' | 'testing' | 'uiux';
|
|
2
2
|
export type EngineeringStandardSeverity = 'info' | 'warn' | 'fail';
|
|
3
|
+
export type EngineeringStandardsDebtScope = 'production' | 'test' | 'generated';
|
|
3
4
|
export interface EngineeringStandardFinding {
|
|
4
5
|
severity: EngineeringStandardSeverity;
|
|
5
6
|
category: EngineeringStandardCategory;
|
|
@@ -40,6 +41,15 @@ export interface EngineeringStandardsPolicyFile {
|
|
|
40
41
|
reason?: string;
|
|
41
42
|
}>;
|
|
42
43
|
}
|
|
44
|
+
export interface EngineeringStandardsBaselineFile {
|
|
45
|
+
version?: number;
|
|
46
|
+
findings?: Array<{
|
|
47
|
+
ruleId: string;
|
|
48
|
+
path: string;
|
|
49
|
+
line?: number;
|
|
50
|
+
reason?: string;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
43
53
|
export interface ResolvedEngineeringStandardsPolicy {
|
|
44
54
|
version: number;
|
|
45
55
|
mode: 'warn' | 'block';
|
|
@@ -98,6 +108,8 @@ export interface EngineeringStandardsScanOptions {
|
|
|
98
108
|
projectDir?: string;
|
|
99
109
|
scaleDir?: string;
|
|
100
110
|
now?: Date;
|
|
111
|
+
changedFiles?: string[];
|
|
112
|
+
includeBaselineFindings?: boolean;
|
|
101
113
|
}
|
|
102
114
|
export interface EngineeringStandardsSummary {
|
|
103
115
|
filesScanned: number;
|
|
@@ -109,6 +121,7 @@ export interface EngineeringStandardsSummary {
|
|
|
109
121
|
export interface EngineeringStandardsScanReport {
|
|
110
122
|
projectDir: string;
|
|
111
123
|
policyPath: string;
|
|
124
|
+
baselinePath: string;
|
|
112
125
|
frameworksPath: string;
|
|
113
126
|
policy: ResolvedEngineeringStandardsPolicy;
|
|
114
127
|
frameworks: ResolvedFrameworksCatalog;
|
|
@@ -126,18 +139,74 @@ export interface EngineeringStandardsSettleOptions extends EngineeringStandardsS
|
|
|
126
139
|
taskId?: string;
|
|
127
140
|
artifactsDir?: string;
|
|
128
141
|
}
|
|
142
|
+
export interface EngineeringStandardsBaselineOptions extends EngineeringStandardsScanOptions {
|
|
143
|
+
taskId?: string;
|
|
144
|
+
artifactsDir?: string;
|
|
145
|
+
writeBaseline?: boolean;
|
|
146
|
+
reason?: string;
|
|
147
|
+
maxFindingsInReport?: number;
|
|
148
|
+
}
|
|
129
149
|
export interface EngineeringStandardsSettleReport {
|
|
130
150
|
ok: boolean;
|
|
131
151
|
taskId?: string;
|
|
132
152
|
standardsImpactPath?: string;
|
|
133
153
|
doctor: EngineeringStandardsDoctorReport;
|
|
134
154
|
}
|
|
155
|
+
export interface EngineeringStandardsBaselineEntry {
|
|
156
|
+
ruleId: string;
|
|
157
|
+
path: string;
|
|
158
|
+
line?: number;
|
|
159
|
+
reason: string;
|
|
160
|
+
severity: EngineeringStandardSeverity;
|
|
161
|
+
category: EngineeringStandardCategory;
|
|
162
|
+
message: string;
|
|
163
|
+
}
|
|
164
|
+
export interface EngineeringStandardsDebtGroup {
|
|
165
|
+
total: number;
|
|
166
|
+
blocking: number;
|
|
167
|
+
warn: number;
|
|
168
|
+
info: number;
|
|
169
|
+
}
|
|
170
|
+
export interface EngineeringStandardsDebtRuleGroup extends EngineeringStandardsDebtGroup {
|
|
171
|
+
category: EngineeringStandardCategory;
|
|
172
|
+
}
|
|
173
|
+
export interface EngineeringStandardsDebtFileGroup extends EngineeringStandardsDebtGroup {
|
|
174
|
+
path: string;
|
|
175
|
+
}
|
|
176
|
+
export interface EngineeringStandardsDebtSummary {
|
|
177
|
+
filesScanned: number;
|
|
178
|
+
totalFindings: number;
|
|
179
|
+
blockingFindings: number;
|
|
180
|
+
bySeverity: Record<EngineeringStandardSeverity, number>;
|
|
181
|
+
byScope: Record<EngineeringStandardsDebtScope, EngineeringStandardsDebtGroup>;
|
|
182
|
+
byCategory: Record<EngineeringStandardCategory, EngineeringStandardsDebtGroup>;
|
|
183
|
+
byRule: Record<string, EngineeringStandardsDebtRuleGroup>;
|
|
184
|
+
topFiles: EngineeringStandardsDebtFileGroup[];
|
|
185
|
+
}
|
|
186
|
+
export interface EngineeringStandardsBaselineReport {
|
|
187
|
+
ok: boolean;
|
|
188
|
+
projectDir: string;
|
|
189
|
+
baselinePath: string;
|
|
190
|
+
legacyDebtPath?: string;
|
|
191
|
+
wroteBaseline: boolean;
|
|
192
|
+
baselineEntries: EngineeringStandardsBaselineEntry[];
|
|
193
|
+
debt: EngineeringStandardsDebtSummary;
|
|
194
|
+
scan: EngineeringStandardsScanReport;
|
|
195
|
+
warnings: string[];
|
|
196
|
+
}
|
|
135
197
|
export declare function engineeringStandardsPolicyPath(projectDir?: string, scaleDir?: string): string;
|
|
136
198
|
export declare function frameworksCatalogPath(projectDir?: string, scaleDir?: string): string;
|
|
199
|
+
export declare function engineeringStandardsBaselinePath(projectDir?: string, scaleDir?: string): string;
|
|
137
200
|
export declare function engineeringStandardsPolicyTemplate(): string;
|
|
201
|
+
export declare function engineeringStandardsBaselineTemplate(): string;
|
|
138
202
|
export declare function frameworksCatalogTemplate(): string;
|
|
139
203
|
export declare function loadEngineeringStandardsPolicy(projectDir?: string, scaleDir?: string): ResolvedEngineeringStandardsPolicy;
|
|
204
|
+
export declare function loadEngineeringStandardsBaseline(projectDir?: string, scaleDir?: string): {
|
|
205
|
+
findings: ResolvedEngineeringStandardsPolicy['baselineFindings'];
|
|
206
|
+
warnings: string[];
|
|
207
|
+
};
|
|
140
208
|
export declare function loadFrameworksCatalog(projectDir?: string, scaleDir?: string, now?: Date): ResolvedFrameworksCatalog;
|
|
141
209
|
export declare function scanEngineeringStandards(options?: EngineeringStandardsScanOptions): EngineeringStandardsScanReport;
|
|
142
210
|
export declare function doctorEngineeringStandards(options?: EngineeringStandardsScanOptions): EngineeringStandardsDoctorReport;
|
|
143
211
|
export declare function settleEngineeringStandards(options?: EngineeringStandardsSettleOptions): EngineeringStandardsSettleReport;
|
|
212
|
+
export declare function baselineEngineeringStandards(options?: EngineeringStandardsBaselineOptions): EngineeringStandardsBaselineReport;
|