@archangel70/cosmo 1.15.1 → 1.16.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 +8 -0
- package/README.md +16 -4
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/DELIVERY.md +29 -1
- package/docs/DEPLOYMENT.md +1 -1
- package/package.json +1 -1
- package/packages/cli/bin/cosmo.mjs +45 -8
- package/packages/cli/lib/delivery.mjs +78 -14
- package/packages/cli/lib/deployment.mjs +1 -1
- package/packages/cli/lib/release-waivers.mjs +97 -0
- package/packages/cli/lib/status.mjs +1 -1
- package/plugins/agent-skills/cosmo/.cosmo-agent.json +1 -1
- package/plugins/agent-skills/cosmo/SKILL.md +1 -1
- package/plugins/antigravity/cosmo.md +1 -1
- package/plugins/claude-code/cosmo/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/cosmo/skills/cosmo/SKILL.md +1 -1
- package/templates/astro-site/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable Cosmo changes are recorded here.
|
|
4
4
|
|
|
5
|
+
## 1.16.0 — Recorded release waivers
|
|
6
|
+
|
|
7
|
+
- Added exact-finding release waivers with a required reason, named approver, timestamp, optional expiration, and durable revocation history.
|
|
8
|
+
- Preserved every original QA finding and recommendation in delivery reports while distinguishing READY, READY WITH WAIVERS, and BLOCKED releases.
|
|
9
|
+
- Invalidated waivers when a finding changes or its source report becomes stale, while keeping missing, invalid, stale, and incomplete process gates non-waivable.
|
|
10
|
+
- Added waiver review and revocation commands, production-deployment enforcement, agent guidance, documentation, and regression coverage.
|
|
11
|
+
- Refreshed transitive build dependencies to resolve all currently reported npm vulnerabilities.
|
|
12
|
+
|
|
5
13
|
## 1.15.1 — Complete user and command documentation
|
|
6
14
|
|
|
7
15
|
- Expanded the beginner preview instructions to explain local and temporary public review links, their privacy boundary, and the optional Cloudflare helper.
|
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.16.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.16.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.15.1` 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.16.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
|
|
|
@@ -568,6 +568,15 @@ cosmo release show .
|
|
|
568
568
|
|
|
569
569
|
The release check writes `DELIVERY.md` and a machine-readable manifest. It blocks placeholder identity, missing approvals, zero indexable pages, incomplete generation, missing/failed/stale QA, capability-selection drift, or any source change after QA. A READY result has a source-derived release ID used by production deployment.
|
|
570
570
|
|
|
571
|
+
When a completed QA report flags something that is intentionally acceptable for this specific project, record an exact waiver instead of editing the report or hiding the finding:
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
cosmo release check .
|
|
575
|
+
cosmo release waive <finding-id> . --reason "Why this is acceptable here" --by "Your name"
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Cosmo preserves the original finding, recommendation, approver, timestamp, and reason in `.cosmo/release-waivers.json` and `DELIVERY.md`. When every remaining blocker has an active exact-match waiver, the release is **READY WITH WAIVERS**. Changed findings do not inherit an old waiver. Missing or stale reports, incomplete workflows, placeholder project data, and other process-integrity gates cannot be waived. Use `cosmo release waivers .` to review the ledger and `cosmo release unwaive <finding-id> . --reason "..." --by "..."` to revoke a decision without deleting its history. See [delivery readiness](docs/DELIVERY.md).
|
|
579
|
+
|
|
571
580
|
## Preview and deployment
|
|
572
581
|
|
|
573
582
|
Deployment is optional. A Cosmo project remains a standard static Astro site whose `dist` directory can be hosted anywhere.
|
|
@@ -779,6 +788,9 @@ Additional intake options include `--location`, `--pages`, `--language`, `--desi
|
|
|
779
788
|
| `cosmo content check [directory]` | Run semantic and evidence-aware content QA. |
|
|
780
789
|
| `cosmo browser check [directory] [options]` | Run rendered responsive, accessibility, and Lighthouse QA. |
|
|
781
790
|
| `cosmo release check|show [directory]` | Create or inspect the source-bound delivery decision. |
|
|
791
|
+
| `cosmo release waive <finding-id> [directory] --reason ... --by ...` | Accept one exact project-specific QA finding while preserving it in the release record. |
|
|
792
|
+
| `cosmo release waivers [directory]` | List active, expired, and revoked waiver decisions. |
|
|
793
|
+
| `cosmo release unwaive <finding-id> [directory] --reason ... --by ...` | Revoke a waiver without deleting its history. |
|
|
782
794
|
| `cosmo handoff create [directory] [options]` | Create durable agent continuity files. |
|
|
783
795
|
| `cosmo handoff show [directory]` | Display the current handoff. |
|
|
784
796
|
| `cosmo deploy configure <provider> [directory] [options]` | Configure Cloudflare Pages, SFTP, FTPS, or FTP. |
|
|
@@ -848,7 +860,7 @@ This is expected while every neutral scaffold route is `noindex`. Approve real p
|
|
|
848
860
|
|
|
849
861
|
### Release remains BLOCKED
|
|
850
862
|
|
|
851
|
-
Run `cosmo status .`, `cosmo workflow resume .`, and `cosmo release check .`.
|
|
863
|
+
Run `cosmo status .`, `cosmo workflow resume .`, and `cosmo release check .`. Complete missing approvals, proof, page state, fresh QA, or other required process gates. If the only remaining blocker is an intentional project-specific QA exception, use its displayed finding ID with `cosmo release waive`; never edit the report to conceal it.
|
|
852
864
|
|
|
853
865
|
### Production deployment reports release drift
|
|
854
866
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -79,7 +79,7 @@ When enabled, `cosmo entity check` compiles EntityMap v1.0 from the Entity Canon
|
|
|
79
79
|
|
|
80
80
|
`cosmo browser check` serves the static build from a short-lived local server and renders every route at 320px, 768px, and 1440px. It blocks on navigation failures, horizontal overflow, browser errors, WCAG A/AA violations, and missing or invisible first-tab focus. It stores normal-state full-page captures and records homepage Lighthouse scores for performance, accessibility, best practices, and SEO.
|
|
81
81
|
|
|
82
|
-
`cosmo release check` sits above the individual validators. It requires completed workflow and generation state, an approved and indexable plan, production identity, an approved design direction,
|
|
82
|
+
`cosmo release check` sits above the individual validators. It requires completed workflow and generation state, an approved and indexable plan, production identity, an approved design direction, fresh QA reports, and an intelligence report matching the active selection. Exact structured QA findings may be accepted through the durable release-waiver ledger with a reason and named approver. The original finding remains visible, revocations retain their decision history, and changed fingerprints require a new decision; missing, stale, invalid, or incomplete process inputs remain non-waivable. The resulting release ID hashes durable source inputs and waiver decisions; `.cosmo/reports/delivery-check.json` and `DELIVERY.md` record READY, READY WITH WAIVERS, or BLOCKED.
|
|
83
83
|
|
|
84
84
|
## Deployment boundary
|
|
85
85
|
|
package/docs/DELIVERY.md
CHANGED
|
@@ -7,7 +7,7 @@ Cosmo separates individual QA checks from the final decision to ship. `cosmo rel
|
|
|
7
7
|
|
|
8
8
|
## Required release state
|
|
9
9
|
|
|
10
|
-
A project is ready only when all of the following are true:
|
|
10
|
+
A project is ready only when all of the following are true, or when a project-specific QA finding has an exact, active waiver:
|
|
11
11
|
|
|
12
12
|
- The canonical production site URL and project identity no longer use starter placeholders.
|
|
13
13
|
- `DESIGN-DIRECTION.md` records an approved project-owned direction.
|
|
@@ -18,6 +18,8 @@ A project is ready only when all of the following are true:
|
|
|
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
|
|
|
21
|
+
Missing, invalid, or stale QA; incomplete workflows or generation; invalid plans; placeholder production identity; and other project/process integrity gates cannot be waived. A waiver is available only for a structured finding produced by a completed QA report.
|
|
22
|
+
|
|
21
23
|
The release ID is a portable hash of the project source and durable Cosmo inputs. Editing those inputs changes the release ID and makes older QA reports stale.
|
|
22
24
|
|
|
23
25
|
### Native adopted Astro sites
|
|
@@ -42,6 +44,32 @@ cosmo release show .
|
|
|
42
44
|
|
|
43
45
|
A blocked release still writes the manifest. Each finding includes a concrete repair, so the manifest doubles as the final punch list. Rerun the affected checks after any source change, then run the release check again.
|
|
44
46
|
|
|
47
|
+
## Recording a reviewed exception
|
|
48
|
+
|
|
49
|
+
Do not edit a QA report to hide a finding. Run the release check and use the exact finding ID it displays:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cosmo release check .
|
|
53
|
+
cosmo release waive site-check-a1b2c3d4e5 . \
|
|
54
|
+
--reason "This embedded form intentionally supplies its own visible heading." \
|
|
55
|
+
--by "Project Owner"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The reason must be specific and at least 10 characters. `--by` records the person who accepted the exception. Add `--expires 2027-01-31` when the decision should be reviewed on a known date.
|
|
59
|
+
|
|
60
|
+
Cosmo stores the decision in `.cosmo/release-waivers.json`. The next delivery report keeps the original finding and recommendation, adds the approver, time, and reason, and reports **READY WITH WAIVERS** when no unwaived blockers remain. A waiver matches the exact source, scope, code, and message fingerprint. If the finding changes, the old waiver remains in history but no longer applies.
|
|
61
|
+
|
|
62
|
+
Inspect or revoke decisions with:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cosmo release waivers .
|
|
66
|
+
cosmo release unwaive site-check-a1b2c3d4e5 . \
|
|
67
|
+
--reason "The embedded form was replaced." \
|
|
68
|
+
--by "Project Owner"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Revocation is appended to the waiver record rather than deleting the decision history. Production deployment accepts an exact **READY WITH WAIVERS** release, while still exposing every accepted finding in `DELIVERY.md` and the machine-readable delivery report.
|
|
72
|
+
|
|
45
73
|
For native adopted sites, omit `cosmo integrity check` and `cosmo content check`; the adopted workflow and `cosmo status` show the applicable checks automatically.
|
|
46
74
|
|
|
47
75
|
## Handoff
|
package/docs/DEPLOYMENT.md
CHANGED
|
@@ -51,7 +51,7 @@ cosmo release check .
|
|
|
51
51
|
cosmo deploy production .
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Production preflight requires the recorded delivery manifest and the current repository to
|
|
54
|
+
Production preflight requires the recorded delivery manifest and the current repository to be READY or READY WITH WAIVERS with the exact same release ID. Source drift, stale QA, a missing manifest, an expired or revoked waiver, or a blocked release stops the command before the provider is invoked.
|
|
55
55
|
|
|
56
56
|
## SFTP, FTPS, and FTP hosts
|
|
57
57
|
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import { adoptAstroProject } from '../lib/adoption.mjs';
|
|
|
12
12
|
import { claudePluginStatus, installClaudePlugin, uninstallClaudePlugin } from '../lib/claude-plugin.mjs';
|
|
13
13
|
import { agentInvocation, agentStatus, installAgent, normalizeAgent, SUPPORTED_AGENTS, uninstallAgent } from '../lib/agent-adapters.mjs';
|
|
14
14
|
import { evaluateDelivery, readDelivery, writeDeliveryReport } from '../lib/delivery.mjs';
|
|
15
|
+
import { readReleaseWaivers, recordReleaseWaiver, revokeReleaseWaiver } from '../lib/release-waivers.mjs';
|
|
15
16
|
import { diagnoseProject } from '../lib/doctor.mjs';
|
|
16
17
|
import { configureDeployment, deployProject, readDeploymentConfig, readDeploymentHistory } from '../lib/deployment.mjs';
|
|
17
18
|
import { evaluateIntelligence, writeIntelligenceReport } from '../lib/intelligence-audit.mjs';
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
workflowSummary,
|
|
67
68
|
} from '../lib/workflow.mjs';
|
|
68
69
|
|
|
69
|
-
const VERSION = '1.
|
|
70
|
+
const VERSION = '1.16.0';
|
|
70
71
|
const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
71
72
|
const templateDirectory = path.resolve(cliDirectory, '../../../templates/astro-site');
|
|
72
73
|
const [command = 'start', ...rawArgs] = process.argv.slice(2);
|
|
@@ -157,6 +158,9 @@ Commands
|
|
|
157
158
|
cosmo handoff show [directory]
|
|
158
159
|
cosmo release check [directory]
|
|
159
160
|
cosmo release show [directory]
|
|
161
|
+
cosmo release waive <finding-id> [directory] --reason text --by name [--expires date]
|
|
162
|
+
cosmo release unwaive <finding-id> [directory] --reason text --by name
|
|
163
|
+
cosmo release waivers [directory]
|
|
160
164
|
cosmo deploy configure cloudflare-pages [directory] --project name [--production-branch main]
|
|
161
165
|
cosmo deploy configure sftp|ftps|ftp [directory] --host name --remote-dir path [--preview-remote-dir path]
|
|
162
166
|
cosmo deploy local [directory] [--no-build]
|
|
@@ -511,7 +515,7 @@ function status(args) {
|
|
|
511
515
|
const target = projectDirectory(positional[0] ?? '.');
|
|
512
516
|
const result = collectProjectStatus(target);
|
|
513
517
|
if (options.json) return console.log(JSON.stringify(result, null, 2));
|
|
514
|
-
console.log(`${result.project.brand ?? result.project.name} — ${result.release?.ready ? 'READY' : 'BLOCKED'}`);
|
|
518
|
+
console.log(`${result.project.brand ?? result.project.name} — ${result.release?.status === 'ready-with-waivers' ? 'READY WITH WAIVERS' : result.release?.ready ? 'READY' : 'BLOCKED'}`);
|
|
515
519
|
console.log(` project: ${result.project.name} · ${result.project.site}`);
|
|
516
520
|
console.log(` workflow: ${result.workflow ? `${result.workflow.status}${result.workflow.currentStage ? ` at ${result.workflow.currentStage}` : ''}` : 'not started'}`);
|
|
517
521
|
console.log(` brand: ${result.brandDiscovery}`);
|
|
@@ -521,7 +525,7 @@ function status(args) {
|
|
|
521
525
|
console.log(` generation: ${nativeAdoption ? 'not applicable (native Astro source preserved)' : result.generation ? `${result.generation.pages} pages · ${result.generation.complete ? 'complete' : 'active'}` : 'not started'}`);
|
|
522
526
|
console.log(` entity map: ${result.entityMap.enabled ? 'enabled' : 'disabled'}`);
|
|
523
527
|
console.log(` qa: ${Object.entries(result.qa).map(([name, report]) => `${name.replace('-check', '')}=${report ? report.status ?? (report.passed ? 'passed' : 'failed') : 'missing'}`).join(' ')}`);
|
|
524
|
-
console.log(` release: ${result.release?.releaseId ?? 'unavailable'} · ${result.release?.ready ? 'ready' : `${result.release?.blocking ?? '?'} blocking`}`);
|
|
528
|
+
console.log(` release: ${result.release?.releaseId ?? 'unavailable'} · ${result.release?.status === 'ready-with-waivers' ? `ready with ${result.release.waived} waiver${result.release.waived === 1 ? '' : 's'}` : result.release?.ready ? 'ready' : `${result.release?.blocking ?? '?'} blocking`}`);
|
|
525
529
|
console.log(` deployment: ${result.deployment ? `${result.deployment.provider}${result.deployment.latest ? ` · last ${result.deployment.latest.status}` : ' · never deployed'}` : 'not configured'}`);
|
|
526
530
|
}
|
|
527
531
|
|
|
@@ -1018,16 +1022,18 @@ function handoffCommand(args) {
|
|
|
1018
1022
|
|
|
1019
1023
|
function releaseCommand(args) {
|
|
1020
1024
|
const subcommand = args[0] ?? 'check';
|
|
1021
|
-
const { positional } = parseOptions(args.slice(1));
|
|
1022
|
-
const target = projectDirectory(positional[0] ?? '.');
|
|
1025
|
+
const { options, positional } = parseOptions(args.slice(1));
|
|
1026
|
+
const target = projectDirectory(['waive', 'unwaive'].includes(subcommand) ? positional[1] ?? '.' : positional[0] ?? '.');
|
|
1023
1027
|
if (subcommand === 'check') {
|
|
1024
|
-
|
|
1028
|
+
writeEntityMap(target);
|
|
1025
1029
|
const report = evaluateDelivery(target);
|
|
1026
1030
|
const files = writeDeliveryReport(target, report);
|
|
1027
|
-
|
|
1031
|
+
const label = report.status === 'ready-with-waivers' ? 'READY WITH WAIVERS' : report.ready ? 'READY' : 'BLOCKED';
|
|
1032
|
+
console.log(`Delivery: ${label}, release ${report.releaseId}, ${report.summary.blocking} blockers, ${report.summary.waived} waived`);
|
|
1028
1033
|
console.log(`Manifest: ${files.markdownFile}`);
|
|
1029
1034
|
if (!report.ready) {
|
|
1030
|
-
for (const item of report.findings.slice(0, 20)) console.error(`- ${item.
|
|
1035
|
+
for (const item of report.findings.filter((finding) => !finding.waived).slice(0, 20)) console.error(`- ${item.id}: ${item.code} — ${item.message}${item.waivable ? ' (waivable)' : ''}`);
|
|
1036
|
+
if (report.findings.some((finding) => !finding.waived && finding.waivable)) console.error('To accept an exact reviewed finding: cosmo release waive <finding-id> . --reason "why this is acceptable" --by "your name"');
|
|
1031
1037
|
process.exitCode = 1;
|
|
1032
1038
|
}
|
|
1033
1039
|
return;
|
|
@@ -1036,6 +1042,37 @@ function releaseCommand(args) {
|
|
|
1036
1042
|
console.log(readDelivery(target).markdown.trimEnd());
|
|
1037
1043
|
return;
|
|
1038
1044
|
}
|
|
1045
|
+
if (subcommand === 'waive') {
|
|
1046
|
+
if (!positional[0]) throw new Error('Usage: cosmo release waive <finding-id> [directory] --reason text --by name [--expires date]');
|
|
1047
|
+
const current = readDelivery(target).data;
|
|
1048
|
+
const finding = current.findings.find((item) => item.id === positional[0]);
|
|
1049
|
+
if (!finding) throw new Error(`Finding ${positional[0]} is not in the latest delivery report. Run cosmo release check . and use the displayed finding id.`);
|
|
1050
|
+
const result = recordReleaseWaiver(target, finding, { reason: options.reason, approvedBy: options.by, expiresAt: options.expires ?? null });
|
|
1051
|
+
const report = evaluateDelivery(target);
|
|
1052
|
+
writeDeliveryReport(target, report);
|
|
1053
|
+
console.log(`Recorded waiver for ${finding.id}: ${finding.code}`);
|
|
1054
|
+
console.log(`Approved by ${result.waiver.approvedBy}: ${result.waiver.reason}`);
|
|
1055
|
+
console.log(`Delivery: ${report.status === 'ready-with-waivers' ? 'READY WITH WAIVERS' : report.ready ? 'READY' : 'BLOCKED'}, ${report.summary.blocking} blockers, ${report.summary.waived} waived`);
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
if (subcommand === 'unwaive') {
|
|
1059
|
+
if (!positional[0]) throw new Error('Usage: cosmo release unwaive <finding-id> [directory] --reason text --by name');
|
|
1060
|
+
const result = revokeReleaseWaiver(target, positional[0], { reason: options.reason, revokedBy: options.by });
|
|
1061
|
+
const report = evaluateDelivery(target);
|
|
1062
|
+
writeDeliveryReport(target, report);
|
|
1063
|
+
console.log(`Revoked waiver for ${result.waiver.findingId} by ${result.waiver.revokedBy}.`);
|
|
1064
|
+
console.log(`Delivery: ${report.ready ? 'READY' : 'BLOCKED'}, ${report.summary.blocking} blockers`);
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
if (subcommand === 'waivers') {
|
|
1068
|
+
const record = readReleaseWaivers(target);
|
|
1069
|
+
if (!record.data.waivers.length) return console.log('No release waivers are recorded.');
|
|
1070
|
+
for (const waiver of record.data.waivers) {
|
|
1071
|
+
const state = waiver.revokedAt ? `revoked ${waiver.revokedAt} by ${waiver.revokedBy}` : waiver.expiresAt && Date.parse(waiver.expiresAt) <= Date.now() ? `expired ${waiver.expiresAt}` : 'active';
|
|
1072
|
+
console.log(`${waiver.findingId} ${state}\n ${waiver.code}: ${waiver.message}\n ${waiver.approvedBy}: ${waiver.reason}`);
|
|
1073
|
+
}
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1039
1076
|
throw new Error(`Unknown release command: ${subcommand}`);
|
|
1040
1077
|
}
|
|
1041
1078
|
|
|
@@ -4,13 +4,39 @@ import path from 'node:path';
|
|
|
4
4
|
import { readIntelligence } from './intelligence.mjs';
|
|
5
5
|
import { readPlan } from './plan.mjs';
|
|
6
6
|
import { readProject, writeJson } from './project.mjs';
|
|
7
|
+
import { activeReleaseWaivers, releaseWaiverFile } from './release-waivers.mjs';
|
|
7
8
|
import { readWorkflowState } from './workflow.mjs';
|
|
8
9
|
|
|
9
10
|
const BASE_REQUIRED_REPORTS = ['integrity-check', 'content-check', 'intelligence-check', 'site-check', 'browser-check'];
|
|
10
11
|
const PLACEHOLDER_PATTERN = /complete this|replace this placeholder|hello@example\.com|\(000\) 000-0000|tel:\+10000000000/i;
|
|
11
12
|
|
|
12
|
-
function finding(code, message, fix) {
|
|
13
|
-
|
|
13
|
+
function finding(code, message, fix, { source = 'release', scope = 'project', waivable = false } = {}) {
|
|
14
|
+
const fingerprint = crypto.createHash('sha256').update(JSON.stringify({ source, scope, code, message })).digest('hex');
|
|
15
|
+
return { id: `${source}-${fingerprint.slice(0, 10)}`, fingerprint, source, scope, code, severity: 'blocking', message, fix, waivable };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function detailText(value) {
|
|
19
|
+
if (typeof value === 'string') return value;
|
|
20
|
+
if (value === null || value === undefined) return '';
|
|
21
|
+
return JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function reportBlockingFindings(name, report) {
|
|
25
|
+
const candidates = [];
|
|
26
|
+
const add = (item, fallbackScope = 'site') => {
|
|
27
|
+
if (!item || typeof item !== 'object') return;
|
|
28
|
+
const severity = item.severity ?? 'critical';
|
|
29
|
+
if (!['blocking', 'critical'].includes(severity)) return;
|
|
30
|
+
const code = String(item.code ?? item.rule ?? 'reported-finding');
|
|
31
|
+
const scope = String(item.scope ?? item.pageId ?? item.route ?? fallbackScope);
|
|
32
|
+
const detail = detailText(item.message ?? item.detail);
|
|
33
|
+
candidates.push(finding(code, detail || `${name} reported ${code}.`, String(item.fix ?? `Review the ${name} finding and either resolve it or record why it is acceptable for this project.`), { source: name, scope, waivable: true }));
|
|
34
|
+
};
|
|
35
|
+
for (const item of report?.findings ?? []) add(item);
|
|
36
|
+
for (const item of report?.critical ?? []) add(item);
|
|
37
|
+
for (const page of report?.pages ?? []) for (const item of page?.findings ?? []) add(item, page.pageId ?? page.route ?? 'page');
|
|
38
|
+
for (const pack of report?.packs ?? []) for (const item of pack?.findings ?? []) add(item, pack.id ?? 'pack');
|
|
39
|
+
return candidates;
|
|
14
40
|
}
|
|
15
41
|
|
|
16
42
|
function optionalJson(file) {
|
|
@@ -61,14 +87,19 @@ function releaseHash(projectDir, files) {
|
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
function renderDelivery(report) {
|
|
64
|
-
const reports = report.reports.map((item) => `- \`${item.path}\`: **${item.status}
|
|
65
|
-
const
|
|
66
|
-
|
|
90
|
+
const reports = report.reports.map((item) => `- \`${item.path}\`: **${item.status}**${item.waived ? ` (${item.waived} blocking finding${item.waived === 1 ? '' : 's'} accepted by recorded waiver)` : ''}`).join('\n');
|
|
91
|
+
const openFindings = report.findings.filter((item) => !item.waived);
|
|
92
|
+
const waivedFindings = report.findings.filter((item) => item.waived);
|
|
93
|
+
const blockers = openFindings.length
|
|
94
|
+
? openFindings.map((item) => `- **${item.id} — ${item.code}:** ${item.message}\n - ${item.waivable ? 'Waivable after explicit review.' : 'Required gate; cannot be waived.'}\n - Fix: ${item.fix}`).join('\n')
|
|
95
|
+
: '- None.';
|
|
96
|
+
const waivers = waivedFindings.length
|
|
97
|
+
? waivedFindings.map((item) => `- **${item.id} — ${item.code}:** ${item.message}\n - Source: ${item.source}${item.scope ? ` / ${item.scope}` : ''}\n - Decision: accepted by ${item.waiver.approvedBy} on ${item.waiver.approvedAt}${item.waiver.expiresAt ? `; expires ${item.waiver.expiresAt}` : ''}\n - Reason: ${item.waiver.reason}\n - Original recommendation: ${item.fix}`).join('\n')
|
|
67
98
|
: '- None.';
|
|
68
99
|
const planLine = report.project.sourceModel === 'native-astro'
|
|
69
100
|
? `Native route inventory: ${report.plan.approved ? 'approved' : 'not approved'}, ${report.plan.pages} routes, URL format ${report.plan.routeFormat ?? 'unknown'}`
|
|
70
101
|
: `Plan: ${report.plan.approved ? 'approved' : 'not approved'}, ${report.plan.pages} pages, ${report.plan.indexable} indexable`;
|
|
71
|
-
return `# Delivery Readiness\n\n- Release: \`${report.releaseId}\`\n- Checked: ${report.checkedAt}\n- Status: **${report.ready ? 'READY' : 'BLOCKED'}**\n- Brand: ${report.project.brand}\n- Site: ${report.project.site}\n- Intelligence: ${report.intelligence.profile}${report.intelligence.packs.length ? ` (${report.intelligence.packs.join(', ')})` : ' (no optional packs)'}\n- ${planLine}\n\n## Reports\n\n${reports}\n\n##
|
|
102
|
+
return `# Delivery Readiness\n\n- Release: \`${report.releaseId}\`\n- Checked: ${report.checkedAt}\n- Status: **${report.status === 'ready-with-waivers' ? 'READY WITH WAIVERS' : report.ready ? 'READY' : 'BLOCKED'}**\n- Brand: ${report.project.brand}\n- Site: ${report.project.site}\n- Intelligence: ${report.intelligence.profile}${report.intelligence.packs.length ? ` (${report.intelligence.packs.join(', ')})` : ' (no optional packs)'}\n- ${planLine}\n\n## Reports\n\n${reports}\n\n## Open blocking findings\n\n${blockers}\n\n## Recorded waivers\n\n${waivers}\n\nWaivers preserve the original finding and recommendation. They apply only to the exact finding fingerprint recorded above; a changed finding requires a new decision. This manifest records local readiness at one source hash. Any later source change requires the relevant checks and release evaluation to run again.\n`;
|
|
72
103
|
}
|
|
73
104
|
|
|
74
105
|
export function evaluateDelivery(projectDir) {
|
|
@@ -120,17 +151,49 @@ export function evaluateDelivery(projectDir) {
|
|
|
120
151
|
let status = 'missing';
|
|
121
152
|
if (data?.invalid) status = 'invalid';
|
|
122
153
|
else if (data) status = data.passed === true ? 'passed' : 'failed';
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
154
|
+
if (['passed', 'failed'].includes(status) && fs.statSync(file).mtimeMs < latestInputMtime) status = 'stale';
|
|
155
|
+
let findingIds = [];
|
|
156
|
+
if (status === 'failed') {
|
|
157
|
+
const reported = reportBlockingFindings(name, data);
|
|
158
|
+
if (reported.length) {
|
|
159
|
+
findings.push(...reported);
|
|
160
|
+
findingIds = reported.map((item) => item.id);
|
|
161
|
+
} else {
|
|
162
|
+
const item = finding(`report-${name}-failed`, `${name}.json failed without structured blocking findings.`, `Rerun the ${name.replace('-check', '')} check and inspect the report.`);
|
|
163
|
+
findings.push(item);
|
|
164
|
+
findingIds = [item.id];
|
|
165
|
+
}
|
|
166
|
+
} else if (status !== 'passed') {
|
|
167
|
+
const item = finding(`report-${name}-${status}`, `${name}.json is ${status}.`, `Rerun the ${name.replace('-check', '')} check after the latest source changes.`);
|
|
168
|
+
findings.push(item);
|
|
169
|
+
findingIds = [item.id];
|
|
170
|
+
}
|
|
171
|
+
return { name, path: `.cosmo/reports/${name}.json`, status, checkedAt: data?.checkedAt ?? data?.generatedAt ?? null, findingIds };
|
|
126
172
|
});
|
|
127
173
|
const intelligenceReport = optionalJson(path.join(projectDir, '.cosmo', 'reports', 'intelligence-check.json'));
|
|
128
174
|
if (intelligenceReport && !intelligenceReport.invalid && JSON.stringify(intelligenceReport.selectedPacks ?? []) !== JSON.stringify(intelligence.packs)) findings.push(finding('intelligence-selection-drift', 'The intelligence report was produced for a different pack selection.', 'Rerun cosmo intelligence check with the current selection.'));
|
|
129
175
|
|
|
176
|
+
let waiverRecord;
|
|
177
|
+
try { waiverRecord = activeReleaseWaivers(projectDir); }
|
|
178
|
+
catch (error) {
|
|
179
|
+
findings.push(finding('release-waivers-invalid', error.message, 'Repair or remove the invalid release waiver file; waiver history must remain trustworthy.'));
|
|
180
|
+
waiverRecord = { file: releaseWaiverFile(projectDir), data: { version: 1, waivers: [] }, active: [] };
|
|
181
|
+
}
|
|
182
|
+
const activeByFingerprint = new Map(waiverRecord.active.map((waiver) => [waiver.fingerprint, waiver]));
|
|
183
|
+
const reviewedFindings = findings.map((item) => {
|
|
184
|
+
const waiver = item.waivable ? activeByFingerprint.get(item.fingerprint) : null;
|
|
185
|
+
return waiver && waiver.findingId === item.id ? { ...item, waived: true, waiver } : { ...item, waived: false };
|
|
186
|
+
});
|
|
187
|
+
for (const item of reports) item.waived = reviewedFindings.filter((finding) => finding.source === item.name && finding.waived).length;
|
|
188
|
+
const openFindings = reviewedFindings.filter((item) => !item.waived);
|
|
189
|
+
const waivedFindings = reviewedFindings.filter((item) => item.waived);
|
|
190
|
+
const releaseInputs = fs.existsSync(waiverRecord.file) ? [...inputs, waiverRecord.file] : inputs;
|
|
191
|
+
const ready = openFindings.length === 0;
|
|
130
192
|
const report = {
|
|
131
|
-
version:
|
|
132
|
-
releaseId: releaseHash(projectDir,
|
|
133
|
-
ready
|
|
193
|
+
version: 2,
|
|
194
|
+
releaseId: releaseHash(projectDir, releaseInputs),
|
|
195
|
+
ready,
|
|
196
|
+
status: ready ? (waivedFindings.length ? 'ready-with-waivers' : 'ready') : 'blocked',
|
|
134
197
|
checkedAt: new Date().toISOString(),
|
|
135
198
|
project: { name: project.name, brand: project.brand, site: project.site, stage: project.stage, sourceModel: project.sourceModel ?? 'cosmo-content' },
|
|
136
199
|
intelligence: { profile: intelligence.profile, packs: intelligence.packs },
|
|
@@ -138,8 +201,9 @@ export function evaluateDelivery(projectDir) {
|
|
|
138
201
|
workflow: workflow ? { status: workflow.status, workflowId: workflow.workflowId, currentStage: workflow.currentStage } : null,
|
|
139
202
|
generation: !nativeAdoption && progress && !progress.invalid ? { complete: progress.complete, summary: progress.summary ?? null } : null,
|
|
140
203
|
reports,
|
|
141
|
-
summary: { blocking:
|
|
142
|
-
findings,
|
|
204
|
+
summary: { blocking: openFindings.length, waived: waivedFindings.length, total: reviewedFindings.length },
|
|
205
|
+
findings: reviewedFindings,
|
|
206
|
+
waiverFile: fs.existsSync(waiverRecord.file) ? path.relative(projectDir, waiverRecord.file) : null,
|
|
143
207
|
};
|
|
144
208
|
return report;
|
|
145
209
|
}
|
|
@@ -127,7 +127,7 @@ export function deploymentPreflight(projectDir, environment) {
|
|
|
127
127
|
assert(fs.existsSync(recordedFile), 'Production deployment requires a recorded READY release. Run cosmo release check.');
|
|
128
128
|
const recorded = JSON.parse(fs.readFileSync(recordedFile, 'utf8'));
|
|
129
129
|
assert(recorded.ready === true, 'Production deployment requires a READY delivery manifest.');
|
|
130
|
-
assert(delivery.ready === true, `Production release is no longer ready:\n${delivery.findings.map((item) => `- ${item.code}: ${item.message}`).join('\n')}`);
|
|
130
|
+
assert(delivery.ready === true, `Production release is no longer ready:\n${delivery.findings.filter((item) => !item.waived).map((item) => `- ${item.code}: ${item.message}`).join('\n')}`);
|
|
131
131
|
assert(recorded.releaseId === delivery.releaseId, `Production release drifted from ${recorded.releaseId} to ${delivery.releaseId}. Rerun QA and cosmo release check.`);
|
|
132
132
|
}
|
|
133
133
|
return { config, environment, output, releaseId: delivery.releaseId, releaseReady: delivery.ready };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readProject, writeJson } from './project.mjs';
|
|
4
|
+
|
|
5
|
+
export class ReleaseWaiverError extends Error {}
|
|
6
|
+
|
|
7
|
+
export function releaseWaiverFile(projectDir) {
|
|
8
|
+
return path.join(projectDir, '.cosmo', 'release-waivers.json');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function assert(condition, message) {
|
|
12
|
+
if (!condition) throw new ReleaseWaiverError(message);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function validDate(value) {
|
|
16
|
+
return typeof value === 'string' && value.trim() && !Number.isNaN(Date.parse(value));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function validateReleaseWaivers(value) {
|
|
20
|
+
assert(value && typeof value === 'object' && !Array.isArray(value), 'Release waivers must be a JSON object.');
|
|
21
|
+
assert(value.version === 1, 'Release waiver version must be 1.');
|
|
22
|
+
assert(Array.isArray(value.waivers), 'Release waivers need a waivers array.');
|
|
23
|
+
for (const waiver of value.waivers) {
|
|
24
|
+
assert(waiver && typeof waiver === 'object' && !Array.isArray(waiver), 'Every release waiver must be an object.');
|
|
25
|
+
for (const key of ['findingId', 'fingerprint', 'source', 'code', 'reason', 'approvedBy', 'approvedAt']) {
|
|
26
|
+
assert(typeof waiver[key] === 'string' && waiver[key].trim(), `Release waiver ${waiver.findingId ?? 'unknown'} needs ${key}.`);
|
|
27
|
+
}
|
|
28
|
+
assert(validDate(waiver.approvedAt), `Release waiver ${waiver.findingId} has an invalid approvedAt date.`);
|
|
29
|
+
if (waiver.expiresAt !== null && waiver.expiresAt !== undefined) assert(validDate(waiver.expiresAt), `Release waiver ${waiver.findingId} has an invalid expiresAt date.`);
|
|
30
|
+
if (waiver.revokedAt !== null && waiver.revokedAt !== undefined) {
|
|
31
|
+
assert(validDate(waiver.revokedAt), `Release waiver ${waiver.findingId} has an invalid revokedAt date.`);
|
|
32
|
+
assert(typeof waiver.revokedBy === 'string' && waiver.revokedBy.trim(), `Revoked waiver ${waiver.findingId} needs revokedBy.`);
|
|
33
|
+
assert(typeof waiver.revocationReason === 'string' && waiver.revocationReason.trim(), `Revoked waiver ${waiver.findingId} needs revocationReason.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function readReleaseWaivers(projectDir, { required = false } = {}) {
|
|
40
|
+
readProject(projectDir);
|
|
41
|
+
const file = releaseWaiverFile(projectDir);
|
|
42
|
+
if (!fs.existsSync(file)) {
|
|
43
|
+
if (required) throw new ReleaseWaiverError('No release waivers exist for this project.');
|
|
44
|
+
return { file, data: { version: 1, waivers: [] } };
|
|
45
|
+
}
|
|
46
|
+
let value;
|
|
47
|
+
try { value = JSON.parse(fs.readFileSync(file, 'utf8')); }
|
|
48
|
+
catch { throw new ReleaseWaiverError('Release waiver file is not valid JSON.'); }
|
|
49
|
+
return { file, data: validateReleaseWaivers(value) };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function activeReleaseWaivers(projectDir, now = Date.now()) {
|
|
53
|
+
const { file, data } = readReleaseWaivers(projectDir);
|
|
54
|
+
return {
|
|
55
|
+
file,
|
|
56
|
+
data,
|
|
57
|
+
active: data.waivers.filter((waiver) => !waiver.revokedAt && (!waiver.expiresAt || Date.parse(waiver.expiresAt) > now)),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function recordReleaseWaiver(projectDir, finding, { reason, approvedBy, expiresAt = null } = {}) {
|
|
62
|
+
assert(finding && finding.id, 'Choose a finding from the latest release check.');
|
|
63
|
+
assert(finding.waivable === true, `Finding ${finding.id} is a required project or process gate and cannot be waived.`);
|
|
64
|
+
assert(finding.waived !== true, `Finding ${finding.id} already has an active waiver.`);
|
|
65
|
+
assert(typeof reason === 'string' && reason.trim().length >= 10, 'A waiver reason of at least 10 characters is required.');
|
|
66
|
+
assert(typeof approvedBy === 'string' && approvedBy.trim(), 'The person approving the waiver is required with --by.');
|
|
67
|
+
if (expiresAt) assert(validDate(expiresAt), 'The optional waiver expiration must be a valid ISO date or date-time.');
|
|
68
|
+
const record = readReleaseWaivers(projectDir);
|
|
69
|
+
const waiver = {
|
|
70
|
+
findingId: finding.id,
|
|
71
|
+
fingerprint: finding.fingerprint,
|
|
72
|
+
source: finding.source,
|
|
73
|
+
scope: finding.scope ?? null,
|
|
74
|
+
code: finding.code,
|
|
75
|
+
message: finding.message,
|
|
76
|
+
reason: reason.trim(),
|
|
77
|
+
approvedBy: approvedBy.trim(),
|
|
78
|
+
approvedAt: new Date().toISOString(),
|
|
79
|
+
expiresAt: expiresAt || null,
|
|
80
|
+
};
|
|
81
|
+
record.data.waivers.push(waiver);
|
|
82
|
+
writeJson(record.file, record.data);
|
|
83
|
+
return { file: record.file, waiver };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function revokeReleaseWaiver(projectDir, findingId, { reason, revokedBy } = {}) {
|
|
87
|
+
assert(typeof reason === 'string' && reason.trim().length >= 5, 'A revocation reason of at least 5 characters is required.');
|
|
88
|
+
assert(typeof revokedBy === 'string' && revokedBy.trim(), 'The person revoking the waiver is required with --by.');
|
|
89
|
+
const record = readReleaseWaivers(projectDir, { required: true });
|
|
90
|
+
const waiver = [...record.data.waivers].reverse().find((item) => item.findingId === findingId && !item.revokedAt);
|
|
91
|
+
assert(waiver, `No active waiver exists for finding ${findingId}.`);
|
|
92
|
+
waiver.revokedAt = new Date().toISOString();
|
|
93
|
+
waiver.revokedBy = revokedBy.trim();
|
|
94
|
+
waiver.revocationReason = reason.trim();
|
|
95
|
+
writeJson(record.file, record.data);
|
|
96
|
+
return { file: record.file, waiver };
|
|
97
|
+
}
|
|
@@ -35,7 +35,7 @@ export function collectProjectStatus(projectDir) {
|
|
|
35
35
|
let release = null;
|
|
36
36
|
try {
|
|
37
37
|
const result = evaluateDelivery(projectDir);
|
|
38
|
-
release = { ready: result.ready, releaseId: result.releaseId, blocking: result.summary.blocking };
|
|
38
|
+
release = { ready: result.ready, status: result.status, releaseId: result.releaseId, blocking: result.summary.blocking, waived: result.summary.waived };
|
|
39
39
|
for (const report of result.reports) if (qa[report.name]) qa[report.name].status = report.status;
|
|
40
40
|
} catch (error) { release = { ready: false, error: error.message }; }
|
|
41
41
|
const deployment = json(path.join(projectDir, '.cosmo', 'deploy', 'config.json'));
|
|
@@ -68,7 +68,7 @@ For every stage:
|
|
|
68
68
|
|
|
69
69
|
Before page writing in a generated-content project, run `cosmo copy guide <page-id> .`. For a native adopted site, edit its existing source only when authorized and preserve its approved design baseline. Keep supplied, observed, inferred, and unknown information distinct. Do not imitate living writers, reproduce source language, fabricate reader psychology, or make unsupported attacks on alternatives. For new builds, explore at least three genuinely different visual directions and store the approved choice in `DESIGN-DIRECTION.md`, tokens, components, and Cosmo design artifacts.
|
|
70
70
|
|
|
71
|
-
Advance generation one state at a time. After two failed repair cycles, leave the page for human review. For release, run the build plus Copy Studio, content, intelligence, integrity, EntityMap when enabled, static, browser, and release checks. Deploy production only when the exact current release reports READY.
|
|
71
|
+
Advance generation one state at a time. After two failed repair cycles, leave the page for human review. For release, run the build plus Copy Studio, content, intelligence, integrity, EntityMap when enabled, static, browser, and release checks. Deploy production only when the exact current release reports READY or READY WITH WAIVERS. Never create a waiver merely to make a gate pass: present the exact finding and recommendation, and record one only after the user explicitly accepts that project-specific exception with their reason. Missing or stale reports and incomplete project/process gates are not waivable.
|
|
72
72
|
|
|
73
73
|
When the user asks to share a temporary preview, run `cosmo preview share .`. Explain that the generated address is public to anyone who has it, works only while the command remains running, and is not a production deployment. A missing `cloudflared` application is an optional-preview setup issue, not a project or release failure; follow Cosmo's displayed installation guidance and never request a Cloudflare API key for a Quick Tunnel.
|
|
74
74
|
|
|
@@ -128,7 +128,7 @@ At every stage:
|
|
|
128
128
|
5. Present approval-stage results and wait.
|
|
129
129
|
6. Submit and approve only through Cosmo CLI commands.
|
|
130
130
|
|
|
131
|
-
For design, explore at least three genuinely distinct directions and preserve the selected direction in repository artifacts. After the page plan is approved, run `cosmo copy brief --all . --replace`, complete each flexible annotated section contract, and obtain approval. Before drafting a page, run `cosmo copy guide <page-id> .` and follow its separate grounding, drafting, evidence, editorial, reader, and final passes. Never imitate a living writer, import private Lyra files, reproduce copyrighted source wording, fabricate reader psychology, or use unsupported attacks on an alternative. For generation, advance one page gate at a time and respect repair limits. For QA, run `cosmo copy check .` with integrity, content, intelligence, EntityMap when enabled, static, and browser checks. For production, require the exact current release to be READY.
|
|
131
|
+
For design, explore at least three genuinely distinct directions and preserve the selected direction in repository artifacts. After the page plan is approved, run `cosmo copy brief --all . --replace`, complete each flexible annotated section contract, and obtain approval. Before drafting a page, run `cosmo copy guide <page-id> .` and follow its separate grounding, drafting, evidence, editorial, reader, and final passes. Never imitate a living writer, import private Lyra files, reproduce copyrighted source wording, fabricate reader psychology, or use unsupported attacks on an alternative. For generation, advance one page gate at a time and respect repair limits. For QA, run `cosmo copy check .` with integrity, content, intelligence, EntityMap when enabled, static, and browser checks. For production, require the exact current release to be READY or READY WITH WAIVERS. Never create a waiver merely to make a gate pass: present the exact finding and recommendation, and record one only after the user explicitly accepts that project-specific exception with their reason. Missing or stale reports and incomplete project/process gates are not waivable.
|
|
132
132
|
|
|
133
133
|
When the user asks to share a temporary preview, run `cosmo preview share .`. Explain that the generated address is public to anyone who has it, works only while the command remains running, and is not a production deployment. A missing `cloudflared` application is an optional-preview setup issue, not a project or release failure; follow Cosmo's displayed installation guidance and never request a Cloudflare API key for a Quick Tunnel.
|
|
134
134
|
|