oh-my-claude-sisyphus 3.5.6 → 3.5.8
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 +58 -343
- package/commands/omc-setup.md +51 -0
- package/dist/__tests__/analytics/tokscale-adapter.test.d.ts +2 -0
- package/dist/__tests__/analytics/tokscale-adapter.test.d.ts.map +1 -0
- package/dist/__tests__/analytics/tokscale-adapter.test.js +79 -0
- package/dist/__tests__/analytics/tokscale-adapter.test.js.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
- package/dist/__tests__/hooks/learner/bridge.test.d.ts +11 -0
- package/dist/__tests__/hooks/learner/bridge.test.d.ts.map +1 -0
- package/dist/__tests__/hooks/learner/bridge.test.js +199 -0
- package/dist/__tests__/hooks/learner/bridge.test.js.map +1 -0
- package/dist/__tests__/installer.test.js +1 -1
- package/dist/analytics/cost-estimator.d.ts +14 -0
- package/dist/analytics/cost-estimator.d.ts.map +1 -1
- package/dist/analytics/cost-estimator.js +65 -0
- package/dist/analytics/cost-estimator.js.map +1 -1
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +4 -0
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/query-engine.d.ts +3 -0
- package/dist/analytics/query-engine.d.ts.map +1 -1
- package/dist/analytics/query-engine.js +87 -0
- package/dist/analytics/query-engine.js.map +1 -1
- package/dist/analytics/token-tracker.d.ts +3 -0
- package/dist/analytics/token-tracker.d.ts.map +1 -1
- package/dist/analytics/token-tracker.js +89 -0
- package/dist/analytics/token-tracker.js.map +1 -1
- package/dist/analytics/tokscale-adapter.d.ts +71 -0
- package/dist/analytics/tokscale-adapter.d.ts.map +1 -0
- package/dist/analytics/tokscale-adapter.js +223 -0
- package/dist/analytics/tokscale-adapter.js.map +1 -0
- package/dist/analytics/types.d.ts +17 -0
- package/dist/analytics/types.d.ts.map +1 -1
- package/dist/analytics/types.js +5 -0
- package/dist/analytics/types.js.map +1 -1
- package/dist/cli/analytics.js +35 -0
- package/dist/cli/analytics.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +4 -2
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/stats.d.ts.map +1 -1
- package/dist/cli/commands/stats.js +6 -1
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/index.js +95 -35
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/tokscale-launcher.d.ts +18 -0
- package/dist/cli/utils/tokscale-launcher.d.ts.map +1 -0
- package/dist/cli/utils/tokscale-launcher.js +64 -0
- package/dist/cli/utils/tokscale-launcher.js.map +1 -0
- package/dist/features/auto-update.js +5 -5
- package/dist/features/auto-update.js.map +1 -1
- package/dist/hooks/learner/bridge.d.ts +71 -0
- package/dist/hooks/learner/bridge.d.ts.map +1 -0
- package/dist/hooks/learner/bridge.js +426 -0
- package/dist/hooks/learner/bridge.js.map +1 -0
- package/dist/hooks/skill-bridge.cjs +349 -0
- package/dist/hud/types.d.ts +6 -2
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +13 -1
- package/dist/hud/usage-api.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.js +1 -1
- package/docs/ARCHITECTURE.md +80 -397
- package/docs/FEATURES.md +396 -1981
- package/docs/MIGRATION.md +4 -4
- package/docs/REFERENCE.md +545 -0
- package/docs/SYNC-SYSTEM.md +6 -6
- package/package.json +5 -2
- package/scripts/build-skill-bridge.mjs +32 -0
- package/scripts/skill-injector.mjs +77 -26
- package/scripts/sync-metadata.ts +2 -2
- package/skills/omc-setup/SKILL.md +51 -0
- package/docs/FULL-README.md +0 -1001
|
@@ -4,34 +4,41 @@
|
|
|
4
4
|
* Skill Injector Hook (UserPromptSubmit)
|
|
5
5
|
* Injects relevant learned skills into context based on prompt triggers.
|
|
6
6
|
*
|
|
7
|
-
* STANDALONE SCRIPT -
|
|
8
|
-
*
|
|
7
|
+
* STANDALONE SCRIPT - uses compiled bridge bundle from dist/hooks/skill-bridge.cjs
|
|
8
|
+
* Falls back to inline implementation if bundle not available (first run before build)
|
|
9
|
+
*
|
|
10
|
+
* Enhancement in v3.5: Now uses RECURSIVE discovery (skills in subdirectories included)
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
import { existsSync, readdirSync, readFileSync, realpathSync } from 'fs';
|
|
12
|
-
import { join } from 'path';
|
|
14
|
+
import { join, basename } from 'path';
|
|
13
15
|
import { homedir } from 'os';
|
|
16
|
+
import { createRequire } from 'module';
|
|
17
|
+
|
|
18
|
+
// Try to load the compiled bridge bundle
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
let bridge = null;
|
|
21
|
+
try {
|
|
22
|
+
bridge = require('../dist/hooks/skill-bridge.cjs');
|
|
23
|
+
} catch {
|
|
24
|
+
// Bridge not available - use fallback (first run before build, or dist/ missing)
|
|
25
|
+
}
|
|
14
26
|
|
|
15
|
-
// Constants
|
|
27
|
+
// Constants (used by fallback)
|
|
16
28
|
const USER_SKILLS_DIR = join(homedir(), '.claude', 'skills', 'omc-learned');
|
|
17
29
|
const PROJECT_SKILLS_SUBDIR = '.omc/skills';
|
|
18
30
|
const SKILL_EXTENSION = '.md';
|
|
19
31
|
const MAX_SKILLS_PER_SESSION = 5;
|
|
20
32
|
|
|
21
|
-
//
|
|
22
|
-
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Fallback Implementation (used when bridge bundle not available)
|
|
35
|
+
// =============================================================================
|
|
23
36
|
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
const chunks = [];
|
|
27
|
-
for await (const chunk of process.stdin) {
|
|
28
|
-
chunks.push(chunk);
|
|
29
|
-
}
|
|
30
|
-
return Buffer.concat(chunks).toString('utf-8');
|
|
31
|
-
}
|
|
37
|
+
// In-memory cache (resets each process - known limitation, fixed by bridge)
|
|
38
|
+
const injectedCacheFallback = new Map();
|
|
32
39
|
|
|
33
|
-
// Parse YAML frontmatter from skill file
|
|
34
|
-
function
|
|
40
|
+
// Parse YAML frontmatter from skill file (fallback)
|
|
41
|
+
function parseSkillFrontmatterFallback(content) {
|
|
35
42
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
36
43
|
if (!match) return null;
|
|
37
44
|
|
|
@@ -56,8 +63,8 @@ function parseSkillFrontmatter(content) {
|
|
|
56
63
|
return { name, triggers, content: body };
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
// Find all skill files
|
|
60
|
-
function
|
|
66
|
+
// Find all skill files (fallback - NON-RECURSIVE for backward compat)
|
|
67
|
+
function findSkillFilesFallback(directory) {
|
|
61
68
|
const candidates = [];
|
|
62
69
|
const seenPaths = new Set();
|
|
63
70
|
|
|
@@ -111,17 +118,17 @@ function findSkillFiles(directory) {
|
|
|
111
118
|
return candidates;
|
|
112
119
|
}
|
|
113
120
|
|
|
114
|
-
// Find matching skills
|
|
115
|
-
function
|
|
121
|
+
// Find matching skills (fallback)
|
|
122
|
+
function findMatchingSkillsFallback(prompt, directory, sessionId) {
|
|
116
123
|
const promptLower = prompt.toLowerCase();
|
|
117
|
-
const candidates =
|
|
124
|
+
const candidates = findSkillFilesFallback(directory);
|
|
118
125
|
const matches = [];
|
|
119
126
|
|
|
120
127
|
// Get or create session cache
|
|
121
|
-
if (!
|
|
122
|
-
|
|
128
|
+
if (!injectedCacheFallback.has(sessionId)) {
|
|
129
|
+
injectedCacheFallback.set(sessionId, new Set());
|
|
123
130
|
}
|
|
124
|
-
const alreadyInjected =
|
|
131
|
+
const alreadyInjected = injectedCacheFallback.get(sessionId);
|
|
125
132
|
|
|
126
133
|
for (const candidate of candidates) {
|
|
127
134
|
// Skip if already injected this session
|
|
@@ -129,7 +136,7 @@ function findMatchingSkills(prompt, directory, sessionId) {
|
|
|
129
136
|
|
|
130
137
|
try {
|
|
131
138
|
const content = readFileSync(candidate.path, 'utf-8');
|
|
132
|
-
const skill =
|
|
139
|
+
const skill = parseSkillFrontmatterFallback(content);
|
|
133
140
|
if (!skill) continue;
|
|
134
141
|
|
|
135
142
|
// Check if any trigger matches
|
|
@@ -146,7 +153,8 @@ function findMatchingSkills(prompt, directory, sessionId) {
|
|
|
146
153
|
name: skill.name,
|
|
147
154
|
content: skill.content,
|
|
148
155
|
score,
|
|
149
|
-
scope: candidate.scope
|
|
156
|
+
scope: candidate.scope,
|
|
157
|
+
triggers: skill.triggers
|
|
150
158
|
});
|
|
151
159
|
}
|
|
152
160
|
} catch {
|
|
@@ -166,6 +174,39 @@ function findMatchingSkills(prompt, directory, sessionId) {
|
|
|
166
174
|
return selected;
|
|
167
175
|
}
|
|
168
176
|
|
|
177
|
+
// =============================================================================
|
|
178
|
+
// Main Logic (uses bridge if available, fallback otherwise)
|
|
179
|
+
// =============================================================================
|
|
180
|
+
|
|
181
|
+
// Read all stdin
|
|
182
|
+
async function readStdin() {
|
|
183
|
+
const chunks = [];
|
|
184
|
+
for await (const chunk of process.stdin) {
|
|
185
|
+
chunks.push(chunk);
|
|
186
|
+
}
|
|
187
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Find matching skills - delegates to bridge or fallback
|
|
191
|
+
function findMatchingSkills(prompt, directory, sessionId) {
|
|
192
|
+
if (bridge) {
|
|
193
|
+
// Use bridge (RECURSIVE discovery, persistent session cache)
|
|
194
|
+
const matches = bridge.matchSkillsForInjection(prompt, directory, sessionId, {
|
|
195
|
+
maxResults: MAX_SKILLS_PER_SESSION
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Mark as injected via bridge
|
|
199
|
+
if (matches.length > 0) {
|
|
200
|
+
bridge.markSkillsInjected(sessionId, matches.map(s => s.path), directory);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return matches;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Fallback (NON-RECURSIVE, in-memory cache)
|
|
207
|
+
return findMatchingSkillsFallback(prompt, directory, sessionId);
|
|
208
|
+
}
|
|
209
|
+
|
|
169
210
|
// Format skills for injection
|
|
170
211
|
function formatSkillsMessage(skills) {
|
|
171
212
|
const lines = [
|
|
@@ -179,7 +220,17 @@ function formatSkillsMessage(skills) {
|
|
|
179
220
|
|
|
180
221
|
for (const skill of skills) {
|
|
181
222
|
lines.push(`### ${skill.name} (${skill.scope})`);
|
|
223
|
+
|
|
224
|
+
// Add metadata block for programmatic parsing
|
|
225
|
+
const metadata = {
|
|
226
|
+
path: skill.path,
|
|
227
|
+
triggers: skill.triggers,
|
|
228
|
+
score: skill.score,
|
|
229
|
+
scope: skill.scope
|
|
230
|
+
};
|
|
231
|
+
lines.push(`<skill-metadata>${JSON.stringify(metadata)}</skill-metadata>`);
|
|
182
232
|
lines.push('');
|
|
233
|
+
|
|
183
234
|
lines.push(skill.content);
|
|
184
235
|
lines.push('');
|
|
185
236
|
lines.push('---');
|
package/scripts/sync-metadata.ts
CHANGED
|
@@ -123,7 +123,7 @@ function getFileSyncConfigs(): FileSync[] {
|
|
|
123
123
|
],
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
path: 'docs/
|
|
126
|
+
path: 'docs/REFERENCE.md',
|
|
127
127
|
replacements: [
|
|
128
128
|
{
|
|
129
129
|
pattern: /\[!\[Version\]\(https:\/\/img\.shields\.io\/badge\/version-[^-]+-[^)]+\)/g,
|
|
@@ -319,7 +319,7 @@ ${color('Description:', colors.cyan)}
|
|
|
319
319
|
|
|
320
320
|
${color('Files Synced:', colors.cyan)}
|
|
321
321
|
- README.md (npm badges)
|
|
322
|
-
- docs/
|
|
322
|
+
- docs/REFERENCE.md (version badges and headers)
|
|
323
323
|
- .github/CLAUDE.md (agent/skill counts)
|
|
324
324
|
- docs/ARCHITECTURE.md (version references)
|
|
325
325
|
- CHANGELOG.md (version header verification)
|
|
@@ -266,6 +266,45 @@ echo "Default execution mode set to: USER_CHOICE"
|
|
|
266
266
|
|
|
267
267
|
**Note**: This preference ONLY affects generic keywords ("fast", "parallel"). Explicit keywords ("ulw", "eco") always override this preference.
|
|
268
268
|
|
|
269
|
+
## Step 3.8: Install CLI Analytics Tools (Optional)
|
|
270
|
+
|
|
271
|
+
The OMC CLI provides standalone token analytics commands (`omc stats`, `omc agents`, `omc tui`).
|
|
272
|
+
|
|
273
|
+
Ask user: "Would you like to install the OMC CLI for standalone analytics? (Recommended for tracking token usage and costs)"
|
|
274
|
+
|
|
275
|
+
**Options:**
|
|
276
|
+
1. **Yes (Recommended)** - Install CLI tools globally for `omc stats`, `omc agents`, etc.
|
|
277
|
+
2. **No** - Skip CLI installation, use only plugin skills
|
|
278
|
+
|
|
279
|
+
### If User Chooses YES:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Check for bun (preferred) or npm
|
|
283
|
+
if command -v bun &> /dev/null; then
|
|
284
|
+
echo "Installing OMC CLI via bun..."
|
|
285
|
+
bun install -g oh-my-claudecode
|
|
286
|
+
elif command -v npm &> /dev/null; then
|
|
287
|
+
echo "Installing OMC CLI via npm..."
|
|
288
|
+
npm install -g oh-my-claudecode
|
|
289
|
+
else
|
|
290
|
+
echo "ERROR: Neither bun nor npm found. Please install Node.js or Bun first."
|
|
291
|
+
exit 1
|
|
292
|
+
fi
|
|
293
|
+
|
|
294
|
+
# Verify installation
|
|
295
|
+
if command -v omc &> /dev/null; then
|
|
296
|
+
echo "✓ OMC CLI installed successfully!"
|
|
297
|
+
echo " Try: omc stats, omc agents, omc tui"
|
|
298
|
+
else
|
|
299
|
+
echo "⚠ CLI installed but 'omc' not in PATH."
|
|
300
|
+
echo " You may need to restart your terminal or add npm/bun global bin to PATH."
|
|
301
|
+
fi
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### If User Chooses NO:
|
|
305
|
+
|
|
306
|
+
Skip this step. User can install later with `npm install -g oh-my-claudecode`.
|
|
307
|
+
|
|
269
308
|
## Step 4: Verify Plugin Installation
|
|
270
309
|
|
|
271
310
|
```bash
|
|
@@ -329,6 +368,12 @@ Run /oh-my-claudecode:mcp-setup to add tools like web search, GitHub, etc.
|
|
|
329
368
|
HUD STATUSLINE:
|
|
330
369
|
The status bar now shows OMC state. Restart Claude Code to see it.
|
|
331
370
|
|
|
371
|
+
CLI ANALYTICS (if installed):
|
|
372
|
+
- omc - Full dashboard (stats + agents + cost)
|
|
373
|
+
- omc stats - View token usage and costs
|
|
374
|
+
- omc agents - See agent breakdown by cost
|
|
375
|
+
- omc tui - Launch interactive TUI dashboard
|
|
376
|
+
|
|
332
377
|
That's it! Just use Claude Code normally.
|
|
333
378
|
```
|
|
334
379
|
|
|
@@ -359,6 +404,12 @@ MAGIC KEYWORDS (power-user shortcuts):
|
|
|
359
404
|
HUD STATUSLINE:
|
|
360
405
|
The status bar now shows OMC state. Restart Claude Code to see it.
|
|
361
406
|
|
|
407
|
+
CLI ANALYTICS (if installed):
|
|
408
|
+
- omc - Full dashboard (stats + agents + cost)
|
|
409
|
+
- omc stats - View token usage and costs
|
|
410
|
+
- omc agents - See agent breakdown by cost
|
|
411
|
+
- omc tui - Launch interactive TUI dashboard
|
|
412
|
+
|
|
362
413
|
Your workflow won't break - it just got easier!
|
|
363
414
|
```
|
|
364
415
|
|