@mark1russell7/conventions 0.37.3 → 0.38.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 +3 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +3 -25
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/{run-TEikR3Yb.js → run-DrVkbk7l.js} +80 -136
- package/build/run-DrVkbk7l.js.map +1 -0
- package/build/workspace-BMtl0EQf.d.ts +33 -0
- package/build/workspace-BMtl0EQf.d.ts.map +1 -0
- package/build/workspace-Cx7p7bWn.js +156 -0
- package/build/workspace-Cx7p7bWn.js.map +1 -0
- package/build/workspace.d.ts +2 -0
- package/build/workspace.js +1 -0
- package/package.json +13 -9
- package/build/run-TEikR3Yb.js.map +0 -1
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
|
|
|
70
70
|
| `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. |
|
|
71
71
|
| `service-run-main` | In a server package, only the entry `src/main.ts` starts the service with `run()`. A server package has a dependency on `@mark1russell7/service` and a file `src/main.ts`, as the preset `service` writes it. A source file that imports the service package and starts `run()` is a break. `run()` owns the process, so a module that starts it cannot be imported by a test. |
|
|
72
72
|
| `shared-ci` | The workflow `ci.yml` calls the shared workflow `reusable-ci.yml` of the template, and no workflow or action of the repository has the name of a shared one of the template. A `ci.yml` with its own steps, or a local copy, does not get the fixes and the new checks of the template. The template itself is not examined (option `home`). On 2026-11-07, 3 of 19 repositories of the account ran CI steps of their own. |
|
|
73
|
+
| `setup-cue` | No workflow or action installs the cue CLI with its own command (a download of a release asset of `cue-lang/cue`, or `go install`). A caller of `reusable-ci.yml` gives the input `cue-version`. Another job uses the action `setup-cue` of the template. The action installs the CLI from a cache, or with retries and a sha256 check. On 2026-11-08, a 504 of GitHub failed each bare `curl` of the CLI. |
|
|
73
74
|
| `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). |
|
|
74
75
|
| `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). |
|
|
75
76
|
| `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). |
|
|
@@ -254,6 +255,8 @@ The package also exports the functions of the tool:
|
|
|
254
255
|
- `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.
|
|
255
256
|
- `tagName(name, version, packageCount)` gives the git tag of a version. `releaseNotes(name, version, changelog)` gives the text of its GitHub release, with `changelogSection`, `npmUrl` and `MAX_NOTES`. The script `scripts/release/tags.ts` keeps the same rule, and a test compares the two.
|
|
256
257
|
- `RULES` and each rule, with the helpers `isGitSpecifier`, `isPinned`, `isSourcePath` and `parseJsonc`.
|
|
258
|
+
- `packageFolders(root, globs)`, `globFolders(root, glob)`, `globToRegExp(glob)` and `workspaceGlobs(root)` find the package folders of a repository.
|
|
259
|
+
- The subpath `@mark1russell7/conventions/workspace` gives these four functions and `reportFolders(root, globs)`, and no other code. `reportFolders` adds a public root that the globs leave out. `@mark1russell7/api-report` imports them from this subpath.
|
|
257
260
|
- `privateTextBreaks(name, text, privates, options)` gives the breaks of one text. The rule `no-local-paths` and the command `pre-push` use it. `privates` has the list (`names`) and the patterns (`patterns`).
|
|
258
261
|
- `parsePrivateNames(text)` parses and checks a private name list. It throws a `PrivateNameListError` with a reason that shows no value of the list.
|
|
259
262
|
- `lineNameHit(list, line, place)`, `pathNameHit(list, path)`, `firstNameMatch(line, names)`, `isCommonUse(line, index, rule)` and `isAllowedHit(allow, repo, path, id)` find the names of the list. They have no input or output.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as workspaceGlobs, n as globToRegExp, r as packageFolders, t as globFolders } from "./workspace-BMtl0EQf.js";
|
|
1
2
|
/** 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
3
|
interface AuditSource {
|
|
3
4
|
readonly repo: string;
|
|
@@ -211,6 +212,7 @@ export declare function withOneJob(text: string, commit?: string): {
|
|
|
211
212
|
reason: string;
|
|
212
213
|
};
|
|
213
214
|
export declare const securityOneJob: Rule;
|
|
215
|
+
export declare const setupCue: Rule;
|
|
214
216
|
/** The shared workflows of the template, by file name. */
|
|
215
217
|
export declare const SHARED_WORKFLOWS: readonly string[];
|
|
216
218
|
/** The shared actions of the template, by folder name under `.github/actions`. */
|
|
@@ -807,29 +809,5 @@ export declare function npmUrl(name: string, version: string): string;
|
|
|
807
809
|
* link to npm. The Releases page of `site-pages` reads each list item as a change.
|
|
808
810
|
*/
|
|
809
811
|
export declare function releaseNotes(name: string, version: string, changelog: string | undefined): string;
|
|
810
|
-
|
|
811
|
-
* This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path
|
|
812
|
-
* segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of
|
|
813
|
-
* its parts. The function escapes each other special character.
|
|
814
|
-
*/
|
|
815
|
-
export declare function globToRegExp(glob: string): RegExp;
|
|
816
|
-
/**
|
|
817
|
-
* This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,
|
|
818
|
-
* in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.
|
|
819
|
-
*/
|
|
820
|
-
export declare function globFolders(root: string, glob: string): string[];
|
|
821
|
-
/**
|
|
822
|
-
* This function gives the globs of the workspace at `root`: the `packages` list of
|
|
823
|
-
* `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when
|
|
824
|
-
* the repository has no workspace.
|
|
825
|
-
*/
|
|
826
|
-
export declare function workspaceGlobs(root: string): string[] | undefined;
|
|
827
|
-
/**
|
|
828
|
-
* This function gives the package folders of the repository at `root`: the folders of the globs
|
|
829
|
-
* that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the
|
|
830
|
-
* function reads the globs of the workspace, and a repository with no workspace is one package.
|
|
831
|
-
* The result has absolute paths, in the order of the code units.
|
|
832
|
-
*/
|
|
833
|
-
export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
|
|
834
|
-
export type { AllowedHit, AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeAnswer, HomeFetch, HomeState, HookOptions, LinePlace, Manifest, Minor, NameHit, NameRule, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, PrePushOptions, PrivateNameList, PrivatePattern, PrivateSources, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult, SecurityCaller, TextBreakOptions, Workflow, WorkflowInput, WorkflowJob, WorkflowStep, YamlFault };
|
|
812
|
+
export { type AllowedHit, type AuditSource, type Break, type CheckOptions, type CheckResult, type CliIo, type ConventionsConfig, type Edit, type FixResult, type Home, type HomeAnswer, type HomeFetch, type HomeState, type HookOptions, type LinePlace, type Manifest, type Minor, type NameHit, type NameRule, type OptionSpec, type OptionValue, type Options, type PackageInfo, type PagesCall, type PathFilter, type PrePushOptions, type PrivateNameList, type PrivatePattern, type PrivateSources, type RegistryAnswer, type RegistryLookup, type Rule, type RuleConfig, type RuleContext, type RuleOutcome, type RuleResult, type SecurityCaller, type TextBreakOptions, type Workflow, type WorkflowInput, type WorkflowJob, type WorkflowStep, type YamlFault, globFolders, globToRegExp, packageFolders, workspaceGlobs };
|
|
835
813
|
//# 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/rules/security-one-job.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.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/private-names.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.ts"
|
|
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/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.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/private-names.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.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;;wBAO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
|
|
1
|
+
import { $ as unreleasedChangeRule, $t as mergeHomes, A as typedFiles, An as codePackages, At as nameMatches, B as roadmapParses, Bn as specifiersOf, Bt as licenseFileOf, C as versionTitle, Cn as summaryName, Ct as PRIVATE_NAME_LIST, D as typedScripts, Dn as cuePreset, Dt as isCommonUse, E as trustPolicy, En as STRICT_OPTIONS, Et as isAllowedHit, F as HOME_TIMEOUT_MS, Fn as matchesAny, Ft as hasImportMetaMain, G as publishedMinor, Gt as messageOf, H as releaseFiles, Hn as parseConfig, Ht as repositoryIsPublic, I as blockHash, In as parseJsonc, It as mainCheck, J as NPM_REGISTRY, Jt as HOMES, K as publishedMinorRule, Kt as repoOf, L as githubFetch, Ln as readJsonc, Lt as LICENSE_TEXTS, M as isSourcePath, Mn as inFolder, Mt as pathNameHit, N as pathsOf, Nn as keyLine, Nt as noBuildOutput, O as configsOfScript, On as DEPENDENCY_FIELDS, Ot as lineNameHit, P as sourceMain, Pn as lineOf, Pt as REAL_COMPARE, Q as unreleasedChange, Qt as mapText, R as sharedDocsRule, Rn as replaceLine, Rt as authorOf, S as setVersions, Sn as prPathFilters, St as privateTextBreaks, T as TRAIN_SCOPES, Tn as readWorkflow, Tt as firstNameMatch, U as lockedVersions, Ut as declaredName, V as requiredScripts, Vn as defaultOptions, Vt as mitText, W as minorOf, Wt as homePackage, X as UNSHIPPED_FILES, Xt as findHomes, Y as SHIPPED_FIELDS, Yt as MAP_RULE, Z as npmLookup, Zt as mapMarkdown, _ as workspaceProtocol, _n as securityOneJob, _t as PRIVATE_PATTERNS_VARIABLE, a as listRules, an as hasTests, at as repositoryOfRemote, b as yamlFaults, bn as convertGate, bt as privateNamesFile, c as runCli, cn as SHARED_CI, ct as pushMainOnly, d as HOOK_MARKER, dn as sharedCi, dt as pagesSite, en as readOverlay, et as pipeFails, f as NO_READ_LINE, fn as setupCue, ft as apiReportScript, g as RULES, gn as securityCallers, gt as PRIVATE_NAMES_FILE_VARIABLE, h as prePush, hn as SECURITY_TIMEOUT_MINUTES, ht as PRIVATE_NAMES_FILE_CONFIG, i as formatResult, in as serviceRunMain, it as pagesAfterRelease, j as testsRequired, jn as hasFile, jt as parsePrivateNames, k as scriptsOf, kn as cleanPath, kt as lineNameHits, l as runFix, ln as SHARED_WORKFLOWS, lt as PAGES_WORKFLOWS, m as installHook, mn as SECURITY_SCAN_INPUTS, mt as HOME_PATTERNS, n as annotations, nn as SERVICE_PACKAGE, nt as isPinned, o as readConfig, on as tsconfigTest, ot as runnerBudget, p as PRE_PUSH_HOOK, pn as SECURITY_SCAN_COMMIT, pt as DEFAULT_ALLOWED, q as reachOf, qt as signaturesOf, r as createContext, rn as runCalls, rt as pinnedGitDeps, s as runChecks, sn as SHARED_ACTIONS, st as scheduleMinute, t as USAGE, tn as HOME_EXPORTS, tt as isGitSpecifier, u as summaryMarkdown, un as callsSharedCi, ut as pagesCalls, v as GITHUB_YAML, vn as withOneJob, vt as invalidPatternBreaks, w as IGNORE_AFTER, wn as gateAfterCancel, wt as PrivateNameListError, x as namedVersions, xn as gateTrigger, xt as privatePatterns, y as workflowParses, yn as ACTIONS_COMMIT, yt as noLocalPaths, z as roadmapOfLine, zn as runGit, zt as licenseFile } from "./run-DrVkbk7l.js";
|
|
2
|
+
import { i as packageFolders, n as globFolders, r as globToRegExp, s as workspaceGlobs } from "./workspace-Cx7p7bWn.js";
|
|
2
3
|
// src/release-text.ts
|
|
3
4
|
/**
|
|
4
5
|
* The rule for the git tag and the text of a GitHub release of a package version.
|
|
@@ -64,6 +65,6 @@ function releaseNotes(name, version, changelog) {
|
|
|
64
65
|
if (section.length <= 1e5) return section;
|
|
65
66
|
return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
|
|
66
67
|
}
|
|
67
|
-
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, prePush, privateNamesFile, privatePatterns, privateTextBreaks, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, sharedCi, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
|
|
68
|
+
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, prePush, privateNamesFile, privatePatterns, privateTextBreaks, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
|
|
68
69
|
|
|
69
70
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/release-text.ts"],"sourcesContent":["/**\n * The rule for the git tag and the text of a GitHub release of a package version.\n *\n * The release workflow keeps the same rule in `scripts/release/tags.ts`. A pinned workflow starts that script, so it\n * does not import this package. A test of this package compares the two.\n */\n\n/** GitHub refuses a release text of more than 125000 characters. */\nexport const MAX_NOTES: number = 100_000;\n\n/** This function gives the tag of a version: `v<version>` when the repository has one published package. */\nexport function tagName(name: string, version: string, packageCount: number): string {\n return packageCount === 1 ? `v${version}` : `${name}@${version}`;\n}\n\nconst escape = (text: string): string => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/**\n * This function gives the text of the section of a version in a changelog, or undefined.\n *\n * The heading of the section has the version, with an optional `v` or `<name>@` before it and optional brackets:\n * `## 1.2.0`, `## v1.2.0`, `## [1.2.0] - 2026-10-18`, `# pkg@1.2.0 (2026-10-18)`. The section stops at the next heading\n * of the same level or a higher level. A heading in fenced code does not count. An empty section gives undefined.\n */\nexport function changelogSection(markdown: string, version: string, name: string): string | undefined {\n const heading = new RegExp(`^(#{1,6})\\\\s+\\\\[?(?:v|${escape(name)}@)?${escape(version)}\\\\]?(?=$|[\\\\s(])`);\n const lines = markdown.split(/\\r?\\n/);\n let level = 0;\n let fence: string | null = null;\n const body: string[] = [];\n for (const line of lines) {\n const fenceMark = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (fenceMark !== undefined) {\n const mark = fenceMark[0] ?? \"\";\n if (fence === null) fence = mark;\n else if (mark === fence) fence = null;\n if (level > 0) body.push(line);\n continue;\n }\n if (fence === null) {\n const levelOf = /^(#{1,6})\\s/.exec(line)?.[1]?.length;\n if (level > 0 && levelOf !== undefined && levelOf <= level) break;\n if (level === 0) {\n const match = heading.exec(line);\n if (match) level = match[1]?.length ?? 0;\n continue;\n }\n }\n if (level > 0) body.push(line);\n }\n const text = body.join(\"\\n\").trim();\n return text === \"\" ? undefined : text;\n}\n\n/** This function gives the address of a version on npm. */\nexport function npmUrl(name: string, version: string): string {\n return `https://www.npmjs.com/package/${name}/v/${version}`;\n}\n\n/**\n * This function gives the text of the GitHub release of a version: its changelog section, or else one list item with a\n * link to npm. The Releases page of `site-pages` reads each list item as a change.\n */\nexport function releaseNotes(name: string, version: string, changelog: string | undefined): string {\n const fallback = `- Version ${version} of [\\`${name}\\`](${npmUrl(name, version)}) on npm.`;\n const section = changelog === undefined ? undefined : changelogSection(changelog, version, name);\n if (section === undefined) return fallback;\n if (section.length <= MAX_NOTES) return section;\n return `${section.slice(0, MAX_NOTES)}\\n\\n(The CHANGELOG.md of \\`${name}\\` has the full text.)`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/release-text.ts"],"sourcesContent":["/**\n * The rule for the git tag and the text of a GitHub release of a package version.\n *\n * The release workflow keeps the same rule in `scripts/release/tags.ts`. A pinned workflow starts that script, so it\n * does not import this package. A test of this package compares the two.\n */\n\n/** GitHub refuses a release text of more than 125000 characters. */\nexport const MAX_NOTES: number = 100_000;\n\n/** This function gives the tag of a version: `v<version>` when the repository has one published package. */\nexport function tagName(name: string, version: string, packageCount: number): string {\n return packageCount === 1 ? `v${version}` : `${name}@${version}`;\n}\n\nconst escape = (text: string): string => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/**\n * This function gives the text of the section of a version in a changelog, or undefined.\n *\n * The heading of the section has the version, with an optional `v` or `<name>@` before it and optional brackets:\n * `## 1.2.0`, `## v1.2.0`, `## [1.2.0] - 2026-10-18`, `# pkg@1.2.0 (2026-10-18)`. The section stops at the next heading\n * of the same level or a higher level. A heading in fenced code does not count. An empty section gives undefined.\n */\nexport function changelogSection(markdown: string, version: string, name: string): string | undefined {\n const heading = new RegExp(`^(#{1,6})\\\\s+\\\\[?(?:v|${escape(name)}@)?${escape(version)}\\\\]?(?=$|[\\\\s(])`);\n const lines = markdown.split(/\\r?\\n/);\n let level = 0;\n let fence: string | null = null;\n const body: string[] = [];\n for (const line of lines) {\n const fenceMark = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (fenceMark !== undefined) {\n const mark = fenceMark[0] ?? \"\";\n if (fence === null) fence = mark;\n else if (mark === fence) fence = null;\n if (level > 0) body.push(line);\n continue;\n }\n if (fence === null) {\n const levelOf = /^(#{1,6})\\s/.exec(line)?.[1]?.length;\n if (level > 0 && levelOf !== undefined && levelOf <= level) break;\n if (level === 0) {\n const match = heading.exec(line);\n if (match) level = match[1]?.length ?? 0;\n continue;\n }\n }\n if (level > 0) body.push(line);\n }\n const text = body.join(\"\\n\").trim();\n return text === \"\" ? undefined : text;\n}\n\n/** This function gives the address of a version on npm. */\nexport function npmUrl(name: string, version: string): string {\n return `https://www.npmjs.com/package/${name}/v/${version}`;\n}\n\n/**\n * This function gives the text of the GitHub release of a version: its changelog section, or else one list item with a\n * link to npm. The Releases page of `site-pages` reads each list item as a change.\n */\nexport function releaseNotes(name: string, version: string, changelog: string | undefined): string {\n const fallback = `- Version ${version} of [\\`${name}\\`](${npmUrl(name, version)}) on npm.`;\n const section = changelog === undefined ? undefined : changelogSection(changelog, version, name);\n if (section === undefined) return fallback;\n if (section.length <= MAX_NOTES) return section;\n return `${section.slice(0, MAX_NOTES)}\\n\\n(The CHANGELOG.md of \\`${name}\\` has the full text.)`;\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAa,YAAoB;;AAGjC,SAAgB,QAAQ,MAAc,SAAiB,cAA8B;CACnF,OAAO,iBAAiB,IAAI,IAAI,YAAY,GAAG,KAAK,GAAG;AACzD;AAEA,MAAM,UAAU,SAAyB,KAAK,QAAQ,uBAAuB,MAAM;;;;;;;;AASnF,SAAgB,iBAAiB,UAAkB,SAAiB,MAAkC;CACpG,MAAM,UAAU,IAAI,OAAO,yBAAyB,OAAO,IAAI,EAAE,KAAK,OAAO,OAAO,EAAE,iBAAiB;CACvG,MAAM,QAAQ,SAAS,MAAM,OAAO;CACpC,IAAI,QAAQ;CACZ,IAAI,QAAuB;CAC3B,MAAM,OAAiB,CAAC;CACxB,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,YAAY,oBAAoB,KAAK,IAAI,CAAC,GAAG;EACnD,IAAI,cAAc,KAAA,GAAW;GAC3B,MAAM,OAAO,UAAU,MAAM;GAC7B,IAAI,UAAU,MAAM,QAAQ;QACvB,IAAI,SAAS,OAAO,QAAQ;GACjC,IAAI,QAAQ,GAAG,KAAK,KAAK,IAAI;GAC7B;EACF;EACA,IAAI,UAAU,MAAM;GAClB,MAAM,UAAU,cAAc,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE;GAC/C,IAAI,QAAQ,KAAK,YAAY,KAAA,KAAa,WAAW,OAAO;GAC5D,IAAI,UAAU,GAAG;IACf,MAAM,QAAQ,QAAQ,KAAK,IAAI;IAC/B,IAAI,OAAO,QAAQ,MAAM,EAAE,EAAE,UAAU;IACvC;GACF;EACF;EACA,IAAI,QAAQ,GAAG,KAAK,KAAK,IAAI;CAC/B;CACA,MAAM,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK;CAClC,OAAO,SAAS,KAAK,KAAA,IAAY;AACnC;;AAGA,SAAgB,OAAO,MAAc,SAAyB;CAC5D,OAAO,iCAAiC,KAAK,KAAK;AACpD;;;;;AAMA,SAAgB,aAAa,MAAc,SAAiB,WAAuC;CACjG,MAAM,WAAW,aAAa,QAAQ,SAAS,KAAK,MAAM,OAAO,MAAM,OAAO,EAAE;CAChF,MAAM,UAAU,cAAc,KAAA,IAAY,KAAA,IAAY,iBAAiB,WAAW,SAAS,IAAI;CAC/F,IAAI,YAAY,KAAA,GAAW,OAAO;CAClC,IAAI,QAAQ,UAAA,KAAqB,OAAO;CACxC,OAAO,GAAG,QAAQ,MAAM,GAAG,SAAS,EAAE,6BAA6B,KAAK;AAC1E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { a as relativePath, i as packageFolders, r as globToRegExp, t as byCode } from "./workspace-Cx7p7bWn.js";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import { spawnSync } from "node:child_process";
|
|
3
4
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { basename, dirname, extname, join, posix, relative, resolve
|
|
5
|
+
import { basename, dirname, extname, join, posix, relative, resolve } from "node:path";
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
7
|
import { parseAllDocuments } from "yaml";
|
|
7
8
|
// src/config.ts
|
|
@@ -81,139 +82,6 @@ function parseConfig(value, rules) {
|
|
|
81
82
|
rules: result
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
|
-
// src/workspace.ts
|
|
85
|
-
/**
|
|
86
|
-
* The package folders of a repository: the folders that the globs of the workspace name, with a
|
|
87
|
-
* `package.json` file. This file is a copy of `workspace.ts` of `@mark1russell7/api-report`, so that
|
|
88
|
-
* each tool has no runtime dependency.
|
|
89
|
-
*/
|
|
90
|
-
/** This function compares two strings by their code units, as the default sort does. */
|
|
91
|
-
const byCode = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
92
|
-
/** This function gives a path relative to `root`, with `/`. */
|
|
93
|
-
const relativePath = (root, file) => relative(root, file).split(sep).join("/");
|
|
94
|
-
/** The characters that have a meaning in a regular expression. */
|
|
95
|
-
const SPECIAL = /* @__PURE__ */ new Set([..."\\^$.|+()[]{}*?/"]);
|
|
96
|
-
/**
|
|
97
|
-
* This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path
|
|
98
|
-
* segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of
|
|
99
|
-
* its parts. The function escapes each other special character.
|
|
100
|
-
*/
|
|
101
|
-
function globToRegExp(glob) {
|
|
102
|
-
let source = "";
|
|
103
|
-
let braces = 0;
|
|
104
|
-
for (let index = 0; index < glob.length; index++) {
|
|
105
|
-
const char = glob.charAt(index);
|
|
106
|
-
if (char === "/" && glob.slice(index + 1) === "**") {
|
|
107
|
-
source += "(?:/.*)?";
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
if (char === "*" && glob.charAt(index + 1) === "*") {
|
|
111
|
-
const atStart = index === 0 || glob.charAt(index - 1) === "/";
|
|
112
|
-
const after = glob.charAt(index + 2);
|
|
113
|
-
if (atStart && after === "/") {
|
|
114
|
-
source += "(?:[^/]+/)*";
|
|
115
|
-
index += 2;
|
|
116
|
-
} else if (atStart && after === "") {
|
|
117
|
-
source += ".*";
|
|
118
|
-
index += 1;
|
|
119
|
-
} else {
|
|
120
|
-
source += "[^/]*";
|
|
121
|
-
index += 1;
|
|
122
|
-
}
|
|
123
|
-
} else if (char === "*") source += "[^/]*";
|
|
124
|
-
else if (char === "?") source += "[^/]";
|
|
125
|
-
else if (char === "{") {
|
|
126
|
-
braces++;
|
|
127
|
-
source += "(?:";
|
|
128
|
-
} else if (char === "}" && braces > 0) {
|
|
129
|
-
braces--;
|
|
130
|
-
source += ")";
|
|
131
|
-
} else if (char === "," && braces > 0) source += "|";
|
|
132
|
-
else if (SPECIAL.has(char)) source += `\\${char}`;
|
|
133
|
-
else source += char;
|
|
134
|
-
}
|
|
135
|
-
if (braces > 0) throw new Error(`A glob with a "{" that has no "}": ${glob}`);
|
|
136
|
-
return new RegExp(`^${source}$`);
|
|
137
|
-
}
|
|
138
|
-
/** The characters that make a path segment a pattern. */
|
|
139
|
-
const GLOB_CHARS = /[*?{]/;
|
|
140
|
-
/** This function removes the `/` characters at the end of a path, with a loop in place of a regular expression. */
|
|
141
|
-
function trimEndSlashes(path) {
|
|
142
|
-
let end = path.length;
|
|
143
|
-
while (end > 0 && path.charAt(end - 1) === "/") end -= 1;
|
|
144
|
-
return path.slice(0, end);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,
|
|
148
|
-
* in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.
|
|
149
|
-
*/
|
|
150
|
-
function globFolders(root, glob) {
|
|
151
|
-
const clean = trimEndSlashes(glob.startsWith("./") ? glob.slice(2) : glob);
|
|
152
|
-
const segments = clean.split("/");
|
|
153
|
-
const firstPattern = segments.findIndex((segment) => GLOB_CHARS.test(segment));
|
|
154
|
-
if (firstPattern < 0) return existsSync(join(root, clean)) ? [clean] : [];
|
|
155
|
-
const base = segments.slice(0, firstPattern).join("/");
|
|
156
|
-
const depth = clean.includes("**") ? Number.POSITIVE_INFINITY : segments.length - firstPattern;
|
|
157
|
-
const pattern = globToRegExp(clean);
|
|
158
|
-
const start = join(root, base);
|
|
159
|
-
if (!existsSync(start)) return [];
|
|
160
|
-
const found = [];
|
|
161
|
-
const walk = (folder, level) => {
|
|
162
|
-
for (const entry of readdirSync(folder, { withFileTypes: true })) {
|
|
163
|
-
if (!entry.isDirectory() || entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
164
|
-
const path = join(folder, entry.name);
|
|
165
|
-
if (pattern.test(relativePath(root, path))) found.push(relativePath(root, path));
|
|
166
|
-
if (level < depth) walk(path, level + 1);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
if (base !== "" && pattern.test(base)) found.push(base);
|
|
170
|
-
walk(start, 1);
|
|
171
|
-
return found.sort(byCode);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* This function gives the globs of the workspace at `root`: the `packages` list of
|
|
175
|
-
* `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when
|
|
176
|
-
* the repository has no workspace.
|
|
177
|
-
*/
|
|
178
|
-
function workspaceGlobs(root) {
|
|
179
|
-
const yaml = join(root, "pnpm-workspace.yaml");
|
|
180
|
-
if (existsSync(yaml)) {
|
|
181
|
-
const lines = readFileSync(yaml, "utf8").split(/\r?\n/);
|
|
182
|
-
const start = lines.findIndex((line) => /^packages\s*:/.test(line));
|
|
183
|
-
if (start >= 0) {
|
|
184
|
-
const unquote = (text) => text.replace(/\s+#.*$/, "").trim().replace(/^["']|["']$/g, "");
|
|
185
|
-
const inline = /^packages\s*:\s*\[(.*)\]/.exec(lines[start] ?? "");
|
|
186
|
-
if (inline) return (inline[1] ?? "").split(",").map(unquote).filter(Boolean);
|
|
187
|
-
const globs = [];
|
|
188
|
-
for (const line of lines.slice(start + 1)) {
|
|
189
|
-
if (/^\s*(#.*)?$/.test(line)) continue;
|
|
190
|
-
const item = /^\s+-\s+(.+)$/.exec(line);
|
|
191
|
-
if (!item) break;
|
|
192
|
-
globs.push(unquote(item[1] ?? ""));
|
|
193
|
-
}
|
|
194
|
-
return globs;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
const manifestFile = join(root, "package.json");
|
|
198
|
-
if (existsSync(manifestFile)) {
|
|
199
|
-
const { workspaces } = JSON.parse(readFileSync(manifestFile, "utf8"));
|
|
200
|
-
if (Array.isArray(workspaces)) return workspaces.filter((glob) => typeof glob === "string");
|
|
201
|
-
if (typeof workspaces === "object" && workspaces !== null && "packages" in workspaces && Array.isArray(workspaces.packages)) return workspaces.packages.filter((glob) => typeof glob === "string");
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* This function gives the package folders of the repository at `root`: the folders of the globs
|
|
206
|
-
* that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the
|
|
207
|
-
* function reads the globs of the workspace, and a repository with no workspace is one package.
|
|
208
|
-
* The result has absolute paths, in the order of the code units.
|
|
209
|
-
*/
|
|
210
|
-
function packageFolders(root, globs = workspaceGlobs(root)) {
|
|
211
|
-
if (globs === void 0) return existsSync(join(root, "package.json")) ? [root] : [];
|
|
212
|
-
const included = /* @__PURE__ */ new Set();
|
|
213
|
-
for (const glob of globs.filter((item) => !item.startsWith("!"))) for (const folder of globFolders(root, glob)) included.add(folder);
|
|
214
|
-
for (const glob of globs.filter((item) => item.startsWith("!"))) for (const folder of globFolders(root, glob.slice(1))) included.delete(folder);
|
|
215
|
-
return [...included].filter((folder) => existsSync(join(root, folder, "package.json"))).sort(byCode).map((folder) => join(root, folder));
|
|
216
|
-
}
|
|
217
85
|
// src/rule.ts
|
|
218
86
|
/**
|
|
219
87
|
* The shape of a rule, the facts that a rule reads (the context), and small helpers for the rules.
|
|
@@ -2211,6 +2079,79 @@ const securityOneJob = {
|
|
|
2211
2079
|
return breaks;
|
|
2212
2080
|
}
|
|
2213
2081
|
};
|
|
2082
|
+
// src/rules/setup-cue.ts
|
|
2083
|
+
/**
|
|
2084
|
+
* The rule `setup-cue`: no workflow or action downloads the cue CLI with its own command. The shared action `setup-cue`
|
|
2085
|
+
* of the template installs it from a cache, or with retries and a sha256 check. A download of a release asset from
|
|
2086
|
+
* GitHub fails at times with a 504, and a bare `curl` then fails the job.
|
|
2087
|
+
*/
|
|
2088
|
+
/** The files of a composite action. */
|
|
2089
|
+
const ACTION$1 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
2090
|
+
/** The action of the template itself. It is the one place with the download. */
|
|
2091
|
+
const SHARED_ACTION = ".github/actions/setup-cue/action.yml";
|
|
2092
|
+
/** A hand-written install of the cue CLI: a download of a release asset, or a build with `go install`. */
|
|
2093
|
+
const DOWNLOAD = /github\.com\/cue-lang\/cue\/releases\/download\/(v[0-9][^/\s"']*)\/|cuelang\.org\/go\/cmd\/cue@(v?[0-9][^\s"']*|latest)/;
|
|
2094
|
+
/** This function gives each line of a file that installs the cue CLI with its own command. It does not read a comment line. */
|
|
2095
|
+
function cueDownloads(text) {
|
|
2096
|
+
const found = [];
|
|
2097
|
+
text.split(/\r?\n/).forEach((line, index) => {
|
|
2098
|
+
if (line.trimStart().startsWith("#")) return;
|
|
2099
|
+
const match = DOWNLOAD.exec(line);
|
|
2100
|
+
if (match === null) return;
|
|
2101
|
+
const version = match[1] ?? match[2];
|
|
2102
|
+
found.push({
|
|
2103
|
+
line: index + 1,
|
|
2104
|
+
version: version === void 0 || version === "latest" ? void 0 : version.replace(/^v/, "")
|
|
2105
|
+
});
|
|
2106
|
+
});
|
|
2107
|
+
return found;
|
|
2108
|
+
}
|
|
2109
|
+
const setupCue = {
|
|
2110
|
+
id: "setup-cue",
|
|
2111
|
+
title: "The cue CLI comes from the shared action `setup-cue`, not from a download in a workflow.",
|
|
2112
|
+
reason: "On 2026-11-08, GitHub gave a 504 for release assets on and off from 09:00Z to after 10:20Z. A bare `curl` of the cue CLI failed the CI of cue and a release of client.",
|
|
2113
|
+
fix: "A caller of `reusable-ci.yml` gives the input `cue-version: \"<version>\"` in place of the download in `setup`. Another job uses the step `uses: mark1russell7/template/.github/actions/setup-cue@<commit>` with `version: <version>`.",
|
|
2114
|
+
sources: [
|
|
2115
|
+
{
|
|
2116
|
+
repo: "cue",
|
|
2117
|
+
rule: "ci",
|
|
2118
|
+
doc: "the cue download of main CI and of #66 (2026-11-08): a 504 of github.com, and #66 passed at attempt 3"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
repo: "client",
|
|
2122
|
+
rule: "release",
|
|
2123
|
+
doc: "the 0.52.0 release (2026-11-08): a bare curl -fsSL of the cue CLI failed on a 504"
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
repo: "template",
|
|
2127
|
+
rule: "security",
|
|
2128
|
+
doc: "the Security run of main daa927c (2026-11-08): the same 504 for the CodeQL bundle, another release asset"
|
|
2129
|
+
}
|
|
2130
|
+
],
|
|
2131
|
+
options: {},
|
|
2132
|
+
check(context) {
|
|
2133
|
+
const files = context.gitFiles();
|
|
2134
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
2135
|
+
const breaks = [];
|
|
2136
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$1.test(path)) && path !== SHARED_ACTION).sort(byCode)) {
|
|
2137
|
+
let text;
|
|
2138
|
+
try {
|
|
2139
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
2140
|
+
} catch {
|
|
2141
|
+
continue;
|
|
2142
|
+
}
|
|
2143
|
+
for (const download of cueDownloads(text)) {
|
|
2144
|
+
const version = download.version === void 0 ? "" : ` ${download.version}`;
|
|
2145
|
+
breaks.push({
|
|
2146
|
+
file,
|
|
2147
|
+
line: download.line,
|
|
2148
|
+
message: `${file} installs the cue CLI${version} with its own command, with no retry. Use the action setup-cue of the template, or the input cue-version of reusable-ci.yml.`
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
return breaks;
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2214
2155
|
// src/rules/shared-ci.ts
|
|
2215
2156
|
/**
|
|
2216
2157
|
* The rule `shared-ci`: a repository uses the shared workflows and actions of the template, and keeps no copy of them.
|
|
@@ -2231,6 +2172,7 @@ const SHARED_WORKFLOWS = [
|
|
|
2231
2172
|
];
|
|
2232
2173
|
/** The shared actions of the template, by folder name under `.github/actions`. */
|
|
2233
2174
|
const SHARED_ACTIONS = [
|
|
2175
|
+
"build-ref",
|
|
2234
2176
|
"changes",
|
|
2235
2177
|
"changeset-check",
|
|
2236
2178
|
"coverage",
|
|
@@ -2239,6 +2181,7 @@ const SHARED_ACTIONS = [
|
|
|
2239
2181
|
"green-main",
|
|
2240
2182
|
"npm-publish",
|
|
2241
2183
|
"security-scan",
|
|
2184
|
+
"setup-cue",
|
|
2242
2185
|
"setup-playwright",
|
|
2243
2186
|
"site-check",
|
|
2244
2187
|
"site-pages"
|
|
@@ -13509,6 +13452,7 @@ const RULES = [
|
|
|
13509
13452
|
gateTrigger,
|
|
13510
13453
|
securityOneJob,
|
|
13511
13454
|
sharedCi,
|
|
13455
|
+
setupCue,
|
|
13512
13456
|
homePackage,
|
|
13513
13457
|
licenseFile,
|
|
13514
13458
|
pagesSite,
|
|
@@ -14390,6 +14334,6 @@ function runHook(args, io) {
|
|
|
14390
14334
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
14391
14335
|
}, io);
|
|
14392
14336
|
}
|
|
14393
|
-
export { unreleasedChangeRule as $, mergeHomes as $t, typedFiles as A,
|
|
14337
|
+
export { unreleasedChangeRule as $, mergeHomes as $t, typedFiles as A, codePackages as An, nameMatches as At, roadmapParses as B, specifiersOf as Bn, licenseFileOf as Bt, versionTitle as C, summaryName as Cn, PRIVATE_NAME_LIST as Ct, typedScripts as D, cuePreset as Dn, isCommonUse as Dt, trustPolicy as E, STRICT_OPTIONS as En, isAllowedHit as Et, HOME_TIMEOUT_MS as F, matchesAny as Fn, hasImportMetaMain as Ft, publishedMinor as G, messageOf as Gt, releaseFiles as H, parseConfig as Hn, repositoryIsPublic as Ht, blockHash as I, parseJsonc as In, mainCheck as It, NPM_REGISTRY as J, HOMES as Jt, publishedMinorRule as K, repoOf as Kt, githubFetch as L, readJsonc as Ln, LICENSE_TEXTS as Lt, isSourcePath as M, inFolder as Mn, pathNameHit as Mt, pathsOf as N, keyLine as Nn, noBuildOutput as Nt, configsOfScript as O, DEPENDENCY_FIELDS as On, lineNameHit as Ot, sourceMain as P, lineOf as Pn, REAL_COMPARE as Pt, unreleasedChange as Q, mapText as Qt, sharedDocsRule as R, replaceLine as Rn, authorOf as Rt, setVersions as S, prPathFilters as Sn, privateTextBreaks as St, TRAIN_SCOPES as T, readWorkflow as Tn, firstNameMatch as Tt, lockedVersions as U, declaredName as Ut, requiredScripts as V, defaultOptions as Vn, mitText as Vt, minorOf as W, homePackage as Wt, UNSHIPPED_FILES as X, findHomes as Xt, SHIPPED_FIELDS as Y, MAP_RULE as Yt, npmLookup as Z, mapMarkdown as Zt, workspaceProtocol as _, securityOneJob as _n, PRIVATE_PATTERNS_VARIABLE as _t, listRules as a, hasTests as an, repositoryOfRemote as at, yamlFaults as b, convertGate as bn, privateNamesFile as bt, runCli as c, SHARED_CI as cn, pushMainOnly as ct, HOOK_MARKER as d, sharedCi as dn, pagesSite as dt, readOverlay as en, pipeFails as et, NO_READ_LINE as f, setupCue as fn, apiReportScript as ft, RULES as g, securityCallers as gn, PRIVATE_NAMES_FILE_VARIABLE as gt, prePush as h, SECURITY_TIMEOUT_MINUTES as hn, PRIVATE_NAMES_FILE_CONFIG as ht, formatResult as i, serviceRunMain as in, pagesAfterRelease as it, testsRequired as j, hasFile as jn, parsePrivateNames as jt, scriptsOf as k, cleanPath as kn, lineNameHits as kt, runFix as l, SHARED_WORKFLOWS as ln, PAGES_WORKFLOWS as lt, installHook as m, SECURITY_SCAN_INPUTS as mn, HOME_PATTERNS as mt, annotations as n, SERVICE_PACKAGE as nn, isPinned as nt, readConfig as o, tsconfigTest as on, runnerBudget as ot, PRE_PUSH_HOOK as p, SECURITY_SCAN_COMMIT as pn, DEFAULT_ALLOWED as pt, reachOf as q, signaturesOf as qt, createContext as r, runCalls as rn, pinnedGitDeps as rt, runChecks as s, SHARED_ACTIONS as sn, scheduleMinute as st, USAGE as t, HOME_EXPORTS as tn, isGitSpecifier as tt, summaryMarkdown as u, callsSharedCi as un, pagesCalls as ut, GITHUB_YAML as v, withOneJob as vn, invalidPatternBreaks as vt, IGNORE_AFTER as w, gateAfterCancel as wn, PrivateNameListError as wt, namedVersions as x, gateTrigger as xn, privatePatterns as xt, workflowParses as y, ACTIONS_COMMIT as yn, noLocalPaths as yt, roadmapOfLine as z, runGit as zn, licenseFile as zt };
|
|
14394
14338
|
|
|
14395
|
-
//# sourceMappingURL=run-
|
|
14339
|
+
//# sourceMappingURL=run-DrVkbk7l.js.map
|