@alterset/alterspec-client 0.22.0 → 0.23.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.
@@ -122,7 +122,7 @@ Alterspec-Covers: CAP-CAT-001-AC-03, CAP-CAT-002
122
122
  - `Alterspec-Task` always, the task exactly as the dispatcher wrote it.
123
123
  - `Alterspec-Covers` only on the commit with which an item's tests pass, naming those items exactly as the task's
124
124
  checklist writes them (`alterspec-client context <task>` lists them). Never an item whose tests don't pass yet,
125
- never one the checklist lacks, never "all". An item named once stays covered; don't name it again. A commit that
125
+ never one the checklist lacks, never one marked `w 0` (nothing your track builds), never "all". An item named once stays covered; don't name it again. A commit that
126
126
  covers nothing has no `Alterspec-Covers` line.
127
127
  - A criterion's `Then` is what the system guarantees, its `Shown` what the screen shows. Build and test only your
128
128
  track's part: `Then` on the backend, `Shown` on a UI track. The brief says when the other part is another task's;
@@ -58,7 +58,9 @@ or whose `Alterspec-Task` trailer the last commit carries; when that doesn't set
58
58
  product's behaviour that the brief didn't state. Each one has a `Q-<n>` from `/alterspec-spec-ask`, or you ask it
59
59
  now, before the commit, as `_shared.md` says; the commit's body names the `Q-<n>` it stands on.
