@mark1russell7/conventions 0.13.0 → 0.13.1
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 +14 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +36 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/{run-C-8IoeoO.js → run-BxPv_FTo.js} +642 -2
- package/build/run-BxPv_FTo.js.map +1 -0
- package/package.json +1 -1
- package/build/run-C-8IoeoO.js.map +0 -1
package/README.md
CHANGED
|
@@ -123,6 +123,19 @@ An unknown rule, an unknown option, or an exception or a changed option without
|
|
|
123
123
|
| `--base <ref>` | The base commit of the change, for the rule `release-files`. |
|
|
124
124
|
| `--json` | Write the result as JSON. |
|
|
125
125
|
|
|
126
|
+
## The map of homes
|
|
127
|
+
|
|
128
|
+
The map gives the home package of each area of code: statistics, seeded random, exact arithmetic, geometry, text, servers, files and commands, tests and more. Before you write a helper, find its home. If the home does not have the function, add the function to the home. Do not make a local copy or a new package.
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
conventions map # each area and its home
|
|
132
|
+
conventions map seeded random # the areas that match the words
|
|
133
|
+
conventions map --markdown # the table with the rule, for a CLAUDE.md
|
|
134
|
+
conventions map --overlay homes.json --markdown # with more homes from a JSON file
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
An overlay file has the shape `{ "homes": [...] }`. A home of the overlay takes the place of the home with the same area. The private repositories use an overlay, because the public map names only public packages.
|
|
138
|
+
|
|
126
139
|
## Add a rule
|
|
127
140
|
|
|
128
141
|
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>" }`.
|
|
@@ -137,4 +150,5 @@ The package also exports the functions of the tool:
|
|
|
137
150
|
- `replaceLine(text, line, lines)` gives the text with one line replaced, for the edits of a rule.
|
|
138
151
|
- `formatResult(result)`, `summaryMarkdown(result)`, `annotations(result)` and `listRules(config)` give the output.
|
|
139
152
|
- `parseConfig(value, rules)` and `readConfig(root)` read the field `conventions`.
|
|
153
|
+
- `HOMES` is the map of homes. `findHomes(query)` finds the homes of words, and `mapMarkdown(homes)` and `mapText(homes)` write them. `readOverlay(file)` and `mergeHomes(base, extra)` add more homes.
|
|
140
154
|
- `RULES` and each rule, with the helpers `isGitSpecifier`, `isPinned`, `isSourcePath` and `parseJsonc`.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -306,6 +306,41 @@ interface CliIo {
|
|
|
306
306
|
export declare const USAGE: string;
|
|
307
307
|
/** This function starts the bin with the arguments `args`, and gives its exit code. */
|
|
308
308
|
export declare function runCli(args: readonly string[], io: CliIo): number;
|
|
309
|
+
/** The state of a home: on npm, in a repository but not on npm, only on a roadmap, or with no package. */
|
|
310
|
+
type HomeState = "published" | "unpublished" | "planned" | "none";
|
|
311
|
+
/** One area of code and its home. */
|
|
312
|
+
interface Home {
|
|
313
|
+
/** The id of the area, in kebab case. */
|
|
314
|
+
readonly area: string;
|
|
315
|
+
/** The area in a few plain words. */
|
|
316
|
+
readonly title: string;
|
|
317
|
+
/** The code that belongs in the home. */
|
|
318
|
+
readonly covers: string;
|
|
319
|
+
/** The packages of the home. A planned home has no package yet. */
|
|
320
|
+
readonly packages: readonly string[];
|
|
321
|
+
/** The repository of the home, as owner/name. */
|
|
322
|
+
readonly repo: string;
|
|
323
|
+
/** The state of the home. */
|
|
324
|
+
readonly state: HomeState;
|
|
325
|
+
/** More words that find the area in a search. */
|
|
326
|
+
readonly words: readonly string[];
|
|
327
|
+
/** A note: the code that goes to another home, or a known split. */
|
|
328
|
+
readonly note?: string;
|
|
329
|
+
}
|
|
330
|
+
/** The rule of the map. Each session and each review applies it. */
|
|
331
|
+
export declare const MAP_RULE = "Before you write a helper, find its home in this map. If the home does not have the function, add it to the home, in a pull request of the home repository. Do not make a local copy, a new package or a new repository for an area that has a home: that needs the strategist. A home that is not on npm is used with workspace:* or a github: specifier pinned to a commit. If no area fits, ask the strategist for a home before you write the code.";
|
|
332
|
+
/** The public homes. Each package of the fleet that other code can use has one area. */
|
|
333
|
+
export declare const HOMES: readonly Home[];
|
|
334
|
+
/** A file of more homes, for example the private repositories, in the shape `{ "homes": Home[] }`. */
|
|
335
|
+
export declare function readOverlay(file: string): readonly Home[];
|
|
336
|
+
/** This function merges the homes. A home of `extra` with the area of a home of `base` takes its place. */
|
|
337
|
+
export declare function mergeHomes(base: readonly Home[], extra: readonly Home[]): readonly Home[];
|
|
338
|
+
/** This function gives the homes that match each word of `query`, best match first. */
|
|
339
|
+
export declare function findHomes(query: string, homes?: readonly Home[]): readonly Home[];
|
|
340
|
+
/** This function writes the map as a Markdown table, with the rule first. */
|
|
341
|
+
export declare function mapMarkdown(homes?: readonly Home[]): string;
|
|
342
|
+
/** This function writes the homes as plain text for a terminal. */
|
|
343
|
+
export declare function mapText(homes: readonly Home[]): string;
|
|
309
344
|
/**
|
|
310
345
|
* This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path
|
|
311
346
|
* segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of
|
|
@@ -330,5 +365,5 @@ export declare function workspaceGlobs(root: string): string[] | undefined;
|
|
|
330
365
|
* The result has absolute paths, in the order of the code units.
|
|
331
366
|
*/
|
|
332
367
|
export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
|
|
333
|
-
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PathFilter, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
|
|
368
|
+
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeState, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PathFilter, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
|
|
334
369
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/rules/main-check.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/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.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;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;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;;;;;wBAMrB,aAAa,SAAS,KAAK,oDAAoD;;UCrM9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA2FA,WAAW;;UCtFP;WACN;WACA;WACA;;;wBAIK,cAAc,eAAe;;qBAoBhC;;wBAgCG,YAAY;;;;;;;wBAkBZ,YAAY,cAAc,cAAc;EAAoC;;EAAmB;;qBA8IlG,aAAa;;qBC1Nb;;wBA6BG,kBAAkB;qBAiFrB,WAAW;qBCxHX,eAAe;;qBCYf;;qBAGA,wBAAwB;qBAOxB,cAAc;;wBCnBX,eAAe;;;;;wBAaf,SAAS,cAAc;qBAqB1B,eAAe;qBCVf,cAAc;qBCTd,iBAAiB;;wBCqCd,cAAc;qBAajB,eAAe;;;;;;wBC3DZ,eAAe,oBAAoB;;wBAUnC,mBAAmB;qBAsJtB,cAAc;;wBCrKX,QAAQ;;wBAQR,aAAa;qBAKhB,YAAY;qBCkBZ,eAAe;;wBCpBZ,SAAS,0BAA0B;qBAKtC,cAAc;;wBCmDX,gBAAgB;;;;;wBAmChB,UACd,SAAS,SAAS,0BAClB,cACA,OAAM;qBAkRK,YAAY;qBC/VZ,cAAc;;qBC3Bd;;qBAGA;qBA6DA,aAAa;qBCnEb,mBAAmB;;qBCenB,gBAAgB;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/rules/main-check.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/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-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Ae,iBAAgB,kBAA0B;;wBAkBnE,YAAY,iBAAgB;;wBAW5B,QAAQ,gBAAgB;;;;;;wBChUxB,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { X as ACTIONS_COMMIT, U as DEFAULT_ALLOWED, rt as DEPENDENCY_FIELDS, d as HOMES, W as HOME_PATTERNS, b as IGNORE_AFTER, f as MAP_RULE, q as REAL_COMPARE, v as RULES, tt as STRICT_OPTIONS, x as TRAIN_SCOPES, t as USAGE, n as annotations, it as cleanPath, at as codePackages, w as configsOfScript, Z as convertGate, r as createContext, nt as cuePreset, bt as defaultOptions, p as findHomes, i as formatResult, Q as gateTrigger, gt as globFolders, _t as globToRegExp, ot as hasFile, J as hasImportMetaMain, O as hasTests, st as inFolder, B as isGitSpecifier, V as isPinned, A as isSourcePath, ct as keyLine, lt as lineOf, a as listRules, Y as mainCheck, m as mapMarkdown, h as mapText, ut as matchesAny, g as mergeHomes, K as noBuildOutput, G as noLocalPaths, vt as packageFolders, xt as parseConfig, dt as parseJsonc, j as pathsOf, H as pinnedGitDeps, $ as prPathFilters, o as readConfig, ft as readJsonc, _ as readOverlay, z as releaseFiles, pt as replaceLine, N as repositoryOfRemote, R as requiredScripts, I as roadmapOfLine, L as roadmapParses, s as runChecks, c as runCli, l as runFix, mt as runGit, P as runnerBudget, F as scheduleMinute, T as scriptsOf, M as sourceMain, ht as specifiersOf, u as summaryMarkdown, et as summaryName, D as testsRequired, S as trustPolicy, k as tsconfigTest, E as typedFiles, C as typedScripts, yt as workspaceGlobs, y as workspaceProtocol } from "./run-BxPv_FTo.js";
|