@specdest/devkit 0.2.1 → 0.2.2

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/catalog/README.md CHANGED
@@ -6,6 +6,6 @@ Canonical machine-readable rule/module definitions shipped with `@specdest/devki
6
6
  - `modules/<id>/manifest.json` declares reusable infrastructure modules.
7
7
  - `source` fields are package-relative catalog files hydrated into artifact `content` before install/sync.
8
8
  - Rule skills install under `.agents/skills/<rule-id>/` and add only their owned `AGENTS.md` section.
9
- - `checker-runtime` owns shared checker helpers and the `.specdest/checks.json` gitignore entry.
9
+ - `checker-runtime` owns shared checker helpers. `.specdest/checks.json` is committed project state and must not be ignored.
10
10
 
11
11
  Stack-specific differences are not expressed through inheritance here; explicit stack modules are added separately.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "checker-runtime",
3
3
  "kind": "module",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "artifacts": [
6
6
  {
7
7
  "kind": "managed-file",
@@ -17,12 +17,13 @@
17
17
  "kind": "managed-file",
18
18
  "path": ".agents/skills/shared/config.ts",
19
19
  "source": "config.ts"
20
- },
20
+ }
21
+ ],
22
+ "obsolete": [
21
23
  {
22
24
  "kind": "shared-line",
23
25
  "path": ".gitignore",
24
26
  "line": ".specdest/checks.json"
25
27
  }
26
- ],
27
- "obsolete": []
28
+ ]
28
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specdest/devkit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "specdest": "src/cli.js"
@@ -65,7 +65,6 @@ export async function runInstalledChecks(projectRoot, options = {}) {
65
65
  const current = await readInstalledState(projectRoot);
66
66
  const entries = await resolveCatalogSelection(Object.keys(current.installed), options);
67
67
  const executor = options.executor ?? defaultExecutor;
68
- const now = options.now ?? (() => new Date());
69
68
  const results = {};
70
69
  let exitCode = 0;
71
70
 
@@ -83,9 +82,11 @@ export async function runInstalledChecks(projectRoot, options = {}) {
83
82
  };
84
83
  }
85
84
 
86
- const checkedAt = now().toISOString();
87
- await writeChecksState(projectRoot, { schemaVersion: 1, checkedAt, results });
88
- return { exitCode, checkedAt, results };
85
+ const persistedResults = Object.fromEntries(
86
+ Object.entries(results).map(([id, result]) => [id, { status: result.status }]),
87
+ );
88
+ await writeChecksState(projectRoot, { schemaVersion: 2, results: persistedResults });
89
+ return { exitCode, results };
89
90
  }
90
91
 
91
92
  export function createProjectCommandHandlers(projectRoot = process.cwd()) {
package/src/sync-core.js CHANGED
@@ -11,12 +11,12 @@ import {
11
11
  } from './shared-file.js';
12
12
 
13
13
  export const STATE_SCHEMA_VERSION = 2;
14
- export const CHECKS_SCHEMA_VERSION = 1;
14
+ export const CHECKS_SCHEMA_VERSION = 2;
15
15
  export const INSTALLED_RELATIVE_PATH = '.specdest/installed.json';
16
16
  export const CHECKS_RELATIVE_PATH = '.specdest/checks.json';
17
17
 
18
18
  const EMPTY_INSTALLED = Object.freeze({ schemaVersion: 2, requested: [], installed: {} });
19
- const EMPTY_CHECKS = Object.freeze({ schemaVersion: CHECKS_SCHEMA_VERSION, checkedAt: null, results: {} });
19
+ const EMPTY_CHECKS = Object.freeze({ schemaVersion: CHECKS_SCHEMA_VERSION, results: {} });
20
20
 
21
21
  function clone(value) {
22
22
  return JSON.parse(JSON.stringify(value));
@@ -51,10 +51,12 @@ function validateInstalledState(state) {
51
51
  }
52
52
 
53
53
  function validateChecksState(state) {
54
- if (state?.schemaVersion !== CHECKS_SCHEMA_VERSION || !state.results || Array.isArray(state.results) || typeof state.results !== 'object') {
54
+ const legacy = state?.schemaVersion === 1;
55
+ const current = state?.schemaVersion === CHECKS_SCHEMA_VERSION;
56
+ if ((!legacy && !current) || !state.results || Array.isArray(state.results) || typeof state.results !== 'object') {
55
57
  throw new Error('Invalid .specdest/checks.json state');
56
58
  }
57
- if (state.checkedAt !== null && typeof state.checkedAt !== 'string') {
59
+ if (legacy && state.checkedAt !== null && typeof state.checkedAt !== 'string') {
58
60
  throw new Error('Invalid .specdest/checks.json checkedAt');
59
61
  }
60
62
  return state;
@@ -90,6 +92,7 @@ export async function readChecksState(projectRoot) {
90
92
 
91
93
  export async function writeChecksState(projectRoot, state) {
92
94
  validateChecksState(state);
95
+ if (state.schemaVersion !== CHECKS_SCHEMA_VERSION) throw new Error('Cannot write legacy .specdest/checks.json state');
93
96
  await writeJsonAtomic(join(projectRoot, CHECKS_RELATIVE_PATH), state);
94
97
  }
95
98