| 47 | } |
| 48 | |
| 49 | function printUsage(): void { |
| 50 | console.log(""); |
| 51 | console.log(" Magic Context CLI"); |
| 52 | console.log(" ─────────────────"); |
| 53 | console.log(""); |
| 54 | console.log(" Commands:"); |
| 55 | console.log(" setup Interactive setup wizard"); |
| 56 | console.log(" doctor Check and fix configuration issues"); |
| 57 | console.log(" doctor --force Force-clear plugin cache"); |
| 58 | console.log(" doctor --issue Collect diagnostics and open a GitHub issue"); |
| 59 | console.log(" doctor --clear Interactive cache cleanup picker"); |
| 60 | console.log(" doctor --check-v22-backfill Show v22 memory backfill status"); |
| 61 | console.log(" doctor --retry-v22-backfill Retry failed v22 memory backfill rows"); |
| 62 | console.log(" doctor --rekey-v22-dir-identity <path> Re-key legacy dir identity rows"); |
| 63 | console.log(" doctor migrate Migrate OpenCode session to Pi JSONL"); |
| 64 | console.log(" doctor migrate-session Re-home an OpenCode session to another directory"); |
| 65 | console.log(""); |
| 66 | console.log(" Harness selection:"); |
| 67 | console.log(" --harness opencode Target OpenCode only"); |
| 68 | console.log(" --harness pi Target Pi only"); |
| 69 | console.log(" (default: auto-detect, prompt if multiple installed)"); |
| 70 | console.log(""); |
| 71 | console.log(" Usage:"); |
| 72 | console.log(" npx @cortexkit/magic-context@latest setup"); |
| 73 | console.log(" # add --dry-run to preview the wizard without writing any files"); |
| 74 | console.log(" npx @cortexkit/magic-context@latest doctor"); |
| 75 | console.log(" npx @cortexkit/magic-context@latest doctor --issue"); |
| 76 | console.log(" npx @cortexkit/magic-context@latest doctor migrate \\"); |
| 77 | console.log(" --from opencode --to pi --session ses_xxx --dry-run"); |
| 78 | console.log(""); |
| 79 | } |
| 80 | |
| 81 | export async function main(argv: string[] = process.argv.slice(2)): Promise<number> { |
| 82 | if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h" || argv[0] === "help") { |