@nerviq/cli 0.0.1 → 0.9.0-beta.1

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