proofscan 0.10.4 → 0.10.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/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +64 -4
- package/dist/db/connection.js.map +1 -1
- package/dist/db/events-store.d.ts +15 -0
- package/dist/db/events-store.d.ts.map +1 -1
- package/dist/db/events-store.js +60 -8
- package/dist/db/events-store.js.map +1 -1
- package/dist/db/schema.d.ts +9 -3
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +40 -3
- package/dist/db/schema.js.map +1 -1
- package/dist/db/types.d.ts +5 -1
- package/dist/db/types.d.ts.map +1 -1
- package/dist/shell/completer.d.ts +1 -0
- package/dist/shell/completer.d.ts.map +1 -1
- package/dist/shell/completer.js +15 -0
- package/dist/shell/completer.js.map +1 -1
- package/dist/shell/popl-commands.d.ts +20 -0
- package/dist/shell/popl-commands.d.ts.map +1 -1
- package/dist/shell/popl-commands.js +376 -36
- package/dist/shell/popl-commands.js.map +1 -1
- package/dist/shell/ref-commands.d.ts.map +1 -1
- package/dist/shell/ref-commands.js +124 -29
- package/dist/shell/ref-commands.js.map +1 -1
- package/dist/shell/ref-resolver.d.ts +17 -3
- package/dist/shell/ref-resolver.d.ts.map +1 -1
- package/dist/shell/ref-resolver.js +61 -3
- package/dist/shell/ref-resolver.js.map +1 -1
- package/dist/shell/repl.d.ts +6 -0
- package/dist/shell/repl.d.ts.map +1 -1
- package/dist/shell/repl.js +47 -4
- package/dist/shell/repl.js.map +1 -1
- package/dist/shell/types.d.ts.map +1 -1
- package/dist/shell/types.js +5 -0
- package/dist/shell/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completer.js","sourceRoot":"","sources":["../../src/shell/completer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe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AC,EAAE,CAAC;YAClC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,qDAAqD;IACrD,IAAI,UAAU,KAAK,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QACxE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,6CAA6C;YAC7C,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClE,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,qDAAqD;YACrD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAqB,EACrB,YAAiC;IAEjC,OAAO,CAAC,IAAY,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -19,8 +19,28 @@
|
|
|
19
19
|
* then calls the shared service layer (same as CLI).
|
|
20
20
|
*/
|
|
21
21
|
import type { ShellContext } from './types.js';
|
|
22
|
+
/** Valid view names */
|
|
23
|
+
export declare const VALID_VIEWS: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Get POPL entry ID prefixes for TAB completion (async version)
|
|
26
|
+
*/
|
|
27
|
+
export declare function getPoplEntryPrefixes(limit?: number): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get POPL entry IDs synchronously for TAB completion
|
|
30
|
+
* Uses readdirSync to avoid async issues with readline completer
|
|
31
|
+
*/
|
|
32
|
+
export declare function getPoplEntryIdsSync(limit?: number): string[];
|
|
22
33
|
/**
|
|
23
34
|
* Handle 'popl' shell command
|
|
24
35
|
*/
|
|
25
36
|
export declare function handlePopl(args: string[], context: ShellContext, configPath: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get POPL JSON output for piping (used by repl.ts for pipe support)
|
|
39
|
+
*
|
|
40
|
+
* This is similar to handlePoplSession but returns JSON string instead of printing.
|
|
41
|
+
* Used for: popl @last --json | ref add <name>
|
|
42
|
+
*
|
|
43
|
+
* @returns JSON string or null on failure
|
|
44
|
+
*/
|
|
45
|
+
export declare function getPoplJsonOutput(args: string[], context: ShellContext, configPath: string): Promise<string | null>;
|
|
26
46
|
//# sourceMappingURL=popl-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popl-commands.d.ts","sourceRoot":"","sources":["../../src/shell/popl-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"popl-commands.d.ts","sourceRoot":"","sources":["../../src/shell/popl-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8B/C,uBAAuB;AACvB,eAAO,MAAM,WAAW,UAAiC,CAAC;AA+E1D;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWhF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,MAAW,GAAG,MAAM,EAAE,CAkBhE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCf;AA8ZD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyExB"}
|
|
@@ -23,7 +23,123 @@ import { ConfigManager } from '../config/index.js';
|
|
|
23
23
|
import { EventsStore } from '../db/events-store.js';
|
|
24
24
|
import { RefResolver, createRefDataProvider, isRef, } from './ref-resolver.js';
|
|
25
25
|
import { hasPoplDir, initPoplDir, createSessionPoplEntry, listPoplEntries, readPoplEntry, getPoplEntriesDir, } from '../popl/index.js';
|
|
26
|
-
import { join } from 'path';
|
|
26
|
+
import { join, relative } from 'path';
|
|
27
|
+
import { existsSync, readdirSync } from 'fs';
|
|
28
|
+
import { readFile } from 'fs/promises';
|
|
29
|
+
/** View names mapping to artifact files */
|
|
30
|
+
const VIEW_ARTIFACT_MAP = {
|
|
31
|
+
popl: 'POPL.yml',
|
|
32
|
+
status: 'status.json',
|
|
33
|
+
rpc: 'rpc.sanitized.jsonl',
|
|
34
|
+
log: 'validation-run.log',
|
|
35
|
+
};
|
|
36
|
+
/** Valid view names */
|
|
37
|
+
export const VALID_VIEWS = Object.keys(VIEW_ARTIFACT_MAP);
|
|
38
|
+
/**
|
|
39
|
+
* Get the observed time from a POPL document
|
|
40
|
+
* Priority: capture.window.ended_at > capture.window.started_at > entry.created_at
|
|
41
|
+
*/
|
|
42
|
+
function getObservedTime(doc) {
|
|
43
|
+
if (doc.capture?.window?.ended_at) {
|
|
44
|
+
return doc.capture.window.ended_at;
|
|
45
|
+
}
|
|
46
|
+
if (doc.capture?.window?.started_at) {
|
|
47
|
+
return doc.capture.window.started_at;
|
|
48
|
+
}
|
|
49
|
+
return doc.entry.created_at;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Format timestamp for oneline display
|
|
53
|
+
* Returns: YYYY-MM-DD HH:mm:ss TZ (e.g., "2026-01-04 20:35:00 +09:00")
|
|
54
|
+
*/
|
|
55
|
+
function formatTimestamp(isoString) {
|
|
56
|
+
try {
|
|
57
|
+
const date = new Date(isoString);
|
|
58
|
+
if (isNaN(date.getTime())) {
|
|
59
|
+
return isoString;
|
|
60
|
+
}
|
|
61
|
+
const year = date.getFullYear();
|
|
62
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
63
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
64
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
65
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
66
|
+
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
67
|
+
const tzOffset = -date.getTimezoneOffset();
|
|
68
|
+
const tzHours = Math.floor(Math.abs(tzOffset) / 60);
|
|
69
|
+
const tzMins = Math.abs(tzOffset) % 60;
|
|
70
|
+
const tzSign = tzOffset >= 0 ? '+' : '-';
|
|
71
|
+
const tz = `${tzSign}${String(tzHours).padStart(2, '0')}:${String(tzMins).padStart(2, '0')}`;
|
|
72
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${tz}`;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return isoString;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve entry ID by prefix matching
|
|
80
|
+
*/
|
|
81
|
+
async function resolveEntryId(cwd, idOrPrefix) {
|
|
82
|
+
const entries = await listPoplEntries(cwd);
|
|
83
|
+
// Exact match first
|
|
84
|
+
const exactMatch = entries.find(e => e.id === idOrPrefix);
|
|
85
|
+
if (exactMatch) {
|
|
86
|
+
return { success: true, entryId: exactMatch.id, entryPath: exactMatch.path };
|
|
87
|
+
}
|
|
88
|
+
// Prefix match
|
|
89
|
+
const prefixMatches = entries.filter(e => e.id.startsWith(idOrPrefix));
|
|
90
|
+
if (prefixMatches.length === 0) {
|
|
91
|
+
return { success: false, error: `Entry not found: ${idOrPrefix}` };
|
|
92
|
+
}
|
|
93
|
+
if (prefixMatches.length === 1) {
|
|
94
|
+
return { success: true, entryId: prefixMatches[0].id, entryPath: prefixMatches[0].path };
|
|
95
|
+
}
|
|
96
|
+
// Multiple matches - ambiguous
|
|
97
|
+
return {
|
|
98
|
+
success: false,
|
|
99
|
+
error: `Ambiguous entry ID prefix: ${idOrPrefix} (${prefixMatches.length} matches)`,
|
|
100
|
+
candidates: prefixMatches.map(e => e.id),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get POPL entry ID prefixes for TAB completion (async version)
|
|
105
|
+
*/
|
|
106
|
+
export async function getPoplEntryPrefixes(limit = 50) {
|
|
107
|
+
const cwd = process.cwd();
|
|
108
|
+
if (!hasPoplDir(cwd)) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const entries = await listPoplEntries(cwd);
|
|
113
|
+
return entries.slice(0, limit).map(e => e.id);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get POPL entry IDs synchronously for TAB completion
|
|
121
|
+
* Uses readdirSync to avoid async issues with readline completer
|
|
122
|
+
*/
|
|
123
|
+
export function getPoplEntryIdsSync(limit = 50) {
|
|
124
|
+
const cwd = process.cwd();
|
|
125
|
+
if (!hasPoplDir(cwd)) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const entriesDir = getPoplEntriesDir(cwd);
|
|
130
|
+
if (!existsSync(entriesDir)) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
const entries = readdirSync(entriesDir, { withFileTypes: true });
|
|
134
|
+
return entries
|
|
135
|
+
.filter(e => e.isDirectory())
|
|
136
|
+
.map(e => e.name)
|
|
137
|
+
.slice(0, limit);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
27
143
|
/**
|
|
28
144
|
* Handle 'popl' shell command
|
|
29
145
|
*/
|
|
@@ -43,10 +159,10 @@ export async function handlePopl(args, context, configPath) {
|
|
|
43
159
|
break;
|
|
44
160
|
case 'ls':
|
|
45
161
|
case 'list':
|
|
46
|
-
await handlePoplList();
|
|
162
|
+
await handlePoplList(subArgs);
|
|
47
163
|
break;
|
|
48
164
|
case 'show':
|
|
49
|
-
await handlePoplShow(subArgs);
|
|
165
|
+
await handlePoplShow(subArgs, configPath);
|
|
50
166
|
break;
|
|
51
167
|
default:
|
|
52
168
|
// Check if it's a direct @reference (popl @last)
|
|
@@ -66,21 +182,30 @@ function printPoplHelp() {
|
|
|
66
182
|
printInfo('Usage: popl <subcommand>');
|
|
67
183
|
printInfo('');
|
|
68
184
|
printInfo('Subcommands:');
|
|
69
|
-
printInfo(' popl init
|
|
70
|
-
printInfo(' popl session [@ref]
|
|
71
|
-
printInfo(' popl ls
|
|
72
|
-
printInfo(' popl show <
|
|
185
|
+
printInfo(' popl init Initialize .popl in current directory');
|
|
186
|
+
printInfo(' popl session [@ref] Create POPL entry for session');
|
|
187
|
+
printInfo(' popl ls [-s|--oneline] List POPL entries');
|
|
188
|
+
printInfo(' popl show <id|@ref> [view] Show POPL entry or artifact');
|
|
189
|
+
printInfo('');
|
|
190
|
+
printInfo('Views for show command:');
|
|
191
|
+
printInfo(' popl, status, rpc, log (default: popl)');
|
|
73
192
|
printInfo('');
|
|
74
193
|
printInfo('Reference shortcuts:');
|
|
75
194
|
printInfo(' popl @this Create entry for current session');
|
|
76
195
|
printInfo(' popl @last Create entry for latest session');
|
|
77
196
|
printInfo(' popl @ref:name Create entry for named reference');
|
|
78
197
|
printInfo('');
|
|
198
|
+
printInfo('Options for session:');
|
|
199
|
+
printInfo(' --json Output JSON for piping');
|
|
200
|
+
printInfo(' --title <title> Set custom title');
|
|
201
|
+
printInfo('');
|
|
79
202
|
printInfo('Examples:');
|
|
80
203
|
printInfo(' popl init');
|
|
81
|
-
printInfo(' popl
|
|
82
|
-
printInfo(' popl
|
|
83
|
-
printInfo(' popl @last');
|
|
204
|
+
printInfo(' popl ls --oneline');
|
|
205
|
+
printInfo(' popl show 01JG status');
|
|
206
|
+
printInfo(' popl session @last --title "My audit"');
|
|
207
|
+
printInfo(' popl @last --json | ref add myentry');
|
|
208
|
+
printInfo(' popl show @ref:myentry');
|
|
84
209
|
}
|
|
85
210
|
/**
|
|
86
211
|
* Handle 'popl init' command
|
|
@@ -106,6 +231,11 @@ async function handlePoplInit() {
|
|
|
106
231
|
}
|
|
107
232
|
/**
|
|
108
233
|
* Handle 'popl session' command with @reference resolution
|
|
234
|
+
*
|
|
235
|
+
* Options:
|
|
236
|
+
* - --json: Output JSON only (for piping to ref add)
|
|
237
|
+
* - --title <title>: Set custom title
|
|
238
|
+
* - --unsafe-include-raw: Include unsanitized artifacts
|
|
109
239
|
*/
|
|
110
240
|
async function handlePoplSession(args, context, configPath) {
|
|
111
241
|
const cwd = process.cwd();
|
|
@@ -121,6 +251,7 @@ async function handlePoplSession(args, context, configPath) {
|
|
|
121
251
|
let refArg;
|
|
122
252
|
let title;
|
|
123
253
|
let unsafeIncludeRaw = false;
|
|
254
|
+
let jsonOutput = false;
|
|
124
255
|
for (let i = 0; i < args.length; i++) {
|
|
125
256
|
const arg = args[i];
|
|
126
257
|
if (arg === '--title' && i + 1 < args.length) {
|
|
@@ -129,6 +260,9 @@ async function handlePoplSession(args, context, configPath) {
|
|
|
129
260
|
else if (arg === '--unsafe-include-raw') {
|
|
130
261
|
unsafeIncludeRaw = true;
|
|
131
262
|
}
|
|
263
|
+
else if (arg === '--json') {
|
|
264
|
+
jsonOutput = true;
|
|
265
|
+
}
|
|
132
266
|
else if (arg.startsWith('@') || !arg.startsWith('-')) {
|
|
133
267
|
refArg = arg;
|
|
134
268
|
}
|
|
@@ -151,13 +285,23 @@ async function handlePoplSession(args, context, configPath) {
|
|
|
151
285
|
const resolver = new RefResolver(dataProvider);
|
|
152
286
|
const resolved = resolver.resolve(refArg, context);
|
|
153
287
|
if (!resolved.success || !resolved.ref) {
|
|
154
|
-
|
|
288
|
+
if (jsonOutput) {
|
|
289
|
+
console.log(JSON.stringify({ error: resolved.error || 'unknown error' }));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
printError(`Failed to resolve reference: ${resolved.error || 'unknown error'}`);
|
|
293
|
+
}
|
|
155
294
|
return;
|
|
156
295
|
}
|
|
157
296
|
// Must have a session
|
|
158
297
|
if (!resolved.ref.session) {
|
|
159
|
-
|
|
160
|
-
|
|
298
|
+
if (jsonOutput) {
|
|
299
|
+
console.log(JSON.stringify({ error: `Reference does not point to a session: ${refArg}` }));
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
printError(`Reference does not point to a session: ${refArg}`);
|
|
303
|
+
printInfo('POPL entries require a session. Use @last or cd into a session first.');
|
|
304
|
+
}
|
|
161
305
|
return;
|
|
162
306
|
}
|
|
163
307
|
sessionId = resolved.ref.session;
|
|
@@ -167,14 +311,31 @@ async function handlePoplSession(args, context, configPath) {
|
|
|
167
311
|
sessionId = refArg;
|
|
168
312
|
}
|
|
169
313
|
// Create POPL entry using service layer
|
|
170
|
-
|
|
314
|
+
if (!jsonOutput) {
|
|
315
|
+
printInfo(`Creating POPL entry for session: ${sessionId.slice(0, 8)}...`);
|
|
316
|
+
}
|
|
171
317
|
const result = await createSessionPoplEntry(sessionId, configDir, {
|
|
172
318
|
outputRoot: cwd,
|
|
173
319
|
title,
|
|
174
320
|
unsafeIncludeRaw,
|
|
175
321
|
});
|
|
176
322
|
if (!result.success) {
|
|
177
|
-
|
|
323
|
+
if (jsonOutput) {
|
|
324
|
+
console.log(JSON.stringify({ error: result.error }));
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
printError(`Failed to create POPL entry: ${result.error}`);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
// JSON output for piping (no local absolute paths for public ledger safety)
|
|
332
|
+
if (jsonOutput) {
|
|
333
|
+
const output = {
|
|
334
|
+
kind: 'popl',
|
|
335
|
+
entry_id: result.entryId,
|
|
336
|
+
target: `popl/${result.entryId}`,
|
|
337
|
+
};
|
|
338
|
+
console.log(JSON.stringify(output));
|
|
178
339
|
return;
|
|
179
340
|
}
|
|
180
341
|
printSuccess('POPL entry created successfully.');
|
|
@@ -186,8 +347,10 @@ async function handlePoplSession(args, context, configPath) {
|
|
|
186
347
|
/**
|
|
187
348
|
* Handle 'popl ls' command
|
|
188
349
|
*/
|
|
189
|
-
async function handlePoplList() {
|
|
350
|
+
async function handlePoplList(args) {
|
|
190
351
|
const cwd = process.cwd();
|
|
352
|
+
// Parse options
|
|
353
|
+
const oneline = args.includes('-s') || args.includes('--oneline');
|
|
191
354
|
if (!hasPoplDir(cwd)) {
|
|
192
355
|
printError('.popl directory not found.');
|
|
193
356
|
printInfo('Run "popl init" to initialize.');
|
|
@@ -200,19 +363,39 @@ async function handlePoplList() {
|
|
|
200
363
|
printInfo('Run "popl session @last" to create one.');
|
|
201
364
|
return;
|
|
202
365
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
366
|
+
if (oneline) {
|
|
367
|
+
// One-line format: <timestamp> | <title> | <id>
|
|
368
|
+
for (const entry of entries) {
|
|
369
|
+
const doc = await readPoplEntry(entry.path);
|
|
370
|
+
if (doc) {
|
|
371
|
+
const observed = getObservedTime(doc);
|
|
372
|
+
const formatted = formatTimestamp(observed);
|
|
373
|
+
const title = doc.entry.title || '(no title)';
|
|
374
|
+
console.log(`${formatted} | ${title} | ${doc.entry.id}`);
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
console.log(`(invalid) | (invalid POPL.yml) | ${entry.id}`);
|
|
378
|
+
}
|
|
213
379
|
}
|
|
214
|
-
|
|
215
|
-
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
// Default detailed format
|
|
383
|
+
console.log(`\nPOPL Entries (${entries.length}):\n`);
|
|
384
|
+
for (const entry of entries) {
|
|
385
|
+
const doc = await readPoplEntry(entry.path);
|
|
386
|
+
if (doc) {
|
|
387
|
+
const observed = getObservedTime(doc);
|
|
388
|
+
console.log(` ${doc.entry.id}`);
|
|
389
|
+
console.log(` Title: ${doc.entry.title}`);
|
|
390
|
+
console.log(` Target: ${doc.target.kind} (${doc.target.ids.connector_id || 'N/A'})`);
|
|
391
|
+
console.log(` Observed: ${formatTimestamp(observed)}`);
|
|
392
|
+
console.log(` Recorded: ${formatTimestamp(doc.entry.created_at)}`);
|
|
393
|
+
console.log(` Trust: ${doc.entry.trust.label}`);
|
|
394
|
+
console.log('');
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
console.log(` ${entry.id} ${dimText('(invalid POPL.yml)')}`);
|
|
398
|
+
}
|
|
216
399
|
}
|
|
217
400
|
}
|
|
218
401
|
}
|
|
@@ -223,32 +406,114 @@ async function handlePoplList() {
|
|
|
223
406
|
}
|
|
224
407
|
/**
|
|
225
408
|
* Handle 'popl show' command
|
|
409
|
+
*
|
|
410
|
+
* Supports:
|
|
411
|
+
* - popl show <entry-id> : Direct entry ID (with prefix matching)
|
|
412
|
+
* - popl show <id> [view] : Show specific artifact view
|
|
413
|
+
* - popl show @ref:<name> : Resolve ref to POPL entry
|
|
414
|
+
* - popl show @popl:<id> : Explicit POPL reference
|
|
226
415
|
*/
|
|
227
|
-
async function handlePoplShow(args) {
|
|
416
|
+
async function handlePoplShow(args, configPath) {
|
|
228
417
|
const cwd = process.cwd();
|
|
229
418
|
if (args.length === 0) {
|
|
230
|
-
printError('Usage: popl show <entry-id>');
|
|
419
|
+
printError('Usage: popl show <entry-id|@ref:name> [view]');
|
|
420
|
+
printInfo('Views: popl, status, rpc, log');
|
|
231
421
|
return;
|
|
232
422
|
}
|
|
233
423
|
if (!hasPoplDir(cwd)) {
|
|
234
424
|
printError('.popl directory not found.');
|
|
235
425
|
return;
|
|
236
426
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const
|
|
427
|
+
// Parse arguments: <entry-id|@ref> [view]
|
|
428
|
+
let entryIdArg = args[0];
|
|
429
|
+
const view = args.length > 1 ? args[1].toLowerCase() : undefined;
|
|
430
|
+
// Check if it's a @ref:<name> or @popl:<id> reference
|
|
431
|
+
if (isRef(entryIdArg)) {
|
|
432
|
+
const manager = new ConfigManager(configPath);
|
|
433
|
+
const eventsStore = new EventsStore(manager.getConfigDir());
|
|
434
|
+
const dataProvider = createRefDataProvider(eventsStore);
|
|
435
|
+
const resolver = new RefResolver(dataProvider);
|
|
436
|
+
const result = resolver.resolve(entryIdArg, {});
|
|
437
|
+
if (!result.success || !result.ref) {
|
|
438
|
+
printError(`Failed to resolve reference: ${result.error || 'unknown error'}`);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
// Must be a popl kind reference
|
|
442
|
+
if (result.ref.kind !== 'popl') {
|
|
443
|
+
printError(`Reference is not a POPL entry: ${entryIdArg}`);
|
|
444
|
+
printInfo(`Reference kind: ${result.ref.kind}`);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
// Get entry_id from the resolved ref
|
|
448
|
+
if (!result.ref.entry_id) {
|
|
449
|
+
printError(`Reference does not have a POPL entry ID: ${entryIdArg}`);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
entryIdArg = result.ref.entry_id;
|
|
453
|
+
}
|
|
454
|
+
// Validate view if provided
|
|
455
|
+
if (view && !VALID_VIEWS.includes(view)) {
|
|
456
|
+
printError(`Invalid view: ${view}`);
|
|
457
|
+
printInfo(`Valid views: ${VALID_VIEWS.join(', ')}`);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
// Resolve entry ID (supports prefix matching)
|
|
461
|
+
const resolved = await resolveEntryId(cwd, entryIdArg);
|
|
462
|
+
if (!resolved.success) {
|
|
463
|
+
printError(resolved.error);
|
|
464
|
+
if (resolved.candidates && resolved.candidates.length > 0) {
|
|
465
|
+
printInfo('Matching entries:');
|
|
466
|
+
const displayLimit = 10;
|
|
467
|
+
for (const candidate of resolved.candidates.slice(0, displayLimit)) {
|
|
468
|
+
printInfo(` ${candidate}`);
|
|
469
|
+
}
|
|
470
|
+
if (resolved.candidates.length > displayLimit) {
|
|
471
|
+
printInfo(` ... and ${resolved.candidates.length - displayLimit} more`);
|
|
472
|
+
}
|
|
473
|
+
printInfo('Provide a longer prefix to disambiguate.');
|
|
474
|
+
}
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const { entryId, entryPath } = resolved;
|
|
478
|
+
const displayPath = relative(cwd, entryPath) || '.';
|
|
479
|
+
// If view is specified, show artifact content
|
|
480
|
+
if (view) {
|
|
481
|
+
const artifactFile = VIEW_ARTIFACT_MAP[view];
|
|
482
|
+
const artifactPath = join(entryPath, artifactFile);
|
|
483
|
+
if (!existsSync(artifactPath)) {
|
|
484
|
+
printError(`Artifact not found: ${artifactFile}`);
|
|
485
|
+
printInfo(`Path: ${relative(cwd, artifactPath)}`);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
try {
|
|
489
|
+
const content = await readFile(artifactPath, 'utf-8');
|
|
490
|
+
process.stdout.write(content);
|
|
491
|
+
// Ensure newline at end
|
|
492
|
+
if (!content.endsWith('\n')) {
|
|
493
|
+
process.stdout.write('\n');
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
498
|
+
printError(`Failed to read artifact: ${msg}`);
|
|
499
|
+
}
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
// Default: show POPL entry metadata
|
|
240
503
|
const doc = await readPoplEntry(entryPath);
|
|
241
504
|
if (!doc) {
|
|
242
|
-
printError(`
|
|
505
|
+
printError(`Failed to read POPL.yml: ${entryId}`);
|
|
243
506
|
return;
|
|
244
507
|
}
|
|
508
|
+
const observed = getObservedTime(doc);
|
|
245
509
|
// Display entry
|
|
246
510
|
console.log('\nPOPL Entry');
|
|
247
511
|
console.log('═══════════════════════════════════════════════════\n');
|
|
248
512
|
console.log(`ID: ${doc.entry.id}`);
|
|
249
513
|
console.log(`Title: ${doc.entry.title}`);
|
|
250
514
|
console.log(`Author: ${doc.entry.author.name}${doc.entry.author.handle ? ` (@${doc.entry.author.handle})` : ''}`);
|
|
251
|
-
console.log(`
|
|
515
|
+
console.log(`Observed: ${formatTimestamp(observed)}`);
|
|
516
|
+
console.log(`Recorded: ${formatTimestamp(doc.entry.created_at)}`);
|
|
252
517
|
console.log(`Trust: ${doc.entry.trust.label} (level ${doc.entry.trust.level})`);
|
|
253
518
|
console.log('\nTarget:');
|
|
254
519
|
console.log(` Kind: ${doc.target.kind}`);
|
|
@@ -276,6 +541,81 @@ async function handlePoplShow(args) {
|
|
|
276
541
|
for (const artifact of doc.evidence.artifacts) {
|
|
277
542
|
console.log(` - ${artifact.name} ${dimText(`(${artifact.sha256.slice(0, 16)}...)`)}`);
|
|
278
543
|
}
|
|
279
|
-
console.log(`\nPath: ${
|
|
544
|
+
console.log(`\nPath: ${displayPath}`);
|
|
545
|
+
console.log(`\nTip: Use "popl show ${entryId.slice(0, 8)} <view>" to see artifact content`);
|
|
546
|
+
console.log(` Views: ${VALID_VIEWS.join(', ')}`);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Get POPL JSON output for piping (used by repl.ts for pipe support)
|
|
550
|
+
*
|
|
551
|
+
* This is similar to handlePoplSession but returns JSON string instead of printing.
|
|
552
|
+
* Used for: popl @last --json | ref add <name>
|
|
553
|
+
*
|
|
554
|
+
* @returns JSON string or null on failure
|
|
555
|
+
*/
|
|
556
|
+
export async function getPoplJsonOutput(args, context, configPath) {
|
|
557
|
+
const cwd = process.cwd();
|
|
558
|
+
const manager = new ConfigManager(configPath);
|
|
559
|
+
const configDir = manager.getConfigDir();
|
|
560
|
+
// Check .popl exists
|
|
561
|
+
if (!hasPoplDir(cwd)) {
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
// Parse arguments (same as handlePoplSession)
|
|
565
|
+
let refArg;
|
|
566
|
+
let title;
|
|
567
|
+
let unsafeIncludeRaw = false;
|
|
568
|
+
for (let i = 0; i < args.length; i++) {
|
|
569
|
+
const arg = args[i];
|
|
570
|
+
if (arg === '--title' && i + 1 < args.length) {
|
|
571
|
+
title = args[++i];
|
|
572
|
+
}
|
|
573
|
+
else if (arg === '--unsafe-include-raw') {
|
|
574
|
+
unsafeIncludeRaw = true;
|
|
575
|
+
}
|
|
576
|
+
else if (arg.startsWith('@') || !arg.startsWith('-')) {
|
|
577
|
+
refArg = arg;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
// Default to @this if no reference and we have context
|
|
581
|
+
if (!refArg) {
|
|
582
|
+
if (context.session) {
|
|
583
|
+
refArg = '@this';
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
refArg = '@last';
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
// Resolve reference to session ID
|
|
590
|
+
let sessionId;
|
|
591
|
+
if (isRef(refArg)) {
|
|
592
|
+
const eventsStore = new EventsStore(configDir);
|
|
593
|
+
const dataProvider = createRefDataProvider(eventsStore);
|
|
594
|
+
const resolver = new RefResolver(dataProvider);
|
|
595
|
+
const resolved = resolver.resolve(refArg, context);
|
|
596
|
+
if (!resolved.success || !resolved.ref || !resolved.ref.session) {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
sessionId = resolved.ref.session;
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
sessionId = refArg;
|
|
603
|
+
}
|
|
604
|
+
// Create POPL entry using service layer
|
|
605
|
+
const result = await createSessionPoplEntry(sessionId, configDir, {
|
|
606
|
+
outputRoot: cwd,
|
|
607
|
+
title,
|
|
608
|
+
unsafeIncludeRaw,
|
|
609
|
+
});
|
|
610
|
+
if (!result.success || !result.entryId) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
// Return JSON (same format as handlePoplSession --json)
|
|
614
|
+
const output = {
|
|
615
|
+
kind: 'popl',
|
|
616
|
+
entry_id: result.entryId,
|
|
617
|
+
target: `popl/${result.entryId}`,
|
|
618
|
+
};
|
|
619
|
+
return JSON.stringify(output);
|
|
280
620
|
}
|
|
281
621
|
//# sourceMappingURL=popl-commands.js.map
|