@mark1russell7/conventions 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mark Russell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # @mark1russell7/conventions
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This package is one check in CI for the conventions that the docs of a repository tell in prose. Each rule is a small module with an id, a reason, a fix and the rows of the invariants audit that it comes from. A repository turns a rule off or changes a rule only with a reason in its `package.json`. Thus each exception is visible in the diff.
4
+
5
+ ## Use
6
+
7
+ Install the package:
8
+
9
+ ```sh
10
+ pnpm add -D @mark1russell7/conventions
11
+ ```
12
+
13
+ Add the script `"check:conventions": "conventions check"` to the root `package.json`. The shared CI of the template starts `check:conventions` after `lint` (`CI.md`).
14
+
15
+ ```sh
16
+ pnpm exec conventions check
17
+ pnpm exec conventions --list
18
+ ```
19
+
20
+ Each break shows the file, the line, the rule and the fix. In GitHub Actions, the check also writes an annotation on the line of each break. It also writes a table of the rules to the summary of the run (`GITHUB_STEP_SUMMARY`). The exit code is 1 when a rule has a break.
21
+
22
+ ## Rules
23
+
24
+ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The audit read the rule documents of 7 repositories. Each rule here is a convention that 3 or more repositories tell, and that a script examines exactly. The column "From" gives the repository and the id of each audit row.
25
+
26
+ | Rule | What it examines | From |
27
+ |---|---|---|
28
+ | `pinned-git-deps` | A dependency from git (`github:`, `git+https:`, `owner/repo`) names a full commit SHA. The rule also examines `overrides`, `resolutions` and `pnpm.overrides`. | coeval `pinned-deps`, `unpublished-dep-pinned`. headroom `non-npm-deps-pinned`, `pinned-github-specifier`. Graph `github-dep-full-sha`, `github-dep-pinned`. client `general-npm-version`. |
29
+ | `workspace-protocol` | A dependency on a package of the workspace uses `workspace:`. The rule does not examine peer dependencies. | client `workspace-protocol`, `workspace-deps`. coeval `pinned-deps`. headroom `non-npm-deps-pinned`. crawler `mcp-workspace-dep`. |
30
+ | `source-main` | The `main` of each workspace package is `src/index.ts` (a package with only a `bin` has no `main`, and a private package with no entry is an app). A public package that has a source entry has the same field in `publishConfig`, and that field points at the build. | coeval `package-main-source`, `source-package-main`. crawler `pkg-source-main`, `source-package-main`, `publish-config-build`. Graph `new-package-main-index`, `source-package-main`. headroom `source-package-main`. |
31
+ | `tsconfig-test` | Each package with a `tsconfig.json` has a `tsconfig.test.json`, and its `typecheck` script names it. | coeval, crawler, Vex `package-tsconfig-test` or `pkg-tsconfig-test`, and `tsconfig-test`. headroom `tsconfig-test`, `tsconfig-test-per-package`. |
32
+ | `cue-preset` | The `tsconfig.json` of each package extends a preset of `@mark1russell7/cue`. No config of a package turns off a strict option that its preset turns on. | client `cue-config`, `no-manual-tsconfig`. Graph `cue-preset-strict`, `strict-preset`, `new-package-via-cli`. coeval, crawler, headroom, Vex `package-scaffold`. |
33
+ | `required-scripts` | The root `package.json` has the script `typecheck`. It also has `lint:ste` when the repository uses `ste-lint`: a dependency on `@mark1russell7/ste-lint`, or a `ste.config.json` at the root. The shared CI skips a missing script, so a removed script turns its check off with no sign. | client, coeval, crawler, Graph, headroom, Vex `ste-prose`. systems `lint-ste-in-ci`. coeval, crawler, headroom, Vex `tsconfig-test`. |
34
+ | `no-build-output` | Git keeps no file in a folder named `dist` or `build`. | client `no-build-output`, `no-dist`, `no-dist-commit`. Only one repository of the audit tells this rule. The `.gitignore` of the template has it for each repository. |
35
+ | `no-local-paths` | No tracked file has the home folder of a user: `C:\Users\<name>`, `/Users/<name>` or `/home/<name>`. A CI user (`runner`), a name of one character and a placeholder (`<you>`) are not a break. | client `I12`. systems `no-identifying-names`, `no-private-identifiers`, `no-private-names`. coeval `no-private-names`. |
36
+ | `release-files` | A pull request changes `.github/workflows/release.yml` or `scripts/release/` only with a line `Release-Edit: <reason>` in a commit message or in the body of the pull request. The commits of the release bot (the sync of the template) need no reason. | coeval `no-release-edit`, `no-release-edits`. crawler `no-release-edit`, `no-release-edits`. headroom `no-release-edits`, `release-files-frozen`. |
37
+
38
+ The rule `release-files` needs the base of the change. On a pull request, the checkout is a merge commit, and the rule reads its two parents (`fetch-depth` 2 or more). In other runs, give `--base <ref>`. Without a base, the rule shows `skip`.
39
+
40
+ ## Configuration
41
+
42
+ The field `conventions` of the root `package.json` sets the rules. An exception or a changed option needs a reason:
43
+
44
+ ```json
45
+ {
46
+ "conventions": {
47
+ "rules": {
48
+ "no-build-output": { "off": "git installs of this package need dist/" },
49
+ "cue-preset": { "ignore": ["packages/web/**"], "reason": "packages/web keeps TypeScript 6 and its own config" },
50
+ "workspace-protocol": { "prefix": "workspace:*", "reason": "each dependency of the workspace is exact" }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ | Field | What it sets |
57
+ |---|---|
58
+ | `rules.<id>.off` | The rule does not start. The text is the reason, and the output shows it. |
59
+ | `rules.<id>.ignore` | The globs of the files whose breaks the rule does not report. It needs `reason`. |
60
+ | `rules.<id>.reason` | The reason of `ignore` or of a changed option. |
61
+ | `rules.<id>.<option>` | An option of the rule. It needs `reason`, because a changed option can make a rule weaker. `conventions --list` shows the options and their values. |
62
+ | `packages` | The globs of the package folders. The default is the `packages` list of `pnpm-workspace.yaml`. |
63
+
64
+ An unknown rule, an unknown option, or an exception or a changed option without a reason is an error. Thus a typing error or a quiet change does not make a rule weaker.
65
+
66
+ | Option | Default | What it sets |
67
+ |---|---|---|
68
+ | `pinned-git-deps.fullSha` | `true` | When `false`, a short SHA is also a commit. |
69
+ | `workspace-protocol.prefix` | `workspace:` | The start of each specifier. |
70
+ | `source-main.main` | `src/index.ts` | The path of `main`. |
71
+ | `source-main.publishConfig` | `true` | When `false`, the rule does not examine `publishConfig`. |
72
+ | `tsconfig-test.file` | `tsconfig.test.json` | The name of the config of the tests. |
73
+ | `cue-preset.prefix` | `@mark1russell7/cue/` | The start of the `extends` path of a preset. |
74
+ | `required-scripts.scripts` | `["typecheck"]` | The scripts of the root `package.json`. |
75
+ | `required-scripts.steScripts` | `["lint:ste"]` | The scripts of the root `package.json` when the repository uses `ste-lint`. |
76
+ | `no-build-output.folders` | `["dist", "build"]` | The names of the folders of build output. |
77
+ | `no-local-paths.allow` | `[]` | More user names that are not a break. |
78
+ | `no-local-paths.patterns` | `[]` | More regular expressions of text that no file has. The environment variable `CONVENTIONS_PRIVATE_PATTERNS` adds one on each line, so a private name stays out of `package.json`. |
79
+ | `release-files.paths` | `[".github/workflows/release.yml", "scripts/release/**"]` | The globs of the files of the release flow. |
80
+ | `release-files.trailer` | `Release-Edit` | The key of the line that gives the reason. |
81
+ | `release-files.authors` | `["mark1russell7-release-train[bot]"]` | The authors of the release flow. Their commits need no reason. |
82
+
83
+ ## Commands
84
+
85
+ | Option | What it sets |
86
+ |---|---|
87
+ | `check` | Start each rule. |
88
+ | `--list` | Show each rule: the reason, the fix, the options, the state and the audit rows. |
89
+ | `--root <folder>` | The root of the repository. The default is the current folder. |
90
+ | `--rule <id>` | Only this rule. Use it again for more rules. |
91
+ | `--base <ref>` | The base commit of the change, for the rule `release-files`. |
92
+ | `--json` | Write the result as JSON. |
93
+
94
+ ## Add a rule
95
+
96
+ A rule is a module in `src/rules/` that exports a `Rule`. A `Rule` has an `id`, a `title`, a `reason`, a `fix` and its audit `sources`. It also has its `options` with defaults, and a function `check(context, options)`. The function gives a list of breaks, or `{ skipped: "<reason>" }`. Add the rule to `RULES` in `src/rules/index.ts`, with a test of a case that passes and a case that breaks. Add a rule only when 3 or more repositories tell it and a script examines it exactly.
97
+
98
+ ## Library
99
+
100
+ The package also exports the functions of the tool:
101
+
102
+ - `runChecks(options)` starts the rules and gives the result of each rule. `runCli(args, io)` is the bin.
103
+ - `formatResult(result)`, `summaryMarkdown(result)`, `annotations(result)` and `listRules(config)` give the output.
104
+ - `parseConfig(value, rules)` and `readConfig(root)` read the field `conventions`.
105
+ - `RULES` and each rule, with the helpers `isGitSpecifier`, `isPinned`, `isSourcePath` and `parseJsonc`.
package/build/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/build/cli.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { c as runCli } from "./run-B73MKaR7.js";
3
+ // src/cli.ts
4
+ try {
5
+ process.exitCode = runCli(process.argv.slice(2), {
6
+ cwd: process.cwd(),
7
+ env: process.env,
8
+ stdout: (text) => process.stdout.write(text),
9
+ stderr: (text) => process.stderr.write(text)
10
+ });
11
+ } catch (error) {
12
+ process.stderr.write(`conventions: ${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
13
+ process.exitCode = 1;
14
+ }
15
+ export {};
16
+
17
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The bin `conventions`. The work is in run.ts, so a test can start the same CLI in a fixture folder.\nimport { runCli } from \"./run.ts\";\n\ntry {\n process.exitCode = runCli(process.argv.slice(2), {\n cwd: process.cwd(),\n env: process.env,\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n });\n} catch (error) {\n process.stderr.write(`conventions: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;AAIA,IAAI;CACF,QAAQ,WAAW,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG;EAC/C,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;CAC7C,CAAC;AACH,SAAS,OAAO;CACd,QAAQ,OAAO,MAAM,gBAAgB,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAChH,QAAQ,WAAW;AACrB"}
@@ -0,0 +1,240 @@
1
+ /** A row of the invariants audit that a rule comes from: the repository, the id of the rule in that audit, and the document line. */
2
+ interface AuditSource {
3
+ readonly repo: string;
4
+ readonly rule: string;
5
+ readonly doc: string;
6
+ }
7
+ /** A break of a rule: the file, the line when the rule knows it, and what is wrong. */
8
+ interface Break {
9
+ /** The file, relative to the root, with `/`. */
10
+ readonly file: string;
11
+ /** The line in the file, from 1. */
12
+ readonly line?: number;
13
+ readonly message: string;
14
+ /** A fix for this break. The fix of the rule applies when this field is missing. */
15
+ readonly fix?: string;
16
+ }
17
+ /** A value of an option of a rule. */
18
+ type OptionValue = string | number | boolean | readonly string[];
19
+ /** The options of a rule, after the defaults. */
20
+ type Options = Readonly<Record<string, OptionValue>>;
21
+ /** The description of one option of a rule. */
22
+ interface OptionSpec {
23
+ readonly type: "string" | "number" | "boolean" | "strings";
24
+ readonly default: OptionValue;
25
+ readonly description: string;
26
+ }
27
+ /** A field of `package.json`, as the rules read it. */
28
+ type Manifest = Readonly<Record<string, unknown>>;
29
+ /** A `package.json` file of the repository. */
30
+ interface PackageInfo {
31
+ /** The folder, relative to the root, with `/`. The root is `""`. */
32
+ readonly folder: string;
33
+ /** The absolute path of the folder. */
34
+ readonly dir: string;
35
+ /** The path of the `package.json` file, relative to the root, with `/`. */
36
+ readonly file: string;
37
+ /** The text of the `package.json` file. */
38
+ readonly text: string;
39
+ readonly manifest: Manifest;
40
+ }
41
+ /** The facts of the repository that a rule reads. */
42
+ interface RuleContext {
43
+ /** The absolute path of the root. */
44
+ readonly root: string;
45
+ /** The root `package.json`. */
46
+ readonly rootPackage: PackageInfo;
47
+ /** The packages of the workspace, without the root. A repository with no workspace has no packages here. */
48
+ readonly packages: readonly PackageInfo[];
49
+ /** The environment variables. */
50
+ readonly env: Readonly<Record<string, string | undefined>>;
51
+ /** The base commit that `--base` gives, if any. */
52
+ readonly base?: string;
53
+ /** This function gives the files that git tracks, relative to the root, or undefined when the root is not in a git repository. */
54
+ gitFiles(): readonly string[] | undefined;
55
+ /** This function starts git in the root, and gives its output, or undefined when git fails. */
56
+ git(args: readonly string[]): string | undefined;
57
+ }
58
+ /** The result of a rule: a list of breaks (empty when the rule passes), or the reason why the rule did not start. */
59
+ type RuleOutcome = readonly Break[] | {
60
+ readonly skipped: string;
61
+ };
62
+ /** One convention, as a machine check. */
63
+ interface Rule {
64
+ /** A short id in kebab case. The configuration names the rule with this id. */
65
+ readonly id: string;
66
+ /** The rule in one sentence. */
67
+ readonly title: string;
68
+ /** Why the rule exists. */
69
+ readonly reason: string;
70
+ /** How to correct a break. */
71
+ readonly fix: string;
72
+ /** The rows of the invariants audit that the rule comes from. */
73
+ readonly sources: readonly AuditSource[];
74
+ /** The options of the rule, with their defaults. */
75
+ readonly options: Readonly<Record<string, OptionSpec>>;
76
+ check(context: RuleContext, options: Options): RuleOutcome;
77
+ }
78
+ /** The fields of `package.json` that hold dependencies. */
79
+ export declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
80
+ /** This function gives each entry of a field of `package.json` that maps names to specifiers. */
81
+ export declare function specifiersOf(manifest: Manifest, field: string): [string, string][];
82
+ /** This function gives the line (from 1) of the first line of `text` that contains `needle`, from the line `from`. */
83
+ export declare function lineOf(text: string, needle: string, from?: number): number | undefined;
84
+ /** This function gives the line of the key `"name":` in `package.json`, after the line of the field `field`. */
85
+ export declare function keyLine(text: string, field: string, name: string): number | undefined;
86
+ /** This function joins a folder and a file name as a path relative to the root. */
87
+ export declare const inFolder: (folder: string, file: string) => string;
88
+ /** This function removes `./` at the start of a path. */
89
+ export declare const cleanPath: (path: string) => string;
90
+ /** This function tells if a path matches one of the globs. */
91
+ export declare function matchesAny(path: string, globs: readonly string[]): boolean;
92
+ /**
93
+ * This function reads a JSON file with comments and commas at the end of a list (a `tsconfig.json`).
94
+ *
95
+ * @throws SyntaxError when the text is not JSON after the comments are removed
96
+ */
97
+ export declare function parseJsonc(text: string): unknown;
98
+ /** This function reads a JSON file with comments, or gives undefined when the file does not exist or is not JSON. */
99
+ export declare function readJsonc(file: string): unknown;
100
+ /** This function starts git in `root` with `args`, and gives its output, or undefined when git fails. */
101
+ export declare function runGit(root: string, args: readonly string[]): string | undefined;
102
+ /** This function tells if `file` exists in the folder `dir`. */
103
+ export declare const hasFile: (dir: string, file: string) => boolean;
104
+ /** The configuration of one rule, after the check of its fields. */
105
+ interface RuleConfig {
106
+ /** The reason why the rule is off. The rule is on when this field is missing. */
107
+ readonly off?: string;
108
+ /** The globs of files that the rule does not report. */
109
+ readonly ignore: readonly string[];
110
+ /** The reason of `ignore` or of the changed options. */
111
+ readonly reason?: string;
112
+ /** The options of the rule, with the defaults. */
113
+ readonly options: Options;
114
+ }
115
+ /** The configuration of the check. */
116
+ interface ConventionsConfig {
117
+ /** The globs of the package folders. The default is the globs of the workspace. */
118
+ readonly packages?: readonly string[];
119
+ /** The configuration of each rule, by its id. */
120
+ readonly rules: Readonly<Record<string, RuleConfig>>;
121
+ }
122
+ /** This function gives the options of a rule with their defaults. */
123
+ export declare function defaultOptions(rule: Rule): Options;
124
+ /**
125
+ * This function reads the field `conventions` of the root `package.json` (`value`), and gives the
126
+ * configuration of each rule of `rules`.
127
+ *
128
+ * @throws Error when the field has a wrong shape, an unknown rule or option, or an exception or a changed option without a reason
129
+ */
130
+ export declare function parseConfig(value: unknown, rules: readonly Rule[]): ConventionsConfig;
131
+ /** The compiler options that make the type check strict. A package does not turn them off. */
132
+ export declare const STRICT_OPTIONS: readonly ["strict", "noImplicitAny", "strictNullChecks", "strictFunctionTypes", "strictBindCallApply", "strictPropertyInitialization", "strictBuiltinIteratorReturn", "noImplicitThis", "useUnknownInCatchVariables", "alwaysStrict", "noUncheckedIndexedAccess", "exactOptionalPropertyTypes", "noImplicitOverride", "noImplicitReturns", "noFallthroughCasesInSwitch", "noPropertyAccessFromIndexSignature"];
133
+ export declare const cuePreset: Rule;
134
+ export declare const noBuildOutput: Rule;
135
+ /** The names in a home path that do not identify a person: CI users, container users and placeholders. */
136
+ export declare const DEFAULT_ALLOWED: readonly string[];
137
+ /** The forms of a home folder: Windows, macOS and Linux. The group `user` is the name of the user. */
138
+ export declare const HOME_PATTERNS: readonly RegExp[];
139
+ export declare const noLocalPaths: Rule;
140
+ /** This function tells if a specifier gets the package from git, not from a registry or the workspace. */
141
+ export declare function isGitSpecifier(spec: string): boolean;
142
+ /**
143
+ * This function tells if a git specifier names a commit. A specifier names a commit when its ref
144
+ * (after `#`) is a commit SHA, or when a tarball URL has the SHA in its path.
145
+ */
146
+ export declare function isPinned(spec: string, fullSha: boolean): boolean;
147
+ export declare const pinnedGitDeps: Rule;
148
+ export declare const releaseFiles: Rule;
149
+ export declare const requiredScripts: Rule;
150
+ /** This function gives each path in the value of an entry field (a string, or the strings in an object). */
151
+ export declare function pathsOf(value: unknown): string[];
152
+ /** This function tells if a path is a source file: a file in `src/`, or a TypeScript file that is not a declaration file. */
153
+ export declare function isSourcePath(path: string): boolean;
154
+ export declare const sourceMain: Rule;
155
+ export declare const tsconfigTest: Rule;
156
+ export declare const workspaceProtocol: Rule;
157
+ /** Each rule of the check. */
158
+ export declare const RULES: readonly Rule[];
159
+ /** The result of one rule. */
160
+ interface RuleResult {
161
+ readonly id: string;
162
+ readonly title: string;
163
+ readonly fix: string;
164
+ /** `pass`: no break. `break`: one or more breaks. `off`: the configuration turns the rule off. `skipped`: the rule did not start. `error`: the rule threw. */
165
+ readonly status: "pass" | "break" | "off" | "skipped" | "error";
166
+ readonly breaks: readonly Break[];
167
+ /** The number of breaks in the files of `ignore`. */
168
+ readonly ignored: number;
169
+ /** The reason of `off`, of `ignore`, of `skipped`, or the message of `error`. */
170
+ readonly note?: string;
171
+ }
172
+ /** The result of `runChecks`. */
173
+ interface CheckResult {
174
+ readonly rules: readonly RuleResult[];
175
+ /** True when a rule has a break or an error. */
176
+ readonly failed: boolean;
177
+ }
178
+ /** The options of `runChecks`. */
179
+ interface CheckOptions {
180
+ /** The root of the repository. */
181
+ readonly root: string;
182
+ /** Only these rules. The default is each rule. */
183
+ readonly only?: readonly string[];
184
+ /** The base commit of the change, for the rules that examine a change. */
185
+ readonly base?: string;
186
+ readonly env?: Readonly<Record<string, string | undefined>>;
187
+ /** The rules. The default is `RULES`. */
188
+ readonly rules?: readonly Rule[];
189
+ }
190
+ /** This function reads the configuration of the root `package.json` at `root`. */
191
+ export declare function readConfig(root: string, rules?: readonly Rule[]): ConventionsConfig;
192
+ /** This function gives the facts of the repository at `root` that the rules read. */
193
+ export declare function createContext(root: string, config: ConventionsConfig, options?: Pick<CheckOptions, "base" | "env">): RuleContext;
194
+ /** This function starts each rule on the repository at `options.root`, and gives the result of each rule. */
195
+ export declare function runChecks(options: CheckOptions): CheckResult;
196
+ /** This function gives the text of a result for a terminal or a CI log. */
197
+ export declare function formatResult(result: CheckResult): string;
198
+ /** This function gives the result as Markdown for the summary of a GitHub Actions run. */
199
+ export declare function summaryMarkdown(result: CheckResult): string;
200
+ /** This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request. */
201
+ export declare function annotations(result: CheckResult): string;
202
+ /** This function gives the text of `--list`: each rule, its reason, its fix, its options, its state and its audit sources. */
203
+ export declare function listRules(config: ConventionsConfig | undefined, rules?: readonly Rule[]): string;
204
+ /** The input and output of `runCli`. */
205
+ interface CliIo {
206
+ readonly cwd: string;
207
+ readonly env: Readonly<Record<string, string | undefined>>;
208
+ readonly stdout: (text: string) => void;
209
+ readonly stderr: (text: string) => void;
210
+ }
211
+ /** The help text of the bin. */
212
+ export declare const USAGE: string;
213
+ /** This function starts the bin with the arguments `args`, and gives its exit code. */
214
+ export declare function runCli(args: readonly string[], io: CliIo): number;
215
+ /**
216
+ * This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path
217
+ * segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of
218
+ * its parts. The function escapes each other special character.
219
+ */
220
+ export declare function globToRegExp(glob: string): RegExp;
221
+ /**
222
+ * This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,
223
+ * in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.
224
+ */
225
+ export declare function globFolders(root: string, glob: string): string[];
226
+ /**
227
+ * This function gives the globs of the workspace at `root`: the `packages` list of
228
+ * `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when
229
+ * the repository has no workspace.
230
+ */
231
+ export declare function workspaceGlobs(root: string): string[] | undefined;
232
+ /**
233
+ * This function gives the package folders of the repository at `root`: the folders of the globs
234
+ * that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the
235
+ * function reads the globs of the workspace, and a repository with no workspace is one package.
236
+ * The result has absolute paths, in the order of the code units.
237
+ */
238
+ export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
239
+ export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Manifest, OptionSpec, OptionValue, Options, PackageInfo, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
240
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/source-main.ts","../src/rules/tsconfig-test.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;;KAIC;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;EAC1C,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;UCxKpB;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA2FA,WAAW;qBC/FX,eAAe;;qBCYf;;qBAGA,wBAAwB;qBAMxB,cAAc;;wBClBX,eAAe;;;;;wBAaf,SAAS,cAAc;qBAqB1B,eAAe;qBCEf,cAAc;qBCrBd,iBAAiB;;wBCdd,QAAQ;;wBAQR,aAAa;qBAKhB,YAAY;qBCjBZ,cAAc;qBCEd,mBAAmB;;qBCOnB,gBAAgB;;UCHZ;WACN;WACA;WACA;;WAEA;WACA,iBAAiB;;WAEjB;;WAEA;;;UAIM;WACN,gBAAgB;;WAEhB;;;UAIM;;WAEN;;WAEA;;WAEA;WACA,MAAM,SAAS;;WAEf,iBAAiB;;;wBAaZ,WAAW,cAAc,iBAAgB,SAAiB;;wBAO1D,cAAc,cAAc,QAAQ,mBAAmB,UAAS,KAAK,gCAAqC;;wBAwB1G,UAAU,SAAS,eAAe;;wBA0ClC,aAAa,QAAQ;;wBA0BrB,gBAAgB,QAAQ;;wBAsBxB,YAAY,QAAQ;;wBAYpB,UAAU,QAAQ,+BAA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBAwBG,OAAO,yBAAyB,IAAI;;;;;;wBCxNpC,aAAa,eAAe;;;;;wBA+C5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
package/build/index.js ADDED
@@ -0,0 +1 @@
1
+ export { x as DEFAULT_ALLOWED, D as DEPENDENCY_FIELDS, S as HOME_PATTERNS, u as RULES, T as STRICT_OPTIONS, t as USAGE, n as annotations, O as cleanPath, r as createContext, E as cuePreset, H as defaultOptions, i as formatResult, R as globFolders, z as globToRegExp, k as hasFile, A as inFolder, v as isGitSpecifier, y as isPinned, p as isSourcePath, j as keyLine, M as lineOf, a as listRules, N as matchesAny, w as noBuildOutput, C as noLocalPaths, B as packageFolders, U as parseConfig, P as parseJsonc, m as pathsOf, b as pinnedGitDeps, o as readConfig, F as readJsonc, _ as releaseFiles, g as requiredScripts, s as runChecks, c as runCli, I as runGit, h as sourceMain, L as specifiersOf, l as summaryMarkdown, f as tsconfigTest, V as workspaceGlobs, d as workspaceProtocol } from "./run-B73MKaR7.js";