@marktiderman/genesis-cli 1.23.0 → 1.25.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.
- package/README.md +126 -16
- package/dist/cli.js +768 -85
- package/dist/cli.js.map +1 -1
- package/dist/{config-HOmiOLQc.d.ts → config-CR4kqSCp.d.ts} +65 -6
- package/dist/doctor.d.ts +103 -6
- package/dist/doctor.js +675 -48
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +2 -2
- package/dist/expo.js +20 -0
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +9 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +593 -52
- package/dist/index.js.map +1 -1
- package/dist/templates/ci/claude-review.yml +26 -0
- package/dist/templates/vercel/ignore-build.sh +131 -0
- package/dist/templates/vercel/vercel.json +4 -0
- package/dist/vite.js +586 -45
- package/dist/vite.js.map +1 -1
- package/package.json +2 -2
|
@@ -23,6 +23,11 @@ interface Finding {
|
|
|
23
23
|
* An `allow` entry's `match` is compared against it.
|
|
24
24
|
*/
|
|
25
25
|
subject?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Every rule that reported this finding, when more than one did (an app rule and a package rule
|
|
28
|
+
* on the same element of the same line): reported once, with `rule` the first of them.
|
|
29
|
+
*/
|
|
30
|
+
rules?: string[];
|
|
26
31
|
}
|
|
27
32
|
/** What a rule or plugin passes to `report`. `level` defaults to `"error"`. */
|
|
28
33
|
interface FindingInput {
|
|
@@ -42,6 +47,27 @@ interface AllowEntry {
|
|
|
42
47
|
match?: string;
|
|
43
48
|
reason: string;
|
|
44
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* A declared extension (`doctor.extend`): a file that builds on one of a package rule's declared
|
|
52
|
+
* extension points (`extensible`) in a way the rule doesn't recognize, and says why. Unlike
|
|
53
|
+
* `allow`, it is not debt: it never expires, and `allow-grew` doesn't count it; a new one is a
|
|
54
|
+
* warning (`extension-added`) for the pull request's review. It covers the findings the file had
|
|
55
|
+
* when it was declared: under `--base`, a count above the merge base's still fails. The doctor
|
|
56
|
+
* checks that `file` still has a finding of `rule` (`stale-extension`), and that `buildsOn` is one
|
|
57
|
+
* of the rule's points, imported from a Genesis package, and flagged by nothing (`extension-invalid`).
|
|
58
|
+
*/
|
|
59
|
+
interface ExtensionEntry {
|
|
60
|
+
/** The rule whose findings in `file` it covers. */
|
|
61
|
+
rule: string;
|
|
62
|
+
/** One app-relative file (no globs: each file is reviewed on its own). */
|
|
63
|
+
file: string;
|
|
64
|
+
/** The rule's extension point the file builds on: one of the rule's `extensible` entries (`useBoardColumns`, `ResourceView.slots`). */
|
|
65
|
+
buildsOn: string;
|
|
66
|
+
/** Why the rule's primitive doesn't fit here: a sentence a reviewer can check. */
|
|
67
|
+
reason: string;
|
|
68
|
+
/** Where the gap is written up for Genesis, when it is one (an issue or proposal link). */
|
|
69
|
+
upstream?: string;
|
|
70
|
+
}
|
|
45
71
|
/** A declarative check: which files it covers and the pattern they must (not) contain. */
|
|
46
72
|
interface PatternRule {
|
|
47
73
|
id: string;
|
|
@@ -57,7 +83,7 @@ interface PatternRule {
|
|
|
57
83
|
/** Regular expression every matching file's path must fit. */
|
|
58
84
|
path?: string;
|
|
59
85
|
message?: string;
|
|
60
|
-
/** Under `--base`, findings in
|
|
86
|
+
/** Under `--base`, findings drop to `info` unless they are in a new file or their count in a file grew since the merge base. */
|
|
61
87
|
newOnly?: boolean;
|
|
62
88
|
}
|
|
63
89
|
/**
|
|
@@ -109,6 +135,12 @@ interface SupabasePackConfig {
|
|
|
109
135
|
* tell new migrations from applied ones.
|
|
110
136
|
*/
|
|
111
137
|
since?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Whether Supabase's automatic branching (a branch per pull request) is on for this project.
|
|
140
|
+
* `false` records that it's off, so `exposed-schema-created-later` stops flagging a schema
|
|
141
|
+
* that a migration creates. Default: unknown, treated as on.
|
|
142
|
+
*/
|
|
143
|
+
automaticBranching?: boolean;
|
|
112
144
|
}
|
|
113
145
|
/** The `doctor` block of genesis.config.json (or package.json `genesis.doctor`). */
|
|
114
146
|
interface DoctorConfig {
|
|
@@ -152,8 +184,9 @@ interface DoctorConfig {
|
|
|
152
184
|
*/
|
|
153
185
|
packageRules?: Record<string, PackageRuleSetting>;
|
|
154
186
|
/**
|
|
155
|
-
* With `--base`, findings
|
|
156
|
-
*
|
|
187
|
+
* With `--base`, a rule's findings drop to `info` unless they are in a new file or a file
|
|
188
|
+
* now has more of them than at the merge base, so new code meets the rule and old code is
|
|
189
|
+
* ratcheted. `true` for every rule, or a list of rule ids.
|
|
157
190
|
* Rules declared `newOnly` (package rules, app patterns) ratchet without this.
|
|
158
191
|
*/
|
|
159
192
|
ratchet?: boolean | string[];
|
|
@@ -161,8 +194,10 @@ interface DoctorConfig {
|
|
|
161
194
|
contracts?: ContractsConfig;
|
|
162
195
|
/** Per-rule level overrides, e.g. `{ "raw-color": "warn", "palette-color": "off" }`. `info` never fails a run. */
|
|
163
196
|
rules?: Record<string, RuleSetting>;
|
|
164
|
-
/** Justified exceptions
|
|
197
|
+
/** Justified exceptions: debt, which only shrinks under `--base`. */
|
|
165
198
|
allow?: AllowEntry[];
|
|
199
|
+
/** Declared extensions: files that build on Genesis in a way a rule doesn't recognize, reviewed, never expiring. */
|
|
200
|
+
extend?: ExtensionEntry[];
|
|
166
201
|
/** Declarative app rules. */
|
|
167
202
|
patterns?: PatternRule[];
|
|
168
203
|
/** A markdown file of pattern rules (`### rule-id` blocks of `- key: value` lines). */
|
|
@@ -260,6 +295,8 @@ interface DoctorResult {
|
|
|
260
295
|
warnings: number;
|
|
261
296
|
/** Findings at `info`: shown, never failing. */
|
|
262
297
|
infos: number;
|
|
298
|
+
/** Under `--base`: the declared extensions this branch adds, for the pull request's review (also `extension-added` findings). */
|
|
299
|
+
extensionsAdded?: ExtensionEntry[];
|
|
263
300
|
}
|
|
264
301
|
/** One "use X instead of Y" rule, as a package declares it. */
|
|
265
302
|
interface PreferRule {
|
|
@@ -287,6 +324,11 @@ interface PreferRule {
|
|
|
287
324
|
unless?: {
|
|
288
325
|
/** The file renders one of these elements. */
|
|
289
326
|
renders?: string[];
|
|
327
|
+
/**
|
|
328
|
+
* Not the whole file: a forbidden element nested inside one of these elements, or inside an app
|
|
329
|
+
* component the file imports whose own body renders one, is left alone (a builder's own panels).
|
|
330
|
+
*/
|
|
331
|
+
inside?: string[];
|
|
290
332
|
/** The file contains this regular expression. */
|
|
291
333
|
pattern?: string;
|
|
292
334
|
};
|
|
@@ -298,8 +340,14 @@ interface PreferRule {
|
|
|
298
340
|
docs?: string;
|
|
299
341
|
/** Why, in a sentence. */
|
|
300
342
|
why: string;
|
|
301
|
-
/** Under `--base`, findings in
|
|
343
|
+
/** Under `--base`, findings drop to `info` unless they are in a new file or their count in a file grew since the merge base. */
|
|
302
344
|
newOnly?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* The Genesis exports (or parts of one: `ResourceView.slots`) an app may build on in a way the
|
|
347
|
+
* rule doesn't recognize, and declare as an extension (`doctor.extend`). A rule without them
|
|
348
|
+
* can't be extended.
|
|
349
|
+
*/
|
|
350
|
+
extensible?: string[];
|
|
303
351
|
}
|
|
304
352
|
/** A catalog entry with no rule behind it. */
|
|
305
353
|
interface PrimitiveEntry {
|
|
@@ -412,6 +460,17 @@ interface GenesisConfigFile {
|
|
|
412
460
|
supabase?: GenesisSupabase;
|
|
413
461
|
/** Where this app sits in its repository (`mobile`), when that isn't the root: see {@link validateAppFolder}. */
|
|
414
462
|
appFolder?: string;
|
|
463
|
+
/** Preview defaults the templates read (templates/vercel/ignore-build.sh): see {@link validateEnvironments}. */
|
|
464
|
+
environments?: GenesisEnvironments;
|
|
465
|
+
}
|
|
466
|
+
/** The app's preview defaults. A variable set where the build runs wins over these; these win over Genesis's defaults. */
|
|
467
|
+
interface GenesisEnvironments {
|
|
468
|
+
/** on-demand (the default), every-pr or off. */
|
|
469
|
+
previews?: "on-demand" | "every-pr" | "off";
|
|
470
|
+
/** The pull request label that asks for a preview; "" turns the label check off. */
|
|
471
|
+
label?: string;
|
|
472
|
+
/** The branch prefix that asks for a preview; "" turns the branch check off. */
|
|
473
|
+
branchPrefix?: string;
|
|
415
474
|
}
|
|
416
475
|
interface LoadedConfig {
|
|
417
476
|
config: DoctorConfig;
|
|
@@ -438,4 +497,4 @@ declare function validateLinks(raw: unknown, source?: string): GenesisLinks;
|
|
|
438
497
|
/** Check the shape, so a typo fails loudly instead of silently disabling a check. */
|
|
439
498
|
declare function validateConfig(raw: unknown, source?: string): DoctorConfig;
|
|
440
499
|
|
|
441
|
-
export { type AllowEntry as A, type SupabasePackConfig as B, type CompanionPackage as C, type DoctorConfig as D,
|
|
500
|
+
export { type AllowEntry as A, type SupabasePackConfig as B, type CompanionPackage as C, type DoctorConfig as D, type ExtensionEntry as E, type Finding as F, type GenesisDataUse as G, loadConfig as H, validateConfig as I, type Level as L, type NativePackConfig as N, PRIVACY_DATA_TYPES as P, type RuleSetting as R, type SourceFile as S, type GenesisPrivacy as a, type GenesisLinks as b, GenesisConfigError as c, PRIVACY_PURPOSES as d, validatePrivacy as e, DoctorConfigError as f, type DoctorContext as g, type DoctorPlugin as h, type DoctorResult as i, type GenesisConfigFile as j, type GenesisSupabase as k, type GenesisFacts as l, type PatternRule as m, type PreferRule as n, type DeclaringPackage as o, privacyDataType as p, type PackageDeclaration as q, readGenesisConfig as r, type FindingInput as s, type ContractsConfig as t, type DoctorPack as u, validateLinks as v, type PackageRuleSetting as w, type PackagesPackConfig as x, type PluginSpec as y, type PrimitiveEntry as z };
|
package/dist/doctor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DoctorConfig, l as GenesisFacts, m as PatternRule, h as DoctorPlugin, S as SourceFile, g as DoctorContext, n as PreferRule, o as DeclaringPackage, q as PackageDeclaration,
|
|
2
|
-
export { A as AllowEntry, C as CompanionPackage,
|
|
1
|
+
import { D as DoctorConfig, l as GenesisFacts, m as PatternRule, h as DoctorPlugin, S as SourceFile, g as DoctorContext, n as PreferRule, o as DeclaringPackage, q as PackageDeclaration, F as Finding, s as FindingInput, E as ExtensionEntry, i as DoctorResult } from './config-CR4kqSCp.js';
|
|
2
|
+
export { A as AllowEntry, C as CompanionPackage, t as ContractsConfig, f as DoctorConfigError, u as DoctorPack, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, k as GenesisSupabase, L as Level, N as NativePackConfig, w as PackageRuleSetting, x as PackagesPackConfig, y as PluginSpec, z as PrimitiveEntry, R as RuleSetting, B as SupabasePackConfig, H as loadConfig, r as readGenesisConfig, I as validateConfig, v as validateLinks } from './config-CR4kqSCp.js';
|
|
3
3
|
import '@marktiderman/genesis-features';
|
|
4
4
|
|
|
5
5
|
/** The installed folder of `name`, looking in node_modules from `from` upward (works with hoisting and pnpm). */
|
|
@@ -27,7 +27,7 @@ declare function parseRulesMarkdown(markdown: string): PatternRule[];
|
|
|
27
27
|
declare function defineDoctorPlugin(plugin: DoctorPlugin): DoctorPlugin;
|
|
28
28
|
|
|
29
29
|
/** Ids of the built-in rules, for `rules` overrides and `allow` entries. */
|
|
30
|
-
declare const BUILTIN_RULES: readonly ["local-primitives", "figma-routes", "starter-leftover", "forbidden-import", "raw-tag", "palette-color", "arbitrary-color", "raw-color", "undefined-token", "shadowed-export", "version-skew", "duplicate-genesis-package", "peer-range-mismatch", "hand-rolled-sub-nav", "local-genesis-copy", "resource-workspace", "page-layout", "iso-date-slice", "resource-view-tree", "studio-server-auth-import", "removed-scope-name", "scope-practice-id", "deprecated-import", "beta-import", "native-raw-primitive", "native-literal-color", "native-custom-header", "native-screen-layout", "store-readiness", "eas-placeholder", "migration-grants", "migration-rls", "migration-definer-search-path", "migration-edited", "migration-testing-kit", "migration-view-rls", "package-app-import", "package-undeclared-dependency", "package-migration-test", "package-migration-number", "package-migration-edited", "package-unregistered", "package-unversioned-change", "package-export-missing", "package-block-invalid", "package-untagged-tests", "package-doctor-declaration", "overlay-unmarked", "overlay-invalid", "overlay-age", "overlay-version", "overlay-behind", "package-rules-invalid", "package-rule-override", "ratchet-skipped", "allow-grew", "rules-weakened", "agent-guide-stale", "contracts-stale", "lock-files", "database-elsewhere", "genesis-eslint-config"];
|
|
30
|
+
declare const BUILTIN_RULES: readonly ["local-primitives", "figma-routes", "starter-leftover", "forbidden-import", "raw-tag", "palette-color", "arbitrary-color", "raw-color", "undefined-token", "shadowed-export", "version-skew", "duplicate-genesis-package", "peer-range-mismatch", "hand-rolled-sub-nav", "local-genesis-copy", "resource-workspace", "page-layout", "iso-date-slice", "resource-view-tree", "studio-server-auth-import", "removed-scope-name", "scope-practice-id", "deprecated-import", "beta-import", "native-raw-primitive", "native-literal-color", "native-custom-header", "native-screen-layout", "store-readiness", "eas-placeholder", "migration-grants", "migration-rls", "migration-definer-search-path", "migration-edited", "migration-testing-kit", "migration-view-rls", "exposed-schema-created-later", "package-app-import", "package-undeclared-dependency", "package-migration-test", "package-migration-number", "package-migration-edited", "package-unregistered", "package-unversioned-change", "package-export-missing", "package-block-invalid", "package-untagged-tests", "package-doctor-declaration", "overlay-unmarked", "overlay-invalid", "overlay-age", "overlay-version", "overlay-behind", "package-rules-invalid", "package-rule-override", "ratchet-skipped", "allow-grew", "rules-weakened", "extension-added", "stale-extension", "extension-invalid", "agent-guide-stale", "contracts-stale", "lock-files", "database-elsewhere", "genesis-eslint-config"];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Minimal globs for config: `*` matches within a folder, `**` across folders,
|
|
@@ -170,6 +170,11 @@ interface ResolvedPreferRule extends PreferRule {
|
|
|
170
170
|
/** The prefer rules of every package that declares any. */
|
|
171
171
|
declare function preferRules(packages: readonly DeclaringPackage[]): ResolvedPreferRule[];
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* The CLAUDE.md written when an app has none, so tools that read only CLAUDE.md (reviewers,
|
|
175
|
+
* cloud project threads) load the same AGENTS.md every other agent reads.
|
|
176
|
+
*/
|
|
177
|
+
declare const CLAUDE_IMPORT = "@AGENTS.md\n";
|
|
173
178
|
/** One row of the catalog. */
|
|
174
179
|
interface PrimitiveRow {
|
|
175
180
|
need: string;
|
|
@@ -195,17 +200,42 @@ declare function catalogTable(rows: readonly PrimitiveRow[], options?: {
|
|
|
195
200
|
/** `genesis catalog` (and its old name, `genesis primitives`): the catalog for a terminal. */
|
|
196
201
|
declare function formatPrimitives(rows: readonly PrimitiveRow[]): string;
|
|
197
202
|
declare const SKILL_PATH = ".claude/skills/genesis/SKILL.md";
|
|
203
|
+
/** An installed package's own agent guide: its `SKILL.md`, which matches the installed version. */
|
|
204
|
+
interface PackageGuide {
|
|
205
|
+
package: string;
|
|
206
|
+
/** Relative to the app root, POSIX separators: `node_modules/<package>/SKILL.md`, or a local package's own folder. */
|
|
207
|
+
path: string;
|
|
208
|
+
/** When to read it, from the guide's `description`. */
|
|
209
|
+
when: string;
|
|
210
|
+
}
|
|
211
|
+
/** The `description` in a SKILL.md's frontmatter, with a folded (`>`, `>-`) or literal (`|`) value joined into one line. */
|
|
212
|
+
declare function skillDescription(text: string): string;
|
|
213
|
+
/**
|
|
214
|
+
* The `SKILL.md` each installed package ships, so agents read the version the app actually has. Only
|
|
215
|
+
* paths that stay put are listed: a local package's folder, or `node_modules/<package>/SKILL.md` at
|
|
216
|
+
* the app or a workspace folder above it. A package reached only through the umbrella lives in
|
|
217
|
+
* pnpm's store under a path that changes with unrelated dependency bumps, so it's left out rather
|
|
218
|
+
* than going stale; `unlistedGuides` names those.
|
|
219
|
+
*/
|
|
220
|
+
declare function packageGuides(root: string, packages: readonly DeclaringPackage[]): PackageGuide[];
|
|
221
|
+
/** Packages that ship a guide the agent guide can't point at, because it's only inside pnpm's store. */
|
|
222
|
+
declare function unlistedGuides(root: string, packages: readonly DeclaringPackage[]): string[];
|
|
223
|
+
/** The rules every agent follows, for callers outside this file (the subagent hook). */
|
|
224
|
+
declare function agentRules(): readonly string[];
|
|
198
225
|
/** `.claude/skills/genesis/SKILL.md`, generated. */
|
|
199
|
-
declare function renderSkill(rows: readonly PrimitiveRow[]): string;
|
|
226
|
+
declare function renderSkill(rows: readonly PrimitiveRow[], guides?: readonly PackageGuide[]): string;
|
|
200
227
|
/** The AGENTS.md block, generated (markers included). */
|
|
201
|
-
declare function renderAgentsBlock(rows: readonly PrimitiveRow[]): string;
|
|
228
|
+
declare function renderAgentsBlock(rows: readonly PrimitiveRow[], guides?: readonly PackageGuide[]): string;
|
|
202
229
|
/** `genesis agents`: write the skill and the AGENTS.md block. Returns the files it changed. Writes nothing when AGENTS.md's block is broken. */
|
|
203
230
|
declare function writeAgentGuide(root: string, packages: readonly DeclaringPackage[], agentsFile?: string): string[];
|
|
204
231
|
/** What `agent-guide-stale` found: the generated files that are missing or differ. */
|
|
205
232
|
declare function agentGuideState(root: string, packages: readonly DeclaringPackage[], agentsFile?: string): {
|
|
206
233
|
skill: "ok" | "missing" | "stale";
|
|
207
234
|
agents: "ok" | "missing" | "stale" | "broken";
|
|
235
|
+
claude: "ok" | "missing" | "blocked" | "no-import";
|
|
208
236
|
};
|
|
237
|
+
/** The fix for a blocked CLAUDE.md, which `genesis agents` can't make itself. */
|
|
238
|
+
declare const BLOCKED_FIX = "rename or replace it with a CLAUDE.md file (or remove the dangling link), then run genesis agents";
|
|
209
239
|
|
|
210
240
|
/**
|
|
211
241
|
* App-relative paths changed since the merge base with `base`: committed on
|
|
@@ -214,6 +244,35 @@ declare function agentGuideState(root: string, packages: readonly DeclaringPacka
|
|
|
214
244
|
*/
|
|
215
245
|
declare function changedSince(root: string, base: string): Set<string> | null;
|
|
216
246
|
|
|
247
|
+
interface ExtensionContext {
|
|
248
|
+
config: DoctorConfig;
|
|
249
|
+
files: readonly SourceFile[];
|
|
250
|
+
packages: readonly DeclaringPackage[];
|
|
251
|
+
/** Every finding the rules reported, before `rules`, `allow` and extensions applied. */
|
|
252
|
+
raw: readonly FindingInput[];
|
|
253
|
+
/**
|
|
254
|
+
* How many findings an extension may cover: its file's count of its rule at the merge base, for
|
|
255
|
+
* an extension the base config had too. Undefined: no limit (no `--base`, or a new extension,
|
|
256
|
+
* whose findings the pull request's review sees).
|
|
257
|
+
*/
|
|
258
|
+
limit?: (entry: ExtensionEntry) => number | undefined;
|
|
259
|
+
}
|
|
260
|
+
/** Why an extension can't be accepted, or null when it can. */
|
|
261
|
+
declare function extensionProblem(entry: ExtensionEntry, ctx: Omit<ExtensionContext, "limit">): string | null;
|
|
262
|
+
/**
|
|
263
|
+
* Drop the findings each valid extension covers, and report extensions that no longer cover
|
|
264
|
+
* anything (`stale-extension`) or can't be accepted (`extension-invalid`). Runs after `rules` and
|
|
265
|
+
* `allow`, so an extension of a rule that is off isn't reported. With `limit`, a file that has
|
|
266
|
+
* more findings of the rule than the extension covered at the merge base keeps them all.
|
|
267
|
+
*/
|
|
268
|
+
declare function applyExtensions(findings: Finding[], ctx: ExtensionContext): Finding[];
|
|
269
|
+
/**
|
|
270
|
+
* One finding per element: findings of different rules on the same file, line and subject (an
|
|
271
|
+
* app's own rule and a package rule hitting the same `<DataTable>`) are merged, at the higher
|
|
272
|
+
* level, listing every rule in `rules`. Two findings of one rule stay two (two elements on a line).
|
|
273
|
+
*/
|
|
274
|
+
declare function dedupeFindings(findings: readonly Finding[]): Finding[];
|
|
275
|
+
|
|
217
276
|
/** The `source` line `genesis introspect` writes for a Postgres read. Shared so the check and the command agree. */
|
|
218
277
|
declare const postgresSource: (schemas: readonly string[]) => string;
|
|
219
278
|
/** The contract `genesis introspect` writes for these schemas, read from Postgres. */
|
|
@@ -222,6 +281,43 @@ declare function postgresContract(url: string, schemas: string[]): Promise<{
|
|
|
222
281
|
tables: number;
|
|
223
282
|
}>;
|
|
224
283
|
|
|
284
|
+
declare const SETTINGS_PATH = ".claude/settings.json";
|
|
285
|
+
/**
|
|
286
|
+
* The command the hook runs. `--dir` points it at the app, so a session started in a subfolder still
|
|
287
|
+
* gets the package guides. It fails open: with no install, the subagent simply starts without the rules.
|
|
288
|
+
*/
|
|
289
|
+
declare const SUBAGENT_HOOK_COMMAND = "\"$CLAUDE_PROJECT_DIR\"/node_modules/.bin/genesis agents --hook subagent-start --dir \"$CLAUDE_PROJECT_DIR\" 2>/dev/null || true";
|
|
290
|
+
/** Secret files no agent should read: the deny rules apply everywhere, cloud sessions included. */
|
|
291
|
+
declare const DENY_RULES: string[];
|
|
292
|
+
/** The text a subagent receives: the rules, then where each installed package's guide is. */
|
|
293
|
+
declare function subagentContext(root: string, packages: readonly DeclaringPackage[]): string;
|
|
294
|
+
/** `genesis agents --hook subagent-start`: the hook's JSON output. */
|
|
295
|
+
declare function subagentHookOutput(root: string, packages: readonly DeclaringPackage[]): string;
|
|
296
|
+
type HookEntry = {
|
|
297
|
+
matcher?: string;
|
|
298
|
+
hooks: {
|
|
299
|
+
type: string;
|
|
300
|
+
command?: string;
|
|
301
|
+
}[];
|
|
302
|
+
};
|
|
303
|
+
type Settings = {
|
|
304
|
+
hooks?: Record<string, HookEntry[]>;
|
|
305
|
+
permissions?: {
|
|
306
|
+
deny?: string[];
|
|
307
|
+
[k: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
[k: string]: unknown;
|
|
310
|
+
};
|
|
311
|
+
/** The settings with Genesis's hook and deny rules in place; nothing of the app's own is removed. */
|
|
312
|
+
declare function mergeAgentHooks(settings: Settings): Settings;
|
|
313
|
+
/** `genesis agents --hooks`: write the hook and deny rules into `.claude/settings.json`. Returns the files it changed. */
|
|
314
|
+
declare function writeAgentHooks(root: string): string[];
|
|
315
|
+
/**
|
|
316
|
+
* Whether the app has Genesis's hook, and whether it's the current command: an app that adopted an
|
|
317
|
+
* older one keeps it until `genesis agents --hooks` runs again. A settings file that can't be read is "none".
|
|
318
|
+
*/
|
|
319
|
+
declare function agentHooksState(root: string): "none" | "ok" | "stale";
|
|
320
|
+
|
|
225
321
|
interface RunDoctorOptions {
|
|
226
322
|
/** The app root. Default `process.cwd()`. */
|
|
227
323
|
root?: string;
|
|
@@ -262,6 +358,7 @@ declare function formatReport(result: DoctorResult, options?: {
|
|
|
262
358
|
}): string;
|
|
263
359
|
/** The `--json` report: plain data, sets turned into sorted lists. */
|
|
264
360
|
declare function toJson(result: DoctorResult): {
|
|
361
|
+
extensionsAdded?: ExtensionEntry[] | undefined;
|
|
265
362
|
ok: boolean;
|
|
266
363
|
genesis: string;
|
|
267
364
|
errors: number;
|
|
@@ -288,4 +385,4 @@ declare function genesisSummary(g: GenesisFacts): {
|
|
|
288
385
|
};
|
|
289
386
|
};
|
|
290
387
|
|
|
291
|
-
export { BUILTIN_RULES, DeclaringPackage, DoctorConfig, DoctorContext, DoctorPlugin, DoctorResult, Finding, GenesisFacts, type GenesisInstall, PackageDeclaration, PackageDeclarationError, PatternRule, PreferRule, type PrimitiveRow, type ReleaseManifest, type ResolvedPreferRule, type RouteFile, type RunDoctorOptions, SKILL_PATH, SourceFile, agentGuideState, builtinChecks, catalogTable, changedSince, clearPackageRulesCache, defineDoctorPlugin, discoverPackages, findPackageDir, formatPrimitives, formatReport, genesisInstalls, genesisSummary, globToRegExp, loadGenesis, nativeLayouts, parseExportNames, parseRulesMarkdown, postgresContract, postgresSource, preferRules, primitivesCatalog, primitivesSummary, readPackageExports, readReleaseManifest, renderAgentsBlock, renderSkill, routesDir, ruleNamespace, runDoctor, satisfies, sqlStatements, toJson, validateDeclaration, webRoutes, writeAgentGuide };
|
|
388
|
+
export { BLOCKED_FIX, BUILTIN_RULES, CLAUDE_IMPORT, DENY_RULES, DeclaringPackage, DoctorConfig, DoctorContext, DoctorPlugin, DoctorResult, ExtensionEntry, Finding, FindingInput, GenesisFacts, type GenesisInstall, PackageDeclaration, PackageDeclarationError, type PackageGuide, PatternRule, PreferRule, type PrimitiveRow, type ReleaseManifest, type ResolvedPreferRule, type RouteFile, type RunDoctorOptions, SETTINGS_PATH, SKILL_PATH, SUBAGENT_HOOK_COMMAND, SourceFile, agentGuideState, agentHooksState, agentRules, applyExtensions, builtinChecks, catalogTable, changedSince, clearPackageRulesCache, dedupeFindings, defineDoctorPlugin, discoverPackages, extensionProblem, findPackageDir, formatPrimitives, formatReport, genesisInstalls, genesisSummary, globToRegExp, loadGenesis, mergeAgentHooks, nativeLayouts, packageGuides, parseExportNames, parseRulesMarkdown, postgresContract, postgresSource, preferRules, primitivesCatalog, primitivesSummary, readPackageExports, readReleaseManifest, renderAgentsBlock, renderSkill, routesDir, ruleNamespace, runDoctor, satisfies, skillDescription, sqlStatements, subagentContext, subagentHookOutput, toJson, unlistedGuides, validateDeclaration, webRoutes, writeAgentGuide, writeAgentHooks };
|