ai-engineering-loop 1.0.14 → 1.0.16

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.
Files changed (46) hide show
  1. package/.agents/workflows/ai-engineering-loop.md +2 -2
  2. package/.claude/commands/ai-engineering-loop.md +1 -1
  3. package/.claude/skills/ai-engineering-loop/SKILL.md +4 -3
  4. package/.gemini/skills/ai-engineering-loop/SKILL.md +4 -3
  5. package/.grok/commands/ai-engineering-loop.md +1 -1
  6. package/.grok/skills/ai-engineering-loop/SKILL.md +4 -4
  7. package/README.md +16 -10
  8. package/adapters/README.md +27 -0
  9. package/adapters/dot/README.md +8 -8
  10. package/adapters/dot/coreview.md +3 -2
  11. package/adapters/dot/gitlab.md +3 -3
  12. package/adapters/dot/mattermost.md +59 -71
  13. package/adapters/dot/multi-branch.md +3 -2
  14. package/adapters/dot/skills/dot-dev-workflow/SKILL.md +2 -2
  15. package/adapters/dot/skills/task-impact-inquiry/SKILL.md +155 -0
  16. package/adapters/generate-adapter/SKILL.md +123 -0
  17. package/adapters/github/README.md +28 -0
  18. package/adapters/github/pull-request.md +23 -0
  19. package/adapters/gitlab/README.md +28 -0
  20. package/adapters/gitlab/merge-request.md +26 -0
  21. package/adapters/standard/README.md +44 -0
  22. package/bin/ai-engineering-loop.js +31 -3
  23. package/core/grill-policy.md +14 -10
  24. package/core/repo-config-schema.md +1 -1
  25. package/examples/backend-api/payment-idempotency/README.md +3 -3
  26. package/examples/dot/status-display/README.md +23 -0
  27. package/examples/dot/status-display/delivery-report.md +41 -0
  28. package/examples/dot/status-display/goal-contract.md +46 -0
  29. package/examples/dot/status-display/judge-verdict.md +44 -0
  30. package/examples/dot/status-display/review-findings.md +63 -0
  31. package/examples/initialization/README.md +2 -2
  32. package/examples/initialization/discovery-trace.md +1 -1
  33. package/examples/mobile-app/offline-sync-queue/README.md +3 -3
  34. package/lib/generate-adapter.js +118 -0
  35. package/lib/sync-hosts.js +7 -1
  36. package/package.json +1 -1
  37. package/templates/repo-config/adapter.md +1 -1
  38. package/tests/generate-adapter.test.js +80 -0
  39. package/tests/no-company-leak.test.js +82 -0
  40. package/tests/skill-host-compat.test.js +45 -7
  41. package/tests/sync-hosts.test.js +33 -1
  42. package/examples/dot/attendance-confirmation/README.md +0 -22
  43. package/examples/dot/attendance-confirmation/delivery-report.md +0 -51
  44. package/examples/dot/attendance-confirmation/goal-contract.md +0 -39
  45. package/examples/dot/attendance-confirmation/judge-verdict.md +0 -43
  46. package/examples/dot/attendance-confirmation/review-findings.md +0 -57
