skill-autoroute 0.7.0 → 0.8.0

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 CHANGED
@@ -272,7 +272,7 @@ npx skill-autoroute install --model triggers=haiku
272
272
  | `install` | The full setup flow |
273
273
  | `regenerate` | Update triggers for new or changed skills, or for all skills after an update that changes how triggers are written. Keeps your choices. |
274
274
  | `scan` | Scan and find duplicates only. Writes nothing. |
275
- | `list` | Show skills, on/off state, tools, priority, paths and trigger rules. Supports `--tools` and `--project`. Writes nothing. |
275
+ | `list [<skill>]` | Show a compact routing table, or one skill's paths, priority and numbered trigger rules. Supports `--tools` and `--project`. Writes nothing. |
276
276
  | `set <skill> on|off` | Turn one skill's hints on or off |
277
277
  | `words [<skill> [add|remove <word>...]]` | Your own trigger words for a skill. Without a skill, lists all of them. |
278
278
  | `status` | Tools, hook state, skill counts, changed skills |
@@ -292,10 +292,31 @@ Inspect the saved routing configuration:
292
292
  npx skill-autoroute list
293
293
  npx skill-autoroute list --tools codex
294
294
  npx skill-autoroute list --project
295
+ npx skill-autoroute list security-review
295
296
  ```
296
297
 
297
298
  `list` reads the user table by default; `--project` reads only the current project's table.
298
- It includes disabled skills (marked `off`). Patterns within a rule must all match (AND);
299
+ The summary groups skills by family, with aligned names, on/off state, tools and rule counts.
300
+ Families come from plugin metadata, namespaced names, plugin paths, or the Caveman, Expo, Foreman,
301
+ Superpowers and Vercel name prefixes. Other entries appear under `OTHER SKILLS`.
302
+ Families and their skills are sorted alphabetically, with `OTHER SKILLS` last.
303
+
304
+ Example layout (your skills and rule counts may differ):
305
+
306
+ ```text
307
+ EXPO
308
+ SKILL STATUS TOOLS RULES
309
+ expo-native-ui on codex 4
310
+ expo-upgrade on codex 4
311
+
312
+ VERCEL
313
+ SKILL STATUS TOOLS RULES
314
+ vercel-composition-patterns on codex 4
315
+ vercel-optimize on codex 3
316
+ ```
317
+
318
+ Use `list <skill>` for paths, priority, custom words and numbered rules; long lines wrap to fit the terminal.
319
+ Both views include disabled skills (marked `off`). Patterns within a rule must all match (AND);
299
320
  any rule can trigger the skill (OR). Custom words are another way to match.
300
321
  Enabled means eligible for routing on matching prompts, not that the agent has invoked the skill.
301
322
 
package/bin/cli.js CHANGED
@@ -6,7 +6,7 @@ import * as flow from '../src/flow.js';
6
6
  import { STEP_DEFAULTS } from '../src/models.js';
7
7
 
8
8
  const USAGE = `usage: skill-autoroute <command> [flags]
9
- commands: install | regenerate | scan | list | set <skill> on|off | words [<skill> [add|remove <word>...]] | status | tokens | bench | uninstall
9
+ commands: install | regenerate | scan | list [<skill>] | set <skill> on|off | words [<skill> [add|remove <word>...]] | status | tokens | bench | uninstall
10
10
  flags: --yes --dry-run --project --tools claude,codex --ai claude|codex|none --model step=model (repeatable) --log`;
11
11
 
12
12
  const COMMANDS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skill-autoroute",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Per-prompt skill router hook for Claude Code and Codex",
5
5
  "keywords": [
6
6
  "claude-code",
package/src/flow.js CHANGED
@@ -410,22 +410,100 @@ export function setSkill(o, ui, name, state) {
410
410
  if (state === 'on' && hits.some((s) => !s.patterns?.length)) ui.log(`${show(name)} has no trigger rules yet, so it gets no hints. Run: npx skill-autoroute regenerate`);
411
411
  }
412
412
 
413
- export function list(o, ui) {
413
+ // Wrap long paths and patterns too; a single token must not overflow a narrow terminal.
414
+ function wrapList(text, width, indent = '', continuation = indent) {
415
+ const out = [];
416
+ while (text.length > Math.max(1, width - indent.length)) {
417
+ const room = Math.max(1, width - indent.length);
418
+ const space = text.lastIndexOf(' ', room);
419
+ const cut = space > 0 ? space : room;
420
+ out.push(indent + text.slice(0, cut));
421
+ text = text.slice(cut + (space > 0 ? 1 : 0));
422
+ indent = continuation;
423
+ }
424
+ out.push(indent + text);
425
+ return out;
426
+ }
427
+
428
+ function listFamily(s) {
429
+ const name = String(s.name ?? '');
430
+ const plugin = String(s.source ?? '').match(/^plugin:([^@]+)/)?.[1];
431
+ const packaged = String(s.path ?? '').replace(/\\/g, '/').match(/\/plugins\/.*\/([^/]+)\/[^/]+\/skills\//)?.[1];
432
+ const prefix = name.match(/^(caveman|expo|foreman|superpowers|vercel)(?:[-:]|$)/)?.[1];
433
+ return show(plugin || name.match(/^([^:]+):/)?.[1] || packaged || prefix || 'Other skills').toUpperCase();
434
+ }
435
+
436
+ export function list(o, ui, name) {
414
437
  const path = routesPath(scopeOf(o));
415
438
  const table = readTable(path);
416
439
  if (!table) return ui.log(`no table at ${show(path)}; run install first`);
417
440
  const skills = table.skills.filter((s) => s && (!o.tools?.length || o.tools.some((t) => (s.tools ?? [s.tool]).includes(t))));
441
+ const selected = name ? skills.filter((s) => s.name === name) : skills;
442
+ if (name && !selected.length) throw new Error(`no skill named "${show(name)}" in this scope for the selected tools`);
418
443
  if (!skills.length) return ui.log('No skills in this scope for the selected tools.');
419
- ui.log('Routing configuration (on = enabled for matching prompts; not proof of invocation).\nRules are case-insensitive: AND within a rule, OR between rules. Own words also trigger a match.');
420
- for (const s of skills) {
421
- ui.log(`${show(s.name)} ${s.enabled ? 'on' : 'off'} ${(s.tools ?? [s.tool]).map(show).join(', ')} priority ${show(s.priority ?? 50)}`);
422
- if (s.path) ui.log(` Path: ${show(s.path)}`);
423
- if (s.projects?.length) ui.log(` Projects: ${s.projects.map(show).join(', ')}`);
424
- ui.log(s.patterns?.length
425
- ? ` Rules: ${s.patterns.map((rule) => `(${rule.map(show).join(' AND ')})`).join(' OR ')}`
426
- : ' No trigger rules.');
427
- if (s.words?.length) ui.log(` Own words: ${s.words.map(show).join(', ')}`);
444
+ const width = Math.max(32, process.stdout.columns || 80) - 4; // room for the interactive logger's gutter
445
+ const lines = [];
446
+ const add = (text, indent = '', continuation = indent) => lines.push(...wrapList(text, width, indent, continuation));
447
+ const tools = (s) => (s.tools ?? [s.tool]).map(show).join(', ') || '-';
448
+ if (!name) {
449
+ const toolWidth = Math.max(5, ...skills.map((s) => tools(s).length));
450
+ const nameWidth = Math.max(1, Math.min(Math.max(5, ...skills.map((s) => show(s.name).length)), width - toolWidth - 19));
451
+ const narrow = nameWidth < 16 && width < 60;
452
+ const row = (n, status, tool, rules) => ` ${n.padEnd(nameWidth)} ${status.padEnd(6)} ${tool.padEnd(toolWidth)} ${rules.padStart(5)}`;
453
+ add(`Skill routes (${scopeOf(o)})`);
454
+ const groups = new Map();
455
+ for (const s of skills) {
456
+ const family = listFamily(s);
457
+ if (!groups.has(family)) groups.set(family, []);
458
+ groups.get(family).push(s);
459
+ }
460
+ const families = [...groups.keys()].sort((a, b) => (a === 'OTHER SKILLS') - (b === 'OTHER SKILLS') || a.localeCompare(b));
461
+ for (const family of families) {
462
+ lines.push('');
463
+ add(family);
464
+ if (narrow) lines.push(' SKILL', ` ${'STATUS'.padEnd(6)} ${'TOOLS'.padEnd(toolWidth)} RULES`);
465
+ else lines.push(row('SKILL', 'STATUS', 'TOOLS', 'RULES'));
466
+ for (const s of groups.get(family).sort((a, b) => String(a.name).localeCompare(String(b.name)))) {
467
+ if (narrow) {
468
+ lines.push('');
469
+ add(show(s.name), ' ');
470
+ lines.push(` ${(s.enabled ? 'on' : 'off').padEnd(6)} ${tools(s).padEnd(toolWidth)} ${String(s.patterns?.length ?? 0).padStart(5)}`);
471
+ } else {
472
+ const chunks = wrapList(show(s.name), nameWidth);
473
+ lines.push(row(chunks[0], s.enabled ? 'on' : 'off', tools(s), String(s.patterns?.length ?? 0)));
474
+ lines.push(...chunks.slice(1).map((line) => ' ' + line));
475
+ }
476
+ }
477
+ }
478
+ lines.push('');
479
+ add(`${skills.length} skills: ${skills.filter((s) => s.enabled).length} on, ${skills.filter((s) => !s.enabled).length} off`);
480
+ add('On = eligible for matching prompts; not proof of invocation.');
481
+ lines.push('');
482
+ add('Details and rules:');
483
+ add('npx skill-autoroute list <skill>' + (o.project ? ' --project' : ''), ' ');
484
+ } else {
485
+ for (const s of selected) {
486
+ if (lines.length) lines.push('');
487
+ add(show(s.name));
488
+ lines.push('');
489
+ for (const [label, value] of [
490
+ ['Status', s.enabled ? 'on' : 'off'], ['Tools', tools(s)], ['Priority', s.priority ?? 50],
491
+ ['Path', s.path], ['Projects', s.projects?.map(show).join(', ')], ['Own words', s.words?.map(show).join(', ')],
492
+ ]) if (value !== undefined && value !== '') add(show(value), ` ${(label + ':').padEnd(11)}`, ' '.repeat(13));
493
+ lines.push('');
494
+ add('Rules (case-insensitive; OR between numbered rules):');
495
+ if (!s.patterns?.length) add('No trigger rules.', ' ');
496
+ for (const [i, rule] of (s.patterns ?? []).entries()) {
497
+ if (i) lines.push('');
498
+ for (const [j, pattern] of rule.entries()) {
499
+ const prefix = j ? ' AND ' : ` ${i + 1}. `;
500
+ add(show(pattern), prefix, ' '.repeat(prefix.length));
501
+ }
502
+ }
503
+ if (s.words?.length) { lines.push(''); add('Own words also trigger a match.'); }
504
+ }
428
505
  }
506
+ ui.log(lines.join('\n'));
429
507
  }
430
508
 
431
509
  export function status(o, ui) {