# The book ToC: the single source of every part and chapter.
# The orchestrator (SKILL.md) renders the menu from this and routes
# each chapter id to its part's step_file. One ordered sequence; the
# reading order is `order`. Add content by adding a chapter here (and
# its body in the part's step_file), or a whole new part-<id>.md plus
# a row below. Keep chapter-id prefixes matching the step_file so
# dispatch stays mechanical.
#
# Per-part fields:
#   order        reading position in the book (ascending).
#   title        English; the orchestrator translates per _core.md.
#   step_file    the part's chapter library under references/.
#                Omitted on `status: planned` parts (not yet written,
#                not shown in the menu).
#   step_files   list form when a part spans several files; dispatch
#                by chapter-id prefix.
#   pace         per-step | auto-advance  (see _core.md per-step cycle).
#   preflight    taught-init | backstage-init | portfolio-init | seed
#                (see _core.md rule #1 + SKILL.md §Entering a part).
#   seed         which snapshot to fast-forward to when this part is
#                entered out of order (see fixtures.md §Seed snapshot:*).
#                Campaign parts use a cumulative portfolio snapshot;
#                `cli` uses the standalone `prologue-built` demo.
#   prereq       recommended predecessor. Gates the menu ONLY for a part
#                with NO `seed`; a seedable part is always shown (its
#                seed bridges the gap, predecessors get marked `skipped`).
#   fixture      which fixture this part lays (see fixtures.md / the
#                part body); `inline` means the chapters lay it as a
#                taught step.
#   track        which capability track shows this part (see _core.md
#                §Provider detection): `rich` (claude/codex: agent +
#                command + slash + `@`), `basic` (the open-standard
#                family agent-skills/antigravity: skill + markdown,
#                connected by markdown references), or `both` (renders
#                lens-aware, slash/`@` on rich, references on basic).
#                The menu shows only parts whose track is the resolved
#                `tutorial.track` or `both`.
#   status       active (default, shown) | planned (no body yet, hidden).

