@specdest/devkit 0.4.4 → 0.4.6
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 +1 -1
- package/package.json +1 -1
- package/src/canonical-project-operations.js +15 -25
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ npx @specdest/devkit fuzz
|
|
|
24
24
|
- `doctor` reports project-stack/cache setup problems.
|
|
25
25
|
- `fuzz` dynamically exercises Zod boundary contracts with `fast-check` plus Specdest semantic amplifiers for nullish, blank-string, numeric/boolean, and array edge cases. It is separate from static `check` and from Stryker mutation testing.
|
|
26
26
|
|
|
27
|
-
The CLI
|
|
27
|
+
The CLI resolves a project stack from supported Expo/Vite + Convex/Supabase package dependencies when possible; otherwise it uses the single committed requested `stack-*` root in `.specdest/installed.json`. Optional `.specdest/rules.json` adds the project type/capabilities plus explicit rule includes/exclusions; every exclusion requires a reason. `.specdest/installed.json` and `.specdest/state.json` remain the committed project status used by the Base rules matrix.
|
|
28
28
|
|
|
29
29
|
See [`docs/operations.md`](docs/operations.md) for cache, dashboard, CI, and release behavior.
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -74,9 +74,17 @@ async function cachedManifest(source, entry, canonicalCheckRoot, checkerRuntimeR
|
|
|
74
74
|
return await prepareCachedManifest(entry, root, canonicalCheckRoot, checkerRuntimeRoot);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
async function resolveCanonicalStack(projectRoot) {
|
|
78
|
+
const detectedStack = await detectProjectStack(projectRoot);
|
|
79
|
+
if (detectedStack) return detectedStack;
|
|
80
|
+
const installedState = await readInstalledState(projectRoot);
|
|
81
|
+
const requestedStacks = (installedState.requested ?? []).filter((id) => id.startsWith('stack-'));
|
|
82
|
+
return requestedStacks.length === 1 ? requestedStacks[0] : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
async function canonicalContext(projectRoot, source, options = {}) {
|
|
78
86
|
const catalog = await source.catalog({ refresh: options.refresh ?? false });
|
|
79
|
-
const stack = await
|
|
87
|
+
const stack = await resolveCanonicalStack(projectRoot);
|
|
80
88
|
const profile = await readRuleProfile(projectRoot);
|
|
81
89
|
assertKnownRuleOverrides(catalog.entries ?? [], profile);
|
|
82
90
|
const projectType = resolveProjectType(stack, profile);
|
|
@@ -130,7 +138,7 @@ async function refreshInstalledRevision(projectRoot, id, revision) {
|
|
|
130
138
|
await writeInstalledState(projectRoot, state);
|
|
131
139
|
}
|
|
132
140
|
|
|
133
|
-
async function cleanupCanonicalInstallState(projectRoot, catalogEntries) {
|
|
141
|
+
async function cleanupCanonicalInstallState(projectRoot, catalogEntries, applicableIds) {
|
|
134
142
|
const installedState = await readInstalledState(projectRoot);
|
|
135
143
|
const catalogRules = new Set(
|
|
136
144
|
(catalogEntries ?? []).filter((entry) => entry.kind === 'rule').map((entry) => entry.id),
|
|
@@ -140,7 +148,8 @@ async function cleanupCanonicalInstallState(projectRoot, catalogEntries) {
|
|
|
140
148
|
);
|
|
141
149
|
const removed = [];
|
|
142
150
|
for (const id of Object.keys(installedState.installed)) {
|
|
143
|
-
if (
|
|
151
|
+
if (requestedStacks.has(id)) continue;
|
|
152
|
+
if (catalogRules.has(id) && applicableIds.has(id)) continue;
|
|
144
153
|
delete installedState.installed[id];
|
|
145
154
|
removed.push(id);
|
|
146
155
|
}
|
|
@@ -212,19 +221,7 @@ export async function canonicalSync(projectRoot, source) {
|
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
223
|
const applicableIds = new Set(applicable.map((entry) => entry.id));
|
|
215
|
-
const
|
|
216
|
-
(catalog.entries ?? []).filter((entry) => entry.kind === 'rule').map((entry) => [entry.id, entry]),
|
|
217
|
-
);
|
|
218
|
-
for (const id of Object.keys(current.installed).filter((installedId) => !applicableIds.has(installedId))) {
|
|
219
|
-
const entry = catalogRules.get(id);
|
|
220
|
-
if (!entry) continue;
|
|
221
|
-
const prepared = await cachedManifest(source, entry, canonicalCheckRoot, checkerRuntimeRoot);
|
|
222
|
-
for (const copy of prepared.manifest.copies ?? []) {
|
|
223
|
-
const target = String(copy.target ?? copy.path ?? '');
|
|
224
|
-
if (target.startsWith('.agents/skills/')) allowedSkillFiles.add(target);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
const removed = await cleanupCanonicalInstallState(projectRoot, catalog.entries ?? []);
|
|
224
|
+
const removed = await cleanupCanonicalInstallState(projectRoot, catalog.entries ?? [], applicableIds);
|
|
228
225
|
await cleanupCanonicalSkillTree(projectRoot, allowedSkillFiles);
|
|
229
226
|
return { stack, projectType, applicable: applicable.length, changed, removed };
|
|
230
227
|
}
|
|
@@ -237,13 +234,6 @@ export async function canonicalCheck(projectRoot, source, options = {}) {
|
|
|
237
234
|
refresh: options.refresh ?? false,
|
|
238
235
|
});
|
|
239
236
|
const byId = new Map(applicable.map((entry) => [entry.id, entry]));
|
|
240
|
-
const catalogRules = new Map(
|
|
241
|
-
(catalog.entries ?? []).filter((entry) => entry.kind === 'rule').map((entry) => [entry.id, entry]),
|
|
242
|
-
);
|
|
243
|
-
for (const id of Object.keys(current.installed)) {
|
|
244
|
-
const entry = catalogRules.get(id);
|
|
245
|
-
if (entry && !byId.has(id)) byId.set(id, entry);
|
|
246
|
-
}
|
|
247
237
|
const results = {};
|
|
248
238
|
const groups = new Map();
|
|
249
239
|
const executor = options.executor ?? execute;
|
|
@@ -388,8 +378,8 @@ export async function canonicalRules(projectRoot, source, options = {}) {
|
|
|
388
378
|
|
|
389
379
|
export async function canonicalDoctor(projectRoot, source) {
|
|
390
380
|
const issues = [];
|
|
391
|
-
const stack = await
|
|
392
|
-
if (!stack) issues.push('Unable to
|
|
381
|
+
const stack = await resolveCanonicalStack(projectRoot);
|
|
382
|
+
if (!stack) issues.push('Unable to resolve a supported project stack.');
|
|
393
383
|
try { await source.catalog(); } catch (error) { issues.push(`Catalog unavailable: ${error.message}`); }
|
|
394
384
|
return { ok: issues.length === 0, stack, cacheRoot: source.cacheRoot, issues };
|
|
395
385
|
}
|