vigiles 9.0.0 → 10.0.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.
@@ -14,13 +14,22 @@
14
14
  import { type AuditScore } from "./audit-score.js";
15
15
  import { type Recommendation } from "./optimize.js";
16
16
  import type { AdoptabilityResult } from "./adoptability.js";
17
- import type { ScanReport } from "./scan.js";
17
+ import type { ScanReport, MarketplaceInfo } from "./scan.js";
18
+ import type { PluginScore } from "./leaderboard.js";
18
19
  /** The current schema version. Bump only on a BREAKING change to the shape. */
19
20
  export declare const AUDIT_SCHEMA_VERSION = 1;
20
21
  export interface AuditReportMeta {
21
22
  /** Wire-format version — consumers gate on this. */
22
23
  readonly schemaVersion: typeof AUDIT_SCHEMA_VERSION;
23
24
  readonly tool: "vigiles";
25
+ /**
26
+ * Discriminates the three `audit --json` shapes a consumer may receive:
27
+ * `audit` (one plugin → {@link AuditReport}), `leaderboard` (a marketplace /
28
+ * multiple dirs → {@link LeaderboardReport}), `marketplace` (a curated,
29
+ * all-external marketplace → {@link MarketplaceReport}). Always present so the
30
+ * JSON is self-describing.
31
+ */
32
+ readonly kind: "audit";
24
33
  /** The vigiles version that produced the report. */
25
34
  readonly vigilesVersion: string;
26
35
  /** The detected/selected harness (`claude-code`, `codex`, …). */
@@ -39,6 +48,29 @@ export interface AuditInventory {
39
48
  readonly mcp: boolean;
40
49
  readonly untested: number;
41
50
  }
51
+ /**
52
+ * A surface (skill / subagent / instruction file) that EXISTS but doesn't yet
53
+ * have a `.spec.ts` — so it can be adopted into a typed spec. The report can't
54
+ * write files (it's a browser app), so it EMITS the exact CLI command instead.
55
+ */
56
+ export interface AdoptableSurface {
57
+ /** The repo-relative path of the surface (e.g. `skills/foo/SKILL.md`). */
58
+ readonly path: string;
59
+ /** The exact command that adopts this one surface. */
60
+ readonly command: string;
61
+ }
62
+ /**
63
+ * The adoptable-surfaces list + the "create all" command — the data the report's
64
+ * "Create spec" / "Create all specs" affordances copy to the clipboard. Present
65
+ * only when there's at least one un-spec'd surface; the CLI computes the surface
66
+ * paths (the layout-aware `discoverAdoptableSurfaces`) and passes them in, so the
67
+ * pure builder stays adapter-agnostic.
68
+ */
69
+ export interface Adoptable {
70
+ readonly surfaces: readonly AdoptableSurface[];
71
+ /** The one command that adopts every surface at once. */
72
+ readonly createAllCommand: string;
73
+ }
42
74
  /**
43
75
  * The full audit, as the dashboard / CI / HTML all consume it. Self-describing
44
76
  * and versioned; additive-only within a `schemaVersion`.
@@ -56,10 +88,24 @@ export interface AuditReport {
56
88
  * Additive/optional, so the schema version is unchanged.
57
89
  */
58
90
  readonly adoptability?: AdoptabilityResult;
91
+ /**
92
+ * The surfaces that exist but aren't spec-managed yet, each with the command
93
+ * that adopts it, plus a "create all" command. Drives the report's "Create
94
+ * spec" / "Create all specs" command-emit buttons. Present only when there's
95
+ * at least one adoptable surface. Additive/optional — schema version unchanged.
96
+ */
97
+ readonly adoptable?: Adoptable;
59
98
  }
60
99
  export interface BuildAuditReportOptions {
61
100
  readonly harness: string;
62
101
  readonly vigilesVersion: string;
102
+ /**
103
+ * The repo-relative paths of surfaces that exist but have no `.spec.ts` yet,
104
+ * computed by the CLI's layout-aware `discoverAdoptableSurfaces` (so the pure
105
+ * builder stays adapter-agnostic — it only formats the commands). Omit/empty
106
+ * when there's nothing to adopt.
107
+ */
108
+ readonly adoptableSurfaces?: readonly string[];
63
109
  }
64
110
  /**
65
111
  * Assemble the versioned {@link AuditReport} from a scan report — pure, no clock.
@@ -67,4 +113,51 @@ export interface BuildAuditReportOptions {
67
113
  * HTML-embedded form omits it so the rendered file stays deterministic.
68
114
  */
69
115
  export declare function buildAuditReport(report: ScanReport, opts: BuildAuditReportOptions): AuditReport;
