rapidkit 0.33.2 → 0.34.0
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 +69 -8
- package/contracts/pipeline-last-run.v1.json +80 -0
- package/dist/analyze-SVYRQNLO.js +1 -0
- package/dist/autopilot-release-LBKCP73F.js +1 -0
- package/dist/{chunk-GAHPNUQJ.js → chunk-2PGMJSO5.js} +6 -6
- package/dist/{workspace-F56NUNVG.js → chunk-3TBSWOTY.js} +13 -13
- package/dist/{chunk-7OGOVP5U.js → chunk-IATULVMR.js} +1 -1
- package/dist/chunk-ILY6QARY.js +9 -0
- package/dist/chunk-JIECGCLV.js +4 -0
- package/dist/chunk-QUNCXYYK.js +1 -0
- package/dist/chunk-RGXFDBYB.js +7 -0
- package/dist/{doctor-T6F2I6VO.js → chunk-YV7IQDBM.js} +26 -26
- package/dist/{create-ZUS2NTVR.js → create-BO2I3ESU.js} +1 -1
- package/dist/doctor-3SBEO7XU.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +115 -118
- package/dist/pipeline-VUQ6AXKF.js +5 -0
- package/dist/workspace-AG2MQFTY.js +1 -0
- package/dist/{workspace-foundation-FJC2TO3N.js → workspace-foundation-G74V6K4U.js} +1 -1
- package/dist/workspace-run-EDM3SUPA.js +1 -0
- package/package.json +4 -3
- package/dist/analyze-Q2XAYVUQ.js +0 -9
- package/dist/autopilot-release-OTGKHLH7.js +0 -7
- package/dist/workspace-run-QATZ6ED2.js +0 -1
- /package/dist/{chunk-F5CNV47O.js → chunk-SAIWD6VM.js} +0 -0
package/README.md
CHANGED
|
@@ -30,9 +30,48 @@ RapidKit is designed around the workspace as the operational boundary.
|
|
|
30
30
|
- Projects are discovered and managed inside that workspace boundary.
|
|
31
31
|
- Wrapper-owned commands stay in the npm CLI; runtime-specific execution is delegated only when appropriate.
|
|
32
32
|
- Release evidence is written into `.rapidkit/reports/` so CI, docs, and local workflows use the same contract surface.
|
|
33
|
+
- A single governance loop connects bootstrap, sync, doctor, analyze, readiness, and autopilot without requiring the VS Code extension.
|
|
33
34
|
|
|
34
35
|
This layout keeps workspace setup deterministic, makes cross-project orchestration explicit, and avoids drifting behavior between the CLI and the core runtime.
|
|
35
36
|
|
|
37
|
+
## Governance Pipeline (CLI-native)
|
|
38
|
+
|
|
39
|
+
RapidKit ships a wrapper-owned release loop for CI and local pre-merge checks:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
bootstrap → workspace sync → doctor → analyze → readiness → autopilot
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Run the full loop in one command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx rapidkit pipeline --json --strict
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or run stages individually:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx rapidkit bootstrap --profile polyglot
|
|
55
|
+
npx rapidkit workspace sync --json
|
|
56
|
+
npx rapidkit doctor workspace --json --ci
|
|
57
|
+
npx rapidkit analyze --json --strict
|
|
58
|
+
npx rapidkit readiness --json --strict
|
|
59
|
+
npx rapidkit autopilot release --mode audit --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Evidence artifacts:
|
|
63
|
+
|
|
64
|
+
| Stage | Report path |
|
|
65
|
+
| ---------- | ----------- |
|
|
66
|
+
| Pipeline | `.rapidkit/reports/pipeline-last-run.json` |
|
|
67
|
+
| Doctor | `.rapidkit/reports/doctor-last-run.json` |
|
|
68
|
+
| Analyze | `.rapidkit/reports/analyze-last-run.json` |
|
|
69
|
+
| Readiness | `.rapidkit/reports/release-readiness-last-run.json` |
|
|
70
|
+
| Autopilot | `.rapidkit/reports/autopilot-release-last-run.json` |
|
|
71
|
+
| Contract verify (CLI fallback) | `.rapidkit/reports/workspace-contract-verify-last-run.json` |
|
|
72
|
+
|
|
73
|
+
The verify gate accepts extension `verify-pack-contract` artifacts **or** runs `workspace contract verify` inline when no extension artifact is present. Use `--skip-verify` on `readiness` / `pipeline` when verify is handled elsewhere.
|
|
74
|
+
|
|
36
75
|
## RapidKit CLI in the Workspai Ecosystem
|
|
37
76
|
|
|
38
77
|
The `rapidkit` npm package remains the official RapidKit CLI.
|
|
@@ -134,21 +173,31 @@ npx rapidkit create project dotnet.webapi.clean my-dotnet --yes --skip-install
|
|
|
134
173
|
```bash
|
|
135
174
|
npx rapidkit create # Prompts: workspace | project
|
|
136
175
|
npx rapidkit create workspace <name> [--profile <profile>] [--author <name>] [--yes]
|
|
137
|
-
npx rapidkit bootstrap [--profile <profile>] [--json]
|
|
176
|
+
npx rapidkit bootstrap [--profile <profile>] [--json] [--compliance-only]
|
|
138
177
|
npx rapidkit setup <python|node|go|java|dotnet> [--warm-deps]
|
|
178
|
+
npx rapidkit pipeline [--json] [--strict] [--skip-verify] [--skip-analyze] [--skip-autopilot] [--autopilot-mode <audit|safe-fix|enforce>]
|
|
139
179
|
npx rapidkit analyze [--workspace <path>] [--json] [--strict] [--output <file>]
|
|
140
|
-
npx rapidkit readiness [--json] [--strict]
|
|
180
|
+
npx rapidkit readiness [--json] [--strict] [--skip-verify]
|
|
141
181
|
npx rapidkit autopilot release [--mode <audit|safe-fix|enforce>] [--json] [--output <file>] [--since <ref>] [--parallel] [--max-workers <n>]
|
|
142
182
|
```
|
|
143
183
|
|
|
144
|
-
Recommended for CI:
|
|
184
|
+
Recommended for CI:
|
|
145
185
|
|
|
146
186
|
```bash
|
|
187
|
+
npx rapidkit pipeline --json --strict
|
|
188
|
+
# or the release gate alone:
|
|
189
|
+
npx rapidkit autopilot release --mode enforce --json --output .rapidkit/reports/autopilot-release.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`bootstrap --json --compliance-only` runs compliance checks only (skips init) for machine-readable CI gates. Default `bootstrap --json` still runs init after compliance checks.
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npx rapidkit workspace sync [--json]
|
|
147
196
|
npx rapidkit workspace policy show
|
|
148
197
|
npx rapidkit workspace policy set <key> <value>
|
|
149
198
|
npx rapidkit doctor
|
|
150
|
-
npx rapidkit doctor workspace [--fix] [--plan] [--apply]
|
|
151
|
-
npx rapidkit doctor project [--fix] [--plan] [--apply]
|
|
199
|
+
npx rapidkit doctor workspace [--json] [--strict] [--ci] [--fix] [--plan] [--apply]
|
|
200
|
+
npx rapidkit doctor project [--json] [--strict] [--ci] [--fix] [--plan] [--apply]
|
|
152
201
|
npx rapidkit workspace list # Display all workspaces created on this system
|
|
153
202
|
npx rapidkit workspace foundation ensure [--force] [--json]
|
|
154
203
|
npx rapidkit workspace share [--output <file>] [--include-paths] [--no-doctor]
|
|
@@ -361,24 +410,34 @@ RapidKit keeps the wrapper boundary explicit so users know which layer owns each
|
|
|
361
410
|
| `create workspace`, `workspace`, `cache`, `mirror`, `infra` | RapidKit wrapper | Platform-level orchestration |
|
|
362
411
|
| `init` | Wrapper orchestrated | Project init in project dirs; full-init alias at workspace root |
|
|
363
412
|
| `dev`, `test`, `build`, `start` | Runtime aware | Delegates to the active project/runtime when available |
|
|
364
|
-
| `readiness` | Wrapper release gate |
|
|
365
|
-
| `
|
|
413
|
+
| `readiness` | Wrapper release gate | Env + doctor + analyze + verify + dependency gates (`--json`, `--strict`, `--skip-verify`) |
|
|
414
|
+
| `pipeline` | Wrapper orchestrator | End-to-end governance loop: sync → doctor → analyze → readiness → autopilot; writes `pipeline-last-run.json` |
|
|
415
|
+
| `autopilot release` | Wrapper orchestrator | Runs doctor/analyze/readiness/remediation/workspace-run gates and emits release verdict evidence |
|
|
366
416
|
| `import` | Workspace ingestion | Imports local folders or git backends with rollback-safe sync behavior |
|
|
367
417
|
| `snapshot` | Workspace recovery | Creates/list/restores metadata or full workspace snapshots with destructive-operation guards |
|
|
368
418
|
| `project archive/restore/delete` | Project lifecycle | Archives by default, restores archived projects, requires exact confirmation for permanent delete, and creates safety snapshots |
|
|
369
419
|
| `doctor` | Wrapper system check | Checks host prerequisites by default |
|
|
370
|
-
| `doctor workspace` | Workspace health | Full workspace scan with project-level details and fixes
|
|
420
|
+
| `doctor workspace` | Workspace health | Full workspace scan with project-level details, CI exit codes (`--strict`, `--ci`), and fixes |
|
|
371
421
|
| `doctor project` | Project health | Current project (or nearest parent) diagnostics with project evidence and scoped fixes |
|
|
372
422
|
| `workspace run` | Workspace orchestrator | Stage execution across discovered projects with optional affected-only, blast-radius expansion, and policy-gated pre-checks |
|
|
373
423
|
| `infra` | Workspace sidecar | Contract-driven local infra discovery, compose generation, and Docker lifecycle (`plan`, `up`, `down`, `status`) |
|
|
374
424
|
|
|
375
425
|
Use `npx rapidkit doctor` for a quick host pre-flight, `npx rapidkit doctor project` for a service-level check, and `npx rapidkit doctor workspace` for the full workspace picture.
|
|
426
|
+
Use `npx rapidkit pipeline --json --strict` to run the full governance loop and gate CI on a single exit code.
|
|
376
427
|
Use `npx rapidkit analyze --json` to generate CI-friendly workspace health evidence and save it under `.rapidkit/reports/`.
|
|
428
|
+
Use `npx rapidkit doctor workspace --ci` for CI-friendly exit codes (1 = errors, 2 = warnings).
|
|
377
429
|
Use `npx rapidkit doctor workspace --plan` or `npx rapidkit doctor project --plan` to preview remediation safely.
|
|
378
430
|
Use `npx rapidkit doctor workspace --apply` or `npx rapidkit doctor project --apply` for non-interactive remediation runs.
|
|
379
431
|
Use `npx rapidkit readiness` when you need machine-readable release evidence or strict CI gating.
|
|
432
|
+
Use `npx rapidkit readiness --skip-verify` when verify is handled by extension/CI separately.
|
|
380
433
|
Use `npx rapidkit autopilot release` to run an end-to-end pre-merge release gate in one command.
|
|
381
434
|
|
|
435
|
+
### Doctor workspace CI exit codes
|
|
436
|
+
|
|
437
|
+
- `npx rapidkit doctor workspace --strict` exits `1` when health score reports errors **or** warnings.
|
|
438
|
+
- `npx rapidkit doctor workspace --ci` exits `1` on errors and `2` on warnings only (errors take precedence).
|
|
439
|
+
- Without `--strict` or `--ci`, doctor reports findings but exits `0` (backward compatible).
|
|
440
|
+
|
|
382
441
|
### Doctor workspace fix behavior
|
|
383
442
|
|
|
384
443
|
- `npx rapidkit doctor workspace` reuses cached project scans when valid and refreshes evidence under `.rapidkit/reports/doctor-last-run.json`.
|
|
@@ -725,6 +784,8 @@ npx rapidkit --version
|
|
|
725
784
|
| `python3` not found | `python3 --version` | Install Python 3.10+ and re-run `npx rapidkit create workspace ...` |
|
|
726
785
|
| `setup --warm-deps` skipped | Check for `package.json` / `go.mod` in current dir | Run from the target project directory |
|
|
727
786
|
| strict policy blocks command | Review `.rapidkit/policies.yml` | Set policy intentionally via `npx rapidkit workspace policy set ...` |
|
|
787
|
+
| `npm audit fix --force` downgrades tsup | Check `package.json` — tsup should stay `^8.5.1` | **Do not use `--force`**. Run `npm install` after restoring tsup; use `esbuild` override if audit still flags dev deps |
|
|
788
|
+
| Security Audit CI fails on esbuild | Run `npm audit --audit-level=moderate` locally | Keep `tsup@^8.5.1` and `"overrides": { "esbuild": "^0.28.1" }` in `package.json` |
|
|
728
789
|
| doctor output seems stale | Check report timestamp in `.rapidkit/reports/` | Re-run `npx rapidkit doctor workspace` or `npx rapidkit doctor project` |
|
|
729
790
|
| affected run scope seems wrong | Verify git ref | Use `--since <ref>` explicitly |
|
|
730
791
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://getrapidkit.com/schemas/pipeline-last-run.v1.json",
|
|
4
|
+
"title": "RapidKit Governance Pipeline Last Run",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"schemaVersion",
|
|
8
|
+
"generatedAt",
|
|
9
|
+
"workspacePath",
|
|
10
|
+
"summary",
|
|
11
|
+
"stages",
|
|
12
|
+
"blockingReasons",
|
|
13
|
+
"artifacts"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"schemaVersion": {
|
|
17
|
+
"const": "rapidkit-pipeline-v1"
|
|
18
|
+
},
|
|
19
|
+
"generatedAt": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "date-time"
|
|
22
|
+
},
|
|
23
|
+
"workspacePath": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"minLength": 1
|
|
26
|
+
},
|
|
27
|
+
"summary": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": ["verdict", "exitCode", "stagesPassed", "stagesWarn", "stagesFailed"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"verdict": {
|
|
32
|
+
"enum": ["ready", "needs-attention", "blocked"]
|
|
33
|
+
},
|
|
34
|
+
"exitCode": {
|
|
35
|
+
"enum": [0, 1, 2, 3]
|
|
36
|
+
},
|
|
37
|
+
"stagesPassed": { "type": "integer", "minimum": 0 },
|
|
38
|
+
"stagesWarn": { "type": "integer", "minimum": 0 },
|
|
39
|
+
"stagesFailed": { "type": "integer", "minimum": 0 }
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
},
|
|
43
|
+
"stages": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["name", "status", "durationMs", "summary"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"name": {
|
|
50
|
+
"enum": ["sync", "doctor", "analyze", "readiness", "autopilot"]
|
|
51
|
+
},
|
|
52
|
+
"status": {
|
|
53
|
+
"enum": ["pass", "warn", "fail", "skipped"]
|
|
54
|
+
},
|
|
55
|
+
"durationMs": { "type": "integer", "minimum": 0 },
|
|
56
|
+
"summary": { "type": "string" },
|
|
57
|
+
"exitCode": { "type": "integer" },
|
|
58
|
+
"evidencePath": { "type": "string" }
|
|
59
|
+
},
|
|
60
|
+
"additionalProperties": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"blockingReasons": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": { "type": "string" }
|
|
66
|
+
},
|
|
67
|
+
"artifacts": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"required": ["reportPath"],
|
|
70
|
+
"properties": {
|
|
71
|
+
"reportPath": { "type": "string" },
|
|
72
|
+
"analyzeEvidencePath": { "type": "string" },
|
|
73
|
+
"readinessEvidencePath": { "type": "string" },
|
|
74
|
+
"autopilotEvidencePath": { "type": "string" }
|
|
75
|
+
},
|
|
76
|
+
"additionalProperties": true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"additionalProperties": true
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-ILY6QARY.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runAutopilotRelease}from'./chunk-RGXFDBYB.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {i,d as d$2,l,k as k$1,f as f$1,g,h}from'./chunk-
|
|
1
|
+
import {i,d as d$2,l,k as k$1,f as f$1,g,h}from'./chunk-IATULVMR.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {a as a$2,e,d as d$1,f,c,k as k$2}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {a as a$1}from'./chunk-VM2TOHNX.js';import {promises}from'fs';import*as k from'fs-extra';import m from'path';import q from'inquirer';import t from'chalk';import F from'ora';import {execa}from'execa';function A(){return c()}async function U(e,o,n,r){let l=d(o,b(),n);r&&(l.metadata||(l.metadata={}),l.metadata.python={version:r}),await b$1(e,l);}async function L(e){await k.outputFile(m.join(e,".gitignore"),`.venv/
|
|
2
2
|
__pycache__/
|
|
3
3
|
*.pyc
|
|
4
4
|
.env
|
|
@@ -139,7 +139,7 @@ npx rapidkit dev
|
|
|
139
139
|
cd <project-name>
|
|
140
140
|
npx rapidkit init
|
|
141
141
|
npx rapidkit dev
|
|
142
|
-
`)+"```\n","utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i$1}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-
|
|
142
|
+
`)+"```\n","utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i$1}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-AG2MQFTY.js');await b(i$1,a);}catch{}if(console.log(t.green(`
|
|
143
143
|
\u2728 Workspace created!
|
|
144
144
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan(`
|
|
145
145
|
\u{1F680} Get started:
|
|
@@ -195,7 +195,7 @@ npx rapidkit dev
|
|
|
195
195
|
cd <project-name>
|
|
196
196
|
npx rapidkit init
|
|
197
197
|
npx rapidkit dev
|
|
198
|
-
`)+"```\n","utf-8"),!n){C.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w} profile)`],{cwd:i$1}),C.succeed("Git repository initialized");}catch{C.warn("Could not initialize git repository");}}try{let{registerWorkspace:$t}=await import('./workspace-
|
|
198
|
+
`)+"```\n","utf-8"),!n){C.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w} profile)`],{cwd:i$1}),C.succeed("Git repository initialized");}catch{C.warn("Could not initialize git repository");}}try{let{registerWorkspace:$t}=await import('./workspace-AG2MQFTY.js');await $t(i$1,a);}catch{}console.log(t.green(`
|
|
199
199
|
\u2728 Workspace created with fallback profile!
|
|
200
200
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan(`
|
|
201
201
|
\u{1F680} Get started:
|
|
@@ -205,7 +205,7 @@ npx rapidkit dev
|
|
|
205
205
|
`)),console.log("");return}catch(B){throw C.fail("Failed to create workspace"),console.error(t.red(`
|
|
206
206
|
\u274C Error:`),B),B}}}else if(console.log(t.yellow(`
|
|
207
207
|
\u26A0\uFE0F Python not detected. Auto-switching to "${w}" profile (no Python required).
|
|
208
|
-
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w)){let j=F("Creating workspace").start();try{if(await k.ensureDir(i$1),j.succeed("Directory created"),await U(i$1,a,"venv",void 0),await Y(i$1,a,"venv",void 0,w),await L(i$1),await z(i$1,a),!n){j.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w})`],{cwd:i$1}),j.succeed("Git repository initialized");}catch{j.warn("Could not initialize git repository");}}try{let{registerWorkspace:C}=await import('./workspace-
|
|
208
|
+
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w)){let j=F("Creating workspace").start();try{if(await k.ensureDir(i$1),j.succeed("Directory created"),await U(i$1,a,"venv",void 0),await Y(i$1,a,"venv",void 0,w),await L(i$1),await z(i$1,a),!n){j.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w})`],{cwd:i$1}),j.succeed("Git repository initialized");}catch{j.warn("Could not initialize git repository");}}try{let{registerWorkspace:C}=await import('./workspace-AG2MQFTY.js');await C(i$1,a);}catch{}console.log(t.green(`
|
|
209
209
|
\u2728 Workspace created (auto-fallback profile)!
|
|
210
210
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan("\u{1F4E6} Profile:"),t.yellow(w)),console.log(t.cyan("\u{1F4A1} Reason:"),t.gray("Python not detected; switched from "+d)),console.log(t.cyan(`
|
|
211
211
|
\u{1F680} Get started:
|
|
@@ -213,7 +213,7 @@ npx rapidkit dev
|
|
|
213
213
|
`)),console.log(t.cyan(`\u{1F4A1} Add Python later:
|
|
214
214
|
`)),console.log(t.gray(" 1. Install Python 3.10+")),console.log(t.gray(` 2. Run: cd ${a} && rapidkit bootstrap --profile ${d}
|
|
215
215
|
`)),console.log("");return}catch(C){throw j.fail("Failed to create workspace"),console.error(t.red(`
|
|
216
|
-
\u274C Error:`),C),C}}}}a$1.step(1,3,"Setting up RapidKit environment");let I=F("Creating directory").start();try{await k.ensureDir(i$1),I.succeed("Directory created"),I.start("Detecting Python version");let f=null,R=await Rt(x.pythonVersion);if(R)f=await gt(R),f?(a$1.info(` Detected Python ${f}`),I.succeed(`Python ${f} detected`)):I.warn("Could not detect exact Python version");else {let b=A();f=await gt(b),f?I.succeed(`Python ${f} detected`):I.warn("Could not detect Python version, proceeding with defaults");}if(x.installMethod==="poetry"&&!await xt()&&(I.warn("Poetry not found \u2014 auto-fallback to pip + venv"),x.installMethod="venv"),await U(i$1,a,x.installMethod,f||void 0),f&&await Mt(i$1,f),await Y(i$1,a,x.installMethod,f||x.pythonVersion,d||h),await L(i$1),await z(i$1,a),x.installMethod==="poetry")try{await _t(i$1,x.pythonVersion,I,r,u,c);}catch(b){let w=b?.details||b?.message||String(b);if(w.includes("pyenv")||w.includes("exit status 127")||w.includes("returned non-zero exit status 127")){I.warn("Poetry encountered Python discovery issues, trying venv method"),a$1.debug(`Poetry error (attempting venv fallback): ${w}`);try{await ct(i$1,x.pythonVersion,I,r,u),x.installMethod="venv";}catch(T){throw T}}else throw b}else x.installMethod==="venv"?await ct(i$1,x.pythonVersion,I,r,u):await Et(i$1,I,r,u,c);if(await It(i$1,x.installMethod),await jt(i$1,x.installMethod),I.succeed("RapidKit environment ready!"),!o.skipGit){I.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:i$1}),I.succeed("Git repository initialized");}catch{I.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-
|
|
216
|
+
\u274C Error:`),C),C}}}}a$1.step(1,3,"Setting up RapidKit environment");let I=F("Creating directory").start();try{await k.ensureDir(i$1),I.succeed("Directory created"),I.start("Detecting Python version");let f=null,R=await Rt(x.pythonVersion);if(R)f=await gt(R),f?(a$1.info(` Detected Python ${f}`),I.succeed(`Python ${f} detected`)):I.warn("Could not detect exact Python version");else {let b=A();f=await gt(b),f?I.succeed(`Python ${f} detected`):I.warn("Could not detect Python version, proceeding with defaults");}if(x.installMethod==="poetry"&&!await xt()&&(I.warn("Poetry not found \u2014 auto-fallback to pip + venv"),x.installMethod="venv"),await U(i$1,a,x.installMethod,f||void 0),f&&await Mt(i$1,f),await Y(i$1,a,x.installMethod,f||x.pythonVersion,d||h),await L(i$1),await z(i$1,a),x.installMethod==="poetry")try{await _t(i$1,x.pythonVersion,I,r,u,c);}catch(b){let w=b?.details||b?.message||String(b);if(w.includes("pyenv")||w.includes("exit status 127")||w.includes("returned non-zero exit status 127")){I.warn("Poetry encountered Python discovery issues, trying venv method"),a$1.debug(`Poetry error (attempting venv fallback): ${w}`);try{await ct(i$1,x.pythonVersion,I,r,u),x.installMethod="venv";}catch(T){throw T}}else throw b}else x.installMethod==="venv"?await ct(i$1,x.pythonVersion,I,r,u):await Et(i$1,I,r,u,c);if(await It(i$1,x.installMethod),await jt(i$1,x.installMethod),I.succeed("RapidKit environment ready!"),!o.skipGit){I.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:i$1}),I.succeed("Git repository initialized");}catch{I.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-AG2MQFTY.js');await b(i$1,a);}catch{console.warn(t.gray("Note: Could not register workspace in shared registry"));}if(console.log(t.green(`
|
|
217
217
|
\u2728 RapidKit environment created successfully!
|
|
218
218
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan("\u2699\uFE0F Configuration:")),console.log(t.gray(` \u2022 Profile: ${d}`)),console.log(t.gray(` \u2022 Python: ${x.pythonVersion}`)),console.log(t.gray(` \u2022 Install method: ${x.installMethod}`)),console.log(t.cyan(`
|
|
219
219
|
\u{1F680} Get started:
|
|
@@ -260,7 +260,7 @@ Possible solutions:
|
|
|
260
260
|
2. Try installing manually: cd ${m.basename(e)} && ${f(".venv")} -m pip install rapidkit-core
|
|
261
261
|
3. Use Poetry instead: npx rapidkit ${m.basename(e)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:g}=await import('./pythonRapidkitExec-MNWRC4F2.js');if(!await g()&&!r){n.start("Checking optional global pipx installation");let a=await tt(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await N(a,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(i){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a$1.debug(`pipx install failed: ${i}`);}}}catch(g){n.succeed("Skipped optional global pipx installation"),a$1.debug(`Global install check skipped: ${g}`);}}async function Et(e,o,n,r,l$1=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:c}=await import('./pythonRapidkitExec-MNWRC4F2.js'),u=await c();if(u.isCompatible){o.succeed(`RapidKit ${u.installedVersion??""} already compatible globally; skipping pipx installation`),await k.outputFile(m.join(e,".rapidkit-global"),`RapidKit already available globally (version ${u.installedVersion??"unknown"}) and satisfies expected constraint ${u.expectedConstraint??"n/a"}; workspace will reuse the existing installation
|
|
262
262
|
`,"utf-8");return}u.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):u.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),a$1.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${u.reason}, installed=${u.installedVersion??"unknown"}, expected=${u.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(c){a$1.debug(`Global RapidKit version-aware check failed before pipx install: ${c}`);}let p=await tt(o,l$1);if(o.start("Installing RapidKit globally with pipx"),n){let c=d$2(r||{});if(!c)throw new k$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a$1.debug(`Installing from local path: ${c}`),o.text="Installing RapidKit from local path (test mode)",await N(p,["install","-e",c]);}else {o.text="Installing RapidKit from PyPI";try{await N(p,["install","rapidkit-core"]);}catch(c){try{o.text="RapidKit already installed globally, upgrading to match expected version",await N(p,["upgrade","rapidkit-core"]);}catch(u){throw a$1.debug(`pipx install/upgrade failed: install=${c}, upgrade=${u}`),new l}}}o.succeed("RapidKit installed globally"),await k.outputFile(m.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
263
|
-
`,"utf-8");}async function ce(e,o){let{skipGit:n=false,testMode:r=false,userConfig:l={},yes:p=false,installMethod:c,pythonVersion:u="3.10"}=o||{},g=c||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a$1.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=g==="poetry"&&!await xt()?"venv":g;await U(e,m.basename(e),h),await L(e),await Y(e,m.basename(e),h,u,o?.profile);let a=F("Registering workspace").start();try{h==="poetry"?(await z(e,m.basename(e)),await _t(e,u,a,r,l,p)):h==="venv"?await ct(e,u,a,r,l):await Et(e,a,r,l,p),await It(e,h),await jt(e,h),a.succeed("Workspace registered");try{let{registerWorkspace:i}=await import('./workspace-
|
|
263
|
+
`,"utf-8");}async function ce(e,o){let{skipGit:n=false,testMode:r=false,userConfig:l={},yes:p=false,installMethod:c,pythonVersion:u="3.10"}=o||{},g=c||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a$1.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=g==="poetry"&&!await xt()?"venv":g;await U(e,m.basename(e),h),await L(e),await Y(e,m.basename(e),h,u,o?.profile);let a=F("Registering workspace").start();try{h==="poetry"?(await z(e,m.basename(e)),await _t(e,u,a,r,l,p)):h==="venv"?await ct(e,u,a,r,l):await Et(e,a,r,l,p),await It(e,h),await jt(e,h),a.succeed("Workspace registered");try{let{registerWorkspace:i}=await import('./workspace-AG2MQFTY.js');await i(e,m.basename(e));}catch{}if(!n){a.start("Initializing git repository");try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),a.succeed("Git repository initialized");}catch{a.warn("Could not initialize git repository");}}}catch(i){throw a.fail("Failed to register workspace"),i}}async function jt(e,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
|
|
264
264
|
# Or simply use: poetry run rapidkit <command>`:o==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)",r=o==="poetry"?`# No activation needed (recommended):
|
|
265
265
|
./rapidkit --help
|
|
266
266
|
# or:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {a}from'./chunk-VKLL63TL.js';import {c}from'./chunk-NFUXULIF.js';import {j}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {promises}from'fs';import o from'path';import i from'chalk';import
|
|
2
|
-
\u2705 Synced ${
|
|
3
|
-
\u2705 All projects already registered (${
|
|
1
|
+
import {a}from'./chunk-VKLL63TL.js';import {c}from'./chunk-NFUXULIF.js';import {j}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {promises}from'fs';import o from'path';import i from'chalk';import E from'ora';import {execa}from'execa';function R(e){let t=o.resolve(e);return process.platform==="win32"?t.toLowerCase():t}function O(e){let t=R(e.path),r=Array.isArray(e.projects)?e.projects:[],a=[],p=new Set;for(let n of r){if(!n||typeof n.name!="string"||typeof n.path!="string")continue;let s=R(n.path);p.has(s)||(p.add(s),a.push({name:n.name,path:s}));}return {name:e.name,path:t,mode:e.mode,projects:a}}function P(e){let t=[],r=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let p=O(a);r.has(p.path)||(r.add(p.path),t.push(p));}return {workspaces:t}}async function B(e,t){try{let r=R(e),a=j(),p=o.join(a,"workspaces.json");await promises.mkdir(a,{recursive:true});let n={workspaces:[]};try{let c=await promises.readFile(p,"utf8"),l=JSON.parse(c);l&&Array.isArray(l.workspaces)&&(n=P(l));}catch{}n.workspaces.some(c=>c.path===r)||(n.workspaces.push({name:t,path:r,mode:"full",projects:[]}),await promises.writeFile(p,JSON.stringify(n,null,2)));}catch{console.warn(i.gray("Note: Could not register workspace in shared registry"));}}async function ae(e,t=false){let r=R(e),a={workspacePath:r,workspaceFound:false,added:[],skipped:0};try{let p=j(),n=o.join(p,"workspaces.json"),s={workspaces:[]};try{let f=await promises.readFile(n,"utf8"),h=JSON.parse(f);h&&Array.isArray(h.workspaces)&&(s=P(h));}catch{return t||console.log("\u26A0\uFE0F Workspace registry not found"),a}let c=s.workspaces.find(f=>f.path===r);if(!c)return t||console.log("\u26A0\uFE0F Workspace not registered in registry"),a;Array.isArray(c.projects)||(c.projects=[]);let l=0,k=0,m=[],u=[e],$=new Set;for(;u.length>0;){let f=u.shift();if(!f||$.has(f))continue;$.add(f);let h=await promises.readdir(f,{withFileTypes:true});for(let y of h){if(!y.isDirectory()||y.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(y.name))continue;let b=o.join(f,y.name),g=R(b),w=o.join(g,".rapidkit","context.json"),D=o.join(g,".rapidkit","project.json");try{let C=false;try{await promises.access(w),C=true;}catch{await promises.access(D),C=true;}if(C){let j=o.basename(g);c.projects.some(v=>v.path===g||v.name===j)?k++:(c.projects.push({name:j,path:g}),l++,m.push(g),t||console.log(`\u2714 Added: ${o.relative(e,g)}`));continue}}catch{}u.push(b);}}return l>0?(await promises.writeFile(n,JSON.stringify(s,null,2)),t||console.log(`
|
|
2
|
+
\u2705 Synced ${l} project(s) to registry`)):t||console.log(`
|
|
3
|
+
\u2705 All projects already registered (${k} found)`),{workspacePath:r,workspaceFound:true,added:m,skipped:k}}catch(p){return t||console.error("\u274C Failed to sync projects:",p.message),a}}async function oe(e,t,r){try{let a=R(e),p=R(r),n=j(),s=o.join(n,"workspaces.json"),c={workspaces:[]};try{let m=await promises.readFile(s,"utf8"),u=JSON.parse(m);u&&Array.isArray(u.workspaces)&&(c=P(u));}catch{return}let l=c.workspaces.find(m=>m.path===a);if(!l)return;Array.isArray(l.projects)||(l.projects=[]),l.projects.some(m=>m.path===p||m.name===t)||(l.projects.push({name:t,path:p}),await promises.writeFile(s,JSON.stringify(c,null,2)));}catch{}}async function ne(e,t){let r=E("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(o.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(o.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:p}=await import('./create-BO2I3ESU.js');await p(e,{workspaceName:t.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let n=T();await promises.writeFile(o.join(e,"rapidkit"),n),await promises.chmod(o.join(e,"rapidkit"),493);let s=z();await promises.writeFile(o.join(e,"rapidkit.cmd"),s);let c=U(t.name);if(await promises.writeFile(o.join(e,"README.md"),c),await promises.writeFile(o.join(e,".gitignore"),`# RapidKit workspace
|
|
4
4
|
.env
|
|
5
5
|
.env.*
|
|
6
6
|
!.env.example
|
|
@@ -15,7 +15,7 @@ Thumbs.db
|
|
|
15
15
|
|
|
16
16
|
# Logs
|
|
17
17
|
*.log
|
|
18
|
-
`),await promises.writeFile(o.join(e,".rapidkit-workspace"),JSON.stringify({signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:b(),createdAt:new Date().toISOString(),name:t.name},null,2)),await J(e),r.succeed("Workspace created!"),!t.skipGit){let
|
|
18
|
+
`),await promises.writeFile(o.join(e,".rapidkit-workspace"),JSON.stringify({signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:b(),createdAt:new Date().toISOString(),name:t.name},null,2)),await J(e),r.succeed("Workspace created!"),!t.skipGit){let k=E("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),k.succeed("Git repository initialized");}catch{k.warn("Could not initialize git repository");}}await B(e,t.name),console.log(`
|
|
19
19
|
${i.green("\u2728 RapidKit workspace created successfully!")}
|
|
20
20
|
|
|
21
21
|
${i.bold("\u{1F4C2} Workspace structure:")}
|
|
@@ -480,7 +480,7 @@ npx rapidkit dev # Start dev server
|
|
|
480
480
|
|
|
481
481
|
- [RapidKit Documentation](https://rapidkit.dev)
|
|
482
482
|
- [GitHub Repository](https://github.com/Baziar/rapidkit)
|
|
483
|
-
`}async function J(e){let{fileURLToPath:t}=await import('url'),r=t(import.meta.url),a=o.dirname(r),
|
|
483
|
+
`}async function J(e){let{fileURLToPath:t}=await import('url'),r=t(import.meta.url),a=o.dirname(r),p=o.resolve(a,".."),n=o.join(p,"templates","kits"),s=o.join(e,".rapidkit","templates"),{default:c}=await import('fs-extra');await c.copy(n,s);let l=o.join(p,"templates","generator.js"),k=o.join(e,".rapidkit","generator.js");await c.copy(l,k);}async function se(e,t){let r=t.template==="fastapi",a=r?"FastAPI":"NestJS",p=E(`Creating ${a} project...`).start();try{let{fileURLToPath:n}=await import('url'),s=n(import.meta.url),c=o.dirname(s),l=o.resolve(c,".."),k=r?"fastapi-standard":"nestjs-standard",m=o.join(l,"templates","kits",k);await promises.mkdir(e,{recursive:true});let u={project_name:r?t.name.replace(/-/g,"_").toLowerCase():t.name.replace(/_/g,"-").toLowerCase(),author:t.author,description:t.description||`${a} application generated with RapidKit`,app_version:"0.1.0",license:"MIT",package_manager:t.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:b()};await F(m,e,u);let $=r?`# Python
|
|
484
484
|
__pycache__/
|
|
485
485
|
*.py[cod]
|
|
486
486
|
*$py.class
|
|
@@ -548,7 +548,7 @@ Thumbs.db
|
|
|
548
548
|
|
|
549
549
|
# Coverage
|
|
550
550
|
coverage/
|
|
551
|
-
`;if(await promises.writeFile(o.join(e,".gitignore")
|
|
551
|
+
`;if(await promises.writeFile(o.join(e,".gitignore"),$),p.succeed(`${a} project created!`),!t.skipGit){let h=E("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${a} project via RapidKit`],{cwd:e}),h.succeed("Git repository initialized");}catch{h.warn("Could not initialize git repository");}}if(!t.skipInstall&&!r){let h=t.package_manager||"npm",y=E(`Installing dependencies with ${h}...`).start();try{await execa(h,["install"],{cwd:e}),y.succeed("Dependencies installed");}catch{y.warn(`Could not install dependencies. Run '${h} install' manually.`);}}let f=o.basename(e);console.log(r?`
|
|
552
552
|
${i.green("\u2728 FastAPI project created successfully!")}
|
|
553
553
|
|
|
554
554
|
${i.bold("\u{1F4C2} Project structure:")}
|
|
@@ -564,7 +564,7 @@ ${e}/
|
|
|
564
564
|
\u2514\u2500\u2500 README.md
|
|
565
565
|
|
|
566
566
|
${i.bold("\u{1F680} Get started:")}
|
|
567
|
-
${i.cyan(`cd ${
|
|
567
|
+
${i.cyan(`cd ${f}`)}
|
|
568
568
|
${i.cyan("npx rapidkit init")} ${i.gray("# Install dependencies")}
|
|
569
569
|
${i.cyan("npx rapidkit dev")} ${i.gray("# Start dev server")}
|
|
570
570
|
|
|
@@ -594,7 +594,7 @@ ${e}/
|
|
|
594
594
|
\u2514\u2500\u2500 README.md
|
|
595
595
|
|
|
596
596
|
${i.bold("\u{1F680} Get started:")}
|
|
597
|
-
${i.cyan(`cd ${
|
|
597
|
+
${i.cyan(`cd ${f}`)}
|
|
598
598
|
${t.skipInstall?i.cyan("npx rapidkit init")+i.gray(" # npm install")+`
|
|
599
599
|
`:""}${i.cyan("cp .env.example .env")}
|
|
600
600
|
${i.cyan("npx rapidkit dev")} ${i.gray("# Start dev server")}
|
|
@@ -614,16 +614,16 @@ ${i.bold("\u{1F310} API endpoints:")}
|
|
|
614
614
|
http://localhost:8000/examples/notes # Example API
|
|
615
615
|
|
|
616
616
|
${i.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
617
|
-
`);}catch(
|
|
617
|
+
`);}catch(n){throw p.fail(`Failed to create ${a} project`),n}}async function F(e,t,r){let a=await promises.readdir(e,{withFileTypes:true});for(let p of a){let n=o.join(e,p.name),s=p.name.replace(/\.j2$/,""),c=o.join(t,s);if(p.isDirectory())await promises.mkdir(c,{recursive:true}),await F(n,c,r);else {let l=await promises.readFile(n,"utf-8");p.name.endsWith(".j2")&&(l=G(l,r)),await promises.writeFile(c,l),(s==="rapidkit"||s==="activate"||s.endsWith(".py")&&c.includes(".rapidkit"))&&await promises.chmod(c,493);}}}function G(e,t){let r=e;for(let[a,p]of Object.entries(t)){let n=new RegExp(`\\{\\{\\s*${a}\\s*\\}\\}`,"g");r=r.replace(n,String(p));let s=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");r=r.replace(s,(k,m,u)=>String(p).replace(new RegExp(m,"g"),u));let c=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*lower\\s*\\}\\}`,"g");r=r.replace(c,String(p).toLowerCase());let l=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");r=r.replace(l,(k,m,u)=>String(p).replace(new RegExp(m,"g"),u).toLowerCase());}return r}async function ce(){let e=j(),t=o.join(e,"workspaces.json");if(!await promises.stat(t).catch(()=>null)){console.log(i.yellow(`
|
|
618
618
|
\u26A0\uFE0F No workspaces registered yet.
|
|
619
619
|
`)),console.log(i.gray(`Create a workspace with: npx rapidkit <workspace-name>
|
|
620
620
|
`));return}try{let r=await promises.readFile(t,"utf8"),a=JSON.parse(r);if(!a||typeof a!="object"||!Array.isArray(a.workspaces)){console.log(i.yellow(`
|
|
621
621
|
\u26A0\uFE0F Workspace registry is invalid; resetting to empty state.
|
|
622
|
-
`)),await promises.writeFile(t,JSON.stringify({workspaces:[]},null,2));return}let
|
|
622
|
+
`)),await promises.writeFile(t,JSON.stringify({workspaces:[]},null,2));return}let p=P(a),n=[],s=0;for(let m of p.workspaces)await promises.stat(m.path).catch(()=>null)?n.push(m):s+=1;let c={workspaces:n},l=JSON.stringify(a),k=JSON.stringify(c);if(l!==k&&await promises.writeFile(t,JSON.stringify(c,null,2)),!c.workspaces||c.workspaces.length===0){console.log(i.yellow(`
|
|
623
623
|
\u26A0\uFE0F No workspaces registered yet.
|
|
624
|
-
`)),
|
|
624
|
+
`)),s>0&&console.log(i.gray(`Cleaned ${s} stale workspace entr${s===1?"y":"ies"}.
|
|
625
625
|
`));return}console.log(i.bold(`
|
|
626
626
|
\u{1F4E6} Registered RapidKit Workspaces:
|
|
627
|
-
`));for(let
|
|
627
|
+
`));for(let m of c.workspaces)console.log(i.cyan(` ${m.name}`)),console.log(i.gray(` Path: ${m.path}`)),console.log(i.gray(` Projects: ${m.projects?.length||0}`)),console.log();s>0&&console.log(i.gray(`Cleaned ${s} stale workspace entr${s===1?"y":"ies"}.`)),console.log(i.gray(`Total: ${c.workspaces.length} workspace(s)
|
|
628
628
|
`));}catch(r){console.error(i.red(`
|
|
629
|
-
\u274C Failed to read workspace registry`)),console.error(i.gray(String(r)));}}async function N(e){try{let t=await promises.readFile(e,"utf8");return JSON.parse(t)}catch{return null}}function K(e){return c(e)}async function M(e){return a(e,{skipDirs:new Set(["node_modules","dist","build","target","coverage","htmlcov"]),includeHiddenDirs:false,descendIntoMatchedProjects:true})}async function A(e){try{return (await promises.readdir(e,{withFileTypes:true})).filter(r=>r.isFile()&&r.name.toLowerCase().endsWith(".json")).map(r=>r.name).sort((r,a)=>r.localeCompare(a))}catch{return []}}async function pe(e,t){let r=t?.includePaths===true,a=t?.includeDoctorEvidence!==false,
|
|
629
|
+
\u274C Failed to read workspace registry`)),console.error(i.gray(String(r)));}}async function N(e){try{let t=await promises.readFile(e,"utf8");return JSON.parse(t)}catch{return null}}function K(e){return c(e)}async function M(e){return a(e,{skipDirs:new Set(["node_modules","dist","build","target","coverage","htmlcov"]),includeHiddenDirs:false,descendIntoMatchedProjects:true})}async function A(e){try{return (await promises.readdir(e,{withFileTypes:true})).filter(r=>r.isFile()&&r.name.toLowerCase().endsWith(".json")).map(r=>r.name).sort((r,a)=>r.localeCompare(a))}catch{return []}}async function pe(e,t){let r=t?.includePaths===true,a=t?.includeDoctorEvidence!==false,p=t?.includeBlueprint!==false,n=o.resolve(e),s=await N(o.join(n,".rapidkit","workspace.json")),c=typeof s?.workspace_name=="string"&&s.workspace_name.trim()||o.basename(n),l=typeof s?.profile=="string"?s.profile:void 0,k=typeof s?.rapidkit_version=="string"?s.rapidkit_version:void 0,m=await M(n),u=[];for(let g of m){let w=await N(o.join(g,".rapidkit","project.json")),D=o.relative(n,g)||".",C=o.join(g,".rapidkit","reports"),j={name:o.basename(g),relative_path:D,runtime:typeof w?.runtime=="string"?w.runtime:void 0,kit_name:typeof w?.kit_name=="string"?w.kit_name:void 0,modules:Array.isArray(w?.modules)?w.modules.filter(v=>typeof v=="string"):void 0};if(r&&(j.absolute_path=g),a){let v=await N(o.join(C,"doctor-last-run.json"));K(v)&&(j.doctor_report=v);}let W=await A(C);W.length>0&&(j.reports=W),u.push(j);}let $=o.join(n,".rapidkit","reports"),f=await A($),h=await N(o.join(n,".rapidkit","workspace.contract.json")),y={schema_version:"1.1",generated_at:new Date().toISOString(),generated_by:"rapidkit-npm",workspace:{name:c,relative_root:".",profile:l,rapidkit_version:k,...r?{absolute_root:n}:{}},summary:{project_count:u.length,doctor_evidence_included:a,contract_included:!!h},reports:{workspace:f},projects:u,...h?{contract:h}:{}};p&&(y.blueprint={schema_version:"rapidkit.workspace-blueprint.v1",purpose:"portable-reproducibility",workspace:{name:c,profile:l},projects:u.map(g=>({name:g.name,relative_path:g.relative_path,runtime:g.runtime,kit_name:g.kit_name,modules:g.modules??[],recreate_commands:[...g.kit_name?[`npx rapidkit create project ${g.kit_name} ${g.name} --yes --skip-install`]:[],`cd ${g.relative_path}`,"npx rapidkit init","npx rapidkit test"]})),recommended_commands:["npx rapidkit workspace contract verify --strict","npx rapidkit doctor workspace","npx rapidkit workspace run init --json","npx rapidkit workspace run test --strict --json","npx rapidkit readiness --strict --json"]});let b=t?.outputPath?o.resolve(t.outputPath):o.join($,"share-bundle.json");return await promises.mkdir(o.dirname(b),{recursive:true}),await promises.writeFile(b,JSON.stringify(y,null,2),"utf8"),b}export{B as a,ae as b,oe as c,ne as d,se as e,ce as f,pe as g};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-VM2TOHNX.js';import {promises}from'fs';import a from'path';import I from'os';import {pathToFileURL}from'url';var K=".rapidkitrc.json",k=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function $(){let e=a.join(I.homedir(),K);try{let t=await promises.readFile(e,"utf-8"),n=JSON.parse(t);return a$1.debug(`Loaded config from ${e}`),n}catch{return a$1.debug("No user config found, using defaults"),{}}}async function O(e=process.cwd()){let t=e,n=a.parse(t).root;for(;t!==n;){for(let s of k){let i=a.join(t,s);try{await promises.access(i),a$1.debug(`Found config file: ${i}`);let c=await import(pathToFileURL(i).href),x=c.default||c;return a$1.debug(`Loaded RapidKit config from ${s}`),x}catch{continue}}t=a.dirname(t);}return a$1.debug("No RapidKit config file found, using defaults"),{}}function N(e,t,n){return {author:n.author||t.workspace?.defaultAuthor||e.author,pythonVersion:n.pythonVersion||t.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:n.defaultInstallMethod||t.workspace?.installMethod||e.defaultInstallMethod,defaultKit:n.defaultKit||t.projects?.defaultKit||e.defaultKit,skipGit:n.skipGit??t.projects?.skipGit??e.skipGit,license:n.license||e.license,testRapidKitPath:n.testRapidKitPath||e.testRapidKitPath}}function v(e){return process.env.RAPIDKIT_DEV_PATH||e.testRapidKitPath||void 0}var o=class extends Error{constructor(n,s,i){super(n);this.code=s;this.details=i;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},p=class extends o{constructor(t,n){let s=n?`Python ${t}+ required, found ${n}`:`Python ${t}+ not found`;super(s,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},d=class extends o{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},f=class extends o{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},u=class extends o{constructor(t){super(`Directory "${t}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},g=class extends o{constructor(t,n){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",n);}},h=class extends o{constructor(t,n){let s=`Installation failed at: ${t}`,i=`${n.message}
|
|
1
|
+
import {a as a$1}from'./chunk-VM2TOHNX.js';import {promises}from'fs';import a from'path';import I from'os';import {pathToFileURL}from'url';var K=".rapidkitrc.json",k=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function $(){let e=a.join(I.homedir(),K);try{let t=await promises.readFile(e,"utf-8"),n=JSON.parse(t);return a$1.debug(`Loaded config from ${e}`),n}catch{return a$1.debug("No user config found, using defaults"),{}}}async function O(e=process.cwd()){let t=e,n=a.parse(t).root;for(;t!==n;){for(let s of k){let i=a.join(t,s);try{await promises.access(i),a$1.debug(`Found config file: ${i}`);let c=await import(pathToFileURL(i).href),x=c.default||c;return a$1.debug(`Loaded RapidKit config from ${s}`),x}catch{continue}}t=a.dirname(t);}return a$1.debug("No RapidKit config file found, using defaults"),{}}function N(e,t,n){return {author:n.author||t.workspace?.defaultAuthor||e.author,pythonVersion:n.pythonVersion||t.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:n.defaultInstallMethod||t.workspace?.installMethod||e.defaultInstallMethod,defaultKit:n.defaultKit||t.projects?.defaultKit||e.defaultKit,skipGit:n.skipGit??t.projects?.skipGit??e.skipGit,license:n.license||e.license,testRapidKitPath:n.testRapidKitPath||e.testRapidKitPath}}function v(e){return process.env.RAPIDKIT_DEV_PATH||e.testRapidKitPath||void 0}var o=class extends Error{constructor(n,s,i){super(n);this.code=s;this.details=i;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}code;details},p=class extends o{constructor(t,n){let s=n?`Python ${t}+ required, found ${n}`:`Python ${t}+ not found`;super(s,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},d=class extends o{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},f=class extends o{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},u=class extends o{constructor(t){super(`Directory "${t}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},g=class extends o{constructor(t,n){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",n);}},h=class extends o{constructor(t,n){let s=`Installation failed at: ${t}`,i=`${n.message}
|
|
2
2
|
|
|
3
3
|
Troubleshooting:
|
|
4
4
|
- Check your internet connection
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {a}from'./chunk-QUNCXYYK.js';import {d,e}from'./chunk-KXTXQODI.js';import {a as a$1}from'./chunk-VKLL63TL.js';import h from'fs';import o from'path';import s from'chalk';var F=new Set([".git",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function y(e){try{return await h.promises.access(e,h.constants.F_OK),true}catch{return false}}async function v(e){try{let n=JSON.parse(await h.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function I(e){try{return await h.promises.readFile(e,"utf-8")}catch{return ""}}function G(e){return a(e)}async function E(e,n){return await y(o.join(e,".rapidkit","project.json"))||await y(o.join(e,".rapidkit","context.json"))?true:o.resolve(e)===o.resolve(n)?d(e).length>0:d(e).length>0}async function S(e){let n=await a$1(e,{skipDirs:F,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:E});return n.length>0?n:d(e).length>0?[e]:[]}function T(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function b(e,n){for(let t of n)if(await y(o.join(e,t)))return true;return false}async function N(e){return b(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function K(e){if(await b(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await v(o.join(e,"package.json")),i=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return typeof i.test=="string"&&i.test.trim().length>0}async function O(e){let n=await v(o.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function f(e,n,t,i,r,c){return {id:e,severity:n,target:t,title:i,detail:r,remediation:c}}function _(e){let n=e.reduce((t,i)=>i.severity==="fail"?t+28:i.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function J(e$1,n){let t=await v(o.join(n,".rapidkit","project.json")),i=e(n,t),r=d(n),c=i.runtime==="unknown"?r[0]||"unknown":i.runtime,a=T(e$1,n),d$1=a,m=await O(n),u=await y(o.join(n,".rapidkit","project.json"))||await y(o.join(n,".rapidkit","context.json")),g=await K(n),k=await b(n,["Dockerfile","dockerfile"]),w=await b(n,[".env.example","env.example","config/env.example"]),A=await b(n,[".github/workflows/ci.yml",".github/workflows/ci.yaml",".github/workflows/main.yml",".github/workflows/build.yml",".github/workflows/test.yml",".github/workflows/deploy.yml",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]),z=await N(n),l=[];return i.key==="unknown"&&l.push(f("project.stack.unknown","fail",d$1,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),u||l.push(f("project.marker.missing","warn",d$1,"RapidKit marker is missing","The project can be detected by files, but it is not registered with RapidKit metadata.","Run `rapidkit import <path>` from a workspace or create the project through RapidKit.")),g||l.push(f("project.tests.missing","warn",d$1,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `rapidkit workspace run test --affected` can gate changes.")),w||l.push(f("project.env.example.missing","info",d$1,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),A||l.push(f("project.ci.missing","warn",d$1,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),z||l.push(f("project.health.missing","info",d$1,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),k||l.push(f("project.container.missing","info",d$1,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:o.basename(n),path:n,relativePath:a,runtime:c,framework:i.key,confidence:i.confidence,supportTier:i.supportTier,hasRapidKitMarker:u,hasTests:g,hasDockerfile:k,hasEnvExample:w,hasCiConfig:A,hasHealthEndpoint:z,scripts:m,findings:l,score:_(l)}}function M(e){return e.name.toLowerCase()}async function W(e){let n=new Map(e.map(r=>[M(r),r])),t=[];for(let r of e){let c=await v(o.join(r.path,"package.json")),a={...c?.dependencies??{},...c?.devDependencies??{},...c?.peerDependencies??{}};for(let m of Object.keys(a)){let u=m.replace(/^@[^/]+\//,"").toLowerCase(),g=n.get(u);g&&g.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:g.relativePath,kind:"package"});}let d=await I(o.join(r.path,"pyproject.toml"));for(let m of e)m.relativePath!==r.relativePath&&d.includes(m.name)&&t.push({from:r.relativePath,to:m.relativePath,kind:"workspace-reference"});}let i=new Set;return t.filter(r=>{let c=`${r.from}\0${r.to}\0${r.kind}`;return i.has(c)?false:(i.add(c),true)})}function H(e,n){let t=new Map;for(let i of e)t.set(i.relativePath,{project:i.relativePath,directDependents:0,directDependencies:0});for(let i of n){let r=t.get(i.from),c=t.get(i.to);r&&(r.directDependencies+=1),c&&(c.directDependents+=1);}return Array.from(t.values()).sort((i,r)=>r.directDependents-i.directDependents||r.directDependencies-i.directDependencies)}async function B(e){let n=await v(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function U(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function V(e){if(e.projectCount===0)return ["Create a RapidKit workspace: npx rapidkit create workspace my-workspace --profile polyglot","Import an existing service: npx rapidkit import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `rapidkit bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `rapidkit import <path>` or recreate them via `rapidkit create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `rapidkit workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||n.push("Create `.rapidkit/workspace-dependency-graph.json` or use analyze output as the first graph seed."),n.push("Run `rapidkit autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function te(e={}){let n=o.resolve(e.workspacePath||process.cwd());if(!await y(n))throw new Error(`Workspace path does not exist: ${n}`);let t=G(n)??n,i=await y(o.join(t,".rapidkit-workspace"))||await y(o.join(t,".rapidkit","workspace.json")),r=await B(t),c=await S(t),a=await Promise.all(c.map(p=>J(t,p))),d=await W(a),m=H(a,d),u=[];i||u.push(f("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered RapidKit workspace.","Run `rapidkit create workspace` or `rapidkit bootstrap --profile polyglot` in a workspace root.")),a.length===0&&u.push(f("workspace.projects.missing","fail",".","No backend projects detected","RapidKit did not find runtime markers or project metadata under this root.","Create a project with `rapidkit create project` or import one with `rapidkit import <path>`."));let g=[...u,...a.flatMap(p=>p.findings)],k=U(g),w={};for(let p of a)w[p.runtime]=(w[p.runtime]||0)+1;let A=a.length>0?Math.round(a.reduce((p,P)=>p+P.score,0)/a.length):0,z=u.reduce((p,P)=>p+(P.severity==="fail"?20:P.severity==="warn"?8:2),0),l=Math.max(0,A-z),$=k.fail>0||e.strict&&k.warn>0?"blocked":k.warn>0?"needs-attention":"ready",C={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:l,verdict:$,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:k},runtimes:w,projects:a,dependencyGraph:{status:d.length>0?"generated":"empty",edges:d,topImpactedProjects:m.slice(0,5)},findings:g,nextActions:V({findings:g,projectCount:a.length,hasGraph:d.length>0}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e.output&&(await h.promises.mkdir(o.dirname(o.resolve(e.output)),{recursive:true}),await h.promises.writeFile(o.resolve(e.output),`${JSON.stringify(C,null,2)}
|
|
2
|
+
`)),!e.output&&i){let p=o.join(t,".rapidkit","reports","analyze-last-run.json");await h.promises.mkdir(o.dirname(p),{recursive:true}),await h.promises.writeFile(p,`${JSON.stringify(C,null,2)}
|
|
3
|
+
`);}return C}function ie(e){let n=e.summary.verdict==="ready"?s.green:e.summary.verdict==="needs-attention"?s.yellow:s.red;if(console.log(s.bold(`
|
|
4
|
+
RapidKit Workspace Analysis
|
|
5
|
+
`)),console.log(s.cyan("Workspace:"),e.workspacePath),console.log(s.cyan("Profile:"),e.profile||"not configured"),console.log(s.cyan("Score:"),`${e.summary.score}/100`),console.log(s.cyan("Verdict:"),n(e.summary.verdict)),console.log(s.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(s.bold(`
|
|
6
|
+
Projects`));for(let t of e.projects){let i=t.score>=85?s.green("pass"):t.score>=65?s.yellow("watch"):s.red("risk");console.log(` ${t.relativePath} ${s.gray(`${t.runtime}/${t.framework}`)} ${i} ${t.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(s.bold(`
|
|
7
|
+
Dependency Graph`)),console.log(s.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(s.gray(" Top impacted projects:"));for(let t of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${t.project} (${t.directDependents} dependents, ${t.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(s.bold(`
|
|
8
|
+
Top Findings`));for(let t of e.findings.slice(0,8)){let i=t.severity==="fail"?s.red:t.severity==="warn"?s.yellow:s.gray;console.log(` ${i(t.severity.toUpperCase())} ${t.target}: ${t.title}`),console.log(s.gray(` ${t.remediation}`));}}console.log(s.bold(`
|
|
9
|
+
Next Actions`));for(let t of e.nextActions.slice(0,5))console.log(s.gray(` - ${t}`));console.log();}export{te as a,ie as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {a}from'./chunk-QUNCXYYK.js';import {a as a$1,b,d as d$1,c as c$1,f}from'./chunk-QCZGNOTH.js';import {c as c$2}from'./chunk-NFUXULIF.js';import c from'chalk';import l from'fs';import y from'fs-extra';import d from'path';function A(t){let e=a$1(t);return b(e,t)?"go":d$1(e,t)?"java":c$1(e,t)?"node":f(e,t)?"python":"unknown"}function j(t,e){if(!l.existsSync(t))return null;let a=l.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>d.join(t,s));return a.length===0?null:(a.sort((s,r)=>l.statSync(r).mtimeMs-l.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function O(t,e){let a=d.join(t,".rapidkit","toolchain.lock");if(!l.existsSync(a))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:a};try{let s=JSON.parse(l.readFileSync(a,"utf-8")),r=p(s.runtime),i=["python","node","go","java"].filter(n=>{let u=p(r[n]);return typeof u.version=="string"&&u.version.trim().length>0});if(i.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via rapidkit setup <runtime> and re-run bootstrap."],evidencePath:a};if(e!=="unknown"){let n=p(r[e]);if(typeof n.version!="string"||n.version.trim().length===0)return {gate:"env",status:"fail",summary:`Project runtime (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:a}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${i.join(", ")}`,details:[],evidencePath:a}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:a}}}function C(t){let e=d.join(t,".rapidkit","reports","doctor-last-run.json");if(!l.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(l.readFileSync(e,"utf-8"));return c$2(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function G(t){let e=C(t);if(!e.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run rapidkit doctor workspace --json before release readiness checks."],evidencePath:e.path},payload:null};let a=p(e.payload.summary),s=Number(a.totalIssues??0);return a.hasSystemErrors?{gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:e.path},payload:e.payload}:s>0?{gate:{gate:"doctor",status:"warn",summary:`Doctor found ${s} issue(s)`,details:["Run rapidkit doctor workspace --fix and re-run readiness checks."],evidencePath:e.path},payload:e.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:e.path},payload:e.payload}}function N(t){let e=d.join(t,".rapidkit","reports","analyze-last-run.json");if(!l.existsSync(e))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run rapidkit analyze --json before release readiness checks."],evidencePath:e};try{let a=JSON.parse(l.readFileSync(e,"utf-8")),s=p(a.summary),r=String(s.verdict??"").toLowerCase(),o=Number(s.score??0),i=p(s.findings),n=Number(i.fail??0);return r==="blocked"||n>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${o}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:e}:r==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${o}/100)`,details:["Review analyze warnings before release."],evidencePath:e}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${o}/100)`,details:[],evidencePath:e}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid JSON",details:["Re-run rapidkit analyze --json to regenerate evidence."],evidencePath:e}}}function $(t){try{let e=JSON.parse(l.readFileSync(t,"utf-8")),a=String(e.status??"").toLowerCase(),s=p(e.summary),r=Number(s.failedChecks??0);return a==="fail"||r>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:t}:a==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:t}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:t}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:t}}}async function x(t,e){if(e.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let a=d.join(t,".rapidkit","reports"),s=j(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return $(s);let r=d.join(a,"workspace-contract-verify-last-run.json"),o=j(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(l.readFileSync(o,"utf-8")),n=String(i.status??"").toLowerCase();if(n==="passed"||n==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(n==="failed"||n==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(i.violations)?i.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:i}=await import('./workspace-contract-Z5VYUF3T.js'),n=await i({workspacePath:t}),u={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:n.status,contractPath:n.contractPath,projectCount:n.projectCount,checks:n.checks,violations:n.violations};return await y.ensureDir(a),await y.writeJSON(r,u,{spaces:2}),n.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:n.violations.slice(0,5),evidencePath:r}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:r}}catch(i){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run rapidkit workspace contract verify --json or export verify-pack contract from CI.",i instanceof Error?i.message:String(i)],evidencePath:d.join(a,"*verify*.json")}}}function z(t,e){let a=d.join(e,".rapidkit","reports","doctor-last-run.json");if(!t)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run rapidkit doctor workspace --json to include dependency findings."],evidencePath:a};let s=Array.isArray(t.projects)?t.projects:[],r=s.reduce((i,n)=>{let u=Number(n.vulnerabilities??0);return Number.isFinite(u)?i+Math.max(0,u):i},0),o=s.filter(i=>i.depsInstalled===false).length;return r>0?{gate:"dependency",status:"fail",summary:`${r} dependency vulnerability(ies) reported`,details:["Resolve vulnerabilities (npm/pip/go audit pipelines) before release."],evidencePath:a}:o>0?{gate:"dependency",status:"warn",summary:`${o} project(s) report missing dependencies`,details:["Run project init/bootstrap and regenerate doctor evidence."],evidencePath:a}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:a}}function V(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function E(t,e){let a=d.join(t,".rapidkit","reports","release-readiness-last-run.json");return await y.ensureDir(d.dirname(a)),await y.writeJSON(a,e,{spaces:2}),a}async function I(t={}){let e=d.resolve(t.startPath??process.cwd()),a$1=a(e)??e,s=A(e),r=O(a$1,s),o=G(a$1),i=N(a$1),n=await x(a$1,{skipVerify:t.skipVerify}),u=z(o.payload,a$1),m=[r,o.gate,i,n,u],g=V(m),v={schemaVersion:"v1",generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:e,action:t.action,overallStatus:g,blocking:g==="fail",blockingReasons:m.filter(f=>f.status==="fail").map(f=>`${f.gate}: ${f.summary}`),gates:m};return t.writeReport!==false&&(v.evidencePath=await E(a$1,v)),v}function J(t){return t==="pass"?c.green("PASS"):t==="warn"?c.yellow("WARN"):c.red("FAIL")}function D(t){return t==="pass"?c.green("PASS"):t==="warn"?c.yellow("WARN"):c.red("FAIL")}async function Q(t){let e=await I({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(c.bold.cyan(`
|
|
2
|
+
\u{1F6A6} RapidKit Release Readiness
|
|
3
|
+
`)),console.log(c.bold(`Workspace: ${c.cyan(d.basename(e.workspacePath))}`)),console.log(c.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${D(e.overallStatus)}`);for(let a of e.gates){console.log(` - ${a.gate}: ${J(a.status)} ${a.summary}`);for(let s of a.details)console.log(c.gray(` ${s}`));a.evidencePath&&console.log(c.gray(` evidence: ${a.evidencePath}`));}e.evidencePath&&console.log(c.gray(`
|
|
4
|
+
Evidence saved: ${e.evidencePath}`));}t.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{I as a,Q as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from'fs';import t from'path';function c(e){let r=t.resolve(e);for(;;){if(n.existsSync(t.join(r,".rapidkit-workspace"))||n.existsSync(t.join(r,".rapidkit","workspace.json")))return r;let i=t.dirname(r);if(i===r)return null;r=i;}}export{c as a};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'./chunk-SAIWD6VM.js';import {a as a$1}from'./chunk-QUNCXYYK.js';import l from'chalk';import _ from'fs';import R from'path';import {execa}from'execa';function D(t){try{return JSON.parse(t)}catch{return null}}function le(t){let r=R.resolve(t),a=a$1(r);if(!a)throw new Error("No RapidKit workspace found in current directory or parents");return a}async function b(t,r){let a=process.argv[1];if(!a)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let o=await execa(process.execPath,[a,...t],{cwd:r,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr,crashed:false}}catch(o){return {exitCode:1,stdout:"",stderr:o instanceof Error?o.message:String(o),crashed:true}}}function q(t){let r=t.toLowerCase();return r==="pass"?"pass":r==="warn"?"warn":r==="fail"?"fail":"warn"}function Q(t){return t.summary.failed>0?"fail":t.gates.results.some(r=>r.status==="warn")?"warn":"pass"}function ce(t){let r=t.filter(o=>o.status!=="skipped");if(r.length===0)return 100;let a=r.reduce((o,e)=>e.status==="pass"?o+1:e.status==="warn"?o+.6:o,0);return Math.round(a/r.length*100)}function ue(t){return t.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:t.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:t.hasWarnings&&t.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function F(t,r){await _.promises.mkdir(R.dirname(t),{recursive:true}),await _.promises.writeFile(t,`${JSON.stringify(r,null,2)}
|
|
2
|
+
`,"utf-8");}async function ye(t){let r=le(t.workspacePath),a$1=t.mode,o=[],e=[],E,G,I,T,V=0,d=false,B=0,K=0,C=-1,z=-1,c="skipped",p="skipped",X=a$1==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(t.skipPipelineStages)o.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let s=Date.now(),i=await b([...X],r),m=Date.now()-s;if(c="pass",i.crashed)c="fail",d=true,e.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e.push("doctor workspace command failed");else {let u=D(i.stdout),j=u&&u.healthScore&&typeof u.healthScore=="object"?u.healthScore:{},h=Number(j.errors??0),$=Number(j.warnings??0);Number.isFinite(h)&&h>0?(c="fail",e.push(`doctor workspace reports ${h} error(s)`)):Number.isFinite($)&&$>0&&(c="warn");}C=o.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,a$1==="enforce"&&c==="warn"&&e.push("doctor workspace reported warnings under enforce mode");let g=Date.now(),w=await b(["analyze","--json"],r),A=Date.now()-g;G=R.join(r,".rapidkit","reports","analyze-last-run.json");let n="pass";if(w.crashed)n="fail",d=true,e.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let u=D(w.stdout),j=u&&u.summary&&typeof u.summary=="object"?u.summary:{},h=String(j.verdict??"ready");h==="blocked"?(n="fail",e.push("analyze reported blocked verdict")):h==="needs-attention"&&(n="warn");}o.push({name:"analyze",status:n,durationMs:A,summary:n==="pass"?"analyze passed":n==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),a$1==="enforce"&&n==="warn"&&e.push("analyze reported warnings under enforce mode");let P=Date.now(),k=await b(["readiness","--json"],r),y=Date.now()-P;if(p="fail",k.crashed)p="fail",d=true,e.push(`readiness execution error: ${k.stderr||"unknown error"}`);else if(k.exitCode!==0)p="fail",e.push("readiness command failed");else {let u=D(k.stdout),j=String(u?.overallStatus??"fail");if(p=q(j),typeof u?.evidencePath=="string"&&u.evidencePath.trim().length>0&&(E=u.evidencePath),p==="fail"){let h=Array.isArray(u?.blockingReasons)?u?.blockingReasons.filter($=>typeof $=="string"):[];h.length>0?e.push(...h.map($=>`readiness: ${$}`)):e.push("readiness overall status is fail");}}z=o.push({name:"readiness",status:p,durationMs:y,summary:`readiness overall status is ${p}`})-1,a$1==="enforce"&&p==="warn"&&e.push("readiness reported warnings under enforce mode");}let Y=Date.now(),N=await b(["doctor","workspace","--plan","--json"],r),Z=Date.now()-Y,S="warn";if(N.crashed)S="fail",d=true,e.push(`doctor remediation plan execution error: ${N.stderr||"unknown error"}`);else if(N.exitCode!==0)S="fail",e.push("doctor remediation plan command failed");else {let s=D(N.stdout),i=s&&s.remediationPlan&&typeof s.remediationPlan=="object"?s.remediationPlan:null,m=Number(i?.totalSteps??0),g=Number(i?.executableSteps??0);Number.isFinite(m)&&m>0&&(B=m),Number.isFinite(g)&&g>0&&(K=g),Number.isFinite(m)&&m===0?S="pass":S="warn";}if(o.push({name:"remediation-plan",status:S,durationMs:Z,summary:S==="pass"?"no remediation steps required":"remediation steps available"}),a$1==="enforce"&&S==="warn"&&e.push("remediation plan has pending steps under enforce mode"),a$1==="safe-fix"){let s=Date.now(),i=await b(["doctor","workspace","--apply"],r),m=Date.now()-s,g=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)d=true,e.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e.push("doctor remediation apply failed");else {V=K>0?K:B>0?B:1;let w=await b(["doctor","workspace","--json"],r);if(w.crashed)c="fail",d=true,e.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e.push("post-apply doctor workspace command failed");else {let n=D(w.stdout),P=n&&n.healthScore&&typeof n.healthScore=="object"?n.healthScore:{},k=Number(P.errors??0),y=Number(P.warnings??0);Number.isFinite(k)&&k>0?(c="fail",e.push(`post-apply doctor reports ${k} error(s)`)):Number.isFinite(y)&&y>0?c="warn":c="pass";}C>=0&&(o[C].status=c,o[C].summary=`doctor workspace post-apply status is ${c}`);let A=await b(["readiness","--json"],r);if(A.crashed)p="fail",d=true,e.push(`post-apply readiness execution error: ${A.stderr||"unknown error"}`);else if(A.exitCode!==0)p="fail",e.push("post-apply readiness command failed");else {let n=D(A.stdout),P=String(n?.overallStatus??"fail");if(p=q(P),typeof n?.evidencePath=="string"&&n.evidencePath.trim().length>0&&(E=n.evidencePath),p==="fail"){let k=Array.isArray(n?.blockingReasons)?n?.blockingReasons.filter(y=>typeof y=="string"):[];k.length>0?e.push(...k.map(y=>`post-apply readiness: ${y}`)):e.push("post-apply readiness overall status is fail");}}z>=0&&(o[z].status=p,o[z].summary=`readiness post-apply overall status is ${p}`);}o.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let O=Date.now(),x="pass",v="workspace test/build completed for selected projects";try{let s=await a({workspacePath:r,stage:"test",affected:true,since:t.since,parallel:t.parallel,maxWorkers:t.maxWorkers,strict:true,json:true,enforceGates:false});I=R.join(r,".rapidkit","reports","autopilot-workspace-run-test.json"),await F(I,s);let i=Q(s);if(i==="fail")x="fail",v="workspace test stage failed for selected projects",e.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",v="workspace test stage completed with warnings",a$1==="enforce"&&e.push("workspace run test reported warnings under enforce mode"));let m=await a({workspacePath:r,stage:"build",affected:true,since:t.since,parallel:t.parallel,maxWorkers:t.maxWorkers,strict:true,json:true,enforceGates:false});T=R.join(r,".rapidkit","reports","autopilot-workspace-run-build.json"),await F(T,m);let g=Q(m);g==="fail"?(x="fail",v="workspace build stage failed for selected projects",e.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",v="workspace test/build completed with warnings",a$1==="enforce"&&e.push("workspace run test/build reported warnings under enforce mode"));}}catch(s){x="fail",v="workspace test/build orchestration failed",d=true,e.push(`workspace run orchestration error: ${s instanceof Error?s.message:String(s)}`);}let ee=Date.now()-O;o.push({name:"workspace-run-test-build",status:x,durationMs:ee,summary:v});let M=o.filter(s=>s.status==="warn").length,te=o.filter(s=>s.status==="fail").length,J=a$1==="enforce"?o.some(s=>s.status==="warn"||s.status==="fail"):te>0,W=[...new Set(e)],se=d||J?Math.max(1,W.length):0,re=ce(o),oe=d||J?"blocked":M>0?"partial":"approved",ae=d?3:J?1:M>0?2:0,ne=ue({mode:a$1,executionError:d,blockers:W,hasWarnings:M>0}),H=R.join(r,".rapidkit","reports","autopilot-release-last-run.json"),f={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:r,mode:a$1,summary:{releaseScore:re,verdict:oe,blockers:se,warnings:M,safeFixesApplied:V,manualActions:W.length,exitCode:ae},stages:o,blockingReasons:W,nextActions:ne,artifacts:{reportPath:H,analyzeEvidencePath:G,readinessEvidencePath:E,workspaceRunTestPath:I,workspaceRunBuildPath:T}};if(await F(H,f),t.output&&await F(R.resolve(t.output),f),!t.json){console.log(l.bold.cyan(`
|
|
3
|
+
\u{1F680} RapidKit Autopilot Release
|
|
4
|
+
`)),console.log(l.bold(`Workspace: ${l.cyan(R.basename(r))}`)),console.log(l.gray(`Path: ${r}`)),console.log(l.white(`Mode: ${a$1}`)),console.log(l.white(`Verdict: ${f.summary.verdict==="approved"?l.green("approved"):f.summary.verdict==="partial"?l.yellow("partial"):l.red("blocked")}`)),console.log(l.white(`Release score: ${f.summary.releaseScore}`));for(let s of f.stages){let i=s.status==="pass"?l.green("PASS"):s.status==="warn"?l.yellow("WARN"):s.status==="skipped"?l.gray("SKIP"):l.red("FAIL");console.log(` - ${s.name}: ${i} ${s.summary} (${s.durationMs}ms)`);}if(f.blockingReasons.length>0){console.log(l.bold.red(`
|
|
5
|
+
Blocking reasons:`));for(let s of f.blockingReasons)console.log(l.red(` - ${s}`));}if(f.nextActions.length>0){console.log(l.bold(`
|
|
6
|
+
Next actions:`));for(let s of f.nextActions)console.log(l.gray(` - ${s}`));}console.log(l.gray(`
|
|
7
|
+
Report: ${f.artifacts.reportPath}`));}return f}export{ye as a};
|