refactor(cli): keep migrate out of scope

This commit is contained in:
Turtle
2026-07-29 21:41:51 +08:00
parent d8e4fd3b75
commit ff126751d8
8 changed files with 21 additions and 91 deletions

View File

@@ -35,13 +35,13 @@ interface MetaInvocation {
}
/**
* Guided fresh-session entries: `dsh migrate` seeds the first turn with the
* `dsh-migrate` skill, `dsh upgrade` with `dsh-upgrade`. Each always mints a
* Guided fresh-session entry: `dsh upgrade` seeds the first turn with the
* `dsh-upgrade` skill. It always mints a
* fresh session in the invoking directory and takes no options — `--resume`,
* `--config`, and `-p` are rejected as mistyped, so there is nothing to carry.
*/
interface SkillSessionInvocation {
mode: 'migrate' | 'upgrade'
mode: 'upgrade'
}
/**
@@ -174,22 +174,15 @@ Examples:
// Registration order is the rendered help order, so daily use comes first
// and the harness-development surfaces (`web --dev`, `meta`) come last.
// `migrate` and `upgrade` are guided fresh-session entries: they take no
// options and always mint a fresh session, so nothing is left to carry. Each
// description names the outcome, not the skill the first turn invokes.
const guided = {
migrate: 'import settings from another coding agent (Claude Code, Codex, opencode)',
upgrade: 'update this dsh installation to the latest version',
} as const
for (const mode of ['migrate', 'upgrade'] as const) {
program
.command(mode)
.description(guided[mode])
.action(() => {
rejectParentOptions(mode)
resolved = { mode }
})
}
// `upgrade` is a guided fresh-session entry: it takes no options and always
// mints a fresh session, so nothing is left to carry.
program
.command('upgrade')
.description('update this dsh installation to the latest version')
.action(() => {
rejectParentOptions('upgrade')
resolved = { mode: 'upgrade' }
})
// Host and port name no default: the CLI passes neither through when the flag
// is absent, so the shipped `cordis.yml` value stands and restating it here

View File

@@ -48,7 +48,6 @@ switch (invocation.mode) {
await runMeta()
break
}
case 'migrate':
case 'upgrade': {
const { runSkillSession } = await import('./tui.ts')
await runSkillSession(`dsh-${invocation.mode}`)

View File

@@ -10,7 +10,7 @@
* workspace, and an in-place resume enters the selected session's own directory.
* `dsh meta`
* ({@link runMeta}) is the one exception — it makes this harness checkout the
* workspace. `dsh migrate`/`dsh upgrade` ({@link runSkillSession}) are fresh
* workspace. `dsh upgrade` ({@link runSkillSession}) are fresh
* sessions whose first turn auto-invokes a bundled skill. After boot, the
* agent's system prompt is told the path to this harness checkout so it can
* find its own source.
@@ -91,7 +91,7 @@ export async function runMeta(): Promise<void> {
/**
* Run the interactive TUI as a guided fresh session whose first turn invokes a
* bundled skill (`dsh migrate` → `dsh-migrate`, `dsh upgrade` → `dsh-upgrade`).
* bundled skill (`dsh upgrade` → `dsh-upgrade`).
* Always mints a fresh session in the invoking directory; the skill is seeded
* only on this first launch, so a later `--resume` of the session is an ordinary
* TUI session with no re-injection.