@mark1russell7/conventions 0.33.0 → 0.35.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 +3 -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 +2 -2
- package/build/{run--5zk2wDX.js → run-Do3z3eKR.js} +263 -4
- package/build/run-Do3z3eKR.js.map +1 -0
- package/package.json +5 -2
- package/build/run--5zk2wDX.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Each break shows the file, the line, the rule and the fix. In GitHub Actions, th
|
|
|
27
27
|
- `push-main-only`: a workflow that starts on `push` and on `pull_request`, with no limit of `push` to the default branch or with no `workflow_dispatch`. The fix adds `branches` and `workflow_dispatch`, and keeps the comments and each other trigger. It keeps a tag run when the workflow reads the tag. It does not edit `release.yml`, and a person chooses the change for `branches-ignore` or for another named branch.
|
|
28
28
|
- `pipe-fails`: a step with a pipe and no `pipefail`. The fix adds `defaults: { run: { shell: bash } }` to the workflow. It does not write over another shell.
|
|
29
29
|
- `gate-after-cancel`: a summary job of a gate with `always()` in its condition. The fix writes `if: ${{ !cancelled() }}`. A condition with other parts needs a person.
|
|
30
|
+
- `security-one-job`: a job that uses the shared workflow `reusable-security.yml`, with its summary job `Security OK`. The fix writes one job `Security OK` that runs the action `security-scan`, with the same inputs and time limit. The pin is the first commit of the template with the action, and Renovate moves it. Another summary job, another job that needs the scans or an input of more than one line needs a person.
|
|
30
31
|
- `tests-required`: the option `passWithNoTests` in a config or a script, in a package with test files. A package with no tests needs a person, who removes its test script.
|
|
31
32
|
- `typed-files`: a config file at the root of a package (`vitest.config.ts`). The fix adds `*.config.ts` and `rootDir: "."` to the `tsconfig.test.json` of the package, when that file has no comments.
|
|
32
33
|
- `trust-policy`: the settings `trustPolicy`, `trustPolicyIgnoreAfter` and `trustPolicyExclude` of `pnpm-workspace.yaml`. The fix makes the file when the repository has none.
|
|
@@ -59,11 +60,13 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
|
|
|
59
60
|
| `main-check` | No script finds out that it is the main module by a compare of `process.argv[1]` with its own path. Through a link (for example `~/git` to `D:/git`), the two paths differ: the script does nothing, and it ends with exit code 0. A script uses `import.meta.main`, or `realpathSync` on each side. | private `main-check` (STRATEGY.md, 2026-11-02). |
|
|
60
61
|
| `tests-required` | No test runner passes when it finds no test: no `passWithNoTests: true` in a config of vitest, vite, jest or Playwright, and no `--passWithNoTests` in `package.json`. With the option, a broken include pattern turns the test gate green with no test run. | private `fail-closed` (STRATEGY.md, 2026-10-30). |
|
|
61
62
|
| `roadmap-parses` | Each call of the Pages workflow of the template (`reusable-pages.yml`) gives a `roadmap`, or `site-pages: false`. Without it, the Status page shows no item of the plan. Each roadmap that a workflow gives to the Status page (a `roadmap:` key) parses as `@mark1russell7/site-pages` reads it. The rule uses the parser of site-pages. Thus a pull request finds a bad row, and the Pages job on `main` does not stop on it. | private `fail-closed` (STRATEGY.md, 2026-10-30). |
|
|
63
|
+
| `workflow-parses` | Each workflow of `.github/workflows` and each file `action.yml` of `.github/actions` parses as YAML, with the parser of the package `yaml`. GitHub refuses a workflow that does not parse, and starts no job. A workflow that starts only on a schedule, a dispatch or `workflow_run` does not start on its pull request. So the rule finds its fault before the merge. The break names the first fault of each file. | layout-contract `memory-probe.yml`, run 42172612147 (2026-11-06). |
|
|
62
64
|
| `runner-budget` | All repositories of the account share 40 runners. Each `strategy` with a `matrix` has a `max-parallel` of 3 or less. Each workflow has a concurrency group at the top or in each job. A job that calls a shared workflow of the option `grouped` gets its group from that workflow, and each job of that workflow has a group. The minute of each `cron` comes from a hash of the repository and the file (1 to 59), so the schedules of the repositories do not start together. The repository comes from `GITHUB_REPOSITORY` or from the remote `origin`. | private `runner-slots` (STRATEGY.md, 2026-10-30). |
|
|
63
65
|
| `main-runs-finish` | A workflow that starts on `push` or on `workflow_call` does not cancel a run in progress. A called workflow gets the event of its caller. A newer push cancels only the run of a pull request: `cancel-in-progress: ${{ github.event_name == 'pull_request' }}`. Each commit of `main` has its own concurrency group: `${{ github.event_name == 'pull_request' && github.ref || github.sha }}`. In one group, GitHub cancels a run that waits when a newer run comes, whatever `cancel-in-progress` says. On 2026-11-03 four waiting CI runs of `main` in client were cancelled, so its version commit had no result and no release. On 2026-11-03 the next merge cancelled the CI run of a commit on `main`, so the main check of that commit had no result. A bench run on `main` was cancelled too, and its claim had no measurement. | private `main-runs-finish` (STRATEGY.md, 2026-11-03). |
|
|
64
66
|
| `push-main-only` | A workflow that starts on `push` and on `pull_request` limits `push` to the default branch with `branches`, and has `workflow_dispatch`. Without the limit, each commit of a pull request starts two runs. A `push` with only a tag filter, a `pull_request` with `types` that do not have `synchronize`, and `pull_request_target` are not breaks. `CI.md` tells each case in "One run for each commit". |
|
|
65
67
|
| `pipe-fails` | A failure on the left of a pipe fails its step. With no `shell` key, GitHub has no `pipefail`, so `tests \| tee out.txt` passes when the tests fail. The fix adds `shell: bash` as the default of the workflow. A step that then turns red had a failure that the pipe hid. |
|
|
66
68
|
| `gate-after-cancel` | A summary job of a gate has the condition `if: ${{ !cancelled() }}`, not `always()`. After a cancel, a job with `always()` asks for a runner, and the new run waits behind it. A job with `!cancelled()` concludes `cancelled` with no runner, and the pull request stays blocked. |
|
|
69
|
+
| `security-one-job` | The security scans run in one job, the check `Security OK`, with the action `security-scan` of the template. The shared workflow `reusable-security.yml` gives three scan jobs, and its caller adds a summary job. Each job asks for its own runner, so in a full queue a run waits for four runners. On 2026-11-06 each scan job of one repository waited 23 to 40 minutes. |
|
|
67
70
|
| `gate-trigger` | No workflow has `paths` or `paths-ignore` on `on.pull_request` or `on.pull_request_target`. The ruleset needs the summary check `<Name> OK` of each gate, and a workflow with a path filter does not start on each pull request. Then its check is not there, the ruleset cannot ask for it, and a pull request can merge before the gate ends. A gate uses the actions `changes` and `gate-summary` of the template (`CI.md`, "A gate with paths"). | private `gate-trigger` (STRATEGY.md, 2026-11-02). |
|
|
68
71
|
| `license-file` | Each public package has a license field, and a license file with the same license in its own folder. A public repository, or a repository with a public package, has a license file at its root. In a GitHub Actions run, the event file tells if the repository is public, and the option `license` (MIT by default) is the license of a root with no public package. npm packs only the license file of the folder of the package, and GitHub reads only the one of the root: on 2026-11-02 five public repositories showed no license on GitHub while npm said MIT. `conventions fix` writes the missing files. | private strategy (2026-11-02). |
|
|
69
72
|
| `home-package` | A change does not add a function with a signature name of another home of the map (for example `median`, `mulberry32` or `writeFileAtomic`). A local copy drifts from the home and splits the fixes. On 2026-11-02 the repositories had 68 local statistics functions in 14 repositories. The rule examines only the lines that the change adds, so the copies that exist do not break. | private direction 18 (STRATEGY.md, 2026-11-02). |
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -182,6 +182,30 @@ export declare function convertGate(text: string, file: string, commit?: string)
|
|
|
182
182
|
reason: string;
|
|
183
183
|
};
|
|
184
184
|
export declare const gateTrigger: Rule;
|
|
185
|
+
/** The first commit of the template with the action `security-scan` (pull request 206). Renovate and the template sync move the pin after the fix. */
|
|
186
|
+
export declare const SECURITY_SCAN_COMMIT: string;
|
|
187
|
+
/** The inputs of the action `security-scan`. The shared workflow has the same inputs and also `timeout-minutes`. */
|
|
188
|
+
export declare const SECURITY_SCAN_INPUTS: readonly string[];
|
|
189
|
+
/** The time limit of the job when the caller gives none: the default of `timeout-minutes` of the shared workflow. */
|
|
190
|
+
export declare const SECURITY_TIMEOUT_MINUTES = 30;
|
|
191
|
+
/** A job of the shared workflow in a workflow file: the line of its key (from 0), and its id. */
|
|
192
|
+
interface SecurityCaller {
|
|
193
|
+
readonly line: number;
|
|
194
|
+
readonly id: string;
|
|
195
|
+
}
|
|
196
|
+
/** This function gives the jobs of a workflow that use the shared workflow `reusable-security.yml`. */
|
|
197
|
+
export declare function securityCallers(text: string): SecurityCaller[];
|
|
198
|
+
/**
|
|
199
|
+
* This function puts one job in place of the job of the shared workflow and its summary job. If it cannot, it gives the
|
|
200
|
+
* reason that a person must change the file. The new job keeps the id of the summary job and the name `Security OK`, which the ruleset
|
|
201
|
+
* needs. It gives the inputs of the caller to the action, and `timeout-minutes` to the job.
|
|
202
|
+
*/
|
|
203
|
+
export declare function withOneJob(text: string, commit?: string): {
|
|
204
|
+
text: string;
|
|
205
|
+
} | {
|
|
206
|
+
reason: string;
|
|
207
|
+
};
|
|
208
|
+
export declare const securityOneJob: Rule;
|
|
185
209
|
/** The state of a home: on npm, in a repository but not on npm, only on a roadmap, or with no package. */
|
|
186
210
|
type HomeState = "published" | "unpublished" | "planned" | "none";
|
|
187
211
|
/** One area of code and its home. */
|
|
@@ -382,6 +406,17 @@ export declare const TRAIN_SCOPES: readonly ["@mark1russell7/*", "@procedures/*"
|
|
|
382
406
|
/** 7 days, in minutes. */
|
|
383
407
|
export declare const IGNORE_AFTER = 10080;
|
|
384
408
|
export declare const trustPolicy: Rule;
|
|
409
|
+
/** A file that GitHub reads as YAML: a workflow, or the file `action.yml` of an action of the repository. */
|
|
410
|
+
export declare const GITHUB_YAML: RegExp;
|
|
411
|
+
/** A fault of the YAML of a file: its line and column (from 1), and the first line of the message of the parser. */
|
|
412
|
+
interface YamlFault {
|
|
413
|
+
readonly line: number;
|
|
414
|
+
readonly column: number;
|
|
415
|
+
readonly message: string;
|
|
416
|
+
}
|
|
417
|
+
/** This function gives the faults of a YAML text. A text with no fault gives an empty list. */
|
|
418
|
+
export declare function yamlFaults(text: string): YamlFault[];
|
|
419
|
+
export declare const workflowParses: Rule;
|
|
385
420
|
export declare const workspaceProtocol: Rule;
|
|
386
421
|
/** Each rule of the check. */
|
|
387
422
|
export declare const RULES: readonly Rule[];
|
|
@@ -547,5 +582,5 @@ export declare function workspaceGlobs(root: string): string[] | undefined;
|
|
|
547
582
|
* The result has absolute paths, in the order of the code units.
|
|
548
583
|
*/
|
|
549
584
|
export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
|
|
550
|
-
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeAnswer, HomeFetch, HomeState, Manifest, Minor, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult, Workflow, WorkflowInput, WorkflowJob, WorkflowStep };
|
|
585
|
+
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeAnswer, HomeFetch, HomeState, Manifest, Minor, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult, SecurityCaller, Workflow, WorkflowInput, WorkflowJob, WorkflowStep, YamlFault };
|
|
551
586
|
//# 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-after-cancel.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.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/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/release-text.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;;;;;WAKjC;EACT,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;;UC1M9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA4FA,WAAW;qBC5CX,iBAAiB;;UCzCb;WACN;WACA;WACA;;;wBAIK,cAAc,eAAe;;qBAoBhC;;wBAyBG,YAAY;;;;;;;wBAkBZ,YAAY,cAAc,cAAc;EAAoC;;EAAmB;;qBAwIlG,aAAa;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.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/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/release-text.ts","../src/workspace.ts"],"mappings":"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"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as repositoryOfRemote, $t as keyLine, A as blockHash, At as mergeHomes, B as publishedMinorRule, Bt as convertGate, C as testsRequired, Ct as repoOf, D as pathsOf, Dt as findHomes, E as isSourcePath, Et as MAP_RULE, F as requiredScripts, Ft as SECURITY_TIMEOUT_MINUTES, G as npmLookup, Gt as readWorkflow, H as NPM_REGISTRY, Ht as prPathFilters, I as releaseFiles, It as securityCallers, J as pipeFails, Jt as DEPENDENCY_FIELDS, K as unreleasedChange, Kt as STRICT_OPTIONS, L as lockedVersions, Lt as securityOneJob, M as sharedDocsRule, Mt as HOME_EXPORTS, N as roadmapOfLine, Nt as SECURITY_SCAN_COMMIT, O as sourceMain, Ot as mapMarkdown, P as roadmapParses, Pt as SECURITY_SCAN_INPUTS, Q as pagesAfterRelease, Qt as inFolder, R as minorOf, Rt as withOneJob, S as typedFiles, St as messageOf, T as tsconfigTest, Tt as HOMES, U as SHIPPED_FIELDS, Ut as summaryName, V as reachOf, Vt as gateTrigger, W as UNSHIPPED_FILES, Wt as gateAfterCancel, X as isPinned, Xt as codePackages, Y as isGitSpecifier, Yt as cleanPath, Z as pinnedGitDeps, Zt as hasFile, _ as TRAIN_SCOPES, _t as licenseFileOf, a as listRules, an as runGit, at as pagesSite, b as configsOfScript, bt as declaredName, c as runCli, cn as globToRegExp, ct as HOME_PATTERNS, d as RULES, dn as defaultOptions, dt as REAL_COMPARE, en as lineOf, et as runnerBudget, f as workspaceProtocol, fn as parseConfig, ft as hasImportMetaMain, g as IGNORE_AFTER, gt as licenseFile, h as yamlFaults, ht as authorOf, i as formatResult, in as replaceLine, it as pagesCalls, j as githubFetch, jt as readOverlay, k as HOME_TIMEOUT_MS, kt as mapText, l as runFix, ln as packageFolders, lt as noLocalPaths, m as workflowParses, mt as LICENSE_TEXTS, n as annotations, nn as parseJsonc, nt as pushMainOnly, o as readConfig, on as specifiersOf, ot as apiReportScript, p as GITHUB_YAML, pt as mainCheck, q as unreleasedChangeRule, qt as cuePreset, r as createContext, rn as readJsonc, rt as PAGES_WORKFLOWS, s as runChecks, sn as globFolders, st as DEFAULT_ALLOWED, t as USAGE, tn as matchesAny, tt as scheduleMinute, u as summaryMarkdown, un as workspaceGlobs, ut as noBuildOutput, v as trustPolicy, vt as mitText, w as hasTests, wt as signaturesOf, x as scriptsOf, xt as homePackage, y as typedScripts, yt as repositoryIsPublic, z as publishedMinor, zt as ACTIONS_COMMIT } from "./run-Do3z3eKR.js";
|
|
2
2
|
// src/release-text.ts
|
|
3
3
|
/**
|
|
4
4
|
* The rule for the git tag and the text of a GitHub release of a package version.
|
|
@@ -64,6 +64,6 @@ function releaseNotes(name, version, changelog) {
|
|
|
64
64
|
if (section.length <= 1e5) return section;
|
|
65
65
|
return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
|
|
66
66
|
}
|
|
67
|
-
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NPM_REGISTRY, PAGES_WORKFLOWS, REAL_COMPARE, RULES, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, workspaceGlobs, workspaceProtocol };
|
|
67
|
+
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NPM_REGISTRY, PAGES_WORKFLOWS, REAL_COMPARE, RULES, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
|
|
68
68
|
|
|
69
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,6 +3,7 @@ import { spawnSync } from "node:child_process";
|
|
|
3
3
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, extname, join, posix, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
+
import { parseAllDocuments } from "yaml";
|
|
6
7
|
// src/config.ts
|
|
7
8
|
/** The fields of the configuration of a rule that are not options. */
|
|
8
9
|
const RULE_FIELDS = [
|
|
@@ -2017,6 +2018,194 @@ const gateTrigger = {
|
|
|
2017
2018
|
return breaks;
|
|
2018
2019
|
}
|
|
2019
2020
|
};
|
|
2021
|
+
// src/rules/security-one-job.ts
|
|
2022
|
+
/**
|
|
2023
|
+
* The rule `security-one-job`: the security scans of a repository run in one job, with the action `security-scan` of the
|
|
2024
|
+
* template. The deprecated shared workflow `reusable-security.yml` gives three scan jobs, and the caller adds the summary
|
|
2025
|
+
* job `Security OK`. Each job asks for its own runner, so a run waits in the queue for four runners in place of one.
|
|
2026
|
+
*/
|
|
2027
|
+
/** The first commit of the template with the action `security-scan` (pull request 206). Renovate and the template sync move the pin after the fix. */
|
|
2028
|
+
const SECURITY_SCAN_COMMIT = "8a01259f04dce1d6a2fa351b758c6d283e9f7fc9";
|
|
2029
|
+
/** The inputs of the action `security-scan`. The shared workflow has the same inputs and also `timeout-minutes`. */
|
|
2030
|
+
const SECURITY_SCAN_INPUTS = [
|
|
2031
|
+
"fail-on-severity",
|
|
2032
|
+
"dependency-review",
|
|
2033
|
+
"dependency-review-scopes",
|
|
2034
|
+
"osv",
|
|
2035
|
+
"osv-lockfile",
|
|
2036
|
+
"codeql",
|
|
2037
|
+
"codeql-languages",
|
|
2038
|
+
"codeql-build-mode"
|
|
2039
|
+
];
|
|
2040
|
+
/** The time limit of the job when the caller gives none: the default of `timeout-minutes` of the shared workflow. */
|
|
2041
|
+
const SECURITY_TIMEOUT_MINUTES = 30;
|
|
2042
|
+
const REUSABLE = /(^|\/)\.github\/workflows\/reusable-security\.ya?ml(@|$)/;
|
|
2043
|
+
/** The keys that a job of the shared workflow can have, and that the fix can replace. */
|
|
2044
|
+
const CALLER_KEYS = /* @__PURE__ */ new Set([
|
|
2045
|
+
"uses",
|
|
2046
|
+
"permissions",
|
|
2047
|
+
"with",
|
|
2048
|
+
"name"
|
|
2049
|
+
]);
|
|
2050
|
+
/** This function gives the lines from `start` to the last line of the block that is not empty. */
|
|
2051
|
+
function trimmedEnd(lines, start) {
|
|
2052
|
+
let end = blockEnd(lines, start);
|
|
2053
|
+
while (end > start + 1 && (lines[end - 1] ?? "").trim() === "") end -= 1;
|
|
2054
|
+
return end;
|
|
2055
|
+
}
|
|
2056
|
+
/** This function gives the id of the job of the line `at`. */
|
|
2057
|
+
const idOf = (line) => {
|
|
2058
|
+
const text = line.trim();
|
|
2059
|
+
const colon = text.indexOf(":");
|
|
2060
|
+
return (colon < 0 ? text : text.slice(0, colon)).replace(/^["']|["']$/g, "");
|
|
2061
|
+
};
|
|
2062
|
+
/** This function gives the jobs of a workflow that use the shared workflow `reusable-security.yml`. */
|
|
2063
|
+
function securityCallers(text) {
|
|
2064
|
+
const lines = workflowLines(text);
|
|
2065
|
+
const jobs = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "jobs") !== void 0);
|
|
2066
|
+
if (jobs < 0) return [];
|
|
2067
|
+
const found = [];
|
|
2068
|
+
for (const job of childKeys(lines, jobs)) {
|
|
2069
|
+
const uses = childKeys(lines, job).map((at) => keyValue(lines[at] ?? "", "uses")).find((value) => value !== void 0);
|
|
2070
|
+
if (uses !== void 0 && REUSABLE.test(uses)) found.push({
|
|
2071
|
+
line: job,
|
|
2072
|
+
id: idOf(lines[job] ?? "")
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
return found;
|
|
2076
|
+
}
|
|
2077
|
+
/** This function gives the ids of the jobs in `needs` of the job of the line `job`. */
|
|
2078
|
+
function needsOf(lines, job) {
|
|
2079
|
+
for (const at of childKeys(lines, job)) {
|
|
2080
|
+
const value = keyValue(lines[at] ?? "", "needs");
|
|
2081
|
+
if (value === void 0) continue;
|
|
2082
|
+
if (value !== "" && !value.startsWith("[")) return [value];
|
|
2083
|
+
return listItems(lines, at, value)?.items ?? [];
|
|
2084
|
+
}
|
|
2085
|
+
return [];
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* This function puts one job in place of the job of the shared workflow and its summary job. If it cannot, it gives the
|
|
2089
|
+
* reason that a person must change the file. The new job keeps the id of the summary job and the name `Security OK`, which the ruleset
|
|
2090
|
+
* needs. It gives the inputs of the caller to the action, and `timeout-minutes` to the job.
|
|
2091
|
+
*/
|
|
2092
|
+
function withOneJob(text, commit = SECURITY_SCAN_COMMIT) {
|
|
2093
|
+
const lines = workflowLines(text);
|
|
2094
|
+
const callers = securityCallers(text);
|
|
2095
|
+
if (callers.length !== 1) return { reason: `the file has ${String(callers.length)} jobs that use reusable-security.yml, and the fix changes only one` };
|
|
2096
|
+
const caller = callers[0];
|
|
2097
|
+
if (caller === void 0) return { reason: "no job uses reusable-security.yml" };
|
|
2098
|
+
const dependents = childKeys(lines, lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "jobs") !== void 0)).filter((job) => needsOf(lines, job).includes(caller.id));
|
|
2099
|
+
if (dependents.length !== 1) return { reason: `${String(dependents.length)} jobs need the job ${caller.id}, and the fix needs exactly one summary job` };
|
|
2100
|
+
const summary = dependents[0];
|
|
2101
|
+
if (summary === void 0) return { reason: "no summary job" };
|
|
2102
|
+
const summaryNeeds = needsOf(lines, summary);
|
|
2103
|
+
if (summaryNeeds.length !== 1) return { reason: `the summary job needs ${summaryNeeds.join(", ")}, and the fix replaces only a summary job of the scans` };
|
|
2104
|
+
const summaryName = childKeys(lines, summary).map((at) => keyValue(lines[at] ?? "", "name")).find((value) => value !== void 0);
|
|
2105
|
+
if (summaryName !== "Security OK") return { reason: `the summary job has the name ${summaryName ?? "(none)"}, not Security OK, which the ruleset needs` };
|
|
2106
|
+
const inputs = [];
|
|
2107
|
+
let timeout = String(30);
|
|
2108
|
+
for (const at of childKeys(lines, caller.line)) {
|
|
2109
|
+
const key = idOf(lines[at] ?? "");
|
|
2110
|
+
if (!CALLER_KEYS.has(key)) return { reason: `the job ${caller.id} has the key ${key}, and the fix cannot keep it` };
|
|
2111
|
+
if (key !== "with") continue;
|
|
2112
|
+
for (const input of childKeys(lines, at)) {
|
|
2113
|
+
const name = idOf(lines[input] ?? "");
|
|
2114
|
+
const value = keyValue(lines[input] ?? "", name) ?? "";
|
|
2115
|
+
if (value === "" || value.startsWith("|") || value.startsWith(">") || trimmedEnd(lines, input) > input + 1) return { reason: `the input ${name} has a value of more than one line` };
|
|
2116
|
+
if (name === "timeout-minutes") timeout = value;
|
|
2117
|
+
else if (SECURITY_SCAN_INPUTS.includes(name)) inputs.push(name);
|
|
2118
|
+
else return { reason: `the action security-scan has no input ${name}` };
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
const raw = text.split(/\r?\n/);
|
|
2122
|
+
const pad = " ".repeat(indentOf$1(raw[caller.line] ?? ""));
|
|
2123
|
+
const withLines = childKeys(lines, caller.line).find((at) => idOf(lines[at] ?? "") === "with");
|
|
2124
|
+
const inputLines = withLines === void 0 ? [] : childKeys(lines, withLines).filter((at) => inputs.includes(idOf(lines[at] ?? ""))).map((at) => `${pad} ${(raw[at] ?? "").trim()}`);
|
|
2125
|
+
const job = [
|
|
2126
|
+
`${pad}${idOf(lines[summary] ?? "")}:`,
|
|
2127
|
+
`${pad} name: Security OK`,
|
|
2128
|
+
`${pad} runs-on: ubuntu-latest`,
|
|
2129
|
+
`${pad} timeout-minutes: ${timeout}`,
|
|
2130
|
+
`${pad} permissions:`,
|
|
2131
|
+
`${pad} contents: read`,
|
|
2132
|
+
`${pad} security-events: write`,
|
|
2133
|
+
`${pad} actions: read`,
|
|
2134
|
+
`${pad} steps:`,
|
|
2135
|
+
`${pad} - uses: mark1russell7/template/.github/actions/security-scan@${commit} # main`,
|
|
2136
|
+
...inputLines.length > 0 ? [`${pad} with:`, ...inputLines] : []
|
|
2137
|
+
];
|
|
2138
|
+
const splices = [{
|
|
2139
|
+
at: caller.line,
|
|
2140
|
+
remove: trimmedEnd(lines, caller.line) - caller.line,
|
|
2141
|
+
insert: job
|
|
2142
|
+
}];
|
|
2143
|
+
const blank = (at) => at >= 0 && at < raw.length - 1 && (raw[at] ?? "").trim() === "";
|
|
2144
|
+
const start = blank(summary - 1) ? summary - 1 : summary;
|
|
2145
|
+
const end = trimmedEnd(lines, summary) + (start === summary && blank(trimmedEnd(lines, summary)) ? 1 : 0);
|
|
2146
|
+
splices.push({
|
|
2147
|
+
at: start,
|
|
2148
|
+
remove: end - start,
|
|
2149
|
+
insert: []
|
|
2150
|
+
});
|
|
2151
|
+
return { text: applySplices(text, splices) };
|
|
2152
|
+
}
|
|
2153
|
+
const securityOneJob = {
|
|
2154
|
+
id: "security-one-job",
|
|
2155
|
+
title: "The security scans run in one job: the action `security-scan`, not the shared workflow `reusable-security.yml`.",
|
|
2156
|
+
reason: "Each job of a run asks for its own runner. reusable-security.yml gives three scan jobs, and the caller adds the summary job Security OK, so each run waits in the queue for four runners, and the summary job waits again after the scans. On 2026-11-06, in a full queue, the scan jobs of systems waited 23 to 40 minutes each. The action security-scan runs the same scans with the same inputs in one job, which is the check Security OK.",
|
|
2157
|
+
fix: "Replace the job that uses reusable-security.yml and its summary job with one job Security OK that runs the action security-scan (CI.md, Security). Give the inputs to the action, and timeout-minutes to the job.",
|
|
2158
|
+
sources: [
|
|
2159
|
+
{
|
|
2160
|
+
repo: "template",
|
|
2161
|
+
rule: "security",
|
|
2162
|
+
doc: "pull request 206 (2026-11-05): the action security-scan, and reusable-security.yml deprecated"
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
repo: "template",
|
|
2166
|
+
rule: "ci",
|
|
2167
|
+
doc: "CI.md, Security: the job of a caller of security-scan, and the change from the old workflow"
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
repo: "optional",
|
|
2171
|
+
rule: "security",
|
|
2172
|
+
doc: ".github/workflows/security.yml (2026-11-06): the job security of reusable-security.yml and the summary job Security OK, the form that the fix changes"
|
|
2173
|
+
},
|
|
2174
|
+
{
|
|
2175
|
+
repo: "systems",
|
|
2176
|
+
rule: "ci",
|
|
2177
|
+
doc: "Security runs 42159170199 to 42172625422 (2026-11-06): three scan jobs, each waited 5.7 to 40.7 minutes for a runner"
|
|
2178
|
+
}
|
|
2179
|
+
],
|
|
2180
|
+
options: {},
|
|
2181
|
+
check(context) {
|
|
2182
|
+
const files = context.gitFiles();
|
|
2183
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
2184
|
+
const breaks = [];
|
|
2185
|
+
for (const file of files.filter((path) => WORKFLOW$1.test(path)).sort(byCode)) {
|
|
2186
|
+
let text;
|
|
2187
|
+
try {
|
|
2188
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
2189
|
+
} catch {
|
|
2190
|
+
continue;
|
|
2191
|
+
}
|
|
2192
|
+
const callers = securityCallers(text);
|
|
2193
|
+
if (callers.length === 0) continue;
|
|
2194
|
+
const after = withOneJob(text);
|
|
2195
|
+
for (const caller of callers) breaks.push({
|
|
2196
|
+
file,
|
|
2197
|
+
line: caller.line + 1,
|
|
2198
|
+
message: `The job ${caller.id} of ${file} uses reusable-security.yml: its scans ask for three runners and its summary job for a fourth.`,
|
|
2199
|
+
..."text" in after ? { edits: [{
|
|
2200
|
+
file,
|
|
2201
|
+
before: text,
|
|
2202
|
+
after: after.text
|
|
2203
|
+
}] } : { fix: `A person must change it, because ${after.reason}. ${securityOneJob.fix}` }
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
return breaks;
|
|
2207
|
+
}
|
|
2208
|
+
};
|
|
2020
2209
|
// src/change.ts
|
|
2021
2210
|
/**
|
|
2022
2211
|
* The change that a check examines: the option `--base`, the merge commit of a pull request, or a push to the default
|
|
@@ -8058,7 +8247,7 @@ const HOMES = [
|
|
|
8058
8247
|
{
|
|
8059
8248
|
area: "optional",
|
|
8060
8249
|
title: "Optional values",
|
|
8061
|
-
covers: "a value that is present or absent, with the functor and monad laws",
|
|
8250
|
+
covers: "a value that is present or absent, and Result, a value or an error (1.2.0), with the functor and monad laws",
|
|
8062
8251
|
packages: ["@mark1russell7/optional"],
|
|
8063
8252
|
repo: "mark1russell7/optional",
|
|
8064
8253
|
state: "published",
|
|
@@ -8068,7 +8257,10 @@ const HOMES = [
|
|
|
8068
8257
|
"some",
|
|
8069
8258
|
"none",
|
|
8070
8259
|
"monad",
|
|
8071
|
-
"functor"
|
|
8260
|
+
"functor",
|
|
8261
|
+
"result",
|
|
8262
|
+
"either",
|
|
8263
|
+
"error"
|
|
8072
8264
|
],
|
|
8073
8265
|
note: "@mark1russell7/render-optional is a second copy. It moves to @mark1russell7/optional."
|
|
8074
8266
|
},
|
|
@@ -12360,6 +12552,71 @@ const trustPolicy = {
|
|
|
12360
12552
|
return breaks;
|
|
12361
12553
|
}
|
|
12362
12554
|
};
|
|
12555
|
+
// src/rules/workflow-parses.ts
|
|
12556
|
+
/**
|
|
12557
|
+
* The rule `workflow-parses`: each workflow file and each action file of `.github` parses as YAML.
|
|
12558
|
+
*/
|
|
12559
|
+
/** A file that GitHub reads as YAML: a workflow, or the file `action.yml` of an action of the repository. */
|
|
12560
|
+
const GITHUB_YAML = /^\.github\/(?:workflows\/[^/]+|actions\/(?:[^/]+\/)*action)\.ya?ml$/;
|
|
12561
|
+
/** This function gives the faults of a YAML text. A text with no fault gives an empty list. */
|
|
12562
|
+
function yamlFaults(text) {
|
|
12563
|
+
const faults = [];
|
|
12564
|
+
for (const document of parseAllDocuments(text, { prettyErrors: true })) for (const error of document.errors) {
|
|
12565
|
+
const at = error.linePos?.[0];
|
|
12566
|
+
faults.push({
|
|
12567
|
+
line: at?.line ?? 1,
|
|
12568
|
+
column: at?.col ?? 1,
|
|
12569
|
+
message: (error.message.split("\n")[0] ?? error.code).replace(/:$/, "")
|
|
12570
|
+
});
|
|
12571
|
+
}
|
|
12572
|
+
return faults;
|
|
12573
|
+
}
|
|
12574
|
+
const workflowParses = {
|
|
12575
|
+
id: "workflow-parses",
|
|
12576
|
+
title: "Each workflow file and each file `action.yml` of `.github` parses as YAML.",
|
|
12577
|
+
reason: "GitHub refuses a workflow that does not parse, and starts no job. A workflow that starts only on a schedule, a dispatch or `workflow_run` does not start on its pull request, so no check finds the fault before the merge. On 2026-11-06 a line at column 1 ended a block `run: |`, and main went red.",
|
|
12578
|
+
fix: "Correct the YAML at the line of the break. A line of a block scalar (`run: |`) has the indent of the block, also a line of a string with quotes: write `\\n` in place of a real line break.",
|
|
12579
|
+
sources: [
|
|
12580
|
+
{
|
|
12581
|
+
repo: "layout-contract",
|
|
12582
|
+
rule: "memory-probe",
|
|
12583
|
+
doc: "run 42172612147 (2026-11-06): GitHub refused memory-probe.yml, and the run had no jobs"
|
|
12584
|
+
},
|
|
12585
|
+
{
|
|
12586
|
+
repo: "highways",
|
|
12587
|
+
rule: "predicate-dump",
|
|
12588
|
+
doc: "predicate-dump.yml starts only on a schedule and a dispatch, and the monthly census of algebra reads its dumps"
|
|
12589
|
+
},
|
|
12590
|
+
{
|
|
12591
|
+
repo: "algebra",
|
|
12592
|
+
rule: "study-monthly",
|
|
12593
|
+
doc: "study-monthly.yml starts only on a schedule and a dispatch, and refreshes the data of the site"
|
|
12594
|
+
}
|
|
12595
|
+
],
|
|
12596
|
+
options: {},
|
|
12597
|
+
check(context) {
|
|
12598
|
+
const files = context.gitFiles();
|
|
12599
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
12600
|
+
const breaks = [];
|
|
12601
|
+
for (const file of files.filter((path) => GITHUB_YAML.test(path)).sort(byCode)) {
|
|
12602
|
+
let text;
|
|
12603
|
+
try {
|
|
12604
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
12605
|
+
} catch {
|
|
12606
|
+
continue;
|
|
12607
|
+
}
|
|
12608
|
+
const [first, ...more] = yamlFaults(text);
|
|
12609
|
+
if (first === void 0) continue;
|
|
12610
|
+
const others = more.length === 0 ? "" : ` The parser finds ${more.length} more ${more.length === 1 ? "fault" : "faults"} after it.`;
|
|
12611
|
+
breaks.push({
|
|
12612
|
+
file,
|
|
12613
|
+
line: first.line,
|
|
12614
|
+
message: `${file} does not parse as YAML, so GitHub starts no job of it: ${first.message}.${others}`
|
|
12615
|
+
});
|
|
12616
|
+
}
|
|
12617
|
+
return breaks;
|
|
12618
|
+
}
|
|
12619
|
+
};
|
|
12363
12620
|
// src/rules/workspace-protocol.ts
|
|
12364
12621
|
/**
|
|
12365
12622
|
* The rule `workspace-protocol`: a package uses another package of the workspace through `workspace:`.
|
|
@@ -12446,12 +12703,14 @@ const RULES = [
|
|
|
12446
12703
|
mainCheck,
|
|
12447
12704
|
testsRequired,
|
|
12448
12705
|
roadmapParses,
|
|
12706
|
+
workflowParses,
|
|
12449
12707
|
runnerBudget,
|
|
12450
12708
|
mainRunsFinish,
|
|
12451
12709
|
pushMainOnly,
|
|
12452
12710
|
pipeFails,
|
|
12453
12711
|
gateAfterCancel,
|
|
12454
12712
|
gateTrigger,
|
|
12713
|
+
securityOneJob,
|
|
12455
12714
|
homePackage,
|
|
12456
12715
|
licenseFile,
|
|
12457
12716
|
pagesSite,
|
|
@@ -12888,6 +13147,6 @@ function runMap(args, io) {
|
|
|
12888
13147
|
else io.stdout(mapText(found));
|
|
12889
13148
|
return 0;
|
|
12890
13149
|
}
|
|
12891
|
-
export {
|
|
13150
|
+
export { repositoryOfRemote as $, keyLine as $t, blockHash as A, mergeHomes as At, publishedMinorRule as B, convertGate as Bt, testsRequired as C, repoOf as Ct, pathsOf as D, findHomes as Dt, isSourcePath as E, MAP_RULE as Et, requiredScripts as F, SECURITY_TIMEOUT_MINUTES as Ft, npmLookup as G, readWorkflow as Gt, NPM_REGISTRY as H, prPathFilters as Ht, releaseFiles as I, securityCallers as It, pipeFails as J, DEPENDENCY_FIELDS as Jt, unreleasedChange as K, STRICT_OPTIONS as Kt, lockedVersions as L, securityOneJob as Lt, sharedDocsRule as M, HOME_EXPORTS as Mt, roadmapOfLine as N, SECURITY_SCAN_COMMIT as Nt, sourceMain as O, mapMarkdown as Ot, roadmapParses as P, SECURITY_SCAN_INPUTS as Pt, pagesAfterRelease as Q, inFolder as Qt, minorOf as R, withOneJob as Rt, typedFiles as S, messageOf as St, tsconfigTest as T, HOMES as Tt, SHIPPED_FIELDS as U, summaryName as Ut, reachOf as V, gateTrigger as Vt, UNSHIPPED_FILES as W, gateAfterCancel as Wt, isPinned as X, codePackages as Xt, isGitSpecifier as Y, cleanPath as Yt, pinnedGitDeps as Z, hasFile as Zt, TRAIN_SCOPES as _, licenseFileOf as _t, listRules as a, runGit as an, pagesSite as at, configsOfScript as b, declaredName as bt, runCli as c, globToRegExp as cn, HOME_PATTERNS as ct, RULES as d, defaultOptions as dn, REAL_COMPARE as dt, lineOf as en, runnerBudget as et, workspaceProtocol as f, parseConfig as fn, hasImportMetaMain as ft, IGNORE_AFTER as g, licenseFile as gt, yamlFaults as h, authorOf as ht, formatResult as i, replaceLine as in, pagesCalls as it, githubFetch as j, readOverlay as jt, HOME_TIMEOUT_MS as k, mapText as kt, runFix as l, packageFolders as ln, noLocalPaths as lt, workflowParses as m, LICENSE_TEXTS as mt, annotations as n, parseJsonc as nn, pushMainOnly as nt, readConfig as o, specifiersOf as on, apiReportScript as ot, GITHUB_YAML as p, mainCheck as pt, unreleasedChangeRule as q, cuePreset as qt, createContext as r, readJsonc as rn, PAGES_WORKFLOWS as rt, runChecks as s, globFolders as sn, DEFAULT_ALLOWED as st, USAGE as t, matchesAny as tn, scheduleMinute as tt, summaryMarkdown as u, workspaceGlobs as un, noBuildOutput as ut, trustPolicy as v, mitText as vt, hasTests as w, signaturesOf as wt, scriptsOf as x, homePackage as xt, typedScripts as y, repositoryIsPublic as yt, publishedMinor as z, ACTIONS_COMMIT as zt };
|
|
12892
13151
|
|
|
12893
|
-
//# sourceMappingURL=run
|
|
13152
|
+
//# sourceMappingURL=run-Do3z3eKR.js.map
|