@archangel70/cosmo 1.16.1 → 1.16.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/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/package.json +1 -1
- package/packages/cli/bin/cosmo.mjs +1 -1
- package/packages/cli/lib/intelligence-audit.mjs +89 -12
- package/plugins/agent-skills/cosmo/.cosmo-agent.json +1 -1
- package/plugins/antigravity/cosmo.md +1 -1
- package/plugins/claude-code/cosmo/.claude-plugin/plugin.json +1 -1
- package/templates/astro-site/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable Cosmo changes are recorded here.
|
|
4
4
|
|
|
5
|
+
## 1.16.2 — Native Astro intelligence resilience
|
|
6
|
+
|
|
7
|
+
- Stopped intelligence checks from parsing Astro's JavaScript and TypeScript frontmatter as YAML on adopted native sites.
|
|
8
|
+
- Preserved native route metadata for editorial and regulated checks while inspecting only the rendered template surface for copy patterns.
|
|
9
|
+
- Converted unreadable native page sources into scoped findings and isolated unexpected pack failures so one problem cannot erase the rest of the intelligence report.
|
|
10
|
+
- Added regression coverage for JavaScript-heavy Astro pages and partial intelligence reports.
|
|
11
|
+
|
|
5
12
|
## 1.16.1 — Node compatibility guard
|
|
6
13
|
|
|
7
14
|
- Raised Cosmo's declared, documented, diagnosed, and CI-tested Node.js minimum to 22.23.4, matching the secured Astro toolchain shipped with v1.16.
|
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.16.
|
|
7
|
+
Current version: **1.16.2**
|
|
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.16.
|
|
85
|
+
You should see `1.16.2` 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.16.1` or a newer version. Cosmo automatically installs its Cla
|
|
|
99
99
|
cosmo --version
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
You should see `1.16.
|
|
102
|
+
You should see `1.16.2` 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/package.json
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
workflowSummary,
|
|
68
68
|
} from '../lib/workflow.mjs';
|
|
69
69
|
|
|
70
|
-
const VERSION = '1.16.
|
|
70
|
+
const VERSION = '1.16.2';
|
|
71
71
|
const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
72
72
|
const templateDirectory = path.resolve(cliDirectory, '../../../templates/astro-site');
|
|
73
73
|
const [command = 'start', ...rawArgs] = process.argv.slice(2);
|
|
@@ -58,10 +58,45 @@ function nativePlan(projectDir) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function pageContent(projectDir, page) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (typeof page.contentFile !== 'string' || !page.contentFile.trim()) {
|
|
62
|
+
return { file: null, data: null, surface: '', error: 'No content source is recorded for this page.' };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const projectRoot = path.resolve(projectDir);
|
|
66
|
+
const file = path.resolve(projectRoot, page.contentFile);
|
|
67
|
+
if (file !== projectRoot && !file.startsWith(`${projectRoot}${path.sep}`)) {
|
|
68
|
+
return { file, data: null, surface: '', error: 'The content source resolves outside the project.' };
|
|
69
|
+
}
|
|
70
|
+
if (!fs.existsSync(file)) {
|
|
71
|
+
return { file, data: null, surface: '', error: 'The content source does not exist.' };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const source = fs.readFileSync(file, 'utf8');
|
|
76
|
+
if (path.extname(file).toLowerCase() === '.astro') {
|
|
77
|
+
const surface = source.replace(/^\uFEFF?---[ \t]*\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/, '');
|
|
78
|
+
return { file, data: page.data ?? {}, surface };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const parsed = matter(source);
|
|
82
|
+
return { file, data: parsed.data, surface: `${JSON.stringify(parsed.data)}\n${parsed.content}` };
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return { file, data: null, surface: '', error: error instanceof Error ? error.message : String(error) };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function pageContentFinding(packId, page, content) {
|
|
89
|
+
return finding(
|
|
90
|
+
packId,
|
|
91
|
+
'page-content-unreadable',
|
|
92
|
+
'blocking',
|
|
93
|
+
`Page ${page.id} could not be inspected from ${page.contentFile ?? 'an unrecorded source'}: ${content.error}`,
|
|
94
|
+
'Repair the page source or update the native route inventory so Cosmo can inspect it.'
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function readPageContent(context, page) {
|
|
99
|
+
return context.pageContent ? context.pageContent(page) : pageContent(context.projectDir, page);
|
|
65
100
|
}
|
|
66
101
|
|
|
67
102
|
function artifactState(projectDir, pack) {
|
|
@@ -134,11 +169,16 @@ function localFindings(context, artifact) {
|
|
|
134
169
|
}
|
|
135
170
|
|
|
136
171
|
function editorialFindings(context) {
|
|
137
|
-
const {
|
|
172
|
+
const { plan, pack } = context;
|
|
138
173
|
const findings = [];
|
|
139
174
|
const editorialTypes = new Set(['guide', 'answer', 'standard']);
|
|
140
175
|
for (const page of plan.pages.filter((item) => item.architecture?.indexability === 'index' && editorialTypes.has(item.type))) {
|
|
141
|
-
const
|
|
176
|
+
const inspected = readPageContent(context, page);
|
|
177
|
+
if (inspected.error) {
|
|
178
|
+
findings.push(pageContentFinding(pack.id, page, inspected));
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const content = inspected.data;
|
|
142
182
|
for (const key of ['author', 'reviewedBy', 'publishedAt', 'correctionPolicy']) if (!nonEmpty(content?.editorial?.[key])) findings.push(finding(pack.id, 'editorial-metadata-missing', 'blocking', `Indexable editorial page ${page.id} is missing editorial.${key}.`, `Add approved ${key} metadata to the page.`));
|
|
143
183
|
for (const key of ['publishedAt', 'updatedAt']) if (content?.editorial?.[key] && Number.isNaN(Date.parse(content.editorial[key]))) findings.push(finding(pack.id, 'editorial-date-invalid', 'blocking', `Page ${page.id} has an invalid editorial.${key}.`, 'Use an ISO 8601 date.'));
|
|
144
184
|
}
|
|
@@ -146,8 +186,17 @@ function editorialFindings(context) {
|
|
|
146
186
|
}
|
|
147
187
|
|
|
148
188
|
function regulatedFindings(context, artifact) {
|
|
149
|
-
const {
|
|
189
|
+
const { plan, evidence, pack } = context;
|
|
150
190
|
const findings = [];
|
|
191
|
+
const unreadable = new Set();
|
|
192
|
+
const inspect = (page) => {
|
|
193
|
+
const content = readPageContent(context, page);
|
|
194
|
+
if (content.error && !unreadable.has(page.id)) {
|
|
195
|
+
findings.push(pageContentFinding(pack.id, page, content));
|
|
196
|
+
unreadable.add(page.id);
|
|
197
|
+
}
|
|
198
|
+
return content;
|
|
199
|
+
};
|
|
151
200
|
const claims = new Map(evidence.claims.map((claim) => [claim.id, claim]));
|
|
152
201
|
for (const page of plan.pages) {
|
|
153
202
|
const highRisk = (page.contract?.supportsClaims ?? []).map((id) => claims.get(id)).filter((claim) => claim?.risk === 'high');
|
|
@@ -157,7 +206,9 @@ function regulatedFindings(context, artifact) {
|
|
|
157
206
|
if (!verified) findings.push(finding(pack.id, 'regulated-claim-unverified', 'blocking', `Page ${page.id} uses high-risk claim ${claim.id} without verified proof.`, 'Obtain reviewer-approved proof or remove the claim.'));
|
|
158
207
|
}
|
|
159
208
|
if (page.architecture?.indexability === 'index') {
|
|
160
|
-
const
|
|
209
|
+
const content = inspect(page);
|
|
210
|
+
if (content.error) continue;
|
|
211
|
+
const review = content.data?.regulatoryReview;
|
|
161
212
|
for (const key of ['reviewedBy', 'reviewedAt', 'jurisdiction']) if (!nonEmpty(review?.[key])) findings.push(finding(pack.id, 'regulatory-review-missing', 'blocking', `Indexable regulated page ${page.id} is missing regulatoryReview.${key}.`, 'Record the authorized review before indexing.'));
|
|
162
213
|
if (review?.status !== 'approved') findings.push(finding(pack.id, 'regulatory-review-not-approved', 'blocking', `Indexable regulated page ${page.id} does not have approved regulatory review.`, 'Set status to approved only after the named reviewer signs off.'));
|
|
163
214
|
const suppliedDisclaimers = new Set(review?.disclaimers ?? []);
|
|
@@ -166,7 +217,9 @@ function regulatedFindings(context, artifact) {
|
|
|
166
217
|
}
|
|
167
218
|
const prohibited = Array.isArray(artifact?.prohibitedClaims) ? artifact.prohibitedClaims.filter((item) => typeof item === 'string' && item.trim()) : [];
|
|
168
219
|
for (const page of plan.pages) {
|
|
169
|
-
const
|
|
220
|
+
const content = inspect(page);
|
|
221
|
+
if (content.error) continue;
|
|
222
|
+
const surface = normalized(content.surface);
|
|
170
223
|
for (const phrase of prohibited) if (surface.includes(normalized(phrase))) findings.push(finding(pack.id, 'prohibited-regulated-claim', 'blocking', `Page ${page.id} contains prohibited claim language: “${phrase}”.`, 'Remove the language and request regulated-content review.'));
|
|
171
224
|
}
|
|
172
225
|
return findings;
|
|
@@ -332,7 +385,12 @@ function editorialNaturalnessFindings(context, artifact) {
|
|
|
332
385
|
}
|
|
333
386
|
const allowed = new Set((artifact?.allowedPatterns ?? []).map(String));
|
|
334
387
|
for (const page of plan.pages) {
|
|
335
|
-
const
|
|
388
|
+
const content = readPageContent(context, page);
|
|
389
|
+
if (content.error) {
|
|
390
|
+
findings.push(pageContentFinding(pack.id, page, content));
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const surface = content.surface;
|
|
336
394
|
const hits = [];
|
|
337
395
|
for (const item of NATURALNESS_PATTERNS) {
|
|
338
396
|
const matches = [...surface.matchAll(new RegExp(item.pattern.source, item.pattern.flags))];
|
|
@@ -457,10 +515,29 @@ export function evaluateIntelligence(projectDir) {
|
|
|
457
515
|
? nativePlan(projectDir)
|
|
458
516
|
: readJson(path.join(projectDir, '.cosmo', 'build-plan.json')) ?? { pages: [] };
|
|
459
517
|
const evidence = readJson(path.join(projectDir, '.cosmo', 'evidence.json')) ?? { claims: [], proofs: [] };
|
|
518
|
+
const pageContentCache = new Map();
|
|
519
|
+
const cachedPageContent = (page) => {
|
|
520
|
+
const key = `${page.id ?? ''}\0${page.contentFile ?? ''}`;
|
|
521
|
+
if (!pageContentCache.has(key)) pageContentCache.set(key, pageContent(projectDir, page));
|
|
522
|
+
return pageContentCache.get(key);
|
|
523
|
+
};
|
|
460
524
|
const packs = intelligence.manifests.map((pack) => {
|
|
461
525
|
const artifact = artifactState(projectDir, pack);
|
|
462
|
-
const context = { projectDir, project, plan, evidence, pack };
|
|
463
|
-
|
|
526
|
+
const context = { projectDir, project, plan, evidence, pack, pageContent: cachedPageContent };
|
|
527
|
+
let specialized = [];
|
|
528
|
+
if (artifact.data) {
|
|
529
|
+
try {
|
|
530
|
+
specialized = EVALUATORS[pack.id]?.(context, artifact.data) ?? [];
|
|
531
|
+
} catch (error) {
|
|
532
|
+
specialized = [finding(
|
|
533
|
+
pack.id,
|
|
534
|
+
'pack-evaluation-failed',
|
|
535
|
+
'blocking',
|
|
536
|
+
`${pack.title} could not finish its evaluation: ${error instanceof Error ? error.message : String(error)}`,
|
|
537
|
+
'Repair the reported project input or pack configuration, then run the intelligence check again.'
|
|
538
|
+
)];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
464
541
|
const findings = [...artifact.findings, ...declarativeFindings(pack, artifact.data), ...specialized];
|
|
465
542
|
const blocking = findings.filter((item) => item.severity === 'blocking').length;
|
|
466
543
|
const warnings = findings.filter((item) => item.severity === 'warning').length;
|