@theholocron/cli 5.0.0-alpha.53 → 5.0.0-alpha.531

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.
@@ -0,0 +1,441 @@
1
+ import { n as compose } from "./config-system-CB56SX2p.mjs";
2
+ import { DEFAULT_ORG } from "@theholocron/astromech";
3
+ // src/presets/capabilities/audit.ts
4
+ /**
5
+ * Adds bundle-size measuring (`measure:bundle`) + optional Knip (`lint:unused`) and
6
+ * Lighthouse (`test:perf`) auditing. Each task is marked `required` — `holocron setup`
7
+ * derives the branch-protection checks from the manifest.
8
+ * Requires: node
9
+ */
10
+ function audit({ knip = false, performance = false, lighthouseConfig } = {}) {
11
+ return {
12
+ id: "audit",
13
+ requires: ["node"],
14
+ tasks: [
15
+ {
16
+ name: "measure:bundle",
17
+ required: true
18
+ },
19
+ ...knip ? [{
20
+ name: "lint:unused",
21
+ required: true
22
+ }] : [],
23
+ ...performance ? [lighthouseConfig ? {
24
+ name: "test:perf",
25
+ required: true,
26
+ with: { "lighthouse-config": lighthouseConfig }
27
+ } : {
28
+ name: "test:perf",
29
+ required: true
30
+ }] : []
31
+ ]
32
+ };
33
+ }
34
+ // src/presets/constants.ts
35
+ /**
36
+ * The org's DNS zone as the presets ship it to a consumer repo that has no `.holocron/org.ts` of its own. A repo
37
+ * with an org area sets `domain` there instead and does not take it from a preset (both set is a `ConfigError`,
38
+ * #1878): destructure `{ repo, providers, org, docs }` from the preset, as the root `holocron.config.ts` does.
39
+ */
40
+ const DEFAULT_DOMAIN = "theholocron.dev";
41
+ /** The subdomain the engineering wiki is served from, under the org's zone. */
42
+ const WIKI_SUBDOMAIN = "wiki";
43
+ /**
44
+ * The wiki's hostname under a zone.
45
+ *
46
+ * @param domain - The org's zone; defaults to {@link DEFAULT_DOMAIN} when no config is in reach.
47
+ * @returns For example `wiki.theholocron.dev`.
48
+ */
49
+ function wikiHost(domain = DEFAULT_DOMAIN) {
50
+ return `${WIKI_SUBDOMAIN}.${domain}`;
51
+ }
52
+ // src/presets/capabilities/docs.ts
53
+ /**
54
+ * Adds a documentation site deployed to Cloudflare Pages with PR previews.
55
+ * Sets org/domain, wires Cloudflare + DNS providers and the Codecov `coverage` provider (which supplies the
56
+ * `codecov/patch` and `codecov/project` required statuses).
57
+ * Requires: node
58
+ */
59
+ function docs() {
60
+ return {
61
+ id: "docs",
62
+ requires: ["node"],
63
+ org: DEFAULT_ORG,
64
+ domain: DEFAULT_DOMAIN,
65
+ docs: {
66
+ build: "workflow",
67
+ https: true
68
+ },
69
+ providers: {
70
+ deployment: "cloudflare",
71
+ dns: "cloudflare",
72
+ workers: "cloudflare",
73
+ coverage: "codecov"
74
+ },
75
+ tasks: [{
76
+ name: "deploy-docs",
77
+ with: { preview: true }
78
+ }]
79
+ };
80
+ }
81
+ // src/presets/capabilities/monorepo.ts
82
+ /**
83
+ * Adjusts a repo to be a monorepo — sets uses_external_packages: true
84
+ * (workspaces pull in many deps). Compose after the base capabilities.
85
+ * Requires: node
86
+ *
87
+ * @example
88
+ * const preset = compose(node(), typecheck(), nextjs(), monorepo());
89
+ */
90
+ function monorepo() {
91
+ return {
92
+ id: "monorepo",
93
+ requires: ["node"],
94
+ repo: { properties: { uses_external_packages: true } }
95
+ };
96
+ }
97
+ // src/presets/capabilities/react.ts
98
+ /**
99
+ * Adds React/Storybook UI testing and browser runtime config.
100
+ * Contributes: secrets provider, browser runtime property, Storybook + interaction
101
+ * test jobs, `lint:unused` (Knip) + `test:perf` (Lighthouse), and the UI `extraRequiredChecks`.
102
+ * Requires: node, typecheck
103
+ *
104
+ * Pass `test` overrides to merge repo-specific options into the single `test:unit`
105
+ * entry so the sync tool sees one complete entry rather than two
106
+ * conflicting ones:
107
+ *
108
+ * @example
109
+ * compose(node(), typecheck(), react({ test: { "run-chromatic": { projects: [...] } } }))
110
+ */
111
+ function react({ test: testOverrides = {} } = {}) {
112
+ return {
113
+ id: "react",
114
+ requires: ["node", "typecheck"],
115
+ providers: { secrets: "github" },
116
+ repo: { properties: {
117
+ runtime_environment: "browser",
118
+ uses_external_packages: false
119
+ } },
120
+ tasks: [
121
+ "lint:unused",
122
+ {
123
+ name: "test:perf",
124
+ with: { "lighthouse-config": "lighthouse.config.cjs" }
125
+ },
126
+ {
127
+ name: "test:unit",
128
+ with: {
129
+ "run-unit": false,
130
+ "run-storybook": true,
131
+ "run-interaction": true,
132
+ ...testOverrides
133
+ }
134
+ }
135
+ ],
136
+ extraRequiredChecks: [
137
+ "Storybook Publish",
138
+ "UI Review",
139
+ "UI Tests",
140
+ "lhci/url/"
141
+ ]
142
+ };
143
+ }
144
+ // src/presets/capabilities/nextjs.ts
145
+ /**
146
+ * Bundle preset for Next.js application repos. Returns a Capability[] that
147
+ * includes react() so callers only need compose(node(), typecheck(), nextjs()).
148
+ * compose() deduplicates, so adding react() explicitly is harmless.
149
+ *
150
+ * Adds: Vercel deployment and Cypress user-flow tests on top of react().
151
+ * Requires (via react()): node, typecheck
152
+ *
153
+ * @example
154
+ * const preset = compose(node(), typecheck(), nextjs({ test: { "wait-on-url": "http://localhost:3000" } }));
155
+ */
156
+ function nextjs({ test: testOverrides = {} } = {}) {
157
+ const nextjsCapability = {
158
+ id: "nextjs",
159
+ requires: ["react"],
160
+ org: DEFAULT_ORG,
161
+ domain: DEFAULT_DOMAIN,
162
+ providers: { deployment: "vercel" },
163
+ tasks: [{
164
+ name: "test:unit",
165
+ with: {
166
+ "run-unit": false,
167
+ "run-storybook": true,
168
+ "run-interaction": true,
169
+ "run-user-flow": true,
170
+ ...testOverrides
171
+ }
172
+ }]
173
+ };
174
+ return [react(), nextjsCapability];
175
+ }
176
+ // src/presets/capabilities/node.ts
177
+ /**
178
+ * Base capability for all theholocron Node.js repositories.
179
+ * Contributes: GitHub source/CI/issues providers, strict branch protection,
180
+ * and the standard task set, spoken as flat task ids: the `lint` suite's leaves
181
+ * (`lint:code`, `lint:editorconfig`, `lint:markdown`, `lint:data`, `lint:commits`),
182
+ * `format`, `scan:secrets`, `test:unit`, `scan:code`, `mark-stale`,
183
+ * `greet`, `update-deps` and `label`. `annotate` (ReviewDog) is no longer in the set: `lint:code` annotates eslint and
184
+ * actionlint findings with problem matchers only where `ci/matchers/*.json` exist (the shared workflow skips them
185
+ * otherwise), so a repo lists `annotate` itself to keep ReviewDog, or provides its own matchers. A repo that got the
186
+ * `annotate` caller from this preset must delete that generated workflow by hand (#2338).
187
+ * The gating tasks (lint leaves, `format`, `scan:secrets`, `test:unit`) are marked
188
+ * `required` — `holocron setup` derives their branch-protection check contexts from
189
+ * the manifest. A repo overrides a task by listing it again; `compose()` also lets
190
+ * the old dotted name (`verification.unitTests`, …) override the id it became.
191
+ */
192
+ function node() {
193
+ return {
194
+ id: "node",
195
+ providers: {
196
+ source: "github",
197
+ ci: "github",
198
+ issues: ["github", { labels: {
199
+ inProgress: "status:in-progress",
200
+ inReview: "status:in-review"
201
+ } }]
202
+ },
203
+ repo: {
204
+ protection: "strict",
205
+ properties: {
206
+ lifecycle: "active",
207
+ open_source: true,
208
+ runtime_environment: "node",
209
+ uses_external_packages: true
210
+ }
211
+ },
212
+ tasks: [
213
+ {
214
+ name: "lint:code",
215
+ required: true
216
+ },
217
+ {
218
+ name: "lint:editorconfig",
219
+ required: true
220
+ },
221
+ {
222
+ name: "lint:markdown",
223
+ required: true
224
+ },
225
+ {
226
+ name: "format",
227
+ required: true
228
+ },
229
+ {
230
+ name: "lint:data",
231
+ required: true
232
+ },
233
+ {
234
+ name: "scan:secrets",
235
+ required: true
236
+ },
237
+ {
238
+ name: "lint:commits",
239
+ required: true
240
+ },
241
+ {
242
+ name: "test:unit",
243
+ required: true
244
+ },
245
+ "scan:code",
246
+ "mark-stale",
247
+ "greet",
248
+ "update-deps",
249
+ "label"
250
+ ]
251
+ };
252
+ }
253
+ // src/presets/capabilities/typecheck.ts
254
+ /**
255
+ * Adds TypeScript type-checking to a repo. Marked `required` — `holocron setup`
256
+ * derives the `Typecheck / Conclusion` branch-protection check from the manifest.
257
+ * Requires: node
258
+ */
259
+ function typecheck() {
260
+ return {
261
+ id: "typecheck",
262
+ requires: ["node"],
263
+ tasks: [{
264
+ name: "typecheck",
265
+ required: true
266
+ }]
267
+ };
268
+ }
269
+ // src/presets/capabilities/wiki.ts
270
+ /**
271
+ * Adds the Fern engineering wiki (`wiki.<domain>/<repo>`, the default zone from `presets/constants`) to a repo.
272
+ * Provisions docs/wiki/{decisions,standards,specifications}/ and wires the
273
+ * wiki CI workflow to publish on push to main.
274
+ *
275
+ * Compose with docsPreset() for repos that have engineering content to publish:
276
+ *
277
+ * ```ts
278
+ * const preset = compose(docsPreset(), wiki());
279
+ * ```
280
+ */
281
+ function wiki() {
282
+ return {
283
+ id: "wiki",
284
+ providers: {
285
+ wiki: ["fern", {
286
+ domain: wikiHost(),
287
+ fernOrg: "holocron"
288
+ }],
289
+ workers: "cloudflare"
290
+ },
291
+ tasks: ["publish-wiki"]
292
+ };
293
+ }
294
+ // src/presets/configs/docs.ts
295
+ /**
296
+ * Preset for theholocron repos that are TypeScript libraries AND publish a
297
+ * documentation site (e.g. configs, utils, holocron, clients).
298
+ *
299
+ * Includes the "audit / Conclusion" check in `extraRequiredChecks` so branch
300
+ * protection works for repos that add the audit workflow explicitly. The
301
+ * tasks are intentionally left repo-specific — add the ones you want as flat ids:
302
+ * tasks: [...preset.tasks, { name: "measure:bundle", required: true }, "lint:unused", ...]
303
+ *
304
+ * For docs-only sites without TypeScript source, use docsSitePreset() instead.
305
+ *
306
+ * @example
307
+ * const preset = docsPreset();
308
+ * export default defineConfig({
309
+ * ...preset,
310
+ * description: "...",
311
+ * homepage: "https://docs.theholocron.dev/my-lib/",
312
+ * repo: { ...preset.repo, name: "theholocron/my-lib", topics: ["typescript"] },
313
+ * tasks: [...preset.tasks, { name: "measure:bundle", required: true }, { name: "release", with: { "run-build": true } }, "sync-repo"],
314
+ * providers: { ...preset.providers, secrets: "github" },
315
+ * });
316
+ */
317
+ function docsPreset() {
318
+ return compose(node(), typecheck(), docs(), {
319
+ id: "audit-check",
320
+ requires: ["node"],
321
+ extraRequiredChecks: ["audit / Conclusion"]
322
+ });
323
+ }
324
+ /**
325
+ * Preset for theholocron repos that are documentation-only sites with no
326
+ * TypeScript source to check (e.g. skills, themes). No typecheck, no audit.
327
+ *
328
+ * @example
329
+ * const preset = docsSitePreset();
330
+ * export default defineConfig({
331
+ * ...preset,
332
+ * description: "...",
333
+ * repo: { ...preset.repo, name: "theholocron/my-site" },
334
+ * tasks: [...preset.tasks, { name: "release", with: { "run-build": false } }, "sync-repo"],
335
+ * providers: { ...preset.providers, secrets: "github" },
336
+ * });
337
+ */
338
+ function docsSitePreset() {
339
+ return compose(node(), docs());
340
+ }
341
+ // src/presets/configs/monorepo.ts
342
+ /**
343
+ * Wraps any composed preset with monorepo-specific overrides
344
+ * (sets uses_external_packages: true).
345
+ *
346
+ * For new configs, prefer: compose(node(), typecheck(), ..., monorepo())
347
+ *
348
+ * @example
349
+ * const preset = monorepo(nextjs());
350
+ */
351
+ function monorepoPreset(base) {
352
+ return {
353
+ ...base,
354
+ repo: {
355
+ ...base.repo,
356
+ properties: {
357
+ ...base.repo.properties,
358
+ uses_external_packages: true
359
+ }
360
+ }
361
+ };
362
+ }
363
+ // src/presets/configs/nextjs.ts
364
+ /**
365
+ * Preset for single-package Next.js application repos. Includes Vercel
366
+ * deployment, Lighthouse audit, Storybook + interaction + user-flow tests,
367
+ * and the derived Conclusion checks.
368
+ *
369
+ * @example
370
+ * const preset = nextjs({ test: { "wait-on-url": "http://localhost:3000", "run-chromatic": true } });
371
+ * export default defineConfig({
372
+ * ...preset,
373
+ * repo: { ...preset.repo, name: "theholocron/my-app", topics: ["nextjs"] },
374
+ * tasks: [
375
+ * ...preset.tasks,
376
+ * "sync-repo",
377
+ * { name: "deploy-docs", with: { storybook: [{ name: "" }] } },
378
+ * ],
379
+ * });
380
+ */
381
+ function nextjsPreset(options) {
382
+ return compose(node(), typecheck(), ...nextjs(options));
383
+ }
384
+ // src/presets/configs/node.ts
385
+ /**
386
+ * Base preset for theholocron Node.js repositories.
387
+ * Spread the returned fragments into `defineConfig()`.
388
+ *
389
+ * @example
390
+ * const preset = node();
391
+ * export default defineConfig({
392
+ * ...preset,
393
+ * repo: { ...preset.repo, name: "theholocron/my-lib" },
394
+ * tasks: [...preset.tasks, { name: "release", with: { "run-build": true } }],
395
+ * });
396
+ */
397
+ function nodePreset() {
398
+ return compose(node());
399
+ }
400
+ // src/presets/configs/react.ts
401
+ /**
402
+ * Preset for single-package React/Vite application repos. Includes Storybook,
403
+ * interaction tests, Knip + Lighthouse audit, and the UI extraRequiredChecks.
404
+ *
405
+ * Pass `test` overrides to merge repo-specific options (e.g. run-chromatic)
406
+ * into the single `test:unit` entry so the sync tool sees one complete entry:
407
+ *
408
+ * @example
409
+ * const preset = react({
410
+ * test: { "run-chromatic": { projects: [{ tokenName: "default", workingDir: "." }] } },
411
+ * });
412
+ * export default defineConfig({
413
+ * ...preset,
414
+ * repo: { ...preset.repo, name: "theholocron/my-app" },
415
+ * tasks: [...preset.tasks, "sync-repo", { name: "deploy-docs", with: { storybook: [{ name: "" }] } }],
416
+ * });
417
+ */
418
+ function reactPreset(options) {
419
+ return compose(node(), typecheck(), react(options));
420
+ }
421
+ // src/presets/index.ts
422
+ /** The capability factories, for composing your own preset with compose(). */
423
+ const withCapabilities = {
424
+ /** Bundle size auditing, with Knip and Lighthouse when asked. */
425
+ withAudit: audit,
426
+ /** A documentation site deployed to Cloudflare Pages with pull request previews. */
427
+ withDocs: docs,
428
+ /** Settings for a monorepo's workspaces. */
429
+ withMonorepo: monorepo,
430
+ /** A Next.js application: Vercel deployment and Cypress tests on top of React. */
431
+ withNextjs: nextjs,
432
+ /** The base library tasks for a Node project, without type-checking. */
433
+ withNode: node,
434
+ /** Adds React and Storybook UI testing. */
435
+ withReact: react,
436
+ /** Adds TypeScript type-checking. */
437
+ withTypecheck: typecheck,
438
+ /** Publishes the engineering wiki. */
439
+ withWiki: wiki
440
+ };
441
+ export { compose, docsPreset, docsSitePreset, monorepoPreset, nextjsPreset, nodePreset, reactPreset, withCapabilities };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.53",
3
+ "version": "5.0.0-alpha.531",
4
4
  "description": "The Holocron CLI - a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "keywords": [
