@vivswan/github-settings-as-code 0.0.0 → 2.0.1-main.658.20260922.gdcb742f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +561 -1
- package/README.md +101 -2
- package/lib/pkg/cli.js +722 -0
- package/lib/pkg/index.d.ts +157 -0
- package/lib/pkg/index.js +3 -0
- package/lib/pkg/inputs-BOuUCdpl.js +15883 -0
- package/lib/pkg/internal-la_KkjCS.js +1 -0
- package/lib/pkg/internal.d.ts +49 -0
- package/lib/pkg/internal.js +3 -0
- package/lib/pkg/layers-MA87H-hC.d.ts +9786 -0
- package/lib/pkg/src-C2gb8QkD.js +160 -0
- package/lib/settings.schema.json +4128 -0
- package/package.json +91 -3
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { $n as RepoRef, A as SingleConfig, An as DEFAULT_API_VERSION, At as TaggedEndpoint, B as runMulti, Bn as isRateLimitError, Bt as ValidatedInput, Cn as DiscoveryFilters, D as SnapshotConfig, Dn as discoverRepos, Dt as SectionSelection, Fn as RequestMark, Ft as SectionInput, G as failRun, Gn as OutputName, Hn as CollectedLine, I as MultiConfig, Jn as prefixedIo, Jt as OnMissingPermission, Kn as collectingIo, Kt as DenialPolicy, Lt as SectionModule, M as runSingle, Mn as GitHubApiOptions, Mt as allGraphqlOps, N as RenderConfig, Nn as GitHubClient, Nt as sectionModule, O as concludeSnapshot, On as ApiError, Ot as SettingsSource, P as runRender, Pn as GraphqlOp, Qn as RemoteTarget, Qt as SnapshotContext, Rt as SectionSnapshot, S as parseConfig, Sn as DEFAULT_DISCOVERY_FILTERS, St as ValidatedSettings, T as FinishedSnapshot, U as concludeRender, Un as Io, Ut as sectionGrant, V as FinishedRender, Vn as AnnotationLevel, W as concludeRun, Wn as MaskPair, Xn as silentIo, Y as TargetOutcome, Yn as redactRanges, Yt as PlanContext, Zn as CentralTarget, Zt as SectionPlan, _ as RunConfig, _r as SettingsFile, _t as worstOf, an as EndpointDecl, ar as Problem, at as deliverArtifactReport, br as Layering, bt as RepoRunResult, cn as endpointPath, cr as SettingsFileRole, dr as describeProblem, dt as SectionSnapshotOutcome, er as Target, fn as FoldOptions, ft as SnapshotResult, g as RunCapabilities, gr as SectionKey, gt as RunOutcome, hn as describeRemoval, hr as SECTION_KEYS, ht as RUN_RESULTS, i as ConfigEnv, in as SectionFailure, ir as LayerProblem, it as ArtifactUploader, j as SingleOutcome, jn as GitHubApi, jt as allEndpoints, k as runSnapshot, kn as ClientAnswer, kt as SECTIONS, lr as SettingsProblem, mn as RemovalNotice, nn as snapshotContext, nr as parseRepoSlug, on as Route, or as ProblemOf, ot as encryptReport, pn as Layer, qn as maskRegistry, r as readLayerFiles, rn as GraphqlOpDecl, rt as openReportChannel, sn as endpointMethod, st as parseRecipient, tn as planContext, tr as dedupeTargets, tt as PrivateReportChannel, u as InputReader, ut as RenderableSnapshot, vn as UndeclaredPolicy, vr as UNDECLARED_POLICY_SECTIONS, xt as SectionOutcome, yr as UndeclaredPolicySection, yt as RepoRunOptions, zn as isPermissionError, zt as ValidatedBrand } from "./layers-MA87H-hC.js";
|
|
2
|
+
import { Result } from "neverthrow";
|
|
3
|
+
//#region src/discovery/central.d.ts
|
|
4
|
+
export declare function resolveCentralTargets(reposDir: string, adminOwner: string): Result<{
|
|
5
|
+
targets: CentralTarget[];
|
|
6
|
+
warnings: string[];
|
|
7
|
+
}, ProblemOf<"repos-dir-missing" | "repos-dir-unreadable" | "repos-dir-invalid-files">>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/discovery/repos-input.d.ts
|
|
10
|
+
export declare function parseReposInput(raw: string): Result<{
|
|
11
|
+
slugs: string[];
|
|
12
|
+
discover: boolean;
|
|
13
|
+
}, ProblemOf<"repos-input-wildcard-mixed" | "repos-input-invalid-entries">>;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/flows/execute.d.ts
|
|
16
|
+
/** What a face hands the executor; the config carries everything else. */
|
|
17
|
+
interface RunDeps {
|
|
18
|
+
readonly io: Io;
|
|
19
|
+
/** Opens the client a config's token authorizes; a merge never asks for one. */
|
|
20
|
+
readonly createClient: (token: string, io: Io, apiVersion: string) => GitHubClient;
|
|
21
|
+
/** The artifact channel's uploader; parseConfig refuses that channel for a face that declares no upload capability. */
|
|
22
|
+
readonly uploader?: ArtifactUploader;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How a run ended: its exit code, and the problem it ended in when it never reached a target (the outputs and the
|
|
26
|
+
* error line are already through `deps.io`; the command line's --json envelope carries the problem's text beside them).
|
|
27
|
+
*/
|
|
28
|
+
interface RunEnd {
|
|
29
|
+
readonly exitCode: number;
|
|
30
|
+
readonly fatal?: Problem;
|
|
31
|
+
}
|
|
32
|
+
export declare function executeRun(cfg: RunConfig, deps: RunDeps): Promise<RunEnd>;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/flows/library.d.ts
|
|
35
|
+
/** The knobs every verb over a document takes. */
|
|
36
|
+
interface ValidateOptions {
|
|
37
|
+
/** How the document is named in problems and warnings; a file path, usually. */
|
|
38
|
+
source?: string;
|
|
39
|
+
/** The `sections` allowlist: an unknown top-level key outside a non-empty one is a warning, not an error. */
|
|
40
|
+
sections?: SectionSelection;
|
|
41
|
+
/** Where the warnings print; without one they come back as the report's `log`. */
|
|
42
|
+
io?: Io;
|
|
43
|
+
/** The action's `undeclared` input: the fallback policy below a list's wrapper and the file's own; unset by default. */
|
|
44
|
+
undeclared?: UndeclaredPolicy;
|
|
45
|
+
/** Who authored the document: "operator" (the default) honors `$NAME` secret references, "target" refuses them. */
|
|
46
|
+
secretSource?: SettingsSource;
|
|
47
|
+
}
|
|
48
|
+
interface ValidateReport {
|
|
49
|
+
settings: ValidatedSettings;
|
|
50
|
+
log: CollectedLine[];
|
|
51
|
+
}
|
|
52
|
+
/** Validate a parsed document into the branded settings every other verb takes. */
|
|
53
|
+
export declare function validateSettings(doc: unknown, options?: ValidateOptions): Result<ValidateReport, SettingsProblem>;
|
|
54
|
+
interface MergeOptions {
|
|
55
|
+
/** How the merged document is named in problems and warnings. */
|
|
56
|
+
source?: string;
|
|
57
|
+
/** How the list sections fold across layers; the action's `layering` input, "deep" unless set. */
|
|
58
|
+
layering?: FoldOptions["layering"];
|
|
59
|
+
/** The action's `undeclared` input: the fallback policy below a list's wrapper and the file's own; unset by default. */
|
|
60
|
+
undeclared?: UndeclaredPolicy;
|
|
61
|
+
io?: Io;
|
|
62
|
+
}
|
|
63
|
+
/** The fold's result: the merged document, its removal notices, and the file text mode: render writes, byte for byte. */
|
|
64
|
+
interface MergeReport {
|
|
65
|
+
settings: ValidatedSettings;
|
|
66
|
+
notices: RemovalNotice[];
|
|
67
|
+
yaml: string;
|
|
68
|
+
log: CollectedLine[];
|
|
69
|
+
}
|
|
70
|
+
/** Fold an ordered list of layers into one validated document, as mode: render does. */
|
|
71
|
+
export declare function mergeSettings(layers: readonly Layer[], options?: MergeOptions): Result<MergeReport, SettingsProblem | LayerProblem>;
|
|
72
|
+
/** The knobs a run over one repository takes, each defaulted as the action's input of the same name. */
|
|
73
|
+
interface RepositoryOptions {
|
|
74
|
+
sections?: SectionSelection;
|
|
75
|
+
onMissingPermission?: RepoRunOptions["onMissingPermission"];
|
|
76
|
+
io?: Io;
|
|
77
|
+
secretEnv?: RepoRunOptions["secretEnv"];
|
|
78
|
+
}
|
|
79
|
+
type CheckOptions = RepositoryOptions;
|
|
80
|
+
type ApplyOptions = RepositoryOptions;
|
|
81
|
+
/** The engine's result plus every line the run printed when the caller brought no Io of their own. */
|
|
82
|
+
interface RepositoryReport extends RepoRunResult {
|
|
83
|
+
log: CollectedLine[];
|
|
84
|
+
}
|
|
85
|
+
type CheckReport = RepositoryReport;
|
|
86
|
+
type ApplyReport = RepositoryReport;
|
|
87
|
+
/** Plan and diff every active section without writing. */
|
|
88
|
+
export declare function checkRepository(client: GitHubClient, repo: RepoRef, settings: ValidatedSettings, options?: CheckOptions): Promise<CheckReport>;
|
|
89
|
+
/** Execute the plan: the repository converges on the document. */
|
|
90
|
+
export declare function applyRepository(client: GitHubClient, repo: RepoRef, settings: ValidatedSettings, options?: ApplyOptions): Promise<ApplyReport>;
|
|
91
|
+
/** The knobs a snapshot takes: the same three, since a snapshot never writes. */
|
|
92
|
+
interface SnapshotOptions {
|
|
93
|
+
sections?: SectionSelection;
|
|
94
|
+
onMissingPermission?: RepoRunOptions["onMissingPermission"];
|
|
95
|
+
io?: Io;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The engine's snapshot result plus the file text mode: snapshot would write
|
|
99
|
+
* (absent exactly when the result is failed, which carries no document), the
|
|
100
|
+
* moment the reads began (`takenAt`: the file carries no date, and the report
|
|
101
|
+
* is the library's summary, so it states the moment where the action's summary
|
|
102
|
+
* and notice do), and every line the run printed when the caller brought no Io
|
|
103
|
+
* of their own.
|
|
104
|
+
*/
|
|
105
|
+
type SnapshotReport = ((RenderableSnapshot & {
|
|
106
|
+
yaml: string;
|
|
107
|
+
}) | (Extract<SnapshotResult, {
|
|
108
|
+
result: "failed";
|
|
109
|
+
}> & {
|
|
110
|
+
yaml?: never;
|
|
111
|
+
})) & {
|
|
112
|
+
takenAt: string;
|
|
113
|
+
log: CollectedLine[];
|
|
114
|
+
};
|
|
115
|
+
/** Read one repository's supported sections back as a settings document and its rendered file. */
|
|
116
|
+
export declare function snapshotRepository(client: GitHubClient, repo: RepoRef, options?: SnapshotOptions): Promise<SnapshotReport>;
|
|
117
|
+
/** Snapshot several repositories in order, one report each; a failed target never stops the rest. */
|
|
118
|
+
export declare function snapshotRepositories(client: GitHubClient, repos: readonly RepoRef[], options?: SnapshotOptions): Promise<SnapshotReport[]>;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/flows/settings-read.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* `logLevel: "error"` is load-bearing: at its default the parser reports a warning (an unresolved tag, an anchor ending
|
|
123
|
+
* in ":") on a SUCCESSFUL parse through process.emitWarning, quoting the offending source line with its values straight
|
|
124
|
+
* to stderr, which nothing here redacts. Empty and null documents become {}.
|
|
125
|
+
*
|
|
126
|
+
* "error" -> warnings silent; a syntax error still throws into the error path
|
|
127
|
+
* "silent" -> would also swallow the syntax errors
|
|
128
|
+
*
|
|
129
|
+
* `merge: true` resolves `<<` merge keys as the Probot app's js-yaml did; off, the key survives as literal data.
|
|
130
|
+
*/
|
|
131
|
+
export declare function parseSettingsDoc(raw: string): Result<unknown, ProblemOf<"yaml-invalid">>;
|
|
132
|
+
export declare function readSettingsFile(path: string, role: SettingsFileRole): Result<unknown, ProblemOf<"settings-file-unreadable">>;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/report/composer.d.ts
|
|
135
|
+
interface TranscriptLine {
|
|
136
|
+
level?: AnnotationLevel;
|
|
137
|
+
line: string;
|
|
138
|
+
}
|
|
139
|
+
interface OutcomeRow {
|
|
140
|
+
key: string;
|
|
141
|
+
status: string;
|
|
142
|
+
detail: string[];
|
|
143
|
+
}
|
|
144
|
+
interface ReportInput {
|
|
145
|
+
/** The target's owner/name slug, unredacted: this document is private. */
|
|
146
|
+
target: string;
|
|
147
|
+
adminRepo: string;
|
|
148
|
+
runUrl: string;
|
|
149
|
+
mode: string;
|
|
150
|
+
result: string;
|
|
151
|
+
timestamp: string;
|
|
152
|
+
outcomes: OutcomeRow[];
|
|
153
|
+
transcript: TranscriptLine[];
|
|
154
|
+
}
|
|
155
|
+
export declare function composeReport(input: ReportInput): string;
|
|
156
|
+
//#endregion
|
|
157
|
+
export { type AnnotationLevel, type ApiError, type ApplyOptions, type ApplyReport, type ArtifactUploader, type CentralTarget, type CheckOptions, type CheckReport, type ClientAnswer, type CollectedLine, type ConfigEnv, DEFAULT_API_VERSION, DEFAULT_DISCOVERY_FILTERS, type DenialPolicy, type DiscoveryFilters, type EndpointDecl, type FinishedRender, type FinishedSnapshot, GitHubApi, type GitHubApiOptions, type GitHubClient, type GraphqlOp, type GraphqlOpDecl, type InputReader, type Io, type Layer, type Layering, type MaskPair, type MergeOptions, type MergeReport, type MultiConfig, type OnMissingPermission, type OutputName, type PlanContext, type PrivateReportChannel, type Problem, RUN_RESULTS, type RemoteTarget, type RemovalNotice, type RenderConfig, type RepoRef, type ReportInput, type RequestMark, type Route, type RunCapabilities, type RunConfig, type RunDeps, type RunEnd, type RunOutcome, SECTIONS, SECTION_KEYS, type SectionFailure, type SectionInput, type SectionKey, type SectionModule, type SectionOutcome, type SectionPlan, SectionSelection, type SectionSnapshot, type SectionSnapshotOutcome, SettingsFile, type SettingsFileRole, type SingleConfig, type SingleOutcome, type SnapshotConfig, type SnapshotContext, type SnapshotOptions, type SnapshotReport, type TaggedEndpoint, type Target, type TargetOutcome, UNDECLARED_POLICY_SECTIONS, type UndeclaredPolicySection, type ValidateOptions, type ValidateReport, type ValidatedBrand, type ValidatedInput, type ValidatedSettings, allEndpoints, allGraphqlOps, collectingIo, concludeRender, concludeRun, concludeSnapshot, dedupeTargets, deliverArtifactReport, describeProblem, describeRemoval, discoverRepos, encryptReport, endpointMethod, endpointPath, failRun, isPermissionError, isRateLimitError, maskRegistry, openReportChannel, parseConfig, parseRecipient, parseRepoSlug, planContext, prefixedIo, readLayerFiles, redactRanges, runMulti, runRender, runSingle, runSnapshot, sectionGrant, sectionModule, silentIo, snapshotContext, worstOf };
|
package/lib/pkg/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { D as runMulti, Dt as endpointPath, Et as endpointMethod, G as composeReport, Gt as prefixedIo, Ht as isRateLimitError, J as parseRecipient, Jt as resolveCentralTargets, K as deliverArtifactReport, Kt as redactRanges, Lt as DEFAULT_API_VERSION, M as concludeRun, N as failRun, O as parseSettingsDoc, Ot as parseReposInput, Pt as discoverRepos, Rt as GitHubApi, St as sectionGrant, Ut as collectingIo, V as openReportChannel, Vt as isPermissionError, Wt as maskRegistry, Xt as parseRepoSlug, Yt as dedupeTargets, _t as SECTION_KEYS, at as describeRemoval, ct as allEndpoints, d as parseConfig, et as describeProblem, g as runSnapshot, h as concludeSnapshot, it as worstOf, j as concludeRender, jt as DEFAULT_DISCOVERY_FILTERS, k as readSettingsFile, lt as allGraphqlOps, mt as snapshotContext, nt as SectionSelection, pt as planContext, q as encryptReport, qt as silentIo, rt as RUN_RESULTS, st as SECTIONS, ut as sectionModule, vt as SettingsFile, w as readLayerFiles, y as runSingle, yt as UNDECLARED_POLICY_SECTIONS } from "./inputs-BOuUCdpl.js";
|
|
2
|
+
import { a as snapshotRepository, c as runRender, i as snapshotRepositories, n as checkRepository, o as validateSettings, r as mergeSettings, s as executeRun, t as applyRepository } from "./src-C2gb8QkD.js";
|
|
3
|
+
export { DEFAULT_API_VERSION, DEFAULT_DISCOVERY_FILTERS, GitHubApi, RUN_RESULTS, SECTIONS, SECTION_KEYS, SectionSelection, SettingsFile, UNDECLARED_POLICY_SECTIONS, allEndpoints, allGraphqlOps, applyRepository, checkRepository, collectingIo, composeReport, concludeRender, concludeRun, concludeSnapshot, dedupeTargets, deliverArtifactReport, describeProblem, describeRemoval, discoverRepos, encryptReport, endpointMethod, endpointPath, executeRun, failRun, isPermissionError, isRateLimitError, maskRegistry, mergeSettings, openReportChannel, parseConfig, parseRecipient, parseRepoSlug, parseReposInput, parseSettingsDoc, planContext, prefixedIo, readLayerFiles, readSettingsFile, redactRanges, resolveCentralTargets, runMulti, runRender, runSingle, runSnapshot, sectionGrant, sectionModule, silentIo, snapshotContext, snapshotRepositories, snapshotRepository, validateSettings, worstOf };
|