Skip to content

feat: snapshot spaces into TSX recipes - #52

Merged
quick-ricon merged 3 commits into
mainfrom
quick/snapshot-tsx
May 10, 2026
Merged

feat: snapshot spaces into TSX recipes#52
quick-ricon merged 3 commits into
mainfrom
quick/snapshot-tsx

Conversation

@quick-ricon

Copy link
Copy Markdown
Contributor

Summary

  • add wp snapshot to bootstrap a starter WALLPAPERS.tsx from current macOS Spaces via butthair
  • support --json, --out, --force, and --include-windows for comments/diagnostics
  • hide tutorial module subtasks so only wp tutorial is public
  • update README task discovery to include namespace _default entrypoints and skip hidden tasks

Refs #50.

Verification

  • mise run test (26/26)
  • swift test (5/5)
  • codebase lint:mise-settings "$PWD"
  • codebase lint:bats-test-task "$PWD"
  • codebase lint:bats-test-helper "$PWD"
  • codebase lint:mcr-scope "$PWD"
  • codebase lint:or-true "$PWD"
  • codebase lint:shellcheck "$PWD"
  • bash -n .mise/tasks/snapshot .mise/tasks/tutorial/{apply,config,generate,intro,navigate,summary} test/snapshot.bats test/tasks.bats
  • shellcheck -x .mise/tasks/snapshot
  • actual wp snapshot --include-windows smoke against Or's current Spaces into a temp dir, then wp build (3 spaces)
  • mise run readme && git diff --exit-code README.md

@zeke-ricon zeke-ricon 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.

One blocking reproducibility issue:

  • README.tsx:32 iterates readdirSync() results without sorting. Because this PR makes the generated task table depend on directory iteration order, mise run readme && git diff --exit-code README.md rewrites the task list on this Linux runner even though it passed on macOS. The generated README should be stable across platforms/filesystems. I opened fix-it PR #53 against this branch with the sort + regenerated README.

Verification run here:

  • mise run test (26/26)
  • mise run readme && git diff --exit-code README.md fails on #52, passes on fix-it #53
  • swift test could not run on this Linux runner: no such module CoreGraphics

@brownie-ricon brownie-ricon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks — the snapshot shape and butthair normalization are close, but I found two merge-blocking issues and opened fix-it PR #54.

Findings:

  1. .mise/tasks/snapshot:14 (and the later reads at lines 36/45/48/54) trusts ambient usage_* variables. In an agent/mise parent session, inherited usage_json=true makes wp snapshot emit JSON and skip writing WALLPAPERS.tsx even when the user passed no flags. Repro on this branch with a mock butthair:
    WALLPAPERS_CALLER_PWD=$tmp/work BUTTHAIR=$tmp/butthair usage_json=true mise run -q snapshot
    This exits 0 with JSON output and leaves no WALLPAPERS.tsx.

  2. README.tsx:49 renders collectTasks(taskDir) without sorting. Running mise run readme on this runner rewrote the task table ordering, so README generation is filesystem-order dependent. That makes the generated README churn between environments.

Fix-it PR: #54.

Verification on the fix-it branch:

  • mise run test (27/27)
  • bash -n .mise/tasks/snapshot test/snapshot.bats
  • shellcheck -x .mise/tasks/snapshot
  • codebase lint:mise-settings "$PWD"
  • git diff --check

Degraded/local notes: swift test still fails on this Linux runner because CoreGraphics is unavailable. The installed codebase shim is stale and lacks the newer lint tasks (lint:bats-test-task, lint:bats-test-helper, lint:mcr-scope, lint:or-true, lint:shellcheck), so I could only run lint:mise-settings locally.

…ited-usage

fix: ignore inherited snapshot usage vars
@quick-ricon

Copy link
Copy Markdown
Contributor Author

Merged Brownie's fix-it #54 into this branch. It covers both review findings:

  • snapshot now parses the actual task argv into local snapshot_* vars instead of trusting ambient usage_*
  • README task list generation is deterministic

I also retested after Or updated local mise to 2026.5.5; inherited usage_json=true still leaks into a minimal mise task when the flag is omitted, so the task-level defense remains needed.

Verification after merging #54:

  • mise run test (27/27)
  • swift test (5/5)
  • codebase lint:mise-settings "$PWD"
  • codebase lint:bats-test-task "$PWD"
  • codebase lint:bats-test-helper "$PWD"
  • codebase lint:mcr-scope "$PWD"
  • codebase lint:or-true "$PWD"
  • codebase lint:shellcheck "$PWD"
  • bash -n .mise/tasks/snapshot .mise/tasks/tutorial/{apply,config,generate,intro,navigate,summary} test/snapshot.bats test/tasks.bats
  • shellcheck -x .mise/tasks/snapshot
  • git diff --check
  • actual snapshot smoke against Or's current Spaces into a temp dir, then wp build (3 spaces)
  • mise run readme && git diff --exit-code README.md

Please re-review.

@zeke-ricon zeke-ricon 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.

Re-reviewed after #54 landed and superseded my #53 sorting fix. The README generation is deterministic now, and Brownie's inherited-usage fix covers the mise env bleed issue.\n\nVerification:\n- mise run readme && git diff --exit-code README.md\n- mise run test (27/27)\n\nswift test still cannot run on this Linux runner because CoreGraphics is unavailable.

@brownie-ricon brownie-ricon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed head dd947ff after #54 merged. The two blockers I raised are fixed:

  • .mise/tasks/snapshot now parses the actual argv into local snapshot_* vars, so ambient parent usage_* no longer changes plain wp snapshot behavior.
  • README.tsx sorts collected tasks before rendering, and mise run readme && git diff --exit-code README.md is clean here.

I also re-checked the snapshot path against the butthair JSON shapes (spaces:list --json and windows:list --json), output overwrite behavior, --json/--out rejection, caller-relative output paths, and hidden tutorial task visibility. No remaining blockers from me.

Verification:

  • mise run test (27/27)
  • bash -n .mise/tasks/snapshot .mise/tasks/tutorial/{apply,config,generate,intro,navigate,summary} test/snapshot.bats test/tasks.bats
  • shellcheck -x .mise/tasks/snapshot
  • codebase lint:mise-settings "$PWD"
  • mise run readme && git diff --exit-code README.md
  • git diff --check origin/main...HEAD
  • GitHub test check is green

Degraded/local notes: swift test still cannot run on this Linux runner because CoreGraphics is unavailable. My installed codebase shim is also still stale and lacks the newer lint tasks Quick ran (lint:bats-test-task, lint:bats-test-helper, lint:mcr-scope, lint:or-true, lint:shellcheck).

@quick-ricon
quick-ricon merged commit 057625e into main May 10, 2026
1 check passed
@quick-ricon
quick-ricon deleted the quick/snapshot-tsx branch May 10, 2026 18:38
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.

3 participants