agjan 0.0.8 → 0.0.10
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/docs/guide.md +16 -6
- package/kit/domains/btp/domain.json +2 -1
- package/kit/skills/agjan-build/SKILL.md +2 -1
- package/kit/skills/agjan-design/SKILL.md +1 -1
- package/kit/skills/agjan-fix/SKILL.md +12 -7
- package/kit/skills/agjan-map/SKILL.md +12 -6
- package/kit/skills/agjan-spec/SKILL.md +11 -8
- package/kit/skills/agjan-verify/SKILL.md +3 -2
- package/kit/skills/fiori-developer/SKILL.md +11 -7
- package/kit/skills/fiori-developer/references/app-setup.md +2 -2
- package/kit/skills/fiori-developer/references/testing.md +2 -1
- package/kit/skills/fiori-developer/references/ui5-basics.md +2 -2
- package/kit/templates/agents-block.md +10 -1
- package/package.json +1 -1
- package/schemas/config.schema.json +15 -0
- package/schemas/log.schema.json +2 -1
- package/src/cli.mjs +11 -2
- package/src/commands/lint.mjs +74 -0
- package/src/commands/log.mjs +9 -2
- package/src/commands/pr-summary.mjs +3 -0
- package/src/commands/report.mjs +6 -1
- package/src/commands/review.mjs +29 -2
- package/src/commands/setup.mjs +34 -2
- package/src/commands/status.mjs +3 -2
- package/src/config.mjs +5 -1
- package/src/copilot-mcp.mjs +56 -0
- package/src/git.mjs +10 -2
- package/src/log.mjs +2 -0
- package/src/plan.mjs +1 -1
- package/src/progress-view.mjs +12 -1
- package/src/review-policy.mjs +17 -3
package/docs/guide.md
CHANGED
|
@@ -48,7 +48,13 @@ Then:
|
|
|
48
48
|
|
|
49
49
|
1. Open the project in Claude Code once and **trust the folder**: the reviewer's tools
|
|
50
50
|
load only in a trusted folder. Allow the project MCP servers when asked (`cap`, `ui5`,
|
|
51
|
-
`fiori`: documentation tools for the role skills).
|
|
51
|
+
`fiori`: documentation tools for the role skills). GitHub Copilot CLI loads a
|
|
52
|
+
project's `.mcp.json` only in folders it remembers as trusted, so with the Copilot
|
|
53
|
+
host `init` asks to add these servers to your Copilot user configuration
|
|
54
|
+
(`copilot mcp add`); they then load in every Copilot session (`/mcp` lists them under
|
|
55
|
+
the user servers). A server with the same name that is already there is left as it
|
|
56
|
+
is. `npx agjan doctor` reports one you removed; `npx agjan sync --copilot-mcp` adds it
|
|
57
|
+
again.
|
|
52
58
|
2. Later, when a team shares the repository on GitHub, consider
|
|
53
59
|
[protecting the main branch](#protecting-the-main-branch-on-github-optional)
|
|
54
60
|
(optional).
|
|
@@ -57,7 +63,8 @@ Then:
|
|
|
57
63
|
## The workflow
|
|
58
64
|
|
|
59
65
|
Each feature on a branch of its own. When one is needed, the agent asks you: create the
|
|
60
|
-
name it proposes, use a branch that already exists (it lists them), or
|
|
66
|
+
name it proposes, use a branch that already exists (it lists them), or provide a new
|
|
67
|
+
name (it confirms the name before creating the branch).
|
|
61
68
|
|
|
62
69
|
**Spec**: in Claude Code or Copilot:
|
|
63
70
|
|
|
@@ -117,8 +124,9 @@ records (step, review, approval, amendment, fix record):
|
|
|
117
124
|
|
|
118
125
|
`npx agjan progress` regenerates the pages and prints the overview; `--open` opens the
|
|
119
126
|
HTML page in your browser. A unit shows **your turn** when it waits for you: a gate to
|
|
120
|
-
approve, an amendment,
|
|
121
|
-
`/agjan-verify`; a skill counts as running once it logged its start)
|
|
127
|
+
approve, an amendment, the next skill to start (`/agjan-design`, `/agjan-build`,
|
|
128
|
+
`/agjan-verify`; a skill counts as running once it logged its start), or the agent
|
|
129
|
+
stopped and needs you (it logs the reason with `npx agjan log --waiting`). A verified feature
|
|
122
130
|
is **done**: trying it locally, manual checks and the pull request are optional next
|
|
123
131
|
steps. `npx agjan status --done` prints just that block. Units already on the base branch appear in the overview but
|
|
124
132
|
get no new page on another branch.
|
|
@@ -145,7 +153,7 @@ Run `npx agjan --help` for the full list.
|
|
|
145
153
|
| Command | Who | Purpose |
|
|
146
154
|
|---|---|---|
|
|
147
155
|
| `init`, `sync [--force]` | you | set up; regenerate managed files after an upgrade |
|
|
148
|
-
| `doctor` | anyone | check Node, git, versions, managed files, hook, CI, the MCP server, guards, trust |
|
|
156
|
+
| `doctor` | anyone | check Node, git, versions, managed files, hook, CI, the MCP server, guards, folder trust (Claude Code, Copilot CLI) |
|
|
149
157
|
| `status [--feature <id> \| --all]` | anyone | state, blockers, tasks, due reviews, next step |
|
|
150
158
|
| `progress [--open]` | anyone | regenerate the progress pages, print the overview, open the HTML page |
|
|
151
159
|
| `branch <name>` · `--list` · `--use <name>` | agent, after asking you | create the branch of a unit, list the existing branches, or switch to one |
|
|
@@ -190,11 +198,12 @@ lists replace. The schema is `node_modules/agjan/schemas/config.schema.json`.
|
|
|
190
198
|
| `hosts` | `claude-code`, `copilot`; decides which files `sync` generates |
|
|
191
199
|
| `git.base` | the branch features merge into; default: the remote's default branch |
|
|
192
200
|
| `verify.<area>` | `build`, `test`, `lint` commands for the skills; `results`: a JUnit XML, Jest or Mocha JSON file that `check` reads to require a passing test per AC |
|
|
201
|
+
| `lint.<area>` | the linter `npx agjan lint` runs in each folder `in` (for example `app/*`) on the changed files matching `files`; the btp domain sets the UI5 linter for `fiori`; `null` turns it off |
|
|
193
202
|
| `tests.<area>`, `scope.implicit.<area>` | test file globs; files every task of the area may change (i18n, lockfiles, fixtures) |
|
|
194
203
|
| `risk_paths` | paths whose change needs a review per task and are never a fix |
|
|
195
204
|
| `fix` | `max_total`, `max_per_file`, `protected`, `ignored`, `new_file_paths` |
|
|
196
205
|
| `review.build` | `area` (default: one build review per completed area) or `task` |
|
|
197
|
-
| `review.rounds` | correction rounds per review step (default 3);
|
|
206
|
+
| `review.rounds` | correction rounds per review step (default 3); if blockers remain, the agent asks you whether to run another round (one more per yes, recorded with `npx agjan review extend <step>`) or to stop |
|
|
198
207
|
| `review.tiers.<step>` | `balanced` or `deep` per step kind (`spec`, `design:light`, `design`, `build`, `verify`, `fix`, `map`); decides which reviewer agent runs it. Defaults: `deep` for `design` and `verify`, else `balanced`; `fast` uses the balanced agent |
|
|
199
208
|
| `build.fix_attempts` | attempts for failing deterministic checks before the agent stops (default 3) |
|
|
200
209
|
| `language` | language of the documents' text (default `en`); headings, ids and keywords stay English |
|
|
@@ -331,6 +340,7 @@ Commit the result in a pull request of its own: CI reports it as a policy change
|
|
|
331
340
|
|
|
332
341
|
| Symptom | Cause and fix |
|
|
333
342
|
|---|---|
|
|
343
|
+
| Copilot shows only `github-mcp-server`, not `cap`, `ui5`, `fiori` | They are not in Copilot's user configuration (`doctor`: copilot mcp), and Copilot ignores `.mcp.json` in folders it does not remember as trusted. Run `npx agjan sync --copilot-mcp`, then restart `copilot`. `/add-dir` does not help: it only allows file access. |
|
|
334
344
|
| The reviewer has no `review_context` tool | Claude Code: the folder is not trusted yet (`doctor` says so); open it once and accept. Copilot CLI: trust the folder when asked. |
|
|
335
345
|
| `approve` says it needs a human at an interactive terminal | It was run without a terminal, for example by an agent. Run it yourself in a terminal. |
|
|
336
346
|
| `approve` refuses: the review did not see the current files | Something changed after the last review; let the agent ask for the review again. |
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"role": "fiori-developer",
|
|
13
13
|
"tests": ["app/*/webapp/test/**", "app/*/test/**"],
|
|
14
14
|
"implicit": ["app/*/package.json", "app/*/package-lock.json", "app/*/webapp/i18n/**"],
|
|
15
|
-
"verify": {}
|
|
15
|
+
"verify": {},
|
|
16
|
+
"lint": { "command": "npx --yes @ui5/linter", "in": "app/*", "files": "webapp/**" }
|
|
16
17
|
},
|
|
17
18
|
"btp": {
|
|
18
19
|
"role": "btp-architect",
|
|
@@ -36,7 +36,8 @@ Repeat until `npx agjan status` says `next: all tasks done and reviewed`:
|
|
|
36
36
|
`Review step build:<area or task> of feature <slug>.` The work must be committed
|
|
37
37
|
first. Read the result with `npx agjan review show`; fix
|
|
38
38
|
blockers in a new commit with the same task subject prefix, then ask for the review
|
|
39
|
-
again, up to the round limit that `npx agjan status` shows (default 3)
|
|
39
|
+
again, up to the round limit that `npx agjan status` shows (default 3).
|
|
40
|
+
If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend <step>` and continue; on `Stop here`, stop and tell the user. (`<step>` is the step under review, for example `build:fiori`.)
|
|
40
41
|
|
|
41
42
|
## 3. When a file outside the paths is needed
|
|
42
43
|
|
|
@@ -72,7 +72,7 @@ Run `npx agjan check` and fix every error.
|
|
|
72
72
|
When all your edits are saved, delegate, on its own (not in parallel with other tool calls), to the reviewer agent that `npx agjan status` names for the step (default `agjan-reviewer-deep`), with exactly this prompt (Claude Code: the Agent tool with that subagent type; GitHub Copilot: the task tool with that custom agent and a short `name`, for example `spec review`):
|
|
73
73
|
`Review step design of feature <slug>.`
|
|
74
74
|
|
|
75
|
-
Read the result with `npx agjan review show`. With minor notes only, leave them open and go on to the gate (a change would need another round). Fix blockers (and majors where you agree) and re-review, up to the round limit that `npx agjan status` shows (default 3)
|
|
75
|
+
Read the result with `npx agjan review show`. With minor notes only, leave them open and go on to the gate (a change would need another round). Fix blockers (and majors where you agree) and re-review, up to the round limit that `npx agjan status` shows (default 3). If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend design` and continue; on `Stop here`, stop and tell the user. Never edit review files or review
|
|
76
76
|
yourself. Any change after a review needs a new review; make no edits after the last
|
|
77
77
|
passing one.
|
|
78
78
|
|
|
@@ -21,13 +21,18 @@ change, or a business decision: stop and recommend `/agjan-spec`.
|
|
|
21
21
|
## 2. Start
|
|
22
22
|
|
|
23
23
|
Work on a branch of its own, without features. If you are on the base branch,
|
|
24
|
-
ask the user one question with
|
|
24
|
+
ask the user one question with your host's question tool. Offer exactly these three
|
|
25
|
+
choices, with these labels; do not merge them into one free-text question:
|
|
26
|
+
|
|
25
27
|
"Work needs its own branch. Create one, or use an existing branch?"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
1. `Create branch "<name>"`: your proposal (following the team's naming rule if
|
|
30
|
+
AGENTS.md names one). Run `npx agjan branch <name>`.
|
|
31
|
+
2. `Use an existing branch`: run `npx agjan branch --list`, ask which one (offer the
|
|
32
|
+
names as choices), then run `npx agjan branch --use <picked>`.
|
|
33
|
+
3. `Provide new branch name`: ask for the name, then confirm it in a second question,
|
|
34
|
+
`Create branch "<their name>"?` with the choices `Yes, create it` and
|
|
35
|
+
`No, change the name`. Run `npx agjan branch <their name>` only after yes.
|
|
31
36
|
If `agjan branch` refuses a name (invalid, already exists), say why and ask again.
|
|
32
37
|
Never create or switch branches with git directly.
|
|
33
38
|
|
|
@@ -48,7 +53,7 @@ Pick a slug and a key of 2 to 6 capitals:
|
|
|
48
53
|
When all your edits are saved, delegate, on its own (not in parallel with other tool calls), to the reviewer agent that `npx agjan status` names for the step (default `agjan-reviewer`), with exactly this prompt (Claude Code: the Agent tool with that subagent type; GitHub Copilot: the task tool with that custom agent and a short `name`, for example `spec review`):
|
|
49
54
|
`Review step fix of feature fixes/<id>.` (the id is the folder name under
|
|
50
55
|
`docs/agjan/fixes/`). Read the result with `npx agjan review show`. Fix blockers in a
|
|
51
|
-
new commit and review again, up to the round limit that `npx agjan status` shows (default 3);
|
|
56
|
+
new commit and review again, up to the round limit that `npx agjan status` shows (default 3). If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend fix` and continue; on `Stop here`, stop and tell the user. Make no
|
|
52
57
|
change after the last passing review.
|
|
53
58
|
|
|
54
59
|
## 5. Record and hand over
|
|
@@ -11,13 +11,18 @@ The merge of this branch is its approval.
|
|
|
11
11
|
## 1. Start
|
|
12
12
|
|
|
13
13
|
On a branch of its own, without features or fixes. If you are on the base branch,
|
|
14
|
-
ask the user one question with
|
|
14
|
+
ask the user one question with your host's question tool. Offer exactly these three
|
|
15
|
+
choices, with these labels; do not merge them into one free-text question:
|
|
16
|
+
|
|
15
17
|
"Work needs its own branch. Create one, or use an existing branch?"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
1. `Create branch "<name>"`: your proposal (following the team's naming rule if
|
|
20
|
+
AGENTS.md names one). Run `npx agjan branch <name>`.
|
|
21
|
+
2. `Use an existing branch`: run `npx agjan branch --list`, ask which one (offer the
|
|
22
|
+
names as choices), then run `npx agjan branch --use <picked>`.
|
|
23
|
+
3. `Provide new branch name`: ask for the name, then confirm it in a second question,
|
|
24
|
+
`Create branch "<their name>"?` with the choices `Yes, create it` and
|
|
25
|
+
`No, change the name`. Run `npx agjan branch <their name>` only after yes.
|
|
21
26
|
If `agjan branch` refuses a name (invalid, already exists), say why and ask again.
|
|
22
27
|
Never create or switch branches with git directly.
|
|
23
28
|
|
|
@@ -53,6 +58,7 @@ user if unsure. These paths are protected for `/agjan-fix`.
|
|
|
53
58
|
2. When all your edits are saved, delegate, on its own (not in parallel with other tool calls), to the reviewer agent that `npx agjan status` names for the step (default `agjan-reviewer`), with exactly this prompt (Claude Code: the Agent tool with that subagent type; GitHub Copilot: the task tool with that custom agent and a short `name`, for example `spec review`):
|
|
54
59
|
`Review step map of feature maps/<id>.` Read the result with `npx agjan review show`;
|
|
55
60
|
fix blockers and review again, up to the round limit that `npx agjan status` shows (default 3).
|
|
61
|
+
If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend map` and continue; on `Stop here`, stop and tell the user.
|
|
56
62
|
3. Commit `docs/agjan/`. `npx agjan check --ci` must pass.
|
|
57
63
|
4. Tell the user it is ready for a PR; the merge approves the baseline.
|
|
58
64
|
|
|
@@ -15,13 +15,16 @@ Run `npx agjan status`. If a feature is already in progress on this branch, cont
|
|
|
15
15
|
it instead of starting a new one. Otherwise:
|
|
16
16
|
|
|
17
17
|
- If you are on the base branch, the work needs a branch of its own. Ask the user one
|
|
18
|
-
question with
|
|
18
|
+
question with your host's question tool. Offer exactly these three choices, with these
|
|
19
|
+
labels; do not merge them into one free-text question:
|
|
19
20
|
"Work needs its own branch. Create one, or use an existing branch?"
|
|
20
|
-
1. Create branch "<name>"
|
|
21
|
-
AGENTS.md names one)
|
|
22
|
-
2. Use an existing branch
|
|
23
|
-
|
|
24
|
-
3.
|
|
21
|
+
1. `Create branch "<name>"`: your proposal (following the team's naming rule if
|
|
22
|
+
AGENTS.md names one). Run `npx agjan branch <name>`.
|
|
23
|
+
2. `Use an existing branch`: run `npx agjan branch --list`, ask which one (offer the
|
|
24
|
+
names as choices), then run `npx agjan branch --use <picked>`.
|
|
25
|
+
3. `Provide new branch name`: ask for the name, then confirm it in a second question,
|
|
26
|
+
`Create branch "<their name>"?` with the choices `Yes, create it` and
|
|
27
|
+
`No, change the name`. Run `npx agjan branch <their name>` only after yes.
|
|
25
28
|
If `agjan branch` refuses a name (invalid, already exists), say why and ask again.
|
|
26
29
|
Never create or switch branches with git directly.
|
|
27
30
|
After switching, run `npx agjan status` again: an existing branch may already carry a
|
|
@@ -69,8 +72,8 @@ cannot be skipped (`npx agjan doctor` shows why).
|
|
|
69
72
|
Then run `npx agjan review show`:
|
|
70
73
|
|
|
71
74
|
- `blocked`: fix every blocker in `spec.md` (and majors where you agree), then ask for
|
|
72
|
-
the review again, up to the round limit that `npx agjan status` shows (default 3).
|
|
73
|
-
|
|
75
|
+
the review again, up to the round limit that `npx agjan status` shows (default 3).
|
|
76
|
+
If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend <step>` and continue; on `Stop here`, stop and tell the user. (`<step>` is `spec`, or `design:light` for a light design.) Never go on to the gate while blockers are open.
|
|
74
77
|
- `pass-with-notes`: fix majors where you agree and ask for another round. With minor
|
|
75
78
|
notes only, leave them open and go on to the gate: changing the spec for them would
|
|
76
79
|
need another round.
|
|
@@ -16,7 +16,7 @@ tell the user what is open. Then `npx agjan log --stage verify --skill agjan-ver
|
|
|
16
16
|
## 2. Full checks
|
|
17
17
|
|
|
18
18
|
Run every area's build, test and lint commands from `agjan.config.json` (else
|
|
19
|
-
`npm test`). Where an area configures `results`, its test command writes that file;
|
|
19
|
+
`npm test`), and `npx agjan lint` (the UI5 linter for Fiori apps). Where an area configures `results`, its test command writes that file;
|
|
20
20
|
`agjan check` then requires a passing test for every automated AC, so run the tests
|
|
21
21
|
again after the last change. Fix failures within the approved task paths and commit them with the
|
|
22
22
|
subject of the task they belong to (`<KEY>-<id>: …`). A fix makes that area's build
|
|
@@ -37,7 +37,8 @@ Everything must be committed. When all your edits are saved, delegate, on its ow
|
|
|
37
37
|
`Review step verify of feature <slug>.`
|
|
38
38
|
|
|
39
39
|
Read the result with `npx agjan review show`. If it is blocked, fix the blockers in new
|
|
40
|
-
commits and ask for the review again, up to the round limit that `npx agjan status` shows (default 3)
|
|
40
|
+
commits and ask for the review again, up to the round limit that `npx agjan status` shows (default 3).
|
|
41
|
+
If blockers remain at the limit, ask the user with your host's question tool, naming the open blockers, with the choices `Run another round` and `Stop here`. On `Run another round`, run `npx agjan review extend verify` and continue; on `Stop here`, stop and tell the user.
|
|
41
42
|
Any change after the final review makes it stale; review again after the last change.
|
|
42
43
|
|
|
43
44
|
## 5. Check and summary
|
|
@@ -20,11 +20,15 @@ baseline `docs/agjan/project.md`, the apps that exist) win over these defaults.
|
|
|
20
20
|
- Fiori MCP server: `search_docs` for Fiori elements, annotations and Fiori tools;
|
|
21
21
|
`list_functionality` and `get_functionality_details` to see how an existing app can
|
|
22
22
|
be changed.
|
|
23
|
-
3.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
not
|
|
23
|
+
3. Run `npx agjan lint` after every change to an app. It runs the UI5 linter (no MCP
|
|
24
|
+
server needed) in each app folder with changed files, on those files;
|
|
25
|
+
it also checks `manifest.json`. Fix what it reports in the files your task changed.
|
|
26
|
+
A finding that needs a wider change (migrating `manifest.json` to version 2, raising
|
|
27
|
+
`minUI5Version`) is not part of the task unless the task says so: report it. If the
|
|
28
|
+
linter cannot run (offline), say so in your output.
|
|
29
|
+
4. When the Fiori MCP server is available, also run `run_manifest_validation` after a
|
|
30
|
+
change to `manifest.json`. Without the documentation tools, follow the skill and the
|
|
31
|
+
patterns already in the app, and say which question could not be checked.
|
|
28
32
|
|
|
29
33
|
Generator and modification tools (`create_ui5_app`, `generate_fiori_app_*`,
|
|
30
34
|
`execute_functionality`) change files: use them only for a task whose approved `paths`
|
|
@@ -61,5 +65,5 @@ then building blocks or custom sections and columns, and controller extensions l
|
|
|
61
65
|
- Authorization lives in the service, never in the UI; the UI only hides what the service
|
|
62
66
|
already forbids.
|
|
63
67
|
- Texts in i18n files, in every locale the app has.
|
|
64
|
-
- After a change: `
|
|
65
|
-
the tests, then `npx agjan check`.
|
|
68
|
+
- After a change: `npx agjan lint`, `run_manifest_validation` (if `manifest.json` changed
|
|
69
|
+
and the Fiori MCP server is available), the tests, then `npx agjan check`.
|
|
@@ -121,7 +121,7 @@ sap.ui.define(['sap/fe/core/AppComponent'], (AppComponent) => AppComponent.exten
|
|
|
121
121
|
|
|
122
122
|
## Check
|
|
123
123
|
|
|
124
|
-
1. `
|
|
125
|
-
|
|
124
|
+
1. `npx agjan lint` (the UI5 linter on the app's changed files) and, with the Fiori MCP
|
|
125
|
+
server, `run_manifest_validation` on `webapp/manifest.json`: no findings.
|
|
126
126
|
2. `npx cds watch`, open the app as each role of the spec (a private window per user),
|
|
127
127
|
and try what the ACs describe, including buttons and messages.
|
|
@@ -29,4 +29,5 @@ MCP server and from the UI5 MCP server's guidelines (Apache-2.0), retrieved on
|
|
|
29
29
|
|
|
30
30
|
## After every UI change
|
|
31
31
|
|
|
32
|
-
- `
|
|
32
|
+
- `npx agjan lint` (the UI5 linter), `run_manifest_validation` if the Fiori MCP server is
|
|
33
|
+
available, then the tests.
|
|
@@ -47,7 +47,7 @@ Distilled from the UI5 MCP server's development guidelines (`get_guidelines`,
|
|
|
47
47
|
## Tools
|
|
48
48
|
|
|
49
49
|
- `get_api_reference` for any control or API, for the UI5 version of the project.
|
|
50
|
-
- `
|
|
51
|
-
|
|
50
|
+
- `npx agjan lint` after every change (deprecated APIs, accessibility, bugs, `manifest.json`).
|
|
51
|
+
Never run the linter's `--fix`; fix findings in your editor.
|
|
52
52
|
- `run_manifest_validation` after every change to `manifest.json`.
|
|
53
53
|
- The UI5 tooling server serves no default file: open `…/index.html`, not `…/`.
|
|
@@ -19,7 +19,7 @@ Rules for agents:
|
|
|
19
19
|
- During Build, change only files within the approved task paths; otherwise revert, or
|
|
20
20
|
propose `npx agjan amend`.
|
|
21
21
|
- Branches: ask the user first (create your proposed name, use an existing branch, or
|
|
22
|
-
|
|
22
|
+
provide a new name, confirmed before creating), then use `npx agjan branch <name>`, `--list` or `--use <name>`; never
|
|
23
23
|
git directly.
|
|
24
24
|
- Run commands from the project root; do not `cd` into folders. Edit files with your
|
|
25
25
|
editor tool, not with scripts. Check behavior with the project's tests (add one if
|
|
@@ -27,6 +27,15 @@ Rules for agents:
|
|
|
27
27
|
- After a review, fix blockers, and majors where you agree. Minor findings may stay open
|
|
28
28
|
(the PR summary lists them): do not spend a review round on minor findings alone. Any
|
|
29
29
|
change after a review needs another round before the gate.
|
|
30
|
+
- Never choose a commit subject, split or squash commits, or delay a commit to avoid a
|
|
31
|
+
review that would be due. When a step is still blocked at its round limit, ask the
|
|
32
|
+
user whether to run another round (`npx agjan review extend <step>` after a yes).
|
|
30
33
|
- Start a review only when all your edits are saved, and on its own: never in parallel
|
|
31
34
|
with other tool calls. The reviewer must see the finished change.
|
|
32
35
|
- Run `npx agjan check` before you report a step as done.
|
|
36
|
+
- When you stop in the middle of a skill to wait for the user (an error you cannot
|
|
37
|
+
resolve, a decision, an action only they can take, a limit reached), first run
|
|
38
|
+
`npx agjan log --waiting "<what the user must do, in one sentence>"`, so the progress
|
|
39
|
+
pages show it is their turn. When you continue, log the step again
|
|
40
|
+
(`npx agjan log --stage <stage> …`). Gates need no extra event: `--gate-requested`
|
|
41
|
+
covers them.
|
package/package.json
CHANGED
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
"additionalProperties": false
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"lint": {
|
|
47
|
+
"description": "Linters that agjan lint runs per area, in every folder matching 'in' with changed files matching 'files'; null turns an area's linter off.",
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": {
|
|
50
|
+
"oneOf": [
|
|
51
|
+
{ "type": "null" },
|
|
52
|
+
{
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": ["command", "in", "files"],
|
|
55
|
+
"properties": { "command": { "type": "string" }, "in": { "type": "string" }, "files": { "type": "string" } },
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
46
61
|
"build": { "type": "object", "properties": { "fix_attempts": { "type": "integer", "minimum": 0 } }, "additionalProperties": false },
|
|
47
62
|
"review": {
|
|
48
63
|
"type": "object",
|
package/schemas/log.schema.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"required": ["at_utc", "event"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"at_utc": { "type": "string" },
|
|
10
|
-
"event": { "enum": ["step", "gate-requested", "approved", "rejected", "accepted", "amendment-proposed", "review-recorded"] },
|
|
10
|
+
"event": { "enum": ["step", "gate-requested", "approved", "rejected", "accepted", "amendment-proposed", "review-recorded", "round-granted", "waiting"] },
|
|
11
11
|
"stage": { "enum": ["map", "spec", "design", "build", "verify", "fix"] },
|
|
12
12
|
"role": { "type": "string" },
|
|
13
13
|
"task": { "type": "string" },
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"host": { "type": "string" },
|
|
16
16
|
"configured_model": { "type": "string" },
|
|
17
17
|
"gate": { "type": "string" },
|
|
18
|
+
"reason": { "type": "string" },
|
|
18
19
|
"amendment": { "type": "string" },
|
|
19
20
|
"finding": { "type": "string" },
|
|
20
21
|
"severity": { "type": "string" },
|
package/src/cli.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import * as fix from './commands/fix.mjs';
|
|
|
14
14
|
import * as mapCommand from './commands/map.mjs';
|
|
15
15
|
import * as branch from './commands/branch.mjs';
|
|
16
16
|
import * as progress from './commands/progress.mjs';
|
|
17
|
+
import * as lint from './commands/lint.mjs';
|
|
17
18
|
import { onEvent } from './log.mjs';
|
|
18
19
|
import { refreshAfterEvent } from './progress-view.mjs';
|
|
19
20
|
|
|
@@ -28,11 +29,12 @@ const COMMANDS = {
|
|
|
28
29
|
scaffold: newCommand.scaffold,
|
|
29
30
|
status: status.run,
|
|
30
31
|
check: check.run,
|
|
32
|
+
lint: lint.run,
|
|
31
33
|
amend: gates.amend,
|
|
32
34
|
approve: gates.approve,
|
|
33
35
|
accept: gates.accept,
|
|
34
36
|
reject: gates.reject,
|
|
35
|
-
review: review.
|
|
37
|
+
review: review.run,
|
|
36
38
|
log: log.run,
|
|
37
39
|
'pr-summary': prSummary.run,
|
|
38
40
|
report: report.run,
|
|
@@ -52,8 +54,11 @@ Usage: agjan <command> [options]
|
|
|
52
54
|
Setup (human):
|
|
53
55
|
init [--domains btp] [--hosts claude-code,copilot] [--base <ref>]
|
|
54
56
|
[--no-hook] [--no-ci] [--prepare] [--agent-allow | --no-agent-allow]
|
|
57
|
+
[--copilot-mcp | --no-copilot-mcp]
|
|
55
58
|
set up agjan in this repository
|
|
56
|
-
sync [--force]
|
|
59
|
+
sync [--force] [--copilot-mcp]
|
|
60
|
+
regenerate managed files (skills, agents, blocks, settings);
|
|
61
|
+
--copilot-mcp adds missing MCP servers to Copilot
|
|
57
62
|
hook install install the pre-commit hook
|
|
58
63
|
doctor check the environment and the project setup
|
|
59
64
|
|
|
@@ -69,6 +74,8 @@ Agent and human:
|
|
|
69
74
|
show the state of the changed (or every) feature
|
|
70
75
|
check [--staged | --ci] [--base <ref>]
|
|
71
76
|
enforce the workflow rules
|
|
77
|
+
lint [--all] [--base <ref>] run the area linters (UI5 linter for fiori) on the changed
|
|
78
|
+
files of each app, without MCP
|
|
72
79
|
amend --task <id> --paths <p,...> --reason "<why>"
|
|
73
80
|
propose a scope amendment during Build
|
|
74
81
|
fix start <slug> --key <KEY> --what "<text>" | fix check | fix record [--verify "…"]
|
|
@@ -76,6 +83,8 @@ Agent and human:
|
|
|
76
83
|
map start start mapping an existing application (project.md)
|
|
77
84
|
baseline refresh record the watched files in baseline.json
|
|
78
85
|
review show [--step <step>] list review records, or print a step's review context
|
|
86
|
+
review extend <step> one more round for a step still blocked at its round
|
|
87
|
+
limit (after the user said yes)
|
|
79
88
|
log --stage <stage> [--role r] [--task T1] [--skill s]
|
|
80
89
|
log --gate-requested <gate> [--message "<commit message>"]
|
|
81
90
|
record a step start or a gate handed to the human
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import { changedFiles, git, resolveBase } from '../git.mjs';
|
|
6
|
+
import { matcher } from '../scope.mjs';
|
|
7
|
+
import { UsageError } from '../errors.mjs';
|
|
8
|
+
import { overrideBase } from './check.mjs';
|
|
9
|
+
|
|
10
|
+
/** Quotes a path for the shell (sh and cmd both accept double quotes). */
|
|
11
|
+
const quote = (path) => (/^[\w./@-]+$/.test(path) ? path : `"${path.replace(/"/g, '\\"')}"`);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The folders an area's linter runs in, with the files to lint in each (paths relative to
|
|
15
|
+
* the folder). `lint.in` names the folders (for example `app/*`), `lint.files` the files
|
|
16
|
+
* inside them (for example `webapp/**`).
|
|
17
|
+
*/
|
|
18
|
+
export function lintTargets(files, lint) {
|
|
19
|
+
const depth = lint.in.split('/').length;
|
|
20
|
+
const isTarget = matcher([`${lint.in}/${lint.files}`]);
|
|
21
|
+
const folders = new Map();
|
|
22
|
+
for (const file of files.filter((f) => isTarget(f))) {
|
|
23
|
+
const parts = file.split('/');
|
|
24
|
+
const folder = parts.slice(0, depth).join('/');
|
|
25
|
+
if (!folders.has(folder)) folders.set(folder, []);
|
|
26
|
+
folders.get(folder).push(parts.slice(depth).join('/'));
|
|
27
|
+
}
|
|
28
|
+
return folders;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* agjan lint [--all] [--base <ref>]: runs each area's linter from the command line
|
|
33
|
+
* (`lint` in the domain or agjan.config.json; the fiori area runs the UI5 linter, which
|
|
34
|
+
* also checks manifest.json), in every folder with changed files and on those files.
|
|
35
|
+
* --all lints the whole folders. It needs no MCP server, so it runs on every host.
|
|
36
|
+
* Exit code 1 when a linter reports problems or cannot run.
|
|
37
|
+
*/
|
|
38
|
+
export function run(ctx, argv) {
|
|
39
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { all: { type: 'boolean' }, base: { type: 'string' } } });
|
|
40
|
+
if (positionals.length) throw new UsageError('usage: agjan lint [--all] [--base <ref>]');
|
|
41
|
+
overrideBase(ctx, values.base);
|
|
42
|
+
const s = ctx.style;
|
|
43
|
+
const linters = Object.entries(ctx.config.lint ?? {}).filter(([, l]) => l?.command && l.in && l.files);
|
|
44
|
+
if (!linters.length) {
|
|
45
|
+
ctx.out(s.gray('no linter configured (lint in agjan.config.json)'));
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
const root = ctx.root;
|
|
49
|
+
const files = values.all
|
|
50
|
+
? (git(root, ['ls-files', '--cached', '--others', '--exclude-standard']) ?? '').split('\n').filter(Boolean)
|
|
51
|
+
: changedFiles(root, resolveBase(root, ctx.config.git?.base));
|
|
52
|
+
const present = files.filter((f) => existsSync(join(root, f)));
|
|
53
|
+
let failed = 0;
|
|
54
|
+
let ran = 0;
|
|
55
|
+
for (const [area, lint] of linters) {
|
|
56
|
+
for (const [folder, inside] of lintTargets(present, lint)) {
|
|
57
|
+
ran += 1;
|
|
58
|
+
const command = values.all ? lint.command : `${lint.command} ${inside.map(quote).join(' ')}`;
|
|
59
|
+
ctx.out(`${s.bold(`lint ${area}`)} ${folder}: ${s.gray(values.all ? lint.command : `${lint.command} (${inside.length} file(s))`)}`);
|
|
60
|
+
const result = spawnSync(command, { cwd: join(root, folder), shell: true, encoding: 'utf8', timeout: 600_000, maxBuffer: 64 * 1024 * 1024 });
|
|
61
|
+
const output = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim();
|
|
62
|
+
if (output) ctx.out(output);
|
|
63
|
+
if (result.status === 0) {
|
|
64
|
+
ctx.out(` ${s.green('ok')}`);
|
|
65
|
+
} else {
|
|
66
|
+
failed += 1;
|
|
67
|
+
const why = result.error ? `could not run: ${result.error.message}` : result.status === null ? 'could not run (stopped)' : `problems found (exit code ${result.status})`;
|
|
68
|
+
ctx.out(` ${s.red(why)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!ran) ctx.out(s.gray(values.all ? 'no files to lint' : 'no changed files to lint (--all lints everything)'));
|
|
73
|
+
return failed ? 1 : 0;
|
|
74
|
+
}
|
package/src/commands/log.mjs
CHANGED
|
@@ -10,8 +10,10 @@ const GATES = ['spec', 'design', 'spec design'];
|
|
|
10
10
|
/**
|
|
11
11
|
* agjan log --stage <stage> [--role r] [--task T1] [--skill s] [--host h] [--model m]
|
|
12
12
|
* agjan log --gate-requested <gate> [--message "<commit message>"]
|
|
13
|
+
* agjan log --waiting "<what the agent needs from the user>"
|
|
13
14
|
* Called once at the start of each step (design 12.1); the end of a step is inferred
|
|
14
15
|
* from the next event. `--message` proposes the commit message `approve` offers the human.
|
|
16
|
+
* `--waiting`: the agent stopped and waits for the user; its next step event ends the wait.
|
|
15
17
|
*/
|
|
16
18
|
export function run(ctx, argv) {
|
|
17
19
|
const { values } = parseArgs({
|
|
@@ -26,15 +28,20 @@ export function run(ctx, argv) {
|
|
|
26
28
|
model: { type: 'string' },
|
|
27
29
|
'gate-requested': { type: 'string' },
|
|
28
30
|
message: { type: 'string' },
|
|
31
|
+
waiting: { type: 'string' },
|
|
29
32
|
},
|
|
30
33
|
});
|
|
31
34
|
const gate = values['gate-requested'];
|
|
32
|
-
|
|
35
|
+
const usage = 'usage: agjan log --stage <stage> [--role r] [--task T1] [--skill s] | --gate-requested <gate> [--message "<text>"] | --waiting "<reason>"';
|
|
36
|
+
if ([gate, values.stage, values.waiting].filter((v) => v !== undefined).length !== 1) throw new UsageError(usage);
|
|
37
|
+
if (values.waiting !== undefined && !values.waiting.trim()) throw new UsageError('--waiting needs a reason: what the user has to do or decide');
|
|
33
38
|
if (gate && !GATES.includes(gate)) throw new UsageError(`--gate-requested must be one of: ${GATES.join(', ')}`);
|
|
34
39
|
if (values.stage && !STAGES.includes(values.stage)) throw new UsageError(`--stage must be one of: ${STAGES.join(', ')}`);
|
|
35
40
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
36
41
|
|
|
37
|
-
if (
|
|
42
|
+
if (values.waiting !== undefined) {
|
|
43
|
+
appendLog(feature.dir, ctx.now(), 'waiting', { reason: values.waiting.trim().replace(/\s+/g, ' ') });
|
|
44
|
+
} else if (gate) {
|
|
38
45
|
// A gate is handed to the human only when approving it can succeed.
|
|
39
46
|
const { problems } = gateReadiness(ctx, feature, gate);
|
|
40
47
|
if (problems.length) {
|
|
@@ -6,6 +6,7 @@ import { acResults, loadResults, resultLabel } from '../test-results.mjs';
|
|
|
6
6
|
import { overrideBase, runChecks } from './check.mjs';
|
|
7
7
|
import { readFix } from './fix.mjs';
|
|
8
8
|
import { highlightMarkdown } from '../ui.mjs';
|
|
9
|
+
import { readLog } from '../log.mjs';
|
|
9
10
|
|
|
10
11
|
function short(hash) {
|
|
11
12
|
return hash ? hash.slice('sha256:'.length, 'sha256:'.length + 12) : '-';
|
|
@@ -77,6 +78,8 @@ function featureSection(ctx, feature) {
|
|
|
77
78
|
out.push('');
|
|
78
79
|
const weak = feature.reviews.records.filter((r) => r.reviewer?.isolation !== 'agent');
|
|
79
80
|
if (weak.length) out.push(`Reviews without an isolated reviewer agent: ${weak.map((r) => r.id).join(', ')}.`, '');
|
|
81
|
+
const granted = readLog(feature.dir).filter((e) => e.event === 'round-granted');
|
|
82
|
+
if (granted.length) out.push(`Rounds beyond the limit, allowed by the user: ${granted.map((e) => `${e.step} round ${e.round}`).join(', ')}.`, '');
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
const open = feature.findings.filter((f) => f.status === 'open');
|
package/src/commands/report.mjs
CHANGED
|
@@ -38,7 +38,7 @@ export function spans(events, end) {
|
|
|
38
38
|
events.forEach((event, i) => {
|
|
39
39
|
const at = times[i];
|
|
40
40
|
if (event.event === 'step') {
|
|
41
|
-
const next = events.findIndex((e, j) => j > i &&
|
|
41
|
+
const next = events.findIndex((e, j) => j > i && ['step', 'gate-requested', 'waiting'].includes(e.event));
|
|
42
42
|
const label = [event.stage, event.task, event.role].filter(Boolean).join(' ');
|
|
43
43
|
out.push({ kind: 'step', label, from: at, to: next === -1 ? end : times[next] });
|
|
44
44
|
}
|
|
@@ -46,6 +46,11 @@ export function spans(events, end) {
|
|
|
46
46
|
const done = events.findIndex((e, j) => j > i && (e.event === 'approved' || e.event === 'rejected'));
|
|
47
47
|
out.push({ kind: 'gate', label: `gate ${event.gate}`, from: at, to: done === -1 ? end : times[done], open: done === -1 });
|
|
48
48
|
}
|
|
49
|
+
// The agent stopped for the user: waiting until its next step.
|
|
50
|
+
if (event.event === 'waiting') {
|
|
51
|
+
const next = events.findIndex((e, j) => j > i && e.event === 'step');
|
|
52
|
+
out.push({ kind: 'gate', label: 'waiting for you', from: at, to: next === -1 ? end : times[next], open: next === -1 });
|
|
53
|
+
}
|
|
49
54
|
});
|
|
50
55
|
return out;
|
|
51
56
|
}
|
package/src/commands/review.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import { parseArgs } from 'node:util';
|
|
|
2
2
|
import { serve } from '../mcp.mjs';
|
|
3
3
|
import { buildContextText, parseStep } from '../review.mjs';
|
|
4
4
|
import { loadFeature, selectFeature } from '../feature.mjs';
|
|
5
|
+
import { appendLog } from '../log.mjs';
|
|
6
|
+
import { roundState } from '../review-policy.mjs';
|
|
5
7
|
import { tone } from '../ui.mjs';
|
|
6
|
-
import { UsageError } from '../errors.mjs';
|
|
8
|
+
import { AgjanError, UsageError } from '../errors.mjs';
|
|
7
9
|
|
|
8
10
|
/** agjan mcp [--host <name>] [--isolation agent|fork|none]: the agjan MCP server on stdio. */
|
|
9
11
|
export function mcp(ctx, argv) {
|
|
@@ -17,6 +19,31 @@ export function mcp(ctx, argv) {
|
|
|
17
19
|
return serve(ctx, { host: values.host ?? 'unknown', isolation });
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
/** agjan review show | extend: dispatches to the subcommand. */
|
|
23
|
+
export function run(ctx, argv) {
|
|
24
|
+
return argv[0] === 'extend' ? extend(ctx, argv.slice(1)) : show(ctx, argv);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* agjan review extend <step> [--feature <slug>]: one more correction round for a step
|
|
29
|
+
* that is still blocked at its round limit (design 7.4). The agent runs it only after
|
|
30
|
+
* the user said yes to another round; status, the report and the PR summary show it.
|
|
31
|
+
*/
|
|
32
|
+
export function extend(ctx, argv) {
|
|
33
|
+
const { values, positionals } = parseArgs({ args: argv, options: { feature: { type: 'string' } }, allowPositionals: true });
|
|
34
|
+
if (positionals.length !== 1) throw new UsageError('usage: agjan review extend <step> [--feature <slug>]');
|
|
35
|
+
const step = positionals[0];
|
|
36
|
+
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
37
|
+
const state = roundState(feature, ctx.config, step);
|
|
38
|
+
if (!state.exhausted) {
|
|
39
|
+
const why = state.last ? `round ${state.round} of ${state.limit}, ${state.last.verdict}` : 'no review yet';
|
|
40
|
+
throw new AgjanError(`the ${step} review has not used up its rounds (${why}); another round needs no extension`);
|
|
41
|
+
}
|
|
42
|
+
appendLog(feature.dir, ctx.now(), 'round-granted', { step, round: state.limit + 1 });
|
|
43
|
+
ctx.out(`${ctx.style.green('granted')} round ${state.limit + 1} for ${ctx.style.bold(step)}: fix the blockers, then ask for the review again`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
/**
|
|
21
48
|
* agjan review show [--step <step>] [--feature <slug>]: read-only. Without --step it lists
|
|
22
49
|
* the review records; with --step it prints the context a reviewer would get.
|
|
@@ -28,7 +55,7 @@ export function show(ctx, argv) {
|
|
|
28
55
|
options: { step: { type: 'string' }, feature: { type: 'string' } },
|
|
29
56
|
allowPositionals: true,
|
|
30
57
|
});
|
|
31
|
-
if (positionals[0] !== 'show' || positionals.length !== 1) throw new UsageError('usage: agjan review show [--step <step>] [--feature <slug>]');
|
|
58
|
+
if (positionals[0] !== 'show' || positionals.length !== 1) throw new UsageError('usage: agjan review show [--step <step>] [--feature <slug>] | agjan review extend <step>');
|
|
32
59
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
33
60
|
if (values.step) {
|
|
34
61
|
ctx.out(buildContextText(ctx.root, ctx.config, feature, parseStep(values.step, feature, ctx.config)));
|
package/src/commands/setup.mjs
CHANGED
|
@@ -15,6 +15,8 @@ import { GUARD } from '../adapters/copilot.mjs';
|
|
|
15
15
|
import { git, mergeBase, resolveBase } from '../git.mjs';
|
|
16
16
|
import { AgjanError, UsageError } from '../errors.mjs';
|
|
17
17
|
import { blink, mark, pad, tone, verdictColor } from '../ui.mjs';
|
|
18
|
+
import { mcpServers } from '../mcp-config.mjs';
|
|
19
|
+
import { addCommand, addCopilotServers, copilotServers } from '../copilot-mcp.mjs';
|
|
18
20
|
|
|
19
21
|
const CI_FILE = '.github/workflows/agjan.yml';
|
|
20
22
|
const CI_TEMPLATE = new URL('../../kit/templates/agjan-ci.yml', import.meta.url);
|
|
@@ -131,6 +133,8 @@ export async function init(ctx, argv) {
|
|
|
131
133
|
'no-agent-allow': { type: 'boolean' },
|
|
132
134
|
'agent-allow-edits': { type: 'boolean' },
|
|
133
135
|
'no-agent-allow-edits': { type: 'boolean' },
|
|
136
|
+
'copilot-mcp': { type: 'boolean' },
|
|
137
|
+
'no-copilot-mcp': { type: 'boolean' },
|
|
134
138
|
},
|
|
135
139
|
});
|
|
136
140
|
const root = ctx.root;
|
|
@@ -154,6 +158,12 @@ export async function init(ctx, argv) {
|
|
|
154
158
|
ask(ctx, `Let agents run these commands without a prompt: ${RECOMMENDED_ALLOW.join(', ')}?\n(agjan approve, accept and reject stay blocked; change agent.allow in ${CONFIG_FILE} later.)`, { defaultYes: true }) ?? false;
|
|
155
159
|
const allowEdits = flag('agent-allow-edits', 'no-agent-allow-edits') ??
|
|
156
160
|
ask(ctx, 'Let agents change files in this project without a prompt?\n(agjan records and policy files excluded; agjan checks the scope of every change.)', { defaultYes: true }) ?? false;
|
|
161
|
+
// Copilot loads the project's .mcp.json only in folders it remembers as trusted; its
|
|
162
|
+
// user configuration loads everywhere (decision 72).
|
|
163
|
+
const areas = Object.fromEntries(domains.flatMap((d) => Object.keys(loadDomain(d).areas).flatMap((a) => [[a, {}], [`${d}:${a}`, {}]])));
|
|
164
|
+
const servers = Object.keys(mcpServers({ areas }).servers);
|
|
165
|
+
const copilotMcp = hosts.includes('copilot') && servers.length > 0 && (flag('copilot-mcp', 'no-copilot-mcp') ??
|
|
166
|
+
ask(ctx, `Add the documentation MCP servers ${servers.join(', ')} to your Copilot configuration (copilot mcp add)?\n(Copilot loads a project's .mcp.json only in folders it remembers as trusted; these then load in every Copilot session.)`, { defaultYes: true }) ?? false);
|
|
157
167
|
|
|
158
168
|
const config = {
|
|
159
169
|
$schema: './node_modules/agjan/schemas/config.schema.json',
|
|
@@ -172,6 +182,7 @@ export async function init(ctx, argv) {
|
|
|
172
182
|
const setting = (on, text) => ` ${pad(on ? tone(s, 'created') : s.gray('none'), on ? 'created' : 'none', 14)} ${text}`;
|
|
173
183
|
ctx.out(setting(agentAllow, `agent.allow${agentAllow ? ` (${RECOMMENDED_ALLOW.length} commands)` : ''}`));
|
|
174
184
|
ctx.out(setting(allowEdits, `agent.allow_edits${allowEdits ? ' (file changes without a prompt)' : ''}`));
|
|
185
|
+
if (copilotMcp) addToCopilot(ctx, loadConfig(root));
|
|
175
186
|
|
|
176
187
|
if (!values['no-hook']) {
|
|
177
188
|
const hook = installHook(root);
|
|
@@ -210,13 +221,28 @@ function addPrepare(root) {
|
|
|
210
221
|
return `added "prepare": "${command}"`;
|
|
211
222
|
}
|
|
212
223
|
|
|
213
|
-
/**
|
|
224
|
+
/**
|
|
225
|
+
* Adds the documentation MCP servers to Copilot's user configuration and reports each:
|
|
226
|
+
* added, already there (left as it is), or failed with the command to run by hand.
|
|
227
|
+
*/
|
|
228
|
+
function addToCopilot(ctx, config) {
|
|
229
|
+
const s = ctx.style;
|
|
230
|
+
const { servers } = mcpServers(config);
|
|
231
|
+
for (const r of addCopilotServers(servers)) {
|
|
232
|
+
const action = r.state === 'added' ? 'created' : r.state === 'exists' ? 'unchanged' : 'failed';
|
|
233
|
+
ctx.out(` ${pad(tone(s, action), action, 14)} copilot mcp ${r.name}: ${r.detail}`);
|
|
234
|
+
if (r.state === 'failed') ctx.out(` ${' '.repeat(14)} add it yourself: ${s.cyan(addCommand(r.name, servers[r.name]).join(' '))}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** agjan sync [--force] [--copilot-mcp]: regenerate managed files; edited ones are kept unless --force. */
|
|
214
239
|
export function sync(ctx, argv) {
|
|
215
|
-
const { values } = parseArgs({ args: argv, options: { force: { type: 'boolean' } } });
|
|
240
|
+
const { values } = parseArgs({ args: argv, options: { force: { type: 'boolean' }, 'copilot-mcp': { type: 'boolean' } } });
|
|
216
241
|
if (!existsSync(join(ctx.root, CONFIG_FILE))) throw new AgjanError(`no ${CONFIG_FILE}; run 'agjan init' first`);
|
|
217
242
|
ctx.out(`${ctx.style.bold('agjan sync')}:`);
|
|
218
243
|
const results = doSync(ctx, { force: values.force });
|
|
219
244
|
printResults(ctx, results);
|
|
245
|
+
if (values['copilot-mcp']) addToCopilot(ctx, ctx.config);
|
|
220
246
|
return results.some((r) => r.action.startsWith('kept')) ? 1 : 0;
|
|
221
247
|
}
|
|
222
248
|
|
|
@@ -323,6 +349,12 @@ export function doctor(ctx) {
|
|
|
323
349
|
const guard = probeGuard(root);
|
|
324
350
|
if (guard) warn('copilot guard', guard);
|
|
325
351
|
else ok('copilot guard', 'denies agjan approve in a test payload');
|
|
352
|
+
const names = Object.keys(mcpServers(config).servers);
|
|
353
|
+
const known = names.length ? copilotServers() : {};
|
|
354
|
+
const missing = names.filter((name) => !known?.[name]);
|
|
355
|
+
if (!known) warn('copilot mcp', 'copilot is not on PATH; its MCP servers were not checked');
|
|
356
|
+
else if (missing.length) warn('copilot mcp', `${missing.join(', ')} not in Copilot's configuration (removed?); add: npx agjan sync --copilot-mcp`);
|
|
357
|
+
else if (names.length) ok('copilot mcp', `${names.join(', ')} in Copilot's configuration`);
|
|
326
358
|
}
|
|
327
359
|
if (config.hosts.includes('claude-code')) {
|
|
328
360
|
const trust = claudeTrust(root);
|
package/src/commands/status.mjs
CHANGED
|
@@ -31,7 +31,7 @@ function heading(ctx, unit, detail) {
|
|
|
31
31
|
function reviewNext(ctx, feature, step) {
|
|
32
32
|
const state = roundState(feature, ctx.config, step);
|
|
33
33
|
if (state.exhausted) {
|
|
34
|
-
return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds:
|
|
34
|
+
return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds: ask the user whether to run another round (yes: npx agjan review extend ${step}) or to stop and take over (fix with them, accept findings, or change the documents)`;
|
|
35
35
|
}
|
|
36
36
|
const round = state.round ? `, round ${state.next} of ${state.limit}` : '';
|
|
37
37
|
return `review step ${step} with ${reviewerFor(ctx.config, step)}${round}`;
|
|
@@ -169,7 +169,8 @@ function describe(ctx, feature, onBase = false) {
|
|
|
169
169
|
for (const step of steps) {
|
|
170
170
|
const records = feature.reviews.records.filter((r) => r.step === step);
|
|
171
171
|
const last = records[records.length - 1];
|
|
172
|
-
|
|
172
|
+
const { limit, extra } = roundState(feature, ctx.config, step);
|
|
173
|
+
row(ctx, 'review', `${step}: ${tone(ctx.style, last.verdict)} (round ${last.round} of ${limit}${extra ? `, ${extra} granted by the user` : ''}, ${last.id})`);
|
|
173
174
|
}
|
|
174
175
|
const open = feature.findings.filter((f) => f.status === 'open');
|
|
175
176
|
if (open.length) {
|
package/src/config.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const DEFAULTS = {
|
|
|
31
31
|
domains: ['btp'],
|
|
32
32
|
hosts: ['claude-code'],
|
|
33
33
|
language: 'en',
|
|
34
|
-
git: { base: null
|
|
34
|
+
git: { base: null },
|
|
35
35
|
scope: { implicit: {} },
|
|
36
36
|
risk_paths: [],
|
|
37
37
|
tests: {},
|
|
@@ -42,6 +42,7 @@ const DEFAULTS = {
|
|
|
42
42
|
ignored: ['package-lock.json', '**/package-lock.json', 'gen/**', 'dist/**'],
|
|
43
43
|
},
|
|
44
44
|
verify: {},
|
|
45
|
+
lint: {},
|
|
45
46
|
build: { fix_attempts: 3 },
|
|
46
47
|
review: { build: 'area', rounds: 3 },
|
|
47
48
|
ci: { policy_changes: 'warn', untracked_changes: 'fail' },
|
|
@@ -84,6 +85,7 @@ export function loadConfig(root) {
|
|
|
84
85
|
const implicit = {};
|
|
85
86
|
const tests = {};
|
|
86
87
|
const verify = {};
|
|
88
|
+
const lint = {};
|
|
87
89
|
for (const [name, area] of Object.entries(domain.areas)) {
|
|
88
90
|
const canonical = `${id}:${name}`;
|
|
89
91
|
areas[canonical] = { id: canonical, domain: id, name, role: area.role };
|
|
@@ -91,11 +93,13 @@ export function loadConfig(root) {
|
|
|
91
93
|
implicit[name] = area.implicit ?? [];
|
|
92
94
|
tests[name] = area.tests ?? [];
|
|
93
95
|
verify[name] = area.verify ?? {};
|
|
96
|
+
if (area.lint) lint[name] = area.lint;
|
|
94
97
|
}
|
|
95
98
|
config = merge(config, {
|
|
96
99
|
scope: { implicit },
|
|
97
100
|
tests,
|
|
98
101
|
verify,
|
|
102
|
+
lint,
|
|
99
103
|
risk_paths: [...config.risk_paths, ...(domain.risk_paths ?? [])],
|
|
100
104
|
fix: { protected: [...config.fix.protected, ...(domain.protected ?? [])] },
|
|
101
105
|
watched: [...(config.watched ?? []), ...(domain.watched ?? [])],
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copilot CLI loads a project's .mcp.json only in folders it remembers as trusted, so
|
|
5
|
+
* `init` also adds the documentation servers to Copilot's user configuration with
|
|
6
|
+
* `copilot mcp add` (design decision 72). Servers there load in every folder. agjan
|
|
7
|
+
* never removes or changes a server in that configuration: one that exists is reported
|
|
8
|
+
* and left as it is.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Runs the copilot command; AGJAN_COPILOT names a Node script that replaces it (tests). */
|
|
12
|
+
function copilot(args) {
|
|
13
|
+
const options = { encoding: 'utf8', timeout: 60_000 };
|
|
14
|
+
const fake = process.env.AGJAN_COPILOT;
|
|
15
|
+
if (fake) return spawnSync(process.execPath, [fake, ...args], options);
|
|
16
|
+
return spawnSync('copilot', args, { ...options, shell: process.platform === 'win32' });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The command line that adds one server, for messages and for doing it by hand. */
|
|
20
|
+
export function addCommand(name, server) {
|
|
21
|
+
const env = Object.entries(server.env ?? {}).flatMap(([k, v]) => ['--env', `${k}=${v}`]);
|
|
22
|
+
return ['copilot', 'mcp', 'add', ...env, name, '--', server.command, ...(server.args ?? [])];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The servers Copilot knows (user, workspace, plugin; not its built-in ones), as
|
|
27
|
+
* { name: { source, command, args } }, or null when copilot cannot be run.
|
|
28
|
+
*/
|
|
29
|
+
export function copilotServers() {
|
|
30
|
+
const run = copilot(['mcp', 'list', '--json']);
|
|
31
|
+
if (run.error || run.status !== 0) return null;
|
|
32
|
+
try {
|
|
33
|
+
const list = JSON.parse(run.stdout).mcpServers ?? {};
|
|
34
|
+
return Object.fromEntries(Object.entries(list).filter(([, s]) => s.source !== 'builtin'));
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Adds each server that Copilot does not know yet. Returns one result per server:
|
|
42
|
+
* `added`, `exists` (left as it is), or `failed` with the reason.
|
|
43
|
+
*/
|
|
44
|
+
export function addCopilotServers(servers) {
|
|
45
|
+
const known = copilotServers();
|
|
46
|
+
if (!known) return Object.keys(servers).map((name) => ({ name, state: 'failed', detail: 'copilot is not on PATH' }));
|
|
47
|
+
return Object.entries(servers).map(([name, server]) => {
|
|
48
|
+
if (known[name]) return { name, state: 'exists', detail: `already in Copilot's ${known[name].source} configuration; left as it is` };
|
|
49
|
+
const run = copilot(addCommand(name, server).slice(1));
|
|
50
|
+
const output = `${run.stdout ?? ''}${run.stderr ?? ''}`.trim();
|
|
51
|
+
if (run.error || run.status !== 0 || /^Error:/m.test(output)) {
|
|
52
|
+
return { name, state: 'failed', detail: (output.split('\n').find((l) => l.startsWith('Error:')) ?? output.split('\n')[0] ?? `exit code ${run.status}`).trim() };
|
|
53
|
+
}
|
|
54
|
+
return { name, state: 'added', detail: "Copilot's user configuration" };
|
|
55
|
+
});
|
|
56
|
+
}
|
package/src/git.mjs
CHANGED
|
@@ -55,12 +55,20 @@ function lines(out) {
|
|
|
55
55
|
return out ? out.split('\n').filter(Boolean) : [];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Files the operating system writes on its own (macOS Finder, Windows Explorer). They are
|
|
60
|
+
* never part of a change: neither in scope checks nor in a review's working-tree hash,
|
|
61
|
+
* even when someone committed them.
|
|
62
|
+
*/
|
|
63
|
+
const OS_FILES = new Set(['.DS_Store', 'Thumbs.db', 'desktop.ini']);
|
|
64
|
+
const osFile = (path) => OS_FILES.has(path.slice(path.lastIndexOf('/') + 1));
|
|
65
|
+
|
|
58
66
|
/**
|
|
59
67
|
* Files changed relative to the merge-base: committed, staged, unstaged and untracked.
|
|
60
68
|
* With `staged`, only the files in the index. Paths are POSIX (git always uses '/').
|
|
61
69
|
*/
|
|
62
70
|
export function changedFiles(root, base, { staged = false } = {}) {
|
|
63
|
-
if (staged) return lines(git(root, ['diff', '--cached', '--name-only', '--no-renames']));
|
|
71
|
+
if (staged) return lines(git(root, ['diff', '--cached', '--name-only', '--no-renames'])).filter((f) => !osFile(f));
|
|
64
72
|
const from = mergeBase(root, base);
|
|
65
73
|
const files = new Set();
|
|
66
74
|
if (from) {
|
|
@@ -71,5 +79,5 @@ export function changedFiles(root, base, { staged = false } = {}) {
|
|
|
71
79
|
for (const f of lines(git(root, ['diff', '--cached', '--name-only', '--no-renames']))) files.add(f);
|
|
72
80
|
}
|
|
73
81
|
for (const f of lines(git(root, ['ls-files', '--others', '--exclude-standard']))) files.add(f);
|
|
74
|
-
return [...files].sort();
|
|
82
|
+
return [...files].filter((f) => !osFile(f)).sort();
|
|
75
83
|
}
|
package/src/log.mjs
CHANGED
|
@@ -7,11 +7,13 @@ export const LOG_FILE = 'log.jsonl';
|
|
|
7
7
|
export const EVENTS = [
|
|
8
8
|
'step', // a skill starts a step (from `agjan log`)
|
|
9
9
|
'gate-requested', // a skill hands a gate to the human (from `agjan log`)
|
|
10
|
+
'waiting', // the agent stopped and waits for the user (from `agjan log --waiting`)
|
|
10
11
|
'approved',
|
|
11
12
|
'rejected',
|
|
12
13
|
'accepted',
|
|
13
14
|
'amendment-proposed',
|
|
14
15
|
'review-recorded',
|
|
16
|
+
'round-granted', // the user allowed one more review round (from `agjan review extend`)
|
|
15
17
|
];
|
|
16
18
|
|
|
17
19
|
let listener = null;
|
package/src/plan.mjs
CHANGED
|
@@ -29,7 +29,7 @@ export function buildPlan(config) {
|
|
|
29
29
|
items.push(
|
|
30
30
|
{ kind: 'block', path: '.gitattributes', style: 'hash', content: 'docs/agjan/** text eol=lf\nagjan.lock.json text eol=lf' },
|
|
31
31
|
// node_modules too: a new project often has no .gitignore of its own (design decision 69).
|
|
32
|
-
{ kind: 'block', path: '.gitignore', style: 'hash', content: '.agjan/\nnode_modules
|
|
32
|
+
{ kind: 'block', path: '.gitignore', style: 'hash', content: '.agjan/\nnode_modules/\n.DS_Store\nThumbs.db' },
|
|
33
33
|
);
|
|
34
34
|
for (const host of hosts) {
|
|
35
35
|
const adapter = ADAPTERS[host];
|
package/src/progress-view.mjs
CHANGED
|
@@ -102,6 +102,16 @@ function stageOf(ctx, unit, onBase, extra) {
|
|
|
102
102
|
return { names, at: 3, turn: 'agent', now: verify.state === 'none' ? 'verify' : `verify (${verify.state})` };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* While the agent would be working, a `waiting` event after its last step means it stopped
|
|
107
|
+
* for the user (an error it cannot resolve, a decision): their turn, with the reason.
|
|
108
|
+
*/
|
|
109
|
+
function waitingFor(events, stage) {
|
|
110
|
+
if (stage.turn !== 'agent') return stage;
|
|
111
|
+
const last = events.filter((e) => ['step', 'waiting', 'gate-requested', 'approved', 'rejected'].includes(e.event)).at(-1);
|
|
112
|
+
return last?.event === 'waiting' ? { ...stage, turn: 'you', now: last.reason } : stage;
|
|
113
|
+
}
|
|
114
|
+
|
|
105
115
|
/** What the human may do after "done" (design decision 70): all of it optional. */
|
|
106
116
|
export function optionalSteps(root, unit, acs) {
|
|
107
117
|
const steps = [];
|
|
@@ -121,7 +131,7 @@ export function unitModel(ctx, slug, { onBase = false, now = Date.now() } = {})
|
|
|
121
131
|
const progress = isFeature && unit.tasks ? buildProgress(ctx.root, config, unit, { history: onBase }) : null;
|
|
122
132
|
const verify = isFeature ? verifyState(ctx.root, config, unit) : null;
|
|
123
133
|
const review = !isFeature ? freshReview(ctx.root, config, unit, unit.kind) : null;
|
|
124
|
-
const stage = stageOf(ctx, unit, onBase, { progress, verify, review });
|
|
134
|
+
const stage = waitingFor(events, stageOf(ctx, unit, onBase, { progress, verify, review }));
|
|
125
135
|
const commits = unitCommits(ctx.root, unit.key);
|
|
126
136
|
|
|
127
137
|
const times = [...events.map((e) => Date.parse(e.at_utc)), ...commits.map((c) => Date.parse(c.at))].filter(Number.isFinite);
|
|
@@ -315,6 +325,7 @@ export function timelineRows(model) {
|
|
|
315
325
|
if (e.event === 'step') rows.push([e.at, '🤖 writer', `${[e.stage, e.task, e.role].filter(Boolean).join(' ')} started`]);
|
|
316
326
|
if (e.event === 'gate-requested') rows.push([e.at, '🤖 writer', `asks you to approve ${e.gate}`]);
|
|
317
327
|
if (e.event === 'amendment-proposed') rows.push([e.at, '🤖 writer', `proposes amendment ${e.amendment ?? ''}`.trim()]);
|
|
328
|
+
if (e.event === 'round-granted') rows.push([e.at, '👤 human', `allows round ${e.round} for ${e.step}`]);
|
|
318
329
|
}
|
|
319
330
|
for (const r of model.reviews) {
|
|
320
331
|
const what = r.findings.length ? ` (${severities(r.findings, model.findings)})` : '';
|
package/src/review-policy.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { stillBlocked } from './feature.mjs';
|
|
9
|
+
import { readLog } from './log.mjs';
|
|
9
10
|
|
|
10
11
|
/** Default tier per kind of review step. */
|
|
11
12
|
export const DEFAULT_TIERS = {
|
|
@@ -66,12 +67,25 @@ export function nextRound(feature, step) {
|
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* The state of one review step: its latest round and verdict, and whether the round limit
|
|
69
|
-
* is reached with the step still blocked (design 7.4:
|
|
70
|
+
* (with the rounds the user granted) is reached with the step still blocked (design 7.4:
|
|
71
|
+
* ask the user for another round, or hand over).
|
|
70
72
|
*/
|
|
71
73
|
export function roundState(feature, config, step) {
|
|
72
74
|
const records = feature.reviews.records.filter((r) => r.step === step);
|
|
73
75
|
const last = records.at(-1) ?? null;
|
|
74
|
-
const
|
|
76
|
+
const extra = extraRounds(feature, step);
|
|
77
|
+
const limit = roundLimit(config) + extra;
|
|
75
78
|
const round = last?.round ?? 0;
|
|
76
|
-
return { last, round, next: nextRound(feature, step), limit, exhausted: stillBlocked(feature, last) && round >= limit };
|
|
79
|
+
return { last, round, next: nextRound(feature, step), limit, extra, exhausted: stillBlocked(feature, last) && round >= limit };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Rounds the user granted beyond the limit in the current correction loop of `step`
|
|
84
|
+
* (`agjan review extend`, design 7.4): each grant adds one round. A new loop starts at
|
|
85
|
+
* round 1 with the configured limit again.
|
|
86
|
+
*/
|
|
87
|
+
export function extraRounds(feature, step) {
|
|
88
|
+
const loopStart = feature.reviews.records.filter((r) => r.step === step && r.round === 1).at(-1)?.at_utc;
|
|
89
|
+
if (!loopStart) return 0;
|
|
90
|
+
return readLog(feature.dir).filter((e) => e.event === 'round-granted' && e.step === step && e.at_utc >= loopStart).length;
|
|
77
91
|
}
|