@phren/cli 0.1.42 → 0.1.45

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.
Files changed (97) hide show
  1. package/dist/capabilities/cli.js +1 -1
  2. package/dist/capabilities/mcp.js +1 -1
  3. package/dist/capabilities/vscode.js +3 -3
  4. package/dist/capabilities/web-ui.js +29 -29
  5. package/dist/cli/actions.d.ts +1 -1
  6. package/dist/cli/actions.js +7 -2
  7. package/dist/cli/config-proactivity.d.ts +6 -6
  8. package/dist/cli/hooks-output.js +15 -6
  9. package/dist/cli/hooks.d.ts +1 -1
  10. package/dist/cli/hooks.js +16 -5
  11. package/dist/cli/session-stop.d.ts +1 -1
  12. package/dist/cli/session-tool-hook.d.ts +1 -1
  13. package/dist/cli-registry.js +1 -1
  14. package/dist/data/access.js +2 -1
  15. package/dist/generated/memory-ui-graph.browser.js +481 -318
  16. package/dist/governance/locks.js +6 -0
  17. package/dist/governance/scores.d.ts +9 -1
  18. package/dist/governance/scores.js +12 -1
  19. package/dist/graph-core/index.d.ts +2 -0
  20. package/dist/graph-core/index.js +2 -0
  21. package/dist/graph-core/model.d.ts +84 -0
  22. package/dist/graph-core/model.js +355 -0
  23. package/dist/graph-core/types.d.ts +110 -0
  24. package/dist/graph-core/types.js +43 -0
  25. package/dist/index.js +4 -1
  26. package/dist/init/init-uninstall.d.ts +1 -0
  27. package/dist/init/init-uninstall.js +13 -3
  28. package/dist/init/setup.js +11 -4
  29. package/dist/link/context.js +2 -1
  30. package/dist/link/link.js +3 -2
  31. package/dist/link/skills.js +2 -1
  32. package/dist/memory-ui-graph.runtime.js +481 -318
  33. package/dist/phren-core.d.ts +16 -0
  34. package/dist/phren-core.js +21 -0
  35. package/dist/phren-paths.js +8 -4
  36. package/dist/profile-store.d.ts +2 -0
  37. package/dist/profile-store.js +16 -19
  38. package/dist/project-config.js +2 -1
  39. package/dist/shared/fragment-graph.js +7 -2
  40. package/dist/shared/index.js +1 -1
  41. package/dist/shared/retrieval.d.ts +38 -0
  42. package/dist/shared/retrieval.js +62 -4
  43. package/dist/shell/entry.d.ts +10 -2
  44. package/dist/shell/entry.js +128 -97
  45. package/dist/shell/graph/canvas.d.ts +64 -0
  46. package/dist/shell/graph/canvas.js +256 -0
  47. package/dist/shell/graph/controller.d.ts +164 -0
  48. package/dist/shell/graph/controller.js +645 -0
  49. package/dist/shell/graph/glyphs.d.ts +12 -0
  50. package/dist/shell/graph/glyphs.js +31 -0
  51. package/dist/shell/graph/graph-view.d.ts +12 -0
  52. package/dist/shell/graph/graph-view.js +408 -0
  53. package/dist/shell/graph/layout.d.ts +68 -0
  54. package/dist/shell/graph/layout.js +267 -0
  55. package/dist/shell/input.d.ts +4 -1
  56. package/dist/shell/input.js +28 -5
  57. package/dist/shell/intro.d.ts +37 -0
  58. package/dist/shell/intro.js +82 -0
  59. package/dist/shell/keys.d.ts +36 -0
  60. package/dist/shell/keys.js +107 -0
  61. package/dist/shell/logo-fx.d.ts +35 -0
  62. package/dist/shell/logo-fx.js +128 -0
  63. package/dist/shell/render.d.ts +34 -1
  64. package/dist/shell/render.js +220 -66
  65. package/dist/shell/shell.d.ts +13 -1
  66. package/dist/shell/shell.js +61 -10
  67. package/dist/shell/startup.d.ts +37 -0
  68. package/dist/shell/startup.js +105 -0
  69. package/dist/shell/state-store.d.ts +1 -1
  70. package/dist/shell/state-store.js +1 -1
  71. package/dist/shell/types.js +1 -0
  72. package/dist/shell/view.d.ts +3 -0
  73. package/dist/shell/view.js +26 -4
  74. package/dist/store-registry.d.ts +13 -0
  75. package/dist/store-registry.js +109 -37
  76. package/dist/test-global-setup.d.ts +1 -0
  77. package/dist/test-global-setup.js +22 -0
  78. package/dist/tool-registry.js +1 -0
  79. package/dist/tools/memory.js +12 -5
  80. package/dist/tools/ops.js +1 -1
  81. package/dist/ui/data.d.ts +15 -7
  82. package/dist/ui/data.js +102 -3
  83. package/dist/utils-fts.js +2 -1
  84. package/dist/utils-helpers.d.ts +1 -0
  85. package/dist/utils-helpers.js +6 -0
  86. package/dist/utils.d.ts +1 -1
  87. package/dist/utils.js +1 -1
  88. package/package.json +38 -7
  89. package/starter/global/skills/phren-consolidate/SKILL.md +152 -0
  90. package/starter/global/skills/phren-discover/SKILL.md +175 -0
  91. package/starter/global/skills/phren-init/SKILL.md +216 -0
  92. package/starter/global/skills/phren-profiles/SKILL.md +121 -0
  93. package/starter/global/skills/phren-sync/SKILL.md +261 -0
  94. package/dist/init-uninstall.d.ts +0 -3
  95. package/dist/init-uninstall.js +0 -514
  96. package/dist/init-walkthrough.d.ts +0 -55
  97. package/dist/init-walkthrough.js +0 -524
