@komatikai/trailhead 4.4.2 → 4.4.6

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 CHANGED
@@ -1,32 +1,42 @@
1
1
  # Trailhead CLI
2
2
 
3
- Interactive setup wizard and diagnostics for Trailhead. Generates `.trailhead.yml`, validates policy files, and compares configured CI check names against GitHub.
3
+ Interactive setup wizard and diagnostics for Trailhead. Generates `.trailhead.yml`, validates policy files, compares configured CI check names against GitHub, and runs the submission gate (`validate-submission`).
4
4
 
5
- ## Usage
5
+ ## Install (no build required)
6
+
7
+ The published npm package ships a **prebuilt JS bundle** (`dist/index.js`) plus **`@swc/core`** as a runtime dependency (one platform-native binding installed via npm optionalDependencies — ~25 MB download, not 135 MB). No repo clone or local build required.
8
+
9
+ ```bash
10
+ npx @komatikai/trailhead init # interactive — pick solo / team / agent / ops
11
+ npx @komatikai/trailhead init --preset solo
12
+ npx @komatikai/trailhead doctor --offline
13
+ ```
14
+
15
+ Pin a version for CI:
16
+
17
+ ```bash
18
+ npm install -D @komatikai/trailhead@4.4.6
19
+ npx trailhead validate-submission --input bundle.json
20
+ ```
21
+
22
+ Persona guide: [docs/getting-started.md](../docs/getting-started.md) · Presets: [presets/README.md](../presets/README.md)
23
+
24
+ ### Migrating from vendored `cli-dist`
25
+
26
+ Komatik agents and other repos that vendor `trailhead/cli-dist/` can replace the copy with an npm pin:
6
27
 
7
28
  ```bash
8
- npx @komatikai/trailhead init
9
- npx @komatikai/trailhead doctor
29
+ npm install -D @komatikai/trailhead@<tag>
30
+ # invoke: npx trailhead validate-submission …
10
31
  ```
11
32
 
33
+ Set `TRAILHEAD_CLI=$(npm root)/.bin/trailhead` (or `npx trailhead`) in shadow-compare harnesses instead of a repo-relative `cli/dist/index.js`.
34
+
35
+ ## Usage
36
+
12
37
  ### `trailhead init`
13
38
 
14
- No installation required. The wizard walks you through:
15
-
16
- 1. **Gate mode** — release-ready, advisory, or risk-only
17
- 2. **Branch model** — main-only or progressive promotion paths
18
- 3. **Required checks** — CI job names for release-ready contexts
19
- 4. **Sensitivity patterns** — which file paths are high/medium risk
20
- 5. **Thresholds** — risk and warn scores
21
- 6. **Freeze windows** — days and hours when deployments are blocked
22
- 7. **Environments** — per-environment threshold overrides
23
- 8. **Services** — monorepo service boundaries with path patterns
24
- 9. **Security gate** — Code Scanning alerts as a risk factor
25
- 10. **Canary tracking** — deploy outcome webhook type
26
- 11. **DORA metrics** — compute DORA-5 alongside gate evaluations
27
- 12. **Health checks** — URLs to probe before scoring
28
- 13. **OpenTelemetry** — OTLP endpoint for evaluation span export
29
- 14. **Evaluation store** — URL for persisting evaluations to a trend dashboard
39
+ Interactive wizard — no GitHub token required. Creates `.trailhead.yml` and `.github/workflows/trailhead.yml`.
30
40
 
31
41
  ### `trailhead doctor`
32
42
 
@@ -43,8 +53,6 @@ GITHUB_TOKEN=ghp_... trailhead doctor --repo owner/repo
43
53
  trailhead doctor --json
44
54
  ```
45
55
 
46
- Options:
47
-
48
56
  | Flag | Description |
49
57
  | --------------------- | -------------------------------------- |
50
58
  | `--path <dir>` | Directory to scan (default: cwd) |
@@ -56,30 +64,26 @@ Options:
56
64
 
57
65
  Exit code `0` when there are no errors; `1` when config is missing/invalid or structural errors are found. Warnings do not fail the command.
58
66
 
59
- ## Output (`init`)
67
+ ### `trailhead validate-submission`
60
68
 
61
- The wizard generates two files:
69
+ Runs the canonical Gate 1 engine on a JSON payload of files (used by komatik-agents and MCP). See `cli/src/index.ts` for input shape.
62
70
 
63
- - **`.trailhead.yml`** per-repo configuration
64
- - **`.github/workflows/trailhead.yml`** — GitHub Actions workflow with selected features
71
+ ## Development (this repo)
65
72
 
66
- ## Development
73
+ Source lives in `cli/src/`; shared modules are copied from `src/` at build time. **Do not commit `cli/dist/`** — CI and the release workflow build the bundle.
67
74
 
68
75
  ```bash
69
- cd cli
70
- npm install
71
- npm run build
72
- node dist/index.js doctor --offline --path ..
76
+ # From repo root
77
+ npm ci
78
+ npm run build:cli
79
+ node cli/dist/index.js doctor --offline --path .
80
+
81
+ # Typecheck CLI sources only
82
+ cd cli && npm ci && npm run typecheck
73
83
  ```
74
84
 
75
- The CLI copies shared validation modules from `src/` during prebuild. Build output goes to `cli/dist/` (gitignored — build before npm publish).
85
+ Bundle pipeline: `scripts/build-cli-bundle.mjs` `ncc` with `@swc/core` external (Action bundle still vendors `swc.*.node` via `copy-swc-bindings.mjs`).
76
86
 
77
87
  ## Publishing
78
88
 
79
- ```bash
80
- cd cli
81
- npm run build
82
- npm publish
83
- ```
84
-
85
- The package is published as `@komatikai/trailhead` on npm.
89
+ On tag push (`v*`), `.github/workflows/release.yml` runs `npm run build:cli`, `npm ci --omit=dev` in `cli/`, then publishes `@komatikai/trailhead`. The npm tarball ships `dist/` plus `@swc/core` in `dependencies` (platform binding resolved at install).