Skip to content

feat: add serve command support#910

Merged
cb1kenobi merged 7 commits into
mainfrom
vite-serve-command
Jun 19, 2026
Merged

feat: add serve command support#910
cb1kenobi merged 7 commits into
mainfrom
vite-serve-command

Conversation

@janvennemann

Copy link
Copy Markdown
Contributor

Summary

  • Register the new serve SDK command for the Titanium Vite runtime
  • Extend initBuildPlatform to handle serve alongside build, enabling platform-specific config
  • Add positional platform shorthand so ti serve ios works like ti build --platform ios
  • Prefer Commander's positional args over manual trailing-args parsing
  • Bump version to 8.2.0

Test plan

  • Verify ti serve ios correctly resolves the platform
  • Verify ti serve --platform android still works
  • Verify ti build commands are unaffected by the argument parsing changes
  • Verify ti serve without a platform prompts for selection

Register the new `serve` SDK command and wire up platform-specific
config handling so it works like `build`. Adds positional platform
shorthand (e.g. `ti serve ios`) by preferring Commander's positional
args over the manual trailing-args logic.

Bumps version to 8.2.0.
@janvennemann

Copy link
Copy Markdown
Contributor Author

Just opening this for discussion for my plans to integrate a Vite based build into the SDK, there are probably a lot of things i've missed and need more fine tuning, e.g. gracefully handle older SDK versions that don't have a serve command.

Replace custom positional platform detection with Commander's native
.argument('[platform]') API. This lets Commander handle the shorthand
`ti build ios` / `ti serve ios` syntax natively instead of manually
checking argv._[0] after parsing.
The serve command's positional-platform work changed executeCommand() to
populate `argv._` from Commander's flat `cmd.args` token list. That collapsed
variadic positionals (e.g. `sdk uninstall [versions...]`) from a nested array
into individual strings, so `sdk.js` consumers reading `cli.argv._[0]` as the
versions array hit `TypeError: versions.filter is not a function` and the
command fell back to printing usage.

Restore the original `argv._ = args` behavior (Commander's action-handler
arguments, where variadic positionals arrive as a nested array). The
serve/build positional platform feature does not depend on this — it reads
`command.processedArgs` in initBuildPlatform() — so it is unaffected.

Add deterministic (no-network) regression tests covering single and
multi-version `sdk uninstall` positional parsing.
@janvennemann

Copy link
Copy Markdown
Contributor Author

Pushed a fix to this branch: fix(cli): restore variadic positional arg parsing (3e1e950).

The positional-platform refactor changed executeCommand() to build argv._ from Commander's flat cmd.args, which collapsed variadic positionals (sdk uninstall [versions...]) into individual strings — sdk.js reads cli.argv._[0] as the versions array, so it hit TypeError: versions.filter is not a function and printed usage instead of running. That was the cause of the failing "install an SDK and remove it" CI test.

Restored the original argv._ = args behavior; the serve/build positional platform feature is unaffected (it reads command.processedArgs in initBuildPlatform()). Added deterministic, no-network regression tests for single and multi-version sdk uninstall parsing.

Merge ordering: this depends on the pnpm toolchain fix #952. Merge #952 to main first, then merge main into this branch (so CI installs cleanly), then merge this PR and release 8.2.0.

@cb1kenobi cb1kenobi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks awesome! Once we get the test green, we'll merge this and get it in for 9.0.0!

Comment thread test/commands/ti-sdk.test.js Outdated
Comment thread test/commands/ti-sdk.test.js Outdated
@cb1kenobi cb1kenobi merged commit aa2d961 into main Jun 19, 2026
12 checks passed
@cb1kenobi cb1kenobi deleted the vite-serve-command branch June 19, 2026 14:37
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