@skill-map/cli 0.15.0 → 0.16.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 CHANGED
@@ -25,6 +25,22 @@ npx @skill-map/cli --version
25
25
 
26
26
  Both `sm` (short, daily use) and `skill-map` (full name, scripts) are registered as binaries after install. The package name is scoped (`@skill-map/cli`) to sit alongside `@skill-map/spec` under the same npm org; the binaries keep the unprefixed names for ergonomics.
27
27
 
28
+ ## Interactive tutorial (recommended starting point)
29
+
30
+ If you use [Claude Code](https://claude.ai/code), `sm tutorial` is the fastest way to learn the CLI and the live UI without committing your real project to anything:
31
+
32
+ ```bash
33
+ mkdir try-skill-map && cd try-skill-map
34
+ sm tutorial # writes sm-tutorial.md into the empty dir
35
+ claude # open Claude Code in the same dir
36
+ # Inside Claude:
37
+ ejecutá @sm-tutorial.md
38
+ ```
39
+
40
+ Claude loads the SKILL.md and runs the demo (~7 min): fixture, `sm init`, live UI, four "reveals" that show the watcher in action, plus the `.skillmapignore` hide-a-file flow. An optional deep-dive (~30-40 min) covers the rest of the CLI surface (`list`, `graph`, `export`, `orphans`, `plugins`, `db ops`).
41
+
42
+ The verb `sm tutorial` writes a single self-contained file; the SKILL.md ships inside this package, so no extra install needed.
43
+
28
44
  ## Usage
29
45
 
30
46
  ```bash
@@ -53,16 +53,43 @@ optional second phase (~30-40 min) covering the rest of the CLI.
53
53
  the Tone bullets above, voseo and all); if in English, run it in
54
54
  plain English. Internal narration in this SKILL.md stays in
55
55
  English regardless.
56
+ - **Never emit bilingual user-facing copy**. The samples in the
57
+ blockquotes throughout this SKILL are written in English as the
58
+ base; translate the entire block to Spanish when the tester
59
+ speaks Spanish. Do NOT show "Spanish / English" pairs inline,
60
+ do NOT keep one sentence in English while another is in Spanish,
61
+ do NOT sprinkle isolated Spanish words inside English paragraphs
62
+ (or vice versa). Pick one language and commit.
63
+ - **Fixture content also follows the tester's language**. When you
64
+ `Write` the demo `.md` files (frontmatter `description`, body
65
+ prose, link anchor text, list items), translate the human text
66
+ to the tester's language. **Keep these English regardless**:
67
+ file paths and filenames (`.claude/agents/demo-agent.md`),
68
+ frontmatter keys (`name`, `description`, `metadata`, `tools`,
69
+ `event`, etc.), node identifiers (`demo-agent`, `demo-skill`),
70
+ link target paths inside `[...]( ... )`, code snippets, fenced
71
+ blocks, and anything the kernel parses structurally. Only the
72
+ natural-language portions get translated — schema and identifiers
73
+ stay stable so the watcher and link extractors keep working.
56
74
 
57
75
  ## Inviolable rules
58
76
 
59
77
  1. **You DO NOT run `sm` verbs for the tester** except `sm version`
60
78
  ONCE during pre-flight to verify the install. Your responsibilities:
61
79
  - Write fixture files and `tutorial-state.yml` directly in the cwd.
62
- - Edit `.md` files when a step calls for it (the live-UI demo
63
- needs this so the watcher has something to react to).
80
+ - Edit `.md` fixture files when a step calls for it (the live-UI
81
+ demo needs this so the watcher has something to react to).
64
82
  - Read files to verify what the tester modified.
65
83
  - Everything else is run by the tester.
84
+ - **Configuration files are off-limits to your editing tools**:
85
+ `.skillmapignore`, `.skill-map/settings.json`,
86
+ `.skill-map/settings.local.json`, and `.gitignore` are
87
+ ALWAYS edited by the tester, never by you. When a step calls
88
+ for a change to one of those, you describe the edit in a
89
+ blockquote and the tester applies it in their own editor.
90
+ The pedagogical point is that those files belong to the user
91
+ — they need to internalise where they live and how to change
92
+ them. Doing it for them defeats the lesson.
66
93
  2. **After every command block, stop and wait.** The tester pastes
67
94
  the output or replies "OK" / "done". Only then do you advance.
68
95
  3. **Persist progress after every step / stage.** Update
@@ -349,7 +376,7 @@ Mark `1-version: done`.
349
376
 
350
377
  **Context**: `sm init` creates a hidden `.skill-map/` folder in the
351
378
  cwd holding the database where skill-map stores what it learns about
352
- the project. It also drops a `.skill-mapignore` in the cwd with
379
+ the project. It also drops a `.skillmapignore` in the cwd with
353
380
  default exclusions. Mandatory first step.
354
381
 
355
382
  ```bash
@@ -358,10 +385,10 @@ ls -la .skill-map/
358
385
  ```
359
386
 
360
387
  Expected: `.skill-map/skill-map.db` appears (plus config files), and
361
- a `.skill-mapignore` shows up at the root.
388
+ a `.skillmapignore` shows up at the root.
362
389
 
363
390
  **After init**, you append the tutorial's entries to the
364
- `.skill-mapignore` that `sm init` just created (do not create a new
391
+ `.skillmapignore` that `sm init` just created (do not create a new
365
392
  file — append to the existing one with `Edit`). This prevents
366
393
  `sm scan` from picking up the tutorial's internal files as graph nodes:
367
394
 
@@ -385,18 +412,25 @@ starts the UI server with the watcher built in. One process, one
385
412
  terminal: it boots the server, scans the `.md` files, detects
386
413
  changes, and pushes events over WebSocket to the live UI.
387
414
 
388
- This step has **three reveals**, each one driven by you editing
389
- files while the server stays up:
415
+ This step has **five reveals**, each one driven by you editing
416
+ files while the server stays up — except Reveal 3, where the
417
+ tester takes the keyboard for the first time.
390
418
 
391
419
  1. **Reveal 1 (boot)** — one node alone (the agent).
392
420
  2. **Reveal 2 (kinds)** — the four other kinds appear as new nodes,
393
421
  still unconnected.
394
- 3. **Reveal 3 (connectors)** — the connectors light up between all
422
+ 3. **Reveal 3 (your first edit)** — the **tester** edits the
423
+ `description` of the agent's `.md` and watches the card
424
+ refresh in the graph.
425
+ 4. **Reveal 4 (connectors)** — the connectors light up between all
395
426
  five nodes.
427
+ 5. **Reveal 5 (ignore)** — a private file appears, then disappears
428
+ the moment a pattern is added to `.skillmapignore`.
396
429
 
397
- The pedagogical arc: a single dot → a constellation of dots → a
398
- graph. Each reveal stops at a confirm prompt before you do the
399
- next.
430
+ The pedagogical arc: a single dot → a constellation of dots →
431
+ your own edit lands graph a graph that respects the user's
432
+ ignore list. Each reveal stops at a confirm prompt before you do
433
+ the next.
400
434
 
401
435
  **Command** (one terminal):
402
436
 
@@ -404,6 +438,28 @@ next.
404
438
  sm
405
439
  ```
406
440
 
441
+ Before Reveal 1, ask the tester to set up a **side-by-side view** so
442
+ they can watch the magic happen without alt-tabbing every reveal.
443
+ Tell the tester:
444
+
445
+ > Arrange your screen so two windows are visible at the same time:
446
+ >
447
+ > 1. **The browser** at `http://127.0.0.1:4242` — where the graph
448
+ > will update in real time.
449
+ > 2. **This terminal** — the one where you're talking to me. You'll
450
+ > see me announce each reveal here, then confirm what you see
451
+ > in the browser.
452
+ >
453
+ > The third window — the terminal running `sm` — you can leave
454
+ > minimized or off to the side; it will just print scan progress
455
+ > lines and you don't need to read them.
456
+ >
457
+ > A typical layout: browser on the left half, this chat on the
458
+ > right half. Or any split that lets you see both at once. Tell
459
+ > me when you're set up and we start.
460
+
461
+ Wait for confirmation before moving on.
462
+
407
463
  #### Reveal 1 — the lone agent
408
464
 
409
465
  Tell the tester:
@@ -507,42 +563,62 @@ Create these four files (with `Write`), exactly in this order:
507
563
  wired into the rest of the fixture next.
508
564
  ```
509
565
 
510
- 4. `notes/todo.md` (kind: note — has a **deliberately broken link**
511
- that we exploit later in stage L4):
566
+ 4. `notes/todo.md` (kind: note):
512
567
  ```markdown
513
568
  ---
514
569
  name: Demo TODO list
515
570
  description: |
516
571
  Live list of things to review in the demo. Will become the
517
572
  hub between skill / agent / command / hook in the next
518
- reveal. Contains a broken link on purpose for the broken-ref
519
- stage later on.
573
+ reveal.
520
574
  tags: [notes, demo]
521
575
  metadata:
522
576
  version: "1.0.0"
523
577
  ---
524
578
 
525
579
  # Pending
526
-
527
- - [ ] Document the [flow diagram](./missing-page.md) — broken
528
- link on purpose, leave it.
529
580
  ```
530
581
 
531
582
  Tell the tester:
532
583
 
533
- > Mirá el navegador / Look at the browser. Four new nodes should
534
- > have popped in: `demo-skill`, `demo-command`, `demo-hook`, and
584
+ > Look at the browser. Four new nodes should have popped in:
585
+ > `demo-skill`, `demo-command`, `demo-hook`, and
535
586
  > `notes/todo`. Five total now, **still unconnected** — they're
536
- > floating dots.
537
- >
538
- > If you don't see them, zoom out with the mouse wheel or the UI
539
- > zoom control — new nodes sometimes land off-screen.
587
+ > floating dots. The viewport auto-fits whenever a node is added or
588
+ > removed, so all five should be visible without panning.
540
589
  >
541
590
  > Did the four appear? Confirm so we can wire them up.
542
591
 
543
592
  Wait for confirmation.
544
593
 
545
- #### Reveal 3 — the connectors light up
594
+ #### Reveal 3 — your first edit
595
+
596
+ Up to here you've been watching the agent write files. Now hand
597
+ the keyboard over: the lesson is that the watcher reacts to
598
+ **any** `.md` edit under the cwd, not just to files the agent
599
+ authors. After this beat, the tester has the muscle memory for
600
+ "save → graph updates", which Reveal 5 (`.skillmapignore`) reuses
601
+ verbatim.
602
+
603
+ Tell the tester:
604
+
605
+ > Tu turno. Open `.claude/agents/demo-agent.md` in your editor of
606
+ > choice. In the frontmatter, change the `description:` field to
607
+ > any text you want — the actual content does not matter, just
608
+ > make it different from what's there now. Save the file.
609
+ >
610
+ > Watch the browser. The `demo-agent` card should refresh its
611
+ > description in real time, no reload, no Ctrl+C — same watcher
612
+ > that picked up the four new nodes a moment ago, this time
613
+ > reacting to YOUR edit.
614
+ >
615
+ > Confirm so we wire the five up.
616
+
617
+ Wait for confirmation. You MAY use `Read` on the file afterwards
618
+ to verify the change landed (read-only, allowed under Inviolable
619
+ rule #1) before moving on.
620
+
621
+ #### Reveal 4 — the connectors light up
546
622
 
547
623
  Now you edit the existing files to add the cross-fixture links —
548
624
  each one becomes a connector in the graph. Apply with `Edit` (do
@@ -571,11 +647,9 @@ not rewrite the files):
571
647
  See [pending items](../../notes/todo.md) for operational
572
648
  context.
573
649
  ```
574
- 5. **Edit `notes/todo.md`** — replace the existing single bullet
575
- with these three (keep the broken-link bullet intact):
650
+ 5. **Edit `notes/todo.md`** — append these two bullets after the
651
+ `# Pending` heading:
576
652
  ```markdown
577
- - [ ] Document the [flow diagram](./missing-page.md) — broken
578
- link on purpose, leave it.
579
653
  - [ ] Polish the
580
654
  [demo-skill](../.claude/skills/demo-skill/SKILL.md)
581
655
  prompt.
@@ -585,8 +659,8 @@ not rewrite the files):
585
659
 
586
660
  Tell the tester:
587
661
 
588
- > Mirá la magia de nuevo / Look at the magic again. The five
589
- > floating nodes should now be wired together — connectors light
662
+ > Look at the magic again. The five floating nodes should now be
663
+ > wired together — connectors light
590
664
  > up between them as the watcher picks up each edit:
591
665
  >
592
666
  > - `demo-skill → demo-agent`
@@ -595,18 +669,117 @@ Tell the tester:
595
669
  > - `demo-hook → notes/todo`
596
670
  > - `notes/todo → demo-skill`, `notes/todo → demo-hook`
597
671
  >
598
- > The intentional broken link inside `notes/todo` (pointing at the
599
- > non-existent `missing-page.md`) does **not** show up as a
600
- > connector in the graph — it surfaces as a `broken-ref` **issue**
601
- > on the `notes/todo` node (look for a warning marker on the node
602
- > or open it in the inspector). We'll explore that issue properly
603
- > in stage L4 if you continue with the deeper part.
672
+ > Confirm. If a connector is missing, refresh the browser and tell
673
+ > me.
674
+
675
+ Wait for confirmation. **Do NOT move on to Reveal 5** until the
676
+ connectors are confirmed visible Reveal 5 reuses the same live UI
677
+ session.
678
+
679
+ #### Reveal 5 — silence a private file via `.skillmapignore`
680
+
681
+ The first four reveals showed the watcher picking up new files and
682
+ edits (yours and theirs). Reveal 5 flips the direction: a file the
683
+ tester DOES NOT want
684
+ in the graph (a draft, a scratch file, a secret) gets hidden by a
685
+ single line in `.skillmapignore`. Same live mechanism — no restart.
686
+
687
+ `sm init` already wrote a starter `.skillmapignore` at the scope
688
+ root. The flow has three beats:
689
+
690
+ **Beat A — you create one new fixture file (the agent does this).**
691
+
692
+ `Write` `notes/private-credentials.md` — kind `note`, simulates a
693
+ file the tester would never want surfacing publicly:
694
+
695
+ ```markdown
696
+ ---
697
+ name: private-credentials
698
+ description: |
699
+ Personal API tokens — exists in the repo but should not show
700
+ up in the skill-map graph. Demonstrates the .skillmapignore
701
+ flow.
702
+ metadata:
703
+ version: "0.0.1"
704
+ ---
705
+
706
+ # Private
707
+
708
+ API_TOKEN: example-not-real
709
+ ```
710
+
711
+ Confirm the file appears in the graph as a sixth node
712
+ (`notes/private-credentials`). The watcher sees it like any
713
+ other `.md` — that's the point of the demo.
714
+
715
+ **Beat B — you show the project structure (the agent does this).**
716
+
717
+ Before asking the tester to touch `.skillmapignore`, give them a
718
+ mental map of the folder so they know where the file lives and
719
+ what's around it. Use `Bash` (`ls -la` and `ls -la notes/` if a
720
+ deeper view helps) and present the listing inside a blockquote so
721
+ the tester sees what their cwd holds:
722
+
723
+ > Antes del último paso, esto es lo que tenés en el directorio
724
+ > ahora mismo:
725
+ >
726
+ > ```
727
+ > . ← your cwd
728
+ > ├── .claude/
729
+ > │ ├── agents/demo-agent.md
730
+ > │ ├── commands/demo-command.md
731
+ > │ ├── hooks/demo-hook.md
732
+ > │ └── skills/demo-skill/SKILL.md
733
+ > ├── .skill-map/ ← project DB + settings (managed)
734
+ > │ ├── settings.json
735
+ > │ ├── settings.local.json
736
+ > │ └── skill-map.db
737
+ > ├── .skillmapignore ← the file we're about to edit
738
+ > ├── notes/
739
+ > │ ├── todo.md
740
+ > │ └── private-credentials.md ← what we want to hide
741
+ > └── sm-tutorial.md ← the tutorial file you loaded
742
+ > ```
604
743
  >
605
- > Confirmá / confirm. If a connector is missing, refresh the
606
- > browser and tell me.
744
+ > The `.skillmapignore` at the root is the file we'll touch
745
+ > next. Same syntax as `.gitignore`. Anything matching a pattern
746
+ > there is invisible to skill-map's scan.
747
+
748
+ Adjust the actual tree shown to whatever `ls -la` returns — the
749
+ goal is "tester recognises their own filesystem", not a copy of
750
+ the snippet above.
751
+
752
+ **Beat C — the tester edits `.skillmapignore` (NOT the agent).**
607
753
 
608
- Once they confirm, ask them to stop the server with **Ctrl+C** in
609
- the terminal before continuing.
754
+ Per Inviolable rule #1, you DO NOT touch `.skillmapignore` with
755
+ your `Edit` tool. Tell the tester to do it from their editor:
756
+
757
+ > Last step. Open `.skillmapignore` (it's at the cwd root) in
758
+ > your editor of choice. At the end of the file, on a new line,
759
+ > append:
760
+ >
761
+ > ```
762
+ > notes/private-*.md
763
+ > ```
764
+ >
765
+ > Save the file. The pattern uses a glob (same as `.gitignore`):
766
+ > `notes/private-*.md` matches `private-credentials.md` and any
767
+ > future sibling `private-*.md`. A literal path
768
+ > (`notes/private-credentials.md`) would also work — the glob
769
+ > teaches the broader habit.
770
+ >
771
+ > Watch the browser when you save. The
772
+ > `notes/private-credentials` node should disappear from the
773
+ > graph in real time, without restarting anything. Six nodes
774
+ > back to five.
775
+ >
776
+ > Did the node vanish?
777
+
778
+ After they confirm, you MAY use `Read` on `.skillmapignore` to
779
+ verify the appended pattern landed correctly (in case
780
+ `sm check` later reports something odd) — that is read-only and
781
+ allowed. Once confirmed, ask them to stop the server with
782
+ **Ctrl+C** in the terminal before continuing.
610
783
 
611
784
  Mark `3-ui-live: done`.
612
785
 
@@ -678,7 +851,8 @@ process trying to bind the same port and confusing the tester.
678
851
  >
679
852
  > Expected: the `demo-skill → demo-agent` connector disappears. If
680
853
  > `demo-agent.md` ends up with no one linking to it, it shows up as
681
- > an orphan (we'll exploit this in stage L4).
854
+ > an orphan (we'll create a similar dangling situation in stage L4
855
+ > to see how `sm check` flags it).
682
856
 
683
857
  You verify by reading `.claude/skills/demo-skill/SKILL.md` to confirm
684
858
  the change was applied. Once they confirm, ask them to **Ctrl+C**
@@ -695,8 +869,9 @@ sm check
695
869
  ```
696
870
 
697
871
  Expected: you see the 5 fixture nodes listed with their kind;
698
- `check` reports the broken-link issue in `notes/todo.md` pointing
699
- at `missing-page.md`.
872
+ `check` runs the deterministic rules and reports a clean fixture
873
+ (no issues at this point — we will plant one in stage L4 and watch
874
+ the rule catch it).
700
875
 
701
876
  ### Stage L3 — ASCII: graph + export (~3 min)
702
877
 
@@ -713,10 +888,18 @@ or json.
713
888
 
714
889
  ### Stage L4 — Issues: broken refs (~3 min)
715
890
 
716
- The fixture has a deliberate broken link in `notes/todo.md`
717
- pointing at `notes/missing-page.md`. skill-map flags it as a
718
- **`broken-ref` issue** (not a graph connector, not an "orphan" —
719
- those are different concepts).
891
+ `broken-ref` is one of the deterministic rules `sm check` runs.
892
+ We'll plant one and watch it surface — that's the easiest way to
893
+ internalise that it is an **issue** on a node, NOT a graph
894
+ connector and NOT the same thing as an "orphan".
895
+
896
+ Ask the tester to **append one bullet** to `notes/todo.md`:
897
+
898
+ ```markdown
899
+ - [ ] Document the [flow diagram](./missing-page.md).
900
+ ```
901
+
902
+ `./missing-page.md` deliberately doesn't exist. Save the file.
720
903
 
721
904
  ```bash
722
905
  sm check
@@ -727,7 +910,9 @@ sm check --json
727
910
  Expected: the warning surfaces the dangling link from
728
911
  `notes/todo.md` to the non-existent `missing-page.md`. The
729
912
  `--rules` filter lets you focus on a single issue type; `--json`
730
- emits the structured payload (useful for CI / scripting).
913
+ emits the structured payload (useful for CI / scripting). When
914
+ done, the tester can leave the bullet in place or delete it — the
915
+ rest of the deep-dive doesn't depend on it.
731
916
 
732
917
  > **Heads up about scope** (mention only if the tester asks):
733
918
  >
@@ -845,7 +1030,7 @@ the cwd, start like this (do NOT repeat pre-flight from scratch):
845
1030
 
846
1031
  If they pick "start over", confirm explicitly. Only after
847
1032
  confirmation, delete the tutorial files in the cwd
848
- (`tutorial-state.yml`, `findings.md`, `.skill-mapignore`, `.claude/`,
1033
+ (`tutorial-state.yml`, `findings.md`, `.skillmapignore`, `.claude/`,
849
1034
  `notes/`, `.skill-map/`, and any `export.*`, `dump.sql`, or
850
1035
  `sm-tutorial-report.md` that may have been left behind) and start
851
1036
  everything from pre-flight.