@alterset/alterspec-client 0.29.0 → 0.31.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/assets/prompts/_shared.md +5 -1
- package/assets/prompts/spec-ask.md +18 -4
- package/assets/prompts/task-done.md +8 -0
- package/developer-guide.md +33 -5
- package/dist/cli.js +241 -31
- package/dist/cli.js.map +1 -1
- package/dist/work.d.ts +274 -2
- package/dist/work.js +54 -2
- package/dist/work.js.map +1 -1
- package/dist/work.schema.json +432 -0
- package/package.json +1 -1
|
@@ -84,7 +84,11 @@ dispatcher's pages.
|
|
|
84
84
|
answer is one of three. *From the spec*, with the IDs it rests on: work on. *Assumed* (`Q-<n>`): the spec doesn't
|
|
85
85
|
say and one reading is the cautious one; work on with it, name `Q-<n>` in the body of every commit that stands on
|
|
86
86
|
it, and expect that the product side may correct it. *Open* (`Q-<n>`): nobody may assume it; leave that checklist
|
|
87
|
-
item uncovered, work the others, and never name it in `Alterspec-Covers`.
|
|
87
|
+
item uncovered, work the others, and never name it in `Alterspec-Covers`. Both carry your reading of the spec
|
|
88
|
+
(`assumption`; `no_reading` with the reason only when there truly is none), and an open one says what it waits
|
|
89
|
+
for: a contradiction between two objects, or a business decision; anything else is assumed. Another developer's
|
|
90
|
+
open question on the same matter is joined (`joins`), your own follow-up extends it (`extends`), and the
|
|
91
|
+
questions the dispatcher returns as `related` are shown before anything is posted. The brief (`alterspec-client context`)
|
|
88
92
|
opens with the change's questions on every track and the product side's answers, and `alterspec-client questions
|
|
89
93
|
<task>` prints a task's: an answer to an open one unblocks its item; a corrected assumption is rework, done before
|
|
90
94
|
anything else. An answer that changes the spec comes back one export later as a change of its own; when the brief
|
|
@@ -40,7 +40,9 @@ that follows is that change's task too.
|
|
|
40
40
|
first one didn't name), this is not a new question: it is a new numbered part of that one. Go on through steps
|
|
41
41
|
3 to 6 for the new part alone and, at step 7, record it as one question that restates the open one with its
|
|
42
42
|
parts numbered, naming the earlier `Q-<n>` first in its text ("Extends Q-124: (1) … (2) …") and passing
|
|
43
|
-
`extends: Q-<n>` when the dispatcher's `ask` takes it; the product side then answers the matter once.
|
|
43
|
+
`extends: Q-<n>` when the dispatcher's `ask` takes it; the product side then answers the matter once. When the
|
|
44
|
+
open one is another developer's question on the same matter, don't restate it: pass `joins: Q-<n>` at step 7,
|
|
45
|
+
and your task waits on that question's answer like theirs (`extends` is for your own follow-up only). And a
|
|
44
46
|
limit: once three of your questions about one cited object are open on the task, ask nothing more about that
|
|
45
47
|
object. Write the cases still undecided into one consolidated question the same way, build everything else on the
|
|
46
48
|
assumptions already recorded, and leave the items those cases hold uncovered. Fifty questions on one task about
|
|
@@ -60,9 +62,21 @@ that follows is that change's task too.
|
|
|
60
62
|
7. An answer from the spec is not sent to the dispatcher: nothing was decided, so there is nothing for the product
|
|
61
63
|
side to read. Record it with `ask` only when the outcome is `assumed` or `open`, and when the dispatcher lists
|
|
62
64
|
that tool: `question`, `outcome`, `cites` (what the question concerns, what the assumption extends),
|
|
63
|
-
`assumption
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
`assumption`, `export` (the commit from step 1) and, with a task, `task` and `item`. The words are the answerer's
|
|
66
|
+
and yours, naming IDs: no code and no copied spec text.
|
|
67
|
+
- `assumption` is always sent with `assumed`, and with `open` too: your best reading of what the product does,
|
|
68
|
+
which the product side confirms or corrects. Only when you truly have no reading of an `open` question, send
|
|
69
|
+
`no_reading` with the reason in its place.
|
|
70
|
+
- `open` also takes `waits_for`, and only two reasons make a question wait: `"contradiction"` (two objects of the
|
|
71
|
+
export say different things; cite both) or `"business"` (a product decision no reading of the spec can make).
|
|
72
|
+
Anything else is `assumed`: record the assumption and work on.
|
|
73
|
+
- `joins` (`Q-<n>`) instead of a new question when step 2 found another asker's open question on the same matter;
|
|
74
|
+
`extends: Q-<n>` for your own follow-up.
|
|
75
|
+
- When the dispatcher answers with `related` (questions it holds on the same objects), show them to the developer
|
|
76
|
+
in one line each before anything is posted, and post only once it is settled: join one, extend your own, or
|
|
77
|
+
send the question as new.
|
|
78
|
+
Keep the `Q-<n>` it returns. Without the tool, or when the call fails, go on and say the question was not
|
|
79
|
+
recorded.
|
|
66
80
|
8. Say the result, by outcome:
|
|
67
81
|
- `spec`: the answer in the export's business terms with the IDs it rests on. Work on.
|
|
68
82
|
- `assumed`: "Assumed, not decided (Q-<n>):" and the assumption, what it extends and what changes if the product
|
|
@@ -21,7 +21,15 @@ Without a task, ask for it; never guess it.
|
|
|
21
21
|
5. Run `alterspec-client questions <task> --open`, when the dispatcher keeps questions (a failure here doesn't
|
|
22
22
|
stop what follows). Say each open one in a line: work standing on an assumption may still be corrected, and an
|
|
23
23
|
item that waited for an answer is not built. The developer typed the command, so go on.
|
|
24
|
+
When the dispatcher's `task` lists `rework` (a `REWORK-<n>` item beside the checklist: a corrected assumption's
|
|
25
|
+
work), say each one that isn't covered. One whose fix is committed and whose tests pass is covered by naming
|
|
26
|
+
`REWORK-<n>` in an `Alterspec-Covers` trailer and running `alterspec-client progress <task>` again; it carries
|
|
27
|
+
no weight. Never cover one whose fix isn't in the code.
|
|
24
28
|
6. Call `done` with the task, that `commit` and, when `merged` printed one, that `branch` (`{ id, commit, branch }`;
|
|
25
29
|
leave `branch` out when there is none).
|
|
26
30
|
7. Say the result in one line: done, at which commit, on which branch, and that the tasks waiting for it may start
|
|
27
31
|
from that branch. `NOT_IN_BRANCH`, `NOT_YOURS`, `NOT_IN_PROGRESS`: say the dispatcher's sentence.
|
|
32
|
+
`QUESTIONS_OPEN` (an item still waits for an answer), `REWORK_OPEN` (a `REWORK-<n>` item isn't covered),
|
|
33
|
+
`COUPLED_HOLD` (the change ships with its other tracks, which aren't done) and `HELD` (the change is held out of
|
|
34
|
+
the release; done on a feature branch is allowed, on the main branch it is not): say the dispatcher's sentence
|
|
35
|
+
as it is and what it waits for; never retry `done` to get past it.
|
package/developer-guide.md
CHANGED
|
@@ -251,6 +251,18 @@ When the brief says "Start from `task/chg-012-be`", a task yours waited for was
|
|
|
251
251
|
yet: fetch it and base your branch on it, not on main (`git fetch origin task/chg-012-be`, then branch from
|
|
252
252
|
`origin/task/chg-012-be`). The teams merge a change's branches together once every track is done.
|
|
253
253
|
|
|
254
|
+
When another track has finished the same change, the brief says so near its top: "**BE has shipped this change**"
|
|
255
|
+
with its commit and branch (from the dispatcher's `task`, which names the change's other tasks). The server already
|
|
256
|
+
behaves as the change says, so your tests of what the change removes or narrows fail until your task is done:
|
|
257
|
+
updating them is part of your task, not a broken dependency. A track still at work is named as "building this change
|
|
258
|
+
now". The dispatcher offers a shipped change's other tasks first.
|
|
259
|
+
|
|
260
|
+
When the change keeps a **compatibility** (its proposal's "Compatibility" section: what the server keeps accepting
|
|
261
|
+
from the apps as they are today), the brief says that instead of "tests will fail": on the backend, which tracks
|
|
262
|
+
still build the change and which later task ends the compatibility; on an app, that the server keeps the old
|
|
263
|
+
behaviour until your task is done. The task that ends a compatibility waits for every app task of the change that
|
|
264
|
+
kept it; when to deploy it is the team's call, since old app versions stay in use after a task is done.
|
|
265
|
+
|
|
254
266
|
### A brief that doesn't move under you
|
|
255
267
|
|
|
256
268
|
The spec keeps changing while you build: a rule your task names may be edited by three later changes before you are
|
|
@@ -271,6 +283,9 @@ sentence a later change wrote is asked on that change's task.
|
|
|
271
283
|
nothing.
|
|
272
284
|
- An object that was signed off only after your task's change (the brief says so) is shown as the export holds it
|
|
273
285
|
now: the export never had its earlier text.
|
|
286
|
+
- When the dispatcher sends the list of what changed since your task's export (client 0.31.0), "Changed since"
|
|
287
|
+
names only the objects your task cites, plus the objects that entered the export after it; when none of yours
|
|
288
|
+
changed it says so in one line. An older dispatcher sends no list, and the section stays as above.
|
|
274
289
|
|
|
275
290
|
### One task of your choosing
|
|
276
291
|
|
|
@@ -300,7 +315,10 @@ You don't carry questions to the product owner by hand. When the spec leaves som
|
|
|
300
315
|
A product person confirms or corrects it on the dispatcher's **Questions** page. A correction shows at the top of
|
|
301
316
|
the task's brief, and Claude reworks what stood on the assumption before anything else.
|
|
302
317
|
- **Open** (`Q-13`). Nothing may be assumed. That checklist item stays uncovered and Claude works the others; when
|
|
303
|
-
the answer is there, the brief shows it and the item goes on.
|
|
318
|
+
the answer is there, the brief shows it and the item goes on. Only two things make a question wait: two parts of
|
|
319
|
+
the spec that say different things (both are named), or a business decision no reading of the spec can make.
|
|
320
|
+
Anything else is assumed. An open question still carries Claude's reading of the spec, which the product side
|
|
321
|
+
confirms or corrects; only when there is truly none does it say why.
|
|
304
322
|
|
|
305
323
|
Claude asks not only when it is stuck. Every time it is about to decide how the product behaves where the brief
|
|
306
324
|
doesn't say (which refusal wins, a default, what happens to existing records, a message's wording), it asks first:
|
|
@@ -319,7 +337,10 @@ question extends that question instead of adding a new one, so the product side
|
|
|
319
337
|
three open questions about one object on a task, Claude asks nothing more about it: it writes the cases still
|
|
320
338
|
undecided into one question and builds everything else on the assumptions already recorded. A wish about how the
|
|
321
339
|
product should behave or look, with nothing in the spec read two ways and no item waiting on it, is not a question:
|
|
322
|
-
bring it to the product side as a proposal.
|
|
340
|
+
bring it to the product side as a proposal. When another developer already asked the same open question, Claude
|
|
341
|
+
joins it instead of asking again, and your task waits on its answer like theirs. When the dispatcher answers that it
|
|
342
|
+
holds related questions on the same objects, Claude shows them to you one line each before anything is posted, and
|
|
343
|
+
posts once you settle it: join one, extend your own, or send it as new.
|
|
323
344
|
|
|
324
345
|
How an answer is found: the client first looks whether the question was asked before, then computes where the spec
|
|
325
346
|
would answer it (`lookup`: what the question names, by ID, by the glossary's words and their synonyms, by title; the
|
|
@@ -329,9 +350,16 @@ that it did. So "the spec doesn't say" means the places that would say it were r
|
|
|
329
350
|
nothing.
|
|
330
351
|
|
|
331
352
|
`npx @alterset/alterspec-client questions` prints your questions with their answers, `questions CHG-023/BE` a
|
|
332
|
-
task's; the brief shows the whole change's, so what the backend assumed
|
|
333
|
-
|
|
334
|
-
|
|
353
|
+
task's, `questions Q-12 Q-13` those questions whole; the brief shows the whole change's, so what the backend assumed
|
|
354
|
+
is in front of the web task too. When the dispatcher says which of them bear on your task (asked on your track, or
|
|
355
|
+
answered with a change to one of your items), only those are whole in the brief and the others are one line each,
|
|
356
|
+
naming the command that prints them. A corrected assumption opens a `REWORK-<n>` item beside the checklist: fix what
|
|
357
|
+
stood on it, and cover it with `Alterspec-Covers: REWORK-<n>` once its tests pass; it carries no weight.
|
|
358
|
+
`/alterspec-task-done` names the questions still open and the rework not covered. The dispatcher may refuse
|
|
359
|
+
`done` while an item waits for an answer (`QUESTIONS_OPEN`), a rework item isn't covered (`REWORK_OPEN`), the
|
|
360
|
+
change ships with its other tracks that aren't done (`COUPLED_HOLD`), or the change is held out of the release on
|
|
361
|
+
the main branch (`HELD`); Claude says the dispatcher's sentence and what it waits for, and never retries to get
|
|
362
|
+
past it. An older dispatcher refuses none of these. If the answer changes the product, the product side grooms it into the spec (several answers as one
|
|
335
363
|
change) and signs it off, and it reaches you as a task of its own in a later export. The dispatcher knows which
|
|
336
364
|
of that change's questions your track built already (your task finished after the answer), and the brief opens
|
|
337
365
|
with it under "Built already": such a task checks that the code says what the spec now says, adds the missing tests
|
package/dist/cli.js
CHANGED
|
@@ -112,6 +112,52 @@ var WorkSchema = z.object({
|
|
|
112
112
|
/** The initiatives the changes name, by ID (format 8). Absent when no change names one. */
|
|
113
113
|
initiatives: z.array(WorkInitiativeSchema).optional()
|
|
114
114
|
}).strict();
|
|
115
|
+
var Version = z.string().regex(/^[0-9a-f]{12}$/);
|
|
116
|
+
var TaskRef = z.object({ change: ChangeRef, track: TrackCode }).strict();
|
|
117
|
+
var WorkBriefPartSchema = z.object({
|
|
118
|
+
kind: z.enum(["capability", "used_by", "decision", "object"]),
|
|
119
|
+
key: z.string().min(1),
|
|
120
|
+
/** A file path inside the export, never an anchor; `paragraphs` names a decision's paragraphs. */
|
|
121
|
+
path: z.string().min(1),
|
|
122
|
+
bytes: z.number().int().min(0),
|
|
123
|
+
touched: z.boolean().optional(),
|
|
124
|
+
paragraphs: z.array(z.string().min(1)).optional()
|
|
125
|
+
}).strict();
|
|
126
|
+
var WorkTaskV9Schema = WorkTaskSchema.extend({
|
|
127
|
+
/** The version of every object, item and cited decision paragraph (`DEC-573#p3`) of the task, as of this export. */
|
|
128
|
+
versions: z.record(z.string().min(1), Version).optional(),
|
|
129
|
+
/** The tracks whose existing behaviour this task changes; sorted, never its own track. */
|
|
130
|
+
alters: z.array(TrackCode).optional(),
|
|
131
|
+
brief: z.object({ bytes: z.number().int().min(0), parts: z.array(WorkBriefPartSchema) }).strict().optional(),
|
|
132
|
+
/** The signed-off tasks whose cited objects a later edit changed, which this task exists for. A label only. */
|
|
133
|
+
amends: z.array(TaskRef).optional()
|
|
134
|
+
}).strict().refine((t) => !t.alters?.includes(t.track), {
|
|
135
|
+
message: "alters never names the task's own track",
|
|
136
|
+
path: ["alters"]
|
|
137
|
+
});
|
|
138
|
+
var WorkChangeV9Schema = WorkChangeSchema.extend({
|
|
139
|
+
tasks: z.array(WorkTaskV9Schema).optional(),
|
|
140
|
+
released: z.literal(false).optional(),
|
|
141
|
+
coupled: z.literal(true).optional()
|
|
142
|
+
}).strict().refine((c) => c.released === false ? c.tasks === void 0 : c.tasks !== void 0, {
|
|
143
|
+
message: "a held change (released: false) has no tasks; a released one has tasks",
|
|
144
|
+
path: ["tasks"]
|
|
145
|
+
});
|
|
146
|
+
var WorkReleaseSchema = z.object({
|
|
147
|
+
id: z.string().regex(/^R-\d{4}-\d{2}-\d{2}-\d+$/),
|
|
148
|
+
date: Day,
|
|
149
|
+
note: z.string().max(400).refine((t) => !/[\r\n]/.test(t), { message: "one line" }),
|
|
150
|
+
changes: z.array(ChangeRef),
|
|
151
|
+
held: z.array(ChangeRef),
|
|
152
|
+
touches: z.record(ChangeRef, z.array(z.string().min(1)))
|
|
153
|
+
}).strict();
|
|
154
|
+
var WorkV9Schema = WorkSchema.extend({
|
|
155
|
+
format: z.literal(9),
|
|
156
|
+
changes: z.array(WorkChangeV9Schema),
|
|
157
|
+
/** The path of every object any task names, every decision any task cites, and every initiative. */
|
|
158
|
+
paths: z.record(z.string().min(1), z.string().min(1)).optional(),
|
|
159
|
+
release: WorkReleaseSchema.optional()
|
|
160
|
+
}).strict();
|
|
115
161
|
var WorkChangeV7Schema = WorkChangeSchema.omit({ initiative: true }).strict();
|
|
116
162
|
var WorkV7Schema = WorkSchema.omit({ initiatives: true }).extend({ format: z.literal(7), changes: z.array(WorkChangeV7Schema) }).strict();
|
|
117
163
|
var WorkTaskV6Schema = WorkTaskSchema.omit({ weight: true }).strict();
|
|
@@ -157,7 +203,8 @@ var AnyWorkSchema = z.discriminatedUnion("format", [
|
|
|
157
203
|
WorkV5Schema,
|
|
158
204
|
WorkV6Schema,
|
|
159
205
|
WorkV7Schema,
|
|
160
|
-
WorkSchema
|
|
206
|
+
WorkSchema,
|
|
207
|
+
WorkV9Schema
|
|
161
208
|
]);
|
|
162
209
|
|
|
163
210
|
// src/config.ts
|
|
@@ -554,7 +601,7 @@ var Status = z4.enum(["draft", "ready", "signed_off"], {
|
|
|
554
601
|
var Scope = z4.enum(["own", "team", "org", "all"]);
|
|
555
602
|
var Op = z4.enum(["C", "R", "U", "D", "A"]);
|
|
556
603
|
var Title = z4.string().trim().min(1, { message: "must not be empty" });
|
|
557
|
-
var
|
|
604
|
+
var Version2 = z4.number().int().min(1);
|
|
558
605
|
var StateName = z4.string().regex(/^[a-z][a-z0-9_]*$/, {
|
|
559
606
|
message: "must be a lowercase state name (letters, digits, underscore)"
|
|
560
607
|
});
|
|
@@ -727,6 +774,13 @@ function exportChange(e) {
|
|
|
727
774
|
return "not in the export";
|
|
728
775
|
}
|
|
729
776
|
|
|
777
|
+
// ../src/changes/compatibility.ts
|
|
778
|
+
var COMPATIBILITY_SECTION = "Compatibility";
|
|
779
|
+
function compatibilityText(sectionText2) {
|
|
780
|
+
const text = sectionText2?.trim();
|
|
781
|
+
return text && !/^none\b/i.test(text) ? text : void 0;
|
|
782
|
+
}
|
|
783
|
+
|
|
730
784
|
// ../src/changes/data-change.ts
|
|
731
785
|
var DATA_CHANGE_SECTION = "One-time data change";
|
|
732
786
|
var DATA_CHANGE_ITEM = "data-change";
|
|
@@ -1461,7 +1515,7 @@ var QuestionSchema = z7.object({
|
|
|
1461
1515
|
developer: z7.string(),
|
|
1462
1516
|
at: z7.string(),
|
|
1463
1517
|
question: z7.string(),
|
|
1464
|
-
outcome: z7.enum(["spec", "assumed", "open"]),
|
|
1518
|
+
outcome: z7.enum(["spec", "assumed", "open", "proposal"]),
|
|
1465
1519
|
status: z7.enum(["open", "answered"]),
|
|
1466
1520
|
cites: z7.array(z7.string()).default([]),
|
|
1467
1521
|
answer: z7.string().nullish(),
|
|
@@ -1469,7 +1523,15 @@ var QuestionSchema = z7.object({
|
|
|
1469
1523
|
corrected: z7.boolean().optional(),
|
|
1470
1524
|
/** The product side's mark: the spec now says what the answer says. */
|
|
1471
1525
|
reconciled: z7.boolean().optional(),
|
|
1472
|
-
answers: z7.array(AnswerSchema).default([])
|
|
1526
|
+
answers: z7.array(AnswerSchema).default([]),
|
|
1527
|
+
/** What an open question waits for (wave contract 2.4). */
|
|
1528
|
+
waits_for: z7.enum(["contradiction", "business"]).nullish(),
|
|
1529
|
+
/** Why an open question carries no reading of the spec. */
|
|
1530
|
+
no_reading: z7.string().nullish(),
|
|
1531
|
+
/** The question this one was joined into. */
|
|
1532
|
+
merged_into: z7.string().nullish(),
|
|
1533
|
+
/** The `REWORK-<n>` item a corrected assumption opened on the asking task. */
|
|
1534
|
+
rework: z7.string().nullish()
|
|
1473
1535
|
});
|
|
1474
1536
|
var TaskAnswerSchema = z7.object({
|
|
1475
1537
|
question: z7.string(),
|
|
@@ -1504,7 +1566,7 @@ function missingCites(x, refs) {
|
|
|
1504
1566
|
}
|
|
1505
1567
|
async function listQuestions(session, filter = {}) {
|
|
1506
1568
|
const answer = await callTool(session, "questions", {
|
|
1507
|
-
...filter.task ? { task: filter.task } : filter.about ? { about: filter.about } : { mine: true },
|
|
1569
|
+
...filter.ids?.length ? { ids: filter.ids } : filter.task ? { task: filter.task } : filter.about ? { about: filter.about } : { mine: true },
|
|
1508
1570
|
...filter.open ? { status: "open" } : {}
|
|
1509
1571
|
});
|
|
1510
1572
|
const parsed = z7.array(QuestionSchema).safeParse(answer.questions ?? []);
|
|
@@ -1532,12 +1594,18 @@ function sortQuestions(questions) {
|
|
|
1532
1594
|
return [...questions].sort((a, b) => rank(a) - rank(b));
|
|
1533
1595
|
}
|
|
1534
1596
|
var one = (text) => text.replace(/\s+/g, " ").trim();
|
|
1597
|
+
function stateOf(q) {
|
|
1598
|
+
const last = holding(q);
|
|
1599
|
+
return isCorrected(q) ? "ASSUMPTION CORRECTED" : last ? q.outcome === "assumed" ? "assumption confirmed" : "answered by the product side" : q.outcome === "spec" ? "answered from the spec" : q.outcome === "assumed" ? "open, working on an assumption" : q.outcome === "proposal" ? "a proposal for the product side" : q.merged_into ? `joined into ${q.merged_into}` : q.waits_for === "contradiction" ? "open, waiting for the product side on a contradiction" : "open, waiting for the product side";
|
|
1600
|
+
}
|
|
1535
1601
|
function questionLines(q) {
|
|
1536
1602
|
const about = [q.task, q.item].filter(Boolean).join(" ");
|
|
1537
1603
|
const last = holding(q);
|
|
1538
|
-
const
|
|
1539
|
-
const lines = [`- ${q.id} (${state}${about ? `; ${about}` : ""}): ${one(q.question)}`];
|
|
1604
|
+
const lines = [`- ${q.id} (${stateOf(q)}${about ? `; ${about}` : ""}): ${one(q.question)}`];
|
|
1540
1605
|
if (q.outcome === "assumed" && q.assumption) lines.push(` - Assumed: ${one(q.assumption)}`);
|
|
1606
|
+
if (q.outcome === "open" && q.assumption) lines.push(` - Reading: ${one(q.assumption)}`);
|
|
1607
|
+
if (isCorrected(q) && q.rework)
|
|
1608
|
+
lines.push(` - Rework: ${q.rework}, covered with \`Alterspec-Covers: ${q.rework}\`.`);
|
|
1541
1609
|
if (q.outcome === "spec" && q.answer)
|
|
1542
1610
|
lines.push(` - From the spec: ${one(q.answer)}${q.cites.length ? ` (${q.cites.join(", ")})` : ""}`);
|
|
1543
1611
|
if (last)
|
|
@@ -1550,17 +1618,27 @@ function questionsText(questions) {
|
|
|
1550
1618
|
if (!questions.length) return "No questions.\n";
|
|
1551
1619
|
return sortQuestions(questions).flatMap(questionLines).join("\n") + "\n";
|
|
1552
1620
|
}
|
|
1553
|
-
function
|
|
1621
|
+
function questionLine(q) {
|
|
1622
|
+
const about = [q.task, q.item].filter(Boolean).join(" ");
|
|
1623
|
+
return `- ${q.id} (${about ? `${about}; ` : ""}${stateOf(q)}): \`alterspec-client questions ${q.id}\``;
|
|
1624
|
+
}
|
|
1625
|
+
function questionsSection(questions, full) {
|
|
1554
1626
|
if (!questions.length) return [];
|
|
1555
1627
|
const sorted = sortQuestions(questions);
|
|
1628
|
+
const whole = (q) => !full || full.has(q.id);
|
|
1629
|
+
const lined = sorted.filter((q) => !whole(q)).length;
|
|
1556
1630
|
const corrected = sorted.filter(isCorrected).length;
|
|
1557
1631
|
const open = sorted.filter((q) => q.status === "open").length;
|
|
1558
1632
|
return [
|
|
1559
1633
|
`## Questions (${open} open${corrected ? `, ${corrected} corrected` : ""})`,
|
|
1560
1634
|
"",
|
|
1561
1635
|
corrected ? "A corrected assumption is rework: what was built on it follows the product side\u2019s answer before the task is done." : "What was asked about this change, on any of its tracks (each names the task it was asked on). An open one on an assumption may still be corrected; an item waiting for an answer stays uncovered.",
|
|
1636
|
+
...lined ? [
|
|
1637
|
+
"",
|
|
1638
|
+
`Whole: the questions asked on this track or answered with a change to an item of this task. The other ${lined} are one line each; read one with \`alterspec-client questions <id>\` when its object is in front of you.`
|
|
1639
|
+
] : [],
|
|
1562
1640
|
"",
|
|
1563
|
-
...sorted.flatMap(questionLines),
|
|
1641
|
+
...sorted.flatMap((q) => whole(q) ? questionLines(q) : [questionLine(q)]),
|
|
1564
1642
|
""
|
|
1565
1643
|
];
|
|
1566
1644
|
}
|
|
@@ -1593,6 +1671,51 @@ function answersSection(answers) {
|
|
|
1593
1671
|
// src/context.ts
|
|
1594
1672
|
var ContextError = class extends Error {
|
|
1595
1673
|
};
|
|
1674
|
+
function parseQuestionsFull(value) {
|
|
1675
|
+
if (!Array.isArray(value)) return void 0;
|
|
1676
|
+
return new Set(
|
|
1677
|
+
value.flatMap((v) => {
|
|
1678
|
+
const id = typeof v === "string" ? v : v?.id;
|
|
1679
|
+
return typeof id === "string" && id ? [id] : [];
|
|
1680
|
+
})
|
|
1681
|
+
);
|
|
1682
|
+
}
|
|
1683
|
+
function parseChangedSince(value) {
|
|
1684
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
1685
|
+
const lists = ["added", "changed", "removed"].map((k) => value[k]);
|
|
1686
|
+
if (!lists.some(Array.isArray)) return void 0;
|
|
1687
|
+
return new Set(
|
|
1688
|
+
lists.flatMap(
|
|
1689
|
+
(l) => Array.isArray(l) ? l.flatMap((v) => {
|
|
1690
|
+
const key = typeof v === "string" ? v : v?.key ?? v?.id;
|
|
1691
|
+
return typeof key === "string" && key ? [key] : [];
|
|
1692
|
+
}) : []
|
|
1693
|
+
)
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
function parseSiblings(value) {
|
|
1697
|
+
if (!Array.isArray(value)) return void 0;
|
|
1698
|
+
const str = (v) => typeof v === "string" && v ? v : void 0;
|
|
1699
|
+
return value.flatMap((v) => {
|
|
1700
|
+
const id = str(v?.id);
|
|
1701
|
+
const track = str(v?.track) ?? id?.split("/")[1];
|
|
1702
|
+
const status = str(v?.status);
|
|
1703
|
+
if (!id || !track || !status) return [];
|
|
1704
|
+
const commit = str(v.commit);
|
|
1705
|
+
const branch = str(v.branch);
|
|
1706
|
+
const inMain = str(v.in_main_at);
|
|
1707
|
+
return [
|
|
1708
|
+
{
|
|
1709
|
+
id,
|
|
1710
|
+
track,
|
|
1711
|
+
status,
|
|
1712
|
+
...commit ? { commit } : {},
|
|
1713
|
+
...branch ? { branch } : {},
|
|
1714
|
+
...inMain ? { in_main_at: inMain } : {}
|
|
1715
|
+
}
|
|
1716
|
+
];
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1596
1719
|
function startFrom(track, after2) {
|
|
1597
1720
|
if (!Array.isArray(after2)) return [];
|
|
1598
1721
|
const out = [];
|
|
@@ -1903,6 +2026,26 @@ function reachOf(x, id, kind, changed) {
|
|
|
1903
2026
|
screens: screens.map((s) => piece(s.id, s.title))
|
|
1904
2027
|
};
|
|
1905
2028
|
}
|
|
2029
|
+
function compatibilityOf(x, change, work, proposal) {
|
|
2030
|
+
const text = compatibilityText(sectionText(x, x.sectionShard(proposal, COMPATIBILITY_SECTION)));
|
|
2031
|
+
const crosses = (owner, ownerChange, a) => a.change !== ownerChange && a.track !== owner.track;
|
|
2032
|
+
const endedBy = x.work.changes.flatMap(
|
|
2033
|
+
(other) => (other.tasks ?? []).filter((t) => t.after.some((a) => a.change === change.id && crosses(t, other.id, a))).map((t) => `${other.id}/${t.track}`)
|
|
2034
|
+
);
|
|
2035
|
+
const kept = text ? { text, tracks: (change.tasks ?? []).filter((t) => t.track !== "BE").map((t) => t.track), endedBy } : void 0;
|
|
2036
|
+
const byChange = /* @__PURE__ */ new Map();
|
|
2037
|
+
for (const a of work.after)
|
|
2038
|
+
if (crosses(work, change.id, a)) byChange.set(a.change, [...byChange.get(a.change) ?? [], a.track]);
|
|
2039
|
+
const ends = [...byChange].map(([c, tracks]) => ({ change: c, tracks }));
|
|
2040
|
+
return kept || ends.length ? { compatibility: { ...kept ? { kept } : {}, ...ends.length ? { ends } : {} } } : {};
|
|
2041
|
+
}
|
|
2042
|
+
function removedByOf(x, change, key) {
|
|
2043
|
+
if (x.sources.has(key)) return {};
|
|
2044
|
+
const h = history(x, key);
|
|
2045
|
+
const at = h.findIndex((e) => e.change === change);
|
|
2046
|
+
const gone = h.slice(at + 1).reverse().find((e) => e.entry.exported.before && !e.entry.exported.after);
|
|
2047
|
+
return gone && gone.change !== change ? { removedBy: gone.change } : {};
|
|
2048
|
+
}
|
|
1906
2049
|
function taskContext(current, task, exportDir2, state = {}, questions, opts = {}) {
|
|
1907
2050
|
const x = pinnedReader(current, task.change);
|
|
1908
2051
|
const at = (path) => opts.pins && x.isPinned(path) ? `${opts.pins}/${path}` : path;
|
|
@@ -1914,10 +2057,10 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1914
2057
|
};
|
|
1915
2058
|
const change = x.work.changes.find((c) => c.id === task.change);
|
|
1916
2059
|
if (!change) throw new ContextError(`${task.change} is not in this export's work.json: pull the export.`);
|
|
1917
|
-
const work = change.tasks.find((t) => t.track === task.track);
|
|
2060
|
+
const work = (change.tasks ?? []).find((t) => t.track === task.track);
|
|
1918
2061
|
if (!work)
|
|
1919
2062
|
throw new ContextError(
|
|
1920
|
-
`${task.change} has no task on ${task.track}: its tracks are ${change.tasks.map((t) => t.track).join(", ") || "none"}.`
|
|
2063
|
+
`${task.change} has no task on ${task.track}: its tracks are ${(change.tasks ?? []).map((t) => t.track).join(", ") || "none"}.`
|
|
1921
2064
|
);
|
|
1922
2065
|
const track = x.work.tracks.find((t) => t.code === task.track);
|
|
1923
2066
|
const proposal = x.proposalPath(task.change);
|
|
@@ -1944,6 +2087,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1944
2087
|
...words2.summary ? { summary: words2.summary } : {},
|
|
1945
2088
|
...words2.weight === void 0 ? {} : { weight: words2.weight },
|
|
1946
2089
|
...questions ? { questions } : {},
|
|
2090
|
+
...questions && state.questionsFull ? { questionsFull: [...state.questionsFull].sort() } : {},
|
|
1947
2091
|
...state.answers?.length ? { answers: state.answers } : {},
|
|
1948
2092
|
...items ? {
|
|
1949
2093
|
checklist: {
|
|
@@ -1955,7 +2099,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1955
2099
|
what: itemWhat(x, item, entries.get(itemObject(item)), task.track),
|
|
1956
2100
|
...covered ? { covered } : {},
|
|
1957
2101
|
...weight === void 0 ? {} : { weight },
|
|
1958
|
-
...labelOf(item) ? { label: labelOf(item) } : {}
|
|
2102
|
+
...labelOf(item) ? { label: labelOf(item) } : {},
|
|
2103
|
+
...weight === 0 ? removedByOf(current, task.change, itemObject(item)) : {}
|
|
1959
2104
|
};
|
|
1960
2105
|
}),
|
|
1961
2106
|
known: state.covered !== void 0,
|
|
@@ -1973,6 +2118,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1973
2118
|
track,
|
|
1974
2119
|
after: work.after,
|
|
1975
2120
|
...state.startFrom?.length ? { startFrom: state.startFrom } : {},
|
|
2121
|
+
...state.siblings?.length ? { siblings: state.siblings } : {},
|
|
2122
|
+
...compatibilityOf(x, change, work, proposal),
|
|
1976
2123
|
proposal: {
|
|
1977
2124
|
path: proposal,
|
|
1978
2125
|
why: sectionText(x, x.sectionShard(proposal, "Why")),
|
|
@@ -2019,8 +2166,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
2019
2166
|
const idOf2 = (c) => c.slice(4).split(/\s/)[0];
|
|
2020
2167
|
const listed = onList ? chunks.filter((c) => onList.has(idOf2(c))) : chunks;
|
|
2021
2168
|
written2.push(...listed);
|
|
2022
|
-
const
|
|
2023
|
-
const added2 = listed.length -
|
|
2169
|
+
const kept2 = onList ? listed.filter((c) => existed.has(idOf2(c))) : chunks;
|
|
2170
|
+
const added2 = listed.length - kept2.length;
|
|
2024
2171
|
const title = titleOf(x, id);
|
|
2025
2172
|
const rest = [
|
|
2026
2173
|
added2 ? `${added2 === 1 ? "One new criterion is" : `${added2} new criteria are`} whole in its delta above.` : "",
|
|
@@ -2031,8 +2178,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
2031
2178
|
id,
|
|
2032
2179
|
path: at(path),
|
|
2033
2180
|
...title ? { title } : {},
|
|
2034
|
-
...
|
|
2035
|
-
...
|
|
2181
|
+
...kept2.length ? { text: kept2.join("").trim() } : {},
|
|
2182
|
+
...kept2.length && rest ? { rest } : {}
|
|
2036
2183
|
}
|
|
2037
2184
|
];
|
|
2038
2185
|
});
|
|
@@ -2166,9 +2313,9 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
2166
2313
|
);
|
|
2167
2314
|
lost2 = s.later.flatMap((l) => {
|
|
2168
2315
|
if (l.entry.binary) return [];
|
|
2169
|
-
const
|
|
2316
|
+
const kept2 = linesOf2(key, l.entry.exported.after ? l.entry.after : void 0);
|
|
2170
2317
|
const gone = [...linesOf2(key, l.entry.exported.before ? l.entry.before : void 0)].filter(
|
|
2171
|
-
(line) => wrote.includes(line) && !
|
|
2318
|
+
(line) => wrote.includes(line) && !kept2.has(line)
|
|
2172
2319
|
);
|
|
2173
2320
|
return gone.length ? [{ change: l.change, lines: gone }] : [];
|
|
2174
2321
|
});
|
|
@@ -2188,17 +2335,24 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
2188
2335
|
}
|
|
2189
2336
|
];
|
|
2190
2337
|
});
|
|
2191
|
-
|
|
2192
|
-
|
|
2338
|
+
const cited = state.changedSince;
|
|
2339
|
+
const kept = cited ? moved.filter((e) => e.entered || cited.has(e.key)) : moved;
|
|
2340
|
+
if (cited) {
|
|
2341
|
+
const elsewhere = moved.length - kept.length;
|
|
2342
|
+
if (elsewhere) ctx.sinceElsewhere = elsewhere;
|
|
2343
|
+
if (!kept.some((e) => !e.entered)) ctx.changedSinceNone = true;
|
|
2344
|
+
}
|
|
2345
|
+
if (kept.length) {
|
|
2346
|
+
ctx.changedSince = kept.sort(
|
|
2193
2347
|
(a, b) => Number(!!b.own) - Number(!!a.own) || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0)
|
|
2194
2348
|
);
|
|
2195
|
-
const touched = new Set(
|
|
2349
|
+
const touched = new Set(kept.flatMap((e) => e.changes.map((ch) => ch.id)));
|
|
2196
2350
|
ctx.later = x.work.changes.filter((c) => touched.has(c.id)).map((c) => {
|
|
2197
2351
|
const delta2 = x.proposalPath(c.id)?.replace(/proposal\.md$/, "delta.md");
|
|
2198
2352
|
return {
|
|
2199
2353
|
id: c.id,
|
|
2200
2354
|
title: c.title,
|
|
2201
|
-
...c.tasks.some((t) => t.track === task.track) ? { task: `${c.id}/${task.track}` } : {},
|
|
2355
|
+
...(c.tasks ?? []).some((t) => t.track === task.track) ? { task: `${c.id}/${task.track}` } : {},
|
|
2202
2356
|
...delta2 ? { delta: delta2 } : {}
|
|
2203
2357
|
};
|
|
2204
2358
|
});
|
|
@@ -2265,7 +2419,7 @@ function checklistSection(c) {
|
|
|
2265
2419
|
...list2.note ? ["", `Covered items unknown: ${list2.note}`] : [],
|
|
2266
2420
|
"",
|
|
2267
2421
|
...list2.items.map(
|
|
2268
|
-
(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)})` : ""}`
|
|
2422
|
+
(i) => `- [${i.weight === 0 ? "-" : i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : i.weight === 0 ? i.removedBy ? ` (w 0, removed by ${i.removedBy})` : " (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)})` : ""}`
|
|
2269
2423
|
)
|
|
2270
2424
|
);
|
|
2271
2425
|
}
|
|
@@ -2277,7 +2431,8 @@ function renderChecklist(c) {
|
|
|
2277
2431
|
"",
|
|
2278
2432
|
...c.summary ? [c.summary, ""] : [],
|
|
2279
2433
|
...c.weight === void 0 ? [] : [`Task weight ${c.weight} of 100.`, ""],
|
|
2280
|
-
...
|
|
2434
|
+
...shippedLines(c),
|
|
2435
|
+
...c.questions?.length ? questionsSection(c.questions, c.questionsFull ? new Set(c.questionsFull) : void 0) : [],
|
|
2281
2436
|
...c.answers?.length ? answersSection(c.answers) : [],
|
|
2282
2437
|
...checklistSection(c),
|
|
2283
2438
|
"",
|
|
@@ -2285,6 +2440,34 @@ function renderChecklist(c) {
|
|
|
2285
2440
|
];
|
|
2286
2441
|
return out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
2287
2442
|
}
|
|
2443
|
+
function shippedLines(c) {
|
|
2444
|
+
const out = [];
|
|
2445
|
+
const kept = c.compatibility?.kept;
|
|
2446
|
+
for (const s of c.siblings ?? []) {
|
|
2447
|
+
if (s.status === "done") {
|
|
2448
|
+
const where = [s.commit?.slice(0, 12), s.in_main_at ? "in main" : s.branch ?? "main"].filter(Boolean).join(", ");
|
|
2449
|
+
out.push(
|
|
2450
|
+
`**${s.track} has shipped this change** (${where})` + (kept ? ": the server keeps the old behaviour this change\u2019s Compatibility names until the other tracks\u2019 tasks are done (below)." : ": tests that check the behaviour it removes or changes are expected to fail until this task is done; updating them is part of this task."),
|
|
2451
|
+
""
|
|
2452
|
+
);
|
|
2453
|
+
} else if (s.status === "in_progress") out.push(`${s.track} is building this change now.`, "");
|
|
2454
|
+
}
|
|
2455
|
+
if (kept) {
|
|
2456
|
+
const ended = kept.endedBy.length ? `${kept.endedBy.join(", ")} ends it.` : "The change that ends it is not signed off yet.";
|
|
2457
|
+
out.push(
|
|
2458
|
+
c.track.kind === "backend" ? `**Compatibility**: ${kept.tracks.join(", ")} build this change too; the server keeps what the proposal\u2019s Compatibility says until their tasks are done. ${ended}` : `**Compatibility**: the server keeps the old behaviour (${c.change.id}\u2019s Compatibility) until this task is done. ${ended}`,
|
|
2459
|
+
"",
|
|
2460
|
+
kept.text,
|
|
2461
|
+
""
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
for (const e of c.compatibility?.ends ?? [])
|
|
2465
|
+
out.push(
|
|
2466
|
+
`**Ends a compatibility**: this task ends the compatibility ${e.change} kept for ${e.tracks.join(", ")}; it is available once their tasks are done. When to deploy it is the team\u2019s call: old app versions stay in use after a task is done.`,
|
|
2467
|
+
""
|
|
2468
|
+
);
|
|
2469
|
+
return out;
|
|
2470
|
+
}
|
|
2288
2471
|
function renderContext(c) {
|
|
2289
2472
|
const out = [
|
|
2290
2473
|
`# ${c.task}: ${c.title ?? c.change.title}`,
|
|
@@ -2310,8 +2493,9 @@ function renderContext(c) {
|
|
|
2310
2493
|
"",
|
|
2311
2494
|
`Start from ${c.startFrom.map((s) => `\`${s.branch}\` (${s.id}${s.commit ? ` done at ${s.commit.slice(0, 12)}` : ""})`).join(", then ")}, not from the main branch: the predecessor's work is pushed there and not merged yet (fetch it and base your branch on \`origin/${c.startFrom[c.startFrom.length - 1].branch}\`).`
|
|
2312
2495
|
);
|
|
2313
|
-
out.push("");
|
|
2314
|
-
if (c.questions?.length)
|
|
2496
|
+
out.push("", ...shippedLines(c));
|
|
2497
|
+
if (c.questions?.length)
|
|
2498
|
+
out.push(...questionsSection(c.questions, c.questionsFull ? new Set(c.questionsFull) : void 0));
|
|
2315
2499
|
if (c.answers?.length) out.push(...answersSection(c.answers));
|
|
2316
2500
|
out.push(...checklistSection(c));
|
|
2317
2501
|
out.push("", `## Why (${c.proposal.path})`, "", c.proposal.why || "(none written)");
|
|
@@ -2479,8 +2663,20 @@ function renderContext(c) {
|
|
|
2479
2663
|
""
|
|
2480
2664
|
);
|
|
2481
2665
|
}
|
|
2666
|
+
if (c.changedSinceNone && !movedSince.length)
|
|
2667
|
+
out.push(
|
|
2668
|
+
"## Changed since (other tasks\u2019 work)",
|
|
2669
|
+
"",
|
|
2670
|
+
`No part of this task changed (the dispatcher\u2019s list).${c.sinceElsewhere ? ` ${c.sinceElsewhere === 1 ? "One other object" : `${c.sinceElsewhere} other objects`} the brief names ${c.sinceElsewhere === 1 ? "was" : "were"}, in other tasks\u2019 work.` : ""}`,
|
|
2671
|
+
""
|
|
2672
|
+
);
|
|
2482
2673
|
if (c.changedSince?.length) {
|
|
2483
|
-
out.push("## Changed since (other tasks\u2019 work)", "");
|
|
2674
|
+
if (!(c.changedSinceNone && !movedSince.length)) out.push("## Changed since (other tasks\u2019 work)", "");
|
|
2675
|
+
if (c.sinceElsewhere && movedSince.length)
|
|
2676
|
+
out.push(
|
|
2677
|
+
`Only the objects this task cites (the dispatcher\u2019s list); ${c.sinceElsewhere === 1 ? "one other object" : `${c.sinceElsewhere} other objects`} the brief names ${c.sinceElsewhere === 1 ? "was" : "were"} changed in other tasks\u2019 work.`,
|
|
2678
|
+
""
|
|
2679
|
+
);
|
|
2484
2680
|
const names = (e) => `${e.key}${e.title ? ` ${e.title}` : ""}${e.own ? " (this task changes it)" : ""}`;
|
|
2485
2681
|
if (movedSince.length) {
|
|
2486
2682
|
out.push(
|
|
@@ -3354,7 +3550,7 @@ function lookup(x, opts) {
|
|
|
3354
3550
|
}
|
|
3355
3551
|
if (opts.item) add(opts.item);
|
|
3356
3552
|
if (!about.size && opts.task) {
|
|
3357
|
-
const task = x.work.changes.find((c) => c.id === opts.task.change)?.tasks
|
|
3553
|
+
const task = x.work.changes.find((c) => c.id === opts.task.change)?.tasks?.find((t) => t.track === opts.task.track);
|
|
3358
3554
|
for (const key of task?.objects ?? []) if (x.sources.has(key) && !key.startsWith("file:")) add(key);
|
|
3359
3555
|
}
|
|
3360
3556
|
const links = (id) => {
|
|
@@ -3780,6 +3976,9 @@ async function coveredState(loaded, task) {
|
|
|
3780
3976
|
const items = answer.items ?? [];
|
|
3781
3977
|
const answers = parseAnswers(answer.answers);
|
|
3782
3978
|
const from = startFrom(task.track, answer.after);
|
|
3979
|
+
const siblings = parseSiblings(answer.siblings);
|
|
3980
|
+
const questionsFull = parseQuestionsFull(answer.questions_full);
|
|
3981
|
+
const changedSince = parseChangedSince(answer.changed_since);
|
|
3783
3982
|
return {
|
|
3784
3983
|
covered: new Map(items.flatMap((i) => i.covered_commit ? [[i.item, i.covered_commit]] : [])),
|
|
3785
3984
|
// The dispatcher's list is the checklist: its first item list stands (its spec, section 9), so the brief and
|
|
@@ -3792,7 +3991,10 @@ async function coveredState(loaded, task) {
|
|
|
3792
3991
|
}))
|
|
3793
3992
|
} : {},
|
|
3794
3993
|
...answers ? { answers } : {},
|
|
3795
|
-
...from.length ? { startFrom: from } : {}
|
|
3994
|
+
...from.length ? { startFrom: from } : {},
|
|
3995
|
+
...siblings?.length ? { siblings } : {},
|
|
3996
|
+
...questionsFull ? { questionsFull } : {},
|
|
3997
|
+
...changedSince ? { changedSince } : {}
|
|
3796
3998
|
};
|
|
3797
3999
|
} catch (e) {
|
|
3798
4000
|
return { unknown: e.message.split("\n")[0] };
|
|
@@ -4030,9 +4232,17 @@ program.command("cites").description("check that every reference is an ID or a p
|
|
|
4030
4232
|
`);
|
|
4031
4233
|
})
|
|
4032
4234
|
);
|
|
4033
|
-
program.command("questions").description(
|
|
4034
|
-
|
|
4235
|
+
program.command("questions").description(
|
|
4236
|
+
"print the questions the dispatcher keeps: some by number, a task\u2019s, or without either your own"
|
|
4237
|
+
).argument("[ref...]", "a task, e.g. CHG-012/BE, or questions by number, e.g. Q-12 Q-14").option("--open", "only the ones still open").option("--about <id...>", "everyone\u2019s questions that name these IDs").option("--json", "print them as JSON").action(
|
|
4238
|
+
run(async (refs, opts) => {
|
|
4239
|
+
const ids = refs.filter((r) => /^Q-\d+$/i.test(r)).map((r) => r.toUpperCase());
|
|
4240
|
+
const rest = refs.filter((r) => !/^Q-\d+$/i.test(r));
|
|
4241
|
+
if (rest.length > 1 || rest.length && ids.length)
|
|
4242
|
+
throw new Error("Name one task, or questions by number (Q-<n>), not both.");
|
|
4243
|
+
const id = rest[0];
|
|
4035
4244
|
const questions = await listQuestions(sessionOf(loadConfig()), {
|
|
4245
|
+
...ids.length ? { ids } : {},
|
|
4036
4246
|
...id ? { task: parseTask(id).id } : {},
|
|
4037
4247
|
...opts.about ? { about: opts.about } : {},
|
|
4038
4248
|
...opts.open ? { open: true } : {}
|