@sdods/cli 0.12.0 → 0.12.1

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.
@@ -6,6 +6,7 @@ import { RecordingModeSchema, newRunId, runFiles, } from '@sdods/contracts';
6
6
  import { SdodsError, CLI_OVERRIDES_ENV, VERSION, checkPoolCapacity, collectGateEvidence, effectiveWorkers, evaluateGates, formatFindings, hasGates, lintProject, listGeneratedProjects, moduleByName, moduleDir, normalizeTagExpr, parseTagExpr, poolAccountsFor, poolDemandByRole, poolTooSmallError, redactRunTraces, serializeCliOverrides, setupTierOf, } from '@sdods/core';
7
7
  import { analyzeChangeImpact } from '@sdods/mcp';
8
8
  import { createContext } from '../context.js';
9
+ import { workspaceBin } from '../workspace-bin.js';
9
10
  import { browserStatuses, ensureBrowsers } from './browsers.js';
10
11
  import { gateFailedError, printGates } from '../gates.js';
11
12
  import { maybeNotify, notifyRun } from '../notify.js';
@@ -328,7 +329,8 @@ export async function runCommand(flags, cmd) {
328
329
  // Recorded specs are plain runner tests: no Gherkin to generate.
329
330
  const recordedOnly = runnerProjects.every((p) => p.layer === 'recorded');
330
331
  if (!recordedOnly) {
331
- const gen = await execa('npx', ['bddgen', '-c', configPath], {
332
+ const [bddgen, ...bddgenArgs] = workspaceBin(ctx.rootDir, 'playwright-bdd', 'bddgen');
333
+ const gen = await execa(bddgen, [...bddgenArgs, '-c', configPath], {
332
334
  cwd: ctx.rootDir,
333
335
  env: childEnv,
334
336
  stdio: ctx.opts.quiet ? 'pipe' : 'inherit',
@@ -4,6 +4,7 @@ import pc from 'picocolors';
4
4
  import { newRunId } from '@sdods/contracts';
5
5
  import { SdodsError, listGeneratedProjects, normalizeTagExpr } from '@sdods/core';
6
6
  import { createContext } from '../context.js';
7
+ import { workspaceBin } from '../workspace-bin.js';
7
8
  import { collect, out } from '../ui.js';
8
9
  /**
9
10
  * Spec generation runs in watch mode while the interactive UI
@@ -68,7 +69,8 @@ export function register(program) {
68
69
  process.on('SIGINT', stop);
69
70
  process.on('SIGTERM', stop);
70
71
  // initial generation so UI mode has specs to show
71
- const gen = await execa('npx', ['bddgen', '-c', configPath], {
72
+ const [bddgen, ...bddgenArgs] = workspaceBin(ctx.rootDir, 'playwright-bdd', 'bddgen');
73
+ const gen = await execa(bddgen, [...bddgenArgs, '-c', configPath], {
72
74
  cwd: ctx.rootDir,
73
75
  env: childEnv,
74
76
  stdio: 'inherit',
@@ -79,7 +81,7 @@ export function register(program) {
79
81
  exitCode: 1,
80
82
  });
81
83
  }
82
- const watcher = execa('npx', ['bddgen', '-c', configPath, '--watch'], {
84
+ const watcher = execa(bddgen, [...bddgenArgs, '-c', configPath, '--watch'], {
83
85
  cwd: ctx.rootDir,
84
86
  env: childEnv,
85
87
  stdio: 'inherit',
@@ -0,0 +1,12 @@
1
+ /**
2
+ * How to run a package's CLI from the workspace: `[node, <its bin script>]` when the package is
3
+ * installed there, else `['npx', <bin>]`.
4
+ *
5
+ * `npx <bin>` only finds a tool through a `node_modules/.bin` shim. Some layouts have the package
6
+ * but no shim npx recognises (bun on Windows writes `.bunx` shims), and npx then downloads an
7
+ * unrelated registry package of the same name: `npx bddgen` fetched `bddgen@1.0.5` and every run
8
+ * failed with "bddgen failed to generate specs". Resolving the package and running its bin with
9
+ * this Node works in every layout.
10
+ */
11
+ export declare function workspaceBin(rootDir: string, pkg: string, bin: string): [string, ...string[]];
12
+ //# sourceMappingURL=workspace-bin.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ /**
5
+ * How to run a package's CLI from the workspace: `[node, <its bin script>]` when the package is
6
+ * installed there, else `['npx', <bin>]`.
7
+ *
8
+ * `npx <bin>` only finds a tool through a `node_modules/.bin` shim. Some layouts have the package
9
+ * but no shim npx recognises (bun on Windows writes `.bunx` shims), and npx then downloads an
10
+ * unrelated registry package of the same name: `npx bddgen` fetched `bddgen@1.0.5` and every run
11
+ * failed with "bddgen failed to generate specs". Resolving the package and running its bin with
12
+ * this Node works in every layout.
13
+ */
14
+ export function workspaceBin(rootDir, pkg, bin) {
15
+ try {
16
+ const manifest = createRequire(join(rootDir, 'package.json')).resolve(`${pkg}/package.json`);
17
+ const { bin: bins } = JSON.parse(readFileSync(manifest, 'utf8'));
18
+ const rel = typeof bins === 'string' ? bins : bins?.[bin];
19
+ if (rel)
20
+ return [process.execPath, join(dirname(manifest), rel)];
21
+ }
22
+ catch {
23
+ // not resolvable from here: fall back to npx
24
+ }
25
+ return ['npx', bin];
26
+ }
27
+ //# sourceMappingURL=workspace-bin.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdods/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "SDODS command line: run, record, analyze, agents, MCP server, scheduler and the web server.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SDODS <admin@sdods.com>",
@@ -25,8 +25,8 @@
25
25
  "node": ">=22"
26
26
  },
27
27
  "dependencies": {
28
- "@sdods/contracts": "0.12.0",
29
- "@sdods/core": "0.12.0",
28
+ "@sdods/contracts": "0.12.1",
29
+ "@sdods/core": "0.12.1",
30
30
  "commander": "^15.0.0",
31
31
  "execa": "^10.0.1",
32
32
  "picocolors": "^1.1.1",
@@ -35,12 +35,12 @@
35
35
  "zod": "^4.6.5",
36
36
  "@playwright/test": "^1.63.0",
37
37
  "playwright-core": "^1.63.0",
38
- "@sdods/integrations": "0.12.0",
39
- "@sdods/mcp": "0.12.0",
40
- "@sdods/agents": "0.12.0",
41
- "@sdods/db": "0.12.0",
38
+ "@sdods/integrations": "0.12.1",
39
+ "@sdods/mcp": "0.12.1",
40
+ "@sdods/agents": "0.12.1",
41
+ "@sdods/db": "0.12.1",
42
42
  "csv-parse": "^7.0.2",
43
- "@sdods/server": "0.12.0"
43
+ "@sdods/server": "0.12.1"
44
44
  },
45
45
  "homepage": "https://sdods.com",
46
46
  "bugs": {