Skip to content

docs: zero-to-hero tutorial + reference + AgentSkill (takeover of #63) - #138

Open
vpavlin wants to merge 4 commits into
mainfrom
docs/tutorial-reference-takeover
Open

docs: zero-to-hero tutorial + reference + AgentSkill (takeover of #63)#138
vpavlin wants to merge 4 commits into
mainfrom
docs/tutorial-reference-takeover

Conversation

@vpavlin

@vpavlin vpavlin commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Takes over #63 (author unavailable) and refreshes every added doc to match the current spel CLI. The original commits from @jimmy-claw are preserved on this branch; a single takeover commit sits on top with Jimmy as Co-Authored-By.

Closes #63.

What changed vs #63

Between March (when Jimmy wrote the docs) and now, v0.2.0 shipped with a large CLI overhaul. The docs on #63 still referenced the old lez-cli world. This PR fixes that:

  • Naminglez-cli → spel, lez_cli → spel_cli, lez-client-gen → spel-client-gen, lez-framework[-core|-macros] → spel-framework[-core|-macros], LezOutput/LezError/LezResult/LezIdl → Spel* across every added file. Kept LEZ (the zone), lez-multisig (the external repo), and the macro names #[lez_program]/#[instruction]/#[account] as-is.
  • spel.toml config — new [program] / [programs.<name>] discovery is now documented in cli.md, the tutorial's Step 8, the skill's cli-ref.md, quickstart.md, and SKILL.md. Also noted that init scaffolds a spel.toml by default (verified in spel-cli/src/init.rs).
  • --dry-run[=text|json] — covers full-tx resolution output, JSON mode suppressing preamble, and the u128/nonce decimal-string precision note. Includes example text and JSON output blocks that match spel-cli/src/tx.rs.
  • -- separator — every multi-flag example now uses -- when mixing global flags with instruction flags; added an explicit "Invocation Syntax" section plus a gotcha entry explaining why.
  • --program <NAME|HEX|FILE> — documented the three-way resolution. --program-id is marked deprecated.
  • PDA seed displaypda section and dry-run examples show the seeds: [program_id, "state", Account(x), Arg(y)] output format.
  • fryorcraken's unresolved comment on cli.md:37 — resolved inline: the init section now explicitly says "scaffolding" and init refer to the same operation.
  • Minor fixcargo install --path spelcargo install --path spel-cli # installs as the spel binary.

Files touched

docs/reference/README.md             |   6 +-
docs/reference/cli.md                | 247 +++++++++++++++++++++++++++-------
docs/reference/client-gen.md         |  14 +-
docs/reference/idl.md                |   6 +-
docs/reference/macros.md             |  42 +++---
docs/reference/types.md              |  34 ++---
docs/tutorial.md                     | 164 +++++++++++++++-----
skills/spel/SKILL.md                 |  16 +--
skills/spel/references/cli-ref.md    | 109 +++++++++++----
skills/spel/references/gotchas.md    |  33 ++++-
skills/spel/references/quickstart.md |  58 ++++----

Test plan

  • Reviewer sanity-checks docs/reference/cli.md against spel --help on main
  • Reviewer confirms the dry-run example output blocks match spel-cli/src/tx.rs render functions (print_dry_run_text / print_dry_run_json)
  • Reviewer walks through tutorial Steps 7-8 with the scaffolded spel.toml against a real program
  • grep -rnE "lez-cli|lez_cli|lez-client-gen|lez-framework|LezOutput|LezError|LezResult|LezIdl" docs/ skills/ returns no matches

🤖 Generated with Claude Code

Adds a guided tutorial, a five-part reference (CLI, IDL, macros, types,
client-gen), and an AgentSkill for agent-driven SPEL work.

Verified end to end against a live LEZ v0.2.4 sequencer before publishing:
scaffold, the tutorial's program exactly as written, generate-idl, make
setup/deploy, initialize, increment, and `spel inspect <PDA> --type
CounterState` returning count 5.

Content is current with main as of #267, including the parts that landed
after this work was first written:
- witness exchange: --export, --co-signer, `spel sign`, `spel submit` (#246)
- `program-id` (the v0.5.0 rename of `inspect <FILE>`)
- --spel-git, and the flag-order rule for `init` (#255)
- private PDAs: --npk/--vpk and the v0.2.1 derivation formula (#256)
- a Claims section covering rule 7, ClaimedNonDefaultAccount and
  AccountAlreadyInitialized, and the ClaimedIfDefault a signer now emits (#262)
- chained calls as the supported way to touch accounts a program does not own

Originally opened as a takeover of #63.

Co-Authored-By: Jimmy Claw <jimmy@claw.dev>
Co-Authored-By: Vaclav Pavlin <vaclav.pavlin@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9qsH6Um6shweCPEN3Z6ph
@vpavlin
vpavlin force-pushed the docs/tutorial-reference-takeover branch from baafcb3 to d714ead Compare September 7, 2026 07:11
vpavlin and others added 3 commits September 7, 2026 10:22
Findings from handing the tutorial to a fresh agent with no SPEL context.

The tutorial claimed three times that `make idl` skips file-level
#[account_type] structs and that only `spel generate-idl` picks them up,
pointing at a placeholder issue link with no number. Tested all four
combinations on one project with both crates on the same framework commit:

  top-level  + spel generate-idl -> RegistryEntry
  top-level  + make idl          -> RegistryEntry
  in-module  + spel generate-idl -> RegistryEntry
  in-module  + make idl          -> RegistryEntry

The producers agree; the warning was wrong and is removed. Replaced with the
real caveat: guest and examples/ are separate crates with separate lockfiles,
so a version skew between them changes which framework generates the IDL (#269).

ProgramContext had zero mentions across every doc, yet `spel init` emits it in
the generated initialize — so a newcomer meets an unexplained parameter in
their own scaffolded code. Documented in macros.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9qsH6Um6shweCPEN3Z6ph
Swept the docs for confident assertions and tested the checkable ones.

Removed, verified against the codebase:
- `SpelOutput::states_only` and `with_chained_calls` were documented as
  available-but-deprecated. Neither exists in any Rust source; SpelOutput has
  only `execute` and `execute_with_claims`. Documented the latter instead.
- `into_parts` returns SpelOutputParts, not the tuple the table claimed.

Corrected in the AgentSkill gotchas:
- a gotcha about "empty string arguments dropped by logoscore" — logoscore is a
  different product and appears nowhere in SPEL; an empty string arg is passed
  through, verified by dry-run.
- "Account flags use --{name}-account suffix" — they are just `--{name}`;
  `spel initialize --owner <id>` is what works.
- "Instruction names transform: snake_case -> kebab-case" implied kebab is
  required. The CLI matches both:
  `snake_to_kebab(&ix.name) == cmd || ix.name == cmd`.

Checked and left alone: the `--` separator rule is correct — without it
`--value` is misparsed, confirmed by dry-run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9qsH6Um6shweCPEN3Z6ph
spel-client-gen accepts --target, --module-name and --ffi-lib-path; the
reference listed only --idl, --out-dir and --help.

Verified the rest of that page by running the tool against a real IDL: it
produces the documented client/ffi/header artifacts, emits one extern "C"
function per instruction taking a JSON string, and includes wallet_path.

Also checked and found accurate, so left alone:
- idl.md's schema (discriminator, execution, instruction_type, metadata, spec,
  variant, visibility are all real optional fields, absent from a simple
  program's IDL only because they are unused)
- every relative doc link resolves, and no anchor points at a missing heading

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9qsH6Um6shweCPEN3Z6ph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant