rapidkit 0.38.0 → 0.40.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.
Files changed (80) hide show
  1. package/README.md +96 -31
  2. package/contracts/agent-customization-pack.v1.json +159 -0
  3. package/contracts/extension-cli-compatibility.v1.json +10 -0
  4. package/contracts/runtime-command-surface.v1.json +33 -0
  5. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +92 -0
  6. package/contracts/workspace-intelligence/workspace-impact.v1.json +32 -2
  7. package/contracts/workspace-intelligence/workspace-model.v1.json +5 -0
  8. package/contracts/workspace-intelligence/workspace-verify.v1.json +103 -1
  9. package/dist/analyze-RHQM4AB2.js +1 -0
  10. package/dist/autopilot-release-S32GYUAQ.js +1 -0
  11. package/dist/chunk-3YLMCP3V.js +1 -0
  12. package/dist/chunk-4FJQWL7P.js +4 -0
  13. package/dist/chunk-4Q2ZZKGB.js +1 -0
  14. package/dist/chunk-6G2KSHP6.js +2 -0
  15. package/dist/{chunk-PPQYTYQG.js → chunk-6KD5F6LX.js} +4 -4
  16. package/dist/{chunk-NKNMGWAZ.js → chunk-CY2WXWYQ.js} +1 -1
  17. package/dist/{chunk-TVIOAZ6E.js → chunk-ERCD6NFF.js} +15 -15
  18. package/dist/chunk-G76C74EV.js +1 -0
  19. package/dist/chunk-GOM3RFB3.js +2 -0
  20. package/dist/chunk-HTYMXMQM.js +1 -0
  21. package/dist/chunk-KYH364KQ.js +1 -0
  22. package/dist/chunk-NAMOYGLS.js +2 -0
  23. package/dist/chunk-OWNGSAO3.js +2 -0
  24. package/dist/chunk-PYCJWW4B.js +1 -0
  25. package/dist/chunk-QPEBI6AB.js +2 -0
  26. package/dist/{chunk-5NBYSXOZ.js → chunk-RXWM5DSC.js} +2 -2
  27. package/dist/chunk-S5KTATOU.js +1 -0
  28. package/dist/chunk-TYZPPUBH.js +1 -0
  29. package/dist/chunk-VQMZC5TC.js +9 -0
  30. package/dist/{chunk-JBDQADHY.js → chunk-WHCON2VN.js} +11 -11
  31. package/dist/chunk-X7PWDIQW.js +1 -0
  32. package/dist/{chunk-7XW2I6MP.js → chunk-ZWKLRZE5.js} +2 -2
  33. package/dist/{create-Y3XJOKL5.js → create-XVDDQA42.js} +1 -1
  34. package/dist/{demo-kit-3VTLJBP7.js → demo-kit-RWGOEDW4.js} +1 -1
  35. package/dist/{doctor-QC662YLH.js → doctor-UOLOGJ2Z.js} +1 -1
  36. package/dist/{dotnet-webapi-clean-FX533F5U.js → dotnet-webapi-clean-RTBRPDPL.js} +1 -1
  37. package/dist/{gofiber-standard-35CJZ7S3.js → gofiber-standard-UGIRKPKL.js} +1 -1
  38. package/dist/{gogin-standard-SAX6C4ZK.js → gogin-standard-HJ7SPFNT.js} +1 -1
  39. package/dist/index.d.ts +32 -1
  40. package/dist/index.js +154 -154
  41. package/dist/pipeline-M52LR5FJ.js +5 -0
  42. package/dist/{springboot-standard-SFMSLTX4.js → springboot-standard-IWJSVDLZ.js} +1 -1
  43. package/dist/{workspace-WBKFXH4Z.js → workspace-L4ITCKMM.js} +1 -1
  44. package/dist/workspace-agent-sync-G7JU77IK.js +25 -0
  45. package/dist/{workspace-context-V4UGIHSC.js → workspace-context-NMMQMHNU.js} +1 -1
  46. package/dist/{workspace-foundation-T45HAWKL.js → workspace-foundation-HNIRAIBF.js} +1 -1
  47. package/dist/workspace-graph-ICB7OVAZ.js +3 -0
  48. package/dist/workspace-history-LHUTLE3S.js +1 -0
  49. package/dist/{workspace-intelligence-MGL3Z25K.js → workspace-intelligence-64IWAYHS.js} +1 -1
  50. package/dist/workspace-model-SDHH5RBC.js +1 -0
  51. package/dist/workspace-run-A26PEGQT.js +1 -0
  52. package/dist/workspace-verify-6Q6MGRG6.js +1 -0
  53. package/dist/workspace-watch-JDXVGW4H.js +1 -0
  54. package/docs/ci-workflows.md +21 -18
  55. package/docs/commands-reference.md +1 -1
  56. package/docs/contracts/ARTIFACT_CATALOG.md +194 -32
  57. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
  58. package/docs/contracts/README.md +9 -7
  59. package/docs/examples/ci-agent-grounding.yml +5 -2
  60. package/package.json +11 -6
  61. package/scripts/check-agent-customization-drift.mjs +75 -0
  62. package/dist/analyze-6RFG7C7Z.js +0 -1
  63. package/dist/autopilot-release-SBPGNGAB.js +0 -1
  64. package/dist/chunk-2ED6SPXP.js +0 -1
  65. package/dist/chunk-3R7UJAX5.js +0 -1
  66. package/dist/chunk-6E5TBB2C.js +0 -2
  67. package/dist/chunk-6P5DCHBQ.js +0 -4
  68. package/dist/chunk-ABPDGFVD.js +0 -2
  69. package/dist/chunk-B2KOIORF.js +0 -1
  70. package/dist/chunk-C7WILE56.js +0 -1
  71. package/dist/chunk-HEG6DIGW.js +0 -2
  72. package/dist/chunk-IW3KLQXE.js +0 -2
  73. package/dist/chunk-RELR4O5E.js +0 -2
  74. package/dist/chunk-T5LN7EO5.js +0 -9
  75. package/dist/chunk-XESEBTPE.js +0 -1
  76. package/dist/pipeline-C4UCLETO.js +0 -5
  77. package/dist/workspace-agent-sync-3FFFJYKF.js +0 -17
  78. package/dist/workspace-model-IKMGY2BX.js +0 -1
  79. package/dist/workspace-run-HOR56FON.js +0 -1
  80. package/dist/workspace-verify-A3J6D7T2.js +0 -1
@@ -0,0 +1,123 @@
1
+ # RapidKit CLI Log Event Stream (`cli-log-event.v1`)
2
+
3
+ Structured NDJSON observability stream emitted by `rapidkit-npm` so IDEs (Workspai),
4
+ CI, and agents can track command progress and outcome **without scraping human
5
+ terminal text**.
6
+
7
+ - **Schema version:** `cli-log-event-v1`
8
+ - **JSON Schema:** [`contracts/cli-log-event.v1.json`](../../contracts/cli-log-event.v1.json)
9
+ - **TypeScript contract:** `src/contracts/cli-log-event-contract.ts` (single runtime
10
+ source of `CLI_LOG_LEVELS`, `CLI_LOG_EVENT_KINDS`, `CLI_LOG_EVENT_REQUIRED_FIELDS`)
11
+ - **Drift guard:** `src/__tests__/contracts/cli-log-event-contract.test.ts` pins the
12
+ TypeScript contract to the JSON schema so the two can never diverge silently.
13
+
14
+ ## Channel separation (critical)
15
+
16
+ RapidKit keeps two machine-readable channels strictly separate:
17
+
18
+ | Channel | Flag | Content |
19
+ | ------- | ---- | ------- |
20
+ | **stdout** | `--json` | The command **result** payload (e.g. workspace model, analyze report). One JSON document. |
21
+ | **stderr** | `--log-format json` (or `--log-json`, or `RAPIDKIT_LOG_FORMAT=json`) | The **NDJSON log stream** — one `cli-log-event.v1` object per line. |
22
+
23
+ Because the two channels are independent, a consumer can request structured
24
+ progress (`--log-format json`) **and** a structured result (`--json`) at the same
25
+ time without corrupting either stream.
26
+
27
+ ## Activation
28
+
29
+ Any of the following enables the stream:
30
+
31
+ ```bash
32
+ rapidkit workspace model --json --log-format json
33
+ RAPIDKIT_LOG_FORMAT=json rapidkit workspace verify --json
34
+ rapidkit doctor workspace --log-json
35
+ ```
36
+
37
+ In text mode (the default) no structured log events are written to stderr.
38
+
39
+ ### Flag normalization (why it works for every command)
40
+
41
+ `--log-format json` / `--log-json` are **not** registered as per-command options. On
42
+ startup the CLI resolves the requested format once, makes it sticky via
43
+ `RAPIDKIT_LOG_FORMAT=json`, and strips the observability flags from `process.argv`
44
+ before any command parser runs. This guarantees the stream works uniformly for
45
+ commander-parsed commands (e.g. `workspace model`), manually handled commands
46
+ (e.g. `create`), and delegated child CLIs (which inherit the env var) — without a
47
+ command ever rejecting the flag as an "unknown option". The result flag (`--json`)
48
+ is preserved, so the stdout result and the stderr stream stay independent.
49
+
50
+ ## Workspace intelligence phase events
51
+
52
+ Every workspace intelligence subcommand (`model`, `snapshot`, `diff`, `impact`,
53
+ `verify`, `context`, `agent-sync`) emits at least a `progress` event when the
54
+ stream is active:
55
+
56
+ ```json
57
+ { "event": "progress", "component": "workspace",
58
+ "metadata": { "phase": "workspace.model", "action": "model", "status": "started" } }
59
+ ```
60
+
61
+ The terminal outcome is always covered by the run lifecycle (`run.completed` /
62
+ `run.failed`), so a consumer can settle UI state deterministically.
63
+
64
+ ## Event shape
65
+
66
+ Each stderr line is a single JSON object:
67
+
68
+ ```json
69
+ {
70
+ "schemaVersion": "cli-log-event-v1",
71
+ "runId": "5f1d…",
72
+ "timestamp": "2026-06-22T13:59:01.123Z",
73
+ "level": "info",
74
+ "event": "run.started",
75
+ "component": "cli",
76
+ "message": "CLI run started",
77
+ "command": ["workspace", "model"],
78
+ "metadata": { "cwd": "/path/to/workspace", "rapidkitVersion": "0.38.0" }
79
+ }
80
+ ```
81
+
82
+ ### Fields
83
+
84
+ | Field | Required | Notes |
85
+ | ----- | -------- | ----- |
86
+ | `schemaVersion` | yes | Always `cli-log-event-v1`. |
87
+ | `runId` | yes | Stable UUID for the whole CLI invocation; correlates every event in one run. |
88
+ | `timestamp` | yes | ISO-8601 date-time. |
89
+ | `level` | yes | `debug` \| `info` \| `warn` \| `error`. |
90
+ | `event` | yes | `log` \| `progress` \| `run.started` \| `run.completed` \| `run.failed`. |
91
+ | `component` | yes | Emitting component (e.g. `cli`, `create`). |
92
+ | `message` | yes | Human-readable message. |
93
+ | `command` | no | Command argv (observability flags stripped). |
94
+ | `metadata` | no | Sanitized key/value context (e.g. `exitCode`, `cwd`, `rapidkitVersion`). |
95
+
96
+ ## Run lifecycle events
97
+
98
+ Every invocation that runs through the CLI run context emits a deterministic
99
+ lifecycle, keyed by a shared `runId`:
100
+
101
+ 1. `run.started` — emitted on initialization (`level: info`).
102
+ 2. `run.completed` — emitted on exit code `0` (`level: info`, `metadata.exitCode: 0`).
103
+ 3. `run.failed` — emitted on any non-zero exit (`level: error`, `metadata.exitCode: <n>`).
104
+
105
+ `run.completed` / `run.failed` are guaranteed even when a command calls
106
+ `process.exit()`, because the CLI installs a process-exit hook that finalizes the
107
+ run context.
108
+
109
+ ## Consumer guidance (IDE / CI)
110
+
111
+ 1. Spawn with `--log-format json` to receive progress; parse stderr line-by-line.
112
+ 2. Treat a line as an event only if it parses as JSON and matches the schema
113
+ (`schemaVersion === 'cli-log-event-v1'`). Ignore non-matching lines.
114
+ 3. Use `runId` to group events; show progress on `progress`/`log`, settle UI state
115
+ on `run.completed` / `run.failed`.
116
+ 4. Read the command **result** from stdout `--json`, not from the log stream.
117
+ 5. Workspai consumes this stream via `src/core/cliLogEventContract.ts`
118
+ (`parseCliLogEventLine`) to drive deterministic progress and evidence refresh.
119
+
120
+ ## See also
121
+
122
+ - [ARTIFACT_CATALOG.md](./ARTIFACT_CATALOG.md) — on-disk artifacts produced by commands
123
+ - [COMMAND_OWNERSHIP_MATRIX.md](./COMMAND_OWNERSHIP_MATRIX.md)
@@ -6,13 +6,14 @@ Contract documentation for JSON payloads, support matrices, and cross-repo parit
6
6
 
