@archangel70/cosmo 1.13.0 → 1.13.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable Cosmo changes are recorded here.
4
4
 
5
+ ## 1.13.1 — Resilient adopted-site QA
6
+
7
+ - Changed browser navigation from open-ended network-idle waiting to bounded load navigation, with a short settle period for lazy scripts.
8
+ - Made browser QA record per-viewport navigation timeouts and continue, ensuring partial evidence and failures are written to the report.
9
+ - Made noindex utility documents exempt from indexable-page H1 and canonical requirements while retaining accessibility checks and metadata warnings.
10
+ - Connected native adopted route inventories to intelligence evaluation with stable route IDs, allowing research findings to reference real existing routes.
11
+ - Prevented the local pack from reporting native route inventories as unused merely because they do not use Cosmo's generated page types.
12
+
5
13
  ## 1.13.0 — Native Astro preservation
6
14
 
7
15
  - Fixed internal-link and sitemap auditing for Astro file-format builds by treating `/route`, `/route/`, and `/route.html` as the same destination without rewriting live URLs.
package/README.md CHANGED
@@ -4,7 +4,7 @@ Cosmo helps an AI coding assistant build a complete, original Astro website for
4
4
 
5
5
  You do **not** need to know how to code. Cosmo supports Claude Code, Codex, and Google Antigravity.
6
6
 
7
- Current version: **1.13.0**
7
+ Current version: **1.13.1**
8
8
 
9
9
  ## Quick install
10
10
 
@@ -82,7 +82,7 @@ This is the only part of the beginner setup that uses a terminal. It is one inst
82
82
  cosmo --version
83
83
  ```
84
84
 
85
- You should see `1.13.0` or a newer version. Cosmo automatically installs its Claude, Codex, and Antigravity launchers.
85
+ You should see `1.13.1` or a newer version. Cosmo automatically installs its Claude, Codex, and Antigravity launchers.
86
86
 
87
87
  ### On Windows
88
88
 
@@ -99,7 +99,7 @@ You should see `1.13.0` or a newer version. Cosmo automatically installs its Cla
99
99
  cosmo --version
100
100
  ```
101
101
 
102
- You should see `1.13.0` or a newer version. Cosmo automatically installs its Claude, Codex, and Antigravity launchers.
102
+ You should see `1.13.1` or a newer version. Cosmo automatically installs its Claude, Codex, and Antigravity launchers.
103
103
 
104
104
  ## Step 4: create your website folder
105
105
 
package/docs/ADOPTION.md CHANGED
@@ -11,6 +11,8 @@ Cosmo adopts an existing Astro site in preservation mode. Adoption adds project
11
11
 
12
12
  The adopted project records `sourceModel: "native-astro"`, `designPolicy: "preserve"`, and the detected route format in `.cosmo/project.json`.
13
13
 
14
+ Each discovered route also receives a stable ID in `.cosmo/adoption/route-inventory.json`. Research findings and other intelligence artifacts can reference those IDs through `supportsPageIds` without creating duplicate Markdown pages or populating the compatibility Build Plan.
15
+
14
16
  ## Preservation workflow
15
17
 
16
18
  `cosmo workflow start .` automatically selects the `adopted` workflow for a native Astro project. It records and reviews:
@@ -12,6 +12,8 @@ Every generated HTML route is rendered at:
12
12
 
13
13
  Each render checks successful navigation, horizontal overflow, console and page errors, WCAG 2 A/AA violations, and whether the first keyboard tab reaches an element with a visible focus treatment. Reduced-motion preference is enabled during the run.
14
14
 
15
+ Navigation waits for the page load event for at most 45 seconds, then allows a short settle period for lazy scripts. It does not wait for network idle because maps, analytics, and other long-lived third-party requests may never become idle. A timed-out route is recorded as a critical finding for that viewport; Cosmo closes that page and continues checking the remaining routes so the JSON report always contains the partial run and every timeout observed.
16
+
15
17
  Normal-state full-page screenshots are written before the keyboard interaction. This keeps the reference captures useful for visual review while still testing the focus path independently.
16
18
 
17
19
  ## Lighthouse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archangel70/cosmo",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Local-first, multi-agent Astro website builder for Claude, Codex, Antigravity, and the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -65,7 +65,7 @@ import {
65
65
  workflowSummary,
66
66
  } from '../lib/workflow.mjs';
