hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

feat(cli): hyperframes pick — open the design picker, gated behind feature flag

Open vanceingalls opened this issue 6 months ago • 1 comments

Summary

hyperframes pick — new CLI command that builds the design picker (from PR #971 — #974), serves it on localhost:8723, and opens the browser. Gated behind a feature flag so it ships dark until you flip it on.

Scope

  • 7 files, ~430 lines
  • packages/cli/src/commands/pick.ts (new)
  • packages/cli/src/cli.ts (1 line: register pick)
  • packages/cli/src/help.ts (8 lines: conditionally show in --help)
  • packages/cli/src/utils/env.ts (new helper: isDesignPickerEnabled())
  • docs/packages/cli.mdx (new ### pick section under Preview tab)
  • .fallowrc.jsonc (exclude vendored picker assets from the fallow audit)
  • .gitignore (.hyperframes/ + /templates/ — picker output dirs)

Behavior

HYPERFRAMES_DESIGN_PICKER=1 npx hyperframes pick
HYPERFRAMES_DESIGN_PICKER=1 npx hyperframes pick --port 8723
HYPERFRAMES_DESIGN_PICKER=1 npx hyperframes pick --build-only
  • Builds .hyperframes/pick-design.html via the skill's Python script (PR #973)
  • Serves the result on localhost:8723 with a small built-in HTTP server (Node createServer, ~70 lines)
  • Routes /templates/<slug>/* to the installed skills presentations/ directory so the picker's iframes resolve regardless of where the page is served from
  • Runs the Python build from a neutral temp cwd so a project's local DESIGN.html doesn't auto-advance the picker past the templates grid
  • Reads .hyperframes/picker-data.json if present, writes a sensible default otherwise
  • Opens the browser via open after the server is up

Feature flag

isDesignPickerEnabled() in packages/cli/src/utils/env.ts returns true when:

  • Running from source (isDevMode() — contributor convenience, no env var needed)
  • OR HYPERFRAMES_DESIGN_PICKER is set to 1 / true / on / yes

In any other case:

  • hyperframes pick short-circuits with a hint pointing at the env var
  • The command is hidden from hyperframes --help output (omitted from the "Getting Started" group)
  • The command stays registered in cli.ts so direct invocation by an enabled user works

Why a feature flag

The picker depends on:

  • python3 on PATH (build script is Python)
  • skills/hyperframes/ installed in the project (via hyperframes skills)
  • A free port at 8723

That's a lot of preconditions for a CLI command in default user flow. Shipping behind a flag lets the picker mature before flipping on for everyone.

Hot spots for review

  • findSkillsRoot walks up from cwd looking for skills/hyperframes/templates/design-picker.html + skills/hyperframes/scripts/build-design-picker.py. Falls back to walking up from the CLI binary's own location for monorepo dev mode. Limited to 10 parent dirs.
  • serveStatic is the inline HTTP server. Single file mime-types, /templates/<slug>/* route, basic forbidden-path guard. No auth — local-only via 127.0.0.1 bind.
  • buildPicker invokes python3 with stdin JSON. Errors surface as a clack spinner failure.

Tests

No new unit tests. Behavior is covered by:

  • TypeScript type-checking (bun run typecheck passes)
  • Manual: bun x tsx packages/cli/src/cli.ts pick opens the picker (dev mode auto-enables flag)

What's not in scope

  • The picker HTML itself — PR #974
  • The build script the CLI invokes — PR #973
  • The templates the picker renders — PR #971 + #972

Test plan

  • [ ] HYPERFRAMES_DESIGN_PICKER=1 npx hyperframes pick in a project with hyperframes skills installed opens the picker
  • [ ] Without the env var, npx hyperframes pick short-circuits with a hint
  • [ ] Without the env var, hyperframes --help does not list pick
  • [ ] Running from the monorepo (bun x tsx packages/cli/src/cli.ts pick) auto-enables (dev mode)
  • [ ] Build (bun run build) succeeds with the new files
  • [ ] bunx oxlint packages/cli/src/commands/pick.ts packages/cli/src/utils/env.ts passes

Stack

Top of stack. Depends on #971, #972, #973, #974.

🤖 Generated with Claude Code

vanceingalls avatar May 19 '26 21:05 vanceingalls

[!WARNING] This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

vanceingalls avatar May 19 '26 21:05 vanceingalls