@intentius/chant 0.52.1 → 0.52.2
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/dist/agents/checks.d.ts +35 -0
- package/dist/agents/checks.d.ts.map +1 -0
- package/dist/agents/discover.d.ts +86 -0
- package/dist/agents/discover.d.ts.map +1 -0
- package/dist/agents/importer.d.ts +46 -0
- package/dist/agents/importer.d.ts.map +1 -0
- package/dist/agents/index.d.ts +14 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/types.d.ts +196 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/audit/catalog.d.ts +4 -1
- package/dist/audit/catalog.d.ts.map +1 -1
- package/dist/audit/report.d.ts +8 -0
- package/dist/audit/report.d.ts.map +1 -1
- package/dist/audit/rules-doc.d.ts.map +1 -1
- package/dist/cli/commands/audit-agents.d.ts +83 -0
- package/dist/cli/commands/audit-agents.d.ts.map +1 -0
- package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
- package/dist/cli/commands/carve-emit.d.ts.map +1 -1
- package/dist/cli/commands/import-agents.d.ts +64 -0
- package/dist/cli/commands/import-agents.d.ts.map +1 -0
- package/dist/cli/handlers/carve-emit.d.ts.map +1 -1
- package/dist/cli/handlers/misc.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +15 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/lexicon.d.ts +11 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/terraform/adopt-state.d.ts +4 -1
- package/dist/terraform/adopt-state.d.ts.map +1 -1
- package/dist/terraform/bridge.d.ts.map +1 -1
- package/dist/terraform/tier-map.d.ts +17 -0
- package/dist/terraform/tier-map.d.ts.map +1 -1
- package/dist/yaml.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/agents/checks.test.ts +228 -0
- package/src/agents/checks.ts +429 -0
- package/src/agents/discover.test.ts +310 -0
- package/src/agents/discover.ts +939 -0
- package/src/agents/importer.ts +49 -0
- package/src/agents/index.ts +29 -0
- package/src/agents/types.ts +207 -0
- package/src/audit/catalog.ts +90 -1
- package/src/audit/report.ts +9 -1
- package/src/audit/rules-doc.ts +6 -0
- package/src/cli/commands/audit-agents.test.ts +260 -0
- package/src/cli/commands/audit-agents.ts +387 -0
- package/src/cli/commands/carve-bridge.test.ts +30 -0
- package/src/cli/commands/carve-bridge.ts +19 -1
- package/src/cli/commands/carve-emit.test.ts +72 -1
- package/src/cli/commands/carve-emit.ts +43 -20
- package/src/cli/commands/import-agents.test.ts +208 -0
- package/src/cli/commands/import-agents.ts +196 -0
- package/src/cli/handlers/carve-emit.ts +2 -0
- package/src/cli/handlers/misc.ts +111 -0
- package/src/cli/main.ts +17 -0
- package/src/cli/registry.ts +15 -0
- package/src/lexicon.ts +12 -0
- package/src/terraform/adopt-state.ts +7 -4
- package/src/terraform/aws-resources.test.ts +24 -1
- package/src/terraform/bridge.test.ts +12 -0
- package/src/terraform/bridge.ts +4 -1
- package/src/terraform/tier-map.ts +28 -1
- package/src/yaml.test.ts +54 -0
- package/src/yaml.ts +24 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks over discovered agent configuration (the `AGT` rule family).
|
|
3
|
+
*
|
|
4
|
+
* The threat model these encode is specific, and worth stating because it is
|
|
5
|
+
* not the same as the CI threat model the rest of `chant audit` covers.
|
|
6
|
+
*
|
|
7
|
+
* An agent config is *executable surface that runs with the user's own
|
|
8
|
+
* credentials on the user's own machine, usually with no review step*. An MCP
|
|
9
|
+
* server entry is a command line that runs at session start; a skill is
|
|
10
|
+
* instructions the model will follow; a permission allowlist decides what runs
|
|
11
|
+
* without anyone being asked. All three are commonly installed with one
|
|
12
|
+
* command, are rarely re-read after the day they were added, and — for the
|
|
13
|
+
* remote-sourced ones — can change upstream without any local edit.
|
|
14
|
+
*
|
|
15
|
+
* So the checks concentrate on three questions:
|
|
16
|
+
* 1. **What executes, and is it pinned?** (AGT001, AGT004)
|
|
17
|
+
* 2. **What can read secrets or reach the network in the clear?** (AGT002, AGT003)
|
|
18
|
+
* 3. **What runs without asking, and over how many projects?** (AGT005, AGT006)
|
|
19
|
+
* Plus AGT007, which flags config that is silently shadowed — where what the
|
|
20
|
+
* user reads is not what the agent runs.
|
|
21
|
+
*
|
|
22
|
+
* Every check is read-only and pure over a scan result, so a caller can run
|
|
23
|
+
* them against a fixture tree with no machine access.
|
|
24
|
+
*/
|
|
25
|
+
import type { AgentFinding, AgentScanResult } from "./types.js";
|
|
26
|
+
/** Rule ids in this family, in report order. Kept in sync with `audit/catalog.ts` by a drift test. */
|
|
27
|
+
export declare const AGENT_RULE_IDS: readonly ["AGT001", "AGT002", "AGT003", "AGT004", "AGT005", "AGT006", "AGT007", "AGT008"];
|
|
28
|
+
/**
|
|
29
|
+
* Run every agent-config check over a scan result.
|
|
30
|
+
*
|
|
31
|
+
* Findings are ordered by severity, then site, then rule — so the report leads
|
|
32
|
+
* with what executes unreviewed rather than with instruction-file hygiene.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkAgentConfigs(scan: AgentScanResult): AgentFinding[];
|
|
35
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/agents/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAmB,YAAY,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAE7F,sGAAsG;AACtG,eAAO,MAAM,cAAc,2FASjB,CAAC;AA8WX;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,YAAY,EAAE,CAmBvE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find every agent configuration on this machine and normalize it.
|
|
3
|
+
*
|
|
4
|
+
* The scan is location-driven, not walk-driven. Agent config does not hide in
|
|
5
|
+
* arbitrary places: each harness publishes a small, fixed set of paths it
|
|
6
|
+
* reads, so this module probes that list rather than crawling the filesystem.
|
|
7
|
+
* That keeps a full three-scope scan to a few dozen `stat` calls, and — more
|
|
8
|
+
* importantly — makes "we looked and it wasn't there" a fact the report can
|
|
9
|
+
* state (`AgentScanResult.probed`) instead of an absence of evidence.
|
|
10
|
+
*
|
|
11
|
+
* Two shapes recur across harnesses and are handled once here:
|
|
12
|
+
*
|
|
13
|
+
* - **A config is many files.** Claude Code merges `settings.json`,
|
|
14
|
+
* `settings.local.json`, `mcp.json`, and `~/.claude.json` into one
|
|
15
|
+
* effective configuration; codex puts the equivalent in one TOML file.
|
|
16
|
+
* Both land as a single {@link AgentConfigSite} with `sources` listing
|
|
17
|
+
* every file that contributed.
|
|
18
|
+
* - **MCP servers are declared in more than one place per scope.** Claude
|
|
19
|
+
* Code alone accepts them in `~/.claude/mcp.json`, `~/.claude.json`'s
|
|
20
|
+
* top-level `mcpServers`, and per-project entries under `~/.claude.json`'s
|
|
21
|
+
* `projects` map. `mergeMcp` collects all of them and keeps the *first*
|
|
22
|
+
* declaration of a name, matching the harness's own precedence.
|
|
23
|
+
*
|
|
24
|
+
* Nothing here judges what it finds — `checks.ts` owns that. Discovery's only
|
|
25
|
+
* editorial act is dropping sites with no content at all, so an empty
|
|
26
|
+
* `~/.gemini` directory doesn't become a resource.
|
|
27
|
+
*/
|
|
28
|
+
import type { AgentRuntime, AgentScanResult, AgentScope, McpServerDecl } from "./types.js";
|
|
29
|
+
export interface ScanOptions {
|
|
30
|
+
/** Scopes to probe. Defaults to all three. */
|
|
31
|
+
scopes?: readonly AgentScope[];
|
|
32
|
+
/** Harnesses to probe. Defaults to all five. */
|
|
33
|
+
runtimes?: readonly AgentRuntime[];
|
|
34
|
+
/** Home directory. Injectable so tests can scan a fixture tree instead of the real machine. */
|
|
35
|
+
home?: string;
|
|
36
|
+
/** Platform, which decides where system-scope policy lives. Injectable for the same reason. */
|
|
37
|
+
platform?: NodeJS.Platform;
|
|
38
|
+
/** Directories to treat as project scope. Defaults to `[process.cwd()]`. */
|
|
39
|
+
projectRoots?: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Machine-wide policy locations, by platform. Claude Code is the only harness
|
|
43
|
+
* of the five that defines a system scope today; the others are user-scoped
|
|
44
|
+
* only, which is itself worth reporting.
|
|
45
|
+
*/
|
|
46
|
+
export declare function systemSettingsPaths(platform: NodeJS.Platform): string[];
|
|
47
|
+
/** Parse a markdown file's `---` YAML frontmatter. Returns `{}` when there is none. */
|
|
48
|
+
export declare function frontmatter(markdown: string): Record<string, unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* Normalize one harness's `mcpServers` / `mcp_servers` map.
|
|
51
|
+
*
|
|
52
|
+
* Both dialects agree on the substance — a name mapping to either a `command`
|
|
53
|
+
* + `args` (stdio) or a `url` (http/sse) — so one normalizer serves Claude
|
|
54
|
+
* Code's JSON and codex's TOML. Keys this model names are lifted out; whatever
|
|
55
|
+
* remains is preserved in `extra` so a check can read a header or timeout
|
|
56
|
+
* without this function having to know about it.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normalizeMcpServers(raw: unknown, source: string): McpServerDecl[];
|
|
59
|
+
/**
|
|
60
|
+
* Scan the machine and return every agent configuration found.
|
|
61
|
+
*
|
|
62
|
+
* Sites are ordered system → user → project, matching the order the harnesses
|
|
63
|
+
* merge them, so a reader scanning the report sees broad policy before the
|
|
64
|
+
* narrow overrides that modify it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function scanAgentConfigs(opts?: ScanOptions): AgentScanResult;
|
|
67
|
+
/**
|
|
68
|
+
* Every project root the harness has registered on this machine, from
|
|
69
|
+
* `~/.claude.json`'s `projects` map.
|
|
70
|
+
*
|
|
71
|
+
* This is what makes `--all-projects` possible without crawling the disk: the
|
|
72
|
+
* harness already keeps the list of every project it has been opened in.
|
|
73
|
+
*
|
|
74
|
+
* Roots whose directory no longer exists are dropped. A deleted project is not
|
|
75
|
+
* something a user can act on, and counting it would make the "N projects not
|
|
76
|
+
* scanned" note overstate the gap — on a machine with 77 registered projects,
|
|
77
|
+
* 12 of them were stale.
|
|
78
|
+
*/
|
|
79
|
+
export declare function registeredProjectRoots(home: string): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Count registered project roots this scan did not visit. A user with dozens of
|
|
82
|
+
* registered projects should be told that a cwd-scoped scan saw one of them,
|
|
83
|
+
* rather than being left to assume it saw all.
|
|
84
|
+
*/
|
|
85
|
+
export declare function unscannedProjectCount(home: string, scannedRoots: string[]): number;
|
|
86
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/agents/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,OAAO,KAAK,EAEV,YAAY,EACZ,eAAe,EACf,UAAU,EAGV,aAAa,EAOd,MAAM,SAAS,CAAC;AAUjB,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAIvE;AA6ID,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWrE;AAQD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAqCjF;AAmjBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,WAAgB,GAAG,eAAe,CAsCxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoB7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAGlF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seam between neutral agent-config discovery and a lexicon's vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* `discover.ts` deliberately knows nothing about chant resources — it reads
|
|
5
|
+
* five harnesses' config dialects and stops. Turning an {@link AgentConfigSite}
|
|
6
|
+
* into resources is a statement about a *target* (fountain's `Agent` and
|
|
7
|
+
* `Environment`, today), and that judgement belongs to the lexicon that owns
|
|
8
|
+
* those types, exactly as `templateParser()` puts CloudFormation's JSON
|
|
9
|
+
* vocabulary in the aws lexicon rather than in core.
|
|
10
|
+
*
|
|
11
|
+
* So a lexicon that can express local agent configuration implements
|
|
12
|
+
* {@link AgentConfigImporter} and returns it from
|
|
13
|
+
* `LexiconPlugin.agentConfigImporter()`. `chant import --agents` loads the
|
|
14
|
+
* plugin, hands it the scan, and pipes the resulting IR through the same
|
|
15
|
+
* `templateGenerator()` every other import path uses.
|
|
16
|
+
*/
|
|
17
|
+
import type { TemplateIR } from "../import/parser.js";
|
|
18
|
+
import type { AgentConfigSite } from "./types.js";
|
|
19
|
+
/** A site the importer could not express, and why. */
|
|
20
|
+
export interface SkippedSite {
|
|
21
|
+
siteId: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The result of re-expressing a scan.
|
|
26
|
+
*
|
|
27
|
+
* The three report arrays exist because this conversion is lossy in ways the
|
|
28
|
+
* user must be told about: a site that couldn't be mapped, a required property
|
|
29
|
+
* that had to be defaulted, and a secret that was rewritten rather than copied
|
|
30
|
+
* are all things a reader would otherwise discover only by diffing the output
|
|
31
|
+
* against their own config.
|
|
32
|
+
*/
|
|
33
|
+
export interface AgentImportOutcome {
|
|
34
|
+
ir: TemplateIR;
|
|
35
|
+
/** Sites that could not be re-expressed in this lexicon's vocabulary. */
|
|
36
|
+
skipped: SkippedSite[];
|
|
37
|
+
/** Site ids where a required property was filled with a default rather than a discovered value. */
|
|
38
|
+
unmappedModel: string[];
|
|
39
|
+
/** Site ids where a literal credential was replaced with an environment reference. */
|
|
40
|
+
redactedSecrets: string[];
|
|
41
|
+
}
|
|
42
|
+
/** Converts discovered agent configuration into a lexicon's resource IR. */
|
|
43
|
+
export interface AgentConfigImporter {
|
|
44
|
+
toTemplateIR(sites: AgentConfigSite[]): AgentImportOutcome;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../src/agents/importer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,UAAU,CAAC;IACf,yEAAyE;IACzE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,mGAAmG;IACnG,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sFAAsF;IACtF,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;CAC5D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-configuration discovery and checks.
|
|
3
|
+
*
|
|
4
|
+
* Finds the agent configs on a machine (`discover.ts`), judges them
|
|
5
|
+
* (`checks.ts`), and normalizes both onto one vendor-neutral model
|
|
6
|
+
* (`types.ts`). The two consumers are `chant audit --agents`, which reports on
|
|
7
|
+
* what it finds, and `chant import --agents`, which re-expresses it as chant
|
|
8
|
+
* code via a lexicon's IR mapper.
|
|
9
|
+
*/
|
|
10
|
+
export type { AgentConfigSite, AgentFinding, AgentRuntime, AgentScanResult, AgentScope, CommandDecl, InstructionFile, McpServerDecl, McpTransport, PermissionConfig, PluginDecl, SkillDecl, SkillOrigin, SubagentDecl, } from "./types.js";
|
|
11
|
+
export { AGENT_RUNTIMES, AGENT_SCOPES } from "./types.js";
|
|
12
|
+
export { scanAgentConfigs, normalizeMcpServers, frontmatter, systemSettingsPaths, unscannedProjectCount, type ScanOptions } from "./discover.js";
|
|
13
|
+
export { checkAgentConfigs, AGENT_RULE_IDS } from "./checks.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9I,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The normalized model for an agent configuration found on a machine.
|
|
3
|
+
*
|
|
4
|
+
* Five harnesses (claude, codex, gemini, opencode, cursor) each spell the same
|
|
5
|
+
* four ideas differently — standing instructions, tool servers, reusable
|
|
6
|
+
* skills, and ambient settings. `discover.ts` reads each harness's own dialect
|
|
7
|
+
* and lands here; everything downstream (`checks.ts`, the report, the fountain
|
|
8
|
+
* IR mapping) reads only this shape and never a vendor file format again.
|
|
9
|
+
*
|
|
10
|
+
* The `AgentConfigSite` boundary is deliberately "one config that governs one
|
|
11
|
+
* root, for one runtime" rather than "one file". A single Claude Code site is
|
|
12
|
+
* assembled from `CLAUDE.md` + `settings.json` + `settings.local.json` +
|
|
13
|
+
* `mcp.json` + `~/.claude.json` + a `skills/` tree — six files that are only
|
|
14
|
+
* meaningful together, and that the agent itself experiences as one merged
|
|
15
|
+
* configuration. `sources` keeps the receipts so a finding can point at the
|
|
16
|
+
* actual file the reader has to edit.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Which agent harness a config belongs to. The first four are exactly
|
|
20
|
+
* fountain's `Agent.runtime` enum, so they re-express losslessly; `cursor` is
|
|
21
|
+
* discovered and reported but has no fountain runtime to map onto (see
|
|
22
|
+
* `MAPPABLE_RUNTIMES` in the fountain import mapper).
|
|
23
|
+
*/
|
|
24
|
+
export type AgentRuntime = "claude" | "codex" | "gemini" | "opencode" | "cursor";
|
|
25
|
+
/**
|
|
26
|
+
* Blast radius of a config, in the order harnesses merge them (later wins).
|
|
27
|
+
*
|
|
28
|
+
* - `system` — machine-wide policy, typically administrator-installed and not
|
|
29
|
+
* user-editable (Claude Code's `managed-settings.json`).
|
|
30
|
+
* - `user` — the home directory. Applies to *every* project the user opens,
|
|
31
|
+
* which is what makes it the highest-leverage scope to audit.
|
|
32
|
+
* - `project` — checked into (or sitting beside) a repo. Narrowest scope, but
|
|
33
|
+
* the one most likely to arrive from someone else.
|
|
34
|
+
*/
|
|
35
|
+
export type AgentScope = "system" | "user" | "project";
|
|
36
|
+
export declare const AGENT_SCOPES: readonly AgentScope[];
|
|
37
|
+
export declare const AGENT_RUNTIMES: readonly AgentRuntime[];
|
|
38
|
+
/** A standing-instructions file (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules). */
|
|
39
|
+
export interface InstructionFile {
|
|
40
|
+
/** Absolute path on disk. */
|
|
41
|
+
path: string;
|
|
42
|
+
/** File contents. Read in full — these become fountain's `Agent.system`. */
|
|
43
|
+
content: string;
|
|
44
|
+
bytes: number;
|
|
45
|
+
}
|
|
46
|
+
/** How an MCP server is reached. `unknown` when the declaration has neither a command nor a URL. */
|
|
47
|
+
export type McpTransport = "stdio" | "http" | "sse" | "unknown";
|
|
48
|
+
/** One MCP server declaration, normalized across the several files that can declare one. */
|
|
49
|
+
export interface McpServerDecl {
|
|
50
|
+
name: string;
|
|
51
|
+
transport: McpTransport;
|
|
52
|
+
/** The file this declaration was read from. */
|
|
53
|
+
source: string;
|
|
54
|
+
/** stdio: the executable. */
|
|
55
|
+
command?: string;
|
|
56
|
+
/** stdio: argv after the executable. */
|
|
57
|
+
args?: string[];
|
|
58
|
+
/** http/sse: the endpoint. */
|
|
59
|
+
url?: string;
|
|
60
|
+
/** Environment handed to the server process. Values are kept verbatim — `checks.ts` is what decides whether one looks like a literal credential. */
|
|
61
|
+
env?: Record<string, string>;
|
|
62
|
+
/** Extra keys the harness accepted that this model doesn't name (headers, timeouts, …). */
|
|
63
|
+
extra?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Where a skill came from. This distinction is the whole point of the skill
|
|
67
|
+
* checks: a `local` skill is text the user can read in their own filesystem,
|
|
68
|
+
* while `plugin`/`marketplace` skills are fetched from a remote and can change
|
|
69
|
+
* under the user without any edit to their machine.
|
|
70
|
+
*/
|
|
71
|
+
export type SkillOrigin = "local" | "plugin" | "marketplace";
|
|
72
|
+
/** One skill available to the agent. */
|
|
73
|
+
export interface SkillDecl {
|
|
74
|
+
name: string;
|
|
75
|
+
origin: SkillOrigin;
|
|
76
|
+
/** Absolute path to the skill directory or SKILL.md, when it exists on disk. */
|
|
77
|
+
path?: string;
|
|
78
|
+
/** Remote source (`owner/repo`, a URL) for plugin/marketplace skills. */
|
|
79
|
+
source?: string;
|
|
80
|
+
/** Version pin on `source`: a tag, branch, or sha. Absence is what AGT004 flags. */
|
|
81
|
+
ref?: string;
|
|
82
|
+
/** SKILL.md body, when read. Becomes fountain's inline `{name, content}` skill form. */
|
|
83
|
+
content?: string;
|
|
84
|
+
/** The skill's own frontmatter `description`, used for the fountain `description`. */
|
|
85
|
+
description?: string;
|
|
86
|
+
}
|
|
87
|
+
/** A subagent / custom agent definition (`.claude/agents/*.md`). */
|
|
88
|
+
export interface SubagentDecl {
|
|
89
|
+
name: string;
|
|
90
|
+
path: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
/** Tool allowlist declared in frontmatter, if any. */
|
|
93
|
+
tools?: string;
|
|
94
|
+
model?: string;
|
|
95
|
+
}
|
|
96
|
+
/** A slash command definition (`.claude/commands/*.md`, `~/.codex/prompts`). */
|
|
97
|
+
export interface CommandDecl {
|
|
98
|
+
name: string;
|
|
99
|
+
path: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}
|
|
102
|
+
/** An installed plugin — a bundle that can inject skills, commands, and MCP servers at once. */
|
|
103
|
+
export interface PluginDecl {
|
|
104
|
+
name: string;
|
|
105
|
+
/** Marketplace or repo the plugin was installed from. */
|
|
106
|
+
marketplace?: string;
|
|
107
|
+
/** Version pin, when the install recorded one. */
|
|
108
|
+
ref?: string;
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* True when the plugin tracks a remote the user does not control.
|
|
112
|
+
*
|
|
113
|
+
* The pinning checks turn on this: a plugin vendored from a local directory
|
|
114
|
+
* cannot change underneath the user, so "pin it" is not advice that applies.
|
|
115
|
+
* Harnesses ship bundled plugins from local paths (codex's
|
|
116
|
+
* `source_type = "local"`), and reporting those as unpinned supply chain is
|
|
117
|
+
* noise that trains the reader to skip the rule.
|
|
118
|
+
*/
|
|
119
|
+
remote: boolean;
|
|
120
|
+
}
|
|
121
|
+
/** Tool-permission configuration, normalized from a harness's own settings shape. */
|
|
122
|
+
export interface PermissionConfig {
|
|
123
|
+
allow?: string[];
|
|
124
|
+
deny?: string[];
|
|
125
|
+
ask?: string[];
|
|
126
|
+
defaultMode?: string;
|
|
127
|
+
/** True when the config disables a confirmation prompt outright. */
|
|
128
|
+
bypassesPrompts?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* One complete agent configuration governing one root, for one runtime.
|
|
132
|
+
*
|
|
133
|
+
* Assembled from every file at that scope the harness would merge together —
|
|
134
|
+
* see the module docstring for why the file is not the unit.
|
|
135
|
+
*/
|
|
136
|
+
export interface AgentConfigSite {
|
|
137
|
+
/** Stable slug, unique within a scan: `user-claude`, `project-claude-chant`. Becomes the fountain resource name. */
|
|
138
|
+
id: string;
|
|
139
|
+
scope: AgentScope;
|
|
140
|
+
runtime: AgentRuntime;
|
|
141
|
+
/** Directory this configuration governs. For `user` scope, the home directory. */
|
|
142
|
+
root: string;
|
|
143
|
+
/** Every file that contributed, absolute. A site with no sources is never emitted. */
|
|
144
|
+
sources: string[];
|
|
145
|
+
instructions: InstructionFile[];
|
|
146
|
+
mcpServers: McpServerDecl[];
|
|
147
|
+
skills: SkillDecl[];
|
|
148
|
+
subagents: SubagentDecl[];
|
|
149
|
+
commands: CommandDecl[];
|
|
150
|
+
plugins: PluginDecl[];
|
|
151
|
+
/** Environment variables the harness injects into every session. */
|
|
152
|
+
env: Record<string, string>;
|
|
153
|
+
permissions?: PermissionConfig;
|
|
154
|
+
/** Default model pinned by the config, when set. */
|
|
155
|
+
model?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Raw merged settings, kept so a check can interrogate a key this model
|
|
158
|
+
* doesn't name without a schema change. Not used for codegen.
|
|
159
|
+
*/
|
|
160
|
+
settings: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
/** Everything one scan found, plus what it couldn't read. */
|
|
163
|
+
export interface AgentScanResult {
|
|
164
|
+
sites: AgentConfigSite[];
|
|
165
|
+
/** Locations probed and found absent — useful for "is it really not configured, or did I not look?" */
|
|
166
|
+
probed: string[];
|
|
167
|
+
/** Paths that existed but could not be read or parsed, with the reason. */
|
|
168
|
+
unreadable: Array<{
|
|
169
|
+
path: string;
|
|
170
|
+
reason: string;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Every MCP declaration each site saw, keyed by site id — including names
|
|
174
|
+
* that lost the first-wins merge and so do not appear in
|
|
175
|
+
* `AgentConfigSite.mcpServers`. Diagnostic data for the shadowing check
|
|
176
|
+
* (AGT007), kept beside the sites rather than on them because it describes
|
|
177
|
+
* the *discovery*, not the configuration being re-expressed.
|
|
178
|
+
*/
|
|
179
|
+
declarations: Record<string, McpServerDecl[]>;
|
|
180
|
+
}
|
|
181
|
+
/** A finding raised by an agent-config check against a discovered site. */
|
|
182
|
+
export interface AgentFinding {
|
|
183
|
+
/** Catalog id, e.g. `AGT001`. */
|
|
184
|
+
checkId: string;
|
|
185
|
+
severity: "error" | "warning" | "info";
|
|
186
|
+
message: string;
|
|
187
|
+
/** The specific file a reader has to open to fix this. */
|
|
188
|
+
file: string;
|
|
189
|
+
/** The site the finding belongs to. */
|
|
190
|
+
siteId: string;
|
|
191
|
+
scope: AgentScope;
|
|
192
|
+
runtime: AgentRuntime;
|
|
193
|
+
/** The named thing within the site (an MCP server name, a skill name). */
|
|
194
|
+
entity?: string;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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MAAM,CAAC;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/audit/catalog.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export declare const CF_SECRETS: Authority;
|
|
|
69
69
|
export declare const CF_ROUTES: Authority;
|
|
70
70
|
export declare const CF_ENVIRONMENTS: Authority;
|
|
71
71
|
export declare const CF_STATIC_ASSETS: Authority;
|
|
72
|
+
export declare const CWE_HARDCODED_CREDS: Authority;
|
|
73
|
+
export declare const CWE_CLEARTEXT: Authority;
|
|
72
74
|
/**
|
|
73
75
|
* Finding category per rule (#415). Curated: security rules are those that
|
|
74
76
|
* cite an authority or guard an exposure; correctness rules flag structural
|
|
@@ -81,7 +83,8 @@ export declare const RULE_CATEGORY: Record<string, Category>;
|
|
|
81
83
|
* CloudFormation ids (COR/EXT) that aren't owned by a single lexicon. Every
|
|
82
84
|
* per-provider block moved to its lexicon's `auditCatalog()` (#687): WAW→aws,
|
|
83
85
|
* WGC→gcp, AZR→azure, DKRD→docker, WK8/ARGO→k8s, WHM→helm, GHA→github,
|
|
84
|
-
* WGL→gitlab, WFJ→forgejo. `resolveAuditCatalog` merges those over this map
|
|
86
|
+
* WGL→gitlab, WFJ→forgejo. `resolveAuditCatalog` merges those over this map,
|
|
87
|
+
* alongside the lexicon-independent SEC/WRG/AGT families core owns outright.
|
|
85
88
|
*/
|
|
86
89
|
export declare const RULE_CATALOG: Record<string, RuleMeta>;
|
|
87
90
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/audit/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,IAAI,GAAG,cAAc,GAAG,aAAa,CAAC;AAElD,wFAAwF;AACx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E,MAAM,GAAG,MAAM,CAE7C"}
|
package/dist/audit/report.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ export interface RenderOptions {
|
|
|
28
28
|
notes?: string[];
|
|
29
29
|
/** Resolved audit catalog (core static + active lexicons' contributions, #687). Defaults to core's static catalog. */
|
|
30
30
|
catalog?: Record<string, RuleMeta>;
|
|
31
|
+
/**
|
|
32
|
+
* Markdown heading text and level for the report's own title. `chant audit
|
|
33
|
+
* --agents` embeds this report under its inventory, so it renders as a
|
|
34
|
+
* level-2 "Findings" section rather than a second `# chant audit` H1 in a
|
|
35
|
+
* document that already has one.
|
|
36
|
+
*/
|
|
37
|
+
title?: string;
|
|
38
|
+
headingLevel?: 1 | 2;
|
|
31
39
|
}
|
|
32
40
|
/** Render an audit report as Markdown. */
|
|
33
41
|
export declare function renderMarkdown(findings: AuditFinding[], opts?: RenderOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/audit/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAc5C,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,iEAAiE;IACjE,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACxC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,sHAAsH;IACtH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/audit/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAc5C,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,iEAAiE;IACjE,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACxC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,sHAAsH;IACtH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACtB;AAoDD,0CAA0C;AAC1C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAqCzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules-doc.d.ts","sourceRoot":"","sources":["../../src/audit/rules-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"rules-doc.d.ts","sourceRoot":"","sources":["../../src/audit/rules-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2CH;;;;;;GAMG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqB5D"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant audit --agents` — audit the agent configuration on this machine.
|
|
3
|
+
*
|
|
4
|
+
* This is a different *subject* from the rest of `chant audit` (a machine, not
|
|
5
|
+
* a repo) but deliberately the same *product*: the same tiering, the same
|
|
6
|
+
* five output formats, the same rule-catalog links. A reader who already knows
|
|
7
|
+
* how to read a chant audit report can read this one, and the HTML/SARIF/JSON
|
|
8
|
+
* consumers downstream need no changes.
|
|
9
|
+
*
|
|
10
|
+
* The bridge is {@link toAuditFindings}: an `AgentFinding` is projected onto
|
|
11
|
+
* the `AuditFinding` shape the renderers already take, with the site id in
|
|
12
|
+
* `entity` so a reader can tell which configuration a finding came from.
|
|
13
|
+
*
|
|
14
|
+
* Two things this command adds that a repo audit has no need for:
|
|
15
|
+
*
|
|
16
|
+
* - **An inventory.** "What is configured on this machine" is the primary
|
|
17
|
+
* question here; findings are secondary. A clean scan should still print
|
|
18
|
+
* the sites it found, because most users have never seen the full list.
|
|
19
|
+
* - **Coverage honesty.** The scan probes a fixed set of locations, so it can
|
|
20
|
+
* state what it looked for and didn't find, what it couldn't parse, and how
|
|
21
|
+
* many registered projects it did not visit. An inventory that quietly
|
|
22
|
+
* omits half the machine is worse than no inventory.
|
|
23
|
+
*/
|
|
24
|
+
import type { AgentConfigSite, AgentFinding, AgentRuntime, AgentScanResult, AgentScope } from "../../agents/types.js";
|
|
25
|
+
import type { AuditFinding } from "../../audit/core.js";
|
|
26
|
+
import { type ReportTheme } from "../../audit/report-html.js";
|
|
27
|
+
import type { AuditFailOn, AuditFormat, AuditTier } from "./audit.js";
|
|
28
|
+
export interface AuditAgentsOptions {
|
|
29
|
+
format?: AuditFormat;
|
|
30
|
+
tier?: AuditTier;
|
|
31
|
+
failOn?: AuditFailOn;
|
|
32
|
+
/** Scopes to scan. Defaults to all three. */
|
|
33
|
+
scopes?: readonly AgentScope[];
|
|
34
|
+
/** Harnesses to scan. Defaults to all five. */
|
|
35
|
+
runtimes?: readonly AgentRuntime[];
|
|
36
|
+
/** Project roots to scan at project scope. Defaults to `[cwd]`. */
|
|
37
|
+
projectRoots?: string[];
|
|
38
|
+
/** Home directory override — injectable so tests scan a fixture tree. */
|
|
39
|
+
home?: string;
|
|
40
|
+
platform?: NodeJS.Platform;
|
|
41
|
+
/** Write the report here instead of returning it for stdout. */
|
|
42
|
+
output?: string;
|
|
43
|
+
theme?: ReportTheme;
|
|
44
|
+
template?: string;
|
|
45
|
+
now?: string;
|
|
46
|
+
toolVersion?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AuditAgentsResult {
|
|
49
|
+
success: boolean;
|
|
50
|
+
output: string;
|
|
51
|
+
findings: AgentFinding[];
|
|
52
|
+
scan: AgentScanResult;
|
|
53
|
+
exitCode: number;
|
|
54
|
+
wroteTo?: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Project an agent finding onto the audit renderers' finding shape.
|
|
59
|
+
*
|
|
60
|
+
* `lexicon` is set to `"agents"` — the renderers only use it as a grouping
|
|
61
|
+
* label, and calling this family what it is keeps a mixed report readable.
|
|
62
|
+
*/
|
|
63
|
+
export declare function toAuditFindings(findings: AgentFinding[]): AuditFinding[];
|
|
64
|
+
/** One-line summary of what a site carries, e.g. `3 MCP servers · 11 skills`. */
|
|
65
|
+
export declare function siteSummary(site: AgentConfigSite): string;
|
|
66
|
+
/**
|
|
67
|
+
* Coverage caveats. Stated even when empty-ish, because the value of an
|
|
68
|
+
* inventory depends entirely on the reader knowing its edges.
|
|
69
|
+
*/
|
|
70
|
+
export declare function agentCoverageNotes(scan: AgentScanResult, opts: {
|
|
71
|
+
home: string;
|
|
72
|
+
projectRoots: string[];
|
|
73
|
+
scopes: readonly AgentScope[];
|
|
74
|
+
}): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Scan the machine's agent configuration and render a report.
|
|
77
|
+
*
|
|
78
|
+
* Pure with respect to the filesystem apart from the scan itself and an
|
|
79
|
+
* optional `--output` write, so it can be driven from tests against a fixture
|
|
80
|
+
* home directory.
|
|
81
|
+
*/
|
|
82
|
+
export declare function auditAgentsCommand(opts?: AuditAgentsOptions): AuditAgentsResult;
|
|
83
|
+
//# sourceMappingURL=audit-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-agents.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/audit-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,gEAAgE;IAChE,MAAM,CAAC,EAAE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,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AASD,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiItF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAqCnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI5F,OAAO,
|
|
1
|
+
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI5F,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAE1G,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAUhE,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7F;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,oCAAoC;IACpC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,sFAAsF;IACtF,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC9B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CA8HrG;AAiJD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAwD/D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant import --agents` — re-express this machine's agent configuration as
|
|
3
|
+
* chant code.
|
|
4
|
+
*
|
|
5
|
+
* Shares its front half with `chant audit --agents` (the same scan, the same
|
|
6
|
+
* normalized sites) and its back half with every other import path (a lexicon's
|
|
7
|
+
* `templateGenerator()` turning IR into TypeScript). The only new step is the
|
|
8
|
+
* middle: `LexiconPlugin.agentConfigImporter()`, which maps sites onto the
|
|
9
|
+
* lexicon's own resource types.
|
|
10
|
+
*
|
|
11
|
+
* The command is loud about what it changed. Re-expression here is lossy in
|
|
12
|
+
* three specific ways — a skipped runtime, a defaulted model, a redacted
|
|
13
|
+
* secret — and each one is something the user would otherwise find only by
|
|
14
|
+
* diffing the generated code against their real config. Printing them is not
|
|
15
|
+
* politeness; it is the difference between generated code you can trust and
|
|
16
|
+
* generated code you have to re-verify by hand.
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentRuntime, AgentScope } from "../../agents/types.js";
|
|
19
|
+
import type { AgentImportOutcome } from "../../agents/importer.js";
|
|
20
|
+
import type { LexiconPlugin } from "../../lexicon.js";
|
|
21
|
+
/** The lexicon used when `--lexicon` isn't given: the one that models agent workloads. */
|
|
22
|
+
export declare const DEFAULT_AGENT_LEXICON = "fountain";
|
|
23
|
+
/**
|
|
24
|
+
* Loads the lexicon plugin. Injectable so this command can be unit-tested
|
|
25
|
+
* without a built lexicon package on disk — the same seam `audit.ts` uses for
|
|
26
|
+
* its `ChecksProvider`.
|
|
27
|
+
*/
|
|
28
|
+
export type PluginLoader = (name: string) => Promise<LexiconPlugin>;
|
|
29
|
+
export interface ImportAgentsOptions {
|
|
30
|
+
/** Lexicon to re-express into. Defaults to {@link DEFAULT_AGENT_LEXICON}. */
|
|
31
|
+
lexicon?: string;
|
|
32
|
+
/** Injectable plugin loader (testing). Defaults to the real one. */
|
|
33
|
+
pluginLoader?: PluginLoader;
|
|
34
|
+
/** Output directory. Defaults to `./infra/agents`. */
|
|
35
|
+
output?: string;
|
|
36
|
+
force?: boolean;
|
|
37
|
+
scopes?: readonly AgentScope[];
|
|
38
|
+
runtimes?: readonly AgentRuntime[];
|
|
39
|
+
projectRoots?: string[];
|
|
40
|
+
home?: string;
|
|
41
|
+
platform?: NodeJS.Platform;
|
|
42
|
+
}
|
|
43
|
+
export interface ImportAgentsResult {
|
|
44
|
+
success: boolean;
|
|
45
|
+
generatedFiles: string[];
|
|
46
|
+
/** Sites found, mapped, and deliberately not mapped. */
|
|
47
|
+
summary: {
|
|
48
|
+
discovered: number;
|
|
49
|
+
mapped: number;
|
|
50
|
+
};
|
|
51
|
+
outcome?: AgentImportOutcome;
|
|
52
|
+
warnings: string[];
|
|
53
|
+
error?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Scan, re-express, and write.
|
|
57
|
+
*
|
|
58
|
+
* Refuses to overwrite existing files without `--force`, matching `chant
|
|
59
|
+
* import` — generated agent code is likely to be edited by hand after the
|
|
60
|
+
* first run, and silently reverting those edits would be the worst possible
|
|
61
|
+
* behavior for a command whose whole purpose is capturing hand-tuned config.
|
|
62
|
+
*/
|
|
63
|
+
export declare function importAgentsCommand(opts?: ImportAgentsOptions): Promise<ImportAgentsResult>;
|
|
64
|
+
//# sourceMappingURL=import-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-agents.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/import-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAo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