From 071597867f2fda8f125ba2af76f516e00c5b3358 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 03:33:46 +0000 Subject: [PATCH 01/10] Initial plan From d043e022cee08ce6e94788111b8ca6212dc1f650 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 03:42:53 +0000 Subject: [PATCH 02/10] refactor(cli): convert init command from Commander.js to oclif Convert the init command to use oclif Command class pattern: - Replace Commander import with @oclif/core (Args, Command, Flags) - Convert initCommand to Init class extending Command - Map .argument() to static args, .option() to static flags - Replace .action() handler with async run() method - Replace process.exit(1) with this.error() for oclif convention - Export TEMPLATES for external consumers - Update bin.ts to remove Commander-based initCommand registration - Update test to check oclif static properties Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- packages/cli/src/bin.ts | 4 +-- packages/cli/src/commands/init.ts | 52 ++++++++++++++++++------------ packages/cli/test/commands.test.ts | 6 ++-- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/packages/cli/src/bin.ts b/packages/cli/src/bin.ts index f3faf2675d..ac0d495fbf 100644 --- a/packages/cli/src/bin.ts +++ b/packages/cli/src/bin.ts @@ -13,7 +13,7 @@ import { serveCommand } from './commands/serve.js'; import { studioCommand } from './commands/studio.js'; import { testCommand } from './commands/test.js'; import { validateCommand } from './commands/validate.js'; -import { initCommand } from './commands/init.js'; + import { infoCommand } from './commands/info.js'; import { generateCommand } from './commands/generate.js'; import { pluginCommand } from './commands/plugin.js'; @@ -63,7 +63,7 @@ ${chalk.dim('Docs: https://objectstack.dev')} `); // ── Development ── -program.addCommand(initCommand); +// initCommand has been migrated to oclif (auto-discovered from commands/) program.addCommand(devCommand); program.addCommand(serveCommand); program.addCommand(studioCommand); diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index cf8e0c5be3..2230b0621e 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -1,12 +1,12 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. -import { Command } from 'commander'; +import { Args, Command, Flags } from '@oclif/core'; import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; import { printHeader, printSuccess, printError, printStep, printKV, printInfo } from '../utils/format.js'; -const TEMPLATES: Record; devDependencies: Record; @@ -179,33 +179,48 @@ function toTitleCase(str: string): string { return str.replace(/[-_]/g, ' ').replace(/\b\w/g, c => c.toUpperCase()); } -export const initCommand = new Command('init') - .description('Initialize a new ObjectStack project in the current directory') - .argument('[name]', 'Project name (defaults to directory name)') - .option('-t, --template