@bongos/core 1.19.302 → 1.19.304

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/.bongos-core.json CHANGED
@@ -2,22 +2,22 @@
2
2
  "artifact": "bongos-core",
3
3
  "manifest_schema": 1,
4
4
  "generator": "scripts/gds/package-core.js",
5
- "core_version": "1.19.302",
6
- "core_contract": "1.19.302",
7
- "source_commit": "d2bc099b7707a0e3e29c2b48b796bc95785d7c74",
5
+ "core_version": "1.19.304",
6
+ "core_contract": "1.19.304",
7
+ "source_commit": "8c22da0cc4ab95a1684933ef98112abb201bc850",
8
8
  "source_ref": "HEAD",
9
- "built_at": "2026-08-22T23:12:06.332Z",
9
+ "built_at": "2026-08-23T19:13:32.623Z",
10
10
  "redaction": {
11
11
  "model": "docs-redacted+functional-verbatim",
12
12
  "docs_redacted": 322,
13
13
  "agent_docs_stubbed": 22,
14
- "functional_verbatim": 1411,
14
+ "functional_verbatim": 1413,
15
15
  "rules": 3,
16
16
  "gate_literals": 3,
17
17
  "gate": "passed"
18
18
  },
19
- "file_count": 1755,
20
- "tree_sha256": "f1bb517fc8d0b3ac176f07c721aaa32bec280b6937905b78fdde9966e084d99e",
19
+ "file_count": 1757,
20
+ "tree_sha256": "644acfeea1c7e902934e366c56379f0191e6de8e08e6338567155722b916b2fd",
21
21
  "files": [
22
22
  {
23
23
  "path": ".claude/skills/blocker-review/SKILL.md",
@@ -172,7 +172,7 @@
172
172
  {
173
173
  "path": ".claude/skills/idea-triage/SKILL.md",
174
174
  "mode": "0000644",
175
- "sha256": "cbecde1c3fe60e02e6b008b80232e8866d7924aaefa9614377044dce5973d1d0"
175
+ "sha256": "b64fe42bb2a542304802b48bea348ae817608ac47f026d98c4de9bea5aa90174"
176
176
  },
177
177
  {
178
178
  "path": ".claude/skills/ideate/SKILL.md",
@@ -1557,7 +1557,7 @@
1557
1557
  {
1558
1558
  "path": "docs/file-map.md",
1559
1559
  "mode": "0000644",
1560
- "sha256": "dff7371d1874f3072213e8d094a26ca13c8e1d53a202b82445dc7cfcf47ad0b7"
1560
+ "sha256": "ffd052f893ea0ef47a65e66a6d260fd43c1ccc653fa277f11f13805099e73d45"
1561
1561
  },
1562
1562
  {
1563
1563
  "path": "docs/handoff-template.md",
@@ -4577,12 +4577,12 @@
4577
4577
  {
4578
4578
  "path": "package-lock.json",
4579
4579
  "mode": "0000644",
4580
- "sha256": "06de1a2274d6eafe7a544b7e0c1f157b42191eb0ad151d6e7f821180604d74bb"
4580
+ "sha256": "3f027a59178132ea747301cbcc78f7404c0f0ec820c6651affcf8854b1cf70f3"
4581
4581
  },
4582
4582
  {
4583
4583
  "path": "package.json",
4584
4584
  "mode": "0000644",
4585
- "sha256": "45ca3b2302b14730ce004fdc64f37ab82cc0dc85518c55c4c3119b85851ddf20"
4585
+ "sha256": "79d94ba55244fa52d3f8f35717803666064daecb4d91d5547060baaa2143692d"
4586
4586
  },
4587
4587
  {
4588
4588
  "path": "public-docs/index.html",
@@ -5037,7 +5037,7 @@
5037
5037
  {
5038
5038
  "path": "scripts/gds/capture.js",
5039
5039
  "mode": "0000644",
5040
- "sha256": "208bfd6c6a73f4234c06bb26e3319ec43ecf865927333bc810ca99efa9745e90"
5040
+ "sha256": "950a65cf4766f795622c6780dcfa9a1b3f9aefe38f406ec6759b129028958aa9"
5041
5041
  },
5042
5042
  {
5043
5043
  "path": "scripts/gds/cf-tunnel.js",
@@ -6237,7 +6237,7 @@
6237
6237
  {
6238
6238
  "path": "src/module-api.js",
6239
6239
  "mode": "0000644",
6240
- "sha256": "938f69ad6350189382990706f63b41c1781f9c7b19610d7275144152c65412d7"
6240
+ "sha256": "b8db1ca313e0156a5891a779be650f8c56069015529e064a18b8e4970e7e312f"
6241
6241
  },
6242
6242
  {
6243
6243
  "path": "src/module-loader/catalog.js",
@@ -7519,6 +7519,11 @@
7519
7519
  "mode": "0000644",
7520
7520
  "sha256": "ea992d1ab2ddedc27aaa5348a397356bef91a4c1ad9b295eb1a0ed1c4fc707e9"
7521
7521
  },
7522
+ {
7523
+ "path": "tests/idea_capture_grades.mjs",
7524
+ "mode": "0000644",
7525
+ "sha256": "fb129f6ee327d946ba2e7ee46bab3b9795621f7f405637e1e8ed2b29807a84cf"
7526
+ },
7522
7527
  {
7523
7528
  "path": "tests/idea_completeness.mjs",
7524
7529
  "mode": "0000644",
@@ -7614,6 +7619,11 @@
7614
7619
  "mode": "0000644",
7615
7620
  "sha256": "4e75030cf2320c2715c5e764394e9d56f66861712176261c878bc99183622b69"
7616
7621
  },
7622
+ {
7623
+ "path": "tests/idea_triage_recommends.mjs",
7624
+ "mode": "0000644",
7625
+ "sha256": "c7ba20839a7b33df0eb7e8bfc2f463217e7d3a538d888e89774107d55d34556d"
7626
+ },
7617
7627
  {
7618
7628
  "path": "tests/idp_device_exchange.mjs",
7619
7629
  "mode": "0000644",
@@ -134,6 +134,54 @@ Then ask the user (concise prompt — Lars is an EE, not a software engineer; fr
134
134
 
135
135
  > Idea #N: "{title}". {one-sentence developed summary}. **Open questions:** {the subagent's open_questions}. **Promote, discard, or merge with another idea?**
136
136
 
137
+ **Step 2.5 — for a FULL IDEA, work out its SHAPE and recommend one (task 1002925 / BV1.R149).**
138
+
139
+ Only for `grade='full'`. A quick idea promotes straight to a task — that is what a
140
+ quick idea is *for* — and a spark is not yours to convert at all (its author
141
+ offered it up for development, and promoting it discards that invitation).
142
+
143
+ **Why this step exists, in the owner's words:** *for ideators it is hard to say
144
+ what is a task or a goal, because it is often hard to have the full picture.* So a
145
+ Full Idea gets **thought about** at triage instead of being forced down a fixed
146
+ path. The person who wrote it was not required to know whether it was one task or
147
+ a quarter of work; that is the judgement triage adds.
148
+
149
+ **Three shapes it can take.** Read the five answers — especially *how does it fit*
150
+ — and decide which one it actually is:
151
+
152
+ | Shape | It looks like this | What you would create |
153
+ |---|---|---|
154
+ | **Goal** | several distinct pieces of work, or an outcome you would measure rather than finish; the "big picture" answer names more than one surface | a goal, plus **draft done-when criteria** taken from what the idea says "done" means |
155
+ | **Task** | one concrete change with an obvious end | a single task in whatever goal already owns that area |
156
+ | **Merge** | work that already exists — an open goal, a live task, or another idea says the same thing | nothing; point it at the existing record |
157
+
158
+ **Do the legwork before recommending.** A recommendation with nothing behind it is
159
+ worse than no recommendation, because it looks like an answer. Run
160
+ `/recall <the idea's subject>`, check the goal board
161
+ (`node scripts/gds/goal.js list`), and look for an existing task before proposing
162
+ anything new — "merge" is the recommendation people skip, and it is often the right
163
+ one.
164
+
165
+ **Then RECOMMEND, and show the reasoning.** Say which shape and *why*, name the
166
+ alternative you rejected and why, and — for a goal — sketch the criteria you would
167
+ draft. One short paragraph, not a report:
168
+
169
+ > Idea #N (Full, 84/100) — **I'd make this a goal.** Its "big picture" answer names
170
+ > three separate surfaces (the CLI, the hall, and the Discord mirror), so a single
171
+ > task would either be a month long or quietly deliver only one of them. Draft
172
+ > criteria: *(1) the CLI can do X; (2) the same is reachable in the hall; (3) the
173
+ > Discord path stops needing the old flag.* I considered a task in goal 1000071
174
+ > since the routing work overlaps, but this outlives that goal's scope.
175
+ > **Goal, task, or merge?**
176
+
177
+ **NOTHING CONVERTS UNTIL THEY ANSWER.** The recommendation is a recommendation:
178
+ do not create the goal, do not create the task, do not mark the idea promoted
179
+ until the human has chosen. If they pick a different shape than you recommended,
180
+ that is the step working — build what they chose, not what you argued for. (The
181
+ server backs this up at the capture end: a Full Idea never auto-routes,
182
+ `full_idea_never_routes` in `modules/ideas/routing.js`. This step is the same rule
183
+ at the triage end, where the judgement is.)
184
+
137
185
  **Step 3 — apply the verdict.**
138
186
 
139
187
  **Promote → pick the tier (BV1.R64 / ADR 0086).** An idea no longer only becomes a *task* — it can promote into any tier of the work hierarchy: a **goal** (a whole module-scoped workspace), a **criterion** (a new done-when test), or a **task** (a single unit of work). Choose by the idea's size: a broad objective → goal; a "we should also require X to be done" → criterion; a concrete piece of work → task. Frame the choice to the user in those terms, then create the right record and mark the idea promoted.
package/docs/file-map.md CHANGED
@@ -174,7 +174,7 @@
174
174
  │ ├── box.js ← (#598/ADR 0031) per-builder dev box lifecycle CLI: provision·park·wake·deprovision·sweep-idle·sweep-dormant·status (dry-run default, --apply to act; rank-gated)
175
175
  │ ├── smoke-box.sh ← (#598) hermetic box-lifecycle smoke (no DB/DO/network): runs tests/boxes.mjs + tests/cf_tunnel.mjs (#771 named tunnel) + route-rank + module-load
176
176
  │ ├── recall.js ← `/recall` CLI: two-call progressive-disclosure search (summary → `--expand <id>`) over Bongos retrieval layer (ADR 0060); `node scripts/gds/recall.js <query>`
177
- │ ├── capture.js ← file an idea_inbox row from the CLI (the ideas.capture kernel port); backs the "capture a tangent" flow across skills
177
+ │ ├── capture.js ← file an idea_inbox row from the CLI (the ideas.capture kernel port); backs the "capture a tangent" flow across skills. Task 1002927 / R151 taught it the GRADES: `--full --fields-file f.json` files a Full Idea, `--spark` is capture-then-mark (two requests — the route refuses a pre-marked capture), and after a plain quick capture it OFFERS to develop further. That offer is TTY-gated (`--no-prompt` too): capture.js is run by agents with no terminal and reads its body from stdin, so an unguarded prompt would hang every non-interactive caller
178
178
  │ ├── spark.js ← (tasks 1002920 / R144 + 1002921 / R145 + 1002922 / R146) the whole spark handoff from the terminal: mark one of your OWN quick ideas as a Big Idea Spark (`--undo` withdraws it), `--list` is the SPARK QUEUE, `--template` prints the five Full Idea fields, `--develop <id> --fields-file <json>` is the PICKUP (any builder; author + developer both recorded). Author-only server-side for the mark (it is the consent); its own command because sparking acts on an EXISTING idea, which is why capture.js refuses grade='spark'
179
179
  │ ├── worktree.js ← (task 1002809) junction-safe worktree add/remove/list — outside-repo worktrees get a node_modules junction via node (no shell quoting), removed BEFORE `git worktree remove`
180
180
  │ ├── learning-capture.js ← file a `learnings` row (DB-backed short-form rule capture, replacing hand-edited recipe files for a single gotcha)
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.302",
3
+ "version": "1.19.304",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.19.302",
9
+ "version": "1.19.304",
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "dependencies": {
12
12
  "express": "^4.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.302",
3
+ "version": "1.19.304",
4
4
  "description": "Cloud Bongos — the AI-first build platform core (GDS + platform surfaces + module system), installed as a versioned dependency (ADR 0108).",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "main": "src/platform-server.js",
@@ -7,7 +7,30 @@
7
7
  // [--kind feature] \
8
8
  // [--body-file path] \
9
9
  // [--version V1|PMS-V2|GDS-V3] \
10
- // [--priority N]
10
+ // [--priority N] \
11
+ // [--spark] \
12
+ // [--full --fields-file path.json] \
13
+ // [--no-prompt]
14
+ //
15
+ // THE GRADE AXIS (task 1002927 / BV1.R151, goal 1000062). Three grades exist and
16
+ // this CLI reaches all three, but NOT symmetrically, because they are not
17
+ // symmetrical acts:
18
+ // quick — the default. Title + body. Unchanged.
19
+ // full — `--full --fields-file f.json`, the five R141 fields. One request.
20
+ // spark — `--spark`, which is TWO requests: capture, then mark. The route
21
+ // deliberately REFUSES grade='spark' at capture (R144: an idea does not
22
+ // arrive pre-marked; sparking is the author's later act on an existing
23
+ // idea), and that invariant is not being worked around here — the
24
+ // author is simply performing both acts in one command, and the mark
25
+ // still goes through the author-only route that checks captured_by.
26
+ //
27
+ // THE POST-CAPTURE OFFER, and the one thing that must not break: after a plain
28
+ // quick capture, an interactive terminal is asked whether to develop the thought
29
+ // into a Full Idea. It is TTY-GATED. capture.js is run by agents and scripts with
30
+ // no terminal (and reads its BODY from stdin when --body-file is absent), so an
31
+ // unguarded prompt would hang every non-interactive caller. No TTY, or
32
+ // --no-prompt, means the offer never appears and the behaviour is exactly what it
33
+ // was before this task.
11
34
  //
12
35
  // Defaults:
13
36
  // --kind → server auto-classifies from title+body (keyword heuristics
@@ -27,7 +50,8 @@
27
50
  // Inbox now: 8 open
28
51
 
29
52
  const fs = require('node:fs/promises');
30
- const { cliClient, requireSession, arg } = require('./cli-lib');
53
+ const readline = require('node:readline');
54
+ const { cliClient, requireSession, arg, hasFlag } = require('./cli-lib');
31
55
 
32
56
 
33
57
  async function resolveDefaultVersion() {
@@ -59,12 +83,49 @@ function formatCaptureFailure(status, data) {
59
83
  return `capture failed (${status}): ${rendered}`;
60
84
  }
61
85
 
86
+ // DEFAULT IS NO, and only an explicit yes counts. Extracted so the done-when
87
+ // ("declinable in one keystroke") is a testable predicate rather than a regex
88
+ // buried in a readline callback: a bare Enter, a stray space, an EOF (null), or
89
+ // anything that is not y/yes all decline.
90
+ function acceptsOffer(answer) {
91
+ return /^y(es)?$/i.test(String(answer == null ? '' : answer).trim());
92
+ }
93
+
94
+ // The offer. DEFAULT IS NO: a bare Enter declines and leaves a plain quick idea,
95
+ // which is the done-when. It prints the command rather than launching an
96
+ // interactive five-field interview — the fields are prose, the terminal is a bad
97
+ // place to write five paragraphs, and the two surfaces built for it (the hall
98
+ // form and /ideate) are better at it than a readline loop would ever be. So the
99
+ // offer's job is to make the NEXT step obvious, not to become that step.
100
+ async function offerToDevelop(ideaId) {
101
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
102
+ try {
103
+ const answer = await new Promise((resolve) => {
104
+ rl.question('\nDevelop this into a Full Idea? It gets a completeness score and can earn on the ideator lane. [y/N] ', resolve);
105
+ });
106
+ if (!acceptsOffer(answer)) {
107
+ // Declined. Nothing further happens — the quick idea stands exactly as filed.
108
+ console.log('Left as a quick idea.');
109
+ return;
110
+ }
111
+ console.log('\nTwo ways to write it:');
112
+ console.log(` in the hall: /builders/ideas (a live completeness meter as you type)`);
113
+ console.log(` in the terminal: node scripts/gds/spark.js --template (then --fields-file)`);
114
+ console.log(`\nOr offer it up for someone else to develop:`);
115
+ console.log(` node scripts/gds/spark.js ${ideaId}`);
116
+ } finally {
117
+ rl.close();
118
+ }
119
+ }
120
+
62
121
  async function main() {
63
- await requireSession();
64
122
  const args = process.argv.slice(2);
65
123
  const title = args[0];
66
124
  if (!title || title.startsWith('--')) {
67
125
  console.error('usage: node scripts/gds/capture.js "title" [--kind feature] [--body-file path] [--version V1|PMS-V2] [--priority N]');
126
+ console.error(' ... [--spark] offer it up for someone else to develop');
127
+ console.error(' ... [--full --fields-file f.json] file a Full Idea (five fields; see spark.js --template)');
128
+ console.error(' ... [--no-prompt] never ask anything (default when not a terminal)');
68
129
  process.exit(2);
69
130
  }
70
131
 
@@ -72,6 +133,37 @@ async function main() {
72
133
  const bodyFile = arg('--body-file', args);
73
134
  const versionFromArg = arg('--version', args);
74
135
  const priorityStr = arg('--priority', args);
136
+ const wantSpark = hasFlag('--spark', args);
137
+ const wantFull = hasFlag('--full', args);
138
+ const fieldsFile = arg('--fields-file', args);
139
+ const noPrompt = hasFlag('--no-prompt', args);
140
+
141
+ // Refused rather than resolved: --spark and --full are contradictory requests
142
+ // (a spark is a thought offered up BECAUSE it is not developed), and silently
143
+ // picking one would file something the caller did not ask for.
144
+ if (wantSpark && wantFull) {
145
+ console.error('--spark and --full are contradictory: a spark is a thought you are NOT developing yet. Pick one.');
146
+ process.exit(2);
147
+ }
148
+ if (wantFull && !fieldsFile) {
149
+ console.error('--full needs --fields-file PATH (a JSON object of the five fields).');
150
+ console.error('Run: node scripts/gds/spark.js --template to see them.');
151
+ process.exit(2);
152
+ }
153
+ if (fieldsFile && !wantFull) {
154
+ console.error('--fields-file only means something with --full.');
155
+ process.exit(2);
156
+ }
157
+
158
+ let fieldValues = null;
159
+ if (wantFull) {
160
+ try {
161
+ fieldValues = JSON.parse(await fs.readFile(fieldsFile, 'utf8'));
162
+ } catch (err) {
163
+ console.error(`failed to read --fields-file as JSON: ${err.message}`);
164
+ process.exit(2);
165
+ }
166
+ }
75
167
 
76
168
  let bodyMd = '';
77
169
  if (bodyFile) {
@@ -93,6 +185,13 @@ async function main() {
93
185
  priority = p;
94
186
  }
95
187
 
188
+ // The session is demanded HERE, not at the top of main(): every exit above this
189
+ // line is an argument error, and answering "you are not signed in" to a mistyped
190
+ // flag sends the caller to /builder-reauth for a session that is fine — while a
191
+ // builder who is NOT signed in cannot read the usage block to find out how to
192
+ // sign in. resolveDefaultVersion() is the first call that actually needs a token.
193
+ await requireSession();
194
+
96
195
  const version = versionFromArg || (await resolveDefaultVersion());
97
196
 
98
197
  const payload = {
@@ -102,6 +201,12 @@ async function main() {
102
201
  suggested_priority: priority,
103
202
  };
104
203
  if (kindFromArg) payload.kind = kindFromArg;
204
+ if (wantFull) {
205
+ // The server validates these against the R141 declaration and scores them
206
+ // with R142 — this CLI sends them and states nothing about their shape.
207
+ payload.grade = 'full';
208
+ payload.field_values = fieldValues;
209
+ }
105
210
 
106
211
  const api = await cliClient();
107
212
  const r = await api.inbox.postInbox({ body: payload });
@@ -115,11 +220,48 @@ async function main() {
115
220
  const versionLabel = idea.suggested_version || 'none';
116
221
  const priorityLabel = idea.suggested_priority == null ? 'null' : `P${idea.suggested_priority}`;
117
222
 
223
+ const gradeLabel = idea.grade && idea.grade !== 'quick' ? `, grade=${idea.grade}` : '';
118
224
  console.log(
119
- `Captured idea #${idea.id}: kind=${kindLabel}, version=${versionLabel}, priority=${priorityLabel}`
225
+ `Captured idea #${idea.id}: kind=${kindLabel}, version=${versionLabel}, priority=${priorityLabel}${gradeLabel}`
120
226
  );
227
+ if (wantFull) {
228
+ // The server is the authority on whether the grade write landed: capture is
229
+ // FAIL-OPEN on grading (R143), so an idea can land as quick with a warning.
230
+ // Reporting what was ASKED for instead of what happened is how a builder
231
+ // ends up believing they filed a Full Idea when they did not.
232
+ if (idea.grade === 'full') {
233
+ const s = idea.completeness_score;
234
+ console.log(`Filed as a Full Idea — completeness ${Number.isInteger(s) ? `${s}/100` : 'unscored'}.`);
235
+ } else {
236
+ console.log('NOTE: stored as a QUICK idea — the grade could not be written. The text is safe; re-file the fields when you can.');
237
+ }
238
+ }
121
239
  console.log(`Inbox now: ${open_count} open`);
122
240
 
241
+ // --spark: capture, then MARK. Two requests by design, not a workaround — the
242
+ // capture route refuses grade='spark' (R144) because an idea does not arrive
243
+ // pre-marked, and the mark still goes through the author-only route.
244
+ if (wantSpark) {
245
+ const sp = await api.inbox.postInboxIdSpark({ id: idea.id, body: {} });
246
+ if (sp.ok) {
247
+ console.log('Marked as a Big Idea Spark — it is in the queue at /builders/ideas for someone to develop.');
248
+ } else {
249
+ // The idea is filed and that is the part that mattered. Say plainly that
250
+ // only the mark failed, and how to retry just the mark.
251
+ console.error(`Filed, but the spark mark failed (${sp.status}). The idea is safe; retry with:`);
252
+ console.error(` node scripts/gds/spark.js ${idea.id}`);
253
+ process.exitCode = 1;
254
+ }
255
+ return;
256
+ }
257
+
258
+ // THE POST-CAPTURE OFFER (the brief: "Claude asks if you would like to submit
259
+ // as a full idea after a quick idea is made"). Only for a plain quick capture,
260
+ // only at a real terminal, and declinable with a single Enter.
261
+ if (!wantFull && !noPrompt && process.stdin.isTTY && process.stdout.isTTY) {
262
+ await offerToDevelop(idea.id);
263
+ }
264
+
123
265
  // Migration detection lives only on the server now (POST /api/gds/tasks sets
124
266
  // tasks.needs_migration from the title/description on create — migration 081,
125
267
  // task 876). Ideas carry no touches[] and aren't tasks, so the old CLI-side
@@ -127,7 +269,7 @@ async function main() {
127
269
  // referred to; promotion to a task re-runs the detection automatically.
128
270
  }
129
271
 
130
- module.exports = { resolveDefaultVersion, formatCaptureFailure };
272
+ module.exports = { resolveDefaultVersion, formatCaptureFailure, acceptsOffer };
131
273
 
132
274
  if (require.main === module) {
133
275
  main().catch((err) => {
package/src/module-api.js CHANGED
@@ -1031,8 +1031,12 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
1031
1031
  // landed since 1.19.300 with no explicit bump. run 32602146266. (task 1002620)
1032
1032
  // 1.19.302 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1033
1033
  // landed since 1.19.301 with no explicit bump. run 32604538465. (task 1002620)
1034
+ // 1.19.303 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1035
+ // landed since 1.19.302 with no explicit bump. run 32605477232. (task 1002620)
1036
+ // 1.19.304 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1037
+ // landed since 1.19.303 with no explicit bump. run 32660527575. (task 1002620)
1034
1038
  // ---------------------------------------------------------------------------
1035
- const CORE_VERSION = '1.19.302'; // CI auto-patch carrier (ADR 0161); see changelog above
1039
+ const CORE_VERSION = '1.19.304'; // CI auto-patch carrier (ADR 0161); see changelog above
1036
1040
 
1037
1041
  // A namespaced logger so a module's log lines are attributable + consistent.
1038
1042
  // Usage: const log = api.logger('dev-box'); log.info('mounted');
@@ -0,0 +1,159 @@
1
+ // tests/idea_capture_grades.mjs
2
+ //
3
+ // task 1002927 (BV1.R151, goal 1000062) — capture.js learns the grades.
4
+ //
5
+ // The done-when: capture.js can file all three grades; the post-capture offer
6
+ // appears after a quick capture and is DECLINABLE IN ONE KEYSTROKE; declining
7
+ // leaves a plain quick idea.
8
+ //
9
+ // The riskiest part of this task is not the grades, it is the PROMPT. capture.js
10
+ // is run by agents and scripts with no terminal, and it already reads its body
11
+ // from stdin when --body-file is absent — so an unguarded question would hang
12
+ // every non-interactive caller, silently, forever. The TTY gate is therefore
13
+ // asserted twice: as a source invariant, and by actually running the process with
14
+ // piped stdin and watching it not hang.
15
+ //
16
+ // Run: node tests/idea_capture_grades.mjs
17
+
18
+ import { strict as assert } from 'node:assert';
19
+ import { createRequire } from 'node:module';
20
+ import { spawnSync } from 'node:child_process';
21
+ import fs from 'node:fs';
22
+ import path from 'node:path';
23
+ import { fileURLToPath } from 'node:url';
24
+
25
+ const require = createRequire(import.meta.url);
26
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
27
+ const CAPTURE = path.join(ROOT, 'scripts/gds/capture.js');
28
+ const SRC = fs.readFileSync(CAPTURE, 'utf8');
29
+ const { acceptsOffer } = require('../scripts/gds/capture.js');
30
+
31
+ // Run capture.js as a real process with piped stdio. Every case below is refused
32
+ // by argument validation BEFORE any network call, so this needs no session.
33
+ function run(args, { input = '' } = {}) {
34
+ return spawnSync(process.execPath, [CAPTURE, ...args], {
35
+ input, encoding: 'utf8', timeout: 20000,
36
+ });
37
+ }
38
+
39
+ let passed = 0;
40
+ let failed = 0;
41
+ function test(name, fn) {
42
+ try { fn(); passed++; console.log(` ok ${name}`); }
43
+ catch (err) { failed++; console.error(` FAIL ${name}\n ${err.message}`); }
44
+ }
45
+
46
+ // --- declinable in ONE keystroke ----------------------------------------
47
+
48
+ test('a bare Enter declines — that is the one keystroke', () => {
49
+ assert.equal(acceptsOffer(''), false);
50
+ });
51
+
52
+ test('only an explicit yes accepts', () => {
53
+ for (const yes of ['y', 'Y', 'yes', 'YES', ' y ', 'Yes']) {
54
+ assert.equal(acceptsOffer(yes), true, JSON.stringify(yes));
55
+ }
56
+ for (const no of ['n', 'no', 'N', 'maybe', 'yep', 'ya', '1', 'ok']) {
57
+ assert.equal(acceptsOffer(no), false, JSON.stringify(no));
58
+ }
59
+ });
60
+
61
+ test('an EOF or a closed pipe declines rather than throwing', () => {
62
+ // readline resolves with undefined on EOF; treating that as a yes would drag a
63
+ // non-interactive caller into a flow it never asked for.
64
+ assert.equal(acceptsOffer(null), false);
65
+ assert.equal(acceptsOffer(undefined), false);
66
+ });
67
+
68
+ // --- the TTY gate --------------------------------------------------------
69
+
70
+ test('the offer is gated on a REAL terminal, both directions', () => {
71
+ assert.match(SRC, /process\.stdin\.isTTY/, 'stdin must be a terminal');
72
+ assert.match(SRC, /process\.stdout\.isTTY/, 'and stdout, or the question goes into a pipe unseen');
73
+ });
74
+
75
+ test('the offer is skipped for a Full Idea capture and by --no-prompt', () => {
76
+ // Asking "develop this into a Full Idea?" right after someone filed one would
77
+ // be absurd; --no-prompt is the explicit opt-out for a caller that has a TTY
78
+ // but does not want to be asked.
79
+ assert.match(SRC, /if \(!wantFull && !noPrompt && process\.stdin\.isTTY/);
80
+ });
81
+
82
+ test('running with PIPED stdin does not hang or prompt', () => {
83
+ // The real regression this guards: a prompt with no TTY blocks forever. These
84
+ // args are refused at validation, which is enough to prove the process exits.
85
+ const r = run(['a title', '--spark', '--full'], { input: '' });
86
+ assert.equal(r.status, 2, `exited cleanly (signal=${r.signal})`);
87
+ assert.equal(r.signal, null, 'not killed by the timeout');
88
+ assert.doesNotMatch(String(r.stdout), /Develop this into a Full Idea\?/);
89
+ });
90
+
91
+ // --- all three grades reachable -----------------------------------------
92
+
93
+ test('--full requires the five fields, and says where to find them', () => {
94
+ const r = run(['a title', '--full']);
95
+ assert.equal(r.status, 2);
96
+ assert.match(r.stderr, /--full needs --fields-file/);
97
+ assert.match(r.stderr, /spark\.js --template/, 'it points at the thing that prints the fields');
98
+ });
99
+
100
+ test('--fields-file without --full is refused rather than silently ignored', () => {
101
+ const r = run(['a title', '--fields-file', '/tmp/nope.json']);
102
+ assert.equal(r.status, 2);
103
+ assert.match(r.stderr, /only means something with --full/);
104
+ });
105
+
106
+ test('--spark and --full are refused together, with the reason', () => {
107
+ const r = run(['a title', '--spark', '--full']);
108
+ assert.equal(r.status, 2);
109
+ assert.match(r.stderr, /contradictory/);
110
+ // The reason matters: it is not an arbitrary exclusion, a spark is BY DEFINITION
111
+ // a thought you are not developing yet.
112
+ assert.match(r.stderr, /NOT developing yet/);
113
+ });
114
+
115
+ test('an unreadable --fields-file fails before any capture', () => {
116
+ const r = run(['a title', '--full', '--fields-file', '/tmp/definitely-not-here.json']);
117
+ assert.equal(r.status, 2);
118
+ assert.match(r.stderr, /failed to read --fields-file as JSON/);
119
+ });
120
+
121
+ test('--spark is capture-then-MARK, not a pre-marked capture', () => {
122
+ // The route refuses grade='spark' at capture (R144: an idea does not arrive
123
+ // pre-marked), and this CLI does not work around that — it performs the second
124
+ // act through the author-only mark route.
125
+ assert.match(SRC, /postInboxIdSpark/, 'it calls the mark route');
126
+ // Asserted over the PAYLOAD ASSIGNMENT, not over the file text: the file
127
+ // explains the rule in prose, and forbidding the string anywhere would fail on
128
+ // the comment that documents why the rule exists. (Fourth time this session an
129
+ // "absent from the source" assertion needed narrowing to what it meant —
130
+ // learning 1000196.)
131
+ const assignments = [...SRC.matchAll(/payload\.grade\s*=\s*'([a-z]+)'/g)].map((m) => m[1]);
132
+ assert.deepEqual(assignments, ['full'], 'the only grade this CLI ever sends at capture is full');
133
+ });
134
+
135
+ test('a full capture reports what the SERVER stored, not what was asked for', () => {
136
+ // Capture is fail-open on grading (R143): the idea can land as quick with a
137
+ // warning. Reporting the request is how someone believes they filed a Full Idea
138
+ // when they did not.
139
+ assert.match(SRC, /idea\.grade === 'full'/);
140
+ assert.match(SRC, /stored as a QUICK idea/);
141
+ });
142
+
143
+ test('a failed spark mark still reports the idea as safe, and how to retry', () => {
144
+ // The capture already committed; losing the mark must not read as losing the
145
+ // thought.
146
+ assert.match(SRC, /the idea is safe|The idea is safe/);
147
+ assert.match(SRC, /spark\.js \$\{idea\.id\}/, 'it prints the exact retry command');
148
+ });
149
+
150
+ test('usage names all three grades', () => {
151
+ const r = run([]);
152
+ assert.equal(r.status, 2);
153
+ for (const flag of ['--spark', '--full', '--no-prompt']) {
154
+ assert.ok(r.stderr.includes(flag), `usage mentions ${flag}`);
155
+ }
156
+ });
157
+
158
+ console.log(`\nidea_capture_grades: ${passed} passed, ${failed} failed`);
159
+ if (failed > 0) process.exit(1);
@@ -0,0 +1,155 @@
1
+ // tests/idea_triage_recommends.mjs
2
+ //
3
+ // task 1002925 (BV1.R149, goal 1000062) — a Full Idea's SHAPE is recommended, not
4
+ // decided for the builder.
5
+ //
6
+ // The done-when: "triage presents a recommendation plus its reasoning; the human
7
+ // decides; nothing converts without that decision."
8
+ //
9
+ // Two halves, and they live in different places:
10
+ // • the SERVER half already exists and is enforced — a Full Idea never
11
+ // auto-routes at capture (routing.js). This file re-asserts it, because R149's
12
+ // rule is meaningless if the row can convert itself before triage ever sees
13
+ // it, and an invariant relied on by a prompt should be pinned next to that
14
+ // prompt's test too.
15
+ // • the TRIAGE half is a prompt, so what is checkable is the CONTRACT: a
16
+ // recommendation is required to carry reasoning, the three shapes are named,
17
+ // the legwork is required before recommending, and nothing converts until the
18
+ // human answers.
19
+ //
20
+ // Prose assertions run against a whitespace-normalised copy — markdown is
21
+ // hard-wrapped, and a phrase worth asserting will straddle a newline.
22
+ //
23
+ // Run: node tests/idea_triage_recommends.mjs
24
+
25
+ import { strict as assert } from 'node:assert';
26
+ import { createRequire } from 'node:module';
27
+ import fs from 'node:fs';
28
+ import path from 'node:path';
29
+ import { fileURLToPath } from 'node:url';
30
+
31
+ const require = createRequire(import.meta.url);
32
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
33
+ const SKILL = fs.readFileSync(path.join(ROOT, '.claude/skills/idea-triage/SKILL.md'), 'utf8');
34
+ const NORM = SKILL.replace(/\s+/g, ' ');
35
+ const { decideLanding } = require('../modules/ideas/routing.js');
36
+
37
+ let passed = 0;
38
+ let failed = 0;
39
+ function test(name, fn) {
40
+ try { fn(); passed++; console.log(` ok ${name}`); }
41
+ catch (err) { failed++; console.error(` FAIL ${name}\n ${err.message}`); }
42
+ }
43
+
44
+ // --- the server half: it cannot convert itself before triage looks -------
45
+
46
+ test('a Full Idea never auto-routes, whatever else is true of it', () => {
47
+ // R149's whole premise is that a human judges the shape. If capture-time
48
+ // routing could turn a Full Idea into a task, that judgement would arrive too
49
+ // late to matter.
50
+ for (const grade of ['full', 'FULL', 'Full']) {
51
+ const d = decideLanding({ goalId: 1000062, kind: 'feature', grade, filerRank: 'archon' });
52
+ assert.equal(d.route, false, `grade ${grade}`);
53
+ assert.equal(d.reason, 'full_idea_never_routes');
54
+ }
55
+ });
56
+
57
+ test('and a quick idea still routes — R149 is not a brake on everything', () => {
58
+ // The contrast is the point: quick ideas promoting straight through is what a
59
+ // quick idea is FOR, and slowing that down would be a regression dressed as care.
60
+ const d = decideLanding({ goalId: 1000062, kind: 'bug', grade: 'quick', filerRank: 'archon' });
61
+ assert.equal(d.route, true);
62
+ });
63
+
64
+ // --- the triage half: recommend, with reasoning --------------------------
65
+
66
+ test('the step is scoped to a Full Idea, and says what the other grades do', () => {
67
+ assert.match(NORM, /Only for `grade='full'`/);
68
+ assert.match(NORM, /quick idea promotes straight to a task/);
69
+ // A spark is not triage's to convert: promoting it discards its author's offer.
70
+ assert.match(NORM, /discards that invitation/);
71
+ });
72
+
73
+ test('it carries the owner\'s REASON, not just the instruction', () => {
74
+ // Without the why, "recommend instead of convert" reads as ceremony and gets
75
+ // optimised away by the next person trying to make triage faster.
76
+ assert.match(NORM, /hard to say what is a task or a goal/);
77
+ assert.match(NORM, /full picture/);
78
+ });
79
+
80
+ test('all three shapes are named — including MERGE', () => {
81
+ assert.match(NORM, /\*\*Goal\*\*/);
82
+ assert.match(NORM, /\*\*Task\*\*/);
83
+ assert.match(NORM, /\*\*Merge\*\*/);
84
+ // Merge is the one people skip, and it is often right.
85
+ assert.match(NORM, /"merge" is the recommendation people skip/);
86
+ });
87
+
88
+ test('a goal recommendation drafts criteria rather than just naming the tier', () => {
89
+ assert.match(NORM, /draft.{0,4}done-when criteria/i);
90
+ });
91
+
92
+ test('the legwork is REQUIRED before recommending', () => {
93
+ // A recommendation with nothing behind it is worse than none, because it looks
94
+ // like an answer.
95
+ assert.match(NORM, /worse than no recommendation/);
96
+ assert.match(NORM, /\/recall/);
97
+ assert.match(NORM, /goal\.js list/);
98
+ });
99
+
100
+ test('the reasoning must include the REJECTED alternative', () => {
101
+ // "I recommend a goal" is an assertion; "a task would deliver only one of the
102
+ // three surfaces" is a reason someone can disagree with.
103
+ assert.match(NORM, /name the alternative you rejected/i);
104
+ });
105
+
106
+ // --- nothing converts without the human ---------------------------------
107
+
108
+ test('the no-convert rule is stated absolutely, and enumerated', () => {
109
+ assert.match(NORM, /NOTHING CONVERTS UNTIL THEY ANSWER/);
110
+ // Enumerated because "do not convert" is vague about the three separate writes
111
+ // an eager agent might make.
112
+ assert.match(NORM, /do not create the goal, do not create the task, do not mark the idea promoted/);
113
+ });
114
+
115
+ test('a human choosing differently is framed as the step WORKING', () => {
116
+ // Otherwise the recommendation becomes something to defend, and the next turn
117
+ // is an argument instead of a build.
118
+ assert.match(NORM, /that is the step working/);
119
+ assert.match(NORM, /build what they chose, not what you argued for/);
120
+ });
121
+
122
+ test('it names the server invariant it leans on', () => {
123
+ // So the next reader knows the two halves are one rule in two places, and does
124
+ // not "simplify" either half away believing the other covers it.
125
+ assert.match(NORM, /full_idea_never_routes/);
126
+ });
127
+
128
+ // --- it does not restate the template ----------------------------------
129
+
130
+ test('the skill restates no field label, and no key as a code identifier', () => {
131
+ const { BASE_TEMPLATE } = require('../modules/ideas/templates.js');
132
+ // LABELS are checked over the whole file: they are distinctive canonical
133
+ // question text, so any occurrence is a restatement.
134
+ for (const f of BASE_TEMPLATE.fields) {
135
+ assert.ok(!SKILL.includes(f.label), `restates the label "${f.label}"`);
136
+ }
137
+ // KEYS are checked only inside CODE — backticks and fenced blocks. One of them
138
+ // is `fit`, an ordinary English word, and this skill legitimately says "how does
139
+ // it fit" in prose. What would actually be a forked template is a key written as
140
+ // an identifier: a hard-coded field list, a JSON example, a payload sketch. So
141
+ // the assertion follows the meaning rather than the substring.
142
+ const code = [
143
+ ...[...SKILL.matchAll(/```[\s\S]*?```/g)].map((m) => m[0]),
144
+ ...[...SKILL.matchAll(/`([^`\n]+)`/g)].map((m) => m[1]),
145
+ ].join('\n');
146
+ for (const f of BASE_TEMPLATE.fields) {
147
+ assert.ok(
148
+ !new RegExp(`\\b${f.key}\\b`).test(code),
149
+ `the key "${f.key}" appears as a code identifier — the template is being restated`,
150
+ );
151
+ }
152
+ });
153
+
154
+ console.log(`\nidea_triage_recommends: ${passed} passed, ${failed} failed`);
155
+ if (failed > 0) process.exit(1);