67
67
 
68
- const VERSION = '1.13.0';
68
+ const VERSION = '1.13.1';
69
69
  const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
70
70
  const templateDirectory = path.resolve(cliDirectory, '../../../templates/astro-site');
71
71
  const [command = 'start', ...rawArgs] = process.argv.slice(2);
@@ -51,6 +51,11 @@ function routeFromPageSource(source, routeFormat) {
51
51
  return routeFormat === 'file' ? route : `${route.replace(/\/$/, '')}/`;
52
52
  }
53
53
 
54
+ function routeId(route, source) {
55
+ if (route === '/') return 'home';
56
+ return slugify(route ?? source.replace(/\.(astro|md|mdx)$/i, ''));
57
+ }
58
+
54
59
  function copyPath(templateDirectory, target, relative) {
55
60
  const source = path.join(templateDirectory, relative);
56
61
  if (!fs.existsSync(source)) return;
@@ -116,7 +121,10 @@ export function adoptAstroProject(templateDirectory, target, options = {}) {
116
121
  writeJson(path.join(resolved, '.cosmo', 'adoption', 'source-inventory.json'), { version: 1, sourceModel: 'native-astro', routeFormat, reviewed: false, pageSources });
117
122
  writeJson(path.join(resolved, '.cosmo', 'adoption', 'route-inventory.json'), {
118
123
  version: 1, routeFormat, approved: false,
119
- routes: pageSources.map((source) => ({ source: `src/pages/${source}`, path: routeFromPageSource(source, routeFormat), indexability: 'preserve' })),
124
+ routes: pageSources.map((source) => {
125
+ const route = routeFromPageSource(source, routeFormat);
126
+ return { id: routeId(route, source), source: `src/pages/${source}`, path: route, type: route === '/' ? 'home' : 'native', indexability: 'preserve' };
127
+ }),
120
128
  });
121
129
  writeJson(path.join(resolved, '.cosmo', 'adoption', 'design-baseline.json'), { version: 1, policy: 'preserve', approved: false, notes: '' });
122
130
  writeJson(path.join(resolved, '.cosmo', 'adoption', 'page-baseline.json'), { version: 1, reviewed: false, notes: '' });
@@ -38,11 +38,11 @@ export function auditDist(distDir) {
38
38
  || firstMatch(html, /<meta\s+[^>]*content=["']([^"']*)["'][^>]*name=["']robots["'][^>]*>/i);
39
39
  const indexable = !robots.toLowerCase().split(',').map((value) => value.trim()).includes('noindex');
40
40
 
41
- if (!title) critical.push({ route, rule: 'missing-title' });
42
- if (!description) critical.push({ route, rule: 'missing-description' });
43
- if (h1s.length !== 1) critical.push({ route, rule: 'h1-count', detail: h1s.length });
41
+ if (!title) (indexable ? critical : warnings).push({ route, rule: 'missing-title' });
42
+ if (!description) (indexable ? critical : warnings).push({ route, rule: 'missing-description' });
43
+ if (indexable && h1s.length !== 1) critical.push({ route, rule: 'h1-count', detail: h1s.length });
44
44
  if (missingAlt) critical.push({ route, rule: 'missing-image-alt', detail: missingAlt });
45
- if (!hasCanonical) critical.push({ route, rule: 'missing-canonical' });
45
+ if (indexable && !hasCanonical) critical.push({ route, rule: 'missing-canonical' });
46
46
  if (!hasSchema) warnings.push({ route, rule: 'missing-json-ld' });
47
47
  if (!hasLang) critical.push({ route, rule: 'missing-language' });
48
48
 
@@ -12,6 +12,8 @@ const VIEWPORTS = [
12
12
  { name: 'tablet', width: 768, height: 1024 },
13
13
  { name: 'desktop', width: 1440, height: 1000 },
14
14
  ];
15
+ const NAVIGATION_TIMEOUT_MS = 45_000;
16
+ const PAGE_SETTLE_MS = 250;
15
17
 
16
18
  function walk(directory, suffix) {
17
19
  if (!fs.existsSync(directory)) return [];
@@ -63,14 +65,13 @@ async function runLighthouse(baseUrl, executablePath) {
63
65
  }
64
66
  }
65
67
 
66
- export async function auditBrowser(projectDir, { baseUrl, lighthouseEnabled = true } = {}) {
68
+ export async function auditBrowser(projectDir, { baseUrl, lighthouseEnabled = true, browserType = chromium, executablePath = findChromeExecutable() } = {}) {
67
69
  const distDir = path.join(projectDir, 'dist');
68
70
  const routes = walk(distDir, '.html').map((file) => routeForFile(distDir, file)).sort();
69
71
  if (!routes.length) throw new Error('No built HTML routes found for browser QA.');
70
- const executablePath = findChromeExecutable();
71
72
  const screenshotsDir = path.join(projectDir, '.cosmo', 'reports', 'screenshots');
72
73
  fs.mkdirSync(screenshotsDir, { recursive: true });
73
- const browser = await chromium.launch({ executablePath, headless: true });
74
+ const browser = await browserType.launch({ executablePath, headless: true });
74
75
  const critical = [];
75
76
  const warnings = [];
76
77
  const pages = [];
@@ -78,63 +79,78 @@ export async function auditBrowser(projectDir, { baseUrl, lighthouseEnabled = tr
78
79
  try {
79
80
  for (const route of routes) {
80
81
  for (const viewport of VIEWPORTS) {
81
- const page = await browser.newPage({ viewport });
82
+ let page = null;
82
83
  const runtimeErrors = [];
83
- page.on('console', (message) => {
84
- if (message.type() === 'error') {
85
- const location = message.location();
86
- runtimeErrors.push(`console: ${message.text()}${location.url ? ` (${location.url})` : ''}`);
84
+ let stage = 'page-create';
85
+ try {
86
+ page = await browser.newPage({ viewport });
87
+ page.on('console', (message) => {
88
+ if (message.type() === 'error') {
89
+ const location = message.location();
90
+ runtimeErrors.push(`console: ${message.text()}${location.url ? ` (${location.url})` : ''}`);
91
+ }
92
+ });
93
+ page.on('pageerror', (error) => runtimeErrors.push(`page: ${error.message}`));
94
+ stage = 'navigation';
95
+ const response = await page.goto(new URL(route, baseUrl).href, { waitUntil: 'load', timeout: NAVIGATION_TIMEOUT_MS });
96
+ stage = 'audit';
97
+ await page.waitForTimeout(PAGE_SETTLE_MS);
98
+ if (!response?.ok()) critical.push({ route, viewport: viewport.width, rule: 'navigation-failed', detail: response?.status() ?? 'no-response' });
99
+ await page.emulateMedia({ reducedMotion: 'reduce' });
100
+ const dimensions = await page.evaluate(() => ({
101
+ clientWidth: document.documentElement.clientWidth,
102
+ scrollWidth: document.documentElement.scrollWidth,
103
+ }));
104
+ if (dimensions.scrollWidth > dimensions.clientWidth) {
105
+ critical.push({ route, viewport: viewport.width, rule: 'horizontal-overflow', detail: dimensions });
106
+ }
107
+
108
+ await page.addScriptTag({ content: axe.source });
109
+ const accessibility = await page.evaluate(async () => globalThis.axe.run(document, {
110
+ runOnly: { type: 'tag', values: ['wcag2a', 'wcag2aa'] },
111
+ }));
112
+ for (const violation of accessibility.violations) {
113
+ critical.push({
114
+ route,
115
+ viewport: viewport.width,
116
+ rule: `accessibility-${violation.id}`,
117
+ detail: {
118
+ impact: violation.impact,
119
+ help: violation.help,
120
+ nodes: violation.nodes.map((node) => ({ target: node.target, summary: node.failureSummary })),
121
+ },
122
+ });
87
123
  }
88
- });
89
- page.on('pageerror', (error) => runtimeErrors.push(`page: ${error.message}`));
90
- const response = await page.goto(new URL(route, baseUrl).href, { waitUntil: 'networkidle' });
91
- if (!response?.ok()) critical.push({ route, viewport: viewport.width, rule: 'navigation-failed', detail: response?.status() ?? 'no-response' });
92
- await page.emulateMedia({ reducedMotion: 'reduce' });
93
- const dimensions = await page.evaluate(() => ({
94
- clientWidth: document.documentElement.clientWidth,
95
- scrollWidth: document.documentElement.scrollWidth,
96
- }));
97
- if (dimensions.scrollWidth > dimensions.clientWidth) {
98
- critical.push({ route, viewport: viewport.width, rule: 'horizontal-overflow', detail: dimensions });
99
- }
100
124
 
101
- await page.addScriptTag({ content: axe.source });
102
- const accessibility = await page.evaluate(async () => globalThis.axe.run(document, {
103
- runOnly: { type: 'tag', values: ['wcag2a', 'wcag2aa'] },
104
- }));
105
- for (const violation of accessibility.violations) {
125
+ const screenshot = path.join(screenshotsDir, screenshotName(route, viewport.width));
126
+ await page.screenshot({ path: screenshot, fullPage: true });
127
+ await page.keyboard.press('Tab');
128
+ const focus = await page.evaluate(() => {
129
+ const element = document.activeElement;
130
+ if (!element || element === document.body) return { focused: false };
131
+ const style = getComputedStyle(element);
132
+ return {
133
+ focused: true,
134
+ tag: element.tagName.toLowerCase(),
135
+ text: element.textContent?.trim().slice(0, 80) ?? '',
136
+ visible: style.outlineStyle !== 'none' || style.boxShadow !== 'none',
137
+ };
138
+ });
139
+ if (!focus.focused) critical.push({ route, viewport: viewport.width, rule: 'keyboard-focus-missing' });
140
+ else if (!focus.visible) critical.push({ route, viewport: viewport.width, rule: 'keyboard-focus-invisible', detail: focus });
141
+
142
+ for (const detail of runtimeErrors) critical.push({ route, viewport: viewport.width, rule: 'browser-runtime-error', detail });
143
+ pages.push({ route, viewport, dimensions, focus, violations: accessibility.violations.length, runtimeErrors, screenshot: path.relative(projectDir, screenshot) });
144
+ } catch (error) {
106
145
  critical.push({
107
146
  route,
108
147
  viewport: viewport.width,
109
- rule: `accessibility-${violation.id}`,
110
- detail: {
111
- impact: violation.impact,
112
- help: violation.help,
113
- nodes: violation.nodes.map((node) => ({ target: node.target, summary: node.failureSummary })),
114
- },
148
+ rule: stage === 'navigation' ? 'navigation-timeout' : 'browser-check-error',
149
+ detail: error instanceof Error ? error.message : String(error),
115
150
  });
151
+ } finally {
152
+ await page?.close().catch(() => {});
116
153
  }
117
-
118
- const screenshot = path.join(screenshotsDir, screenshotName(route, viewport.width));
119
- await page.screenshot({ path: screenshot, fullPage: true });
120
- await page.keyboard.press('Tab');
121
- const focus = await page.evaluate(() => {
122
- const element = document.activeElement;
123
- if (!element || element === document.body) return { focused: false };
124
- const style = getComputedStyle(element);
125
- return {
126
- focused: true,
127
- tag: element.tagName.toLowerCase(),
128
- text: element.textContent?.trim().slice(0, 80) ?? '',
129
- visible: style.outlineStyle !== 'none' || style.boxShadow !== 'none',
130
- };
131
- });
132
- if (!focus.focused) critical.push({ route, viewport: viewport.width, rule: 'keyboard-focus-missing' });
133
- else if (!focus.visible) critical.push({ route, viewport: viewport.width, rule: 'keyboard-focus-invisible', detail: focus });
134
-
135
- for (const detail of runtimeErrors) critical.push({ route, viewport: viewport.width, rule: 'browser-runtime-error', detail });
136
- pages.push({ route, viewport, dimensions, focus, violations: accessibility.violations.length, runtimeErrors, screenshot: path.relative(projectDir, screenshot) });
137
- await page.close();
138
154
  }
139
155
  }
140
156
  } finally {
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import crypto from 'node:crypto';
4
4
  import matter from 'gray-matter';
5
5
  import { readIntelligence } from './intelligence.mjs';
6
- import { writeJson } from './project.mjs';
6
+ import { readProject, slugify, writeJson } from './project.mjs';
7
7
  import { EDITORIAL_PATTERNS } from './editorial-guidance.mjs';
8
8
 
9
9
  const RICH_OWNERSHIP = new Set(['measured', 'lived', 'originated', 'accessed', 'staked', 'first', 'corrected']);
@@ -35,6 +35,28 @@ function readJson(file) {
35
35
  }
36
36
  }
37
37
 
38
+ function nativePlan(projectDir) {
39
+ const inventory = readJson(path.join(projectDir, '.cosmo', 'adoption', 'route-inventory.json'));
40
+ const routes = Array.isArray(inventory?.routes) ? inventory.routes : [];
41
+ return {
42
+ pages: routes.map((route, index) => {
43
+ const routePath = route.path ?? null;
44
+ const id = route.id || (routePath === '/' ? 'home' : slugify(routePath ?? route.source ?? `native-route-${index + 1}`));
45
+ return {
46
+ id,
47
+ path: routePath,
48
+ type: route.type ?? (routePath === '/' ? 'home' : 'native'),
49
+ contentFile: route.source ?? null,
50
+ data: route.data ?? {},
51
+ contract: route.contract ?? {},
52
+ architecture: route.architecture ?? {
53
+ indexability: route.indexability === 'noindex' ? 'noindex' : 'preserve',
54
+ },
55
+ };
56
+ }),
57
+ };
58
+ }
59
+
38
60
  function pageContent(projectDir, page) {
39
61
  const file = path.resolve(projectDir, page.contentFile);
40
62
  if (!fs.existsSync(file)) return { file, data: null, surface: '' };
@@ -82,10 +104,10 @@ function authorityFindings(context, artifact) {
82
104
  }
83
105
 
84
106
  function localFindings(context, artifact) {
85
- const { plan, evidence, pack } = context;
107
+ const { plan, evidence, pack, project } = context;
86
108
  const findings = [];
87
109
  const pages = plan.pages.filter((page) => page.type === 'location');
88
- if (!pages.length) findings.push(finding(pack.id, 'local-pack-unused', 'warning', 'The local pack is selected but the plan contains no location page.', 'Remove the pack if locality is not part of the approved strategy.'));
110
+ if (!pages.length && project.sourceModel !== 'native-astro') findings.push(finding(pack.id, 'local-pack-unused', 'warning', 'The local pack is selected but the plan contains no location page.', 'Remove the pack if locality is not part of the approved strategy.'));
89
111
  const proofIds = new Set(Array.isArray(artifact?.localProofIds) ? artifact.localProofIds : []);
90
112
  for (const proofId of proofIds) if (!evidence.proofs.some((proof) => proof.id === proofId)) findings.push(finding(pack.id, 'unknown-local-proof', 'blocking', `Local-market artifact references unknown proof ${proofId}.`, 'Register the proof in the central evidence ledger or remove the reference.'));
91
113
  for (const page of pages) {
@@ -430,11 +452,14 @@ function declarativeFindings(pack, artifact) {
430
452
 
431
453
  export function evaluateIntelligence(projectDir) {
432
454
  const intelligence = readIntelligence(projectDir);
433
- const plan = readJson(path.join(projectDir, '.cosmo', 'build-plan.json')) ?? { pages: [] };
455
+ const project = readProject(projectDir).data;
456
+ const plan = project.sourceModel === 'native-astro'
457
+ ? nativePlan(projectDir)
458
+ : readJson(path.join(projectDir, '.cosmo', 'build-plan.json')) ?? { pages: [] };
434
459
  const evidence = readJson(path.join(projectDir, '.cosmo', 'evidence.json')) ?? { claims: [], proofs: [] };
435
460
  const packs = intelligence.manifests.map((pack) => {
436
461
  const artifact = artifactState(projectDir, pack);
437
- const context = { projectDir, plan, evidence, pack };
462
+ const context = { projectDir, project, plan, evidence, pack };
438
463
  const specialized = artifact.data ? (EVALUATORS[pack.id]?.(context, artifact.data) ?? []) : [];
439
464
  const findings = [...artifact.findings, ...declarativeFindings(pack, artifact.data), ...specialized];
440
465
  const blocking = findings.filter((item) => item.severity === 'blocking').length;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "cosmo",
3
- "version": "1.13.0"
3
+ "version": "1.13.1"
4
4
  }
@@ -1,4 +1,4 @@
1
- <!-- cosmo-agent-version: 1.13.0 -->
1
+ <!-- cosmo-agent-version: 1.13.1 -->
2
2
  # Cosmo
3
3
 
4
4
  Use the Cosmo website-building workflow in the current workspace.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosmo",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Conversational launcher for starting, adopting, and resuming local-first Cosmo Astro website builds.",
5
5
  "author": {
6
6
  "name": "Cosmo"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmo/astro-starter",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {