digdig 0.0.4 → 0.0.6
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 +3 -3
- package/digdig.config.example.json +1 -1
- package/dist/commands/evidence.d.ts.map +1 -1
- package/dist/commands/evidence.js +5 -1
- package/dist/commands/evidence.js.map +1 -1
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +10 -1
- package/dist/commands/review.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/deep/graph-preprocess.d.ts +3 -9
- package/dist/deep/graph-preprocess.d.ts.map +1 -1
- package/dist/deep/graph-preprocess.js +11 -9
- package/dist/deep/graph-preprocess.js.map +1 -1
- package/dist/deep/session.d.ts.map +1 -1
- package/dist/deep/session.js +10 -4
- package/dist/deep/session.js.map +1 -1
- package/dist/deep/tfidf.d.ts +2 -24
- package/dist/deep/tfidf.d.ts.map +1 -1
- package/dist/deep/tfidf.js +22 -75
- package/dist/deep/tfidf.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +5 -3
- package/dist/init.js.map +1 -1
- package/dist/runCli.d.ts.map +1 -1
- package/dist/runCli.js +45 -73
- package/dist/runCli.js.map +1 -1
- package/package.json +1 -1
package/dist/deep/tfidf.js
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// ── Tokenization ──────────────────────────────────────────────
|
|
13
13
|
const CJK_RANGE = /[一-鿿㐀-䶿 -〿]/;
|
|
14
|
+
// A maximal run of CJK characters, or a maximal run of everything else. Splitting
|
|
15
|
+
// on runs is what keeps an ASCII word whole when it is glued to CJK: testing the
|
|
16
|
+
// token as a whole only asks whether it *contains* CJK, so `github中文社区` used
|
|
17
|
+
// to enter the bigram branch as one string and come out as
|
|
18
|
+
// ["gi","it","th","hu","ub","b中","中文","文社","社区"] with `github` absent.
|
|
19
|
+
const CJK_RUN = /[一-鿿㐀-䶿]+|[^一-鿿㐀-䶿]+/g;
|
|
14
20
|
/** Tokenize a single text string */
|
|
15
21
|
export function tokenize(text) {
|
|
16
22
|
const tokens = [];
|
|
@@ -20,84 +26,25 @@ export function tokenize(text) {
|
|
|
20
26
|
const cleaned = part.toLowerCase().replace(/[^\w一-鿿㐀-䶿]/g, '');
|
|
21
27
|
if (!cleaned)
|
|
22
28
|
continue;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
tokens.push(
|
|
29
|
+
for (const run of cleaned.match(CJK_RUN) ?? []) {
|
|
30
|
+
if (CJK_RANGE.test(run)) {
|
|
31
|
+
// A CJK run is expanded via character bigram. No pair spans the
|
|
32
|
+
// run boundary, so no `t异`-style fragment is ever emitted.
|
|
33
|
+
for (let i = 0; i < run.length - 1; i++) {
|
|
34
|
+
tokens.push(run.slice(i, i + 2));
|
|
35
|
+
}
|
|
36
|
+
// Also push single CJK chars if the run is a single char
|
|
37
|
+
if (run.length === 1)
|
|
38
|
+
tokens.push(run);
|
|
29
39
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
tokens.push(
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
// English/ASCII: only keep tokens with length >= 3
|
|
36
|
-
if (cleaned.length >= 3)
|
|
37
|
-
tokens.push(cleaned);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return tokens;
|
|
41
|
-
}
|
|
42
|
-
/** Compute TF-IDF over a set of results.
|
|
43
|
-
* Each result's "document" is the concatenation of title + content.
|
|
44
|
-
* Only results with a `content` field are included.
|
|
45
|
-
*/
|
|
46
|
-
export function computeTfIdf(results, opts) {
|
|
47
|
-
const top = opts?.top ?? 30;
|
|
48
|
-
const withContent = results.filter(r => r.content);
|
|
49
|
-
// Build per-document term sets and frequency maps
|
|
50
|
-
const docTermFreqs = [];
|
|
51
|
-
const docFreq = new Map(); // term → number of docs containing it
|
|
52
|
-
const totalTermFreq = new Map(); // term → total freq across all docs
|
|
53
|
-
for (const result of withContent) {
|
|
54
|
-
const text = `${result.title || ''} ${result.content || ''}`;
|
|
55
|
-
const tokens = tokenize(text);
|
|
56
|
-
// Dedupe within same result: count each term only once for doc freq
|
|
57
|
-
const seen = new Set();
|
|
58
|
-
const freq = new Map();
|
|
59
|
-
for (const token of tokens) {
|
|
60
|
-
freq.set(token, (freq.get(token) || 0) + 1);
|
|
61
|
-
if (!seen.has(token)) {
|
|
62
|
-
docFreq.set(token, (docFreq.get(token) || 0) + 1);
|
|
63
|
-
seen.add(token);
|
|
40
|
+
else if (run.length >= 3) {
|
|
41
|
+
// English/ASCII run: kept whole, only drop runs shorter than 3
|
|
42
|
+
tokens.push(run);
|
|
64
43
|
}
|
|
65
|
-
totalTermFreq.set(token, (totalTermFreq.get(token) || 0) + 1);
|
|
66
44
|
}
|
|
67
|
-
docTermFreqs.push(freq);
|
|
68
45
|
}
|
|
69
|
-
|
|
70
|
-
// Aggregate TF-IDF: sum tfidf across all docs, pick top terms
|
|
71
|
-
const aggregated = new Map();
|
|
72
|
-
for (const freq of docTermFreqs) {
|
|
73
|
-
for (const [term, tf] of freq) {
|
|
74
|
-
const df = docFreq.get(term) || 1;
|
|
75
|
-
const idf = Math.log(N / df) + 1; // smoothed IDF
|
|
76
|
-
const entry = aggregated.get(term);
|
|
77
|
-
if (entry) {
|
|
78
|
-
entry.tfSum += tf;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
aggregated.set(term, { tfSum: tf, idf, docFreq: df });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const terms = Array.from(aggregated.entries())
|
|
86
|
-
.map(([term, { tfSum, idf, docFreq: df }]) => ({
|
|
87
|
-
term,
|
|
88
|
-
tf: tfSum,
|
|
89
|
-
idf,
|
|
90
|
-
tfidf: tfSum * idf,
|
|
91
|
-
docFreq: df,
|
|
92
|
-
}))
|
|
93
|
-
.sort((a, b) => b.tfidf - a.tfidf)
|
|
94
|
-
.slice(0, top);
|
|
95
|
-
return {
|
|
96
|
-
terms,
|
|
97
|
-
tokenizationStrategy: 'whitespace_min3_cjk_bigram',
|
|
98
|
-
coverage: withContent.length / (results.length || 1),
|
|
99
|
-
resultsWithContent: withContent.length,
|
|
100
|
-
totalResults: results.length,
|
|
101
|
-
};
|
|
46
|
+
return tokens;
|
|
102
47
|
}
|
|
48
|
+
/** Description of what `tokenize` does, for callers that report it to the Agent. */
|
|
49
|
+
export const TOKENIZATION_STRATEGY = 'whitespace_min3_cjk_bigram_split';
|
|
103
50
|
//# sourceMappingURL=tfidf.js.map
|
package/dist/deep/tfidf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tfidf.js","sourceRoot":"","sources":["../../src/deep/tfidf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iEAAiE;AAEjE,MAAM,SAAS,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tfidf.js","sourceRoot":"","sources":["../../src/deep/tfidf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iEAAiE;AAEjE,MAAM,SAAS,GAAG,aAAa,CAAC;AAChC,kFAAkF;AAClF,iFAAiF;AACjF,6EAA6E;AAC7E,2DAA2D;AAC3D,uEAAuE;AACvE,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAExC,oCAAoC;AACpC,MAAM,UAAU,QAAQ,CAAC,IAAY;IACjC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,sBAAsB;IACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,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EAAE,MAAM,CAAC;CAC1B;AA0DD,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CAC1B;AA0DD,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CA2HlD"}
|
package/dist/init.js
CHANGED
|
@@ -15,7 +15,7 @@ const DEFAULT_CONFIG = {
|
|
|
15
15
|
proxyUrl: '',
|
|
16
16
|
// Same default as config.ts, so `init` does not write a value the README
|
|
17
17
|
// would then have to contradict.
|
|
18
|
-
timeout:
|
|
18
|
+
timeout: 25000,
|
|
19
19
|
ollamaApiKey: '',
|
|
20
20
|
deepseekApiKey: ''
|
|
21
21
|
};
|
|
@@ -92,8 +92,10 @@ export async function initConfig() {
|
|
|
92
92
|
const limitStr = await configurator.question('Default result limit', String(config.defaultLimit));
|
|
93
93
|
config.defaultLimit = Math.max(1, parseInt(limitStr, 10) || 10);
|
|
94
94
|
// Configure timeout
|
|
95
|
-
const timeoutStr = await configurator.question('Request timeout (milliseconds)', String(config.timeout));
|
|
96
|
-
|
|
95
|
+
const timeoutStr = await configurator.question('Request timeout (milliseconds, minimum 12000)', String(config.timeout));
|
|
96
|
+
// SearXNG's own `max_request_timeout` is 10.0s upstream, so anything under
|
|
97
|
+
// 12000 makes the client hang up on a server that is still working.
|
|
98
|
+
config.timeout = Math.max(12000, parseInt(timeoutStr, 10) || 25000);
|
|
97
99
|
// Configure proxy
|
|
98
100
|
console.log('\n--- Proxy Configuration ---');
|
|
99
101
|
const useProxy = await configurator.confirm('Use HTTP proxy', config.useProxy);
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAchD,MAAM,cAAc,GAAkB;IAClC,OAAO,EAAE,uBAAuB;IAChC,aAAa,EAAE,EAAE;IACjB,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,EAAE;IACZ,yEAAyE;IACzE,iCAAiC;IACjC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,EAAE;IAChB,cAAc,EAAE,EAAE;CACrB,CAAC;AAEF,MAAM,qBAAqB;IACf,EAAE,CAAqB;IAE/B;QACI,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YAC/B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,YAAqB;QAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;YACrF,IAAI,C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IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBACzB,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAC5C,OAAO,CAAC,CAAC;QACb,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,qCAAqC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7G,OAAO,CAAC,CAAC;QACb,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC5C,OAAO,CAAC,CAAC;IACb,CAAC;AACL,CAAC"}
|
package/dist/runCli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCli.d.ts","sourceRoot":"","sources":["../src/runCli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAAE,cAAc,EAA+C,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"runCli.d.ts","sourceRoot":"","sources":["../src/runCli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAAE,cAAc,EAA+C,MAAM,cAAc,CAAC;AA8sB3F,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAwiB1D;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmR5F"}
|
package/dist/runCli.js
CHANGED
|
@@ -164,16 +164,6 @@ function formatPreprocessAsMarkdown(data) {
|
|
|
164
164
|
if (data.coOccurrenceTruncated)
|
|
165
165
|
lines.push('*Co-occurrence matrix was truncated*');
|
|
166
166
|
lines.push('');
|
|
167
|
-
if (data.tfidfTerms?.length) {
|
|
168
|
-
lines.push('### Top TF-IDF Terms');
|
|
169
|
-
lines.push('');
|
|
170
|
-
lines.push('| Term | TF-IDF | Doc Freq |');
|
|
171
|
-
lines.push('|------|--------|----------|');
|
|
172
|
-
for (const t of data.tfidfTerms.slice(0, 20)) {
|
|
173
|
-
lines.push(`| ${t.term} | ${t.tfidf.toFixed(2)} | ${t.docFreq} |`);
|
|
174
|
-
}
|
|
175
|
-
lines.push('');
|
|
176
|
-
}
|
|
177
167
|
if (data.coOccurrences?.length) {
|
|
178
168
|
lines.push('### Co-occurrences');
|
|
179
169
|
lines.push('');
|
|
@@ -216,10 +206,14 @@ function formatFactsAsMarkdown(facts) {
|
|
|
216
206
|
if (facts.pending.length) {
|
|
217
207
|
lines.push(`**Awaiting approval:** ${facts.pending.length}`);
|
|
218
208
|
lines.push('');
|
|
219
|
-
|
|
220
|
-
|
|
209
|
+
// `id` and `rev` are not decoration: the footer tells the Agent to write
|
|
210
|
+
// selections for --approve-file, and this table is where it reads them.
|
|
211
|
+
// A markdown rendering that dropped them would be cheaper per token and
|
|
212
|
+
// useless for the step that follows.
|
|
213
|
+
lines.push('| # | ID | Rev | Source | Body | Verified | Round | Title |');
|
|
214
|
+
lines.push('|---|----|-----|--------|------|----------|-------|-------|');
|
|
221
215
|
facts.pending.forEach((fact, index) => {
|
|
222
|
-
lines.push(`| ${index} | ${fact.domain || '-'} | ${fact.contentLength} | ${fact.verified ? '✓' : '✗'} | ${fact.round ?? '-'} | ${fact.title || fact.url} |`);
|
|
216
|
+
lines.push(`| ${index} | ${fact.id} | ${fact.revision} | ${fact.domain || '-'} | ${fact.contentLength} | ${fact.verified ? '✓' : '✗'} | ${fact.round ?? '-'} | ${fact.title || fact.url} |`);
|
|
223
217
|
});
|
|
224
218
|
lines.push('');
|
|
225
219
|
}
|
|
@@ -372,28 +366,6 @@ async function searchOneQuery(service, plan, searchOptions, limit) {
|
|
|
372
366
|
function originTool(engine) {
|
|
373
367
|
return EXTERNAL_PROVIDERS.includes(engine) ? engine : 'digdig';
|
|
374
368
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Resolve `--format` for a subcommand.
|
|
377
|
-
*
|
|
378
|
-
* The root program declares `-f, --format` too, and Commander assigns a flag to
|
|
379
|
-
* the program it appears *after* — but a subcommand's own `opts.format` then
|
|
380
|
-
* arrives as `undefined`, while the parent reports its default (`md`). Neither
|
|
381
|
-
* `opts` nor `command.rawArgs` (empty for a nested command) can answer, so the
|
|
382
|
-
* argv handed to `runCli` is carried through `createProgram` and read here.
|
|
383
|
-
*/
|
|
384
|
-
function subcommandFormat(argv, command, fallback) {
|
|
385
|
-
const start = argv.indexOf(command);
|
|
386
|
-
if (start === -1)
|
|
387
|
-
return fallback;
|
|
388
|
-
for (let i = start + 1; i < argv.length; i++) {
|
|
389
|
-
const arg = argv[i];
|
|
390
|
-
if (arg === '--format' || arg === '-f')
|
|
391
|
-
return argv[i + 1];
|
|
392
|
-
if (arg.startsWith('--format='))
|
|
393
|
-
return arg.slice('--format='.length);
|
|
394
|
-
}
|
|
395
|
-
return fallback;
|
|
396
|
-
}
|
|
397
369
|
async function runSearch(service, options) {
|
|
398
370
|
const queries = options.queries || (options.query ? [options.query] : []);
|
|
399
371
|
if (queries.length === 0) {
|
|
@@ -719,9 +691,9 @@ export function createProgram(argv = []) {
|
|
|
719
691
|
.option('--depth <n>', 'BFS depth (default: 2)', val => parseInt(val, 10), 2)
|
|
720
692
|
.option('--strategy <strategy>', 'Sampling strategy: augmented_chain | dual_core_bridge | community_core_path | deep_chain | mixed')
|
|
721
693
|
.option('-f, --format <fmt>', 'Output format: md, json')
|
|
722
|
-
.action(async (path, opts) => {
|
|
694
|
+
.action(async (path, opts, command) => {
|
|
723
695
|
console.warn('[DEPRECATED] query-graph is deprecated. Use graph-explore + graph-drill instead.');
|
|
724
|
-
const graphFormat =
|
|
696
|
+
const graphFormat = command.optsWithGlobals().format === 'json' ? 'json' : 'md';
|
|
725
697
|
const code = await runQueryGraph({
|
|
726
698
|
graphFile: path,
|
|
727
699
|
seeds: opts.seeds?.split(',').map((s) => s.trim()).filter(Boolean) || [],
|
|
@@ -836,12 +808,12 @@ Examples:
|
|
|
836
808
|
Note: --fallback-rules is experimental and may produce low-quality obfuscation labels.
|
|
837
809
|
Recommended workflow: use --list to get candidates, then have an LLM generate obfuscated labels,
|
|
838
810
|
and write them back via graph-add.`)
|
|
839
|
-
.action(async (path, opts) => {
|
|
811
|
+
.action(async (path, opts, command) => {
|
|
840
812
|
const code = await runGraphObfuscateCommand({
|
|
841
813
|
graphFile: path,
|
|
842
814
|
list: opts.list ?? !opts.fallbackRules,
|
|
843
815
|
fallbackRules: opts.fallbackRules ?? false,
|
|
844
|
-
format:
|
|
816
|
+
format: command.optsWithGlobals().format === 'md' ? 'md' : 'json',
|
|
845
817
|
skipEntityTypes: opts.skipTypes?.split(',').map((t) => t.trim()).filter(Boolean),
|
|
846
818
|
});
|
|
847
819
|
process.exitCode = code;
|
|
@@ -849,7 +821,7 @@ and write them back via graph-add.`)
|
|
|
849
821
|
program
|
|
850
822
|
.command('graph-preprocess')
|
|
851
823
|
.argument('<session>', 'Session directory or name')
|
|
852
|
-
.description('Preprocess session data:
|
|
824
|
+
.description('Preprocess session data: co-occurrence, term frequencies, entity context, and result provenance')
|
|
853
825
|
.option('--top <n>', 'Top N terms to return', val => parseInt(val, 10), 30)
|
|
854
826
|
.option('--co-occurrence-threshold <n>', 'Min co-occurrence count', val => parseInt(val, 10), 2)
|
|
855
827
|
.option('--max-terms <n>', 'Max terms for co-occurrence matrix', val => parseInt(val, 10), 50)
|
|
@@ -858,14 +830,14 @@ and write them back via graph-add.`)
|
|
|
858
830
|
Examples:
|
|
859
831
|
dg graph-preprocess my-session
|
|
860
832
|
dg graph-preprocess my-session --top 50 --format md`)
|
|
861
|
-
.action(async (session, opts) => {
|
|
833
|
+
.action(async (session, opts, command) => {
|
|
862
834
|
const sessionDir = resolveSessionPath(session);
|
|
863
835
|
const result = graphPreprocess(sessionDir, {
|
|
864
836
|
top: opts.top,
|
|
865
837
|
coOccurrenceThreshold: opts.coOccurrenceThreshold,
|
|
866
838
|
maxTermsForCoOccurrence: opts.maxTerms,
|
|
867
839
|
});
|
|
868
|
-
if (
|
|
840
|
+
if (command.optsWithGlobals().format === 'md') {
|
|
869
841
|
console.log(formatPreprocessAsMarkdown(result));
|
|
870
842
|
}
|
|
871
843
|
else {
|
|
@@ -888,7 +860,7 @@ Examples:
|
|
|
888
860
|
.action(async (session, opts, command) => {
|
|
889
861
|
const code = await runCoverage({
|
|
890
862
|
session,
|
|
891
|
-
format:
|
|
863
|
+
format: command.optsWithGlobals().format === 'md' ? 'md' : 'json',
|
|
892
864
|
});
|
|
893
865
|
process.exitCode = code;
|
|
894
866
|
});
|
|
@@ -901,13 +873,13 @@ Examples:
|
|
|
901
873
|
Examples:
|
|
902
874
|
dg suggest-queries my-session
|
|
903
875
|
dg suggest-queries my-session --format md`)
|
|
904
|
-
.action(async (session, opts) => {
|
|
876
|
+
.action(async (session, opts, command) => {
|
|
905
877
|
const sessionDir = resolveSessionPath(session);
|
|
906
878
|
const graph = loadSessionGraph(sessionDir);
|
|
907
879
|
const results = loadSessionResults(sessionDir);
|
|
908
880
|
const stage = determineSearchStage(graph);
|
|
909
881
|
const data = generateQuerySuggestions(graph, results, stage);
|
|
910
|
-
if (
|
|
882
|
+
if (command.optsWithGlobals().format === 'md') {
|
|
911
883
|
console.log(formatSuggestAsMarkdown(data));
|
|
912
884
|
}
|
|
913
885
|
else {
|
|
@@ -926,14 +898,14 @@ Examples:
|
|
|
926
898
|
Examples:
|
|
927
899
|
dg strategy-info my-session
|
|
928
900
|
dg strategy-info my-session --format md`)
|
|
929
|
-
.action(async (session, opts) => {
|
|
901
|
+
.action(async (session, opts, command) => {
|
|
930
902
|
const sessionDir = resolveSessionPath(session);
|
|
931
903
|
const graph = loadSessionGraph(sessionDir);
|
|
932
904
|
const info = getStrategyInfo(graph, {
|
|
933
905
|
broadRounds: opts.broadRounds,
|
|
934
906
|
transitionThreshold: opts.transitionThreshold,
|
|
935
907
|
});
|
|
936
|
-
if (
|
|
908
|
+
if (command.optsWithGlobals().format === 'md') {
|
|
937
909
|
console.log(formatStrategyAsMarkdown(info));
|
|
938
910
|
}
|
|
939
911
|
else {
|
|
@@ -950,12 +922,12 @@ Examples:
|
|
|
950
922
|
Examples:
|
|
951
923
|
dg session-report my-session
|
|
952
924
|
dg session-report my-session --format md`)
|
|
953
|
-
.action(async (session, opts) => {
|
|
925
|
+
.action(async (session, opts, command) => {
|
|
954
926
|
const sessionDir = resolveSessionPath(session);
|
|
955
927
|
const graph = loadSessionGraph(sessionDir);
|
|
956
928
|
const results = loadSessionResults(sessionDir);
|
|
957
929
|
const analysis = getSessionAnalysis(graph, results, getPendingResults(sessionDir));
|
|
958
|
-
if (
|
|
930
|
+
if (command.optsWithGlobals().format === 'md') {
|
|
959
931
|
console.log(formatSessionReportAsMarkdown(analysis));
|
|
960
932
|
}
|
|
961
933
|
else {
|
|
@@ -975,11 +947,11 @@ Examples:
|
|
|
975
947
|
dg graph-explore my-session --seed "tokio" --format json
|
|
976
948
|
|
|
977
949
|
See also: graph-drill, graph-search`)
|
|
978
|
-
.action(async (session, opts) => {
|
|
950
|
+
.action(async (session, opts, command) => {
|
|
979
951
|
const code = await runGraphExplore({
|
|
980
952
|
session,
|
|
981
953
|
seed: opts.seed,
|
|
982
|
-
format:
|
|
954
|
+
format: command.optsWithGlobals().format === 'json' ? 'json' : 'md',
|
|
983
955
|
});
|
|
984
956
|
process.exitCode = code;
|
|
985
957
|
});
|
|
@@ -996,12 +968,12 @@ Examples:
|
|
|
996
968
|
dg graph-drill my-session --seed "tokio" --relations "alternative_to,depends_on" --format json
|
|
997
969
|
|
|
998
970
|
See also: graph-explore`)
|
|
999
|
-
.action(async (session, opts) => {
|
|
971
|
+
.action(async (session, opts, command) => {
|
|
1000
972
|
const code = await runGraphDrill({
|
|
1001
973
|
session,
|
|
1002
974
|
seed: opts.seed,
|
|
1003
975
|
relations: opts.relations.split(',').map((r) => r.trim()).filter(Boolean),
|
|
1004
|
-
format:
|
|
976
|
+
format: command.optsWithGlobals().format === 'json' ? 'json' : 'md',
|
|
1005
977
|
});
|
|
1006
978
|
process.exitCode = code;
|
|
1007
979
|
});
|
|
@@ -1018,11 +990,11 @@ Examples:
|
|
|
1018
990
|
|
|
1019
991
|
Note: Path nodes are created by graph-preprocess. If no paths exist,
|
|
1020
992
|
the command will list available path node IDs.`)
|
|
1021
|
-
.action(async (session, opts) => {
|
|
993
|
+
.action(async (session, opts, command) => {
|
|
1022
994
|
const code = await runGraphTraverse({
|
|
1023
995
|
session,
|
|
1024
996
|
pathId: opts.path,
|
|
1025
|
-
format:
|
|
997
|
+
format: command.optsWithGlobals().format === 'json' ? 'json' : 'md',
|
|
1026
998
|
});
|
|
1027
999
|
process.exitCode = code;
|
|
1028
1000
|
});
|
|
@@ -1039,12 +1011,12 @@ Examples:
|
|
|
1039
1011
|
dg graph-search my-session --keyword "tokio" --limit 5 --format json
|
|
1040
1012
|
|
|
1041
1013
|
See also: graph-explore (for viewing relations of a known entity)`)
|
|
1042
|
-
.action(async (session, opts) => {
|
|
1014
|
+
.action(async (session, opts, command) => {
|
|
1043
1015
|
const code = await runGraphSearch({
|
|
1044
1016
|
session,
|
|
1045
1017
|
keyword: opts.keyword,
|
|
1046
1018
|
limit: opts.limit,
|
|
1047
|
-
format:
|
|
1019
|
+
format: command.optsWithGlobals().format === 'json' ? 'json' : 'md',
|
|
1048
1020
|
});
|
|
1049
1021
|
process.exitCode = code;
|
|
1050
1022
|
});
|
|
@@ -1060,11 +1032,11 @@ See also: graph-explore (for viewing relations of a known entity)`)
|
|
|
1060
1032
|
Examples:
|
|
1061
1033
|
dg claim-add my-session --claim-file .digdig/sessions/my-session/agent-inputs/claim.json
|
|
1062
1034
|
dg claim-add my-session --claims-file .digdig/sessions/my-session/agent-inputs/claims.json`)
|
|
1063
|
-
.action(async (session, opts) => {
|
|
1035
|
+
.action(async (session, opts, command) => {
|
|
1064
1036
|
const code = await runClaimAdd(session, {
|
|
1065
1037
|
claimFile: opts.claimFile,
|
|
1066
1038
|
claimsFile: opts.claimsFile,
|
|
1067
|
-
format:
|
|
1039
|
+
format: command.optsWithGlobals().format,
|
|
1068
1040
|
});
|
|
1069
1041
|
process.exitCode = code;
|
|
1070
1042
|
});
|
|
@@ -1074,10 +1046,10 @@ Examples:
|
|
|
1074
1046
|
.description('List claims')
|
|
1075
1047
|
.option('--status <status>', 'Filter by status: pending, verifying, reviewed')
|
|
1076
1048
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1077
|
-
.action(async (session, opts) => {
|
|
1049
|
+
.action(async (session, opts, command) => {
|
|
1078
1050
|
const code = await runClaimList(session, {
|
|
1079
1051
|
status: opts.status,
|
|
1080
|
-
format:
|
|
1052
|
+
format: command.optsWithGlobals().format,
|
|
1081
1053
|
});
|
|
1082
1054
|
process.exitCode = code;
|
|
1083
1055
|
});
|
|
@@ -1087,10 +1059,10 @@ Examples:
|
|
|
1087
1059
|
.description('Search candidate evidence for a claim (read-only)')
|
|
1088
1060
|
.requiredOption('--claim-id <id>', 'Claim ID')
|
|
1089
1061
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1090
|
-
.action(async (session, opts) => {
|
|
1062
|
+
.action(async (session, opts, command) => {
|
|
1091
1063
|
const code = await runEvidenceSearch(session, {
|
|
1092
1064
|
claimId: opts.claimId,
|
|
1093
|
-
format:
|
|
1065
|
+
format: command.optsWithGlobals().format,
|
|
1094
1066
|
});
|
|
1095
1067
|
process.exitCode = code;
|
|
1096
1068
|
});
|
|
@@ -1105,7 +1077,7 @@ Examples:
|
|
|
1105
1077
|
.option('--confidence <n>', 'Confidence 0-1', parseFloat)
|
|
1106
1078
|
.option('--complete', 'Auto-trigger policy aggregation after this evidence')
|
|
1107
1079
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1108
|
-
.action(async (session, opts) => {
|
|
1080
|
+
.action(async (session, opts, command) => {
|
|
1109
1081
|
const code = await runEvidenceVerify(session, {
|
|
1110
1082
|
claimId: opts.claimId,
|
|
1111
1083
|
evidenceFile: opts.evidenceFile,
|
|
@@ -1113,7 +1085,7 @@ Examples:
|
|
|
1113
1085
|
reason: opts.reason,
|
|
1114
1086
|
confidence: opts.confidence,
|
|
1115
1087
|
complete: opts.complete ?? false,
|
|
1116
|
-
format:
|
|
1088
|
+
format: command.optsWithGlobals().format,
|
|
1117
1089
|
});
|
|
1118
1090
|
process.exitCode = code;
|
|
1119
1091
|
});
|
|
@@ -1123,10 +1095,10 @@ Examples:
|
|
|
1123
1095
|
.description('List evidence for a claim')
|
|
1124
1096
|
.requiredOption('--claim-id <id>', 'Claim ID')
|
|
1125
1097
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1126
|
-
.action(async (session, opts) => {
|
|
1098
|
+
.action(async (session, opts, command) => {
|
|
1127
1099
|
const code = await runEvidenceList(session, {
|
|
1128
1100
|
claimId: opts.claimId,
|
|
1129
|
-
format:
|
|
1101
|
+
format: command.optsWithGlobals().format,
|
|
1130
1102
|
});
|
|
1131
1103
|
process.exitCode = code;
|
|
1132
1104
|
});
|
|
@@ -1136,10 +1108,10 @@ Examples:
|
|
|
1136
1108
|
.description('List verdicts for a claim')
|
|
1137
1109
|
.requiredOption('--claim-id <id>', 'Claim ID')
|
|
1138
1110
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1139
|
-
.action(async (session, opts) => {
|
|
1111
|
+
.action(async (session, opts, command) => {
|
|
1140
1112
|
const code = await runVerdictList(session, {
|
|
1141
1113
|
claimId: opts.claimId,
|
|
1142
|
-
format:
|
|
1114
|
+
format: command.optsWithGlobals().format,
|
|
1143
1115
|
});
|
|
1144
1116
|
process.exitCode = code;
|
|
1145
1117
|
});
|
|
@@ -1149,10 +1121,10 @@ Examples:
|
|
|
1149
1121
|
.description('Run policy aggregation (manual, or auto via evidence-verify --complete)')
|
|
1150
1122
|
.option('--claim-id <id>', 'Aggregate only a specific claim')
|
|
1151
1123
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1152
|
-
.action(async (session, opts) => {
|
|
1124
|
+
.action(async (session, opts, command) => {
|
|
1153
1125
|
const code = await runPolicyAggregate(session, {
|
|
1154
1126
|
claimId: opts.claimId,
|
|
1155
|
-
format:
|
|
1127
|
+
format: command.optsWithGlobals().format,
|
|
1156
1128
|
});
|
|
1157
1129
|
process.exitCode = code;
|
|
1158
1130
|
});
|
|
@@ -1162,10 +1134,10 @@ Examples:
|
|
|
1162
1134
|
.description('List reviews')
|
|
1163
1135
|
.option('--status <status>', 'Filter: approved, needsReview, rejected')
|
|
1164
1136
|
.option('-f, --format <fmt>', 'Output format: json (default), md')
|
|
1165
|
-
.action(async (session, opts) => {
|
|
1137
|
+
.action(async (session, opts, command) => {
|
|
1166
1138
|
const code = await runReviewList(session, {
|
|
1167
1139
|
status: opts.status,
|
|
1168
|
-
format:
|
|
1140
|
+
format: command.optsWithGlobals().format,
|
|
1169
1141
|
});
|
|
1170
1142
|
process.exitCode = code;
|
|
1171
1143
|
});
|