@vaultcompass/conductor 0.4.5 → 0.4.6

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.
@@ -8,5 +8,33 @@ export interface TextOptions {
8
8
  * wants their own terminal to be is not that.
9
9
  */
10
10
  verbose?: boolean;
11
+ /**
12
+ * The umbrella's own package version, printed as the first line of the
13
+ * full report. This text report is also the pull-request comment body,
14
+ * and without this line nothing on it says which conductor produced it.
15
+ *
16
+ * Left out of the one-line clean summary on purpose: that line is kept to
17
+ * one line by design, and the version is not the fact a clean run needs to
18
+ * lead with. Omitted entirely (no line at all) when no version is given,
19
+ * so a caller that does not pass one sees the same report as before.
20
+ */
21
+ version?: string;
22
+ /**
23
+ * Renders a short body instead of the full report when the trust base was
24
+ * refused and no gate ran: the version, the verdict sentence, and every
25
+ * refusal detail line the full report would have printed for this case
26
+ * (`refusalLines`) -- which is the reason and, when the base ref carries
27
+ * no policy file at all, the remedy that reason names. There is no
28
+ * pointer at a step log: a fork's read-only token cannot even show the
29
+ * commenter that log, so the reason has to be ON the comment rather than
30
+ * behind a link to one.
31
+ *
32
+ * Built for the pull-request-comment step. Its whole point is otherwise a
33
+ * full sticky comment whose only content is "the trust base was refused,
34
+ * nothing was checked" -- true, but not worth the ceremony of the full
35
+ * per-gate report on every push. Every other run is unaffected: this only
36
+ * fires when the trust base was actually refused, whatever --verbose says.
37
+ */
38
+ compact?: boolean;
11
39
  }
12
40
  export declare function renderText(result: RunResult, options?: TextOptions): string;
@@ -599,8 +599,28 @@ function summaryLine(result) {
599
599
  parts.push('Re-run with --verbose for the full report.');
600
600
  return parts.join(' ');
601
601
  }
602
+ /**
603
+ * The version line, as the first line of every report that carries one.
604
+ *
605
+ * One function rather than one literal at each of the two call sites below:
606
+ * the compact body and the full report both lead with it, and a change to
607
+ * the line's wording only needs one edit to stay in sync between them.
608
+ */
609
+ function versionLine(version) {
610
+ return version === undefined ? [] : [`conductor ${version}`];
611
+ }
602
612
  export function renderText(result, options = {}) {
603
613
  const refusal = refusalLines(result);
614
+ if (options.compact === true && refusal.length > 0) {
615
+ // The version, then the verdict sentence, then EVERY refusal detail
616
+ // line the full report would have printed for this case -- refusalLines
617
+ // itself, which already carries the base-ref-specific remedy (running
618
+ // "conductor init", or reading the pull request's own file as a
619
+ // proposal) as part of the same sentence. Nothing here points at a step
620
+ // log: the reason has to be readable on the comment itself.
621
+ const lines = [...versionLine(options.version), verdict(result), ...refusal];
622
+ return `${lines.join('\n')}\n`;
623
+ }
604
624
  if (refusal.length === 0 && !options.verbose && isFullyClean(result)) {
605
625
  return `${summaryLine(result)}\n`;
606
626
  }
@@ -613,6 +633,7 @@ export function renderText(result, options = {}) {
613
633
  // different questions, so two numbers, and the section headers and the
614
634
  // "not enforced" lines are what connect them.
615
635
  const lines = [
636
+ ...versionLine(options.version),
616
637
  ...refusal,
617
638
  ...(refusal.length === 0 ? [] : ['']),
618
639
  `conductor run: ${result.gates.length} gate(s), ${result.findings.length} finding(s)`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultcompass/conductor",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "type": "module",
5
5
  "description": "Umbrella installer and combined report over the independently installable guardrail gates.",
6
6
  "keywords": [