@phren/cli 0.2.13 → 0.2.15

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.
@@ -78,7 +78,16 @@ export async function servers() {
78
78
  }
79
79
  export async function snapshot(server) { return object((await rpc(server, "session.snapshot")).snapshot); }
80
80
  export function workspaceSnapshot(s) {
81
- return { kind: "herdr", groups: objects(s.workspaces).map(w => ({ id: w.workspace_id, label: w.label,
81
+ const focusedPane = objects(s.panes).find(p => p.pane_id === s.focused_pane_id
82
+ && p.tab_id === s.focused_tab_id && p.workspace_id === s.focused_workspace_id);
83
+ const focus = focusedPane && id.safeParse(s.focused_workspace_id).success
84
+ && id.safeParse(s.focused_tab_id).success && id.safeParse(s.focused_pane_id).success
85
+ && objects(s.tabs).some(t => t.tab_id === s.focused_tab_id && t.workspace_id === s.focused_workspace_id)
86
+ && objects(s.workspaces).some(w => w.workspace_id === s.focused_workspace_id)
87
+ ? { workspaceID: s.focused_workspace_id, tabID: s.focused_tab_id, paneID: s.focused_pane_id } : undefined;
88
+ // Focus identifies a pane to inspect. Its conversation is still resolved and
89
+ // validated independently through panes(), never inferred from a directory.
90
+ return { kind: "herdr", focus, groups: objects(s.workspaces).map(w => ({ id: w.workspace_id, label: w.label,
82
91
  children: objects(s.tabs).filter(t => t.workspace_id === w.workspace_id).map(t => {
83
92
  const panes = objects(s.panes).filter(p => p.tab_id === t.tab_id);
84
93
  const agent = panes.find(p => p.agent);
@@ -18579,7 +18579,9 @@ async function snapshot(server) {
18579
18579
  return object2((await rpc(server, "session.snapshot")).snapshot);
18580
18580
  }
18581
18581
  function workspaceSnapshot(s) {
18582
- return { kind: "herdr", groups: objects(s.workspaces).map((w) => ({
18582
+ const focusedPane = objects(s.panes).find((p) => p.pane_id === s.focused_pane_id && p.tab_id === s.focused_tab_id && p.workspace_id === s.focused_workspace_id);
18583
+ const focus = focusedPane && id.safeParse(s.focused_workspace_id).success && id.safeParse(s.focused_tab_id).success && id.safeParse(s.focused_pane_id).success && objects(s.tabs).some((t) => t.tab_id === s.focused_tab_id && t.workspace_id === s.focused_workspace_id) && objects(s.workspaces).some((w) => w.workspace_id === s.focused_workspace_id) ? { workspaceID: s.focused_workspace_id, tabID: s.focused_tab_id, paneID: s.focused_pane_id } : void 0;
18584
+ return { kind: "herdr", focus, groups: objects(s.workspaces).map((w) => ({
18583
18585
  id: w.workspace_id,
18584
18586
  label: w.label,
18585
18587
  children: objects(s.tabs).filter((t) => t.workspace_id === w.workspace_id).map((t) => {
@@ -22682,7 +22684,7 @@ async function runBridge(args, version2) {
22682
22684
  }
22683
22685
 
22684
22686
  // src/bridge/hook-main.ts
22685
- runBridge(process.argv.slice(2), "0.2.13").then((code) => {
22687
+ runBridge(process.argv.slice(2), "0.2.15").then((code) => {
22686
22688
  process.exitCode = code;
22687
22689
  }).catch((error51) => {
22688
22690
  console.error(error51 instanceof Error ? error51.message : "Phren Hook failed.");
@@ -430,7 +430,7 @@ export function addTask(phrenPath, project, item, opts) {
430
430
  line,
431
431
  checked: false,
432
432
  priority: normalizePriority(line),
433
- createdAt: opts?.createdAt,
433
+ createdAt: opts?.createdAt ?? new Date().toISOString(),
434
434
  sessionId: opts?.sessionId,
435
435
  scope: opts?.scope,
436
436
  parentFinding: opts?.parentFinding,
@@ -468,6 +468,7 @@ export function addTasks(phrenPath, project, items, opts) {
468
468
  checked: false,
469
469
  priority: normalizePriority(line),
470
470
  scope: opts?.scope,
471
+ createdAt: new Date().toISOString(),
471
472
  });
472
473
  added.push(line);
473
474
  }
@@ -27,6 +27,8 @@ export declare function withFallbackColors(style?: {
27
27
  }): WalkthroughStyle;
28
28
  export declare function createWalkthroughStyle(): Promise<WalkthroughStyle>;
29
29
  export declare function createWalkthroughPrompts(): Promise<WalkthroughPromptUi>;
30
+ /** Adapts an Inquirer module, or returns null when it offers neither API. */
31
+ export declare function walkthroughPromptsFrom(inquirerModule: unknown): WalkthroughPromptUi | null;
30
32
  export interface WalkthroughResult {
31
33
  storageChoice: StorageLocationChoice;
32
34
  storagePath: string;
@@ -37,7 +37,18 @@ export async function createWalkthroughStyle() {
37
37
  }
38
38
  export async function createWalkthroughPrompts() {
39
39
  try {
40
- const inquirerModule = await import(String("inquirer"));
40
+ const ui = walkthroughPromptsFrom(await import(String("inquirer")));
41
+ if (ui)
42
+ return ui;
43
+ }
44
+ catch {
45
+ // fallback below
46
+ }
47
+ return readlineWalkthroughPrompts();
48
+ }
49
+ /** Adapts an Inquirer module, or returns null when it offers neither API. */
50
+ export function walkthroughPromptsFrom(inquirerModule) {
51
+ {
41
52
  const maybeFns = inquirerModule;
42
53
  if (typeof maybeFns.input === "function"
43
54
  && typeof maybeFns.confirm === "function"
@@ -65,7 +76,7 @@ export async function createWalkthroughPrompts() {
65
76
  },
66
77
  select: async (message, choices, defaultValue) => {
67
78
  const answer = await prompt([{
68
- type: "list",
79
+ type: "select",
69
80
  name: "value",
70
81
  message,
71
82
  choices: choices.map((choice) => ({ value: choice.value, name: choice.name })),
@@ -76,9 +87,9 @@ export async function createWalkthroughPrompts() {
76
87
  };
77
88
  }
78
89
  }
79
- catch {
80
- // fallback below
81
- }
90
+ return null;
91
+ }
92
+ async function readlineWalkthroughPrompts() {
82
93
  const readline = await import("readline");
83
94
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
84
95
  const ask = (message) => new Promise((resolve) => rl.question(message, resolve));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {