@ozzylabs/feedradar 0.1.6 → 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/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/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/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/recipes.d.ts.map +1 -1
- package/dist/core/recipes.js +6 -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 +29 -0
- 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 +10 -0
- package/dist/schemas/recipe.d.ts.map +1 -1
- package/dist/schemas/recipe.js +10 -1
- package/dist/schemas/recipe.js.map +1 -1
- package/dist/schemas/source.d.ts +43 -0
- package/dist/schemas/source.d.ts.map +1 -1
- package/dist/schemas/source.js +34 -0
- package/dist/schemas/source.js.map +1 -1
- package/dist/templates/agents/AGENTS.md +30 -0
- package/dist/templates/workflows/combined-with-triage.template.yaml.tmpl +133 -0
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type TriageRunner } from "../core/triage/index.js";
|
|
2
|
+
import type { Item } from "../schemas/item.js";
|
|
3
|
+
import type { Command } from "./index.js";
|
|
4
|
+
/**
|
|
5
|
+
* `radar triage` and `radar triage feedback` CLI implementations (ADR-0018 PR-3).
|
|
6
|
+
*
|
|
7
|
+
* The CLI is a thin wrapper around `core/triage/index.ts > triageItems()` that:
|
|
8
|
+
*
|
|
9
|
+
* 1. Loads `detected` items from `items/`, optionally narrowing by
|
|
10
|
+
* `--source` / `--filter-tags` / `--max-items`.
|
|
11
|
+
* 2. Resolves the per-source `triagePolicy` (either from `sources/<id>.yaml`
|
|
12
|
+
* or from `--policy <path>`).
|
|
13
|
+
* 3. Calls `triageItems()` once per source (each source has its own policy /
|
|
14
|
+
* agent, so batching cross-source would either lose policy nuance or
|
|
15
|
+
* require a multi-policy prompt — neither worth the complexity).
|
|
16
|
+
* 4. Either prints the proposed decisions (`--dry-run`), opens `$EDITOR` to
|
|
17
|
+
* let the user massage them (`--interactive`), or writes them to disk
|
|
18
|
+
* (`--apply`).
|
|
19
|
+
*
|
|
20
|
+
* `radar triage feedback` is a separate path that mutates the `triage.feedback`
|
|
21
|
+
* array on a single item — no agent call, no policy resolution.
|
|
22
|
+
*/
|
|
23
|
+
export interface TriageIO {
|
|
24
|
+
log?: (message: string) => void;
|
|
25
|
+
warn?: (message: string) => void;
|
|
26
|
+
error?: (message: string) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface TriageCommandOptions {
|
|
29
|
+
cwd?: string;
|
|
30
|
+
io?: TriageIO;
|
|
31
|
+
/** Test seam: inject the triage runner instead of spawning a real CLI. */
|
|
32
|
+
runner?: TriageRunner;
|
|
33
|
+
/** Test seam: override `$EDITOR` invocation for `--interactive`. */
|
|
34
|
+
editor?: (path: string) => Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Test seam: override the interactive confirmation prompt. Default reads
|
|
37
|
+
* from stdin until a newline is seen; tests inject a function that
|
|
38
|
+
* returns the canned answer.
|
|
39
|
+
*/
|
|
40
|
+
confirm?: (message: string) => Promise<boolean>;
|
|
41
|
+
/** Test seam: override the `now()` clock stamped on every decision / feedback. */
|
|
42
|
+
now?: () => string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Top-level dispatcher for `radar triage`. Routes to the feedback subcommand
|
|
46
|
+
* when the first positional is `feedback`, otherwise runs the triage flow.
|
|
47
|
+
*/
|
|
48
|
+
export declare function runTriage(args: string[], options?: TriageCommandOptions): Promise<number>;
|
|
49
|
+
interface PerSourceStats {
|
|
50
|
+
source: string;
|
|
51
|
+
total: number;
|
|
52
|
+
byDecision: Record<"research" | "digest" | "dismiss" | "unsure", number>;
|
|
53
|
+
digestGroups: number;
|
|
54
|
+
humanOverrides: {
|
|
55
|
+
triagedDismissToResearch: number;
|
|
56
|
+
triagedResearchToDismiss: number;
|
|
57
|
+
triagedUnsureToResearch: number;
|
|
58
|
+
triagedUnsureToDismiss: number;
|
|
59
|
+
};
|
|
60
|
+
agent: string | null;
|
|
61
|
+
policyPath: string | null;
|
|
62
|
+
policyLastEditedDaysAgo: number | null;
|
|
63
|
+
suggestions: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parse `Nd | Nh | Nm | Ns` into a `Date` cutoff. Returns `null` when the
|
|
67
|
+
* shape doesn't match — callers translate that into a CLI error. Mirrors
|
|
68
|
+
* `parseSinceCutoff` in items.ts so the two `--since` flags accept the same
|
|
69
|
+
* syntax.
|
|
70
|
+
*/
|
|
71
|
+
declare function parseSinceCutoffForStats(value: string, now?: Date): Date | null;
|
|
72
|
+
/**
|
|
73
|
+
* Derive the human-override breakdown for a single source's triaged items.
|
|
74
|
+
*
|
|
75
|
+
* Two pathways feed the same counters:
|
|
76
|
+
*
|
|
77
|
+
* 1. `triage.feedback[].correct === false` (research / digest / dismiss
|
|
78
|
+
* decisions) — an explicit signal the human disagreed. Each decision class
|
|
79
|
+
* only flips one direction (research → dismiss, dismiss → research), so a
|
|
80
|
+
* single boolean is enough.
|
|
81
|
+
* 2. `status` mutation downstream of `triaged_unsure` — the schema has no
|
|
82
|
+
* "unsure direction" feedback field; instead we infer from where the item
|
|
83
|
+
* landed (`researched` / `reviewed` → research; `dismissed` → dismiss).
|
|
84
|
+
* This is best-effort: items still sitting in `triaged_unsure` are
|
|
85
|
+
* excluded.
|
|
86
|
+
*
|
|
87
|
+
* The function only walks items whose `triage.decision` is set — items
|
|
88
|
+
* without a triage record (legacy or pending) are silently skipped.
|
|
89
|
+
*/
|
|
90
|
+
declare function computeHumanOverrides(items: Item[]): PerSourceStats["humanOverrides"];
|
|
91
|
+
/**
|
|
92
|
+
* Heuristic policy-tuning hints (ADR-0018 §W5, #242).
|
|
93
|
+
*
|
|
94
|
+
* Triggered by 3 thresholds:
|
|
95
|
+
*
|
|
96
|
+
* - 3+ false negatives → recommend reviewing dismiss criteria, prefixing
|
|
97
|
+
* common `matchedKeywords` from the offending items so the user knows
|
|
98
|
+
* *which* dismissed items the agent missed.
|
|
99
|
+
* - 3+ false positives → recommend tightening research criteria with the
|
|
100
|
+
* same keyword extraction pattern (different message).
|
|
101
|
+
* - 5+ unsure decisions → recommend lowering `confidenceThreshold` or
|
|
102
|
+
* spelling out unsure cases in `rules:`.
|
|
103
|
+
*
|
|
104
|
+
* Below the thresholds we stay silent — surfacing 1-event "trends" would
|
|
105
|
+
* train users to ignore the section.
|
|
106
|
+
*/
|
|
107
|
+
declare function buildSuggestions(items: Item[], overrides: PerSourceStats["humanOverrides"]): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Extract the top 1-3 most common `matchedKeywords` (or title-derived words
|
|
110
|
+
* when keywords are absent) from a set of items, joined as ` / `. Used to
|
|
111
|
+
* give the suggestion a concrete "what to look at" hook without dumping
|
|
112
|
+
* every keyword in the source.
|
|
113
|
+
*/
|
|
114
|
+
declare function extractTopKeywordHint(items: Item[]): string;
|
|
115
|
+
/**
|
|
116
|
+
* Aggregate stats per source group. Pure: takes items + a per-source policy
|
|
117
|
+
* lookup, returns a sorted array of `PerSourceStats`. The CLI layer wires
|
|
118
|
+
* disk I/O around it.
|
|
119
|
+
*/
|
|
120
|
+
declare function aggregatePerSource(items: Item[], policyMeta: Map<string, {
|
|
121
|
+
agent: string;
|
|
122
|
+
path: string;
|
|
123
|
+
lastEditedDaysAgo: number | null;
|
|
124
|
+
}>, sinceCutoff: Date | null): PerSourceStats[];
|
|
125
|
+
declare function renderStatsBlock(stat: PerSourceStats, sinceDays: number | null): string[];
|
|
126
|
+
export declare const __test__: {
|
|
127
|
+
aggregatePerSource: typeof aggregatePerSource;
|
|
128
|
+
buildSuggestions: typeof buildSuggestions;
|
|
129
|
+
computeHumanOverrides: typeof computeHumanOverrides;
|
|
130
|
+
extractTopKeywordHint: typeof extractTopKeywordHint;
|
|
131
|
+
parseSinceCutoffForStats: typeof parseSinceCutoffForStats;
|
|
132
|
+
renderStatsBlock: typeof renderStatsBlock;
|
|
133
|
+
};
|
|
134
|
+
export declare const triageCommand: Command;
|
|
135
|
+
export {};
|
|
136
|
+
//# sourceMappingURL=triage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triage.d.ts","sourceRoot":"","sources":["../../src/cli/triage.ts"],"names":[],"mappings":"AAQA,OAAO,EAAqB,KAAK,YAAY,EAAe,MAAM,yBAAyB,CAAC;AAE5F,OAAO,KAAK,EAAe,IAAI,EAAkB,MAAM,oBAAoB,CAAC;AAI5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,QAAQ;IACvB,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,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;OAIG;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