@glubean/cli 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +22 -2
  2. package/dist/commands/contracts.d.ts.map +1 -1
  3. package/dist/commands/contracts.js +28 -4
  4. package/dist/commands/contracts.js.map +1 -1
  5. package/dist/commands/init.d.ts +2 -0
  6. package/dist/commands/init.d.ts.map +1 -1
  7. package/dist/commands/init.js +267 -60
  8. package/dist/commands/init.js.map +1 -1
  9. package/dist/commands/migrate.d.ts +31 -0
  10. package/dist/commands/migrate.d.ts.map +1 -0
  11. package/dist/commands/migrate.js +516 -0
  12. package/dist/commands/migrate.js.map +1 -0
  13. package/dist/commands/redact.d.ts.map +1 -1
  14. package/dist/commands/redact.js +32 -8
  15. package/dist/commands/redact.js.map +1 -1
  16. package/dist/commands/run.d.ts +110 -2
  17. package/dist/commands/run.d.ts.map +1 -1
  18. package/dist/commands/run.js +493 -43
  19. package/dist/commands/run.js.map +1 -1
  20. package/dist/lib/config.d.ts +267 -43
  21. package/dist/lib/config.d.ts.map +1 -1
  22. package/dist/lib/config.js +744 -149
  23. package/dist/lib/config.js.map +1 -1
  24. package/dist/lib/env.d.ts +29 -0
  25. package/dist/lib/env.d.ts.map +1 -0
  26. package/dist/lib/env.js +59 -0
  27. package/dist/lib/env.js.map +1 -0
  28. package/dist/lib/print-plan.d.ts +21 -0
  29. package/dist/lib/print-plan.d.ts.map +1 -0
  30. package/dist/lib/print-plan.js +108 -0
  31. package/dist/lib/print-plan.js.map +1 -0
  32. package/dist/lib/upload.d.ts +36 -1
  33. package/dist/lib/upload.d.ts.map +1 -1
  34. package/dist/lib/upload.js +126 -19
  35. package/dist/lib/upload.js.map +1 -1
  36. package/dist/main.d.ts.map +1 -1
  37. package/dist/main.js +420 -27
  38. package/dist/main.js.map +1 -1
  39. package/package.json +15 -6
  40. package/templates/README.md +7 -13
  41. package/templates/demo/.env.example +7 -0
  42. package/templates/demo/.env.secrets.example +11 -0
  43. package/templates/demo/README.md +60 -0
  44. package/templates/demo/config/api.ts +24 -0
  45. package/templates/demo/gitignore.tpl +13 -0
  46. package/templates/demo/glubean.yaml +48 -0
  47. package/templates/demo/tests/api-flaky/search-flaky.test.ts +28 -0
  48. package/templates/demo/tests/api-stable/get-users.test.ts +30 -0
  49. package/templates/demo/tests/canary/synthetic-50pct-flaky.test.ts +23 -0
  50. package/templates/demo/tests/contracts/stable/users-contract.contract.ts +70 -0
  51. package/templates/demo/tsconfig.json +15 -0
  52. package/templates/AI-INSTRUCTIONS.md +0 -160
  53. package/templates/ci-config/ci.yaml +0 -13
  54. package/templates/ci-config/default.yaml +0 -9
  55. package/templates/ci-config/explore.yaml +0 -5
  56. package/templates/ci-config/staging.yaml +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/lib/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAW,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAE5C,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAA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EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;AAC1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiZH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAm2BH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
package/dist/main.js CHANGED
@@ -10,9 +10,10 @@ if (_cwd)
10
10
  process.chdir(_cwd);
11
11
  import { Command } from "commander";
12
12
  import { CLI_VERSION } from "./version.js";
13
- import { loadConfig } from "./lib/config.js";
13
+ import { loadProjectConfigV1, resolveRunPlan, GlubeanConfigError, } from "./lib/config.js";
14
+ import { formatResolvedPlan } from "./lib/print-plan.js";
14
15
  import { initCommand } from "./commands/init.js";
15
- import { runCommand } from "./commands/run.js";
16
+ import { runCommand, resolveTestFilesForSuite } from "./commands/run.js";
16
17
  import { scanCommand } from "./commands/scan.js";
17
18
  import { validateMetadataCommand } from "./commands/validate_metadata.js";
18
19
  import { loginCommand } from "./commands/login.js";
@@ -21,6 +22,7 @@ import { specSplitCommand } from "./commands/spec_split.js";
21
22
  import { redactCommand } from "./commands/redact.js";
22
23
  import { configMcpCommand } from "./commands/config_mcp.js";
23
24
  import { upgradeCommand } from "./commands/upgrade.js";
25
+ import { migrateCommand } from "./commands/migrate.js";
24
26
  import { envShowCommand, envUseCommand, envResetCommand, envListCommand } from "./commands/env.js";
