Skip to content

feat(cli): user-friendly first-run — hello, doctor, friendlier errors - #31

Merged
slavazeph-coder merged 1 commit into
mainfrom
claude/crumb-v1.3-spec-YCqPD
May 5, 2026
Merged

feat(cli): user-friendly first-run — hello, doctor, friendlier errors#31
slavazeph-coder merged 1 commit into
mainfrom
claude/crumb-v1.3-spec-YCqPD

Conversation

@slavazeph-coder

Copy link
Copy Markdown
Contributor

Summary

Three additions aimed at first-touch friction. No wire-format change. All additive — every existing flag and command keeps working.

This PR stacks cleanly on top of #29 (1.0.0) and #30 (integrations); landing order doesn't matter (different files).

What's new

crumb hello — 30-second walkthrough

Lands a brand-new install at "I have a working crumb in my clipboard" with zero flags. Builds a sample task crumb, validates it, copies it, prints three concrete next steps.

$ crumb hello --no-clipboard
Welcome to CRUMB — the copy-paste AI handoff format.

Here's a working crumb (kind=task, v=1.3):

  BEGIN CRUMB
  v=1.3
  kind=task
  title=My first crumb
  source=crumb hello
  ---
  [goal]
  Switch AIs without losing context
  ...
  END CRUMB

(clipboard skipped: --no-clipboard)

Next steps:
  crumb new task --goal "<your real goal>"   # make your own
  crumb handoff <file.crumb>                  # send via clipboard
  crumb doctor                                # check your install
  crumb --help-all                            # see every command

crumb doctor — install diagnostic

Reports Python version, validator presence, clipboard tool, Palace state, Claude Code integration, MCP registration. Always exits 0 (informational), warnings are advisory so it can run in CI without flaking.

$ crumb doctor
crumb doctor — version 0.11.0

Runtime:
  [ok  ] Python 3.11.15
  [ok  ] Python validator  — /…/validators/validate.py
  [ok  ] Node validator (optional)  — /…/validators/validate.js

Clipboard:
  [WARN] clipboard tool  — install one of: xclip, xsel, wl-copy

Optional integrations:
  [WARN] Palace (this directory)  — run `crumb palace init` to enable memory
  [ok  ] Claude Code integration  — not installed (~/.claude not present)
  [ok  ] MCP server entry  — not registered (optional)

Run `crumb hello` for a 30-second walkthrough.

Friendlier argparse errors

_FriendlyArgumentParser subclasses ArgumentParser and appends a one-line pointer to --help and crumb hello after argparse's terse "the following arguments are required" / "invalid choice" messages. Propagates to every subparser via parser_class=; no per-subcommand wiring needed.

$ crumb new
usage: crumb new [-h] [--title TITLE] ...
crumb new: error: the following arguments are required: kind

  try `crumb new --help` for this command's options, or `crumb hello` for a 30-second walkthrough.

Help text update

Top-level --help now leads with hello and doctor so new users see the walkthrough as the obvious first step:

Core commands:

  hello      30-second walkthrough — copies a working sample crumb.
  doctor     Check your install and surface missing dependencies.
  new        Create a new .crumb file.
  validate   Check that a .crumb file is well-formed.
  handoff    Copy a .crumb to clipboard for pasting into an AI.
  receive    Read a .crumb from clipboard or file.
  lint       Run safety / quality / deadline checks.

--help-all adds them under a Setup: group alongside init, hooks, context, pack.

Test plan

  • python3 -m pytest tests/ -q629 passing (was 614; +15 in tests/test_user_friendly.py)
  • crumb hello --no-clipboard emits a v=1.3 task crumb that round-trips through parse_crumb
  • crumb doctor exits 0 with all warnings (informational)
  • crumb validate (no args) shows the friendly hint pointing at crumb hello
  • crumb new frogpile (invalid choice) shows the friendly hint
  • Bare crumb still shows core help and exits 0

Stats

3 files changed, +388 / -3.

File Change
cli/crumb.py +cmd_hello, +cmd_doctor, +_FriendlyArgumentParser, register subparsers, update --help text
tests/test_user_friendly.py new — 15 tests across 4 classes
CHANGELOG.md new "Unreleased" section

Out of scope

Sequencing with #29 and #30

Disjoint files. Any merge order works. Once #29 lands the version bump to 1.0.0, crumb doctor will report 1.0.0 automatically (it reads CLI_VERSION).

https://claude.ai/code/session_01Ewf1noyQc9gc6DmohyR32z


Generated by Claude Code

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

✅ Shadow AI Scan

No Shadow AI findings detected at or above medium risk.

github-actions Bot added a commit that referenced this pull request May 3, 2026
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

CRUMB Bench Results

