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,201 +0,0 @@
|
|
|
1
|
-
const test = require('node:test');
|
|
2
|
-
const assert = require('node:assert');
|
|
3
|
-
const {
|
|
4
|
-
EXECUTION_MODES,
|
|
5
|
-
EXECUTION_MODE_ALIASES,
|
|
6
|
-
GROK_FORBIDDEN_REVIEW_TYPES,
|
|
7
|
-
resolveExecutionModeId,
|
|
8
|
-
createCapabilityEvidence,
|
|
9
|
-
selectExecutionMode,
|
|
10
|
-
detectGrokRuntime,
|
|
11
|
-
createGrokCapabilityEvidence,
|
|
12
|
-
buildGrokReviewSpawnPlan,
|
|
13
|
-
formatExecutionReport
|
|
14
|
-
} = require('../lib/orchestration.js');
|
|
15
|
-
|
|
16
|
-
function fakeFs(existingPaths) {
|
|
17
|
-
return {
|
|
18
|
-
existsSync: (p) => existingPaths.includes(p)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
test('Grok spawn_subagent with full execution proof selects TRUE_INDEPENDENT_AGENT', () => {
|
|
23
|
-
const nativeSubagent = createGrokCapabilityEvidence({
|
|
24
|
-
invocationAvailable: true,
|
|
25
|
-
childConversationId: 'grok-child-da-01',
|
|
26
|
-
childModelResponse: 'Finding ledger JSON emitted',
|
|
27
|
-
executionIdentity: 'spawn_subagent:grok-child-da-01',
|
|
28
|
-
independentContextProven: true,
|
|
29
|
-
historyInherited: false
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const selected = selectExecutionMode({
|
|
33
|
-
nativeSubagent,
|
|
34
|
-
artifactIsolation: createCapabilityEvidence({
|
|
35
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
36
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
37
|
-
available: true
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.TRUE_INDEPENDENT_AGENT.id);
|
|
42
|
-
assert.strictEqual(selected.isIndependentExecutionProven, true);
|
|
43
|
-
assert.strictEqual(nativeSubagent.commandOrApi, 'spawn_subagent');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('GROK_SUBAGENTS=0 disables invocation even when grok binary exists', () => {
|
|
47
|
-
const grokBin = '/tmp/fake-grok-home/bin/grok';
|
|
48
|
-
const runtime = detectGrokRuntime(
|
|
49
|
-
{ GROK_HOME: '/tmp/fake-grok-home', GROK_SUBAGENTS: '0', HOME: '/tmp' },
|
|
50
|
-
fakeFs([grokBin])
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
assert.strictEqual(runtime.host, 'grok-cli');
|
|
54
|
-
assert.strictEqual(runtime.configurationSupported, true);
|
|
55
|
-
assert.strictEqual(runtime.invocationAvailable, false);
|
|
56
|
-
assert.strictEqual(runtime.executionProven, false);
|
|
57
|
-
assert.match(runtime.reason, /GROK_SUBAGENTS=0/);
|
|
58
|
-
|
|
59
|
-
const selected = selectExecutionMode({
|
|
60
|
-
nativeSubagent: createGrokCapabilityEvidence({
|
|
61
|
-
invocationAvailable: runtime.invocationAvailable,
|
|
62
|
-
reason: runtime.reason
|
|
63
|
-
}),
|
|
64
|
-
artifactIsolation: createCapabilityEvidence({
|
|
65
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
66
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
67
|
-
available: true
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('Grok binary present with default subagents maps to INVOCATION_AVAILABLE, not execution proven', () => {
|
|
75
|
-
const grokBin = '/tmp/fake-grok-home/bin/grok';
|
|
76
|
-
const runtime = detectGrokRuntime(
|
|
77
|
-
{ GROK_HOME: '/tmp/fake-grok-home', HOME: '/tmp' },
|
|
78
|
-
fakeFs([grokBin])
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
assert.strictEqual(runtime.invocationAvailable, true);
|
|
82
|
-
assert.strictEqual(runtime.executionProven, false);
|
|
83
|
-
|
|
84
|
-
const evidence = createGrokCapabilityEvidence({
|
|
85
|
-
invocationAvailable: true
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const selected = selectExecutionMode({
|
|
89
|
-
nativeSubagent: evidence,
|
|
90
|
-
artifactIsolation: createCapabilityEvidence({
|
|
91
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
92
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
93
|
-
available: true
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
assert.strictEqual(evidence.classification, 'INVOCATION_AVAILABLE');
|
|
98
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test('resume_from Maker transcript cannot activate TRUE_INDEPENDENT_AGENT', () => {
|
|
102
|
-
const tainted = createGrokCapabilityEvidence({
|
|
103
|
-
invocationAvailable: true,
|
|
104
|
-
childConversationId: 'grok-child-resume',
|
|
105
|
-
childModelResponse: 'I remember the Maker rationale',
|
|
106
|
-
executionIdentity: 'spawn_subagent:resume',
|
|
107
|
-
independentContextProven: true,
|
|
108
|
-
resumeFrom: 'maker-subagent-id'
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const selected = selectExecutionMode({
|
|
112
|
-
nativeSubagent: tainted,
|
|
113
|
-
artifactIsolation: createCapabilityEvidence({
|
|
114
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
115
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
116
|
-
available: true
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
assert.strictEqual(tainted.historyInherited, true);
|
|
121
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('caveman:cavecrew-reviewer cannot serve as Devil\'s Advocate', () => {
|
|
125
|
-
const compressed = createCapabilityEvidence({
|
|
126
|
-
mechanism: 'caveman:cavecrew-reviewer',
|
|
127
|
-
classification: 'GROK_COMPRESSED_REVIEW_PRESET',
|
|
128
|
-
available: true,
|
|
129
|
-
invocationAvailable: true,
|
|
130
|
-
executionProven: true,
|
|
131
|
-
childConversationId: 'cave-1',
|
|
132
|
-
executionIdentity: 'cave-1',
|
|
133
|
-
childModelResponse: 'path:line: 🔴 BLOCKER: bug. fix it.',
|
|
134
|
-
modelExecutionProven: true,
|
|
135
|
-
independentContextProven: true
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const selected = selectExecutionMode({
|
|
139
|
-
nativeSubagent: compressed,
|
|
140
|
-
artifactIsolation: createCapabilityEvidence({
|
|
141
|
-
mechanism: 'clean-slate-artifact-barrier',
|
|
142
|
-
classification: 'CONTEXT_ISOLATION_ONLY',
|
|
143
|
-
available: true
|
|
144
|
-
})
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
assert.strictEqual(selected.id, EXECUTION_MODES.CONTEXT_ISOLATION_ONLY.id);
|
|
148
|
-
assert.ok(GROK_FORBIDDEN_REVIEW_TYPES.includes('caveman:cavecrew-reviewer'));
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test('Skill aliases resolve to canonical execution mode ids', () => {
|
|
152
|
-
assert.strictEqual(resolveExecutionModeId('NATIVE_SUBAGENT'), 'TRUE_INDEPENDENT_AGENT');
|
|
153
|
-
assert.strictEqual(resolveExecutionModeId('SDK_AGENT'), 'ISOLATED_AGENT_INSTANCE');
|
|
154
|
-
assert.strictEqual(resolveExecutionModeId('HEADLESS_SUBPROCESS'), 'FRESH_PROCESS_AGENT');
|
|
155
|
-
assert.strictEqual(resolveExecutionModeId('ARTIFACT_ISOLATED_REVIEW'), 'CONTEXT_ISOLATION_ONLY');
|
|
156
|
-
assert.strictEqual(EXECUTION_MODE_ALIASES.NATIVE_SUBAGENT, EXECUTION_MODES.TRUE_INDEPENDENT_AGENT.id);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('Grok DA/Judge spawn plan is fresh, execute-only, and forbids compressed review types', () => {
|
|
160
|
-
const da = buildGrokReviewSpawnPlan({
|
|
161
|
-
role: 'devil-advocate',
|
|
162
|
-
iteration: 2,
|
|
163
|
-
artifactPaths: { goalContract: 'goal.md', gitDiff: 'diff.patch' }
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
assert.strictEqual(da.tool, 'spawn_subagent');
|
|
167
|
-
assert.strictEqual(da.subagent_type, 'devil-advocate');
|
|
168
|
-
assert.strictEqual(da.fallback_subagent_type, 'general-purpose');
|
|
169
|
-
assert.strictEqual(da.description, '[devil-advocate] review iteration 2');
|
|
170
|
-
assert.strictEqual(da.background, false);
|
|
171
|
-
assert.strictEqual(da.capability_mode, 'execute');
|
|
172
|
-
assert.strictEqual(da.isolation, 'none');
|
|
173
|
-
assert.strictEqual(da.resume_from, null);
|
|
174
|
-
assert.ok(da.forbidden_types.includes('caveman:cavecrew-reviewer'));
|
|
175
|
-
assert.strictEqual(da.artifactPaths.goalContract, 'goal.md');
|
|
176
|
-
|
|
177
|
-
const judge = buildGrokReviewSpawnPlan({ role: 'judge', iteration: 2 });
|
|
178
|
-
assert.strictEqual(judge.subagent_type, 'judge');
|
|
179
|
-
assert.strictEqual(judge.description, '[judge] evaluate iteration 2');
|
|
180
|
-
assert.strictEqual(judge.resume_from, null);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('buildGrokReviewSpawnPlan rejects unknown roles', () => {
|
|
184
|
-
assert.throws(
|
|
185
|
-
() => buildGrokReviewSpawnPlan({ role: 'caveman:cavecrew-reviewer' }),
|
|
186
|
-
/must be devil-advocate or judge/
|
|
187
|
-
);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test('Grok proven spawn report discloses independent execution', () => {
|
|
191
|
-
const report = formatExecutionReport({
|
|
192
|
-
selectedMode: EXECUTION_MODES.TRUE_INDEPENDENT_AGENT,
|
|
193
|
-
capabilityRegistry: {
|
|
194
|
-
nativeSubagent: { invocationAvailable: true }
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
assert.match(report, /Execution Mode: TRUE_INDEPENDENT_AGENT/);
|
|
199
|
-
assert.match(report, /Independent LLM Execution: PROVEN/);
|
|
200
|
-
assert.match(report, /Native Subagent Invocation: AVAILABLE/);
|
|
201
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const test = require('node:test');
|
|
4
|
-
const assert = require('node:assert');
|
|
5
|
-
const {
|
|
6
|
-
HOST_MODEL_LIST_COMMANDS,
|
|
7
|
-
parseGrokModelsOutput,
|
|
8
|
-
codingInternModels,
|
|
9
|
-
formatInternPickList,
|
|
10
|
-
internInCatalog
|
|
11
|
-
} = require('../lib/intern-catalog.js');
|
|
12
|
-
|
|
13
|
-
const GROK_MODELS_FIXTURE = `You are logged in with grok.com.
|
|
14
|
-
|
|
15
|
-
Default model: grok-4.6
|
|
16
|
-
|
|
17
|
-
Available models:
|
|
18
|
-
- grok-4.20-0309-non-reasoning
|
|
19
|
-
- grok-4.20-0309-reasoning
|
|
20
|
-
- grok-4.20-multi-agent-0309
|
|
21
|
-
- grok-4.3
|
|
22
|
-
- grok-4.5
|
|
23
|
-
* grok-4.6 (default)
|
|
24
|
-
- grok-build-0.1
|
|
25
|
-
- grok-imagine-image
|
|
26
|
-
- grok-imagine-image-2.0
|
|
27
|
-
- grok-imagine-image-quality
|
|
28
|
-
- grok-imagine-video
|
|
29
|
-
- grok-imagine-video-1.5
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
test('host list commands include grok models and /models', () => {
|
|
33
|
-
assert.ok(HOST_MODEL_LIST_COMMANDS.includes('grok models'));
|
|
34
|
-
assert.ok(HOST_MODEL_LIST_COMMANDS.includes('/models'));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('AC-1 parse grok models into ids plus default', () => {
|
|
38
|
-
const parsed = parseGrokModelsOutput(GROK_MODELS_FIXTURE);
|
|
39
|
-
assert.strictEqual(parsed.defaultModel, 'grok-4.6');
|
|
40
|
-
assert.ok(parsed.models.includes('grok-build-0.1'));
|
|
41
|
-
assert.ok(parsed.models.includes('grok-4.6'));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('AC-2 empty catalog pick list is only none', () => {
|
|
45
|
-
assert.strictEqual(formatInternPickList([]), '0) none (Recommended)');
|
|
46
|
-
assert.strictEqual(internInCatalog('none', []), true);
|
|
47
|
-
assert.strictEqual(internInCatalog('', []), true);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('AC-3 Claude has no grok catalog so only none is in-catalog', () => {
|
|
51
|
-
assert.strictEqual(internInCatalog('gemini-flash', []), false);
|
|
52
|
-
assert.strictEqual(internInCatalog('grok-build-0.1', []), false);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('AC-4 imagine and video models are not coding intern picks', () => {
|
|
56
|
-
const { models } = parseGrokModelsOutput(GROK_MODELS_FIXTURE);
|
|
57
|
-
const coding = codingInternModels(models);
|
|
58
|
-
assert.ok(coding.includes('grok-build-0.1'));
|
|
59
|
-
assert.ok(!coding.includes('grok-imagine-image'));
|
|
60
|
-
assert.ok(!coding.includes('grok-imagine-video'));
|
|
61
|
-
const list = formatInternPickList(models);
|
|
62
|
-
assert.match(list, /0\) none \(Recommended\)/);
|
|
63
|
-
assert.match(list, /grok-build-0.1/);
|
|
64
|
-
assert.doesNotMatch(list, /imagine/);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('AC-5 unknown slug is not in catalog', () => {
|
|
68
|
-
const { models } = parseGrokModelsOutput(GROK_MODELS_FIXTURE);
|
|
69
|
-
assert.strictEqual(internInCatalog('grok-build-0.1', models), true);
|
|
70
|
-
assert.strictEqual(internInCatalog('not-a-real-model', models), false);
|
|
71
|
-
assert.strictEqual(internInCatalog('sk-abc', models), false);
|
|
72
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const test = require('node:test');
|
|
2
|
-
const assert = require('node:assert');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const { execFileSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const CLI = path.join(__dirname, '..', 'bin', 'ai-engineering-loop.js');
|
|
9
|
-
|
|
10
|
-
function tmpRepo() {
|
|
11
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ael-'));
|
|
12
|
-
fs.writeFileSync(
|
|
13
|
-
path.join(dir, 'package.json'),
|
|
14
|
-
JSON.stringify({ name: 'fixture', scripts: { test: 'node -e ""' } }, null, 2)
|
|
15
|
-
);
|
|
16
|
-
return dir;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
test('init writes glossary.md and adrs/README.md', () => {
|
|
20
|
-
const dir = tmpRepo();
|
|
21
|
-
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
22
|
-
const glossary = path.join(dir, '.ai-engineering-loop', 'glossary.md');
|
|
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');
|
|
26
|
-
assert.ok(fs.existsSync(glossary));
|
|
27
|
-
assert.ok(fs.existsSync(adr));
|
|
28
|
-
assert.ok(fs.existsSync(workflow));
|
|
29
|
-
assert.ok(fs.existsSync(lessons));
|
|
30
|
-
assert.match(fs.readFileSync(glossary, 'utf8'), /Ubiquitous Language/);
|
|
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/);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('repair fills missing glossary without overwriting a filled glossary or architecture', () => {
|
|
37
|
-
const dir = tmpRepo();
|
|
38
|
-
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
39
|
-
const glossary = path.join(dir, '.ai-engineering-loop', 'glossary.md');
|
|
40
|
-
const architecture = path.join(dir, '.ai-engineering-loop', 'architecture.md');
|
|
41
|
-
fs.writeFileSync(glossary, '# Custom glossary\n- Foo: bar\n');
|
|
42
|
-
const archBefore = fs.readFileSync(architecture, 'utf8');
|
|
43
|
-
fs.unlinkSync(glossary);
|
|
44
|
-
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
45
|
-
assert.ok(fs.existsSync(glossary));
|
|
46
|
-
assert.strictEqual(fs.readFileSync(architecture, 'utf8'), archBefore);
|
|
47
|
-
fs.writeFileSync(glossary, '# Custom glossary\n- Foo: bar\n');
|
|
48
|
-
fs.unlinkSync(architecture);
|
|
49
|
-
execFileSync('node', [CLI, 'init'], { cwd: dir, encoding: 'utf8' });
|
|
50
|
-
assert.match(fs.readFileSync(glossary, 'utf8'), /Foo: bar/);
|
|
51
|
-
assert.ok(fs.existsSync(architecture));
|
|
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
|
-
});
|
|
@@ -1,82 +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 path = require('path');
|
|
7
|
-
|
|
8
|
-
const ROOT = path.join(__dirname, '..');
|
|
9
|
-
|
|
10
|
-
const SKIP_DIR = new Set([
|
|
11
|
-
'.git',
|
|
12
|
-
'node_modules',
|
|
13
|
-
'.serena',
|
|
14
|
-
'.DS_Store'
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
function walk(dir, out = []) {
|
|
18
|
-
for (const name of fs.readdirSync(dir)) {
|
|
19
|
-
if (SKIP_DIR.has(name)) continue;
|
|
20
|
-
const abs = path.join(dir, name);
|
|
21
|
-
const st = fs.lstatSync(abs);
|
|
22
|
-
if (st.isSymbolicLink()) continue;
|
|
23
|
-
if (st.isDirectory()) walk(abs, out);
|
|
24
|
-
else if (st.isFile()) out.push(abs);
|
|
25
|
-
}
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function rel(abs) {
|
|
30
|
-
return path.relative(ROOT, abs).split(path.sep).join('/');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const FINGERPRINTS = [
|
|
34
|
-
{ re: /dotify/i, label: 'dotify' },
|
|
35
|
-
{ re: /bikin-rindu/i, label: 'bikin-rindu' },
|
|
36
|
-
{ re: /hasNormalHours/, label: 'hasNormalHours' },
|
|
37
|
-
{ re: /overtimeNote/, label: 'overtimeNote' },
|
|
38
|
-
{ re: /attendanceConfirmation/i, label: 'attendanceConfirmation' },
|
|
39
|
-
{ re: /internal-dotify/, label: 'internal-dotify' },
|
|
40
|
-
{ re: /hanaaaca/, label: 'coworker handle' },
|
|
41
|
-
{ re: /ulfa\.mufida/, label: 'coworker handle' },
|
|
42
|
-
{ re: /kontribusi\/mattermost-agent/, label: 'local mattermost-agent checkout' },
|
|
43
|
-
{ re: /dot-system\//, label: 'dot-system/' },
|
|
44
|
-
{ re: /timeEntities/, label: 'timeEntities' },
|
|
45
|
-
{ re: /resolveAttendanceConfirmation/, label: 'resolveAttendanceConfirmation' },
|
|
46
|
-
{ re: /attendance-confirmations/, label: 'attendance-confirmations' }
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
test('packaged files do not embed real client tickets, schema, or machine paths', () => {
|
|
50
|
-
const files = walk(ROOT).filter((abs) => {
|
|
51
|
-
const r = rel(abs);
|
|
52
|
-
return !r.startsWith('tests/no-company-leak.test.js');
|
|
53
|
-
});
|
|
54
|
-
const hits = [];
|
|
55
|
-
for (const abs of files) {
|
|
56
|
-
const r = rel(abs);
|
|
57
|
-
let text;
|
|
58
|
-
try {
|
|
59
|
-
text = fs.readFileSync(abs, 'utf8');
|
|
60
|
-
} catch {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (text.includes('\u0000')) continue;
|
|
64
|
-
|
|
65
|
-
if (r !== 'bin/ai-engineering-loop.js' && /gitlab\.dot\.co\.id/.test(text)) {
|
|
66
|
-
hits.push(`${r}: gitlab.dot.co.id (allowed only as adapter auto-detect in bin/)`);
|
|
67
|
-
}
|
|
68
|
-
if (r === 'bin/ai-engineering-loop.js' && /gitlab\.dot\.co\.id\/.+/.test(text)) {
|
|
69
|
-
hits.push(`${r}: gitlab.dot.co.id with a path (ticket URL)`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const inSensitiveTree = r.startsWith('adapters/') || r.startsWith('examples/');
|
|
73
|
-
if (inSensitiveTree && /\/Users\/egagofur/.test(text)) {
|
|
74
|
-
hits.push(`${r}: /Users/egagofur`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
for (const { re, label } of FINGERPRINTS) {
|
|
78
|
-
if (re.test(text)) hits.push(`${r}: ${label}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
assert.deepStrictEqual(hits, []);
|
|
82
|
-
});
|