@alterset/alterspec-client 0.16.0 → 0.17.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 +4 -3
- package/assets/prompts/task-context.md +3 -2
- package/assets/prompts/task-next.md +11 -3
- package/assets/skills/alterspec-task-next/SKILL.md +2 -2
- package/developer-guide.md +14 -1
- package/dist/cli.js +45 -9
- package/dist/cli.js.map +1 -1
- package/dist/work.d.ts +98 -9
- package/dist/work.js +22 -6
- package/dist/work.js.map +1 -1
- package/dist/work.schema.json +194 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,9 +102,10 @@ instructions, wherever you keep them.
|
|
|
102
102
|
You talk to Claude Code; the skills call the dispatcher and the CLI for you.
|
|
103
103
|
|
|
104
104
|
1. **Take work.** `/alterspec-task-next`, or just "give me the next task". Name a track or ask for several at once:
|
|
105
|
-
`/alterspec-task-next BE 2
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
`/alterspec-task-next BE 2`; or name the one task you want, out of order: `/alterspec-task-next CHG-052/BE` (you
|
|
106
|
+
get it when it is available to you, else the dispatcher's reason). It only assigns: with one task it continues
|
|
107
|
+
with the brief, with several it lists them; type `/alterspec-task-context <task>` wherever you work on each. It
|
|
108
|
+
creates no branch or worktree; where and how you work is yours.
|
|
108
109
|
2. **Build from the brief.** `/alterspec-task-context [task]` reads the task's brief from the export:
|
|
109
110
|
- the checklist, with the items the dispatcher already holds covered and what changed in each;
|
|
110
111
|
- why the change was made;
|
|
@@ -47,8 +47,9 @@ or whose `Alterspec-Task` trailer the last commit carries; when that doesn't set
|
|
|
47
47
|
6. Before each commit of the task, look at what you built for it and name to yourself every choice about the
|
|
48
48
|
product's behaviour that the brief didn't state. Each one has a `Q-<n>` from `/alterspec-spec-ask`, or you ask it
|
|
49
49
|
now, before the commit, as `_shared.md` says; the commit's body names the `Q-<n>` it stands on.
|
|
50
|
-
7. Work through the checklist
|
|
51
|
-
|
|
50
|
+
7. Work through the checklist, the heavy items first (their weight `w`, when the brief shows one, is how much
|
|
51
|
+
behaviour each is; it is the sign-off's, never yours to set or send). A criterion item is your track's part of
|
|
52
|
+
it (`Then` on the backend, `Shown` on a UI track); leave the part the brief gives to another task. A contract state item comes with its mockup link
|
|
52
53
|
(`…/SCR-….html?state=<state>`): open that page in that state to see what you build (sign in as one of the
|
|
53
54
|
screen's roles on the channel's `index.html` first; the session stays). For each item, make its
|
|
54
55
|
tests pass, then commit with the trailers of `_shared.md`: `Alterspec-Task: <task>` always, `Alterspec-Covers`
|
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Read `.alterspec-client/prompts/_shared.md` first and follow it.
|
|
4
4
|
|
|
5
|
-
Arguments: `[track] [parallel]`,
|
|
6
|
-
the developer wants in progress at once (default 1).
|
|
5
|
+
Arguments: `[track] [parallel]` or `[task]`, all optional. The track is a track code; `parallel` is how many tasks
|
|
6
|
+
the developer wants in progress at once (default 1), e.g. `BE 2`. An argument shaped like a task ID (`CHG-052/BE`,
|
|
7
|
+
`BUG-3/BE`) names one task the developer wants instead of the next in order; a sentence does too ("I want
|
|
8
|
+
CHG-052/BE", "take CHG-052/BE").
|
|
7
9
|
|
|
8
10
|
1. Start as `_shared.md` says (`whoami`, `export-head`).
|
|
9
11
|
2. Tracks: the one the developer named; else `tracks` in `.alterspec-client.json` when it lists any; else none, and
|
|
10
12
|
the dispatcher offers every track the developer may take.
|
|
11
|
-
3. Call `next_task` with `export` = `send` from `export-head
|
|
13
|
+
3. Call `next_task` with `export` = `send` from `export-head` and, for a named task, `task` only (no `tracks`, no
|
|
14
|
+
`parallel`: the dispatcher assigns that one task when it is available to the developer); otherwise `tracks` and
|
|
15
|
+
`parallel`.
|
|
12
16
|
4. Say each `reasons` entry in one line (none available, blocked by what, at the limit, more after pulling). A task
|
|
13
17
|
with `kind: bug` (`BUG-3/BE`) is a bug's: say so, with the bug's title; it is worked like any other.
|
|
18
|
+
A named task that was not assigned is refused: say the dispatcher's reason in one line (its `message`; for
|
|
19
|
+
`BLOCKED` list the tasks it waits for, for `TAKEN` who has it) and stop. Never work around a refusal: don't call
|
|
20
|
+
`next_task` again with `parallel` or without `task` to take the next task in order instead. The developer decides
|
|
21
|
+
what to do next.
|
|
14
22
|
5. Each assigned task's `after` lists the done tasks it waited for, each with its `commit` and `branch`. When an
|
|
15
23
|
entry of the same track names a `branch` (not null), that predecessor's work is pushed there and not in the main
|
|
16
24
|
branch yet: say in one line which branch to start from, e.g. "CHG-013/BE starts from `task/chg-012-be`, where
|
|
@@ -1,7 +1,7 @@
|
|
|
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 shows the brief of one; creates no branch or worktree."
|
|
4
|
-
argument-hint: "[track] [parallel]"
|
|
3
|
+
description: "Use when the developer wants work from the dispatcher: \"give me work\", \"next task\", \"take two BE tasks\", \"I want CHG-052/BE\". Takes the next task(s) on their tracks, or the one task they name when it is available, and shows the brief of one; creates no branch or worktree."
|
|
4
|
+
argument-hint: "[track] [parallel] | [task]"
|
|
5
5
|
allowed-tools: Read Glob Grep Bash(npx @alterset/alterspec-client *) Bash(git *) mcp__dispatcher__*
|
|
6
6
|
---
|
|
7
7
|
|
package/developer-guide.md
CHANGED
|
@@ -16,7 +16,11 @@ You connect to it with the **alterspec client** (`@alterset/alterspec-client`, p
|
|
|
16
16
|
change is done.
|
|
17
17
|
- A task's **checklist** lists what it must deliver: acceptance criteria (`CAP-CAT-001-AC-03`), screen actions
|
|
18
18
|
(`SCR-PRC-01.A02`), experience states (`UX-SCR-PRC-01-WEB#error`). Progress counts the items your commits cover;
|
|
19
|
-
nobody types percentages.
|
|
19
|
+
nobody types percentages. Each item may carry a **weight** (`w 20`), 1 to 100: how much specified behaviour it
|
|
20
|
+
is, reasoned when the change was signed off from the spec alone, never from your code (a wording change is a
|
|
21
|
+
few, an acceptance criterion about 10, a new capability 40 to 60). The dispatcher's progress and ETA count
|
|
22
|
+
weight, not items, so a task of twelve small parts is not twelve days; an item without a weight counts 10.
|
|
23
|
+
Nobody types a weight either: the product side's sign-off gives it, and a developer never changes it.
|
|
20
24
|
- An acceptance criterion may have two outcomes: **Then**, what the system guarantees, and **Shown**, what the
|
|
21
25
|
person sees on the screen. The backend builds and tests the Then, a UI track the Shown, and each task's checklist
|
|
22
26
|
holds the criterion only for its own part; the brief shows you yours and says when the other part is another
|
|
@@ -175,6 +179,7 @@ server. Then talk to it in plain words; the skills do the rest.
|
|
|
175
179
|
| You say or type | What happens |
|
|
176
180
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
177
181
|
| "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 |
|
|
182
|
+
| "I want CHG-052/BE" / `/alterspec-task-next CHG-052/BE` | takes that one task when it is available to you (its predecessors done, on your track, no overlap with your other work); otherwise says the dispatcher's reason and stops |
|
|
178
183
|
| "let's work on my task" / `/alterspec-task-context` | the task's brief from the spec: why, the checklist (each part of an object named by its section or line), the one-time data change if any, the objects it changes (before and after), what moved since the sign-off and where the export uses them, the reach of its rules and roles, the changed acceptance criteria, the rules, events, quality requirements, integrations, decisions and glossary terms they and the change name (the rest, and the entities with their lifecycles, as paths); for a UI track also the screens, their contracts, mockups and design system |
|
|
179
184
|
| "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 |
|
|
180
185
|
| "what does RULE-… say?" / `/alterspec-spec-ask` | answers about the product from the spec, citing IDs; what the spec doesn't say is recorded as an assumption or an open question for the product side; Claude uses it by itself when a task's spec is undecided |
|
|
@@ -210,6 +215,14 @@ When the brief says "Start from `task/chg-012-be`", a task yours waited for was
|
|
|
210
215
|
yet: fetch it and base your branch on it, not on main (`git fetch origin task/chg-012-be`, then branch from
|
|
211
216
|
`origin/task/chg-012-be`). The teams merge a change's branches together once every track is done.
|
|
212
217
|
|
|
218
|
+
### One task of your choosing
|
|
219
|
+
|
|
220
|
+
Name it: `/alterspec-task-next CHG-052/BE` (or "take CHG-052/BE"). The dispatcher assigns it alone when it is
|
|
221
|
+
available to you: on a track you may take, in your export, the tasks it waits for done, under your limit on that
|
|
222
|
+
track and not overlapping a task you have in progress there. Otherwise you get its reason (blocked by which tasks,
|
|
223
|
+
taken by whom, at the limit, done already, pull the export first) and nothing is assigned; Claude never takes the
|
|
224
|
+
next task in order instead. The order is advice, not a rule: an available task has its dependencies done.
|
|
225
|
+
|
|
213
226
|
### Several tasks at once
|
|
214
227
|
|
|
215
228
|
Ask for more than one: `/alterspec-task-next BE 2`. Claude lists them and works on none; type
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ import { z as z2 } from "zod";
|
|
|
14
14
|
// ../src/schemas/work.ts
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
var TrackCode = z.string().regex(/^[A-Z]{2,5}$/, { message: "must be BE or a channel code" });
|
|
17
|
+
var WorkWeight = z.number().int().min(1).max(100);
|
|
17
18
|
var ChangeRef = z.string().regex(/^CHG-\d{3,}$/);
|
|
18
19
|
var Day = z.iso.date();
|
|
19
20
|
var WorkTrackSchema = z.object({
|
|
@@ -38,7 +39,14 @@ var WorkTaskSchema = z.object({
|
|
|
38
39
|
* changes it builds on that did the same work (an item of both, a line of a whole object this task edits again,
|
|
39
40
|
* or an object this task names that entered the export with the earlier change).
|
|
40
41
|
*/
|
|
41
|
-
after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict())
|
|
42
|
+
after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),
|
|
43
|
+
/**
|
|
44
|
+
* The weight of each item (format 3): how much specified behaviour it adds or changes, 1–100, reasoned at the
|
|
45
|
+
* change's sign-off against alterspec's rubric (a typical acceptance criterion about 10), never anyone's code.
|
|
46
|
+
* An item the sign-off didn't weigh takes the median of the task's weighed items; a task of a change signed off
|
|
47
|
+
* without weights has no `weights`, and a reader counts each of its items as 10. For weighing progress and ETA.
|
|
48
|
+
*/
|
|
49
|
+
weights: z.record(z.string().min(1), WorkWeight).optional()
|
|
42
50
|
}).strict();
|
|
43
51
|
var WorkChangeSchema = z.object({
|
|
44
52
|
id: ChangeRef,
|
|
@@ -52,7 +60,7 @@ var WorkChangeSchema = z.object({
|
|
|
52
60
|
/** One per track the change is on; empty = no work. */
|
|
53
61
|
tasks: z.array(WorkTaskSchema)
|
|
54
62
|
}).strict();
|
|
55
|
-
var WORK_FORMAT =
|
|
63
|
+
var WORK_FORMAT = 3;
|
|
56
64
|
var WorkSchema = z.object({
|
|
57
65
|
format: z.literal(WORK_FORMAT),
|
|
58
66
|
/** The alterspec version that wrote the export. */
|
|
@@ -64,12 +72,17 @@ var WorkSchema = z.object({
|
|
|
64
72
|
/** Every change signed off after the baseline, in the change map's order. */
|
|
65
73
|
changes: z.array(WorkChangeSchema)
|
|
66
74
|
}).strict();
|
|
67
|
-
var
|
|
75
|
+
var WorkTaskV2Schema = WorkTaskSchema.omit({ weights: true });
|
|
76
|
+
var WorkV2Schema = WorkSchema.extend({
|
|
77
|
+
format: z.literal(2),
|
|
78
|
+
changes: z.array(WorkChangeSchema.extend({ tasks: z.array(WorkTaskV2Schema) }).strict())
|
|
79
|
+
}).strict();
|
|
80
|
+
var WorkTaskV1Schema = WorkTaskV2Schema.omit({ items: true });
|
|
68
81
|
var WorkV1Schema = WorkSchema.extend({
|
|
69
82
|
format: z.literal(1),
|
|
70
83
|
changes: z.array(WorkChangeSchema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict())
|
|
71
84
|
}).strict();
|
|
72
|
-
var AnyWorkSchema = z.discriminatedUnion("format", [WorkV1Schema, WorkSchema]);
|
|
85
|
+
var AnyWorkSchema = z.discriminatedUnion("format", [WorkV1Schema, WorkV2Schema, WorkSchema]);
|
|
73
86
|
|
|
74
87
|
// src/config.ts
|
|
75
88
|
var CONFIG_FILE = ".alterspec-client.json";
|
|
@@ -465,13 +478,25 @@ var ChangeSchema = z5.object({
|
|
|
465
478
|
* rewritten, so a channel added later gives an old change no task.
|
|
466
479
|
*/
|
|
467
480
|
tracks: z5.record(TrackCode, z5.array(z5.string())).optional(),
|
|
481
|
+
/**
|
|
482
|
+
* The weight of each task item (`work.json`), 1–100: how much specified behaviour the item adds or changes,
|
|
483
|
+
* reasoned by the sign-off skill against the rubric (`_weights.md`), never anyone's code. Written by
|
|
484
|
+
* `change weigh`, frozen at sign-off next to `tracks` (`{}` = signed off without weighing); absent = signed off
|
|
485
|
+
* before weights existed. The dispatcher weighs progress and ETA by it.
|
|
486
|
+
*/
|
|
487
|
+
weights: z5.record(z5.string(), WorkWeight).optional(),
|
|
468
488
|
/**
|
|
469
489
|
* In a team project: the draft IDs the change and what it creates carried until the sign-off numbered them
|
|
470
490
|
* (draft → final). Written by the CLI at sign-off.
|
|
471
491
|
*/
|
|
472
492
|
drafted_as: z5.record(z5.string(), z5.string()).optional(),
|
|
473
493
|
/** The first 16 hex of the sha256 of the change's `delta.json`, written with it at sign-off, never rewritten. */
|
|
474
|
-
delta: z5.string().regex(/^[0-9a-f]{16}$/).optional()
|
|
494
|
+
delta: z5.string().regex(/^[0-9a-f]{16}$/).optional(),
|
|
495
|
+
/**
|
|
496
|
+
* Accepted findings on the archived change itself (`delta-chain`: a merge of parallel sign-offs no delta
|
|
497
|
+
* recorded), each on a decided decision naming the change; history can't be fixed, only accepted.
|
|
498
|
+
*/
|
|
499
|
+
accepts: list(AcceptSchema)
|
|
475
500
|
}).strict().superRefine((c, ctx) => {
|
|
476
501
|
for (const key of Object.keys(c.base)) {
|
|
477
502
|
if (!ObjectKey.safeParse(key).success) {
|
|
@@ -1446,6 +1471,7 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1446
1471
|
const entries = new Map(delta?.objects.map((e) => [e.key, e]));
|
|
1447
1472
|
const lost = new Map(delta?.unrecoverable?.map((u) => [u.key, u.why]));
|
|
1448
1473
|
const items = work.items;
|
|
1474
|
+
const weights = work.weights;
|
|
1449
1475
|
const ctx = {
|
|
1450
1476
|
task: task.id,
|
|
1451
1477
|
...questions ? { questions } : {},
|
|
@@ -1454,10 +1480,12 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1454
1480
|
checklist: {
|
|
1455
1481
|
items: items.map((item) => {
|
|
1456
1482
|
const covered = state.covered?.get(item);
|
|
1483
|
+
const weight = weights?.[item];
|
|
1457
1484
|
return {
|
|
1458
1485
|
item,
|
|
1459
1486
|
what: itemWhat(x, item, entries.get(itemObject(item)), task.track),
|
|
1460
|
-
...covered ? { covered } : {}
|
|
1487
|
+
...covered ? { covered } : {},
|
|
1488
|
+
...weight === void 0 ? {} : { weight }
|
|
1461
1489
|
};
|
|
1462
1490
|
}),
|
|
1463
1491
|
known: state.covered !== void 0,
|
|
@@ -1656,14 +1684,21 @@ function renderContext(c) {
|
|
|
1656
1684
|
else {
|
|
1657
1685
|
const list2 = c.checklist;
|
|
1658
1686
|
const done = list2.items.filter((i) => i.covered).length;
|
|
1687
|
+
const weighed = list2.items.some((i) => i.weight !== void 0);
|
|
1688
|
+
const sum = (items) => items.reduce((a, i) => a + (i.weight ?? 0), 0);
|
|
1689
|
+
const weight = weighed ? list2.known ? `, ${sum(list2.items.filter((i) => i.covered))} of ${sum(list2.items)} weight` : `, ${sum(list2.items)} weight` : "";
|
|
1659
1690
|
out.push(
|
|
1660
|
-
`## Checklist (${list2.known ? `${done} of ${list2.items.length} covered` : `${list2.items.length} item${list2.items.length === 1 ? "" : "s"}`})`,
|
|
1691
|
+
`## Checklist (${list2.known ? `${done} of ${list2.items.length} covered` : `${list2.items.length} item${list2.items.length === 1 ? "" : "s"}`}${weight})`,
|
|
1661
1692
|
"",
|
|
1662
1693
|
"Name an item in `Alterspec-Covers` on the commit with which its tests pass.",
|
|
1694
|
+
...weighed ? [
|
|
1695
|
+
"The weight (w) is how much specified behaviour an item is, 1\u2013100, reasoned at the sign-off from the spec alone;",
|
|
1696
|
+
"progress and the ETA count weight, not items. Start with the heavy ones."
|
|
1697
|
+
] : [],
|
|
1663
1698
|
...list2.note ? ["", `Covered items unknown: ${list2.note}`] : [],
|
|
1664
1699
|
"",
|
|
1665
1700
|
...list2.items.map(
|
|
1666
|
-
(i) => `- [${i.covered ? "x" : " "}] \`${i.item}
|
|
1701
|
+
(i) => `- [${i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : ` (w ${i.weight})`}: ${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
|
|
1667
1702
|
)
|
|
1668
1703
|
);
|
|
1669
1704
|
}
|
|
@@ -2790,8 +2825,9 @@ async function reportProgress(session, task, covered) {
|
|
|
2790
2825
|
}
|
|
2791
2826
|
function progressText(r) {
|
|
2792
2827
|
const progress = r.answer.progress;
|
|
2828
|
+
const weight = r.answer.weight;
|
|
2793
2829
|
const eta = r.answer.eta;
|
|
2794
|
-
const count = progress ? `${progress.covered} of ${progress.of} items covered (${progress.percent}
|
|
2830
|
+
const count = progress ? `${progress.covered} of ${progress.of} items covered (${progress.percent} %${weight ? `, ${weight.covered} of ${weight.total} weight` : ""})` : "no checklist (its export predates task items)";
|
|
2795
2831
|
const when = !eta ? "" : eta.by === "done" ? "; done" : eta.date ? `; ETA ${eta.at_least ? "at least " : ""}${eta.date}${eta.by === "developer" ? ` (yours; computed ${eta.computed?.date ?? "unknown"})` : ""}` : "; ETA unknown";
|
|
2796
2832
|
const lines = [`${r.task}: ${count}${when}.`];
|
|
2797
2833
|
if (r.unknown.length) lines.unshift(unknownLine(r));
|