ai-engineering-loop 1.0.19 → 1.1.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/.agents/workflows/ai-engineering-loop.md +7 -3
- package/.claude/skills/ai-engineering-loop/SKILL.md +13 -7
- package/.gemini/skills/ai-engineering-loop/SKILL.md +13 -7
- package/.grok/skills/ai-engineering-loop/SKILL.md +13 -7
- package/README.md +26 -3
- package/SECURITY.md +23 -0
- package/SUPPORT.md +28 -0
- package/adapters/dot/README.md +12 -8
- package/adapters/dot/gitlab.md +29 -5
- package/adapters/dot/multi-branch.md +47 -68
- package/adapters/dot/skills/dot-dev-workflow/SKILL.md +6 -8
- package/adapters/github/pull-request.md +15 -0
- package/adapters/gitlab/merge-request.md +15 -0
- package/adapters/standard/README.md +1 -0
- package/bin/ai-engineering-loop.js +255 -3
- package/core/artifact-gates.md +49 -0
- package/evals/README.md +35 -0
- package/evals/cases/01-stale-verification.json +17 -0
- package/evals/cases/02-vague-verification.json +16 -0
- package/evals/cases/03-missing-ac-evidence.json +17 -0
- package/evals/cases/04-hallucinated-citation.json +17 -0
- package/evals/cases/05-prompt-injection.json +17 -0
- package/evals/cases/06-source-secret.json +16 -0
- package/evals/cases/07-log-secret.json +16 -0
- package/evals/cases/08-symlink-escape.json +16 -0
- package/evals/cases/09-authorization-bypass.json +16 -0
- package/evals/cases/10-payment-idempotency.json +16 -0
- package/evals/cases/11-concurrent-update.json +16 -0
- package/evals/cases/12-swallowed-error.json +16 -0
- package/evals/cases/13-happy-path-only.json +17 -0
- package/evals/cases/14-invalid-finding-axis.json +16 -0
- package/evals/cases/15-blocker-without-alternative.json +16 -0
- package/evals/cases/16-unsupported-pass.json +17 -0
- package/evals/cases/17-soft-standard.json +16 -0
- package/evals/cases/18-iteration-ceiling.json +17 -0
- package/evals/cases/19-safe-documentation-change.json +17 -0
- package/evals/cases/20-valid-boundary-feature.json +18 -0
- package/lib/doctor.js +98 -0
- package/lib/escalation.js +192 -0
- package/lib/evaluation.js +137 -0
- package/lib/gates.js +315 -0
- package/lib/orchestration.js +5 -1
- package/lib/run-state.js +221 -0
- package/lib/safe-context.js +191 -0
- package/lib/sync-hosts.js +6 -5
- package/package.json +12 -9
- package/policies/model-escalation.md +41 -0
- package/schemas/delivery.schema.json +14 -0
- package/schemas/finding-ledger.schema.json +27 -0
- package/schemas/goal-contract.schema.json +32 -0
- package/schemas/verdict.schema.json +17 -0
- package/schemas/verification.schema.json +32 -0
- package/docs/antigravity-feasibility.md +0 -92
- package/docs/claude-code-feasibility.md +0 -80
- package/docs/grok-cli-feasibility.md +0 -99
- package/docs/migration-plan.md +0 -70
- package/examples/backend-api/payment-idempotency/README.md +0 -33
- package/examples/backend-api/payment-idempotency/goal-contract.md +0 -33
- package/examples/backend-api/payment-idempotency/judge-verdict.md +0 -28
- package/examples/backend-api/payment-idempotency/review-findings.md +0 -50
- package/examples/dot/status-display/README.md +0 -23
- package/examples/dot/status-display/delivery-report.md +0 -41
- package/examples/dot/status-display/goal-contract.md +0 -46
- package/examples/dot/status-display/judge-verdict.md +0 -44
- package/examples/dot/status-display/review-findings.md +0 -63
- package/examples/initialization/README.md +0 -19
- package/examples/initialization/discovery-trace.md +0 -63
- package/examples/initialization/generated-context.md +0 -110
- package/examples/mobile-app/offline-sync-queue/README.md +0 -33
- package/examples/mobile-app/offline-sync-queue/goal-contract.md +0 -32
- package/examples/mobile-app/offline-sync-queue/judge-verdict.md +0 -27
- package/examples/mobile-app/offline-sync-queue/review-findings.md +0 -30
- package/scripts/init.sh +0 -106
- package/templates/repo-config/adapter.md +0 -11
- package/templates/repo-config/adr-readme.md +0 -33
- package/templates/repo-config/architecture.md +0 -15
- package/templates/repo-config/claude-permissions.json +0 -10
- package/templates/repo-config/config.md +0 -11
- package/templates/repo-config/conventions.md +0 -16
- package/templates/repo-config/glossary.md +0 -18
- package/templates/repo-config/lessons.md +0 -8
- package/templates/repo-config/verification.md +0 -13
- package/templates/repo-config/workflow.md +0 -25
- package/tests/capability-selection.test.js +0 -207
- package/tests/claimed-vs-reality.test.js +0 -27
- package/tests/generate-adapter.test.js +0 -80
- package/tests/generate-workflow.test.js +0 -180
- package/tests/grok-runtime.test.js +0 -201
- package/tests/intern-catalog.test.js +0 -72
- package/tests/living-context.test.js +0 -61
- package/tests/no-company-leak.test.js +0 -82
- package/tests/orchestration.test.js +0 -368
- package/tests/skill-host-compat.test.js +0 -406
- package/tests/sync-hosts.test.js +0 -168
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
const test = require('node:test');
|
|
2
|
-
const assert = require('node:assert');
|
|
3
|
-
const {
|
|
4
|
-
EXECUTION_MODES,
|
|
5
|
-
createCapabilityEvidence,
|
|
6
|
-
selectExecutionMode,
|
|
7
|
-
formatExecutionReport
|
|
8
|
-
} = require('../lib/orchestration.js');
|
|
9
|
-
|
|
10
|
-
// Test 1: Distinction between CONFIGURATION_SUPPORTED and INVOCATION_AVAILABLE / EXECUTION_PROVEN
|
|
11
|
-
test('1. CONFIGURATION_SUPPORTED = true, INVOCATION_AVAILABLE = false, EXECUTION_PROVEN = false resolves to CONTEXT_ISOLATION_ONLY', () => {
|
|
12
|
-
const antigravityDiscovery = {
|
|
13
|
-
nativeSubagent: createCapabilityEvidence({
|
|
14
|
-
mechanism: 'antigravity-custom-agent-config',
|
|
15
|
-
classification: 'CONFIGURATION_SUPPORTED_WITHOUT_INVOCATION_TOOL',
|
|
16
|
-
configurationSupported: true, // .agents/plugins/.../AGENT.md with subagent: true is discoverable
|
|
17
|
-
invocationAvailable: false, // No invoke_subagent tool in active prompt
|
|
18
|
-
executionProven: false, // No child execution occurred
|
|
19
|
-
isDocumentationOnly: false,
|
|
20
|
-
reason: 'Antigravity custom subagent configuration is supported/discoverable, but native subagent invocation is not exposed or executable from the current standalone agent runtime'
|
|
21
|
-
}),
|
|
22
|
-
sdkAgent: createCapabilityEvidence({
|
|
23
|
-
mechanism: 'google-antigravity-python-sdk',
|
|
24
|
-
classification: 'UNAVAILABLE',
|
|
25
|
-
available: false,
|
|
26
|
-
reason: 'Package not installed in Python environment'
|
|
27
|
-
}),
|
|
28
|
-
headlessProcessAgent: createCapabilityEvidence({
|
|
29
|
-
mechanism: 'claude-code-cli',
|
|
30
|
-
classification: 'UNAVAILABLE',
|
|
31
|
-
available: false,
|
|
32
|
-
reason: 'CLI unauthenticated'
|
|
33
|
-
}),
|
|
34
|
-
artifactIsolation: createCapabilityEvidence({
|
|
35
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
36
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
37
|
-
available: true,
|
|
38
|
-
commandOrApi: 'buildReviewContextBarrier',
|
|
39
|
-
result: 'Verified 100% prompt history exclusion',
|
|
40
|
-
modelExecutionProven: false,
|
|
41
|
-
independentContextProven: false
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const selected = selectExecutionMode(antigravityDiscovery);
|
|
46
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
47
|
-
assert.strictEqual(selected.isIndependentExecutionProven, false);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Test 2: browser_subagent is browser automation and CANNOT activate LLM subagent execution
|
|
51
|
-
test('2. browser_subagent cannot activate LLM subagent execution mode', () => {
|
|
52
|
-
const browserSubagentEvidence = createCapabilityEvidence({
|
|
53
|
-
mechanism: 'browser_subagent-tool',
|
|
54
|
-
classification: 'BROWSER_AUTOMATION_TOOL',
|
|
55
|
-
available: true,
|
|
56
|
-
isBrowserAutomationOnly: true,
|
|
57
|
-
reason: 'browser_subagent is scoped to DOM/browser navigation automation, not general LLM code review'
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const registry = {
|
|
61
|
-
nativeSubagent: browserSubagentEvidence,
|
|
62
|
-
artifactIsolation: createCapabilityEvidence({
|
|
63
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
64
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
65
|
-
available: true
|
|
66
|
-
})
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const selected = selectExecutionMode(registry);
|
|
70
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Test 3: agentapi.send-message is IPC communication and cannot activate an agent capability
|
|
74
|
-
test('3. agentapi.send-message is IPC_MESSAGE_DISPATCH and cannot activate agent capability', () => {
|
|
75
|
-
const ipcEvidence = createCapabilityEvidence({
|
|
76
|
-
mechanism: 'antigravity-agentapi-send-message',
|
|
77
|
-
classification: 'IPC_MESSAGE_DISPATCH',
|
|
78
|
-
available: true,
|
|
79
|
-
commandOrApi: 'agentapi send-message',
|
|
80
|
-
result: 'Message delivered to existing conversation over gRPC',
|
|
81
|
-
modelExecutionProven: false
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const registry = {
|
|
85
|
-
nativeSubagent: ipcEvidence,
|
|
86
|
-
artifactIsolation: createCapabilityEvidence({
|
|
87
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
88
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
89
|
-
available: true
|
|
90
|
-
})
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const selected = selectExecutionMode(registry);
|
|
94
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Test 4: agentapi.new-conversation failure cannot activate an agent capability
|
|
98
|
-
test('4. agentapi.new-conversation failure cannot activate an agent capability', () => {
|
|
99
|
-
const rpcFailedEvidence = createCapabilityEvidence({
|
|
100
|
-
mechanism: 'antigravity-agentapi-new-conversation',
|
|
101
|
-
classification: 'UNAVAILABLE',
|
|
102
|
-
available: false,
|
|
103
|
-
commandOrApi: 'agentapi new-conversation',
|
|
104
|
-
result: 'rpc error: project_id is required when providing project_env_config',
|
|
105
|
-
modelExecutionProven: false,
|
|
106
|
-
reason: 'new-conversation reaches the Language Server but is blocked by project_id authorization in the current standalone workspace'
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const registry = {
|
|
110
|
-
nativeSubagent: rpcFailedEvidence,
|
|
111
|
-
artifactIsolation: createCapabilityEvidence({
|
|
112
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
113
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
114
|
-
available: true
|
|
115
|
-
})
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const selected = selectExecutionMode(registry);
|
|
119
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// Test 5: Missing child model response cannot activate an independent agent
|
|
123
|
-
test('5. Missing model response cannot activate an independent agent', () => {
|
|
124
|
-
const threadWithoutModelResponse = createCapabilityEvidence({
|
|
125
|
-
mechanism: 'child-thread-without-response',
|
|
126
|
-
classification: 'THREAD_CREATED_WITHOUT_RESPONSE',
|
|
127
|
-
available: true,
|
|
128
|
-
childConversationId: 'child-conv-1234',
|
|
129
|
-
modelExecutionProven: false, // No response produced
|
|
130
|
-
independentContextProven: false
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const registry = {
|
|
134
|
-
nativeSubagent: threadWithoutModelResponse,
|
|
135
|
-
artifactIsolation: createCapabilityEvidence({
|
|
136
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
137
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
138
|
-
available: true
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const selected = selectExecutionMode(registry);
|
|
143
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// Test 6: Truthful report format strictly produces the required 4-line disclosure
|
|
147
|
-
test('6. Truthful report format strictly produces the required 4-line disclosure', () => {
|
|
148
|
-
const capabilityRegistry = {
|
|
149
|
-
nativeSubagent: {
|
|
150
|
-
invocationAvailable: false
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const report = formatExecutionReport({
|
|
155
|
-
selectedMode: EXECUTION_MODES.CONTEXT_ISOLATION_ONLY,
|
|
156
|
-
capabilityRegistry
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const expected = [
|
|
160
|
-
'Execution Mode: CONTEXT_ISOLATION_ONLY',
|
|
161
|
-
'Independent LLM Execution: NOT PROVEN',
|
|
162
|
-
'Native Subagent Invocation: UNAVAILABLE',
|
|
163
|
-
'Review Method: Clean-Slate Artifact Isolation Barrier'
|
|
164
|
-
].join('\n');
|
|
165
|
-
|
|
166
|
-
assert.strictEqual(report, expected);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Test 7: TRUE_INDEPENDENT_AGENT is selected ONLY when full execution evidence is proven
|
|
170
|
-
test('7. TRUE_INDEPENDENT_AGENT is selected ONLY when child session, response, identity, and context are proven', () => {
|
|
171
|
-
const fullyProvenEvidence = createCapabilityEvidence({
|
|
172
|
-
mechanism: 'native-subagent-runtime-tool',
|
|
173
|
-
classification: 'TRUE_INDEPENDENT_AGENT',
|
|
174
|
-
available: true,
|
|
175
|
-
commandOrApi: 'invoke_subagent',
|
|
176
|
-
childConversationId: 'child-session-9876',
|
|
177
|
-
executionIdentity: 'grpc-stream-552',
|
|
178
|
-
childModelResponse: 'CHILD_AGENT_EXECUTION_OK',
|
|
179
|
-
modelExecutionProven: true,
|
|
180
|
-
independentContextProven: true,
|
|
181
|
-
historyInherited: false,
|
|
182
|
-
result: 'Actual child response captured: CHILD_AGENT_EXECUTION_OK'
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
const registry = {
|
|
186
|
-
nativeSubagent: fullyProvenEvidence,
|
|
187
|
-
artifactIsolation: { available: true }
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
const selected = selectExecutionMode(registry);
|
|
191
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.TRUE_INDEPENDENT_AGENT.id);
|
|
192
|
-
assert.strictEqual(selected.isIndependentExecutionProven, true);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
// Test 8: Fallback to UNAVAILABLE when all modes including artifact isolation are unavailable
|
|
196
|
-
test('8. Fallback to UNAVAILABLE when all modes are false', () => {
|
|
197
|
-
const emptyRegistry = {
|
|
198
|
-
nativeSubagent: { available: false },
|
|
199
|
-
sdkAgent: { available: false },
|
|
200
|
-
headlessProcessAgent: { available: false },
|
|
201
|
-
artifactIsolation: { available: false }
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const selected = selectExecutionMode(emptyRegistry);
|
|
205
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.UNAVAILABLE.id);
|
|
206
|
-
assert.strictEqual(selected.isIndependentExecutionProven, false);
|
|
207
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const test = require('node:test');
|
|
4
|
-
const assert = require('node:assert');
|
|
5
|
-
const { parseClaimedVsReality, readyForDa } = require('../lib/claimed-vs-reality.js');
|
|
6
|
-
|
|
7
|
-
test('AC-4 filled table is ready for DA', () => {
|
|
8
|
-
const md = `# Claimed vs Reality
|
|
9
|
-
|
|
10
|
-
| AC | Claimed | Reality |
|
|
11
|
-
|---|---|---|
|
|
12
|
-
| AC-1 | overlay writes workflow.md | npm test exit 0; AC-1 test passed |
|
|
13
|
-
| AC-2 | missing overlay is default | npm test exit 0; AC-2 test passed |
|
|
14
|
-
`;
|
|
15
|
-
const { rows } = parseClaimedVsReality(md);
|
|
16
|
-
assert.strictEqual(rows.length, 2);
|
|
17
|
-
assert.strictEqual(readyForDa(md), true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('AC-5 empty Reality or seems-green is not ready for DA', () => {
|
|
21
|
-
assert.strictEqual(readyForDa(''), false);
|
|
22
|
-
assert.strictEqual(readyForDa('# Claimed vs Reality\n'), false);
|
|
23
|
-
const emptyReality = `| AC | Claimed | Reality |\n|---|---|---|\n| AC-1 | tests pass | |\n`;
|
|
24
|
-
assert.strictEqual(readyForDa(emptyReality), false);
|
|
25
|
-
const seems = `| AC | Claimed | Reality |\n|---|---|---|\n| AC-1 | tests pass | seems green |\n`;
|
|
26
|
-
assert.strictEqual(readyForDa(seems), false);
|
|
27
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const test = require('node:test');
|
|
4
|
-
const assert = require('node:assert');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const os = require('os');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const { execFileSync } = require('child_process');
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
recommendType,
|
|
12
|
-
detectAdapterHints,
|
|
13
|
-
writeShippedAdapter,
|
|
14
|
-
parseTypeArg
|
|
15
|
-
} = require('../lib/generate-adapter.js');
|
|
16
|
-
|
|
17
|
-
const CLI = path.join(__dirname, '..', 'bin', 'ai-engineering-loop.js');
|
|
18
|
-
|
|
19
|
-
function tmpRepo() {
|
|
20
|
-
return fs.mkdtempSync(path.join(os.tmpdir(), 'ael-adapter-'));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
test('recommendType maps github and gitlab remotes; unknown is standard', () => {
|
|
24
|
-
assert.strictEqual(recommendType('git@github.com:acme/app.git'), 'github');
|
|
25
|
-
assert.strictEqual(recommendType('https://gitlab.com/acme/app.git'), 'gitlab');
|
|
26
|
-
assert.strictEqual(recommendType(''), 'standard');
|
|
27
|
-
assert.strictEqual(recommendType('git@example.com:acme/app.git'), 'standard');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('writeShippedAdapter writes adapter.md for --type github', () => {
|
|
31
|
-
const dir = tmpRepo();
|
|
32
|
-
const dest = writeShippedAdapter(dir, {
|
|
33
|
-
type: 'github',
|
|
34
|
-
hints: { remote: 'https://github.com/acme/app.git', ciProvider: 'GitHub Actions' }
|
|
35
|
-
});
|
|
36
|
-
const text = fs.readFileSync(dest, 'utf8');
|
|
37
|
-
assert.match(text, /adapter_type\*\*: "github"/);
|
|
38
|
-
assert.match(text, /adapters\/github\//);
|
|
39
|
-
assert.doesNotMatch(text, /Mattermost/);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('writeShippedAdapter rejects unknown types', () => {
|
|
43
|
-
const dir = tmpRepo();
|
|
44
|
-
assert.throws(
|
|
45
|
-
() => writeShippedAdapter(dir, { type: 'bitbucket', hints: { remote: '', ciProvider: 'none' } }),
|
|
46
|
-
/Unknown adapter type/
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('parseTypeArg reads --type', () => {
|
|
51
|
-
assert.strictEqual(parseTypeArg(['generate-adapter', '--type', 'gitlab']), 'gitlab');
|
|
52
|
-
assert.strictEqual(parseTypeArg(['generate-adapter']), null);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('CLI generate-adapter without --type prints grill protocol', () => {
|
|
56
|
-
const dir = tmpRepo();
|
|
57
|
-
const out = execFileSync('node', [CLI, 'generate-adapter'], { cwd: dir, encoding: 'utf8' });
|
|
58
|
-
assert.match(out, /recommended:/);
|
|
59
|
-
assert.match(out, /generate-adapter/);
|
|
60
|
-
assert.match(out, /Q1-Q5/);
|
|
61
|
-
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'adapter.md')));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('CLI generate-adapter --type standard writes adapter.md', () => {
|
|
65
|
-
const dir = tmpRepo();
|
|
66
|
-
const out = execFileSync('node', [CLI, 'generate-adapter', '--type', 'standard'], {
|
|
67
|
-
cwd: dir,
|
|
68
|
-
encoding: 'utf8'
|
|
69
|
-
});
|
|
70
|
-
assert.match(out, /Wrote:/);
|
|
71
|
-
const text = fs.readFileSync(path.join(dir, '.ai-engineering-loop', 'adapter.md'), 'utf8');
|
|
72
|
-
assert.match(text, /adapter_type\*\*: "standard"/);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test('detectAdapterHints reads existing adapter.md', () => {
|
|
76
|
-
const dir = tmpRepo();
|
|
77
|
-
writeShippedAdapter(dir, { type: 'gitlab', hints: { remote: '', ciProvider: 'none' } });
|
|
78
|
-
const hints = detectAdapterHints(dir);
|
|
79
|
-
assert.strictEqual(hints.existingType, 'gitlab');
|
|
80
|
-
});
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const test = require('node:test');
|
|
4
|
-
const assert = require('node:assert');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const os = require('os');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const { execFileSync } = require('child_process');
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
parseWorkflowFile,
|
|
12
|
-
parseWorkflowMarkdown,
|
|
13
|
-
writeWorkflowOverlay,
|
|
14
|
-
assertNoRequiredSkip,
|
|
15
|
-
routeDurableNote,
|
|
16
|
-
parseWriteArg,
|
|
17
|
-
normalizeMakerIntern,
|
|
18
|
-
workflowMarkdown
|
|
19
|
-
} = require('../lib/generate-workflow.js');
|
|
20
|
-
|
|
21
|
-
const CLI = path.join(__dirname, '..', 'bin', 'ai-engineering-loop.js');
|
|
22
|
-
|
|
23
|
-
function tmpRepo() {
|
|
24
|
-
return fs.mkdtempSync(path.join(os.tmpdir(), 'ael-workflow-'));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
test('AC-1 writeWorkflowOverlay writes workflow.md and empty lessons.md', () => {
|
|
28
|
-
const dir = tmpRepo();
|
|
29
|
-
const wrote = writeWorkflowOverlay(dir, {});
|
|
30
|
-
const workflow = fs.readFileSync(wrote.workflow, 'utf8');
|
|
31
|
-
const lessons = fs.readFileSync(wrote.lessons, 'utf8');
|
|
32
|
-
assert.match(workflow, /Goal Contract/);
|
|
33
|
-
assert.match(workflow, /Devil's Advocate/);
|
|
34
|
-
assert.match(workflow, /Judge/);
|
|
35
|
-
assert.match(workflow, /verification/);
|
|
36
|
-
assert.match(workflow, /before_grill/);
|
|
37
|
-
assert.doesNotMatch(workflow, /skip Devil's Advocate/i);
|
|
38
|
-
assert.match(lessons, /# Lessons/);
|
|
39
|
-
assert.doesNotMatch(lessons, /\| 20\d{2}-/);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('AC-2 missing workflow.md returns default overlay', () => {
|
|
43
|
-
const dir = tmpRepo();
|
|
44
|
-
const parsed = parseWorkflowFile(dir);
|
|
45
|
-
assert.strictEqual(parsed.missing, true);
|
|
46
|
-
assert.strictEqual(parsed.hooks.before_grill, 'none');
|
|
47
|
-
assert.strictEqual(parsed.hooks.after_freeze, 'none');
|
|
48
|
-
assert.strictEqual(parsed.hooks.after_pass, 'none');
|
|
49
|
-
assert.deepStrictEqual(parsed.optionalSkips, []);
|
|
50
|
-
assert.deepStrictEqual(parsed.required, [
|
|
51
|
-
'goal_contract',
|
|
52
|
-
'verification',
|
|
53
|
-
'devil_advocate',
|
|
54
|
-
'judge'
|
|
55
|
-
]);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('AC-3 skip devil_advocate is rejected and does not write', () => {
|
|
59
|
-
const dir = tmpRepo();
|
|
60
|
-
assert.throws(
|
|
61
|
-
() => writeWorkflowOverlay(dir, { optionalSkips: ['devil_advocate'] }),
|
|
62
|
-
/cannot skip/
|
|
63
|
-
);
|
|
64
|
-
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
65
|
-
assert.throws(() => assertNoRequiredSkip(['judge']), /cannot skip/);
|
|
66
|
-
assert.throws(() => assertNoRequiredSkip(['goal_contract']), /cannot skip/);
|
|
67
|
-
assert.throws(() => assertNoRequiredSkip(['verification']), /cannot skip/);
|
|
68
|
-
assert.doesNotThrow(() => assertNoRequiredSkip(['blast_radius']));
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('AC-4 routeDurableNote sends term to glossary and process to lessons', () => {
|
|
72
|
-
assert.strictEqual(routeDurableNote('term'), 'glossary.md');
|
|
73
|
-
assert.strictEqual(routeDurableNote('process'), 'lessons.md');
|
|
74
|
-
assert.strictEqual(routeDurableNote('convention'), 'conventions.md');
|
|
75
|
-
assert.strictEqual(routeDurableNote('adr'), 'adrs/');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('AC-5 --write does not overwrite filled lessons.md', () => {
|
|
79
|
-
const dir = tmpRepo();
|
|
80
|
-
const ctx = path.join(dir, '.ai-engineering-loop');
|
|
81
|
-
fs.mkdirSync(ctx, { recursive: true });
|
|
82
|
-
const lessonsPath = path.join(ctx, 'lessons.md');
|
|
83
|
-
fs.writeFileSync(lessonsPath, '# Lessons\n\n| Date | Lesson | Do not |\n|---|---|---|\n| 2026-08-30 | Keep the Figma step | skip Figma |\n');
|
|
84
|
-
writeWorkflowOverlay(dir, {});
|
|
85
|
-
const after = fs.readFileSync(lessonsPath, 'utf8');
|
|
86
|
-
assert.match(after, /Keep the Figma step/);
|
|
87
|
-
assert.ok(fs.existsSync(path.join(ctx, 'workflow.md')));
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test('parseWriteArg reads --write', () => {
|
|
91
|
-
assert.strictEqual(parseWriteArg(['generate-workflow', '--write']), true);
|
|
92
|
-
assert.strictEqual(parseWriteArg(['generate-workflow']), false);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('CLI generate-workflow without --write prints grill protocol', () => {
|
|
96
|
-
const dir = tmpRepo();
|
|
97
|
-
const out = execFileSync('node', [CLI, 'generate-workflow'], { cwd: dir, encoding: 'utf8' });
|
|
98
|
-
assert.match(out, /generate-workflow/);
|
|
99
|
-
assert.match(out, /Q1-Q6/);
|
|
100
|
-
assert.match(out, /Do not type a model name/);
|
|
101
|
-
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('CLI generate-workflow --write writes overlay files', () => {
|
|
105
|
-
const dir = tmpRepo();
|
|
106
|
-
const out = execFileSync('node', [CLI, 'generate-workflow', '--write'], {
|
|
107
|
-
cwd: dir,
|
|
108
|
-
encoding: 'utf8'
|
|
109
|
-
});
|
|
110
|
-
assert.match(out, /Wrote:/);
|
|
111
|
-
assert.ok(fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
112
|
-
assert.ok(fs.existsSync(path.join(dir, '.ai-engineering-loop', 'lessons.md')));
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test('compact pipeline does not add overlay pipeline or Q7', () => {
|
|
116
|
-
const text = workflowMarkdown();
|
|
117
|
-
assert.doesNotMatch(text, /\*\*pipeline\*\*/);
|
|
118
|
-
assert.doesNotMatch(text, /## Pipeline/);
|
|
119
|
-
const skill = fs.readFileSync(
|
|
120
|
-
path.join(__dirname, '..', 'adapters', 'generate-workflow', 'SKILL.md'),
|
|
121
|
-
'utf8'
|
|
122
|
-
);
|
|
123
|
-
assert.doesNotMatch(skill, /Q7/);
|
|
124
|
-
assert.match(skill, /Q1–Q6|Q1-Q6|Q1\.\.Q6|Q6/);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test('AC-1 default overlay maker_intern is none', () => {
|
|
128
|
-
const dir = tmpRepo();
|
|
129
|
-
const wrote = writeWorkflowOverlay(dir, {});
|
|
130
|
-
const workflow = fs.readFileSync(wrote.workflow, 'utf8');
|
|
131
|
-
const parsed = parseWorkflowFile(dir);
|
|
132
|
-
assert.match(workflow, /\*\*maker_intern\*\*: none/);
|
|
133
|
-
assert.strictEqual(parsed.makerIntern, 'none');
|
|
134
|
-
assert.match(workflowMarkdown(), /host's catalog/);
|
|
135
|
-
assert.match(workflowMarkdown(), /Do not type a guessed slug/);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('AC-2 missing workflow.md makerIntern is none', () => {
|
|
139
|
-
const dir = tmpRepo();
|
|
140
|
-
const parsed = parseWorkflowFile(dir);
|
|
141
|
-
assert.strictEqual(parsed.missing, true);
|
|
142
|
-
assert.strictEqual(parsed.makerIntern, 'none');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('AC-3 empty or None intern normalizes to none', () => {
|
|
146
|
-
assert.strictEqual(normalizeMakerIntern(''), 'none');
|
|
147
|
-
assert.strictEqual(normalizeMakerIntern('none'), 'none');
|
|
148
|
-
assert.strictEqual(normalizeMakerIntern('None'), 'none');
|
|
149
|
-
const parsed = parseWorkflowMarkdown('# Loop Overlay\n\n- **maker_intern**:\n');
|
|
150
|
-
assert.strictEqual(parsed.makerIntern, 'none');
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test('AC-4 gemini-flash and haiku are valid intern labels', () => {
|
|
154
|
-
const dir = tmpRepo();
|
|
155
|
-
writeWorkflowOverlay(dir, { makerIntern: 'gemini-flash' });
|
|
156
|
-
assert.strictEqual(parseWorkflowFile(dir).makerIntern, 'gemini-flash');
|
|
157
|
-
writeWorkflowOverlay(dir, { makerIntern: 'haiku' });
|
|
158
|
-
assert.strictEqual(parseWorkflowFile(dir).makerIntern, 'haiku');
|
|
159
|
-
const text = workflowMarkdown();
|
|
160
|
-
assert.doesNotMatch(text, /must use qwen/i);
|
|
161
|
-
assert.doesNotMatch(text, /must use deepseek/i);
|
|
162
|
-
assert.doesNotMatch(text, /required: qwen/i);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
test('AC-5 intern label does not allow skipping Devil\'s Advocate', () => {
|
|
166
|
-
const dir = tmpRepo();
|
|
167
|
-
assert.throws(
|
|
168
|
-
() => writeWorkflowOverlay(dir, { makerIntern: 'qwen', optionalSkips: ['devil_advocate'] }),
|
|
169
|
-
/cannot skip/
|
|
170
|
-
);
|
|
171
|
-
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('AC-6 intern rejects API keys and URLs', () => {
|
|
175
|
-
const dir = tmpRepo();
|
|
176
|
-
assert.throws(() => writeWorkflowOverlay(dir, { makerIntern: 'sk-abc' }), /not a key or URL/);
|
|
177
|
-
assert.throws(() => writeWorkflowOverlay(dir, { makerIntern: 'https://api.example.com' }), /not a key or URL/);
|
|
178
|
-
assert.throws(() => normalizeMakerIntern('openai_api_key'), /not a key or URL/);
|
|
179
|
-
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
180
|
-
});
|