@@ -0,0 +1,46 @@
1
+ # Goal Contract: Request Display Status Fix
2
+
3
+ ## 1. Objective
4
+
5
+ Fix incorrect display status on list and pagination endpoints when a request has mixed line items, holiday logs, non-standard windows, or null collections.
6
+
7
+ ## 2. Business Outcome & User Lifecycle Impact
8
+
9
+ - **Employees**: See APPROVED, REJECTED, or NEED_APPROVAL matching the real record.
10
+ - **Reviewers**: Stop getting false pending notices for already-settled holiday logs.
11
+ - **Finance**: Totals used by the downstream aggregate job stay consistent.
12
+
13
+ ## 3. Acceptance Criteria (AC)
14
+
15
+ - [ ] **AC-1**: If `hasStandardWindow = true` and `duration` is within the standard day limit on a weekday without a rush note, display status is `APPROVED` or `NEED_APPROVAL` from clock-in/out presence only.
16
+ - [ ] **AC-2**: If a rush note exists, or duration exceeds the standard limit, or `isHoliday = true`, evaluate pending status across all associated `lineItems`.
17
+ - [ ] **AC-3**: Non-standard-window records (`user.type.hasStandardWindow = false`) must not use the weekday duration threshold.
18
+ - [ ] **AC-4**: Null or missing `lineItems` default to `APPROVED` without throwing `TypeError`.
19
+ - [ ] **AC-5**: The existing API response contract is unchanged.
20
+
21
+ ## 4. Technical Constraints
22
+
23
+ - Keep the existing list/pagination query shape.
24
+ - Centralize logic in a pure function: `resolveRequestDisplayStatus`.
25
+ - No new runtime dependencies.
26
+ - `tsc --noEmit` exits 0.
27
+
28
+ ## 5. Out of Scope
29
+
30
+ - Frontend layout changes.
31
+ - Database migrations.
32
+ - Changing the downstream aggregate/export job.
33
+
34
+ ## 6. Verification Requirements
35
+
36
+ - **Unit Tests**: Jest suite at `src/server/requests/utils/resolve-display-status.test.ts`.
37
+ - **Typecheck**: `npx tsc --noEmit` exits 0.
38
+ - **Linter**: `npx eslint --fix` on modified files, 0 errors.
39
+ - **Regression**: commands in `.ai-engineering-loop/verification.md` (example: `npx jest && npx tsc --noEmit`).
40
+
41
+ ## 7. Definition of Done (DoD)
42
+
43
+ - [ ] AC-1 through AC-5 proven by unit tests.
44
+ - [ ] Deterministic verification passes.
45
+ - [ ] Devil's Advocate review with 0 unresolved blocking findings.
46
+ - [ ] Judge issues PASS.
@@ -0,0 +1,44 @@
1
+ # Judge Evaluation Report: Request Display Status Fix
2
+
3
+ ## 1. Executive Verdict
4
+
5
+ - **Verdict**: `PASS`
6
+ - **Iteration**: `Iteration 2 of 3`
7
+ - **Confidence**: `HIGH`
8
+
9
+ ---
10
+
11
+ ## 2. Deterministic Verification Audit
12
+
13
+ | Check | Command Executed | Raw Result | Status |
14
+ |---|---|---|:---:|
15
+ | **Unit Tests** | `npx jest src/server/requests/utils/resolve-display-status.test.ts` | `Tests: 12 passed, 12 total.` | PASS |
16
+ | **Full Suite** | `npx jest && npx tsc --noEmit` | `Test Suites: 12 passed. tsc exit 0.` | PASS |
17
+ | **TypeScript** | `npx tsc --noEmit` | `Exit code 0.` | PASS |
18
+ | **Linter** | `npx eslint --fix src/server/requests/**` | `0 errors.` | PASS |
19
+
20
+ ---
21
+
22
+ ## 3. Goal Contract Compliance Audit
23
+
24
+ | Criterion | Verified By Test / Artifact | Result |
25
+ |---|---|:---:|
26
+ | **AC-1**: Standard-window weekday | `resolve-display-status.test.ts > standard window` | PASS |
27
+ | **AC-2**: Holiday and over-limit handling | `resolve-display-status.test.ts > holiday rush` | PASS |
28
+ | **AC-3**: Non-standard-window records | `resolve-display-status.test.ts > non-standard window` | PASS |
29
+ | **AC-4**: Null `lineItems` | `resolve-display-status.test.ts > null safety` | PASS |
30
+ | **AC-5**: API contract | router typecheck | PASS |
31
+
32
+ ---
33
+
34
+ ## 4. Finding Triage Audit
35
+
36
+ - **COR-001 (High - Null Safety)**: Maker applied null coalescing in Iteration 2. **Status: RESOLVED & VERIFIED**.
37
+ - **MAINT-001 (Low - Factory Suggestion)**: Invalid speculative nitpick. **Status: DISMISSED / INVALID**.
38
+
39
+ ---
40
+
41
+ ## 5. Formal Conclusion & Hand-off
42
+
43
+ Definition of Done is met with reproducible evidence.
44
+ **Authorized next action**: DOT Delivery Adapter (`adapters/dot/README.md`) for GitLab MR, multi-branch cherry-pick, Coreview triage, and Mattermost.
@@ -0,0 +1,63 @@
1
+ # Adversarial Review Findings & Triage: Request Display Status Fix
2
+
3
+ ## 1. Review Summary
4
+
5
+ - **Reviewer**: Devil's Advocate Agent
6
+ - **Target Branch**: `main...fix/request-display-status`
7
+ - **Total Findings**: 2
8
+ - **Blocking (SEV-1/2)**: 1
9
+ - **Non-Blocking / Invalid**: 1
10
+
11
+ ---
12
+
13
+ ## 2. Findings Ledger
14
+
15
+ ### Finding COR-001: Missing null safety when iterating `lineItems`
16
+
17
+ - **Severity**: `HIGH` (SEV-2)
18
+ - **Category**: `Correctness`
19
+ - **Location**: `src/server/requests/utils/resolve-display-status.ts:34-41`
20
+ - **Evidence**:
21
+
22
+ ```typescript
23
+ const hasPending = confirmation.lineItems.some(
24
+ (item) => item.status === "NEED_APPROVAL"
25
+ );
26
+ ```
27
+
28
+ - **Problem**:
29
+ If `confirmation.lineItems` is `null` or `undefined` (legacy rows), `.some()` throws `TypeError`.
30
+ - **Impact**:
31
+ Pagination API crashes for historical records.
32
+ - **Recommendation**:
33
+
34
+ ```diff
35
+ - const hasPending = confirmation.lineItems.some(
36
+ + const hasPending = (confirmation.lineItems ?? []).some(
37
+ (item) => item.status === "NEED_APPROVAL"
38
+ );
39
+ ```
40
+
41
+ - **Confidence**: `HIGH`
42
+ - **Status**: `TRIAGED_VALID`
43
+ - **Resolution**:
44
+ Maker applied `(confirmation.lineItems ?? [])` and added `should return APPROVED when lineItems is null or undefined`.
45
+
46
+ ---
47
+
48
+ ### Finding MAINT-001: Suggestion to convert helper into an abstract factory class
49
+
50
+ - **Severity**: `LOW` (SEV-4)
51
+ - **Category**: `Maintainability`
52
+ - **Location**: `src/server/requests/utils/resolve-display-status.ts:1-50`
53
+ - **Evidence**:
54
+ Utility is `export function resolveRequestDisplayStatus(...)`.
55
+ - **Problem**:
56
+ Reviewer wanted a Strategy/Factory for future calculator swaps.
57
+ - **Impact**:
58
+ None. Pure functions match this repo.
59
+ - **Recommendation**: Refactor to `class StatusCalculatorFactory`.
60
+ - **Confidence**: `LOW`
61
+ - **Status**: `TRIAGED_INVALID`
62
+ - **Triage Reason**:
63
+ Speculative overengineering. Constraint: surgical change, no extra abstractions.
@@ -13,7 +13,7 @@ This walkthrough demonstrates how the **AI Engineering Loop** automatically init
13
13
 
