Skip to content

feat(cli): add interactive wizards for fetch and init commands#73

Merged
alexey1312 merged 12 commits intomainfrom
feature/fetch-interactive-wizard
Mar 20, 2026
Merged

feat(cli): add interactive wizards for fetch and init commands#73
alexey1312 merged 12 commits intomainfrom
feature/fetch-interactive-wizard

Conversation

@alexey1312
Copy link
Collaborator

Description

  • Add interactive wizard for exfig fetch — walks user through file ID, asset type, platform, format, and output path selection with smart per-platform defaults
  • Add interactive wizard for exfig init — guided config generation with platform, asset types (multi-select), Figma file IDs, frame/page names, and colors source (Styles vs Variables)
  • Add multipleChoicePrompt wrapper to NooraUI adapter for multi-select prompts with min/max limits
  • Add WizardPlatform.asPlatform mapping for reuse across wizards
  • Generated configs now use published package:// URIs instead of local .exfig/schemas/ paths, with version from ExFigCommand.version
  • Remove SchemaExtractor.extract() from exfig init — no more .exfig/schemas/ created on init
  • Replace readLine() overwrite prompt with NooraUI.yesOrNoPrompt for consistent UX
  • Make --platform optional in exfig init (wizard in TTY, ValidationError in non-TTY)
  • Context-aware "next steps" output — skip "edit file IDs" when wizard provided them, show only selected export commands
  • 39 tests covering wizard types, template transformation (section removal, ID substitution, brace balance, variables colors, page names)
  • Update exfig.usage.kdl, README, DocC articles

Additional notes

  • Wizard flow reuses WizardPlatform from fetch wizard for consistent platform selection
  • Template transformation is pure/testable — split into InitWizardTransform.swift extension to stay within SwiftLint file/type length limits
  • Three template operations: section removal (brace-counting), value substitution, and block uncommenting (variablesColors, figmaPageName)

When required options (--file-id, --frame, --output) are omitted in an
interactive terminal, a guided wizard helps fill them in with smart
platform-specific defaults.

Changes:
- NooraUI: add textPrompt, singleChoicePrompt, yesOrNoPrompt wrappers
- FetchWizard: wizard flow with WizardPlatform, WizardAssetType,
  PlatformDefaults (format, scale, nameStyle per platform)
- DownloadOptions: make fileId, frameName, outputPath optional
- DownloadImages: wire wizard into run(), fallback to error in non-TTY
- ImageFormat: add CustomStringConvertible for display in prompts
- Usage spec: update fetch flags as optional with interactive docs
- Tests: FetchWizardTests (16 tests), updated DownloadOptionsTests
Add `exfig fetch` wizard mentions to Quick Start (README), Quick Fetch
section (Usage.md), and ExFig.md landing page capabilities. Update
CLAUDE.md with documentation structure guidance for future sessions.
When --platform is omitted in a TTY, `exfig init` launches a guided
wizard that collects platform, asset types, Figma file IDs, and frame
names, then generates a ready-to-run config with unselected sections
removed and IDs substituted.

- Add InitWizard with run() and pure applyResult() for testability
- Add multipleChoicePrompt wrapper to NooraUI
- Add WizardPlatform.asPlatform mapping
- Make --platform optional, gate wizard on TTYDetector.isTTY
- Replace readLine() overwrite prompt with NooraUI.yesOrNoPrompt
- Context-aware "next steps" output (skip "edit file IDs" after wizard)
- 16 tests covering section removal, ID substitution, brace balance
- Update exfig.usage.kdl, README, DocC articles, CLAUDE.md
- Add colors source choice: Styles vs Figma Variables
- When Variables selected: uncomment variablesColors block, populate
  tokensFileId, collectionName, lightModeName, darkModeName
- Add optional page name filter for icons and images (figmaPageName)
- Split transform logic into InitWizardTransform.swift (file_length)
- 23 tests covering variables, page names, section removal, brace balance
Generated exfig.pkl now references published PKL package URIs
(package://github.com/DesignPipe/exfig/releases/download/v{VERSION}/...)
instead of local .exfig/schemas/ paths. Version is taken from
ExFigCommand.version at generation time.

- Add substitutePackageURI() to replace .exfig/schemas/ with package://
- Remove SchemaExtractor.extract() call from `exfig init`
- No more .exfig/schemas/ created on init
- Make DownloadOptions.format optional with effectiveFormat computed
  property so wizard doesn't override explicit --format png
- Add extractFigmaFileId() to auto-extract file IDs from full Figma URLs
- Trim whitespace on text prompt inputs before empty-check defaults
- Add defensive check in removeSection for unclosed brace-counted sections
- Remove unnecessary swiftlint:disable function_parameter_count
- Add tests for substitutePackageURI, extractFigmaFileId, Android/Web
  templates, removeSection edge cases, and collapseBlankLines
- Update CLAUDE.md with wizard patterns and CLI flag gotcha
Automatically regenerates and stages llms.txt / llms-full.txt when
documentation sources (README, DocC articles, CONFIG.md) are modified.

- check uses temp dir generation (parallel-safe for hk batching)
- fix regenerates in-place and auto-stages via hk stage list
- generate-llms.sh now accepts LLMS_TXT/LLMS_FULL env overrides
@alexey1312 alexey1312 merged commit 2c2cf0c into main Mar 20, 2026
3 checks passed
@alexey1312 alexey1312 deleted the feature/fetch-interactive-wizard branch March 20, 2026 16:35
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