agentxchain 2.111.0 → 2.112.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.
@@ -122,6 +122,7 @@ import { eventsCommand } from '../src/commands/events.js';
122
122
  import { connectorCheckCommand } from '../src/commands/connector.js';
123
123
  import { scheduleDaemonCommand, scheduleListCommand, scheduleRunDueCommand, scheduleStatusCommand } from '../src/commands/schedule.js';
124
124
  import { chainLatestCommand, chainListCommand, chainShowCommand } from '../src/commands/chain.js';
125
+ import { missionAttachChainCommand, missionListCommand, missionShowCommand, missionStartCommand } from '../src/commands/mission.js';
125
126
 
126
127
  const __dirname = dirname(fileURLToPath(import.meta.url));
127
128
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
@@ -419,6 +420,43 @@ chainCmd
419
420
  .option('-d, --dir <path>', 'Project directory')
420
421
  .action(chainShowCommand);
421
422
 
423
+ const missionCmd = program
424
+ .command('mission')
425
+ .description('Group chained runs under a single-repo long-horizon mission');
426
+
427
+ missionCmd
428
+ .command('start')
429
+ .description('Create a durable mission artifact for a single repo')
430
+ .requiredOption('--title <text>', 'Mission title')
431
+ .requiredOption('--goal <text>', 'Mission goal')
432
+ .option('--id <mission_id>', 'Override the derived mission ID')
433
+ .option('-j, --json', 'Output as JSON')
434
+ .option('-d, --dir <path>', 'Project directory')
435
+ .action(missionStartCommand);
436
+
437
+ missionCmd
438
+ .command('list')
439
+ .description('List mission artifacts newest first')
440
+ .option('-l, --limit <n>', 'Max missions to show (default: 20)')
441
+ .option('-j, --json', 'Output as JSON')
442
+ .option('-d, --dir <path>', 'Project directory')
443
+ .action(missionListCommand);
444
+
445
+ missionCmd
446
+ .command('show [mission_id]')
447
+ .description('Show one mission, or the latest mission when no ID is provided')
448
+ .option('-j, --json', 'Output as JSON')
449
+ .option('-d, --dir <path>', 'Project directory')
450
+ .action(missionShowCommand);
451
+
452
+ missionCmd
453
+ .command('attach-chain [chain_id]')
454
+ .description('Attach a chain report to a mission (default: latest chain on latest mission)')
455
+ .option('-m, --mission <mission_id>', 'Explicit mission ID (defaults to latest mission)')
456
+ .option('-j, --json', 'Output as JSON')
457
+ .option('-d, --dir <path>', 'Project directory')
458
+ .action(missionAttachChainCommand);
459
+
422
460
  program
423
461
  .command('validate')
424
462
  .description('Validate project protocol artifacts')
@@ -547,6 +585,7 @@ program
547
585
  .option('--max-chains <n>', 'Maximum continuation runs in chain mode (default: 5)', parseInt)
548
586
  .option('--chain-on <statuses>', 'Comma-separated terminal statuses that trigger chaining (default: completed)')
549
587
  .option('--chain-cooldown <seconds>', 'Seconds to wait between chained runs (default: 5)', parseInt)
588
+ .option('--mission <mission_id>', 'Bind chained runs to a mission (use "latest" for most recent mission)')
550
589
  .action(runCommand);
551
590
 
552
591
  program
package/dashboard/app.js CHANGED
@@ -15,6 +15,7 @@ import { render as renderCrossRepo } from './components/cross-repo.js';
15
15
  import { render as renderDelegations } from './components/delegations.js';
16
16
  import { render as renderBlockers } from './components/blockers.js';
17
17
  import { render as renderArtifacts } from './components/artifacts.js';
18
+ import { render as renderMission } from './components/mission.js';
18
19
  import { render as renderChain } from './components/chain.js';
19
20
  import { render as renderRunHistory } from './components/run-history.js';
20
21
  import { render as renderTimeouts } from './components/timeouts.js';