14
14
  ## 2. Walkthrough Artifacts
15
15
 
16
- 1. **[Discovery Execution Trace (`discovery-trace.md`)](file:///Users/egagofur/Development/work/ai-engineering-loop/examples/initialization/discovery-trace.md)**:
16
+ 1. **[Discovery Execution Trace (`discovery-trace.md`)](./discovery-trace.md)**:
17
17
  - Full 5-pass log of directory inspection, manifest parsing, script discovery, architecture tracing, and second-pass quality check.
18
- 2. **[Generated Context Artifacts (`generated-context.md`)](file:///Users/egagofur/Development/work/ai-engineering-loop/examples/initialization/generated-context.md)**:
18
+ 2. **[Generated Context Artifacts (`generated-context.md`)](./generated-context.md)**:
19
19
  - The exact evidence-based `.ai-engineering-loop/` files generated automatically by the agent without user intervention.
@@ -18,7 +18,7 @@
18
18
  - `packages/` (contains `ui/`, `database/`, `shared/`)
19
19
  - `pnpm-workspace.yaml` (detected `pnpm` monorepo)
20
20
  - `turbo.json` (detected Turborepo pipeline)
21
- - **Profile Binding**: Bound [`profiles/monorepo.md`](file:///Users/egagofur/Development/work/ai-engineering-loop/profiles/monorepo.md).
21
+ - **Profile Binding**: Bound [`profiles/monorepo.md`](../../profiles/monorepo.md).
22
22
 
23
23
  ### Pass 2: Manifests & Verification Commands Discovery
24
24
  - Parsed `package.json` (root):
@@ -22,12 +22,12 @@ Task: Implement persistent offline SQLite mutation queue with exponential backof
22
22
 
23
23
  ## 3. Walkthrough Artifacts
24
24
 
25
- 1. **[Goal Contract (`goal-contract.md`)](file:///Users/egagofur/Development/work/ai-engineering-loop/examples/mobile-app/offline-sync-queue/goal-contract.md)**:
25
+ 1. **[Goal Contract (`goal-contract.md`)](./goal-contract.md)**:
26
26
  - AC-1: All form submissions persist immediately to local SQLite `mutation_queue` table before network dispatch.
27
27
  - AC-2: Background sync engine triggers on network restoration with exponential backoff.
28
28
  - AC-3: OS suspension / app kill must not drop un-synced items.
29
- 2. **[Adversarial Review Findings (`review-findings.md`)](file:///Users/egagofur/Development/work/ai-engineering-loop/examples/mobile-app/offline-sync-queue/review-findings.md)**:
29
+ 2. **[Adversarial Review Findings (`review-findings.md`)](./review-findings.md)**:
30
30
  - Devil's Advocate activates `mobile-app` rules (offline persistence, lifecycle, battery).
31
31
  - Flags missing disk write error handling when device storage is full (`PERF-001`).
32
- 3. **[Judge Verdict (`judge-verdict.md`)](file:///Users/egagofur/Development/work/ai-engineering-loop/examples/mobile-app/offline-sync-queue/judge-verdict.md)**:
32
+ 3. **[Judge Verdict (`judge-verdict.md`)](./judge-verdict.md)**:
33
33
  - Audits Flutter unit & mock network tests, verifies 100% pass, and issues `PASS` verdict.
@@ -0,0 +1,118 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const SHIPPED_TYPES = ['standard', 'github', 'gitlab', 'dot'];
7
+
8
+ function readGitRemote(rootDir) {
9
+ const gitConfig = path.join(rootDir, '.git', 'config');
10
+ try {
11
+ const text = fs.readFileSync(gitConfig, 'utf8');
12
+ const match = text.match(/url\s*=\s*(.*)/);
13
+ return match ? match[1].trim() : '';
14
+ } catch {
15
+ return '';
16
+ }
17
+ }
18
+
19
+ function detectCi(rootDir) {
20
+ if (fs.existsSync(path.join(rootDir, '.github', 'workflows'))) {
21
+ return 'GitHub Actions';
22
+ }
23
+ if (fs.existsSync(path.join(rootDir, '.gitlab-ci.yml'))) {
24
+ return 'GitLab CI';
25
+ }
26
+ return 'none';
27
+ }
28
+
29
+ function recommendType(remote) {
30
+ const url = (remote || '').toLowerCase();
31
+ if (url.includes('github.com')) return 'github';
32
+ if (url.includes('gitlab')) return 'gitlab';
33
+ return 'standard';
34
+ }
35
+
36
+ function detectAdapterHints(rootDir) {
37
+ const remote = readGitRemote(rootDir);
38
+ const ciProvider = detectCi(rootDir);
39
+ const recommended = recommendType(remote);
40
+ let existingType = '';
41
+ const adapterPath = path.join(rootDir, '.ai-engineering-loop', 'adapter.md');
42
+ try {
43
+ const text = fs.readFileSync(adapterPath, 'utf8');
44
+ const match = text.match(/adapter_type\*\*:\s*"?([a-z0-9-]+)/i) || text.match(/adapter_type:\s*"?([a-z0-9-]+)/i);
45
+ if (match) existingType = match[1];
46
+ } catch {
47
+ /* missing */
48
+ }
49
+ return { remote, ciProvider, recommended, existingType };
50
+ }
51
+
52
+ function adapterMarkdown({ type, remote, ciProvider, defaultBranch = 'main' }) {
53
+ const spec = `adapters/${type}/`;
54
+ const remoteLine = remote ? `- **remote_repository**: "${remote}"\n` : '';
55
+ return `# Project Delivery Adapter Configuration
56
+
57
+ ## Delivery Pipeline
58
+ - **adapter_type**: "${type}"
59
+ - **spec**: "${spec}"
60
+ ${remoteLine}- **default_target_branch**: "${defaultBranch}"
61
+ - **ci_provider**: "${ciProvider}"
62
+
63
+ ## Stage 8
64
+ After Judge PASS, follow \`${spec}\` in the ai-engineering-loop package.
65
+ Do not start Maker. Do not skip Devil's Advocate or Judge.
66
+ Extra branches and chat notifications stay off unless this file names them.
67
+ `;
68
+ }
69
+
70
+ function writeShippedAdapter(rootDir, { type, hints }) {
71
+ if (!SHIPPED_TYPES.includes(type)) {
72
+ const err = new Error(`Unknown adapter type: ${type}. Use ${SHIPPED_TYPES.join('|')}`);
73
+ err.code = 'UNKNOWN_TYPE';
74
+ throw err;
75
+ }
76
+ const dir = path.join(rootDir, '.ai-engineering-loop');
77
+ fs.mkdirSync(dir, { recursive: true });
78
+ const dest = path.join(dir, 'adapter.md');
79
+ const body = adapterMarkdown({
80
+ type,
81
+ remote: hints.remote,
82
+ ciProvider: hints.ciProvider
83
+ });
84
+ fs.writeFileSync(dest, body);
85
+ return dest;
86
+ }
87
+
88
+ function formatGenerateAdapterReport(hints, { version, wrote } = {}) {
89
+ const lines = [
90
+ `Adapter generate (v${version || 'unknown'})`,
91
+ 'Detected',
92
+ `- remote: ${hints.remote || '(none)'}`,
93
+ `- ci: ${hints.ciProvider}`,
94
+ `- recommended: ${hints.recommended}`,
95
+ `- existing: ${hints.existingType || '(none)'}`,
96
+ `Shipped: ${SHIPPED_TYPES.join(' | ')}`,
97
+ 'Next: load skill generate-adapter. Ask Q1-Q5. Wait.',
98
+ 'Headless: npx ai-engineering-loop generate-adapter --type <standard|github|gitlab|dot>'
99
+ ];
100
+ if (wrote) lines.push(`Wrote: ${wrote}`);
101
+ return lines.join('\n');
102
+ }
103
+
104
+ function parseTypeArg(argv) {
105
+ const idx = argv.indexOf('--type');
106
+ if (idx === -1) return null;
107
+ return argv[idx + 1] || null;
108
+ }
109
+
110
+ module.exports = {
111
+ SHIPPED_TYPES,
112
+ detectAdapterHints,
113
+ recommendType,
114
+ adapterMarkdown,
115
+ writeShippedAdapter,
116
+ formatGenerateAdapterReport,
117
+ parseTypeArg
118
+ };
package/lib/sync-hosts.js CHANGED
@@ -33,6 +33,8 @@ function hostFileMap(home) {
33
33
  root: claude,
34
34
  files: [
35
35
  { src: '.claude/skills/ai-engineering-loop/SKILL.md', dest: path.join(claude, 'skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' },
36
+ { src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(claude, 'skills/task-impact-inquiry/SKILL.md'), mode: 'upsert' },
37
+ { src: 'adapters/generate-adapter/SKILL.md', dest: path.join(claude, 'skills/generate-adapter/SKILL.md'), mode: 'upsert' },
36
38
  { src: '.claude/agents/devil-advocate.md', dest: path.join(claude, 'agents/devil-advocate.md'), mode: 'upsert' },
37
39
  { src: '.claude/agents/judge.md', dest: path.join(claude, 'agents/judge.md'), mode: 'upsert' },
38
40
  { src: '.claude/commands/ai-engineering-loop.md', dest: path.join(claude, 'commands/ai-engineering-loop.md'), mode: 'upsert' }
@@ -43,6 +45,8 @@ function hostFileMap(home) {
43
45
  root: grok,
44
46
  files: [
45
47
  { src: '.grok/skills/ai-engineering-loop/SKILL.md', dest: path.join(grok, 'skills/ai-engineering-loop/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
48
+ { src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(grok, 'skills/task-impact-inquiry/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
49
+ { src: 'adapters/generate-adapter/SKILL.md', dest: path.join(grok, 'skills/generate-adapter/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
46
50
  { src: '.grok/agents/devil-advocate.md', dest: path.join(grok, 'agents/devil-advocate.md'), mode: 'upsert' },
47
51
  { src: '.grok/agents/judge.md', dest: path.join(grok, 'agents/judge.md'), mode: 'upsert' },
48
52
  { src: '.grok/commands/ai-engineering-loop.md', dest: path.join(grok, 'commands/ai-engineering-loop.md'), mode: 'upsert' }
@@ -52,7 +56,9 @@ function hostFileMap(home) {
52
56
  id: 'gemini',
53
57
  root: gemini,
54
58
  files: [
55
- { src: '.gemini/skills/ai-engineering-loop/SKILL.md', dest: path.join(gemini, 'config/skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' }
59
+ { src: '.gemini/skills/ai-engineering-loop/SKILL.md', dest: path.join(gemini, 'config/skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' },
60
+ { src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(gemini, 'config/skills/task-impact-inquiry/SKILL.md'), mode: 'upsert' },
61
+ { src: 'adapters/generate-adapter/SKILL.md', dest: path.join(gemini, 'config/skills/generate-adapter/SKILL.md'), mode: 'upsert' }
56
62
  ]
57
63
  },
58
64
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-engineering-loop",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "A reusable, framework-agnostic AI Engineering Operating System for autonomous coding agents.",
5
5
  "main": "bin/ai-engineering-loop.js",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  # Project Delivery Adapter Configuration
2
2
 
3
3
  ## Delivery Settings
4
- - **adapter_type**: "github" # dot | github | gitlab | custom
4
+ - **adapter_type**: "github" # standard | github | gitlab | dot | custom
5
5
  - **repository**: "organization/my-service"
6
6
  - **default_target_branch**: "main"
7
7
  - **notification_webhook**: "https://hooks.slack.com/services/..." # Optional
@@ -0,0 +1,80 @@
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
+ });
@@ -0,0 +1,82 @@
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
+ });
@@ -166,17 +166,33 @@ test('Gemini Antigravity skill matches the loop and never uses Grok spawn keys o
166
166
  assert.match(gemini, /TRUE_INDEPENDENT_AGENT/);
167
167
  });
168
168
 
169
- test('DOT adapter locates task-impact-inquiry on Antigravity Gemini skills, not Claude', () => {
169
+ test('task-impact-inquiry is Claude-safe and ships to Claude, Grok, and Gemini', () => {
170
+ const skill = readRepo('adapters/dot/skills/task-impact-inquiry/SKILL.md');
171
+ const { fm } = parseFrontmatter(skill, 'task-impact-inquiry');
172
+ assert.doesNotMatch(fm, /^description:\s*>-?/m);
173
+ assert.doesNotMatch(skill, /```mermaid/);
174
+ assert.doesNotMatch(skill, /\$\\/);
175
+ assert.doesNotMatch(skill, /spawn_subagent/);
176
+ assert.match(skill, /lifecycle/);
177
+ assert.match(skill, /ASCII/);
178
+ assert.match(skill, /failure table/);
179
+ assert.match(skill, /Do not interview again/);
180
+ assert.match(skill, /Passing unit tests are not isolation proof|Green unit tests/);
181
+ assert.match(skill, /New-dev briefing/);
182
+ assert.match(skill, /Hit map|Where it hits/);
183
+ assert.match(skill, /Do not generate an FSD/);
184
+ const grill = readRepo('core/grill-policy.md');
185
+ assert.match(grill, /Business blast radius/);
186
+ assert.match(grill, /~\/\.claude\/skills\/task-impact-inquiry/);
187
+ assert.match(grill, /~\/\.grok\/skills\/task-impact-inquiry/);
188
+ assert.match(grill, /~\/\.gemini\/config\/skills\/task-impact-inquiry/);
170
189
  const readme = readRepo('adapters/dot/README.md');
171
- assert.match(readme, /~\/\.gemini\/config\/skills/);
172
190
  assert.match(readme, /task-impact-inquiry/);
173
- assert.match(readme, /not from `~\/\.claude\/skills\/`/);
174
- assert.doesNotMatch(readme, /and `~\/\.claude\/skills\/`/);
175
- const grill = readRepo('core/grill-policy.md');
176
- assert.match(grill, /task-impact-inquiry/);
177
- assert.match(grill, /Do not skip grill/);
191
+ assert.match(readme, /~\/\.claude\/skills\//);
192
+ assert.doesNotMatch(readme, /not from `~\/\.claude\/skills\/`/);
178
193
  const wf = readRepo('.agents/workflows/ai-engineering-loop.md');
179
194
  assert.match(wf, /task-impact-inquiry/);
195
+ assert.match(wf, /blast radius: lifecycle sketch/);
180
196
  });
181
197
 
182
198
  test('DOT router sends commit-bound work to ai-engineering-loop; workflow is Stage 8 only', () => {
@@ -194,6 +210,27 @@ test('DOT router sends commit-bound work to ai-engineering-loop; workflow is Sta
194
210
  assert.doesNotMatch(readme, /Pre-commit multi-round adversarial review gate \(Phase 6\)/);
195
211
  });
196
212
 
213
+ test('generate-adapter skill is Claude-safe and shipped adapters stay generic', () => {
214
+ const skill = readRepo('adapters/generate-adapter/SKILL.md');
215
+ const { fm } = parseFrontmatter(skill, 'generate-adapter');
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
+ const catalog = readRepo('adapters/README.md');
223
+ assert.match(catalog, /standard/);
224
+ assert.match(catalog, /github/);
225
+ assert.match(catalog, /gitlab/);
226
+ const gitlab = readRepo('adapters/gitlab/README.md');
227
+ assert.match(gitlab, /not the DOT adapter/);
228
+ assert.doesNotMatch(gitlab, /Coreview/);
229
+ assert.doesNotMatch(gitlab, /Mattermost/);
230
+ const standard = readRepo('adapters/standard/README.md');
231
+ assert.match(standard, /Judge `PASS`/);
232
+ });
233
+
197
234
  test('Host skills Stage 0 runs sync-hosts before status', () => {
198
235
  for (const rel of [
199
236
  '.claude/skills/ai-engineering-loop/SKILL.md',
@@ -260,6 +297,7 @@ test('Failure table is required to freeze, TDD, verify, and Judge', () => {
260
297
  assert.match(text, /failure table/, rel);
261
298
  assert.match(text, /One red test per AC row/, rel);
262
299
  assert.match(text, /Do not freeze sunny-path-only/, rel);
300
+ assert.match(text, /blast radius: lifecycle sketch/, rel);
263
301
  }
264
302
  });
265
303
 
@@ -47,9 +47,27 @@ test('sync upserts Claude AEL files but does not invent DOT skills', () => {
47
47
  assert.ok(fs.existsSync(path.join(home, '.claude/agents/judge.md')));
48
48
  assert.ok(fs.existsSync(path.join(home, '.claude/commands/ai-engineering-loop.md')));
49
49
  assert.ok(!fs.existsSync(path.join(home, '.claude/skills/dot-dev-workflow/SKILL.md')));
50
+ assert.ok(fs.existsSync(path.join(home, '.claude/skills/task-impact-inquiry/SKILL.md')));
50
51
  assert.ok(!fs.existsSync(path.join(home, '.claude/settings.local.json')));
51
52
  });
52
53
 
54
+ test('sync upserts task-impact-inquiry onto Claude, Grok, and Gemini', () => {
55
+ const home = tmpHome();
56
+ fs.mkdirSync(path.join(home, '.claude'));
57
+ fs.mkdirSync(path.join(home, '.grok'));
58
+ fs.mkdirSync(path.join(home, '.gemini'));
59
+ applyHostSync({ packageRoot: ROOT, home });
60
+ const claude = fs.readFileSync(path.join(home, '.claude/skills/task-impact-inquiry/SKILL.md'), 'utf8');
61
+ const grok = fs.readFileSync(path.join(home, '.grok/skills/task-impact-inquiry/SKILL.md'), 'utf8');
62
+ const gemini = fs.readFileSync(path.join(home, '.gemini/config/skills/task-impact-inquiry/SKILL.md'), 'utf8');
63
+ assert.match(claude, /name: task-impact-inquiry/);
64
+ assert.doesNotMatch(claude, /```mermaid/);
65
+ assert.match(claude, /New-dev briefing/);
66
+ assert.match(grok, /^user-invocable: true$/m);
67
+ assert.match(grok, /Where it hits/);
68
+ assert.match(gemini, /Business blast radius|blast radius/);
69
+ });
70
+
53
71
  test('DOT skills update only when already installed', () => {
54
72
  const home = tmpHome();
55
73
  const dest = path.join(home, '.claude/skills/dot-dev-workflow/SKILL.md');
@@ -84,7 +102,7 @@ test('dry-run does not write; second apply is current', () => {
84
102
  assert.ok(!fs.existsSync(path.join(home, '.gemini/config/skills/ai-engineering-loop/SKILL.md')));
85
103
  applyHostSync({ packageRoot: ROOT, home });
86
104
  const again = applyHostSync({ packageRoot: ROOT, home });
87
- assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).current, 1);
105
+ assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).current, 3);
88
106
  assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).copy, 0);
89
107
  });
90
108
 
@@ -116,4 +134,18 @@ test('CLI sync-hosts --dry-run respects AEL_HOME', () => {
116
134
  test('CLI help lists sync-hosts', () => {
117
135
  const out = execFileSync('node', [CLI, '--help'], { encoding: 'utf8' });
118
136
  assert.match(out, /sync-hosts/);
137
+ assert.match(out, /generate-adapter/);
138
+ });
139
+
140
+ test('sync upserts generate-adapter onto Claude, Grok, and Gemini', () => {
141
+ const home = tmpHome();
142
+ fs.mkdirSync(path.join(home, '.claude'));
143
+ fs.mkdirSync(path.join(home, '.grok'));
144
+ fs.mkdirSync(path.join(home, '.gemini'));
145
+ applyHostSync({ packageRoot: ROOT, home });
146
+ const claude = fs.readFileSync(path.join(home, '.claude/skills/generate-adapter/SKILL.md'), 'utf8');
147
+ const grok = fs.readFileSync(path.join(home, '.grok/skills/generate-adapter/SKILL.md'), 'utf8');
148
+ assert.match(claude, /name: generate-adapter/);
149
+ assert.doesNotMatch(claude, /```mermaid/);
150
+ assert.match(grok, /^user-invocable: true$/m);
119
151
  });