docs: zero-to-hero tutorial + reference + AgentSkill (takeover of #63)#138
Open
vpavlin wants to merge 12 commits into
Open
docs: zero-to-hero tutorial + reference + AgentSkill (takeover of #63)#138vpavlin wants to merge 12 commits into
vpavlin wants to merge 12 commits into
Conversation
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>
This was referenced Apr 24, 2026
186ed4a to
1f81834
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Takes over #63 (author unavailable) and refreshes every added doc to match the current
spelCLI. The original commits from @jimmy-claw are preserved on this branch; a single takeover commit sits on top with Jimmy asCo-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-cliworld. This PR fixes that:lez-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. KeptLEZ(the zone),lez-multisig(the external repo), and the macro names#[lez_program]/#[instruction]/#[account]as-is.spel.tomlconfig — new[program]/[programs.<name>]discovery is now documented incli.md, the tutorial's Step 8, the skill'scli-ref.md,quickstart.md, andSKILL.md. Also noted thatinitscaffolds aspel.tomlby default (verified inspel-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 matchspel-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-idis marked deprecated.pdasection and dry-run examples show theseeds: [program_id, "state", Account(x), Arg(y)]output format.cli.md:37— resolved inline: theinitsection now explicitly says "scaffolding" andinitrefer to the same operation.cargo install --path spel→cargo install --path spel-cli # installs as the spel binary.Files touched
Test plan
docs/reference/cli.mdagainstspel --helpon mainspel-cli/src/tx.rsrender functions (print_dry_run_text/print_dry_run_json)spel.tomlagainst a real programgrep -rnE "lez-cli|lez_cli|lez-client-gen|lez-framework|LezOutput|LezError|LezResult|LezIdl" docs/ skills/returns no matches🤖 Generated with Claude Code