@@ -0,0 +1,164 @@
1
+ /**
2
+ * State + interaction for the terminal graph view.
3
+ *
4
+ * The controller is the terminal-side analogue of the browser's
5
+ * `browser/graph/state.ts` + `interactions.ts`: it owns the payload built by
6
+ * `buildGraph`, the normalized model from `graph-core`, the force layout, a 2D
7
+ * camera, selection/search/focus, and the key map. Rendering lives in
8
+ * `graph-view.ts`; this module never writes to the terminal.
9
+ */
10
+ import type { GraphFilters, GraphModel, VisibleData } from "../../graph-core/model.js";
11
+ import type { GraphPayload, NodeDetail, NodeKind, RuntimeNode } from "../../graph-core/types.js";
12
+ import { type Point } from "./layout.js";
13
+ /** Nodes drawn at once. Terminals have far fewer pixels than a browser tab. */
14
+ export declare const TUI_NODE_LIMIT = 350;
15
+ export type GraphStatus = "idle" | "loading" | "ready" | "empty" | "error";
16
+ export interface FilterPreset {
17
+ name: string;
18
+ types: Partial<Record<NodeKind, boolean>>;
19
+ health: string;
20
+ }
21
+ export declare const FILTER_PRESETS: FilterPreset[];
22
+ export interface Camera {
23
+ /** World coordinates at the centre of the viewport. */
24
+ cx: number;
25
+ cy: number;
26
+ /** Braille dots per world unit. */
27
+ scale: number;
28
+ }
29
+ export interface SearchState {
30
+ query: string;
31
+ matchIds: Set<string>;
32
+ results: RuntimeNode[];
33
+ /** Cursor into results; -1 when nothing is active. */
34
+ index: number;
35
+ }
36
+ /** What the controller needs from the shell when a key lands. */
37
+ export interface GraphKeyHost {
38
+ setMessage(msg: string): void;
39
+ startInput(ctx: string, initial: string): void;
40
+ }
41
+ /** Injected so tests can feed a fixture instead of scanning a store. */
42
+ export type GraphBuilder = (phrenPath: string, profile: string) => Promise<GraphPayload>;
43
+ export interface GraphControllerOptions {
44
+ builder?: GraphBuilder;
45
+ tokenOf?: (phrenPath: string) => string;
46
+ /** Animation frame period; the tests shrink it. */
47
+ frameMs?: number;
48
+ }
49
+ declare const DIRECTIONS: Record<string, Point>;
50
+ export declare class GraphController {
51
+ readonly phrenPath: string;
52
+ readonly profile: string;
53
+ status: GraphStatus;
54
+ errorText: string;
55
+ /** A rebuild is running while the previous picture stays on screen. */
56
+ get refreshing(): boolean;
57
+ payload: GraphPayload | null;
58
+ model: GraphModel;
59
+ filters: GraphFilters;
60
+ visible: VisibleData;
61
+ /** Project nodes in display order for `[`/`]`. */
62
+ projects: RuntimeNode[];
63
+ presetIndex: number;
64
+ selectedId: string | null;
65
+ search: SearchState;
66
+ camera: Camera;
67
+ private sim;
68
+ private lastPositions;
69
+ private viewport;
70
+ private dataToken;
71
+ private building;
72
+ private repaintHook;
73
+ private timer;
74
+ private cameraTarget;
75
+ /** Re-frame once the intro settle finishes so the whole map is in view. */
76
+ private fitOnSettle;
77
+ /** Set by pan/zoom; until then a resize re-fits the whole map. */
78
+ private userMoved;
79
+ private readonly builder;
80
+ private readonly tokenOf;
81
+ private readonly frameMs;
82
+ constructor(phrenPath: string, profile: string, opts?: GraphControllerOptions);
83
+ /**
84
+ * Let the shell trigger a repaint on its own (settle animation, fly-to,
85
+ * a build finishing). Without it the controller blocks the first render on
86
+ * the build and snaps every camera move.
87
+ */
88
+ setRepaintHook(hook: (() => void) | null): void;
89
+ get positions(): Map<string, Point>;
90
+ private lastToken;
91
+ private lastTokenAt;
92
+ /** The store token, re-read at most every 2s: animation repaints must not stat the whole store. */
93
+ private currentToken;
94
+ /**
95
+ * Make sure a payload matching the store is loaded, or on its way. Blocks
96
+ * only on the very first build when there is no repaint hook to come back
97
+ * through; otherwise the old picture stays up with a refreshing badge.
98
+ */
99
+ ensureData(): Promise<void>;
100
+ private build;
101
+ /** Load a payload directly (tests, or a host that already has one). */
102
+ adopt(payload: GraphPayload): void;
103
+ get preset(): FilterPreset;
104
+ get focusedProject(): string | null;
105
+ private applyFilters;
106
+ private rebuildLayout;
107
+ /**
108
+ * The view reports its canvas size (in dots) before projecting. The first
109
+ * fit happens before any frame is drawn, so a size change re-fits unless
110
+ * the user has taken the camera over.
111
+ */
112
+ setViewport(width: number, height: number): void;
113
+ get viewportSize(): {
114
+ width: number;
115
+ height: number;
116
+ };
117
+ /** World → dot coordinates for the current camera. */
118
+ project(p: Point): Point;
119
+ fitAll(): void;
120
+ zoom(factor: number): void;
121
+ pan(direction: keyof typeof DIRECTIONS): void;
122
+ /** Centre the camera on a node, eased when animation is available. */
123
+ flyTo(nodeId: string): void;
124
+ /** Fly only when the node sits outside the middle band of the viewport. */
125
+ private keepInView;
126
+ relayout(): void;
127
+ private startAnimation;
128
+ stopAnimation(): void;
129
+ get animating(): boolean;
130
+ private animationFrame;
131
+ /** Called by the shell when the view changes away or the shell closes. */
132
+ dispose(): void;
133
+ detail(nodeId: string): NodeDetail | null;
134
+ /** Visible neighbours of a node, best first — what the pane numbers 1-9. */
135
+ neighborsOf(nodeId: string): RuntimeNode[];
136
+ select(nodeId: string | null, opts?: {
137
+ fly?: boolean;
138
+ }): void;
139
+ private nearestToCenter;
140
+ /**
141
+ * Arrow-key traversal: prefer a connected neighbour in that direction; if
142
+ * there is none, take the nearest visible node in that half-plane so the
143
+ * walk never dead-ends on a leaf.
144
+ */
145
+ walk(direction: keyof typeof DIRECTIONS): RuntimeNode | null;
146
+ private refreshSearch;
147
+ /** Set the query, light up matches, and fly to the best one. */
148
+ applySearch(query: string): RuntimeNode | null;
149
+ clearSearch(): void;
150
+ stepSearch(delta: number): RuntimeNode | null;
151
+ cyclePreset(delta?: number): FilterPreset;
152
+ /** Focus one project (name) or all (null). */
153
+ focusProject(name: string | null): void;
154
+ cycleProject(delta: number): string | null;
155
+ jumpToNeighbor(n: number): RuntimeNode | null;
156
+ /**
157
+ * Returns true when the key was consumed, undefined to let the shell's
158
+ * generic handler have it (q, :, ?, view shortcuts, final Esc).
159
+ */
160
+ handleKey(rawKey: string, host: GraphKeyHost): true | undefined;
161
+ /** One-line description for the message bar. */
162
+ describe(node: RuntimeNode): string;
163
+ }
164
+ export {};