Skip to content

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

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

docs: zero-to-hero tutorial + reference + AgentSkill (takeover of #63)#138
vpavlin wants to merge 12 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

Jimmy Claw and others added 11 commits March 9, 2026 19:42
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add an AgentSkill that provides SPEL framework knowledge for building,
deploying, and interacting with LEZ on-chain programs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updates PR #63's docs to match post-rename, post-arg-parsing-refactor
`spel` CLI. Jimmy is unavailable — taking over the branch.

- Rename lez-cli → spel, lez_cli → spel_cli, lez-client-gen → spel-client-gen,
  lez-framework[-core|-macros] → spel-framework[-core|-macros], and type
  names LezOutput/LezError/LezResult/LezIdl → Spel* across all added docs.
  Keeps LEZ (the zone name), lez-multisig (the external repo), and the
  macro names #[lez_program]/#[instruction]/#[account] as-is.
- Document spel.toml config discovery with [program] and [programs.<name>]
  forms in cli.md, tutorial.md (Step 8), skill cli-ref.md, quickstart.md,
  and SKILL.md. Note that `init` scaffolds one by default.
- Document --dry-run[=text|json] — full tx resolution output, JSON mode
  suppresses preamble, u128/nonce precision note, example output.
- Add `--` separator explanation and update every multi-flag example.
- --program now accepts NAME|HEX|FILE (from spel.toml name, raw program ID,
  or binary path); mark --program-id deprecated.
- Document PDA seed-input display (`seeds: [program_id, "state", ...]`)
  in the pda section and dry-run text output.
- Resolve fryorcraken's scaffold/init ambiguity (cli.md:37) with an
  inline note that "scaffolding" and `init` are the same operation.
- Fix `cargo install --path spel` → `cargo install --path spel-cli`.

Co-Authored-By: Jimmy <vaclav.pavlin+jimmy@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Walked the tutorial against a live sequencer (spel init → make build →
make setup → make deploy → initialize → increment → inspect). Fixes
every bug that surfaced plus a few I missed in the takeover pass.

Tutorial (docs/tutorial.md):
- Renumber to 7 steps (merged Define State + Write Instructions into
  one "Write the Program" step; merged IDL/CLI-wrapper setup into
  "Build and Generate IDL").
- Add `spel.toml` to the Step 1 directory tree; explain its role.
- Move CounterState into the guest file with `#[account_type]` at file
  top level (not inside `mod { }` — the IDL generator only scans
  top-level items). Drop the `_core` crate from the tutorial path; it's
  noted as optional for genuinely-shared host-side types.
- Switch handlers from deprecated
  `SpelOutput::states_only(vec![AccountPostState::new_claimed(acc, Claim::Authorized), …])`
  to idiomatic `SpelOutput::execute(vec![acc, …], vec![])`. The macro
  reads `#[account(init|mut|signer)]` and emits the correct claim.
- Add `mut counter: AccountWithMetadata` where handlers write
  account.account.data.
- Drop `use nssa_core::…` imports — everything needed is in
  `spel_framework::prelude::*` (AccountWithMetadata, SpelOutput,
  SpelError, Claim, AccountPostState, AutoClaim, BorshSerialize,
  BorshDeserialize).
- Add CounterState `BorshSerialize + BorshDeserialize` derives.
- Use `spel generate-idl` instead of `make idl` in Step 4; explain why
  (proc-macro path currently skips `#[account_type]` markers — see
  follow-up issue).
- Update expected IDL sample with top-level `accounts` entry for
  CounterState, plus empty `errors` and `types`.
- Add a "Read the count back" subsection demonstrating
  `spel inspect "$(spel pda counter)" --type CounterState` with
  realistic decoded JSON output.
- CLI flags: `--owner-account` → `--owner`, `--members-account` →
  `--members`, etc. (the `-account` suffix was removed in 021061d).
- Correct the `spel pda` description: it prints only the base58 address.
  The `seeds: [...]` line is rendered during dry-run / live tx output,
  not by the standalone subcommand.
- Fix `spel_cli::run()` → `spel::run()` (crate is named `spel`).
- Chained-call example now uses `SpelOutput::execute(accounts, calls)`.

Reference files (docs/reference/*.md):
- cli.md: `spel_cli::run` → `spel::run`, `--<account>-account` →
  `--<account>` everywhere.
- types.md: mark `states_only` and `with_chained_calls` as deprecated
  in the methods table; rewrite the example to use `execute`; update
  `AccountPostState` / `ChainedCall` prose.
- macros.md: rewrite the sample handler to use `execute`; update the
  `init` attribute row to describe auto-claim behaviour.

Skill (skills/spel/):
- SKILL.md: recommend `SpelOutput::execute` in "Return values"; drop
  `--owner-account` in the description; update the `init` critical-rule
  wording.
- quickstart.md: rewrite Section 2 (drop `_core` for state), Section 3
  (modern handler pattern with `#[account_type]`), Section 9 CLI
  examples (`--owner`, no seed-display claim on `pda`, add
  `inspect --type`).
- cli-ref.md: `--<account>-account` → `--<account>`; correct the `pda`
  subcommand's output description.
- gotchas.md: rewrite the "Return ALL accounts" example with `execute`;
  replace the `new_claimed vs new` + `new_claimed_if_default` sections
  with a single "Let the macro derive claims" section explaining the
  auto-claim model.

README.md:
- `spel_cli::run()` → `spel::run()`.
- Writing-Programs example: switch to `execute(…)` pattern, drop
  `nssa_core::…` imports, update the prelude-contents note.
- Account-attributes table: update the `init` row to describe
  auto-claim.
- Makefile example: `--owner-account` → `--owner`, add `--` separator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vpavlin vpavlin force-pushed the docs/tutorial-reference-takeover branch from 186ed4a to 1f81834 Compare May 18, 2026 10:04
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