@nerviq/cli 0.0.1 → 0.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +181 -0
- package/LICENSE +21 -0
- package/README.md +447 -0
- package/bin/cli.js +749 -0
- package/content/case-study-template.md +91 -0
- package/content/claims-governance.md +37 -0
- package/content/claude-code/audit-repo/SKILL.md +20 -0
- package/content/claude-native-integration.md +60 -0
- package/content/devto-article.json +9 -0
- package/content/launch-posts.md +226 -0
- package/content/pilot-rollout-kit.md +30 -0
- package/content/release-checklist.md +31 -0
- package/package.json +53 -4
- package/src/activity.js +529 -0
- package/src/aider/activity.js +226 -0
- package/src/aider/config-parser.js +166 -0
- package/src/aider/context.js +158 -0
- package/src/aider/deep-review.js +316 -0
- package/src/aider/domain-packs.js +278 -0
- package/src/aider/freshness.js +168 -0
- package/src/aider/governance.js +253 -0
- package/src/aider/interactive.js +334 -0
- package/src/aider/mcp-packs.js +98 -0
- package/src/aider/patch.js +214 -0
- package/src/aider/plans.js +186 -0
- package/src/aider/premium.js +360 -0
- package/src/aider/setup.js +404 -0
- package/src/aider/techniques.js +1323 -0
- package/src/analyze.js +821 -0
- package/src/audit.js +1003 -0
- package/src/badge.js +13 -0
- package/src/benchmark.js +339 -0
- package/src/claudex-sync.json +7 -0
- package/src/codex/activity.js +324 -0
- package/src/codex/config-parser.js +183 -0
- package/src/codex/context.js +221 -0
- package/src/codex/deep-review.js +493 -0
- package/src/codex/domain-packs.js +372 -0
- package/src/codex/freshness.js +167 -0
- package/src/codex/governance.js +192 -0
- package/src/codex/interactive.js +618 -0
- package/src/codex/mcp-packs.js +660 -0
- package/src/codex/patch.js +209 -0
- package/src/codex/plans.js +251 -0
- package/src/codex/premium.js +614 -0
- package/src/codex/setup.js +603 -0
- package/src/codex/techniques.js +2649 -0
- package/src/context.js +272 -0
- package/src/copilot/activity.js +309 -0
- package/src/copilot/config-parser.js +226 -0
- package/src/copilot/context.js +197 -0
- package/src/copilot/deep-review.js +346 -0
- package/src/copilot/domain-packs.js +350 -0
- package/src/copilot/freshness.js +197 -0
- package/src/copilot/governance.js +222 -0
- package/src/copilot/interactive.js +406 -0
- package/src/copilot/mcp-packs.js +572 -0
- package/src/copilot/patch.js +238 -0
- package/src/copilot/plans.js +253 -0
- package/src/copilot/premium.js +450 -0
- package/src/copilot/setup.js +488 -0
- package/src/copilot/techniques.js +1822 -0
- package/src/cursor/activity.js +301 -0
- package/src/cursor/config-parser.js +265 -0
- package/src/cursor/context.js +236 -0
- package/src/cursor/deep-review.js +334 -0
- package/src/cursor/domain-packs.js +346 -0
- package/src/cursor/freshness.js +214 -0
- package/src/cursor/governance.js +229 -0
- package/src/cursor/interactive.js +391 -0
- package/src/cursor/mcp-packs.js +571 -0
- package/src/cursor/patch.js +243 -0
- package/src/cursor/plans.js +254 -0
- package/src/cursor/premium.js +468 -0
- package/src/cursor/setup.js +488 -0
- package/src/cursor/techniques.js +1786 -0
- package/src/deep-review.js +345 -0
- package/src/domain-packs.js +364 -0
- package/src/formatters/sarif.js +115 -0
- package/src/gemini/activity.js +402 -0
- package/src/gemini/config-parser.js +275 -0
- package/src/gemini/context.js +221 -0
- package/src/gemini/deep-review.js +559 -0
- package/src/gemini/domain-packs.js +371 -0
- package/src/gemini/freshness.js +204 -0
- package/src/gemini/governance.js +201 -0
- package/src/gemini/interactive.js +860 -0
- package/src/gemini/mcp-packs.js +658 -0
- package/src/gemini/patch.js +229 -0
- package/src/gemini/plans.js +269 -0
- package/src/gemini/premium.js +759 -0
- package/src/gemini/setup.js +692 -0
- package/src/gemini/techniques.js +2084 -0
- package/src/governance.js +523 -0
- package/src/harmony/advisor.js +383 -0
- package/src/harmony/audit.js +303 -0
- package/src/harmony/canon.js +444 -0
- package/src/harmony/cli.js +331 -0
- package/src/harmony/drift.js +401 -0
- package/src/harmony/governance.js +313 -0
- package/src/harmony/memory.js +238 -0
- package/src/harmony/sync.js +458 -0
- package/src/harmony/watch.js +336 -0
- package/src/index.js +256 -0
- package/src/insights.js +119 -0
- package/src/interactive.js +118 -0
- package/src/mcp-packs.js +597 -0
- package/src/opencode/activity.js +286 -0
- package/src/opencode/config-parser.js +109 -0
- package/src/opencode/context.js +247 -0
- package/src/opencode/deep-review.js +313 -0
- package/src/opencode/domain-packs.js +240 -0
- package/src/opencode/freshness.js +158 -0
- package/src/opencode/governance.js +159 -0
- package/src/opencode/interactive.js +392 -0
- package/src/opencode/mcp-packs.js +474 -0
- package/src/opencode/patch.js +184 -0
- package/src/opencode/plans.js +231 -0
- package/src/opencode/premium.js +413 -0
- package/src/opencode/setup.js +449 -0
- package/src/opencode/techniques.js +1713 -0
- package/src/plans.js +655 -0
- package/src/secret-patterns.js +30 -0
- package/src/setup.js +1274 -0
- package/src/synergy/adaptive.js +261 -0
- package/src/synergy/compensation.js +156 -0
- package/src/synergy/evidence.js +193 -0
- package/src/synergy/learning.js +184 -0
- package/src/synergy/patterns.js +227 -0
- package/src/synergy/ranking.js +83 -0
- package/src/synergy/report.js +163 -0
- package/src/synergy/routing.js +152 -0
- package/src/techniques.js +1354 -0
- package/src/watch.js +229 -0
- package/src/windsurf/activity.js +302 -0
- package/src/windsurf/config-parser.js +267 -0
- package/src/windsurf/context.js +249 -0
- package/src/windsurf/deep-review.js +337 -0
- package/src/windsurf/domain-packs.js +348 -0
- package/src/windsurf/freshness.js +215 -0
- package/src/windsurf/governance.js +231 -0
- package/src/windsurf/interactive.js +388 -0
- package/src/windsurf/mcp-packs.js +535 -0
- package/src/windsurf/patch.js +231 -0
- package/src/windsurf/plans.js +247 -0
- package/src/windsurf/premium.js +467 -0
- package/src/windsurf/setup.js +471 -0
- package/src/windsurf/techniques.js +1758 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
const CODEX_DOMAIN_PACKS = [
|
|
2
|
+
{
|
|
3
|
+
key: 'baseline-general',
|
|
4
|
+
label: 'Baseline General',
|
|
5
|
+
useWhen: 'General Codex repos that need a safe, reviewable baseline before deeper specialization.',
|
|
6
|
+
adoption: 'Safe default when no stronger domain signal dominates the repo.',
|
|
7
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Review workflow starter'],
|
|
8
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
9
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
10
|
+
benchmarkFocus: ['starter-safe improvement', 'reviewable trust posture'],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: 'backend-api',
|
|
14
|
+
label: 'Backend API',
|
|
15
|
+
useWhen: 'Service, API, or backend-heavy repos with routes, services, jobs, schemas, or data access.',
|
|
16
|
+
adoption: 'Recommended when Codex needs stronger verification and review structure around backend changes.',
|
|
17
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Backend verification guide', 'CI / review workflow starter'],
|
|
18
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config', 'codex-ci-review'],
|
|
19
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml', '.github/workflows/'],
|
|
20
|
+
benchmarkFocus: ['test + build verification', 'reviewable API changes', 'safe rollout posture'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'frontend-ui',
|
|
24
|
+
label: 'Frontend UI',
|
|
25
|
+
useWhen: 'React, Next.js, Vue, Angular, or Svelte repos with UI-heavy workflows and component work.',
|
|
26
|
+
adoption: 'Recommended when Codex needs better component, build, and review guidance.',
|
|
27
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Frontend review workflow', 'CI / review workflow starter'],
|
|
28
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config', 'codex-ci-review'],
|
|
29
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml', '.github/workflows/'],
|
|
30
|
+
benchmarkFocus: ['build verification', 'component-safe edits', 'reviewable UI changes'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: 'enterprise-governed',
|
|
34
|
+
label: 'Enterprise Governed',
|
|
35
|
+
useWhen: 'Repos with CI, policy files, security posture, or auditable team workflows that need stronger Codex governance.',
|
|
36
|
+
adoption: 'Recommended for teams that need explicit approvals, review expectations, and durable rollout evidence.',
|
|
37
|
+
recommendedModules: ['Codex config baseline', 'Codex rules baseline', 'Review workflow starter', 'Governance rollout kit'],
|
|
38
|
+
recommendedProposalFamilies: ['codex-config', 'codex-rules', 'codex-ci-review'],
|
|
39
|
+
recommendedSurfaces: ['.codex/config.toml', 'codex/rules/', '.github/workflows/'],
|
|
40
|
+
benchmarkFocus: ['policy-aware rollout', 'approval posture', 'repeatable governance evidence'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'monorepo',
|
|
44
|
+
label: 'Monorepo',
|
|
45
|
+
useWhen: 'Workspace-based repos with multiple packages sharing a root and a need for scoped Codex behavior.',
|
|
46
|
+
adoption: 'Recommended when path-aware rules and workspace review boundaries matter.',
|
|
47
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex rules baseline', 'Workspace-aware rules', 'Review workflow starter'],
|
|
48
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-rules', 'codex-ci-review'],
|
|
49
|
+
recommendedSurfaces: ['AGENTS.md', 'codex/rules/', '.github/workflows/'],
|
|
50
|
+
benchmarkFocus: ['workspace-safe edits', 'package-scoped review', 'cross-package drift control'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'infra-platform',
|
|
54
|
+
label: 'Infra Platform',
|
|
55
|
+
useWhen: 'Terraform, Docker, Kubernetes, serverless, or deployment-oriented repos with operational blast radius.',
|
|
56
|
+
adoption: 'Recommended when Codex changes need stronger guardrails, review gates, and infra-aware verification.',
|
|
57
|
+
recommendedModules: ['Codex config baseline', 'Codex rules baseline', 'Infra review workflow', 'CI / review workflow starter'],
|
|
58
|
+
recommendedProposalFamilies: ['codex-config', 'codex-rules', 'codex-ci-review'],
|
|
59
|
+
recommendedSurfaces: ['.codex/config.toml', 'codex/rules/', '.github/workflows/'],
|
|
60
|
+
benchmarkFocus: ['release safety', 'infra verification', 'reviewable operational changes'],
|
|
61
|
+
},
|
|
62
|
+
// --- Parity expansion: 10 new packs to match Claude's 16 ---
|
|
63
|
+
{
|
|
64
|
+
key: 'data-pipeline',
|
|
65
|
+
label: 'Data Pipeline',
|
|
66
|
+
useWhen: 'Repos with workers, DAGs, ETL jobs, migrations, or analytics-heavy workflows.',
|
|
67
|
+
adoption: 'Recommended when Codex needs pipeline-safe verification and state-aware review.',
|
|
68
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Pipeline verification guide'],
|
|
69
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config', 'codex-ci-review'],
|
|
70
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml', '.github/workflows/'],
|
|
71
|
+
benchmarkFocus: ['pipeline safety', 'repeatable task flows', 'state-aware review'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: 'oss-library',
|
|
75
|
+
label: 'OSS Library',
|
|
76
|
+
useWhen: 'Public packages or contributor-heavy repos that need lighter governance.',
|
|
77
|
+
adoption: 'Recommended for open-source repos where Codex should suggest, not auto-apply.',
|
|
78
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline'],
|
|
79
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
80
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
81
|
+
benchmarkFocus: ['low-footprint adoption', 'contributor-safe defaults', 'manual review friendliness'],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'mobile',
|
|
85
|
+
label: 'Mobile',
|
|
86
|
+
useWhen: 'React Native, Flutter, Swift, or Kotlin repos with mobile-specific build and test workflows.',
|
|
87
|
+
adoption: 'Recommended when Codex needs mobile build awareness and platform-specific verification.',
|
|
88
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Mobile verification guide'],
|
|
89
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
90
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
91
|
+
benchmarkFocus: ['mobile build safety', 'platform-specific verification', 'reviewable native changes'],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'regulated-lite',
|
|
95
|
+
label: 'Regulated Lite',
|
|
96
|
+
useWhen: 'Repos with basic compliance needs — activity artifacts, rollback manifests, and audit trail.',
|
|
97
|
+
adoption: 'Recommended for regulated-adjacent repos that need governance without full enterprise overhead.',
|
|
98
|
+
recommendedModules: ['Codex config baseline', 'Codex rules baseline', 'Governance rollout kit'],
|
|
99
|
+
recommendedProposalFamilies: ['codex-config', 'codex-rules'],
|
|
100
|
+
recommendedSurfaces: ['.codex/config.toml', 'codex/rules/'],
|
|
101
|
+
benchmarkFocus: ['compliance posture', 'activity artifact coverage', 'rollback readiness'],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: 'ecommerce',
|
|
105
|
+
label: 'E-commerce',
|
|
106
|
+
useWhen: 'Shopify, Stripe, or payment-heavy repos with transaction safety needs.',
|
|
107
|
+
adoption: 'Recommended when Codex changes touch payment flows, cart logic, or sensitive data.',
|
|
108
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Security review workflow'],
|
|
109
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config', 'codex-ci-review'],
|
|
110
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml', '.github/workflows/'],
|
|
111
|
+
benchmarkFocus: ['transaction safety', 'payment flow review', 'PII-safe changes'],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: 'ai-ml',
|
|
115
|
+
label: 'AI / ML',
|
|
116
|
+
useWhen: 'Repos with ML pipelines, model training, RAG, or LLM integration workflows.',
|
|
117
|
+
adoption: 'Recommended when Codex needs model-aware verification and experiment tracking.',
|
|
118
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'ML verification guide'],
|
|
119
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
120
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
121
|
+
benchmarkFocus: ['model safety', 'experiment reproducibility', 'data pipeline review'],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: 'devops-cicd',
|
|
125
|
+
label: 'DevOps / CI-CD',
|
|
126
|
+
useWhen: 'Repos focused on CI/CD pipelines, deployment automation, and infrastructure-as-code.',
|
|
127
|
+
adoption: 'Recommended when Codex manages CI workflows, deployment scripts, or release processes.',
|
|
128
|
+
recommendedModules: ['Codex config baseline', 'Codex rules baseline', 'CI / review workflow starter'],
|
|
129
|
+
recommendedProposalFamilies: ['codex-config', 'codex-rules', 'codex-ci-review'],
|
|
130
|
+
recommendedSurfaces: ['.codex/config.toml', 'codex/rules/', '.github/workflows/'],
|
|
131
|
+
benchmarkFocus: ['deployment safety', 'CI pipeline review', 'release gate coverage'],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: 'design-system',
|
|
135
|
+
label: 'Design System',
|
|
136
|
+
useWhen: 'Component libraries, Storybook repos, or design token systems.',
|
|
137
|
+
adoption: 'Recommended when Codex edits shared UI components with downstream consumers.',
|
|
138
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline', 'Component review workflow'],
|
|
139
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
140
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
141
|
+
benchmarkFocus: ['component safety', 'visual regression awareness', 'cross-consumer impact'],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: 'docs-content',
|
|
145
|
+
label: 'Docs / Content',
|
|
146
|
+
useWhen: 'Documentation repos, blogs, or content-heavy sites with editorial workflows.',
|
|
147
|
+
adoption: 'Recommended when Codex edits prose, docs, or content with editorial review needs.',
|
|
148
|
+
recommendedModules: ['AGENTS.md baseline', 'Codex config baseline'],
|
|
149
|
+
recommendedProposalFamilies: ['codex-agents-md', 'codex-config'],
|
|
150
|
+
recommendedSurfaces: ['AGENTS.md', '.codex/config.toml'],
|
|
151
|
+
benchmarkFocus: ['content quality', 'editorial review', 'link and reference integrity'],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
key: 'security-focused',
|
|
155
|
+
label: 'Security Focused',
|
|
156
|
+
useWhen: 'Repos with strong security posture needs — secret management, auth, encryption.',
|
|
157
|
+
adoption: 'Recommended for security-critical repos where every Codex change needs security review.',
|
|
158
|
+
recommendedModules: ['Codex config baseline', 'Codex rules baseline', 'Security review workflow'],
|
|
159
|
+
recommendedProposalFamilies: ['codex-config', 'codex-rules', 'codex-ci-review'],
|
|
160
|
+
recommendedSurfaces: ['.codex/config.toml', 'codex/rules/', '.github/workflows/'],
|
|
161
|
+
benchmarkFocus: ['secret protection', 'auth flow safety', 'security review coverage'],
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
function uniqueByKey(items) {
|
|
166
|
+
const seen = new Set();
|
|
167
|
+
const result = [];
|
|
168
|
+
for (const item of items) {
|
|
169
|
+
if (seen.has(item.key)) continue;
|
|
170
|
+
seen.add(item.key);
|
|
171
|
+
result.push(item);
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function detectCodexDomainPacks(ctx, stacks = [], assets = {}) {
|
|
177
|
+
const stackKeys = new Set((stacks || []).map((stack) => stack.key));
|
|
178
|
+
const pkg = ctx.jsonFile ? (ctx.jsonFile('package.json') || {}) : {};
|
|
179
|
+
const deps = ctx.projectDependencies ? ctx.projectDependencies() : {
|
|
180
|
+
...(pkg.dependencies || {}),
|
|
181
|
+
...(pkg.devDependencies || {}),
|
|
182
|
+
};
|
|
183
|
+
const matches = [];
|
|
184
|
+
|
|
185
|
+
function addMatch(key, reasons) {
|
|
186
|
+
const pack = CODEX_DOMAIN_PACKS.find((item) => item.key === key);
|
|
187
|
+
if (!pack) return;
|
|
188
|
+
matches.push({
|
|
189
|
+
...pack,
|
|
190
|
+
matchReasons: reasons.filter(Boolean).slice(0, 3),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const hasFrontend = stackKeys.has('react') || stackKeys.has('nextjs') || stackKeys.has('vue') ||
|
|
195
|
+
stackKeys.has('angular') || stackKeys.has('svelte') ||
|
|
196
|
+
ctx.hasDir('components') || ctx.hasDir('pages') ||
|
|
197
|
+
(ctx.hasDir('app') && (deps.next || deps.react || deps.vue || deps['@angular/core'] || deps.svelte));
|
|
198
|
+
|
|
199
|
+
const hasBackend = stackKeys.has('python') || stackKeys.has('django') || stackKeys.has('fastapi') ||
|
|
200
|
+
stackKeys.has('go') || stackKeys.has('rust') || stackKeys.has('java') ||
|
|
201
|
+
ctx.hasDir('api') || ctx.hasDir('routes') || ctx.hasDir('services') || ctx.hasDir('controllers') ||
|
|
202
|
+
ctx.hasDir('workers') || ctx.hasDir('jobs');
|
|
203
|
+
|
|
204
|
+
const hasInfra = stackKeys.has('docker') || stackKeys.has('terraform') || stackKeys.has('kubernetes') ||
|
|
205
|
+
ctx.files.includes('wrangler.toml') || ctx.files.includes('serverless.yml') || ctx.files.includes('serverless.yaml') ||
|
|
206
|
+
ctx.files.includes('cdk.json') || ctx.hasDir('infra') || ctx.hasDir('deploy') || ctx.hasDir('helm');
|
|
207
|
+
|
|
208
|
+
const isMonorepo = ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
|
|
209
|
+
ctx.files.includes('lerna.json') || ctx.files.includes('pnpm-workspace.yaml') ||
|
|
210
|
+
ctx.hasDir('packages') ||
|
|
211
|
+
(pkg.workspaces && (Array.isArray(pkg.workspaces) ? pkg.workspaces.length > 0 : true));
|
|
212
|
+
|
|
213
|
+
const hasCi = (typeof ctx.workflowFiles === 'function' ? ctx.workflowFiles().length : 0) > 0 ||
|
|
214
|
+
ctx.hasDir('.github/workflows');
|
|
215
|
+
const hasPolicyFiles = Boolean(ctx.fileContent('SECURITY.md') || ctx.fileContent('CODEOWNERS')) ||
|
|
216
|
+
ctx.hasDir('compliance') || ctx.hasDir('policies') || ctx.hasDir('audit');
|
|
217
|
+
const explicitTrust = Boolean(assets.trust && assets.trust.approvalPolicy && assets.trust.sandboxMode);
|
|
218
|
+
const ruleCoverage = Number(assets.counts && assets.counts.rules) > 0;
|
|
219
|
+
const workflowCoverage = Number(assets.counts && assets.counts.workflows) > 0;
|
|
220
|
+
const isEnterpriseGoverned = (hasCi && explicitTrust) || hasPolicyFiles || (ruleCoverage && workflowCoverage);
|
|
221
|
+
|
|
222
|
+
if (hasBackend) {
|
|
223
|
+
addMatch('backend-api', [
|
|
224
|
+
'Detected backend stack or service-oriented directories for Codex to navigate.',
|
|
225
|
+
ctx.hasDir('api') ? 'API-facing structure detected.' : null,
|
|
226
|
+
ctx.hasDir('services') ? 'Service-layer directories detected.' : null,
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (hasFrontend) {
|
|
231
|
+
addMatch('frontend-ui', [
|
|
232
|
+
'Detected UI-heavy frontend stack or component directories.',
|
|
233
|
+
stackKeys.has('nextjs') ? 'Next.js stack detected.' : null,
|
|
234
|
+
ctx.hasDir('components') ? 'Component directories detected.' : null,
|
|
235
|
+
]);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (isEnterpriseGoverned) {
|
|
239
|
+
addMatch('enterprise-governed', [
|
|
240
|
+
'Detected team-governed rollout signals such as CI, policies, or explicit Codex trust posture.',
|
|
241
|
+
hasCi ? 'GitHub workflow automation detected.' : null,
|
|
242
|
+
hasPolicyFiles ? 'Security/compliance policy files detected.' : null,
|
|
243
|
+
]);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (isMonorepo) {
|
|
247
|
+
addMatch('monorepo', [
|
|
248
|
+
'Detected workspace or multi-package repository structure.',
|
|
249
|
+
ctx.files.includes('pnpm-workspace.yaml') ? 'pnpm workspace detected.' : null,
|
|
250
|
+
ctx.hasDir('packages') ? 'Packages directory detected.' : null,
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (hasInfra) {
|
|
255
|
+
addMatch('infra-platform', [
|
|
256
|
+
'Detected infrastructure or deployment-oriented repo signals.',
|
|
257
|
+
ctx.files.includes('wrangler.toml') ? 'Wrangler config detected.' : null,
|
|
258
|
+
ctx.hasDir('infra') ? 'Infrastructure directory detected.' : null,
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// --- Parity expansion: detect 10 new domain packs ---
|
|
263
|
+
|
|
264
|
+
const hasDataPipeline = ctx.hasDir('dags') || ctx.hasDir('etl') || ctx.hasDir('pipelines') ||
|
|
265
|
+
ctx.hasDir('marts') || ctx.hasDir('migrations') ||
|
|
266
|
+
deps.airflow || deps.prefect || deps.dagster || deps.dbt;
|
|
267
|
+
if (hasDataPipeline) {
|
|
268
|
+
addMatch('data-pipeline', [
|
|
269
|
+
'Detected data pipeline or ETL-oriented repo signals.',
|
|
270
|
+
ctx.hasDir('dags') ? 'DAG directory detected.' : null,
|
|
271
|
+
]);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const isOss = ctx.files.includes('LICENSE') && ctx.files.includes('CONTRIBUTING.md');
|
|
275
|
+
if (isOss && !isEnterpriseGoverned) {
|
|
276
|
+
addMatch('oss-library', [
|
|
277
|
+
'Detected open-source library signals (LICENSE + CONTRIBUTING.md).',
|
|
278
|
+
]);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const isMobile = stackKeys.has('react-native') || stackKeys.has('flutter') ||
|
|
282
|
+
stackKeys.has('swift') || stackKeys.has('kotlin') ||
|
|
283
|
+
deps['react-native'] || deps.flutter || ctx.files.includes('Podfile') ||
|
|
284
|
+
ctx.files.includes('build.gradle') || ctx.hasDir('ios') || ctx.hasDir('android');
|
|
285
|
+
if (isMobile) {
|
|
286
|
+
addMatch('mobile', [
|
|
287
|
+
'Detected mobile development signals.',
|
|
288
|
+
ctx.hasDir('ios') ? 'iOS directory detected.' : null,
|
|
289
|
+
ctx.hasDir('android') ? 'Android directory detected.' : null,
|
|
290
|
+
]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const isRegulated = hasPolicyFiles && !isEnterpriseGoverned;
|
|
294
|
+
if (isRegulated) {
|
|
295
|
+
addMatch('regulated-lite', [
|
|
296
|
+
'Detected compliance-adjacent signals without full enterprise governance.',
|
|
297
|
+
]);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const isEcommerce = deps.stripe || deps['@stripe/stripe-js'] ||
|
|
301
|
+
deps.shopify || deps['@shopify/shopify-api'] ||
|
|
302
|
+
ctx.hasDir('checkout') || ctx.hasDir('cart') || ctx.hasDir('payments');
|
|
303
|
+
if (isEcommerce) {
|
|
304
|
+
addMatch('ecommerce', [
|
|
305
|
+
'Detected e-commerce or payment-related signals.',
|
|
306
|
+
deps.stripe ? 'Stripe dependency detected.' : null,
|
|
307
|
+
]);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const isAiMl = deps.tensorflow || deps.torch || deps.pytorch || deps.transformers ||
|
|
311
|
+
deps.langchain || deps['@langchain/core'] || deps.openai || deps.anthropic ||
|
|
312
|
+
ctx.hasDir('models') || ctx.hasDir('training') || ctx.hasDir('rag') ||
|
|
313
|
+
ctx.files.includes('model.py') || ctx.files.includes('train.py');
|
|
314
|
+
if (isAiMl) {
|
|
315
|
+
addMatch('ai-ml', [
|
|
316
|
+
'Detected AI/ML or model training signals.',
|
|
317
|
+
ctx.hasDir('models') ? 'Models directory detected.' : null,
|
|
318
|
+
]);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const isDevops = hasCi && hasInfra && !isEnterpriseGoverned;
|
|
322
|
+
if (isDevops) {
|
|
323
|
+
addMatch('devops-cicd', [
|
|
324
|
+
'Detected DevOps/CI-CD focus with both CI workflows and infrastructure.',
|
|
325
|
+
]);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const isDesignSystem = ctx.hasDir('stories') || ctx.hasDir('storybook') ||
|
|
329
|
+
deps['@storybook/react'] || deps['@storybook/vue3'] ||
|
|
330
|
+
ctx.files.includes('.storybook');
|
|
331
|
+
if (isDesignSystem) {
|
|
332
|
+
addMatch('design-system', [
|
|
333
|
+
'Detected design system or component library signals.',
|
|
334
|
+
ctx.hasDir('stories') ? 'Storybook stories detected.' : null,
|
|
335
|
+
]);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const isDocsContent = ctx.hasDir('docs') && !hasBackend && !hasFrontend &&
|
|
339
|
+
(ctx.files.includes('mkdocs.yml') || ctx.files.includes('docusaurus.config.js') ||
|
|
340
|
+
ctx.files.includes('_config.yml') || ctx.files.includes('hugo.toml'));
|
|
341
|
+
if (isDocsContent) {
|
|
342
|
+
addMatch('docs-content', [
|
|
343
|
+
'Detected documentation or content-focused repo.',
|
|
344
|
+
]);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const isSecurityFocused = ctx.hasDir('security') ||
|
|
348
|
+
deps['helmet'] || deps['csurf'] || deps['bcrypt'] ||
|
|
349
|
+
(hasPolicyFiles && ctx.fileContent('SECURITY.md'));
|
|
350
|
+
if (isSecurityFocused) {
|
|
351
|
+
addMatch('security-focused', [
|
|
352
|
+
'Detected security-focused repo signals.',
|
|
353
|
+
ctx.fileContent('SECURITY.md') ? 'SECURITY.md present.' : null,
|
|
354
|
+
]);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (matches.length === 0) {
|
|
358
|
+
addMatch('baseline-general', [
|
|
359
|
+
'No stronger platform-specific domain dominated, so a safe general Codex baseline is the best starting point.',
|
|
360
|
+
assets.instructionPath
|
|
361
|
+
? 'The repo already has Codex surfaces, but they are not yet specialized by domain.'
|
|
362
|
+
: 'The repo needs a first Codex baseline before specialization.',
|
|
363
|
+
]);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return uniqueByKey(matches);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
module.exports = {
|
|
370
|
+
CODEX_DOMAIN_PACKS,
|
|
371
|
+
detectCodexDomainPacks,
|
|
372
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex Freshness Operationalization — CP-12
|
|
3
|
+
*
|
|
4
|
+
* Release gates, recurring probes, propagation checklists,
|
|
5
|
+
* and staleness blocking for Codex surfaces.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { version } = require('../../package.json');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* P0 sources that must be fresh before any Codex release claim.
|
|
12
|
+
* Each source has a staleness threshold in days.
|
|
13
|
+
*/
|
|
14
|
+
const P0_SOURCES = [
|
|
15
|
+
{
|
|
16
|
+
key: 'codex-cli-docs',
|
|
17
|
+
label: 'Codex CLI Official Docs',
|
|
18
|
+
url: 'https://docs.codex.ai',
|
|
19
|
+
stalenessThresholdDays: 30,
|
|
20
|
+
verifiedAt: null, // Set during release gate check
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'codex-config-reference',
|
|
24
|
+
label: 'Codex Config Reference',
|
|
25
|
+
url: 'https://docs.codex.ai/config',
|
|
26
|
+
stalenessThresholdDays: 30,
|
|
27
|
+
verifiedAt: null,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: 'codex-github-action',
|
|
31
|
+
label: 'Codex GitHub Action',
|
|
32
|
+
url: 'https://github.com/openai/codex-action',
|
|
33
|
+
stalenessThresholdDays: 30,
|
|
34
|
+
verifiedAt: null,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: 'codex-changelog',
|
|
38
|
+
label: 'Codex CLI Changelog',
|
|
39
|
+
url: 'https://github.com/openai/codex-cli/releases',
|
|
40
|
+
stalenessThresholdDays: 14,
|
|
41
|
+
verifiedAt: null,
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Propagation checklist: when a Codex source changes, these must update.
|
|
47
|
+
*/
|
|
48
|
+
const PROPAGATION_CHECKLIST = [
|
|
49
|
+
{
|
|
50
|
+
trigger: 'Codex CLI release with config changes',
|
|
51
|
+
targets: [
|
|
52
|
+
'src/codex/techniques.js — update LEGACY_CONFIG_PATTERNS if keys renamed/removed',
|
|
53
|
+
'src/codex/config-parser.js — update validation rules',
|
|
54
|
+
'src/codex/governance.js — update caveats if behavior changes',
|
|
55
|
+
'test/codex-check-matrix.js — update check expectations',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
trigger: 'New Codex hook event type added',
|
|
60
|
+
targets: [
|
|
61
|
+
'src/codex/techniques.js — add to SUPPORTED_HOOK_EVENTS',
|
|
62
|
+
'src/codex/governance.js — add to CODEX_HOOK_REGISTRY',
|
|
63
|
+
'src/codex/setup.js — update hooks starter template',
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
trigger: 'New Codex MCP transport or field',
|
|
68
|
+
targets: [
|
|
69
|
+
'src/codex/mcp-packs.js — update pack TOML projections',
|
|
70
|
+
'src/codex/techniques.js — update MCP checks',
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
trigger: 'Codex domain pack definitions change',
|
|
75
|
+
targets: [
|
|
76
|
+
'src/codex/domain-packs.js — update pack registry',
|
|
77
|
+
'src/codex/governance.js — governance export picks up changes',
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
trigger: 'New check category added',
|
|
82
|
+
targets: [
|
|
83
|
+
'src/codex/techniques.js — add check implementations',
|
|
84
|
+
'test/codex-check-matrix.js — add pass/fail scenarios',
|
|
85
|
+
'test/codex-golden-matrix.js — update golden scores',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Release gate: check if all P0 sources are within staleness threshold.
|
|
92
|
+
* Returns { ready, stale, fresh } arrays.
|
|
93
|
+
*/
|
|
94
|
+
function checkReleaseGate(sourceVerifications = {}) {
|
|
95
|
+
const now = new Date();
|
|
96
|
+
const results = P0_SOURCES.map(source => {
|
|
97
|
+
const verifiedAt = sourceVerifications[source.key]
|
|
98
|
+
? new Date(sourceVerifications[source.key])
|
|
99
|
+
: source.verifiedAt ? new Date(source.verifiedAt) : null;
|
|
100
|
+
|
|
101
|
+
if (!verifiedAt) {
|
|
102
|
+
return { ...source, status: 'unverified', daysStale: null };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const daysSince = Math.floor((now - verifiedAt) / (1000 * 60 * 60 * 24));
|
|
106
|
+
const isStale = daysSince > source.stalenessThresholdDays;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
...source,
|
|
110
|
+
verifiedAt: verifiedAt.toISOString(),
|
|
111
|
+
daysStale: daysSince,
|
|
112
|
+
status: isStale ? 'stale' : 'fresh',
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
ready: results.every(r => r.status === 'fresh'),
|
|
118
|
+
stale: results.filter(r => r.status === 'stale' || r.status === 'unverified'),
|
|
119
|
+
fresh: results.filter(r => r.status === 'fresh'),
|
|
120
|
+
results,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Format the release gate results for display.
|
|
126
|
+
*/
|
|
127
|
+
function formatReleaseGate(gateResult) {
|
|
128
|
+
const lines = [
|
|
129
|
+
`Codex Freshness Gate (nerviq v${version})`,
|
|
130
|
+
'═══════════════════════════════════════',
|
|
131
|
+
'',
|
|
132
|
+
`Status: ${gateResult.ready ? 'READY' : 'BLOCKED'}`,
|
|
133
|
+
`Fresh: ${gateResult.fresh.length}/${gateResult.results.length}`,
|
|
134
|
+
'',
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
for (const result of gateResult.results) {
|
|
138
|
+
const icon = result.status === 'fresh' ? '✓' : result.status === 'stale' ? '✗' : '?';
|
|
139
|
+
const age = result.daysStale !== null ? ` (${result.daysStale}d ago)` : ' (unverified)';
|
|
140
|
+
lines.push(` ${icon} ${result.label}${age} — threshold: ${result.stalenessThresholdDays}d`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!gateResult.ready) {
|
|
144
|
+
lines.push('');
|
|
145
|
+
lines.push('Action required: verify stale/unverified sources before claiming release freshness.');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return lines.join('\n');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get the propagation checklist for a given trigger.
|
|
153
|
+
*/
|
|
154
|
+
function getPropagationTargets(triggerKeyword) {
|
|
155
|
+
const keyword = triggerKeyword.toLowerCase();
|
|
156
|
+
return PROPAGATION_CHECKLIST.filter(item =>
|
|
157
|
+
item.trigger.toLowerCase().includes(keyword)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = {
|
|
162
|
+
P0_SOURCES,
|
|
163
|
+
PROPAGATION_CHECKLIST,
|
|
164
|
+
checkReleaseGate,
|
|
165
|
+
formatReleaseGate,
|
|
166
|
+
getPropagationTargets,
|
|
167
|
+
};
|