25
27
  import { abortUpdateCheck, checkForUpdates } from "./update_check.js";
26
28
  const program = new Command();
@@ -37,6 +39,7 @@ program
37
39
  .command("init")
38
40
  .description("Initialize a new Glubean project (interactive wizard)")
39
41
  .option("--contract-first", "Scaffold contract-first project (product/, contracts/, tests/)")
42
+ .option("--template <name>", "Scaffold a named template (currently: demo — the public demo project)")
40
43
  .option("--ai-tools", "Configure MCP server + AI skill for your editor")
41
44
  .option("--hooks", "Install git hooks (pre-commit, pre-push)")
42
45
  .option("--github-actions", "Scaffold GitHub Actions workflow")
@@ -48,6 +51,7 @@ program
48
51
  .action(async (options) => {
49
52
  await initCommand({
50
53
  contractFirst: options.contractFirst,
54
+ template: options.template,
51
55
  aiTools: options.aiTools,
52
56
  hooks: options.hooks,
53
57
  githubActions: options.githubActions,
@@ -66,8 +70,11 @@ program
66
70
  .description("Run tests from a file, directory, or glob pattern (defaults to testDir)")
67
71
  .option("--explore", "Run explore tests (from exploreDir instead of testDir)")
68
72
  .option("-f, --filter <pattern>", "Run only tests matching pattern (name or id substring)")
73
+ .option("--profile <name>", "Use profile from glubean.yaml (Phase 1 first slice). When set, loads glubean.yaml + resolves the named profile; CLI flags still override profile values.")
74
+ .option("--suite <name>", "Run only the named suite from the profile. The name must already appear in `profile.suites`. (Single value — narrows a multi-suite profile to one suite.)")
69
75
  .option("-t, --tag <tag>", "Run only tests with matching tag (comma-separated or repeatable)", collect, [])
70
76
  .option("--tag-mode <mode>", 'Tag match logic: "or" (any tag) or "and" (all tags)', "or")
77
+ .option("--exclude-tag <tag>", "Exclude tests with matching tag (comma-separated or repeatable; always OR-mode — any match drops the test)", collect, [])
71
78
  .option("--env-file <path>", "Path to .env file (default: .env if it exists)")
72
79
  .option("-l, --log-file", "Write logs to file (<testfile>.log)")
73
80
  .option("--pretty", "Pretty-print JSON in log file (2-space indent)")
@@ -83,67 +90,349 @@ program
83
90
  .option("--inspect-brk [port]", "Enable V8 Inspector for debugging (pauses until debugger attaches)")
84
91
  .option("--reporter <format>", 'Output format: "junit" or "junit:/path/to/output.xml"')
85
92
  .option("--trace-limit <count>", "Max trace files to keep per test (default: 20)")
86
- .option("--ci", "CI mode: enables --fail-fast and --reporter junit")
87
93
  .option("--include-browser", "Include cases that require a browser (e.g., OAuth login)")
88
94
  .option("--include-out-of-band", "Include cases that require out-of-band channels (email, SMS)")
89
95
  .option("--include-opt-in", "Include opt-in cases (expensive, slow, or side-effect-producing)")
90
96
  .option("--no-session", "Skip session setup/teardown")
91
97
  .option("-M, --meta <key=value>", "Custom run metadata (repeatable)", collect, [])
92
98
  .option("--upload", "Upload run results and artifacts to Glubean Cloud")
99
+ .option("--upload-receipt-json <path>", "Write Cloud upload receipt JSON after --upload")
93
100
  .option("--project <id>", "Glubean Cloud project ID (or GLUBEAN_PROJECT_ID env)")
94
101
  .option("--token <token>", "Auth token for cloud upload (or GLUBEAN_TOKEN env)")
95
102
  .option("--api-url <url>", "Glubean API server URL")
96
103
  .option("--input-json <value>", "Explicit case input as JSON literal or @path/to.json. Validated against the case's `needs` schema; runs raw (overlay skipped). Requires --filter to match exactly one testId.")
97
104
  .option("--bootstrap-json <value>", "Bootstrap params as JSON literal or @path/to.json. Validated against the overlay's `params` schema and passed to overlay's run(ctx, params). Requires --filter to match exactly one testId.")
98
105
  .option("--force-standalone", "DEBUG: bypass `runnability.requireAttachment` for the filtered case. Emits a runtime warning. Author-debug only.")
99
- .action(async (target, options) => {
106
+ .action(async (target, options, cmd) => {
107
+ await executeRun(target, options, cmd);
108
+ });
109
+ // Extracted run handler so both `glubean run` and `glubean ci run` can
110
+ // share it. The CI subcommand is just `run` with `--profile ci` baked
111
+ // in as the default.
112
+ async function executeRun(target, options, cmd) {
100
113
  // Flatten --config values
101
114
  const configFiles = options.config && options.config.length > 0
102
115
  ? options.config.flatMap((v) => v.split(",").map((s) => s.trim()).filter(Boolean))
103
116
  : undefined;
104
- // Resolve default target from config when not explicitly provided
117
+ // Config consolidation (docs/06 P2): a bare `glubean run` (no target, no
118
+ // profile) defaults to the `local` profile — there's no global
119
+ // testDir/exploreDir config outside glubean.yaml anymore. The deprecated
120
+ // `--explore` flag maps to the `explore` profile. This MUST run before
121
+ // the --suite guard below so `glubean run --suite X` (no target) narrows
122
+ // the defaulted local profile instead of erroring "requires --profile".
123
+ if (options.explore) {
124
+ console.warn(`\x1b[33m--explore is deprecated; use \`glubean run --profile explore\` ` +
125
+ `(define an \`explore\` profile in glubean.yaml).\x1b[0m`);
126
+ }
127
+ if (!target && !options.profile) {
128
+ options.profile = options.explore ? "explore" : "local";
129
+ }
130
+ // --suite is a profile-mode-only override. Reject it without --profile
131
+ // so the user sees the broader-than-expected run before it starts,
132
+ // instead of silently ignoring the flag. (No-target runs already have a
133
+ // profile from the defaulting above, so this only fires for ad-hoc
134
+ // `glubean run <target> --suite X` with no profile.)
135
+ if (options.suite && !options.profile) {
136
+ console.error(`\x1b[31m--suite requires --profile (the suite name is looked up in ` +
137
+ `the profile's \`suites:\` list).\x1b[0m`);
138
+ process.exit(1);
139
+ }
140
+ // ── Profile mode (Phase 1 first slice) ──────────────────────────────────
141
+ // When --profile is given, load glubean.yaml, resolve the profile, then
142
+ // build CliProfileOverrides from explicit CLI flags so they still beat
143
+ // profile values. Suite expansion + selection/execution/reporters/upload
144
+ // come from the plan.
145
+ //
146
+ // Multi-suite profiles are fully supported: every declared suite is
147
+ // expanded into a concatenated file list with a per-file kind
148
+ // allow-list, in suite declaration order (see the resolvedTarget block
149
+ // below). runCommand accepts `string | string[]` and runs them in a
150
+ // single pass with unified reporter output.
151
+ let resolvedPlan;
152
+ if (options.profile) {
153
+ try {
154
+ // Honor --config when combined with --profile (first --config wins;
155
+ // multi-merge dropped per plan §"是否保留 --config"). Without this,
156
+ // `--config ./ci/glubean.yaml` is silently ignored for profile mode.
157
+ const profileConfigPath = configFiles && configFiles.length > 0
158
+ ? configFiles[0]
159
+ : undefined;
160
+ const { config, configPath } = await loadProjectConfigV1(process.cwd(), profileConfigPath ? { configPath: profileConfigPath } : {});
161
+ // commander's getOptionValueSource returns "cli" only when user typed
162
+ // the flag — otherwise "default" or undefined. Use this to detect
163
+ // explicit overrides for fields where omitted ≠ a meaningful value.
164
+ const cmdSrc = (name) => cmd
165
+ .getOptionValueSource?.(name) === "cli";
166
+ const explicitTags = options.tag && options.tag.length > 0
167
+ ? options.tag.flatMap((t) => t.split(",").map((s) => s.trim()).filter(Boolean))
168
+ : undefined;
169
+ const explicitExcludeTags = options.excludeTag && options.excludeTag.length > 0
170
+ ? options.excludeTag.flatMap((t) => t.split(",").map((s) => s.trim()).filter(Boolean))
171
+ : undefined;
172
+ // --suite is a single-value narrowing override: it restricts the
173
+ // resolved profile to one of its already-declared suites. To run
174
+ // several suites, declare them in the profile — multi-suite
175
+ // expansion is handled by the resolvedTarget block below.
176
+ const explicitSuites = options.suite
177
+ ? [options.suite.trim()].filter(Boolean)
178
+ : undefined;
179
+ const cliOverrides = {
180
+ suites: explicitSuites,
181
+ tags: explicitTags,
182
+ excludeTags: explicitExcludeTags,
183
+ tagMode: cmdSrc("tagMode") ? options.tagMode : undefined,
184
+ filter: options.filter,
185
+ pick: options.pick,
186
+ envFile: options.envFile,
187
+ failFast: cmdSrc("failFast") ? options.failFast : undefined,
188
+ failAfter: options.failAfter ? parseInt(options.failAfter, 10) : undefined,
189
+ includeBrowser: cmdSrc("includeBrowser") ? options.includeBrowser : undefined,
190
+ includeOutOfBand: cmdSrc("includeOutOfBand") ? options.includeOutOfBand : undefined,
191
+ includeOptIn: cmdSrc("includeOptIn") ? options.includeOptIn : undefined,
192
+ emitFullTrace: cmdSrc("emitFullTrace") ? options.emitFullTrace : undefined,
193
+ inferSchema: cmdSrc("inferSchema") ? options.inferSchema : undefined,
194
+ truncateArrays: cmdSrc("truncateArrays") ? options.truncateArrays : undefined,
195
+ uploadEnabled: cmdSrc("upload") ? options.upload : undefined,
196
+ };
197
+ resolvedPlan = resolveRunPlan(config, configPath, options.profile, cliOverrides);
198
+ if (resolvedPlan.suites.length === 0) {
199
+ console.error(`\x1b[31mProfile "${resolvedPlan.profile}" has an empty \`suites\` ` +
200
+ `list. Add at least one suite name in glubean.yaml ` +
201
+ `(e.g. \`profiles.${resolvedPlan.profile}.suites: [tests]\`).\x1b[0m`);
202
+ process.exit(1);
203
+ }
204
+ }
205
+ catch (err) {
206
+ if (err instanceof GlubeanConfigError) {
207
+ console.error(`\x1b[31m${err.message}\x1b[0m`);
208
+ process.exit(1);
209
+ }
210
+ throw err;
211
+ }
212
+ }
213
+ // Resolve target from config when not explicitly provided. In profile
214
+ // mode this iterates each suite, applies its `kinds` filter at the
215
+ // file level, and passes the concatenated file list as the target.
216
+ // runCommand accepts `string | string[]` so a multi-suite profile
217
+ // discovers + runs all suites in a single pass with unified reporter
218
+ // output. (Phase 4 multi-suite execution + the resolved suite.kinds
219
+ // filter that was the documented E1 gap from Phase 1 sub-task E1.)
105
220
  let resolvedTarget = target;
221
+ // Per-file allow-list of runnable kinds for the multi-suite path.
222
+ // Built alongside `resolvedTarget` so runCommand can drop runnables
223
+ // whose kind isn't in any contributing suite's declared kinds —
224
+ // protects mixed-export files (e.g. `.contract.ts` with an inline
225
+ // `contract.flow(...)`).
226
+ let allowedKindsPerFile;
106
227
  if (!resolvedTarget) {
107
- const config = await loadConfig(process.cwd(), configFiles);
108
- resolvedTarget = options.explore ? config.run.exploreDir : config.run.testDir;
228
+ if (resolvedPlan && resolvedPlan.suites.length > 0) {
229
+ // Preserve profile.suites declaration order it controls
230
+ // file:start ordering downstream, which interacts with
231
+ // failFast / failAfter (early failures in earlier suites
232
+ // short-circuit later suites). Dedupe while preserving order
233
+ // when the same path appears across suites.
234
+ const seen = new Set();
235
+ const allFiles = [];
236
+ allowedKindsPerFile = new Map();
237
+ for (const suite of resolvedPlan.suites) {
238
+ const suiteFiles = await resolveTestFilesForSuite(suite.target, suite.kinds);
239
+ // A declared suite that resolves to zero files is almost always a
240
+ // typo (wrong dir, wrong kinds filter). Fail loudly per-suite so
241
+ // CI surfaces the misconfiguration instead of silently dropping
242
+ // it into the aggregate.
243
+ if (suiteFiles.length === 0) {
244
+ console.error(`\x1b[31mSuite "${suite.name}" (target: ${suite.target}, ` +
245
+ `kinds: ${suite.kinds.join(", ") || "any"}) resolved to ` +
246
+ `zero test files. Check the directory exists and contains ` +
247
+ `*.${suite.kinds.join(".ts / *.")}.ts files matching the ` +
248
+ `declared kinds.\x1b[0m`);
249
+ process.exit(1);
250
+ }
251
+ // When a suite has no declared kinds, allow all three. Otherwise
252
+ // union the declared kinds into the per-file allow-list (a file
253
+ // shared between suites with different kinds runs the union).
254
+ const suiteKindSet = suite.kinds.length === 0
255
+ ? new Set(["test", "contract", "flow"])
256
+ : new Set(suite.kinds.filter((k) => k === "test" || k === "contract" || k === "flow"));
257
+ for (const f of suiteFiles) {
258
+ const existing = allowedKindsPerFile.get(f);
259
+ if (existing) {
260
+ for (const k of suiteKindSet)
261
+ existing.add(k);
262
+ }
263
+ else {
264
+ allowedKindsPerFile.set(f, new Set(suiteKindSet));
265
+ }
266
+ if (seen.has(f))
267
+ continue;
268
+ seen.add(f);
269
+ allFiles.push(f);
270
+ }
271
+ }
272
+ resolvedTarget = allFiles;
273
+ }
274
+ else {
275
+ // Unreachable: a missing target with no profile is normalized to the
276
+ // `local`/`explore` profile above, so resolvedPlan (with ≥1 suite) is
277
+ // always present on this branch. Guard the type + invariant.
278
+ console.error(`\x1b[31mNo run target resolved. Pass a path, or define a ` +
279
+ `\`local\` profile in glubean.yaml.\x1b[0m`);
280
+ process.exit(1);
281
+ }
109
282
  }
110
- // --ci implies --fail-fast and --reporter junit
111
- const isCi = options.ci === true;
112
- const failFast = options.failFast || isCi;
283
+ const failFast = resolvedPlan?.execution.failFast ?? options.failFast;
113
284
  let reporter = options.reporter;
114
285
  let reporterPath;
115
- if (!reporter && isCi) {
286
+ // Profile's `reporters.junit` implies `--reporter junit` (with the
287
+ // profile-supplied path) when the user didn't pass --reporter on the CLI.
288
+ if (!reporter && resolvedPlan?.reporters.junit) {
116
289
  reporter = "junit";
117
290
  }
291
+ if (reporter === "junit" && !reporterPath && resolvedPlan?.reporters.junit) {
292
+ reporterPath = resolvedPlan.reporters.junit;
293
+ }
118
294
  if (reporter && reporter.startsWith("junit:")) {
119
295
  reporterPath = reporter.slice("junit:".length);
120
296
  reporter = "junit";
121
297
  }
122
- const resultJson = options.resultJson;
298
+ const resultJson = options.resultJson ?? resolvedPlan?.reporters.resultJson;
299
+ // Helper: only treat CLI-supplied value as override when commander says
300
+ // the user actually typed the flag. Otherwise plan wins.
301
+ const cliSrc = (name) => cmd
302
+ .getOptionValueSource?.(name) === "cli";
303
+ const cliTags = options.tag?.flatMap((t) => t.split(",").map((s) => s.trim()).filter(Boolean));
304
+ const cliExcludeTags = options.excludeTag?.flatMap((t) => t.split(",").map((s) => s.trim()).filter(Boolean));
305
+ // Phase 3 task 5 — print resolved plan AFTER all CLI overrides have
306
+ // been merged so the printout is a verbatim record of what runs (and
307
+ // not stale profile values that --result-json / --reporter / explicit
308
+ // target overrode below). We build the printed view by overlaying the
309
+ // post-override fields on top of `resolvedPlan`.
310
+ //
311
+ // Default-path placeholders: when the user enables `--reporter junit`
312
+ // or `--result-json` without a path, runCommand picks a runtime
313
+ // default (`glubean-run.junit.xml` / `glubean-run.result.json` for
314
+ // multi-file, or `<testfile>.junit.xml` / `<testfile>.result.json`
315
+ // for single-file). The exact default depends on test discovery
316
+ // which hasn't run yet at print time — use a "<default>" hint so the
317
+ // user sees that an artifact WILL be written.
318
+ if (resolvedPlan) {
319
+ // Any user-supplied positional target overrides suite expansion —
320
+ // resolvedTarget becomes that single string instead of the file
321
+ // array built from per-suite resolution. Comparing to a specific
322
+ // suite's target as a "did they really override?" heuristic would
323
+ // misreport the plan when the user passes the same path string
324
+ // that happens to match the first suite's target.
325
+ const explicitTargetGiven = !!target;
326
+ // junit reporter active iff `reporter === "junit"` after the
327
+ // resolution above (from CLI or profile).
328
+ const junitActive = reporter === "junit";
329
+ const printJunit = junitActive
330
+ ? reporterPath ?? "<default: glubean-run.junit.xml or <testfile>.junit.xml>"
331
+ : resolvedPlan.reporters.junit;
332
+ // resultJson can be undefined / string path / true (flag with no value).
333
+ const printResultJson = typeof resultJson === "string"
334
+ ? resultJson
335
+ : resultJson
336
+ ? "<default: glubean-run.result.json or <testfile>.result.json>"
337
+ : undefined;
338
+ // Upload destination: when `--project <id>` is passed, the upload
339
+ // routes to that project id, NOT the profile's `projectAlias`.
340
+ // Reflect that override so the printed plan matches the actual
341
+ // destination. Same enable-bit override for `--upload`.
342
+ const overrideUpload = resolvedPlan.upload
343
+ ? {
344
+ ...resolvedPlan.upload,
345
+ ...(options.project ? { projectAlias: options.project } : {}),
346
+ ...(options.upload === true ? { enabled: true } : {}),
347
+ }
348
+ : options.upload === true || options.project
349
+ ? {
350
+ enabled: options.upload === true,
351
+ ...(options.project ? { projectAlias: options.project } : {}),
352
+ }
353
+ : undefined;
354
+ const printPlan = {
355
+ ...resolvedPlan,
356
+ // Explicit target overrides the suite entirely — don't inherit
357
+ // the original suite name or kinds (they'd misrepresent what
358
+ // discovery actually scans). `kinds` is required by SuiteConfig,
359
+ // so use [] to signal "no kind filter declared here". The
360
+ // explicit `target` is the user-supplied positional arg (always
361
+ // a single string) — distinct from `resolvedTarget` which may be
362
+ // the file array built from per-suite resolution below.
363
+ suites: explicitTargetGiven
364
+ ? [{ name: "(override)", target: target, kinds: [] }]
365
+ : resolvedPlan.suites,
366
+ execution: {
367
+ ...resolvedPlan.execution,
368
+ failFast,
369
+ // Reflect --no-session in the printed plan so the visible
370
+ // record matches the actual run.
371
+ ...(options.session === false ? { noSession: true } : {}),
372
+ },
373
+ reporters: {
374
+ ...resolvedPlan.reporters,
375
+ ...(printJunit ? { junit: printJunit } : {}),
376
+ ...(printResultJson !== undefined ? { resultJson: printResultJson } : {}),
377
+ },
378
+ ...(overrideUpload ? { upload: overrideUpload } : {}),
379
+ };
380
+ console.log(formatResolvedPlan(printPlan));
381
+ console.log("");
382
+ }
123
383
  await runCommand(resolvedTarget, {
124
- filter: options.filter,
125
- pick: options.pick,
126
- tags: options.tag?.flatMap((t) => t.split(",").map((s) => s.trim()).filter(Boolean)),
127
- tagMode: options.tagMode,
128
- envFile: options.envFile,
384
+ filter: options.filter ?? resolvedPlan?.selection.filter,
385
+ pick: options.pick ?? resolvedPlan?.selection.pick,
386
+ tags: (cliTags && cliTags.length > 0) ? cliTags : resolvedPlan?.selection.tags,
387
+ // tagMode: commander always supplies the default "or" so use cli-source
388
+ // detection to know if user actually typed --tag-mode. Otherwise plan wins.
389
+ tagMode: cliSrc("tagMode")
390
+ ? options.tagMode
391
+ : (resolvedPlan?.selection.tagMode ?? options.tagMode),
392
+ excludeTags: (cliExcludeTags && cliExcludeTags.length > 0)
393
+ ? cliExcludeTags
394
+ : resolvedPlan?.selection.excludeTags,
395
+ // envFile: only set when CLI explicitly or profile sets non-default
396
+ // value. runCommand treats any envFile as user-specified and fails
397
+ // hard if the file doesn't exist; falling back silently to ".env"
398
+ // (the plan builtin default) would break projects without a .env.
399
+ envFile: options.envFile ?? (resolvedPlan && resolvedPlan.envFile !== ".env"
400
+ ? resolvedPlan.envFile
401
+ : undefined),
129
402
  logFile: options.logFile,
130
403
  pretty: options.pretty,
131
404
  verbose: options.verbose,
132
405
  failFast,
133
- failAfter: options.failAfter ? parseInt(options.failAfter, 10) : undefined,
406
+ // failAfter: preserve `null` (= "no count limit") explicitly from
407
+ // plan as a real null — mergeRunOptions distinguishes null
408
+ // (override to "off") from undefined (no override, legacy config can
409
+ // still set a limit). Coercing null→undefined would let legacy
410
+ // package.json `glubean.run.failAfter` re-introduce a count limit.
411
+ failAfter: options.failAfter
412
+ ? parseInt(options.failAfter, 10)
413
+ : resolvedPlan
414
+ ? resolvedPlan.execution.failAfter // may be number, null, or 0 (already validated as >=1 or null)
415
+ : undefined,
416
+ timeoutMs: resolvedPlan?.execution.timeoutMs,
417
+ concurrency: resolvedPlan?.execution.concurrency,
134
418
  resultJson,
135
- emitFullTrace: options.emitFullTrace,
136
- inferSchema: options.inferSchema,
137
- truncateArrays: options.truncateArrays,
419
+ emitFullTrace: options.emitFullTrace ?? resolvedPlan?.reporters.emitFullTrace,
420
+ inferSchema: options.inferSchema ?? resolvedPlan?.reporters.inferSchema,
421
+ truncateArrays: options.truncateArrays ?? resolvedPlan?.reporters.truncateArrays,
138
422
  configFiles,
139
423
  inspectBrk: options.inspectBrk,
140
424
  reporter,
141
425
  reporterPath,
142
426
  traceLimit: options.traceLimit ? parseInt(options.traceLimit, 10) : undefined,
143
- includeBrowser: options.includeBrowser,
144
- includeOutOfBand: options.includeOutOfBand,
145
- includeOptIn: options.includeOptIn,
146
- noSession: options.noSession,
427
+ includeBrowser: options.includeBrowser ?? resolvedPlan?.capabilities.browser,
428
+ includeOutOfBand: options.includeOutOfBand ?? resolvedPlan?.capabilities.outOfBand,
429
+ includeOptIn: options.includeOptIn ?? resolvedPlan?.capabilities.optIn,
430
+ // Commander stores `--no-session` as `options.session === false`
431
+ // (NOT `options.noSession`). Treat either form as the negation
432
+ // signal so the long-standing CLI bug doesn't bite ci run users.
433
+ noSession: options.noSession === true || options.session === false
434
+ ? true
435
+ : resolvedPlan?.execution.noSession,
147
436
  meta: options.meta?.length
148
437
  ? options.meta.reduce((acc, item) => {
149
438
  const eq = item.indexOf("=");
@@ -152,14 +441,104 @@ program
152
441
  return acc;
153
442
  }, {})
154
443
  : undefined,
155
- upload: options.upload,
156
- project: options.project,
444
+ upload: options.upload ?? resolvedPlan?.upload?.enabled,
445
+ uploadReceiptJson: options.uploadReceiptJson,
446
+ // When profile has upload.projectAlias and CLI didn't pass --project,
447
+ // forward the alias as the project identifier so the upload preflight
448
+ // doesn't exit with "no project ID found". `resolveProjectId` accepts
449
+ // either a project ID or an alias.
450
+ project: options.project ?? resolvedPlan?.upload?.projectAlias,
157
451
  token: options.token,
158
452
  apiUrl: options.apiUrl,
159
453
  inputJson: options.inputJson,
160
454
  bootstrapJson: options.bootstrapJson,
161
455
  forceStandalone: options.forceStandalone,
456
+ allowedKindsPerFile,
457
+ // Phase 4: thread the v1 plan's full redaction config (replacement
458
+ // format + globalRules + custom patterns) into runCommand so newly
459
+ // init'd projects (which scaffold `defaults.redaction` in
460
+ // glubean.yaml) keep their declared security posture for upload
461
+ // events. The legacy loadConfig path doesn't read glubean.yaml, so
462
+ // without this the upload would use the legacy defaults regardless
463
+ // of what the project declared.
464
+ redactionConfig: resolvedPlan?.redaction,
465
+ // Plan 06 P1 — v1 profile thresholds (defaults.thresholds ∪
466
+ // profile.thresholds). runCommand prefers these over legacy
467
+ // package.json thresholds when non-empty.
468
+ thresholds: resolvedPlan?.thresholds,
469
+ // Phase 5 5a — pass profile name + suite names so runCommand can
470
+ // emit `metadata.runPlan` on upload. Cloud server projects these
471
+ // to top-level RunEntity fields for query indexing.
472
+ // When the user supplied an explicit positional target, suites
473
+ // from the profile didn't drive expansion (resolvedTarget is the
474
+ // raw target string, not the per-suite file list) — omit suites
475
+ // so `?suite=Y` queries don't incorrectly match runs that didn't
476
+ // actually execute suite Y. Profile name stays meaningful (its
477
+ // selection/execution/reporters still applied).
478
+ profile: resolvedPlan?.profile,
479
+ suites: target ? undefined : resolvedPlan?.suites.map((s) => s.name),
162
480
  });
481
+ }
482
+ // ─────────────────────────────────────────────────────────────────────────────
483
+ // ci subcommand — Phase 3 tasks 3+4
484
+ //
485
+ // `glubean ci run` is the explicit CI entry point. It's equivalent to
486
+ // `glubean run --profile ci`, but it makes the CI dependency on
487
+ // `profiles.ci` visible at the command surface (instead of via a hidden
488
+ // flag). When the project has no `profiles.ci`, the underlying profile
489
+ // resolution fails closed with a list of available profiles — no silent
490
+ // fallback.
491
+ // ─────────────────────────────────────────────────────────────────────────────
492
+ const ciCmd = program
493
+ .command("ci")
494
+ .description("CI-mode subcommands (entry point: `glubean ci run`).");
495
+ ciCmd
496
+ .command("run [target]")
497
+ .description("Run tests with the `ci` profile from glubean.yaml. Equivalent to " +
498
+ "`glubean run --profile ci`. A multi-suite `profiles.ci` runs all " +
499
+ "its declared suites; use `--suite <name>` to narrow to one.")
500
+ // `--explore` deliberately omitted on ci run: in the v1 config model the
501
+ // explore-vs-test distinction is a dedicated profile (e.g.
502
+ // `glubean run --profile explore`), not a flag on the CI entry point.
503
+ .option("-f, --filter <pattern>", "Run only tests matching pattern (name or id substring)")
504
+ .option("--suite <name>", "Run only the named suite from the `ci` profile. The name must already appear in `profile.suites`. (Single value — narrows a multi-suite profile to one suite.)")
505
+ .option("-t, --tag <tag>", "Run only tests with matching tag (comma-separated or repeatable)", collect, [])
506
+ .option("--tag-mode <mode>", 'Tag match logic: "or" (any tag) or "and" (all tags)', "or")
507
+ .option("--exclude-tag <tag>", "Exclude tests with matching tag (comma-separated or repeatable; always OR-mode — any match drops the test)", collect, [])
508
+ .option("--env-file <path>", "Path to .env file (default: .env if it exists)")
509
+ .option("-l, --log-file", "Write logs to file (<testfile>.log)")
510
+ .option("--pretty", "Pretty-print JSON in log file (2-space indent)")
511
+ .option("--verbose", "Show all output (traces, assertions) in console")
512
+ .option("--fail-fast", "Stop on first test failure")
513
+ .option("--fail-after <count>", "Stop after N test failures")
514
+ .option("--result-json [path]", "Write structured results to .result.json (or custom path)")
515
+ .option("--emit-full-trace", "Include full request/response headers and bodies in HTTP traces")
516
+ .option("--infer-schema", "Infer JSON Schema from response bodies in traces")
517
+ .option("--truncate-arrays", "Always truncate arrays in trace bodies for AI-friendly output")
518
+ .option("--config <paths>", "Config file(s), comma-separated or repeatable", collect, [])
519
+ .option("--pick <keys>", "Select specific test.pick example(s) by key (comma-separated)")
520
+ .option("--inspect-brk [port]", "Enable V8 Inspector for debugging (pauses until debugger attaches)")
521
+ .option("--reporter <format>", 'Output format: "junit" or "junit:/path/to/output.xml"')
522
+ .option("--trace-limit <count>", "Max trace files to keep per test (default: 20)")
523
+ .option("--include-browser", "Include cases that require a browser (e.g., OAuth login)")
524
+ .option("--include-out-of-band", "Include cases that require out-of-band channels (email, SMS)")
525
+ .option("--include-opt-in", "Include opt-in cases (expensive, slow, or side-effect-producing)")
526
+ .option("--no-session", "Skip session setup/teardown")
527
+ .option("-M, --meta <key=value>", "Custom run metadata (repeatable)", collect, [])
528
+ .option("--upload", "Upload run results and artifacts to Glubean Cloud")
529
+ .option("--upload-receipt-json <path>", "Write Cloud upload receipt JSON after --upload")
530
+ .option("--project <id>", "Glubean Cloud project ID (or GLUBEAN_PROJECT_ID env)")
531
+ .option("--token <token>", "Auth token for cloud upload (or GLUBEAN_TOKEN env)")
532
+ .option("--api-url <url>", "Glubean API server URL")
533
+ .option("--input-json <value>", "Explicit case input as JSON literal or @path/to.json. Validated against the case's `needs` schema; runs raw (overlay skipped). Requires --filter to match exactly one testId.")
534
+ .option("--bootstrap-json <value>", "Bootstrap params as JSON literal or @path/to.json. Validated against the overlay's `params` schema and passed to overlay's run(ctx, params). Requires --filter to match exactly one testId.")
535
+ .option("--force-standalone", "DEBUG: bypass `runnability.requireAttachment` for the filtered case. Emits a runtime warning. Author-debug only.")
536
+ .action(async (target, options, cmd) => {
537
+ // Bake in the `ci` profile so executeRun's profile-mode branch fires.
538
+ // The user can't override this — that would defeat the point of the
539
+ // subcommand. To run a different profile they'd use `glubean run --profile <X>`.
540
+ options.profile = "ci";
541
+ await executeRun(target, options, cmd);
163
542
  });
164
543
  // ─────────────────────────────────────────────────────────────────────────────
165
544
  // scan command
@@ -193,6 +572,20 @@ program
193
572
  });
194
573
  });
195
574
  // ─────────────────────────────────────────────────────────────────────────────
575
+ // migrate command
576
+ // ─────────────────────────────────────────────────────────────────────────────
577
+ program
578
+ .command("migrate")
579
+ .description("Preview or apply v0.1.x -> v10 project migrations")
580
+ .option("-d, --dir <path>", "Project directory", ".")
581
+ .option("--apply", "Write changes instead of printing a dry-run diff")
582
+ .action(async (options) => {
583
+ await migrateCommand({
584
+ dir: options.dir,
585
+ apply: options.apply,
586
+ });
587
+ });
588
+ // ─────────────────────────────────────────────────────────────────────────────
196
589
  // validate-metadata command
197
590
  // ─────────────────────────────────────────────────────────────────────────────
198
591
  program