6
6
  "cli",
@@ -10,12 +10,12 @@
10
10
  "orchestrator",
11
11
  "theholocron"
12
12
  ],
13
- "homepage": "https://github.com/theholocron/holocron/tree/main/packages/cli#readme",
13
+ "homepage": "https://docs.theholocron.dev/holocron/cli/",
14
14
  "bugs": "https://github.com/theholocron/holocron/issues",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/theholocron/holocron.git",
18
- "directory": "packages/cli"
18
+ "directory": "cli/cli"
19
19
  },
20
20
  "license": "MIT",
21
21
  "author": "Newton Koumantzelis",
@@ -31,6 +31,11 @@
31
31
  "types": "./dist/plugin/capabilities.d.mts",
32
32
  "import": "./dist/plugin/capabilities.mjs",
33
33
  "default": "./dist/plugin/capabilities.mjs"
34
+ },
35
+ "./presets": {
36
+ "types": "./dist/presets.d.mts",
37
+ "import": "./dist/presets.mjs",
38
+ "default": "./dist/presets.mjs"
34
39
  }
35
40
  },
36
41
  "bin": {
@@ -41,41 +46,48 @@
41
46
  ],
42
47
  "dependencies": {
43
48
  "@axiomhq/pino": "^2.0.0",
44
- "@inquirer/prompts": "^8.5.2",
45
- "@inquirer/search": "^4.3.3",
46
- "@napi-rs/keyring": "^1.3.0",
47
- "@sentry/node": "^10.70.0",
48
- "@theholocron/components-doc": "^1.6.0",
49
- "@theholocron/env-utils": "^1.6.0",
50
- "@theholocron/github-client": "^1.26.0",
51
- "@theholocron/http-client": "^1.25.0",
52
- "@theholocron/observability": "^0.4.0",
53
- "@theholocron/registry-doc": "^1.12.0",
54
- "chalk": "^6.0.0",
55
- "ora": "^9.4.1",
56
- "pino": "^10.3.1",
57
- "pino-pretty": "^13.1.3",
58
- "posthog-node": "^5.51.6",
49
+ "@inquirer/prompts": "^8.8.0",
50
+ "@inquirer/search": "^4.4.0",
51
+ "@napi-rs/keyring": "^2.1.2",
52
+ "@sentry/node": "^11.12.0",
53
+ "chalk": "^6.0.1",
54
+ "clipboardy": "^5.3.2",
55
+ "dotenv": "^18.0.10",
56
+ "ora": "^10.0.0",
57
+ "pino": "^10.4.0",
58
+ "pino-pretty": "^13.2.0",
59
+ "posthog-node": "^5.74.0",
60
+ "tsx": "4.23.15",
59
61
  "yargs": "^18.1.0",
60
- "@theholocron/astromech": "5.0.0-alpha.53",
61
- "@theholocron/datapad": "5.0.0-alpha.53"
62
+ "@theholocron/dagobah": "5.0.0-alpha.531",
63
+ "@theholocron/datapad": "5.0.0-alpha.531",
64
+ "@theholocron/env-utils": "^1.17.0-alpha.5",
65
+ "@theholocron/fs-utils": "^1.17.0-alpha.5",
66
+ "@theholocron/git-utils": "^1.17.0-alpha.5",
67
+ "@theholocron/astromech": "5.0.0-alpha.531",
68
+ "@theholocron/github-client": "^1.58.0-alpha.55",
69
+ "@theholocron/http-client": "^1.58.0-alpha.55",
70
+ "@theholocron/json-utils": "^1.17.0-alpha.5",
71
+ "@theholocron/misc-utils": "^1.17.0-alpha.5",
72
+ "@theholocron/kyber": "5.0.0-alpha.531",
73
+ "@theholocron/observability": "^0.7.0-alpha.6",
74
+ "@theholocron/pkg-utils": "^1.17.0-alpha.5"
62
75
  },
