@ivotoby/postgram-cli 1.30.1 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/pgm.js +17 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @ivotoby/postgram-cli
|
|
2
2
|
|
|
3
|
-
Command-line client for [Postgram](https://github.com/ivo-toby/postgram/)
|
|
3
|
+
Command-line client for [Postgram](https://github.com/ivo-toby/postgram/) built
|
|
4
|
+
for both humans and agents.
|
|
4
5
|
|
|
5
6
|
## Install
|
|
6
7
|
|
|
@@ -24,10 +25,10 @@ echo '{"api_url":"http://localhost:3100","api_key":"your-api-key"}' > ~/.pgmrc
|
|
|
24
25
|
## Usage
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
|
-
# Store
|
|
28
|
+
# Store durable memory
|
|
28
29
|
pgm store "decided to use pgvector" --type memory --tags "decisions,architecture"
|
|
29
30
|
|
|
30
|
-
# Search
|
|
31
|
+
# Search with human output
|
|
31
32
|
pgm search "pgvector decisions" --limit 5
|
|
32
33
|
|
|
33
34
|
# Agent-friendly output formats
|
|
@@ -69,7 +70,7 @@ pgm sync ./notes --repo my-notes
|
|
|
69
70
|
# Check enrichment/extraction queue status
|
|
70
71
|
pgm queue
|
|
71
72
|
|
|
72
|
-
# JSON output
|
|
73
|
+
# Compact JSON output where supported
|
|
73
74
|
pgm store "hello" --json
|
|
74
75
|
```
|
|
75
76
|
|
package/dist/pgm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
-
import { createWriteStream } from 'node:fs';
|
|
3
|
+
import { createWriteStream, readFileSync } from 'node:fs';
|
|
4
4
|
import { mkdir, readFile as fsReadFile, stat } from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { Command } from 'commander';
|
|
@@ -10,6 +10,11 @@ import { handleCliFailure, isJsonMode, parseCommaList, parseJsonObject, printHum
|
|
|
10
10
|
import { AppError, ErrorCode } from './errors.js';
|
|
11
11
|
import { buildSyncManifest } from './sync-walk.js';
|
|
12
12
|
import { compactEdgeResponse, compactEntityListResponse, compactGraphResponse, compactSearchResponse, compactStoredEntityResponse, entityListResponseToToon, graphResponseToToon, searchResponseToToon } from './search-output.js';
|
|
13
|
+
function readCliVersion() {
|
|
14
|
+
const rawPackageJson = readFileSync(new URL('../package.json', import.meta.url), 'utf8');
|
|
15
|
+
const packageJson = JSON.parse(rawPackageJson);
|
|
16
|
+
return packageJson.version;
|
|
17
|
+
}
|
|
13
18
|
function formatStoredEntity(entity) {
|
|
14
19
|
return [
|
|
15
20
|
`${entity.type} ${shortId(entity.id)}${entity.status ? ` [${entity.status}]` : ''}`,
|
|
@@ -238,15 +243,16 @@ async function runBackup(output, encrypt) {
|
|
|
238
243
|
const program = new Command();
|
|
239
244
|
program
|
|
240
245
|
.name('pgm')
|
|
241
|
-
.description('Postgram
|
|
242
|
-
.
|
|
246
|
+
.description('Postgram CLI for humans and agents')
|
|
247
|
+
.version(readCliVersion())
|
|
248
|
+
.option('--json', 'emit compact JSON for agents where supported');
|
|
243
249
|
program
|
|
244
250
|
.command('store')
|
|
245
251
|
.alias('add')
|
|
246
|
-
.description('Store
|
|
252
|
+
.description('Store durable memory/entity; use memory session-context for resumability')
|
|
247
253
|
.argument('[content]', 'entity content')
|
|
248
254
|
.option('--type <type>', 'entity type', 'memory')
|
|
249
|
-
.option('--visibility <visibility>', 'entity visibility', 'shared')
|
|
255
|
+
.option('--visibility <visibility>', 'entity visibility (prefer personal for agent memory)', 'shared')
|
|
250
256
|
.option('--owner <owner>', 'entity owner or namespace')
|
|
251
257
|
.option('--status <status>', 'entity status')
|
|
252
258
|
.option('--tags <tags>', 'comma-separated tags')
|
|
@@ -284,7 +290,7 @@ program
|
|
|
284
290
|
});
|
|
285
291
|
program
|
|
286
292
|
.command('search')
|
|
287
|
-
.description('Search stored entities')
|
|
293
|
+
.description('Search stored entities (compact JSON with --json; TOON with --toon)')
|
|
288
294
|
.argument('query', 'search query')
|
|
289
295
|
.option('--type <type>', 'entity type')
|
|
290
296
|
.option('--tags <tags>', 'comma-separated tags')
|
|
@@ -295,7 +301,7 @@ program
|
|
|
295
301
|
.option('--recency-weight <recencyWeight>', 'recency weight', '0.1')
|
|
296
302
|
.option('--expand-graph', 'include graph-connected entities in results')
|
|
297
303
|
.option('--include-archived', 'include archived entities in results')
|
|
298
|
-
.option('--memory-role <role>', 'memory role filter: durable_memory
|
|
304
|
+
.option('--memory-role <role>', 'memory role filter: session_context for continuity; durable_memory for stable facts')
|
|
299
305
|
.option('--full-response', 'emit the full API response instead of compact default output when used with --json')
|
|
300
306
|
.option('--toon', 'emit compact TOON output for lower agent token use; formatting is applied in the CLI, not the API')
|
|
301
307
|
.action(async (query, options, command) => {
|
|
@@ -333,7 +339,7 @@ program
|
|
|
333
339
|
});
|
|
334
340
|
const memoryCommand = program
|
|
335
341
|
.command('memory')
|
|
336
|
-
.description('Memory
|
|
342
|
+
.description('Memory commands for agent session context');
|
|
337
343
|
memoryCommand
|
|
338
344
|
.command('groom')
|
|
339
345
|
.description('Preview or archive stale session-context memories for the authenticated client')
|
|
@@ -381,12 +387,12 @@ memoryCommand
|
|
|
381
387
|
memoryCommand
|
|
382
388
|
.command('session-context')
|
|
383
389
|
.alias('session')
|
|
384
|
-
.description('Store client-scoped session
|
|
390
|
+
.description('Store client-scoped session context for agent resumability')
|
|
385
391
|
.argument('[content]', 'session context content')
|
|
386
|
-
.option('--visibility <visibility>', 'entity visibility', 'shared')
|
|
392
|
+
.option('--visibility <visibility>', 'entity visibility (prefer personal for agent session context)', 'shared')
|
|
387
393
|
.option('--owner <owner>', 'entity owner or namespace')
|
|
388
394
|
.option('--session-id <sessionId>', 'external session or thread id')
|
|
389
|
-
.option('--agent-id <agentId>', 'agent
|
|
395
|
+
.option('--agent-id <agentId>', 'agent/persona metadata only; not an auth boundary')
|
|
390
396
|
.option('--topic <topic>', 'topic label')
|
|
391
397
|
.option('--tags <tags>', 'comma-separated tags')
|
|
392
398
|
.option('--promotable', 'mark this session context as promotable')
|