@scrylog/cli 0.2.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.
- package/README.md +46 -7
- package/dist/assets/highlights-eq9cgrbb.scm +604 -0
- package/dist/assets/highlights-ghv9g403.scm +205 -0
- package/dist/assets/highlights-hk7bwhj4.scm +284 -0
- package/dist/assets/highlights-r812a2qc.scm +150 -0
- package/dist/assets/highlights-x6tmsnaa.scm +115 -0
- package/dist/assets/injections-73j83es3.scm +27 -0
- package/dist/assets/parser.worker-xyhf83rf.js +4563 -0
- package/dist/assets/tree-sitter-3jzf13jk.wasm +0 -0
- package/dist/assets/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/dist/assets/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/dist/assets/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/dist/assets/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/dist/assets/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/dist/cli/assets/providers/SOURCES.md +21 -0
- package/dist/cli/assets/providers/claude-terminal.png +0 -0
- package/dist/cli/assets/providers/claude-terminal.svg +62 -0
- package/dist/cli/assets/providers/claude.png +0 -0
- package/dist/cli/assets/providers/copilot.png +0 -0
- package/dist/cli/assets/providers/copilot.svg +44 -0
- package/dist/cli/assets/providers/openai-terminal.png +0 -0
- package/dist/cli/assets/providers/openai-terminal.svg +62 -0
- package/dist/cli/assets/providers/openai.png +0 -0
- package/dist/cli/assets/providers/opencode-terminal.png +0 -0
- package/dist/cli/assets/providers/opencode-terminal.svg +62 -0
- package/dist/cli/assets/providers/opencode.png +0 -0
- package/dist/cli/assets/providers/shell.png +0 -0
- package/dist/cli/assets/providers/shell.svg +23 -0
- package/dist/cli/assets/providers/unknown.png +0 -0
- package/dist/cli/assets/providers/unknown.svg +23 -0
- package/dist/cli/index.js +499 -0
- package/dist/cli/index.js.map +61 -0
- package/dist/daemon/index.js +670 -0
- package/dist/daemon/index.js.map +1475 -0
- package/dist/hooks/claude.js +6 -0
- package/dist/hooks/claude.js.map +11 -0
- package/dist/hooks/codex.js +10 -0
- package/dist/hooks/codex.js.map +11 -0
- package/dist/mcp/index.js +100 -0
- package/dist/mcp/index.js.map +231 -0
- package/dist/oc/index.js +21 -0
- package/dist/oc/index.js.map +10 -0
- package/package.json +26 -20
- package/src/postinstall.cjs +11 -0
- package/src/api/docs/sessions.keys.ts +0 -6
- package/src/api/docs/sessions.ts +0 -81
- package/src/api/docs/system.keys.ts +0 -5
- package/src/api/docs/system.ts +0 -66
- package/src/api/docs/usage.keys.ts +0 -3
- package/src/api/docs/usage.ts +0 -24
- package/src/api/docs/webhooks.keys.ts +0 -5
- package/src/api/docs/webhooks.ts +0 -78
- package/src/api/index.ts +0 -18
- package/src/api/lib/auth.ts +0 -43
- package/src/api/lib/errors.ts +0 -28
- package/src/api/lib/route.ts +0 -18
- package/src/api/models/claude.ts +0 -4
- package/src/api/models/codex.ts +0 -4
- package/src/api/models/opencode.ts +0 -11
- package/src/api/routes/sessions.ts +0 -47
- package/src/api/routes/system.ts +0 -103
- package/src/api/routes/usage.ts +0 -15
- package/src/api/routes/webhooks/claude.ts +0 -141
- package/src/api/routes/webhooks/codex.ts +0 -175
- package/src/api/routes/webhooks/opencode.ts +0 -111
- package/src/api/routes.ts +0 -93
- package/src/api/schemas/common.ts +0 -21
- package/src/api/schemas/sessions.ts +0 -72
- package/src/api/schemas/usage.ts +0 -50
- package/src/api/schemas/webhooks/claude.ts +0 -32
- package/src/api/schemas/webhooks/codex.ts +0 -34
- package/src/api/schemas/webhooks/opencode.ts +0 -29
- package/src/api/services/claude-session.ts +0 -9
- package/src/api/services/codex-session.ts +0 -8
- package/src/api/services/opencode-session.ts +0 -73
- package/src/classifier.ts +0 -206
- package/src/cli/commands.ts +0 -632
- package/src/cli/prompt.ts +0 -44
- package/src/daemon/cli.ts +0 -27
- package/src/daemon/collectors/claude/README.md +0 -108
- package/src/daemon/collectors/claude/collector.ts +0 -423
- package/src/daemon/collectors/claude/discovery.ts +0 -148
- package/src/daemon/collectors/claude/hooks.ts +0 -181
- package/src/daemon/collectors/claude/index.ts +0 -8
- package/src/daemon/collectors/claude/jsonl.ts +0 -85
- package/src/daemon/collectors/claude/transcript.ts +0 -246
- package/src/daemon/collectors/codex/README.md +0 -147
- package/src/daemon/collectors/codex/collector.ts +0 -661
- package/src/daemon/collectors/codex/discovery.ts +0 -104
- package/src/daemon/collectors/codex/hooks.ts +0 -179
- package/src/daemon/collectors/codex/index.ts +0 -7
- package/src/daemon/collectors/codex/jsonl.ts +0 -108
- package/src/daemon/collectors/codex/transcript.ts +0 -299
- package/src/daemon/collectors/git.ts +0 -295
- package/src/daemon/collectors/opencode/README.md +0 -106
- package/src/daemon/collectors/opencode/collector.ts +0 -545
- package/src/daemon/collectors/opencode/discovery.ts +0 -257
- package/src/daemon/collectors/opencode/index.ts +0 -5
- package/src/daemon/collectors/opencode/session-builder.ts +0 -59
- package/src/daemon/collectors/opencode-db.ts +0 -282
- package/src/daemon/collectors/process.ts +0 -201
- package/src/daemon/collectors/tmux/README.md +0 -128
- package/src/daemon/collectors/tmux/collector.ts +0 -472
- package/src/daemon/collectors/tmux/enrichment.ts +0 -241
- package/src/daemon/collectors/tmux/index.ts +0 -4
- package/src/daemon/collectors/tmux/parse.ts +0 -128
- package/src/daemon/collectors/usage.ts +0 -193
- package/src/daemon/index.ts +0 -207
- package/src/daemon/scheduler.ts +0 -86
- package/src/daemon/store.ts +0 -588
- package/src/detect.ts +0 -143
- package/src/hooks/claude.ts +0 -596
- package/src/hooks/codex.ts +0 -517
- package/src/legacy/classifier.ts +0 -215
- package/src/legacy/detect.ts +0 -143
- package/src/mcp/client-server.ts +0 -21
- package/src/mcp/http-handler.ts +0 -126
- package/src/mcp/index.ts +0 -61
- package/src/mcp/resources/config-current.ts +0 -19
- package/src/mcp/resources/index.ts +0 -11
- package/src/mcp/resources/sessions-active.ts +0 -19
- package/src/mcp/resources/sessions-all.ts +0 -19
- package/src/mcp/schemas/sessions.ts +0 -3
- package/src/mcp/server.ts +0 -17
- package/src/mcp/services/api-adapter.ts +0 -48
- package/src/mcp/services/data-source.ts +0 -22
- package/src/mcp/services/store-adapter.ts +0 -40
- package/src/mcp/tools/get-active-sessions.ts +0 -16
- package/src/mcp/tools/get-session-children.ts +0 -24
- package/src/mcp/tools/get-session-messages.ts +0 -24
- package/src/mcp/tools/get-session.ts +0 -23
- package/src/mcp/tools/index.ts +0 -15
- package/src/mcp/tools/list-sessions.ts +0 -16
- package/src/neo-blessed.d.ts +0 -4
- package/src/oc/index.ts +0 -302
- package/src/service/manager.ts +0 -284
- package/src/shared/config.ts +0 -478
- package/src/shared/ipc.ts +0 -80
- package/src/shared/logger.ts +0 -248
- package/src/shared/paths.ts +0 -73
- package/src/shared/platform.ts +0 -110
- package/src/shared/session-view.ts +0 -241
- package/src/shared/types.ts +0 -299
- package/src/shared/utils.ts +0 -339
- package/src/tui/app.ts +0 -920
- package/src/tui/client.ts +0 -149
- package/src/tui/index.ts +0 -217
- package/src/types.ts +0 -113
- package/src/usage/README.md +0 -323
- package/src/usage/api.ts +0 -99
- package/src/usage/client.ts +0 -3
- package/src/usage/clients/anthropic-oauth-usage.ts +0 -178
- package/src/usage/clients/anthropic-web-usage.ts +0 -245
- package/src/usage/clients/claude-cli-probe.ts +0 -187
- package/src/usage/clients/codex-oauth-usage.ts +0 -113
- package/src/usage/clients/opencode-go-usage.ts +0 -441
- package/src/usage/index.ts +0 -20
- package/src/usage/mappers.ts +0 -273
- package/src/usage/planner.ts +0 -54
- package/src/usage/providers/claude.ts +0 -113
- package/src/usage/providers/codex.ts +0 -34
- package/src/usage/providers/opencode-go.ts +0 -37
- package/src/usage/resolver.ts +0 -4
- package/src/usage/resolvers/browser-cookies.ts +0 -470
- package/src/usage/resolvers/claude-auth.ts +0 -108
- package/src/usage/resolvers/claude-cli.ts +0 -24
- package/src/usage/resolvers/claude-desktop-auth.ts +0 -160
- package/src/usage/resolvers/claude-web.ts +0 -16
- package/src/usage/resolvers/codex-auth.ts +0 -117
- package/src/usage/resolvers/opencode-go-web.ts +0 -14
- package/src/usage/types.ts +0 -190
package/src/detect.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { DetectionReason, PaneSample, ProcessInfo, ToolKind } from "./types";
|
|
2
|
-
import { compactWhitespace, isMostlyUiNoise, isOpencodeFooterLine, isSuggestionStyleText, pickMeaningfulTail, stripAnsiAndUi } from "./shared/utils";
|
|
3
|
-
|
|
4
|
-
const ACTIVITY_PATTERN = /(thinking|generating|executing|applying|running|streaming|analyzing|^working\s*\(|background terminal running|waited for background terminal|creating|created\s+\d+)/i;
|
|
5
|
-
const PROMPT_PATTERN = /(press enter|continue\?|y\/n|confirm(?:a|as|ar)?\b|waiting for input|type your own answer|send a message|^>\s|^>\b|^\?\s|pregunta clave|^\-\s+¿|^¿)/im;
|
|
6
|
-
const COMPLETION_PATTERN = /(worked for\s+\d|all done|completed|finished|done\b|se cre[oó]\b|cada archivo contiene|ya se escribieron\s+\d+\s+a\s+\d+|contin[uú]o hasta que termine|proceso ya pas[oó]|termin[oó]\s+bien)/i;
|
|
7
|
-
|
|
8
|
-
const TOOL_PATTERNS: Array<{ tool: ToolKind; regex: RegExp; label: string }> = [
|
|
9
|
-
{ tool: "opencode", regex: /(^|\b)(opencode)(\b|$)/i, label: "process matched opencode" },
|
|
10
|
-
{ tool: "claude", regex: /(?:^|\s|\/)(claude)(?:\s|$)/i, label: "process matched claude" },
|
|
11
|
-
{ tool: "codex", regex: /(^|\b)(codexcli|codex)(\b|$)/i, label: "process matched codex" },
|
|
12
|
-
{ tool: "copilotcli", regex: /(^|\b)(copilotcli|copilot)(\b|$)/i, label: "process matched copilot" },
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
const SHELL_PATTERN = /(^|\b)(bash|zsh|fish|sh|tmux)(\b|$)/i;
|
|
16
|
-
|
|
17
|
-
export function detectTool(currentCommand: string, processTree: ProcessInfo[]): { tool: ToolKind; reasons: DetectionReason[] } {
|
|
18
|
-
const reasons: DetectionReason[] = [];
|
|
19
|
-
const candidates = [currentCommand, ...processTree.map((process) => `${process.comm} ${process.command}`)];
|
|
20
|
-
|
|
21
|
-
for (const candidate of candidates) {
|
|
22
|
-
for (const pattern of TOOL_PATTERNS) {
|
|
23
|
-
if (pattern.regex.test(candidate)) {
|
|
24
|
-
reasons.push({
|
|
25
|
-
label: pattern.label,
|
|
26
|
-
detail: compactWhitespace(candidate),
|
|
27
|
-
});
|
|
28
|
-
return { tool: pattern.tool, reasons };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (candidates.some((candidate) => SHELL_PATTERN.test(candidate))) {
|
|
34
|
-
reasons.push({
|
|
35
|
-
label: "shell foreground detected",
|
|
36
|
-
detail: compactWhitespace(currentCommand || processTree[0]?.command || "shell"),
|
|
37
|
-
});
|
|
38
|
-
return { tool: "shell", reasons };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
reasons.push({
|
|
42
|
-
label: "no supported tool match",
|
|
43
|
-
detail: compactWhitespace(candidates.join(" | ")) || "no command context",
|
|
44
|
-
});
|
|
45
|
-
return { tool: "unknown", reasons };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function previewSignals(sample: PaneSample | null): DetectionReason[] {
|
|
49
|
-
if (!sample || sample.lines.length === 0) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const normalizedLines = sample.lines.map((line) => compactWhitespace(stripAnsiAndUi(line))).filter(Boolean);
|
|
54
|
-
const recentLines = normalizedLines.slice(-8);
|
|
55
|
-
const tailWindow = recentLines.filter((line) => !isMostlyUiNoise(line));
|
|
56
|
-
const preview = pickMeaningfulTail(tailWindow, sample.preview);
|
|
57
|
-
const reasons: DetectionReason[] = [];
|
|
58
|
-
const activityMatch = findMatchingLine(tailWindow, ACTIVITY_PATTERN);
|
|
59
|
-
const promptMatch = findMatchingLine(tailWindow, PROMPT_PATTERN, { excludeSuggestions: true });
|
|
60
|
-
const completionMatch = findMatchingLine(tailWindow, COMPLETION_PATTERN);
|
|
61
|
-
const opencodeFooterMatch = findOpencodeFooterSignal(recentLines);
|
|
62
|
-
|
|
63
|
-
if (activityMatch) {
|
|
64
|
-
reasons.push({ label: "activity keywords", detail: activityMatch });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (promptMatch) {
|
|
68
|
-
reasons.push({ label: "input prompt keywords", detail: promptMatch });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (completionMatch) {
|
|
72
|
-
reasons.push({ label: "completion keywords", detail: completionMatch });
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (opencodeFooterMatch) {
|
|
76
|
-
reasons.push({ label: "opencode footer activity", detail: opencodeFooterMatch });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const lastMeaningful = tailWindow.at(-1) ?? preview;
|
|
80
|
-
if (!isSuggestionStyleText(lastMeaningful) && (/[:>]\s*$/.test(lastMeaningful) || /^>\s+/.test(lastMeaningful) || /^\?\s+/.test(lastMeaningful))) {
|
|
81
|
-
reasons.push({ label: "prompt-like tail", detail: lastMeaningful });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return reasons;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function getPreviewMatchPositions(sample: PaneSample | null): { activityIndex: number; promptIndex: number; completionIndex: number } {
|
|
88
|
-
if (!sample || sample.lines.length === 0) {
|
|
89
|
-
return { activityIndex: -1, promptIndex: -1, completionIndex: -1 };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const normalizedLines = sample.lines.map((line) => compactWhitespace(stripAnsiAndUi(line)));
|
|
93
|
-
let activityIndex = -1;
|
|
94
|
-
let promptIndex = -1;
|
|
95
|
-
let completionIndex = -1;
|
|
96
|
-
|
|
97
|
-
for (let index = 0; index < normalizedLines.length; index += 1) {
|
|
98
|
-
const line = normalizedLines[index] ?? "";
|
|
99
|
-
if (!line) {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (ACTIVITY_PATTERN.test(line) || isOpencodeFooterLine(line)) {
|
|
103
|
-
activityIndex = index;
|
|
104
|
-
}
|
|
105
|
-
if (isMostlyUiNoise(line) && !isOpencodeFooterLine(line)) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (PROMPT_PATTERN.test(line) && !isSuggestionStyleText(line)) {
|
|
109
|
-
promptIndex = index;
|
|
110
|
-
}
|
|
111
|
-
if (COMPLETION_PATTERN.test(line)) {
|
|
112
|
-
completionIndex = index;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return { activityIndex, promptIndex, completionIndex };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function findMatchingLine(lines: string[], pattern: RegExp, options?: { excludeSuggestions?: boolean }): string | null {
|
|
120
|
-
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
121
|
-
const line = lines[index] ?? "";
|
|
122
|
-
if (options?.excludeSuggestions && isSuggestionStyleText(line)) {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
if (pattern.test(line)) {
|
|
126
|
-
return line;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function findOpencodeFooterSignal(lines: string[]): string | null {
|
|
134
|
-
const tailLines = lines.slice(-3);
|
|
135
|
-
for (let index = tailLines.length - 1; index >= 0; index -= 1) {
|
|
136
|
-
const line = tailLines[index] ?? "";
|
|
137
|
-
if (isOpencodeFooterLine(line)) {
|
|
138
|
-
return line;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return null;
|
|
143
|
-
}
|