@scrylog/cli 0.3.0 → 0.3.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.
Files changed (195) hide show
  1. package/dist/assets/highlights-eq9cgrbb.scm +604 -0
  2. package/dist/assets/highlights-ghv9g403.scm +205 -0
  3. package/dist/assets/highlights-hk7bwhj4.scm +284 -0
  4. package/dist/assets/highlights-r812a2qc.scm +150 -0
  5. package/dist/assets/highlights-x6tmsnaa.scm +115 -0
  6. package/dist/assets/injections-73j83es3.scm +27 -0
  7. package/dist/assets/parser.worker-xyhf83rf.js +4563 -0
  8. package/dist/assets/tree-sitter-3jzf13jk.wasm +0 -0
  9. package/dist/assets/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  10. package/dist/assets/tree-sitter-markdown-411r6y9b.wasm +0 -0
  11. package/dist/assets/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  12. package/dist/assets/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  13. package/dist/assets/tree-sitter-zig-e78zbjpm.wasm +0 -0
  14. package/dist/cli/index.js +499 -0
  15. package/dist/cli/index.js.map +61 -0
  16. package/dist/daemon/index.js +670 -0
  17. package/dist/daemon/index.js.map +1475 -0
  18. package/dist/hooks/claude.js +6 -0
  19. package/dist/hooks/claude.js.map +11 -0
  20. package/dist/hooks/codex.js +10 -0
  21. package/dist/hooks/codex.js.map +11 -0
  22. package/dist/mcp/index.js +100 -0
  23. package/dist/mcp/index.js.map +231 -0
  24. package/dist/oc/index.js +21 -0
  25. package/dist/oc/index.js.map +10 -0
  26. package/package.json +16 -13
  27. package/src/api/docs/sessions.keys.ts +0 -6
  28. package/src/api/docs/sessions.ts +0 -82
  29. package/src/api/docs/system.keys.ts +0 -5
  30. package/src/api/docs/system.ts +0 -69
  31. package/src/api/docs/usage.keys.ts +0 -3
  32. package/src/api/docs/usage.ts +0 -24
  33. package/src/api/docs/webhooks.keys.ts +0 -5
  34. package/src/api/docs/webhooks.ts +0 -78
  35. package/src/api/index.ts +0 -18
  36. package/src/api/lib/auth.ts +0 -43
  37. package/src/api/lib/errors.ts +0 -28
  38. package/src/api/lib/route.ts +0 -18
  39. package/src/api/models/claude.ts +0 -4
  40. package/src/api/models/codex.ts +0 -4
  41. package/src/api/models/opencode.ts +0 -11
  42. package/src/api/routes/sessions.ts +0 -51
  43. package/src/api/routes/system.ts +0 -106
  44. package/src/api/routes/usage.ts +0 -15
  45. package/src/api/routes/webhooks/claude.ts +0 -149
  46. package/src/api/routes/webhooks/codex.ts +0 -175
  47. package/src/api/routes/webhooks/opencode.ts +0 -112
  48. package/src/api/routes.ts +0 -93
  49. package/src/api/schemas/common.ts +0 -29
  50. package/src/api/schemas/sessions.ts +0 -86
  51. package/src/api/schemas/usage.ts +0 -51
  52. package/src/api/schemas/webhooks/claude.ts +0 -32
  53. package/src/api/schemas/webhooks/codex.ts +0 -34
  54. package/src/api/schemas/webhooks/opencode.ts +0 -29
  55. package/src/api/services/claude-session.ts +0 -9
  56. package/src/api/services/codex-session.ts +0 -8
  57. package/src/api/services/opencode-session.ts +0 -73
  58. package/src/classifier.ts +0 -206
  59. package/src/cli/commands.ts +0 -714
  60. package/src/cli/index.ts +0 -18
  61. package/src/cli/program.ts +0 -175
  62. package/src/cli/prompt.ts +0 -44
  63. package/src/daemon/cli.ts +0 -27
  64. package/src/daemon/collectors/claude/README.md +0 -108
  65. package/src/daemon/collectors/claude/collector.ts +0 -423
  66. package/src/daemon/collectors/claude/discovery.ts +0 -127
  67. package/src/daemon/collectors/claude/hooks.ts +0 -181
  68. package/src/daemon/collectors/claude/index.ts +0 -8
  69. package/src/daemon/collectors/claude/jsonl.ts +0 -85
  70. package/src/daemon/collectors/claude/transcript.ts +0 -246
  71. package/src/daemon/collectors/codex/README.md +0 -147
  72. package/src/daemon/collectors/codex/collector.ts +0 -661
  73. package/src/daemon/collectors/codex/discovery.ts +0 -104
  74. package/src/daemon/collectors/codex/hooks.ts +0 -179
  75. package/src/daemon/collectors/codex/index.ts +0 -7
  76. package/src/daemon/collectors/codex/jsonl.ts +0 -108
  77. package/src/daemon/collectors/codex/transcript.ts +0 -299
  78. package/src/daemon/collectors/git.ts +0 -353
  79. package/src/daemon/collectors/herdr/collector.ts +0 -128
  80. package/src/daemon/collectors/herdr/index.ts +0 -2
  81. package/src/daemon/collectors/herdr/normalization.ts +0 -111
  82. package/src/daemon/collectors/opencode/README.md +0 -106
  83. package/src/daemon/collectors/opencode/collector.ts +0 -545
  84. package/src/daemon/collectors/opencode/discovery.ts +0 -257
  85. package/src/daemon/collectors/opencode/index.ts +0 -5
  86. package/src/daemon/collectors/opencode/session-builder.ts +0 -59
  87. package/src/daemon/collectors/opencode-db.ts +0 -294
  88. package/src/daemon/collectors/process.ts +0 -201
  89. package/src/daemon/collectors/tmux/README.md +0 -128
  90. package/src/daemon/collectors/tmux/collector.ts +0 -492
  91. package/src/daemon/collectors/tmux/enrichment.ts +0 -242
  92. package/src/daemon/collectors/tmux/index.ts +0 -4
  93. package/src/daemon/collectors/tmux/parse.ts +0 -128
  94. package/src/daemon/collectors/usage.ts +0 -259
  95. package/src/daemon/index.ts +0 -209
  96. package/src/daemon/scheduler.ts +0 -86
  97. package/src/daemon/store.ts +0 -630
  98. package/src/detect.ts +0 -143
  99. package/src/hooks/claude.ts +0 -596
  100. package/src/hooks/codex.ts +0 -517
  101. package/src/legacy/classifier.ts +0 -215
  102. package/src/legacy/detect.ts +0 -143
  103. package/src/mcp/client-server.ts +0 -21
  104. package/src/mcp/http-handler.ts +0 -126
  105. package/src/mcp/index.ts +0 -61
  106. package/src/mcp/resources/config-current.ts +0 -19
  107. package/src/mcp/resources/index.ts +0 -11
  108. package/src/mcp/resources/sessions-active.ts +0 -19
  109. package/src/mcp/resources/sessions-all.ts +0 -19
  110. package/src/mcp/schemas/sessions.ts +0 -3
  111. package/src/mcp/server.ts +0 -17
  112. package/src/mcp/services/api-adapter.ts +0 -48
  113. package/src/mcp/services/data-source.ts +0 -22
  114. package/src/mcp/services/store-adapter.ts +0 -40
  115. package/src/mcp/tools/get-active-sessions.ts +0 -16
  116. package/src/mcp/tools/get-session-children.ts +0 -24
  117. package/src/mcp/tools/get-session-messages.ts +0 -24
  118. package/src/mcp/tools/get-session.ts +0 -23
  119. package/src/mcp/tools/index.ts +0 -15
  120. package/src/mcp/tools/list-sessions.ts +0 -16
  121. package/src/oc/index.ts +0 -302
  122. package/src/service/manager.ts +0 -284
  123. package/src/shared/config.ts +0 -511
  124. package/src/shared/ipc.ts +0 -80
  125. package/src/shared/logger.ts +0 -248
  126. package/src/shared/paths.ts +0 -73
  127. package/src/shared/platform.ts +0 -110
  128. package/src/shared/session-exclusions.ts +0 -5
  129. package/src/shared/session-view.ts +0 -302
  130. package/src/shared/terminal-capabilities.ts +0 -130
  131. package/src/shared/types.ts +0 -330
  132. package/src/shared/utils.ts +0 -339
  133. package/src/shared/version.ts +0 -44
  134. package/src/tui/App.tsx +0 -240
  135. package/src/tui/client.ts +0 -163
  136. package/src/tui/components/BindingsModal.tsx +0 -82
  137. package/src/tui/components/DashboardHeader.tsx +0 -256
  138. package/src/tui/components/KeyBar.tsx +0 -67
  139. package/src/tui/components/SessionDetailModal.tsx +0 -169
  140. package/src/tui/components/SessionsView.tsx +0 -184
  141. package/src/tui/components/TabBar.tsx +0 -40
  142. package/src/tui/components/UsageSummaryPane.tsx +0 -272
  143. package/src/tui/components/UsageView.tsx +0 -242
  144. package/src/tui/components/tool-icons.ts +0 -24
  145. package/src/tui/index.tsx +0 -106
  146. package/src/tui/keybindings.ts +0 -49
  147. package/src/tui/model.ts +0 -295
  148. package/src/tui/state.ts +0 -77
  149. package/src/tui/theme.ts +0 -110
  150. package/src/types.ts +0 -113
  151. package/src/usage/README.md +0 -323
  152. package/src/usage/api.ts +0 -99
  153. package/src/usage/client.ts +0 -3
  154. package/src/usage/clients/anthropic-oauth-usage.ts +0 -258
  155. package/src/usage/clients/anthropic-web-usage.ts +0 -329
  156. package/src/usage/clients/claude-cli-probe.ts +0 -513
  157. package/src/usage/clients/codex-app-server.ts +0 -354
  158. package/src/usage/clients/codex-oauth-usage.ts +0 -240
  159. package/src/usage/clients/opencode-go-api.ts +0 -100
  160. package/src/usage/clients/opencode-go-usage.ts +0 -577
  161. package/src/usage/errors.ts +0 -33
  162. package/src/usage/index.ts +0 -20
  163. package/src/usage/local/opencode-go-local.ts +0 -194
  164. package/src/usage/mappers.ts +0 -282
  165. package/src/usage/planner.ts +0 -118
  166. package/src/usage/providers/claude.ts +0 -233
  167. package/src/usage/providers/codex.ts +0 -115
  168. package/src/usage/providers/opencode-go.ts +0 -115
  169. package/src/usage/resolver.ts +0 -4
  170. package/src/usage/resolvers/browser-cookies.ts +0 -808
  171. package/src/usage/resolvers/claude-auth.ts +0 -208
  172. package/src/usage/resolvers/claude-cli.ts +0 -24
  173. package/src/usage/resolvers/claude-desktop-auth.ts +0 -170
  174. package/src/usage/resolvers/claude-web.ts +0 -82
  175. package/src/usage/resolvers/codex-auth.ts +0 -174
  176. package/src/usage/resolvers/keychain-coordinator.ts +0 -397
  177. package/src/usage/resolvers/opencode-go-web.ts +0 -55
  178. package/src/usage/types.ts +0 -225
  179. package/src/usage/web-session-cache.ts +0 -37
  180. /package/{src/tui → dist/cli}/assets/providers/SOURCES.md +0 -0
  181. /package/{src/tui → dist/cli}/assets/providers/claude-terminal.png +0 -0
  182. /package/{src/tui → dist/cli}/assets/providers/claude-terminal.svg +0 -0
  183. /package/{src/tui → dist/cli}/assets/providers/claude.png +0 -0
  184. /package/{src/tui → dist/cli}/assets/providers/copilot.png +0 -0
  185. /package/{src/tui → dist/cli}/assets/providers/copilot.svg +0 -0
  186. /package/{src/tui → dist/cli}/assets/providers/openai-terminal.png +0 -0
  187. /package/{src/tui → dist/cli}/assets/providers/openai-terminal.svg +0 -0
  188. /package/{src/tui → dist/cli}/assets/providers/openai.png +0 -0
  189. /package/{src/tui → dist/cli}/assets/providers/opencode-terminal.png +0 -0
  190. /package/{src/tui → dist/cli}/assets/providers/opencode-terminal.svg +0 -0
  191. /package/{src/tui → dist/cli}/assets/providers/opencode.png +0 -0
  192. /package/{src/tui → dist/cli}/assets/providers/shell.png +0 -0
  193. /package/{src/tui → dist/cli}/assets/providers/shell.svg +0 -0
  194. /package/{src/tui → dist/cli}/assets/providers/unknown.png +0 -0
  195. /package/{src/tui → dist/cli}/assets/providers/unknown.svg +0 -0
