Skip to content

Commit 0c1d6cc

Browse files
committed
fix cli dev subcommand
1 parent b178629 commit 0c1d6cc

1 file changed

Lines changed: 33 additions & 26 deletions

File tree

  • packages/cli-v3/src/commands

packages/cli-v3/src/commands/dev.ts

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,17 @@ const DevCommandOptions = CommonCommandOptions.extend({
6565
export type DevCommandOptions = z.infer<typeof DevCommandOptions>;
6666

6767
export function configureDevCommand(program: Command) {
68+
// `dev` is a pure container: it owns no options and no action of its own. The
69+
// dev session lives in the `start` default subcommand (so a bare `trigger dev`
70+
// still runs it), and `archive` is a sibling. Keeping the parent option-free
71+
// means each subcommand owns its own `--branch` with no inherited-option
72+
// shadowing between them.
6873
const devBase = program.command("dev").description("Run your Trigger.dev tasks locally");
6974

7075
commonOptions(
7176
devBase
72-
.command("archive")
73-
.description("Archive a dev branch")
74-
.argument("[path]", "The path to the project", ".")
75-
.option(
76-
"-b, --branch <branch>",
77-
"The dev branch to archive. Defaults to the TRIGGER_DEV_BRANCH environment variable if set."
78-
)
79-
.option("--skip-update-check", "Skip checking for @trigger.dev package updates")
80-
.option("-c, --config <config file>", "The name of the config file, found at [path]")
81-
.option(
82-
"-p, --project-ref <project ref>",
83-
"The project ref. Required if there is no config file. This will override the project specified in the config file."
84-
)
85-
.option(
86-
"--env-file <env file>",
87-
"Path to the .env file to load into the CLI process. Defaults to .env in the project directory."
88-
)
89-
).action(async (path, options) => {
90-
await handleTelemetry(async () => {
91-
await printStandloneInitialBanner(true, options.profile);
92-
await devArchiveCommand(path, options);
93-
});
94-
});
95-
96-
commonOptions(
97-
devBase
77+
.command("start", { isDefault: true })
78+
.description("Run your Trigger.dev tasks locally")
9879
.option("-c, --config <config file>", "The name of the config file")
9980
.option(
10081
"-p, --project-ref <project ref>",
@@ -147,6 +128,32 @@ export function configureDevCommand(program: Command) {
147128
await devCommand(opts);
148129
});
149130
});
131+
132+
commonOptions(
133+
devBase
134+
.command("archive")
135+
.description("Archive a dev branch")
136+
.argument("[path]", "The path to the project", ".")
137+
.option(
138+
"-b, --branch <branch>",
139+
"The dev branch to archive. Defaults to the TRIGGER_DEV_BRANCH environment variable if set."
140+
)
141+
.option("--skip-update-check", "Skip checking for @trigger.dev package updates")
142+
.option("-c, --config <config file>", "The name of the config file, found at [path]")
143+
.option(
144+
"-p, --project-ref <project ref>",
145+
"The project ref. Required if there is no config file. This will override the project specified in the config file."
146+
)
147+
.option(
148+
"--env-file <env file>",
149+
"Path to the .env file to load into the CLI process. Defaults to .env in the project directory."
150+
)
151+
).action(async (path, options) => {
152+
await handleTelemetry(async () => {
153+
await printStandloneInitialBanner(true, options.profile);
154+
await devArchiveCommand(path, options);
155+
});
156+
});
150157
}
151158

152159
export async function devCommand(options: DevCommandOptions) {

0 commit comments

Comments
 (0)