Commit Graph

23 Commits

Author SHA1 Message Date
Yunfei He 7f3b0ca40e chore: align Vue file conventions (#137)
- document Vue file authoring conventions
- rename runtime/example component files to kebab-case
- update imports and docs references
2026-06-05 08:28:59 +08:00
Yunfei He bfd680490f refactor(runtime)!: rename useAppContext() to useApp() (full Ink alignment) (#73)
#69 added `useAppContext()` as a Vue-native rename of Ink's `useApp()`,
qualified to avoid reading as the Vue application instance. On reflection the
"Context" suffix borrowed the name of an internal grab-bag context and slightly
mislabels the hook — it returns app lifecycle controls, not that context. The
collision worry doesn't hold up: Vue has no `useApp()`, the returned
`{ exit, waitUntilRenderFlush }` is clearly not the Vue app instance, and "App"
in vue-tui already means the `TuiApp` from `createApp()`.

Rename to `useApp()` for full Ink fidelity (same name + same shape), and drop
the now-defunct "App composable" entry from ink-divergences.md — it ceases to
be a divergence.

Internal context cleanup (the grab-bag `AppContext` + the `StdinContext`
duplication) is intentionally out of scope here, tracked separately.

BREAKING CHANGE: `useAppContext()` is renamed to `useApp()`. Replace
`const { exit } = useAppContext()` with `const { exit } = useApp()`.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 23:32:22 +08:00
Yunfei He 9d1e4d7805 feat(runtime)!: replace useExit() with Ink-aligned useAppContext() (#69)
Ink's `useApp()` returns `{ exit, waitUntilRenderFlush }`. vue-tui previously
exposed only `exit()` via `useExit()` and kept `waitUntilRenderFlush` on the
`TuiApp` handle alone. Align the public surface with Ink: add `useAppContext()`
returning the same pair, and remove `useExit()`.

- thread `waitUntilRenderFlush` into the injected `AppContext` via a hoisted
  impl shared by the `TuiApp` handle and the composable, so both resolve
  identically
- add `useAppContext()`; delete `useExit()`; migrate all call sites, PTY
  fixtures, examples, READMEs and the public-API surface test
- port Ink's two "useApp waitUntilRenderFlush" tests; Ink's third relies on
  React concurrent mode (N/A in Vue)
- rewrite the ink-divergences entry: this is now a *naming* divergence
  (`useAppContext` vs `useApp`, mirroring `createApp` vs `render`), not a
  surface one — and fix the prior wrong claim that Ink's `useApp` returns
  stdin/stdout/stderr

The name is qualified (`useAppContext`, not `useApp`) so it doesn't read as the
Vue application instance (`createApp`/`app.mount`) — the same Vue-native naming
choice vue-tui already makes with `createApp()` vs Ink's `render()`.

BREAKING CHANGE: `useExit()` is removed. Replace `const exit = useExit()` with
`const { exit } = useAppContext()`.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 19:57:52 +08:00
Yunfei He 162e022b7f refactor: convert coding-agent example from JSX to SFC templates
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 14:57:53 +08:00
Yunfei He 6e01954cf9 fix: resolve vpr ready failures
- Fix unhandled promise in coding-agent example (void operator)
- Fix unhandled promise in cli/dev.ts (void operator)
- Fix ChildProcess.on() type error in cli/process-manager.ts
  (@types/node v25 removed .on() from ChildProcess type)
- Change example build scripts from "vite build" to "vp build"
  (vite resolves to vite-plus-core which has no CLI bin)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 23:19:55 +08:00
Yunfei He ca25ccd96e fix(paint): continuous backgroundColor across wrapped text lines
- Wrap each text line with applyChalk(bgProps) after wrapText so
  background color is reapplied on every wrapped line (wrap-ansi
  doesn't carry ANSI state across line breaks)
- Add wrapped-text backgroundColor regression test
- Fix typo: color=" cyan" → color="cyan" in example
- Add FORCE_COLOR=3 debugging tip to AGENTS.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 11:31:00 +08:00
Yunfei He 0854ef4828 fix(coding-agent): fix user message layout and add Agent prefix
- Use nested Text instead of sibling Text nodes to keep 'You: ' and
  content on the same line (avoids yoga row layout splitting them)
- Add 'Agent: ' prefix (cyan, bold) to assistant messages
2026-05-24 23:03:13 +08:00
Yunfei He 638dd9fbc7 fix(coding-agent): harden edge cases from codex review
- Guard JSON.parse of tool arguments with try-catch
- Robust tool-call accumulation via Map (handles out-of-order deltas)
- Pass real ToolCall to onToolCall/onToolResult (correct ids in scrollback)
- Persist skipped tool calls to Static scrollback
- Flush partial streaming text on network errors
- Ensure empty assistant messages have content: "" (valid schema)
2026-05-24 22:49:57 +08:00
Yunfei He 4ac8a87507 fix(coding-agent): persist user messages and tool results to Static scrollback 2026-05-24 22:40:57 +08:00
Yunfei He 20b412ace1 refactor: convert all SFCs to script setup
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:39:11 +08:00
Yunfei He 9f9edcf991 fix(coding-agent): lazy-init OpenAI client to avoid top-level throw 2026-05-24 22:36:38 +08:00
Yunfei He 253fa8bfc6 feat(coding-agent): add API key validation in entry point
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:32:55 +08:00
Yunfei He 6a8a365d24 feat(coding-agent): implement App with state machine and Static/Dynamic split
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:32:07 +08:00
Yunfei He b1da92e63c feat(coding-agent): add MessageList component
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:30:48 +08:00
Yunfei He 242fc74b9c feat(coding-agent): add streaming agent loop with DeepSeek
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:29:32 +08:00
Yunfei He 6aec92e16d feat(coding-agent): add types and bash execution
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:27:27 +08:00
Yunfei He 795251a080 feat(examples): scaffold coding-agent example
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:26:21 +08:00
Yunfei He 34a73c1b5f fix: rename start to preview in remaining examples
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 21:48:09 +08:00
Yunfei He 48ff01a0f9 fix: rename flappy-bird package and use preview instead of start
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 21:47:26 +08:00
Yunfei He 625aa138f1 fix(cli): clean terminal output for TUI apps
- Silence Vite server logs (logLevel: 'silent')
- Intercept console.log/info/warn/error/debug in child process to
  suppress [vite] and [Vue warn] noise from HMR client
- Add 3s startup grace period to ignore initial reload requests
  (prevents double-spawn on first WS connection)
- Clear screen before spawning child process

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 21:39:28 +08:00
Yunfei He 020fd0d85a feat: add basic-jsx and basic-template examples
- basic-jsx: Counter + Clock with defineComponent() + JSX
- basic-template: Counter + Clock with .vue SFC + <template>
- Both demonstrate HMR via vue-tui dev
- Fix vite-plugin: strip build.lib and external config for bundledDev,
  add node builtins resolveId to prevent browser-external shimming
- Remove old hmr-demo example (superseded by basic-template)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 21:21:08 +08:00
Yunfei He e8ef31814a feat: add hmr-demo example with Vue SFC HMR
- Counter + Clock components demonstrating component-level HMR
- Fix hmr-loader: use project-root file:// URL prefix so Node's
  bare specifier resolution finds node_modules
- Fix hmr-loader: export hooks directly instead of inline data URL
- Fix process-manager: register loader via data URL + register()
  pointing to the file (matches spike pattern)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 20:48:52 +08:00
Yunfei He 544a826670 feat: flappy-bird and basic examples
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 18:13:57 +08:00