@ozzylabs/feedradar 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/dismiss.d.ts +2 -1
- package/dist/cli/dismiss.d.ts.map +1 -1
- package/dist/cli/dismiss.js +4 -1
- package/dist/cli/dismiss.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +7 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/items.d.ts +44 -0
- package/dist/cli/items.d.ts.map +1 -0
- package/dist/cli/items.js +288 -0
- package/dist/cli/items.js.map +1 -0
- package/dist/cli/research.d.ts +21 -0
- package/dist/cli/research.d.ts.map +1 -1
- package/dist/cli/research.js +54 -10
- package/dist/cli/research.js.map +1 -1
- package/dist/cli/review.d.ts +23 -0
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +293 -2
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/source.d.ts.map +1 -1
- package/dist/cli/source.js +3 -0
- package/dist/cli/source.js.map +1 -1
- package/dist/cli/triage.d.ts +136 -0
- package/dist/cli/triage.d.ts.map +1 -0
- package/dist/cli/triage.js +1110 -0
- package/dist/cli/triage.js.map +1 -0
- package/dist/cli/undismiss.d.ts +30 -0
- package/dist/cli/undismiss.d.ts.map +1 -0
- package/dist/cli/undismiss.js +133 -0
- package/dist/cli/undismiss.js.map +1 -0
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +2 -0
- package/dist/cli/watch.js.map +1 -1
- package/dist/cli/workflow/generate-combined-with-triage.d.ts +115 -0
- package/dist/cli/workflow/generate-combined-with-triage.d.ts.map +1 -0
- package/dist/cli/workflow/generate-combined-with-triage.js +446 -0
- package/dist/cli/workflow/generate-combined-with-triage.js.map +1 -0
- package/dist/cli/workflow.d.ts +6 -5
- package/dist/cli/workflow.d.ts.map +1 -1
- package/dist/cli/workflow.js +13 -8
- package/dist/cli/workflow.js.map +1 -1
- package/dist/core/feeds/json-api.d.ts +26 -0
- package/dist/core/feeds/json-api.d.ts.map +1 -1
- package/dist/core/feeds/json-api.js +360 -223
- package/dist/core/feeds/json-api.js.map +1 -1
- package/dist/core/recipes.d.ts.map +1 -1
- package/dist/core/recipes.js +10 -0
- package/dist/core/recipes.js.map +1 -1
- package/dist/core/transitions.d.ts +30 -0
- package/dist/core/transitions.d.ts.map +1 -0
- package/dist/core/transitions.js +103 -0
- package/dist/core/transitions.js.map +1 -0
- package/dist/core/triage/adapter.d.ts +80 -0
- package/dist/core/triage/adapter.d.ts.map +1 -0
- package/dist/core/triage/adapter.js +128 -0
- package/dist/core/triage/adapter.js.map +1 -0
- package/dist/core/triage/index.d.ts +105 -0
- package/dist/core/triage/index.d.ts.map +1 -0
- package/dist/core/triage/index.js +246 -0
- package/dist/core/triage/index.js.map +1 -0
- package/dist/core/triage/prompt.d.ts +30 -0
- package/dist/core/triage/prompt.d.ts.map +1 -0
- package/dist/core/triage/prompt.js +157 -0
- package/dist/core/triage/prompt.js.map +1 -0
- package/dist/core/triage/response.d.ts +114 -0
- package/dist/core/triage/response.d.ts.map +1 -0
- package/dist/core/triage/response.js +188 -0
- package/dist/core/triage/response.js.map +1 -0
- package/dist/recipes/aws-whats-new.yaml +62 -7
- package/dist/recipes/dev-to.yaml +24 -0
- package/dist/schemas/item.d.ts +151 -5
- package/dist/schemas/item.d.ts.map +1 -1
- package/dist/schemas/item.js +164 -4
- package/dist/schemas/item.js.map +1 -1
- package/dist/schemas/recipe.d.ts +22 -0
- package/dist/schemas/recipe.d.ts.map +1 -1
- package/dist/schemas/recipe.js +13 -1
- package/dist/schemas/recipe.js.map +1 -1
- package/dist/schemas/source.d.ts +135 -0
- package/dist/schemas/source.d.ts.map +1 -1
- package/dist/schemas/source.js +138 -0
- package/dist/schemas/source.js.map +1 -1
- package/dist/templates/agents/AGENTS.md +36 -4
- package/dist/templates/workflows/combined-with-triage.template.yaml.tmpl +133 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ npm i -g playwright
|
|
|
32
32
|
npx playwright install chromium
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Run `radar doctor` to verify Playwright / Chromium are detected before adding an `html-js` source. CI setup details and a sample workflow are in [
|
|
35
|
+
Run `radar doctor` to verify Playwright / Chromium are detected before adding an `html-js` source. CI setup details and a sample workflow are in [the user-guide's `--kind html-js` → CI section](./docs/user-guide.md#ci-で使う) (the user-guide is Japanese-only today, so the anchor stays as-is).
|
|
36
36
|
|
|
37
37
|
While developing locally, clone this repo and run `pnpm install && pnpm run build` to produce `dist/index.js`, then invoke `node dist/index.js <command>`.
|
|
38
38
|
|
package/dist/cli/dismiss.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export interface DismissCommandOptions {
|
|
|
20
20
|
* 1. Parse + validate args.
|
|
21
21
|
* 2. Locate `items/<sourceId>/<item-id>.yaml`.
|
|
22
22
|
* 3. Reject if the item is not in `detected` (terminal/researched states
|
|
23
|
-
* cannot be dismissed;
|
|
23
|
+
* cannot be dismissed; `dismissed` itself is reversed via `radar
|
|
24
|
+
* undismiss` — ADR-0018 §W6).
|
|
24
25
|
* 4. Write back with `status: dismissed`.
|
|
25
26
|
*/
|
|
26
27
|
export declare function runDismiss(args: string[], options?: DismissCommandOptions): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dismiss.d.ts","sourceRoot":"","sources":["../../src/cli/dismiss.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wFAAwF;AACxF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"dismiss.d.ts","sourceRoot":"","sources":["../../src/cli/dismiss.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wFAAwF;AACxF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;AAgED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAgDjB;AAED,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC"}
|
package/dist/cli/dismiss.js
CHANGED
|
@@ -28,6 +28,8 @@ function printHelp(log) {
|
|
|
28
28
|
log("");
|
|
29
29
|
log("Transitions the item's status from `detected` to `dismissed` (ADR-0008).");
|
|
30
30
|
log("Items already in `researched`, `reviewed`, or `dismissed` cannot be dismissed.");
|
|
31
|
+
log("");
|
|
32
|
+
log("Inverse: `radar undismiss <item-id> [--force]` (ADR-0018 §W6).");
|
|
31
33
|
}
|
|
32
34
|
async function pathExists(p) {
|
|
33
35
|
try {
|
|
@@ -67,7 +69,8 @@ async function findItem(cwd, itemId) {
|
|
|
67
69
|
* 1. Parse + validate args.
|
|
68
70
|
* 2. Locate `items/<sourceId>/<item-id>.yaml`.
|
|
69
71
|
* 3. Reject if the item is not in `detected` (terminal/researched states
|
|
70
|
-
* cannot be dismissed;
|
|
72
|
+
* cannot be dismissed; `dismissed` itself is reversed via `radar
|
|
73
|
+
* undismiss` — ADR-0018 §W6).
|
|
71
74
|
* 4. Write back with `status: dismissed`.
|
|
72
75
|
*/
|
|
73
76
|
export async function runDismiss(args, options = {}) {
|
package/dist/cli/dismiss.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dismiss.js","sourceRoot":"","sources":["../../src/cli/dismiss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAoBxD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YAChB,SAAS;QACX,CAAC;QACD,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,SAAS,CAAC,GAAwB;IACzC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,GAAG,CAAC,YAAY,CAAC,C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EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACvD,IAAI,CAAC;QACH,yEAAyE;QACzE,oEAAoE;QACpE,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,KAAK,CAAC,0CAA0C,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9F,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,CAAC,kBAAkB,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC3E,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAY;IACrC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,wDAAwD;IACjE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;CAChC,CAAC"}
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1C;AAwCD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBvD"}
|
package/dist/cli/index.js
CHANGED
|
@@ -4,9 +4,12 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import { dismissCommand } from "./dismiss.js";
|
|
5
5
|
import { doctorCommand } from "./doctor.js";
|
|
6
6
|
import { initCommand } from "./init.js";
|
|
7
|
+
import { itemsCommand } from "./items.js";
|
|
7
8
|
import { researchCommand } from "./research.js";
|
|
8
9
|
import { reviewCommand } from "./review.js";
|
|
9
10
|
import { sourceCommand } from "./source.js";
|
|
11
|
+
import { triageCommand } from "./triage.js";
|
|
12
|
+
import { undismissCommand } from "./undismiss.js";
|
|
10
13
|
import { updateCommand } from "./update.js";
|
|
11
14
|
import { watchCommand } from "./watch.js";
|
|
12
15
|
import { workflowCommand } from "./workflow.js";
|
|
@@ -15,7 +18,10 @@ const commands = [
|
|
|
15
18
|
sourceCommand,
|
|
16
19
|
watchCommand,
|
|
17
20
|
researchCommand,
|
|
21
|
+
triageCommand,
|
|
18
22
|
dismissCommand,
|
|
23
|
+
undismissCommand,
|
|
24
|
+
itemsCommand,
|
|
19
25
|
reviewCommand,
|
|
20
26
|
updateCommand,
|
|
21
27
|
doctorCommand,
|
|
@@ -35,7 +41,7 @@ function printHelp() {
|
|
|
35
41
|
console.log("");
|
|
36
42
|
console.log("Commands:");
|
|
37
43
|
for (const c of commands) {
|
|
38
|
-
console.log(` ${c.name.padEnd(
|
|
44
|
+
console.log(` ${c.name.padEnd(12)} ${c.summary}`);
|
|
39
45
|
}
|
|
40
46
|
console.log("");
|
|
41
47
|
console.log("Options:");
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C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Q,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,GAAG,CAAC,CAAC;QACnD,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Command } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* `radar items list` (ADR-0018 PR-3).
|
|
4
|
+
*
|
|
5
|
+
* Lists items from `items/` with composable filters. Designed both for
|
|
6
|
+
* humans (default tabular output) and for piping into workflow generators
|
|
7
|
+
* (`--json` / `--field`).
|
|
8
|
+
*
|
|
9
|
+
* Filter semantics:
|
|
10
|
+
*
|
|
11
|
+
* - `--status <status>`: exact match on `Item.status`. Multiple statuses
|
|
12
|
+
* are not supported; pipe through `grep -E` if needed.
|
|
13
|
+
* - `--source <id>`: matches `Item.sourceId`.
|
|
14
|
+
* - `--triage-group <name>`: matches `Item.triage.group`. Used by the
|
|
15
|
+
* digest workflow to gather every item in a group.
|
|
16
|
+
* - `--since <duration>`: cutoff in `Nd` / `Nh` form, applied to
|
|
17
|
+
* `publishedAt ?? fetchedAt`. Items older than the cutoff are dropped.
|
|
18
|
+
* - `--limit N`: caps result count after filtering.
|
|
19
|
+
*
|
|
20
|
+
* Output:
|
|
21
|
+
*
|
|
22
|
+
* - default: fixed-width table (id, status, source, publishedAt,
|
|
23
|
+
* matched_keywords, triage.decision when present)
|
|
24
|
+
* - `--json`: JSON array (one object per item)
|
|
25
|
+
* - `--field <expr>`: print one item field per row (used for piping)
|
|
26
|
+
*/
|
|
27
|
+
export interface ItemsIO {
|
|
28
|
+
log?: (message: string) => void;
|
|
29
|
+
error?: (message: string) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface ItemsCommandOptions {
|
|
32
|
+
cwd?: string;
|
|
33
|
+
io?: ItemsIO;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Top-level dispatcher for `radar items <subcommand>`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runItems(args: string[], options?: ItemsCommandOptions): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Implementation of `radar items list`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runItemsList(args: string[], options?: ItemsCommandOptions): Promise<number>;
|
|
43
|
+
export declare const itemsCommand: Command;
|
|
44
|
+
//# sourceMappingURL=items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../src/cli/items.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AA6JD;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBjG;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAoHjB;AAED,eAAO,MAAM,YAAY,EAAE,OAI1B,CAAC"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { loadItems } from "../core/items.js";
|
|
4
|
+
import { ItemStatusSchema } from "../schemas/index.js";
|
|
5
|
+
function parseIntFlag(flag, raw, min) {
|
|
6
|
+
if (raw === undefined)
|
|
7
|
+
throw new Error(`option ${flag} requires a value`);
|
|
8
|
+
const n = Number(raw);
|
|
9
|
+
if (!Number.isInteger(n) || n < min) {
|
|
10
|
+
throw new Error(`option ${flag} expects an integer >= ${min}, got '${raw}'`);
|
|
11
|
+
}
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
function parseListArgs(args) {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (let i = 0; i < args.length; i++) {
|
|
17
|
+
const a = args[i];
|
|
18
|
+
if (a === "-h" || a === "--help") {
|
|
19
|
+
out.help = true;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (a === "--status") {
|
|
23
|
+
const value = args[++i];
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
throw new Error(`option ${a} requires a value`);
|
|
26
|
+
out.status = value;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (a === "--source") {
|
|
30
|
+
const value = args[++i];
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
throw new Error(`option ${a} requires a value`);
|
|
33
|
+
out.source = value;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (a === "--triage-group") {
|
|
37
|
+
const value = args[++i];
|
|
38
|
+
if (value === undefined)
|
|
39
|
+
throw new Error(`option ${a} requires a value`);
|
|
40
|
+
out.triageGroup = value;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (a === "--since") {
|
|
44
|
+
const value = args[++i];
|
|
45
|
+
if (value === undefined)
|
|
46
|
+
throw new Error(`option ${a} requires a value`);
|
|
47
|
+
out.since = value;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (a === "--limit") {
|
|
51
|
+
out.limit = parseIntFlag(a, args[++i], 1);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (a === "--json") {
|
|
55
|
+
out.json = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (a === "--field") {
|
|
59
|
+
const value = args[++i];
|
|
60
|
+
if (value === undefined)
|
|
61
|
+
throw new Error(`option ${a} requires a value`);
|
|
62
|
+
out.field = value;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (a?.startsWith("--")) {
|
|
66
|
+
throw new Error(`unknown option: ${a}`);
|
|
67
|
+
}
|
|
68
|
+
throw new Error(`unexpected positional argument: ${a}`);
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
function printListHelp(log) {
|
|
73
|
+
log("Usage: radar items list [filters] [output options]");
|
|
74
|
+
log("");
|
|
75
|
+
log("Filters:");
|
|
76
|
+
log(" --status <status> detected | triaged_research | triaged_digest |");
|
|
77
|
+
log(" triaged_unsure | researched | reviewed | dismissed");
|
|
78
|
+
log(" --source <id> limit to one source");
|
|
79
|
+
log(" --triage-group <name> items whose triage.group == <name>");
|
|
80
|
+
log(" (used by digest workflow)");
|
|
81
|
+
log(" --since <duration> drop items older than the cutoff (e.g. 7d, 24h)");
|
|
82
|
+
log(" --limit N cap result count");
|
|
83
|
+
log("");
|
|
84
|
+
log("Output options:");
|
|
85
|
+
log(" --json emit JSON array (one object per item)");
|
|
86
|
+
log(" --field <expr> emit one item field per row (e.g. id, sourceId,");
|
|
87
|
+
log(" triage.decision). Supports nested dot paths.");
|
|
88
|
+
}
|
|
89
|
+
function printItemsHelp(log) {
|
|
90
|
+
log("Usage: radar items <list> [...]");
|
|
91
|
+
log("");
|
|
92
|
+
log("Subcommands:");
|
|
93
|
+
log(" list [filters] List items matching the supplied filters");
|
|
94
|
+
}
|
|
95
|
+
async function pathExists(p) {
|
|
96
|
+
try {
|
|
97
|
+
await access(p);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Parse `Nd` / `Nh` / `Nm` / `Ns` cutoff strings to a `Date` representing
|
|
106
|
+
* the threshold (= now - duration). Returns `null` on unparsable input so
|
|
107
|
+
* the caller can surface a clear error.
|
|
108
|
+
*/
|
|
109
|
+
function parseSinceCutoff(value, now = new Date()) {
|
|
110
|
+
const match = value.match(/^(\d+)([smhd])$/);
|
|
111
|
+
if (!match)
|
|
112
|
+
return null;
|
|
113
|
+
const n = Number(match[1]);
|
|
114
|
+
const unit = match[2];
|
|
115
|
+
const ms = unit === "s"
|
|
116
|
+
? n * 1000
|
|
117
|
+
: unit === "m"
|
|
118
|
+
? n * 60_000
|
|
119
|
+
: unit === "h"
|
|
120
|
+
? n * 3_600_000
|
|
121
|
+
: n * 86_400_000;
|
|
122
|
+
return new Date(now.getTime() - ms);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolve a dot-path expression like `triage.decision` against an item.
|
|
126
|
+
* Used by `--field <expr>`. Missing intermediate fields return `undefined`
|
|
127
|
+
* (silently — the caller renders `-` for missing values).
|
|
128
|
+
*/
|
|
129
|
+
function resolveField(item, expr) {
|
|
130
|
+
let current = item;
|
|
131
|
+
for (const part of expr.split(".")) {
|
|
132
|
+
if (current === undefined || current === null)
|
|
133
|
+
return undefined;
|
|
134
|
+
if (typeof current !== "object")
|
|
135
|
+
return undefined;
|
|
136
|
+
current = current[part];
|
|
137
|
+
}
|
|
138
|
+
return current;
|
|
139
|
+
}
|
|
140
|
+
function pad(value, width) {
|
|
141
|
+
if (value.length >= width)
|
|
142
|
+
return value.slice(0, width);
|
|
143
|
+
return value + " ".repeat(width - value.length);
|
|
144
|
+
}
|
|
145
|
+
function renderJsonValue(value) {
|
|
146
|
+
if (value === undefined || value === null)
|
|
147
|
+
return "-";
|
|
148
|
+
if (typeof value === "string")
|
|
149
|
+
return value;
|
|
150
|
+
return JSON.stringify(value);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Top-level dispatcher for `radar items <subcommand>`.
|
|
154
|
+
*/
|
|
155
|
+
export async function runItems(args, options = {}) {
|
|
156
|
+
const log = options.io?.log ?? ((m) => console.log(m));
|
|
157
|
+
const error = options.io?.error ?? ((m) => console.error(m));
|
|
158
|
+
const [sub, ...rest] = args;
|
|
159
|
+
if (!sub || sub === "-h" || sub === "--help" || sub === "help") {
|
|
160
|
+
printItemsHelp(log);
|
|
161
|
+
return sub ? 0 : 2;
|
|
162
|
+
}
|
|
163
|
+
switch (sub) {
|
|
164
|
+
case "list":
|
|
165
|
+
return runItemsList(rest, options);
|
|
166
|
+
default:
|
|
167
|
+
error(`items: unknown subcommand '${sub}'`);
|
|
168
|
+
printItemsHelp(error);
|
|
169
|
+
return 2;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Implementation of `radar items list`.
|
|
174
|
+
*/
|
|
175
|
+
export async function runItemsList(args, options = {}) {
|
|
176
|
+
const cwd = options.cwd ?? process.cwd();
|
|
177
|
+
const log = options.io?.log ?? ((m) => console.log(m));
|
|
178
|
+
const error = options.io?.error ?? ((m) => console.error(m));
|
|
179
|
+
let parsed;
|
|
180
|
+
try {
|
|
181
|
+
parsed = parseListArgs(args);
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
error(`items list: ${e instanceof Error ? e.message : String(e)}`);
|
|
185
|
+
return 2;
|
|
186
|
+
}
|
|
187
|
+
if (parsed.help) {
|
|
188
|
+
printListHelp(log);
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
// Validate --status against the schema enum early so typos like
|
|
192
|
+
// "triaged_reasearch" fail fast with a list of valid values.
|
|
193
|
+
let statusFilter;
|
|
194
|
+
if (parsed.status !== undefined) {
|
|
195
|
+
const v = ItemStatusSchema.safeParse(parsed.status);
|
|
196
|
+
if (!v.success) {
|
|
197
|
+
error(`items list: invalid --status '${parsed.status}' (expected: ${ItemStatusSchema.options.join(" | ")})`);
|
|
198
|
+
return 2;
|
|
199
|
+
}
|
|
200
|
+
statusFilter = v.data;
|
|
201
|
+
}
|
|
202
|
+
const itemsDir = join(cwd, "items");
|
|
203
|
+
if (!(await pathExists(itemsDir))) {
|
|
204
|
+
if (parsed.json) {
|
|
205
|
+
log("[]");
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
log("items list: no items/ directory (run `radar init` first)");
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
let items;
|
|
212
|
+
try {
|
|
213
|
+
items = await loadItems(itemsDir, parsed.source);
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
error(`items list: ${e instanceof Error ? e.message : String(e)}`);
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
// Apply filters in cheap-first order.
|
|
220
|
+
if (statusFilter) {
|
|
221
|
+
items = items.filter((i) => i.status === statusFilter);
|
|
222
|
+
}
|
|
223
|
+
if (parsed.triageGroup) {
|
|
224
|
+
items = items.filter((i) => i.triage?.group === parsed.triageGroup);
|
|
225
|
+
}
|
|
226
|
+
if (parsed.since) {
|
|
227
|
+
const cutoff = parseSinceCutoff(parsed.since);
|
|
228
|
+
if (!cutoff) {
|
|
229
|
+
error(`items list: invalid --since '${parsed.since}' (expected Ns | Nm | Nh | Nd)`);
|
|
230
|
+
return 2;
|
|
231
|
+
}
|
|
232
|
+
items = items.filter((i) => {
|
|
233
|
+
const ts = i.publishedAt ?? i.fetchedAt;
|
|
234
|
+
return new Date(ts) >= cutoff;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// Deterministic order: publishedAt desc (newest first), with fetchedAt as
|
|
238
|
+
// fallback and id as the final tie-breaker. Stable order matters for
|
|
239
|
+
// pipelines that diff the output across runs.
|
|
240
|
+
items.sort((a, b) => {
|
|
241
|
+
const aTs = a.publishedAt ?? a.fetchedAt;
|
|
242
|
+
const bTs = b.publishedAt ?? b.fetchedAt;
|
|
243
|
+
if (aTs !== bTs)
|
|
244
|
+
return bTs.localeCompare(aTs);
|
|
245
|
+
return a.id.localeCompare(b.id);
|
|
246
|
+
});
|
|
247
|
+
if (parsed.limit !== undefined && items.length > parsed.limit) {
|
|
248
|
+
items = items.slice(0, parsed.limit);
|
|
249
|
+
}
|
|
250
|
+
// Output dispatch.
|
|
251
|
+
if (parsed.field) {
|
|
252
|
+
for (const item of items) {
|
|
253
|
+
const v = resolveField(item, parsed.field);
|
|
254
|
+
log(renderJsonValue(v));
|
|
255
|
+
}
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
if (parsed.json) {
|
|
259
|
+
log(JSON.stringify(items, null, 2));
|
|
260
|
+
return 0;
|
|
261
|
+
}
|
|
262
|
+
if (items.length === 0) {
|
|
263
|
+
log("items list: no items match the filter");
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
// Default tabular output.
|
|
267
|
+
const headers = ["ID", "STATUS", "SOURCE", "PUBLISHED", "MATCHED", "TRIAGE"];
|
|
268
|
+
const rows = items.map((i) => [
|
|
269
|
+
i.id,
|
|
270
|
+
i.status,
|
|
271
|
+
i.sourceId,
|
|
272
|
+
i.publishedAt ?? i.fetchedAt,
|
|
273
|
+
i.matchedKeywords.join(",") || "-",
|
|
274
|
+
i.triage?.decision ?? "-",
|
|
275
|
+
]);
|
|
276
|
+
const widths = headers.map((h, idx) => Math.max(h.length, ...rows.map((r) => (r[idx] ?? "").length)));
|
|
277
|
+
log(headers.map((h, idx) => pad(h, widths[idx] ?? 0)).join(" "));
|
|
278
|
+
for (const row of rows) {
|
|
279
|
+
log(row.map((c, idx) => pad(c, widths[idx] ?? 0)).join(" "));
|
|
280
|
+
}
|
|
281
|
+
return 0;
|
|
282
|
+
}
|
|
283
|
+
export const itemsCommand = {
|
|
284
|
+
name: "items",
|
|
285
|
+
summary: "Inspect items in the workspace (list | ...)",
|
|
286
|
+
run: (args) => runItems(args),
|
|
287
|
+
};
|
|
288
|
+
//# sourceMappingURL=items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../src/cli/items.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkDvD,SAAS,YAAY,CAAC,IAAY,EAAE,GAAuB,EAAE,GAAW;IACtE,IAAI,GAAG,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,mBAAmB,CAAC,CAAC;IAC1E,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,0BAA0B,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,aAAa,CAAC,IAAc;IACnC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YACjC,GAAG,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,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CACpC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAC9D,CAAC;IACF,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAY;IACnC,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,6CAA6C;IACtD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC9B,CAAC"}
|
package/dist/cli/research.d.ts
CHANGED
|
@@ -10,6 +10,27 @@ import type { Command } from "./index.js";
|
|
|
10
10
|
* cap also applies when the YAML is hand-edited.
|
|
11
11
|
*/
|
|
12
12
|
export declare const RESEARCH_BATCH_DEFAULT_MAX_ITEMS = 10;
|
|
13
|
+
/**
|
|
14
|
+
* Whitelist of `Item.status` values accepted by `radar research --batch
|
|
15
|
+
* --status <status>`.
|
|
16
|
+
*
|
|
17
|
+
* Constrained to the two "ready-to-research" statuses defined by the
|
|
18
|
+
* ADR-0008 / ADR-0018 state machine:
|
|
19
|
+
*
|
|
20
|
+
* - `detected` — legacy pre-triage path (`radar research` directly)
|
|
21
|
+
* - `triaged_research` — triage adapter promoted the item for research
|
|
22
|
+
* (ADR-0018 §W-B); workflow YAML generated by
|
|
23
|
+
* `radar workflow generate combined-with-triage`
|
|
24
|
+
* drives this branch (PR #249).
|
|
25
|
+
*
|
|
26
|
+
* Other statuses (`researched`, `reviewed`, `dismissed`, `triaged_digest`,
|
|
27
|
+
* `triaged_unsure`) are rejected with an explicit error rather than silently
|
|
28
|
+
* matching zero items, so a typo in scheduled YAML fails loud instead of
|
|
29
|
+
* decaying into a silent no-op (issue #250). `triaged_digest` requires
|
|
30
|
+
* `--digest` aggregation per group and is intentionally not a `--batch`
|
|
31
|
+
* single-item input; the workflow YAML walks groups explicitly.
|
|
32
|
+
*/
|
|
33
|
+
export declare const RESEARCH_BATCH_ALLOWED_STATUSES: readonly ["detected", "triaged_research"];
|
|
13
34
|
/** Sinks for the research command's user-facing output. Tests inject capturing sinks. */
|
|
14
35
|
export interface ResearchIO {
|
|
15
36
|
log?: (message: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../src/cli/research.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../src/cli/research.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAa5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,+BAA+B,2CAA4C,CAAC;AAGzF,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAgjBD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,MAAM,CAAC,CAyHjB;AAED,eAAO,MAAM,eAAe,EAAE,OAI7B,CAAC"}
|
package/dist/cli/research.js
CHANGED
|
@@ -21,7 +21,8 @@ import { getAgentAdapter } from "../agents/index.js";
|
|
|
21
21
|
import { getDefaultAgent, loadRadarConfig, RadarConfigError } from "../core/config.js";
|
|
22
22
|
import { loadItems, saveItems } from "../core/items.js";
|
|
23
23
|
import { loadTemplate } from "../core/templates.js";
|
|
24
|
-
import {
|
|
24
|
+
import { isValidTransition } from "../core/transitions.js";
|
|
25
|
+
import { AgentIdSchema, ResearchFrontmatterSchema } from "../schemas/index.js";
|
|
25
26
|
import { buildAgentProgressCallback, buildReporter, ProgressFlagError, parseProgressFlags, pollOutputFileSize, } from "./_progress.js";
|
|
26
27
|
/**
|
|
27
28
|
* Default hard-cap for `radar research --batch`.
|
|
@@ -33,6 +34,27 @@ import { buildAgentProgressCallback, buildReporter, ProgressFlagError, parseProg
|
|
|
33
34
|
* cap also applies when the YAML is hand-edited.
|
|
34
35
|
*/
|
|
35
36
|
export const RESEARCH_BATCH_DEFAULT_MAX_ITEMS = 10;
|
|
37
|
+
/**
|
|
38
|
+
* Whitelist of `Item.status` values accepted by `radar research --batch
|
|
39
|
+
* --status <status>`.
|
|
40
|
+
*
|
|
41
|
+
* Constrained to the two "ready-to-research" statuses defined by the
|
|
42
|
+
* ADR-0008 / ADR-0018 state machine:
|
|
43
|
+
*
|
|
44
|
+
* - `detected` — legacy pre-triage path (`radar research` directly)
|
|
45
|
+
* - `triaged_research` — triage adapter promoted the item for research
|
|
46
|
+
* (ADR-0018 §W-B); workflow YAML generated by
|
|
47
|
+
* `radar workflow generate combined-with-triage`
|
|
48
|
+
* drives this branch (PR #249).
|
|
49
|
+
*
|
|
50
|
+
* Other statuses (`researched`, `reviewed`, `dismissed`, `triaged_digest`,
|
|
51
|
+
* `triaged_unsure`) are rejected with an explicit error rather than silently
|
|
52
|
+
* matching zero items, so a typo in scheduled YAML fails loud instead of
|
|
53
|
+
* decaying into a silent no-op (issue #250). `triaged_digest` requires
|
|
54
|
+
* `--digest` aggregation per group and is intentionally not a `--batch`
|
|
55
|
+
* single-item input; the workflow YAML walks groups explicitly.
|
|
56
|
+
*/
|
|
57
|
+
export const RESEARCH_BATCH_ALLOWED_STATUSES = ["detected", "triaged_research"];
|
|
36
58
|
function parseArgs(args) {
|
|
37
59
|
const out = { itemIds: [] };
|
|
38
60
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -95,8 +117,10 @@ function printHelp(log) {
|
|
|
95
117
|
log(" --digest Bundle multiple items into a single digest report (ADR-0011)");
|
|
96
118
|
log(" --batch Research every item matching --status (and --filter-tags)");
|
|
97
119
|
log(" respecting the --max-items hard-cap (ADR-0014 D3a).");
|
|
98
|
-
log(" --status <status> Batch-mode filter: detected |
|
|
99
|
-
log(" (default: detected).");
|
|
120
|
+
log(" --status <status> Batch-mode filter: detected | triaged_research");
|
|
121
|
+
log(" (default: detected). `triaged_research` consumes items");
|
|
122
|
+
log(" the triage adapter promoted (ADR-0018 §W-B) and");
|
|
123
|
+
log(" transitions them to `researched` on success.");
|
|
100
124
|
log(` --max-items N Batch-mode hard-cap on processed items (default: ${RESEARCH_BATCH_DEFAULT_MAX_ITEMS}).`);
|
|
101
125
|
log(" Excess items are dropped and announced via warn() so a runaway");
|
|
102
126
|
log(" detection cannot blow the cap from inside a workflow.");
|
|
@@ -341,7 +365,27 @@ async function processResearchInvocation(params) {
|
|
|
341
365
|
}, matterOptions);
|
|
342
366
|
await writeFile(outputPath, rewritten, "utf8");
|
|
343
367
|
}
|
|
344
|
-
|
|
368
|
+
// Defer the "which prior statuses can transition into `researched`"
|
|
369
|
+
// decision to `isValidTransition()` (src/core/transitions.ts). That
|
|
370
|
+
// module enumerates the ADR-0008 / ADR-0018 state machine edges in one
|
|
371
|
+
// place; re-deriving the rule here would risk drift the next time the
|
|
372
|
+
// matrix changes (e.g. a future `triaged_*` status).
|
|
373
|
+
//
|
|
374
|
+
// Today this resolves to {detected, triaged_research, triaged_digest} →
|
|
375
|
+
// researched. Items in any other status (already researched, dismissed,
|
|
376
|
+
// terminal reviewed, etc.) are passed through unchanged: the batch
|
|
377
|
+
// filter upstream enforces input selection, and this guard is defense
|
|
378
|
+
// in depth for the single-item path where a user invokes
|
|
379
|
+
// `radar research <item-id>` against an item already past the
|
|
380
|
+
// pre-research stage.
|
|
381
|
+
const transitions = new Map();
|
|
382
|
+
const updated = items.map((item) => {
|
|
383
|
+
if (isValidTransition(item.status, "researched")) {
|
|
384
|
+
transitions.set(item.id, item.status);
|
|
385
|
+
return { ...item, status: "researched" };
|
|
386
|
+
}
|
|
387
|
+
return item;
|
|
388
|
+
});
|
|
345
389
|
try {
|
|
346
390
|
await saveItems(join(cwd, "items"), updated);
|
|
347
391
|
}
|
|
@@ -352,11 +396,12 @@ async function processResearchInvocation(params) {
|
|
|
352
396
|
}
|
|
353
397
|
log(`research: wrote ${outputPath}`);
|
|
354
398
|
for (const item of updated) {
|
|
355
|
-
|
|
399
|
+
const from = transitions.get(item.id);
|
|
400
|
+
if (from !== undefined && item.status === "researched") {
|
|
356
401
|
// Phase marker: status transition. We emit one phase per item rather
|
|
357
402
|
// than collapsing them so the digest case stays explicit about what
|
|
358
403
|
// moved. The arrow uses U+2192 (→) per ADR-0015 D4 examples.
|
|
359
|
-
progress.phase(`Status:
|
|
404
|
+
progress.phase(`Status: ${from} → researched`, `items/${item.sourceId}/${item.id}.yaml`);
|
|
360
405
|
log(`research: items/${item.sourceId}/${item.id}.yaml status -> researched`);
|
|
361
406
|
}
|
|
362
407
|
}
|
|
@@ -396,12 +441,11 @@ async function runResearchBatch(parsed, cwd, log, warn, error, progress) {
|
|
|
396
441
|
return 2;
|
|
397
442
|
}
|
|
398
443
|
const rawStatus = parsed.status ?? "detected";
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
error(`research: invalid --status '${rawStatus}' (expected: detected | dismissed | researched | reviewed)`);
|
|
444
|
+
if (!RESEARCH_BATCH_ALLOWED_STATUSES.includes(rawStatus)) {
|
|
445
|
+
error(`research: invalid --status '${rawStatus}' (expected: ${RESEARCH_BATCH_ALLOWED_STATUSES.join(" | ")})`);
|
|
402
446
|
return 2;
|
|
403
447
|
}
|
|
404
|
-
const status =
|
|
448
|
+
const status = rawStatus;
|
|
405
449
|
const maxItems = parseMaxItems(parsed.maxItems, error);
|
|
406
450
|
if (maxItems === null)
|
|
407
451
|
return 2;
|