daftari 3.2.0 → 3.3.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/CHANGELOG.md +11 -0
- package/dist/access/rbac.d.ts +1 -0
- package/dist/access/rbac.d.ts.map +1 -1
- package/dist/access/rbac.js +8 -0
- package/dist/access/rbac.js.map +1 -1
- package/dist/backfill/derive.d.ts.map +1 -1
- package/dist/backfill/derive.js +2 -0
- package/dist/backfill/derive.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/consolidate/call-budget.d.ts +2 -0
- package/dist/consolidate/call-budget.d.ts.map +1 -1
- package/dist/consolidate/call-budget.js +8 -1
- package/dist/consolidate/call-budget.js.map +1 -1
- package/dist/curation/lint-voice.d.ts.map +1 -1
- package/dist/curation/lint-voice.js +1 -0
- package/dist/curation/lint-voice.js.map +1 -1
- package/dist/curation/lint.d.ts +2 -1
- package/dist/curation/lint.d.ts.map +1 -1
- package/dist/curation/lint.js +42 -0
- package/dist/curation/lint.js.map +1 -1
- package/dist/distill/adapters/chat-transcript.d.ts +15 -0
- package/dist/distill/adapters/chat-transcript.d.ts.map +1 -0
- package/dist/distill/adapters/chat-transcript.js +182 -0
- package/dist/distill/adapters/chat-transcript.js.map +1 -0
- package/dist/distill/adapters/types.d.ts +39 -0
- package/dist/distill/adapters/types.d.ts.map +1 -0
- package/dist/distill/adapters/types.js +7 -0
- package/dist/distill/adapters/types.js.map +1 -0
- package/dist/distill/chunk.d.ts +34 -0
- package/dist/distill/chunk.d.ts.map +1 -0
- package/dist/distill/chunk.js +46 -0
- package/dist/distill/chunk.js.map +1 -0
- package/dist/distill/cli.d.ts +13 -0
- package/dist/distill/cli.d.ts.map +1 -0
- package/dist/distill/cli.js +568 -0
- package/dist/distill/cli.js.map +1 -0
- package/dist/distill/cost.d.ts +105 -0
- package/dist/distill/cost.d.ts.map +1 -0
- package/dist/distill/cost.js +168 -0
- package/dist/distill/cost.js.map +1 -0
- package/dist/distill/extract.d.ts +44 -0
- package/dist/distill/extract.d.ts.map +1 -0
- package/dist/distill/extract.js +153 -0
- package/dist/distill/extract.js.map +1 -0
- package/dist/distill/index.d.ts +73 -0
- package/dist/distill/index.d.ts.map +1 -0
- package/dist/distill/index.js +112 -0
- package/dist/distill/index.js.map +1 -0
- package/dist/distill/output-fence.d.ts +16 -0
- package/dist/distill/output-fence.d.ts.map +1 -0
- package/dist/distill/output-fence.js +38 -0
- package/dist/distill/output-fence.js.map +1 -0
- package/dist/distill/propose.d.ts +95 -0
- package/dist/distill/propose.d.ts.map +1 -0
- package/dist/distill/propose.js +237 -0
- package/dist/distill/propose.js.map +1 -0
- package/dist/distill/state.d.ts +92 -0
- package/dist/distill/state.d.ts.map +1 -0
- package/dist/distill/state.js +198 -0
- package/dist/distill/state.js.map +1 -0
- package/dist/frontmatter/schema.d.ts.map +1 -1
- package/dist/frontmatter/schema.js +1 -0
- package/dist/frontmatter/schema.js.map +1 -1
- package/dist/frontmatter/types.d.ts +2 -1
- package/dist/frontmatter/types.d.ts.map +1 -1
- package/dist/frontmatter/types.js +1 -0
- package/dist/frontmatter/types.js.map +1 -1
- package/dist/interview/transcript.d.ts.map +1 -1
- package/dist/interview/transcript.js +1 -0
- package/dist/interview/transcript.js.map +1 -1
- package/dist/okf/map.d.ts.map +1 -1
- package/dist/okf/map.js +1 -0
- package/dist/okf/map.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/sleep/index.d.ts.map +1 -1
- package/dist/sleep/index.js +14 -0
- package/dist/sleep/index.js.map +1 -1
- package/dist/sleep/run-ledger.d.ts +17 -0
- package/dist/sleep/run-ledger.d.ts.map +1 -0
- package/dist/sleep/run-ledger.js +119 -0
- package/dist/sleep/run-ledger.js.map +1 -0
- package/dist/sleep/runs-cli.d.ts +2 -0
- package/dist/sleep/runs-cli.d.ts.map +1 -0
- package/dist/sleep/runs-cli.js +69 -0
- package/dist/sleep/runs-cli.js.map +1 -0
- package/dist/tools/backlinks.d.ts +28 -0
- package/dist/tools/backlinks.d.ts.map +1 -0
- package/dist/tools/backlinks.js +207 -0
- package/dist/tools/backlinks.js.map +1 -0
- package/dist/tools/erase.d.ts +15 -0
- package/dist/tools/erase.d.ts.map +1 -0
- package/dist/tools/erase.js +127 -0
- package/dist/tools/erase.js.map +1 -0
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +2 -0
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +1 -0
- package/dist/tools/write.js.map +1 -1
- package/dist/utils/config.d.ts +18 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +71 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/git-erase.d.ts +35 -0
- package/dist/utils/git-erase.d.ts.map +1 -0
- package/dist/utils/git-erase.js +179 -0
- package/dist/utils/git-erase.js.map +1 -0
- package/dist/utils/vault-gitignore.d.ts +1 -1
- package/dist/utils/vault-gitignore.d.ts.map +1 -1
- package/dist/utils/vault-gitignore.js +5 -0
- package/dist/utils/vault-gitignore.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
// src/distill/cli.ts
|
|
2
|
+
//
|
|
3
|
+
// `daftari distill` CLI front door (U7) and its argument-parsing helpers.
|
|
4
|
+
//
|
|
5
|
+
// Split out of src/distill/index.ts (U9): index.ts owns the pipeline
|
|
6
|
+
// orchestration and the config/client resolver; this module owns the argv
|
|
7
|
+
// parsing, mode routing (--plan / --propose / --review), and process I/O.
|
|
8
|
+
// index.ts re-exports `runDistill` so existing importers keep their path.
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { basename, extname, resolve } from "node:path";
|
|
11
|
+
import { withCallBudget } from "../consolidate/call-budget.js";
|
|
12
|
+
import { listStagedActions } from "../curation/staged-actions.js";
|
|
13
|
+
import { err, ok } from "../frontmatter/types.js";
|
|
14
|
+
import { vaultRatify } from "../tools/staged-actions.js";
|
|
15
|
+
import { loadConfig } from "../utils/config.js";
|
|
16
|
+
import { chunkMessages } from "./chunk.js";
|
|
17
|
+
import { buildReceipt, planDistill } from "./cost.js";
|
|
18
|
+
import { extractClaims } from "./extract.js";
|
|
19
|
+
import { ADAPTER_REGISTRY, DISTILL_NOT_CONFIGURED_MSG, resolveDistillClient } from "./index.js";
|
|
20
|
+
import { makeOverlapHinter } from "./propose.js";
|
|
21
|
+
import { distillUpsert, recordLandedClaim } from "./state.js";
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// CLI front door — U7
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
const DISTILL_USAGE = `daftari distill — compile-on-ingest: extract claims from a source file.
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
daftari distill <file|-> [options]
|
|
29
|
+
|
|
30
|
+
Source:
|
|
31
|
+
<file> Path to a chat-transcript .txt file.
|
|
32
|
+
- Read from stdin (requires --source-id).
|
|
33
|
+
|
|
34
|
+
Options:
|
|
35
|
+
--vault <path> Vault root (default: current directory).
|
|
36
|
+
--source-id <id> Stable identity of this source. Required when reading
|
|
37
|
+
from stdin; derived from the filename otherwise.
|
|
38
|
+
--plan Print a cost/call estimate without making any LLM calls.
|
|
39
|
+
This is the default when neither --plan nor --propose is given.
|
|
40
|
+
--propose Run the full pipeline: extract claims and stage proposals
|
|
41
|
+
into the vault. Requires an API key and a distill: config block.
|
|
42
|
+
--review <run_id> Review the pending proposals from a prior run and approve
|
|
43
|
+
them all through the ratify path. Dry-run (list only) unless
|
|
44
|
+
--yes is given. Mutually exclusive with --plan / --propose.
|
|
45
|
+
--by <principal> Reviewer principal recorded on each ratify (default: cli).
|
|
46
|
+
--yes Actually approve on --review (without it, --review lists only).
|
|
47
|
+
--max-llm-calls <n> Override config.maxLlmCalls for this run.
|
|
48
|
+
--max-claims <n> Override config.maxClaims for this run.
|
|
49
|
+
--model <id> Override config.model for this run.
|
|
50
|
+
--transport <t> LLM transport: anthropic (default) | openrouter.
|
|
51
|
+
--zdr Assert zero-data-retention for the receipt (default: false).
|
|
52
|
+
--help, -h Show this help.
|
|
53
|
+
|
|
54
|
+
Exit codes:
|
|
55
|
+
0 Success.
|
|
56
|
+
2 Usage error (no source, stdin without --source-id, unknown flag).
|
|
57
|
+
3 Config/key refuse (missing distill: block, missing API key on --propose).
|
|
58
|
+
4 Partial failure (some claims failed to stage, or some proposals failed to ratify).
|
|
59
|
+
`;
|
|
60
|
+
/**
|
|
61
|
+
* Read a string flag value (--flag value or --flag=value).
|
|
62
|
+
*
|
|
63
|
+
* Returns:
|
|
64
|
+
* `{ found: false }` — flag is absent from argv.
|
|
65
|
+
* `{ found: true, value: string }` — flag present with a non-empty value.
|
|
66
|
+
* `{ found: true, value: undefined }` — flag present but its value is
|
|
67
|
+
* missing (last token) or the `=`-form was `--flag=` (empty rhs); the
|
|
68
|
+
* caller should exit 2.
|
|
69
|
+
*/
|
|
70
|
+
function readStringArg(argv, flag) {
|
|
71
|
+
const match = argv.find((a) => a === flag || a.startsWith(`${flag}=`));
|
|
72
|
+
if (match === undefined)
|
|
73
|
+
return { found: false };
|
|
74
|
+
if (match.includes("=")) {
|
|
75
|
+
const rhs = match.slice(match.indexOf("=") + 1);
|
|
76
|
+
return { found: true, value: rhs.length > 0 ? rhs : undefined };
|
|
77
|
+
}
|
|
78
|
+
const idx = argv.indexOf(match);
|
|
79
|
+
const next = argv[idx + 1];
|
|
80
|
+
// If next token is absent or is itself a flag, the value is missing.
|
|
81
|
+
return {
|
|
82
|
+
found: true,
|
|
83
|
+
value: next !== undefined && !next.startsWith("--") ? next : undefined,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Read a string flag, returning the value or undefined when absent.
|
|
88
|
+
* Exits 2 via `process.exit`-equivalent return of a sentinel string when the
|
|
89
|
+
* flag is present but its value is missing — callers check `MISSING_VALUE`.
|
|
90
|
+
*
|
|
91
|
+
* Because `runDistill` is async and exit codes are returned, not thrown, we
|
|
92
|
+
* use a shared sentinel object to signal "flag present, value missing".
|
|
93
|
+
*/
|
|
94
|
+
const MISSING_FLAG_VALUE = Symbol("MISSING_FLAG_VALUE");
|
|
95
|
+
function readString(argv, flag) {
|
|
96
|
+
const res = readStringArg(argv, flag);
|
|
97
|
+
if (!res.found)
|
|
98
|
+
return undefined;
|
|
99
|
+
if (res.value === undefined)
|
|
100
|
+
return MISSING_FLAG_VALUE;
|
|
101
|
+
return res.value;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Parse a positive integer flag value.
|
|
105
|
+
*
|
|
106
|
+
* Returns:
|
|
107
|
+
* `undefined` — flag is absent (use default).
|
|
108
|
+
* `number` — flag present with a valid positive integer.
|
|
109
|
+
* `MISSING_FLAG_VALUE` — flag present but value token is missing.
|
|
110
|
+
* `INVALID_INT_VALUE` — flag present but value is non-numeric or ≤ 0.
|
|
111
|
+
*/
|
|
112
|
+
const INVALID_INT_VALUE = Symbol("INVALID_INT_VALUE");
|
|
113
|
+
function readPositiveInt(argv, flag) {
|
|
114
|
+
const res = readStringArg(argv, flag);
|
|
115
|
+
if (!res.found)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (res.value === undefined)
|
|
118
|
+
return MISSING_FLAG_VALUE;
|
|
119
|
+
const n = Number.parseInt(res.value, 10);
|
|
120
|
+
return Number.isFinite(n) && n > 0 ? n : INVALID_INT_VALUE;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Generate a stable run ID for one distill invocation.
|
|
124
|
+
* Format: `distill-<ISO date>-<6-char random hex>`.
|
|
125
|
+
* Not the idempotency key (that is sourceId); this is a per-run trace stamp.
|
|
126
|
+
*/
|
|
127
|
+
function makeRunId() {
|
|
128
|
+
const iso = new Date().toISOString().replace(/[:.]/g, "-");
|
|
129
|
+
const rand = Math.floor(Math.random() * 0xffffff)
|
|
130
|
+
.toString(16)
|
|
131
|
+
.padStart(6, "0");
|
|
132
|
+
return `distill-${iso}-${rand}`;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Derive a stable sourceId from a file path: basename without extension.
|
|
136
|
+
* E.g. "/path/to/chat-2026-01.txt" → "chat-2026-01".
|
|
137
|
+
*/
|
|
138
|
+
function sourceIdFromPath(filePath) {
|
|
139
|
+
const base = basename(filePath);
|
|
140
|
+
const ext = extname(base);
|
|
141
|
+
return ext ? base.slice(0, base.length - ext.length) : base;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Load config without constructing an LLM client (used on the --plan path).
|
|
145
|
+
* Returns err when the config is missing the distill: block — same refuse
|
|
146
|
+
* message as resolveDistillClient so the user sees a consistent error.
|
|
147
|
+
*/
|
|
148
|
+
function resolveDistillConfig(vaultRoot) {
|
|
149
|
+
const cfg = loadConfig(vaultRoot);
|
|
150
|
+
if (!cfg.ok)
|
|
151
|
+
return err(cfg.error);
|
|
152
|
+
if (!cfg.value.distill) {
|
|
153
|
+
return err(new Error(DISTILL_NOT_CONFIGURED_MSG));
|
|
154
|
+
}
|
|
155
|
+
return ok(cfg.value.distill);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* `daftari distill` CLI front door.
|
|
159
|
+
*
|
|
160
|
+
* Parses argv, validates inputs, then routes to one of:
|
|
161
|
+
* --plan (default): zero-spend pre-flight estimate.
|
|
162
|
+
* --propose: full LLM-driven extraction + staged proposals.
|
|
163
|
+
* --review: batch-ratify a prior run's staged proposals.
|
|
164
|
+
*
|
|
165
|
+
* Returns an exit code (0/2/3/4); the caller sets process.exitCode.
|
|
166
|
+
* Diagnostics go to stderr; clean output goes to stdout.
|
|
167
|
+
*/
|
|
168
|
+
export async function runDistill(argv) {
|
|
169
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
170
|
+
process.stdout.write(DISTILL_USAGE);
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Parse flags
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
// I5: both --plan and --propose is a usage error.
|
|
177
|
+
if (argv.includes("--plan") && argv.includes("--propose")) {
|
|
178
|
+
process.stderr.write(`daftari distill: cannot specify both --plan and --propose\n\n${DISTILL_USAGE}`);
|
|
179
|
+
return 2;
|
|
180
|
+
}
|
|
181
|
+
// I1: read value-taking flags; any flag present without a value is an error.
|
|
182
|
+
const vaultRes = readString(argv, "--vault");
|
|
183
|
+
if (vaultRes === MISSING_FLAG_VALUE) {
|
|
184
|
+
process.stderr.write(`daftari distill: --vault requires a value\n\n${DISTILL_USAGE}`);
|
|
185
|
+
return 2;
|
|
186
|
+
}
|
|
187
|
+
const vaultRaw = vaultRes ?? ".";
|
|
188
|
+
const vaultRoot = resolve(vaultRaw);
|
|
189
|
+
// --review <run_id>: batch-ratify mode. Handled before the source-file
|
|
190
|
+
// machinery because it takes a run_id, not a source file.
|
|
191
|
+
const reviewRes = readString(argv, "--review");
|
|
192
|
+
if (reviewRes === MISSING_FLAG_VALUE) {
|
|
193
|
+
process.stderr.write(`daftari distill: --review requires a run_id\n\n${DISTILL_USAGE}`);
|
|
194
|
+
return 2;
|
|
195
|
+
}
|
|
196
|
+
if (reviewRes !== undefined) {
|
|
197
|
+
if (argv.includes("--plan") || argv.includes("--propose")) {
|
|
198
|
+
process.stderr.write(`daftari distill: --review cannot be combined with --plan or --propose\n\n${DISTILL_USAGE}`);
|
|
199
|
+
return 2;
|
|
200
|
+
}
|
|
201
|
+
const byRes = readString(argv, "--by");
|
|
202
|
+
if (byRes === MISSING_FLAG_VALUE) {
|
|
203
|
+
process.stderr.write(`daftari distill: --by requires a value\n\n${DISTILL_USAGE}`);
|
|
204
|
+
return 2;
|
|
205
|
+
}
|
|
206
|
+
const principal = byRes ?? "cli";
|
|
207
|
+
const applied = argv.includes("--yes");
|
|
208
|
+
return await reviewRun(vaultRoot, reviewRes, principal, applied);
|
|
209
|
+
}
|
|
210
|
+
const sourceIdRes = readString(argv, "--source-id");
|
|
211
|
+
if (sourceIdRes === MISSING_FLAG_VALUE) {
|
|
212
|
+
process.stderr.write(`daftari distill: --source-id requires a value\n\n${DISTILL_USAGE}`);
|
|
213
|
+
return 2;
|
|
214
|
+
}
|
|
215
|
+
const sourceIdFlag = sourceIdRes;
|
|
216
|
+
const transportRes2 = readString(argv, "--transport");
|
|
217
|
+
if (transportRes2 === MISSING_FLAG_VALUE) {
|
|
218
|
+
process.stderr.write(`daftari distill: --transport requires a value\n\n${DISTILL_USAGE}`);
|
|
219
|
+
return 2;
|
|
220
|
+
}
|
|
221
|
+
const transportFlag = transportRes2;
|
|
222
|
+
const modelRes = readString(argv, "--model");
|
|
223
|
+
if (modelRes === MISSING_FLAG_VALUE) {
|
|
224
|
+
process.stderr.write(`daftari distill: --model requires a value\n\n${DISTILL_USAGE}`);
|
|
225
|
+
return 2;
|
|
226
|
+
}
|
|
227
|
+
const modelFlag = modelRes;
|
|
228
|
+
// I2: numeric flags — distinguish absent (ok) from present-but-bad (exit 2).
|
|
229
|
+
const maxLlmCallsRaw = readPositiveInt(argv, "--max-llm-calls");
|
|
230
|
+
if (maxLlmCallsRaw === MISSING_FLAG_VALUE) {
|
|
231
|
+
process.stderr.write(`daftari distill: --max-llm-calls requires a value\n\n${DISTILL_USAGE}`);
|
|
232
|
+
return 2;
|
|
233
|
+
}
|
|
234
|
+
if (maxLlmCallsRaw === INVALID_INT_VALUE) {
|
|
235
|
+
process.stderr.write(`daftari distill: --max-llm-calls must be a positive integer\n\n${DISTILL_USAGE}`);
|
|
236
|
+
return 2;
|
|
237
|
+
}
|
|
238
|
+
const maxLlmCallsFlag = maxLlmCallsRaw;
|
|
239
|
+
const maxClaimsRaw = readPositiveInt(argv, "--max-claims");
|
|
240
|
+
if (maxClaimsRaw === MISSING_FLAG_VALUE) {
|
|
241
|
+
process.stderr.write(`daftari distill: --max-claims requires a value\n\n${DISTILL_USAGE}`);
|
|
242
|
+
return 2;
|
|
243
|
+
}
|
|
244
|
+
if (maxClaimsRaw === INVALID_INT_VALUE) {
|
|
245
|
+
process.stderr.write(`daftari distill: --max-claims must be a positive integer\n\n${DISTILL_USAGE}`);
|
|
246
|
+
return 2;
|
|
247
|
+
}
|
|
248
|
+
const maxClaimsFlag = maxClaimsRaw;
|
|
249
|
+
const zdr = argv.includes("--zdr");
|
|
250
|
+
const wantPropose = argv.includes("--propose");
|
|
251
|
+
// When neither --plan nor --propose is given, default to --plan (safe zero-spend preview).
|
|
252
|
+
const mode = wantPropose ? "propose" : "plan";
|
|
253
|
+
// Source file is the first non-flag positional argument.
|
|
254
|
+
// Collect all positional args (those not starting with "--" and not
|
|
255
|
+
// immediately following a known value-taking flag).
|
|
256
|
+
const VALUE_FLAGS = new Set([
|
|
257
|
+
"--vault",
|
|
258
|
+
"--source-id",
|
|
259
|
+
"--transport",
|
|
260
|
+
"--max-llm-calls",
|
|
261
|
+
"--max-claims",
|
|
262
|
+
"--model",
|
|
263
|
+
"--review",
|
|
264
|
+
"--by",
|
|
265
|
+
]);
|
|
266
|
+
const positionals = [];
|
|
267
|
+
for (let i = 0; i < argv.length; i++) {
|
|
268
|
+
const a = argv[i];
|
|
269
|
+
if (a === "--plan" ||
|
|
270
|
+
a === "--propose" ||
|
|
271
|
+
a === "--zdr" ||
|
|
272
|
+
a === "--yes" ||
|
|
273
|
+
a === "--help" ||
|
|
274
|
+
a === "-h") {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (a.startsWith("--")) {
|
|
278
|
+
// Either a known value-flag or an unknown flag.
|
|
279
|
+
const bare = a.includes("=") ? a.slice(0, a.indexOf("=")) : a;
|
|
280
|
+
if (VALUE_FLAGS.has(bare)) {
|
|
281
|
+
// Skip the next token if the flag was written as `--flag value` (no `=`).
|
|
282
|
+
if (!a.includes("="))
|
|
283
|
+
i++;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
// Unknown flag → usage error.
|
|
287
|
+
process.stderr.write(`daftari distill: unknown flag: ${a}\n\n${DISTILL_USAGE}`);
|
|
288
|
+
return 2;
|
|
289
|
+
}
|
|
290
|
+
positionals.push(a);
|
|
291
|
+
}
|
|
292
|
+
// m3: reject extra positionals before checking for absent source.
|
|
293
|
+
if (positionals.length > 1) {
|
|
294
|
+
process.stderr.write(`daftari distill: only one source is accepted; got: ${positionals.join(", ")}\n\n${DISTILL_USAGE}`);
|
|
295
|
+
return 2;
|
|
296
|
+
}
|
|
297
|
+
const sourceArg = positionals[0];
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
// Validate source arg
|
|
300
|
+
// ---------------------------------------------------------------------------
|
|
301
|
+
if (sourceArg === undefined) {
|
|
302
|
+
process.stderr.write(`daftari distill: no source file given — pass a file path or '-' for stdin\n\n${DISTILL_USAGE}`);
|
|
303
|
+
return 2;
|
|
304
|
+
}
|
|
305
|
+
if (sourceArg === "-" && sourceIdFlag === undefined) {
|
|
306
|
+
process.stderr.write(`daftari distill: reading from stdin requires --source-id\n\n${DISTILL_USAGE}`);
|
|
307
|
+
return 2;
|
|
308
|
+
}
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
// Resolve config (both modes need it; only --propose also needs the client)
|
|
311
|
+
// ---------------------------------------------------------------------------
|
|
312
|
+
const configRes = resolveDistillConfig(vaultRoot);
|
|
313
|
+
if (!configRes.ok) {
|
|
314
|
+
process.stderr.write(`daftari distill: ${configRes.error.message}\n`);
|
|
315
|
+
return 3;
|
|
316
|
+
}
|
|
317
|
+
// Apply CLI overrides to a mutable copy of config.
|
|
318
|
+
const config = {
|
|
319
|
+
...configRes.value,
|
|
320
|
+
...(maxLlmCallsFlag !== undefined ? { maxLlmCalls: maxLlmCallsFlag } : {}),
|
|
321
|
+
...(maxClaimsFlag !== undefined ? { maxClaims: maxClaimsFlag } : {}),
|
|
322
|
+
...(modelFlag !== undefined ? { model: modelFlag } : {}),
|
|
323
|
+
};
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
// Read source content
|
|
326
|
+
// ---------------------------------------------------------------------------
|
|
327
|
+
// I3: guard stdin TTY before attempting to read (would block forever).
|
|
328
|
+
if (sourceArg === "-" && process.stdin.isTTY) {
|
|
329
|
+
process.stderr.write(`daftari distill: stdin is a terminal — pipe content or pass a file path\n`);
|
|
330
|
+
return 2;
|
|
331
|
+
}
|
|
332
|
+
let sourceContent;
|
|
333
|
+
try {
|
|
334
|
+
if (sourceArg === "-") {
|
|
335
|
+
// Read stdin synchronously (distill is not a long-running server).
|
|
336
|
+
const chunks = [];
|
|
337
|
+
for await (const chunk of process.stdin) {
|
|
338
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
339
|
+
}
|
|
340
|
+
sourceContent = Buffer.concat(chunks).toString("utf-8");
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
sourceContent = readFileSync(resolve(sourceArg), "utf-8");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
catch (e) {
|
|
347
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
348
|
+
process.stderr.write(`daftari distill: cannot read source: ${reason}\n`);
|
|
349
|
+
return 2;
|
|
350
|
+
}
|
|
351
|
+
// Stable source identity: explicit flag wins, else derive from filename.
|
|
352
|
+
const sourceId = sourceIdFlag ?? (sourceArg === "-" ? "stdin" : sourceIdFromPath(sourceArg));
|
|
353
|
+
// ---------------------------------------------------------------------------
|
|
354
|
+
// Parse + chunk (both modes)
|
|
355
|
+
// ---------------------------------------------------------------------------
|
|
356
|
+
// Adapter selection: v1 uses chat-transcript for all sources.
|
|
357
|
+
// Future adapters plug in here once the registry grows.
|
|
358
|
+
const adapter = ADAPTER_REGISTRY["chat-transcript"];
|
|
359
|
+
const messages = adapter.parse(sourceContent);
|
|
360
|
+
const chunks = chunkMessages(messages);
|
|
361
|
+
// ---------------------------------------------------------------------------
|
|
362
|
+
// --plan: zero-spend estimate
|
|
363
|
+
// ---------------------------------------------------------------------------
|
|
364
|
+
if (mode === "plan") {
|
|
365
|
+
const plan = planDistill(chunks, config);
|
|
366
|
+
const costLine = plan.estimatedCostUSD === 0
|
|
367
|
+
? "$0.00 (no chunks)"
|
|
368
|
+
: `~$${plan.estimatedCostUSD.toFixed(4)}${plan.priced ? "" : " (Haiku fallback pricing — model not in price table)"}`;
|
|
369
|
+
process.stdout.write([
|
|
370
|
+
`distill --plan`,
|
|
371
|
+
` source: ${sourceArg}`,
|
|
372
|
+
` source-id: ${sourceId}`,
|
|
373
|
+
` vault: ${vaultRoot}`,
|
|
374
|
+
` model: ${plan.model}`,
|
|
375
|
+
` chunks: ${plan.chunkCount}`,
|
|
376
|
+
` estimated LLM calls: ${plan.estimatedLlmCalls}`,
|
|
377
|
+
` estimated cost: ${costLine}`,
|
|
378
|
+
``,
|
|
379
|
+
`Run with --propose to extract claims and stage proposals.`,
|
|
380
|
+
``,
|
|
381
|
+
].join("\n"));
|
|
382
|
+
return 0;
|
|
383
|
+
}
|
|
384
|
+
// ---------------------------------------------------------------------------
|
|
385
|
+
// --propose: full extraction + staging
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
// C1: single transport resolution — resolveDistillClient owns transport
|
|
388
|
+
// selection and returns the transport it actually used. Reading provider
|
|
389
|
+
// from clientRes.value.transport ensures the receipt matches the client.
|
|
390
|
+
const clientRes = resolveDistillClient(vaultRoot, transportFlag);
|
|
391
|
+
if (!clientRes.ok) {
|
|
392
|
+
process.stderr.write(`daftari distill: ${clientRes.error.message}\n`);
|
|
393
|
+
return 3;
|
|
394
|
+
}
|
|
395
|
+
const transport = clientRes.value.transport;
|
|
396
|
+
const budgetedClient = withCallBudget(clientRes.value.client, config.maxLlmCalls);
|
|
397
|
+
const runId = makeRunId();
|
|
398
|
+
process.stderr.write(`daftari distill: extracting claims from ${sourceId} ` +
|
|
399
|
+
`(${chunks.length} chunks, max ${config.maxLlmCalls} LLM calls)...\n`);
|
|
400
|
+
const outcome = await extractClaims(chunks, budgetedClient, {
|
|
401
|
+
model: config.model,
|
|
402
|
+
maxClaims: config.maxClaims,
|
|
403
|
+
inCallInputCap: config.inCallInputCap,
|
|
404
|
+
});
|
|
405
|
+
if (outcome.chunkErrors.length > 0) {
|
|
406
|
+
process.stderr.write(`daftari distill: ${outcome.chunkErrors.length} chunk error(s):\n`);
|
|
407
|
+
for (const ce of outcome.chunkErrors) {
|
|
408
|
+
process.stderr.write(` [${ce.anchor}] ${ce.error}\n`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// U8: build the overlap-hinter from the vault's local search index.
|
|
412
|
+
// No AccessContext on the CLI path (single-user, no RBAC filter needed);
|
|
413
|
+
// vaultSearch tolerates undefined access — RBAC filter only applies when
|
|
414
|
+
// access is present.
|
|
415
|
+
const hinter = makeOverlapHinter(vaultRoot);
|
|
416
|
+
// Stage proposals via distillUpsert (idempotent join).
|
|
417
|
+
const upsertRes = await distillUpsert(vaultRoot, {
|
|
418
|
+
sourceId,
|
|
419
|
+
sourceContent,
|
|
420
|
+
claims: outcome.claims,
|
|
421
|
+
runId,
|
|
422
|
+
overlapSearch: hinter,
|
|
423
|
+
});
|
|
424
|
+
if (!upsertRes.ok) {
|
|
425
|
+
process.stderr.write(`daftari distill: staging error: ${upsertRes.error.message}\n`);
|
|
426
|
+
return 4;
|
|
427
|
+
}
|
|
428
|
+
const upsert = upsertRes.value;
|
|
429
|
+
const receipt = buildReceipt({
|
|
430
|
+
outcome,
|
|
431
|
+
config,
|
|
432
|
+
provider: transport,
|
|
433
|
+
zdr,
|
|
434
|
+
sourceId,
|
|
435
|
+
});
|
|
436
|
+
// Summary to stdout.
|
|
437
|
+
process.stdout.write([
|
|
438
|
+
`distill --propose complete`,
|
|
439
|
+
` run-id: ${runId}`,
|
|
440
|
+
` source-id: ${sourceId}`,
|
|
441
|
+
` model: ${receipt.model}`,
|
|
442
|
+
` LLM calls: ${receipt.llmCalls}`,
|
|
443
|
+
` claims: ${receipt.claimsProduced}`,
|
|
444
|
+
` skipped: ${upsert.skipped.length}`,
|
|
445
|
+
` updated: ${upsert.updated.length}`,
|
|
446
|
+
` created: ${upsert.created.length}`,
|
|
447
|
+
` noop: ${upsert.noop}`,
|
|
448
|
+
` truncated: ${receipt.truncated}`,
|
|
449
|
+
` approx cost: ~$${receipt.approxCostUSD.toFixed(4)}`,
|
|
450
|
+
` state written: ${upsert.stateWritten}`,
|
|
451
|
+
``,
|
|
452
|
+
].join("\n"));
|
|
453
|
+
// I4: warn on stateWritten:false — proposals staged, but next run will
|
|
454
|
+
// re-distill because the content-hash was not persisted.
|
|
455
|
+
if (!upsert.stateWritten) {
|
|
456
|
+
process.stderr.write(`daftari distill: warning: state write failed — next run will re-distill this source\n`);
|
|
457
|
+
}
|
|
458
|
+
if (outcome.budget_exhausted) {
|
|
459
|
+
process.stderr.write(`daftari distill: LLM call budget exhausted — run is partial (increase --max-llm-calls to continue)\n`);
|
|
460
|
+
}
|
|
461
|
+
// Exit 4 when any proposals failed to stage.
|
|
462
|
+
if (upsert.propose !== null && upsert.propose.errors.length > 0) {
|
|
463
|
+
process.stderr.write(`daftari distill: ${upsert.propose.errors.length} proposal(s) failed to stage\n`);
|
|
464
|
+
return 4;
|
|
465
|
+
}
|
|
466
|
+
return 0;
|
|
467
|
+
}
|
|
468
|
+
// ---------------------------------------------------------------------------
|
|
469
|
+
// --review: batch-ratify a prior run's staged proposals (U9)
|
|
470
|
+
// ---------------------------------------------------------------------------
|
|
471
|
+
/**
|
|
472
|
+
* Recover the distill source-id and claim-key from a staged action's
|
|
473
|
+
* `proposedDiff.frontmatter.sources[0]` (format `distill:<sourceId>#<claimKey>`).
|
|
474
|
+
* Returns null when the action is not a distill proposal or the ref is
|
|
475
|
+
* malformed — the caller still ratifies, it just cannot advance the landed map.
|
|
476
|
+
*/
|
|
477
|
+
function parseDistillRef(proposedDiff) {
|
|
478
|
+
if (typeof proposedDiff !== "object" || proposedDiff === null)
|
|
479
|
+
return null;
|
|
480
|
+
const fm = proposedDiff.frontmatter;
|
|
481
|
+
if (typeof fm !== "object" || fm === null)
|
|
482
|
+
return null;
|
|
483
|
+
const sources = fm.sources;
|
|
484
|
+
if (!Array.isArray(sources) || sources.length === 0)
|
|
485
|
+
return null;
|
|
486
|
+
const ref = sources[0];
|
|
487
|
+
if (typeof ref !== "string")
|
|
488
|
+
return null;
|
|
489
|
+
const m = /^distill:(.+?)#(.+)$/.exec(ref);
|
|
490
|
+
if (m === null)
|
|
491
|
+
return null;
|
|
492
|
+
return { sourceId: m[1], claimKey: m[2] };
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* `daftari distill --review <run_id>` — review and batch-approve the pending
|
|
496
|
+
* proposals emitted by a prior `--propose` run.
|
|
497
|
+
*
|
|
498
|
+
* Dry-run by default: lists the matched proposals and exits 0. With `applied`
|
|
499
|
+
* (the `--yes` flag), each pending proposal is dispatched through the existing
|
|
500
|
+
* `vault_ratify` path (F2: CLI-first, the MCP ratify tool is untouched) with
|
|
501
|
+
* `decision: "approve"`. Each ratify writes its doc and lands its own commit
|
|
502
|
+
* (F3: history per claim). After each successful land, the distill-state
|
|
503
|
+
* landed map is advanced via recordLandedClaim (U5's mark-after-land hook).
|
|
504
|
+
*
|
|
505
|
+
* Exit codes: 0 = success (including empty match / dry-run); 4 = one or more
|
|
506
|
+
* ratifies failed.
|
|
507
|
+
*/
|
|
508
|
+
async function reviewRun(vaultRoot, runId, principal, applied) {
|
|
509
|
+
const listRes = await listStagedActions(vaultRoot, "pending");
|
|
510
|
+
if (!listRes.ok) {
|
|
511
|
+
process.stderr.write(`daftari distill: ${listRes.error.message}\n`);
|
|
512
|
+
return 4;
|
|
513
|
+
}
|
|
514
|
+
const matched = listRes.value.filter((a) => a.runId === runId);
|
|
515
|
+
if (matched.length === 0) {
|
|
516
|
+
process.stdout.write(`distill --review ${runId}\n no pending proposals for this run.\n`);
|
|
517
|
+
return 0;
|
|
518
|
+
}
|
|
519
|
+
process.stdout.write([
|
|
520
|
+
`distill --review ${runId}`,
|
|
521
|
+
` ${matched.length} pending proposal(s):`,
|
|
522
|
+
...matched.map((a) => {
|
|
523
|
+
const firstLine = a.rationale.split("\n", 1)[0];
|
|
524
|
+
return ` ${a.id} ${a.targetPath}${firstLine ? ` — ${firstLine}` : ""}`;
|
|
525
|
+
}),
|
|
526
|
+
``,
|
|
527
|
+
].join("\n"));
|
|
528
|
+
if (!applied) {
|
|
529
|
+
process.stdout.write(`Dry-run: re-run with --yes to approve all ${matched.length} proposal(s).\n`);
|
|
530
|
+
return 0;
|
|
531
|
+
}
|
|
532
|
+
let approved = 0;
|
|
533
|
+
let failed = 0;
|
|
534
|
+
for (const action of matched) {
|
|
535
|
+
const ratifyRes = await vaultRatify(vaultRoot, {
|
|
536
|
+
id: action.id,
|
|
537
|
+
decision: "approve",
|
|
538
|
+
principal,
|
|
539
|
+
});
|
|
540
|
+
if (!ratifyRes.ok) {
|
|
541
|
+
failed++;
|
|
542
|
+
process.stderr.write(`daftari distill: ratify ${action.id} failed: ${ratifyRes.error.message}\n`);
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
approved++;
|
|
546
|
+
// Advance U5's landed map so a later re-distill of the same source treats
|
|
547
|
+
// this claim as already-landed. A non-distill proposal sharing the run_id
|
|
548
|
+
// (or a malformed ref) simply skips this step — the ratify still counts.
|
|
549
|
+
const ref = parseDistillRef(action.proposedDiff);
|
|
550
|
+
if (ref === null) {
|
|
551
|
+
process.stderr.write(`daftari distill: ${action.id} landed but has no distill source ref — landed map not advanced\n`);
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const landed = recordLandedClaim(vaultRoot, ref.sourceId, ref.claimKey, action.targetPath);
|
|
555
|
+
if (!landed.ok) {
|
|
556
|
+
process.stderr.write(`daftari distill: ${action.id} landed but state update failed: ${landed.error.message}\n`);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
process.stdout.write([
|
|
560
|
+
`distill --review complete`,
|
|
561
|
+
` run-id: ${runId}`,
|
|
562
|
+
` approved: ${approved}`,
|
|
563
|
+
` failed: ${failed}`,
|
|
564
|
+
``,
|
|
565
|
+
].join("\n"));
|
|
566
|
+
return failed > 0 ? 4 : 0;
|
|
567
|
+
}
|
|
568
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/distill/cli.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,EAAE;AACF,0EAA0E;AAC1E,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,0EAA0E;AAC1E,0EAA0E;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,aAAa,GAAG;;;;;;;;;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