@theholocron/cli 5.0.0-alpha.25 → 5.0.0-alpha.250
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 +320 -56
- package/dist/cli.mjs +14014 -8103
- package/dist/cli.mjs.map +1 -1
- package/dist/compose-DFW8ftHT.mjs +209 -0
- package/dist/index-BD9zG_5Z.d.mts +1632 -0
- package/dist/index-BK5cc9WI.d.mts +626 -0
- package/dist/index.d.mts +102 -576
- package/dist/index.mjs +174 -252
- package/dist/plugin/capabilities.d.mts +2 -794
- package/dist/plugin/capabilities.mjs +15 -3
- package/dist/presets.d.mts +211 -0
- package/dist/presets.mjs +401 -0
- package/package.json +25 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProviderApiError } from "@theholocron/http-client";
|
|
2
|
-
|
|
2
|
+
// src/plugin/capabilities/capabilities.ts
|
|
3
3
|
const CARDINALITY = {
|
|
4
4
|
source: "single",
|
|
5
5
|
ci: "single",
|
|
@@ -16,6 +16,7 @@ const CARDINALITY = {
|
|
|
16
16
|
analytics: "many",
|
|
17
17
|
errors: "single",
|
|
18
18
|
logs: "single",
|
|
19
|
+
monitoring: "single",
|
|
19
20
|
wiki: "single",
|
|
20
21
|
workers: "single"
|
|
21
22
|
};
|
|
@@ -25,11 +26,22 @@ const CARDINALITY = {
|
|
|
25
26
|
* own requirements at call time.
|
|
26
27
|
*/
|
|
27
28
|
const REQUIRED_CAPABILITIES = [];
|
|
29
|
+
/**
|
|
30
|
+
* A provider could not finish an edit because the bot lacks a permission it should not keep. Carries what a person
|
|
31
|
+
* needs to give it for one run and take it away again, so `setup` can walk them through it.
|
|
32
|
+
*/
|
|
33
|
+
var ElevationRequiredError = class extends Error {
|
|
34
|
+
elevation;
|
|
35
|
+
name = "ElevationRequiredError";
|
|
36
|
+
constructor(message, elevation, options) {
|
|
37
|
+
super(message, options);
|
|
38
|
+
this.elevation = elevation;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
28
41
|
var WebhookVerificationError = class extends Error {
|
|
29
42
|
name = "WebhookVerificationError";
|
|
30
43
|
};
|
|
31
44
|
function isMulti(key) {
|
|
32
45
|
return CARDINALITY[key] === "many";
|
|
33
46
|
}
|
|
34
|
-
|
|
35
|
-
export { CARDINALITY, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti };
|
|
47
|
+
export { CARDINALITY, ElevationRequiredError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { n as Capability, r as ComposedPreset, t as compose } from "./index-BK5cc9WI.mjs";
|
|
2
|
+
interface AuditOptions {
|
|
3
|
+
/** Enable Knip unused-export analysis (default: false). */
|
|
4
|
+
knip?: boolean;
|
|
5
|
+
/** Enable Lighthouse performance audits (default: false). */
|
|
6
|
+
performance?: boolean;
|
|
7
|
+
/** Path to the Lighthouse config file. */
|
|
8
|
+
lighthouseConfig?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Adds BundleWatch + optional Knip and Lighthouse auditing. Marked `required` —
|
|
12
|
+
* `holocron setup` derives the `audit / Conclusion` branch-protection check
|
|
13
|
+
* from the manifest.
|
|
14
|
+
* Requires: node
|
|
15
|
+
*/
|
|
16
|
+
declare function audit({ knip, performance, lighthouseConfig }?: AuditOptions): Capability;
|
|
17
|
+
/**
|
|
18
|
+
* Adds a documentation site deployed to Cloudflare Pages with PR previews.
|
|
19
|
+
* Sets org/domain, wires Cloudflare + DNS providers, and adds the codecov
|
|
20
|
+
* `extraRequiredChecks` (enabled for all docs repos).
|
|
21
|
+
* Requires: node
|
|
22
|
+
*/
|
|
23
|
+
declare function docs(): Capability;
|
|
24
|
+
/**
|
|
25
|
+
* Adjusts a repo to be a monorepo — sets uses_external_packages: true
|
|
26
|
+
* (workspaces pull in many deps). Compose after the base capabilities.
|
|
27
|
+
* Requires: node
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const preset = compose(node(), typecheck(), nextjs(), monorepo());
|
|
31
|
+
*/
|
|
32
|
+
declare function monorepo(): Capability;
|
|
33
|
+
interface NextjsOptions {
|
|
34
|
+
/** Extra `with:` inputs merged into the `test` workflow entry. */
|
|
35
|
+
test?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Bundle preset for Next.js application repos. Returns a Capability[] that
|
|
39
|
+
* includes react() so callers only need compose(node(), typecheck(), nextjs()).
|
|
40
|
+
* compose() deduplicates, so adding react() explicitly is harmless.
|
|
41
|
+
*
|
|
42
|
+
* Adds: Vercel deployment and Cypress user-flow tests on top of react().
|
|
43
|
+
* Requires (via react()): node, typecheck
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const preset = compose(node(), typecheck(), nextjs({ test: { "wait-on-url": "http://localhost:3000" } }));
|
|
47
|
+
*/
|
|
48
|
+
declare function nextjs({ test: testOverrides }?: NextjsOptions): Capability[];
|
|
49
|
+
/**
|
|
50
|
+
* Base capability for all theholocron Node.js repositories.
|
|
51
|
+
* Contributes: GitHub source/CI/issues providers, strict branch protection,
|
|
52
|
+
* and the standard workflow set (lint, test, security, review, stale, greetings,
|
|
53
|
+
* dependencies, bookkeeping). Does NOT include typecheck — add that separately.
|
|
54
|
+
* The `lint` task carries the org linter list explicitly so every repo runs the
|
|
55
|
+
* same set (a repo can override with its own `{ name: "lint", linters: [...] }`).
|
|
56
|
+
* `lint` and `test` are marked `required` — `holocron setup` derives their
|
|
57
|
+
* `… / Conclusion` branch-protection check contexts from the manifest.
|
|
58
|
+
*/
|
|
59
|
+
declare function node(): Capability;
|
|
60
|
+
interface ReactOptions {
|
|
61
|
+
/** Extra `with:` inputs merged into the `test` workflow entry (e.g. run-chromatic). */
|
|
62
|
+
test?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Adds React/Storybook UI testing and browser runtime config.
|
|
66
|
+
* Contributes: secrets provider, browser runtime property, Storybook + interaction
|
|
67
|
+
* test jobs, audit with Knip + Lighthouse, and the UI `extraRequiredChecks`.
|
|
68
|
+
* Requires: node, typecheck
|
|
69
|
+
*
|
|
70
|
+
* Pass `test` overrides to merge repo-specific options into the single test
|
|
71
|
+
* workflow entry so the sync tool sees one complete entry rather than two
|
|
72
|
+
* conflicting ones:
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* compose(node(), typecheck(), react({ test: { "run-chromatic": { projects: [...] } } }))
|
|
76
|
+
*/
|
|
77
|
+
declare function react({ test: testOverrides }?: ReactOptions): Capability;
|
|
78
|
+
/**
|
|
79
|
+
* Adds TypeScript type-checking to a repo. Marked `required` — `holocron setup`
|
|
80
|
+
* derives the `Typecheck / Conclusion` branch-protection check from the manifest.
|
|
81
|
+
* Requires: node
|
|
82
|
+
*/
|
|
83
|
+
declare function typecheck(): Capability;
|
|
84
|
+
/**
|
|
85
|
+
* Adds the Fern engineering wiki (wiki.theholocron.dev/<repo>) to a repo.
|
|
86
|
+
* Provisions docs/wiki/{decisions,standards,specifications}/ and wires the
|
|
87
|
+
* wiki CI workflow to publish on push to main.
|
|
88
|
+
*
|
|
89
|
+
* Compose with docsPreset() for repos that have engineering content to publish:
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* const preset = compose(docsPreset(), wiki());
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare function wiki(): Capability;
|
|
96
|
+
/** Cloudflare account ID for the theholocron org. */
|
|
97
|
+
export declare const CLOUDFLARE_ACCOUNT_ID = "9c558af98664d13fc89b7e0a0d93d5a8";
|
|
98
|
+
type DocsPreset = ComposedPreset;
|
|
99
|
+
type DocsSitePreset = ComposedPreset;
|
|
100
|
+
/**
|
|
101
|
+
* Preset for theholocron repos that are TypeScript libraries AND publish a
|
|
102
|
+
* documentation site (e.g. configs, utils, holocron, clients).
|
|
103
|
+
*
|
|
104
|
+
* Includes the "audit / Conclusion" check in `extraRequiredChecks` so branch
|
|
105
|
+
* protection works for repos that add the audit workflow explicitly. The
|
|
106
|
+
* workflow itself is intentionally left repo-specific — add it with your own
|
|
107
|
+
* options:
|
|
108
|
+
* tasks: [...preset.tasks, { name: "audit", required: true }, ...]
|
|
109
|
+
* // or with overrides:
|
|
110
|
+
* tasks: [...preset.tasks, { name: "audit", required: true, with: { "run-knip": true } }, ...]
|
|
111
|
+
*
|
|
112
|
+
* For docs-only sites without TypeScript source, use docsSitePreset() instead.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const preset = docsPreset();
|
|
116
|
+
* export default defineConfig({
|
|
117
|
+
* ...preset,
|
|
118
|
+
* description: "...",
|
|
119
|
+
* homepage: "https://docs.theholocron.dev/my-lib/",
|
|
120
|
+
* repo: { ...preset.repo, name: "theholocron/my-lib", topics: ["typescript"] },
|
|
121
|
+
* tasks: [...preset.tasks, { name: "audit", required: true }, { name: "release", with: { "run-build": true } }, "sync"],
|
|
122
|
+
* providers: { ...preset.providers, secrets: "github" },
|
|
123
|
+
* });
|
|
124
|
+
*/
|
|
125
|
+
export declare function docsPreset(): DocsPreset;
|
|
126
|
+
/**
|
|
127
|
+
* Preset for theholocron repos that are documentation-only sites with no
|
|
128
|
+
* TypeScript source to check (e.g. skills, themes). No typecheck, no audit.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* const preset = docsSitePreset();
|
|
132
|
+
* export default defineConfig({
|
|
133
|
+
* ...preset,
|
|
134
|
+
* description: "...",
|
|
135
|
+
* repo: { ...preset.repo, name: "theholocron/my-site" },
|
|
136
|
+
* tasks: [...preset.tasks, { name: "release", with: { "run-build": false } }, "sync"],
|
|
137
|
+
* providers: { ...preset.providers, secrets: "github" },
|
|
138
|
+
* });
|
|
139
|
+
*/
|
|
140
|
+
export declare function docsSitePreset(): DocsSitePreset;
|
|
141
|
+
/**
|
|
142
|
+
* Wraps any composed preset with monorepo-specific overrides
|
|
143
|
+
* (sets uses_external_packages: true).
|
|
144
|
+
*
|
|
145
|
+
* For new configs, prefer: compose(node(), typecheck(), ..., monorepo())
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const preset = monorepo(nextjs());
|
|
149
|
+
*/
|
|
150
|
+
export declare function monorepoPreset(base: ComposedPreset): ComposedPreset;
|
|
151
|
+
/**
|
|
152
|
+
* Preset for single-package Next.js application repos. Includes Vercel
|
|
153
|
+
* deployment, Lighthouse audit, Storybook + interaction + user-flow tests,
|
|
154
|
+
* and the derived Conclusion checks.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* const preset = nextjs({ test: { "wait-on-url": "http://localhost:3000", "run-chromatic": true } });
|
|
158
|
+
* export default defineConfig({
|
|
159
|
+
* ...preset,
|
|
160
|
+
* repo: { ...preset.repo, name: "theholocron/my-app", topics: ["nextjs"] },
|
|
161
|
+
* tasks: [
|
|
162
|
+
* ...preset.tasks,
|
|
163
|
+
* "sync",
|
|
164
|
+
* { name: "deploy", with: { docs: true, storybook: [{ name: "" }] } },
|
|
165
|
+
* ],
|
|
166
|
+
* });
|
|
167
|
+
*/
|
|
168
|
+
export declare function nextjsPreset(options?: NextjsOptions): ComposedPreset;
|
|
169
|
+
/**
|
|
170
|
+
* Base preset for theholocron Node.js repositories.
|
|
171
|
+
* Spread the returned fragments into `defineConfig()`.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* const preset = node();
|
|
175
|
+
* export default defineConfig({
|
|
176
|
+
* ...preset,
|
|
177
|
+
* repo: { ...preset.repo, name: "theholocron/my-lib" },
|
|
178
|
+
* tasks: [...preset.tasks, { name: "release", with: { "run-build": true } }],
|
|
179
|
+
* });
|
|
180
|
+
*/
|
|
181
|
+
export declare function nodePreset(): ComposedPreset;
|
|
182
|
+
/**
|
|
183
|
+
* Preset for single-package React/Vite application repos. Includes Storybook,
|
|
184
|
+
* interaction tests, Knip + Lighthouse audit, and the UI extraRequiredChecks.
|
|
185
|
+
*
|
|
186
|
+
* Pass `test` overrides to merge repo-specific options (e.g. run-chromatic)
|
|
187
|
+
* into the single test workflow entry so the sync tool sees one complete entry:
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* const preset = react({
|
|
191
|
+
* test: { "run-chromatic": { projects: [{ tokenName: "default", workingDir: "." }] } },
|
|
192
|
+
* });
|
|
193
|
+
* export default defineConfig({
|
|
194
|
+
* ...preset,
|
|
195
|
+
* repo: { ...preset.repo, name: "theholocron/my-app" },
|
|
196
|
+
* tasks: [...preset.tasks, "sync", { name: "deploy", with: { docs: true, storybook: [{ name: "" }] } }],
|
|
197
|
+
* });
|
|
198
|
+
*/
|
|
199
|
+
export declare function reactPreset(options?: ReactOptions): ComposedPreset;
|
|
200
|
+
/** The capability factories, for composing your own preset with compose(). */
|
|
201
|
+
export declare const withCapabilities: {
|
|
202
|
+
withAudit: typeof audit;
|
|
203
|
+
withDocs: typeof docs;
|
|
204
|
+
withMonorepo: typeof monorepo;
|
|
205
|
+
withNextjs: typeof nextjs;
|
|
206
|
+
withNode: typeof node;
|
|
207
|
+
withReact: typeof react;
|
|
208
|
+
withTypecheck: typeof typecheck;
|
|
209
|
+
withWiki: typeof wiki;
|
|
210
|
+
};
|
|
211
|
+
export { type AuditOptions, type Capability, type ComposedPreset, type DocsPreset, type DocsSitePreset, type NextjsOptions, type ReactOptions, compose };
|
package/dist/presets.mjs
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { t as compose } from "./compose-DFW8ftHT.mjs";
|
|
2
|
+
// src/presets/capabilities/audit.ts
|
|
3
|
+
/**
|
|
4
|
+
* Adds BundleWatch + optional Knip and Lighthouse auditing. Marked `required` —
|
|
5
|
+
* `holocron setup` derives the `audit / Conclusion` branch-protection check
|
|
6
|
+
* from the manifest.
|
|
7
|
+
* Requires: node
|
|
8
|
+
*/
|
|
9
|
+
function audit({ knip = false, performance = false, lighthouseConfig } = {}) {
|
|
10
|
+
const withBlock = {};
|
|
11
|
+
if (knip) withBlock["run-knip"] = true;
|
|
12
|
+
if (performance) withBlock["run-performance"] = true;
|
|
13
|
+
if (lighthouseConfig) withBlock["lighthouse-config"] = lighthouseConfig;
|
|
14
|
+
return {
|
|
15
|
+
id: "audit",
|
|
16
|
+
requires: ["node"],
|
|
17
|
+
tasks: [Object.keys(withBlock).length > 0 ? {
|
|
18
|
+
name: "audit",
|
|
19
|
+
required: true,
|
|
20
|
+
with: withBlock
|
|
21
|
+
} : {
|
|
22
|
+
name: "audit",
|
|
23
|
+
required: true
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// src/presets/constants.ts
|
|
28
|
+
/** Cloudflare account ID for the theholocron org. */
|
|
29
|
+
const CLOUDFLARE_ACCOUNT_ID = "9c558af98664d13fc89b7e0a0d93d5a8";
|
|
30
|
+
// src/presets/capabilities/docs.ts
|
|
31
|
+
/**
|
|
32
|
+
* Adds a documentation site deployed to Cloudflare Pages with PR previews.
|
|
33
|
+
* Sets org/domain, wires Cloudflare + DNS providers, and adds the codecov
|
|
34
|
+
* `extraRequiredChecks` (enabled for all docs repos).
|
|
35
|
+
* Requires: node
|
|
36
|
+
*/
|
|
37
|
+
function docs() {
|
|
38
|
+
return {
|
|
39
|
+
id: "docs",
|
|
40
|
+
requires: ["node"],
|
|
41
|
+
org: "theholocron",
|
|
42
|
+
domain: "theholocron.dev",
|
|
43
|
+
docs: {
|
|
44
|
+
build: "workflow",
|
|
45
|
+
https: true
|
|
46
|
+
},
|
|
47
|
+
providers: {
|
|
48
|
+
deployment: ["cloudflare", { accountId: CLOUDFLARE_ACCOUNT_ID }],
|
|
49
|
+
dns: "cloudflare",
|
|
50
|
+
workers: ["cloudflare", { accountId: CLOUDFLARE_ACCOUNT_ID }]
|
|
51
|
+
},
|
|
52
|
+
tasks: [{
|
|
53
|
+
name: "deploy",
|
|
54
|
+
with: {
|
|
55
|
+
docs: true,
|
|
56
|
+
preview: true
|
|
57
|
+
}
|
|
58
|
+
}],
|
|
59
|
+
extraRequiredChecks: ["codecov/patch", "codecov/project"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// src/presets/capabilities/monorepo.ts
|
|
63
|
+
/**
|
|
64
|
+
* Adjusts a repo to be a monorepo — sets uses_external_packages: true
|
|
65
|
+
* (workspaces pull in many deps). Compose after the base capabilities.
|
|
66
|
+
* Requires: node
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const preset = compose(node(), typecheck(), nextjs(), monorepo());
|
|
70
|
+
*/
|
|
71
|
+
function monorepo() {
|
|
72
|
+
return {
|
|
73
|
+
id: "monorepo",
|
|
74
|
+
requires: ["node"],
|
|
75
|
+
repo: { properties: { uses_external_packages: true } }
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// src/presets/capabilities/react.ts
|
|
79
|
+
/**
|
|
80
|
+
* Adds React/Storybook UI testing and browser runtime config.
|
|
81
|
+
* Contributes: secrets provider, browser runtime property, Storybook + interaction
|
|
82
|
+
* test jobs, audit with Knip + Lighthouse, and the UI `extraRequiredChecks`.
|
|
83
|
+
* Requires: node, typecheck
|
|
84
|
+
*
|
|
85
|
+
* Pass `test` overrides to merge repo-specific options into the single test
|
|
86
|
+
* workflow entry so the sync tool sees one complete entry rather than two
|
|
87
|
+
* conflicting ones:
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* compose(node(), typecheck(), react({ test: { "run-chromatic": { projects: [...] } } }))
|
|
91
|
+
*/
|
|
92
|
+
function react({ test: testOverrides = {} } = {}) {
|
|
93
|
+
return {
|
|
94
|
+
id: "react",
|
|
95
|
+
requires: ["node", "typecheck"],
|
|
96
|
+
providers: { secrets: "github" },
|
|
97
|
+
repo: { properties: {
|
|
98
|
+
runtime_environment: "browser",
|
|
99
|
+
uses_external_packages: false
|
|
100
|
+
} },
|
|
101
|
+
tasks: [{
|
|
102
|
+
name: "audit",
|
|
103
|
+
with: {
|
|
104
|
+
"run-knip": true,
|
|
105
|
+
"run-performance": true,
|
|
106
|
+
"lighthouse-config": "lighthouse.config.cjs"
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
name: "test",
|
|
110
|
+
with: {
|
|
111
|
+
"run-unit": false,
|
|
112
|
+
"run-storybook": true,
|
|
113
|
+
"run-interaction": true,
|
|
114
|
+
...testOverrides
|
|
115
|
+
}
|
|
116
|
+
}],
|
|
117
|
+
extraRequiredChecks: [
|
|
118
|
+
"Storybook Publish",
|
|
119
|
+
"UI Review",
|
|
120
|
+
"UI Tests",
|
|
121
|
+
"lhci/url/"
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// src/presets/capabilities/nextjs.ts
|
|
126
|
+
/**
|
|
127
|
+
* Bundle preset for Next.js application repos. Returns a Capability[] that
|
|
128
|
+
* includes react() so callers only need compose(node(), typecheck(), nextjs()).
|
|
129
|
+
* compose() deduplicates, so adding react() explicitly is harmless.
|
|
130
|
+
*
|
|
131
|
+
* Adds: Vercel deployment and Cypress user-flow tests on top of react().
|
|
132
|
+
* Requires (via react()): node, typecheck
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* const preset = compose(node(), typecheck(), nextjs({ test: { "wait-on-url": "http://localhost:3000" } }));
|
|
136
|
+
*/
|
|
137
|
+
function nextjs({ test: testOverrides = {} } = {}) {
|
|
138
|
+
const nextjsCapability = {
|
|
139
|
+
id: "nextjs",
|
|
140
|
+
requires: ["react"],
|
|
141
|
+
org: "theholocron",
|
|
142
|
+
domain: "theholocron.dev",
|
|
143
|
+
providers: { deployment: "vercel" },
|
|
144
|
+
tasks: [{
|
|
145
|
+
name: "test",
|
|
146
|
+
with: {
|
|
147
|
+
"run-unit": false,
|
|
148
|
+
"run-storybook": true,
|
|
149
|
+
"run-interaction": true,
|
|
150
|
+
"run-user-flow": true,
|
|
151
|
+
...testOverrides
|
|
152
|
+
}
|
|
153
|
+
}]
|
|
154
|
+
};
|
|
155
|
+
return [react(), nextjsCapability];
|
|
156
|
+
}
|
|
157
|
+
// src/presets/capabilities/node.ts
|
|
158
|
+
/** The org-standard linter set — drives both CI super-linter and `holocron run lint`. */
|
|
159
|
+
const ORG_LINTERS = [
|
|
160
|
+
"eslint",
|
|
161
|
+
"prettier",
|
|
162
|
+
"yamllint",
|
|
163
|
+
"actionlint",
|
|
164
|
+
"gitleaks",
|
|
165
|
+
"editorconfig",
|
|
166
|
+
"commitlint",
|
|
167
|
+
"git-merge-conflict-markers"
|
|
168
|
+
];
|
|
169
|
+
/**
|
|
170
|
+
* Base capability for all theholocron Node.js repositories.
|
|
171
|
+
* Contributes: GitHub source/CI/issues providers, strict branch protection,
|
|
172
|
+
* and the standard workflow set (lint, test, security, review, stale, greetings,
|
|
173
|
+
* dependencies, bookkeeping). Does NOT include typecheck — add that separately.
|
|
174
|
+
* The `lint` task carries the org linter list explicitly so every repo runs the
|
|
175
|
+
* same set (a repo can override with its own `{ name: "lint", linters: [...] }`).
|
|
176
|
+
* `lint` and `test` are marked `required` — `holocron setup` derives their
|
|
177
|
+
* `… / Conclusion` branch-protection check contexts from the manifest.
|
|
178
|
+
*/
|
|
179
|
+
function node() {
|
|
180
|
+
return {
|
|
181
|
+
id: "node",
|
|
182
|
+
providers: {
|
|
183
|
+
source: "github",
|
|
184
|
+
ci: "github",
|
|
185
|
+
issues: ["github", { labels: {
|
|
186
|
+
inProgress: "status:in-progress",
|
|
187
|
+
inReview: "status:in-review"
|
|
188
|
+
} }]
|
|
189
|
+
},
|
|
190
|
+
repo: {
|
|
191
|
+
protection: "strict",
|
|
192
|
+
properties: {
|
|
193
|
+
lifecycle: "active",
|
|
194
|
+
open_source: true,
|
|
195
|
+
runtime_environment: "node",
|
|
196
|
+
uses_external_packages: true
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
tasks: [
|
|
200
|
+
{
|
|
201
|
+
name: "lint",
|
|
202
|
+
required: true,
|
|
203
|
+
linters: ORG_LINTERS
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "test",
|
|
207
|
+
required: true
|
|
208
|
+
},
|
|
209
|
+
"security",
|
|
210
|
+
"review",
|
|
211
|
+
"stale",
|
|
212
|
+
"greetings",
|
|
213
|
+
"dependencies",
|
|
214
|
+
"bookkeeping"
|
|
215
|
+
]
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
// src/presets/capabilities/typecheck.ts
|
|
219
|
+
/**
|
|
220
|
+
* Adds TypeScript type-checking to a repo. Marked `required` — `holocron setup`
|
|
221
|
+
* derives the `Typecheck / Conclusion` branch-protection check from the manifest.
|
|
222
|
+
* Requires: node
|
|
223
|
+
*/
|
|
224
|
+
function typecheck() {
|
|
225
|
+
return {
|
|
226
|
+
id: "typecheck",
|
|
227
|
+
requires: ["node"],
|
|
228
|
+
tasks: [{
|
|
229
|
+
name: "typecheck",
|
|
230
|
+
required: true
|
|
231
|
+
}]
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
// src/presets/capabilities/wiki.ts
|
|
235
|
+
/**
|
|
236
|
+
* Adds the Fern engineering wiki (wiki.theholocron.dev/<repo>) to a repo.
|
|
237
|
+
* Provisions docs/wiki/{decisions,standards,specifications}/ and wires the
|
|
238
|
+
* wiki CI workflow to publish on push to main.
|
|
239
|
+
*
|
|
240
|
+
* Compose with docsPreset() for repos that have engineering content to publish:
|
|
241
|
+
*
|
|
242
|
+
* ```ts
|
|
243
|
+
* const preset = compose(docsPreset(), wiki());
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
function wiki() {
|
|
247
|
+
return {
|
|
248
|
+
id: "wiki",
|
|
249
|
+
providers: {
|
|
250
|
+
wiki: ["fern", {
|
|
251
|
+
domain: "wiki.theholocron.dev",
|
|
252
|
+
fernOrg: "holocron"
|
|
253
|
+
}],
|
|
254
|
+
workers: ["cloudflare", { accountId: "9c558af98664d13fc89b7e0a0d93d5a8" }]
|
|
255
|
+
},
|
|
256
|
+
tasks: ["wiki"]
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
// src/presets/configs/docs.ts
|
|
260
|
+
/**
|
|
261
|
+
* Preset for theholocron repos that are TypeScript libraries AND publish a
|
|
262
|
+
* documentation site (e.g. configs, utils, holocron, clients).
|
|
263
|
+
*
|
|
264
|
+
* Includes the "audit / Conclusion" check in `extraRequiredChecks` so branch
|
|
265
|
+
* protection works for repos that add the audit workflow explicitly. The
|
|
266
|
+
* workflow itself is intentionally left repo-specific — add it with your own
|
|
267
|
+
* options:
|
|
268
|
+
* tasks: [...preset.tasks, { name: "audit", required: true }, ...]
|
|
269
|
+
* // or with overrides:
|
|
270
|
+
* tasks: [...preset.tasks, { name: "audit", required: true, with: { "run-knip": true } }, ...]
|
|
271
|
+
*
|
|
272
|
+
* For docs-only sites without TypeScript source, use docsSitePreset() instead.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* const preset = docsPreset();
|
|
276
|
+
* export default defineConfig({
|
|
277
|
+
* ...preset,
|
|
278
|
+
* description: "...",
|
|
279
|
+
* homepage: "https://docs.theholocron.dev/my-lib/",
|
|
280
|
+
* repo: { ...preset.repo, name: "theholocron/my-lib", topics: ["typescript"] },
|
|
281
|
+
* tasks: [...preset.tasks, { name: "audit", required: true }, { name: "release", with: { "run-build": true } }, "sync"],
|
|
282
|
+
* providers: { ...preset.providers, secrets: "github" },
|
|
283
|
+
* });
|
|
284
|
+
*/
|
|
285
|
+
function docsPreset() {
|
|
286
|
+
return compose(node(), typecheck(), docs(), {
|
|
287
|
+
id: "audit-check",
|
|
288
|
+
requires: ["node"],
|
|
289
|
+
extraRequiredChecks: ["audit / Conclusion"]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Preset for theholocron repos that are documentation-only sites with no
|
|
294
|
+
* TypeScript source to check (e.g. skills, themes). No typecheck, no audit.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* const preset = docsSitePreset();
|
|
298
|
+
* export default defineConfig({
|
|
299
|
+
* ...preset,
|
|
300
|
+
* description: "...",
|
|
301
|
+
* repo: { ...preset.repo, name: "theholocron/my-site" },
|
|
302
|
+
* tasks: [...preset.tasks, { name: "release", with: { "run-build": false } }, "sync"],
|
|
303
|
+
* providers: { ...preset.providers, secrets: "github" },
|
|
304
|
+
* });
|
|
305
|
+
*/
|
|
306
|
+
function docsSitePreset() {
|
|
307
|
+
return compose(node(), docs());
|
|
308
|
+
}
|
|
309
|
+
// src/presets/configs/monorepo.ts
|
|
310
|
+
/**
|
|
311
|
+
* Wraps any composed preset with monorepo-specific overrides
|
|
312
|
+
* (sets uses_external_packages: true).
|
|
313
|
+
*
|
|
314
|
+
* For new configs, prefer: compose(node(), typecheck(), ..., monorepo())
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* const preset = monorepo(nextjs());
|
|
318
|
+
*/
|
|
319
|
+
function monorepoPreset(base) {
|
|
320
|
+
return {
|
|
321
|
+
...base,
|
|
322
|
+
repo: {
|
|
323
|
+
...base.repo,
|
|
324
|
+
properties: {
|
|
325
|
+
...base.repo.properties,
|
|
326
|
+
uses_external_packages: true
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
// src/presets/configs/nextjs.ts
|
|
332
|
+
/**
|
|
333
|
+
* Preset for single-package Next.js application repos. Includes Vercel
|
|
334
|
+
* deployment, Lighthouse audit, Storybook + interaction + user-flow tests,
|
|
335
|
+
* and the derived Conclusion checks.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* const preset = nextjs({ test: { "wait-on-url": "http://localhost:3000", "run-chromatic": true } });
|
|
339
|
+
* export default defineConfig({
|
|
340
|
+
* ...preset,
|
|
341
|
+
* repo: { ...preset.repo, name: "theholocron/my-app", topics: ["nextjs"] },
|
|
342
|
+
* tasks: [
|
|
343
|
+
* ...preset.tasks,
|
|
344
|
+
* "sync",
|
|
345
|
+
* { name: "deploy", with: { docs: true, storybook: [{ name: "" }] } },
|
|
346
|
+
* ],
|
|
347
|
+
* });
|
|
348
|
+
*/
|
|
349
|
+
function nextjsPreset(options) {
|
|
350
|
+
return compose(node(), typecheck(), ...nextjs(options));
|
|
351
|
+
}
|
|
352
|
+
// src/presets/configs/node.ts
|
|
353
|
+
/**
|
|
354
|
+
* Base preset for theholocron Node.js repositories.
|
|
355
|
+
* Spread the returned fragments into `defineConfig()`.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* const preset = node();
|
|
359
|
+
* export default defineConfig({
|
|
360
|
+
* ...preset,
|
|
361
|
+
* repo: { ...preset.repo, name: "theholocron/my-lib" },
|
|
362
|
+
* tasks: [...preset.tasks, { name: "release", with: { "run-build": true } }],
|
|
363
|
+
* });
|
|
364
|
+
*/
|
|
365
|
+
function nodePreset() {
|
|
366
|
+
return compose(node());
|
|
367
|
+
}
|
|
368
|
+
// src/presets/configs/react.ts
|
|
369
|
+
/**
|
|
370
|
+
* Preset for single-package React/Vite application repos. Includes Storybook,
|
|
371
|
+
* interaction tests, Knip + Lighthouse audit, and the UI extraRequiredChecks.
|
|
372
|
+
*
|
|
373
|
+
* Pass `test` overrides to merge repo-specific options (e.g. run-chromatic)
|
|
374
|
+
* into the single test workflow entry so the sync tool sees one complete entry:
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* const preset = react({
|
|
378
|
+
* test: { "run-chromatic": { projects: [{ tokenName: "default", workingDir: "." }] } },
|
|
379
|
+
* });
|
|
380
|
+
* export default defineConfig({
|
|
381
|
+
* ...preset,
|
|
382
|
+
* repo: { ...preset.repo, name: "theholocron/my-app" },
|
|
383
|
+
* tasks: [...preset.tasks, "sync", { name: "deploy", with: { docs: true, storybook: [{ name: "" }] } }],
|
|
384
|
+
* });
|
|
385
|
+
*/
|
|
386
|
+
function reactPreset(options) {
|
|
387
|
+
return compose(node(), typecheck(), react(options));
|
|
388
|
+
}
|
|
389
|
+
// src/presets/index.ts
|
|
390
|
+
/** The capability factories, for composing your own preset with compose(). */
|
|
391
|
+
const withCapabilities = {
|
|
392
|
+
withAudit: audit,
|
|
393
|
+
withDocs: docs,
|
|
394
|
+
withMonorepo: monorepo,
|
|
395
|
+
withNextjs: nextjs,
|
|
396
|
+
withNode: node,
|
|
397
|
+
withReact: react,
|
|
398
|
+
withTypecheck: typecheck,
|
|
399
|
+
withWiki: wiki
|
|
400
|
+
};
|
|
401
|
+
export { CLOUDFLARE_ACCOUNT_ID, compose, docsPreset, docsSitePreset, monorepoPreset, nextjsPreset, nodePreset, reactPreset, withCapabilities };
|