63
76
  "devDependencies": {
64
- "@theholocron/eslint-config": "^8.4.5",
65
- "@theholocron/tsconfig": "^8.4.5",
66
- "@theholocron/vitest-config": "^8.4.5",
67
77
  "@types/node": "^26",
68
78
  "@types/yargs": "^17.0.35",
69
- "@vitest/coverage-v8": "^4.1.11",
70
- "@vitest/eslint-plugin": "^1.6.27",
71
- "eslint": "^10.8.1",
72
- "eslint-plugin-n": "^18.3.0",
73
- "globals": "^17.11.0",
74
- "tsdown": "^0.22.14",
75
- "tsx": "4.23.12",
76
- "typescript": "^5.9.3",
77
- "vitest": "^4.1.11",
78
- "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.53"
79
+ "@vitest/coverage-v8": "^5.1.0",
80
+ "@vitest/eslint-plugin": "^1.6.28",
81
+ "eslint": "^10.15.0",
82
+ "eslint-plugin-n": "^18.5.0",
83
+ "globals": "^17.14.0",
84
+ "tsdown": "^0.23.7",
85
+ "typescript": "^6.0.3",
86
+ "vitest": "^5.1.0",
87
+ "@theholocron/eslint-config": "^8.9.0-alpha.22",
88
+ "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.22",
89
+ "@theholocron/vitest-config": "^8.9.0-alpha.22",
90
+ "@theholocron/tsconfig": "^8.9.0-alpha.22"
79
91
  },
80
92
  "engines": {
81
93
  "node": ">=22.0.0"
@@ -84,12 +96,13 @@
84
96
  "access": "public"
85
97
  },
86
98
  "scripts": {
87
- "delivery.build": "tsdown",
88
- "sourceQuality.staticAnalysis": "eslint .",
99
+ "build": "tsdown",
100
+ "lint:code": "eslint .",
89
101
  "start": "node ./dist/cli.mjs",
102
+ "start:source": "tsx --import ./src/source-run/register.ts ./src/cli/cli.ts",
103
+ "test:unit": "vitest run --coverage",
90
104
  "test:watch": "vitest",
91
- "verification.typeSafety": "tsc --noEmit",
92
- "verification.unitTests": "vitest run"
105
+ "typecheck": "tsc --noEmit"
93
106
  },
94
107
  "main": "./dist/index.mjs",
95
108
  "types": "./dist/index.d.mts"