@alterset/alterspec-client 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/agent-instructions.md +32 -0
- package/assets/prompts/_shared.md +5 -6
- package/assets/prompts/task-context.md +2 -2
- package/assets/prompts/task-next.md +7 -5
- package/assets/prompts/task-release.md +1 -1
- package/assets/skills/alterspec-task-next/SKILL.md +1 -1
- package/developer-guide.md +15 -12
- package/dist/cli.js +22 -4
- package/dist/cli.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -80,14 +80,18 @@ npx @alterset/alterspec-client key
|
|
|
80
80
|
|
|
81
81
|
The dispatcher's tools appear in the next Claude Code session started in the repository.
|
|
82
82
|
|
|
83
|
+
`init` doesn't touch your `CLAUDE.md`. So that Claude knows where the export is and how to treat it outside the
|
|
84
|
+
skills too, copy the block in [`agent-instructions.md`](agent-instructions.md) (in this package) into your agent's
|
|
85
|
+
instructions, wherever you keep them.
|
|
86
|
+
|
|
83
87
|
## Working day
|
|
84
88
|
|
|
85
89
|
You talk to Claude Code; the skills call the dispatcher and the CLI for you.
|
|
86
90
|
|
|
87
91
|
1. **Take work.** `/alterspec-task-next`, or just "give me the next task". Name a track or ask for several at once:
|
|
88
|
-
`/alterspec-task-next BE 2`.
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
`/alterspec-task-next BE 2`. It only assigns: with one task it continues with the brief, with several it lists
|
|
93
|
+
them; type `/alterspec-task-context <task>` wherever you work on each. It creates no branch or worktree; where you
|
|
94
|
+
work is yours to choose (`worktree <task>` makes one when you want it).
|
|
91
95
|
2. **Build from the brief.** `/alterspec-task-context [task]` reads the task's brief from the export:
|
|
92
96
|
- the checklist, with the items the dispatcher already holds covered;
|
|
93
97
|
- why the change was made;
|
|
@@ -119,7 +123,7 @@ Other skills:
|
|
|
119
123
|
| ----------------------------------------- | ---------------------------------------------------------------------------- |
|
|
120
124
|
| `/alterspec-task-status [track]` | Your tasks with progress and ETA, what is available, what is blocked and by what, and the open changes per level. |
|
|
121
125
|
| `/alterspec-task-eta <task> <YYYY-MM-DD\|clear> <reason>` | Set your own date for a task, or `clear` it so the dispatcher's computed ETA applies again. |
|
|
122
|
-
| `/alterspec-task-release <task> [reason]` | Give a task back.
|
|
126
|
+
| `/alterspec-task-release <task> [reason]` | Give a task back. Your code and branches stay as they are. |
|
|
123
127
|
| `/alterspec-spec-ask <question>` | Answer a question about the product from the export, citing IDs. Read-only. |
|
|
124
128
|
|
|
125
129
|
You only ever type `task-done`, `task-eta` and `task-release` yourself, because each is your word. Claude starts
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Instructions for your coding agent
|
|
2
|
+
|
|
3
|
+
The client's skills tell Claude how to use the export while one of them runs. Outside a skill (ordinary coding in
|
|
4
|
+
the repository, a review, a session after its context was summarised) the agent knows only what your own instructions
|
|
5
|
+
say. Copy the block below into them: `CLAUDE.md`, a file under `.claude/`, `AGENTS.md` or wherever your team keeps
|
|
6
|
+
them. Replace `<export>` with the path of your export clone (`export` in `.alterspec-client.json`), and change the
|
|
7
|
+
wording to suit your team.
|
|
8
|
+
|
|
9
|
+
The export's own `README.md` explains how the export is laid out and how to read it; it is written by the same
|
|
10
|
+
alterspec version as the export, so it is always the right description of that export. This block only points there.
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
## Product spec
|
|
14
|
+
|
|
15
|
+
The product spec is in `<export>/`, an alterspec export: the signed-off spec, in business terms only. Before you
|
|
16
|
+
work from it, read its `README.md` (at least "How to read the spec" and "For coding agents").
|
|
17
|
+
|
|
18
|
+
- Treat it as the requirements. Build what it says, nothing it doesn't say. Technology, architecture, data storage
|
|
19
|
+
and APIs are ours to decide; the spec never decides them.
|
|
20
|
+
- Never edit, commit or switch branches in `<export>/`; the alterspec client pulls it.
|
|
21
|
+
- Look objects up by ID: the file names are the IDs (`modules/*/capabilities/CAP-….md`, `entities/ENT-….md`), and
|
|
22
|
+
`export.json` lists every object with its file. Read only the part you need: `_shards/` holds every document cut
|
|
23
|
+
by section and every collection by item.
|
|
24
|
+
- Reference spec IDs (CAP-…, RULE-…, CAP-…-AC-NN) in test names and comments where code implements them. Write one
|
|
25
|
+
test per acceptance criterion, named by its ID.
|
|
26
|
+
- Take rule messages, labels and states word for word from the spec and the screens' experience contracts.
|
|
27
|
+
- The mockups in `experience/*/mockups/` are the agreed look and behaviour; don't copy their code.
|
|
28
|
+
- If the spec is silent, ambiguous or contradicts itself or the code, stop and ask, naming the IDs involved. Never
|
|
29
|
+
fill a gap with an invented business rule.
|
|
30
|
+
- Work on a task goes through the alterspec skills (`/alterspec-task-context`); every commit of a task carries the
|
|
31
|
+
trailers they describe.
|
|
32
|
+
```
|
|
@@ -21,9 +21,7 @@ dispatcher's pages.
|
|
|
21
21
|
developer's clone of it. It says what the product does in business terms and names everything by ID; it never
|
|
22
22
|
says how to build it, which is this repository's business. Cite IDs when you refer to it. The clone is read-only:
|
|
23
23
|
never edit, commit or switch branches in it; `alterspec-client` pulls it.
|
|
24
|
-
- **The CLI does the deterministic work**: which commit to send, the task's brief and checklist, its
|
|
25
|
-
worktree, the items its commits cover, the commit that brought it in. Never work these out yourself, never pick a
|
|
26
|
-
branch name.
|
|
24
|
+
- **The CLI does the deterministic work**: which commit to send, the task's brief and checklist, the items its commits cover, the commit that brought it in. Never work these out yourself.
|
|
27
25
|
- **Progress and ETA are the dispatcher's arithmetic.** Never compute a percentage or a date yourself, and never
|
|
28
26
|
guess one: say what the dispatcher answered. The developer's own date is theirs to set, with
|
|
29
27
|
`/alterspec-task-eta`.
|
|
@@ -36,7 +34,7 @@ dispatcher's pages.
|
|
|
36
34
|
that follow (the public key and its fingerprint) exactly, for the developer to send to an admin. Stop.
|
|
37
35
|
- There is no `whoami` tool: the `dispatcher` MCP server isn't loaded. Tell the developer to run
|
|
38
36
|
`npx @alterset/alterspec-client init` here (it writes the server to `.mcp.json` and approves it in the
|
|
39
|
-
git-ignored `.claude/settings.local.json`; in a
|
|
37
|
+
git-ignored `.claude/settings.local.json`; in a worktree `alterspec-client worktree` made, it did that), or to approve
|
|
40
38
|
it with `/mcp` in an interactive `claude` terminal, and then to start a new session. Stop.
|
|
41
39
|
2. Run `alterspec-client export-head --latest <latest_export.commit>` (without `--latest` while it is null). Its JSON
|
|
42
40
|
has `send`, the commit to give the dispatcher as `export`, and `behind`:
|
|
@@ -55,8 +53,9 @@ dispatcher's pages.
|
|
|
55
53
|
|
|
56
54
|
## Commits of a task
|
|
57
55
|
|
|
58
|
-
Work
|
|
59
|
-
|
|
56
|
+
Work where the developer works: the client makes no branch or worktree for a task, and you make none unless the
|
|
57
|
+
developer asks (then `alterspec-client worktree <task>` makes the branch `task/<chg>-<track>` in a worktree of its own,
|
|
58
|
+
`--here` in this checkout). Every commit of the task ends with a trailer block, after a blank line:
|
|
60
59
|
|
|
61
60
|
```
|
|
62
61
|
Alterspec-Task: CHG-012/BE
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Read `.alterspec-client/prompts/_shared.md` first and follow it.
|
|
4
4
|
|
|
5
5
|
Arguments: `[CHG-NNN/TRACK]`. Without one, take the developer's task in progress from `whoami`'s `in_progress`; when
|
|
6
|
-
there are several, the one whose branch this checkout is on (`git branch --show-current` prints `task/<chg>-<track>`)
|
|
7
|
-
when that doesn't settle it, ask which.
|
|
6
|
+
there are several, the one whose branch this checkout is on (`git branch --show-current` prints `task/<chg>-<track>`)
|
|
7
|
+
or whose `Alterspec-Task` trailer the last commit carries; when that doesn't settle it, ask which.
|
|
8
8
|
|
|
9
9
|
1. Start as `_shared.md` says (`whoami`, `export-head`).
|
|
10
10
|
2. Run `alterspec-client context <task>` and read the brief. It opens with the task's checklist: its items, what
|
|
@@ -11,11 +11,13 @@ the developer wants in progress at once (default 1).
|
|
|
11
11
|
3. Call `next_task` with `export` = `send` from `export-head`, `tracks` and `parallel`.
|
|
12
12
|
4. Say each `reasons` entry in one line (none available, blocked by what, at the limit, more after pulling).
|
|
13
13
|
5. The tasks it assigned:
|
|
14
|
-
- **One**:
|
|
15
|
-
|
|
16
|
-
- **Several**:
|
|
17
|
-
|
|
18
|
-
Work on none of them in this session.
|
|
14
|
+
- **One**: continue with `.alterspec-client/prompts/task-context.md` for that task, here, on whatever branch the
|
|
15
|
+
developer is on.
|
|
16
|
+
- **Several**: list each task with its title, and say: type `/alterspec-task-context <task>` where you want to work
|
|
17
|
+
on it. Work on none of them in this session.
|
|
19
18
|
- **None**: say so, with the reasons. Stop.
|
|
20
19
|
|
|
20
|
+
Taking a task assigns it, nothing more: never create a branch or a worktree, switch branches or stash anything. Where
|
|
21
|
+
and how the developer works on it is theirs to decide.
|
|
22
|
+
|
|
21
23
|
Never ask for more tasks than the developer asked for.
|
|
@@ -9,4 +9,4 @@ Without a task, ask for it; never guess it.
|
|
|
9
9
|
2. The reason is the developer's words after the task. Without one, ask once why (one line, for whoever takes it
|
|
10
10
|
next); an empty answer is fine.
|
|
11
11
|
3. Call `release` with the task and the reason. Say the result in one line: the task is available again.
|
|
12
|
-
4.
|
|
12
|
+
4. The developer's code, branches and commits stay as they are; touch none of them.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alterspec-task-next
|
|
3
|
-
description: "Use when the developer wants work from the dispatcher: \"give me work\", \"next task\", \"take two BE tasks\". Takes the next task(s) on their tracks and
|
|
3
|
+
description: "Use when the developer wants work from the dispatcher: \"give me work\", \"next task\", \"take two BE tasks\". Takes the next task(s) on their tracks and shows the brief of one; creates no branch or worktree."
|
|
4
4
|
argument-hint: "[track] [parallel]"
|
|
5
5
|
allowed-tools: Read Glob Grep Bash(npx @alterset/alterspec-client *) Bash(git *) mcp__dispatcher__*
|
|
6
6
|
---
|
package/developer-guide.md
CHANGED
|
@@ -98,8 +98,6 @@ git clone <code-repo>
|
|
|
98
98
|
|
|
99
99
|
The export is **read-only**: never edit, commit or switch branches in it. The client pulls it for you.
|
|
100
100
|
|
|
101
|
-
Task worktrees (step 6, "Several tasks at once") are created next to your code repository, in `<code-repo>-tasks/`.
|
|
102
|
-
|
|
103
101
|
## Step 4: Set the client up in your code repository
|
|
104
102
|
|
|
105
103
|
In the root of your code repository:
|
|
@@ -163,19 +161,20 @@ server. Then talk to it in plain words; the skills do the rest.
|
|
|
163
161
|
|
|
164
162
|
| You say or type | What happens |
|
|
165
163
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
166
|
-
| "give me work" / `/alterspec-task-next` | takes the next available task on your track
|
|
164
|
+
| "give me work" / `/alterspec-task-next` | takes the next available task on your track and shows the brief; it creates no branch or worktree, you work wherever you like |
|
|
167
165
|
| "let's work on my task" / `/alterspec-task-context` | the task's brief from the spec: why, the checklist, the objects it changes (before and after), rules, acceptance criteria; for a UI track also the screens, their contracts, mockups and design system |
|
|
168
166
|
| "what am I on?" / `/alterspec-task-status` | your tasks with progress and ETA, what's available on your tracks, what is blocked and by what |
|
|
169
167
|
| "what does RULE-… say?" / `/alterspec-spec-ask` | answers about the product from the spec, citing IDs; reads only |
|
|
170
168
|
| `/alterspec-task-done CHG-023/BE` | after your branch is merged: reports the task done with the commit that brought it in; refused while the work isn't merged |
|
|
171
|
-
| `/alterspec-task-release CHG-023/BE <reason>` | gives the task back so someone else can take it;
|
|
169
|
+
| `/alterspec-task-release CHG-023/BE <reason>` | gives the task back so someone else can take it; your code and branches stay as they are |
|
|
172
170
|
| `/alterspec-task-eta CHG-023/BE <YYYY-MM-DD> <reason>` | sets your own date when the computed ETA is wrong; `clear` instead of the date removes it |
|
|
173
171
|
|
|
174
172
|
**done**, **release** and **eta** happen only when you type them; Claude never does them on its own.
|
|
175
173
|
|
|
176
174
|
### A task, start to finish
|
|
177
175
|
|
|
178
|
-
1. "Give me work." Claude takes a task
|
|
176
|
+
1. "Give me work." Claude takes a task and shows the brief and its checklist. Work on it in the branch (or worktree) you
|
|
177
|
+
choose.
|
|
179
178
|
2. Build it with Claude in your own technology. The spec says what, never how; a mockup shows the agreed look and
|
|
180
179
|
behaviour, it is not code to copy. When the spec is silent or disagrees with the code, Claude asks you.
|
|
181
180
|
3. Claude ends every commit of the task with a trailer:
|
|
@@ -188,20 +187,21 @@ server. Then talk to it in plain words; the skills do the rest.
|
|
|
188
187
|
`Alterspec-Covers` names the checklist items whose tests pass with that commit, never items that aren't tested yet.
|
|
189
188
|
After each commit a hook reports them in the background, and the task's progress on the dashboard moves.
|
|
190
189
|
|
|
191
|
-
4. Push
|
|
190
|
+
4. Push your branch, open a pull request into the main branch as usual, get it reviewed and merged.
|
|
192
191
|
5. Type `/alterspec-task-done CHG-023/BE`.
|
|
193
192
|
|
|
194
193
|
### Several tasks at once
|
|
195
194
|
|
|
196
|
-
Ask for more than one: `/alterspec-task-next BE 2`.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
195
|
+
Ask for more than one: `/alterspec-task-next BE 2`. Claude lists them and works on none; type
|
|
196
|
+
`/alterspec-task-context <task>` wherever you work on each, e.g. a session per worktree. If you want the client to
|
|
197
|
+
make a worktree for a task, run `npx @alterset/alterspec-client worktree CHG-023/BE`: it creates the branch
|
|
198
|
+
`task/chg-023-be` from `origin/<branch>` in `../<code-repo>-tasks/` (the `--worktrees` folder of `init`). The
|
|
199
|
+
dispatcher never gives you two tasks on the same track that change the same objects, so they don't conflict.
|
|
200
200
|
|
|
201
201
|
### Good to know
|
|
202
202
|
|
|
203
|
-
- **
|
|
204
|
-
|
|
203
|
+
- **The trailer names the task.** Progress is read from the `Alterspec-Task` trailer of your commits, on any branch;
|
|
204
|
+
the hook takes the task from the last commit's trailer (or from a `task/<chg>-<track>` branch).
|
|
205
205
|
- **A UI task waits for its `BE` task.** "Nothing available" on a UI track usually means the backend part isn't done
|
|
206
206
|
yet; `/alterspec-task-status` says what blocks what.
|
|
207
207
|
- **The scope is the spec's.** If the brief and the code disagree, or something in the spec looks wrong, ask whoever
|
|
@@ -209,6 +209,9 @@ objects, so the worktrees don't conflict.
|
|
|
209
209
|
- **Only you move your task on.** Going away for a while? Release it. An admin can force a release only when you are
|
|
210
210
|
gone, and that is logged.
|
|
211
211
|
- **Keep the client current.** Run `init` again now and then (or when your admin says so); it updates the skills.
|
|
212
|
+
- **Tell Claude about the spec outside the skills too.** The skills explain the export only while they run. Copy the
|
|
213
|
+
block in [`agent-instructions.md`](agent-instructions.md) (in this package) into your `CLAUDE.md` or wherever you
|
|
214
|
+
keep your agent's instructions, with your export clone's path.
|
|
212
215
|
|
|
213
216
|
## When something goes wrong
|
|
214
217
|
|
package/dist/cli.js
CHANGED
|
@@ -1556,10 +1556,25 @@ import { join as join7 } from "path";
|
|
|
1556
1556
|
var git3 = (cwd, args) => execFileSync4("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
1557
1557
|
function currentTask(repo) {
|
|
1558
1558
|
try {
|
|
1559
|
-
|
|
1559
|
+
const task = taskOfBranch(git3(repo, ["symbolic-ref", "--short", "HEAD"]));
|
|
1560
|
+
if (task) return task;
|
|
1561
|
+
} catch {
|
|
1562
|
+
}
|
|
1563
|
+
try {
|
|
1564
|
+
const named2 = git3(repo, [
|
|
1565
|
+
"log",
|
|
1566
|
+
"-1",
|
|
1567
|
+
`--format=%(trailers:key=${TRAILER},valueonly,separator=%x1d)`,
|
|
1568
|
+
"HEAD"
|
|
1569
|
+
]);
|
|
1570
|
+
for (const id of named2.split(""))
|
|
1571
|
+
try {
|
|
1572
|
+
return parseTask(id.trim());
|
|
1573
|
+
} catch {
|
|
1574
|
+
}
|
|
1560
1575
|
} catch {
|
|
1561
|
-
return void 0;
|
|
1562
1576
|
}
|
|
1577
|
+
return void 0;
|
|
1563
1578
|
}
|
|
1564
1579
|
function coveredItems(repo, task) {
|
|
1565
1580
|
const trailer = (key) => `%(trailers:key=${key},valueonly,separator=%x1d)`;
|
|
@@ -1777,7 +1792,10 @@ program.command("context").description("print a task\u2019s brief, assembled fro
|
|
|
1777
1792
|
process.stdout.write(opts.json ? JSON.stringify(ctx, null, 2) + "\n" : renderContext(ctx));
|
|
1778
1793
|
})
|
|
1779
1794
|
);
|
|
1780
|
-
program.command("progress").description("report the items the task\u2019s commits cover to the dispatcher").argument(
|
|
1795
|
+
program.command("progress").description("report the items the task\u2019s commits cover to the dispatcher").argument(
|
|
1796
|
+
"[task]",
|
|
1797
|
+
"the task, e.g. CHG-012/BE; default the one of the branch task/<chg>-<track> or of the last commit\u2019s trailer"
|
|
1798
|
+
).option("--hook", "as the Claude Code hook after a commit: silent, throttled, never failing").option("--json", "print the dispatcher\u2019s answer as JSON").action(async (id, opts) => {
|
|
1781
1799
|
if (opts.hook) {
|
|
1782
1800
|
setTimeout(() => process.exit(0), 3e4).unref();
|
|
1783
1801
|
const repo = await hookCwd(process.stdin) ?? process.cwd();
|
|
@@ -1789,7 +1807,7 @@ program.command("progress").description("report the items the task\u2019s commit
|
|
|
1789
1807
|
const task = id ? parseTask(id) : currentTask(repo);
|
|
1790
1808
|
if (!task)
|
|
1791
1809
|
throw new Error(
|
|
1792
|
-
"
|
|
1810
|
+
"Neither the branch (task/<chg>-<track>) nor the last commit\u2019s Alterspec-Task trailer names a task: name it, e.g. `progress CHG-012/BE`."
|
|
1793
1811
|
);
|
|
1794
1812
|
const report = await reportProgress(sessionOf(loadConfig()), task, coveredItems(repo, task));
|
|
1795
1813
|
process.stdout.write(opts.json ? JSON.stringify(report, null, 2) + "\n" : progressText(report));
|