greprag 5.18.0 → 5.19.1
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/commands/corpus/client.d.ts +58 -0
- package/dist/commands/corpus/client.js +182 -0
- package/dist/commands/corpus/client.js.map +1 -0
- package/dist/commands/corpus/index.d.ts +23 -0
- package/dist/commands/corpus/index.js +109 -0
- package/dist/commands/corpus/index.js.map +1 -0
- package/dist/commands/corpus/manage.d.ts +6 -0
- package/dist/commands/corpus/manage.js +49 -0
- package/dist/commands/corpus/manage.js.map +1 -0
- package/dist/commands/corpus/refresh.d.ts +11 -0
- package/dist/commands/corpus/refresh.js +117 -0
- package/dist/commands/corpus/refresh.js.map +1 -0
- package/dist/commands/corpus/search.d.ts +6 -0
- package/dist/commands/corpus/search.js +110 -0
- package/dist/commands/corpus/search.js.map +1 -0
- package/dist/commands/corpus/section.d.ts +5 -0
- package/dist/commands/corpus/section.js +35 -0
- package/dist/commands/corpus/section.js.map +1 -0
- package/dist/commands/corpus/source.d.ts +15 -0
- package/dist/commands/corpus/source.js +119 -0
- package/dist/commands/corpus/source.js.map +1 -0
- package/dist/commands/corpus/status.d.ts +5 -0
- package/dist/commands/corpus/status.js +47 -0
- package/dist/commands/corpus/status.js.map +1 -0
- package/dist/commands/corpus/upload.d.ts +7 -0
- package/dist/commands/corpus/upload.js +101 -0
- package/dist/commands/corpus/upload.js.map +1 -0
- package/dist/commands/corpus/walk.d.ts +5 -0
- package/dist/commands/corpus/walk.js +41 -0
- package/dist/commands/corpus/walk.js.map +1 -0
- package/dist/commands/session.d.ts +8 -0
- package/dist/commands/session.js +132 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/hook.js +9 -2
- package/dist/hook.js.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/corpus.d.ts +0 -18
- package/dist/commands/corpus.js +0 -617
- package/dist/commands/corpus.js.map +0 -1
- package/dist/commands/fact.d.ts +0 -22
- package/dist/commands/fact.js +0 -337
- package/dist/commands/fact.js.map +0 -1
- package/dist/commands/inbox-watch-supervisor.d.ts +0 -31
- package/dist/commands/inbox-watch-supervisor.js +0 -173
- package/dist/commands/inbox-watch-supervisor.js.map +0 -1
- package/dist/commands/inbox-watch-util.d.ts +0 -5
- package/dist/commands/inbox-watch-util.js +0 -13
- package/dist/commands/inbox-watch-util.js.map +0 -1
- package/dist/commands/odyssey.d.ts +0 -27
- package/dist/commands/odyssey.js +0 -394
- package/dist/commands/odyssey.js.map +0 -1
- package/dist/inbox-notify.d.ts +0 -60
- package/dist/inbox-notify.js +0 -229
- package/dist/inbox-notify.js.map +0 -1
package/dist/commands/fact.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** greprag fact — per-project self-organizing knowledge substrate.
|
|
2
|
-
*
|
|
3
|
-
* Pull-based phase 1 (see ~/.claude/CLAUDE.md § Chip Spawning "Before
|
|
4
|
-
* composing" preamble). Agents seed facts they wish a future spawned chip
|
|
5
|
-
* had known; future chips query
|
|
6
|
-
* the relevant scope at spawn time and skip the discovery they would
|
|
7
|
-
* otherwise repeat. All server work delegates to FactsService in
|
|
8
|
-
* @greprag/core via /v1/facts/:projectId — the CLI is a thin HTTP printer
|
|
9
|
-
* + project resolver.
|
|
10
|
-
*
|
|
11
|
-
* Subcommands:
|
|
12
|
-
* add "<text>" --scope <S> [--project <name>] [--source-session <id>]
|
|
13
|
-
* query [--scope <S>] [--query "<intent>"] [--project <name>]
|
|
14
|
-
* [--limit <N=10>] [--format markdown|json]
|
|
15
|
-
* list [--project <name>]
|
|
16
|
-
* delete <nodeId> [--project <name>]
|
|
17
|
-
* scopes [--project <name>]
|
|
18
|
-
*
|
|
19
|
-
* Project resolution: without --project, uses the current cwd's project
|
|
20
|
-
* anchor (readAnchor). With --project <name>, hits /v1/projects to
|
|
21
|
-
* resolve name → projectId (case-insensitive). */
|
|
22
|
-
export declare function runFact(args: string[]): Promise<void>;
|
package/dist/commands/fact.js
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** greprag fact — per-project self-organizing knowledge substrate.
|
|
3
|
-
*
|
|
4
|
-
* Pull-based phase 1 (see ~/.claude/CLAUDE.md § Chip Spawning "Before
|
|
5
|
-
* composing" preamble). Agents seed facts they wish a future spawned chip
|
|
6
|
-
* had known; future chips query
|
|
7
|
-
* the relevant scope at spawn time and skip the discovery they would
|
|
8
|
-
* otherwise repeat. All server work delegates to FactsService in
|
|
9
|
-
* @greprag/core via /v1/facts/:projectId — the CLI is a thin HTTP printer
|
|
10
|
-
* + project resolver.
|
|
11
|
-
*
|
|
12
|
-
* Subcommands:
|
|
13
|
-
* add "<text>" --scope <S> [--project <name>] [--source-session <id>]
|
|
14
|
-
* query [--scope <S>] [--query "<intent>"] [--project <name>]
|
|
15
|
-
* [--limit <N=10>] [--format markdown|json]
|
|
16
|
-
* list [--project <name>]
|
|
17
|
-
* delete <nodeId> [--project <name>]
|
|
18
|
-
* scopes [--project <name>]
|
|
19
|
-
*
|
|
20
|
-
* Project resolution: without --project, uses the current cwd's project
|
|
21
|
-
* anchor (readAnchor). With --project <name>, hits /v1/projects to
|
|
22
|
-
* resolve name → projectId (case-insensitive). */
|
|
23
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
-
}
|
|
29
|
-
Object.defineProperty(o, k2, desc);
|
|
30
|
-
}) : (function(o, m, k, k2) {
|
|
31
|
-
if (k2 === undefined) k2 = k;
|
|
32
|
-
o[k2] = m[k];
|
|
33
|
-
}));
|
|
34
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
-
}) : function(o, v) {
|
|
37
|
-
o["default"] = v;
|
|
38
|
-
});
|
|
39
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
-
var ownKeys = function(o) {
|
|
41
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
-
var ar = [];
|
|
43
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
-
return ar;
|
|
45
|
-
};
|
|
46
|
-
return ownKeys(o);
|
|
47
|
-
};
|
|
48
|
-
return function (mod) {
|
|
49
|
-
if (mod && mod.__esModule) return mod;
|
|
50
|
-
var result = {};
|
|
51
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
-
__setModuleDefault(result, mod);
|
|
53
|
-
return result;
|
|
54
|
-
};
|
|
55
|
-
})();
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.runFact = runFact;
|
|
58
|
-
const fs = __importStar(require("fs"));
|
|
59
|
-
const path = __importStar(require("path"));
|
|
60
|
-
const project_anchor_1 = require("../project-anchor");
|
|
61
|
-
const API_URL_DEFAULT = 'https://api.greprag.com';
|
|
62
|
-
// ---------- Config / env (mirrors corpus.ts) ------------------------------
|
|
63
|
-
function loadEnvFile(filePath) {
|
|
64
|
-
try {
|
|
65
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
66
|
-
for (const line of content.split('\n')) {
|
|
67
|
-
const trimmed = line.trim();
|
|
68
|
-
if (!trimmed || trimmed.startsWith('#'))
|
|
69
|
-
continue;
|
|
70
|
-
const eqIdx = trimmed.indexOf('=');
|
|
71
|
-
if (eqIdx < 1)
|
|
72
|
-
continue;
|
|
73
|
-
const key = trimmed.slice(0, eqIdx).trim();
|
|
74
|
-
let value = trimmed.slice(eqIdx + 1).trim();
|
|
75
|
-
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
76
|
-
(value.startsWith("'") && value.endsWith("'"))) {
|
|
77
|
-
value = value.slice(1, -1);
|
|
78
|
-
}
|
|
79
|
-
if (!process.env[key])
|
|
80
|
-
process.env[key] = value;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch { /* file missing — fine */ }
|
|
84
|
-
}
|
|
85
|
-
function getConfig() {
|
|
86
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE || '';
|
|
87
|
-
if (homeDir)
|
|
88
|
-
loadEnvFile(path.join(homeDir, '.greprag', '.env'));
|
|
89
|
-
if (!process.env.GREPRAG_API_KEY)
|
|
90
|
-
loadEnvFile(path.join(process.cwd(), '.env'));
|
|
91
|
-
return {
|
|
92
|
-
apiUrl: process.env.GREPRAG_API_URL || API_URL_DEFAULT,
|
|
93
|
-
apiKey: process.env.GREPRAG_API_KEY || '',
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
async function apiCall(url, apiKey, body) {
|
|
97
|
-
const res = await fetch(url, {
|
|
98
|
-
method: 'POST',
|
|
99
|
-
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
100
|
-
body: JSON.stringify(body),
|
|
101
|
-
});
|
|
102
|
-
if (!res.ok)
|
|
103
|
-
throw new Error(`API ${res.status}: ${await res.text()}`);
|
|
104
|
-
return res.json();
|
|
105
|
-
}
|
|
106
|
-
async function apiGet(url, apiKey) {
|
|
107
|
-
const res = await fetch(url, { headers: { 'Authorization': `Bearer ${apiKey}` } });
|
|
108
|
-
if (!res.ok)
|
|
109
|
-
throw new Error(`API ${res.status}: ${await res.text()}`);
|
|
110
|
-
return res.json();
|
|
111
|
-
}
|
|
112
|
-
async function apiDelete(url, apiKey) {
|
|
113
|
-
const res = await fetch(url, {
|
|
114
|
-
method: 'DELETE',
|
|
115
|
-
headers: { 'Authorization': `Bearer ${apiKey}` },
|
|
116
|
-
});
|
|
117
|
-
if (!res.ok)
|
|
118
|
-
throw new Error(`API ${res.status}: ${await res.text()}`);
|
|
119
|
-
return res.json();
|
|
120
|
-
}
|
|
121
|
-
// ---------- Helpers --------------------------------------------------------
|
|
122
|
-
function getFlag(args, flag) {
|
|
123
|
-
const idx = args.indexOf(flag);
|
|
124
|
-
if (idx === -1 || idx + 1 >= args.length)
|
|
125
|
-
return undefined;
|
|
126
|
-
return args[idx + 1];
|
|
127
|
-
}
|
|
128
|
-
function abortNotConfigured() {
|
|
129
|
-
console.error('Not configured. Run: greprag init');
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
/** Resolve which project a fact command operates on. --project <name> wins
|
|
133
|
-
* via the tenant's projects registry; otherwise the cwd's anchor decides. */
|
|
134
|
-
async function resolveProject(args, apiUrl, apiKey) {
|
|
135
|
-
const projectArg = getFlag(args, '--project');
|
|
136
|
-
if (!projectArg) {
|
|
137
|
-
const anchor = (0, project_anchor_1.readAnchor)(process.cwd());
|
|
138
|
-
return { projectId: anchor.projectId, projectName: anchor.projectName };
|
|
139
|
-
}
|
|
140
|
-
const r = await apiGet(`${apiUrl}/v1/projects`, apiKey);
|
|
141
|
-
const needle = projectArg.trim().toLowerCase();
|
|
142
|
-
const match = (r.projects || []).find(p => p.project_name.toLowerCase() === needle);
|
|
143
|
-
if (!match) {
|
|
144
|
-
throw new Error(`project "${projectArg}" not found under this tenant. ` +
|
|
145
|
-
`Register it via 'greprag init' in that directory, then retry.`);
|
|
146
|
-
}
|
|
147
|
-
return { projectId: match.project_id, projectName: match.project_name };
|
|
148
|
-
}
|
|
149
|
-
/** Try to read the current session's UUID from the harness env (Claude Code
|
|
150
|
-
* exposes it as CLAUDE_SESSION_ID on hook invocations). Falls back to
|
|
151
|
-
* undefined — callers should pass --source-session explicitly when they
|
|
152
|
-
* know it. */
|
|
153
|
-
function readSessionEnv() {
|
|
154
|
-
return process.env.CLAUDE_SESSION_ID || process.env.GREPRAG_SESSION_ID || null;
|
|
155
|
-
}
|
|
156
|
-
// ---------- add -----------------------------------------------------------
|
|
157
|
-
async function addCmd(args) {
|
|
158
|
-
const cfg = getConfig();
|
|
159
|
-
if (!cfg.apiKey)
|
|
160
|
-
abortNotConfigured();
|
|
161
|
-
const text = args[0];
|
|
162
|
-
if (!text || text.startsWith('--')) {
|
|
163
|
-
console.error('Usage: greprag fact add "<text>" --scope <scope> [--project <name>] [--source-session <id>]');
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
const scope = getFlag(args, '--scope');
|
|
167
|
-
if (!scope) {
|
|
168
|
-
console.error('Usage: greprag fact add "<text>" --scope <scope> [--project <name>]');
|
|
169
|
-
process.exit(1);
|
|
170
|
-
}
|
|
171
|
-
const sourceSession = getFlag(args, '--source-session') || readSessionEnv();
|
|
172
|
-
const { projectId, projectName } = await resolveProject(args, cfg.apiUrl, cfg.apiKey);
|
|
173
|
-
const result = await apiCall(`${cfg.apiUrl}/v1/facts/${projectId}`, cfg.apiKey, {
|
|
174
|
-
text, scope,
|
|
175
|
-
sourceSessionId: sourceSession,
|
|
176
|
-
projectName,
|
|
177
|
-
});
|
|
178
|
-
if (!result.ok || !result.nodeId)
|
|
179
|
-
throw new Error(result.error || 'add failed');
|
|
180
|
-
console.log(`Added fact [${result.nodeId}] scope=${scope} project=${projectName}`);
|
|
181
|
-
}
|
|
182
|
-
// ---------- query ---------------------------------------------------------
|
|
183
|
-
async function queryCmd(args) {
|
|
184
|
-
const cfg = getConfig();
|
|
185
|
-
if (!cfg.apiKey)
|
|
186
|
-
abortNotConfigured();
|
|
187
|
-
const scope = getFlag(args, '--scope');
|
|
188
|
-
const queryStr = getFlag(args, '--query');
|
|
189
|
-
const limit = parseInt(getFlag(args, '--limit') || '10', 10);
|
|
190
|
-
const format = (getFlag(args, '--format') || 'markdown').toLowerCase();
|
|
191
|
-
if (format !== 'markdown' && format !== 'json') {
|
|
192
|
-
console.error('--format must be markdown or json');
|
|
193
|
-
process.exit(1);
|
|
194
|
-
}
|
|
195
|
-
const { projectId, projectName } = await resolveProject(args, cfg.apiUrl, cfg.apiKey);
|
|
196
|
-
const params = new URLSearchParams();
|
|
197
|
-
if (scope)
|
|
198
|
-
params.set('scope', scope);
|
|
199
|
-
if (queryStr)
|
|
200
|
-
params.set('query', queryStr);
|
|
201
|
-
params.set('limit', String(limit));
|
|
202
|
-
const result = await apiGet(`${cfg.apiUrl}/v1/facts/${projectId}?${params.toString()}`, cfg.apiKey);
|
|
203
|
-
if (!result.ok || !result.facts)
|
|
204
|
-
throw new Error(result.error || 'query failed');
|
|
205
|
-
if (format === 'json') {
|
|
206
|
-
console.log(JSON.stringify({
|
|
207
|
-
project: projectName,
|
|
208
|
-
scope: scope ?? null,
|
|
209
|
-
query: queryStr ?? null,
|
|
210
|
-
facts: result.facts,
|
|
211
|
-
}, null, 2));
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (result.facts.length === 0) {
|
|
215
|
-
const scopeNote = scope ? ` (scope=${scope})` : '';
|
|
216
|
-
const queryNote = queryStr ? ` matching "${queryStr}"` : '';
|
|
217
|
-
console.log(`No facts in ${projectName}${scopeNote}${queryNote}.`);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
for (let i = 0; i < result.facts.length; i++) {
|
|
221
|
-
console.log(`${i + 1}. ${result.facts[i].text}`);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
// ---------- list ----------------------------------------------------------
|
|
225
|
-
async function listCmd(args) {
|
|
226
|
-
const cfg = getConfig();
|
|
227
|
-
if (!cfg.apiKey)
|
|
228
|
-
abortNotConfigured();
|
|
229
|
-
const { projectId, projectName } = await resolveProject(args, cfg.apiUrl, cfg.apiKey);
|
|
230
|
-
const result = await apiGet(`${cfg.apiUrl}/v1/facts/${projectId}/list`, cfg.apiKey);
|
|
231
|
-
if (!result.ok || !result.facts)
|
|
232
|
-
throw new Error(result.error || 'list failed');
|
|
233
|
-
if (result.facts.length === 0) {
|
|
234
|
-
console.log(`No facts seeded in ${projectName} yet.`);
|
|
235
|
-
console.log('Add one: greprag fact add "<text>" --scope <scope>');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
// Group by scope (server already orders scope ASC, createdAt DESC).
|
|
239
|
-
const grouped = new Map();
|
|
240
|
-
for (const f of result.facts) {
|
|
241
|
-
const scope = f.scope || '(no scope)';
|
|
242
|
-
if (!grouped.has(scope))
|
|
243
|
-
grouped.set(scope, []);
|
|
244
|
-
grouped.get(scope).push(f);
|
|
245
|
-
}
|
|
246
|
-
console.log(`\n${result.facts.length} fact${result.facts.length === 1 ? '' : 's'} in ${projectName}:\n`);
|
|
247
|
-
for (const [scope, rows] of grouped) {
|
|
248
|
-
console.log(`## ${scope} (${rows.length})`);
|
|
249
|
-
for (const f of rows) {
|
|
250
|
-
const date = f.createdAt ? f.createdAt.slice(0, 10) : '';
|
|
251
|
-
console.log(` [${f.nodeId}] ${date} ${f.text}`);
|
|
252
|
-
}
|
|
253
|
-
console.log('');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// ---------- delete --------------------------------------------------------
|
|
257
|
-
async function deleteCmd(args) {
|
|
258
|
-
const cfg = getConfig();
|
|
259
|
-
if (!cfg.apiKey)
|
|
260
|
-
abortNotConfigured();
|
|
261
|
-
const nodeId = args[0];
|
|
262
|
-
if (!nodeId || nodeId.startsWith('--')) {
|
|
263
|
-
console.error('Usage: greprag fact delete <nodeId> [--project <name>]');
|
|
264
|
-
process.exit(1);
|
|
265
|
-
}
|
|
266
|
-
if (!/^[0-9a-f]{8}$/i.test(nodeId)) {
|
|
267
|
-
console.error('nodeId must be 8 hex chars (printed in `greprag fact list`).');
|
|
268
|
-
process.exit(1);
|
|
269
|
-
}
|
|
270
|
-
const { projectId, projectName } = await resolveProject(args, cfg.apiUrl, cfg.apiKey);
|
|
271
|
-
const result = await apiDelete(`${cfg.apiUrl}/v1/facts/${projectId}/${nodeId}`, cfg.apiKey);
|
|
272
|
-
if (!result.ok)
|
|
273
|
-
throw new Error(result.error || 'delete failed');
|
|
274
|
-
console.log(`Deleted fact [${nodeId}] from ${projectName}`);
|
|
275
|
-
}
|
|
276
|
-
// ---------- scopes --------------------------------------------------------
|
|
277
|
-
async function scopesCmd(args) {
|
|
278
|
-
const cfg = getConfig();
|
|
279
|
-
if (!cfg.apiKey)
|
|
280
|
-
abortNotConfigured();
|
|
281
|
-
const { projectId, projectName } = await resolveProject(args, cfg.apiUrl, cfg.apiKey);
|
|
282
|
-
const result = await apiGet(`${cfg.apiUrl}/v1/facts/${projectId}/scopes`, cfg.apiKey);
|
|
283
|
-
if (!result.ok || !result.scopes)
|
|
284
|
-
throw new Error(result.error || 'scopes failed');
|
|
285
|
-
if (result.scopes.length === 0) {
|
|
286
|
-
console.log(`No scopes in ${projectName} yet.`);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
for (const s of result.scopes)
|
|
290
|
-
console.log(s);
|
|
291
|
-
}
|
|
292
|
-
// ---------- Dispatch ------------------------------------------------------
|
|
293
|
-
const SUB_HELP = `
|
|
294
|
-
greprag fact — per-project self-organizing knowledge substrate.
|
|
295
|
-
|
|
296
|
-
Subcommands:
|
|
297
|
-
add "<text>" --scope <S> [--project <name>] [--source-session <id>]
|
|
298
|
-
Append a new fact under the given scope.
|
|
299
|
-
query [--scope <S>] [--query "<intent>"] [--project <name>]
|
|
300
|
-
[--limit N=10] [--format markdown|json]
|
|
301
|
-
Read facts. With --query, lexical-rank by
|
|
302
|
-
relevance. Without, most recent first.
|
|
303
|
-
list [--project <name>] Every fact grouped by scope (for review).
|
|
304
|
-
delete <nodeId> [--project <name>]
|
|
305
|
-
Drop one fact by its 8-char nodeId.
|
|
306
|
-
scopes [--project <name>] Distinct scope labels present in this project.
|
|
307
|
-
|
|
308
|
-
Examples:
|
|
309
|
-
greprag fact add "Migrations live at repo root, not packages/api/migrations." --scope chip-startup
|
|
310
|
-
greprag fact query --scope chip-startup --limit 10 --format markdown
|
|
311
|
-
greprag fact query --query "where do migrations live" --limit 5
|
|
312
|
-
greprag fact list
|
|
313
|
-
greprag fact delete a3f2c1d4
|
|
314
|
-
greprag fact scopes
|
|
315
|
-
`.trim();
|
|
316
|
-
async function runFact(args) {
|
|
317
|
-
const sub = args[0];
|
|
318
|
-
const rest = args.slice(1);
|
|
319
|
-
switch (sub) {
|
|
320
|
-
case 'add': return addCmd(rest);
|
|
321
|
-
case 'query': return queryCmd(rest);
|
|
322
|
-
case 'list': return listCmd(rest);
|
|
323
|
-
case 'delete': return deleteCmd(rest);
|
|
324
|
-
case 'scopes': return scopesCmd(rest);
|
|
325
|
-
case undefined:
|
|
326
|
-
case 'help':
|
|
327
|
-
case '--help':
|
|
328
|
-
case '-h':
|
|
329
|
-
console.log(SUB_HELP);
|
|
330
|
-
return;
|
|
331
|
-
default:
|
|
332
|
-
console.error(`Unknown subcommand: ${sub}\n`);
|
|
333
|
-
console.log(SUB_HELP);
|
|
334
|
-
process.exit(1);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
//# sourceMappingURL=fact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fact.js","sourceRoot":"","sources":["../../src/commands/fact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;mDAoBmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyUnD,0BAoBC;AA3VD,uCAAyB;AACzB,2CAA6B;AAC7B,sDAA+C;AAE/C,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAElD,6EAA6E;AAE7E,SAAS,WAAW,CAAC,QAAgB;IACnC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,IAAI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B,GAAG,IAAI,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** Supervisor + child-guard split for `greprag inbox watch`.
|
|
2
|
-
*
|
|
3
|
-
* The parent supervisor (`runSupervisor`) spawns the watch loop as a
|
|
4
|
-
* Node child via `child_process.spawn` — Win32 CreateProcess on
|
|
5
|
-
* Windows, not Cygwin fork — and respawns on any non-clean exit so
|
|
6
|
-
* the SSE loop's silent-death failure modes (uncaught exception,
|
|
7
|
-
* undici internal error, external SIGKILL, OOM) translate into a
|
|
8
|
-
* visible restart line on stderr instead of a vanished watcher.
|
|
9
|
-
*
|
|
10
|
-
* The child-side last-resort handlers (`installLastResortHandlers`)
|
|
11
|
-
* catch anything the SSE loop's try/catch missed and exit non-zero
|
|
12
|
-
* so the supervisor sees a respawnable death instead of a clean
|
|
13
|
-
* exit. Direct-mode callers (tests, programmatic SDK use, or
|
|
14
|
-
* --no-supervise) don't install these handlers — they share the
|
|
15
|
-
* caller's process and `process.exit` would abort the caller.
|
|
16
|
-
*
|
|
17
|
-
* adr: adr/monitor-resilience.md */
|
|
18
|
-
export declare const SUPERVISE_ENV = "GREPRAG_WATCH_CHILD";
|
|
19
|
-
export declare const FATAL_EXIT_CODE = 64;
|
|
20
|
-
/** Last-resort process handlers in the spawned child. The SSE loop
|
|
21
|
-
* already wraps every reconnect in try/catch — these fire only when
|
|
22
|
-
* something truly unexpected throws (a callback registered outside
|
|
23
|
-
* the loop, a promise that escapes the awaited path, an undici
|
|
24
|
-
* internal error). Exit code 2 signals "abnormal" to the supervisor
|
|
25
|
-
* so it respawns; SIGINT/SIGTERM skip these and return via the
|
|
26
|
-
* normal abort path. */
|
|
27
|
-
export declare function installLastResortHandlers(): void;
|
|
28
|
-
/** Parent supervisor. Spawns the watch loop as a Node child, forwards
|
|
29
|
-
* stdio so Monitor sees each printed line as a notification verbatim,
|
|
30
|
-
* and respawns on any non-clean exit. */
|
|
31
|
-
export declare function runSupervisor(): Promise<void>;
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** Supervisor + child-guard split for `greprag inbox watch`.
|
|
3
|
-
*
|
|
4
|
-
* The parent supervisor (`runSupervisor`) spawns the watch loop as a
|
|
5
|
-
* Node child via `child_process.spawn` — Win32 CreateProcess on
|
|
6
|
-
* Windows, not Cygwin fork — and respawns on any non-clean exit so
|
|
7
|
-
* the SSE loop's silent-death failure modes (uncaught exception,
|
|
8
|
-
* undici internal error, external SIGKILL, OOM) translate into a
|
|
9
|
-
* visible restart line on stderr instead of a vanished watcher.
|
|
10
|
-
*
|
|
11
|
-
* The child-side last-resort handlers (`installLastResortHandlers`)
|
|
12
|
-
* catch anything the SSE loop's try/catch missed and exit non-zero
|
|
13
|
-
* so the supervisor sees a respawnable death instead of a clean
|
|
14
|
-
* exit. Direct-mode callers (tests, programmatic SDK use, or
|
|
15
|
-
* --no-supervise) don't install these handlers — they share the
|
|
16
|
-
* caller's process and `process.exit` would abort the caller.
|
|
17
|
-
*
|
|
18
|
-
* adr: adr/monitor-resilience.md */
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.FATAL_EXIT_CODE = exports.SUPERVISE_ENV = void 0;
|
|
21
|
-
exports.installLastResortHandlers = installLastResortHandlers;
|
|
22
|
-
exports.runSupervisor = runSupervisor;
|
|
23
|
-
const child_process_1 = require("child_process");
|
|
24
|
-
const inbox_watch_util_1 = require("./inbox-watch-util");
|
|
25
|
-
const LOG_PREFIX = '[greprag inbox watch]';
|
|
26
|
-
// Env sentinel set on the spawned child so the same CLI entry point
|
|
27
|
-
// can detect it's the child and run the loop directly instead of
|
|
28
|
-
// recursing into another supervisor.
|
|
29
|
-
exports.SUPERVISE_ENV = 'GREPRAG_WATCH_CHILD';
|
|
30
|
-
// Backoff applies to the gap between RESPAWNS, not the SSE
|
|
31
|
-
// reconnect-on-network-blip — that's handled inside the child.
|
|
32
|
-
const SUPERVISOR_BACKOFF_INITIAL_MS = 500;
|
|
33
|
-
const SUPERVISOR_BACKOFF_MAX_MS = 30_000;
|
|
34
|
-
const SUPERVISOR_BACKOFF_FACTOR = 2;
|
|
35
|
-
// 60s of uninterrupted child life resets the backoff so a long-lived
|
|
36
|
-
// child that finally dies retries fast, not slowly.
|
|
37
|
-
const SUPERVISOR_HEALTHY_RESET_MS = 60_000;
|
|
38
|
-
// Exit code the child uses for "fatal, do not respawn" conditions —
|
|
39
|
-
// 4xx HTTP responses, missing API key, missing anchor. Anything else
|
|
40
|
-
// (signal, code 1, code 2, exception) is a crash and gets respawned.
|
|
41
|
-
// Picked from the 64-78 sysexits range to avoid Node's own codes.
|
|
42
|
-
exports.FATAL_EXIT_CODE = 64;
|
|
43
|
-
/** Last-resort process handlers in the spawned child. The SSE loop
|
|
44
|
-
* already wraps every reconnect in try/catch — these fire only when
|
|
45
|
-
* something truly unexpected throws (a callback registered outside
|
|
46
|
-
* the loop, a promise that escapes the awaited path, an undici
|
|
47
|
-
* internal error). Exit code 2 signals "abnormal" to the supervisor
|
|
48
|
-
* so it respawns; SIGINT/SIGTERM skip these and return via the
|
|
49
|
-
* normal abort path. */
|
|
50
|
-
function installLastResortHandlers() {
|
|
51
|
-
process.on('uncaughtException', (err) => {
|
|
52
|
-
const msg = (err && err.message) || String(err);
|
|
53
|
-
console.error(`${LOG_PREFIX} uncaughtException: ${msg}`);
|
|
54
|
-
process.exit(2);
|
|
55
|
-
});
|
|
56
|
-
process.on('unhandledRejection', (reason) => {
|
|
57
|
-
const msg = (reason && reason.message) || String(reason);
|
|
58
|
-
console.error(`${LOG_PREFIX} unhandledRejection: ${msg}`);
|
|
59
|
-
process.exit(2);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/** Parent supervisor. Spawns the watch loop as a Node child, forwards
|
|
63
|
-
* stdio so Monitor sees each printed line as a notification verbatim,
|
|
64
|
-
* and respawns on any non-clean exit. */
|
|
65
|
-
async function runSupervisor() {
|
|
66
|
-
let backoff = SUPERVISOR_BACKOFF_INITIAL_MS;
|
|
67
|
-
let shutdownRequested = false;
|
|
68
|
-
let currentChild = null;
|
|
69
|
-
// Forward terminal-style signals to the child so Ctrl-C or TaskStop
|
|
70
|
-
// exits both processes cleanly without orphaning. We don't exit the
|
|
71
|
-
// supervisor here — the child's exit handler sees the signaled exit
|
|
72
|
-
// and the main loop falls through to the shutdownRequested check.
|
|
73
|
-
const forward = (sig) => {
|
|
74
|
-
shutdownRequested = true;
|
|
75
|
-
if (currentChild && !currentChild.killed) {
|
|
76
|
-
try {
|
|
77
|
-
currentChild.kill(sig);
|
|
78
|
-
}
|
|
79
|
-
catch { /* race: already exited */ }
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const onSigint = () => forward('SIGINT');
|
|
83
|
-
const onSigterm = () => forward('SIGTERM');
|
|
84
|
-
process.on('SIGINT', onSigint);
|
|
85
|
-
process.on('SIGTERM', onSigterm);
|
|
86
|
-
// Re-invoke the same JS entrypoint via the Node binary we're running
|
|
87
|
-
// under. Skips the bash/sh npm shim on respawn — the shim's fork
|
|
88
|
-
// pressure is paid once at initial invocation, not once per restart.
|
|
89
|
-
const childArgs = [process.argv[1], ...process.argv.slice(2)];
|
|
90
|
-
const childEnv = { ...process.env, [exports.SUPERVISE_ENV]: '1' };
|
|
91
|
-
while (!shutdownRequested) {
|
|
92
|
-
const startedAt = Date.now();
|
|
93
|
-
let spawnErr = null;
|
|
94
|
-
try {
|
|
95
|
-
currentChild = (0, child_process_1.spawn)(process.execPath, childArgs, {
|
|
96
|
-
env: childEnv,
|
|
97
|
-
stdio: 'inherit',
|
|
98
|
-
// detached:false keeps the child in our process group so
|
|
99
|
-
// terminal signals reach it without manual forwarding, and a
|
|
100
|
-
// supervisor crash doesn't orphan the watcher.
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
spawnErr = err;
|
|
105
|
-
currentChild = null;
|
|
106
|
-
}
|
|
107
|
-
if (spawnErr || !currentChild) {
|
|
108
|
-
const reason = spawnErr ? spawnErr.message : 'spawn returned null child';
|
|
109
|
-
console.error(`${LOG_PREFIX} supervisor: spawn failed (${reason}) — retry in ${(0, inbox_watch_util_1.fmtDuration)(backoff)}`);
|
|
110
|
-
await sleepUntilOrShutdown(backoff, () => shutdownRequested);
|
|
111
|
-
backoff = Math.min(backoff * SUPERVISOR_BACKOFF_FACTOR, SUPERVISOR_BACKOFF_MAX_MS);
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const exit = await new Promise((resolve) => {
|
|
115
|
-
let resolved = false;
|
|
116
|
-
const settle = (v) => { if (!resolved) {
|
|
117
|
-
resolved = true;
|
|
118
|
-
resolve(v);
|
|
119
|
-
} };
|
|
120
|
-
currentChild.once('exit', (code, signal) => settle({ code, signal, err: null }));
|
|
121
|
-
currentChild.once('error', (err) => settle({ code: null, signal: null, err }));
|
|
122
|
-
});
|
|
123
|
-
const liveMs = Date.now() - startedAt;
|
|
124
|
-
currentChild = null;
|
|
125
|
-
if (shutdownRequested)
|
|
126
|
-
break;
|
|
127
|
-
// Clean child exit. The child's loop only returns when its
|
|
128
|
-
// AbortSignal fires; under supervision that only happens via the
|
|
129
|
-
// SIGINT/SIGTERM we forwarded, and we caught those via
|
|
130
|
-
// shutdownRequested. Code 0 here means the child finished its
|
|
131
|
-
// own work — propagate the clean exit.
|
|
132
|
-
if (exit.err === null && exit.code === 0 && exit.signal === null)
|
|
133
|
-
break;
|
|
134
|
-
// Child killed by a signal we forwarded — user wanted out.
|
|
135
|
-
if (exit.signal === 'SIGINT' || exit.signal === 'SIGTERM')
|
|
136
|
-
break;
|
|
137
|
-
// Child signaled "fatal, do not respawn" — bad API key, 4xx,
|
|
138
|
-
// missing anchor. Respawning would loop forever.
|
|
139
|
-
if (exit.err === null && exit.code === exports.FATAL_EXIT_CODE) {
|
|
140
|
-
process.exitCode = 1;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
if (liveMs >= SUPERVISOR_HEALTHY_RESET_MS)
|
|
144
|
-
backoff = SUPERVISOR_BACKOFF_INITIAL_MS;
|
|
145
|
-
const reason = exit.err
|
|
146
|
-
? `spawn error: ${exit.err.message}`
|
|
147
|
-
: exit.signal
|
|
148
|
-
? `signal ${exit.signal}`
|
|
149
|
-
: `exit ${exit.code}`;
|
|
150
|
-
console.error(`${LOG_PREFIX} supervisor: child died (${reason}) after ${(0, inbox_watch_util_1.fmtDuration)(liveMs)} — respawning in ${(0, inbox_watch_util_1.fmtDuration)(backoff)}`);
|
|
151
|
-
await sleepUntilOrShutdown(backoff, () => shutdownRequested);
|
|
152
|
-
backoff = Math.min(backoff * SUPERVISOR_BACKOFF_FACTOR, SUPERVISOR_BACKOFF_MAX_MS);
|
|
153
|
-
}
|
|
154
|
-
process.off('SIGINT', onSigint);
|
|
155
|
-
process.off('SIGTERM', onSigterm);
|
|
156
|
-
}
|
|
157
|
-
/** Sleep that polls a shutdown predicate every 100ms so the supervisor
|
|
158
|
-
* wakes promptly on signal-driven shutdown without needing a shared
|
|
159
|
-
* AbortSignal. Resolves when the delay elapses OR the predicate flips. */
|
|
160
|
-
function sleepUntilOrShutdown(ms, isDown) {
|
|
161
|
-
return new Promise((resolve) => {
|
|
162
|
-
const deadline = Date.now() + ms;
|
|
163
|
-
const tick = () => {
|
|
164
|
-
if (isDown() || Date.now() >= deadline) {
|
|
165
|
-
resolve();
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
setTimeout(tick, Math.min(100, deadline - Date.now()));
|
|
169
|
-
};
|
|
170
|
-
tick();
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
//# sourceMappingURL=inbox-watch-supervisor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-watch-supervisor.js","sourceRoot":"","sources":["../../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oBAAoB,IAAA,8BAAW,EAAC,OAAO,CAAC,EAAE,CACxH,CAAC;QACF,MAAM,oBAAoB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAC7D,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,yBAAyB,EAAE,yBAAyB,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACpC,CAAC;AAED;;2EAE2E;AAC3E,SAAS,oBAAoB,CAAC,EAAU,EAAE,MAAqB;IAC7D,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,GAAS,EAAE;YACtB,IAAI,MAAM,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAAC,OAAO,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YAC9D,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;QACF,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Small util shared between the inbox-watch loop and its supervisor.
|
|
2
|
-
* Lives in its own file so the supervisor module doesn't pull in
|
|
3
|
-
* the entire SSE-parsing surface. */
|
|
4
|
-
/** Human-readable duration: "300ms", "5s", "60s". */
|
|
5
|
-
export declare function fmtDuration(ms: number): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** Small util shared between the inbox-watch loop and its supervisor.
|
|
3
|
-
* Lives in its own file so the supervisor module doesn't pull in
|
|
4
|
-
* the entire SSE-parsing surface. */
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fmtDuration = fmtDuration;
|
|
7
|
-
/** Human-readable duration: "300ms", "5s", "60s". */
|
|
8
|
-
function fmtDuration(ms) {
|
|
9
|
-
if (ms < 1000)
|
|
10
|
-
return `${ms}ms`;
|
|
11
|
-
return `${Math.round(ms / 1000)}s`;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=inbox-watch-util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-watch-util.js","sourceRoot":"","sources":["../../src/commands/inbox-watch-util.ts"],"names":[],"mappings":";AAAA;;sCAEsC;;AAGtC,kCAGC;AAJD,qDAAqD;AACrD,SAAgB,WAAW,CAAC,EAAU;IACpC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,EAAE,IAAI,CAAC;IAChC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;AACrC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** greprag odyssey — episodic project memory (turn / hourly / daily / weekly / ship-event).
|
|
2
|
-
*
|
|
3
|
-
* Odyssey = the per-project narrative pyramid. Stop hook captures raw turns;
|
|
4
|
-
* crons compact at hourly, daily, and weekly tiers; advisor skills pull on
|
|
5
|
-
* demand by project + time window. This CLI is the read surface (plus a
|
|
6
|
-
* manual compaction trigger for admin use).
|
|
7
|
-
*
|
|
8
|
-
* Note: the server-side route + shape values stay named `memory` / `turn` /
|
|
9
|
-
* `hourly` / `daily` / `weekly` / `ship-event` (internal — surface-only
|
|
10
|
-
* rename in v5.8.0). The CLI maps `odyssey` subcommands to /v1/memory/* URLs.
|
|
11
|
-
* Mirrors the v5.7.0 lore-rename pattern. See adr/odyssey-rename.md.
|
|
12
|
-
*
|
|
13
|
-
* Subcommands:
|
|
14
|
-
* briefing [--project <name>] [--format markdown|json]
|
|
15
|
-
* The SessionStart-shaped briefing — most recent weekly + 7 daily summaries.
|
|
16
|
-
* daily [--last N=7] [--project <name>] [--from ISO --to ISO] [--format markdown|json]
|
|
17
|
-
* weekly [--last N=2] [--project <name>] [--from ISO --to ISO] [--format markdown|json]
|
|
18
|
-
* hourly [--last N=24] [--project <name>] [--from ISO --to ISO] [--format markdown|json]
|
|
19
|
-
* turns [--last N=20] [--project <name>] [--from ISO --to ISO] [--format markdown|json]
|
|
20
|
-
* ships [--last N=50] [--project <name>] [--from ISO --to ISO] [--format markdown|json]
|
|
21
|
-
* compact <hour|day|week> [--now ISO]
|
|
22
|
-
* Manual compaction trigger (cron also runs these on schedule).
|
|
23
|
-
*
|
|
24
|
-
* Project resolution: without --project, uses the current cwd's project
|
|
25
|
-
* anchor (readAnchor). With --project <name>, hits /v1/projects to resolve
|
|
26
|
-
* name → projectId (case-insensitive). */
|
|
27
|
-
export declare function runOdyssey(args: string[]): Promise<void>;
|