ai-engineering-loop 1.0.15 → 1.0.17
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 +1 -1
- package/.claude/commands/ai-engineering-loop.md +1 -1
- package/.claude/skills/ai-engineering-loop/SKILL.md +5 -3
- package/.gemini/skills/ai-engineering-loop/SKILL.md +5 -3
- package/.grok/commands/ai-engineering-loop.md +1 -1
- package/.grok/skills/ai-engineering-loop/SKILL.md +4 -4
- package/README.md +23 -10
- package/adapters/README.md +29 -0
- package/adapters/generate-adapter/SKILL.md +123 -0
- package/adapters/generate-workflow/SKILL.md +128 -0
- package/adapters/github/README.md +28 -0
- package/adapters/github/pull-request.md +23 -0
- package/adapters/gitlab/README.md +28 -0
- package/adapters/gitlab/merge-request.md +26 -0
- package/adapters/standard/README.md +44 -0
- package/bin/ai-engineering-loop.js +63 -4
- package/core/context-impact-assessment.md +1 -0
- package/core/repo-config-schema.md +14 -1
- package/lib/generate-adapter.js +118 -0
- package/lib/generate-workflow.js +203 -0
- package/lib/sync-hosts.js +7 -1
- package/package.json +1 -1
- package/templates/repo-config/adapter.md +1 -1
- package/templates/repo-config/lessons.md +8 -0
- package/templates/repo-config/workflow.md +20 -0
- package/tests/generate-adapter.test.js +80 -0
- package/tests/generate-workflow.test.js +109 -0
- package/tests/living-context.test.js +15 -0
- package/tests/skill-host-compat.test.js +45 -0
- package/tests/sync-hosts.test.js +32 -1
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
writeWorkflowOverlay,
|
|
13
|
+
assertNoRequiredSkip,
|
|
14
|
+
routeDurableNote,
|
|
15
|
+
parseWriteArg
|
|
16
|
+
} = require('../lib/generate-workflow.js');
|
|
17
|
+
|
|
18
|
+
const CLI = path.join(__dirname, '..', 'bin', 'ai-engineering-loop.js');
|
|
19
|
+
|
|
20
|
+
function tmpRepo() {
|
|
21
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), 'ael-workflow-'));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
test('AC-1 writeWorkflowOverlay writes workflow.md and empty lessons.md', () => {
|
|
25
|
+
const dir = tmpRepo();
|
|
26
|
+
const wrote = writeWorkflowOverlay(dir, {});
|
|
27
|
+
const workflow = fs.readFileSync(wrote.workflow, 'utf8');
|
|
28
|
+
const lessons = fs.readFileSync(wrote.lessons, 'utf8');
|
|
29
|
+
assert.match(workflow, /Goal Contract/);
|
|
30
|
+
assert.match(workflow, /Devil's Advocate/);
|
|
31
|
+
assert.match(workflow, /Judge/);
|
|
32
|
+
assert.match(workflow, /verification/);
|
|
33
|
+
assert.match(workflow, /before_grill/);
|
|
34
|
+
assert.doesNotMatch(workflow, /skip Devil's Advocate/i);
|
|
35
|
+
assert.match(lessons, /# Lessons/);
|
|
36
|
+
assert.doesNotMatch(lessons, /\| 20\d{2}-/);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('AC-2 missing workflow.md returns default overlay', () => {
|
|
40
|
+
const dir = tmpRepo();
|
|
41
|
+
const parsed = parseWorkflowFile(dir);
|
|
42
|
+
assert.strictEqual(parsed.missing, true);
|
|
43
|
+
assert.strictEqual(parsed.hooks.before_grill, 'none');
|
|
44
|
+
assert.strictEqual(parsed.hooks.after_freeze, 'none');
|
|
45
|
+
assert.strictEqual(parsed.hooks.after_pass, 'none');
|
|
46
|
+
assert.deepStrictEqual(parsed.optionalSkips, []);
|
|
47
|
+
assert.deepStrictEqual(parsed.required, [
|
|
48
|
+
'goal_contract',
|
|
49
|
+
'verification',
|
|
50
|
+
'devil_advocate',
|
|
51
|
+
'judge'
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('AC-3 skip devil_advocate is rejected and does not write', () => {
|
|
56
|
+
const dir = tmpRepo();
|
|
57
|
+
assert.throws(
|
|
58
|
+
() => writeWorkflowOverlay(dir, { optionalSkips: ['devil_advocate'] }),
|
|
59
|
+
/cannot skip/
|
|
60
|
+
);
|
|
61
|
+
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
62
|
+
assert.throws(() => assertNoRequiredSkip(['judge']), /cannot skip/);
|
|
63
|
+
assert.throws(() => assertNoRequiredSkip(['goal_contract']), /cannot skip/);
|
|
64
|
+
assert.throws(() => assertNoRequiredSkip(['verification']), /cannot skip/);
|
|
65
|
+
assert.doesNotThrow(() => assertNoRequiredSkip(['blast_radius']));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('AC-4 routeDurableNote sends term to glossary and process to lessons', () => {
|
|
69
|
+
assert.strictEqual(routeDurableNote('term'), 'glossary.md');
|
|
70
|
+
assert.strictEqual(routeDurableNote('process'), 'lessons.md');
|
|
71
|
+
assert.strictEqual(routeDurableNote('convention'), 'conventions.md');
|
|
72
|
+
assert.strictEqual(routeDurableNote('adr'), 'adrs/');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('AC-5 --write does not overwrite filled lessons.md', () => {
|
|
76
|
+
const dir = tmpRepo();
|
|
77
|
+
const ctx = path.join(dir, '.ai-engineering-loop');
|
|
78
|
+
fs.mkdirSync(ctx, { recursive: true });
|
|
79
|
+
const lessonsPath = path.join(ctx, 'lessons.md');
|
|
80
|
+
fs.writeFileSync(lessonsPath, '# Lessons\n\n| Date | Lesson | Do not |\n|---|---|---|\n| 2026-08-30 | Keep the Figma step | skip Figma |\n');
|
|
81
|
+
writeWorkflowOverlay(dir, {});
|
|
82
|
+
const after = fs.readFileSync(lessonsPath, 'utf8');
|
|
83
|
+
assert.match(after, /Keep the Figma step/);
|
|
84
|
+
assert.ok(fs.existsSync(path.join(ctx, 'workflow.md')));
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('parseWriteArg reads --write', () => {
|
|
88
|
+
assert.strictEqual(parseWriteArg(['generate-workflow', '--write']), true);
|
|
89
|
+
assert.strictEqual(parseWriteArg(['generate-workflow']), false);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('CLI generate-workflow without --write prints grill protocol', () => {
|
|
93
|
+
const dir = tmpRepo();
|
|
94
|
+
const out = execFileSync('node', [CLI, 'generate-workflow'], { cwd: dir, encoding: 'utf8' });
|
|
95
|
+
assert.match(out, /generate-workflow/);
|
|
96
|
+
assert.match(out, /Q1-Q5/);
|
|
97
|
+
assert.ok(!fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('CLI generate-workflow --write writes overlay files', () => {
|
|
101
|
+
const dir = tmpRepo();
|
|
102
|
+
const out = execFileSync('node', [CLI, 'generate-workflow', '--write'], {
|
|
103
|
+
cwd: dir,
|
|
104
|
+
encoding: 'utf8'
|
|
105
|
+
});
|
|
106
|
+
assert.match(out, /Wrote:/);
|
|
107
|
+
assert.ok(fs.existsSync(path.join(dir, '.ai-engineering-loop', 'workflow.md')));
|
|
108
|
+
assert.ok(fs.existsSync(path.join(dir, '.ai-engineering-loop', 'lessons.md')));
|
|
109
|
+
});
|
|
@@ -21,10 +21,16 @@ test('init writes glossary.md and adrs/README.md', () => {
|
|
|
21
21
|
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
22
22
|
const glossary = path.join(dir, '.ai-engineering-loop', 'glossary.md');
|
|
23
23
|
const adr = path.join(dir, '.ai-engineering-loop', 'adrs', 'README.md');
|
|
24
|
+
const workflow = path.join(dir, '.ai-engineering-loop', 'workflow.md');
|
|
25
|
+
const lessons = path.join(dir, '.ai-engineering-loop', 'lessons.md');
|
|
24
26
|
assert.ok(fs.existsSync(glossary));
|
|
25
27
|
assert.ok(fs.existsSync(adr));
|
|
28
|
+
assert.ok(fs.existsSync(workflow));
|
|
29
|
+
assert.ok(fs.existsSync(lessons));
|
|
26
30
|
assert.match(fs.readFileSync(glossary, 'utf8'), /Ubiquitous Language/);
|
|
27
31
|
assert.match(fs.readFileSync(adr, 'utf8'), /Architecture Decision Records/);
|
|
32
|
+
assert.match(fs.readFileSync(workflow, 'utf8'), /before_grill/);
|
|
33
|
+
assert.match(fs.readFileSync(lessons, 'utf8'), /# Lessons/);
|
|
28
34
|
});
|
|
29
35
|
|
|
30
36
|
test('repair fills missing glossary without overwriting a filled glossary or architecture', () => {
|
|
@@ -44,3 +50,12 @@ test('repair fills missing glossary without overwriting a filled glossary or arc
|
|
|
44
50
|
assert.match(fs.readFileSync(glossary, 'utf8'), /Foo: bar/);
|
|
45
51
|
assert.ok(fs.existsSync(architecture));
|
|
46
52
|
});
|
|
53
|
+
|
|
54
|
+
test('init does not overwrite filled lessons.md', () => {
|
|
55
|
+
const dir = tmpRepo();
|
|
56
|
+
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
57
|
+
const lessons = path.join(dir, '.ai-engineering-loop', 'lessons.md');
|
|
58
|
+
fs.writeFileSync(lessons, '# Lessons\n\n| Date | Lesson | Do not |\n|---|---|---|\n| 2026-08-30 | Keep Figma | skip Figma |\n');
|
|
59
|
+
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
60
|
+
assert.match(fs.readFileSync(lessons, 'utf8'), /Keep Figma/);
|
|
61
|
+
});
|
|
@@ -210,6 +210,51 @@ test('DOT router sends commit-bound work to ai-engineering-loop; workflow is Sta
|
|
|
210
210
|
assert.doesNotMatch(readme, /Pre-commit multi-round adversarial review gate \(Phase 6\)/);
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
+
test('generate-workflow skill is Claude-safe and host skills read the overlay', () => {
|
|
214
|
+
const skill = readRepo('adapters/generate-workflow/SKILL.md');
|
|
215
|
+
const { fm } = parseFrontmatter(skill, 'generate-workflow');
|
|
216
|
+
assert.doesNotMatch(fm, /^description:\s*>-?/m);
|
|
217
|
+
assert.doesNotMatch(skill, /```mermaid/);
|
|
218
|
+
assert.doesNotMatch(skill, /\$\\/);
|
|
219
|
+
assert.doesNotMatch(skill, /spawn_subagent/);
|
|
220
|
+
assert.match(skill, /Q1/);
|
|
221
|
+
assert.match(skill, /Do not start Maker/);
|
|
222
|
+
assert.match(skill, /lessons\.md/);
|
|
223
|
+
for (const rel of [
|
|
224
|
+
'.claude/skills/ai-engineering-loop/SKILL.md',
|
|
225
|
+
'.grok/skills/ai-engineering-loop/SKILL.md',
|
|
226
|
+
'.gemini/skills/ai-engineering-loop/SKILL.md',
|
|
227
|
+
'.agents/workflows/ai-engineering-loop.md'
|
|
228
|
+
]) {
|
|
229
|
+
const text = readRepo(rel);
|
|
230
|
+
assert.match(text, /lessons\.md/, rel);
|
|
231
|
+
assert.match(text, /workflow\.md/, rel);
|
|
232
|
+
assert.match(text, /Do not skip Goal Contract, verification, Devil's Advocate, or Judge/, rel);
|
|
233
|
+
assert.match(text, /generate-workflow/, rel);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
test('generate-adapter skill is Claude-safe and shipped adapters stay generic', () => {
|
|
238
|
+
const skill = readRepo('adapters/generate-adapter/SKILL.md');
|
|
239
|
+
const { fm } = parseFrontmatter(skill, 'generate-adapter');
|
|
240
|
+
assert.doesNotMatch(fm, /^description:\s*>-?/m);
|
|
241
|
+
assert.doesNotMatch(skill, /```mermaid/);
|
|
242
|
+
assert.doesNotMatch(skill, /\$\\/);
|
|
243
|
+
assert.doesNotMatch(skill, /spawn_subagent/);
|
|
244
|
+
assert.match(skill, /Q1/);
|
|
245
|
+
assert.match(skill, /Do not start Maker/);
|
|
246
|
+
const catalog = readRepo('adapters/README.md');
|
|
247
|
+
assert.match(catalog, /standard/);
|
|
248
|
+
assert.match(catalog, /github/);
|
|
249
|
+
assert.match(catalog, /gitlab/);
|
|
250
|
+
const gitlab = readRepo('adapters/gitlab/README.md');
|
|
251
|
+
assert.match(gitlab, /not the DOT adapter/);
|
|
252
|
+
assert.doesNotMatch(gitlab, /Coreview/);
|
|
253
|
+
assert.doesNotMatch(gitlab, /Mattermost/);
|
|
254
|
+
const standard = readRepo('adapters/standard/README.md');
|
|
255
|
+
assert.match(standard, /Judge `PASS`/);
|
|
256
|
+
});
|
|
257
|
+
|
|
213
258
|
test('Host skills Stage 0 runs sync-hosts before status', () => {
|
|
214
259
|
for (const rel of [
|
|
215
260
|
'.claude/skills/ai-engineering-loop/SKILL.md',
|
package/tests/sync-hosts.test.js
CHANGED
|
@@ -102,7 +102,7 @@ test('dry-run does not write; second apply is current', () => {
|
|
|
102
102
|
assert.ok(!fs.existsSync(path.join(home, '.gemini/config/skills/ai-engineering-loop/SKILL.md')));
|
|
103
103
|
applyHostSync({ packageRoot: ROOT, home });
|
|
104
104
|
const again = applyHostSync({ packageRoot: ROOT, home });
|
|
105
|
-
assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).current,
|
|
105
|
+
assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).current, 4);
|
|
106
106
|
assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).copy, 0);
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -134,4 +134,35 @@ test('CLI sync-hosts --dry-run respects AEL_HOME', () => {
|
|
|
134
134
|
test('CLI help lists sync-hosts', () => {
|
|
135
135
|
const out = execFileSync('node', [CLI, '--help'], { encoding: 'utf8' });
|
|
136
136
|
assert.match(out, /sync-hosts/);
|
|
137
|
+
assert.match(out, /generate-adapter/);
|
|
138
|
+
assert.match(out, /generate-workflow/);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test('sync upserts generate-adapter onto Claude, Grok, and Gemini', () => {
|
|
142
|
+
const home = tmpHome();
|
|
143
|
+
fs.mkdirSync(path.join(home, '.claude'));
|
|
144
|
+
fs.mkdirSync(path.join(home, '.grok'));
|
|
145
|
+
fs.mkdirSync(path.join(home, '.gemini'));
|
|
146
|
+
applyHostSync({ packageRoot: ROOT, home });
|
|
147
|
+
const claude = fs.readFileSync(path.join(home, '.claude/skills/generate-adapter/SKILL.md'), 'utf8');
|
|
148
|
+
const grok = fs.readFileSync(path.join(home, '.grok/skills/generate-adapter/SKILL.md'), 'utf8');
|
|
149
|
+
assert.match(claude, /name: generate-adapter/);
|
|
150
|
+
assert.doesNotMatch(claude, /```mermaid/);
|
|
151
|
+
assert.match(grok, /^user-invocable: true$/m);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('sync upserts generate-workflow onto Claude, Grok, and Gemini', () => {
|
|
155
|
+
const home = tmpHome();
|
|
156
|
+
fs.mkdirSync(path.join(home, '.claude'));
|
|
157
|
+
fs.mkdirSync(path.join(home, '.grok'));
|
|
158
|
+
fs.mkdirSync(path.join(home, '.gemini'));
|
|
159
|
+
applyHostSync({ packageRoot: ROOT, home });
|
|
160
|
+
const claude = fs.readFileSync(path.join(home, '.claude/skills/generate-workflow/SKILL.md'), 'utf8');
|
|
161
|
+
const grok = fs.readFileSync(path.join(home, '.grok/skills/generate-workflow/SKILL.md'), 'utf8');
|
|
162
|
+
const gemini = fs.readFileSync(path.join(home, '.gemini/config/skills/generate-workflow/SKILL.md'), 'utf8');
|
|
163
|
+
assert.match(claude, /name: generate-workflow/);
|
|
164
|
+
assert.doesNotMatch(claude, /```mermaid/);
|
|
165
|
+
assert.match(claude, /lessons\.md/);
|
|
166
|
+
assert.match(grok, /^user-invocable: true$/m);
|
|
167
|
+
assert.match(gemini, /Do not start Maker/);
|
|
137
168
|
});
|