7
7
  Canonical JSON lives in **`../contracts/`** (npm package root, published in the tarball).
8
8
 
9
- | Script | Purpose |
10
- | ----------------------------------- | ------------------------------------------------------------------------------------------- |
11
- | `npm run generate:contracts` | Regenerate runtime surface, create planner, import-stack parity, module-layout, infra-stack |
12
- | `npm run check:generated-contracts` | Verify committed JSON matches generators |
13
- | `npm run sync:parity-snapshot` | Copy canonical → vscode `contracts/` mirror |
14
- | `npm run check:parity-snapshot` | Verify mirrors match canonical |
15
- | `npm run validate:contracts` | Generate check + mirror check + contract tests |
9
+ | Script | Purpose |
10
+ | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
11
+ | `npm run generate:contracts` | Regenerate runtime surface, create planner, agent customization pack, import-stack parity, module-layout, infra-stack |
12
+ | `npm run check:generated-contracts` | Verify committed JSON matches generators |
13
+ | `npm run sync:parity-snapshot` | Copy canonical → vscode `contracts/` mirror |
14
+ | `npm run check:parity-snapshot` | Verify mirrors match canonical |
15
+ | `npm run validate:contracts` | Generate check + mirror check + contract tests |
16
+ | `npm run check:agent-customization-drift` | Verify generated agent customization files are committed in a consumer workspace |
16
17
 
17
18
  Workflow: change code → `npm run generate:contracts` → `npm run sync:parity-snapshot` → commit npm + vscode `contracts/`.
18
19
 
@@ -37,6 +38,7 @@ Published under `../contracts/` (not duplicated in this folder):
37
38
  - `analyze-last-run.v1.json` — analyze evidence
38
39
  - `pipeline-last-run.v1.json` — governance pipeline orchestration
39
40
  - `create-planner-capabilities.v1.json` — native-create, external-create-adopt, and adopt-only capability lanes
41
+ - `agent-customization-pack.v1.json` — generated instructions, prompts, skills, agents, optional hooks, MCP-ready design metadata, target matrix, and drift state for AI agent surfaces
40
42
 
41
43
  Workspace intelligence (`../contracts/workspace-intelligence/`):
42
44
 
@@ -32,7 +32,7 @@ jobs:
32
32
  node-version: '20'
33
33
 
34
34
  - name: Install RapidKit CLI
35
- run: npm install -g rapidkit@latest
35
+ run: npm install --no-save rapidkit@latest
36
36
 
37
37
  - name: Run governance pipeline
38
38
  run: npx rapidkit pipeline --json --strict
@@ -41,7 +41,8 @@ jobs:
41
41
 
42
42
  - name: Sync and verify agent grounding
43
43
  run: |
44
- npx rapidkit workspace agent-sync --write --refresh-context --strict --json
44
+ npx rapidkit workspace agent-sync --write --refresh-context --strict --json --preset enterprise
45
+ node ./node_modules/rapidkit/scripts/check-agent-customization-drift.mjs --workspace .
45
46
  env:
46
47
  RAPIDKIT_NO_AGENT_SYNC: '0'
47
48
 
@@ -53,6 +54,8 @@ jobs:
53
54
  path: |
54
55
  .rapidkit/reports/INDEX.json
55
56
  .rapidkit/reports/workspace-context-agent.json
57
+ .rapidkit/reports/agent-customization-pack.json
58
+ .rapidkit/reports/rapidkit-mcp-design.json
56
59
  .rapidkit/reports/pipeline-last-run.json
57
60
  AGENTS.md
58
61
  if-no-files-found: ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidkit",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -43,7 +43,8 @@
43
43
  "docs",
44
44
  "data/modules-embeddings.json",
45
45
  "scripts/enforce-package-manager.cjs",
46
- "scripts/check-cli-resolution.cjs"
46
+ "scripts/check-cli-resolution.cjs",
47
+ "scripts/check-agent-customization-drift.mjs"
47
48
  ],
