@productbrain/cli 0.1.0-beta.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/context.d.ts +8 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +18 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/get.d.ts +8 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +17 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/orient.d.ts +100 -0
- package/dist/commands/orient.d.ts.map +1 -0
- package/dist/commands/orient.js +37 -0
- package/dist/commands/orient.js.map +1 -0
- package/dist/commands/search.d.ts +7 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +12 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/formatters/context.d.ts +32 -0
- package/dist/formatters/context.d.ts.map +1 -0
- package/dist/formatters/context.js +76 -0
- package/dist/formatters/context.js.map +1 -0
- package/dist/formatters/entry.d.ts +33 -0
- package/dist/formatters/entry.d.ts.map +1 -0
- package/dist/formatters/entry.js +57 -0
- package/dist/formatters/entry.js.map +1 -0
- package/dist/formatters/orient.d.ts +102 -0
- package/dist/formatters/orient.d.ts.map +1 -0
- package/dist/formatters/orient.js +204 -0
- package/dist/formatters/orient.js.map +1 -0
- package/dist/formatters/search.d.ts +12 -0
- package/dist/formatters/search.d.ts.map +1 -0
- package/dist/formatters/search.js +17 -0
- package/dist/formatters/search.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client.d.ts +5 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +21 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +36 -0
- package/dist/lib/config.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb context <entry-id> — gather and display constellation context.
|
|
3
|
+
* Pipe-friendly: when stdout is not a TTY, output clean markdown (no ANSI codes).
|
|
4
|
+
*/
|
|
5
|
+
export declare function runContext(options: {
|
|
6
|
+
entryId: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb context <entry-id> — gather and display constellation context.
|
|
3
|
+
* Pipe-friendly: when stdout is not a TTY, output clean markdown (no ANSI codes).
|
|
4
|
+
*/
|
|
5
|
+
import { mcpCall } from '../lib/client.js';
|
|
6
|
+
import { formatContext } from '../formatters/context.js';
|
|
7
|
+
export async function runContext(options) {
|
|
8
|
+
const result = await mcpCall('chain.gatherContext', {
|
|
9
|
+
entryId: options.entryId,
|
|
10
|
+
maxHops: 2,
|
|
11
|
+
});
|
|
12
|
+
if (!result?.root) {
|
|
13
|
+
throw new Error(`Entry "${options.entryId}" not found.`);
|
|
14
|
+
}
|
|
15
|
+
const tty = Boolean(process.stdout.isTTY);
|
|
16
|
+
console.log(formatContext(result, { tty }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAsB,MAAM,0BAA0B,CAAC;AAE7E,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA4B;IAC3D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAgB,qBAAqB,EAAE;QACjE,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,CAAC;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,UAAU,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAsB,MAAM,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb get — display full entry by ID (data, relations, last 10 history events).
|
|
3
|
+
* BET-108 Slice 3.
|
|
4
|
+
*/
|
|
5
|
+
import { mcpCall } from '../lib/client.js';
|
|
6
|
+
import { formatEntry } from '../formatters/entry.js';
|
|
7
|
+
export async function runGet(options) {
|
|
8
|
+
const entry = await mcpCall('chain.getEntry', {
|
|
9
|
+
entryId: options.entryId,
|
|
10
|
+
});
|
|
11
|
+
if (!entry) {
|
|
12
|
+
console.error(`Entry '${options.entryId}' not found.`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
console.log(formatEntry(entry));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAqB,MAAM,wBAAwB,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA4B;IACvD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAsB,gBAAgB,EAAE;QACjE,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb orient — prints workspace stage and all orient sections per ARCH-25.
|
|
3
|
+
*/
|
|
4
|
+
export interface OrientViewFromApi {
|
|
5
|
+
stage: string;
|
|
6
|
+
strategicContext: {
|
|
7
|
+
vision: string | null;
|
|
8
|
+
purpose: string | null;
|
|
9
|
+
activeBetCount: number;
|
|
10
|
+
currentBet: string | null;
|
|
11
|
+
activeTensionCount: number;
|
|
12
|
+
productAreas: string[];
|
|
13
|
+
productAreaCount: number;
|
|
14
|
+
};
|
|
15
|
+
activeBets: Array<{
|
|
16
|
+
entryId: string | null;
|
|
17
|
+
name: string;
|
|
18
|
+
collectionSlug: string | null;
|
|
19
|
+
status: string;
|
|
20
|
+
preview?: string;
|
|
21
|
+
linkedTensions?: Array<{
|
|
22
|
+
entryId: string | null;
|
|
23
|
+
name: string;
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
governance?: {
|
|
27
|
+
principles: Array<{
|
|
28
|
+
entryId: string | null;
|
|
29
|
+
name: string;
|
|
30
|
+
preview?: string;
|
|
31
|
+
}>;
|
|
32
|
+
standards: Array<{
|
|
33
|
+
entryId: string | null;
|
|
34
|
+
name: string;
|
|
35
|
+
preview?: string;
|
|
36
|
+
}>;
|
|
37
|
+
businessRules: Array<{
|
|
38
|
+
entryId: string | null;
|
|
39
|
+
name: string;
|
|
40
|
+
preview?: string;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
tensions?: Array<{
|
|
44
|
+
entryId: string | null;
|
|
45
|
+
name: string;
|
|
46
|
+
}>;
|
|
47
|
+
architectureNotes?: Array<{
|
|
48
|
+
entryId: string | null;
|
|
49
|
+
name: string;
|
|
50
|
+
preview?: string;
|
|
51
|
+
}>;
|
|
52
|
+
proposals?: Array<{
|
|
53
|
+
targetEntryName: string;
|
|
54
|
+
proposedOperation: string;
|
|
55
|
+
hoursRemaining: number;
|
|
56
|
+
}>;
|
|
57
|
+
absenceSignals?: Array<{
|
|
58
|
+
type: string;
|
|
59
|
+
severity: string;
|
|
60
|
+
message: string;
|
|
61
|
+
suggestion?: string;
|
|
62
|
+
}>;
|
|
63
|
+
plannedWork?: {
|
|
64
|
+
uncommittedDrafts: Array<{
|
|
65
|
+
name: string;
|
|
66
|
+
collection: string;
|
|
67
|
+
}>;
|
|
68
|
+
inProgressEntries: Array<{
|
|
69
|
+
name: string;
|
|
70
|
+
collection: string;
|
|
71
|
+
entryId: string;
|
|
72
|
+
}>;
|
|
73
|
+
openTensions: Array<{
|
|
74
|
+
name: string;
|
|
75
|
+
entryId: string;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
priorSessions?: Array<{
|
|
79
|
+
sessionId: string;
|
|
80
|
+
status: string;
|
|
81
|
+
startedAt: number;
|
|
82
|
+
entriesCreated: string[];
|
|
83
|
+
entriesModified: string[];
|
|
84
|
+
}>;
|
|
85
|
+
recoveryBlock?: {
|
|
86
|
+
sessionId: string;
|
|
87
|
+
status: string;
|
|
88
|
+
date: string;
|
|
89
|
+
duration: string;
|
|
90
|
+
draftsNeedingAttention: Array<{
|
|
91
|
+
entryId: string;
|
|
92
|
+
collection: string;
|
|
93
|
+
name: string;
|
|
94
|
+
}>;
|
|
95
|
+
} | null;
|
|
96
|
+
}
|
|
97
|
+
export declare function runOrient(options?: {
|
|
98
|
+
brief?: boolean;
|
|
99
|
+
}): Promise<void>;
|
|
100
|
+
//# sourceMappingURL=orient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient.d.ts","sourceRoot":"","sources":["../../src/commands/orient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,UAAU,EAAE,KAAK,CAAC;QAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClE,CAAC,CAAC;IACH,UAAU,CAAC,EAAE;QACX,UAAU,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;YAAC,IAAI,EAAE,M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,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAChF,YAAY,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC;IACF,aAAa,CAAC,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC,CAAC;IACH,aAAa,CAAC,EAAE;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtF,GAAG,IAAI,CAAC;CACV;AAwBD,wBAAsB,SAAS,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAShF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb orient — prints workspace stage and all orient sections per ARCH-25.
|
|
3
|
+
*/
|
|
4
|
+
import { mcpCall } from '../lib/client.js';
|
|
5
|
+
import { formatOrient, formatOrientBrief } from '../formatters/orient.js';
|
|
6
|
+
function normalizeView(raw) {
|
|
7
|
+
return {
|
|
8
|
+
...raw,
|
|
9
|
+
governance: raw.governance ?? {
|
|
10
|
+
principles: [],
|
|
11
|
+
standards: [],
|
|
12
|
+
businessRules: [],
|
|
13
|
+
},
|
|
14
|
+
tensions: raw.tensions ?? [],
|
|
15
|
+
architectureNotes: raw.architectureNotes ?? [],
|
|
16
|
+
proposals: raw.proposals ?? [],
|
|
17
|
+
absenceSignals: raw.absenceSignals ?? [],
|
|
18
|
+
plannedWork: raw.plannedWork ?? {
|
|
19
|
+
uncommittedDrafts: [],
|
|
20
|
+
inProgressEntries: [],
|
|
21
|
+
openTensions: [],
|
|
22
|
+
},
|
|
23
|
+
priorSessions: raw.priorSessions ?? [],
|
|
24
|
+
recoveryBlock: raw.recoveryBlock ?? null,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export async function runOrient(options = {}) {
|
|
28
|
+
const raw = await mcpCall('chain.getOrientView', {});
|
|
29
|
+
const view = normalizeView(raw);
|
|
30
|
+
if (options.brief) {
|
|
31
|
+
console.log(formatOrientBrief(view));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(formatOrient(view));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=orient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient.js","sourceRoot":"","sources":["../../src/commands/orient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AA4D1E,SAAS,aAAa,CAAC,GAAsB;IAC3C,OAAO;QACL,GAAG,GAAG;QACN,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI;YAC5B,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,aAAa,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;QAC5B,iBAAiB,EAAE,GAAG,CAAC,iBAAiB,IAAI,EAAE;QAC9C,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,EAAE;QAC9B,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE;QACxC,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI;YAC9B,iBAAiB,EAAE,EAAE;YACrB,iBAAiB,EAAE,EAAE;YACrB,YAAY,EAAE,EAAE;SACjB;QACD,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,EAAE;QACtC,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,UAA+B,EAAE;IAC/D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAoB,qBAAqB,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb search — full-text search across all collections via chain.searchEntries.
|
|
3
|
+
*/
|
|
4
|
+
import { mcpCall } from '../lib/client.js';
|
|
5
|
+
import { formatSearchResults } from '../formatters/search.js';
|
|
6
|
+
export async function runSearch(options) {
|
|
7
|
+
const results = await mcpCall('chain.searchEntries', {
|
|
8
|
+
query: options.query,
|
|
9
|
+
});
|
|
10
|
+
console.log(formatSearchResults(results ?? []));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAqB,MAAM,yBAAyB,CAAC;AAEjF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAiB,qBAAqB,EAAE;QACnE,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context formatter — constellation context for pb context <entry-id>.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
* Pipe-friendly: when stdout is not a TTY, output clean markdown (no ANSI codes).
|
|
5
|
+
*/
|
|
6
|
+
export interface ContextRelatedEntry {
|
|
7
|
+
_id?: string;
|
|
8
|
+
entryId: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
canonicalKey?: string;
|
|
11
|
+
collectionSlug?: string;
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
relationType?: string;
|
|
14
|
+
relationDirection?: string;
|
|
15
|
+
hop?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ContextResult {
|
|
18
|
+
root: {
|
|
19
|
+
_id: string;
|
|
20
|
+
entryId: string | null;
|
|
21
|
+
name: string;
|
|
22
|
+
collectionSlug: string;
|
|
23
|
+
};
|
|
24
|
+
related: ContextRelatedEntry[];
|
|
25
|
+
totalRelations: number;
|
|
26
|
+
hopsTraversed: number;
|
|
27
|
+
}
|
|
28
|
+
/** Format context for terminal (readable summary) or pipe (clean markdown, no ANSI). */
|
|
29
|
+
export declare function formatContext(result: ContextResult, options: {
|
|
30
|
+
tty: boolean;
|
|
31
|
+
}): string;
|
|
32
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/formatters/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAKtF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context formatter — constellation context for pb context <entry-id>.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
* Pipe-friendly: when stdout is not a TTY, output clean markdown (no ANSI codes).
|
|
5
|
+
*/
|
|
6
|
+
/** Format context for terminal (readable summary) or pipe (clean markdown, no ANSI). */
|
|
7
|
+
export function formatContext(result, options) {
|
|
8
|
+
if (options.tty) {
|
|
9
|
+
return formatContextTty(result);
|
|
10
|
+
}
|
|
11
|
+
return formatContextPipe(result);
|
|
12
|
+
}
|
|
13
|
+
/** Terminal output — compact, scannable summary. */
|
|
14
|
+
function formatContextTty(result) {
|
|
15
|
+
const lines = [];
|
|
16
|
+
const root = result.root;
|
|
17
|
+
const id = root.entryId ?? root.name;
|
|
18
|
+
lines.push(`${id} [${root.collectionSlug}] — ${root.name}`);
|
|
19
|
+
lines.push(`${result.totalRelations} related (${result.hopsTraversed} hops)`);
|
|
20
|
+
lines.push('');
|
|
21
|
+
if (result.related.length === 0) {
|
|
22
|
+
lines.push('No related entries.');
|
|
23
|
+
return lines.join('\n');
|
|
24
|
+
}
|
|
25
|
+
const byCollection = groupByCollection(result.related);
|
|
26
|
+
for (const [collName, entries] of byCollection) {
|
|
27
|
+
lines.push(`${collName} (${entries.length})`);
|
|
28
|
+
for (const e of entries.slice(0, 8)) {
|
|
29
|
+
const arrow = e.relationDirection === 'outgoing' ? '→' : '←';
|
|
30
|
+
const hopLabel = (e.hop ?? 1) > 1 ? ` (hop ${e.hop})` : '';
|
|
31
|
+
const eid = e.entryId ? `${e.entryId}: ` : '';
|
|
32
|
+
lines.push(` ${arrow} ${e.relationType ?? '—'} ${eid}${e.name}${hopLabel}`);
|
|
33
|
+
}
|
|
34
|
+
if (entries.length > 8) {
|
|
35
|
+
lines.push(` … +${entries.length - 8} more`);
|
|
36
|
+
}
|
|
37
|
+
lines.push('');
|
|
38
|
+
}
|
|
39
|
+
return lines.join('\n').trimEnd();
|
|
40
|
+
}
|
|
41
|
+
/** Pipe output — clean markdown, no ANSI codes. Suitable for > file.md. */
|
|
42
|
+
function formatContextPipe(result) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
const root = result.root;
|
|
45
|
+
const id = root.entryId ?? root.name;
|
|
46
|
+
lines.push(`# Context: ${id}: ${root.name}`);
|
|
47
|
+
lines.push(`_${result.totalRelations} related entries (${result.hopsTraversed} hops)_`);
|
|
48
|
+
lines.push('');
|
|
49
|
+
if (result.related.length === 0) {
|
|
50
|
+
lines.push('No related entries.');
|
|
51
|
+
return lines.join('\n');
|
|
52
|
+
}
|
|
53
|
+
const byCollection = groupByCollection(result.related);
|
|
54
|
+
for (const [collName, entries] of byCollection) {
|
|
55
|
+
lines.push(`## ${collName} (${entries.length})`);
|
|
56
|
+
for (const e of entries) {
|
|
57
|
+
const arrow = e.relationDirection === 'outgoing' ? '→' : '←';
|
|
58
|
+
const hopLabel = (e.hop ?? 1) > 1 ? ` (hop ${e.hop})` : '';
|
|
59
|
+
const eid = e.entryId ? `${e.entryId}: ` : '';
|
|
60
|
+
lines.push(`- ${arrow} **${e.relationType ?? '—'}** ${eid}${e.name}${hopLabel}`);
|
|
61
|
+
}
|
|
62
|
+
lines.push('');
|
|
63
|
+
}
|
|
64
|
+
return lines.join('\n').trimEnd();
|
|
65
|
+
}
|
|
66
|
+
function groupByCollection(related) {
|
|
67
|
+
const map = new Map();
|
|
68
|
+
for (const e of related) {
|
|
69
|
+
const key = e.collectionName ?? e.collectionSlug ?? 'unknown';
|
|
70
|
+
const list = map.get(key) ?? [];
|
|
71
|
+
list.push(e);
|
|
72
|
+
map.set(key, list);
|
|
73
|
+
}
|
|
74
|
+
return map;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/formatters/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,MAAqB,EAAE,OAAyB;IAC5E,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,oDAAoD;AACpD,SAAS,gBAAgB,CAAC,MAAqB;I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,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry formatter — full entry display with data, relations, and history.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
export interface EntryRelation {
|
|
6
|
+
direction: string;
|
|
7
|
+
type: string;
|
|
8
|
+
otherEntryId?: string | null;
|
|
9
|
+
otherName?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface EntryHistoryEvent {
|
|
12
|
+
timestamp: number;
|
|
13
|
+
event: string;
|
|
14
|
+
changedBy?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EntryFromApi {
|
|
17
|
+
entryId?: string | null;
|
|
18
|
+
name: string;
|
|
19
|
+
canonicalKey?: string | null;
|
|
20
|
+
status: string;
|
|
21
|
+
workflowStatus?: string;
|
|
22
|
+
data?: Record<string, unknown>;
|
|
23
|
+
tags?: string[];
|
|
24
|
+
labels?: Array<{
|
|
25
|
+
slug?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
}>;
|
|
28
|
+
relations?: EntryRelation[];
|
|
29
|
+
history?: EntryHistoryEvent[];
|
|
30
|
+
}
|
|
31
|
+
/** Format full entry for terminal output — data fields, relations (with type labels), last 10 history events. */
|
|
32
|
+
export declare function formatEntry(entry: EntryFromApi): string;
|
|
33
|
+
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/formatters/entry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAUD,iHAAiH;AACjH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAmDvD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry formatter — full entry display with data, relations, and history.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
function sanitizeData(data) {
|
|
6
|
+
if (!data || typeof data !== 'object')
|
|
7
|
+
return undefined;
|
|
8
|
+
const filtered = Object.fromEntries(Object.entries(data).filter(([k]) => !k.startsWith('_')));
|
|
9
|
+
return Object.keys(filtered).length > 0 ? filtered : undefined;
|
|
10
|
+
}
|
|
11
|
+
/** Format full entry for terminal output — data fields, relations (with type labels), last 10 history events. */
|
|
12
|
+
export function formatEntry(entry) {
|
|
13
|
+
const lines = [];
|
|
14
|
+
const id = entry.entryId ?? '—';
|
|
15
|
+
const coll = entry.canonicalKey ?? '—';
|
|
16
|
+
lines.push(`${id} [${coll}] ${entry.name}`);
|
|
17
|
+
lines.push('');
|
|
18
|
+
lines.push(`Status: ${entry.status}${entry.workflowStatus ? ` / ${entry.workflowStatus}` : ''}`);
|
|
19
|
+
lines.push('');
|
|
20
|
+
const data = sanitizeData(entry.data);
|
|
21
|
+
if (data) {
|
|
22
|
+
lines.push('Data:');
|
|
23
|
+
for (const [key, val] of Object.entries(data)) {
|
|
24
|
+
const display = typeof val === 'string' ? val : JSON.stringify(val);
|
|
25
|
+
lines.push(` ${key}: ${display}`);
|
|
26
|
+
}
|
|
27
|
+
lines.push('');
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(entry.tags) && entry.tags.length > 0) {
|
|
30
|
+
lines.push(`Tags: ${entry.tags.join(', ')}`);
|
|
31
|
+
lines.push('');
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(entry.labels) && entry.labels.length > 0) {
|
|
34
|
+
const slugs = entry.labels.map((l) => l.slug ?? l.name ?? '').filter(Boolean);
|
|
35
|
+
lines.push(`Labels: ${slugs.map((s) => `\`${s}\``).join(', ')}`);
|
|
36
|
+
lines.push('');
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(entry.relations) && entry.relations.length > 0) {
|
|
39
|
+
lines.push('Relations:');
|
|
40
|
+
for (const r of entry.relations) {
|
|
41
|
+
const arrow = r.direction === 'outgoing' ? '→' : '←';
|
|
42
|
+
const other = r.otherEntryId ? `${r.otherEntryId}: ${r.otherName ?? ''}` : (r.otherName ?? '—');
|
|
43
|
+
lines.push(` ${arrow} ${r.type} ${other}`);
|
|
44
|
+
}
|
|
45
|
+
lines.push('');
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(entry.history) && entry.history.length > 0) {
|
|
48
|
+
const last10 = entry.history.slice(-10);
|
|
49
|
+
lines.push('History (last 10):');
|
|
50
|
+
for (const h of last10) {
|
|
51
|
+
const date = new Date(h.timestamp).toISOString().split('T')[0];
|
|
52
|
+
lines.push(` ${date}: ${h.event}${h.changedBy ? ` (${h.changedBy})` : ''}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/formatters/entry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,SAAS,YAAY,CAAC,IAAa;IACjC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CACjC,MAAM,CAAC,OAAO,CAAC,IAA+B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CACpF,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC;IAChC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,IAAI,GAAG,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,IAAI,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC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YACvB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orient formatter — full ARCH-25 sections for CLI display.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
export interface OrientView {
|
|
6
|
+
stage: string;
|
|
7
|
+
strategicContext: {
|
|
8
|
+
vision: string | null;
|
|
9
|
+
purpose: string | null;
|
|
10
|
+
activeBetCount: number;
|
|
11
|
+
currentBet: string | null;
|
|
12
|
+
activeTensionCount: number;
|
|
13
|
+
productAreas: string[];
|
|
14
|
+
productAreaCount: number;
|
|
15
|
+
};
|
|
16
|
+
activeBets: Array<{
|
|
17
|
+
entryId: string | null;
|
|
18
|
+
name: string;
|
|
19
|
+
collectionSlug: string | null;
|
|
20
|
+
status: string;
|
|
21
|
+
preview?: string;
|
|
22
|
+
linkedTensions?: Array<{
|
|
23
|
+
entryId: string | null;
|
|
24
|
+
name: string;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
governance: {
|
|
28
|
+
principles: Array<{
|
|
29
|
+
entryId: string | null;
|
|
30
|
+
name: string;
|
|
31
|
+
preview?: string;
|
|
32
|
+
}>;
|
|
33
|
+
standards: Array<{
|
|
34
|
+
entryId: string | null;
|
|
35
|
+
name: string;
|
|
36
|
+
preview?: string;
|
|
37
|
+
}>;
|
|
38
|
+
businessRules: Array<{
|
|
39
|
+
entryId: string | null;
|
|
40
|
+
name: string;
|
|
41
|
+
preview?: string;
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
tensions: Array<{
|
|
45
|
+
entryId: string | null;
|
|
46
|
+
name: string;
|
|
47
|
+
}>;
|
|
48
|
+
architectureNotes: Array<{
|
|
49
|
+
entryId: string | null;
|
|
50
|
+
name: string;
|
|
51
|
+
preview?: string;
|
|
52
|
+
}>;
|
|
53
|
+
proposals: Array<{
|
|
54
|
+
targetEntryName: string;
|
|
55
|
+
proposedOperation: string;
|
|
56
|
+
hoursRemaining: number;
|
|
57
|
+
}>;
|
|
58
|
+
absenceSignals: Array<{
|
|
59
|
+
type: string;
|
|
60
|
+
severity: string;
|
|
61
|
+
message: string;
|
|
62
|
+
suggestion?: string;
|
|
63
|
+
}>;
|
|
64
|
+
plannedWork: {
|
|
65
|
+
uncommittedDrafts: Array<{
|
|
66
|
+
name: string;
|
|
67
|
+
collection: string;
|
|
68
|
+
}>;
|
|
69
|
+
inProgressEntries: Array<{
|
|
70
|
+
name: string;
|
|
71
|
+
collection: string;
|
|
72
|
+
entryId: string;
|
|
73
|
+
}>;
|
|
74
|
+
openTensions: Array<{
|
|
75
|
+
name: string;
|
|
76
|
+
entryId: string;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
priorSessions: Array<{
|
|
80
|
+
sessionId: string;
|
|
81
|
+
status: string;
|
|
82
|
+
startedAt: number;
|
|
83
|
+
entriesCreated: string[];
|
|
84
|
+
entriesModified: string[];
|
|
85
|
+
}>;
|
|
86
|
+
recoveryBlock: {
|
|
87
|
+
sessionId: string;
|
|
88
|
+
status: string;
|
|
89
|
+
date: string;
|
|
90
|
+
duration: string;
|
|
91
|
+
draftsNeedingAttention: Array<{
|
|
92
|
+
entryId: string;
|
|
93
|
+
collection: string;
|
|
94
|
+
name: string;
|
|
95
|
+
}>;
|
|
96
|
+
} | null;
|
|
97
|
+
}
|
|
98
|
+
/** Full orient output — all sections per ARCH-25. */
|
|
99
|
+
export declare function formatOrient(view: OrientView): string;
|
|
100
|
+
/** Compact view — stage, counts, top bets, tensions, planned work, recovery. */
|
|
101
|
+
export declare function formatOrientBrief(view: OrientView): string;
|
|
102
|
+
//# sourceMappingURL=orient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient.d.ts","sourceRoot":"","sources":["../../src/formatters/orient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,UAAU,EAAE,KAAK,CAAC;QAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClE,CAAC,CAAC;IACH,UAAU,EAAE;QACV,UAAU,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC9E,SAAS,EAAE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YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC;IACF,aAAa,EAAE,KAAK,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC,CAAC;IACH,aAAa,EAAE;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtF,GAAG,IAAI,CAAC;CACV;AAkBD,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CA0JrD;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CA2C1D"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orient formatter — full ARCH-25 sections for CLI display.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
function section(title, items, indent = 2) {
|
|
6
|
+
if (items.length === 0)
|
|
7
|
+
return [];
|
|
8
|
+
const pad = ' '.repeat(indent);
|
|
9
|
+
return [title, '', ...items.map((i) => `${pad}• ${i}`), ''];
|
|
10
|
+
}
|
|
11
|
+
function formatEntryList(items, max = 5) {
|
|
12
|
+
return items.slice(0, max).map((e) => {
|
|
13
|
+
const id = e.entryId ?? e.name;
|
|
14
|
+
return e.preview ? `${id} — ${e.preview.slice(0, 80)}${e.preview.length > 80 ? '…' : ''}` : id;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** Full orient output — all sections per ARCH-25. */
|
|
18
|
+
export function formatOrient(view) {
|
|
19
|
+
const lines = [];
|
|
20
|
+
// 1. Stage and strategic context
|
|
21
|
+
lines.push(`Stage: ${view.stage}`);
|
|
22
|
+
lines.push('');
|
|
23
|
+
const { strategicContext, activeBets } = view;
|
|
24
|
+
if (strategicContext.vision) {
|
|
25
|
+
lines.push(`Vision: ${strategicContext.vision.slice(0, 200)}${strategicContext.vision.length > 200 ? '…' : ''}`);
|
|
26
|
+
}
|
|
27
|
+
if (strategicContext.purpose) {
|
|
28
|
+
lines.push(`Purpose: ${strategicContext.purpose.slice(0, 200)}${strategicContext.purpose.length > 200 ? '…' : ''}`);
|
|
29
|
+
}
|
|
30
|
+
if (strategicContext.currentBet) {
|
|
31
|
+
lines.push(`Current bet: ${strategicContext.currentBet}`);
|
|
32
|
+
}
|
|
33
|
+
lines.push(`Active bets: ${strategicContext.activeBetCount}`);
|
|
34
|
+
if (strategicContext.activeTensionCount > 0) {
|
|
35
|
+
lines.push(`Active tensions: ${strategicContext.activeTensionCount}`);
|
|
36
|
+
}
|
|
37
|
+
if (strategicContext.productAreaCount > 0) {
|
|
38
|
+
lines.push(`Product areas: ${strategicContext.productAreas.join(', ')}`);
|
|
39
|
+
}
|
|
40
|
+
lines.push('');
|
|
41
|
+
// 2. Active bets
|
|
42
|
+
if (activeBets.length > 0) {
|
|
43
|
+
lines.push('## Active bets');
|
|
44
|
+
lines.push('');
|
|
45
|
+
for (const bet of activeBets.slice(0, 10)) {
|
|
46
|
+
const id = bet.entryId ?? bet.name;
|
|
47
|
+
lines.push(` • ${id} — ${bet.name}`);
|
|
48
|
+
if (bet.linkedTensions && bet.linkedTensions.length > 0) {
|
|
49
|
+
for (const t of bet.linkedTensions.slice(0, 3)) {
|
|
50
|
+
lines.push(` ↳ ${t.name}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
lines.push('');
|
|
55
|
+
}
|
|
56
|
+
// 3. Governance
|
|
57
|
+
const gov = view.governance;
|
|
58
|
+
const hasGov = gov.principles.length > 0 || gov.standards.length > 0 || gov.businessRules.length > 0;
|
|
59
|
+
if (hasGov) {
|
|
60
|
+
lines.push('## Governance');
|
|
61
|
+
lines.push('');
|
|
62
|
+
if (gov.principles.length > 0) {
|
|
63
|
+
lines.push(' Principles:');
|
|
64
|
+
lines.push(...formatEntryList(gov.principles).map((i) => ` • ${i}`));
|
|
65
|
+
}
|
|
66
|
+
if (gov.standards.length > 0) {
|
|
67
|
+
lines.push(' Standards:');
|
|
68
|
+
lines.push(...formatEntryList(gov.standards).map((i) => ` • ${i}`));
|
|
69
|
+
}
|
|
70
|
+
if (gov.businessRules.length > 0) {
|
|
71
|
+
lines.push(' Business rules:');
|
|
72
|
+
lines.push(...formatEntryList(gov.businessRules).map((i) => ` • ${i}`));
|
|
73
|
+
}
|
|
74
|
+
lines.push('');
|
|
75
|
+
}
|
|
76
|
+
// 4. Open tensions
|
|
77
|
+
if (view.tensions.length > 0) {
|
|
78
|
+
lines.push('## Open tensions');
|
|
79
|
+
lines.push('');
|
|
80
|
+
for (const t of view.tensions.slice(0, 5)) {
|
|
81
|
+
lines.push(` • ${t.entryId ?? t.name} — ${t.name}`);
|
|
82
|
+
}
|
|
83
|
+
lines.push('');
|
|
84
|
+
}
|
|
85
|
+
// 5. Architecture notes
|
|
86
|
+
if (view.architectureNotes.length > 0) {
|
|
87
|
+
lines.push('## Architecture notes');
|
|
88
|
+
lines.push('');
|
|
89
|
+
lines.push(...formatEntryList(view.architectureNotes).map((i) => ` • ${i}`));
|
|
90
|
+
lines.push('');
|
|
91
|
+
}
|
|
92
|
+
// 6. Proposals
|
|
93
|
+
if (view.proposals.length > 0) {
|
|
94
|
+
lines.push('## Open proposals');
|
|
95
|
+
lines.push('');
|
|
96
|
+
for (const p of view.proposals.slice(0, 5)) {
|
|
97
|
+
lines.push(` • ${p.targetEntryName} — ${p.proposedOperation} (${p.hoursRemaining}h left)`);
|
|
98
|
+
}
|
|
99
|
+
lines.push('');
|
|
100
|
+
}
|
|
101
|
+
// 7. Absence signals
|
|
102
|
+
if (view.absenceSignals.length > 0) {
|
|
103
|
+
lines.push('## Absence signals');
|
|
104
|
+
lines.push('');
|
|
105
|
+
for (const s of view.absenceSignals.slice(0, 5)) {
|
|
106
|
+
lines.push(` [${s.severity}] ${s.message}`);
|
|
107
|
+
if (s.suggestion)
|
|
108
|
+
lines.push(` → ${s.suggestion}`);
|
|
109
|
+
}
|
|
110
|
+
lines.push('');
|
|
111
|
+
}
|
|
112
|
+
// 8. Planned work
|
|
113
|
+
const pw = view.plannedWork;
|
|
114
|
+
const hasPlanned = pw.uncommittedDrafts.length > 0 ||
|
|
115
|
+
pw.inProgressEntries.length > 0 ||
|
|
116
|
+
pw.openTensions.length > 0;
|
|
117
|
+
if (hasPlanned) {
|
|
118
|
+
lines.push('## Planned work');
|
|
119
|
+
lines.push('');
|
|
120
|
+
if (pw.uncommittedDrafts.length > 0) {
|
|
121
|
+
lines.push(' Uncommitted drafts:');
|
|
122
|
+
for (const d of pw.uncommittedDrafts.slice(0, 3)) {
|
|
123
|
+
lines.push(` • ${d.name} [${d.collection}]`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (pw.inProgressEntries.length > 0) {
|
|
127
|
+
lines.push(' In progress:');
|
|
128
|
+
for (const e of pw.inProgressEntries.slice(0, 3)) {
|
|
129
|
+
lines.push(` • ${e.name} [${e.collection}]`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (pw.openTensions.length > 0) {
|
|
133
|
+
lines.push(' Open tensions:');
|
|
134
|
+
for (const t of pw.openTensions.slice(0, 3)) {
|
|
135
|
+
lines.push(` • ${t.name}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
lines.push('');
|
|
139
|
+
}
|
|
140
|
+
// 9. Prior sessions / recovery
|
|
141
|
+
if (view.recoveryBlock) {
|
|
142
|
+
lines.push('## Previous session recovery');
|
|
143
|
+
lines.push('');
|
|
144
|
+
const rb = view.recoveryBlock;
|
|
145
|
+
lines.push(` ${rb.date} — ${rb.duration} (${rb.status})`);
|
|
146
|
+
if (rb.draftsNeedingAttention.length > 0) {
|
|
147
|
+
lines.push(' Drafts needing attention:');
|
|
148
|
+
for (const d of rb.draftsNeedingAttention.slice(0, 5)) {
|
|
149
|
+
lines.push(` • ${d.entryId} [${d.collection}] ${d.name}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
lines.push('');
|
|
153
|
+
}
|
|
154
|
+
else if (view.priorSessions.length > 0) {
|
|
155
|
+
lines.push('## Prior sessions');
|
|
156
|
+
lines.push('');
|
|
157
|
+
const last = view.priorSessions[0];
|
|
158
|
+
lines.push(` Last: ${last.sessionId} — ${last.status} (${last.entriesCreated.length} created, ${last.entriesModified.length} modified)`);
|
|
159
|
+
lines.push('');
|
|
160
|
+
}
|
|
161
|
+
return lines.join('\n').trimEnd();
|
|
162
|
+
}
|
|
163
|
+
/** Compact view — stage, counts, top bets, tensions, planned work, recovery. */
|
|
164
|
+
export function formatOrientBrief(view) {
|
|
165
|
+
const lines = [];
|
|
166
|
+
lines.push(`${view.stage} | ${view.strategicContext.activeBetCount} bets | ${view.strategicContext.activeTensionCount} tensions`);
|
|
167
|
+
if (view.strategicContext.currentBet) {
|
|
168
|
+
lines.push(`Current: ${view.strategicContext.currentBet}`);
|
|
169
|
+
}
|
|
170
|
+
if (view.activeBets.length > 0) {
|
|
171
|
+
lines.push('');
|
|
172
|
+
lines.push('Bets:');
|
|
173
|
+
for (const bet of view.activeBets.slice(0, 5)) {
|
|
174
|
+
lines.push(` • ${bet.entryId ?? bet.name} ${bet.name}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (view.tensions.length > 0) {
|
|
178
|
+
lines.push('');
|
|
179
|
+
lines.push('Open tensions:');
|
|
180
|
+
for (const t of view.tensions.slice(0, 3)) {
|
|
181
|
+
lines.push(` • ${t.name}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const pw = view.plannedWork;
|
|
185
|
+
const hasPlanned = pw.uncommittedDrafts.length > 0 ||
|
|
186
|
+
pw.inProgressEntries.length > 0 ||
|
|
187
|
+
pw.openTensions.length > 0;
|
|
188
|
+
if (hasPlanned) {
|
|
189
|
+
lines.push('');
|
|
190
|
+
lines.push('Planned:');
|
|
191
|
+
if (pw.uncommittedDrafts.length > 0)
|
|
192
|
+
lines.push(` ${pw.uncommittedDrafts.length} draft(s)`);
|
|
193
|
+
if (pw.inProgressEntries.length > 0)
|
|
194
|
+
lines.push(` ${pw.inProgressEntries.length} in progress`);
|
|
195
|
+
if (pw.openTensions.length > 0)
|
|
196
|
+
lines.push(` ${pw.openTensions.length} open tension(s)`);
|
|
197
|
+
}
|
|
198
|
+
if (view.recoveryBlock) {
|
|
199
|
+
lines.push('');
|
|
200
|
+
lines.push('⚠ Recovery: ' + view.recoveryBlock.draftsNeedingAttention.length + ' draft(s) need attention');
|
|
201
|
+
}
|
|
202
|
+
return lines.join('\n');
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=orient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient.js","sourceRoot":"","sources":["../../src/formatters/orient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4DH,SAAS,OAAO,CAAC,KAAa,EAAE,KAAe,EAAE,MAAM,GAAG,CAAC;IACzD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,eAAe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AAE,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAC/B,EAAE,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAC/B,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvB,IAAI,EAAE,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,iBAAiB,CAAC,MAAM,WAAW,CAAC,CAAC;QAC7F,IAAI,EAAE,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,iBAAiB,CAAC,MAAM,cAAc,CAAC,CAAC;QAChG,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,MAAM,kBAAkB,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAC;IAC7G,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search formatter — scannable terminal output for chain.searchEntries results.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
export interface SearchResult {
|
|
6
|
+
entryId?: string | null;
|
|
7
|
+
name: string;
|
|
8
|
+
collectionSlug?: string | null;
|
|
9
|
+
status?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function formatSearchResults(results: SearchResult[]): string;
|
|
12
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/formatters/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAYnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search formatter — scannable terminal output for chain.searchEntries results.
|
|
3
|
+
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
|
+
*/
|
|
5
|
+
export function formatSearchResults(results) {
|
|
6
|
+
if (results.length === 0) {
|
|
7
|
+
return 'No results found.';
|
|
8
|
+
}
|
|
9
|
+
const lines = [];
|
|
10
|
+
for (const r of results) {
|
|
11
|
+
const id = r.entryId ?? r.name;
|
|
12
|
+
const coll = r.collectionSlug ?? '—';
|
|
13
|
+
lines.push(` ${id} [${coll}] ${r.name}`);
|
|
14
|
+
}
|
|
15
|
+
return lines.join('\n');
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/formatters/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC;QAC/B,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,IAAI,GAAG,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Product Brain CLI — read-only Chain knowledge in the terminal.
|
|
4
|
+
* BET-108 Slice 0: pb orient
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { runContext } from './commands/context.js';
|
|
8
|
+
import { runGet } from './commands/get.js';
|
|
9
|
+
import { runOrient } from './commands/orient.js';
|
|
10
|
+
import { runSearch } from './commands/search.js';
|
|
11
|
+
const program = new Command();
|
|
12
|
+
program
|
|
13
|
+
.name('pb')
|
|
14
|
+
.description('Product Brain — read-only CLI for Chain knowledge')
|
|
15
|
+
.version('0.1.0');
|
|
16
|
+
program
|
|
17
|
+
.command('get <entry-id>')
|
|
18
|
+
.description('Display full entry by ID (data, relations, last 10 history events)')
|
|
19
|
+
.action(async (entryId) => {
|
|
20
|
+
if (!entryId?.trim()) {
|
|
21
|
+
program.commands.find((c) => c.name() === 'get')?.help();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
await runGet({ entryId: entryId.trim() });
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
program
|
|
33
|
+
.command('context <entry-id>')
|
|
34
|
+
.description('Gather and display constellation context (pipe-friendly markdown when stdout is not a TTY)')
|
|
35
|
+
.action(async (entryId) => {
|
|
36
|
+
if (!entryId?.trim()) {
|
|
37
|
+
program.commands.find((c) => c.name() === 'context')?.help();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await runContext({ entryId: entryId.trim() });
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
program
|
|
49
|
+
.command('search [query...]')
|
|
50
|
+
.description('Full-text search across all collections')
|
|
51
|
+
.action(async (queryParts = []) => {
|
|
52
|
+
const query = queryParts?.join(' ').trim();
|
|
53
|
+
if (!query) {
|
|
54
|
+
program.commands.find((c) => c.name() === 'search')?.help();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
await runSearch({ query });
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
program
|
|
66
|
+
.command('orient')
|
|
67
|
+
.description('Print workspace stage and all orient sections (strategic context, bets, governance, tensions, etc.)')
|
|
68
|
+
.option('-b, --brief', 'Compact view: stage, counts, top bets, tensions, planned work')
|
|
69
|
+
.action(async (opts) => {
|
|
70
|
+
try {
|
|
71
|
+
await runOrient({ brief: opts.brief });
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
program.parse();
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,IAAI,CAAC;KACV,WAAW,CAAC,mDAAmD,CAAC;KAChE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,oEAAoE,CAAC;KACjF,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;IAChC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;QACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;QACzD,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;Q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bearer auth.
|
|
3
|
+
*/
|
|
4
|
+
import { getConfig } from './config.js';
|
|
5
|
+
export async function mcpCall(fn, args = {}) {
|
|
6
|
+
const { apiKey, siteUrl } = getConfig();
|
|
7
|
+
const res = await fetch(`${siteUrl}/api/mcp`, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
Authorization: `Bearer ${apiKey}`,
|
|
12
|
+
},
|
|
13
|
+
body: JSON.stringify({ fn, args }),
|
|
14
|
+
});
|
|
15
|
+
const json = (await res.json());
|
|
16
|
+
if (!res.ok || json.error) {
|
|
17
|
+
throw new Error(json.error ?? res.statusText);
|
|
18
|
+
}
|
|
19
|
+
return json.data;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,EAAU,EACV,OAAgC,EAAE;IAElC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC;IAExC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,UAAU,EAAE;QAC5C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,EAAE;SAClC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;KACnC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiC,CAAC;IAChE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC,IAAS,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,wBAAgB,SAAS,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAiB/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI config — reads PRODUCTBRAIN_API_KEY + CONVEX_SITE_URL from env / .env.mcp.
|
|
3
|
+
* Mirrors scripts/test-orient.mjs pattern.
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync, existsSync } from 'fs';
|
|
6
|
+
import { resolve } from 'path';
|
|
7
|
+
const ENV_PATHS = ['.env.mcp', 'packages/mcp-server/.env.mcp', '.env'];
|
|
8
|
+
function loadEnv() {
|
|
9
|
+
for (const p of ENV_PATHS) {
|
|
10
|
+
const full = resolve(process.cwd(), p);
|
|
11
|
+
if (existsSync(full)) {
|
|
12
|
+
const content = readFileSync(full, 'utf8');
|
|
13
|
+
for (const line of content.split('\n')) {
|
|
14
|
+
const m = line.match(/^([^#=]+)=(.*)$/);
|
|
15
|
+
if (m && !process.env[m[1].trim()]) {
|
|
16
|
+
process.env[m[1].trim()] = m[2].trim().replace(/^["']|["']$/g, '');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
loadEnv();
|
|
24
|
+
const DEFAULT_SITE_URL = 'https://trustworthy-kangaroo-277.convex.site';
|
|
25
|
+
export function getConfig() {
|
|
26
|
+
const apiKey = process.env.PRODUCTBRAIN_API_KEY ?? '';
|
|
27
|
+
const siteUrl = (process.env.CONVEX_SITE_URL ?? DEFAULT_SITE_URL).replace(/\/$/, '');
|
|
28
|
+
if (!apiKey || !apiKey.startsWith('pb_sk_')) {
|
|
29
|
+
throw new Error('Missing PRODUCTBRAIN_API_KEY (pb_sk_*) — set it or add to .env.mcp');
|
|
30
|
+
}
|
|
31
|
+
if (!siteUrl.startsWith('https://')) {
|
|
32
|
+
throw new Error(`CONVEX_SITE_URL must use HTTPS (got "${siteUrl.slice(0, 30)}…"). API keys must not be sent over unencrypted connections.`);
|
|
33
|
+
}
|
|
34
|
+
return { apiKey, siteUrl };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,8BAA8B,EAAE,MAAM,CAAC,CAAC;AAEvE,SAAS,OAAO;IACd,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC3C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;oBACnC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;gBACrE,CAAC;YACH,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,OAAO,EAAE,CAAC;AAEV,MAAM,gBAAgB,GAAG,8CAA8C,CAAC;AAExE,MAAM,UAAU,SAAS;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC;IACtD,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAErF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,wCAAwC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,8DAA8D,CAC3H,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@productbrain/cli",
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
|
+
"description": "Product Brain — read-only CLI for Chain knowledge",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"pb": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "tsc --watch",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"lint": "tsc --noEmit",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"publish:beta": "npm publish --tag=beta",
|
|
19
|
+
"version:prerelease": "npm version prerelease --no-git-tag-version"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"commander": "^12.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^25.3.0",
|
|
26
|
+
"typescript": "^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|