@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.
- 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,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot Premium Operator UX
|
|
3
|
+
*
|
|
4
|
+
* Three subsystems:
|
|
5
|
+
* 1. Multi-Pack Composition Engine — merge domain + MCP packs with dedup, conflict resolution
|
|
6
|
+
* 2. CI Template Library — 5 GitHub Actions workflow templates (using GitHub native Copilot)
|
|
7
|
+
* 3. Adoption Signal Gate — activate features based on local usage telemetry (5 gates)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { COPILOT_DOMAIN_PACKS } = require('./domain-packs');
|
|
12
|
+
const { COPILOT_MCP_PACKS } = require('./mcp-packs');
|
|
13
|
+
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// 1. Multi-Pack Composition Engine
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
const PACK_DEPENDENCY_ORDER = [
|
|
19
|
+
'baseline-general',
|
|
20
|
+
'backend-api',
|
|
21
|
+
'frontend-ui',
|
|
22
|
+
'infra-platform',
|
|
23
|
+
'monorepo',
|
|
24
|
+
'enterprise-governed',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const PACK_SPECIFICITY = {
|
|
28
|
+
'baseline-general': 0,
|
|
29
|
+
'backend-api': 2,
|
|
30
|
+
'frontend-ui': 2,
|
|
31
|
+
'infra-platform': 3,
|
|
32
|
+
'monorepo': 3,
|
|
33
|
+
'enterprise-governed': 4,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const DEFAULT_SIZE_BUDGET = 16000;
|
|
37
|
+
|
|
38
|
+
function lookupDomainPack(key) {
|
|
39
|
+
return COPILOT_DOMAIN_PACKS.find(p => p.key === key) || null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function lookupMcpPack(key) {
|
|
43
|
+
return COPILOT_MCP_PACKS.find(p => p.key === key) || null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Compose domain packs and MCP packs into a unified, deduplicated, ordered result.
|
|
48
|
+
* Copilot-specific: tracks cloudAgentCompatible for each MCP pack.
|
|
49
|
+
*/
|
|
50
|
+
function composePacks(domainPackKeys = [], mcpPackKeys = [], options = {}) {
|
|
51
|
+
const sizeBudget = options.sizeBudget || DEFAULT_SIZE_BUDGET;
|
|
52
|
+
const warnings = [];
|
|
53
|
+
|
|
54
|
+
// --- Resolve domain packs ---
|
|
55
|
+
const seenDomainKeys = new Set();
|
|
56
|
+
const rawDomainPacks = [];
|
|
57
|
+
for (const key of domainPackKeys) {
|
|
58
|
+
if (seenDomainKeys.has(key)) continue;
|
|
59
|
+
seenDomainKeys.add(key);
|
|
60
|
+
const pack = lookupDomainPack(key);
|
|
61
|
+
if (!pack) { warnings.push(`Domain pack "${key}" not found, skipped.`); continue; }
|
|
62
|
+
rawDomainPacks.push(pack);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
rawDomainPacks.sort((a, b) => {
|
|
66
|
+
const orderA = PACK_DEPENDENCY_ORDER.indexOf(a.key);
|
|
67
|
+
const orderB = PACK_DEPENDENCY_ORDER.indexOf(b.key);
|
|
68
|
+
return (orderA === -1 ? 99 : orderA) - (orderB === -1 ? 99 : orderB);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const moduleOwner = new Map();
|
|
72
|
+
for (const pack of rawDomainPacks) {
|
|
73
|
+
const specificity = PACK_SPECIFICITY[pack.key] ?? 1;
|
|
74
|
+
for (const mod of pack.recommendedModules || []) {
|
|
75
|
+
const existing = moduleOwner.get(mod);
|
|
76
|
+
if (!existing || specificity > existing.specificity) {
|
|
77
|
+
moduleOwner.set(mod, { key: pack.key, specificity });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const allSurfaces = new Set();
|
|
83
|
+
for (const pack of rawDomainPacks) {
|
|
84
|
+
for (const surface of pack.recommendedSurfaces || []) allSurfaces.add(surface);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const allProposalFamilies = new Set();
|
|
88
|
+
for (const pack of rawDomainPacks) {
|
|
89
|
+
for (const family of pack.recommendedProposalFamilies || []) allProposalFamilies.add(family);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// --- Resolve MCP packs ---
|
|
93
|
+
const seenMcpKeys = new Set();
|
|
94
|
+
const resolvedMcpPacks = [];
|
|
95
|
+
for (const key of mcpPackKeys) {
|
|
96
|
+
if (seenMcpKeys.has(key)) continue;
|
|
97
|
+
seenMcpKeys.add(key);
|
|
98
|
+
const pack = lookupMcpPack(key);
|
|
99
|
+
if (!pack) { warnings.push(`MCP pack "${key}" not found, skipped.`); continue; }
|
|
100
|
+
resolvedMcpPacks.push(pack);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const mergedExcludeTools = new Set();
|
|
104
|
+
for (const pack of resolvedMcpPacks) {
|
|
105
|
+
for (const tool of pack.excludeTools || []) mergedExcludeTools.add(tool);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const mergedRequiredAuth = new Set();
|
|
109
|
+
for (const pack of resolvedMcpPacks) {
|
|
110
|
+
for (const auth of pack.requiredAuth || []) mergedRequiredAuth.add(auth);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Copilot-specific: separate cloud-compatible from VS Code-only MCP packs
|
|
114
|
+
const cloudCompatible = resolvedMcpPacks.filter(p => p.cloudAgentCompatible !== false);
|
|
115
|
+
const vscodeOnly = resolvedMcpPacks.filter(p => p.cloudAgentCompatible === false);
|
|
116
|
+
|
|
117
|
+
const estimatedSize = estimateCompositionSize(rawDomainPacks, resolvedMcpPacks);
|
|
118
|
+
const overBudget = estimatedSize > sizeBudget;
|
|
119
|
+
if (overBudget) {
|
|
120
|
+
warnings.push(`Combined instruction size (~${estimatedSize} chars) exceeds budget (${sizeBudget}).`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
domainPacks: rawDomainPacks.map(p => ({
|
|
125
|
+
key: p.key,
|
|
126
|
+
label: p.label,
|
|
127
|
+
modulesOwned: [...moduleOwner.entries()].filter(([, owner]) => owner.key === p.key).map(([mod]) => mod),
|
|
128
|
+
})),
|
|
129
|
+
mcpPacks: resolvedMcpPacks.map(p => ({
|
|
130
|
+
key: p.key,
|
|
131
|
+
label: p.label,
|
|
132
|
+
serverName: p.serverName,
|
|
133
|
+
trustLevel: p.trustLevel,
|
|
134
|
+
cloudAgentCompatible: p.cloudAgentCompatible,
|
|
135
|
+
})),
|
|
136
|
+
cloudCompatibleMcpPacks: cloudCompatible.map(p => p.key),
|
|
137
|
+
vscodeOnlyMcpPacks: vscodeOnly.map(p => p.key),
|
|
138
|
+
merged: {
|
|
139
|
+
surfaces: [...allSurfaces],
|
|
140
|
+
proposalFamilies: [...allProposalFamilies],
|
|
141
|
+
modules: [...moduleOwner.entries()].map(([mod, owner]) => ({ module: mod, owner: owner.key })),
|
|
142
|
+
excludeTools: [...mergedExcludeTools].sort(),
|
|
143
|
+
requiredAuth: [...mergedRequiredAuth].sort(),
|
|
144
|
+
},
|
|
145
|
+
budget: {
|
|
146
|
+
estimatedSize,
|
|
147
|
+
limit: sizeBudget,
|
|
148
|
+
overBudget,
|
|
149
|
+
utilization: Math.round((estimatedSize / sizeBudget) * 100),
|
|
150
|
+
},
|
|
151
|
+
warnings,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function estimateCompositionSize(domainPacks, mcpPacks) {
|
|
156
|
+
let size = 0;
|
|
157
|
+
for (const pack of domainPacks) {
|
|
158
|
+
size += (pack.label || '').length + (pack.useWhen || '').length + (pack.adoption || '').length;
|
|
159
|
+
size += JSON.stringify(pack.recommendedModules || []).length;
|
|
160
|
+
size += JSON.stringify(pack.benchmarkFocus || []).length;
|
|
161
|
+
}
|
|
162
|
+
for (const pack of mcpPacks) {
|
|
163
|
+
size += (pack.label || '').length + (pack.description || '').length;
|
|
164
|
+
size += JSON.stringify(pack.jsonProjection || {}).length;
|
|
165
|
+
size += JSON.stringify(pack.excludeTools || []).length;
|
|
166
|
+
}
|
|
167
|
+
return size;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
// 2. CI Template Library (5 templates — using GitHub native Copilot)
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
|
|
174
|
+
const CI_TEMPLATES = [
|
|
175
|
+
{
|
|
176
|
+
key: 'copilot-pr-review',
|
|
177
|
+
label: 'Copilot PR Review',
|
|
178
|
+
filename: 'copilot-pr-review.yml',
|
|
179
|
+
description: 'Runs Copilot code review on pull request diffs.',
|
|
180
|
+
trigger: 'pull_request',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: 'copilot-issue-triage',
|
|
184
|
+
label: 'Copilot Issue Triage',
|
|
185
|
+
filename: 'copilot-issue-triage.yml',
|
|
186
|
+
description: 'Assigns and labels issues using Copilot cloud agent.',
|
|
187
|
+
trigger: 'issues.opened',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
key: 'copilot-scheduled-audit',
|
|
191
|
+
label: 'Copilot Scheduled Audit',
|
|
192
|
+
filename: 'copilot-scheduled-audit.yml',
|
|
193
|
+
description: 'Weekly Copilot audit of codebase health.',
|
|
194
|
+
trigger: 'schedule (cron)',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: 'copilot-test-gen',
|
|
198
|
+
label: 'Copilot Test Generation',
|
|
199
|
+
filename: 'copilot-test-gen.yml',
|
|
200
|
+
description: 'Generates test stubs for new files using Copilot.',
|
|
201
|
+
trigger: 'pull_request',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
key: 'copilot-docs-sync',
|
|
205
|
+
label: 'Copilot Docs Sync',
|
|
206
|
+
filename: 'copilot-docs-sync.yml',
|
|
207
|
+
description: 'Checks documentation staleness using Copilot.',
|
|
208
|
+
trigger: 'schedule (cron)',
|
|
209
|
+
},
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
const TEMPLATE_CONTENT = {
|
|
213
|
+
'copilot-pr-review': `# Copilot PR Review — generated by nerviq
|
|
214
|
+
name: Copilot PR Review
|
|
215
|
+
|
|
216
|
+
on:
|
|
217
|
+
pull_request:
|
|
218
|
+
types: [opened, synchronize]
|
|
219
|
+
|
|
220
|
+
permissions:
|
|
221
|
+
contents: read
|
|
222
|
+
pull-requests: write
|
|
223
|
+
|
|
224
|
+
jobs:
|
|
225
|
+
copilot-review:
|
|
226
|
+
runs-on: ubuntu-latest
|
|
227
|
+
timeout-minutes: 15
|
|
228
|
+
steps:
|
|
229
|
+
- uses: actions/checkout@v4
|
|
230
|
+
- name: Copilot Code Review
|
|
231
|
+
uses: github/copilot-code-review@v1
|
|
232
|
+
with:
|
|
233
|
+
review-mode: comments
|
|
234
|
+
`,
|
|
235
|
+
|
|
236
|
+
'copilot-issue-triage': `# Copilot Issue Triage — generated by nerviq
|
|
237
|
+
# Assigns Copilot cloud agent to triage new issues.
|
|
238
|
+
name: Copilot Issue Triage
|
|
239
|
+
|
|
240
|
+
on:
|
|
241
|
+
issues:
|
|
242
|
+
types: [opened]
|
|
243
|
+
|
|
244
|
+
permissions:
|
|
245
|
+
issues: write
|
|
246
|
+
|
|
247
|
+
jobs:
|
|
248
|
+
triage:
|
|
249
|
+
runs-on: ubuntu-latest
|
|
250
|
+
steps:
|
|
251
|
+
- uses: actions/checkout@v4
|
|
252
|
+
- name: Assign to Copilot
|
|
253
|
+
run: |
|
|
254
|
+
gh issue comment \${{ github.event.issue.number }} --body "@copilot please triage this issue and suggest labels."
|
|
255
|
+
env:
|
|
256
|
+
GH_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
257
|
+
`,
|
|
258
|
+
|
|
259
|
+
'copilot-scheduled-audit': `# Copilot Scheduled Audit — generated by nerviq
|
|
260
|
+
name: Copilot Scheduled Audit
|
|
261
|
+
|
|
262
|
+
on:
|
|
263
|
+
schedule:
|
|
264
|
+
- cron: '0 9 * * 1'
|
|
265
|
+
workflow_dispatch:
|
|
266
|
+
|
|
267
|
+
permissions:
|
|
268
|
+
contents: read
|
|
269
|
+
issues: write
|
|
270
|
+
|
|
271
|
+
jobs:
|
|
272
|
+
audit:
|
|
273
|
+
runs-on: ubuntu-latest
|
|
274
|
+
timeout-minutes: 30
|
|
275
|
+
steps:
|
|
276
|
+
- uses: actions/checkout@v4
|
|
277
|
+
- name: Run nerviq audit
|
|
278
|
+
run: npx nerviq --platform copilot --json > audit-report.json
|
|
279
|
+
- uses: actions/upload-artifact@v4
|
|
280
|
+
with:
|
|
281
|
+
name: copilot-audit-report
|
|
282
|
+
path: audit-report.json
|
|
283
|
+
retention-days: 30
|
|
284
|
+
`,
|
|
285
|
+
|
|
286
|
+
'copilot-test-gen': `# Copilot Test Generation — generated by nerviq
|
|
287
|
+
name: Copilot Test Generation
|
|
288
|
+
|
|
289
|
+
on:
|
|
290
|
+
pull_request:
|
|
291
|
+
types: [opened, synchronize]
|
|
292
|
+
|
|
293
|
+
permissions:
|
|
294
|
+
contents: read
|
|
295
|
+
pull-requests: write
|
|
296
|
+
|
|
297
|
+
jobs:
|
|
298
|
+
test-gen:
|
|
299
|
+
runs-on: ubuntu-latest
|
|
300
|
+
steps:
|
|
301
|
+
- uses: actions/checkout@v4
|
|
302
|
+
with:
|
|
303
|
+
fetch-depth: 0
|
|
304
|
+
- name: Detect New Files
|
|
305
|
+
id: new-files
|
|
306
|
+
run: |
|
|
307
|
+
FILES=$(git diff --name-only --diff-filter=A \${{ github.event.pull_request.base.sha }}..\${{ github.sha }})
|
|
308
|
+
SRC_FILES=$(echo "$FILES" | grep -E '\\.(js|ts|py|go|rs|java)$' || true)
|
|
309
|
+
echo "files=$SRC_FILES" >> $GITHUB_OUTPUT
|
|
310
|
+
- name: Suggest Tests via Copilot
|
|
311
|
+
if: steps.new-files.outputs.files != ''
|
|
312
|
+
run: |
|
|
313
|
+
echo "New files detected: \${{ steps.new-files.outputs.files }}"
|
|
314
|
+
echo "Consider assigning @copilot to generate test stubs."
|
|
315
|
+
`,
|
|
316
|
+
|
|
317
|
+
'copilot-docs-sync': `# Copilot Docs Sync — generated by nerviq
|
|
318
|
+
name: Copilot Docs Sync
|
|
319
|
+
|
|
320
|
+
on:
|
|
321
|
+
schedule:
|
|
322
|
+
- cron: '0 10 * * 3'
|
|
323
|
+
workflow_dispatch:
|
|
324
|
+
|
|
325
|
+
permissions:
|
|
326
|
+
contents: read
|
|
327
|
+
issues: write
|
|
328
|
+
|
|
329
|
+
jobs:
|
|
330
|
+
docs-check:
|
|
331
|
+
runs-on: ubuntu-latest
|
|
332
|
+
steps:
|
|
333
|
+
- uses: actions/checkout@v4
|
|
334
|
+
with:
|
|
335
|
+
fetch-depth: 0
|
|
336
|
+
- name: Check Doc Staleness
|
|
337
|
+
run: |
|
|
338
|
+
STALE_THRESHOLD=30
|
|
339
|
+
for doc_path in README.md CONTRIBUTING.md docs/; do
|
|
340
|
+
[ ! -e "$doc_path" ] && continue
|
|
341
|
+
LAST_MODIFIED=$(git log -1 --format="%ct" -- "$doc_path" 2>/dev/null || echo 0)
|
|
342
|
+
NOW=$(date +%s)
|
|
343
|
+
DAYS_OLD=$(( (NOW - LAST_MODIFIED) / 86400 ))
|
|
344
|
+
if [ "$DAYS_OLD" -gt "$STALE_THRESHOLD" ]; then
|
|
345
|
+
echo "STALE: $doc_path ($DAYS_OLD days old)"
|
|
346
|
+
fi
|
|
347
|
+
done
|
|
348
|
+
`,
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
function getCiTemplate(templateKey) {
|
|
352
|
+
const meta = CI_TEMPLATES.find(t => t.key === templateKey);
|
|
353
|
+
if (!meta) return null;
|
|
354
|
+
return TEMPLATE_CONTENT[templateKey] || null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ---------------------------------------------------------------------------
|
|
358
|
+
// 3. Adoption Signal Gate (5 gates)
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
|
|
361
|
+
const GATE_THRESHOLDS = {
|
|
362
|
+
'ci-templates': {
|
|
363
|
+
metric: 'auditCount',
|
|
364
|
+
threshold: 3,
|
|
365
|
+
description: 'Activate CI templates after 3+ successful audits.',
|
|
366
|
+
},
|
|
367
|
+
'cloud-agent': {
|
|
368
|
+
metric: 'auditCount',
|
|
369
|
+
threshold: 2,
|
|
370
|
+
description: 'Activate cloud agent setup after 2+ audits.',
|
|
371
|
+
},
|
|
372
|
+
'multi-pack': {
|
|
373
|
+
metric: 'auditCount',
|
|
374
|
+
threshold: 2,
|
|
375
|
+
description: 'Activate multi-pack composition after 2+ audits.',
|
|
376
|
+
},
|
|
377
|
+
'prompt-templates': {
|
|
378
|
+
metric: 'auditCount',
|
|
379
|
+
threshold: 3,
|
|
380
|
+
description: 'Activate prompt template generation after 3+ audits.',
|
|
381
|
+
},
|
|
382
|
+
'governance-upgrade': {
|
|
383
|
+
metric: 'averageScore',
|
|
384
|
+
threshold: 70,
|
|
385
|
+
description: 'Suggest governance upgrade when average score exceeds 70.',
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
function getCopilotHistory(dir, limit = 20) {
|
|
390
|
+
const fs = require('fs');
|
|
391
|
+
const snapshotDir = path.join(dir, '.claude', 'claudex-setup', 'snapshots');
|
|
392
|
+
try {
|
|
393
|
+
const files = fs.readdirSync(snapshotDir)
|
|
394
|
+
.filter(f => f.endsWith('.json'))
|
|
395
|
+
.sort()
|
|
396
|
+
.slice(-limit);
|
|
397
|
+
|
|
398
|
+
return files.map(f => {
|
|
399
|
+
try {
|
|
400
|
+
const data = JSON.parse(fs.readFileSync(path.join(snapshotDir, f), 'utf8'));
|
|
401
|
+
if (data.platform === 'copilot' || data.summary?.platform === 'copilot') return data;
|
|
402
|
+
return null;
|
|
403
|
+
} catch { return null; }
|
|
404
|
+
}).filter(Boolean);
|
|
405
|
+
} catch {
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function checkAdoptionGate(gateKey, dir) {
|
|
411
|
+
const gate = GATE_THRESHOLDS[gateKey];
|
|
412
|
+
if (!gate) {
|
|
413
|
+
return { activated: false, current: 0, threshold: 0, gate: gateKey, description: `Unknown gate "${gateKey}".` };
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const history = getCopilotHistory(dir, 100);
|
|
417
|
+
let current = 0;
|
|
418
|
+
|
|
419
|
+
switch (gate.metric) {
|
|
420
|
+
case 'auditCount':
|
|
421
|
+
current = history.length;
|
|
422
|
+
break;
|
|
423
|
+
case 'averageScore': {
|
|
424
|
+
const scores = history.map(e => e.summary?.score).filter(s => typeof s === 'number');
|
|
425
|
+
current = scores.length > 0 ? Math.round(scores.reduce((a, b) => a + b, 0) / scores.length) : 0;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
default:
|
|
429
|
+
current = 0;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return {
|
|
433
|
+
activated: current >= gate.threshold,
|
|
434
|
+
current,
|
|
435
|
+
threshold: gate.threshold,
|
|
436
|
+
gate: gateKey,
|
|
437
|
+
description: gate.description,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
module.exports = {
|
|
442
|
+
composePacks,
|
|
443
|
+
getCiTemplate,
|
|
444
|
+
CI_TEMPLATES,
|
|
445
|
+
checkAdoptionGate,
|
|
446
|
+
GATE_THRESHOLDS,
|
|
447
|
+
PACK_DEPENDENCY_ORDER,
|
|
448
|
+
PACK_SPECIFICITY,
|
|
449
|
+
DEFAULT_SIZE_BUDGET,
|
|
450
|
+
};
|