Repository navigation
feat: choose the visual level and test suites per run (--visual, --tests) - #162
Merged
Merged
Conversation
…sts)
NATIVEAPPTEMPLATE_VISUAL / NATIVEAPPTEMPLATE_TESTS were environment-only,
so the plugin and the MCP server couldn't pick them per run.
- CLI: --visual=0|1|2 (or --visual N), --tests / --no-tests. A flag wins
over the variable; without one the variable decides (default 0, no
tests). An invalid --visual exits 2.
- MCP generate_app: optional `visual` (0|1|2) and `tests`, passed to
dispatch() as options for that call only, never written to process.env.
- Preflight in dispatch() for visual >= 1, before the planner (the first
API call): a booted iOS simulator, an attached Android emulator/device
(honouring NATIVEAPPTEMPLATE_MOBILE_IOS_DEVICE / NATIVEAPPTEMPLATE_ADB_SERIAL)
and, for 2, `mise`. Failure throws PreflightError: the CLI prints the list
and exits 2, the MCP tool returns an error result. Injectable for tests.
- Plugin skill maps plain language ("visual 2", "check the UI too",
"画面も確認して", "run the tests", "テストも回して") to the flags, states
time/cost and prerequisites first, and suggests --visual=1 instead of
re-running with NATIVEAPPTEMPLATE_VISUAL=1. The report's reproduce line
and the PARTIAL hint use the flags too.
Closes #160
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr
Merged
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.
Closes #160
Changes
CLI (
src/index.ts,src/run-options.ts) —--visual=0|1|2(also--visual 2),--tests,--no-tests. Precedence: flag >NATIVEAPPTEMPLATE_VISUAL/NATIVEAPPTEMPLATE_TESTS> default (0, no tests). The variables keep their old reading. An invalid--visual(3,high, empty, missing) exits 2 witherror: --visual must be 0, 1, or 2 (got "3"). Tests still imply build mode.MCP
generate_app(src/mcp.ts) — optionalvisual(0|1|2, zod literal union) andtests(boolean). They go todispatch()asDispatchOptions.visual/.testsfor that call only.process.envis never written, so nothing carries over to the server's next call.createMcpServer({ dispatch })is the test seam.Preflight (
src/preflight.ts, called fromdispatch()so the CLI, MCP and plugin all get it). When the visual level is >= 1, before the planner (the first Anthropic API call), it checks for:xcrun simctl list devices booted -j, iOS runtimes only); ifNATIVEAPPTEMPLATE_MOBILE_IOS_DEVICEis set, that udid/name must be booted.adb devicesviaresolveAdbPath+ the existingparseAdbDevices); ifNATIVEAPPTEMPLATE_ADB_SERIALis set, that serial must be attached.mise --version.If something is missing it throws
PreflightErrorwith the list. The CLI prints it plus "Nothing was generated and no API call was made." and exits 2. MCP returnsisError. The checks are injectable (DispatchOptions.preflight,PreflightDeps, explicitenv) and are skipped in judge-stub mode, so unit tests never touch real simctl/adb/mise.Plugin skill (
plugin/skills/generate-app/SKILL.md):--visual=2, "visual 1" / "just check the home screen" to--visual=1, and "run the tests" / "テストも回して" to--tests.--visual=1instead of restarting withNATIVEAPPTEMPLATE_VISUAL=1.Docs:
plugin/README.md: a plain-language paragraph.docs/PLUGIN-GUIDE.md: §6.2 overrides, §9 CLI flag table, §7.2 example, and troubleshooting now refer to the flags.Tests
New tests:
parseArgs: both forms,--tests/--no-tests, invalid values become errors.resolveVisualLevel/resolveTestsprecedence.dispatch: options override the env, and preflight runs only at level >= 1, with the resolved level.dispatchrejects withPreflightError.preflightVisualwith mocked simctl/adb/mise: none booted, adb failure, level 1 without mise, and the override variables.parseBootedIosSimulators.{visual: 2, tests: true}then{}givesseen = [{visual:2,tests:true}, {}], reports 2/true then 0/unset, andprocess.envstays untouched.visual: 3is rejected by the schema.Each new test was seen red against a mutation of its target (flag ignored, precedence flipped, MCP dropping
visual, mise / serial checks removed, dispatch preflight skipped, invalid value accepted, watchOS runtime not filtered), then green.npm run ci: 196 pass.Real check
preflightVisual(1)and(2)against this machine (booted iPhone 17 Pro,emulator-5554+ a phone, mise installed):[].PATH=/usr/bin:/bin:<node> NATIVEAPPTEMPLATE_ADB_SERIAL=bogus-1 node dist/index.js "a queue" --visual 2:--visual=5also exits 2 with the usage line. No paid end-to-end run was made.Notes
.mcp.json/npx -y nativeapptemplate-agentresolve the published package, so the new flags and MCP args reach plugin users with the next npm release.tests/smoke.test.tsin different places.🤖 Generated with Claude Code
https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr