rapidkit 0.38.0 → 0.39.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 +36 -9
- package/contracts/runtime-command-surface.v1.json +33 -0
- package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +92 -0
- package/contracts/workspace-intelligence/workspace-impact.v1.json +32 -2
- package/contracts/workspace-intelligence/workspace-model.v1.json +5 -0
- package/contracts/workspace-intelligence/workspace-verify.v1.json +103 -1
- package/dist/analyze-RHQM4AB2.js +1 -0
- package/dist/autopilot-release-FWKOY2BD.js +1 -0
- package/dist/chunk-3YLMCP3V.js +1 -0
- package/dist/chunk-4FJQWL7P.js +4 -0
- package/dist/chunk-4Q2ZZKGB.js +1 -0
- package/dist/chunk-6G2KSHP6.js +2 -0
- package/dist/{chunk-PPQYTYQG.js → chunk-6KD5F6LX.js} +4 -4
- package/dist/{chunk-TVIOAZ6E.js → chunk-ERCD6NFF.js} +15 -15
- package/dist/chunk-G76C74EV.js +1 -0
- package/dist/chunk-GOM3RFB3.js +2 -0
- package/dist/{chunk-NKNMGWAZ.js → chunk-GYNIVEYP.js} +1 -1
- package/dist/chunk-HTYMXMQM.js +1 -0
- package/dist/chunk-KYH364KQ.js +1 -0
- package/dist/chunk-OWNGSAO3.js +2 -0
- package/dist/chunk-PYCJWW4B.js +1 -0
- package/dist/chunk-QPEBI6AB.js +2 -0
- package/dist/{chunk-5NBYSXOZ.js → chunk-RXWM5DSC.js} +2 -2
- package/dist/chunk-S5KTATOU.js +1 -0
- package/dist/chunk-TYZPPUBH.js +1 -0
- package/dist/chunk-UY4KRFNL.js +2 -0
- package/dist/chunk-VQMZC5TC.js +9 -0
- package/dist/{chunk-JBDQADHY.js → chunk-WHCON2VN.js} +11 -11
- package/dist/chunk-X7PWDIQW.js +1 -0
- package/dist/{chunk-7XW2I6MP.js → chunk-ZWKLRZE5.js} +2 -2
- package/dist/{create-Y3XJOKL5.js → create-XVDDQA42.js} +1 -1
- package/dist/{demo-kit-3VTLJBP7.js → demo-kit-RWGOEDW4.js} +1 -1
- package/dist/{doctor-QC662YLH.js → doctor-UOLOGJ2Z.js} +1 -1
- package/dist/{dotnet-webapi-clean-FX533F5U.js → dotnet-webapi-clean-RTBRPDPL.js} +1 -1
- package/dist/{gofiber-standard-35CJZ7S3.js → gofiber-standard-UGIRKPKL.js} +1 -1
- package/dist/{gogin-standard-SAX6C4ZK.js → gogin-standard-HJ7SPFNT.js} +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +153 -153
- package/dist/pipeline-O5ANBQMK.js +5 -0
- package/dist/{springboot-standard-SFMSLTX4.js → springboot-standard-IWJSVDLZ.js} +1 -1
- package/dist/{workspace-WBKFXH4Z.js → workspace-L4ITCKMM.js} +1 -1
- package/dist/{workspace-agent-sync-3FFFJYKF.js → workspace-agent-sync-SALW6TVR.js} +1 -1
- package/dist/{workspace-context-V4UGIHSC.js → workspace-context-NMMQMHNU.js} +1 -1
- package/dist/{workspace-foundation-T45HAWKL.js → workspace-foundation-HNIRAIBF.js} +1 -1
- package/dist/workspace-graph-ICB7OVAZ.js +3 -0
- package/dist/workspace-history-LHUTLE3S.js +1 -0
- package/dist/{workspace-intelligence-MGL3Z25K.js → workspace-intelligence-64IWAYHS.js} +1 -1
- package/dist/workspace-model-SDHH5RBC.js +1 -0
- package/dist/workspace-run-EP7XGEM6.js +1 -0
- package/dist/workspace-verify-6Q6MGRG6.js +1 -0
- package/dist/workspace-watch-JDXVGW4H.js +1 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +148 -0
- package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
- package/package.json +8 -5
- package/dist/analyze-6RFG7C7Z.js +0 -1
- package/dist/autopilot-release-SBPGNGAB.js +0 -1
- package/dist/chunk-2ED6SPXP.js +0 -1
- package/dist/chunk-3R7UJAX5.js +0 -1
- package/dist/chunk-6E5TBB2C.js +0 -2
- package/dist/chunk-6P5DCHBQ.js +0 -4
- package/dist/chunk-ABPDGFVD.js +0 -2
- package/dist/chunk-B2KOIORF.js +0 -1
- package/dist/chunk-C7WILE56.js +0 -1
- package/dist/chunk-HEG6DIGW.js +0 -2
- package/dist/chunk-IW3KLQXE.js +0 -2
- package/dist/chunk-RELR4O5E.js +0 -2
- package/dist/chunk-T5LN7EO5.js +0 -9
- package/dist/chunk-XESEBTPE.js +0 -1
- package/dist/pipeline-C4UCLETO.js +0 -5
- package/dist/workspace-model-IKMGY2BX.js +0 -1
- package/dist/workspace-run-HOR56FON.js +0 -1
- package/dist/workspace-verify-A3J6D7T2.js +0 -1
package/README.md
CHANGED
|
@@ -237,18 +237,45 @@ Every tool gets the same answers: what projects exist, what stack they use, whic
|
|
|
237
237
|
|
|
238
238
|
Workspace Intelligence provides a shared understanding of projects, dependencies, operational context, and release readiness for developers, CI pipelines, and AI agents.
|
|
239
239
|
|
|
240
|
-
| Command
|
|
241
|
-
|
|
|
242
|
-
| `workspace model --json`
|
|
243
|
-
| `workspace context --for-agent --json --write`
|
|
244
|
-
| `workspace agent-sync --write`
|
|
245
|
-
| `workspace snapshot --json`
|
|
246
|
-
| `workspace diff --from <file\|git[:ref]> --json`
|
|
247
|
-
| `workspace impact --from <file> --json`
|
|
248
|
-
| `workspace verify [--strict] --json`
|
|
240
|
+
| Command | Purpose |
|
|
241
|
+
| ------------------------------------------------- | ---------------------------------------------------------------- |
|
|
242
|
+
| `workspace model [--cache\|--incremental] --json` | Canonical workspace model (graph-aware, incremental rebuilds) |
|
|
243
|
+
| `workspace context --for-agent --json --write` | Agent-ready context pack + auto agent grounding sync |
|
|
244
|
+
| `workspace agent-sync --write` | Cross-tool grounding (AGENTS.md, Copilot, Cursor, Claude, INDEX) |
|
|
245
|
+
| `workspace snapshot --json` | Persist model snapshot |
|
|
246
|
+
| `workspace diff --from <file\|git[:ref]> --json` | Diff against snapshot or git |
|
|
247
|
+
| `workspace impact --from <file> --json` | Graph-aware transitive blast-radius evidence |
|
|
248
|
+
| `workspace verify [--strict] --json` | Definitive verification gate (subgraph + freshness + policy) |
|
|
249
|
+
| `workspace graph <emit\|explain\|dot\|mermaid>` | Inspect and visualize the dependency graph |
|
|
250
|
+
| `workspace watch [--json] [--once]` | Daemon mode: keep model + graph in memory, stream change events |
|
|
249
251
|
|
|
250
252
|
JSON schemas: `contracts/workspace-intelligence/`. Details: [commands-reference.md](docs/commands-reference.md).
|
|
251
253
|
|
|
254
|
+
### Graph-aware intelligence engine
|
|
255
|
+
|
|
256
|
+
The workspace model carries a deterministic, first-class **dependency graph** that
|
|
257
|
+
`impact`, `verify`, and `graph` all reason over — so the same evidence drives blast
|
|
258
|
+
radius, gating, and visualization:
|
|
259
|
+
|
|
260
|
+
- **Transitive blast radius** — `workspace impact` reports each affected project's
|
|
261
|
+
`distance`, `path`, and `via` edge back to the change, plus centrality-weighted
|
|
262
|
+
**critical-path hotspots**.
|
|
263
|
+
- **Whole-subgraph gate** — `workspace verify` gates the changed projects **and** their
|
|
264
|
+
transitive dependents, surfaces graph **integrity** issues (cycles, dangling edges,
|
|
265
|
+
orphans), and emits a structured `gate` (`passed`/`mode`/`exitCode`/`reasons`).
|
|
266
|
+
- **Transitive freshness** — a deterministic `fresh | stale | unknown` verdict chained
|
|
267
|
+
through the graph: a dependency change makes every dependent stale, not just by
|
|
268
|
+
timestamp.
|
|
269
|
+
- **Policy violations** — model/contract violations are surfaced as structured
|
|
270
|
+
`policyViolations[]` (not just an exit code) so IDEs and CI can render blockers.
|
|
271
|
+
- **Health history** — every verify run appends to a bounded
|
|
272
|
+
`.rapidkit/reports/workspace-intelligence-history.json` ring buffer for trends.
|
|
273
|
+
- **Fast rebuilds** — `workspace model --cache` / `--incremental` reuse unchanged
|
|
274
|
+
project models and re-infer only incident edges, keyed by a structural `inputsHash`.
|
|
275
|
+
- **Watch / daemon** — `workspace watch` keeps the model + graph in memory and streams
|
|
276
|
+
deterministic `workspace-watch-event.v1` change events (changed projects, graph edge
|
|
277
|
+
deltas, structural hash) via fast incremental rebuilds.
|
|
278
|
+
|
|
252
279
|
### Agent grounding (CLI-only, no extension required)
|
|
253
280
|
|
|
254
281
|
RapidKit can sync **cross-tool instruction files** so Copilot, Cursor, Claude Code, Codex, Grok, and other agents read the same evidence before guessing:
|
|
@@ -39,6 +39,39 @@
|
|
|
39
39
|
"coreProjectCommands": [
|
|
40
40
|
"docs"
|
|
41
41
|
],
|
|
42
|
+
"workspaceSubcommands": [
|
|
43
|
+
"list",
|
|
44
|
+
"sync",
|
|
45
|
+
"registry",
|
|
46
|
+
"foundation",
|
|
47
|
+
"model",
|
|
48
|
+
"snapshot",
|
|
49
|
+
"diff",
|
|
50
|
+
"impact",
|
|
51
|
+
"verify",
|
|
52
|
+
"graph",
|
|
53
|
+
"watch",
|
|
54
|
+
"context",
|
|
55
|
+
"agent-sync",
|
|
56
|
+
"policy",
|
|
57
|
+
"contract",
|
|
58
|
+
"share",
|
|
59
|
+
"export",
|
|
60
|
+
"archive",
|
|
61
|
+
"hydrate",
|
|
62
|
+
"import",
|
|
63
|
+
"run",
|
|
64
|
+
"init"
|
|
65
|
+
],
|
|
66
|
+
"workspaceIntelligenceSubcommands": [
|
|
67
|
+
"model",
|
|
68
|
+
"snapshot",
|
|
69
|
+
"diff",
|
|
70
|
+
"impact",
|
|
71
|
+
"verify",
|
|
72
|
+
"context",
|
|
73
|
+
"agent-sync"
|
|
74
|
+
],
|
|
42
75
|
"moduleSuggestionFrameworks": [
|
|
43
76
|
"fastapi",
|
|
44
77
|
"nestjs"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://getrapidkit.com/schemas/workspace-dependency-graph.v1.json",
|
|
4
|
+
"title": "RapidKit Workspace Dependency Graph",
|
|
5
|
+
"description": "First-class, versioned dependency graph of inter-project relationships consumed by impact, verify, run --blast-radius, and risk weighting.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schemaVersion", "generatedAt", "nodes", "edges", "stats"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": {
|
|
10
|
+
"const": "workspace-dependency-graph.v1"
|
|
11
|
+
},
|
|
12
|
+
"generatedAt": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"format": "date-time"
|
|
15
|
+
},
|
|
16
|
+
"nodes": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": ["id", "path"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"id": { "type": "string", "minLength": 1 },
|
|
23
|
+
"path": { "type": "string", "minLength": 1 },
|
|
24
|
+
"runtime": { "type": "string" },
|
|
25
|
+
"framework": { "type": "string" },
|
|
26
|
+
"kind": { "type": "string" }
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"edges": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": ["from", "to", "kind", "source", "confidence", "evidence"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"from": { "type": "string", "minLength": 1 },
|
|
38
|
+
"to": { "type": "string", "minLength": 1 },
|
|
39
|
+
"kind": {
|
|
40
|
+
"enum": [
|
|
41
|
+
"code-import",
|
|
42
|
+
"package-dep",
|
|
43
|
+
"event-pub-sub",
|
|
44
|
+
"service-dependsOn",
|
|
45
|
+
"shared-resource"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"source": {
|
|
49
|
+
"enum": ["inferred", "contract", "manual"]
|
|
50
|
+
},
|
|
51
|
+
"confidence": {
|
|
52
|
+
"enum": ["high", "medium", "low"]
|
|
53
|
+
},
|
|
54
|
+
"evidence": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"required": ["file"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"file": { "type": "string", "minLength": 1 },
|
|
61
|
+
"detail": { "type": "string" }
|
|
62
|
+
},
|
|
63
|
+
"additionalProperties": true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"additionalProperties": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"stats": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"required": [
|
|
73
|
+
"nodeCount",
|
|
74
|
+
"edgeCount",
|
|
75
|
+
"inferredEdges",
|
|
76
|
+
"contractEdges",
|
|
77
|
+
"manualEdges",
|
|
78
|
+
"hasCycle"
|
|
79
|
+
],
|
|
80
|
+
"properties": {
|
|
81
|
+
"nodeCount": { "type": "integer", "minimum": 0 },
|
|
82
|
+
"edgeCount": { "type": "integer", "minimum": 0 },
|
|
83
|
+
"inferredEdges": { "type": "integer", "minimum": 0 },
|
|
84
|
+
"contractEdges": { "type": "integer", "minimum": 0 },
|
|
85
|
+
"manualEdges": { "type": "integer", "minimum": 0 },
|
|
86
|
+
"hasCycle": { "type": "boolean" }
|
|
87
|
+
},
|
|
88
|
+
"additionalProperties": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"additionalProperties": true
|
|
92
|
+
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"workspace",
|
|
12
12
|
"summary",
|
|
13
13
|
"affectedProjects",
|
|
14
|
+
"transitiveImpact",
|
|
15
|
+
"criticalPathHotspots",
|
|
14
16
|
"workspaceImpact",
|
|
15
17
|
"verificationPlan",
|
|
16
18
|
"agentBrief",
|
|
@@ -43,7 +45,8 @@
|
|
|
43
45
|
"risk",
|
|
44
46
|
"affectedProjects",
|
|
45
47
|
"workspaceItems",
|
|
46
|
-
"recommendedCommands"
|
|
48
|
+
"recommendedCommands",
|
|
49
|
+
"blastRadius"
|
|
47
50
|
],
|
|
48
51
|
"properties": {
|
|
49
52
|
"changed": { "type": "boolean" },
|
|
@@ -52,11 +55,38 @@
|
|
|
52
55
|
},
|
|
53
56
|
"affectedProjects": { "type": "integer", "minimum": 0 },
|
|
54
57
|
"workspaceItems": { "type": "integer", "minimum": 0 },
|
|
55
|
-
"recommendedCommands": { "type": "integer", "minimum": 0 }
|
|
58
|
+
"recommendedCommands": { "type": "integer", "minimum": 0 },
|
|
59
|
+
"blastRadius": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["directlyAffected", "transitivelyAffected", "maxDistance", "graphEdges"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"directlyAffected": { "type": "integer", "minimum": 0 },
|
|
64
|
+
"transitivelyAffected": { "type": "integer", "minimum": 0 },
|
|
65
|
+
"maxDistance": { "type": "integer", "minimum": 0 },
|
|
66
|
+
"graphEdges": { "type": "integer", "minimum": 0 }
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
}
|
|
56
70
|
},
|
|
57
71
|
"additionalProperties": false
|
|
58
72
|
},
|
|
59
73
|
"affectedProjects": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
|
|
74
|
+
"transitiveImpact": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
|
|
75
|
+
"criticalPathHotspots": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"required": ["project", "fanIn", "fanOut", "reach", "betweenness"],
|
|
80
|
+
"properties": {
|
|
81
|
+
"project": { "type": "string" },
|
|
82
|
+
"fanIn": { "type": "integer", "minimum": 0 },
|
|
83
|
+
"fanOut": { "type": "integer", "minimum": 0 },
|
|
84
|
+
"reach": { "type": "integer", "minimum": 0 },
|
|
85
|
+
"betweenness": { "type": "number", "minimum": 0 }
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
60
90
|
"workspaceImpact": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
|
|
61
91
|
"verificationPlan": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
|
|
62
92
|
"agentBrief": {
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"items": { "type": "object", "additionalProperties": true }
|
|
42
42
|
},
|
|
43
43
|
"contracts": { "type": "object", "additionalProperties": true },
|
|
44
|
+
"graph": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"description": "First-class inferred dependency graph (workspace-dependency-graph.v1). Additive/optional.",
|
|
47
|
+
"additionalProperties": true
|
|
48
|
+
},
|
|
44
49
|
"evidence": { "type": "object", "additionalProperties": true },
|
|
45
50
|
"discovery": { "type": "object", "additionalProperties": true },
|
|
46
51
|
"policies": { "type": "object", "additionalProperties": true },
|
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
"steps",
|
|
14
14
|
"missingEvidence",
|
|
15
15
|
"blockingReasons",
|
|
16
|
-
"verificationPlan"
|
|
16
|
+
"verificationPlan",
|
|
17
|
+
"affectedSubgraph",
|
|
18
|
+
"graphIntegrity",
|
|
19
|
+
"freshness",
|
|
20
|
+
"policyMode",
|
|
21
|
+
"policyViolations"
|
|
17
22
|
],
|
|
18
23
|
"properties": {
|
|
19
24
|
"schemaVersion": {
|
|
@@ -105,6 +110,103 @@
|
|
|
105
110
|
"verificationPlan": {
|
|
106
111
|
"type": "array",
|
|
107
112
|
"items": { "type": "object", "additionalProperties": true }
|
|
113
|
+
},
|
|
114
|
+
"affectedSubgraph": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": [
|
|
117
|
+
"totalProjects",
|
|
118
|
+
"directlyChanged",
|
|
119
|
+
"transitiveDependents",
|
|
120
|
+
"covered",
|
|
121
|
+
"uncovered",
|
|
122
|
+
"unverifiable"
|
|
123
|
+
],
|
|
124
|
+
"properties": {
|
|
125
|
+
"totalProjects": { "type": "integer", "minimum": 0 },
|
|
126
|
+
"directlyChanged": { "type": "array", "items": { "type": "string" } },
|
|
127
|
+
"transitiveDependents": { "type": "array", "items": { "type": "string" } },
|
|
128
|
+
"covered": { "type": "array", "items": { "type": "string" } },
|
|
129
|
+
"uncovered": { "type": "array", "items": { "type": "string" } },
|
|
130
|
+
"unverifiable": { "type": "array", "items": { "type": "string" } }
|
|
131
|
+
},
|
|
132
|
+
"additionalProperties": false
|
|
133
|
+
},
|
|
134
|
+
"graphIntegrity": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"required": ["ok", "cycles", "danglingEdges", "orphans", "stats"],
|
|
137
|
+
"properties": {
|
|
138
|
+
"ok": { "type": "boolean" },
|
|
139
|
+
"cycles": {
|
|
140
|
+
"type": "array",
|
|
141
|
+
"items": { "type": "array", "items": { "type": "string" } }
|
|
142
|
+
},
|
|
143
|
+
"danglingEdges": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"required": ["from", "to", "kind", "missing"],
|
|
148
|
+
"properties": {
|
|
149
|
+
"from": { "type": "string" },
|
|
150
|
+
"to": { "type": "string" },
|
|
151
|
+
"kind": { "type": "string" },
|
|
152
|
+
"missing": { "enum": ["from", "to", "both"] }
|
|
153
|
+
},
|
|
154
|
+
"additionalProperties": true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"orphans": { "type": "array", "items": { "type": "string" } },
|
|
158
|
+
"stats": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"required": [
|
|
161
|
+
"nodeCount",
|
|
162
|
+
"edgeCount",
|
|
163
|
+
"cycleCount",
|
|
164
|
+
"danglingCount",
|
|
165
|
+
"orphanCount"
|
|
166
|
+
],
|
|
167
|
+
"properties": {
|
|
168
|
+
"nodeCount": { "type": "integer", "minimum": 0 },
|
|
169
|
+
"edgeCount": { "type": "integer", "minimum": 0 },
|
|
170
|
+
"cycleCount": { "type": "integer", "minimum": 0 },
|
|
171
|
+
"danglingCount": { "type": "integer", "minimum": 0 },
|
|
172
|
+
"orphanCount": { "type": "integer", "minimum": 0 }
|
|
173
|
+
},
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"additionalProperties": false
|
|
178
|
+
},
|
|
179
|
+
"freshness": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["verdict", "baseline", "changed", "added", "removed", "projectHashes"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"verdict": { "enum": ["fresh", "stale", "unknown"] },
|
|
184
|
+
"baseline": { "enum": ["none", "recorded"] },
|
|
185
|
+
"changed": { "type": "array", "items": { "type": "string" } },
|
|
186
|
+
"added": { "type": "array", "items": { "type": "string" } },
|
|
187
|
+
"removed": { "type": "array", "items": { "type": "string" } },
|
|
188
|
+
"projectHashes": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"additionalProperties": { "type": "string" }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
"policyMode": { "type": "string" },
|
|
196
|
+
"policyViolations": {
|
|
197
|
+
"type": "array",
|
|
198
|
+
"items": {
|
|
199
|
+
"type": "object",
|
|
200
|
+
"required": ["source", "severity", "code", "message"],
|
|
201
|
+
"properties": {
|
|
202
|
+
"source": { "enum": ["model", "contract"] },
|
|
203
|
+
"severity": { "enum": ["error", "warning"] },
|
|
204
|
+
"code": { "type": "string" },
|
|
205
|
+
"message": { "type": "string" },
|
|
206
|
+
"target": { "type": "string" }
|
|
207
|
+
},
|
|
208
|
+
"additionalProperties": false
|
|
209
|
+
}
|
|
108
210
|
}
|
|
109
211
|
},
|
|
110
212
|
"additionalProperties": true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-VQMZC5TC.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-GYNIVEYP.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-6G2KSHP6.js';import {b}from'./chunk-GOM3RFB3.js';import {intro,confirm,isCancel,password,text,multiselect,select,cancel}from'@clack/prompts';var c=false;function S(n){if(b()||c)return;c=true;let i=`${a$1.brand("\u25C6")} ${a$1.white("RapidKit")}${n?a$1.dim(` ${n}`):""}`;intro(i);}function a(n="Cancelled"){b()||(cancel(a$1.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$1.success("yes"),inactive:a$1.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(b()){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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {c as c$1}from'./chunk-NFUXULIF.js';import {a as a$1,b as b$1,d as d$1,c,f as f$1}from'./chunk-YBS2HGO3.js';import {a,b}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-4Q2ZZKGB.js';import u from'chalk';import d 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.existsSync(s))try{let i=JSON.parse(d.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$1(e,t)?"java":c(e,t)?"node":f$1(e,t)?"python":"unknown"}function O(t,e){if(!d.existsSync(t))return null;let a=d.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.statSync(r).mtimeMs-d.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.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.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.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(d.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.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.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.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.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$1=await W(a$1,{skipVerify:t.skipVerify}),g=F(n.payload,a$1),k=[i,n.gate,c,f$1,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=f(m,{commandId:"workspaceReadiness",exitCode:v==="fail"?2:v==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:e()});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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d,b,g as g$1,a,c}from'./chunk-GOM3RFB3.js';import {randomUUID}from'crypto';var i=null;function f(){return i}function V(t){let r=t.argv??process.argv,n=m(r.slice(2)),e={runId:randomUUID(),startedAt:new Date().toISOString(),command:n,cwd:t.cwd??process.cwd(),rapidkitVersion:t.rapidkitVersion,finalized:false};return i=e,d(e.runId),b(r)&&g$1(l(e,"run.started","info","CLI run started")),e}function E(t,r){if(!(!i||i.finalized)){if(i.finalized=true,!b()){i=null;return}t===0?g$1(l(i,"run.completed","info",r??"CLI run completed",{exitCode:t})):g$1(l(i,"run.failed","error",r??"CLI run failed",{exitCode:t})),i=null;}}function w(t=process.argv){a(t)==="json"&&(process.env.RAPIDKIT_LOG_FORMAT="json");let r=t.slice(0,2),n=m(t.slice(2));n.length!==t.length-2&&(process.argv=[...r,...n]);}function m(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:c,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 g=false;function L(t){if(g||!t?.force&&(process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"))return;g=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 E(o),r(n)});}function O(){return f()?.runId}function _(t,r){let{blockers:n,stderrTail:e,runId:o,generatedAt:p,...C}=r,x=p||(typeof t.generatedAt=="string"?t.generatedAt:void 0)||(typeof t.timestamp=="string"?t.timestamp:void 0)||new Date().toISOString();return {...t,...C,generatedAt:x,...n&&n.length>0?{blockers:n}:{},...e&&e.trim()?{stderrTail:e.trim()}:{},...o?{runId:o}:{}}}export{V as a,E as b,w as c,L as d,O as e,_ as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1,f}from'./chunk-GOM3RFB3.js';import {spinner,log,note}from'@clack/prompts';import a from'picocolors';function c(r,t,e){f({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(b$1())return c(t,"started",r),{start(n){return n&&(e=n),c(t,"started",e),this},succeed(n){c(t,"succeeded",n??e);},fail(n){c(t,"failed",n??e);},warn(n){c(t,"warn",n??e);},stop(n){c(t,"succeeded",n??e);},get text(){return e},set text(n){e=n,c(t,"started",n);}};let i=spinner();return i.start(r),{start(n){return i.start(n??e),n&&(e=n),this},succeed(n){i.stop(n??e);},fail(n){i.stop(n??e,1);},warn(n){i.stop(n??e);},stop(n){i.stop(n??e);},get text(){return e},set text(n){e=n,i.message(n);}}}function R(r,t){return b(r,t)}function h(r,t,e,i="create"){f({level:"info",event:"progress",component:i,message:e,metadata:{phase:"step",stepNum:r,total:t,status:"started"}});}function J(r){f({level:r.status==="failed"?"error":r.status==="warn"?"warn":"info",event:"progress",component:"workspace",message:r.message,metadata:{phase:`workspace.${r.action}`,action:r.action,status:r.status,...r.metadata??{}}});}function F(r){f({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 p={brand:r=>a.cyan(r),accent:r=>a.magenta(r),value:r=>a.cyan(r),dim:r=>a.gray(r),muted:r=>a.dim(r),success:r=>a.green(r),warn:r=>a.yellow(r),error:r=>a.red(r),white:r=>a.white(r),bold:r=>a.bold(r)};function d(r,t,e){b$1()&&f({level:r,event:"log",component:"cli",message:t,metadata:e});}var g={info(r){d("info",r),!b$1()&&log.info(r);},success(r){d("info",r,{outcome:"success"}),!b$1()&&log.success(r);},warn(r){d("warn",r),!b$1()&&log.warn(r);},error(r){d("error",r),!b$1()&&log.error(r);},step(r){d("info",r,{phase:"step"}),!b$1()&&log.step(r);},stepNumbered(r,t,e){let i=`${p.dim(`[${r}/${t}]`)} ${e}`;d("info",e,{phase:"step",stepNum:r,total:t}),!b$1()&&log.step(i);},note(r,t){d("info",r,{kind:"note",title:t}),!b$1()&¬e(r,t);},message(r,t=p.brand("\u25C7")){d("info",r),!b$1()&&log.message(r,{symbol:t});},dim(r){b$1()||console.log(p.dim(r));},plain(r){b$1()||console.log(r);},nextSteps(r){b$1()||g.note(r.map(t=>p.white(t)).join(`
|
|
2
|
+
`),p.brand("Next steps"));}};var w=class{debugEnabled=false;setDebug(t){this.debugEnabled=t;}isJsonMode(){return b$1()}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,i){if(b$1()){h(t,e,i);return}g.stepNumbered(t,e,i);}write(t,e,i,n,v="info"){let k=i.length>0?{details:i.map(x=>y(x))}:void 0;if(b$1()){f({level:t,event:"log",component:"cli",message:e,metadata:{...n,...k}});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 Y=new w;export{p as a,b,R as c,J as d,F as e,Y as f};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {f}from'./chunk-6G2KSHP6.js';import {b as b$1}from'./chunk-2FIX2MDC.js';import {execa}from'execa';import m from'chalk';import {createRequire}from'module';import {promises}from'fs';import l from'path';import g from'os';var v="rapidkit",A=createRequire(import.meta.url),C=A("../package.json"),i=C?.version??"0.0.0";function b(r){let e=r.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let t=e[4]?e[4].split(".").map(o=>o.match(/^\d+$/)?Number(o):o):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:t}}function k(r,n){let e=b(r),t=b(n);if(!e||!t)return 0;if(e.major!==t.major)return e.major>t.major?1:-1;if(e.minor!==t.minor)return e.minor>t.minor?1:-1;if(e.patch!==t.patch)return e.patch>t.patch?1:-1;if(e.prerelease.length===0&&t.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(t.prerelease.length===0)return -1;let o=Math.max(e.prerelease.length,t.prerelease.length);for(let u=0;u<o;u+=1){let a=e.prerelease[u],s=t.prerelease[u];if(a===void 0)return -1;if(s===void 0)return 1;if(a===s)continue;let d=typeof a=="number",h=typeof s=="number";return d&&h?a>s?1:-1:d?-1:h||String(a)>String(s)?1:-1}return 0}var _=14400*1e3;function y(){let r=process.env.RAPIDKIT_CACHE_DIR?.trim()||(process.env.VITEST_WORKER_ID?l.join(g.homedir(),".rapidkit","cache",`vitest-${process.env.VITEST_WORKER_ID}`):l.join(g.homedir(),".rapidkit","cache"));return l.join(r,"update-check.json")}async function U(){try{let r=await promises.readFile(y(),"utf-8"),n=JSON.parse(r);return typeof n.latestVersion=="string"&&typeof n.checkedAt=="number"&&n.currentVersion===i&&Date.now()-n.checkedAt<_?n:null}catch{return null}}async function N(r){try{let n=y();await promises.mkdir(l.dirname(n),{recursive:true}),await promises.writeFile(n,JSON.stringify({latestVersion:r,checkedAt:Date.now(),currentVersion:i}),"utf-8");}catch{}}async function F(){try{f.debug("Checking for updates...");let r=await U();if(r){let t=Math.round((Date.now()-r.checkedAt)/6e4);f.debug(`Update check: cache hit (${t}m old)`),k(r.latestVersion,i)>0&&(console.log(m.yellow(`
|
|
2
2
|
\u26A0\uFE0F Update available: ${i} \u2192 ${r.latestVersion}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
|
|
3
|
-
`)));return}let{stdout:n}=await execa("npm",["view",v,"version"],{timeout:b$1()}),e
|
|
4
|
-
\u26A0\uFE0F Update available: ${i} \u2192 ${e
|
|
5
|
-
`))):
|
|
3
|
+
`)));return}let{stdout:n}=await execa("npm",["view",v,"version"],{timeout:b$1()}),e=n.trim();await N(e),e&&k(e,i)>0?(console.log(m.yellow(`
|
|
4
|
+
\u26A0\uFE0F Update available: ${i} \u2192 ${e}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
|
|
5
|
+
`))):f.debug("You are using the latest version");}catch{f.debug("Could not check for updates");}}function M(){return i}export{F as a,M as b};
|