@@ -36,6 +37,7 @@ const VIEWS = {
36
37
  'cross-repo': { fetch: ['coordinatorState', 'coordinatorHistory'], render: renderCrossRepo },
37
38
  blockers: { fetch: ['coordinatorBlockers'], render: renderBlockers },
38
39
  artifacts: { fetch: ['workflowKitArtifacts'], render: renderArtifacts },
40
+ mission: { fetch: ['missions'], render: renderMission },
39
41
  chain: { fetch: ['chainReports'], render: renderChain },
40
42
  'run-history': { fetch: ['runHistory'], render: renderRunHistory },
41
43
  timeouts: { fetch: ['timeouts'], render: renderTimeouts },
@@ -60,6 +62,7 @@ const API_MAP = {
60
62
  coordinatorBlockers: '/api/coordinator/blockers',
61
63
  coordinatorRepoStatusRows: '/api/coordinator/repo-status',
62
64
  workflowKitArtifacts: '/api/workflow-kit-artifacts',
65
+ missions: '/api/missions',
63
66
  chainReports: '/api/chain-reports',
64
67
  connectors: '/api/connectors',
65
68
  runHistory: '/api/run-history',
@@ -0,0 +1,177 @@
1
+ function esc(str) {
2
+ if (str == null) return '';
3
+ return String(str)
4
+ .replace(/&/g, '&amp;')
5
+ .replace(/</g, '&lt;')
6
+ .replace(/>/g, '&gt;')
7
+ .replace(/"/g, '&quot;')
8
+ .replace(/'/g, '&#39;');
9
+ }
10
+
11
+ function badge(label, color = 'var(--text-dim)') {
12
+ return `<span class="badge" style="color:${color};border-color:${color}">${esc(label)}</span>`;
13
+ }
14
+
15
+ function formatMissionStatus(status) {
16
+ switch (status) {
17
+ case 'progressing':
18
+ return badge('progressing', 'var(--green)');
19
+ case 'planned':
20
+ return badge('planned', '#38bdf8');
21
+ case 'needs_attention':
22
+ return badge('needs attention', 'var(--yellow)');
23
+ case 'degraded':
24
+ return badge('degraded', 'var(--red)');
25
+ default:
26
+ return badge(status || 'unknown', 'var(--text-dim)');
27
+ }
28
+ }
29
+
30
+ function formatTerminalReason(reason) {
31
+ switch (reason) {
32
+ case 'chain_limit_reached':
33
+ return badge('chain limit reached', '#38bdf8');
34
+ case 'non_chainable_status':
35
+ return badge('non-chainable status', 'var(--yellow)');
36
+ case 'operator_abort':
37
+ return badge('operator abort', 'var(--red)');
38
+ case 'parent_validation_failed':
39
+ return badge('parent validation failed', 'var(--red)');
40
+ case 'completed':
41
+ return badge('completed', 'var(--green)');
42
+ default:
43
+ return badge(reason || 'none', 'var(--text-dim)');
44
+ }
45
+ }
46
+
47
+ function formatDate(iso) {
48
+ if (!iso) return '—';
49
+ try {
50
+ const date = new Date(iso);
51
+ return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
52
+ + ' ' + date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
53
+ } catch {
54
+ return esc(iso);
55
+ }
56
+ }
57
+
58
+ function truncateId(value, len = 14) {
59
+ if (!value) return '—';
60
+ return value.length > len ? `${value.slice(0, len)}…` : value;
61
+ }
62
+
63
+ function renderAttachedChains(latest) {
64
+ if (!Array.isArray(latest?.chains) || latest.chains.length === 0) {
65
+ return `<div class="section"><h3>Attached Chains</h3><p class="section-subtitle">No chain reports are attached to this mission yet.</p></div>`;
66
+ }
67
+
68
+ let html = `<div class="section"><h3>Attached Chains</h3>
69
+ <table class="data-table">
70
+ <thead>
71
+ <tr>
72
+ <th>#</th>
73
+ <th>Chain ID</th>
74
+ <th>Runs</th>
75
+ <th>Turns</th>
76
+ <th>Terminal</th>
77
+ <th>Started</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>`;
81
+
82
+ latest.chains.forEach((chain, index) => {
83
+ html += `<tr>
84
+ <td style="color:var(--text-dim)">${index + 1}</td>
85
+ <td class="mono" title="${esc(chain.chain_id || '')}">${esc(truncateId(chain.chain_id))}</td>
86
+ <td>${chain.runs?.length || 0}</td>
87
+ <td>${chain.total_turns ?? '—'}</td>
88
+ <td>${formatTerminalReason(chain.terminal_reason)}</td>
89
+ <td>${formatDate(chain.started_at)}</td>
90
+ </tr>`;
91
+ });
92
+
93
+ html += '</tbody></table></div>';
94
+ return html;
95
+ }
96
+
97
+ function renderRecentMissions(missions) {
98
+ let html = `<div class="section"><h3>Recent Missions</h3>
99
+ <table class="data-table">
100
+ <thead>
101
+ <tr>
102
+ <th>#</th>
103
+ <th>Mission ID</th>
104
+ <th>Status</th>
105
+ <th>Chains</th>
106
+ <th>Runs</th>
107
+ <th>Turns</th>
108
+ <th>Repo Decisions</th>
109
+ <th>Latest Terminal</th>
110
+ <th>Updated</th>
111
+ <th>Title</th>
112
+ </tr>
113
+ </thead>
114
+ <tbody>`;
115
+
116
+ missions.forEach((mission, index) => {
117
+ html += `<tr>
118
+ <td style="color:var(--text-dim)">${index + 1}</td>
119
+ <td class="mono" title="${esc(mission.mission_id || '')}">${esc(truncateId(mission.mission_id, 18))}</td>
120
+ <td>${formatMissionStatus(mission.derived_status)}</td>
121
+ <td>${mission.chain_count ?? 0}</td>
122
+ <td>${mission.total_runs ?? 0}</td>
123
+ <td>${mission.total_turns ?? 0}</td>
124
+ <td>${mission.active_repo_decisions_count ?? 0}</td>
125
+ <td>${formatTerminalReason(mission.latest_terminal_reason)}</td>
126
+ <td>${formatDate(mission.updated_at || mission.created_at)}</td>
127
+ <td>${esc(mission.title || '—')}</td>
128
+ </tr>`;
129
+ });
130
+
131
+ html += '</tbody></table></div>';
132
+ return html;
133
+ }
134
+
135
+ export function render({ missions }) {
136
+ if (!missions || typeof missions !== 'object') {
137
+ return `<div class="placeholder"><h2>Mission</h2><p>No mission data available. Create a mission and bind a chain to populate this view.</p></div>`;
138
+ }
139
+
140
+ const missionList = Array.isArray(missions.missions) ? missions.missions : [];
141
+ const latest = missions.latest || missionList[0] || null;
142
+
143
+ if (!latest || missionList.length === 0) {
144
+ return `<div class="placeholder"><h2>Mission</h2><p>No missions found. Run <code>agentxchain mission start --title "..." --goal "..."</code> and then <code>agentxchain run --chain --mission latest</code> to track long-horizon work here.</p></div>`;
145
+ }
146
+
147
+ const missingChains = Array.isArray(latest.missing_chain_ids) ? latest.missing_chain_ids : [];
148
+
149
+ let html = `<div class="mission-view"><div class="run-header"><div class="run-meta">`;
150
+ html += `<span class="turn-count">latest mission ${esc(latest.mission_id || '—')}</span>`;
151
+ html += formatMissionStatus(latest.derived_status);
152
+ html += badge(`${latest.chain_count || 0} chains`, '#38bdf8');
153
+ html += badge(`${latest.total_turns || 0} turns`, 'var(--green)');
154
+ html += badge(`${latest.active_repo_decisions_count || 0} repo decisions`, 'var(--yellow)');
155
+ html += `</div></div>`;
156
+
157
+ html += `<div class="section"><h3>Latest Mission Summary</h3><dl class="detail-list">`;
158
+ html += `<dt>Title</dt><dd>${esc(latest.title || '—')}</dd>`;
159
+ html += `<dt>Goal</dt><dd>${esc(latest.goal || '—')}</dd>`;
160
+ html += `<dt>Updated</dt><dd>${esc(latest.updated_at || latest.created_at || '—')}</dd>`;
161
+ html += `<dt>Latest Chain</dt><dd class="mono">${esc(latest.latest_chain_id || '—')}</dd>`;
162
+ html += `<dt>Latest Terminal</dt><dd>${esc(latest.latest_terminal_reason || '—')}</dd>`;
163
+ html += `<dt>Total Runs</dt><dd>${latest.total_runs ?? 0}</dd>`;
164
+ html += `<dt>Attached Chains</dt><dd>${latest.attached_chain_count ?? 0}</dd>`;
165
+ html += `<dt>Missing Chains</dt><dd>${missingChains.length}</dd>`;
166
+ html += `<dt>Active Repo Decisions</dt><dd>${latest.active_repo_decisions_count ?? 0}</dd>`;
167
+ html += `</dl></div>`;
168
+
169
+ if (missingChains.length > 0) {
170
+ html += `<div class="section"><h3>Missing Chain References</h3><p class="section-subtitle">This mission is degraded until the missing chain reports are restored.</p><p class="mono">${esc(missingChains.join(', '))}</p></div>`;
171
+ }
172
+
173
+ html += renderAttachedChains(latest);
174
+ html += renderRecentMissions(missionList);
175
+ html += '</div>';
176
+ return html;
177
+ }
@@ -405,6 +405,7 @@
405
405
  <a href="#gate">Gates</a>
406
406
  <a href="#blockers">Blockers</a>
407
407
  <a href="#artifacts">Artifacts</a>
408
+ <a href="#mission">Mission</a>
408
409
  <a href="#chain">Chain</a>
409
410
  <a href="#run-history">Run History</a>
410
411
  <a href="#timeouts">Timeouts</a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentxchain",
3
- "version": "2.111.0",
3
+ "version": "2.112.0",
4
4
  "description": "CLI for AgentXchain — governed multi-agent software delivery",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,6 +27,7 @@
27
27
  "test:node": "node --test test/*.test.js",
28
28
  "preflight:release": "bash scripts/release-preflight.sh",
29
29
  "preflight:release:strict": "bash scripts/release-preflight.sh --strict",
30
+ "check:release-alignment": "node scripts/check-release-alignment.mjs",
30
31
  "postflight:release": "bash scripts/release-postflight.sh",
31
32
  "postflight:downstream": "bash scripts/release-downstream-truth.sh",
32
33
  "bump:release": "bash scripts/release-bump.sh",
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ import process from 'node:process';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import {
7
+ RELEASE_ALIGNMENT_SCOPES,
8
+ validateReleaseAlignment,
9
+ } from '../src/lib/release-alignment.js';
10
+
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
12
+ const REPO_ROOT = join(__dirname, '..', '..');
13
+
14
+ function usage() {
15
+ console.error('Usage: node cli/scripts/check-release-alignment.mjs [--target-version <semver>] [--scope prebump|current] [--json]');
16
+ }
17
+
18
+ let targetVersion = null;
19
+ let scope = RELEASE_ALIGNMENT_SCOPES.CURRENT;
20
+ let json = false;
21
+
22
+ for (let index = 2; index < process.argv.length; index += 1) {
23
+ const arg = process.argv[index];
24
+ if (arg === '--target-version') {
25
+ targetVersion = process.argv[index + 1] || null;
26
+ if (!targetVersion) {
27
+ console.error('Error: --target-version requires a semver argument');
28
+ usage();
29
+ process.exit(1);
30
+ }
31
+ index += 1;
32
+ continue;
33
+ }
34
+ if (arg === '--scope') {
35
+ scope = process.argv[index + 1] || '';
36
+ if (!Object.values(RELEASE_ALIGNMENT_SCOPES).includes(scope)) {
37
+ console.error(`Error: invalid --scope "${scope}"`);
38
+ usage();
39
+ process.exit(1);
40
+ }
41
+ index += 1;
42
+ continue;
43
+ }
44
+ if (arg === '--json') {
45
+ json = true;
46
+ continue;
47
+ }
48
+ console.error(`Error: unknown argument "${arg}"`);
49
+ usage();
50
+ process.exit(1);
51
+ }
52
+
53
+ const result = validateReleaseAlignment(REPO_ROOT, { targetVersion, scope });
54
+
55
+ if (json) {
56
+ console.log(JSON.stringify(result, null, 2));
57
+ } else if (result.ok) {
58
+ console.log(`Release alignment OK for ${result.targetVersion} (${result.scope}, ${result.checkedSurfaceCount} surfaces).`);
59
+ } else {
60
+ console.error(`Release alignment FAILED for ${result.targetVersion} (${result.scope}, ${result.errors.length} issue(s)).`);
61
+ for (const error of result.errors) {
62
+ console.error(`- [${error.surface_id}] ${error.message}`);
63
+ }
64
+ }
65
+
66
+ process.exit(result.ok ? 0 : 1);
@@ -143,74 +143,23 @@ if git rev-parse "v${TARGET_VERSION}" >/dev/null 2>&1; then
143
143
  fi
144
144
  echo " OK: tag v${TARGET_VERSION} does not exist"
145
145
 
146
- # 4. Pre-bump version-surface alignment guard
147
- # Ensures all governed version surfaces already reference the target version
146
+ # 4. Pre-bump release-alignment guard
147
+ # Ensures all manual target-version surfaces already reference the target version
148
148
  # BEFORE the bump commit is created. This catches stale drift that would
149
149
  # otherwise only be discovered after minting local release identities.
150
150
  #
151
151
  # NOTE: Homebrew mirror formula and README are NOT checked here. They are
152
- # auto-aligned in step 5 because the registry SHA256 is inherently a
153
- # post-publish artifact. See DEC-HOMEBREW-SHA-SPLIT-001.
154
- echo "[4/9] Verifying version-surface alignment for ${TARGET_VERSION}..."
155
- SURFACE_ERRORS=()
156
-
157
- # 4a. CHANGELOG top heading
158
- CHANGELOG_TOP=$(grep -m1 -E '^## [0-9]+\.[0-9]+\.[0-9]+$' "${REPO_ROOT}/cli/CHANGELOG.md" 2>/dev/null | sed 's/^## //' || true)
159
- if [[ "$CHANGELOG_TOP" != "$TARGET_VERSION" ]]; then
160
- SURFACE_ERRORS+=("CHANGELOG.md top heading is '${CHANGELOG_TOP:-missing}', expected '${TARGET_VERSION}'")
161
- fi
162
-
163
- # 4b. Release notes page exists
164
- RELEASE_DOC_ID="v${TARGET_VERSION//./-}"
165
- RELEASE_DOC_PATH="website-v2/docs/releases/${RELEASE_DOC_ID}.mdx"
166
- if [[ ! -f "${REPO_ROOT}/${RELEASE_DOC_PATH}" ]]; then
167
- SURFACE_ERRORS+=("release notes page missing: ${RELEASE_DOC_PATH}")
168
- fi
169
-
170
- # 4c. Docs sidebar auto-generates releases from dirName (release doc existence is sufficient)
171
- if ! grep -q "dirName.*releases" "${REPO_ROOT}/website-v2/sidebars.ts" 2>/dev/null; then
172
- SURFACE_ERRORS+=("sidebars.ts does not auto-generate releases (missing dirName: 'releases')")
173
- fi
174
-
175
- # 4d. Homepage hero badge shows target version
176
- if ! grep -q "v${TARGET_VERSION}" "${REPO_ROOT}/website-v2/src/pages/index.tsx" 2>/dev/null; then
177
- SURFACE_ERRORS+=("homepage index.tsx does not contain 'v${TARGET_VERSION}'")
178
- fi
179
-
180
- # 4e. Conformance capabilities version
181
- CAPS_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${REPO_ROOT}/.agentxchain-conformance/capabilities.json','utf8')).version)}catch{console.log('missing')}" 2>/dev/null || echo "missing")
182
- if [[ "$CAPS_VERSION" != "$TARGET_VERSION" ]]; then
183
- SURFACE_ERRORS+=("capabilities.json version is '${CAPS_VERSION}', expected '${TARGET_VERSION}'")
184
- fi
185
-
186
- # 4f. Protocol implementor guide example
187
- if ! grep -q "\"version\": \"${TARGET_VERSION}\"" "${REPO_ROOT}/website-v2/docs/protocol-implementor-guide.mdx" 2>/dev/null; then
188
- SURFACE_ERRORS+=("protocol-implementor-guide.mdx does not contain '\"version\": \"${TARGET_VERSION}\"'")
189
- fi
190
-
191
- # 4g. Launch evidence report title
192
- ESCAPED_VERSION="${TARGET_VERSION//./\\.}"
193
- if ! grep -qE "^# Launch Evidence Report — AgentXchain v${ESCAPED_VERSION}" "${REPO_ROOT}/.planning/LAUNCH_EVIDENCE_REPORT.md" 2>/dev/null; then
194
- SURFACE_ERRORS+=("LAUNCH_EVIDENCE_REPORT.md title does not carry v${TARGET_VERSION}")
195
- fi
196
-
197
- # 4h. llms.txt must list the current release notes route
198
- CURRENT_RELEASE_ROUTE="/docs/releases/${RELEASE_DOC_ID}"
199
- if ! grep -q "${CURRENT_RELEASE_ROUTE}" "${REPO_ROOT}/website-v2/static/llms.txt" 2>/dev/null; then
200
- SURFACE_ERRORS+=("website-v2/static/llms.txt does not list '${CURRENT_RELEASE_ROUTE}'")
201
- fi
202
-
203
- # 4i. sitemap.xml is now auto-generated by Docusaurus at build time — no static file check needed
204
-
205
- if [[ "${#SURFACE_ERRORS[@]}" -gt 0 ]]; then
206
- echo "FAIL: ${#SURFACE_ERRORS[@]} version-surface(s) not aligned to ${TARGET_VERSION}:" >&2
207
- printf ' - %s\n' "${SURFACE_ERRORS[@]}" >&2
152
+ # auto-aligned in step 6 because the registry tarball URL is deterministic but
153
+ # the registry SHA256 is inherently post-publish truth.
154
+ echo "[4/10] Verifying release alignment for ${TARGET_VERSION}..."
155
+ if node "${CLI_DIR}/scripts/check-release-alignment.mjs" --target-version "${TARGET_VERSION}" --scope prebump; then
156
+ :
157
+ else
208
158
  echo "" >&2
209
159
  echo "Fix these surfaces before running release-bump. The bump script refuses to" >&2
210
160
  echo "create release identity when governed surfaces are stale." >&2
211
161
  exit 1
212
162
  fi
213
- echo " OK: all 8 governed version surfaces reference ${TARGET_VERSION}"
214
163
 
215
164
  # 5. Normalize release-note sidebar ordering
216
165
  echo "[5/10] Normalizing release-note sidebar positions..."
@@ -85,7 +85,7 @@ fi
85
85
  echo ""
86
86
 
87
87
  # 1. Clean working tree
88
- echo "[1/6] Git status"
88
+ echo "[1/7] Git status"
89
89
  if git diff --quiet HEAD 2>/dev/null && [ -z "$(git ls-files --others --exclude-standard 2>/dev/null)" ]; then
90
90
  pass "Working tree is clean"
91
91
  else
@@ -97,7 +97,7 @@ else
97
97
  fi
98
98
 
99
99
  # 2. Dependencies
100
- echo "[2/6] Dependencies"
100
+ echo "[2/7] Dependencies"
101
101
  if run_and_capture NPM_CI_OUTPUT npm ci --ignore-scripts; then
102
102
  pass "npm ci succeeded"
103
103
  else
@@ -107,7 +107,7 @@ fi
107
107
 
108
108
  # 3. Tests
109
109
  if [[ "$PUBLISH_GATE" -eq 1 ]]; then
110
- echo "[3/6] Release-gate tests (targeted subset)"
110
+ echo "[3/7] Release-gate tests (targeted subset)"
111
111
  # In publish-gate mode, run only release-critical tests to avoid CI hangs.
112
112
  # The full test suite is a pre-tag responsibility, not a publish-time gate.
113
113
  GATE_TESTS=(
@@ -142,7 +142,7 @@ if [[ "$PUBLISH_GATE" -eq 1 ]]; then
142
142
  fi
143
143
  fi
144
144
  else
145
- echo "[3/6] Test suite"
145
+ echo "[3/7] Test suite"
146
146
  # Install MCP example deps — tests start example servers as subprocesses
147
147
  for example_dir in "${CLI_DIR}/../examples/mcp-echo-agent" "${CLI_DIR}/../examples/mcp-http-echo-agent"; do
148
148
  if [[ -f "${example_dir}/package.json" && ! -d "${example_dir}/node_modules" ]]; then
@@ -189,7 +189,7 @@ else
189
189
  fi
190
190
 
191
191
  # 4. CHANGELOG has target version
192
- echo "[4/6] CHANGELOG"
192
+ echo "[4/7] CHANGELOG"
193
193
  if grep -Fxq "## ${TARGET_VERSION}" CHANGELOG.md 2>/dev/null; then
194
194
  pass "CHANGELOG.md contains ${TARGET_VERSION} entry"
195
195
  else
@@ -197,7 +197,7 @@ else
197
197
  fi
198
198
 
199
199
  # 5. Package version
200
- echo "[5/6] Package version"
200
+ echo "[5/7] Package version"
201
201
  PKG_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).version)")
202
202
  echo " Current version: ${PKG_VERSION}"
203
203
  if [ "$PKG_VERSION" = "${TARGET_VERSION}" ]; then
@@ -210,8 +210,23 @@ else
210
210
  fi
211
211
  fi
212
212
 
213
- # 6. Pack dry-run
214
- echo "[6/6] npm pack --dry-run"
213
+ # 6. Release-alignment surfaces (shared manifest)
214
+ echo "[6/7] Release alignment (shared manifest)"
215
+ ALIGNMENT_SCRIPT="${SCRIPT_DIR}/check-release-alignment.mjs"
216
+ if [[ -f "$ALIGNMENT_SCRIPT" ]]; then
217
+ if run_and_capture ALIGNMENT_OUTPUT node "$ALIGNMENT_SCRIPT" --scope current --target-version "$TARGET_VERSION"; then
218
+ ALIGNED_COUNT="$(printf '%s\n' "$ALIGNMENT_OUTPUT" | awk -F'[,)]' '/surfaces/ { for (i=1;i<=NF;i++) if ($i ~ /[0-9]+ surfaces/) { gsub(/[^0-9]/,"",$i); print $i; exit } }')"
219
+ pass "Release alignment OK (${ALIGNED_COUNT:-all} surfaces)"
220
+ else
221
+ fail "Release alignment failed"
222
+ printf '%s\n' "$ALIGNMENT_OUTPUT" | head -20
223
+ fi
224
+ else
225
+ warn "check-release-alignment.mjs not found — skipping manifest validation"
226
+ fi
227
+
228
+ # 7. Pack dry-run
229
+ echo "[7/7] npm pack --dry-run"
215
230
  if run_and_capture PACK_OUTPUT npm pack --dry-run; then
216
231
  pass "npm pack --dry-run succeeded"
217
232
  PACK_SIZE_LINE="$(printf '%s\n' "$PACK_OUTPUT" | awk '/total files:/ { print; found=1 } END { if (!found) exit 1 }')"