48
49
  "publishConfig": {
49
50
  "registry": "https://registry.npmjs.org",
@@ -64,12 +65,16 @@
64
65
  "test:e2e:user-first-install": "bash scripts/e2e-user-first-install.sh",
65
66
  "test": "vitest run",
66
67
  "test:drift": "node scripts/run-drift-guard.mjs",
67
- "sync:parity-snapshot": "node scripts/sync-import-stack-parity-snapshot.mjs",
68
- "check:parity-snapshot": "node scripts/sync-import-stack-parity-snapshot.mjs --check",
68
+ "benchmark:intelligence": "vitest run src/__tests__/workspace-intelligence-benchmark.test.ts",
69
+ "sync:shared-contracts": "node scripts/sync-shared-contracts.mjs",
70
+ "check:shared-contracts": "node scripts/sync-shared-contracts.mjs --check",
71
+ "sync:parity-snapshot": "node scripts/sync-shared-contracts.mjs",
72
+ "check:parity-snapshot": "node scripts/sync-shared-contracts.mjs --check",
69
73
  "generate:contracts": "node scripts/generate-shared-contracts.mjs",
70
74
  "check:generated-contracts": "node scripts/generate-shared-contracts.mjs --check",
71
- "validate:contracts": "npm run check:generated-contracts && npm run check:parity-snapshot && vitest run src/__tests__/contracts/",
72
- "test:parity-contract": "npm run check:parity-snapshot && vitest run src/__tests__/contracts/import-stack-parity.snapshot.test.ts",
75
+ "check:agent-customization-drift": "node scripts/check-agent-customization-drift.mjs",
76
+ "validate:contracts": "npm run check:shared-contracts && vitest run src/__tests__/contracts/",
77
+ "test:parity-contract": "npm run check:shared-contracts && vitest run src/__tests__/contracts/import-stack-parity.snapshot.test.ts",
73
78
  "test:watch": "vitest",
74
79
  "test:coverage": "vitest run --coverage",
75
80
  "test:prepare-embeddings": "node scripts/prepare-mock-embeddings.mjs",
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import path from 'node:path';
4
+
5
+ const GENERATED_AGENT_PATHS = [
6
+ '.rapidkit/reports/INDEX.json',
7
+ '.rapidkit/reports/agent-customization-pack.json',
8
+ '.rapidkit/reports/rapidkit-mcp-design.json',
9
+ '.rapidkit/reports/workspace-context-agent.json',
10
+ '.rapidkit/AGENT-GROUNDING.md',
11
+ 'AGENTS.md',
12
+ 'CLAUDE.md',
13
+ '.github/copilot-instructions.md',
14
+ '.github/instructions',
15
+ '.github/prompts',
16
+ '.github/skills/rapidkit-grounding',
17
+ '.github/skills/rapidkit-workspace-intelligence',
18
+ '.github/agents',
19
+ '.cursor/rules/rapidkit-grounding.mdc',
20
+ '.claude/rules/rapidkit-evidence.md',
21
+ '.vscode/rapidkit-agent-hooks.json',
22
+ ];
23
+
24
+ function parseWorkspaceArg(argv) {
25
+ const workspaceIndex = argv.indexOf('--workspace');
26
+ if (workspaceIndex >= 0 && argv[workspaceIndex + 1]) {
27
+ return argv[workspaceIndex + 1];
28
+ }
29
+ const inline = argv.find((arg) => arg.startsWith('--workspace='));
30
+ if (inline) {
31
+ return inline.slice('--workspace='.length);
32
+ }
33
+ return process.cwd();
34
+ }
35
+
36
+ function runGit(workspacePath, args) {
37
+ return spawnSync('git', ['-C', workspacePath, ...args], {
38
+ encoding: 'utf8',
39
+ stdio: ['ignore', 'pipe', 'pipe'],
40
+ });
41
+ }
42
+
43
+ const workspacePath = path.resolve(parseWorkspaceArg(process.argv.slice(2)));
44
+ const gitCheck = runGit(workspacePath, ['rev-parse', '--is-inside-work-tree']);
45
+
46
+ if (gitCheck.status !== 0 || gitCheck.stdout.trim() !== 'true') {
47
+ console.warn(
48
+ `[rapidkit] Agent customization drift check skipped: ${workspacePath} is not a git work tree.`
49
+ );
50
+ process.exit(0);
51
+ }
52
+
53
+ const status = runGit(workspacePath, ['status', '--porcelain', '--', ...GENERATED_AGENT_PATHS]);
54
+
55
+ if (status.status !== 0) {
56
+ console.error('[rapidkit] Failed to inspect generated agent customization drift.');
57
+ if (status.stderr.trim()) {
58
+ console.error(status.stderr.trim());
59
+ }
60
+ process.exit(status.status ?? 1);
61
+ }
62
+
63
+ const drift = status.stdout.trim();
64
+
65
+ if (drift.length > 0) {
66
+ console.error('[rapidkit] Agent customization drift detected.');
67
+ console.error(
68
+ 'Run `npx rapidkit workspace agent-sync --write --refresh-context --preset enterprise`, review the generated files, and commit the changes.'
69
+ );
70
+ console.error('');
71
+ console.error(drift);
72
+ process.exit(1);
73
+ }
74
+
75
+ console.log('[rapidkit] Agent customization files are in sync.');
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-T5LN7EO5.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-NKNMGWAZ.js';
@@ -1 +0,0 @@
1
- import {r,j,q}from'./chunk-7XW2I6MP.js';import l from'path';import c from'fs-extra';var x=new Set([...r().map(e=>e.id),...j().map(e=>e.kitId)]),v=[{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",status:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",status:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"laravel",aliases:["laravel","php-laravel"],ecosystem:"php",status:"planned",officialCommands:["composer create-project laravel/laravel <name>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",status:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",status:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],i=new Map;for(let e of v){i.set(e.id,e);for(let t of e.aliases)i.set(t,e);}var E=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function s(e){return e?.trim().toLowerCase()||void 0}function I(e){let t=s(e.kitId)??s(e.framework)??s(e.runtime)??"unknown";if(e.projectExists)return {lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let o=e.kitId?q(e.kitId):void 0;if(o&&x.has(o))return {lane:"native-create",status:"available",canExecuteCreate:true,requested:t,resolved:o,reason:"RapidKit owns the create contract, project marker, registry, doctor, and workspace model path."};let r=i.get(t)??i.get(s(e.framework)??"")??i.get(s(e.runtime)??"");if(r)return {lane:"external-create-adopt",status:r.status,canExecuteCreate:false,requested:t,resolved:r.id,officialCommands:r.officialCommands,fallbackLane:"adopt-only",reason:"External generator support is planned but not enabled; use adopt/import until RapidKit owns the post-create contract."};let n=s(e.runtime);return n&&E.has(n)?{lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,resolved:n,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function h(e){return !e.canExecuteCreate&&(e.lane==="external-create-adopt"||e.lane==="adopt-only"&&e.resolved!==void 0)}var b=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function m(e){try{if(!await c.pathExists(e))return null;let t=await c.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}function w(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return b.has(t)?t:null}async function S(e,t){let o=t??await m(l.join(e,".rapidkit","project.json")),r=w(o?.kind)??w(o?.type);if(r)return r;let n=await m(l.join(e,"package.json"));if(n){let a={...n.dependencies??{},...n.devDependencies??{}},k=n.scripts??{},d=Object.values(k).filter(C=>typeof C=="string").join(" ").toLowerCase();if(a.next||a.react||a.vue||a.svelte||a.vite||a["@angular/core"]||d.includes("next ")||d.includes("vite "))return "frontend";if(n.private===true&&!a.express&&!a["@nestjs/core"])return "library"}return await c.pathExists(l.join(e,"Dockerfile"))||await c.pathExists(l.join(e,"docker-compose.yml"))||await c.pathExists(l.join(e,"terraform.tf"))?"infra":"service"}export{I as a,h as b,S as c};
@@ -1 +0,0 @@
1
- import {b}from'./chunk-C7WILE56.js';import {r,j as j$1}from'./chunk-7XW2I6MP.js';import {e}from'./chunk-RELR4O5E.js';import {a}from'./chunk-HEG6DIGW.js';import f,{promises}from'fs';import i from'path';import E,{homedir}from'os';import {pathToFileURL}from'url';import l from'process';function R(t){let r=t.label.indexOf(" \u2014 ");return r>=0?t.label.slice(r+3).trim():t.label.trim()}function j(){let t=r().map(r=>({value:r.id,label:R(r),hint:r.description,name:r.label})),e=j$1().map(r=>({value:r.kitId,label:r.displayName,hint:r.commandDisplay("my-app"),name:`${r.displayName} \u2014 ${r.framework}`}));return [...t,...e]}var _=".rapidkitrc.json",F=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function yt(){let t=i.join(E.homedir(),_);try{let e$1=await promises.readFile(t,"utf-8"),r=JSON.parse(e$1);return e.debug(`Loaded config from ${t}`),r}catch{return e.debug("No user config found, using defaults"),{}}}async function vt(t=process.cwd()){let e$1=t,r=i.parse(e$1).root;for(;e$1!==r;){for(let n of F){let o=i.join(e$1,n);try{await promises.access(o),e.debug(`Found config file: ${o}`);let m=await import(pathToFileURL(o).href),P=m.default||m;return e.debug(`Loaded RapidKit config from ${n}`),P}catch{continue}}e$1=i.dirname(e$1);}return e.debug("No RapidKit config file found, using defaults"),{}}function bt(t,e,r){return {author:r.author||e.workspace?.defaultAuthor||t.author,pythonVersion:r.pythonVersion||e.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:r.defaultInstallMethod||e.workspace?.installMethod||t.defaultInstallMethod,defaultKit:r.defaultKit||e.projects?.defaultKit||t.defaultKit,skipGit:r.skipGit??e.projects?.skipGit??t.skipGit,license:r.license||t.license,testRapidKitPath:r.testRapidKitPath||t.testRapidKitPath}}function wt(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}var x="workspai",Rt="Workspai";function L(t){return f.existsSync(i.join(t,".rapidkit-workspace"))||f.existsSync(i.join(t,".rapidkit","workspace.json"))}function g(t=homedir()){return i.join(t,"rapidkit","workspaces")}function K(t=homedir()){return i.join(t,"Workspai","rapidkits")}function y(t,e=homedir()){return i.join(g(e),t)}function U(t,e=homedir()){return [y(t,e),i.join(K(e),t)]}function D(t,e={}){let r=e.homeDir??homedir();return e.outputDir?i.resolve(e.outputDir,t):y(t,r)}function jt(t,e=homedir()){for(let r of U(t,e))if(f.existsSync(r))return r}function Et(t,e="my-workspace"){let r=1;for(;;){let n=r===1?e:`${e}-${r}`,o=i.join(t,n);if(!f.existsSync(o))return {name:n,targetPath:o};r+=1;}}function S(t=homedir()){return [i.join(g(t),x),i.join(K(t),x)]}function Mt(t=homedir()){for(let e of S(t))if(L(e))return e;return y(x,t)}function T(t,e){let r=t.indexOf(e);if(r>=0&&r+1<t.length)return t[r+1];let n=t.find(o=>o.startsWith(`${e}=`));if(n)return n.slice(e.length+1)}function N(t){return t.includes("--here")}function W(t,e=l.cwd()){if(N(t))return i.resolve(e);let r=T(t,"--output");if(r)return i.resolve(r)}function $t(t,e=l.cwd()){let r=i.resolve(t),n=i.resolve(e),o=i.relative(n,r);return o.length>0&&!o.startsWith("..")&&!i.isAbsolute(o)?`cd ${o}`:`cd ${r}`}function Gt(t,e={}){let r=e.argv??[],n=e.outputParent??W(r,l.cwd());return D(t.trim(),{homeDir:e.homeDir,outputDir:n})}async function Ot(t,e={}){let r=e.cwd??l.cwd(),n=e.homeDir??homedir(),o=W(t,r);if(o!==void 0)return o;let h=e.hasYes??(t.includes("--yes")||t.includes("-y"));if(!(e.interactive??(!h&&!!l.stdin.isTTY&&!a())))return;let P=g(n),{location:A}=await b([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:[{value:"managed",label:"Managed home",hint:P},{value:"here",label:"Current directory",hint:r}],default:0}]);if(A==="here")return i.resolve(r)}export{j as a,yt as b,vt as c,bt as d,wt as e,Rt as f,g,jt as h,Et as i,Mt as j,$t as k,Gt as l,Ot as m};
@@ -1,2 +0,0 @@
1
- import {a,b,d}from'./chunk-FV5A3N3I.js';import {n,q,g}from'./chunk-YBS2HGO3.js';import {h,i,f,e}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-VKLL63TL.js';import M from'fs';import w from'path';import j from'chalk';import {execa}from'execa';function le(e){return M.existsSync(w.join(e,"bun.lock"))||M.existsSync(w.join(e,"bunfig.toml"))?"bun":M.existsSync(w.join(e,"pnpm-lock.yaml"))?"pnpm":M.existsSync(w.join(e,"yarn.lock"))?"yarn":(M.existsSync(w.join(e,"package-lock.json")),"npm")}function pe(e,r,t=le(e)){return t==="npm"?`npm run ${r}`:`${t} run ${r}`}function me(e,r=le(e)){return `${r} install`}var Fe={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Ae={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function fe(e$1,r,t){if(r){let o=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),a=e(r),f=`${e$1}-${a==="gofiber"?"fiber":a==="gogin"?"gin":a==="dotnet"?"aspnetcore":a!=="unknown"?a:o==="fiber"?"fiber":o==="aspnetcore"||o==="asp-net-core"?"aspnetcore":o}`,g=Fe[f];if(g&&g.commands[t])return g.commands[t]}let n=Ae[t]?.[e$1]??[];return n.length>0?n[0]:void 0}var Te={test:"test",build:"build",start:"start"};function U(e){if(e.stage==="init")return e.runtime==="node"?me(e.projectPath):fe(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=Te[e.stage];if(r){let t=g(e.projectPath,r,{framework:e.framework});if(t)return pe(e.projectPath,t.scriptName)}}return fe(e.runtime,e.framework,e.stage)}function Ne(e){let r=h(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,o)=>o.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function ge(e){return Ne(e).primary}function ye(e,r){if(!e)return "unknown";r||(r={setup:["ModuleNotFoundError","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[t,n]of Object.entries(r))for(let o of n)if(new RegExp(o,"i").test(e))return t;return "unknown"}async function G(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function he(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(o=>["init","test","build","start"].includes(o))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}var ke={init:"init",test:"test",build:"build",start:"start"};function Ie(e){return e in ke?ke[e]:null}function we(e,r,t=q(e)){let n=Ie(r);if(!n)return {supported:false,reason:`Workspace stage "${r}" is not part of the RapidKit fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No RapidKit project metadata was detected for this target."};let o=t.commandMap[n];return !o||o.status!=="supported"?{supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`}:{supported:true}}var We=new Set(["init","test","build","start"]),$e=new Set([".git","node_modules",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function W(e){try{return await M.promises.access(e,M.constants.F_OK),true}catch{return false}}async function De(e,r,t){if(r==="python"){let n=w.join(e,".rapidkit","cli.py");return await W(n)?{valid:true}:{valid:false,reason:"Project-local .rapidkit/cli.py is missing. Run `rapidkit init` in this project first."}}return G(t)}async function Y(e){let r=await M.promises.readFile(e,"utf-8");return JSON.parse(r)}function A(e){return e.replace(/\\/g,"/")}function Me(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function Oe(e){return a$1(e,{skipDirs:$e,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(r,t)=>await W(w.join(r,".rapidkit","context.json"))||await W(w.join(r,".rapidkit","project.json"))?true:w.resolve(r)===w.resolve(t)?false:h(r).length>0})}async function Le(e){for(let r of [w.join(".rapidkit","project.json"),w.join(".rapidkit","context.json")]){let t=w.join(e,r);if(await W(t))try{let n=await Y(t),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function _e(e,r,t){let n=Me(t);if(!n)return {projects:r,normalizedScope:null};let o=A(n).toLowerCase(),a=[];for(let d of r){let f=A(w.relative(e,d)),g=w.basename(d),m=await Le(d);[f,g,m].filter(i=>typeof i=="string"&&i.length>0).map(i=>A(i).toLowerCase()).includes(o)&&a.push(d);}if(a.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:a,normalizedScope:n}}async function Ge(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false});if(n.exitCode!==0)return new Set(r);let o=n.stdout.split(/\r?\n/).map(d=>d.trim()).filter(d=>d.length>0).map(d=>A(d));if(o.length===0)return new Set;let a=new Set;for(let d of r){let f=A(w.relative(e,d));if(!f||f===".")continue;let g=`${f}/`;o.some(m=>m===f||m.startsWith(g))&&a.add(d);}return a}async function Be(e,r,t){let n=w.join(e,".rapidkit","workspace.contract.json");if(await W(n))try{let s=await Ke(e,r,t,n);if(s.graphStatus!=="missing")return s}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let o=w.join(e,".rapidkit","workspace-dependency-graph.json");if(!await W(o))return {expanded:t,graphStatus:"missing",expansionDepth:0};let a;try{a=await Y(o);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let d=new Set(r.map(s=>w.resolve(s))),f=new Map;if(!a||typeof a!="object"||Array.isArray(a))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let g=Array.isArray(a.projects)?a.projects:[];for(let s of g){if(!s||typeof s!="object"||Array.isArray(s))continue;let x=s,S=typeof x.path=="string"?x.path:"",y=w.resolve(e,S);if(!d.has(y))continue;let c=Array.isArray(x.dependsOn)?x.dependsOn.filter(l=>typeof l=="string"):[];for(let l of c){let R=w.resolve(e,l);d.has(R)&&(f.has(R)||f.set(R,new Set),f.get(R)?.add(y));}}let m=new Set(t),b=[...m],i=0;for(;b.length>0;){let s=b.shift();if(!s)continue;let x=f.get(s);if(x)for(let S of x)m.has(S)||(m.add(S),b.push(S),i+=1);}return {expanded:m,graphStatus:"loaded",expansionDepth:i}}async function Ke(e,r,t,n){let o=await Y(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let a=o,d=Array.isArray(a.projects)?a.projects:null;if(!d)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let f=new Map,g=new Map;for(let y of r){let c=A(w.relative(e,y));g.set(c,w.resolve(y));}let m=new Map,b=new Map,i=new Map;for(let y of d){if(!y||typeof y!="object"||Array.isArray(y))continue;let c=y,l=typeof c.slug=="string"?c.slug:"",R=typeof c.relativePath=="string"?A(c.relativePath):l,v=g.get(R);!l||!v||f.set(l,v);}for(let y of d){if(!y||typeof y!="object"||Array.isArray(y))continue;let c=y,l=typeof c.slug=="string"?c.slug:"",R=f.get(l);if(!R)continue;let v=c.contracts&&typeof c.contracts=="object"&&!Array.isArray(c.contracts)?c.contracts:{},D=Array.isArray(v.dependsOn)?v.dependsOn.filter(h=>typeof h=="string"):[],T=Array.isArray(v.publishes)?v.publishes.filter(h=>typeof h=="string"):[],N=Array.isArray(v.consumes)?v.consumes.filter(h=>typeof h=="string"):[];for(let h of D){let C=f.get(h);C&&(i.has(C)||i.set(C,new Set),i.get(C)?.add(R));}for(let h of T)m.has(h)||m.set(h,new Set),m.get(h)?.add(R);for(let h of N)b.has(h)||b.set(h,new Set),b.get(h)?.add(R);}for(let[y,c]of m.entries()){let l=b.get(y);if(l)for(let R of c){i.has(R)||i.set(R,new Set);for(let v of l)v!==R&&i.get(R)?.add(v);}}let s=new Set(t),x=[...s],S=0;for(;x.length>0;){let y=x.shift();if(!y)continue;let c=i.get(y);if(c)for(let l of c)s.has(l)||(s.add(l),x.push(l),S+=1);}return {expanded:s,graphStatus:"loaded",expansionDepth:S}}async function Ve(e,r){if(typeof r=="boolean")return r;let t=w.join(e,".rapidkit","policies.yml");if(!await W(t))return true;let n="";try{n=await M.promises.readFile(t,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}async function J(e,r){let t=process.argv[1];if(!t)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};let n=await execa(process.execPath,[t,...e],{cwd:r,reject:false,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(n.exitCode??1),stdout:n.stdout,stderr:n.stderr}}function He(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"}function ze(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function Ue(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function Je(e$1){let r=i=>{let s=f(i);return s==="node"||s==="bun"?"node":s==="python"?"python":s==="go"?"go":s==="java"?"java":s==="php"?"php":s==="ruby"?"ruby":s==="rust"?"rust":s==="dotnet"?"dotnet":s==="elixir"?"elixir":s==="clojure"||s==="scala"||s==="kotlin"?"jvm-generic":ge(e$1)},t=i=>{if(!i)return;let s=e(i);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(s))return s},n$1=n(e$1),o=n$1?.detection??i(e$1,n$1?.projectJson??null),a=n$1?.contextJson,d=r(o.runtime),f$1=t(o.key),g={},m=new Set(["init","test","build","start"]);if(a?.commands&&typeof a.commands=="object")for(let[i,s]of Object.entries(a.commands))typeof s=="string"&&m.has(i)&&(g[i]=s);let b;if(a?.commandEnvironments&&typeof a.commandEnvironments=="object"){let i=a.commandEnvironments;b={dev:typeof i.dev=="string"?i.dev:void 0,staging:typeof i.staging=="string"?i.staging:void 0,prod:typeof i.prod=="string"?i.prod:void 0,default:typeof i.default=="string"?i.default:void 0};}return {runtime:d,framework:f$1,commandOverrides:Object.keys(g).length>0?g:void 0,environmentCommandVariants:b,environment:typeof a?.environment=="string"?a.environment:void 0}}async function qe(e,r,t,n,o,a,d){let f=!o?.[r]&&He(t),g;if(o&&o[r]?g=o[r]:f?g=`rapidkit ${r}`:g=U({projectPath:e,runtime:t,framework:n,stage:r}),!g)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let m=he(g,a,d);if(!m)return {exitCode:127,command:g,message:"Failed to resolve stage command",errorCategory:"runtime"};let b=U({projectPath:e,runtime:t,framework:n,stage:r});if(f){if(b){let c=f?await De(e,t,b):await G(b);if(!c.valid)return {exitCode:127,command:m,message:c.reason||"Command not available",errorCategory:"setup"}}}else {let c=await G(m);if(!c.valid)return {exitCode:127,command:m,message:c.reason||"Command not available",errorCategory:"setup"}}let i=0,s="",x="",S;try{let c=f?r==="init"&&ze()?await Ue(e):await J([r],e):await execa(m,[],{cwd:e,reject:false,shell:true});if(i=Number(c.exitCode??0),s=c.stdout,x=c.stderr,i!==0){let l=`${s}
2
- ${x}`;S=ye(l);}}catch(c){return {exitCode:1,command:m,message:c instanceof Error?c.message:"Command execution failed",errorCategory:"runtime"}}return {exitCode:i,command:m,errorCategory:S,healthStatus:void 0,message:i!==0?`Stage failed with exit code ${i}`:void 0}}function be(e){try{return JSON.parse(e)}catch{return null}}function Ye(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx rapidkit setup dotnet` or `npx rapidkit init`.";case "go":return "Install Go 1.21+, then rerun `npx rapidkit setup go` or `npx rapidkit init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx rapidkit setup java` or `npx rapidkit init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx rapidkit setup node` or `npx rapidkit init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx rapidkit setup python` or `npx rapidkit init`.";default:return null}}async function Qe(e){let r=[],t=await J(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let a=be(t.stdout)?.healthScore,d=Number(a?.errors??0);Number.isFinite(d)&&d>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${d} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await J(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=be(n.stdout),a=String(o?.overallStatus??"").toLowerCase();a==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):a==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}function Xe(e){return We.has(e)}function Ze(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function Ct(e){if(!Xe(e.stage))throw new Error(`Unsupported workspace run stage: ${e.stage}`);let r=Date.now(),t=w.resolve(e.workspacePath),n=await Oe(t),{projects:o,normalizedScope:a$1}=await _e(t,n,e.scope),d$1=e.affected===true,f=e.blastRadius===true,g=e.since?.trim()||"HEAD~1",m=d$1?await Ge(t,o,g):new Set(o),b$1,i="not-applicable",s=0,x="all";if(d$1&&f){let p=await Be(t,n,m);b$1=p.expanded,i=p.graphStatus,s=p.expansionDepth,x="affected+blast-radius";}else d$1?(b$1=m,x="affected"):(b$1=m,x="all");let S=e.stage==="init"?false:await Ve(t,e.enforceGates),y=S?await Qe(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],c=y.find(p=>p.status==="fail"),l=o.filter(p=>b$1.has(p)),R=e.continueOnError===true||e.stage==="init",v=e.parallel===true,D=Ze(e.maxWorkers,l.length),T=l.length,N=0;e.json||console.log(j.gray(`Workspace run (${e.stage}) started: ${T} target(s), ${v?`parallel x${D}`:"sequential"}`));let h=new Map;for(let p of n){let k=o.includes(p),u=k&&b$1.has(p);h.set(p,{path:p,relativePath:A(w.relative(t,p)),selected:u,affected:u,status:"skipped",exitCode:null,durationMs:0,reason:u?void 0:k?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(c)for(let p of l){let k=h.get(p);k&&(k.status="skipped",k.reason=`blocked by ${c.gate}`);}else {let p=async k=>{let u=h.get(k);if(!u)return;let $=A(w.relative(t,k));e.json||console.log(j.gray(`\u23F3 [${N}/${T}] ${e.stage} ${$}`)),u.selected=true,u.affected=true;let P=Date.now(),{runtime:E,framework:F,commandOverrides:ve,environmentCommandVariants:Se,environment:je}=await Je(k);u.runtimeDetected=E,u.framework=F;let te=we(k,e.stage);if(!te.supported){u.status="skipped",u.reason=te.reason??`stage "${e.stage}" unsupported for project`,u.durationMs=Date.now()-P,u.exitCode=null,N+=1;return}let I=await qe(k,e.stage,E,F,ve,Se,je);if(u.executionCommand=I.command,u.errorCategory=I.errorCategory,u.healthStatus=I.healthStatus,u.durationMs=Date.now()-P,u.exitCode=I.exitCode,I.exitCode===0?(u.status="passed",u.reason=void 0):(u.status="failed",u.reason=I.message||"stage command failed",u.errorMessage=I.message),N+=1,!e.json){let Ee=T>0?Math.round(N/T*100):100,Ce=u.status==="passed"?j.green("\u2705"):j.red("\u274C");if(console.log(j.gray(`${Ce} [${N}/${T}] (${Ee}%) ${$} ${u.durationMs}ms`)),u.status==="failed"){u.reason&&console.log(j.red(` Reason: ${u.reason}`)),u.executionCommand&&console.log(j.gray(` Command: ${u.executionCommand}`));let re=Ye(u.runtimeDetected);re&&u.errorCategory==="setup"&&console.log(j.gray(` Hint: ${re}`));}}};if(v&&l.length>1){let k=0,u=false,$=new Array(D).fill(null).map(async()=>{for(;k<l.length;){if(u&&!R)return;let P=k;k+=1;let E=l[P];await p(E),h.get(E)?.status==="failed"&&(u=true);}});if(await Promise.all($),!R&&u){let P=false;for(let E of l){let F=h.get(E);if(F){if(F.status==="failed"){P=true;continue}P&&F.status==="skipped"&&(F.reason=F.reason||"stopped after failure");}}}}else for(let k of l){await p(k);let u=h.get(k);if(!R&&u?.status==="failed"){let $=l.slice(l.indexOf(k)+1);for(let P of $){let E=h.get(P);E&&(E.status="skipped",E.reason="stopped after failure");}break}}}let C=[];for(let p of n){let k=h.get(p);k&&C.push(k);}let Q=C.filter(p=>p.status==="passed").length,K=C.filter(p=>p.status==="failed").length,X=C.filter(p=>p.status==="skipped").length,Z=e.strict===true,xe=K>0||Z&&y.some(p=>p.status==="fail"||p.status==="warn")?1:0,ee={schemaVersion:"1.0",workspacePath:t,stage:e.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:d$1,blastRadius:f,since:d$1?g:null,parallel:v,maxWorkers:D,continueOnError:R,strict:Z,enforceGates:S,scope:a$1},selection:{mode:x,since:d$1?g:null,scope:a$1,graphStatus:i,expansionDepth:s},gates:{enforced:S,results:y,blocked:!!c,blockingGate:c?.gate},summary:{projectCount:n.length,selectedCount:l.length,passed:Q,failed:K,skipped:X,exitCode:xe},projects:C,enterpriseControls:{jsonReady:true,evidencePath:b}},Re=w.join(t,".rapidkit","reports",a);return await d(t,ee),e.json||(c&&(console.log(j.red(`\u274C Workspace run blocked by ${c.gate}`)),console.log(j.gray(` ${c.summary}`))),console.log(j.cyan(`Workspace run (${e.stage}) => passed: ${Q}, failed: ${K}, skipped: ${X}`)),console.log(j.gray(`Report: ${Re}`))),ee}export{Ct as a};
@@ -1,4 +0,0 @@
1
- import {c as c$1}from'./chunk-NFUXULIF.js';import {a as a$1,b as b$1,d as d$2,c,f}from'./chunk-YBS2HGO3.js';import {a,b}from'./chunk-KMUWWZRT.js';import {e,d}from'./chunk-B2KOIORF.js';import u from'chalk';import d$1 from'fs';import h from'fs-extra';import l from'path';var G="release-readiness-v1";function $(t,e){let a=l.resolve(t);if(!b(a))return a;let s=l.join(e,".rapidkit","workspace.contract.json");if(d$1.existsSync(s))try{let i=JSON.parse(d$1.readFileSync(s,"utf-8")),n=Array.isArray(i.projects)?i.projects:[];for(let c of n){let f=p(c),g=typeof f.relativePath=="string"?f.relativePath.trim():"";if(g)return l.join(e,g)}}catch{}let r=x(e),o=Array.isArray(r.payload?.projects)?r.payload.projects:[];for(let i of o){let n=p(i),c=typeof n.path=="string"?n.path.trim():"";if(c)return l.resolve(c)}return a}function I(t){let e=a$1(t);return b$1(e,t)?"go":d$2(e,t)?"java":c(e,t)?"node":f(e,t)?"python":"unknown"}function O(t,e){if(!d$1.existsSync(t))return null;let a=d$1.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>l.join(t,s));return a.length===0?null:(a.sort((s,r)=>d$1.statSync(r).mtimeMs-d$1.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function V(t){let{readWorkspaceRegistrySummary:e,resolveWorkspaceRegisteredProjects:a}=await import('./workspace-registry-summary-MIPHVB56.js'),s=await e(t);return s?s.projectCount:(await a(t)).summary.projectCount}function z(t,e,a){let s=l.join(t,".rapidkit","toolchain.lock");if(!d$1.existsSync(s))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:s};try{let r=JSON.parse(d$1.readFileSync(s,"utf-8")),o=p(r.runtime),n=["python","node","go","java"].filter(c=>{let f=p(o[c]);return typeof f.version=="string"&&f.version.trim().length>0});if(n.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:s};if(e!=="unknown"){let c=p(o[e]);if(typeof c.version!="string"||c.version.trim().length===0)return {gate:"env",status:"fail",summary:`${a?.hasRegisteredProjects?"Project runtime":"Workspace"} (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:s}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${n.join(", ")}`,details:[],evidencePath:s}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:s}}}function x(t){let e=l.join(t,".rapidkit","reports","doctor-last-run.json");if(!d$1.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(d$1.readFileSync(e,"utf-8"));return c$1(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function L(t){let e=x(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 D(t){let e=l.join(t,".rapidkit","reports","analyze-last-run.json");if(!d$1.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(d$1.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 J(t){try{let e=JSON.parse(d$1.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 W(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=l.join(t,".rapidkit","reports"),s=O(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return J(s);let r=l.join(a,"workspace-contract-verify-last-run.json"),o=O(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(d$1.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-D5O4OZD5.js'),n=await i({workspacePath:t}),c={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 h.ensureDir(a),await h.writeJSON(r,c,{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:l.join(a,"*verify*.json")}}}function F(t,e){let a=l.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 c=Number(n.vulnerabilities??0);return Number.isFinite(c)?i+Math.max(0,c):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 M(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function _(t,e){let a=l.join(t,".rapidkit","reports","release-readiness-last-run.json");return await h.ensureDir(l.dirname(a)),await h.writeJSON(a,e,{spaces:2}),a}async function K(t={}){let e$1=l.resolve(t.startPath??process.cwd()),a$1=a(e$1)??e$1,s=$(e$1,a$1),r=I(s),o=await V(a$1)>0,i=z(a$1,r,{hasRegisteredProjects:o}),n=L(a$1),c=D(a$1),f=await W(a$1,{skipVerify:t.skipVerify}),g=F(n.payload,a$1),k=[i,n.gate,c,f,g],v=M(k),m={schemaVersion:G,generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:s,action:t.action,overallStatus:v,blocking:v==="fail",blockingReasons:k.filter(y=>y.status==="fail").map(y=>`${y.gate}: ${y.summary}`),gates:k};if(t.writeReport!==false){let y=e(m,{commandId:"workspaceReadiness",exitCode:v==="fail"?2:v==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:d()});m.evidencePath=await _(a$1,y);}return m}function H(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}function B(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}async function se(t){let e=await K({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(u.bold.cyan(`
2
- \u{1F6A6} RapidKit Release Readiness
3
- `)),console.log(u.bold(`Workspace: ${u.cyan(l.basename(e.workspacePath))}`)),console.log(u.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${B(e.overallStatus)}`);for(let a of e.gates){console.log(` - ${a.gate}: ${H(a.status)} ${a.summary}`);for(let s of a.details)console.log(u.gray(` ${s}`));a.evidencePath&&console.log(u.gray(` evidence: ${a.evidencePath}`));}e.evidencePath&&console.log(u.gray(`
4
- Evidence saved: ${e.evidencePath}`));}t.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{K as a,se as b};
@@ -1,2 +0,0 @@
1
- import {d,b,a}from'./chunk-XESEBTPE.js';import U from'crypto';import l from'path';import w from'fs-extra';import {spawnSync}from'child_process';function j(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function J(e){let t=[],r=[],o=[];for(let c of e.split(`
2
- `)){if(!c.trim())continue;let n=c.slice(0,2),s=c.slice(3).trim();if(s){if(n==="??"){r.push(s);continue}n.includes("D")&&o.push(s),t.push(s);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(r)].sort(),deletedFiles:[...new Set(o)].sort()}}function T(e,t){let r={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},o=j(e,["rev-parse","--is-inside-work-tree"]);if(!o.ok||o.stdout!=="true")return r;let c=j(e,["rev-parse","--abbrev-ref","HEAD"]),n=j(e,["rev-parse","HEAD"]),s=j(e,["status","--porcelain=v1","--untracked-files=all"]),i=J(s.stdout),p=i.changedFiles.length>0||i.untrackedFiles.length>0||i.deletedFiles.length>0;return {available:true,branch:c.ok?c.stdout:void 0,commit:n.ok?n.stdout:void 0,ref:t?.ref,dirty:p,changedFiles:i.changedFiles,untrackedFiles:i.untrackedFiles,deletedFiles:i.deletedFiles}}var G="workspace-model-snapshot.v1",$="workspace-model-diff.v1",S=".rapidkit/reports/workspace-model-snapshot.json",N=".rapidkit/reports/workspace-model-diff-last-run.json",Q="workspace-impact.v1",X=".rapidkit/reports/workspace-impact-last-run.json";function B(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function Y(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function F(e){if(Array.isArray(e))return e.map(t=>F(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=F(e[r]);return t}return e}function u(e){return JSON.stringify(F(e))}function R(e){let t={...e,generatedAt:"<ignored>",validation:e.validation?{...e.validation,issues:e.validation.issues.map(r=>({...r})).sort((r,o)=>{let c=`${r.severity}:${r.code}:${r.target}:${r.message}`,n=`${o.severity}:${o.code}:${o.target}:${o.message}`;return c.localeCompare(n)})}:void 0};return U.createHash("sha256").update(u(t)).digest("hex")}function L(e,t){return l.isAbsolute(t)?t:l.join(e,t)}async function Z(e){let t=await w.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion===G){let o=r;if(!o.model||o.model.schemaVersion!==a)throw new Error(`Invalid workspace model snapshot: ${e}`);return {model:o.model,hash:o.modelHash||R(o.model)}}if(r.schemaVersion===a){let o=r;return {model:o,hash:R(o)}}throw r.schemaVersion===$?new Error(`workspace diff --from received a diff report (${l.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${S}. To analyze an existing diff report, run: npx rapidkit workspace impact --from ${l.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(r.schemaVersion)}`)}async function ee(e){let t=await w.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==$)return null;let o=r;if(!o.currentModel||o.currentModel.schemaVersion!==a||!o.summary||!Array.isArray(o.changes))throw new Error(`Invalid workspace model diff report: ${e}`);return o}async function Pe(e){let t=e.model??await d({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:G,generatedAt:(e.now??new Date).toISOString(),modelHash:R(t),modelRef:b,model:t}}async function Me(e,t){let r=l.join(t,S);return await w.ensureDir(l.dirname(r)),await w.writeJson(r,e,{spaces:2}),r}function C(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function te(e,t){let r=[],o=["name","profile","type"],c=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let n of o){let s=e.workspace[n],i=t.workspace[n];u(s)!==u(i)&&h(r,{type:"workspace.changed",severity:"info",target:`workspace.${n}`,message:`Workspace metadata field changed: ${String(n)}`,before:s,after:i});}for(let n of c){let s=e.identity[n],i=t.identity[n];u(s)!==u(i)&&h(r,{type:"workspace.changed",severity:"info",target:`identity.${n}`,message:`Workspace identity field changed: ${String(n)}`,before:s,after:i});}return u(e.policies)!==u(t.policies)&&h(r,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),u(e.evidence)!==u(t.evidence)&&h(r,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),u(e.discovery)!==u(t.discovery)&&h(r,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(r,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),r}function re(e,t){let r=e.validation??null,o=t.validation??null;return u(r)===u(o)?[]:[{type:"validation.changed",severity:o?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:r,after:o}]}function oe(e,t){let r=[],o=new Map(e.projects.map(n=>[n.path,n])),c=new Map(t.projects.map(n=>[n.path,n]));for(let[n,s]of c.entries()){let i=o.get(n);if(!i){h(r,{type:"project.added",severity:"info",target:n,message:`Project added: ${s.name}`,after:C(s)});continue}let p=C(i),d=C(s);if(u(p)!==u(d)){let g=i.runtime!==s.runtime||i.framework!==s.framework;h(r,{type:"project.changed",severity:g?"warning":"info",target:n,message:`Project changed: ${s.name}`,before:p,after:d});}}for(let[n,s]of o.entries())c.has(n)||h(r,{type:"project.removed",severity:"warning",target:n,message:`Project removed: ${s.name}`,before:C(s)});return r.sort((n,s)=>`${n.type}:${n.target}`.localeCompare(`${s.type}:${s.target}`))}async function ne(e){let t=l.resolve(e.workspacePath),r=B(e.fromPath),o=r?Y(e.fromPath):void 0,c=e.fromPath;if(r){let m=l.join(t,S);if(!await w.pathExists(m))throw new Error("Git-aware workspace diff requires an existing snapshot at .rapidkit/reports/workspace-model-snapshot.json. Run: npx rapidkit workspace snapshot --json");c=S;}let n=L(t,c),s=await Z(n),i=e.model??await d({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),p=R(i),d$1=[...te(s.model,i),...oe(s.model,i),...re(s.model,i)],g;e.includeGitObservation!==false&&(g=e.gitObservation??T(t,{ref:o}),g.available&&ie(d$1,g,i));let y=d$1.filter(m=>m.type.startsWith("git.")).length,v=s.hash!==p,I=r?`git:${o??"HEAD"}`:l.relative(t,n).split(l.sep).join("/");return {schemaVersion:$,generatedAt:(e.now??new Date).toISOString(),fromRef:I,toRef:b,fromHash:s.hash,toHash:p,summary:{changed:v||y>0,addedProjects:d$1.filter(m=>m.type==="project.added").length,removedProjects:d$1.filter(m=>m.type==="project.removed").length,changedProjects:d$1.filter(m=>m.type==="project.changed").length,workspaceChanges:d$1.filter(m=>m.type==="workspace.changed").length,validationChanges:d$1.filter(m=>m.type==="validation.changed").length,gitChangedFiles:y},git:g?.available?ce(g,o):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:d$1,currentModel:i}}async function je(e,t){let r=l.join(t,N);return await w.ensureDir(l.dirname(r)),await w.writeJson(r,e,{spaces:2}),r}function O(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function V(e){return e.reduce((t,r)=>O(r)>O(t)?r:t,"none")}function H(e){return e.join(" ")}function W(e,t,r,o){return {id:e,label:t,scope:o.scope,project:o.project,display:H(["npx","rapidkit",...r]),execute:H(["npx","--yes","--package","rapidkit","rapidkit",...r]),required:o.required!==false}}function ae(e){let t=`project:${e.name}`;return [W(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:e.commands.fleetStages.includes("test")}),W(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:e.commands.fleetStages.includes("build")})]}function E(){return [W("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),W("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),W("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),W("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),W("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false})]}function se(e,t){let r=t.split(l.sep).join("/");return e.projects.filter(c=>{let n=c.path.split(l.sep).join("/");return r===n||r.startsWith(`${n}/`)}).sort((c,n)=>n.path.length-c.path.length)[0]}function ie(e,t,r){let o=new Set(e.map(n=>n.target)),c=(n,s)=>{let i=s.split(l.sep).join("/"),p=`git:${i}`;if(o.has(p))return;let d=se(r,i),g=d?`${d.name} (${d.path})`:"workspace";h(e,{type:n,severity:n==="git.deleted"?"warning":"info",target:p,message:`Git ${n==="git.untracked"?"untracked":n==="git.deleted"?"deleted":"changed"} file affects ${g}: ${i}`,after:{path:i,project:d?.name,projectPath:d?.path}}),o.add(p);};for(let n of t.changedFiles)c("git.file.changed",n);for(let n of t.untrackedFiles)c("git.untracked",n);for(let n of t.deletedFiles)c("git.deleted",n);}function ce(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function pe(e){let t=new Set,r=[];for(let o of e){let c=`${o.scope}:${o.project??""}:${o.display}`;t.has(c)||(t.add(c),r.push(o));}return r}function de(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function le(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function fe(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(r=>r.severity==="critical"?false:r.type.startsWith("git.")||r.type==="validation.changed")?e.risk:O(e.risk)>=O("high")||e.risk==="medium"?"low":e.risk}function me(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,l.basename(t.path),t.absolutePath].filter(o=>typeof o=="string"&&o.trim().length>0).map(o=>o.trim().toLowerCase()).includes(r)}function ue(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(r=>r.project?.name??r.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function Ce(e){let t=l.resolve(e.workspacePath),r=B(e.fromPath),o=e.diff;if(!o&&!r){let a=L(t,e.fromPath);o=await ee(a)??void 0;}o||(o=await ne({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let c=new Map(o.currentModel.projects.map(a=>[a.path,a])),n=new Map(o.currentModel.projects.map(a=>[a.name,a])),s=o.changes.filter(a=>a.type.startsWith("project.")),i=new Map;for(let a of s){let f=(c.get(a.target)??(typeof a.before?.name=="string"?n.get(a.before.name):void 0))?.path??a.target,b=i.get(f)??[];b.push(a),i.set(f,b);}let p=[];for(let[a,k]of i.entries()){let f=c.get(a);if(f&&!me(e.scope,f))continue;let b=V(k.map(de)),_=f?.name??(typeof k[0]?.before?.name=="string"?String(k[0].before.name):a);p.push({id:`project:${_}`,scope:"project",target:a,title:`Project impact: ${_}`,summary:k.map(P=>P.message).join(" "),risk:b,reasons:k.map(P=>`${P.type}: ${P.message}`),project:f?{name:f.name,path:f.path,kind:f.kind,runtime:f.runtime,framework:f.framework,supportTier:f.supportTier,...f.generator?{generator:f.generator}:{}}:void 0,verification:f?ae(f):E()});}let d=o.changes.filter(a=>!a.type.startsWith("project.")),g=o.currentModel.summary?.projectCount??o.currentModel.projects.length,y=d.map(a=>({id:`workspace:${a.target}`,scope:"workspace",target:a.target,title:`Workspace impact: ${a.target}`,summary:a.message,risk:le(a,{projectCount:g}),reasons:[`${a.type}: ${a.message}`],verification:E()})),v=pe([...p.flatMap(a=>a.verification),...y.flatMap(a=>a.verification),...o.summary.changed?E():[]]).filter(a=>a.required),I=V([...p.map(a=>a.risk),...y.map(a=>a.risk)]),m=fe({risk:I,affectedProjects:p.length,projectCount:g,changes:o.changes}),x={changed:o.summary.changed,risk:m,affectedProjects:p.length,workspaceItems:y.length,recommendedCommands:v.length};return {schemaVersion:Q,generatedAt:(e.now??new Date).toISOString(),fromRef:o.fromRef,diffRef:N,workspace:{name:o.currentModel.workspace.name,profile:o.currentModel.workspace.profile,type:o.currentModel.workspace.type},summary:x,affectedProjects:p.sort((a,k)=>a.target.localeCompare(k.target)),workspaceImpact:y.sort((a,k)=>a.target.localeCompare(k.target)),verificationPlan:v,agentBrief:ue({changed:x.changed,risk:m,affectedProjects:p,workspaceImpact:y}),diff:o}}async function Se(e,t){let r=l.join(t,X);return await w.ensureDir(l.dirname(r)),await w.writeJson(r,e,{spaces:2}),r}export{G as a,$ as b,S as c,N as d,Q as e,X as f,B as g,Y as h,Pe as i,Me as j,ne as k,je as l,E as m,Ce as n,Se as o};
@@ -1 +0,0 @@
1
- import {c as c$1,a,e,b}from'./chunk-HEG6DIGW.js';import {randomUUID}from'crypto';var i=null;function g(){return i}function w(t){let r=t.argv??process.argv,n=v(r.slice(2)),e$1={runId:randomUUID(),startedAt:new Date().toISOString(),command:n,cwd:t.cwd??process.cwd(),rapidkitVersion:t.rapidkitVersion,finalized:false};return i=e$1,c$1(e$1.runId),a(r)&&e(l(e$1,"run.started","info","CLI run started")),e$1}function R(t,r){if(!(!i||i.finalized)){if(i.finalized=true,!a()){i=null;return}t===0?e(l(i,"run.completed","info",r??"CLI run completed",{exitCode:t})):e(l(i,"run.failed","error",r??"CLI run failed",{exitCode:t})),i=null;}}function v(t){let r=[];for(let n=0;n<t.length;n+=1){let e=t[n];if(e!=="--log-json"){if(e==="--log-format"){n+=1;continue}e.startsWith("--log-format=")||r.push(e);}}return r}function l(t,r,n,e,o){return {schemaVersion:b,runId:t.runId,timestamp:new Date().toISOString(),level:n,event:r,component:"cli",message:e,command:t.command,metadata:{cwd:t.cwd,rapidkitVersion:t.rapidkitVersion,startedAt:t.startedAt,...o}}}var c=false;function T(t){if(c||!t?.force&&(process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"))return;c=true;let r=process.exit.bind(process);process.exit=(n=>{let e=typeof n=="number"?n:typeof n=="string"?Number.parseInt(n,10):0,o=Number.isFinite(e)?e:1;return R(o),r(n)});}function y(){return g()?.runId}function h(t,r){let{blockers:n,stderrTail:e,runId:o,generatedAt:f,...m}=r,p=f||(typeof t.generatedAt=="string"?t.generatedAt:void 0)||(typeof t.timestamp=="string"?t.timestamp:void 0)||new Date().toISOString();return {...t,...m,generatedAt:p,...n&&n.length>0?{blockers:n}:{},...e&&e.trim()?{stderrTail:e.trim()}:{},...o?{runId:o}:{}}}export{w as a,R as b,T as c,y as d,h as e};
@@ -1 +0,0 @@
1
- import {a as a$2}from'./chunk-RELR4O5E.js';import {a as a$1}from'./chunk-HEG6DIGW.js';import {intro,confirm,isCancel,password,text,multiselect,select,cancel}from'@clack/prompts';var c=false;function S(n){if(a$1()||c)return;c=true;let i=`${a$2.brand("\u25C6")} ${a$2.white("RapidKit")}${n?a$2.dim(` ${n}`):""}`;intro(i);}function a(n="Cancelled"){a$1()||(cancel(a$2.dim(n)),c=false);}function m(n){if(n)return i=>{let e=n(i);if(e!==true)return e===false?"Invalid value":e}}function v(n){return n.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"").trim()}function E(n){let i=v(n);for(let e of [" \u2014 "," \u2013 "," - "]){let t=i.indexOf(e);if(t>0)return {label:i.slice(0,t).trim(),hint:i.slice(t+e.length).trim()}}return {label:i}}function g(n){if(n.label)return {label:n.label,hint:n.hint};let i=E(n.name??String(n.value));return {label:i.label,hint:n.hint??i.hint}}function w(n,i){if(typeof n=="number")return n;if(n===void 0)return;let e=i.findIndex(t=>t.value===n);return e>=0?e:void 0}function h(n,i){return n.when===void 0?true:typeof n.when=="function"?n.when(i):n.when}async function Q(n,i){let e=n,t=v(e.message??e.name);if(e.type==="confirm"){let r=await confirm({message:t,initialValue:typeof e.default=="boolean"?e.default:false,active:a$2.success("yes"),inactive:a$2.dim("no")});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="password"){let r=await password({message:t,validate:m(e.validate)});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="input"){let r=await text({message:t,defaultValue:typeof e.default=="string"?e.default:void 0,initialValue:typeof e.default=="string"?e.default:void 0,validate:m(e.validate),placeholder:typeof e.default=="string"?e.default:void 0});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="checkbox"){let r=[...e.choices??[]],l=await multiselect({message:t,options:r.map(u=>{let s=g(u);return {value:u.value,label:s.label,hint:s.hint}}),required:false});return isCancel(l)&&(a(),process.exit(130)),l}if(e.type==="rawlist"||e.type==="list"){let r=[...e.choices??[]].filter(s=>!s.disabled),l=w(e.default,r),u=await select({message:t,options:r.map(s=>{let p=g(s);return {value:s.value,label:p.label,hint:p.hint}}),initialValue:l!==void 0?r[l]?.value:void 0});return isCancel(u)&&(a(),process.exit(130)),u}throw new Error(`Unsupported prompt type: ${e.type}`)}async function A(n){if(a$1()){let e={};for(let t of n)if(h(t,e))if(t.default!==void 0)e[t.name]=t.default;else if(t.type==="confirm")e[t.name]=false;else if(t.type==="checkbox")e[t.name]=[];else if(t.choices?.length){let r=w(t.default,[...t.choices]);e[t.name]=r!==void 0?t.choices[r]?.value:t.choices[0]?.value;}else e[t.name]="";return e}let i={};for(let e of n)h(e,i)&&(i[e.name]=await Q(e));return i}export{S as a,A as b};
@@ -1,2 +0,0 @@
1
- var m="RAPIDKIT_LOG_FORMAT";function c(e=process.argv){let r=process.env[m]?.trim().toLowerCase();if(r==="json")return "json";if(r==="text")return "text";for(let o=0;o<e.length;o+=1){let t=e[o];if(t==="--log-json")return "json";if(t==="--log-format"){let n=e[o+1]?.trim().toLowerCase();if(n==="json")return "json";if(n==="text")return "text"}if(t?.startsWith("--log-format=")){let n=t.slice(13).trim().toLowerCase();if(n==="json")return "json";if(n==="text")return "text"}}return "text"}function a(e=process.argv){return c(e)==="json"}var l="cli-log-event-v1";var g="unknown-run";function I(e){g=e;}function u(){return g}function d(e){return {schemaVersion:l,runId:u(),timestamp:new Date().toISOString(),level:e.level,event:e.event,component:e.component,message:e.message,...e.command?{command:e.command}:{},...e.metadata&&Object.keys(e.metadata).length>0?{metadata:p(e.metadata)}:{}}}function R(e){a()&&f(d(e));}function f(e){process.stderr.write(`${JSON.stringify(e)}
2
- `);}function p(e){let r={};for(let[o,t]of Object.entries(e))if(t!==void 0){if(t instanceof Error){r[o]={name:t.name,message:t.message};continue}if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"){r[o]=t;continue}if(Array.isArray(t)){r[o]=t.map(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:String(n));continue}r[o]=String(t);}return r}export{a,l as b,I as c,R as d,f as e};
@@ -1,2 +0,0 @@
1
- import {d}from'./chunk-XESEBTPE.js';import d$1 from'path';import u from'fs-extra';var k="workspace-context.v1",f=".rapidkit/reports/workspace-context-agent.json";function w(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function h(e){return `npx --yes --package rapidkit rapidkit ${e}`.trim()}function y(e){return `npx rapidkit ${e}`.trim()}function i(e){return {id:e.id,scope:e.scope,display:y(e.args),execute:h(e.args),description:e.description,...e.project?{project:e.project}:{}}}function g(e,t){return `workspace run ${t} --scope project:${e.name}`}function j(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function C(e){return [e.name,e.path,d$1.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function v(e,t){let s=[i({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model."}),i({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification."}),i({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop."}),i({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges."}),i({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions."})],r=t?[t]:e.projects;for(let o of r)o.commands.fleetStages.includes("test")&&s.push(i({id:`project.${o.name}.test`,scope:"project",project:o.name,args:g(o,"test"),description:`Run tests for ${o.name} through workspace orchestration.`})),o.commands.fleetStages.includes("build")&&s.push(i({id:`project.${o.name}.build`,scope:"project",project:o.name,args:g(o,"build"),description:`Build ${o.name} through workspace orchestration.`}));return s}function x(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function W(e,t){if(!t?.startsWith("project:"))return;let s=j(t);if(s)return e.projects.find(r=>C(r).includes(s))}function b(e,t,s){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let o=r.filter(a=>a.severity==="error").length,c=r.filter(a=>a.severity==="warning").length;return {status:o>0?"failed":c>0?"warning":"passed",errors:o,warnings:c,issues:r}}function S(e){let t=[],s=[];for(let[r,o]of Object.entries(e.evidence))o?.exists?t.push(`${r}: ${o.path}`):s.push(r);return {available:t.sort(),missing:s.sort()}}function P(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?e.summary.runtimes.join(", "):"no runtime",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s} runtime coverage, and ${r}.`}function A(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function O(e){let t=e.model??await d({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),s=w(e.agent),r=W(t,e.scope),o=b(t,e.scope,r);if(e.strict===true&&o.status!=="passed"){let n=o.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let c=(r?[r]:t.projects).map(n=>({name:n.name,path:n.path,kind:n.kind,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},createCapability:n.createCapability,supportTier:n.supportTier,safeCommands:x(n),importantFiles:n.importantFiles})),a=S(t),m=P(t);return {schemaVersion:k,generatedAt:(e.now??new Date).toISOString(),agent:s,workspaceSummary:m,modelRef:".rapidkit/reports/workspace-model.json",workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...r?{activeProject:r.name}:{}},projects:c,safeCommands:v(t,r),evidence:a,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:o,agentInstructions:["Read `.rapidkit/reports/INDEX.json` first, then this context pack and linked evidence reports.","Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx rapidkit workspace agent-sync --write --refresh-context`."],unsafeAssumptions:A(t),humanSummary:[m,`Evidence available: ${a.available.length}. Missing evidence groups: ${a.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `)}}async function D(e,t){let s=d$1.join(t,f);return await u.ensureDir(d$1.dirname(s)),await u.writeJSON(s,e,{spaces:2}),s}export{k as a,f as b,O as c,D as d};
@@ -1,2 +0,0 @@
1
- import {a,d as d$1}from'./chunk-HEG6DIGW.js';import {spinner,log,note}from'@clack/prompts';import o from'picocolors';function p(r,t,e){d$1({level:t==="failed"?"error":t==="warn"?"warn":"info",event:"progress",component:r.component,message:e,metadata:{phase:r.phase,status:t,...r.metadata}});}function b(r,t){let e=r;if(a())return p(t,"started",r),{start(n){return n&&(e=n),p(t,"started",e),this},succeed(n){p(t,"succeeded",n??e);},fail(n){p(t,"failed",n??e);},warn(n){p(t,"warn",n??e);},stop(n){p(t,"succeeded",n??e);},get text(){return e},set text(n){e=n,p(t,"started",n);}};let s=spinner();return s.start(r),{start(n){return s.start(n??e),n&&(e=n),this},succeed(n){s.stop(n??e);},fail(n){s.stop(n??e,1);},warn(n){s.stop(n??e);},stop(n){s.stop(n??e);},get text(){return e},set text(n){e=n,s.message(n);}}}function J(r,t){return b(r,t)}function h(r,t,e,s="create"){d$1({level:"info",event:"progress",component:s,message:e,metadata:{phase:"step",stepNum:r,total:t,status:"started"}});}function R(r){d$1({level:r.status==="failed"?"error":"info",event:"progress",component:r.component??"create",message:r.message,metadata:{phase:r.phase??"workspace.install.pypi",status:r.status,installMethod:r.installMethod,...r.attempt!==void 0?{attempt:r.attempt}:{},...r.maxAttempts!==void 0?{maxAttempts:r.maxAttempts}:{}}});}var c={brand:r=>o.cyan(r),accent:r=>o.magenta(r),value:r=>o.cyan(r),dim:r=>o.gray(r),muted:r=>o.dim(r),success:r=>o.green(r),warn:r=>o.yellow(r),error:r=>o.red(r),white:r=>o.white(r),bold:r=>o.bold(r)};function d(r,t,e){a()&&d$1({level:r,event:"log",component:"cli",message:t,metadata:e});}var g={info(r){d("info",r),!a()&&log.info(r);},success(r){d("info",r,{outcome:"success"}),!a()&&log.success(r);},warn(r){d("warn",r),!a()&&log.warn(r);},error(r){d("error",r),!a()&&log.error(r);},step(r){d("info",r,{phase:"step"}),!a()&&log.step(r);},stepNumbered(r,t,e){let s=`${c.dim(`[${r}/${t}]`)} ${e}`;d("info",e,{phase:"step",stepNum:r,total:t}),!a()&&log.step(s);},note(r,t){d("info",r,{kind:"note",title:t}),!a()&&note(r,t);},message(r,t=c.brand("\u25C7")){d("info",r),!a()&&log.message(r,{symbol:t});},dim(r){a()||console.log(c.dim(r));},plain(r){a()||console.log(r);},nextSteps(r){a()||g.note(r.map(t=>c.white(t)).join(`
2
- `),c.brand("Next steps"));}};var w=class{debugEnabled=false;setDebug(t){this.debugEnabled=t;}isJsonMode(){return a()}debug(t,...e){this.debugEnabled&&this.write("debug",t,e);}info(t,...e){this.write("info",t,e);}success(t,...e){this.write("info",t,e,{outcome:"success"},"success");}warn(t,...e){this.write("warn",t,e,void 0,"warn");}error(t,...e){this.write("error",t,e,void 0,"error");}step(t,e,s){if(a()){h(t,e,s);return}g.stepNumbered(t,e,s);}write(t,e,s,n,v="info"){let x=s.length>0?{details:s.map(k=>y(k))}:void 0;if(a()){d$1({level:t,event:"log",component:"cli",message:e,metadata:{...n,...x}});return}let m=t==="debug"?`[debug] ${e}`:e;switch(v){case "success":g.success(m);break;case "warn":g.warn(m);break;case "error":g.error(m);break;default:t==="debug"?g.dim(m):g.info(m);}}};function y(r){return r instanceof Error?{name:r.name,message:r.message}:r===null||typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:String(r)}var X=new w;export{c as a,b,J as c,R as d,X as e};
@@ -1,9 +0,0 @@
1
- import {a,b}from'./chunk-KMUWWZRT.js';import {e,d}from'./chunk-B2KOIORF.js';import {h as h$1,i}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-VKLL63TL.js';import h from'fs';import o from'path';import s from'chalk';var S=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 z(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 T(e){try{return await h.promises.readFile(e,"utf-8")}catch{return ""}}function N(e){return a(e)}async function K(e,n){return await y(o.join(e,".rapidkit","project.json"))||await y(o.join(e,".rapidkit","context.json"))?true:b(e)?false:o.resolve(e)===o.resolve(n)?h$1(e).length>0:h$1(e).length>0}async function O(e){let n=await a$1(e,{skipDirs:S,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:K});return n.length>0?n:b(e)?[]:h$1(e).length>0?[e]:[]}function _(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function A(e,n){for(let t of n)if(await y(o.join(e,t)))return true;return false}async function M(e){return A(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 J(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await z(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 W(e){let n=await z(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 H(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 B(e,n){let t=await z(o.join(n,".rapidkit","project.json")),i$1=i(n,t),r=h$1(n),c=i$1.runtime==="unknown"?r[0]||"unknown":i$1.runtime,a=_(e,n),d=a,u=await W(n),g=await y(o.join(n,".rapidkit","project.json"))||await y(o.join(n,".rapidkit","context.json")),m=await J(n),k=await A(n,["Dockerfile","dockerfile"]),w=await A(n,[".env.example","env.example","config/env.example"]),P=await A(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"]),R=await M(n),l=[];return i$1.key==="unknown"&&l.push(f("project.stack.unknown","fail",d,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),g||l.push(f("project.marker.missing","warn",d,"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.")),m||l.push(f("project.tests.missing","warn",d,"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,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),P||l.push(f("project.ci.missing","warn",d,"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.")),R||l.push(f("project.health.missing","info",d,"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,"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$1.key,confidence:i$1.confidence,supportTier:i$1.supportTier,hasRapidKitMarker:g,hasTests:m,hasDockerfile:k,hasEnvExample:w,hasCiConfig:P,hasHealthEndpoint:R,scripts:u,findings:l,score:H(l)}}function U(e){return e.name.toLowerCase()}async function V(e){let n=new Map(e.map(r=>[U(r),r])),t=[];for(let r of e){let c=await z(o.join(r.path,"package.json")),a={...c?.dependencies??{},...c?.devDependencies??{},...c?.peerDependencies??{}};for(let u of Object.keys(a)){let g=u.replace(/^@[^/]+\//,"").toLowerCase(),m=n.get(g);m&&m.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:m.relativePath,kind:"package"});}let d=await T(o.join(r.path,"pyproject.toml"));for(let u of e)u.relativePath!==r.relativePath&&d.includes(u.name)&&t.push({from:r.relativePath,to:u.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 L(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 q(e){let n=await z(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function Q(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 X(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx rapidkit create project <name> --kit <kit>","Import an existing service: npx rapidkit import <path>"]:["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 ae(e$1={}){let n=o.resolve(e$1.workspacePath||process.cwd());if(!await y(n))throw new Error(`Workspace path does not exist: ${n}`);let t=N(n)??n,i=await y(o.join(t,".rapidkit-workspace"))||await y(o.join(t,".rapidkit","workspace.json")),r=await q(t),c=await O(t),a=await Promise.all(c.map(p=>B(t,p))),d$1=await V(a),u=L(a,d$1),g=[];i||g.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&&g.push(f("workspace.projects.missing","warn",".","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 m=[...g,...a.flatMap(p=>p.findings)],k=Q(m),w={};for(let p of a)w[p.runtime]=(w[p.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((p,v)=>p+v.score,0)/a.length):0,R=g.reduce((p,v)=>p+(v.severity==="fail"?20:v.severity==="warn"?8:2),0),l=Math.max(0,P-R),E=k.fail>0||e$1.strict&&k.warn>0?"blocked":k.warn>0?"needs-attention":"ready",j={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:l,verdict:E,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:k},runtimes:w,projects:a,dependencyGraph:{status:d$1.length>0?"generated":"empty",edges:d$1,topImpactedProjects:u.slice(0,5)},findings:m,nextActions:X({findings:m,projectCount:a.length,hasGraph:d$1.length>0,workspaceDetected:i}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e$1.output&&(await h.promises.mkdir(o.dirname(o.resolve(e$1.output)),{recursive:true}),await h.promises.writeFile(o.resolve(e$1.output),`${JSON.stringify(j,null,2)}
2
- `)),!e$1.output&&i){let p=o.join(t,".rapidkit","reports","analyze-last-run.json");await h.promises.mkdir(o.dirname(p),{recursive:true});let v=e(j,{commandId:"workspaceAnalyze",exitCode:j.summary.verdict==="blocked"?2:j.summary.verdict==="needs-attention"?1:0,generatedAt:j.generatedAt,blockers:j.findings.filter(x=>x.severity==="fail").map(x=>x.title).slice(0,12),runId:d()});await h.promises.writeFile(p,`${JSON.stringify(v,null,2)}
3
- `);}return j}function ce(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{ae as a,ce as b};