60
60
  7. Work through the checklist, the heavy items first (their weight `w`, when the brief shows one, is how much
61
- behaviour each is; it is the sign-off's, never yours to set or send). A criterion item is your track's part of
61
+ behaviour each is; it is the sign-off's, never yours to set or send). An item marked `w 0, nothing to build on this track` is
62
+ another track's behaviour that your track only reads: read it, build nothing for it and never name it in
63
+ `Alterspec-Covers`; when your track does have work for it, ask with `/alterspec-spec-ask`. A criterion item is your track's part of
62
64
  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
63
65
  (`…/SCR-….html?state=<state>`): open that page in that state to see what you build (sign in as one of the
64
66
  screen's roles on the channel's `index.html` first; the session stays). For each item, make its
@@ -16,10 +16,13 @@ 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. Each item may carry a **weight** (`w 20`), 1 to 100: how much specified behaviour it
19
+ nobody types percentages. Each item may carry a **weight** (`w 20`), 0 to 100: how much specified behaviour it
20
20
  is, reasoned when the change was signed off from the spec alone, never from your code (a wording change is a
21
21
  few, an acceptance criterion about 10, a new capability 40 to 60). The dispatcher's progress and ETA count
22
22
  weight, not items, so a task of twelve small parts is not twelve days; an item without a weight counts 10.
23
+ The weight is your track's: an item marked `w 0, nothing to build on this track` is behaviour another track
24
+ builds (a criterion only the other channel shows, a mockup file). You read it, build nothing for it and never
25
+ name it in `Alterspec-Covers`; it counts in no progress, and a task whose items all weigh 0 is never handed out.
23
26
  Nobody types a weight either: the product side's sign-off gives it, and a developer never changes it.
24
27
  - A task may carry a **title** and a **summary**, and each item a **label**: what a person calls them, written by
25
28
  the product side at the sign-off (or taken from the spec's own titles). The brief opens with the title and the
package/dist/cli.js CHANGED
@@ -15,6 +15,7 @@ import { z as z2 } from "zod";
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
17
  var WorkWeight = z.number().int().min(1).max(100);
18
+ var ItemWeight = z.number().int().min(0).max(100);
18
19
  var WORD_CAPS = { title: 100, summary: 400, label: 100, name: 100 };
19
20
  var words = (max) => z.string().max(max, { message: `at most ${max} characters` }).regex(/^\S(?:[^\n\r]*\S)?$/, { message: "one line of text, without spaces around it" });
20
21
  var WorkTitle = words(WORD_CAPS.title);
@@ -47,12 +48,14 @@ var WorkTaskSchema = z.object({
47
48
  */
48
49
  after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),
49
50
  /**
50
- * The weight of each item (format 3): how much specified behaviour it adds or changes, 1–100, reasoned at the
51
- * change's sign-off against alterspec's rubric (a typical acceptance criterion about 10), never anyone's code.
52
- * An item the sign-off didn't weigh takes the median of the task's weighed items; a task of a change signed off
53
- * without weights has no `weights`, and a reader counts each of its items as 10. For weighing progress and ETA.
51
+ * The weight of each item on this track (format 3; per track and 0–100 from format 6): how much of the
52
+ * behaviour the item specifies this track builds, reasoned at the change's sign-off against alterspec's rubric
53
+ * (a typical acceptance criterion about 10), never anyone's code. 0: nothing to build on this track; the item
54
+ * is read, not built, and counts in no progress. A task whose weights are all 0 has no work and is not handed
55
+ * out. An item the sign-off didn't weigh takes the median of the task's weighed items above 0; a task of a
56
+ * change signed off without weights has no `weights`, and a reader counts each of its items as 10.
54
57
  */
55
- weights: z.record(z.string().min(1), WorkWeight).optional(),
58
+ weights: z.record(z.string().min(1), ItemWeight).optional(),
56
59
  /**
57
60
  * What this track builds in this change, for a person reading a list (format 5): reasoned at the change's
58
61
  * sign-off, in the product's words, naming no ID. Absent: the change was signed off without one.
@@ -86,7 +89,7 @@ var WorkChangeSchema = z.object({
86
89
  */
87
90
  weight: WorkWeight.optional()
88
91
  }).strict();
89
- var WORK_FORMAT = 5;
92
+ var WORK_FORMAT = 6;
90
93
  var WorkSchema = z.object({
91
94
  format: z.literal(WORK_FORMAT),
92
95
  /** The alterspec version that wrote the export. */
@@ -103,9 +106,17 @@ var WorkSchema = z.object({
103
106
  */
104
107
  names: z.record(z.string().min(1), WorkName).optional()
105
108
  }).strict();
106
- var WorkTaskV4Schema = WorkTaskSchema.omit({ title: true, summary: true, labels: true }).strict();
107
- var WorkChangeV4Schema = WorkChangeSchema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();
108
- var WorkV4Schema = WorkSchema.omit({ names: true }).extend({ format: z.literal(4), changes: z.array(WorkChangeV4Schema) }).strict();
109
+ var WorkTaskV5Schema = WorkTaskSchema.extend({
110
+ weights: z.record(z.string().min(1), WorkWeight).optional()
111
+ }).strict();
112
+ var WorkChangeV5Schema = WorkChangeSchema.extend({ tasks: z.array(WorkTaskV5Schema) }).strict();
113
+ var WorkV5Schema = WorkSchema.extend({
114
+ format: z.literal(5),
115
+ changes: z.array(WorkChangeV5Schema)
116
+ }).strict();
117
+ var WorkTaskV4Schema = WorkTaskV5Schema.omit({ title: true, summary: true, labels: true }).strict();
118
+ var WorkChangeV4Schema = WorkChangeV5Schema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();
119
+ var WorkV4Schema = WorkV5Schema.omit({ names: true }).extend({ format: z.literal(4), changes: z.array(WorkChangeV4Schema) }).strict();
109
120
  var WorkChangeV3Schema = WorkChangeV4Schema.omit({ weight: true }).strict();
110
121
  var WorkV3Schema = WorkV4Schema.extend({
111
122
  format: z.literal(3),
@@ -126,6 +137,7 @@ var AnyWorkSchema = z.discriminatedUnion("format", [
126
137
  WorkV2Schema,
127
138
  WorkV3Schema,
128
139
  WorkV4Schema,
140
+ WorkV5Schema,
129
141
  WorkSchema
130
142
  ]);
131
143
 
@@ -530,12 +542,19 @@ var ChangeSchema = z5.object({
530
542
  */
531
543
  tracks: z5.record(TrackCode, z5.array(z5.string())).optional(),
532
544
  /**
533
- * The weight of each task item (`work.json`), 1–100: how much specified behaviour the item adds or changes,
534
- * reasoned by the sign-off skill against the rubric (`_weights.md`), never anyone's code. Written by
535
- * `change weigh`, frozen at sign-off next to `tracks` (`{}` = signed off without weighing); absent = signed off
536
- * before weights existed. The dispatcher weighs progress and ETA by it.
545
+ * The weight of each task item (`work.json`), 0–100, on every track that has no weight of its own for it
546
+ * (`track_weights`): how much specified behaviour the item adds or changes, reasoned by the sign-off skill
547
+ * against the rubric (`_weights.md`), never anyone's code. Written by `change weigh`, frozen at sign-off next
548
+ * to `tracks` (`{}` = signed off without weighing); absent = signed off before weights existed. The dispatcher
549
+ * weighs progress and ETA by it.
537
550
  */
538
- weights: z5.record(z5.string(), WorkWeight).optional(),
551
+ weights: z5.record(z5.string(), ItemWeight).optional(),
552
+ /**
553
+ * The weight of an item on one track where it differs from `weights`, by track then item, 0–100: the part of
554
+ * the behaviour that track builds; 0 when it builds nothing of it (a criterion only another channel shows).
555
+ * Written by `change weigh` (an entry with `track`), frozen at sign-off as it is.
556
+ */
557
+ track_weights: z5.record(TrackCode, z5.record(z5.string(), ItemWeight)).optional(),
539
558
  /**
540
559
  * The size of the whole change, 1–100 (`work.json` format 4, `changes[].weight`): reasoned by the sign-off skill
541
560
  * against the change rubric (`_weights.md` "The change's weight"), never a sum of the item weights and never
@@ -2062,22 +2081,28 @@ function renderContext(c) {
2062
2081
  out.push("This export has no checklist (work.json format 1): the task\u2019s progress is its status only.");
2063
2082
  else {
2064
2083
  const list2 = c.checklist;
2065
- const done = list2.items.filter((i) => i.covered).length;
2084
+ const toBuild = list2.items.filter((i) => i.weight !== 0);
2085
+ const readOnly = list2.items.length - toBuild.length;
2086
+ const done = toBuild.filter((i) => i.covered).length;
2066
2087
  const weighed = list2.items.some((i) => i.weight !== void 0);
2067
2088
  const sum = (items) => items.reduce((a, i) => a + (i.weight ?? 0), 0);
2068
2089
  const weight = weighed ? list2.known ? `, ${sum(list2.items.filter((i) => i.covered))} of ${sum(list2.items)} weight` : `, ${sum(list2.items)} weight` : "";
2069
2090
  out.push(
2070
- `## Checklist (${list2.known ? `${done} of ${list2.items.length} covered` : `${list2.items.length} item${list2.items.length === 1 ? "" : "s"}`}${weight})`,
2091
+ `## Checklist (${list2.known ? `${done} of ${toBuild.length} covered` : `${toBuild.length} item${toBuild.length === 1 ? "" : "s"}`}${weight}${readOnly ? `; ${readOnly} to read only` : ""})`,
2071
2092
  "",
2072
2093
  "Name an item in `Alterspec-Covers` on the commit with which its tests pass.",
2073
2094
  ...weighed ? [
2074
- "The weight (w) is how much specified behaviour an item is, 1\u2013100, reasoned at the sign-off from the spec alone;",
2095
+ "The weight (w) is how much specified behaviour an item is on this track, reasoned at the sign-off from the spec alone;",
2075
2096
  "progress and the ETA count weight, not items. Start with the heavy ones."
2076
2097
  ] : [],
2098
+ ...readOnly ? [
2099
+ "An item of weight 0 is nothing this track builds (another channel shows it, or it is a mockup file): read it,",
2100
+ "build nothing for it and never name it in `Alterspec-Covers`. If your track does have work for it, say so with `/alterspec-spec-ask`."
2101
+ ] : [],
2077
2102
  ...list2.note ? ["", `Covered items unknown: ${list2.note}`] : [],
2078
2103
  "",
2079
2104
  ...list2.items.map(
2080
- (i) => `- [${i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : ` (w ${i.weight})`}: ${i.label ? `**${i.label}** \u2014 ` : ""}${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
2105
+ (i) => `- [${i.weight === 0 ? "-" : i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : i.weight === 0 ? " (w 0, nothing to build on this track)" : ` (w ${i.weight})`}: ${i.label ? `**${i.label}** \u2014 ` : ""}${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
2081
2106
  )
2082
2107
  );
2083
2108
  }