@vaultcompass/conductor 0.2.2 → 0.2.4

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.
package/README.md CHANGED
@@ -220,6 +220,22 @@ that gate, for pointing at a build that is not installed anywhere.
220
220
  `--adopt`: those hooks were never conductor's, and no flag here turns
221
221
  somebody else's file into one this tool may overwrite.
222
222
 
223
+ Init recognises the hook manager already wired into the repository. husky is
224
+ redirected to the tracked hook it maintains rather than the generated
225
+ dispatcher git runs. lefthook and the pre-commit framework are refused, with
226
+ the stanza to add to their own config file. simple-git-hooks and yorkie are
227
+ refused too, and recognised from the declaration as well as from the hook
228
+ file, because the declaration is there on a fresh clone where the generated
229
+ hook is not yet: the `simple-git-hooks` or `gitHooks` key in package.json, or
230
+ any of the standalone config files simple-git-hooks reads. Their hook text
231
+ lives in package.json, which conductor does not write, so the guidance names
232
+ the entry to add and `--force` does not override the refusal.
233
+
234
+ That refusal applies only where git actually runs `.git/hooks`. Both managers
235
+ write that directory and neither reads `core.hooksPath`, so a repository that
236
+ has pointed git somewhere else has taken their file out of play, and init
237
+ proceeds normally without mentioning them.
238
+
223
239
  `conductor run` runs every enabled gate and prints one report.
224
240
 
225
241
  - `--staged` gates the git index against HEAD, which is what the hook does.
@@ -281,11 +297,24 @@ gate looks like. In Actions this is almost always a shallow checkout, so
281
297
  outranks everything, and a path here that is not on disk is reported
282
298
  rather than replaced: running a different contract than the one somebody
283
299
  named is the wrong kindness.
284
- 2. `<repo>/.conductor/intent-contract.yaml`, when it is **frozen**. The
285
- native flow wins wherever a team has done it. Frozen is the test rather
286
- than present: an unfrozen contract is a draft somebody left behind, and
287
- running the gate against it fails every pull request on "not frozen by
288
- user" without checking anything.
300
+ 2. `<repo>/.intent-guard/intent-contract.yaml`, when it is **frozen**, and
301
+ `<repo>/.conductor/intent-contract.yaml` after it. The native flow wins
302
+ wherever a team has done it. Frozen is the test rather than present: an
303
+ unfrozen contract is a draft somebody left behind, and running the gate
304
+ against it fails every pull request on "not frozen by user" without
305
+ checking anything.
306
+
307
+ The second path is the directory intent-guard used before 1.3.0, which
308
+ renamed it because `.conductor` had become the name of a different product
309
+ in this family. Both are read, so a repository on either version is
310
+ checked rather than blocked, and a run that used the old one says so: one
311
+ line on the gate's contract line in the text report, and an
312
+ `intent-guard/legacy-state-dir` notification in the SARIF log. If the
313
+ repository holds **both** directories, the gate does not run and says so,
314
+ naming both: that is the state intent-guard itself refuses every command
315
+ in, so the umbrella refuses on exactly the gate's rule rather than a
316
+ softer one. A `.conductor` holding nothing intent-guard wrote belongs to
317
+ something else and is ignored.
289
318
  3. The **first** `Spec: <path>` line in the pull request body, read from the
290
319
  event payload at `GITHUB_EVENT_PATH`. A path here that is not on disk, or
291
320
  one that leaves the repository, falls through to the next rule.
@@ -319,9 +348,9 @@ and that includes a contributor from a fork.** On the ordinary path, where a
319
348
  repository has no frozen contract of its own, `Spec: none` means the intent
320
349
  gate does not run at all on that pull request, and budget breaches are the
321
350
  thing this gate blocks on. The one thing a waiver cannot override is a frozen
322
- `.conductor/intent-contract.yaml`, which is checked first: a repository that
323
- wants the gate to be non-waivable freezes a native contract and keeps it
324
- committed.
351
+ native contract, under either of the two paths above, which is checked first:
352
+ a repository that wants the gate to be non-waivable freezes a native contract
353
+ and keeps it committed.
325
354
 
326
355
  **What blocks is unchanged.** Blocking stays where intent-guard puts it:
327
356
  budget breaches block, subject to `enforce`. Drift on its own is reported and
