@ai-atomic-framework/cli 0.1.0-beta.2 → 0.1.0-beta.3

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.
@@ -4,9 +4,21 @@ import { createRequire } from 'node:module';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { atomicSpecSemanticFingerprintAtom, runAtm } from '../registry/atom-runtime.js';
6
6
  import { normalizeSemanticFingerprint } from '../registry/semantic-fingerprint.js';
7
- const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../');
8
7
  const require = createRequire(import.meta.url);
9
- export const defaultAtomicSpecSchemaPath = path.join(repoRoot, 'schemas', 'atomic-spec.schema.json');
8
+ export function resolveAtomicSpecSchemaPath(startDirectory = path.dirname(fileURLToPath(import.meta.url))) {
9
+ const fallbackPath = path.resolve(startDirectory, '../../../../schemas/atomic-spec.schema.json');
10
+ let current = path.resolve(startDirectory);
11
+ while (true) {
12
+ const candidate = path.join(current, 'schemas', 'atomic-spec.schema.json');
13
+ if (existsSync(candidate))
14
+ return candidate;
15
+ const parent = path.dirname(current);
16
+ if (parent === current)
17
+ return fallbackPath;
18
+ current = parent;
19
+ }
20
+ }
21
+ export const defaultAtomicSpecSchemaPath = resolveAtomicSpecSchemaPath();
10
22
  function asRecord(value) {
11
23
  return value && typeof value === 'object' && !Array.isArray(value)
12
24
  ? value
@@ -149,6 +149,7 @@ export function inspectRunnerPublicationDisposition(cwd, receiptRef) {
149
149
  const dirtyPaths = readDirtyPaths(cwd);
150
150
  const receipts = readRunnerReceipts(cwd);
151
151
  const requested = receiptRef ? normalizeReceiptRef(receiptRef) : null;
152
+ const publishedSealedSourceSha = readPublishedRunnerSealedSourceSha(cwd);
152
153
  // A release transition is explicitly receipt-addressed. Do not silently
153
154
  // fall back to directory discovery when its caller supplied one: test,
154
155
  // recovery, and alternate evidence roots are all legitimate as long as the
@@ -157,9 +158,15 @@ export function inspectRunnerPublicationDisposition(cwd, receiptRef) {
157
158
  const selected = (requested
158
159
  ? readRunnerReceiptAtPath(cwd, requested)
159
160
  : null) ?? receipts.find((candidate) => {
161
+ // A historical receipt can name the same generated output as the current
162
+ // runner. Once the release manifest binds that runner to a sealed source,
163
+ // path overlap alone is not authority to select older evidence.
164
+ if (publishedSealedSourceSha !== null && candidate.inventory.sealedSourceSha !== publishedSealedSourceSha) {
165
+ return false;
166
+ }
160
167
  const members = new Set(candidate.inventory.entries.map((entry) => entry.path));
161
168
  return dirtyPaths.some((entry) => members.has(entry));
162
- }) ?? receipts[0] ?? null;
169
+ }) ?? null;
163
170
  const inventory = selected?.inventory ?? deriveRunnerBuildOutputInventory({
164
171
  sealedSourceSha: readHeadSha(cwd),
165
172
  observedPaths: []
@@ -293,6 +300,21 @@ function readHeadSha(cwd) {
293
300
  const result = spawnSync('git', ['rev-parse', '--verify', 'HEAD'], { cwd, encoding: 'utf8' });
294
301
  return (result.status ?? 1) === 0 ? String(result.stdout ?? '').trim() : 'unknown';
295
302
  }
303
+ function readPublishedRunnerSealedSourceSha(cwd) {
304
+ const manifestPath = path.join(cwd, 'release', 'atm-onefile', 'release-manifest.json');
305
+ if (!existsSync(manifestPath))
306
+ return null;
307
+ try {
308
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
309
+ const sealedSourceCommit = typeof manifest.sealedSourceCommit === 'string'
310
+ ? manifest.sealedSourceCommit.trim().toLowerCase()
311
+ : '';
312
+ return /^[a-f0-9]{40,64}$/.test(sealedSourceCommit) ? sealedSourceCommit : null;
313
+ }
314
+ catch {
315
+ return null;
316
+ }
317
+ }
296
318
  function readRunnerReceipts(cwd) {
297
319
  const evidenceRoot = path.join(cwd, '.atm', 'history', 'evidence');
298
320
  if (!existsSync(evidenceRoot))
@@ -8,6 +8,7 @@ import { resolvePlanningPathFromStored } from '../planning-repo-root.js';
8
8
  import { quoteCliValue } from '../shared.js';
9
9
  import { evaluateTaskWorkAdmissionGate } from '../git-governance/work-admission-check.js';
10
10
  import { inspectCloseWindowStagedIndexAdmission } from '../tasks/close-window-lock.js';
11
+ import { evaluateAcceptanceEvidenceClosureGate } from '../tasks/close-orchestrator/acceptance-evidence-gate.js';
11
12
  // TASK-SKL-0029 — write-readiness lifecycle adapter.
12
13
  //
13
14
  // Write-readiness must not recompute a task's required-case set or freshness; it
@@ -104,6 +105,19 @@ function resolvePlanningPath(cwd, planningMirrorPath) {
104
105
  }
105
106
  export function buildTaskflowCloseWriteReadinessHint(input) {
106
107
  const blockers = [];
108
+ // `tasks close` builds a closure packet through this same gate. Evaluate it
109
+ // before advertising taskflow close as ready, so dry-run cannot be greener
110
+ // than the eventual write path.
111
+ const acceptanceEvidenceGate = evaluateAcceptanceEvidenceClosureGate({
112
+ taskDocument: input.taskDocument
113
+ });
114
+ for (const blocker of acceptanceEvidenceGate.blockers) {
115
+ blockers.push({
116
+ code: blocker.code,
117
+ summary: `Taskflow close requires closure-critical acceptance evidence for ${blocker.predicateId}: ${blocker.reasons.join(', ')}.`,
118
+ requiredCommand: null
119
+ });
120
+ }
107
121
  const brokerConflictGate = evaluateTaskflowBrokerConflictGate({
108
122
  cwd: input.cwd,
109
123
  taskId: input.taskId,
@@ -165,18 +165,49 @@ function parseKnownBadRange(range) {
165
165
  });
166
166
  }
167
167
  function parseSemver(version) {
168
- const match = version.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$/);
168
+ const match = version.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);
169
169
  if (!match)
170
170
  return null;
171
- return [Number(match[1]), Number(match[2]), Number(match[3])];
171
+ return {
172
+ major: Number(match[1]),
173
+ minor: Number(match[2]),
174
+ patch: Number(match[3]),
175
+ prerelease: match[4] ? match[4].split('.') : null
176
+ };
172
177
  }
173
178
  function compareSemver(left, right) {
174
- for (let index = 0; index < 3; index += 1) {
175
- if (left[index] > right[index])
179
+ for (const field of ['major', 'minor', 'patch']) {
180
+ if (left[field] > right[field])
176
181
  return 1;
177
- if (left[index] < right[index])
182
+ if (left[field] < right[field])
178
183
  return -1;
179
184
  }
185
+ if (left.prerelease === null && right.prerelease === null)
186
+ return 0;
187
+ if (left.prerelease === null)
188
+ return 1;
189
+ if (right.prerelease === null)
190
+ return -1;
191
+ const length = Math.max(left.prerelease.length, right.prerelease.length);
192
+ for (let index = 0; index < length; index += 1) {
193
+ const leftIdentifier = left.prerelease[index];
194
+ const rightIdentifier = right.prerelease[index];
195
+ if (leftIdentifier === undefined)
196
+ return -1;
197
+ if (rightIdentifier === undefined)
198
+ return 1;
199
+ if (leftIdentifier === rightIdentifier)
200
+ continue;
201
+ const leftNumeric = /^\d+$/.test(leftIdentifier);
202
+ const rightNumeric = /^\d+$/.test(rightIdentifier);
203
+ if (leftNumeric && rightNumeric)
204
+ return Number(leftIdentifier) - Number(rightIdentifier);
205
+ if (leftNumeric)
206
+ return -1;
207
+ if (rightNumeric)
208
+ return 1;
209
+ return leftIdentifier < rightIdentifier ? -1 : 1;
210
+ }
180
211
  return 0;
181
212
  }
182
213
  function summarizeReason(reason) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-atomic-framework/cli",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "private": false,
5
5
  "description": "CLI entrypoint for AI-Atomic-Framework repository adoption and validation.",
6
6
  "license": "Apache-2.0",
@@ -1,30 +0,0 @@
1
- {
2
- "schemaVersion": "atm.compatibilityMatrix.v0.1",
3
- "lastUpdated": "2026-05-19",
4
- "releaseTrain": {
5
- "frameworkVersion": "0.1.0",
6
- "defaultChartVersion": "0.1.0",
7
- "defaultTemplateVersion": "0.1.0",
8
- "minimumSupportedChartVersion": "0.1.0",
9
- "minimumSupportedTemplateVersion": "0.1.0"
10
- },
11
- "atmChartVersions": [
12
- {
13
- "version": "0.1.0",
14
- "status": "supported",
15
- "sourceSchemaVersion": "atm.defaultGuards.v0.1",
16
- "minFrameworkVersion": "0.0.0",
17
- "maxFrameworkVersion": null,
18
- "migrationGuide": null
19
- }
20
- ],
21
- "agentTemplateVersions": [
22
- {
23
- "version": "0.1.0",
24
- "status": "supported",
25
- "minFrameworkVersion": "0.0.0",
26
- "maxFrameworkVersion": null,
27
- "migrationGuide": null
28
- }
29
- ]
30
- }
@@ -1,17 +0,0 @@
1
- {
2
- "schemaVersion": "atm.compatibilityMatrixLegacy.v0.1",
3
- "lastUpdated": "2026-05-18",
4
- "atmChartVersions": [
5
- {
6
- "version": "0.0.1",
7
- "status": "unsupported",
8
- "sourceSchemaVersion": "atm.defaultGuards.v0.1",
9
- "minFrameworkVersion": "0.0.0",
10
- "maxFrameworkVersion": null,
11
- "removedFromActiveSupportAt": "2026-05-18",
12
- "migrationGuide": "Run `node atm.mjs upgrade plan --allow-unknown-chart --json` only after reviewing the dry-run file list, then apply with an explicit backup/rollback path.",
13
- "reason": "Pre-M9 chart baseline retained for offline self-diagnosis only."
14
- }
15
- ],
16
- "agentTemplateVersions": []
17
- }
@@ -1,4 +0,0 @@
1
- {
2
- "schemaVersion": "atm.knownBadVersions.v0.1",
3
- "entries": []
4
- }
@@ -1,23 +0,0 @@
1
- {
2
- "schemaVersion": "atm.releaseIntegrity.v0.1",
3
- "version": "0.1.0",
4
- "buildAt": "2026-08-29T16:22:16.637Z",
5
- "artefacts": [
6
- {
7
- "path": "compatibility-matrix.json",
8
- "sha256": "sha256:293a51c3ac7d57b8fd77c79fe146a8d6bfe79ec54008536faec9c38b16453278"
9
- },
10
- {
11
- "path": "compatibility-matrix.legacy.json",
12
- "sha256": "sha256:09568d7d9388164931b04e360fe5f5a10541480efdb1a9148336bba7de7beacd"
13
- },
14
- {
15
- "path": "known-bad-versions.json",
16
- "sha256": "sha256:19d4f68750e2da2aa2dcd58899df3cccb952d24e33e04017e5d4cafbd74f1140"
17
- },
18
- {
19
- "path": "schemas/governance/default-guards.schema.json",
20
- "sha256": "sha256:8d3a6d2b99a51890653ab36669cb725dc4cec7c914abd4145794861a7841d888"
21
- }
22
- ]
23
- }
@@ -1,121 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.ai-atomic-framework.dev/governance/default-guards.schema.json",
4
- "title": "ATM Default Guards v0.1",
5
- "description": "Machine-readable starter guard set written into a host repository during ATM bootstrap.",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "required": [
9
- "schemaId",
10
- "specVersion",
11
- "schemaVersion",
12
- "migration",
13
- "generatedAt",
14
- "repositoryKind",
15
- "guards"
16
- ],
17
- "properties": {
18
- "schemaId": {
19
- "const": "atm.defaultGuards"
20
- },
21
- "specVersion": {
22
- "const": "0.1.0"
23
- },
24
- "schemaVersion": {
25
- "const": "atm.defaultGuards.v0.1"
26
- },
27
- "migration": {
28
- "$ref": "#/$defs/migration"
29
- },
30
- "generatedAt": {
31
- "type": "string",
32
- "format": "date-time"
33
- },
34
- "repositoryKind": {
35
- "type": "string",
36
- "minLength": 1
37
- },
38
- "versionContract": {
39
- "$ref": "#/$defs/versionContract"
40
- },
41
- "guards": {
42
- "type": "array",
43
- "minItems": 1,
44
- "items": {
45
- "$ref": "#/$defs/guard"
46
- }
47
- }
48
- },
49
- "$defs": {
50
- "migration": {
51
- "type": "object",
52
- "additionalProperties": false,
53
- "required": [
54
- "strategy",
55
- "fromVersion",
56
- "notes"
57
- ],
58
- "properties": {
59
- "strategy": {
60
- "enum": [
61
- "none",
62
- "additive",
63
- "breaking"
64
- ]
65
- },
66
- "fromVersion": {
67
- "type": [
68
- "string",
69
- "null"
70
- ],
71
- "pattern": "^\\d+\\.\\d+\\.\\d+$"
72
- },
73
- "notes": {
74
- "type": "string",
75
- "minLength": 1
76
- }
77
- }
78
- },
79
- "versionContract": {
80
- "type": "object",
81
- "additionalProperties": false,
82
- "required": [
83
- "atmChartVersion",
84
- "minFrameworkVersion",
85
- "templateVersion"
86
- ],
87
- "properties": {
88
- "atmChartVersion": {
89
- "type": "string",
90
- "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
91
- },
92
- "minFrameworkVersion": {
93
- "type": "string",
94
- "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
95
- },
96
- "templateVersion": {
97
- "type": "string",
98
- "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
99
- }
100
- }
101
- },
102
- "guard": {
103
- "type": "object",
104
- "additionalProperties": false,
105
- "required": [
106
- "id",
107
- "summary"
108
- ],
109
- "properties": {
110
- "id": {
111
- "type": "string",
112
- "pattern": "^[a-z][a-z0-9-]+$"
113
- },
114
- "summary": {
115
- "type": "string",
116
- "minLength": 1
117
- }
118
- }
119
- }
120
- }
121
- }