rapidkit 0.37.0 → 0.37.1
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 +23 -44
- package/dist/autopilot-release-QNZ2IL7K.js +1 -0
- package/dist/chunk-3SWQKRXH.js +2 -0
- package/dist/{chunk-7VSYTOOG.js → chunk-7RBZGQ7T.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/{pipeline-BOU4KETN.js → pipeline-IMB3C3JY.js} +1 -1
- package/dist/{workspace-agent-sync-V2H6NTGD.js → workspace-agent-sync-4R7S3F6T.js} +1 -1
- package/dist/{workspace-context-KCKNV5VQ.js → workspace-context-CKACDTVE.js} +1 -1
- package/dist/workspace-run-PNMZJNDC.js +1 -0
- package/dist/workspace-verify-EO435PS4.js +1 -0
- package/docs/AI_DYNAMIC_INTEGRATION.md +440 -0
- package/docs/AI_EXAMPLES.md +419 -0
- package/docs/AI_FEATURES.md +460 -0
- package/docs/AI_QUICKSTART.md +245 -0
- package/docs/DEVELOPMENT.md +88 -0
- package/docs/From Code to Shared Understanding.png +0 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +170 -0
- package/docs/OPTIMIZATION_GUIDE.md +504 -0
- package/docs/PACKAGE_MANAGER_POLICY.md +25 -0
- package/docs/README.md +120 -0
- package/docs/SECURITY.md +63 -0
- package/docs/SETUP.md +107 -0
- package/docs/UTILITIES.md +221 -0
- package/docs/WORKSPACE_MARKER_SPEC.md +276 -0
- package/docs/ci-workflows.md +56 -0
- package/docs/commands-reference.md +136 -0
- package/docs/config-file-guide.md +295 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +104 -0
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +138 -0
- package/docs/contracts/README.md +70 -0
- package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +98 -0
- package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +74 -0
- package/docs/contracts/rapidkit-cli-contracts.json +239 -0
- package/docs/doctor-command.md +263 -0
- package/docs/examples/ci-agent-grounding.yml +62 -0
- package/docs/from-code-to-shared-understanding.md +46 -0
- package/docs/governance-policy.enterprise.example.json +40 -0
- package/docs/mirror-config.enterprise.example.json +60 -0
- package/docs/policies.workspace.example.yml +23 -0
- package/docs/workspace-operations.md +160 -0
- package/docs/workspace-run.md +80 -0
- package/package.json +3 -2
- package/dist/autopilot-release-AUXP2ZIF.js +0 -1
- package/dist/chunk-EJGKBFV4.js +0 -2
- package/dist/workspace-run-DEXI52KO.js +0 -1
- package/dist/workspace-verify-HBCQNNGU.js +0 -1
- /package/dist/{chunk-D23L2GFT.js → chunk-TRXYRHD7.js} +0 -0
package/docs/SETUP.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Setup & Workflow
|
|
2
|
+
|
|
3
|
+
Canonical setup reference for **maintainers** of the RapidKit npm CLI.
|
|
4
|
+
|
|
5
|
+
**End users:** start with [../README.md](../README.md), [OPEN_SOURCE_USER_SCENARIOS.md](./OPEN_SOURCE_USER_SCENARIOS.md), and [workspace-operations.md](./workspace-operations.md).
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node.js `>= 20.19.6`
|
|
10
|
+
- npm ([PACKAGE_MANAGER_POLICY.md](./PACKAGE_MANAGER_POLICY.md))
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm ci
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Build & quality gates
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm run build
|
|
20
|
+
npm run validate
|
|
21
|
+
npm run validate:docs
|
|
22
|
+
npm run validate:contracts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
| Command | Purpose |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `validate` | typecheck + lint + format + tests |
|
|
28
|
+
| `validate:docs` | markdown links, drift guard, doc examples, README smoke |
|
|
29
|
+
| `validate:contracts` | generated JSON contracts + parity tests |
|
|
30
|
+
|
|
31
|
+
See [ci-workflows.md](./ci-workflows.md) for GitHub Actions mapping.
|
|
32
|
+
|
|
33
|
+
## Workspace CLI smoke
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run build
|
|
37
|
+
|
|
38
|
+
node dist/index.js --help
|
|
39
|
+
node dist/index.js --version
|
|
40
|
+
|
|
41
|
+
node dist/index.js create workspace test-ws --yes --profile polyglot
|
|
42
|
+
node dist/index.js workspace list
|
|
43
|
+
cd test-ws
|
|
44
|
+
node ../dist/index.js bootstrap --profile polyglot
|
|
45
|
+
node ../dist/index.js setup python
|
|
46
|
+
node ../dist/index.js setup node --warm-deps
|
|
47
|
+
node ../dist/index.js doctor workspace
|
|
48
|
+
node ../dist/index.js workspace policy show
|
|
49
|
+
node ../dist/index.js cache status
|
|
50
|
+
node ../dist/index.js mirror status
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Release confidence scripts
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run test:scenarios
|
|
57
|
+
npm run test:scenarios:full
|
|
58
|
+
npm run test:runtime-matrix:full
|
|
59
|
+
npm run smoke:frontend-generators
|
|
60
|
+
npm pack --dry-run
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Common development commands
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run typecheck
|
|
67
|
+
npm run lint
|
|
68
|
+
npm run format:check
|
|
69
|
+
npm test
|
|
70
|
+
npm run test:coverage
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Details: [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
74
|
+
|
|
75
|
+
## Environment variables
|
|
76
|
+
|
|
77
|
+
Bridge + Core integration:
|
|
78
|
+
|
|
79
|
+
- `RAPIDKIT_DEV_PATH` — local RapidKit Core checkout
|
|
80
|
+
- `RAPIDKIT_CORE_PYTHON_PACKAGE` — override Core install target
|
|
81
|
+
- `RAPIDKIT_BRIDGE_FORCE_VENV=1` — force cached bridge venv
|
|
82
|
+
- `RAPIDKIT_BRIDGE_UPGRADE_PIP=1` — upgrade pip in bridge venv
|
|
83
|
+
- `XDG_CACHE_HOME` — bridge cache root
|
|
84
|
+
|
|
85
|
+
Scenario toggles: `RAPIDKIT_SCENARIO_FULL_BOOTSTRAP`, `RAPIDKIT_SCENARIO_WORKSPACE_CREATE`
|
|
86
|
+
|
|
87
|
+
General: `DEBUG`, `NODE_ENV`
|
|
88
|
+
|
|
89
|
+
## Open-source release hygiene
|
|
90
|
+
|
|
91
|
+
Before tagging:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run validate
|
|
95
|
+
npm run validate:docs
|
|
96
|
+
npm run security
|
|
97
|
+
npm run test:scenarios
|
|
98
|
+
npm pack --dry-run
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use placeholders in examples (never real credentials). Do not commit local coverage output unless intentional.
|
|
102
|
+
|
|
103
|
+
## See also
|
|
104
|
+
|
|
105
|
+
- [Documentation index](./README.md)
|
|
106
|
+
- [commands-reference.md](./commands-reference.md)
|
|
107
|
+
- [contracts/README.md](./contracts/README.md)
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Utilities Documentation
|
|
2
|
+
|
|
3
|
+
Internal cache and performance helpers for the npm CLI codebase.
|
|
4
|
+
|
|
5
|
+
**End-user commands:** [doctor-command.md](./doctor-command.md) · [OPEN_SOURCE_USER_SCENARIOS.md](./OPEN_SOURCE_USER_SCENARIOS.md) · [../README.md](../README.md)
|
|
6
|
+
|
|
7
|
+
## Cache System
|
|
8
|
+
|
|
9
|
+
### Using Cache
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Cache, getCachedOrFetch } from './utils/cache.js';
|
|
13
|
+
|
|
14
|
+
// Simple usage
|
|
15
|
+
const data = await getCachedOrFetch('my-key', async () => {
|
|
16
|
+
// Heavy operation
|
|
17
|
+
return await fetchDataFromAPI();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Advanced usage
|
|
21
|
+
const cache = Cache.getInstance();
|
|
22
|
+
|
|
23
|
+
// Save
|
|
24
|
+
await cache.set('user-data', userData, '1.0');
|
|
25
|
+
|
|
26
|
+
// Read
|
|
27
|
+
const cached = await cache.get('user-data', '1.0');
|
|
28
|
+
|
|
29
|
+
// Invalidate
|
|
30
|
+
await cache.invalidate('user-data');
|
|
31
|
+
|
|
32
|
+
// Clear all
|
|
33
|
+
await cache.clear();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Cache Features
|
|
37
|
+
- **Memory cache** for fast access
|
|
38
|
+
- **Disk cache** for persistence
|
|
39
|
+
- **TTL**: 24 hours (configurable)
|
|
40
|
+
- **Versioning**: Version support
|
|
41
|
+
- **Automatic cleanup**: Auto-removal of expired cache
|
|
42
|
+
|
|
43
|
+
## Performance Monitoring
|
|
44
|
+
|
|
45
|
+
### Using Performance Monitor
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { PerformanceMonitor, measure, measurePerformance } from './utils/performance.js';
|
|
49
|
+
|
|
50
|
+
// Method 1: Manual timing
|
|
51
|
+
const monitor = PerformanceMonitor.getInstance();
|
|
52
|
+
monitor.start('my-operation');
|
|
53
|
+
// ... operation
|
|
54
|
+
monitor.end('my-operation');
|
|
55
|
+
|
|
56
|
+
// Method 2: Helper function
|
|
57
|
+
await measure('my-async-operation', async () => {
|
|
58
|
+
await doSomethingHeavy();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Method 3: Decorator (for methods)
|
|
62
|
+
class MyService {
|
|
63
|
+
@measurePerformance
|
|
64
|
+
async heavyOperation() {
|
|
65
|
+
// This method is automatically measured
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Show summary
|
|
70
|
+
monitor.summary();
|
|
71
|
+
|
|
72
|
+
// Get metrics
|
|
73
|
+
const metrics = monitor.getMetrics();
|
|
74
|
+
console.log(metrics);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Use Cases
|
|
78
|
+
- Measure operation timing
|
|
79
|
+
- Identify bottlenecks
|
|
80
|
+
- Optimize performance
|
|
81
|
+
- Debug performance issues
|
|
82
|
+
|
|
83
|
+
## Best Practices
|
|
84
|
+
|
|
85
|
+
### Cache
|
|
86
|
+
```typescript
|
|
87
|
+
// ✅ Good: Use version for invalidation
|
|
88
|
+
await cache.set('data', myData, '2.0');
|
|
89
|
+
|
|
90
|
+
// ✅ Good: Use getCachedOrFetch
|
|
91
|
+
const result = await getCachedOrFetch('expensive-op', fetchData);
|
|
92
|
+
|
|
93
|
+
// ❌ Bad: Forgetting version
|
|
94
|
+
await cache.set('data', myData); // default version '1.0'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Performance
|
|
98
|
+
```typescript
|
|
99
|
+
// ✅ Good: Measure heavy operations
|
|
100
|
+
await measure('database-query', () => db.query());
|
|
101
|
+
|
|
102
|
+
// ✅ Good: Show summary in development
|
|
103
|
+
if (process.env.NODE_ENV === 'development') {
|
|
104
|
+
monitor.summary();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ❌ Bad: Measuring trivial operations
|
|
108
|
+
monitor.start('simple-addition');
|
|
109
|
+
const result = 1 + 1;
|
|
110
|
+
monitor.end('simple-addition'); // overhead exceeds benefit
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Integration Example
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { getCachedOrFetch } from './utils/cache.js';
|
|
117
|
+
import { measure } from './utils/performance.js';
|
|
118
|
+
import { logger } from './logger.js';
|
|
119
|
+
|
|
120
|
+
async function fetchUserData(userId: string) {
|
|
121
|
+
const apiBaseUrl = process.env.API_BASE_URL ?? 'https://api.example.com';
|
|
122
|
+
return await getCachedOrFetch(
|
|
123
|
+
`user-${userId}`,
|
|
124
|
+
async () => {
|
|
125
|
+
return await measure('fetch-user-from-api', async () => {
|
|
126
|
+
logger.debug(`Fetching user ${userId} from API`);
|
|
127
|
+
const response = await fetch(`${apiBaseUrl}/users/${userId}`);
|
|
128
|
+
return await response.json();
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
'1.0'
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Usage
|
|
136
|
+
const user = await fetchUserData('123');
|
|
137
|
+
// First time: Fetches from API and caches
|
|
138
|
+
// Second time: Reads from cache (fast)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Environment Variables
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Enable debug mode to see cache hits/misses
|
|
145
|
+
DEBUG=rapidkit:cache npm run dev
|
|
146
|
+
|
|
147
|
+
# Enable performance logging
|
|
148
|
+
DEBUG=rapidkit:perf npm run dev
|
|
149
|
+
|
|
150
|
+
# Enable all
|
|
151
|
+
DEBUG=rapidkit:* npm run dev
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Testing
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
158
|
+
import { Cache } from './utils/cache.js';
|
|
159
|
+
|
|
160
|
+
describe('Cache', () => {
|
|
161
|
+
beforeEach(async () => {
|
|
162
|
+
await Cache.getInstance().clear();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('should cache and retrieve data', async () => {
|
|
166
|
+
const cache = Cache.getInstance();
|
|
167
|
+
await cache.set('test', { value: 42 });
|
|
168
|
+
const result = await cache.get('test');
|
|
169
|
+
expect(result).toEqual({ value: 42 });
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should invalidate expired cache', async () => {
|
|
173
|
+
// Test with mock Date.now()
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Migration Guide
|
|
179
|
+
|
|
180
|
+
If you have existing code that you want to add caching to:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// Before
|
|
184
|
+
async function loadTemplates() {
|
|
185
|
+
const files = await fs.readdir(templateDir);
|
|
186
|
+
return files.map(parseTemplate);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// After
|
|
190
|
+
async function loadTemplates() {
|
|
191
|
+
return await getCachedOrFetch('templates', async () => {
|
|
192
|
+
const files = await fs.readdir(templateDir);
|
|
193
|
+
return files.map(parseTemplate);
|
|
194
|
+
}, '1.0');
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Troubleshooting
|
|
199
|
+
|
|
200
|
+
### Cache not working
|
|
201
|
+
```bash
|
|
202
|
+
# Check cache location
|
|
203
|
+
ls -la "$HOME/.rapidkit/cache/"
|
|
204
|
+
|
|
205
|
+
# Clear cache manually
|
|
206
|
+
rm -rf "$HOME/.rapidkit/cache/"
|
|
207
|
+
|
|
208
|
+
# Check safe permissions (least privilege)
|
|
209
|
+
chmod 700 "$HOME/.rapidkit"
|
|
210
|
+
chmod 700 "$HOME/.rapidkit/cache"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Incorrect performance metrics
|
|
214
|
+
```bash
|
|
215
|
+
# Make sure you're in debug mode
|
|
216
|
+
export DEBUG=rapidkit:perf
|
|
217
|
+
npm run dev
|
|
218
|
+
|
|
219
|
+
# Check memory usage
|
|
220
|
+
node --expose-gc --max-old-space-size=4096 dist/index.js
|
|
221
|
+
```
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# RapidKit Workspace Marker Specification
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `.rapidkit-workspace` file is the standardized marker that identifies a RapidKit workspace. It uses a **metadata layer architecture** that allows multiple tools (npm CLI, VS Code Extension, Python Core, etc.) to add their own metadata while preserving a consistent core structure.
|
|
6
|
+
|
|
7
|
+
## File Structure
|
|
8
|
+
|
|
9
|
+
### Core Fields (Required)
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"signature": "RAPIDKIT_WORKSPACE",
|
|
14
|
+
"createdBy": "rapidkit-npm",
|
|
15
|
+
"version": "0.15.1",
|
|
16
|
+
"createdAt": "2026-02-01T12:23:31.993Z",
|
|
17
|
+
"name": "workspace-name",
|
|
18
|
+
"metadata": { ... }
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Field | Type | Description |
|
|
23
|
+
|-------|------|-------------|
|
|
24
|
+
| `signature` | `"RAPIDKIT_WORKSPACE"` | Fixed identifier for workspace detection |
|
|
25
|
+
| `createdBy` | `"rapidkit-npm" \| "rapidkit-vscode" \| "rapidkit-cli"` | Tool that originally created the workspace |
|
|
26
|
+
| `version` | `string` | Version of the tool that created the workspace |
|
|
27
|
+
| `createdAt` | `string` | ISO 8601 timestamp of workspace creation |
|
|
28
|
+
| `name` | `string` | Workspace name |
|
|
29
|
+
| `metadata` | `object` | Optional metadata layer (see below) |
|
|
30
|
+
|
|
31
|
+
### Metadata Layer (Optional)
|
|
32
|
+
|
|
33
|
+
The metadata layer allows each tool to store its own information without conflicts:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"metadata": {
|
|
38
|
+
"vscode": {
|
|
39
|
+
"extensionVersion": "0.5.0",
|
|
40
|
+
"createdViaExtension": true,
|
|
41
|
+
"lastOpenedAt": "2026-02-01T14:30:00.000Z",
|
|
42
|
+
"openCount": 5
|
|
43
|
+
},
|
|
44
|
+
"npm": {
|
|
45
|
+
"packageVersion": "0.15.1",
|
|
46
|
+
"installMethod": "poetry",
|
|
47
|
+
"lastUsedAt": "2026-02-01T12:23:31.993Z"
|
|
48
|
+
},
|
|
49
|
+
"python": {
|
|
50
|
+
"coreVersion": "0.2.1",
|
|
51
|
+
"pythonVersion": "3.10",
|
|
52
|
+
"venvPath": ".venv"
|
|
53
|
+
},
|
|
54
|
+
"custom": {
|
|
55
|
+
"myTool": "data"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### VS Code Metadata
|
|
62
|
+
|
|
63
|
+
| Field | Type | Description |
|
|
64
|
+
|-------|------|-------------|
|
|
65
|
+
| `extensionVersion` | `string` | Extension version that last interacted |
|
|
66
|
+
| `createdViaExtension` | `boolean` | Was workspace created via Extension? |
|
|
67
|
+
| `lastOpenedAt` | `string` | ISO 8601 timestamp of last open |
|
|
68
|
+
| `openCount` | `number` | Number of times opened in VS Code |
|
|
69
|
+
|
|
70
|
+
#### npm CLI Metadata
|
|
71
|
+
|
|
72
|
+
| Field | Type | Description |
|
|
73
|
+
|-------|------|-------------|
|
|
74
|
+
| `packageVersion` | `string` | npm package version |
|
|
75
|
+
| `installMethod` | `"poetry" \| "venv" \| "pipx"` | Install method used |
|
|
76
|
+
| `lastUsedAt` | `string` | ISO 8601 timestamp of last use |
|
|
77
|
+
|
|
78
|
+
#### Python Core Metadata
|
|
79
|
+
|
|
80
|
+
| Field | Type | Description |
|
|
81
|
+
|-------|------|-------------|
|
|
82
|
+
| `coreVersion` | `string` | RapidKit Core version |
|
|
83
|
+
| `pythonVersion` | `string` | Python version used |
|
|
84
|
+
| `venvPath` | `string` | Virtual environment path (relative) |
|
|
85
|
+
|
|
86
|
+
## Usage Guidelines
|
|
87
|
+
|
|
88
|
+
### Creating a Workspace Marker
|
|
89
|
+
|
|
90
|
+
**npm package:**
|
|
91
|
+
```typescript
|
|
92
|
+
import { createNpmWorkspaceMarker, writeWorkspaceMarker } from './workspace-marker';
|
|
93
|
+
|
|
94
|
+
const marker = createNpmWorkspaceMarker('my-workspace', '0.15.1', 'poetry');
|
|
95
|
+
await writeWorkspaceMarker('/path/to/workspace', marker);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**VS Code Extension:**
|
|
99
|
+
```typescript
|
|
100
|
+
// Let npm create the marker, then add VS Code metadata
|
|
101
|
+
await updateWorkspaceMetadata(workspacePath, {
|
|
102
|
+
vscode: {
|
|
103
|
+
extensionVersion: '0.5.0',
|
|
104
|
+
createdViaExtension: true,
|
|
105
|
+
lastOpenedAt: new Date().toISOString(),
|
|
106
|
+
openCount: 1,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Reading Workspace Metadata
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { readWorkspaceMarker } from './workspace-marker';
|
|
115
|
+
|
|
116
|
+
const marker = await readWorkspaceMarker('/path/to/workspace');
|
|
117
|
+
|
|
118
|
+
if (marker) {
|
|
119
|
+
console.log('Workspace:', marker.name);
|
|
120
|
+
console.log('Created by:', marker.createdBy);
|
|
121
|
+
|
|
122
|
+
if (marker.metadata?.vscode) {
|
|
123
|
+
console.log('Opened', marker.metadata.vscode.openCount, 'times in VS Code');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Updating Metadata
|
|
129
|
+
|
|
130
|
+
**Always use `updateWorkspaceMetadata()` to preserve existing metadata:**
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// ✅ Correct - preserves other metadata
|
|
134
|
+
await updateWorkspaceMetadata(workspacePath, {
|
|
135
|
+
vscode: {
|
|
136
|
+
extensionVersion: '0.5.0',
|
|
137
|
+
lastOpenedAt: new Date().toISOString(),
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// ❌ Wrong - overwrites entire marker
|
|
142
|
+
await writeWorkspaceMarker(workspacePath, newMarker);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Benefits
|
|
146
|
+
|
|
147
|
+
### 1. **Cross-Tool Compatibility**
|
|
148
|
+
- npm, Extension, and future tools share the same format
|
|
149
|
+
- No conflicts between different tools
|
|
150
|
+
|
|
151
|
+
### 2. **Traceability**
|
|
152
|
+
- Know which tool created the workspace
|
|
153
|
+
- Track usage across different interfaces
|
|
154
|
+
- Debug issues by checking tool versions
|
|
155
|
+
|
|
156
|
+
### 3. **Extensibility**
|
|
157
|
+
- New tools can add their own metadata
|
|
158
|
+
- No breaking changes to core structure
|
|
159
|
+
- Custom metadata for user tools
|
|
160
|
+
|
|
161
|
+
### 4. **Backwards Compatibility**
|
|
162
|
+
- Old markers without metadata still work
|
|
163
|
+
- Metadata is optional
|
|
164
|
+
- Validation checks only core fields
|
|
165
|
+
|
|
166
|
+
## Migration Guide
|
|
167
|
+
|
|
168
|
+
### From Legacy Markers
|
|
169
|
+
|
|
170
|
+
Old format (Extension-specific):
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"signature": "RAPIDKIT_WORKSPACE",
|
|
174
|
+
"createdBy": "rapidkit-vscode",
|
|
175
|
+
"version": "0.15.1",
|
|
176
|
+
"createdAt": "2026-02-01T12:24:21.830Z",
|
|
177
|
+
"name": "alef",
|
|
178
|
+
"vscodeVersion": "0.5.0",
|
|
179
|
+
"originalCreatedBy": "rapidkit-npm"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
New format (standardized):
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"signature": "RAPIDKIT_WORKSPACE",
|
|
187
|
+
"createdBy": "rapidkit-npm",
|
|
188
|
+
"version": "0.15.1",
|
|
189
|
+
"createdAt": "2026-02-01T12:24:21.830Z",
|
|
190
|
+
"name": "alef",
|
|
191
|
+
"metadata": {
|
|
192
|
+
"vscode": {
|
|
193
|
+
"extensionVersion": "0.5.0",
|
|
194
|
+
"createdViaExtension": true,
|
|
195
|
+
"lastOpenedAt": "2026-02-01T12:24:21.830Z",
|
|
196
|
+
"openCount": 1
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Best Practices
|
|
203
|
+
|
|
204
|
+
1. **npm creates the marker** - Only npm package should create the core marker
|
|
205
|
+
2. **Tools add metadata** - Other tools use `updateWorkspaceMetadata()`
|
|
206
|
+
3. **Preserve existing data** - Always merge, never overwrite
|
|
207
|
+
4. **Validate on read** - Use `isValidWorkspaceMarker()` to check structure
|
|
208
|
+
5. **Handle missing metadata gracefully** - Metadata is always optional
|
|
209
|
+
|
|
210
|
+
## Example Workflows
|
|
211
|
+
|
|
212
|
+
### Workflow 1: Create workspace with npm, open in VS Code
|
|
213
|
+
```
|
|
214
|
+
1. User: npx rapidkit my-workspace
|
|
215
|
+
2. npm: Creates marker with npm metadata
|
|
216
|
+
3. User: Opens workspace in VS Code
|
|
217
|
+
4. Extension: Adds VS Code metadata to existing marker
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Result:
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"signature": "RAPIDKIT_WORKSPACE",
|
|
224
|
+
"createdBy": "rapidkit-npm",
|
|
225
|
+
"version": "0.15.1",
|
|
226
|
+
"createdAt": "2026-02-01T10:00:00.000Z",
|
|
227
|
+
"name": "my-workspace",
|
|
228
|
+
"metadata": {
|
|
229
|
+
"npm": {
|
|
230
|
+
"packageVersion": "0.15.1",
|
|
231
|
+
"installMethod": "poetry"
|
|
232
|
+
},
|
|
233
|
+
"vscode": {
|
|
234
|
+
"extensionVersion": "0.5.0",
|
|
235
|
+
"createdViaExtension": false,
|
|
236
|
+
"lastOpenedAt": "2026-02-01T11:00:00.000Z",
|
|
237
|
+
"openCount": 1
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Workflow 2: Create workspace via Extension
|
|
244
|
+
```
|
|
245
|
+
1. User: Creates workspace via Extension
|
|
246
|
+
2. Extension: Calls npm package to create marker
|
|
247
|
+
3. npm: Creates marker with npm metadata
|
|
248
|
+
4. Extension: Adds VS Code metadata
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Result:
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"signature": "RAPIDKIT_WORKSPACE",
|
|
255
|
+
"createdBy": "rapidkit-npm",
|
|
256
|
+
"version": "0.15.1",
|
|
257
|
+
"createdAt": "2026-02-01T10:00:00.000Z",
|
|
258
|
+
"name": "my-workspace",
|
|
259
|
+
"metadata": {
|
|
260
|
+
"npm": {
|
|
261
|
+
"packageVersion": "0.15.1",
|
|
262
|
+
"installMethod": "poetry"
|
|
263
|
+
},
|
|
264
|
+
"vscode": {
|
|
265
|
+
"extensionVersion": "0.5.0",
|
|
266
|
+
"createdViaExtension": true,
|
|
267
|
+
"lastOpenedAt": "2026-02-01T10:00:00.000Z",
|
|
268
|
+
"openCount": 1
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Version History
|
|
275
|
+
|
|
276
|
+
- **v1.0** (2026-02-01): Initial specification with metadata layer architecture
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# CI Workflows
|
|
2
|
+
|
|
3
|
+
Map of GitHub Actions workflows in this repository. Use this when editing CI to avoid overlapping coverage.
|
|
4
|
+
|
|
5
|
+
## Workflows
|
|
6
|
+
|
|
7
|
+
| Workflow | Path | Purpose |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Build / test matrix | `.github/workflows/ci.yml` | Build, lint, typecheck, tests, coverage, contract gates |
|
|
10
|
+
| Workspace E2E matrix | `.github/workflows/workspace-e2e-matrix.yml` | Cross-OS workspace lifecycle smoke; setup `--warm-deps`; cache/mirror ops |
|
|
11
|
+
| Windows bridge E2E | `.github/workflows/windows-bridge-e2e.yml` | Native Windows bridge and lifecycle checks |
|
|
12
|
+
| E2E smoke | `.github/workflows/e2e-smoke.yml` | Focused bridge regression smoke |
|
|
13
|
+
| Frontend generator smoke | `.github/workflows/frontend-generator-smoke.yml` | Official frontend generator drift gate |
|
|
14
|
+
| Security | `.github/workflows/security.yml` | Security scanning and policy checks |
|
|
15
|
+
|
|
16
|
+
## Consumer workspace: agent grounding CI
|
|
17
|
+
|
|
18
|
+
For RapidKit **consumer workspaces** (not this CLI repo), use the copy-paste template:
|
|
19
|
+
|
|
20
|
+
- [examples/ci-agent-grounding.yml](./examples/ci-agent-grounding.yml)
|
|
21
|
+
|
|
22
|
+
Minimal job:
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
- run: npx rapidkit pipeline --json --strict
|
|
26
|
+
- run: npx rapidkit workspace agent-sync --write --refresh-context --strict --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`pipeline` writes governance evidence and **auto-syncs** agent hooks (`AGENTS.md`, Copilot, Cursor, Claude) unless `RAPIDKIT_NO_AGENT_SYNC=1` or `--no-agent-sync`.
|
|
30
|
+
|
|
31
|
+
## Local validation scripts
|
|
32
|
+
|
|
33
|
+
| Script | Command |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| Runtime acceptance (default) | `npm run test:runtime-matrix` |
|
|
36
|
+
| Runtime acceptance (full) | `npm run test:runtime-matrix:full` |
|
|
37
|
+
| Frontend generators (dry-run) | `npm run smoke:frontend-generators` |
|
|
38
|
+
| Frontend generators (network) | `npm run smoke:frontend-generators:network` |
|
|
39
|
+
| Docs drift guard | `npm run check:docs-drift` |
|
|
40
|
+
| README command smoke | `npm run smoke:readme` |
|
|
41
|
+
|
|
42
|
+
## Recommended pre-release checks
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run validate
|
|
46
|
+
npm run validate:docs
|
|
47
|
+
npm run security
|
|
48
|
+
npm run security
|
|
49
|
+
npm run test:runtime-matrix:full
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## See also
|
|
53
|
+
|
|
54
|
+
- [SETUP.md](./SETUP.md)
|
|
55
|
+
- [DEVELOPMENT.md](./DEVELOPMENT.md)
|
|
56
|
+
- [Documentation index](./README.md)
|