parts:
  # ----- migrated content (ships in this release) -----

  - id: fundamentals
    order: 0
    title: "The live map (prologue)"
    step_file: part-fundamentals.md
    pace: per-step
    preflight: taught-init
    fixture: inline           # the chapters lay the basics fixture as taught steps
    track: rich               # claude/codex prologue: agent/command kinds, slash + @ connectors
    status: active
    chapters:
      - id: init            ; title: "Your first node (sm init, sm, the UI)" ; est_min: 2
      - id: kinds           ; title: "The other kinds appear"               ; est_min: 1
      - id: first-edit      ; title: "Your first edit (the watcher reacts)" ; est_min: 1
      - id: connectors      ; title: "The connectors light up"             ; est_min: 1
      - id: inspector       ; title: "The inspector and connections"       ; est_min: 1
      - id: edit-link       ; title: "Edit a link, the topology changes"   ; est_min: 2
      - id: workspace       ; title: "Navigate the workspace (files, search, isolate)" ; est_min: 1
      - id: ignore          ; title: "Silence a file via .skillmapignore"  ; est_min: 1

  - id: basic-fundamentals
    order: 0
    title: "The live map (prologue)"
    step_file: part-basic-fundamentals.md
    pace: per-step
    preflight: taught-init    # same flavour as `fundamentals`; the boot node is demo-skill on the basic track
    fixture: inline           # the chapters lay the basics fixture (skill + markdown only) as taught steps
    track: basic              # open-standard family: skill + markdown, connected by markdown references
    status: active
    chapters:
      - id: init            ; title: "Your first node (sm init, sm, the UI)" ; est_min: 2
      - id: kinds           ; title: "Skills and notes appear"             ; est_min: 1
      - id: first-edit      ; title: "Your first edit (the watcher reacts)" ; est_min: 1
      - id: connectors      ; title: "Connect with references (markdown links)" ; est_min: 1
      - id: inspector       ; title: "The inspector and connections"       ; est_min: 1
      - id: edit-link       ; title: "Edit a link, the topology changes"   ; est_min: 2
      - id: workspace       ; title: "Navigate the workspace (files, search, isolate)" ; est_min: 1
      - id: ignore          ; title: "Silence a file via .skillmapignore"  ; est_min: 1

  - id: extend
    order: 6
    title: "Extend skill-map with plugins"
    # Spans three chapter libraries; dispatch by chapter-id prefix:
    #   settings-*  -> part-settings.md
    #   tour-*      -> part-plugins.md
    #   authoring-* -> part-authoring.md
    step_files:
      - part-settings.md
      - part-plugins.md
      - part-authoring.md
    pace: auto-advance
    preflight: backstage-init  # lays the fixture below + sm init --no-scan
    fixture: master            # master-agent / master-skill / notes/ideas (fixtures.md)
    track: both                # settings / plugins / authoring are lens-agnostic
    status: active
    chapters:
      - id: settings-1-layers        ; title: "The config layers and `sm config list`" ; est_min: 3
      - id: settings-2-resolve       ; title: "Read, resolve, and set a value with `sm config`" ; est_min: 3
      - id: settings-3-lens          ; title: "The active provider lens (`activeProvider`)" ; est_min: 3
      - id: tour-1-intro             ; title: "How plugins work" ; est_min: 3
      - id: tour-2-kinds             ; title: "The six extension kinds" ; est_min: 4
      - id: tour-3-explore           ; title: "Explore one extension up close" ; est_min: 3
      - id: authoring-1-scaffold     ; title: "`sm plugins create extractor demo-highlight`" ; est_min: 2
      - id: authoring-2-anatomy      ; title: "Tour the scaffold (plugin.json + stubs + README)" ; est_min: 3
      - id: authoring-3-edit-setting ; title: "Edit a setting (string-list) and observe it in the UI" ; est_min: 3
      - id: authoring-4-edit-slot    ; title: "Change the view-slot the contribution targets" ; est_min: 2
      - id: authoring-5-doctor-author ; title: "Catch a manifest mistake with `sm plugins doctor`" ; est_min: 2

  - id: cli
    order: 5
    title: "The CLI for you and your agent"
    step_file: part-cli.md
    pace: auto-advance
    preflight: seed            # self-seeds the Part 0 demo fixture
    seed: prologue-built       # the prologue demo fixture (not the cumulative portfolio)
    prereq: fundamentals       # recommended predecessor; cli self-seeds, so it is always shown
    track: both                # CLI verbs are lens-agnostic; prose notes lens-specific node counts
    status: active
    chapters:
      - id: browse           ; title: "list / show / check" ; est_min: 2
      - id: graph-export     ; title: "graph / export (query, formatters)" ; est_min: 2
      - id: issues           ; title: "Issues and broken refs (--analyzers, --json)" ; est_min: 2
      - id: annotations      ; title: "Annotations and the .sm consent prompt" ; est_min: 3
      - id: reference-paths  ; title: "Validate links to folders outside the scan scope" ; est_min: 3

  # ----- the portfolio campaign (the spine's real project) -----
  # Each part builds on the prior one's accumulated harness. Run in
  # order it just continues; entered out of order, `preflight: seed`
  # fast-forwards the project to the part's `seed` snapshot (see
  # SKILL.md §Entering a part + fixtures.md §Seed snapshot:*), so any
  # part is reachable directly from the menu.

  - id: project-kickoff
    order: 1
    title: "The harness from zero"
    step_file: part-project-kickoff.md
    pace: per-step
    preflight: portfolio-init   # lays the Express skeleton + AGENTS.md; clears the prologue demo fixture if present
    fixture: portfolio
    track: rich                 # uses the agent kind; basic track has its own counterpart
    status: active
    chapters:
      - id: kickoff     ; title: "Start the portfolio (sm init on the real skeleton)" ; est_min: 2
      - id: manual      ; title: "The handbook (AGENTS.md) and CLAUDE.md" ; est_min: 2
      - id: first-agent ; title: "The first harness agent (content-editor)" ; est_min: 2
      - id: real-kinds  ; title: "The real kinds in context" ; est_min: 1
      - id: check-links ; title: "The check-links skill" ; est_min: 1
      - id: publish     ; title: "The /publish command invokes the skill" ; est_min: 2
      - id: links       ; title: "Mentions (@) and references between assets" ; est_min: 2
      - id: confidence  ; title: "Connector confidence (opacity = certainty)" ; est_min: 2

  - id: daily-loop
    order: 2
    title: "The daily loop (add, improve, publish)"   # the campaign finale
    step_file: part-daily-loop.md
    pace: auto-advance
    preflight: seed
    seed: harness-connected   # fast-forward to here if project-kickoff is not done
    prereq: project-kickoff
    fixture: portfolio        # reuses the wired harness; lays the pretty site (style.css + pages) as taught steps
    track: rich               # agent-driven page add + reserved command; basic track has its own counterpart
    status: active
    chapters:
      - id: setup            ; title: "Make it yours and bring it up" ; est_min: 4
      - id: add-page         ; title: "Add a page with your agent" ; est_min: 3
      - id: broken-ref       ; title: "A rename breaks a link" ; est_min: 3
      - id: reserved         ; title: "A reserved name collides" ; est_min: 2
      - id: publish          ; title: "Ship it: run /publish for real" ; est_min: 3
      - id: stability        ; title: "Set a node's stability (and the `.sm` sidecar)" ; est_min: 3
      - id: golive           ; title: "Your website, live next to the graph" ; est_min: 3

  - id: realtime
    order: 3
    title: "Real time: watch your agent run"
    step_file: part-realtime.md
    pace: per-step
    preflight: seed            # fast-forwards to the connected portfolio, same flavour as `daily-loop`
    seed: harness-connected    # the campaign project (the portfolio), NOT the prologue demo
    prereq: project-kickoff    # recommended predecessor (basic track: basic-kickoff); realtime seeds, so it is always shown
    fixture: portfolio         # reuses the wired harness the campaign built
    track: both                # hook install + consent are lens-agnostic; the part body carries
                               # per-provider trigger deltas and gates the pure agent-skills lens
                               # (no runtime to hook) with an in-part note, not a menu filter
    status: active
    chapters:
      - id: wire          ; title: "Wire the real-time hook" ; est_min: 3
      - id: live          ; title: "Restart and watch nodes light up" ; est_min: 3
      - id: conversations ; title: "Capture agent conversations (opt-in)" ; est_min: 3

  - id: ai-layer
    order: 4
    title: "The AI layer: your agent works the map"
    step_file: part-ai-layer.md
    pace: per-step
    preflight: seed            # fast-forwards to the flawed portfolio (the campaign project + planted-flaw docs)
    seed: flawed-portfolio     # harness-connected PLUS the ai-flaws docs; in-order entry still lays ai-flaws (see SKILL.md)
    prereq: realtime           # recommended predecessor (leaves the agent wired); ai-layer seeds, so it is always shown
    fixture: portfolio         # the campaign project again; the flawed docs ride on top
    track: both                # UI-only flows are lens-agnostic; the part body carries the
                               # per-provider invocation / MCP-registration deltas and gates the
                               # pure agent-skills lens (no runtime to park on the processing
                               # skill) with an in-part note, not a menu filter
    status: active
    chapters:
      - id: two-kinds     ; title: "Two kinds of judgment" ; est_min: 3
      - id: agent-circuit ; title: "The queue and the agent that answers it" ; est_min: 6
      - id: first-action  ; title: "Your first AI action" ; est_min: 4
      - id: finders       ; title: "Finders record findings" ; est_min: 5
      - id: fixers        ; title: "Fixers and human decisions" ; est_min: 6
      - id: tagger        ; title: "The tagger proposes, you decide" ; est_min: 4
      - id: security-lane ; title: "The security lane never obeys the document" ; est_min: 5

  # ----- the basic-track campaign (the Agent Skills open standard; vendors like Antigravity build on it) -----
  # Mirrors the rich campaign arc with skill + markdown only, connected by
  # markdown references. Same fixtures (portfolio / harness) laid under the
  # `agent-skills` lens, which renders the agent/command nodes as skills.

  - id: basic-kickoff
    order: 1
    title: "The harness from zero"
    step_file: part-basic-kickoff.md
    pace: per-step
    preflight: portfolio-init
    fixture: portfolio
    track: basic
    status: active
    chapters:
      - id: kickoff      ; title: "Start the portfolio (sm init on the real skeleton)" ; est_min: 2
      - id: manual       ; title: "The handbook (AGENTS.md) and an entry pointer" ; est_min: 2
      - id: first-skill  ; title: "The first harness skill (content-editor)" ; est_min: 2
      - id: real-kinds   ; title: "The kinds in context" ; est_min: 2
      - id: check-links ; title: "The link checker" ; est_min: 2
      - id: publish     ; title: "The publish skill references the harness" ; est_min: 3
      - id: links       ; title: "The handbook becomes the hub (references)" ; est_min: 3
      - id: confidence  ; title: "Connector confidence (opacity = certainty)" ; est_min: 2

  - id: basic-daily
    order: 2
    title: "The daily loop (add, improve, publish)"
    step_file: part-basic-daily.md
    pace: auto-advance
    preflight: seed
    seed: harness-connected
    prereq: basic-kickoff
    fixture: portfolio
    track: basic
    status: active
    chapters:
      - id: setup       ; title: "Make it yours and bring it up" ; est_min: 4
      - id: add-page    ; title: "Add a page with your skill" ; est_min: 3
      - id: broken-ref  ; title: "A rename breaks a link" ; est_min: 3
      - id: reserved    ; title: "A reserved name collides" ; est_min: 4
      - id: publish     ; title: "Ship it: run the publish skill for real" ; est_min: 3
      - id: stability   ; title: "Set a node's stability (and the `.sm` sidecar)" ; est_min: 3
      - id: golive      ; title: "Your website, live next to the graph" ; est_min: 3

findings_file: "./findings.md"
