Skip to content

Commit f5622ac

Browse files
cevianclaude
andcommitted
refactor: rename init command to run, simplify existing-project flow
The `run` command handles both new projects (scaffolding wizard) and existing projects (launch dev UI). Existing project flow simplified to just a launch mode selector. All references updated across CLI, skills, and install instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 54b4c25 commit f5622ac

File tree

4 files changed

+29
-33
lines changed

4 files changed

+29
-33
lines changed

packages/core/src/cli/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { getTrace, printTrace } from "./trace.js";
1515
import { getAppName } from "./app.js";
1616
import { startMcpServer } from "./mcp/server.js";
1717
import { runInstall, runUninstall } from "./install.js";
18-
import { runInit } from "./init.js";
18+
import { runRun } from "./run.js";
1919

2020
// Read version from package.json
2121
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -88,12 +88,12 @@ program
8888
.description("CLI for 0pflow workflow engine")
8989
.version(version);
9090

91-
// ============ Init command ============
91+
// ============ Run command ============
9292
program
93-
.command("init")
94-
.description("Create a new 0pflow project")
93+
.command("run")
94+
.description("Create a new project or launch an existing one")
9595
.action(async () => {
96-
await runInit();
96+
await runRun();
9797
});
9898

9999
// ============ Workflow commands ============

packages/core/src/cli/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ export async function runInstall(options: InstallOptions = {}): Promise<void> {
228228

229229
// Development mode: just show the command to use
230230
if (mcpResult.isLocal) {
231-
// Build the init command from the MCP command (same tsx + script, different subcommand)
232-
const initCmd = mcpResult.command.slice(0, -2).concat("init").join(" ");
231+
// Build the run command from the MCP command (same tsx + script, different subcommand)
232+
const initCmd = mcpResult.command.slice(0, -2).concat("run").join(" ");
233233

234234
printBanner();
235235
console.log(pc.yellow("Development mode detected"));
Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,36 +111,32 @@ async function launchDevServer(cwd: string, { yolo = false }: { yolo?: boolean }
111111
}
112112
}
113113

114-
export async function runInit(): Promise<void> {
115-
p.intro(pc.red("0pflow") + pc.dim(" — create a new project"));
114+
export async function runRun(): Promise<void> {
115+
p.intro(pc.red("0pflow"));
116116

117117
if (!isClaudeAvailable()) {
118118
p.log.error("Claude Code CLI not found. Install it from https://claude.ai/code");
119119
process.exit(1);
120120
}
121121

122-
// ── Existing project check ──────────────────────────────────────────
122+
// ── Existing project → launch ───────────────────────────────────────
123123
if (isExisting0pflow()) {
124-
const action = await p.select({
125-
message: "This directory is already an 0pflow project.",
124+
const mode = await p.select({
125+
message: "Launch mode",
126126
options: [
127-
{ value: "claude" as const, label: "Launch Dev UI" },
128-
{ value: "claude-yolo" as const, label: "Launch Dev UI with --dangerously-skip-permissions" },
129-
{ value: "new" as const, label: "Create a new project in a subdirectory" },
127+
{ value: "normal" as const, label: "Launch" },
128+
{ value: "yolo" as const, label: "Launch with --dangerously-skip-permissions" },
130129
],
131130
});
132131

133-
if (p.isCancel(action)) {
132+
if (p.isCancel(mode)) {
134133
p.cancel("Cancelled.");
135134
process.exit(0);
136135
}
137136

138-
if (action === "claude" || action === "claude-yolo") {
139-
p.outro(pc.green("Launching Dev UI..."));
140-
await launchDevServer(process.cwd(), { yolo: action === "claude-yolo" });
141-
return;
142-
}
143-
// fall through to normal wizard (cwdEmpty will be false, so directory defaults to ./<name>)
137+
p.outro(pc.green("Launching..."));
138+
await launchDevServer(process.cwd(), { yolo: mode === "yolo" });
139+
return;
144140
}
145141

146142
const cwdEmpty = isCwdEmpty();
@@ -390,7 +386,7 @@ export async function runInit(): Promise<void> {
390386
} else {
391387
s.stop(pc.yellow("Database not ready yet"));
392388
p.log.warn(
393-
`Run later: 0pflow init won't retry. Use the MCP tools or set up manually.`,
389+
`Run later: 0pflow run won't retry. Use the MCP tools or set up manually.`,
394390
);
395391
}
396392
} else {
@@ -400,19 +396,19 @@ export async function runInit(): Promise<void> {
400396
}
401397
}
402398

403-
// ── Launch Dev UI? ──────────────────────────────────────────────────
399+
// ── Launch? ─────────────────────────────────────────────────────────
404400
const launchChoice = await p.select({
405-
message: "Launch Dev UI to design your first workflow?",
401+
message: "Launch now?",
406402
options: [
407-
{ value: "claude" as const, label: "Yes" },
408-
{ value: "claude-yolo" as const, label: "Yes, with --dangerously-skip-permissions" },
403+
{ value: "normal" as const, label: "Yes" },
404+
{ value: "yolo" as const, label: "Yes, with --dangerously-skip-permissions" },
409405
{ value: "no" as const, label: "No, I'll do it later" },
410406
],
411407
});
412408

413409
if (!p.isCancel(launchChoice) && launchChoice !== "no") {
414-
p.outro(pc.green("Launching Dev UI..."));
415-
await launchDevServer(resolve(appPath), { yolo: launchChoice === "claude-yolo" });
410+
p.outro(pc.green("Launching..."));
411+
await launchDevServer(resolve(appPath), { yolo: launchChoice === "yolo" });
416412
return;
417413
}
418414

@@ -421,7 +417,7 @@ export async function runInit(): Promise<void> {
421417

422418
p.outro(pc.green("Project created!"));
423419
console.log();
424-
console.log(pc.bold(" To launch the Dev UI later:"));
425-
console.log(pc.cyan(` ${cdCmd}0pflow dev`));
420+
console.log(pc.bold(" To launch later:"));
421+
console.log(pc.cyan(` ${cdCmd}0pflow run`));
426422
console.log();
427423
}

skills/create-workflow/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Design and write a workflow with embedded description fields for 0pflow.
1616
Check the current working directory and handle one of three cases:
1717

1818
**Case 1: Empty directory** (no files, or only dotfiles like `.git`)
19-
→ Tell the user to run `0pflow init` first to scaffold a new project, then re-invoke this skill. **Stop here.**
19+
→ Tell the user to run `0pflow run` first to scaffold a new project, then re-invoke this skill. **Stop here.**
2020

2121
**Case 2: Existing 0pflow project** (has `generated/workflows/` or `specs/agents/` directories)
2222
→ Good to go. Continue to step 2.
2323

2424
**Case 3: Existing non-0pflow directory** (has files/projects but no 0pflow structure — e.g., home directory, another repo)
25-
→ Tell the user to run `0pflow init` in a subdirectory first, then re-invoke this skill from inside that directory. **Stop here.**
25+
→ Tell the user to run `0pflow run` in a subdirectory first, then re-invoke this skill from inside that directory. **Stop here.**
2626

2727
### 2. Discover Integrations
2828

0 commit comments

Comments
 (0)