@cleocode/cleo-os 2026.4.35 → 2026.4.37
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/cli.d.ts +15 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +41 -14
- package/dist/cli.js.map +1 -1
- package/extensions/cleo-cant-bridge.d.ts +10 -0
- package/extensions/cleo-cant-bridge.d.ts.map +1 -1
- package/extensions/cleo-cant-bridge.js +73 -5
- package/extensions/cleo-cant-bridge.js.map +1 -1
- package/extensions/cleo-cant-bridge.ts +90 -5
- package/extensions/cleo-hooks-bridge.d.ts +44 -0
- package/extensions/cleo-hooks-bridge.d.ts.map +1 -0
- package/extensions/cleo-hooks-bridge.js +197 -0
- package/extensions/cleo-hooks-bridge.js.map +1 -0
- package/extensions/cleo-hooks-bridge.ts +272 -0
- package/extensions/cleo-startup.d.ts +228 -0
- package/extensions/cleo-startup.d.ts.map +1 -0
- package/extensions/cleo-startup.js +728 -0
- package/extensions/cleo-startup.js.map +1 -0
- package/extensions/cleo-startup.ts +1019 -0
- package/package.json +3 -6
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CleoOS branded startup extension.
|
|
3
|
+
*
|
|
4
|
+
* CANONICAL LOCATION: `packages/cleo-os/extensions/cleo-startup.ts`
|
|
5
|
+
*
|
|
6
|
+
* Installed to: $XDG_DATA_HOME/cleo/extensions/cleo-startup.js
|
|
7
|
+
* Loaded by: Pi via `--extension <path>` injected by CleoOS cli.ts
|
|
8
|
+
*
|
|
9
|
+
* On `session_start`, displays a branded CleoOS welcome panel with:
|
|
10
|
+
* - ASCII art CLEO logo
|
|
11
|
+
* - Project name and CLEO task summary (pending / active / done)
|
|
12
|
+
* - Last 3 brain decisions ("what we decided recently")
|
|
13
|
+
* - Memory bridge summary (total entries, % verified, top 3 cited)
|
|
14
|
+
* - Quick action hints based on current state
|
|
15
|
+
* - Current focused task (if any)
|
|
16
|
+
* - Last session handoff note from the memory bridge
|
|
17
|
+
*
|
|
18
|
+
* Also registers:
|
|
19
|
+
* - `/cleo:status` — on-demand project status refresh
|
|
20
|
+
* - `/cleo:focus <task-id>` — focus on a task
|
|
21
|
+
* - `/cleo:end-session [note]` — end the current session
|
|
22
|
+
*
|
|
23
|
+
* All data is fetched via the `cleo` CLI (best-effort). If any call
|
|
24
|
+
* fails, the banner degrades gracefully — Pi is never crashed.
|
|
25
|
+
*
|
|
26
|
+
* Design system:
|
|
27
|
+
* - accentPrimary (purple #a855f7) — banner chrome, icons
|
|
28
|
+
* - accentSuccess (green #22c55e) — active counts
|
|
29
|
+
* - accentWarning (amber #f59e0b) — pending counts, handoff note
|
|
30
|
+
* - textSecondary (gray #94a3b8) — body text, labels
|
|
31
|
+
* - bold — headings, task title
|
|
32
|
+
* - Box-drawing constants from tui-theme for Forge aesthetic
|
|
33
|
+
*
|
|
34
|
+
* Guardrails:
|
|
35
|
+
* - Best-effort: all CLEO CLI calls wrapped in try/catch
|
|
36
|
+
* - NO top-level await; all work inside event handlers
|
|
37
|
+
* - NEVER modify system prompt (startup display only)
|
|
38
|
+
* - NEVER crash Pi
|
|
39
|
+
*
|
|
40
|
+
* @packageDocumentation
|
|
41
|
+
*/
|
|
42
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
43
|
+
/**
|
|
44
|
+
* Task summary counts parsed from `cleo dash --json`.
|
|
45
|
+
*/
|
|
46
|
+
interface TaskSummary {
|
|
47
|
+
/** Number of active (in-progress) tasks. */
|
|
48
|
+
active: number;
|
|
49
|
+
/** Number of pending tasks. */
|
|
50
|
+
pending: number;
|
|
51
|
+
/** Number of completed tasks. */
|
|
52
|
+
done: number;
|
|
53
|
+
/** Total task count. */
|
|
54
|
+
total: number;
|
|
55
|
+
/** Number of blocked tasks. */
|
|
56
|
+
blocked: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Current session data parsed from `cleo session status --json`.
|
|
60
|
+
*/
|
|
61
|
+
interface SessionInfo {
|
|
62
|
+
/** Whether a session is currently active. */
|
|
63
|
+
active: boolean;
|
|
64
|
+
/** Session ID (short form). */
|
|
65
|
+
id: string;
|
|
66
|
+
/** Session display name. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** ID of the focused task, or null. */
|
|
69
|
+
currentTaskId: string | null;
|
|
70
|
+
/** Handoff note from the previous session end, or null. */
|
|
71
|
+
handoffNote: string | null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Current task info parsed from `cleo current --json`.
|
|
75
|
+
*/
|
|
76
|
+
interface CurrentTask {
|
|
77
|
+
/** Task ID. */
|
|
78
|
+
id: string;
|
|
79
|
+
/** Task title. */
|
|
80
|
+
title: string;
|
|
81
|
+
/** Task status. */
|
|
82
|
+
status: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A single decision entry from `cleo memory decision-find --json`.
|
|
86
|
+
*/
|
|
87
|
+
interface DecisionEntry {
|
|
88
|
+
/** Short decision ID. */
|
|
89
|
+
id: string;
|
|
90
|
+
/** Decision title or summary text. */
|
|
91
|
+
title: string;
|
|
92
|
+
/** ISO date string. */
|
|
93
|
+
date: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Memory bridge statistics parsed from `.cleo/memory-bridge.md`.
|
|
97
|
+
*/
|
|
98
|
+
interface MemoryBridgeStats {
|
|
99
|
+
/** Total entry count found in memory bridge sections. */
|
|
100
|
+
totalEntries: number;
|
|
101
|
+
/** Top 3 cited items (label lines from the bridge). */
|
|
102
|
+
topThree: string[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Quick-action hints built from task/session state.
|
|
106
|
+
*/
|
|
107
|
+
interface QuickHints {
|
|
108
|
+
/** Array of short hint strings to display. */
|
|
109
|
+
hints: string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Parse task summary from `cleo dash --json` output.
|
|
113
|
+
*
|
|
114
|
+
* @param stdout - Raw stdout from the CLI call.
|
|
115
|
+
* @returns Parsed task summary, defaulting all counts to 0 on failure.
|
|
116
|
+
*/
|
|
117
|
+
export declare function parseDashSummary(stdout: string): TaskSummary;
|
|
118
|
+
/**
|
|
119
|
+
* Parse session info from `cleo session status --json` output.
|
|
120
|
+
*
|
|
121
|
+
* Extracts active state, session ID/name, current task, and the last
|
|
122
|
+
* handoff note left at session end.
|
|
123
|
+
*
|
|
124
|
+
* @param stdout - Raw stdout from the CLI call.
|
|
125
|
+
* @returns Parsed session info.
|
|
126
|
+
*/
|
|
127
|
+
export declare function parseSessionInfo(stdout: string): SessionInfo;
|
|
128
|
+
/**
|
|
129
|
+
* Parse current task info from `cleo current --json` output.
|
|
130
|
+
*
|
|
131
|
+
* @param stdout - Raw stdout from the CLI call.
|
|
132
|
+
* @returns Parsed current task, or null if none active.
|
|
133
|
+
*/
|
|
134
|
+
export declare function parseCurrentTask(stdout: string): CurrentTask | null;
|
|
135
|
+
/**
|
|
136
|
+
* Parse the last 3 decisions from `cleo memory decision-find --json` output.
|
|
137
|
+
*
|
|
138
|
+
* @param stdout - Raw stdout from the CLI call.
|
|
139
|
+
* @returns Array of up to 3 decision entries.
|
|
140
|
+
*/
|
|
141
|
+
export declare function parseRecentDecisions(stdout: string): DecisionEntry[];
|
|
142
|
+
/**
|
|
143
|
+
* Parse memory bridge statistics from `.cleo/memory-bridge.md`.
|
|
144
|
+
*
|
|
145
|
+
* Counts total list items across all sections and extracts the
|
|
146
|
+
* top 3 cited items (items appearing in the "Recent Decisions" or
|
|
147
|
+
* "Key Learnings" sections).
|
|
148
|
+
*
|
|
149
|
+
* @param content - Raw memory-bridge.md content.
|
|
150
|
+
* @returns Memory bridge statistics.
|
|
151
|
+
*/
|
|
152
|
+
export declare function parseMemoryBridgeStats(content: string): MemoryBridgeStats;
|
|
153
|
+
/**
|
|
154
|
+
* Build quick-action hints based on current project state.
|
|
155
|
+
*
|
|
156
|
+
* Generates context-sensitive suggestions so the operator knows
|
|
157
|
+
* immediately what to do next without running extra commands.
|
|
158
|
+
*
|
|
159
|
+
* @param tasks - Task summary counts.
|
|
160
|
+
* @param session - Current session state.
|
|
161
|
+
* @param currentTask - Currently focused task, or null.
|
|
162
|
+
* @returns Quick-action hints.
|
|
163
|
+
*/
|
|
164
|
+
export declare function buildQuickHints(tasks: TaskSummary, session: SessionInfo, currentTask: CurrentTask | null): QuickHints;
|
|
165
|
+
/**
|
|
166
|
+
* Read the last session handoff note from `.cleo/memory-bridge.md`.
|
|
167
|
+
*
|
|
168
|
+
* Falls back to null if the file does not exist or parsing fails.
|
|
169
|
+
* Prefers the `## Last Session` section's `Note:` line.
|
|
170
|
+
*
|
|
171
|
+
* @param projectDir - The project root directory.
|
|
172
|
+
* @returns The last session note, or null.
|
|
173
|
+
*/
|
|
174
|
+
export declare function readMemoryBridgeNote(projectDir: string): string | null;
|
|
175
|
+
/**
|
|
176
|
+
* Build the full CleoOS startup banner.
|
|
177
|
+
*
|
|
178
|
+
* Renders a box-drawing widget with:
|
|
179
|
+
* - ASCII art CLEO logo
|
|
180
|
+
* - Branded header with forge icon
|
|
181
|
+
* - Task counts (active / pending / done / blocked)
|
|
182
|
+
* - Last 3 brain decisions
|
|
183
|
+
* - Memory bridge summary
|
|
184
|
+
* - Quick action hints
|
|
185
|
+
* - Current task title (if any)
|
|
186
|
+
* - Session info (name + ID)
|
|
187
|
+
* - Last session handoff note (from memory-bridge.md or session data)
|
|
188
|
+
*
|
|
189
|
+
* @param tasks - Task summary counts.
|
|
190
|
+
* @param session - Current session state.
|
|
191
|
+
* @param currentTask - Currently focused task, or null.
|
|
192
|
+
* @param handoffNote - Last session handoff note, or null.
|
|
193
|
+
* @param projectName - Project display name.
|
|
194
|
+
* @param decisions - Recent brain decisions (up to 3).
|
|
195
|
+
* @param memStats - Memory bridge statistics.
|
|
196
|
+
* @param hints - Quick-action hints.
|
|
197
|
+
* @returns Array of ANSI-styled banner lines.
|
|
198
|
+
*/
|
|
199
|
+
export declare function buildStartupBanner(tasks: TaskSummary, session: SessionInfo, currentTask: CurrentTask | null, handoffNote: string | null, projectName: string, decisions?: DecisionEntry[], memStats?: MemoryBridgeStats, hints?: QuickHints): string[];
|
|
200
|
+
/**
|
|
201
|
+
* Detect the project name for display in the startup banner.
|
|
202
|
+
*
|
|
203
|
+
* Resolution order:
|
|
204
|
+
* 1. `name` field from `.cleo/project-info.json`
|
|
205
|
+
* 2. `name` field from `package.json` in `projectDir`
|
|
206
|
+
* 3. Last path segment of `projectDir`
|
|
207
|
+
*
|
|
208
|
+
* @param projectDir - The project root directory.
|
|
209
|
+
* @returns The resolved project display name.
|
|
210
|
+
*/
|
|
211
|
+
export declare function detectProjectName(projectDir: string): string;
|
|
212
|
+
/**
|
|
213
|
+
* Pi extension factory for the CleoOS branded startup experience.
|
|
214
|
+
*
|
|
215
|
+
* Registers:
|
|
216
|
+
* - `session_start` — fetches all data, renders the branded startup banner
|
|
217
|
+
* - `/cleo:status` — on-demand project status refresh
|
|
218
|
+
* - `/cleo:focus <task-id>` — focus on a task from inside Pi
|
|
219
|
+
* - `/cleo:end-session [note]` — end the current session from inside Pi
|
|
220
|
+
*
|
|
221
|
+
* All operations are best-effort — failures are silently swallowed so Pi
|
|
222
|
+
* is never blocked by CLEO unavailability.
|
|
223
|
+
*
|
|
224
|
+
* @param pi - The Pi extension API instance.
|
|
225
|
+
*/
|
|
226
|
+
export default function (pi: ExtensionAPI): void;
|
|
227
|
+
export {};
|
|
228
|
+
//# sourceMappingURL=cleo-startup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleo-startup.d.ts","sourceRoot":"","sources":["cleo-startup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAMH,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,+BAA+B,CAAC;AA2BvC;;GAEG;AACH,UAAU,WAAW;IACnB,4CAA4C;IAC5C,MAAM,EAAE,MAA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