workflow-agent-cli 2.6.0 ā 2.7.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/dist/chunk-HKRWHFVI.js +415 -0
- package/dist/chunk-HKRWHFVI.js.map +1 -0
- package/dist/cli/index.js +369 -271
- package/dist/cli/index.js.map +1 -1
- package/dist/scripts/postinstall.js +16 -2
- package/dist/scripts/postinstall.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-LN5OAWEQ.js +0 -92
- package/dist/chunk-LN5OAWEQ.js.map +0 -1
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
// src/scripts/copilot-instructions-generator.ts
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync, readdirSync, mkdirSync } from "fs";
|
|
3
|
+
import { join, basename } from "path";
|
|
4
|
+
var CUSTOM_START_MARKER = "<!-- CUSTOM START -->";
|
|
5
|
+
var CUSTOM_END_MARKER = "<!-- CUSTOM END -->";
|
|
6
|
+
var GENERATED_MARKER = "<!-- AUTO-GENERATED BY WORKFLOW-AGENT - DO NOT EDIT ABOVE THIS LINE -->";
|
|
7
|
+
function extractTitle(content) {
|
|
8
|
+
const match = content.match(/^#\s+(.+)$/m);
|
|
9
|
+
return match ? match[1].trim() : "Untitled";
|
|
10
|
+
}
|
|
11
|
+
function extractDescription(content) {
|
|
12
|
+
const lines = content.split("\n");
|
|
13
|
+
let foundTitle = false;
|
|
14
|
+
let description = "";
|
|
15
|
+
for (const line of lines) {
|
|
16
|
+
if (line.startsWith("# ")) {
|
|
17
|
+
foundTitle = true;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (foundTitle) {
|
|
21
|
+
if (line.trim() === "" || line.startsWith(">")) {
|
|
22
|
+
if (description) break;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (line.startsWith("#") || line.startsWith("---") || line.startsWith("##")) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
description += line.trim() + " ";
|
|
29
|
+
if (description.length > 150) break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return description.trim().slice(0, 200) + (description.length > 200 ? "..." : "");
|
|
33
|
+
}
|
|
34
|
+
function extractKeyRules(content, maxRules = 5) {
|
|
35
|
+
const rules = [];
|
|
36
|
+
const emphasisPatterns = [
|
|
37
|
+
/\*\*(?:MUST|NEVER|ALWAYS|REQUIRED)[^*]+\*\*/gi,
|
|
38
|
+
/(?:^|\n)\s*[-*]\s+\*\*[^*]+\*\*/gm
|
|
39
|
+
];
|
|
40
|
+
for (const pattern of emphasisPatterns) {
|
|
41
|
+
const matches = content.match(pattern);
|
|
42
|
+
if (matches) {
|
|
43
|
+
for (const match of matches.slice(0, 2)) {
|
|
44
|
+
const cleaned = match.replace(/\*\*/g, "").replace(/^[-*]\s*/, "").trim();
|
|
45
|
+
if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {
|
|
46
|
+
rules.push(cleaned);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const rulesSectionMatch = content.match(/##\s+(?:.*(?:Rules?|Requirements?|Guidelines?|Standards?)[^\n]*)\n([\s\S]*?)(?=\n##|\n#|$)/i);
|
|
52
|
+
if (rulesSectionMatch) {
|
|
53
|
+
const section = rulesSectionMatch[1];
|
|
54
|
+
const listItems = section.match(/^\s*[-*\d.]+\s+(.+)$/gm);
|
|
55
|
+
if (listItems) {
|
|
56
|
+
for (const item of listItems.slice(0, 3)) {
|
|
57
|
+
const cleaned = item.replace(/^[-*\d.]+\s*/, "").trim();
|
|
58
|
+
if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {
|
|
59
|
+
rules.push(cleaned);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const importantMatch = content.match(/(?:Important|Critical|Key|Essential)[:\s]+([^\n]+)/gi);
|
|
65
|
+
if (importantMatch) {
|
|
66
|
+
for (const match of importantMatch.slice(0, 2)) {
|
|
67
|
+
const cleaned = match.replace(/^(?:Important|Critical|Key|Essential)[:\s]+/i, "").trim();
|
|
68
|
+
if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {
|
|
69
|
+
rules.push(cleaned);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (rules.length < 2) {
|
|
74
|
+
const listItems = content.match(/^\s*[-*]\s+(.+)$/gm);
|
|
75
|
+
if (listItems) {
|
|
76
|
+
for (const item of listItems.slice(0, 3)) {
|
|
77
|
+
const cleaned = item.replace(/^[-*]\s*/, "").trim();
|
|
78
|
+
if (cleaned.length > 15 && cleaned.length < 150 && !rules.includes(cleaned)) {
|
|
79
|
+
rules.push(cleaned);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return rules.slice(0, maxRules);
|
|
85
|
+
}
|
|
86
|
+
function parseGuideline(filePath) {
|
|
87
|
+
try {
|
|
88
|
+
const content = readFileSync(filePath, "utf-8");
|
|
89
|
+
const filename = basename(filePath);
|
|
90
|
+
if (filename.startsWith("_") || filename === "Guidelines.md") {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
filename,
|
|
95
|
+
title: extractTitle(content),
|
|
96
|
+
description: extractDescription(content),
|
|
97
|
+
keyRules: extractKeyRules(content)
|
|
98
|
+
};
|
|
99
|
+
} catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function loadWorkflowConfig(projectRoot) {
|
|
104
|
+
const configPath = join(projectRoot, "workflow.config.json");
|
|
105
|
+
if (!existsSync(configPath)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const content = readFileSync(configPath, "utf-8");
|
|
110
|
+
return JSON.parse(content);
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function extractCustomContent(existingContent) {
|
|
116
|
+
const startIndex = existingContent.indexOf(CUSTOM_START_MARKER);
|
|
117
|
+
const endIndex = existingContent.indexOf(CUSTOM_END_MARKER);
|
|
118
|
+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
119
|
+
return existingContent.slice(
|
|
120
|
+
startIndex + CUSTOM_START_MARKER.length,
|
|
121
|
+
endIndex
|
|
122
|
+
).trim();
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function generateInstructionsContent(config, guidelines, customContent) {
|
|
127
|
+
const projectName = config?.projectName || "this project";
|
|
128
|
+
const scopes = config?.scopes || [];
|
|
129
|
+
let content = `# Copilot Instructions for ${projectName}
|
|
130
|
+
|
|
131
|
+
> **This file is the Single Source of Truth for AI agents working on this codebase.**
|
|
132
|
+
> It is auto-generated from the \`guidelines/\` directory by workflow-agent-cli.
|
|
133
|
+
> Last generated: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
134
|
+
|
|
135
|
+
${GENERATED_MARKER}
|
|
136
|
+
|
|
137
|
+
## Project Overview
|
|
138
|
+
|
|
139
|
+
`;
|
|
140
|
+
if (config) {
|
|
141
|
+
content += `- **Project Name**: ${projectName}
|
|
142
|
+
`;
|
|
143
|
+
content += `- **Enforcement Level**: ${config.enforcement || "strict"}
|
|
144
|
+
`;
|
|
145
|
+
if (scopes.length > 0) {
|
|
146
|
+
content += `- **Available Scopes**: ${scopes.map((s) => `\`${s.name}\``).join(", ")}
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
content += "\n";
|
|
150
|
+
}
|
|
151
|
+
if (scopes.length > 0) {
|
|
152
|
+
content += `### Valid Scopes for Commits and Branches
|
|
153
|
+
|
|
154
|
+
| Scope | Description |
|
|
155
|
+
|-------|-------------|
|
|
156
|
+
`;
|
|
157
|
+
for (const scope of scopes.slice(0, 15)) {
|
|
158
|
+
content += `| \`${scope.name}\` | ${scope.description} |
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
if (scopes.length > 15) {
|
|
162
|
+
content += `| ... | See workflow.config.json for all ${scopes.length} scopes |
|
|
163
|
+
`;
|
|
164
|
+
}
|
|
165
|
+
content += "\n";
|
|
166
|
+
}
|
|
167
|
+
if (guidelines.length > 0) {
|
|
168
|
+
content += `## Guidelines Summary
|
|
169
|
+
|
|
170
|
+
The following guidelines govern development on this project. **Read the linked documents for full details.**
|
|
171
|
+
|
|
172
|
+
`;
|
|
173
|
+
const mandatoryFiles = [
|
|
174
|
+
"AGENT_EDITING_INSTRUCTIONS.md",
|
|
175
|
+
"BRANCHING_STRATEGY.md",
|
|
176
|
+
"TESTING_STRATEGY.md",
|
|
177
|
+
"SINGLE_SOURCE_OF_TRUTH.md",
|
|
178
|
+
"PATTERN_ANALYSIS_WORKFLOW.md",
|
|
179
|
+
"SELF_IMPROVEMENT_MANDATE.md"
|
|
180
|
+
];
|
|
181
|
+
const sortedGuidelines = [...guidelines].sort((a, b) => {
|
|
182
|
+
const aIndex = mandatoryFiles.indexOf(a.filename);
|
|
183
|
+
const bIndex = mandatoryFiles.indexOf(b.filename);
|
|
184
|
+
if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex;
|
|
185
|
+
if (aIndex !== -1) return -1;
|
|
186
|
+
if (bIndex !== -1) return 1;
|
|
187
|
+
return a.title.localeCompare(b.title);
|
|
188
|
+
});
|
|
189
|
+
for (const guideline of sortedGuidelines) {
|
|
190
|
+
content += `### ${guideline.title}
|
|
191
|
+
|
|
192
|
+
\u{1F4C4} [See full details](../guidelines/${guideline.filename})
|
|
193
|
+
|
|
194
|
+
${guideline.description}
|
|
195
|
+
|
|
196
|
+
`;
|
|
197
|
+
if (guideline.keyRules.length > 0) {
|
|
198
|
+
content += `**Key Rules:**
|
|
199
|
+
`;
|
|
200
|
+
for (const rule of guideline.keyRules) {
|
|
201
|
+
content += `- ${rule}
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
content += "\n";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
content += `## Quick Reference
|
|
209
|
+
|
|
210
|
+
### Branch Naming Convention
|
|
211
|
+
\`\`\`
|
|
212
|
+
<type>/<scope>/<short-description>
|
|
213
|
+
\`\`\`
|
|
214
|
+
|
|
215
|
+
**Types**: \`feature\`, \`fix\`, \`chore\`, \`docs\`, \`refactor\`, \`test\`, \`perf\`
|
|
216
|
+
|
|
217
|
+
### Commit Message Format
|
|
218
|
+
\`\`\`
|
|
219
|
+
<type>(<scope>): <description>
|
|
220
|
+
|
|
221
|
+
[optional body]
|
|
222
|
+
|
|
223
|
+
[optional footer]
|
|
224
|
+
\`\`\`
|
|
225
|
+
|
|
226
|
+
### Before Making Changes
|
|
227
|
+
1. Read the relevant guideline document in \`guidelines/\`
|
|
228
|
+
2. Check for existing patterns in \`workflow:solution:search\`
|
|
229
|
+
3. Create an implementation plan for multi-file changes
|
|
230
|
+
4. Ensure tests are added for new functionality
|
|
231
|
+
|
|
232
|
+
### Before Committing
|
|
233
|
+
1. Run \`pnpm run workflow:verify\` to validate all changes
|
|
234
|
+
2. Ensure branch name follows convention
|
|
235
|
+
3. Ensure commit message follows conventional commits format
|
|
236
|
+
|
|
237
|
+
`;
|
|
238
|
+
content += `## Project-Specific Instructions
|
|
239
|
+
|
|
240
|
+
${CUSTOM_START_MARKER}
|
|
241
|
+
${customContent || `
|
|
242
|
+
<!--
|
|
243
|
+
Add your project-specific instructions here.
|
|
244
|
+
This section will be preserved when the file is regenerated.
|
|
245
|
+
|
|
246
|
+
Examples:
|
|
247
|
+
- Specific coding patterns unique to this project
|
|
248
|
+
- Custom review requirements
|
|
249
|
+
- Domain-specific terminology
|
|
250
|
+
- Team-specific workflows
|
|
251
|
+
-->
|
|
252
|
+
`}
|
|
253
|
+
${CUSTOM_END_MARKER}
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
*This file was generated by [workflow-agent-cli](https://www.npmjs.com/package/workflow-agent-cli). Run \`pnpm run workflow:generate-instructions\` to regenerate.*
|
|
258
|
+
`;
|
|
259
|
+
return content;
|
|
260
|
+
}
|
|
261
|
+
function generateCopilotInstructions(projectRoot, options = {}) {
|
|
262
|
+
const { force = false, silent = false } = options;
|
|
263
|
+
const guidelinesDir = join(projectRoot, "guidelines");
|
|
264
|
+
const githubDir = join(projectRoot, ".github");
|
|
265
|
+
const outputPath = join(githubDir, "copilot-instructions.md");
|
|
266
|
+
if (!existsSync(guidelinesDir)) {
|
|
267
|
+
if (!silent) {
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
success: false,
|
|
271
|
+
filePath: null,
|
|
272
|
+
guidelinesCount: 0,
|
|
273
|
+
isNew: false,
|
|
274
|
+
preservedCustomContent: false,
|
|
275
|
+
error: "No guidelines directory found. Run 'workflow init' first."
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const files = readdirSync(guidelinesDir).filter((f) => f.endsWith(".md"));
|
|
279
|
+
if (files.length === 0) {
|
|
280
|
+
return {
|
|
281
|
+
success: false,
|
|
282
|
+
filePath: null,
|
|
283
|
+
guidelinesCount: 0,
|
|
284
|
+
isNew: false,
|
|
285
|
+
preservedCustomContent: false,
|
|
286
|
+
error: "No markdown files found in guidelines directory."
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
const guidelines = [];
|
|
290
|
+
for (const file of files) {
|
|
291
|
+
const summary = parseGuideline(join(guidelinesDir, file));
|
|
292
|
+
if (summary) {
|
|
293
|
+
guidelines.push(summary);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const config = loadWorkflowConfig(projectRoot);
|
|
297
|
+
let customContent = null;
|
|
298
|
+
let isNew = true;
|
|
299
|
+
if (existsSync(outputPath)) {
|
|
300
|
+
isNew = false;
|
|
301
|
+
const existingContent = readFileSync(outputPath, "utf-8");
|
|
302
|
+
customContent = extractCustomContent(existingContent);
|
|
303
|
+
}
|
|
304
|
+
const content = generateInstructionsContent(config, guidelines, customContent);
|
|
305
|
+
if (!existsSync(githubDir)) {
|
|
306
|
+
mkdirSync(githubDir, { recursive: true });
|
|
307
|
+
}
|
|
308
|
+
writeFileSync(outputPath, content, "utf-8");
|
|
309
|
+
return {
|
|
310
|
+
success: true,
|
|
311
|
+
filePath: outputPath,
|
|
312
|
+
guidelinesCount: guidelines.length,
|
|
313
|
+
isNew,
|
|
314
|
+
preservedCustomContent: customContent !== null
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/scripts/workflow-scripts.ts
|
|
319
|
+
var WORKFLOW_SCRIPTS = {
|
|
320
|
+
// Core Commands
|
|
321
|
+
"workflow:init": "workflow-agent init",
|
|
322
|
+
"workflow:validate": "workflow-agent validate",
|
|
323
|
+
"workflow:config": "workflow-agent config",
|
|
324
|
+
"workflow:suggest": "workflow-agent suggest",
|
|
325
|
+
"workflow:setup": "workflow-agent setup",
|
|
326
|
+
"workflow:doctor": "workflow-agent doctor",
|
|
327
|
+
// Scope Commands
|
|
328
|
+
"workflow:scope:create": "workflow-agent scope:create",
|
|
329
|
+
"workflow:scope:migrate": "workflow-agent scope:migrate",
|
|
330
|
+
// Verification & Auto-Setup
|
|
331
|
+
"workflow:verify": "workflow-agent verify",
|
|
332
|
+
"workflow:verify:fix": "workflow-agent verify --fix",
|
|
333
|
+
"workflow:auto-setup": "workflow-agent auto-setup",
|
|
334
|
+
// Learning System Commands
|
|
335
|
+
"workflow:learn": "workflow-agent learn:list",
|
|
336
|
+
"workflow:learn:record": "workflow-agent learn:record",
|
|
337
|
+
"workflow:learn:list": "workflow-agent learn:list",
|
|
338
|
+
"workflow:learn:apply": "workflow-agent learn:apply",
|
|
339
|
+
"workflow:learn:sync": "workflow-agent learn:sync",
|
|
340
|
+
"workflow:learn:config": "workflow-agent learn:config",
|
|
341
|
+
"workflow:learn:deprecate": "workflow-agent learn:deprecate",
|
|
342
|
+
"workflow:learn:stats": "workflow-agent learn:stats",
|
|
343
|
+
// Solution Pattern Commands
|
|
344
|
+
"workflow:solution": "workflow-agent solution:list",
|
|
345
|
+
"workflow:solution:capture": "workflow-agent solution:capture",
|
|
346
|
+
"workflow:solution:search": "workflow-agent solution:search",
|
|
347
|
+
"workflow:solution:list": "workflow-agent solution:list",
|
|
348
|
+
"workflow:solution:apply": "workflow-agent solution:apply",
|
|
349
|
+
"workflow:solution:deprecate": "workflow-agent solution:deprecate",
|
|
350
|
+
"workflow:solution:stats": "workflow-agent solution:stats",
|
|
351
|
+
// Advisory Board Commands
|
|
352
|
+
"workflow:advisory": "workflow-agent advisory",
|
|
353
|
+
"workflow:advisory:quick": "workflow-agent advisory --depth quick",
|
|
354
|
+
"workflow:advisory:standard": "workflow-agent advisory --depth standard",
|
|
355
|
+
"workflow:advisory:comprehensive": "workflow-agent advisory --depth comprehensive",
|
|
356
|
+
"workflow:advisory:executive": "workflow-agent advisory --depth executive",
|
|
357
|
+
"workflow:advisory:ci": "workflow-agent advisory --ci",
|
|
358
|
+
// AI Agent Instructions
|
|
359
|
+
"workflow:generate-instructions": "workflow-agent generate-instructions"
|
|
360
|
+
};
|
|
361
|
+
var SCRIPT_CATEGORIES = {
|
|
362
|
+
"Core Commands": [
|
|
363
|
+
"workflow:init",
|
|
364
|
+
"workflow:validate",
|
|
365
|
+
"workflow:config",
|
|
366
|
+
"workflow:suggest",
|
|
367
|
+
"workflow:setup",
|
|
368
|
+
"workflow:doctor"
|
|
369
|
+
],
|
|
370
|
+
"Scope Commands": ["workflow:scope:create", "workflow:scope:migrate"],
|
|
371
|
+
Verification: [
|
|
372
|
+
"workflow:verify",
|
|
373
|
+
"workflow:verify:fix",
|
|
374
|
+
"workflow:auto-setup"
|
|
375
|
+
],
|
|
376
|
+
"Learning System": [
|
|
377
|
+
"workflow:learn",
|
|
378
|
+
"workflow:learn:record",
|
|
379
|
+
"workflow:learn:list",
|
|
380
|
+
"workflow:learn:apply",
|
|
381
|
+
"workflow:learn:sync",
|
|
382
|
+
"workflow:learn:config",
|
|
383
|
+
"workflow:learn:deprecate",
|
|
384
|
+
"workflow:learn:stats"
|
|
385
|
+
],
|
|
386
|
+
"Solution Patterns": [
|
|
387
|
+
"workflow:solution",
|
|
388
|
+
"workflow:solution:capture",
|
|
389
|
+
"workflow:solution:search",
|
|
390
|
+
"workflow:solution:list",
|
|
391
|
+
"workflow:solution:apply",
|
|
392
|
+
"workflow:solution:deprecate",
|
|
393
|
+
"workflow:solution:stats"
|
|
394
|
+
],
|
|
395
|
+
"Advisory Board": [
|
|
396
|
+
"workflow:advisory",
|
|
397
|
+
"workflow:advisory:quick",
|
|
398
|
+
"workflow:advisory:standard",
|
|
399
|
+
"workflow:advisory:comprehensive",
|
|
400
|
+
"workflow:advisory:executive",
|
|
401
|
+
"workflow:advisory:ci"
|
|
402
|
+
],
|
|
403
|
+
"AI Agent Instructions": [
|
|
404
|
+
"workflow:generate-instructions"
|
|
405
|
+
]
|
|
406
|
+
};
|
|
407
|
+
var TOTAL_SCRIPTS = Object.keys(WORKFLOW_SCRIPTS).length;
|
|
408
|
+
|
|
409
|
+
export {
|
|
410
|
+
generateCopilotInstructions,
|
|
411
|
+
WORKFLOW_SCRIPTS,
|
|
412
|
+
SCRIPT_CATEGORIES,
|
|
413
|
+
TOTAL_SCRIPTS
|
|
414
|
+
};
|
|
415
|
+
//# sourceMappingURL=chunk-HKRWHFVI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scripts/copilot-instructions-generator.ts","../src/scripts/workflow-scripts.ts"],"sourcesContent":["/**\n * Copilot Instructions Generator\n *\n * Generates .github/copilot-instructions.md from the project's guidelines directory.\n * This file serves as the Single Source of Truth for AI agents (GitHub Copilot, Claude, etc.)\n * when working on the codebase.\n *\n * Features:\n * - Reads all markdown files from guidelines/\n * - Extracts key rules and summaries from each guideline\n * - Loads project config from workflow.config.json\n * - Preserves custom user content between markers\n * - Provides links to full guideline documents\n */\n\nimport { readFileSync, writeFileSync, existsSync, readdirSync, mkdirSync } from \"fs\";\nimport { join, basename } from \"path\";\n\n// Markers for custom user content that should be preserved on regeneration\nconst CUSTOM_START_MARKER = \"<!-- CUSTOM START -->\";\nconst CUSTOM_END_MARKER = \"<!-- CUSTOM END -->\";\nconst GENERATED_MARKER = \"<!-- AUTO-GENERATED BY WORKFLOW-AGENT - DO NOT EDIT ABOVE THIS LINE -->\";\n\ninterface WorkflowConfig {\n projectName?: string;\n scopes?: Array<{ name: string; description: string; emoji?: string }>;\n enforcement?: string;\n language?: string;\n}\n\ninterface GuidelineSummary {\n filename: string;\n title: string;\n description: string;\n keyRules: string[];\n}\n\n/**\n * Extract title from markdown content (first H1)\n */\nfunction extractTitle(content: string): string {\n const match = content.match(/^#\\s+(.+)$/m);\n return match ? match[1].trim() : \"Untitled\";\n}\n\n/**\n * Extract description from markdown content (first paragraph after title)\n */\nfunction extractDescription(content: string): string {\n // Look for content after the first heading, before the next heading or section\n const lines = content.split(\"\\n\");\n let foundTitle = false;\n let description = \"\";\n\n for (const line of lines) {\n if (line.startsWith(\"# \")) {\n foundTitle = true;\n continue;\n }\n if (foundTitle) {\n // Skip empty lines and blockquotes at start\n if (line.trim() === \"\" || line.startsWith(\">\")) {\n if (description) break; // End if we already have content\n continue;\n }\n // Stop at next heading or horizontal rule\n if (line.startsWith(\"#\") || line.startsWith(\"---\") || line.startsWith(\"##\")) {\n break;\n }\n description += line.trim() + \" \";\n // Take only first meaningful paragraph\n if (description.length > 150) break;\n }\n }\n\n return description.trim().slice(0, 200) + (description.length > 200 ? \"...\" : \"\");\n}\n\n/**\n * Extract key rules from markdown content\n * Looks for lists, bold text, and important patterns\n */\nfunction extractKeyRules(content: string, maxRules: number = 5): string[] {\n const rules: string[] = [];\n\n // Pattern 1: Look for \"MUST\", \"NEVER\", \"ALWAYS\", \"REQUIRED\" in bold or emphasized\n const emphasisPatterns = [\n /\\*\\*(?:MUST|NEVER|ALWAYS|REQUIRED)[^*]+\\*\\*/gi,\n /(?:^|\\n)\\s*[-*]\\s+\\*\\*[^*]+\\*\\*/gm,\n ];\n\n for (const pattern of emphasisPatterns) {\n const matches = content.match(pattern);\n if (matches) {\n for (const match of matches.slice(0, 2)) {\n const cleaned = match.replace(/\\*\\*/g, \"\").replace(/^[-*]\\s*/, \"\").trim();\n if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {\n rules.push(cleaned);\n }\n }\n }\n }\n\n // Pattern 2: Look for numbered or bulleted rules under headings containing \"Rules\", \"Requirements\", \"Guidelines\"\n const rulesSectionMatch = content.match(/##\\s+(?:.*(?:Rules?|Requirements?|Guidelines?|Standards?)[^\\n]*)\\n([\\s\\S]*?)(?=\\n##|\\n#|$)/i);\n if (rulesSectionMatch) {\n const section = rulesSectionMatch[1];\n const listItems = section.match(/^\\s*[-*\\d.]+\\s+(.+)$/gm);\n if (listItems) {\n for (const item of listItems.slice(0, 3)) {\n const cleaned = item.replace(/^[-*\\d.]+\\s*/, \"\").trim();\n if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {\n rules.push(cleaned);\n }\n }\n }\n }\n\n // Pattern 3: Look for key points under \"Important\", \"Critical\", \"Key\"\n const importantMatch = content.match(/(?:Important|Critical|Key|Essential)[:\\s]+([^\\n]+)/gi);\n if (importantMatch) {\n for (const match of importantMatch.slice(0, 2)) {\n const cleaned = match.replace(/^(?:Important|Critical|Key|Essential)[:\\s]+/i, \"\").trim();\n if (cleaned.length > 10 && cleaned.length < 150 && !rules.includes(cleaned)) {\n rules.push(cleaned);\n }\n }\n }\n\n // Fallback: Get first few list items if we don't have enough rules\n if (rules.length < 2) {\n const listItems = content.match(/^\\s*[-*]\\s+(.+)$/gm);\n if (listItems) {\n for (const item of listItems.slice(0, 3)) {\n const cleaned = item.replace(/^[-*]\\s*/, \"\").trim();\n if (cleaned.length > 15 && cleaned.length < 150 && !rules.includes(cleaned)) {\n rules.push(cleaned);\n }\n }\n }\n }\n\n return rules.slice(0, maxRules);\n}\n\n/**\n * Parse a guideline markdown file and extract summary\n */\nfunction parseGuideline(filePath: string): GuidelineSummary | null {\n try {\n const content = readFileSync(filePath, \"utf-8\");\n const filename = basename(filePath);\n\n // Skip template example and non-guideline files\n if (filename.startsWith(\"_\") || filename === \"Guidelines.md\") {\n return null;\n }\n\n return {\n filename,\n title: extractTitle(content),\n description: extractDescription(content),\n keyRules: extractKeyRules(content),\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Load workflow config from project root\n */\nfunction loadWorkflowConfig(projectRoot: string): WorkflowConfig | null {\n const configPath = join(projectRoot, \"workflow.config.json\");\n if (!existsSync(configPath)) {\n return null;\n }\n\n try {\n const content = readFileSync(configPath, \"utf-8\");\n return JSON.parse(content) as WorkflowConfig;\n } catch {\n return null;\n }\n}\n\n/**\n * Extract preserved custom content from existing file\n */\nfunction extractCustomContent(existingContent: string): string | null {\n const startIndex = existingContent.indexOf(CUSTOM_START_MARKER);\n const endIndex = existingContent.indexOf(CUSTOM_END_MARKER);\n\n if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {\n return existingContent.slice(\n startIndex + CUSTOM_START_MARKER.length,\n endIndex\n ).trim();\n }\n\n return null;\n}\n\n/**\n * Generate the copilot-instructions.md content\n */\nfunction generateInstructionsContent(\n config: WorkflowConfig | null,\n guidelines: GuidelineSummary[],\n customContent: string | null\n): string {\n const projectName = config?.projectName || \"this project\";\n const scopes = config?.scopes || [];\n\n let content = `# Copilot Instructions for ${projectName}\n\n> **This file is the Single Source of Truth for AI agents working on this codebase.**\n> It is auto-generated from the \\`guidelines/\\` directory by workflow-agent-cli.\n> Last generated: ${new Date().toISOString().split(\"T\")[0]}\n\n${GENERATED_MARKER}\n\n## Project Overview\n\n`;\n\n if (config) {\n content += `- **Project Name**: ${projectName}\\n`;\n content += `- **Enforcement Level**: ${config.enforcement || \"strict\"}\\n`;\n if (scopes.length > 0) {\n content += `- **Available Scopes**: ${scopes.map(s => `\\`${s.name}\\``).join(\", \")}\\n`;\n }\n content += \"\\n\";\n }\n\n // Add scope reference if available\n if (scopes.length > 0) {\n content += `### Valid Scopes for Commits and Branches\n\n| Scope | Description |\n|-------|-------------|\n`;\n for (const scope of scopes.slice(0, 15)) {\n content += `| \\`${scope.name}\\` | ${scope.description} |\\n`;\n }\n if (scopes.length > 15) {\n content += `| ... | See workflow.config.json for all ${scopes.length} scopes |\\n`;\n }\n content += \"\\n\";\n }\n\n // Add guidelines summaries\n if (guidelines.length > 0) {\n content += `## Guidelines Summary\n\nThe following guidelines govern development on this project. **Read the linked documents for full details.**\n\n`;\n\n // Group by importance (mandatory templates first)\n const mandatoryFiles = [\n \"AGENT_EDITING_INSTRUCTIONS.md\",\n \"BRANCHING_STRATEGY.md\",\n \"TESTING_STRATEGY.md\",\n \"SINGLE_SOURCE_OF_TRUTH.md\",\n \"PATTERN_ANALYSIS_WORKFLOW.md\",\n \"SELF_IMPROVEMENT_MANDATE.md\",\n ];\n\n const sortedGuidelines = [...guidelines].sort((a, b) => {\n const aIndex = mandatoryFiles.indexOf(a.filename);\n const bIndex = mandatoryFiles.indexOf(b.filename);\n if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex;\n if (aIndex !== -1) return -1;\n if (bIndex !== -1) return 1;\n return a.title.localeCompare(b.title);\n });\n\n for (const guideline of sortedGuidelines) {\n content += `### ${guideline.title}\n\nš [See full details](../guidelines/${guideline.filename})\n\n${guideline.description}\n\n`;\n if (guideline.keyRules.length > 0) {\n content += `**Key Rules:**\n`;\n for (const rule of guideline.keyRules) {\n content += `- ${rule}\\n`;\n }\n content += \"\\n\";\n }\n }\n }\n\n // Add quick reference section\n content += `## Quick Reference\n\n### Branch Naming Convention\n\\`\\`\\`\n<type>/<scope>/<short-description>\n\\`\\`\\`\n\n**Types**: \\`feature\\`, \\`fix\\`, \\`chore\\`, \\`docs\\`, \\`refactor\\`, \\`test\\`, \\`perf\\`\n\n### Commit Message Format\n\\`\\`\\`\n<type>(<scope>): <description>\n\n[optional body]\n\n[optional footer]\n\\`\\`\\`\n\n### Before Making Changes\n1. Read the relevant guideline document in \\`guidelines/\\`\n2. Check for existing patterns in \\`workflow:solution:search\\`\n3. Create an implementation plan for multi-file changes\n4. Ensure tests are added for new functionality\n\n### Before Committing\n1. Run \\`pnpm run workflow:verify\\` to validate all changes\n2. Ensure branch name follows convention\n3. Ensure commit message follows conventional commits format\n\n`;\n\n // Add custom content section\n content += `## Project-Specific Instructions\n\n${CUSTOM_START_MARKER}\n${customContent || `\n<!-- \nAdd your project-specific instructions here.\nThis section will be preserved when the file is regenerated.\n\nExamples:\n- Specific coding patterns unique to this project\n- Custom review requirements\n- Domain-specific terminology\n- Team-specific workflows\n-->\n`}\n${CUSTOM_END_MARKER}\n\n---\n\n*This file was generated by [workflow-agent-cli](https://www.npmjs.com/package/workflow-agent-cli). Run \\`pnpm run workflow:generate-instructions\\` to regenerate.*\n`;\n\n return content;\n}\n\n/**\n * Result of generating copilot instructions\n */\nexport interface GenerateResult {\n success: boolean;\n filePath: string | null;\n guidelinesCount: number;\n isNew: boolean;\n preservedCustomContent: boolean;\n error?: string;\n}\n\n/**\n * Generate .github/copilot-instructions.md from guidelines directory\n *\n * @param projectRoot - Root directory of the project\n * @param options - Generation options\n * @returns Result of the generation\n */\nexport function generateCopilotInstructions(\n projectRoot: string,\n options: { force?: boolean; silent?: boolean } = {}\n): GenerateResult {\n const { force = false, silent = false } = options;\n\n const guidelinesDir = join(projectRoot, \"guidelines\");\n const githubDir = join(projectRoot, \".github\");\n const outputPath = join(githubDir, \"copilot-instructions.md\");\n\n // Check if guidelines directory exists\n if (!existsSync(guidelinesDir)) {\n if (!silent) {\n // Guidelines don't exist yet - skip silently during postinstall\n }\n return {\n success: false,\n filePath: null,\n guidelinesCount: 0,\n isNew: false,\n preservedCustomContent: false,\n error: \"No guidelines directory found. Run 'workflow init' first.\",\n };\n }\n\n // Read all markdown files from guidelines\n const files = readdirSync(guidelinesDir).filter(f => f.endsWith(\".md\"));\n if (files.length === 0) {\n return {\n success: false,\n filePath: null,\n guidelinesCount: 0,\n isNew: false,\n preservedCustomContent: false,\n error: \"No markdown files found in guidelines directory.\",\n };\n }\n\n // Parse each guideline\n const guidelines: GuidelineSummary[] = [];\n for (const file of files) {\n const summary = parseGuideline(join(guidelinesDir, file));\n if (summary) {\n guidelines.push(summary);\n }\n }\n\n // Load workflow config\n const config = loadWorkflowConfig(projectRoot);\n\n // Check for existing file and extract custom content\n let customContent: string | null = null;\n let isNew = true;\n\n if (existsSync(outputPath)) {\n isNew = false;\n const existingContent = readFileSync(outputPath, \"utf-8\");\n customContent = extractCustomContent(existingContent);\n }\n\n // Generate the content\n const content = generateInstructionsContent(config, guidelines, customContent);\n\n // Ensure .github directory exists\n if (!existsSync(githubDir)) {\n mkdirSync(githubDir, { recursive: true });\n }\n\n // Write the file\n writeFileSync(outputPath, content, \"utf-8\");\n\n return {\n success: true,\n filePath: outputPath,\n guidelinesCount: guidelines.length,\n isNew,\n preservedCustomContent: customContent !== null,\n };\n}\n\n/**\n * Check if copilot instructions need regeneration\n * (e.g., guidelines have been modified since last generation)\n */\nexport function needsRegeneration(projectRoot: string): boolean {\n const guidelinesDir = join(projectRoot, \"guidelines\");\n const outputPath = join(projectRoot, \".github\", \"copilot-instructions.md\");\n\n if (!existsSync(outputPath)) {\n return existsSync(guidelinesDir);\n }\n\n // For now, always regenerate to ensure latest content\n // Future: could compare file modification times\n return true;\n}\n","/**\n * Shared workflow scripts definition\n * Used by postinstall.ts and setup.ts to ensure consistency\n */\n\nexport const WORKFLOW_SCRIPTS = {\n // Core Commands\n \"workflow:init\": \"workflow-agent init\",\n \"workflow:validate\": \"workflow-agent validate\",\n \"workflow:config\": \"workflow-agent config\",\n \"workflow:suggest\": \"workflow-agent suggest\",\n \"workflow:setup\": \"workflow-agent setup\",\n \"workflow:doctor\": \"workflow-agent doctor\",\n\n // Scope Commands\n \"workflow:scope:create\": \"workflow-agent scope:create\",\n \"workflow:scope:migrate\": \"workflow-agent scope:migrate\",\n\n // Verification & Auto-Setup\n \"workflow:verify\": \"workflow-agent verify\",\n \"workflow:verify:fix\": \"workflow-agent verify --fix\",\n \"workflow:auto-setup\": \"workflow-agent auto-setup\",\n\n // Learning System Commands\n \"workflow:learn\": \"workflow-agent learn:list\",\n \"workflow:learn:record\": \"workflow-agent learn:record\",\n \"workflow:learn:list\": \"workflow-agent learn:list\",\n \"workflow:learn:apply\": \"workflow-agent learn:apply\",\n \"workflow:learn:sync\": \"workflow-agent learn:sync\",\n \"workflow:learn:config\": \"workflow-agent learn:config\",\n \"workflow:learn:deprecate\": \"workflow-agent learn:deprecate\",\n \"workflow:learn:stats\": \"workflow-agent learn:stats\",\n\n // Solution Pattern Commands\n \"workflow:solution\": \"workflow-agent solution:list\",\n \"workflow:solution:capture\": \"workflow-agent solution:capture\",\n \"workflow:solution:search\": \"workflow-agent solution:search\",\n \"workflow:solution:list\": \"workflow-agent solution:list\",\n \"workflow:solution:apply\": \"workflow-agent solution:apply\",\n \"workflow:solution:deprecate\": \"workflow-agent solution:deprecate\",\n \"workflow:solution:stats\": \"workflow-agent solution:stats\",\n\n // Advisory Board Commands\n \"workflow:advisory\": \"workflow-agent advisory\",\n \"workflow:advisory:quick\": \"workflow-agent advisory --depth quick\",\n \"workflow:advisory:standard\": \"workflow-agent advisory --depth standard\",\n \"workflow:advisory:comprehensive\":\n \"workflow-agent advisory --depth comprehensive\",\n \"workflow:advisory:executive\": \"workflow-agent advisory --depth executive\",\n \"workflow:advisory:ci\": \"workflow-agent advisory --ci\",\n\n // AI Agent Instructions\n \"workflow:generate-instructions\": \"workflow-agent generate-instructions\",\n} as const;\n\nexport type WorkflowScriptName = keyof typeof WORKFLOW_SCRIPTS;\n\n/**\n * Script categories for organized console output\n */\nexport const SCRIPT_CATEGORIES = {\n \"Core Commands\": [\n \"workflow:init\",\n \"workflow:validate\",\n \"workflow:config\",\n \"workflow:suggest\",\n \"workflow:setup\",\n \"workflow:doctor\",\n ],\n \"Scope Commands\": [\"workflow:scope:create\", \"workflow:scope:migrate\"],\n Verification: [\n \"workflow:verify\",\n \"workflow:verify:fix\",\n \"workflow:auto-setup\",\n ],\n \"Learning System\": [\n \"workflow:learn\",\n \"workflow:learn:record\",\n \"workflow:learn:list\",\n \"workflow:learn:apply\",\n \"workflow:learn:sync\",\n \"workflow:learn:config\",\n \"workflow:learn:deprecate\",\n \"workflow:learn:stats\",\n ],\n \"Solution Patterns\": [\n \"workflow:solution\",\n \"workflow:solution:capture\",\n \"workflow:solution:search\",\n \"workflow:solution:list\",\n \"workflow:solution:apply\",\n \"workflow:solution:deprecate\",\n \"workflow:solution:stats\",\n ],\n \"Advisory Board\": [\n \"workflow:advisory\",\n \"workflow:advisory:quick\",\n \"workflow:advisory:standard\",\n \"workflow:advisory:comprehensive\",\n \"workflow:advisory:executive\",\n \"workflow:advisory:ci\",\n ],\n \"AI Agent Instructions\": [\n \"workflow:generate-instructions\",\n ],\n} as const;\n\nexport const TOTAL_SCRIPTS = Object.keys(WORKFLOW_SCRIPTS).length;\n"],"mappings":";AAeA,SAAS,cAAc,eAAe,YAAY,aAAa,iBAAiB;AAChF,SAAS,MAAM,gBAAgB;AAG/B,IAAM,sBAAsB;AAC5B,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;AAmBzB,SAAS,aAAa,SAAyB;AAC7C,QAAM,QAAQ,QAAQ,MAAM,aAAa;AACzC,SAAO,QAAQ,MAAM,CAAC,EAAE,KAAK,IAAI;AACnC;AAKA,SAAS,mBAAmB,SAAyB;AAEnD,QAAM,QAAQ,QAAQ,MAAM,IAAI;AAChC,MAAI,aAAa;AACjB,MAAI,cAAc;AAElB,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,WAAW,IAAI,GAAG;AACzB,mBAAa;AACb;AAAA,IACF;AACA,QAAI,YAAY;AAEd,UAAI,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,GAAG,GAAG;AAC9C,YAAI,YAAa;AACjB;AAAA,MACF;AAEA,UAAI,KAAK,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