dev-cockpit 0.6.0 → 0.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"composer-drift.d.ts","sourceRoot":"","sources":["../../../src/health/predicates/composer-drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAoBD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,aAAa,EAClB,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,YAAY,CAAC,CA0CvB;AAeD,MAAM,WAAW,+BAAgC,SAAQ,yBAAyB;IAChF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CAC1C;AAED,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,+BAAoC,GACzC,WAAW,CAiBb"}
1
+ {"version":3,"file":"composer-drift.d.ts","sourceRoot":"","sources":["../../../src/health/predicates/composer-drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAoBD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,aAAa,EAClB,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,YAAY,CAAC,CA0CvB;AAeD,MAAM,WAAW,+BAAgC,SAAQ,yBAAyB;IAChF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CAC1C;AAED,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,+BAAoC,GACzC,WAAW,CA4Bb"}
@@ -24,4 +24,15 @@ export declare function runRemediation(key: RemediationKey, checks: HealthCheck[
24
24
  */
25
25
  export declare function findRemediation(key: RemediationKey, checks: HealthCheck[]): HealthCheck | undefined;
26
26
  export declare function dispatchRemediation(remediation: Remediation, ctx: HealthContext, workspaceRoot: string, sourceId: string): Promise<void>;
27
+ /**
28
+ * Run a single command, streaming its stdout/stderr into the health output log
29
+ * under `health:<sourceId>`. Resolves with the process exit code once it exits.
30
+ *
31
+ * Shared by the `command`-shape dispatcher above and by `run`-shape
32
+ * remediations that need to invoke one or more commands with a proper per-call
33
+ * `cwd` (e.g. `composer install` in several package dirs). Keeping this the one
34
+ * way a remediation reaches a subprocess means commands stay plain argv — no
35
+ * shell string is ever parsed, so `&&` / `(cd …)` can't leak into argv.
36
+ */
37
+ export declare function streamCommand(ctx: HealthContext, sourceId: string, program: string, args: string[], cwd: string): Promise<number>;
27
38
  //# sourceMappingURL=remediations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remediations.d.ts","sourceRoot":"","sources":["../../src/health/remediations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,MAAM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AAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAevE;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,WAAW,EAAE,EACrB,GAAG,EAAE,aAAa,EAClB,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,WAAW,EAAE,GACpB,WAAW,GAAG,SAAS,CAEzB;AAED,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,aAAa,EAClB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
package/dist/index.js CHANGED
@@ -88257,6 +88257,9 @@ async function dispatchRemediation(remediation, ctx, workspaceRoot, sourceId) {
88257
88257
  if (!program2) return;
88258
88258
  const args = parts.slice(1);
88259
88259
  const cwd = remediation.cwd ?? workspaceRoot;
88260
+ await streamCommand(ctx, sourceId, program2, args, cwd);
88261
+ }
88262
+ async function streamCommand(ctx, sourceId, program2, args, cwd) {
88260
88263
  const handle = spawnStream(program2, args, {
88261
88264
  cwd,
88262
88265
  onStdout: (line2) => ctx.appendOutput?.({
@@ -88272,7 +88275,7 @@ async function dispatchRemediation(remediation, ctx, workspaceRoot, sourceId) {
88272
88275
  text: line2
88273
88276
  })
88274
88277
  });
88275
- await handle.exitCode;
88278
+ return handle.exitCode;
88276
88279
  }
88277
88280
 
88278
88281
  // src/health/notify-resolver.ts
@@ -91186,17 +91189,29 @@ function status3(severity, detail) {
91186
91189
  }
91187
91190
  function createComposerDriftCheck(opts = {}) {
91188
91191
  const dirs = opts.packageDirs ?? ["."];
91189
- const defaultCommand = dirs.map((d) => d === "" || d === "." ? "composer install" : `(cd ${d} && composer install)`).join(" && ");
91192
+ const id = opts.id ?? "composer-drift";
91190
91193
  return {
91191
- id: opts.id ?? "composer-drift",
91194
+ id,
91192
91195
  label: opts.label ?? "Composer",
91193
91196
  severity: opts.severity ?? "error",
91194
91197
  triggers: opts.triggers ?? ["startup", "lockfile"],
91195
91198
  predicate: (ctx) => checkComposerDrift(ctx, opts),
91199
+ // Run `composer install` once per package dir, each in its own cwd. A
91200
+ // declarative `command` string can't express this without shell syntax
91201
+ // (`&&`, `(cd …)`), and the dispatcher runs commands as plain argv — so
91202
+ // that syntax would reach composer as bogus package arguments. The `run`
91203
+ // shape keeps each invocation a clean argv in the right directory and
91204
+ // short-circuits on the first failure, mirroring `&&`.
91196
91205
  remediation: opts.remediation ?? {
91197
91206
  key: "R",
91198
91207
  label: "Run composer install",
91199
- command: defaultCommand
91208
+ run: async (ctx, workspaceRoot) => {
91209
+ for (const d of dirs) {
91210
+ const cwd = d === "" || d === "." ? workspaceRoot : path15.join(workspaceRoot, d);
91211
+ const code = await streamCommand(ctx, id, "composer", ["install"], cwd);
91212
+ if (code !== 0) break;
91213
+ }
91214
+ }
91200
91215
  }
91201
91216
  };
91202
91217
  }