@ivotoby/postgram-cli 1.33.3 → 1.34.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/README.md CHANGED
@@ -82,6 +82,22 @@ commands (`search`, `list`, `task list`, `expand`) when an agent needs the
82
82
  smallest readable output. TOON and compacting are CLI-layer formats; the
83
83
  Postgram API remains JSON.
84
84
 
85
+ Compact search may include an `edges` summary:
86
+
87
+ ```json
88
+ "edges": {
89
+ "count": 3,
90
+ "relations": [{ "relation": "mentioned_in", "count": 2 }]
91
+ }
92
+ ```
93
+
94
+ `edges.count` and `edges.relations` are traversal affordances. They tell an
95
+ agent that graph context exists without returning neighbor content. Use
96
+ `--expand-graph` or `pgm expand <entity-id>` when the user asks about causes,
97
+ provenance, decisions, dependencies, blockers, ownership, involvement,
98
+ discussion participants, connected context, or ambiguous search hits. Do not
99
+ expand when the compact result already answers a direct fact.
100
+
85
101
  ## Memory Roles
86
102
 
87
103
  Store durable memory:
package/dist/pgm.js CHANGED
@@ -15,6 +15,13 @@ function readCliVersion() {
15
15
  const packageJson = JSON.parse(rawPackageJson);
16
16
  return packageJson.version;
17
17
  }
18
+ function printTopLevelVersionAndExit(argv) {
19
+ if (argv.length === 3 && (argv[2] === '--version' || argv[2] === '-V')) {
20
+ process.stdout.write(`${readCliVersion()}\n`);
21
+ process.exit(0);
22
+ }
23
+ }
24
+ printTopLevelVersionAndExit(process.argv);
18
25
  function formatStoredEntity(entity) {
19
26
  return [
20
27
  `${entity.type} ${shortId(entity.id)}${entity.status ? ` [${entity.status}]` : ''}`,
@@ -244,7 +251,6 @@ const program = new Command();
244
251
  program
245
252
  .name('pgm')
246
253
  .description('Postgram CLI for humans and agents')
247
- .version(readCliVersion())
248
254
  .option('--json', 'emit compact JSON for agents where supported');
249
255
  program
250
256
  .command('store')
@@ -60,6 +60,7 @@ export function compactSearchResponse(response) {
60
60
  content: entry.entity.content,
61
61
  chunk: entry.chunk_content,
62
62
  ...(entry.entity.tags?.length ? { tags: entry.entity.tags } : {}),
63
+ ...(entry.edges ? { edges: entry.edges } : {}),
63
64
  ...(entry.related?.length
64
65
  ? {
65
66
  related: entry.related.map((related) => ({
@@ -98,9 +99,18 @@ function toonScalar(value) {
98
99
  }
99
100
  return /[,\n\r"]/u.test(scalar) ? JSON.stringify(scalar) : scalar;
100
101
  }
102
+ function formatEdgeSummary(edges) {
103
+ if (!edges || edges.count === 0) {
104
+ return '';
105
+ }
106
+ const relations = edges.relations
107
+ .map((entry) => `${entry.relation}=${entry.count}`)
108
+ .join('|');
109
+ return `${edges.count} edges${relations ? `: ${relations}` : ''}`;
110
+ }
101
111
  export function searchResponseToToon(response) {
102
112
  const lines = [
103
- `results[${response.results.length}]{id,type,score,content,chunk,tags,related}:`
113
+ `results[${response.results.length}]{id,type,score,content,chunk,tags,edges,related}:`
104
114
  ];
105
115
  for (const result of response.results) {
106
116
  lines.push([
@@ -112,6 +122,7 @@ export function searchResponseToToon(response) {
112
122
  result.content,
113
123
  result.chunk,
114
124
  result.tags,
125
+ formatEdgeSummary(result.edges),
115
126
  result.related?.length ? `${result.related.length} related` : ''
116
127
  ]
117
128
  .map(toonScalar)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivotoby/postgram-cli",
3
- "version": "1.33.3",
3
+ "version": "1.34.1",
4
4
  "description": "Postgram CLI — store, search, and manage entities from the command line",
5
5
  "type": "module",
6
6
  "bin": {