@archangel70/cosmo 1.7.0 → 1.10.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +117 -88
  3. package/docs/AGENT-HANDOFF.md +8 -8
  4. package/docs/ARCHITECTURE.md +3 -3
  5. package/docs/CONTENT-QA.md +2 -0
  6. package/docs/COPY-STUDIO.md +154 -0
  7. package/docs/FIRST-PARTY-CAPABILITIES.md +1 -1
  8. package/docs/GENERATION.md +1 -1
  9. package/docs/INTELLIGENCE-PACKS.md +2 -2
  10. package/docs/MULTI-AGENT.md +69 -0
  11. package/docs/PAGE-PRODUCTION.md +2 -0
  12. package/docs/ROADMAP.md +10 -0
  13. package/package.json +9 -3
  14. package/packages/cli/bin/cosmo.mjs +150 -18
  15. package/packages/cli/lib/adoption.mjs +21 -0
  16. package/packages/cli/lib/agent-adapters.mjs +124 -0
  17. package/packages/cli/lib/claude-plugin.mjs +4 -0
  18. package/packages/cli/lib/copy-studio.mjs +355 -0
  19. package/packages/cli/lib/delivery.mjs +4 -2
  20. package/packages/cli/lib/editorial-guidance.mjs +17 -0
  21. package/packages/cli/lib/generation.mjs +6 -2
  22. package/packages/cli/lib/intelligence-audit.mjs +22 -5
  23. package/packages/cli/lib/intelligence.mjs +14 -2
  24. package/packages/cli/lib/launcher.mjs +111 -0
  25. package/packages/cli/lib/project.mjs +2 -0
  26. package/packages/cli/lib/status.mjs +1 -1
  27. package/plugins/agent-skills/cosmo/.cosmo-agent.json +4 -0
  28. package/plugins/agent-skills/cosmo/SKILL.md +79 -0
  29. package/plugins/antigravity/cosmo.md +19 -0
  30. package/plugins/claude-code/cosmo/.claude-plugin/plugin.json +2 -2
  31. package/plugins/claude-code/cosmo/agents/cosmo.md +45 -0
  32. package/plugins/claude-code/cosmo/skills/cosmo/SKILL.md +16 -4
  33. package/plugins/claude-code/cosmo/skills/cosmo-help/SKILL.md +20 -6
  34. package/scripts/postinstall.mjs +10 -8
  35. package/templates/astro-site/.agents/rules/cosmo.md +3 -0
  36. package/templates/astro-site/.agents/skills/cosmo/SKILL.md +18 -0
  37. package/templates/astro-site/.agents/workflows/cosmo.md +3 -0
  38. package/templates/astro-site/.cosmo/workflows/default.json +15 -2
  39. package/templates/astro-site/AGENTS.md +12 -6
  40. package/templates/astro-site/CLAUDE.md +3 -2
  41. package/templates/astro-site/README.md +1 -1
  42. package/templates/astro-site/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ # Copy Studio
2
+
3
+ Copy Studio turns approved business facts, audience understanding, positioning, and evidence into a page-specific writing contract for Claude or another agent. It gives the writer room to create while preventing unsupported claims, generic page formulas, manipulative pressure, and strategy drift.
4
+
5
+ Copy Studio is built into Cosmo. It does not require Lyra, Sonic, a hosted service, or access to private source material.
6
+
7
+ ## The simple workflow
8
+
9
+ When using Cosmo conversationally, invoke it in Claude with `cosmo`, in Codex with `$cosmo`, or in Antigravity with `/cosmo`, then answer the assistant's questions. The selected assistant handles these files and commands for you.
10
+
11
+ The writing process is:
12
+
13
+ 1. Understand the reader's situation and current alternative.
14
+ 2. Record what the reader presently believes and what the evidence can credibly help them understand.
15
+ 3. Define the meaningful benefit, credible difference, category, voice, and proof.
16
+ 4. Decide whether the copy needs to help the reader reconsider a current solution. If so, use factual questions or documented friction—not fear, invented weakness, or personal attack.
17
+ 5. Approve the project strategy.
18
+ 6. Create and approve a flexible brief for each planned page.
19
+ 7. Let the selected writing agent draft from the brief in separate writing, evidence, editing, and reader-review passes.
20
+ 8. Run Copy Studio QA before release.
21
+
22
+ ## Files
23
+
24
+ ### Project strategy
25
+
26
+ `.cosmo/copy/strategy.json` records:
27
+
28
+ - Primary audience and current alternative.
29
+ - Starting and desired beliefs.
30
+ - Motivation and practical ability to change.
31
+ - Meaningful benefit, category, and credible differentiation.
32
+ - Project-owned voice techniques and language boundaries.
33
+ - Optional competitive-transition strategy.
34
+ - Evidence IDs and a named human owner.
35
+ - Non-negotiable safeguards against fabricated claims and manipulation.
36
+
37
+ The switching state is derived from two separately recorded observations:
38
+
39
+ | Motivation to change | Ability to change | Cosmo state | Practical implication |
40
+ | --- | --- | --- | --- |
41
+ | High | High | `mobile` | Make the choice and proof clear. |
42
+ | Low | High | `content` | Establish why reconsideration is worthwhile. |
43
+ | Low | Low | `committed` | Do not force conversion; reduce risk and build understanding. |
44
+ | High | Low | `constrained` | Address migration, cost, timing, or implementation barriers. |
45
+ | Unknown | Unknown | `unknown` | Research instead of pretending to know. |
46
+
47
+ Cosmo rejects a state that contradicts its motivation and ability inputs.
48
+
49
+ ### Page copy briefs
50
+
51
+ `.cosmo/work/pages/<page-id>/copy-brief.json` translates strategy into an annotated page contract:
52
+
53
+ - Reader entry point, primary question, page job, angle, and objections.
54
+ - Awareness and switching context.
55
+ - Positioning and evidence assigned to the page.
56
+ - An open-ended section list with purpose, answer target, word budget, claims, proof, technique, transition, and CTA role.
57
+ - Revision owner, factual-preservation promise, and change log.
58
+
59
+ The section contract is intentionally flexible. It does not require every site or page to use the same six-section copy formula.
60
+
61
+ ## Commands
62
+
63
+ Initialize Copy Studio in an older Cosmo project:
64
+
65
+ ```bash
66
+ cosmo copy init .
67
+ ```
68
+
69
+ After the site plan is approved, create page briefs:
70
+
71
+ ```bash
72
+ cosmo copy brief --all .
73
+ ```
74
+
75
+ To regenerate one brief after an intentional strategy or plan change:
76
+
77
+ ```bash
78
+ cosmo copy brief home . --replace
79
+ ```
80
+
81
+ Once the strategy and page brief are complete and approved, print the agent's grounded writing instructions:
82
+
83
+ ```bash
84
+ cosmo copy guide home .
85
+ ```
86
+
87
+ Validate every strategy and brief:
88
+
89
+ ```bash
90
+ cosmo copy check .
91
+ ```
92
+
93
+ The check writes `.cosmo/reports/copy-check.json`. When Copy Studio is enabled, a current passing report is required for release.
94
+
95
+ ## Writing passes
96
+
97
+ The generated guide separates jobs that are easy to blur together:
98
+
99
+ 1. **Grounding:** read approved facts, evidence, source manifests, voice, and the copy brief.
100
+ 2. **Drafting:** answer first, add useful depth, and keep the reader as protagonist.
101
+ 3. **Evidence:** verify factual and comparative claims and place proof where the claim appears.
102
+ 4. **Editing:** improve structure, transitions, specificity, rhythm, and redundancy without changing facts.
103
+ 5. **Reader review:** test whether the message meets the recorded starting belief and earns its CTA.
104
+ 6. **Finalization:** record material changes and rerun QA.
105
+
106
+ ## Contextual editorial review
107
+
108
+ Copy Studio's writing guide now includes a minimum-edit review: facts and evidence take priority over page purpose and positioning, followed by brand voice, then style preferences. Keep strong sentences and deliberate personality intact.
109
+
110
+ The built-in `editorial-naturalness` pack flags clusters of possible filler, vague praise, unsupported attribution, faux-insight setups, redundant asides, and recap openers. Its report includes page and file identifiers, matched wording, surrounding excerpts, and suggestions. These are advisory observations, not proof of AI authorship or a quality score. The audit never edits prose.
111
+
112
+ For existing projects, enable the pack if needed:
113
+
114
+ ```bash
115
+ cosmo intelligence add editorial-naturalness .
116
+ cosmo intelligence scaffold .
117
+ cosmo intelligence check .
118
+ ```
119
+
120
+ Complete the pack's artifact with owned voice samples, a review owner, and the desired cluster threshold. Existing selections remain valid. `allowedPatterns` accepts pattern IDs such as `not-just-but` to exempt intentional choices. Record the reason for each exception in the page's revision change log. Other checks remain active.
121
+
122
+ The editor also asks whether generic sentences could describe almost any business, whether terminology has shifted unnecessarily, and whether every sentence contributes. These require contextual judgment; they are not claimed as automated detections. Replace filler only with verified details. Never invent a statistic or anecdote to satisfy a style rule.
123
+
124
+ Useful comparisons, technical terms, FAQs, rhetorical questions, passive voice, fragments, summaries, and punctuation remain available. There are no universal word bans or punctuation quotas in this review. Explicit project voice restrictions and evidence rules still apply.
125
+
126
+ For material edits, record the original and revised passages, reason, affected claim/proof IDs, and reviewer in `revision.changeLog`. Changes to claims, qualifications, positioning, CTAs, or approved voice require human review. Rerun evidence and copy checks after accepted edits. `cosmo copy check` validates contracts; `cosmo intelligence check` supplies the selected naturalness pack's prose observations.
127
+
128
+ ## Competitive transition
129
+
130
+ Competitive transition is optional. It helps copy address the honest reason a reader remains with a current category or solution. It requires:
131
+
132
+ - The current alternative.
133
+ - A documented vulnerability in the reader's present situation.
134
+ - A truthful question or friction-based reframe.
135
+ - A clear category distinction.
136
+ - A proof bridge showing why the new promise is credible.
137
+ - Migration support that makes change realistically possible.
138
+
139
+ Named competitors require the explicit `named-with-proof` policy and verified evidence. Category-level comparison is the default. Copy Studio does not authorize false claims, impersonation, copied language, fear tactics, fabricated dissatisfaction, or attacks on people.
140
+
141
+ ## What the check blocks
142
+
143
+ - Unapproved strategies or page briefs.
144
+ - Missing audience, belief, positioning, or ownership decisions.
145
+ - Contradictory switching assessments.
146
+ - Unknown or unverified proof IDs.
147
+ - Named comparisons without explicit evidence-backed approval.
148
+ - Claims or proofs that were not planned for the page.
149
+ - Planned claims or proofs that were never placed in a section.
150
+ - Missing answer-first value.
151
+ - CTA pressure above the page's funnel-stage ceiling.
152
+ - A revision process that does not preserve approved facts.
153
+
154
+ The report lists deterministic findings rather than presenting a subjective “great copy” score.
@@ -30,7 +30,7 @@ cosmo intelligence guide plan ./site
30
30
  cosmo intelligence check ./site
31
31
  ```
32
32
 
33
- `cosmo intelligence guide` exposes the selected first-party questions and Claude/Codex instructions at the current stage. Completed artifacts remain repository-owned and portable across agents.
33
+ `cosmo intelligence guide` exposes selected first-party questions with build and review guidance, or guidance for a named supported agent with `--agent`. Completed artifacts remain repository-owned and portable across agents.
34
34
 
35
35
  ## Research workbench
36
36
 
@@ -50,7 +50,7 @@ cosmo generate status .
50
50
 
51
51
  Generation progress v2 moves through `planned`, `briefed`, `sourced`, `outlined`, `drafted`, `edited`, `verified`, and `done`. See `docs/PAGE-PRODUCTION.md` for the artifact required by each transition.
52
52
 
53
- The queue is deliberately model-neutral. A Claude-led build can use Claude Design for visual exploration and Claude for content work; a later Codex session can continue from the same plan, progress ledger, content schema, and design documentation without access to the earlier conversation.
53
+ The queue is deliberately model-neutral. A build may use Claude Design, another agent, or a human for visual exploration and any capable writing agent for content work. A later Claude, Codex, or Antigravity session can continue from the same plan, progress ledger, content schema, and design documentation without access to the earlier conversation.
54
54
 
55
55
  ## Completion gates
56
56
 
@@ -37,7 +37,7 @@ A profile is only a convenient composition. Adding or removing a single pack cha
37
37
  | `image-direction` | Design | `.cosmo/design/image-direction.json` |
38
38
  | `claude-design` | Design | `.cosmo/design/claude-design-handoff.json` |
39
39
 
40
- The local pack manifest includes its discovery questions, Claude guidance, Codex continuation guidance, required keys, and artifact template. Workflow submission validates selected packs at their declared stage. Direct generation rechecks every upstream pack gate, so the workflow cannot be bypassed accidentally.
40
+ The local pack manifest includes its discovery questions, agent or role guidance, required keys, and artifact template. Older Claude/Codex guidance remains supported; new packs may provide `default`, `build`, `review`, or named-agent entries. Workflow submission validates selected packs at their declared stage. Direct generation rechecks every upstream pack gate, so the workflow cannot be bypassed accidentally.
41
41
 
42
42
  ## v1.1 evaluation
43
43
 
@@ -111,7 +111,7 @@ Imported packs may use only four artifact rules: `non-empty`, `equals`, `min-ite
111
111
  "capability": { "id": "conversion-evidence", "version": 1, "status": "active", "stages": ["plan", "qa"] },
112
112
  "questions": ["Which conversion decision is supported by evidence?"],
113
113
  "artifact": { "stage": "plan", "path": ".cosmo/intelligence/artifacts/conversion-evidence/evidence.json", "requiredKeys": ["version", "hypotheses"], "nonEmptyKeys": ["hypotheses"], "template": { "version": 1, "hypotheses": [] } },
114
- "guidance": { "claude": "Document assumptions before designing.", "codex": "Preserve approved experiment ids." },
114
+ "guidance": { "default": "Document assumptions before designing.", "review": "Preserve approved experiment ids." },
115
115
  "checks": [{ "id": "enough-hypotheses", "severity": "blocking", "path": "hypotheses", "rule": "min-items", "min": 2, "message": "Record at least two hypotheses." }]
116
116
  }
117
117
  }
@@ -0,0 +1,69 @@
1
+ # Multi-agent Cosmo
2
+
3
+ Cosmo separates its deterministic website engine from the conversational agent that operates it. Project truth lives in `.cosmo`, typed Astro content, design artifacts, QA reports, and `HANDOFF.md`; it does not depend on one vendor's chat history.
4
+
5
+ ## Supported agents
6
+
7
+ | Agent | Installed adapter | Deterministic invocation |
8
+ | --- | --- | --- |
9
+ | Claude Code | Claude plugin and shared Cosmo skill | `cosmo` or `/cosmo:cosmo` |
10
+ | Codex | User skill at `~/.agents/skills/cosmo` | `$cosmo` or a matching natural request |
11
+ | Google Antigravity | Global workflow at `~/.gemini/config/global_workflows/cosmo.md` | `/cosmo` |
12
+
13
+ New and adopted projects also contain:
14
+
15
+ - `.agents/skills/cosmo/SKILL.md`: shared start, adopt, resume, build, review, and release behavior.
16
+ - `.agents/rules/cosmo.md`: persistent project safeguards for Antigravity and compatible agents.
17
+ - `.agents/workflows/cosmo.md`: workspace `/cosmo` workflow for Antigravity.
18
+ - `AGENTS.md`: concise cross-agent project guidance, loaded automatically by Codex.
19
+ - `CLAUDE.md`: Claude-specific guidance and optional Claude Design integration.
20
+
21
+ ## Installation
22
+
23
+ A global npm installation installs all three lightweight adapters:
24
+
25
+ ```bash
26
+ npm install --global @archangel70/cosmo
27
+ ```
28
+
29
+ Repair or refresh every adapter:
30
+
31
+ ```bash
32
+ cosmo setup
33
+ ```
34
+
35
+ Manage one adapter without affecting the others:
36
+
37
+ ```bash
38
+ cosmo setup --agent codex
39
+ cosmo agent install antigravity --replace
40
+ cosmo agent status all
41
+ cosmo agent uninstall claude
42
+ ```
43
+
44
+ The older `cosmo claude install|status|uninstall` commands remain supported.
45
+
46
+ ## Switching agents
47
+
48
+ Run relevant checks, then record the switch:
49
+
50
+ ```bash
51
+ cosmo handoff create . --from claude --to antigravity --note "Homepage approved; services copy still needs review."
52
+ ```
53
+
54
+ Open the same project folder in the next agent and invoke Cosmo. The receiving agent reads `HANDOFF.md` and repository state, so no chat export is required.
55
+
56
+ ## Design portability
57
+
58
+ Claude Design remains an optional capability rather than a Cosmo dependency. Projects using it retain the resulting design direction, responsive states, reference renders, tokens, components, and implementation notes in the repository. Codex, Antigravity, another design authority, or a human designer can fulfill or continue the same contract when Claude Design is unavailable.
59
+
60
+ ## Adapter contract
61
+
62
+ Every adapter must:
63
+
64
+ 1. Inspect before mutating and never initialize over a non-empty unrelated folder.
65
+ 2. Distinguish a new site, an existing Astro site, and an existing Cosmo project.
66
+ 3. Resume from repository state and preserve prior-agent handoffs.
67
+ 4. Never invent evidence or approval, weaken a gate, or write secrets into tracked files.
68
+ 5. Follow the same workflow, copy, intelligence, generation, QA, release, and deployment commands.
69
+ 6. Keep conversational guidance plain enough that a user does not need to learn the CLI.
@@ -1,5 +1,7 @@
1
1
  # Cosmo Page Production
2
2
 
3
+ Before a page moves from sourced material into outlining, Copy Studio requires an approved `.cosmo/work/pages/<page-id>/copy-brief.json`. Run `cosmo copy guide <page-id> .` to give the writing agent its approved reader entry point, angle, evidence placement, section contracts, and CTA ceiling. See [Copy Studio](COPY-STUDIO.md).
4
+
3
5
  Generation progress v2 records the real state of each page instead of treating content creation as one opaque operation.
4
6
 
5
7
  ## State machine
package/docs/ROADMAP.md CHANGED
@@ -175,6 +175,16 @@ The acceptance pilot completed five generation entries, static and browser QA wi
175
175
  - Local-state resume behavior with workflow, intelligence, approval, QA, release, handoff, and deployment awareness.
176
176
  - Human approval and evidence boundaries carried into the conversational entry point.
177
177
 
178
+ ## Milestone 19 — v1.9 multi-agent Cosmo (complete)
179
+
180
+ - One-command adapter setup for Claude Code, Codex, and Google Antigravity.
181
+ - Shared repository skill for start, adoption, resume, production, review, release, and cross-agent continuation.
182
+ - Codex user-skill installation plus repository `AGENTS.md` discovery.
183
+ - Antigravity global and workspace `/cosmo` workflows with persistent project rules.
184
+ - Agent-neutral design authority while preserving optional Claude Design workflows.
185
+ - Backward-compatible Claude commands and durable handoffs between any named agents.
186
+ - Adapter conformance, starter, adoption, and packed-install smoke coverage.
187
+
178
188
  ## Later, only when justified
179
189
 
180
190
  - Additional deployment adapters, including Cloudflare Workers.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@archangel70/cosmo",
3
- "version": "1.7.0",
4
- "description": "Local-first Astro website builder for Claude, Claude Design, Codex, and the command line.",
3
+ "version": "1.10.0",
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",
7
7
  "bin": {
@@ -11,6 +11,8 @@
11
11
  "packages/cli/bin/**",
12
12
  "packages/cli/lib/**",
13
13
  "plugins/claude-code/cosmo/**",
14
+ "plugins/agent-skills/cosmo/**",
15
+ "plugins/antigravity/**",
14
16
  "templates/astro-site/.cosmo/brand/**",
15
17
  "templates/astro-site/.cosmo/build-plan.json",
16
18
  "templates/astro-site/.cosmo/capabilities/**",
@@ -21,6 +23,7 @@
21
23
  "templates/astro-site/.cosmo/work/**",
22
24
  "templates/astro-site/.cosmo/workflows/**",
23
25
  "templates/astro-site/.env.example",
26
+ "templates/astro-site/.agents/**",
24
27
  "templates/astro-site/gitignore.template",
25
28
  "templates/astro-site/AGENTS.md",
26
29
  "templates/astro-site/CLAUDE.md",
@@ -38,7 +41,9 @@
38
41
  "docs/BRAND-DISCOVERY.md",
39
42
  "docs/BROWSER-QA.md",
40
43
  "docs/CLAUDE-LAUNCHER.md",
44
+ "docs/MULTI-AGENT.md",
41
45
  "docs/CONTENT-QA.md",
46
+ "docs/COPY-STUDIO.md",
42
47
  "docs/DELIVERY.md",
43
48
  "docs/DEPLOYMENT.md",
44
49
  "docs/FIRST-PARTY-CAPABILITIES.md",
@@ -71,12 +76,13 @@
71
76
  "qa": "node packages/cli/bin/cosmo.mjs check templates/astro-site",
72
77
  "integrity:qa": "node packages/cli/bin/cosmo.mjs integrity check templates/astro-site",
73
78
  "content:qa": "node packages/cli/bin/cosmo.mjs content check templates/astro-site",
79
+ "copy:qa": "node packages/cli/bin/cosmo.mjs copy check templates/astro-site",
74
80
  "intelligence:qa": "node packages/cli/bin/cosmo.mjs intelligence check templates/astro-site",
75
81
  "browser:qa": "node packages/cli/bin/cosmo.mjs browser check templates/astro-site",
76
82
  "package:smoke": "node scripts/smoke-package.mjs",
77
83
  "postinstall": "node scripts/postinstall.mjs",
78
84
  "test": "node --test packages/cli/test/*.test.mjs",
79
- "verify": "npm run test && npm run check && npm run integrity:qa && npm run qa && npm run content:qa && npm run intelligence:qa && npm run browser:qa"
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"
80
86
  },
81
87
  "dependencies": {
82
88
  "axe-core": "^4.13.0",
@@ -6,20 +6,24 @@ import { fileURLToPath } from 'node:url';
6
6
  import { auditDist, writeAuditReport } from '../lib/audit.mjs';
7
7
  import { auditBrowser, writeBrowserReport } from '../lib/browser-audit.mjs';
8
8
  import { auditContent, writeContentReport } from '../lib/content-audit.mjs';
9
+ import { copyGuide, evaluateCopyStudio, scaffoldCopyBrief, scaffoldCopyStudio, writeCopyStudioReport } from '../lib/copy-studio.mjs';
9
10
  import { checkBrandDiscovery, scaffoldBrandDiscovery } from '../lib/brand.mjs';
10
11
  import { adoptAstroProject } from '../lib/adoption.mjs';
11
12
  import { claudePluginStatus, installClaudePlugin, uninstallClaudePlugin } from '../lib/claude-plugin.mjs';
13
+ import { agentInvocation, agentStatus, installAgent, normalizeAgent, SUPPORTED_AGENTS, uninstallAgent } from '../lib/agent-adapters.mjs';
12
14
  import { evaluateDelivery, readDelivery, writeDeliveryReport } from '../lib/delivery.mjs';
13
15
  import { diagnoseProject } from '../lib/doctor.mjs';
14
16
  import { configureDeployment, deployProject, readDeploymentConfig, readDeploymentHistory } from '../lib/deployment.mjs';
15
17
  import { evaluateIntelligence, writeIntelligenceReport } from '../lib/intelligence-audit.mjs';
16
18
  import { createHandoff, readHandoff } from '../lib/handoff.mjs';
17
19
  import { checkIntegrity, createPageBrief, scaffoldIntegrity } from '../lib/integrity.mjs';
20
+ import { launcherGuide } from '../lib/launcher.mjs';
18
21
  import {
19
22
  addIntelligencePack,
20
23
  applyIntelligenceProfile,
21
24
  intelligenceCatalog,
22
25
  importIntelligencePack,
26
+ guidanceForAgent,
23
27
  readIntelligence,
24
28
  readIntelligenceLock,
25
29
  removeIntelligencePack,
@@ -59,10 +63,10 @@ import {
59
63
  workflowSummary,
60
64
  } from '../lib/workflow.mjs';
61
65
 
62
- const VERSION = '1.7.0';
66
+ const VERSION = '1.10.0';
63
67
  const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
64
68
  const templateDirectory = path.resolve(cliDirectory, '../../../templates/astro-site');
65
- const [command = 'help', ...rawArgs] = process.argv.slice(2);
69
+ const [command = 'start', ...rawArgs] = process.argv.slice(2);
66
70
 
67
71
  function projectDirectory(value = '.') {
68
72
  return path.resolve(process.cwd(), value);
@@ -73,7 +77,14 @@ function help() {
73
77
  Cosmo ${VERSION} — local-first Astro site builder
74
78
 
75
79
  Commands
76
- cosmo setup
80
+ cosmo Show the guided next step for this folder
81
+ cosmo start [directory] Show the guided next step for another folder
82
+ cosmo help Show the complete developer command reference
83
+ cosmo setup [--agent claude|codex|antigravity|all]
84
+ cosmo agent list
85
+ cosmo agent install <claude|codex|antigravity|all> [--replace]
86
+ cosmo agent status [claude|codex|antigravity|all]
87
+ cosmo agent uninstall <claude|codex|antigravity|all>
77
88
  cosmo init [directory] [--name slug] [--brand name] [--site url] [--profile id]
78
89
  cosmo adopt [directory] [--name slug] [--brand name] [--site url] [--profile id] [--design-mode mode]
79
90
  cosmo claude install [--replace]
@@ -83,18 +94,23 @@ Commands
83
94
  cosmo build [directory]
84
95
  cosmo check [directory] [--no-build]
85
96
  cosmo content check [directory]
97
+ cosmo copy init [directory] [--replace]
98
+ cosmo copy brief <page-id> [directory] [--replace]
99
+ cosmo copy brief --all [directory] [--replace]
100
+ cosmo copy guide <page-id> [directory]
101
+ cosmo copy check [directory]
86
102
  cosmo browser check [directory] [--no-build] [--no-lighthouse]
87
103
  cosmo status [directory] [--json]
88
104
  cosmo doctor [directory] [--json]
89
105
  cosmo intake [directory] --niche value --audience value --goal value [--location value] [--pages number]
90
- cosmo design brief [directory]
106
+ cosmo design brief [directory] [--agent claude|codex|antigravity]
91
107
  cosmo design capture [directory]
92
108
  cosmo integrity init [directory] [--replace]
93
109
  cosmo integrity check [directory] [--allow-missing-briefs]
94
110
  cosmo intelligence list
95
111
  cosmo intelligence show [directory]
96
112
  cosmo intelligence check [directory]
97
- cosmo intelligence guide <stage> [directory]
113
+ cosmo intelligence guide <stage> [directory] [--agent claude|codex|antigravity]
98
114
  cosmo intelligence apply <profile> [directory]
99
115
  cosmo intelligence add <pack> [directory]
100
116
  cosmo intelligence remove <pack> [directory]
@@ -140,6 +156,11 @@ Commands
140
156
  `);
141
157
  }
142
158
 
159
+ function start(args) {
160
+ const { positional } = parseOptions(args);
161
+ console.log(launcherGuide(projectDirectory(positional[0] ?? '.'), VERSION));
162
+ }
163
+
143
164
  async function init(args) {
144
165
  const { options, positional } = parseOptions(args);
145
166
  const target = projectDirectory(positional[0] ?? '.');
@@ -184,6 +205,8 @@ async function init(args) {
184
205
  writeJson(planFile, plan);
185
206
  for (const page of plan.pages) createPageBrief(target, page.id, { replace: true });
186
207
  applyIntelligenceProfile(target, String(options.profile ?? 'lean'));
208
+ scaffoldCopyStudio(target);
209
+ for (const page of plan.pages) scaffoldCopyBrief(target, page.id);
187
210
 
188
211
  const configFile = path.join(target, 'cosmo.config.mjs');
189
212
  const config = fs.readFileSync(configFile, 'utf8')
@@ -230,12 +253,69 @@ function claudeCommand(args) {
230
253
  throw new Error(`Unknown claude command: ${subcommand}`);
231
254
  }
232
255
 
233
- function setup() {
234
- const result = installClaudePlugin({ replace: true });
235
- console.log(`Cosmo ${VERSION} is ready for Claude at ${result.target}`);
236
- if (result.validation.attempted) console.log('Claude plugin validation: passed');
237
- console.log('Restart Claude, open a website folder, and type: cosmo');
238
- console.log('Explicit fallback: /cosmo:cosmo');
256
+ function printAgentStatus(agent, status) {
257
+ console.log(`${agent.padEnd(12)} ${status.installed ? 'ready' : 'not installed'}${status.version ? ` v${status.version}` : ''}`);
258
+ console.log(` ${status.target}`);
259
+ if (status.installed) console.log(` Start: ${agentInvocation(agent)}`);
260
+ }
261
+
262
+ function agentCommand(args) {
263
+ const [subcommand = 'status', requested = 'all', ...rest] = args;
264
+ const { options } = parseOptions(rest);
265
+ if (subcommand === 'list') {
266
+ console.log('Supported Cosmo agents');
267
+ for (const agent of SUPPORTED_AGENTS) printAgentStatus(agent, agentStatus(agent));
268
+ return;
269
+ }
270
+ const agent = normalizeAgent(requested);
271
+ const agents = agent === 'all' ? SUPPORTED_AGENTS : [agent];
272
+ if (subcommand === 'status') {
273
+ for (const name of agents) printAgentStatus(name, agentStatus(name));
274
+ return;
275
+ }
276
+ if (subcommand === 'install') {
277
+ let failed = false;
278
+ for (const name of agents) {
279
+ try {
280
+ const result = installAgent(name, { replace: Boolean(options.replace), validate: name === 'claude' });
281
+ printAgentStatus(name, result);
282
+ } catch (error) {
283
+ if (agents.length === 1) throw error;
284
+ failed = true;
285
+ console.error(`${name.padEnd(12)} failed: ${error.message}`);
286
+ }
287
+ }
288
+ if (failed) process.exitCode = 1;
289
+ return;
290
+ }
291
+ if (subcommand === 'uninstall') {
292
+ for (const name of agents) {
293
+ const result = uninstallAgent(name);
294
+ console.log(result.removed ? `Removed Cosmo for ${name} from ${result.target}` : `Cosmo for ${name} is not installed at ${result.target}`);
295
+ }
296
+ return;
297
+ }
298
+ throw new Error(`Unknown agent command: ${subcommand}`);
299
+ }
300
+
301
+ function setup(args) {
302
+ const { options, positional } = parseOptions(args);
303
+ const requested = normalizeAgent(options.agent ?? positional[0] ?? 'all');
304
+ const agents = requested === 'all' ? SUPPORTED_AGENTS : [requested];
305
+ console.log(`Cosmo ${VERSION} agent setup`);
306
+ let failed = false;
307
+ for (const agent of agents) {
308
+ try {
309
+ const result = installAgent(agent, { replace: true, validate: agent === 'claude' });
310
+ printAgentStatus(agent, result);
311
+ } catch (error) {
312
+ if (agents.length === 1) throw error;
313
+ failed = true;
314
+ console.error(`${agent.padEnd(12)} failed: ${error.message}`);
315
+ }
316
+ }
317
+ console.log('Open a website folder in your preferred agent and invoke Cosmo using the instruction shown above.');
318
+ if (failed) process.exitCode = 1;
239
319
  }
240
320
 
241
321
  async function build(args) {
@@ -285,6 +365,52 @@ function contentCheck(args) {
285
365
  }
286
366
  }
287
367
 
368
+ function copyCommand(args) {
369
+ const subcommand = args[0] ?? 'check';
370
+ const rest = args.slice(1);
371
+ if (subcommand === 'init') {
372
+ const { options, positional } = parseOptions(rest);
373
+ const target = projectDirectory(positional[0] ?? '.');
374
+ const result = scaffoldCopyStudio(target, { replace: Boolean(options.replace) });
375
+ console.log(result.created ? `Created Copy Studio strategy: ${result.file}` : `Copy Studio strategy already exists: ${result.file}`);
376
+ return;
377
+ }
378
+ if (subcommand === 'brief') {
379
+ const all = rest.includes('--all');
380
+ const parsed = rest.filter((arg) => arg !== '--all');
381
+ const { options, positional } = parseOptions(parsed);
382
+ const target = projectDirectory(all ? positional[0] ?? '.' : positional[1] ?? '.');
383
+ const plan = readPlan(target, { requireApproved: false }).data;
384
+ const pageIds = all ? plan.pages.map((page) => page.id) : [positional[0]];
385
+ if (!pageIds[0]) throw new Error('Usage: cosmo copy brief <page-id> [directory] [--replace]');
386
+ for (const pageId of pageIds) {
387
+ const result = scaffoldCopyBrief(target, pageId, { replace: Boolean(options.replace) });
388
+ console.log(result.created ? `Created copy brief: ${result.file}` : `Copy brief already exists: ${result.file}`);
389
+ }
390
+ return;
391
+ }
392
+ if (subcommand === 'guide') {
393
+ const { positional } = parseOptions(rest);
394
+ if (!positional[0]) throw new Error('Usage: cosmo copy guide <page-id> [directory]');
395
+ console.log(copyGuide(projectDirectory(positional[1] ?? '.'), positional[0]));
396
+ return;
397
+ }
398
+ if (subcommand === 'check') {
399
+ const { positional } = parseOptions(rest);
400
+ const target = projectDirectory(positional[0] ?? '.');
401
+ const report = evaluateCopyStudio(target);
402
+ const file = writeCopyStudioReport(target, report);
403
+ console.log(`Copy Studio: ${report.summary.pages} pages, ${report.summary.blocking} blocking, ${report.summary.warnings} warnings`);
404
+ console.log(`Report: ${file}`);
405
+ if (!report.passed) {
406
+ for (const item of report.findings.filter((entry) => entry.severity === 'blocking').slice(0, 20)) console.error(`- ${item.scope}: ${item.code} (${item.message})`);
407
+ process.exitCode = 1;
408
+ }
409
+ return;
410
+ }
411
+ throw new Error(`Unknown copy command: ${subcommand}`);
412
+ }
413
+
288
414
  function staticServer(projectDir) {
289
415
  const distDir = path.join(projectDir, 'dist');
290
416
  const types = { '.css': 'text/css', '.html': 'text/html', '.js': 'text/javascript', '.json': 'application/json', '.png': 'image/png', '.svg': 'image/svg+xml', '.txt': 'text/plain', '.xml': 'application/xml' };
@@ -446,11 +572,11 @@ function designBrief(args) {
446
572
  }
447
573
  const selectedDesignPacks = readIntelligence(target).manifests.filter((pack) => pack.stages.includes('design'));
448
574
  const intelligenceSection = selectedDesignPacks.length
449
- ? `\n## Selected intelligence packs\n\n${selectedDesignPacks.map((pack) => `### ${pack.title}\n\n${pack.guidance.claude}\n\nQuestions:\n${pack.questions.map((question) => `- ${question}`).join('\n')}\n\nRequired handoff: \`${pack.artifact.path}\``).join('\n\n')}\n`
575
+ ? `\n## Selected intelligence packs\n\n${selectedDesignPacks.map((pack) => `### ${pack.title}\n\n${guidanceForAgent(pack, options.agent ?? 'build')}\n\nQuestions:\n${pack.questions.map((question) => `- ${question}`).join('\n')}\n\nRequired handoff: \`${pack.artifact.path}\``).join('\n\n')}\n`
450
576
  : '';
451
577
  fs.mkdirSync(path.dirname(file), { recursive: true });
452
- fs.writeFileSync(file, `# Creative Brief — ${data.brand}\n\n## Goal\n\nCreate a distinctive, conversion-aware visual direction for ${data.brand}. Explore at least three genuinely different compositions before selecting one.\n\n## Inputs to complete\n\n- Audience:\n- Primary conversion:\n- Desired first-five-seconds feeling:\n- Brand truths that must remain visible:\n- Real assets available:\n- Competitors and references:\n\n## Required page capabilities\n\n- Semantic hook, problem, proof, solution, evidence, and action sections\n- Mobile-first behavior at 320px, 768px, and 1440px\n- Keyboard-visible focus and reduced-motion support\n- Strong content hierarchy with exactly one H1\n- Components that can be reused without forcing identical page compositions\n\n## Creative freedom\n\nClaude Design owns composition, typography, palette, rhythm, texture, art direction, and signature interaction. Cosmo owns content structure, accessibility, SEO, and build integrity. Avoid treating the existing starter styling as a visual requirement.\n${intelligenceSection}\n## Deliverables\n\n1. Three visual directions with a short rationale for each\n2. One selected and refined homepage direction\n3. Mobile and desktop states\n4. Component inventory and design tokens\n5. Notes describing the distinctive element that should survive implementation\n`);
453
- console.log(`Created Claude Design brief: ${file}`);
578
+ fs.writeFileSync(file, `# Creative Brief — ${data.brand}\n\n## Goal\n\nCreate a distinctive, conversion-aware visual direction for ${data.brand}. Explore at least three genuinely different compositions before selecting one.\n\n## Inputs to complete\n\n- Audience:\n- Primary conversion:\n- Desired first-five-seconds feeling:\n- Brand truths that must remain visible:\n- Real assets available:\n- Competitors and references:\n\n## Required page capabilities\n\n- Semantic hook, problem, proof, solution, evidence, and action sections\n- Mobile-first behavior at 320px, 768px, and 1440px\n- Keyboard-visible focus and reduced-motion support\n- Strong content hierarchy with exactly one H1\n- Components that can be reused without forcing identical page compositions\n\n## Creative freedom\n\nThe selected design authority owns composition, typography, palette, rhythm, texture, art direction, and signature interaction. This may be Claude Design, the current capable agent, another design tool, or a human designer. Cosmo owns content structure, accessibility, SEO, and build integrity. Avoid treating the existing starter styling as a visual requirement.\n${intelligenceSection}\n## Deliverables\n\n1. Three visual directions with a short rationale for each\n2. One selected and refined homepage direction\n3. Mobile and desktop states\n4. Component inventory and design tokens\n5. Notes describing the distinctive element that should survive implementation\n`);
579
+ console.log(`Created design brief: ${file}`);
454
580
  }
455
581
 
456
582
  function designCapture(args) {
@@ -555,7 +681,7 @@ function intelligenceCommand(args) {
555
681
  return;
556
682
  }
557
683
  if (subcommand === 'guide') {
558
- const { positional } = parseOptions(rest);
684
+ const { options, positional } = parseOptions(rest);
559
685
  if (!positional[0]) throw new Error('Usage: cosmo intelligence guide <stage> [directory]');
560
686
  const target = projectDirectory(positional[1] ?? '.');
561
687
  const packs = readIntelligence(target).manifests.filter((pack) => pack.stages.includes(positional[0]));
@@ -563,8 +689,11 @@ function intelligenceCommand(args) {
563
689
  console.log(`Intelligence guidance — ${positional[0]}`);
564
690
  for (const pack of packs) {
565
691
  console.log(`\n${pack.title} (${pack.id})`);
566
- console.log(` Claude: ${pack.guidance.claude}`);
567
- console.log(` Codex: ${pack.guidance.codex}`);
692
+ if (options.agent) console.log(` ${normalizeAgent(options.agent)}: ${guidanceForAgent(pack, options.agent)}`);
693
+ else {
694
+ console.log(` Build: ${guidanceForAgent(pack, 'build')}`);
695
+ console.log(` Review: ${guidanceForAgent(pack, 'review')}`);
696
+ }
568
697
  console.log(' Questions:');
569
698
  for (const question of pack.questions) console.log(` - ${question}`);
570
699
  if (pack.artifact.stage === positional[0]) console.log(` Gate: ${pack.artifact.path}`);
@@ -866,15 +995,18 @@ async function deployCommand(args) {
866
995
 
867
996
  async function main() {
868
997
  if (command === 'help' || command === '--help' || command === '-h') return help();
998
+ if (command === 'start') return start(rawArgs);
869
999
  if (command === '--version' || command === '-v' || command === 'version') return console.log(VERSION);
870
- if (command === 'setup') return setup();
1000
+ if (command === 'setup') return setup(rawArgs);
871
1001
  if (command === 'init') return init(rawArgs);
872
1002
  if (command === 'adopt') return adopt(rawArgs);
873
1003
  if (command === 'claude') return claudeCommand(rawArgs);
1004
+ if (command === 'agent') return agentCommand(rawArgs);
874
1005
  if (command === 'dev') return dev(rawArgs);
875
1006
  if (command === 'build') return build(rawArgs);
876
1007
  if (command === 'check') return check(rawArgs);
877
1008
  if (command === 'content' && rawArgs[0] === 'check') return contentCheck(rawArgs.slice(1));
1009
+ if (command === 'copy') return copyCommand(rawArgs);
878
1010
  if (command === 'browser' && rawArgs[0] === 'check') return browserCheck(rawArgs.slice(1));
879
1011
  if (command === 'status') return status(rawArgs);
880
1012
  if (command === 'doctor') return doctorCommand(rawArgs);