File Score Grade Tokens Compression
./.crumb N/A - - -
./.crumb/latest.crumb N/A - - -
./CODEX_HANDOFF_0.4.0.crumb 58/100 C ~1985 1.6x
./crumbs/map.crumb 79/100 B ~269 1.6x
./crumbs/mem.crumb 80/100 B ~225 1.7x
./examples/halo-trace-to-log.crumb 84/100 B ~155 2.0x
./examples/log-deployment.crumb 84/100 B ~147 2.0x
./examples/map-client-takeover.crumb 78/100 B ~290 1.6x
./examples/map-repo-onboarding.crumb 82/100 B ~166 1.7x
./examples/mem-mempalace-auth-migration.crumb 87/100 A ~120 2.5x
./examples/mem-terse-output.crumb 77/100 B ~336 1.6x
./examples/mem-user-preferences.crumb 83/100 B ~135 1.8x
./examples/task-bug-fix.crumb 83/100 B ~127 1.7x
./examples/task-content-repurpose-handoff.crumb 80/100 B ~250 1.7x
./examples/task-cross-tool-feature-handoff.crumb 79/100 B ~249 1.6x
./examples/task-feature-continuation.crumb 82/100 B ~134 1.7x
./examples/task-packed-auth-context.crumb 82/100 B ~233 2.0x
./examples/todo-sprint.crumb 84/100 B ~90 1.7x
./examples/v12-content-ref.crumb 82/100 B ~193 1.8x
./examples/v12-delta.crumb 78/100 B ~344 1.8x
./examples/v12-fold.crumb 61/100 C ~317 1.4x
./examples/v12-handoff.crumb 80/100 B ~204 1.4x
./examples/v12-priority.crumb 79/100 B ~254 1.6x
./examples/v12-refs.crumb 82/100 B ~182 1.8x
./examples/v12-typed-content.crumb 80/100 B ~218 1.5x
./examples/v13-agent.crumb 82/100 B ~167 1.7x
./examples/v13-checks.crumb 80/100 B ~165 1.3x
./examples/v13-fold-priority.crumb 64/100 C ~223 1.4x
./examples/v13-guardrails.crumb 80/100 B ~205 1.5x
./examples/v13-handoff-deps.crumb 80/100 B ~201 1.6x
./examples/v13-script.crumb 80/100 B ~169 1.4x
./examples/v13-workflow.crumb 81/100 B ~178 1.6x
./examples/v14-handoff-deadlines.crumb 79/100 B ~290 1.7x
./examples/v14-release-gate.crumb 79/100 B ~295 1.8x
./examples/v14-typed-checks.crumb 80/100 B ~223 1.5x
./examples/wake-session.crumb 84/100 B ~195 2.2x
./fixtures/extensions/mempalace-export.crumb 86/100 A ~102 2.3x
./fixtures/extensions/task-packed.crumb 85/100 B ~157 2.3x
./fixtures/invalid/bad-kind.crumb N/A - - -
./fixtures/invalid/missing-source.crumb N/A - - -
./fixtures/valid/agent-basic.crumb 80/100 B ~51 1.1x
./fixtures/valid/log-basic.crumb 82/100 B ~51 1.4x
./fixtures/valid/mem-basic.crumb 81/100 B ~42 1.2x
./fixtures/valid/task-basic.crumb 81/100 B ~65 1.2x
./fixtures/valid/v13-checks.crumb 81/100 B ~74 1.2x
./fixtures/valid/v13-handoff-deps.crumb 82/100 B ~93 1.3x

Powered by crumb-format — two-stage context compression

Three additions aimed at first-touch friction. No wire-format change.

- `crumb hello`: 30-second walkthrough. Builds a sample task crumb,
  validates it, copies to clipboard if a tool is available, prints
  three concrete next steps. Designed for "fresh install → working
  crumb in clipboard" with zero flags. `--no-clipboard` skips copy.

- `crumb doctor`: install diagnostic. Checks Python version, validator
  presence, clipboard tool, Palace state, Claude Code integration, MCP
  registration. Always exits 0 (informational), warnings are advisory.

- `_FriendlyArgumentParser`: subclasses ArgumentParser to append a
  one-line pointer to `--help` and `crumb hello` after argparse's
  terse "the following arguments are required" / "invalid choice"
  errors. Propagates to all subparsers via `parser_class=`; no
  per-subcommand wiring needed.

Top-level `--help` now leads with `hello` and `doctor` so new users
see the walkthrough as the obvious first step.

15 new tests in test_user_friendly.py cover hello validity, doctor
output sections, argparse hint firing, and help-text mentions.

Tests: 629 passing (was 614).

https://claude.ai/code/session_01Ewf1noyQc9gc6DmohyR32z
@slavazeph-coder
slavazeph-coder force-pushed the claude/crumb-v1.3-spec-YCqPD branch from fd31ef3 to 24a8d6e Compare May 5, 2026 17:31
@slavazeph-coder
slavazeph-coder marked this pull request as ready for review May 5, 2026 17:31
@slavazeph-coder
slavazeph-coder merged commit 02a5716 into main May 5, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24a8d6e034

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cli/crumb.py
Comment on lines +5528 to +5530
elif system == "Linux":
candidates = ["xclip", "xsel", "wl-copy"]
else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove unsupported wl-copy from doctor success criteria

crumb doctor currently marks clipboard support as OK when only wl-copy is installed, but _copy_to_clipboard() never attempts wl-copy (it only tries xclip/xsel on Linux). On Wayland systems that have wl-copy but not X11 tools, this produces a false positive diagnostic: doctor reports clipboard ready, while crumb hello/crumb handoff still fail to copy. Either add wl-copy support to _copy_to_clipboard() or stop treating it as a valid tool here.

Useful? React with 👍 / 👎.

slavazeph-coder added a commit that referenced this pull request May 8, 2026
First post-1.0 minor. No wire-format change (stays at v=1.4).
Semver-minor: adds Cursor integration (PR #32), three top-level CLI
commands (PR #31: hello, doctor, friendlier argparse errors),
--dry-run on installers, stale-doc cleanup.

CLI_VERSION → 1.1.0. pyproject.toml version → 1.1.0.

673 tests passing. 39/39 examples + fixtures green on Python and Node.
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.

2 participants