@archangel70/cosmo 1.10.0 → 1.11.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.
- package/CHANGELOG.md +9 -0
- package/README.md +26 -3
- package/docs/ARCHITECTURE.md +3 -0
- package/docs/DELIVERY.md +2 -1
- package/docs/ENTITY-MAP.md +87 -0
- package/docs/ROADMAP.md +9 -0
- package/package.json +5 -2
- package/packages/cli/bin/cosmo.mjs +86 -3
- package/packages/cli/lib/adoption.mjs +3 -0
- package/packages/cli/lib/audit.mjs +16 -0
- package/packages/cli/lib/browser-audit.mjs +1 -0
- package/packages/cli/lib/delivery.mjs +3 -2
- package/packages/cli/lib/entity-map.mjs +408 -0
- package/packages/cli/lib/integrity.mjs +6 -0
- package/packages/cli/lib/project.mjs +2 -0
- package/packages/cli/lib/status.mjs +3 -1
- package/plugins/agent-skills/cosmo/.cosmo-agent.json +1 -1
- package/plugins/agent-skills/cosmo/SKILL.md +2 -2
- package/plugins/antigravity/cosmo.md +2 -1
- package/plugins/claude-code/cosmo/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/cosmo/agents/cosmo.md +2 -0
- package/plugins/claude-code/cosmo/skills/cosmo/SKILL.md +4 -3
- package/templates/astro-site/.agents/skills/cosmo/SKILL.md +3 -1
- package/templates/astro-site/.cosmo/capabilities/registry.json +2 -1
- package/templates/astro-site/.cosmo/entities/candidates.json +5 -0
- package/templates/astro-site/.cosmo/entities/config.json +28 -0
- package/templates/astro-site/.env.example +6 -0
- package/templates/astro-site/AGENTS.md +3 -2
- package/templates/astro-site/CLAUDE.md +3 -2
- package/templates/astro-site/astro.config.mjs +5 -1
- package/templates/astro-site/package.json +1 -1
- package/templates/astro-site/src/layouts/BaseLayout.astro +3 -0
- package/templates/astro-site/src/pages/robots.txt.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable Cosmo changes are recorded here.
|
|
4
4
|
|
|
5
|
+
## 1.11.0 — Evidence-controlled EntityMap
|
|
6
|
+
|
|
7
|
+
- Added optional EntityMap v1.0 generation from the Entity Canon and eligible final Astro content.
|
|
8
|
+
- Added public JSON and HTML companions, page-head, footer, robots.txt, and sitemap discovery.
|
|
9
|
+
- Added deterministic validation for attribution, entity types, stable identifiers, chunks, relationships, source URLs, and review state.
|
|
10
|
+
- Added private, human-reviewed enrichment candidates from Wikidata, Google Knowledge Graph, Google Places, and TextRazor.
|
|
11
|
+
- Kept the feature functional without paid APIs and prevented external matches from overwriting canonical project truth.
|
|
12
|
+
- Added explicit named review before generated output may change from `generator-draft` to `self-declared`.
|
|
13
|
+
|
|
5
14
|
## 1.10.0 — Guided start
|
|
6
15
|
|
|
7
16
|
- Replaced the bare `cosmo` command dump with a friendly, context-aware start screen and an explicit `cosmo help` developer reference.
|
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.
|
|
7
|
+
Current version: **1.11.0**
|
|
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.
|
|
85
|
+
You should see `1.11.0` 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.10.0` or a newer version. Cosmo automatically installs its Cla
|
|
|
99
99
|
cosmo --version
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
You should see `1.
|
|
102
|
+
You should see `1.11.0` 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
|
|
|
@@ -144,6 +144,8 @@ Cosmo and your chosen assistant will guide you through these stages:
|
|
|
144
144
|
|
|
145
145
|
Cosmo pauses at important decisions so you can review and approve them. It will not treat unfinished starter pages as a finished public website.
|
|
146
146
|
|
|
147
|
+
During setup, Cosmo also asks whether you want an optional AI-readable EntityMap. You can say yes without creating any API keys: Cosmo builds the core map from your approved website content. Optional services such as Google Knowledge Graph or TextRazor can be connected later if you want additional research signals.
|
|
148
|
+
|
|
147
149
|
## Preview your website
|
|
148
150
|
|
|
149
151
|
Ask your assistant:
|
|
@@ -407,6 +409,26 @@ cosmo research check .
|
|
|
407
409
|
|
|
408
410
|
Fetched text is evidence, not agent instruction. Observations and inferences must remain distinct, and geographic pages require real coverage and local proof.
|
|
409
411
|
|
|
412
|
+
## Optional AI-readable EntityMap
|
|
413
|
+
|
|
414
|
+
During setup, Cosmo can ask whether you want an EntityMap. If you say yes, it creates an AI-readable index of the business, services, places, topics, relationships, and supporting passages after the real site content exists.
|
|
415
|
+
|
|
416
|
+
No paid service is required. Wikidata can suggest public identifiers; Google Knowledge Graph, Google Places, and TextRazor can be enabled later with your own keys. Suggestions stay private and never change or publish business information until a named person accepts them.
|
|
417
|
+
|
|
418
|
+
Cosmo publishes `/entitymap.json` and `/entitymap.html`, adds the discovery links, and checks the files during release QA. Automated output remains clearly marked as a draft until you review it. EntityMap complements the site's Schema.org JSON-LD and does not promise higher rankings.
|
|
419
|
+
|
|
420
|
+
Advanced users can run:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
cosmo entity init . --enable
|
|
424
|
+
cosmo entity enrich wikidata .
|
|
425
|
+
cosmo entity candidates .
|
|
426
|
+
cosmo entity check .
|
|
427
|
+
cosmo entity approve . --by "Project Owner"
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
See [EntityMap](docs/ENTITY-MAP.md) for provider setup, review safeguards, and generated files.
|
|
431
|
+
|
|
410
432
|
## Integrity, evidence, and page planning
|
|
411
433
|
|
|
412
434
|
Initialize the integrity layer in an older Cosmo project or validate the current one:
|
|
@@ -704,6 +726,7 @@ Browser options are `--no-build` and `--no-lighthouse`. Remote deployment accept
|
|
|
704
726
|
| `.cosmo/brand/` | Discovery, Entity Canon, and voice profile. |
|
|
705
727
|
| `.cosmo/copy/strategy.json` | Approved reader, positioning, voice, proof, and competitive-transition strategy. |
|
|
706
728
|
| `.cosmo/evidence.json` | Central claim and proof ledger. |
|
|
729
|
+
| `.cosmo/entities/` | EntityMap configuration, optional provider settings, accepted matches, and private candidates. |
|
|
707
730
|
| `.cosmo/intelligence/` | Active packs, artifacts, and private-package locks. |
|
|
708
731
|
| `.cosmo/build-plan.json` | Typed page architecture and link graph. |
|
|
709
732
|
| `.cosmo/work/pages/` | Per-page integrity briefs, Copy Studio briefs, and production artifacts. |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -24,6 +24,7 @@ Cosmo is a local orchestrator and validator. A generated Astro repository remain
|
|
|
24
24
|
| Pipeline state | Local `.cosmo/*.json` artifacts |
|
|
25
25
|
| Entity identity and voice | `.cosmo/brand/entity-canon.json` and `.cosmo/brand/voice-profile.json` |
|
|
26
26
|
| Claims, proof, and provenance | `.cosmo/evidence.json` |
|
|
27
|
+
| AI-readable entity publication | `.cosmo/entities/config.json`, accepted matches, canonical content, and EntityMap QA |
|
|
27
28
|
| Page purpose and site graph | Plan v3 architecture contract and its derived page brief |
|
|
28
29
|
| Optional domain and creative intelligence | `.cosmo/intelligence/selection.json`, selected pack manifests, and completed pack artifacts |
|
|
29
30
|
| Release deployment | Optional provider config plus the exact READY release ID; provider credentials remain external |
|
|
@@ -61,6 +62,8 @@ The seed carries a neutral home/about graph, keeps every route `noindex`, and ma
|
|
|
61
62
|
|
|
62
63
|
`cosmo content check` validates project-wide semantic contracts: canonical entity id, Plan v3 intent fidelity, governed links, voice boundaries, proof verification and provenance, generic and manipulative language policy, duplicated passages, and qualitative substance tiers. Its rules live in `.cosmo/policies/content-integrity.json`; the output is `.cosmo/reports/content-check.json`.
|
|
63
64
|
|
|
65
|
+
When enabled, `cosmo entity check` compiles EntityMap v1.0 from the Entity Canon and eligible final content. External services may suggest identifiers, but their candidates remain non-public until a named reviewer accepts them. The resulting JSON, HTML companion, discovery declarations, and QA report become part of release readiness without replacing Schema.org JSON-LD.
|
|
66
|
+
|
|
64
67
|
`cosmo check` builds the site and inspects generated HTML for:
|
|
65
68
|
|
|
66
69
|
- Missing or duplicate titles, descriptions, and H1s.
|
package/docs/DELIVERY.md
CHANGED
|
@@ -14,7 +14,7 @@ A project is ready only when all of the following are true:
|
|
|
14
14
|
- The Build Plan is approved and at least one route is explicitly indexable.
|
|
15
15
|
- The workflow is complete, including every approval.
|
|
16
16
|
- Generation is complete for the approved inventory.
|
|
17
|
-
- Integrity, content, intelligence, static, and
|
|
17
|
+
- Integrity, content, intelligence, static, browser, and enabled EntityMap reports all pass.
|
|
18
18
|
- Every report is newer than the source and portable Cosmo inputs it validates.
|
|
19
19
|
- The intelligence report was produced for the currently selected packs.
|
|
20
20
|
|
|
@@ -28,6 +28,7 @@ cosmo integrity check .
|
|
|
28
28
|
cosmo check . --no-build
|
|
29
29
|
cosmo content check .
|
|
30
30
|
cosmo intelligence check .
|
|
31
|
+
cosmo entity check .
|
|
31
32
|
cosmo browser check . --no-build
|
|
32
33
|
cosmo release check .
|
|
33
34
|
cosmo release show .
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# EntityMap
|
|
2
|
+
|
|
3
|
+
Cosmo can create an optional [EntityMap v1.0](https://entitymap.org/spec/v1.0) for a finished website. It describes the publisher, subjects, services, places, relationships, and short supporting passages in an AI-readable form.
|
|
4
|
+
|
|
5
|
+
EntityMap is an emerging publisher-assertion standard. It complements Schema.org JSON-LD, sitemaps, and visible content; it does not replace them and Cosmo does not promise a search-ranking benefit.
|
|
6
|
+
|
|
7
|
+
## Plain-language workflow
|
|
8
|
+
|
|
9
|
+
When beginning a site, the assistant asks whether the user wants an EntityMap. If selected, Cosmo:
|
|
10
|
+
|
|
11
|
+
1. Reads approved identity from the Entity Canon.
|
|
12
|
+
2. Reads eligible final pages and their primary topics.
|
|
13
|
+
3. Selects concise, extractive passages from those pages.
|
|
14
|
+
4. Builds `/entitymap.json` and `/entitymap.html`.
|
|
15
|
+
5. adds discovery through the page head, footer, robots.txt, and sitemap.
|
|
16
|
+
6. Checks attribution, identifiers, types, relationships, URLs, and chunk limits.
|
|
17
|
+
7. Leaves automated output marked `generator-draft` until the user explicitly reviews it.
|
|
18
|
+
|
|
19
|
+
Only indexable pages are included by default. Set `includeNoindex` only after deciding that publicly accessible noindex pages should be represented.
|
|
20
|
+
|
|
21
|
+
## Commands for advanced users
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cosmo entity init . --enable
|
|
25
|
+
cosmo entity build .
|
|
26
|
+
cosmo entity check .
|
|
27
|
+
cosmo entity approve . --by "Project Owner"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Approval records the reviewer and time, then changes the public status to `self-declared`. It never claims third-party certification.
|
|
31
|
+
|
|
32
|
+
## Optional enrichment
|
|
33
|
+
|
|
34
|
+
Wikidata is enabled by default and does not require a key. Google Knowledge Graph, Google Places, and TextRazor are available but disabled until the user chooses them.
|
|
35
|
+
|
|
36
|
+
Provider settings live in `.cosmo/entities/config.json`. Keys belong in a local ignored environment file:
|
|
37
|
+
|
|
38
|
+
```dotenv
|
|
39
|
+
COSMO_GOOGLE_KG_API_KEY=
|
|
40
|
+
COSMO_GOOGLE_PLACES_API_KEY=
|
|
41
|
+
COSMO_TEXTRAZOR_API_KEY=
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Run one provider at a time:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cosmo entity enrich wikidata .
|
|
48
|
+
cosmo entity enrich googleKnowledgeGraph . --env-file .env.local
|
|
49
|
+
cosmo entity enrich googlePlaces . --env-file .env.local
|
|
50
|
+
cosmo entity enrich textRazor . --env-file .env.local
|
|
51
|
+
cosmo entity candidates .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
External responses are reduced to candidate identifiers, labels, URLs, descriptions, scores, provider names, and retrieval dates. They do not overwrite the Entity Canon and are not published automatically.
|
|
55
|
+
|
|
56
|
+
After the user confirms a match, record that decision:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cosmo entity accept candidate-0123456789abcdef . --by "Project Owner"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Only accepted Wikidata or Wikipedia matches are eligible for a public `sameAs` field. Other accepted provider identifiers remain internal corroboration.
|
|
63
|
+
|
|
64
|
+
## Accuracy hierarchy
|
|
65
|
+
|
|
66
|
+
Cosmo resolves disagreements in this order:
|
|
67
|
+
|
|
68
|
+
1. User-confirmed first-party information.
|
|
69
|
+
2. Official documents and registries.
|
|
70
|
+
3. Captured primary-source research.
|
|
71
|
+
4. External knowledge APIs.
|
|
72
|
+
5. NLP extraction.
|
|
73
|
+
6. AI inference, which remains a candidate until reviewed.
|
|
74
|
+
|
|
75
|
+
An absent Google or Wikidata result is never treated as proof that a business, person, service, or concept does not exist.
|
|
76
|
+
|
|
77
|
+
## Repository files
|
|
78
|
+
|
|
79
|
+
| Path | Purpose |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `.cosmo/entities/config.json` | Feature status, review record, accepted matches, and provider settings. |
|
|
82
|
+
| `.cosmo/entities/candidates.json` | Private enrichment suggestions and their review state. |
|
|
83
|
+
| `.cosmo/reports/entity-check.json` | Deterministic conformance and integrity report. |
|
|
84
|
+
| `public/entitymap.json` | Generated machine-readable publication. |
|
|
85
|
+
| `public/entitymap.html` | Generated human- and crawler-readable companion. |
|
|
86
|
+
|
|
87
|
+
The two public files are generated artifacts. Edit canonical identity and page content instead of maintaining them by hand.
|
package/docs/ROADMAP.md
CHANGED
|
@@ -185,6 +185,15 @@ The acceptance pilot completed five generation entries, static and browser QA wi
|
|
|
185
185
|
- Backward-compatible Claude commands and durable handoffs between any named agents.
|
|
186
186
|
- Adapter conformance, starter, adoption, and packed-install smoke coverage.
|
|
187
187
|
|
|
188
|
+
## Milestone 20 — v1.11 evidence-controlled EntityMap (complete)
|
|
189
|
+
|
|
190
|
+
- Optional EntityMap v1.0 generation from canonical identity and eligible final page content.
|
|
191
|
+
- Machine-readable JSON and human-readable HTML companions with head, footer, robots, and sitemap discovery.
|
|
192
|
+
- Draft-versus-reviewed publication status with named human review and no fabricated certification.
|
|
193
|
+
- No-key Wikidata enrichment plus optional Google Knowledge Graph, Google Places, and TextRazor adapters.
|
|
194
|
+
- Private candidate review that prevents external services from overwriting the Entity Canon.
|
|
195
|
+
- EntityMap conformance, attribution, relationship, source, and freshness checks integrated into release readiness.
|
|
196
|
+
|
|
188
197
|
## Later, only when justified
|
|
189
198
|
|
|
190
199
|
- Additional deployment adapters, including Cloudflare Workers.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archangel70/cosmo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
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",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"templates/astro-site/.cosmo/build-plan.json",
|
|
18
18
|
"templates/astro-site/.cosmo/capabilities/**",
|
|
19
19
|
"templates/astro-site/.cosmo/evidence.json",
|
|
20
|
+
"templates/astro-site/.cosmo/entities/**",
|
|
20
21
|
"templates/astro-site/.cosmo/intelligence/selection.json",
|
|
21
22
|
"templates/astro-site/.cosmo/policies/**",
|
|
22
23
|
"templates/astro-site/.cosmo/project.json",
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"docs/FIRST-PARTY-CAPABILITIES.md",
|
|
50
51
|
"docs/GENERATION.md",
|
|
51
52
|
"docs/INTEGRITY.md",
|
|
53
|
+
"docs/ENTITY-MAP.md",
|
|
52
54
|
"docs/INTELLIGENCE-PACKS.md",
|
|
53
55
|
"docs/OPERATIONS.md",
|
|
54
56
|
"docs/PAGE-PRODUCTION.md",
|
|
@@ -78,11 +80,12 @@
|
|
|
78
80
|
"content:qa": "node packages/cli/bin/cosmo.mjs content check templates/astro-site",
|
|
79
81
|
"copy:qa": "node packages/cli/bin/cosmo.mjs copy check templates/astro-site",
|
|
80
82
|
"intelligence:qa": "node packages/cli/bin/cosmo.mjs intelligence check templates/astro-site",
|
|
83
|
+
"entity:qa": "node packages/cli/bin/cosmo.mjs entity check templates/astro-site",
|
|
81
84
|
"browser:qa": "node packages/cli/bin/cosmo.mjs browser check templates/astro-site",
|
|
82
85
|
"package:smoke": "node scripts/smoke-package.mjs",
|
|
83
86
|
"postinstall": "node scripts/postinstall.mjs",
|
|
84
87
|
"test": "node --test packages/cli/test/*.test.mjs",
|
|
85
|
-
"verify": "npm run test && npm run check && npm run integrity:qa && npm run qa && npm run copy:qa && npm run content:qa && npm run intelligence:qa && npm run browser:qa"
|
|
88
|
+
"verify": "npm run test && npm run check && npm run integrity:qa && npm run entity:qa && npm run qa && npm run copy:qa && npm run content:qa && npm run intelligence:qa && npm run browser:qa"
|
|
86
89
|
},
|
|
87
90
|
"dependencies": {
|
|
88
91
|
"axe-core": "^4.13.0",
|
|
@@ -16,6 +16,7 @@ import { diagnoseProject } from '../lib/doctor.mjs';
|
|
|
16
16
|
import { configureDeployment, deployProject, readDeploymentConfig, readDeploymentHistory } from '../lib/deployment.mjs';
|
|
17
17
|
import { evaluateIntelligence, writeIntelligenceReport } from '../lib/intelligence-audit.mjs';
|
|
18
18
|
import { createHandoff, readHandoff } from '../lib/handoff.mjs';
|
|
19
|
+
import { acceptEntityCandidate, approveEntityMap, enrichEntityMap, readEntityMapConfig, scaffoldEntityMap, writeEntityMap } from '../lib/entity-map.mjs';
|
|
19
20
|
import { checkIntegrity, createPageBrief, scaffoldIntegrity } from '../lib/integrity.mjs';
|
|
20
21
|
import { launcherGuide } from '../lib/launcher.mjs';
|
|
21
22
|
import {
|
|
@@ -63,7 +64,7 @@ import {
|
|
|
63
64
|
workflowSummary,
|
|
64
65
|
} from '../lib/workflow.mjs';
|
|
65
66
|
|
|
66
|
-
const VERSION = '1.
|
|
67
|
+
const VERSION = '1.11.0';
|
|
67
68
|
const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
68
69
|
const templateDirectory = path.resolve(cliDirectory, '../../../templates/astro-site');
|
|
69
70
|
const [command = 'start', ...rawArgs] = process.argv.slice(2);
|
|
@@ -85,8 +86,8 @@ Commands
|
|
|
85
86
|
cosmo agent install <claude|codex|antigravity|all> [--replace]
|
|
86
87
|
cosmo agent status [claude|codex|antigravity|all]
|
|
87
88
|
cosmo agent uninstall <claude|codex|antigravity|all>
|
|
88
|
-
cosmo init [directory] [--name slug] [--brand name] [--site url] [--profile id]
|
|
89
|
-
cosmo adopt [directory] [--name slug] [--brand name] [--site url] [--profile id] [--design-mode mode]
|
|
89
|
+
cosmo init [directory] [--name slug] [--brand name] [--site url] [--profile id] [--entity-map]
|
|
90
|
+
cosmo adopt [directory] [--name slug] [--brand name] [--site url] [--profile id] [--design-mode mode] [--entity-map]
|
|
90
91
|
cosmo claude install [--replace]
|
|
91
92
|
cosmo claude status
|
|
92
93
|
cosmo claude uninstall
|
|
@@ -122,6 +123,13 @@ Commands
|
|
|
122
123
|
cosmo research init [directory] [--replace]
|
|
123
124
|
cosmo research capture <source-id> <snapshot> [directory] --kind type --location value [--captured-at date] [--replace]
|
|
124
125
|
cosmo research check [directory]
|
|
126
|
+
cosmo entity init [directory] [--enable] [--replace]
|
|
127
|
+
cosmo entity build [directory]
|
|
128
|
+
cosmo entity check [directory]
|
|
129
|
+
cosmo entity enrich <wikidata|googleKnowledgeGraph|googlePlaces|textRazor> [directory] [--env-file path]
|
|
130
|
+
cosmo entity candidates [directory]
|
|
131
|
+
cosmo entity accept <candidate-id> [directory] --by name
|
|
132
|
+
cosmo entity approve [directory] --by name
|
|
125
133
|
cosmo brief create <page-id> [directory] [--replace]
|
|
126
134
|
cosmo brief create --all [directory] [--replace]
|
|
127
135
|
cosmo workflow list [directory]
|
|
@@ -199,6 +207,7 @@ async function init(args) {
|
|
|
199
207
|
const evidenceFile = path.join(target, '.cosmo', 'evidence.json');
|
|
200
208
|
const evidence = JSON.parse(fs.readFileSync(evidenceFile, 'utf8'));
|
|
201
209
|
writeJson(evidenceFile, { ...evidence, entityId });
|
|
210
|
+
scaffoldEntityMap(target, { enabled: Boolean(options['entity-map']), replace: true });
|
|
202
211
|
const planFile = path.join(target, '.cosmo', 'build-plan.json');
|
|
203
212
|
const plan = JSON.parse(fs.readFileSync(planFile, 'utf8'));
|
|
204
213
|
for (const page of plan.pages) page.contract.strengthensEntity = entityId;
|
|
@@ -318,10 +327,17 @@ function setup(args) {
|
|
|
318
327
|
if (failed) process.exitCode = 1;
|
|
319
328
|
}
|
|
320
329
|
|
|
330
|
+
function prepareEntityMap(target) {
|
|
331
|
+
const result = writeEntityMap(target);
|
|
332
|
+
if (!result.report.passed) throw new Error(`EntityMap has ${result.report.summary.blocking} blocking finding(s). Run cosmo entity check .`);
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
|
|
321
336
|
async function build(args) {
|
|
322
337
|
const { positional } = parseOptions(args);
|
|
323
338
|
const target = projectDirectory(positional[0] ?? '.');
|
|
324
339
|
readProject(target);
|
|
340
|
+
prepareEntityMap(target);
|
|
325
341
|
await run('npm', ['run', 'build'], { cwd: target });
|
|
326
342
|
}
|
|
327
343
|
|
|
@@ -329,6 +345,7 @@ async function dev(args) {
|
|
|
329
345
|
const { positional } = parseOptions(args);
|
|
330
346
|
const target = projectDirectory(positional[0] ?? '.');
|
|
331
347
|
readProject(target);
|
|
348
|
+
prepareEntityMap(target);
|
|
332
349
|
await run('npm', ['run', 'dev'], { cwd: target });
|
|
333
350
|
}
|
|
334
351
|
|
|
@@ -336,6 +353,7 @@ async function check(args) {
|
|
|
336
353
|
const { options, positional } = parseOptions(args);
|
|
337
354
|
const target = projectDirectory(positional[0] ?? '.');
|
|
338
355
|
readProject(target);
|
|
356
|
+
prepareEntityMap(target);
|
|
339
357
|
if (!options['no-build']) await run('npm', ['run', 'build'], { cwd: target });
|
|
340
358
|
const report = auditDist(path.join(target, 'dist'));
|
|
341
359
|
const reportFile = writeAuditReport(target, report);
|
|
@@ -441,6 +459,7 @@ async function browserCheck(args) {
|
|
|
441
459
|
const { options, positional } = parseOptions(args);
|
|
442
460
|
const target = projectDirectory(positional[0] ?? '.');
|
|
443
461
|
readProject(target);
|
|
462
|
+
prepareEntityMap(target);
|
|
444
463
|
if (!options['no-build']) await run('npm', ['run', 'build'], { cwd: target });
|
|
445
464
|
const server = await staticServer(target);
|
|
446
465
|
const port = server.address().port;
|
|
@@ -474,6 +493,7 @@ function status(args) {
|
|
|
474
493
|
console.log(` intelligence: ${result.intelligence.profile} · ${result.intelligence.packs.length ? result.intelligence.packs.join(', ') : 'no selected packs'}${result.intelligence.installedPackages.length ? ` · ${result.intelligence.installedPackages.length} imported` : ''}`);
|
|
475
494
|
console.log(` plan: ${result.plan ? `${result.plan.pages} pages · ${result.plan.approved ? 'approved' : 'draft'}` : 'missing'}`);
|
|
476
495
|
console.log(` generation: ${result.generation ? `${result.generation.pages} pages · ${result.generation.complete ? 'complete' : 'active'}` : 'not started'}`);
|
|
496
|
+
console.log(` entity map: ${result.entityMap.enabled ? 'enabled' : 'disabled'}`);
|
|
477
497
|
console.log(` qa: ${Object.entries(result.qa).map(([name, report]) => `${name.replace('-check', '')}=${report ? report.status ?? (report.passed ? 'passed' : 'failed') : 'missing'}`).join(' ')}`);
|
|
478
498
|
console.log(` release: ${result.release?.releaseId ?? 'unavailable'} · ${result.release?.ready ? 'ready' : `${result.release?.blocking ?? '?'} blocking`}`);
|
|
479
499
|
console.log(` deployment: ${result.deployment ? `${result.deployment.provider}${result.deployment.latest ? ` · last ${result.deployment.latest.status}` : ' · never deployed'}` : 'not configured'}`);
|
|
@@ -530,6 +550,65 @@ function researchCommand(args) {
|
|
|
530
550
|
throw new Error(`Unknown research command: ${subcommand}`);
|
|
531
551
|
}
|
|
532
552
|
|
|
553
|
+
async function entityCommand(args) {
|
|
554
|
+
const subcommand = args[0] ?? 'check';
|
|
555
|
+
const rest = args.slice(1);
|
|
556
|
+
if (subcommand === 'init') {
|
|
557
|
+
const { options, positional } = parseOptions(rest);
|
|
558
|
+
const result = scaffoldEntityMap(projectDirectory(positional[0] ?? '.'), { enabled: Boolean(options.enable), replace: Boolean(options.replace) });
|
|
559
|
+
console.log(`${result.created ? 'Created' : 'Updated'} EntityMap configuration: ${result.file}`);
|
|
560
|
+
console.log(`EntityMap is ${result.data.enabled ? 'enabled' : 'disabled'}.`);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (subcommand === 'build' || subcommand === 'check') {
|
|
564
|
+
const { positional } = parseOptions(rest);
|
|
565
|
+
const target = projectDirectory(positional[0] ?? '.');
|
|
566
|
+
const result = writeEntityMap(target);
|
|
567
|
+
console.log(`EntityMap: ${result.report.enabled ? `${result.report.summary.entities} entities, ${result.report.summary.chunks} chunks` : 'disabled'}, ${result.report.summary.blocking} blocking, ${result.report.summary.warnings} warnings`);
|
|
568
|
+
console.log(`Report: ${result.reportFile}`);
|
|
569
|
+
if (result.jsonFile) console.log(`Published sources: ${result.jsonFile} and ${result.htmlFile}`);
|
|
570
|
+
for (const item of result.report.findings) console.log(` ${item.severity}: ${item.code} — ${item.message}`);
|
|
571
|
+
if (!result.report.passed) process.exitCode = 1;
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (subcommand === 'enrich') {
|
|
575
|
+
const { options, positional } = parseOptions(rest);
|
|
576
|
+
if (!positional[0]) throw new Error('Usage: cosmo entity enrich <provider> [directory] [--env-file path]');
|
|
577
|
+
if (options['env-file']) process.loadEnvFile(path.resolve(String(options['env-file'])));
|
|
578
|
+
const result = await enrichEntityMap(projectDirectory(positional[1] ?? '.'), positional[0]);
|
|
579
|
+
console.log(`${result.provider}: ${result.candidates.length} candidates saved for human review.`);
|
|
580
|
+
console.log(`Candidates: ${result.file}`);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (subcommand === 'candidates') {
|
|
584
|
+
const { positional } = parseOptions(rest);
|
|
585
|
+
const target = projectDirectory(positional[0] ?? '.');
|
|
586
|
+
readEntityMapConfig(target);
|
|
587
|
+
const file = path.join(target, '.cosmo', 'entities', 'candidates.json');
|
|
588
|
+
const data = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf8')) : { candidates: [] };
|
|
589
|
+
if (!data.candidates.length) console.log('No EntityMap enrichment candidates.');
|
|
590
|
+
for (const item of data.candidates) console.log(`${item.id} ${item.status.padEnd(12)} ${item.provider.padEnd(22)} ${item.entityId} → ${item.matchedName}`);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (subcommand === 'accept') {
|
|
594
|
+
const { options, positional } = parseOptions(rest);
|
|
595
|
+
if (!positional[0]) throw new Error('Usage: cosmo entity accept <candidate-id> [directory] --by name');
|
|
596
|
+
const item = acceptEntityCandidate(projectDirectory(positional[1] ?? '.'), positional[0], options.by);
|
|
597
|
+
console.log(`Accepted ${item.matchedName} for ${item.entityId}; the reviewer and source were recorded.`);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (subcommand === 'approve') {
|
|
601
|
+
const { options, positional } = parseOptions(rest);
|
|
602
|
+
const target = projectDirectory(positional[0] ?? '.');
|
|
603
|
+
const review = approveEntityMap(target, options.by);
|
|
604
|
+
const result = writeEntityMap(target);
|
|
605
|
+
console.log(`EntityMap reviewed by ${review.reviewedBy} at ${review.reviewedAt}.`);
|
|
606
|
+
console.log(`Published ${result.report.summary.entities} approved entities.`);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
throw new Error(`Unknown entity command: ${subcommand}`);
|
|
610
|
+
}
|
|
611
|
+
|
|
533
612
|
function intake(args) {
|
|
534
613
|
const { options, positional } = parseOptions(args);
|
|
535
614
|
const target = projectDirectory(positional[0] ?? '.');
|
|
@@ -915,6 +994,7 @@ function releaseCommand(args) {
|
|
|
915
994
|
const { positional } = parseOptions(args.slice(1));
|
|
916
995
|
const target = projectDirectory(positional[0] ?? '.');
|
|
917
996
|
if (subcommand === 'check') {
|
|
997
|
+
prepareEntityMap(target);
|
|
918
998
|
const report = evaluateDelivery(target);
|
|
919
999
|
const files = writeDeliveryReport(target, report);
|
|
920
1000
|
console.log(`Delivery: ${report.ready ? 'READY' : 'BLOCKED'}, release ${report.releaseId}, ${report.summary.blocking} blockers`);
|
|
@@ -964,6 +1044,7 @@ async function deployCommand(args) {
|
|
|
964
1044
|
const { options, positional } = parseOptions(rest);
|
|
965
1045
|
const target = projectDirectory(positional[0] ?? '.');
|
|
966
1046
|
readProject(target);
|
|
1047
|
+
prepareEntityMap(target);
|
|
967
1048
|
if (!options['no-build']) await run('npm', ['run', 'build'], { cwd: target });
|
|
968
1049
|
await run('npm', ['run', 'preview', '--', '--host', '127.0.0.1'], { cwd: target });
|
|
969
1050
|
return;
|
|
@@ -971,6 +1052,7 @@ async function deployCommand(args) {
|
|
|
971
1052
|
if (['preview', 'production'].includes(subcommand)) {
|
|
972
1053
|
const { options, positional } = parseOptions(rest);
|
|
973
1054
|
const target = projectDirectory(positional[0] ?? '.');
|
|
1055
|
+
prepareEntityMap(target);
|
|
974
1056
|
const record = await deployProject(target, subcommand, { build: !options['no-build'], envFile: options['env-file'] });
|
|
975
1057
|
console.log(`${subcommand === 'production' ? 'Production' : 'Preview'} deployed: ${record.url ?? record.remoteDir ?? 'URL unavailable in provider output'}`);
|
|
976
1058
|
console.log(`Release: ${record.releaseId}${record.releaseReady ? ' (READY)' : ' (preview of blocked release)'}`);
|
|
@@ -1012,6 +1094,7 @@ async function main() {
|
|
|
1012
1094
|
if (command === 'doctor') return doctorCommand(rawArgs);
|
|
1013
1095
|
if (command === 'brand') return brandCommand(rawArgs);
|
|
1014
1096
|
if (command === 'research') return researchCommand(rawArgs);
|
|
1097
|
+
if (command === 'entity') return entityCommand(rawArgs);
|
|
1015
1098
|
if (command === 'intake') return intake(rawArgs);
|
|
1016
1099
|
if (command === 'design' && rawArgs[0] === 'brief') return designBrief(rawArgs.slice(1));
|
|
1017
1100
|
if (command === 'design' && rawArgs[0] === 'capture') return designCapture(rawArgs.slice(1));
|
|
@@ -2,12 +2,14 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { applyIntelligenceProfile } from './intelligence.mjs';
|
|
4
4
|
import { scaffoldCopyStudio } from './copy-studio.mjs';
|
|
5
|
+
import { scaffoldEntityMap } from './entity-map.mjs';
|
|
5
6
|
import { slugify, writeJson } from './project.mjs';
|
|
6
7
|
|
|
7
8
|
const GOVERNANCE_PATHS = [
|
|
8
9
|
'.cosmo/brand',
|
|
9
10
|
'.cosmo/capabilities',
|
|
10
11
|
'.cosmo/intelligence/selection.json',
|
|
12
|
+
'.cosmo/entities',
|
|
11
13
|
'.cosmo/policies',
|
|
12
14
|
'.cosmo/workflows',
|
|
13
15
|
];
|
|
@@ -86,6 +88,7 @@ export function adoptAstroProject(templateDirectory, target, options = {}) {
|
|
|
86
88
|
writeJson(voiceFile, { ...voice, entityId: slugify(brand) });
|
|
87
89
|
applyIntelligenceProfile(resolved, profile);
|
|
88
90
|
scaffoldCopyStudio(resolved);
|
|
91
|
+
scaffoldEntityMap(resolved, { enabled: Boolean(options['entity-map']), replace: true });
|
|
89
92
|
|
|
90
93
|
const guides = ['CLAUDE.md', 'AGENTS.md'].map((file) => installAgentGuide(templateDirectory, resolved, file)).filter(Boolean);
|
|
91
94
|
guides.push(...installAgentAdapters(templateDirectory, resolved));
|
|
@@ -17,6 +17,7 @@ function routeForFile(distDir, file) {
|
|
|
17
17
|
const relative = path.relative(distDir, file).split(path.sep).join('/');
|
|
18
18
|
if (relative === 'index.html') return '/';
|
|
19
19
|
if (relative.endsWith('/index.html')) return `/${relative.slice(0, -'index.html'.length)}`;
|
|
20
|
+
if (relative === 'entitymap.html') return '/entitymap.html';
|
|
20
21
|
return `/${relative.replace(/\.html$/, '')}`;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -24,6 +25,7 @@ function normalizeRoute(href) {
|
|
|
24
25
|
const pathname = href.split('#')[0].split('?')[0];
|
|
25
26
|
if (!pathname) return null;
|
|
26
27
|
if (pathname === '/') return '/';
|
|
28
|
+
if (/\/[^/]+\.[a-z0-9]+$/i.test(pathname)) return pathname;
|
|
27
29
|
return pathname.endsWith('/') ? pathname : `${pathname}/`;
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -126,6 +128,20 @@ export function auditDist(distDir) {
|
|
|
126
128
|
if (!fs.existsSync(robotsFile)) warnings.push({ rule: 'missing-robots' });
|
|
127
129
|
else if (!/^Sitemap:\s*https?:\/\//im.test(fs.readFileSync(robotsFile, 'utf8'))) warnings.push({ rule: 'robots-missing-sitemap' });
|
|
128
130
|
|
|
131
|
+
const entityJsonFile = path.join(distDir, 'entitymap.json');
|
|
132
|
+
const entityHtmlFile = path.join(distDir, 'entitymap.html');
|
|
133
|
+
if (fs.existsSync(entityJsonFile)) {
|
|
134
|
+
if (!fs.existsSync(entityHtmlFile)) critical.push({ rule: 'entitymap-html-missing' });
|
|
135
|
+
try {
|
|
136
|
+
const entityMap = JSON.parse(fs.readFileSync(entityJsonFile, 'utf8'));
|
|
137
|
+
if (entityMap.version !== '1.0' || entityMap.schema !== 'https://entitymap.org/spec/v1.0' || !entityMap.publisher?.name || !Array.isArray(entityMap.entities) || entityMap.entities.length === 0) critical.push({ rule: 'entitymap-invalid-root' });
|
|
138
|
+
} catch (error) { critical.push({ rule: 'entitymap-invalid-json', detail: error.message }); }
|
|
139
|
+
if (!fs.existsSync(robotsFile) || !/^EntityMap:\s*https?:\/\//im.test(fs.readFileSync(robotsFile, 'utf8'))) warnings.push({ rule: 'robots-missing-entitymap' });
|
|
140
|
+
for (const file of htmlFiles.filter((item) => item !== entityHtmlFile)) {
|
|
141
|
+
if (!/<link\s+[^>]*rel=["']entitymap["'][^>]*>/i.test(fs.readFileSync(file, 'utf8'))) warnings.push({ route: routeForFile(distDir, file), rule: 'page-missing-entitymap-discovery' });
|
|
142
|
+
}
|
|
143
|
+
} else if (fs.existsSync(entityHtmlFile)) critical.push({ rule: 'entitymap-json-missing' });
|
|
144
|
+
|
|
129
145
|
if (htmlFiles.length === 0) critical.push({ rule: 'no-html-output' });
|
|
130
146
|
return {
|
|
131
147
|
passed: critical.length === 0,
|
|
@@ -24,6 +24,7 @@ function routeForFile(distDir, file) {
|
|
|
24
24
|
const relative = path.relative(distDir, file).split(path.sep).join('/');
|
|
25
25
|
if (relative === 'index.html') return '/';
|
|
26
26
|
if (relative.endsWith('/index.html')) return `/${relative.slice(0, -'index.html'.length)}`;
|
|
27
|
+
if (relative === 'entitymap.html') return '/entitymap.html';
|
|
27
28
|
return `/${relative.replace(/\.html$/, '')}`;
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -44,7 +44,7 @@ function sourceFiles(projectDir) {
|
|
|
44
44
|
path.join(projectDir, '.cosmo', 'policies'),
|
|
45
45
|
path.join(projectDir, '.cosmo', 'work'),
|
|
46
46
|
];
|
|
47
|
-
const direct = ['.cosmo/project.json', '.cosmo/build-plan.json', '.cosmo/evidence.json', 'DESIGN-DIRECTION.md', 'cosmo.config.mjs', 'astro.config.mjs', 'package.json', 'package-lock.json', 'tsconfig.json']
|
|
47
|
+
const direct = ['.cosmo/project.json', '.cosmo/build-plan.json', '.cosmo/evidence.json', '.cosmo/entities/config.json', 'DESIGN-DIRECTION.md', 'cosmo.config.mjs', 'astro.config.mjs', 'package.json', 'package-lock.json', 'tsconfig.json']
|
|
48
48
|
.map((relative) => path.join(projectDir, relative))
|
|
49
49
|
.filter((file) => fs.existsSync(file));
|
|
50
50
|
return [...roots.flatMap(filesBelow), ...direct];
|
|
@@ -94,7 +94,8 @@ export function evaluateDelivery(projectDir) {
|
|
|
94
94
|
const progress = optionalJson(path.join(projectDir, '.cosmo', 'progress.json'));
|
|
95
95
|
if (!progress || progress.invalid || progress.complete !== true) findings.push(finding('generation-incomplete', progress?.invalid ? 'Generation state is invalid.' : 'Generation is missing or incomplete.', 'Finish or reconcile every planned page through the generation pipeline.'));
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const entityConfig = optionalJson(path.join(projectDir, '.cosmo', 'entities', 'config.json'));
|
|
98
|
+
const requiredReports = [...BASE_REQUIRED_REPORTS, ...(fs.existsSync(path.join(projectDir, '.cosmo', 'copy', 'strategy.json')) ? ['copy-check'] : []), ...(entityConfig?.enabled ? ['entity-check'] : [])];
|
|
98
99
|
const reports = requiredReports.map((name) => {
|
|
99
100
|
const file = path.join(projectDir, '.cosmo', 'reports', `${name}.json`);
|
|
100
101
|
const data = optionalJson(file);
|