package/dist/cli.js CHANGED
@@ -125,7 +125,11 @@ export function buildProgram() {
125
125
  const cwd = process.cwd();
126
126
  const shared = { cwd, pathValue: process.env.PATH ?? '' };
127
127
  if (options.revert) {
128
- const result = revertInit({ ...shared, force: Boolean(options.force) });
128
+ const result = revertInit({
129
+ ...shared,
130
+ force: Boolean(options.force),
131
+ dryRun: Boolean(options.dryRun),
132
+ });
129
133
  const rendered = `${renderRevertHuman(result)}\n`;
130
134
  if (options.json) {
131
135
  process.stdout.write(`${JSON.stringify(result)}\n`);
@@ -199,7 +199,12 @@ export function runGate(gate, options) {
199
199
  ...progress,
200
200
  durationMs: Date.now() - started,
201
201
  couldNotRun: { reason: 'unparseable-output', detail },
202
- findings: [normalizeUnparseableGate(gate.role, gate.product, detail)],
202
+ // progress.stderr, because the comment on progress promises exactly
203
+ // this: it is kept current so an unexpected throw still reports which
204
+ // binary ran and what it printed. Leaving it off here made that
205
+ // promise false for the finding, which is the only part of it a
206
+ // published log ever sees.
207
+ findings: [normalizeUnparseableGate(gate.role, gate.product, detail, progress.stderr)],
203
208
  run: EMPTY_RUN,
204
209
  diagnostics: [],
205
210
  };
@@ -276,7 +281,9 @@ function runGateInner(gate, options, started, progress) {
276
281
  ...withRun,
277
282
  exitCode: null,
278
283
  couldNotRun: { reason: 'spawn-failed', detail: child.error.message },
279
- findings: [normalizeFailedGate(gate.role, gate.product, child.error.message)],
284
+ findings: [
285
+ normalizeFailedGate(gate.role, gate.product, child.error.message, withRun.stderr),
286
+ ],
280
287
  run: EMPTY_RUN,
281
288
  diagnostics: [],
282
289
  };
@@ -294,7 +301,11 @@ function runGateInner(gate, options, started, progress) {
294
301
  ...withRun,
295
302
  exitCode,
296
303
  couldNotRun: { reason: 'gate-error', detail },
297
- findings: [normalizeFailedGate(gate.role, gate.product, detail)],
304
+ // The child's own stderr goes with it. The text report prints it from
305
+ // the outcome, but a gate that could not run gets no SARIF run of its
306
+ // own, so this finding is the only place a published log can say what
307
+ // the gate actually complained about.
308
+ findings: [normalizeFailedGate(gate.role, gate.product, detail, withRun.stderr)],
298
309
  run: EMPTY_RUN,
299
310
  diagnostics: [],
300
311
  };
@@ -314,7 +325,7 @@ function runGateInner(gate, options, started, progress) {
314
325
  ...withRun,
315
326
  exitCode,
316
327
  couldNotRun: { reason: 'unparseable-output', detail },
317
- findings: [normalizeUnparseableGate(gate.role, gate.product, detail)],
328
+ findings: [normalizeUnparseableGate(gate.role, gate.product, detail, withRun.stderr)],
318
329
  run: EMPTY_RUN,
319
330
  diagnostics: [],
320
331
  };
@@ -346,7 +357,7 @@ function runGateInner(gate, options, started, progress) {
346
357
  ...withRun,
347
358
  exitCode,
348
359
  couldNotRun: { reason: 'unparseable-output', detail },
349
- findings: [normalizeUnparseableGate(gate.role, gate.product, detail)],
360
+ findings: [normalizeUnparseableGate(gate.role, gate.product, detail, withRun.stderr)],
350
361
  run: EMPTY_RUN,
351
362
  diagnostics: [],
352
363
  };
package/dist/init.d.ts CHANGED
@@ -23,8 +23,31 @@ export declare const INTENT_GUARD_HOOK_MARKER = "conductor-managed-pre-commit";
23
23
  * a flag, and this one detects it: the umbrella's whole job is to be run
24
24
  * once in a repository somebody else already wired up.
25
25
  */
26
- export type HookManager = 'native' | 'husky' | 'lefthook' | 'precommit';
27
- export type ConflictReason = 'not-a-git-repository' | 'foreign-hook' | 'gate-hook' | 'generated-hook' | 'hooks-path-outside-repository' | 'no-manifest' | 'manifest-unreadable' | 'changed-since-init' | 'write-failed';
26
+ export type HookManager = 'native' | 'husky' | 'lefthook' | 'precommit' | 'simple-git-hooks' | 'yorkie';
27
+ /**
28
+ * The two managers whose pre-commit TEXT lives in package.json rather than
29
+ * in a config file of their own or in the hook file.
30
+ *
31
+ * They are kept apart from lefthook and the pre-commit framework because
32
+ * the refusal is different: there is no manager-owned config file to point
33
+ * somebody at, only a key in the file conductor deliberately never writes.
34
+ */
35
+ export type ManagedHookManager = 'simple-git-hooks' | 'yorkie';
36
+ export type ConflictReason = 'not-a-git-repository' | 'foreign-hook' | 'gate-hook' | 'generated-hook'
37
+ /**
38
+ * A manager whose hook text lives in package.json owns this file:
39
+ * simple-git-hooks or yorkie. Distinct from generated-hook because the
40
+ * remedy is different -- there is no config file of the manager's own to
41
+ * point at, only a key in package.json that conductor will not write.
42
+ */
43
+ | 'managed-hooks' | 'hooks-path-outside-repository'
44
+ /**
45
+ * A path recorded in the manifest resolves outside the repository. The
46
+ * manifest is a committed, untrusted file, so revert and apply refuse any
47
+ * path in it that is not contained rather than writing or deleting where it
48
+ * points.
49
+ */
50
+ | 'manifest-path-outside-repository' | 'no-manifest' | 'manifest-unreadable' | 'changed-since-init' | 'write-failed';
28
51
  export interface InitConflict {
29
52
  path: string;
30
53
  reason: ConflictReason;
@@ -105,6 +128,13 @@ export interface RevertResult {
105
128
  ok: boolean;
106
129
  actions: InitAction[];
107
130
  conflicts: InitConflict[];
131
+ /**
132
+ * A dry run planned the revert and touched nothing. The actions describe
133
+ * what it WOULD have removed or restored, and `ok` is what the same revert
134
+ * would have returned for real, so `--revert --dry-run` exits the way the
135
+ * revert it previews would.
136
+ */
137
+ dryRun: boolean;
108
138
  }
109
139
  /**
110
140
  * Removes exactly what init wrote, and nothing else.