rapidkit 0.37.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -118
- package/contracts/create-planner-capabilities.v1.json +251 -0
- package/contracts/runtime-command-surface.v1.json +52 -0
- package/dist/autopilot-release-SBPGNGAB.js +1 -0
- package/dist/chunk-2ED6SPXP.js +1 -0
- package/dist/chunk-3R7UJAX5.js +1 -0
- package/dist/{chunk-RUUDLAKJ.js → chunk-5NBYSXOZ.js} +1 -1
- package/dist/chunk-7XW2I6MP.js +13 -0
- package/dist/{chunk-U6QUN6V2.js → chunk-ABPDGFVD.js} +1 -1
- package/dist/chunk-IW3KLQXE.js +2 -0
- package/dist/{chunk-7RBZGQ7T.js → chunk-NKNMGWAZ.js} +1 -1
- package/dist/{chunk-IOIWVHRO.js → chunk-TVIOAZ6E.js} +13 -13
- package/dist/chunk-XESEBTPE.js +1 -0
- package/dist/{create-HN5HOGQ4.js → create-Y3XJOKL5.js} +1 -1
- package/dist/index.js +150 -144
- package/dist/{pipeline-IMB3C3JY.js → pipeline-C4UCLETO.js} +1 -1
- package/dist/{workspace-2AL5C3QZ.js → workspace-WBKFXH4Z.js} +1 -1
- package/dist/{workspace-agent-sync-4R7S3F6T.js → workspace-agent-sync-3FFFJYKF.js} +1 -1
- package/dist/{workspace-context-CKACDTVE.js → workspace-context-V4UGIHSC.js} +1 -1
- package/dist/{workspace-foundation-L6ZBGMVE.js → workspace-foundation-T45HAWKL.js} +1 -1
- package/dist/{workspace-intelligence-3TWXJQ7Y.js → workspace-intelligence-MGL3Z25K.js} +1 -1
- package/dist/{workspace-model-NQVZN5W4.js → workspace-model-IKMGY2BX.js} +1 -1
- package/dist/workspace-run-HOR56FON.js +1 -0
- package/dist/{workspace-verify-EO435PS4.js → workspace-verify-A3J6D7T2.js} +1 -1
- package/docs/README.md +1 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +63 -56
- package/docs/contracts/README.md +15 -14
- package/docs/create-planner-capabilities.md +81 -0
- package/package.json +1 -1
- package/dist/autopilot-release-QNZ2IL7K.js +0 -1
- package/dist/chunk-3SWQKRXH.js +0 -2
- package/dist/chunk-C7OVQQXT.js +0 -1
- package/dist/chunk-UXKB4KGZ.js +0 -13
- package/dist/chunk-YJ24EV3P.js +0 -1
- package/dist/workspace-run-PNMZJNDC.js +0 -1
- /package/dist/{chunk-TRXYRHD7.js → chunk-6E5TBB2C.js} +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "rapidkit-create-planner-capabilities-v1",
|
|
3
|
+
"lanes": {
|
|
4
|
+
"native-create": {
|
|
5
|
+
"status": "available",
|
|
6
|
+
"meaning": "RapidKit owns the scaffold contract, marker, registry, doctor, bootstrap, and workspace model path."
|
|
7
|
+
},
|
|
8
|
+
"external-create-adopt": {
|
|
9
|
+
"status": "planned",
|
|
10
|
+
"meaning": "A stable ecosystem generator exists, but RapidKit does not yet own the post-create contract."
|
|
11
|
+
},
|
|
12
|
+
"adopt-only": {
|
|
13
|
+
"status": "available",
|
|
14
|
+
"meaning": "The project enters Workspace Intelligence through import/adopt, not native create."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"nativeCreate": [
|
|
18
|
+
{
|
|
19
|
+
"id": "fastapi.standard",
|
|
20
|
+
"runtime": "python",
|
|
21
|
+
"framework": "fastapi",
|
|
22
|
+
"owner": "core",
|
|
23
|
+
"stability": "stable",
|
|
24
|
+
"moduleSupport": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "fastapi.ddd",
|
|
28
|
+
"runtime": "python",
|
|
29
|
+
"framework": "fastapi",
|
|
30
|
+
"owner": "core",
|
|
31
|
+
"stability": "stable",
|
|
32
|
+
"moduleSupport": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "nestjs.standard",
|
|
36
|
+
"runtime": "node",
|
|
37
|
+
"framework": "nestjs",
|
|
38
|
+
"owner": "core",
|
|
39
|
+
"stability": "stable",
|
|
40
|
+
"moduleSupport": true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "springboot.standard",
|
|
44
|
+
"runtime": "java",
|
|
45
|
+
"framework": "springboot",
|
|
46
|
+
"owner": "npm",
|
|
47
|
+
"stability": "stable",
|
|
48
|
+
"moduleSupport": false
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "gofiber.standard",
|
|
52
|
+
"runtime": "go",
|
|
53
|
+
"framework": "gofiber",
|
|
54
|
+
"owner": "npm",
|
|
55
|
+
"stability": "stable",
|
|
56
|
+
"moduleSupport": false
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "gogin.standard",
|
|
60
|
+
"runtime": "go",
|
|
61
|
+
"framework": "gogin",
|
|
62
|
+
"owner": "npm",
|
|
63
|
+
"stability": "stable",
|
|
64
|
+
"moduleSupport": false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "dotnet.webapi.clean",
|
|
68
|
+
"runtime": "dotnet",
|
|
69
|
+
"framework": "dotnet",
|
|
70
|
+
"owner": "npm",
|
|
71
|
+
"stability": "preview",
|
|
72
|
+
"moduleSupport": false
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "frontend.nextjs",
|
|
76
|
+
"runtime": "node",
|
|
77
|
+
"framework": "nextjs",
|
|
78
|
+
"owner": "npm",
|
|
79
|
+
"stability": "stable",
|
|
80
|
+
"moduleSupport": false
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "frontend.remix",
|
|
84
|
+
"runtime": "node",
|
|
85
|
+
"framework": "remix",
|
|
86
|
+
"owner": "npm",
|
|
87
|
+
"stability": "stable",
|
|
88
|
+
"moduleSupport": false
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "frontend.vite-react",
|
|
92
|
+
"runtime": "node",
|
|
93
|
+
"framework": "react",
|
|
94
|
+
"owner": "npm",
|
|
95
|
+
"stability": "stable",
|
|
96
|
+
"moduleSupport": false
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "frontend.vite-vue",
|
|
100
|
+
"runtime": "node",
|
|
101
|
+
"framework": "vue",
|
|
102
|
+
"owner": "npm",
|
|
103
|
+
"stability": "stable",
|
|
104
|
+
"moduleSupport": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "frontend.vite-svelte",
|
|
108
|
+
"runtime": "node",
|
|
109
|
+
"framework": "svelte",
|
|
110
|
+
"owner": "npm",
|
|
111
|
+
"stability": "stable",
|
|
112
|
+
"moduleSupport": false
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "frontend.vite-solid",
|
|
116
|
+
"runtime": "node",
|
|
117
|
+
"framework": "solid",
|
|
118
|
+
"owner": "npm",
|
|
119
|
+
"stability": "stable",
|
|
120
|
+
"moduleSupport": false
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "frontend.vite-vanilla",
|
|
124
|
+
"runtime": "node",
|
|
125
|
+
"framework": "vite",
|
|
126
|
+
"owner": "npm",
|
|
127
|
+
"stability": "stable",
|
|
128
|
+
"moduleSupport": false
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "frontend.nuxt",
|
|
132
|
+
"runtime": "node",
|
|
133
|
+
"framework": "nuxt",
|
|
134
|
+
"owner": "npm",
|
|
135
|
+
"stability": "stable",
|
|
136
|
+
"moduleSupport": false
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "frontend.angular",
|
|
140
|
+
"runtime": "node",
|
|
141
|
+
"framework": "angular",
|
|
142
|
+
"owner": "npm",
|
|
143
|
+
"stability": "stable",
|
|
144
|
+
"moduleSupport": false
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "frontend.astro",
|
|
148
|
+
"runtime": "node",
|
|
149
|
+
"framework": "astro",
|
|
150
|
+
"owner": "npm",
|
|
151
|
+
"stability": "stable",
|
|
152
|
+
"moduleSupport": false
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"id": "frontend.sveltekit",
|
|
156
|
+
"runtime": "node",
|
|
157
|
+
"framework": "sveltekit",
|
|
158
|
+
"owner": "npm",
|
|
159
|
+
"stability": "stable",
|
|
160
|
+
"moduleSupport": false
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"externalCreateAdopt": [
|
|
164
|
+
{
|
|
165
|
+
"id": "wordpress-site",
|
|
166
|
+
"aliases": [
|
|
167
|
+
"wordpress",
|
|
168
|
+
"wordpress-site",
|
|
169
|
+
"wp",
|
|
170
|
+
"wp-site"
|
|
171
|
+
],
|
|
172
|
+
"ecosystem": "wordpress",
|
|
173
|
+
"status": "planned",
|
|
174
|
+
"officialCommands": [
|
|
175
|
+
"wp core download",
|
|
176
|
+
"wp config create",
|
|
177
|
+
"wp db create",
|
|
178
|
+
"wp core install"
|
|
179
|
+
],
|
|
180
|
+
"adoptAfterCreate": true
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"id": "wordpress-block",
|
|
184
|
+
"aliases": [
|
|
185
|
+
"wordpress-block",
|
|
186
|
+
"wp-block",
|
|
187
|
+
"gutenberg-block"
|
|
188
|
+
],
|
|
189
|
+
"ecosystem": "wordpress",
|
|
190
|
+
"status": "planned",
|
|
191
|
+
"officialCommands": [
|
|
192
|
+
"npx @wordpress/create-block@latest <slug>"
|
|
193
|
+
],
|
|
194
|
+
"adoptAfterCreate": true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"id": "laravel",
|
|
198
|
+
"aliases": [
|
|
199
|
+
"laravel",
|
|
200
|
+
"php-laravel"
|
|
201
|
+
],
|
|
202
|
+
"ecosystem": "php",
|
|
203
|
+
"status": "planned",
|
|
204
|
+
"officialCommands": [
|
|
205
|
+
"composer create-project laravel/laravel <name>"
|
|
206
|
+
],
|
|
207
|
+
"adoptAfterCreate": true
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "symfony",
|
|
211
|
+
"aliases": [
|
|
212
|
+
"symfony",
|
|
213
|
+
"php-symfony"
|
|
214
|
+
],
|
|
215
|
+
"ecosystem": "php",
|
|
216
|
+
"status": "planned",
|
|
217
|
+
"officialCommands": [
|
|
218
|
+
"composer create-project symfony/skeleton <name>"
|
|
219
|
+
],
|
|
220
|
+
"adoptAfterCreate": true
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"id": "rails",
|
|
224
|
+
"aliases": [
|
|
225
|
+
"rails",
|
|
226
|
+
"ruby-on-rails",
|
|
227
|
+
"ruby-rails"
|
|
228
|
+
],
|
|
229
|
+
"ecosystem": "ruby",
|
|
230
|
+
"status": "planned",
|
|
231
|
+
"officialCommands": [
|
|
232
|
+
"rails new <name>"
|
|
233
|
+
],
|
|
234
|
+
"adoptAfterCreate": true
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"adoptOnlyRuntimes": [
|
|
238
|
+
"php",
|
|
239
|
+
"ruby",
|
|
240
|
+
"rust",
|
|
241
|
+
"elixir",
|
|
242
|
+
"clojure",
|
|
243
|
+
"scala",
|
|
244
|
+
"kotlin"
|
|
245
|
+
],
|
|
246
|
+
"productRules": [
|
|
247
|
+
"Do not translate unsupported stack requests into unrelated native kits.",
|
|
248
|
+
"If native create is unavailable, explain the lane and guide to adopt/import.",
|
|
249
|
+
"Use the same capability contract in CLI, CI, VS Code, and AI planning surfaces."
|
|
250
|
+
]
|
|
251
|
+
}
|
|
@@ -79,6 +79,58 @@
|
|
|
79
79
|
"frontend.astro",
|
|
80
80
|
"frontend.sveltekit"
|
|
81
81
|
],
|
|
82
|
+
"createPlanner": {
|
|
83
|
+
"lanes": {
|
|
84
|
+
"native-create": {
|
|
85
|
+
"status": "available",
|
|
86
|
+
"meaning": "RapidKit owns the scaffold contract, marker, registry, doctor, bootstrap, and workspace model path."
|
|
87
|
+
},
|
|
88
|
+
"external-create-adopt": {
|
|
89
|
+
"status": "planned",
|
|
90
|
+
"meaning": "A stable ecosystem generator exists, but RapidKit does not yet own the post-create contract."
|
|
91
|
+
},
|
|
92
|
+
"adopt-only": {
|
|
93
|
+
"status": "available",
|
|
94
|
+
"meaning": "The project enters Workspace Intelligence through import/adopt, not native create."
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"nativeCreateKits": [
|
|
98
|
+
"fastapi.standard",
|
|
99
|
+
"fastapi.ddd",
|
|
100
|
+
"nestjs.standard",
|
|
101
|
+
"springboot.standard",
|
|
102
|
+
"gofiber.standard",
|
|
103
|
+
"gogin.standard",
|
|
104
|
+
"dotnet.webapi.clean",
|
|
105
|
+
"frontend.nextjs",
|
|
106
|
+
"frontend.remix",
|
|
107
|
+
"frontend.vite-react",
|
|
108
|
+
"frontend.vite-vue",
|
|
109
|
+
"frontend.vite-svelte",
|
|
110
|
+
"frontend.vite-solid",
|
|
111
|
+
"frontend.vite-vanilla",
|
|
112
|
+
"frontend.nuxt",
|
|
113
|
+
"frontend.angular",
|
|
114
|
+
"frontend.astro",
|
|
115
|
+
"frontend.sveltekit"
|
|
116
|
+
],
|
|
117
|
+
"externalCreateAdopt": [
|
|
118
|
+
"wordpress-site",
|
|
119
|
+
"wordpress-block",
|
|
120
|
+
"laravel",
|
|
121
|
+
"symfony",
|
|
122
|
+
"rails"
|
|
123
|
+
],
|
|
124
|
+
"adoptOnlyRuntimes": [
|
|
125
|
+
"php",
|
|
126
|
+
"ruby",
|
|
127
|
+
"rust",
|
|
128
|
+
"elixir",
|
|
129
|
+
"clojure",
|
|
130
|
+
"scala",
|
|
131
|
+
"kotlin"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
82
134
|
"runtimeMatrix": {
|
|
83
135
|
"python": {
|
|
84
136
|
"tier": "first-class",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-NKNMGWAZ.js';
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import {c}from'./chunk-NFUXULIF.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$1}from'./chunk-VKLL63TL.js';import {b}from'./chunk-PPQYTYQG.js';import {j}from'./chunk-Z5LKRG57.js';import {promises}from'fs';import o from'path';import i from'chalk';import N from'ora';import {execa}from'execa';function B(e){let t=a(e.path),r=Array.isArray(e.projects)?e.projects:[],a$1=[],s=new Set;for(let p of r){if(!p||typeof p.name!="string"||typeof p.path!="string")continue;let n=a(p.path);s.has(n)||(s.add(n),a$1.push({name:p.name,path:n}));}return {name:e.name,path:t,mode:e.mode,projects:a$1}}function P(e){let t=[],r=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let s=B(a);r.has(s.path)||(r.add(s.path),t.push(s));}return {workspaces:t}}async function F(e){try{let t=await promises.readFile(e,"utf8"),r=JSON.parse(t);if(r&&Array.isArray(r.workspaces))return P(r)}catch{}return {workspaces:[]}}async function T(e,t){try{let r=a(e),a$1=j(),s=o.join(a$1,"workspaces.json");await promises.mkdir(a$1,{recursive:true});let p={name:t,path:r,mode:"full",projects:[]};for(let n=0;n<3;n+=1){let c=await F(s);if(c.workspaces.some(k=>k.path===r)||(c.workspaces.push(p),await promises.writeFile(s,JSON.stringify(c,null,2)),(await F(s)).workspaces.some(k=>k.path===r)))return}console.warn(i.gray("Note: Could not register workspace in shared registry"));}catch{console.warn(i.gray("Note: Could not register workspace in shared registry"));}}async function ne(e,t=false){let r=a(e),a$1={workspacePath:r,workspaceFound:false,added:[],skipped:0};try{let s=j(),p=o.join(s,"workspaces.json"),n={workspaces:[]};try{let f=await promises.readFile(p,"utf8"),h=JSON.parse(f);h&&Array.isArray(h.workspaces)&&(n=P(h));}catch{return t||console.log("\u26A0\uFE0F Workspace registry not found"),a$1}let c=n.workspaces.find(f=>f.path===r);if(!c)return t||console.log("\u26A0\uFE0F Workspace not registered in registry"),a$1;Array.isArray(c.projects)||(c.projects=[]);let l=0,k=0,g=[],m=[e],y=new Set;for(;m.length>0;){let f=m.shift();if(!f||y.has(f))continue;y.add(f);let h=await promises.readdir(f,{withFileTypes:true});for(let w of h){if(!w.isDirectory()||w.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(w.name))continue;let b=o.join(f,w.name),u=a(b),$=o.join(u,".rapidkit","context.json"),W=o.join(u,".rapidkit","project.json");try{let S=false;try{await promises.access($),S=true;}catch{await promises.access(W),S=true;}if(S){let v=o.basename(u);c.projects.some(_=>_.path===u||_.name===v)?k++:(c.projects.push({name:v,path:u}),l++,g.push(u),t||console.log(`\u2714 Added: ${o.relative(e,u)}`));continue}}catch{}m.push(b);}}return l>0?(await promises.writeFile(p,JSON.stringify(n,null,2)),t||console.log(`
|
|
2
2
|
\u2705 Synced ${l} project(s) to registry`)):t||console.log(`
|
|
3
|
-
\u2705 All projects already registered (${k} found)`),{workspacePath:r,workspaceFound:true,added:g,skipped:k}}catch(s){return t||console.error("\u274C Failed to sync projects:",s.message),a$1}}async function se(e,t,r){try{let a$1=a(e),s=a(r),p=j(),n=o.join(p,"workspaces.json"),c={workspaces:[]};try{let m=await promises.readFile(n,"utf8"),y=JSON.parse(m);y&&Array.isArray(y.workspaces)&&(c=P(y));}catch{return}let l=c.workspaces.find(m=>m.path===a$1);if(!l)return;Array.isArray(l.projects)||(l.projects=[]);let k=l.projects.findIndex(m=>m.path===s||m.name===t),g={name:t,path:s};if(k>=0){let m=l.projects[k];(m.name!==g.name||m.path!==g.path)&&(l.projects[k]=g,await promises.writeFile(n,JSON.stringify(c,null,2)));}else l.projects.push({name:t,path:s}),await promises.writeFile(n,JSON.stringify(c,null,2));}catch{}}async function ce(e,t){let r=N("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(o.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(o.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:s}=await import('./create-
|
|
3
|
+
\u2705 All projects already registered (${k} found)`),{workspacePath:r,workspaceFound:true,added:g,skipped:k}}catch(s){return t||console.error("\u274C Failed to sync projects:",s.message),a$1}}async function se(e,t,r){try{let a$1=a(e),s=a(r),p=j(),n=o.join(p,"workspaces.json"),c={workspaces:[]};try{let m=await promises.readFile(n,"utf8"),y=JSON.parse(m);y&&Array.isArray(y.workspaces)&&(c=P(y));}catch{return}let l=c.workspaces.find(m=>m.path===a$1);if(!l)return;Array.isArray(l.projects)||(l.projects=[]);let k=l.projects.findIndex(m=>m.path===s||m.name===t),g={name:t,path:s};if(k>=0){let m=l.projects[k];(m.name!==g.name||m.path!==g.path)&&(l.projects[k]=g,await promises.writeFile(n,JSON.stringify(c,null,2)));}else l.projects.push({name:t,path:s}),await promises.writeFile(n,JSON.stringify(c,null,2));}catch{}}async function ce(e,t){let r=N("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(o.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(o.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:s}=await import('./create-Y3XJOKL5.js');await s(e,{workspaceName:t.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let{publishWorkspaceRegistrySummary:p}=await import('./workspace-registry-summary-MIPHVB56.js');await p(e);let n=z();await promises.writeFile(o.join(e,"rapidkit"),n),await promises.chmod(o.join(e,"rapidkit"),493);let c=U();await promises.writeFile(o.join(e,"rapidkit.cmd"),c);let l=J(t.name);if(await promises.writeFile(o.join(e,"README.md"),l),await promises.writeFile(o.join(e,".gitignore"),`# RapidKit workspace
|
|
4
4
|
.env
|
|
5
5
|
.env.*
|
|
6
6
|
!.env.example
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-PPQYTYQG.js';import {b as b$2}from'./chunk-Z5LKRG57.js';import O from'validate-npm-package-name';import o from'path';import {spawn}from'child_process';import s from'chalk';import l from'fs-extra';var m=class extends Error{constructor(r,n,a){super(r);this.code=n;this.details=a;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}code;details},I=class extends m{constructor(t,r){let n=r?`Python ${t}+ required, found ${r}`:`Python ${t}+ not found`;super(n,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},_=class extends m{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},D=class extends m{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},$=class extends m{constructor(t){super(`Directory "${t}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},p=class extends m{constructor(t,r){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",r);}},E=class extends m{constructor(t,r){let n=`Installation failed at: ${t}`,a=`${r.message}
|
|
2
|
+
|
|
3
|
+
Troubleshooting:
|
|
4
|
+
- Check your internet connection
|
|
5
|
+
- Verify Python/Poetry installation
|
|
6
|
+
- Try running with --debug flag for more details`;super(n,"INSTALLATION_ERROR",a);}},G=class extends m{constructor(){super("RapidKit Python package is not yet available on PyPI","RAPIDKIT_NOT_AVAILABLE",`Available options:
|
|
7
|
+
1. Install Python 3.10+ and retry the same command
|
|
8
|
+
2. Use the core workflow: npx rapidkit create workspace <name>
|
|
9
|
+
3. Offline fallback (limited): npx rapidkit create project fastapi.standard <name> --output .
|
|
10
|
+
|
|
11
|
+
Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function F(e){let t=O(e);if(!t.validForNewPackages){let n=t.errors||[],a=t.warnings||[],i=[...n,...a];throw new p(e,`NPM validation failed: ${i.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new p(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new p(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new p(e,"Name must be at least 2 characters long");if(e.length>214)throw new p(e,"Name must be less than 214 characters");return true}function de(e){let t=T(e.workspacePath,e.result.projectPath)?"imported":"adopted";return {name:e.result.projectName,path:e.result.projectPath,relativePath:M(e.workspacePath,e.result.projectPath),relationship:t,stack:e.result.definition.framework,runtime:"node",framework:e.result.definition.framework,frameworkDisplayName:e.result.definition.displayName,supportTier:"extended",moduleSupport:false,confidence:"high",source:t==="adopted"?"adopted-local":"local-folder",importedAt:e.importedAt??new Date().toISOString()}}function T(e,t){let r=o.relative(o.resolve(e),o.resolve(t));return r===""||r.length>0&&!r.startsWith("..")&&!o.isAbsolute(r)}function M(e,t){return (o.relative(e,t)||".").split(o.sep).join("/")}var S=[{id:"nextjs",kitId:"frontend.nextjs",aliases:["frontend.nextjs","next","nextjs","next.js"],displayName:"Next.js",framework:"nextjs",defaultPort:3e3,commandDisplay:e=>`npx create-next-app@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-next-app@latest",e,"--yes",...t.skipGit?["--disable-git"]:[],...t.skipInstall?["--skip-install"]:[]]})},{id:"remix",kitId:"frontend.remix",aliases:["frontend.remix","remix","remix-run","react-router"],displayName:"React Router",framework:"remix",defaultPort:5173,commandDisplay:e=>`npx create-react-router@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-react-router@latest",e,"--yes",...t.skipInstall?["--no-install"]:["--install"],"--no-git-init"]})},{id:"vite-react",kitId:"frontend.vite-react",aliases:["frontend.vite-react","vite-react","react","vite.react"],displayName:"React + Vite",framework:"react",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template react-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","react-ts","--no-interactive"]})},{id:"vite-vue",kitId:"frontend.vite-vue",aliases:["frontend.vite-vue","vite-vue","vue","vite.vue"],displayName:"Vue + Vite",framework:"vue",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template vue-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vue-ts","--no-interactive"]})},{id:"vite-svelte",kitId:"frontend.vite-svelte",aliases:["frontend.vite-svelte","vite-svelte","svelte","vite.svelte"],displayName:"Svelte + Vite",framework:"svelte",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template svelte-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","svelte-ts","--no-interactive"]})},{id:"vite-solid",kitId:"frontend.vite-solid",aliases:["frontend.vite-solid","vite-solid","solid","solidjs","vite.solid"],displayName:"Solid + Vite",framework:"solid",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template solid-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","solid-ts","--no-interactive"]})},{id:"vite-vanilla",kitId:"frontend.vite-vanilla",aliases:["frontend.vite-vanilla","vite","vanilla","vite-vanilla"],displayName:"Vite",framework:"vite",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template vanilla-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vanilla-ts","--no-interactive"]})},{id:"nuxt",kitId:"frontend.nuxt",aliases:["frontend.nuxt","nuxt","nuxtjs","nuxt.js"],displayName:"Nuxt",framework:"nuxt",defaultPort:3e3,commandDisplay:(e,t)=>`npx create-nuxt@latest ${e} --template minimal --packageManager npm --gitInit ${t?.skipGit?"false":"true"}${t?.skipInstall?" --no-install":""}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-nuxt@latest",e,"--template","minimal","--packageManager","npm","--gitInit",t.skipGit?"false":"true",...t.skipInstall?["--no-install"]:[]]})},{id:"angular",kitId:"frontend.angular",aliases:["frontend.angular","angular","ng"],displayName:"Angular",framework:"angular",defaultPort:4200,minNodeMajor:18,minNodeMessage:"Angular scaffolding requires Node.js 18.19+ or 20.11+. Upgrade Node, or choose another frontend kit.",commandDisplay:e=>`npx @angular/cli@19 new ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","@angular/cli@19","new",e,"--defaults","--skip-git",...t.skipInstall?["--skip-install"]:[]]})},{id:"astro",kitId:"frontend.astro",aliases:["frontend.astro","astro"],displayName:"Astro",framework:"astro",defaultPort:4321,commandDisplay:e=>`npm create astro@4 ${e}`,commandExec:(e,t)=>({command:"npm",args:["create","astro@4",e,"--","--yes",...t.skipInstall?["--no-install"]:[],...t.skipGit?["--no-git"]:[]]})},{id:"sveltekit",kitId:"frontend.sveltekit",aliases:["frontend.sveltekit","sveltekit","svelte-kit"],displayName:"SvelteKit",framework:"sveltekit",defaultPort:5173,commandDisplay:e=>`npx sv@latest create ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","sv@latest","create",e,"--template","minimal","--types","ts","--no-add-ons",...t.skipInstall?["--no-install"]:["--install","npm"]]})}],k=new Map;for(let e of S){k.set(e.id,e),k.set(e.kitId,e);for(let t of e.aliases)k.set(t.toLowerCase(),e);}function le(){return [...S]}function w(e){return e?k.get(e.trim().toLowerCase())??null:null}function ce(e){return !!w(e)}function me(e){if(e[0]!=="create"||e[1]!=="frontend")return null;let t=e[2],r=e[3],n=e.slice(4),a=w(t);return a?["create","project",a.kitId,r??"",...n].filter(Boolean):["create","project",`frontend.${t??""}`,r??"",...n].filter(Boolean)}function L(e){let t=w(e);return t?`rapidkit create frontend ${t.id} <name> [--output <dir>] [--skip-install] [--dry-run]`:"rapidkit create frontend <nextjs|remix|vite-react|vite-vue|vite-svelte|vite-solid|vite-vanilla|nuxt|angular|astro|sveltekit> <name> [--output <dir>] [--skip-install] [--dry-run]"}async function pe(e){let t=e.args;if(t[0]!=="create"||t[1]!=="project")throw new Error("Frontend create expects normalized args: create project <frontend.kit> <name>");let r=w(t[2]);if(!r)throw new Error(`Unknown frontend generator: ${t[2]??"(missing)"}`);let n=t[3];if(!n)throw new Error(`Usage: ${L(r.id)}`);F(n),J(r);let a=z(t,"--output")||process.cwd(),i=o.resolve(a,n),y=e.dryRun===true||t.includes("--dry-run"),v=t.includes("--skip-install"),f=t.includes("--skip-git")||t.includes("--no-git"),c=r.commandExec(n,{skipGit:f,skipInstall:v}),g=r.commandDisplay(n,{skipGit:f,skipInstall:v});if(await l.pathExists(i))throw new Error(`Directory "${i}" already exists`);if(y)return U({definition:r,projectName:n,projectPath:i,commandPlan:c}),{definition:r,projectName:n,projectPath:i,dryRun:y,commandDisplay:g,commandExec:[c.command,...c.args]};await l.ensureDir(o.dirname(i));let u=await R(c.command,c.args,o.dirname(i)),h=await W(i);if(u!==0&&!h)throw new Error(`Official ${r.displayName} generator failed with exit code ${u}`);return u!==0&&h&&console.log(s.yellow(`\u26A0\uFE0F Official ${r.displayName} generator exited with code ${u}, but the scaffold looks complete. Continuing RapidKit project setup...`)),f||await Y(i),await B({definition:r,projectName:n,projectPath:i,commandDisplay:g,commandExec:[c.command,...c.args],skipGit:f,skipInstall:v}),console.log(s.green(`\u2705 ${r.displayName} project created at ${i}`)),console.log(s.gray(` Display command: npx rapidkit create frontend ${r.id} ${n}`)),console.log(s.gray(" Next: cd "+n+" && npx rapidkit dev")),{definition:r,projectName:n,projectPath:i,dryRun:y,commandDisplay:g,commandExec:[c.command,...c.args]}}async function B(e){let t=new Date().toISOString(),r=await b$1(),n={schema_version:"1.0",name:e.projectName,slug:e.projectName,kind:"frontend",project_type:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId,kit:e.definition.kitId,engine:"npm",support_tier:"extended",module_support:false,modules:[],rapidkit_version:r,generated_by:"rapidkit-npm",generated_at:t,frontend:{generator:e.definition.id,official_generator:true,default_port:e.definition.defaultPort,command_display:e.commandDisplay,command_exec:e.commandExec,skip_install:e.skipInstall,skip_git:e.skipGit},contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}},a={project:e.projectName,runtime:"node",framework:e.definition.framework,kind:"frontend",source:"official-generator"},i={kind:"rapidkit.frontend_create",schema_version:"1.0",generated_at:t,project:{name:e.projectName,path:e.projectPath,kind:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId},generator:{id:e.definition.id,command_display:e.commandDisplay,command_exec:e.commandExec}};await l.ensureDir(o.join(e.projectPath,".rapidkit")),await l.writeJson(o.join(e.projectPath,".rapidkit","project.json"),n,{spaces:2}),await l.writeJson(o.join(e.projectPath,".rapidkit","context.json"),a,{spaces:2}),await l.writeJson(o.join(e.projectPath,".rapidkit","frontend-create.json"),i,{spaces:2});}function U(e){console.log(s.bold(`
|
|
12
|
+
RapidKit frontend create plan: ${e.definition.displayName}`)),console.log(s.gray(`Project: ${e.projectName}`)),console.log(s.gray(`Target: ${e.projectPath}`)),console.log(s.gray(`Show: npx rapidkit create frontend ${e.definition.id} ${e.projectName}`)),console.log(s.gray(`Run: ${[e.commandPlan.command,...e.commandPlan.args].join(" ")}`)),console.log(s.gray(`Default: http://localhost:${e.definition.defaultPort}`));}function V(){let e=Number.parseInt(process.versions.node.split(".")[0]??"",10);return Number.isFinite(e)?e:0}function J(e){if(!(!e.minNodeMajor||V()>=e.minNodeMajor))throw new Error(e.minNodeMessage??`${e.displayName} requires Node.js ${e.minNodeMajor}+ (current: ${process.versions.node}).`)}async function W(e){if(!await l.pathExists(e))return false;let t=o.join(e,"package.json");return await l.pathExists(t)?true:(await l.readdir(e)).length>0}async function Y(e){let t=o.join(e,".git");if(await l.pathExists(t))return;if(await R("git",["init"],e)===0){console.log(s.gray(" Git repository initialized."));return}console.log(s.yellow("\u26A0\uFE0F Git initialization was skipped or failed. You can run `git init` manually inside the project."));}async function R(e,t,r){return await new Promise(n=>{let a=spawn(e,t,{cwd:r,stdio:"inherit",shell:b$2()});a.on("close",i=>n(i??1)),a.on("error",()=>n(1));})}function z(e,t){let r=e.indexOf(t);if(r>=0&&r+1<e.length)return e[r+1];let n=e.find(a=>a.startsWith(`${t}=`));return n?n.slice(t.length+1):void 0}var K=[{id:"fastapi.standard",aliases:["fastapi","fastapi.standard"],label:"fastapi \u2014 FastAPI Standard Kit",description:"Core-backed FastAPI service scaffold.",owner:"core",runtime:"python",framework:"fastapi",moduleSupport:true,stability:"stable"},{id:"fastapi.ddd",aliases:["fastapi.ddd","fastapi-ddd"],label:"fastapi \u2014 FastAPI DDD Kit",description:"Core-backed FastAPI DDD service scaffold.",owner:"core",runtime:"python",framework:"fastapi",moduleSupport:true,stability:"stable"},{id:"nestjs.standard",aliases:["nestjs","nest","nestjs.standard"],label:"nestjs \u2014 NestJS Standard Kit",description:"Core-backed NestJS service scaffold.",owner:"core",runtime:"node",framework:"nestjs",moduleSupport:true,stability:"stable"},{id:"springboot.standard",aliases:["spring","springboot","springboot.standard","java"],label:"spring \u2014 Spring Boot Standard Kit",description:"npm-backed Spring Boot service scaffold.",owner:"npm",runtime:"java",framework:"springboot",moduleSupport:false,stability:"stable",generator:"springboot",createUsage:"rapidkit create project springboot.standard <name> [--java-version <major>] [--spring-boot-version <semver>] [--group-id <com.example>] [--package-name <com.example.app>] [--port <number>]"},{id:"gofiber.standard",aliases:["go","go.standard","fiber","gofiber","gofiber.standard","go/fiber"],label:"go/fiber \u2014 Go Fiber Standard Kit",description:"npm-backed Go Fiber service scaffold.",owner:"npm",runtime:"go",framework:"gofiber",moduleSupport:false,stability:"stable",generator:"gofiber",createUsage:"rapidkit create project gofiber.standard <name> [--output <dir>]"},{id:"gogin.standard",aliases:["gin","gogin","gogin.standard","go/gin"],label:"go/gin \u2014 Go Gin Standard Kit",description:"npm-backed Go Gin service scaffold.",owner:"npm",runtime:"go",framework:"gogin",moduleSupport:false,stability:"stable",generator:"gogin",createUsage:"rapidkit create project gogin.standard <name> [--output <dir>]"},{id:"dotnet.webapi.clean",aliases:["dotnet","dotnet.webapi","dotnet.webapi.clean","aspnet","aspnetcore","asp.net","asp.net-core","csharp","c#"],label:"dotnet \u2014 ASP.NET Core Clean Web API",description:"npm-backed ASP.NET Core Web API with clean architecture boundaries.",owner:"npm",runtime:"dotnet",framework:"dotnet",moduleSupport:false,stability:"preview",generator:"dotnet-webapi-clean",createUsage:"rapidkit create project dotnet.webapi.clean <name> [--target-framework net8.0] [--root-namespace <Company.Product>] [--port <number>]"}],b=new Map;for(let e of K){b.set(e.id.toLowerCase(),e);for(let t of e.aliases)b.set(t.toLowerCase(),e);}function A(e){return e?b.get(e.trim().toLowerCase())??null:null}function ue(e){return A(e)?.id??e}function ke(){return K.filter(e=>e.owner==="core"||e.generator)}function we(e){return A(e)?.owner==="npm"}async function ye(e,t){if(!e.generator)throw new Error(`Kit is not backed by an npm generator: ${e.id}`);if(e.generator==="gofiber"){let{generateGoFiberKit:r}=await import('./gofiber-standard-35CJZ7S3.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="gogin"){let{generateGoGinKit:r}=await import('./gogin-standard-SAX6C4ZK.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="springboot"){let{generateSpringBootKit:r}=await import('./springboot-standard-SFMSLTX4.js');await r(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:d(t.args,"--java-version")?.trim(),spring_boot_version:d(t.args,"--spring-boot-version")?.trim(),springdoc_version:d(t.args,"--springdoc-version")?.trim(),group_id:d(t.args,"--group-id")?.trim(),package_name:d(t.args,"--package-name")?.trim(),description:d(t.args,"--description")?.trim(),port:d(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="dotnet-webapi-clean"){let{generateDotnetWebApiCleanKit:r}=await import('./dotnet-webapi-clean-FX533F5U.js');await r(t.projectPath,{project_name:t.projectName,target_framework:d(t.args,"--target-framework")?.trim(),root_namespace:d(t.args,"--root-namespace")?.trim(),description:d(t.args,"--description")?.trim(),port:d(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function d(e,t){let r=e.indexOf(t);if(r>=0&&r+1<e.length)return e[r+1];let n=e.find(a=>a.startsWith(`${t}=`));return n?n.slice(t.length+1):void 0}
|
|
13
|
+
export{m as a,I as b,_ as c,D as d,$ as e,E as f,G as g,F as h,de as i,le as j,w as k,ce as l,me as m,L as n,pe as o,A as p,ue as q,ke as r,we as s,ye as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {d,b,a}from'./chunk-
|
|
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
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-6E5TBB2C.js';import {a as a$1,d}from'./chunk-FV5A3N3I.js';import {a as a$2}from'./chunk-KMUWWZRT.js';import l from'chalk';import Y from'fs';import y from'path';import {execa}from'execa';var Z="autopilot-release-last-run.json",ee="autopilot-release.json";function $(s){try{return JSON.parse(s)}catch{return null}}function ge(s){let t=y.resolve(s),o=a$2(t);if(!o)throw new Error("No RapidKit workspace found in current directory or parents");return o}async function b(s,t){let o=process.argv[1];if(!o)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let a=await execa(process.execPath,[o,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(a.exitCode??1),stdout:a.stdout,stderr:a.stderr,crashed:false}}catch(a){return {exitCode:1,stdout:"",stderr:a instanceof Error?a.message:String(a),crashed:true}}}function te(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function se(s){return s.summary.failed>0||s.gates.results.some(t=>t.status==="fail")?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function we(s){let t=s.filter(a=>a.status!=="skipped");if(t.length===0)return 100;let o=t.reduce((a,e)=>e.status==="pass"?a+1:e.status==="warn"?a+.6:a,0);return Math.round(o/t.length*100)}function he(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function U(s,t){await Y.promises.mkdir(y.dirname(s),{recursive:true}),await Y.promises.writeFile(s,`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,"utf-8");}async function je(s){let t=ge(s.workspacePath),o=s.mode,a$2=[],e=[],F,B,C,O,J,G=0,f=false,I=0,T=0,D=-1,N=-1,c="skipped",p="skipped",re=o==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(s.skipPipelineStages)a$2.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let r=Date.now(),i=await b([...re],t),m=Date.now()-r;if(c="pass",i.crashed)c="fail",f=true,e.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e.push("doctor workspace command failed");else {let d=$(i.stdout),j=d&&d.healthScore&&typeof d.healthScore=="object"?d.healthScore:{},k=Number(j.errors??0),E=Number(j.warnings??0);Number.isFinite(k)&&k>0?(c="fail",e.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(E)&&E>0&&(c="warn");}D=a$2.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,o==="enforce"&&c==="warn"&&e.push("doctor workspace reported warnings under enforce mode");let g=Date.now(),w=await b(["analyze","--json"],t),v=Date.now()-g;B=y.join(t,".rapidkit","reports","analyze-last-run.json");let n="pass";if(w.crashed)n="fail",f=true,e.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let d=$(w.stdout),j=d&&d.summary&&typeof d.summary=="object"?d.summary:{},k=String(j.verdict??"ready");k==="blocked"?(n="fail",e.push("analyze reported blocked verdict")):k==="needs-attention"&&(n="warn");}a$2.push({name:"analyze",status:n,durationMs:v,summary:n==="pass"?"analyze passed":n==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),o==="enforce"&&n==="warn"&&e.push("analyze reported warnings under enforce mode");let P=Date.now(),h=await b(["readiness","--json"],t),R=Date.now()-P;if(p="fail",h.crashed)p="fail",f=true,e.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)p="fail",e.push("readiness command failed");else {let d=$(h.stdout),j=String(d?.overallStatus??"fail");if(p=te(j),typeof d?.evidencePath=="string"&&d.evidencePath.trim().length>0&&(F=d.evidencePath),p==="fail"){let k=Array.isArray(d?.blockingReasons)?d?.blockingReasons.filter(E=>typeof E=="string"):[];k.length>0?e.push(...k.map(E=>`readiness: ${E}`)):e.push("readiness overall status is fail");}}N=a$2.push({name:"readiness",status:p,durationMs:R,summary:`readiness overall status is ${p}`})-1,o==="enforce"&&p==="warn"&&e.push("readiness reported warnings under enforce mode");}let ae=Date.now(),M=await b(["doctor","workspace","--plan","--json"],t),oe=Date.now()-ae,S="warn";if(M.crashed)S="fail",f=true,e.push(`doctor remediation plan execution error: ${M.stderr||"unknown error"}`);else if(M.exitCode!==0)S="fail",e.push("doctor remediation plan command failed");else {let r=$(M.stdout),i=r&&r.remediationPlan&&typeof r.remediationPlan=="object"?r.remediationPlan:null,m=Number(i?.totalSteps??0),g=Number(i?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(T=g),Number.isFinite(m)&&m===0?S="pass":S="warn";}if(a$2.push({name:"remediation-plan",status:S,durationMs:oe,summary:S==="pass"?"no remediation steps required":"remediation steps available"}),o==="enforce"&&S==="warn"&&e.push("remediation plan has pending steps under enforce mode"),o==="safe-fix"){let r=Date.now(),i=await b(["doctor","workspace","--apply"],t),m=Date.now()-r,g=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)f=true,e.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e.push("doctor remediation apply failed");else {G=T>0?T:I>0?I:1;let w=await b(["doctor","workspace","--json"],t);if(w.crashed)c="fail",f=true,e.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e.push("post-apply doctor workspace command failed");else {let n=$(w.stdout),P=n&&n.healthScore&&typeof n.healthScore=="object"?n.healthScore:{},h=Number(P.errors??0),R=Number(P.warnings??0);Number.isFinite(h)&&h>0?(c="fail",e.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(R)&&R>0?c="warn":c="pass";}D>=0&&(a$2[D].status=c,a$2[D].summary=`doctor workspace post-apply status is ${c}`);let v=await b(["readiness","--json"],t);if(v.crashed)p="fail",f=true,e.push(`post-apply readiness execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)p="fail",e.push("post-apply readiness command failed");else {let n=$(v.stdout),P=String(n?.overallStatus??"fail");if(p=te(P),typeof n?.evidencePath=="string"&&n.evidencePath.trim().length>0&&(F=n.evidencePath),p==="fail"){let h=Array.isArray(n?.blockingReasons)?n?.blockingReasons.filter(R=>typeof R=="string"):[];h.length>0?e.push(...h.map(R=>`post-apply readiness: ${R}`)):e.push("post-apply readiness overall status is fail");}}N>=0&&(a$2[N].status=p,a$2[N].summary=`readiness post-apply overall status is ${p}`);}a$2.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else a$2.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ne=Date.now(),x="pass",A="workspace test/build completed for selected projects";try{let r=await a({workspacePath:t,stage:"test",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});C=y.join(t,".rapidkit","reports",a$1),await d(t,r),O=C;let i=se(r);if(i==="fail")x="fail",A="workspace test stage failed for selected projects",e.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",A="workspace test stage completed with warnings",o==="enforce"&&e.push("workspace run test reported warnings under enforce mode"));let m=await a({workspacePath:t,stage:"build",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});await d(t,m),J=C;let g=se(m);g==="fail"?(x="fail",A="workspace build stage failed for selected projects",e.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",A="workspace test/build completed with warnings",o==="enforce"&&e.push("workspace run test/build reported warnings under enforce mode"));}}catch(r){x="fail",A="workspace test/build orchestration failed",f=true,e.push(`workspace run orchestration error: ${r instanceof Error?r.message:String(r)}`);}let ie=Date.now()-ne;a$2.push({name:"workspace-run-test-build",status:x,durationMs:ie,summary:A});let z=a$2.filter(r=>r.status==="warn").length,le=a$2.filter(r=>r.status==="fail").length,L=o==="enforce"?a$2.some(r=>r.status==="warn"||r.status==="fail"):le>0,W=[...new Set(e)],ce=f||L?Math.max(1,W.length):0,de=we(a$2),pe=f||L?"blocked":z>0?"partial":"approved",ue=f?3:L?1:z>0?2:0,fe=he({mode:o,executionError:f,blockers:W,hasWarnings:z>0}),V=y.join(t,".rapidkit","reports"),H=y.join(V,Z),q=y.join(V,ee),u={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:t,mode:o,summary:{releaseScore:de,verdict:pe,blockers:ce,warnings:z,safeFixesApplied:G,manualActions:W.length,exitCode:ue},stages:a$2,blockingReasons:W,nextActions:fe,artifacts:{reportPath:H,aliasEvidencePath:q,analyzeEvidencePath:B,readinessEvidencePath:F,workspaceRunEvidencePath:C,workspaceRunTestPath:O,workspaceRunBuildPath:J},enterpriseControls:{jsonReady:true,evidencePath:`.rapidkit/reports/${Z}`,aliasEvidencePath:`.rapidkit/reports/${ee}`}};if(await U(H,u),await U(q,u),s.output&&await U(y.resolve(s.output),u),!s.json){console.log(l.bold.cyan(`
|
|
3
3
|
\u{1F680} RapidKit Autopilot Release
|
|
4
4
|
`)),console.log(l.bold(`Workspace: ${l.cyan(y.basename(t))}`)),console.log(l.gray(`Path: ${t}`)),console.log(l.white(`Mode: ${o}`)),console.log(l.white(`Verdict: ${u.summary.verdict==="approved"?l.green("approved"):u.summary.verdict==="partial"?l.yellow("partial"):l.red("blocked")}`)),console.log(l.white(`Release score: ${u.summary.releaseScore}`));for(let r of u.stages){let i=r.status==="pass"?l.green("PASS"):r.status==="warn"?l.yellow("WARN"):r.status==="skipped"?l.gray("SKIP"):l.red("FAIL");console.log(` - ${r.name}: ${i} ${r.summary} (${r.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(l.bold.red(`
|