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>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { shallowRef } from "vue";
|
||||
import { Box, Text, Static, useInput, useAppContext } from "@vue-tui/runtime";
|
||||
import { Box, Text, Static, useInput, useApp } from "@vue-tui/runtime";
|
||||
import { runAgentLoop, type Message, type ToolCall } from "./agent";
|
||||
import MessageList from "./components/MessageList.vue";
|
||||
|
||||
@@ -14,7 +14,7 @@ const pendingCommand = shallowRef("");
|
||||
const messages: Message[] = [];
|
||||
|
||||
let approvalResolve: ((approved: boolean) => void) | null = null;
|
||||
const { exit } = useAppContext();
|
||||
const { exit } = useApp();
|
||||
|
||||
const autoApprove = process.argv.includes("--yolo");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onScopeDispose, reactive } from "vue";
|
||||
import chalk from "chalk";
|
||||
import { Box, Text, useAppContext, useInput } from "@vue-tui/runtime";
|
||||
import { Box, Text, useApp, useInput } from "@vue-tui/runtime";
|
||||
|
||||
// --- world dimensions ----------------------------------------------------
|
||||
|
||||
@@ -130,7 +130,7 @@ function renderFrame(w: World): string[] {
|
||||
|
||||
// --- component -----------------------------------------------------------
|
||||
|
||||
const { exit } = useAppContext();
|
||||
const { exit } = useApp();
|
||||
const world = reactive<World>(makeWorld(0));
|
||||
|
||||
function flap(): void {
|
||||
|
||||
Reference in New Issue
Block a user