@@ -1,284 +0,0 @@
1
- import { existsSync, rmSync, writeFileSync } from "node:fs";
2
- import { homedir } from "node:os";
3
- import { dirname, isAbsolute, join } from "node:path";
4
- import { getResolvedConfigPath } from "../shared/config";
5
- import {
6
- ensureParentDir,
7
- getLaunchAgentPath,
8
- getServiceLabel,
9
- getSystemdUnitName,
10
- getSystemdUnitPath,
11
- getUserUid,
12
- } from "../shared/paths";
13
- import { IS_LINUX, IS_MAC, IS_WSL, whichCommand } from "../shared/platform";
14
- import { maybeRunCommand } from "../shared/utils";
15
-
16
- export interface ServiceStatus {
17
- platform: "macos" | "linux" | "wsl" | "unsupported" | "linux-no-systemd";
18
- installed: boolean;
19
- running: boolean;
20
- detail: string;
21
- }
22
-
23
- export interface ServiceManager {
24
- readonly platform: ServiceStatus["platform"];
25
- install(configPath?: string): void;
26
- uninstall(): void;
27
- start(): void;
28
- stop(): void;
29
- restart(): void;
30
- status(): ServiceStatus;
31
- }
32
-
33
- export function getServiceManagerOrThrow(): ServiceManager {
34
- if (IS_MAC) return new LaunchdServiceManager();
35
- if (IS_LINUX) {
36
- if (!hasSystemd()) {
37
- const reason = IS_WSL
38
- ? "WSL detected without systemd. Enable systemd in /etc/wsl.conf to use service management."
39
- : "No running systemd user session detected. Service management requires systemd --user.";
40
- return new UnsupportedServiceManager(IS_WSL ? "wsl" : "linux-no-systemd", reason);
41
- }
42
- return new SystemdUserServiceManager();
43
- }
44
- return new UnsupportedServiceManager("unsupported", "Daemon service management is only supported on macOS and Linux. On Windows, run scrylogd manually or use Task Scheduler.");
45
- }
46
-
47
- function hasSystemd(): boolean {
48
- const result = maybeRunCommand(["systemctl", "--user", "is-system-running"]);
49
- return result.ok && result.output.trim() === "running";
50
- }
51
-
52
- function daemonScriptPath(): string {
53
- return join(import.meta.dir, "../daemon/index.ts");
54
- }
55
-
56
- export function resolveDaemonExec(configPath?: string, daemonPath = whichCommand("scrylogd")): string[] {
57
- const resolvedConfigPath = getResolvedConfigPath(configPath);
58
- if (daemonPath) {
59
- return [daemonPath, "--config", resolvedConfigPath];
60
- }
61
- return [process.execPath, "run", daemonScriptPath(), "--config", resolvedConfigPath];
62
- }
63
-
64
- export function renderLaunchAgentPlist(configPath?: string): string {
65
- const args = resolveDaemonExec(configPath);
66
- const programArguments = args.map((arg) => ` <string>${xmlEscape(arg)}</string>`).join("\n");
67
- const path = resolveServicePath(args);
68
- return `<?xml version="1.0" encoding="UTF-8"?>
69
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
70
- <plist version="1.0">
71
- <dict>
72
- <key>Label</key>
73
- <string>${getServiceLabel()}</string>
74
- <key>ProgramArguments</key>
75
- <array>
76
- ${programArguments}
77
- </array>
78
- <key>EnvironmentVariables</key>
79
- <dict>
80
- <key>PATH</key>
81
- <string>${xmlEscape(path)}</string>
82
- </dict>
83
- <key>RunAtLoad</key>
84
- <true/>
85
- <key>KeepAlive</key>
86
- <true/>
87
- </dict>
88
- </plist>
89
- `;
90
- }
91
-
92
- export function renderSystemdUserUnit(configPath?: string): string {
93
- const args = resolveDaemonExec(configPath);
94
- const path = resolveServicePath(args);
95
- return `[Unit]
96
- Description=scrylog daemon
97
- After=default.target
98
-
99
- [Service]
100
- Environment="PATH=${path}"
101
- ExecStart=${args.map(shellQuote).join(" ")}
102
- Restart=on-failure
103
- RestartSec=3
104
-
105
- [Install]
106
- WantedBy=default.target
107
- `;
108
- }
109
-
110
- function run(command: string[], allowFailure = false): string {
111
- const proc = Bun.spawnSync(command, { stdout: "pipe", stderr: "pipe" });
112
- const stdout = Buffer.from(proc.stdout).toString("utf8").trim();
113
- const stderr = Buffer.from(proc.stderr).toString("utf8").trim();
114
- if (proc.exitCode !== 0 && !allowFailure) {
115
- throw new Error(stderr || stdout || `Command failed: ${command.join(" ")}`);
116
- }
117
- return stdout || stderr;
118
- }
119
-
120
- class LaunchdServiceManager implements ServiceManager {
121
- readonly platform = "macos" as const;
122
-
123
- install(configPath?: string): void {
124
- const filePath = getLaunchAgentPath();
125
- ensureParentDir(filePath);
126
- writeFileSync(filePath, renderLaunchAgentPlist(configPath), "utf8");
127
- this.stop();
128
- run(["launchctl", "bootstrap", `gui/${getUserUid()}`, filePath], true);
129
- this.start();
130
- }
131
-
132
- uninstall(): void {
133
- this.stop();
134
- const filePath = getLaunchAgentPath();
135
- if (existsSync(filePath)) {
136
- rmSync(filePath, { force: true });
137
- }
138
- }
139
-
140
- start(): void {
141
- const filePath = getLaunchAgentPath();
142
- if (!existsSync(filePath)) {
143
- throw new Error("LaunchAgent is not installed");
144
- }
145
- run(["launchctl", "bootstrap", `gui/${getUserUid()}`, filePath], true);
146
- run(["launchctl", "kickstart", "-k", `gui/${getUserUid()}/${getServiceLabel()}`], true);
147
- }
148
-
149
- stop(): void {
150
- const filePath = getLaunchAgentPath();
151
- run(["launchctl", "bootout", `gui/${getUserUid()}`, filePath], true);
152
- run(["launchctl", "bootout", `gui/${getUserUid()}/${getServiceLabel()}`], true);
153
- }
154
-
155
- restart(): void {
156
- this.stop();
157
- this.start();
158
- }
159
-
160
- status(): ServiceStatus {
161
- const installed = existsSync(getLaunchAgentPath());
162
- const detail = run(["launchctl", "print", `gui/${getUserUid()}/${getServiceLabel()}`], true);
163
- const running = /state = running/i.test(detail) || /pid = \d+/i.test(detail);
164
- return { platform: this.platform, installed, running, detail: detail || "No launchd job loaded" };
165
- }
166
- }
167
-
168
- class SystemdUserServiceManager implements ServiceManager {
169
- readonly platform = "linux" as const;
170
-
171
- install(configPath?: string): void {
172
- const filePath = getSystemdUnitPath();
173
- ensureParentDir(filePath);
174
- writeFileSync(filePath, renderSystemdUserUnit(configPath), "utf8");
175
- run(["systemctl", "--user", "daemon-reload"]);
176
- run(["systemctl", "--user", "enable", "--now", getSystemdUnitName()]);
177
- }
178
-
179
- uninstall(): void {
180
- run(["systemctl", "--user", "disable", "--now", getSystemdUnitName()], true);
181
- const filePath = getSystemdUnitPath();
182
- if (existsSync(filePath)) {
183
- rmSync(filePath, { force: true });
184
- }
185
- run(["systemctl", "--user", "daemon-reload"], true);
186
- }
187
-
188
- start(): void {
189
- run(["systemctl", "--user", "start", getSystemdUnitName()]);
190
- }
191
-
192
- stop(): void {
193
- run(["systemctl", "--user", "stop", getSystemdUnitName()], true);
194
- }
195
-
196
- restart(): void {
197
- run(["systemctl", "--user", "restart", getSystemdUnitName()]);
198
- }
199
-
200
- status(): ServiceStatus {
201
- const installed = existsSync(getSystemdUnitPath()) && run(["systemctl", "--user", "is-enabled", getSystemdUnitName()], true).includes("enabled");
202
- const active = run(["systemctl", "--user", "is-active", getSystemdUnitName()], true);
203
- const detail = run(["systemctl", "--user", "status", getSystemdUnitName(), "--no-pager"], true);
204
- return {
205
- platform: this.platform,
206
- installed,
207
- // `is-active` returns "inactive" for a missing/stopped unit, which contains the
208
- // substring "active" — only an exact match means the unit is actually running.
209
- running: active.trim() === "active",
210
- detail: detail || active || "Unit not loaded",
211
- };
212
- }
213
- }
214
-
215
- class UnsupportedServiceManager implements ServiceManager {
216
- readonly platform: ServiceStatus["platform"];
217
- private readonly detail: string;
218
-
219
- constructor(platform: "wsl" | "unsupported" | "linux-no-systemd", detail: string) {
220
- this.platform = platform;
221
- this.detail = detail;
222
- }
223
-
224
- install(): void {
225
- throw new Error(this.detail);
226
- }
227
-
228
- uninstall(): void {
229
- // Nothing to uninstall on unsupported platforms.
230
- }
231
-
232
- start(): void {
233
- throw new Error(this.detail);
234
- }
235
-
236
- stop(): void {
237
- // Nothing to stop.
238
- }
239
-
240
- restart(): void {
241
- throw new Error(this.detail);
242
- }
243
-
244
- status(): ServiceStatus {
245
- return { platform: this.platform, installed: false, running: false, detail: this.detail };
246
- }
247
- }
248
-
249
- function shellQuote(value: string): string {
250
- return `'${value.replace(/'/g, `'"'"'`)}'`;
251
- }
252
-
253
- function resolveServicePath(args: string[]): string {
254
- const commandPath = args[0];
255
- const candidates = [
256
- commandPath && isAbsolute(commandPath) ? dirname(commandPath) : undefined,
257
- isAbsolute(process.execPath) ? dirname(process.execPath) : undefined,
258
- process.env.PATH,
259
- join(homedir(), ".bun", "bin"),
260
- "/opt/homebrew/bin",
261
- "/usr/local/bin",
262
- "/usr/bin",
263
- "/bin",
264
- "/usr/sbin",
265
- "/sbin",
266
- ];
267
-
268
- const paths = new Set<string>();
269
- for (const candidate of candidates) {
270
- for (const part of candidate?.split(":") ?? []) {
271
- if (part) paths.add(part);
272
- }
273
- }
274
- return Array.from(paths).join(":");
275
- }
276
-
277
- function xmlEscape(value: string): string {
278
- return value
279
- .replace(/&/g, "&amp;")
280
- .replace(/</g, "&lt;")
281
- .replace(/>/g, "&gt;")
282
- .replace(/"/g, "&quot;")
283
- .replace(/'/g, "&apos;");
284
- }