ai-engineering-loop 1.0.15 → 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.
- 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 +3 -2
- package/.gemini/skills/ai-engineering-loop/SKILL.md +3 -2
- package/.grok/commands/ai-engineering-loop.md +1 -1
- package/.grok/skills/ai-engineering-loop/SKILL.md +3 -3
- package/README.md +15 -9
- package/adapters/README.md +27 -0
- package/adapters/generate-adapter/SKILL.md +123 -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 +31 -3
- package/core/repo-config-schema.md +1 -1
- package/lib/generate-adapter.js +118 -0
- package/lib/sync-hosts.js +4 -1
- package/package.json +1 -1
- package/templates/repo-config/adapter.md +1 -1
- package/tests/generate-adapter.test.js +80 -0
- package/tests/skill-host-compat.test.js +21 -0
- package/tests/sync-hosts.test.js +15 -1
|
@@ -15,4 +15,4 @@ If `invoke_subagent` (or Task) exists, spawn `devil-advocate` then `judge` as si
|
|
|
15
15
|
|
|
16
16
|
If no subagent tool exists, run the same budgets in this session as CONTEXT_ISOLATION_ONLY. Do not claim independent agent execution.
|
|
17
17
|
|
|
18
|
-
Init/status/refresh/sync-hosts: `npx ai-engineering-loop <command>`. Stage 0: `npx ai-engineering-loop sync-hosts` then `npx ai-engineering-loop status`. If sync-hosts copied files, tell the user a new session is needed for updated skill text; keep going with this session.
|
|
18
|
+
Init/status/refresh/sync-hosts/generate-adapter: `npx ai-engineering-loop <command>`. Stage 0: `npx ai-engineering-loop sync-hosts` then `npx ai-engineering-loop status`. If sync-hosts copied files, tell the user a new session is needed for updated skill text; keep going with this session. Stage 8: load `adapters/<adapter_type>/`. If adapter.md is missing, run `generate-adapter` (grill). Do not invent a company pipeline.
|
|
@@ -8,4 +8,4 @@ Follow `.claude/skills/ai-engineering-loop/SKILL.md`.
|
|
|
8
8
|
|
|
9
9
|
Use the Task tool for Devil's Advocate and Judge. Pass subagent_type, description, and prompt. If the schema includes run_in_background, set it false. Wait for each Task to finish. Write the git diff to a file and pass that path. DA: 8 tool calls. Judge: 4 tool calls, ledger and contract only. Do not let either roam the repo.
|
|
10
10
|
|
|
11
|
-
Arguments: init, status, refresh, sync-hosts, or a task description.
|
|
11
|
+
Arguments: init, status, refresh, sync-hosts, generate-adapter, or a task description.
|
|
@@ -24,7 +24,8 @@ Claude Code talks to strict proxies (including Kiro). Follow this exactly:
|
|
|
24
24
|
|
|
25
25
|
## Commands
|
|
26
26
|
|
|
27
|
-
- `init` / `status` / `refresh` / `sync-hosts`: run `npx ai-engineering-loop <command>` in the repo. Do not commit unless asked.
|
|
27
|
+
- `init` / `status` / `refresh` / `sync-hosts` / `generate-adapter`: run `npx ai-engineering-loop <command>` in the repo. Do not commit unless asked.
|
|
28
|
+
- `generate-adapter`: load skill `generate-adapter` if present. Grill Q1-Q5. Then write `.ai-engineering-loop/adapter.md`. Do not start Maker.
|
|
28
29
|
- Any other argument: full loop for that task.
|
|
29
30
|
|
|
30
31
|
## Loop
|
|
@@ -43,7 +44,7 @@ Parent session is Maker plus orchestrator. Spawn Devil's Advocate and Judge as *
|
|
|
43
44
|
6. Stage 6: Task `subagent_type: devil-advocate`. Use `general-purpose` only if that type is rejected. If the Task schema includes `run_in_background`, set it false. Then wait for Task to return. Do not start Judge or more Maker work until the Finding Ledger is back. Prompt: diff file path, name-only list, Goal Contract path, verification log path, conventions.md path, and "at most 8 tool calls; read the diff file; skip css and generated files". Report Spec and Standards axes separately.
|
|
44
45
|
7. Stage 7: Task `subagent_type: judge` the same way (wait, no background). Use `general-purpose` only if `judge` is rejected. Prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css; do not re-review the whole diff".
|
|
45
46
|
8. ITERATE with iteration under 3: fix in the parent, re-verify, spawn a **new** Devil's Advocate (do not resume the previous child).
|
|
46
|
-
9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`.
|
|
47
|
+
9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`. Load shipped spec `adapters/<adapter_type>/` (`standard`, `github`, `gitlab`, `dot`). If adapter.md is missing or the type is unknown, run `generate-adapter` (grill). Do not invent a company pipeline.
|
|
47
48
|
|
|
48
49
|
## Report header
|
|
49
50
|
|
|
@@ -19,7 +19,8 @@ Canonical mode ids: `TRUE_INDEPENDENT_AGENT`, `ISOLATED_AGENT_INSTANCE`, `FRESH_
|
|
|
19
19
|
|
|
20
20
|
## Commands
|
|
21
21
|
|
|
22
|
-
- `init` / `status` / `refresh` / `sync-hosts`: run `npx ai-engineering-loop <command>` in the repo. Do not commit unless asked.
|
|
22
|
+
- `init` / `status` / `refresh` / `sync-hosts` / `generate-adapter`: run `npx ai-engineering-loop <command>` in the repo. Do not commit unless asked.
|
|
23
|
+
- `generate-adapter`: load skill `generate-adapter` if present. Grill Q1-Q5. Then write `.ai-engineering-loop/adapter.md`. Do not start Maker.
|
|
23
24
|
- Any other argument: full loop for that task.
|
|
24
25
|
|
|
25
26
|
## Loop
|
|
@@ -36,7 +37,7 @@ Canonical mode ids: `TRUE_INDEPENDENT_AGENT`, `ISOLATED_AGENT_INSTANCE`, `FRESH_
|
|
|
36
37
|
6. Stage 6: spawn `devil-advocate`. Wait. Prompt: diff file path, name-only list, Goal Contract path, verification log path, conventions.md path, and "at most 8 tool calls; read the diff file; skip css and generated files". Report Spec and Standards axes separately.
|
|
37
38
|
7. Stage 7: spawn `judge` the same way (wait, no background). Prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css; do not re-review the whole diff".
|
|
38
39
|
8. ITERATE with iteration under 3: fix in the parent, re-verify, spawn a **new** Devil's Advocate.
|
|
39
|
-
9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`.
|
|
40
|
+
9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`. Load shipped spec `adapters/<adapter_type>/` (`standard`, `github`, `gitlab`, `dot`). If adapter.md is missing or the type is unknown, run `generate-adapter` (grill). Do not invent a company pipeline.
|
|
40
41
|
|
|
41
42
|
## Report header
|
|
42
43
|
|
|
@@ -7,5 +7,5 @@ Follow `.grok/skills/ai-engineering-loop/SKILL.md`.
|
|
|
7
7
|
|
|
8
8
|
Arguments:
|
|
9
9
|
|
|
10
|
-
- `init` / `status` / `refresh` / `sync-hosts` → run `npx ai-engineering-loop <arg>`
|
|
10
|
+
- `init` / `status` / `refresh` / `sync-hosts` / `generate-adapter` → run `npx ai-engineering-loop <arg>`
|
|
11
11
|
- anything else → full 8-stage loop for that task, spawning `devil-advocate` then `judge` via `spawn_subagent`
|
|
@@ -38,9 +38,9 @@ Optional fallback if `devil-advocate` / `judge` types are not registered: `subag
|
|
|
38
38
|
|
|
39
39
|
## Commands
|
|
40
40
|
|
|
41
|
-
### `/ai-engineering-loop init|status|refresh|sync-hosts`
|
|
41
|
+
### `/ai-engineering-loop init|status|refresh|sync-hosts|generate-adapter`
|
|
42
42
|
|
|
43
|
-
Run `npx ai-engineering-loop <command>` in the target repo. Do not commit unless the user asks. `sync-hosts` copies this package's skills/agents/commands into `~/.claude`, `~/.grok`, `~/.gemini`, and `~/.agents` for hosts that already exist.
|
|
43
|
+
Run `npx ai-engineering-loop <command>` in the target repo. Do not commit unless the user asks. `sync-hosts` copies this package's skills/agents/commands into `~/.claude`, `~/.grok`, `~/.gemini`, and `~/.agents` for hosts that already exist. `generate-adapter`: load skill `generate-adapter` if present. Grill Q1-Q5. Then write `.ai-engineering-loop/adapter.md`. Do not start Maker.
|
|
44
44
|
|
|
45
45
|
### `/ai-engineering-loop [task]`
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ Run `npx ai-engineering-loop <command>` in the target repo. Do not commit unless
|
|
|
56
56
|
6. Stage 6: `spawn_subagent` Devil's Advocate. `background: false`. `capability_mode: "execute"`. Do **not** pass `resume_from`. Wait for the child. Prompt: diff file path, name-only file list, Goal Contract path, verification log path, conventions.md path, plus "at most 8 tool calls; read the diff file; skip css and generated files". Report Spec and Standards axes separately.
|
|
57
57
|
7. Stage 7: `spawn_subagent` Judge the same way (`background: false`, wait). Use `general-purpose` only if `judge` is rejected. Prompt: Goal Contract path, verification evidence path, Finding Ledger, and "at most 4 tool calls; ledger and contract only; skip css; do not re-review the whole diff".
|
|
58
58
|
8. If Judge says `ITERATE` and iteration < 3, Maker fixes in the parent, re-verify, spawn a **fresh** DA (new spawn, no resume).
|
|
59
|
-
9. Stage 8: delivery
|
|
59
|
+
9. Stage 8: delivery from `.ai-engineering-loop/adapter.md`. Load shipped spec `adapters/<adapter_type>/` (`standard`, `github`, `gitlab`, `dot`). If adapter.md is missing or the type is unknown, run `generate-adapter` (grill). Do not invent a company pipeline.
|
|
60
60
|
|
|
61
61
|
After a proven Grok DA spawn, the report header must be:
|
|
62
62
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://github.com/egagofur/ai-engineering-loop/pulls)
|
|
8
8
|
[](https://github.com/egagofur/ai-engineering-loop)
|
|
9
|
-
[](https://github.com/egagofur/ai-engineering-loop/releases)
|
|
10
10
|
|
|
11
11
|
**A Reusable, Framework-Agnostic AI Engineering Operating System for Autonomous Coding Agents**
|
|
12
12
|
|
|
@@ -180,9 +180,15 @@ npx ai-engineering-loop run
|
|
|
180
180
|
|
|
181
181
|
# Copy package skills/agents/commands into ~/.claude ~/.grok ~/.gemini ~/.agents
|
|
182
182
|
npx ai-engineering-loop sync-hosts
|
|
183
|
+
|
|
184
|
+
# Grill (or --type) a Stage 8 delivery adapter for this repo
|
|
185
|
+
npx ai-engineering-loop generate-adapter
|
|
186
|
+
npx ai-engineering-loop generate-adapter --type github
|
|
183
187
|
```
|
|
184
188
|
|
|
185
|
-
|
|
189
|
+
Shipped adapters (Stage 8 only, after Judge PASS): `standard`, `github`, `gitlab`, `dot`. Catalog: `adapters/README.md`. Each team generates its own; do not copy a neighbour's pipeline.
|
|
190
|
+
|
|
191
|
+
`sync-hosts` updates only hosts that already exist on the machine. DOT skills (`dot-dev-skill-router`, `dot-dev-workflow`) are updated only if they are already installed. `task-impact-inquiry` and `generate-adapter` are upserted onto Claude, Grok, and Gemini. After a copy, start a new session so the host reloads skill text. `/ai-engineering-loop` Stage 0 and `run` call `sync-hosts` so a published package bump reaches global host files without a manual copy.
|
|
186
192
|
|
|
187
193
|
---
|
|
188
194
|
|
|
@@ -329,13 +335,13 @@ ai-engineering-loop/
|
|
|
329
335
|
│ ├── evidence-policy.md # 5-level evidence hierarchy & Verification Evidence Contract
|
|
330
336
|
│ └── no-progress-policy.md # Finding signature hashing & stagnation detection
|
|
331
337
|
│
|
|
332
|
-
├── adapters/ # Pluggable delivery
|
|
333
|
-
│
|
|
334
|
-
│
|
|
335
|
-
│
|
|
336
|
-
│
|
|
337
|
-
│
|
|
338
|
-
│
|
|
338
|
+
├── adapters/ # Pluggable Stage 8 delivery (not a second OS)
|
|
339
|
+
│ ├── README.md # Catalog: standard, github, gitlab, dot
|
|
340
|
+
│ ├── generate-adapter/SKILL.md # Grill Q1-Q5, then write adapter.md
|
|
341
|
+
│ ├── standard/ # Generic git delivery (any forge)
|
|
342
|
+
│ ├── github/ # gh pr / GitHub Issues
|
|
343
|
+
│ ├── gitlab/ # glab mr (not the DOT pipeline)
|
|
344
|
+
│ └── dot/ # DOT-specific GitLab + multi-branch + chat
|
|
339
345
|
│
|
|
340
346
|
└── templates/ # Starter templates for target repositories
|
|
341
347
|
└── repo-config/ # Ready-to-copy .ai-engineering-loop/ files
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Delivery adapters
|
|
2
|
+
|
|
3
|
+
Stages 0–7 are the same on every host. **Stage 8 is the only place that knows your forge.**
|
|
4
|
+
|
|
5
|
+
An adapter is not a second engineering OS. It runs **after Judge `PASS`**. It must not start Maker, amend the Goal Contract, or skip Devil's Advocate.
|
|
6
|
+
|
|
7
|
+
## Shipped types
|
|
8
|
+
|
|
9
|
+
| Type | Use when | Spec |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| **`standard`** | Default. Any git repo. No company tools assumed. | [`standard/`](standard/) |
|
|
12
|
+
| **`github`** | `github.com` remote, `gh` CLI | [`github/`](github/) |
|
|
13
|
+
| **`gitlab`** | GitLab.com or self-hosted GitLab (not DOT) | [`gitlab/`](gitlab/) |
|
|
14
|
+
| **`dot`** | DOT delivery (GitLab + multi-branch + Coreview + Mattermost) | [`dot/`](dot/) |
|
|
15
|
+
|
|
16
|
+
Pick one with `npx ai-engineering-loop generate-adapter`. The agent **asks** (grill). Do not copy a neighbour's adapter.
|
|
17
|
+
|
|
18
|
+
Custom tools (Linear, Slack, Bitbucket): still start from `standard`, then name those tools in `.ai-engineering-loop/adapter.md`. Do not put secrets in the file.
|
|
19
|
+
|
|
20
|
+
## Generate
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx ai-engineering-loop generate-adapter
|
|
24
|
+
npx ai-engineering-loop generate-adapter --type github
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Interactive path: load skill `generate-adapter`, answer Q1–Q5, then the agent writes `.ai-engineering-loop/adapter.md`.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-adapter
|
|
3
|
+
description: Grill then write a Stage 8 delivery adapter for this repo. Use when the user says generate-adapter, buat adapter, or each team needs its own forge. Not a substitute for ai-engineering-loop.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate Adapter
|
|
7
|
+
|
|
8
|
+
Write **this repo's** Stage 8 delivery adapter. Every team has different tools. Do not copy DOT, and do not invent Slack/Jira/bots the user did not name.
|
|
9
|
+
|
|
10
|
+
This skill is not the engineering OS. After the adapter file exists, commit-bound work still runs `ai-engineering-loop`. Stage 8 reads the file this skill writes.
|
|
11
|
+
|
|
12
|
+
## Hard gate
|
|
13
|
+
|
|
14
|
+
Do not edit production code. Do not create a feature branch for the product.
|
|
15
|
+
|
|
16
|
+
Do not write `.ai-engineering-loop/adapter.md` until:
|
|
17
|
+
|
|
18
|
+
1. Look-up is done (remote, CI, existing adapter).
|
|
19
|
+
2. Q1–Q5 are on screen with a recommended answer.
|
|
20
|
+
3. The user has answered or waived.
|
|
21
|
+
|
|
22
|
+
## When to use
|
|
23
|
+
|
|
24
|
+
- `generate-adapter`, `buat adapter`, `adapter sendiri`
|
|
25
|
+
- `.ai-engineering-loop/adapter.md` missing, `adapter_type` unknown, or Stage 8 would have to guess
|
|
26
|
+
- The user wants GitHub / GitLab / standard / custom delivery
|
|
27
|
+
|
|
28
|
+
If Stage 1 grill for a **product task** is already running, do not start this skill as a second interview. Finish that Goal Contract first.
|
|
29
|
+
|
|
30
|
+
## Host notes
|
|
31
|
+
|
|
32
|
+
Claude Code / Kiro: no mermaid, no LaTeX, no extra tool keys.
|
|
33
|
+
|
|
34
|
+
Grok: do not spawn children. Stay in the parent.
|
|
35
|
+
|
|
36
|
+
Look up facts. Grill only **decisions**.
|
|
37
|
+
|
|
38
|
+
## Steps
|
|
39
|
+
|
|
40
|
+
### 1. Look up
|
|
41
|
+
|
|
42
|
+
Read, in order. Skip if missing.
|
|
43
|
+
|
|
44
|
+
1. `git remote -v` and `.git/config`
|
|
45
|
+
2. `.github/workflows/`, `.gitlab-ci.yml`
|
|
46
|
+
3. `.ai-engineering-loop/adapter.md`
|
|
47
|
+
4. Shipped specs: `adapters/standard/`, `adapters/github/`, `adapters/gitlab/`, `adapters/dot/` (in the ai-engineering-loop package)
|
|
48
|
+
|
|
49
|
+
Or run `npx ai-engineering-loop generate-adapter` and use its detected block.
|
|
50
|
+
|
|
51
|
+
Cite the remote host. Do not ask what git already shows.
|
|
52
|
+
|
|
53
|
+
Recommended type:
|
|
54
|
+
|
|
55
|
+
- `github.com` → `github`
|
|
56
|
+
- GitLab host that is not a named company adapter → `gitlab`
|
|
57
|
+
- no remote / unknown → `standard`
|
|
58
|
+
- user said they need the DOT pipeline → `dot` (load `adapters/dot/`, do not invent extra tools)
|
|
59
|
+
|
|
60
|
+
### 2. Grill (wait)
|
|
61
|
+
|
|
62
|
+
Ask all five in one round. Number them. Give Recommended. Wait.
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Q1 - Forge: github | gitlab | standard (git only) | custom
|
|
66
|
+
Recommended: <from look-up>
|
|
67
|
+
|
|
68
|
+
Q2 - Open the change with: gh | glab | human copies the URL
|
|
69
|
+
Recommended: <binary that exists, else human>
|
|
70
|
+
|
|
71
|
+
Q3 - Extra environment branches after the default: none | list them
|
|
72
|
+
Recommended: none
|
|
73
|
+
|
|
74
|
+
Q4 - Notify after the PR/MR: none | name the tool you already use
|
|
75
|
+
Recommended: none
|
|
76
|
+
|
|
77
|
+
Q5 - Issue tracker: github | gitlab | none | name it
|
|
78
|
+
Recommended: same as forge, or none
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If the user picks **custom**, they must name the tools. Do not fill Linear/Slack/Bitbucket unless they said so.
|
|
82
|
+
|
|
83
|
+
### 3. Write
|
|
84
|
+
|
|
85
|
+
Write `.ai-engineering-loop/adapter.md` (create `.ai-engineering-loop/` if needed).
|
|
86
|
+
|
|
87
|
+
- `adapter_type`: `standard` | `github` | `gitlab` | `dot` | `custom`
|
|
88
|
+
- `spec`: shipped folder (`adapters/github/`) or `.ai-engineering-loop/adapter/delivery.md` for custom
|
|
89
|
+
- remote, default branch, ci_provider from look-up
|
|
90
|
+
- extra branches and notify only if the user named them
|
|
91
|
+
- no tokens, no webhooks with secrets, no coworker handles, no internal ticket URLs
|
|
92
|
+
|
|
93
|
+
If `custom`, also write `.ai-engineering-loop/adapter/delivery.md` from their answers, following the same hard gate as `adapters/standard/` (Judge PASS first, no silent installs).
|
|
94
|
+
|
|
95
|
+
Headless alternative the user can run:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx ai-engineering-loop generate-adapter --type github
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`--type` skips this interview. Do not pass `--type` yourself unless they waived the grill.
|
|
102
|
+
|
|
103
|
+
### 4. Stop
|
|
104
|
+
|
|
105
|
+
Print the path written and the type. Do not start Maker. Do not open a PR.
|
|
106
|
+
|
|
107
|
+
## Output
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
Generate adapter
|
|
111
|
+
Detected: <remote> <ci>
|
|
112
|
+
Questions: Q1..Q5 with Recommended
|
|
113
|
+
Wrote: .ai-engineering-loop/adapter.md (type=<type>)
|
|
114
|
+
Next: /ai-engineering-loop for product work. Stage 8 uses this file.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Forbidden
|
|
118
|
+
|
|
119
|
+
- Copying `adapters/dot/` onto a non-DOT repo
|
|
120
|
+
- Inventing company chat, review bots, or extra branches
|
|
121
|
+
- Mermaid or LaTeX
|
|
122
|
+
- Putting secrets or private ticket URLs in adapter.md
|
|
123
|
+
- Running the 8-stage product loop inside this skill
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# GitHub delivery adapter
|
|
2
|
+
|
|
3
|
+
Stage 8 after Judge `PASS` on GitHub-hosted repos.
|
|
4
|
+
|
|
5
|
+
This is not the engineering OS. Do not run Maker. Do not skip Devil's Advocate or Judge.
|
|
6
|
+
|
|
7
|
+
Requires `gh` authenticated to the current remote. If `gh` is missing, fall back to [`../standard/`](../standard/) and print the compare URL.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Re-run `.ai-engineering-loop/verification.md` if the log is stale.
|
|
12
|
+
2. Commit the surgical diff. Push the topic branch. Never push the default branch.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git push -u origin HEAD
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. Optional issue if none is linked (branch name, `Fixes #n`, or `gh issue list`):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
gh issue create --title "<summary>" --body "<Goal Contract path and AC list>"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
4. Open the pull request. Follow [`pull-request.md`](pull-request.md).
|
|
25
|
+
|
|
26
|
+
5. Extra branches, review bots, and chat are **off** unless `.ai-engineering-loop/adapter.md` names them. Do not invent Actions secrets or Slack webhooks.
|
|
27
|
+
|
|
28
|
+
6. Stop. The human merges on GitHub.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# GitHub pull request
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
gh pr create \
|
|
5
|
+
--title "<type>(<scope>): <summary>" \
|
|
6
|
+
--body "$(cat <<'EOF'
|
|
7
|
+
## Goal Contract
|
|
8
|
+
`.ai-engineering-loop/tasks/goal-contract.md` (or the path this repo uses)
|
|
9
|
+
|
|
10
|
+
## What changed
|
|
11
|
+
- <root cause or behaviour>
|
|
12
|
+
- <edge cases>
|
|
13
|
+
- <tests added>
|
|
14
|
+
|
|
15
|
+
## Verification
|
|
16
|
+
Commands from `.ai-engineering-loop/verification.md` (exit 0).
|
|
17
|
+
EOF
|
|
18
|
+
)"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Link an issue with `Fixes #n` in the body when an issue exists.
|
|
22
|
+
|
|
23
|
+
Do not paste raw diffs, tokens, or local machine paths.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# GitLab delivery adapter
|
|
2
|
+
|
|
3
|
+
Stage 8 after Judge `PASS` on GitLab.com or self-hosted GitLab.
|
|
4
|
+
|
|
5
|
+
This is the **generic** GitLab adapter. It is not the DOT adapter. Do not load `adapters/dot/`. No extra environment cherry-picks unless `.ai-engineering-loop/adapter.md` lists those branches.
|
|
6
|
+
|
|
7
|
+
Requires `glab` authenticated to the current remote. If `glab` is missing, fall back to [`../standard/`](../standard/) and print the branch name.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Re-run `.ai-engineering-loop/verification.md` if the log is stale.
|
|
12
|
+
2. Commit the surgical diff. Push the topic branch. Never push the default branch.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git push -u origin HEAD
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. Optional issue if none is linked:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
glab issue create --title "<summary>" --description "<Goal Contract path and AC list>" --yes
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
4. Open the merge request. Follow [`merge-request.md`](merge-request.md).
|
|
25
|
+
|
|
26
|
+
5. Extra environments and chat notifications stay off unless `adapter.md` lists them.
|
|
27
|
+
|
|
28
|
+
6. Stop. The human merges on GitLab.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# GitLab merge request
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
glab mr create \
|
|
5
|
+
--source-branch <branch-name> \
|
|
6
|
+
--target-branch <default-branch> \
|
|
7
|
+
--title "<type>(<scope>): <summary>" \
|
|
8
|
+
--description "$(cat <<'EOF'
|
|
9
|
+
## Goal Contract
|
|
10
|
+
`.ai-engineering-loop/tasks/goal-contract.md` (or the path this repo uses)
|
|
11
|
+
|
|
12
|
+
## What changed
|
|
13
|
+
- <root cause or behaviour>
|
|
14
|
+
- <edge cases>
|
|
15
|
+
- <tests added>
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
Commands from `.ai-engineering-loop/verification.md` (exit 0).
|
|
19
|
+
EOF
|
|
20
|
+
)" \
|
|
21
|
+
--yes
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Link the issue URL in the description when an issue exists.
|
|
25
|
+
|
|
26
|
+
Do not paste raw diffs, tokens, or local machine paths.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Standard delivery adapter
|
|
2
|
+
|
|
3
|
+
General Stage 8 for any git project. No GitHub, GitLab, Slack, or company bot is required.
|
|
4
|
+
|
|
5
|
+
Use this when the remote is unknown, the human merges by hand, or you have not generated a forge-specific adapter yet.
|
|
6
|
+
|
|
7
|
+
## Hard gate
|
|
8
|
+
|
|
9
|
+
Do not commit, push, or open a change request until Judge `PASS`.
|
|
10
|
+
|
|
11
|
+
If `.ai-engineering-loop/adapter.md` names a more specific type (`github`, `gitlab`, `dot`), follow that spec instead.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Read `.ai-engineering-loop/verification.md`. Re-run those commands if the last log is stale. Keep exit codes.
|
|
16
|
+
2. Commit only the surgical diff for this Goal Contract.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git status
|
|
20
|
+
git diff
|
|
21
|
+
git add <modified-files>
|
|
22
|
+
git commit -m "<type>(<scope>): <summary>"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Push the topic branch. Do not push to `main` / `master` / the default branch.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git push -u origin HEAD
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. Open a change request **with the tool that already exists**, or stop and give the human the compare URL:
|
|
32
|
+
- `gh pr create` if GitHub and `gh` works
|
|
33
|
+
- `glab mr create` if GitLab and `glab` works
|
|
34
|
+
- otherwise print `git remote -v` and the branch name; the human opens the PR/MR
|
|
35
|
+
5. Do not cherry-pick to extra environments unless `adapter.md` lists those branches.
|
|
36
|
+
6. Do not send chat notifications unless `adapter.md` names a channel and a tool. Never invent a webhook or token.
|
|
37
|
+
7. Stop. Merge is a human action unless the user already said to merge.
|
|
38
|
+
|
|
39
|
+
## Best practice
|
|
40
|
+
|
|
41
|
+
- One branch, one change request, default branch only.
|
|
42
|
+
- Link the Goal Contract path in the PR/MR body (not the whole chat).
|
|
43
|
+
- No secrets, no internal hostnames, no coworker handles in the description.
|
|
44
|
+
- If the forge CLI is missing, do not install it silently. Tell the user.
|
|
@@ -20,8 +20,14 @@ const {
|
|
|
20
20
|
planHostSync,
|
|
21
21
|
formatHostSyncReport
|
|
22
22
|
} = require('../lib/sync-hosts.js');
|
|
23
|
+
const {
|
|
24
|
+
detectAdapterHints,
|
|
25
|
+
writeShippedAdapter,
|
|
26
|
+
formatGenerateAdapterReport,
|
|
27
|
+
parseTypeArg
|
|
28
|
+
} = require('../lib/generate-adapter.js');
|
|
23
29
|
|
|
24
|
-
const VERSION = '1.0.
|
|
30
|
+
const VERSION = '1.0.16';
|
|
25
31
|
const CWD = process.cwd();
|
|
26
32
|
const CONTEXT_DIR = path.join(CWD, '.ai-engineering-loop');
|
|
27
33
|
|
|
@@ -275,7 +281,7 @@ function generateContextFiles(rootDir, discovery, trigger = 'init', impact = 'IN
|
|
|
275
281
|
|
|
276
282
|
// 0. metadata.json (Baseline)
|
|
277
283
|
const metadataJson = {
|
|
278
|
-
contextVersion: '1.0.
|
|
284
|
+
contextVersion: '1.0.16',
|
|
279
285
|
generatedAt: new Date().toISOString(),
|
|
280
286
|
repositoryRevision: currentRevision,
|
|
281
287
|
projectProfile: discovery.profile,
|
|
@@ -365,7 +371,7 @@ ${discovery.scripts.e2e ? `- **e2e**: \`${discovery.scripts.e2e}\`` : ''}
|
|
|
365
371
|
const adapterMd = `# Project Delivery Adapter Configuration
|
|
366
372
|
|
|
367
373
|
## Delivery Pipeline
|
|
368
|
-
- **adapter_type**: "${discovery.adapter.type}" #
|
|
374
|
+
- **adapter_type**: "${discovery.adapter.type}" # standard | github | gitlab | dot | custom
|
|
369
375
|
${discovery.adapter.repoSlug ? `- **remote_repository**: "${discovery.adapter.repoSlug}"` : ''}
|
|
370
376
|
- **default_target_branch**: "${discovery.adapter.defaultBranch}"
|
|
371
377
|
- **ci_provider**: "${discovery.adapter.ciProvider}"
|
|
@@ -654,6 +660,23 @@ function handleSyncHosts() {
|
|
|
654
660
|
console.log(formatHostSyncReport(results, { version: VERSION, dryRun }));
|
|
655
661
|
}
|
|
656
662
|
|
|
663
|
+
function handleGenerateAdapter() {
|
|
664
|
+
log.info('AI Engineering Loop — Generate delivery adapter (generate-adapter)');
|
|
665
|
+
const hints = detectAdapterHints(CWD);
|
|
666
|
+
const type = parseTypeArg(process.argv);
|
|
667
|
+
if (!type) {
|
|
668
|
+
console.log(formatGenerateAdapterReport(hints, { version: VERSION }));
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
try {
|
|
672
|
+
const wrote = writeShippedAdapter(CWD, { type, hints });
|
|
673
|
+
console.log(formatGenerateAdapterReport(hints, { version: VERSION, wrote }));
|
|
674
|
+
} catch (err) {
|
|
675
|
+
log.error(err.message);
|
|
676
|
+
process.exit(1);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
657
680
|
function detectGrokHost() {
|
|
658
681
|
try {
|
|
659
682
|
const { detectGrokRuntime } = require('../lib/orchestration.js');
|
|
@@ -746,6 +769,8 @@ Commands:
|
|
|
746
769
|
sync-hosts Copy package skills/agents/commands into ~/.claude ~/.grok ~/.gemini ~/.agents
|
|
747
770
|
(only hosts that already exist; DOT skills only if already installed)
|
|
748
771
|
--dry-run print the plan without writing
|
|
772
|
+
generate-adapter Print detected forge and grill protocol for Stage 8
|
|
773
|
+
--type standard|github|gitlab|dot write .ai-engineering-loop/adapter.md (skip grill)
|
|
749
774
|
|
|
750
775
|
Options:
|
|
751
776
|
-h, --help Show this help menu
|
|
@@ -776,6 +801,9 @@ switch (command) {
|
|
|
776
801
|
case 'sync-hosts':
|
|
777
802
|
handleSyncHosts();
|
|
778
803
|
break;
|
|
804
|
+
case 'generate-adapter':
|
|
805
|
+
handleGenerateAdapter();
|
|
806
|
+
break;
|
|
779
807
|
case '-v':
|
|
780
808
|
case '--version':
|
|
781
809
|
console.log(`ai-engineering-loop v${VERSION}`);
|
|
@@ -64,7 +64,7 @@ Maintains lightweight state for instant drift detection:
|
|
|
64
64
|
- `e2e`: (Optional) End-to-end / browser test command.
|
|
65
65
|
|
|
66
66
|
### 6. `adapter.md` — Delivery Pipeline Configuration
|
|
67
|
-
- `adapter_type`: Configured adapter (`
|
|
67
|
+
- `adapter_type`: Configured adapter (`standard`, `github`, `gitlab`, `dot`, `custom`). Shipped specs live in `adapters/<type>/`. Generate with `npx ai-engineering-loop generate-adapter` (grill) or `--type`.
|
|
68
68
|
- `remote_repository`: Git remote repository slug.
|
|
69
69
|
- `default_target_branch`: Base target branch.
|
|
70
70
|
- `ci_provider`: Detected CI engine (GitHub Actions, GitLab CI).
|
|
@@ -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
|
@@ -34,6 +34,7 @@ function hostFileMap(home) {
|
|
|
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
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' },
|
|
37
38
|
{ src: '.claude/agents/devil-advocate.md', dest: path.join(claude, 'agents/devil-advocate.md'), mode: 'upsert' },
|
|
38
39
|
{ src: '.claude/agents/judge.md', dest: path.join(claude, 'agents/judge.md'), mode: 'upsert' },
|
|
39
40
|
{ src: '.claude/commands/ai-engineering-loop.md', dest: path.join(claude, 'commands/ai-engineering-loop.md'), mode: 'upsert' }
|
|
@@ -45,6 +46,7 @@ function hostFileMap(home) {
|
|
|
45
46
|
files: [
|
|
46
47
|
{ src: '.grok/skills/ai-engineering-loop/SKILL.md', dest: path.join(grok, 'skills/ai-engineering-loop/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
|
|
47
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 },
|
|
48
50
|
{ src: '.grok/agents/devil-advocate.md', dest: path.join(grok, 'agents/devil-advocate.md'), mode: 'upsert' },
|
|
49
51
|
{ src: '.grok/agents/judge.md', dest: path.join(grok, 'agents/judge.md'), mode: 'upsert' },
|
|
50
52
|
{ src: '.grok/commands/ai-engineering-loop.md', dest: path.join(grok, 'commands/ai-engineering-loop.md'), mode: 'upsert' }
|
|
@@ -55,7 +57,8 @@ function hostFileMap(home) {
|
|
|
55
57
|
root: gemini,
|
|
56
58
|
files: [
|
|
57
59
|
{ src: '.gemini/skills/ai-engineering-loop/SKILL.md', dest: path.join(gemini, 'config/skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' },
|
|
58
|
-
{ src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(gemini, 'config/skills/task-impact-inquiry/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' }
|
|
59
62
|
]
|
|
60
63
|
},
|
|
61
64
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Project Delivery Adapter Configuration
|
|
2
2
|
|
|
3
3
|
## Delivery Settings
|
|
4
|
-
- **adapter_type**: "github" #
|
|
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
|
+
});
|
|
@@ -210,6 +210,27 @@ 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-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
|
+
|
|
213
234
|
test('Host skills Stage 0 runs sync-hosts before status', () => {
|
|
214
235
|
for (const rel of [
|
|
215
236
|
'.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, 3);
|
|
106
106
|
assert.strictEqual(summarizeHostSync(again.filter((item) => item.id === 'gemini')).copy, 0);
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -134,4 +134,18 @@ 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
|
+
});
|
|
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);
|
|
137
151
|
});
|