116
+ /**
117
+ * The versioned envelope for a `audit --json` run over MULTIPLE plugins (a
118
+ * marketplace expanded into its members, or several dirs) — the leaderboard.
119
+ * Shares the same `meta.schemaVersion`/`tool`/`kind` self-description as
120
+ * {@link AuditReport} so every `audit --json` shape is a versioned object, never
121
+ * a bare array. `kind:"leaderboard"` is the discriminant; `plugins` carries the
122
+ * ranked per-plugin scores.
123
+ */
124
+ export interface LeaderboardReport {
125
+ readonly meta: {
126
+ readonly schemaVersion: typeof AUDIT_SCHEMA_VERSION;
127
+ readonly tool: "vigiles";
128
+ readonly kind: "leaderboard";
129
+ readonly vigilesVersion: string;
130
+ /** The marketplace / parent dir that was expanded and ranked. */
131
+ readonly dir: string;
132
+ readonly generatedAt?: string;
133
+ };
134
+ readonly plugins: readonly PluginScore[];
135
+ }
136
+ /** Assemble the versioned {@link LeaderboardReport} — pure, no clock. */
137
+ export declare function buildLeaderboardReport(plugins: readonly PluginScore[], opts: {
138
+ vigilesVersion: string;
139
+ dir: string;
140
+ }): LeaderboardReport;
141
+ /**
142
+ * The versioned envelope for a `audit --json` run on a CURATED marketplace whose
143
+ * members are all external (git/url, nothing on disk to scan). Wraps the
144
+ * {@link MarketplaceInfo} inventory so this path, too, emits a versioned object
145
+ * rather than a raw, unversioned struct. `kind:"marketplace"` is the discriminant.
146
+ */
147
+ export interface MarketplaceReport {
148
+ readonly meta: {
149
+ readonly schemaVersion: typeof AUDIT_SCHEMA_VERSION;
150
+ readonly tool: "vigiles";
151
+ readonly kind: "marketplace";
152
+ readonly vigilesVersion: string;
153
+ readonly dir: string;
154
+ readonly generatedAt?: string;
155
+ };
156
+ readonly marketplace: MarketplaceInfo;
157
+ }
158
+ /** Assemble the versioned {@link MarketplaceReport} — pure, no clock. */
159
+ export declare function buildMarketplaceReport(marketplace: MarketplaceInfo, opts: {
160
+ vigilesVersion: string;
161
+ dir: string;
162
+ }): MarketplaceReport;
70
163
  //# sourceMappingURL=audit-report.d.ts.map
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AUDIT_SCHEMA_VERSION = void 0;
4
4
  exports.buildAuditReport = buildAuditReport;
5
+ exports.buildLeaderboardReport = buildLeaderboardReport;
6
+ exports.buildMarketplaceReport = buildMarketplaceReport;
5
7
  /**
6
8
  * The `AuditReport` — the versioned JSON contract that IS the audit's product
7
9
  * boundary. Everything renders FROM it: the local self-contained HTML report,
@@ -19,16 +21,37 @@ const audit_score_js_1 = require("./audit-score.js");
19
21
  const optimize_js_1 = require("./optimize.js");
20
22
  /** The current schema version. Bump only on a BREAKING change to the shape. */
21
23
  exports.AUDIT_SCHEMA_VERSION = 1;
24
+ /** The one command that adopts every un-spec'd surface (bare `init`). */
25
+ const CREATE_ALL_COMMAND = "npx vigiles init";
26
+ /** The command that adopts ONE surface at a given repo-relative path. */
27
+ function adoptCommand(path) {
28
+ return `npx vigiles init --target=${path}`;
29
+ }
30
+ /**
31
+ * Build the {@link Adoptable} payload from the layout-aware surface paths — pure,
32
+ * just formats the per-surface + create-all commands. Returns `undefined` when
33
+ * there's nothing to adopt (so the field stays absent).
34
+ */
35
+ function buildAdoptable(surfaces) {
36
+ if (!surfaces || surfaces.length === 0)
37
+ return undefined;
38
+ return {
39
+ surfaces: surfaces.map((path) => ({ path, command: adoptCommand(path) })),
40
+ createAllCommand: CREATE_ALL_COMMAND,
41
+ };
42
+ }
22
43
  /**
23
44
  * Assemble the versioned {@link AuditReport} from a scan report — pure, no clock.
24
45
  * The CLI attaches `meta.generatedAt` when it writes the JSON artifact; the
25
46
  * HTML-embedded form omits it so the rendered file stays deterministic.
26
47
  */
27
48
  function buildAuditReport(report, opts) {
49
+ const adoptable = buildAdoptable(opts.adoptableSurfaces);
28
50
  return {
29
51
  meta: {
30
52
  schemaVersion: exports.AUDIT_SCHEMA_VERSION,
31
53
  tool: "vigiles",
54
+ kind: "audit",
32
55
  vigilesVersion: opts.vigilesVersion,
33
56
  harness: opts.harness,
34
57
  dir: report.dir,
@@ -46,6 +69,33 @@ function buildAuditReport(report, opts) {
46
69
  mcp: report.mcp,
47
70
  untested: report.untested,
48
71
  },
72
+ ...(adoptable ? { adoptable } : {}),
73
+ };
74
+ }
75
+ /** Assemble the versioned {@link LeaderboardReport} — pure, no clock. */
76
+ function buildLeaderboardReport(plugins, opts) {
77
+ return {
78
+ meta: {
79
+ schemaVersion: exports.AUDIT_SCHEMA_VERSION,
80
+ tool: "vigiles",
81
+ kind: "leaderboard",
82
+ vigilesVersion: opts.vigilesVersion,
83
+ dir: opts.dir,
84
+ },
85
+ plugins,
86
+ };
87
+ }
88
+ /** Assemble the versioned {@link MarketplaceReport} — pure, no clock. */
89
+ function buildMarketplaceReport(marketplace, opts) {
90
+ return {
91
+ meta: {
92
+ schemaVersion: exports.AUDIT_SCHEMA_VERSION,
93
+ tool: "vigiles",
94
+ kind: "marketplace",
95
+ vigilesVersion: opts.vigilesVersion,
96
+ dir: opts.dir,
97
+ },
98
+ marketplace,
49
99
  };
50
100
  }
51
101
  //# sourceMappingURL=audit-report.js.map