@aicgen/aicgen 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.vs/ProjectSettings.json +2 -2
  2. package/.vs/VSWorkspaceState.json +15 -15
  3. package/.vs/aicgen.slnx/v18/DocumentLayout.json +53 -53
  4. package/assets/icon.svg +33 -33
  5. package/bun.lock +0 -43
  6. package/data/architecture/microservices/api-gateway.md +56 -56
  7. package/data/devops/observability.md +73 -73
  8. package/dist/index.js +9299 -9299
  9. package/package.json +2 -2
  10. package/.claude/agents/architecture-reviewer.md +0 -88
  11. package/.claude/agents/guideline-checker.md +0 -73
  12. package/.claude/agents/security-auditor.md +0 -108
  13. package/.claude/guidelines/api-design.md +0 -645
  14. package/.claude/guidelines/architecture.md +0 -2503
  15. package/.claude/guidelines/best-practices.md +0 -618
  16. package/.claude/guidelines/code-style.md +0 -304
  17. package/.claude/guidelines/design-patterns.md +0 -573
  18. package/.claude/guidelines/devops.md +0 -226
  19. package/.claude/guidelines/error-handling.md +0 -413
  20. package/.claude/guidelines/language.md +0 -782
  21. package/.claude/guidelines/performance.md +0 -706
  22. package/.claude/guidelines/security.md +0 -583
  23. package/.claude/guidelines/testing.md +0 -568
  24. package/.claude/settings.json +0 -98
  25. package/.claude/settings.local.json +0 -8
  26. package/.eslintrc.json +0 -28
  27. package/.github/workflows/release.yml +0 -180
  28. package/.github/workflows/test.yml +0 -81
  29. package/CONTRIBUTING.md +0 -821
  30. package/dist/commands/init.d.ts +0 -8
  31. package/dist/commands/init.d.ts.map +0 -1
  32. package/dist/commands/init.js +0 -46
  33. package/dist/commands/init.js.map +0 -1
  34. package/dist/config/profiles.d.ts +0 -4
  35. package/dist/config/profiles.d.ts.map +0 -1
  36. package/dist/config/profiles.js +0 -30
  37. package/dist/config/profiles.js.map +0 -1
  38. package/dist/config/settings.d.ts +0 -7
  39. package/dist/config/settings.d.ts.map +0 -1
  40. package/dist/config/settings.js +0 -7
  41. package/dist/config/settings.js.map +0 -1
  42. package/dist/index.d.ts +0 -3
  43. package/dist/index.d.ts.map +0 -1
  44. package/dist/index.js.map +0 -1
  45. package/dist/models/guideline.d.ts +0 -15
  46. package/dist/models/guideline.d.ts.map +0 -1
  47. package/dist/models/guideline.js +0 -2
  48. package/dist/models/guideline.js.map +0 -1
  49. package/dist/models/preference.d.ts +0 -9
  50. package/dist/models/preference.d.ts.map +0 -1
  51. package/dist/models/preference.js +0 -2
  52. package/dist/models/preference.js.map +0 -1
  53. package/dist/models/profile.d.ts +0 -9
  54. package/dist/models/profile.d.ts.map +0 -1
  55. package/dist/models/profile.js +0 -2
  56. package/dist/models/profile.js.map +0 -1
  57. package/dist/models/project.d.ts +0 -13
  58. package/dist/models/project.d.ts.map +0 -1
  59. package/dist/models/project.js +0 -2
  60. package/dist/models/project.js.map +0 -1
  61. package/dist/services/ai/anthropic.d.ts +0 -7
  62. package/dist/services/ai/anthropic.d.ts.map +0 -1
  63. package/dist/services/ai/anthropic.js +0 -39
  64. package/dist/services/ai/anthropic.js.map +0 -1
  65. package/dist/services/generator.d.ts +0 -2
  66. package/dist/services/generator.d.ts.map +0 -1
  67. package/dist/services/generator.js +0 -4
  68. package/dist/services/generator.js.map +0 -1
  69. package/dist/services/learner.d.ts +0 -2
  70. package/dist/services/learner.d.ts.map +0 -1
  71. package/dist/services/learner.js +0 -4
  72. package/dist/services/learner.js.map +0 -1
  73. package/dist/services/scanner.d.ts +0 -3
  74. package/dist/services/scanner.d.ts.map +0 -1
  75. package/dist/services/scanner.js +0 -54
  76. package/dist/services/scanner.js.map +0 -1
  77. package/dist/utils/errors.d.ts +0 -15
  78. package/dist/utils/errors.d.ts.map +0 -1
  79. package/dist/utils/errors.js +0 -27
  80. package/dist/utils/errors.js.map +0 -1
  81. package/dist/utils/file.d.ts +0 -7
  82. package/dist/utils/file.d.ts.map +0 -1
  83. package/dist/utils/file.js +0 -32
  84. package/dist/utils/file.js.map +0 -1
  85. package/dist/utils/logger.d.ts +0 -6
  86. package/dist/utils/logger.d.ts.map +0 -1
  87. package/dist/utils/logger.js +0 -17
  88. package/dist/utils/logger.js.map +0 -1
  89. package/dist/utils/path.d.ts +0 -6
  90. package/dist/utils/path.d.ts.map +0 -1
  91. package/dist/utils/path.js +0 -14
  92. package/dist/utils/path.js.map +0 -1
  93. package/docs/planning/memory-lane.md +0 -83
  94. package/packaging/linux/aicgen.spec +0 -23
  95. package/packaging/linux/control +0 -9
  96. package/packaging/macos/scripts/postinstall +0 -12
  97. package/packaging/windows/setup.nsi +0 -92
  98. package/scripts/add-categories.ts +0 -87
  99. package/scripts/build-binary.ts +0 -46
  100. package/scripts/embed-data.ts +0 -105
  101. package/scripts/generate-version.ts +0 -150
  102. package/scripts/test-decompress.ts +0 -27
  103. package/scripts/test-extract.ts +0 -31
  104. package/src/__tests__/services/assistant-file-writer.test.ts +0 -400
  105. package/src/__tests__/services/guideline-loader.test.ts +0 -281
  106. package/src/__tests__/services/tarball-extraction.test.ts +0 -125
  107. package/src/commands/add-guideline.ts +0 -296
  108. package/src/commands/clear.ts +0 -61
  109. package/src/commands/guideline-selector.ts +0 -123
  110. package/src/commands/init.ts +0 -645
  111. package/src/commands/quick-add.ts +0 -586
  112. package/src/commands/remove-guideline.ts +0 -152
  113. package/src/commands/stats.ts +0 -49
  114. package/src/commands/update.ts +0 -240
  115. package/src/config.ts +0 -82
  116. package/src/embedded-data.ts +0 -1492
  117. package/src/index.ts +0 -67
  118. package/src/models/profile.ts +0 -24
  119. package/src/models/project.ts +0 -43
  120. package/src/services/assistant-file-writer.ts +0 -612
  121. package/src/services/config-generator.ts +0 -150
  122. package/src/services/config-manager.ts +0 -70
  123. package/src/services/data-source.ts +0 -248
  124. package/src/services/first-run-init.ts +0 -148
  125. package/src/services/guideline-loader.ts +0 -311
  126. package/src/services/hook-generator.ts +0 -178
  127. package/src/services/subagent-generator.ts +0 -310
  128. package/src/utils/banner.ts +0 -66
  129. package/src/utils/errors.ts +0 -27
  130. package/src/utils/file.ts +0 -67
  131. package/src/utils/formatting.ts +0 -172
  132. package/src/utils/logger.ts +0 -89
  133. package/src/utils/path.ts +0 -17
  134. package/src/utils/wizard-state.ts +0 -132
  135. package/tsconfig.json +0 -25
  136. /package/{CLAUDE.md → claude.md} +0 -0
@@ -1,612 +0,0 @@
1
- import { writeFile, mkdir } from 'fs/promises';
2
- import { join, dirname } from 'path';
3
- import { AIAssistant } from '../models/project.js';
4
- import { ProfileSelection } from '../models/profile.js';
5
- import { GuidelineLoader } from './guideline-loader.js';
6
- import { HookGenerator } from './hook-generator.js';
7
- import { SubAgentGenerator } from './subagent-generator.js';
8
-
9
- export interface GeneratedFile {
10
- path: string;
11
- content: string;
12
- type: 'main' | 'guideline' | 'config' | 'agent' | 'universal';
13
- }
14
-
15
- export class AssistantFileWriter {
16
- private guidelineLoader: GuidelineLoader;
17
- private hookGenerator: HookGenerator;
18
- private subAgentGenerator: SubAgentGenerator;
19
-
20
- static async create(): Promise<AssistantFileWriter> {
21
- const guidelineLoader = await GuidelineLoader.create();
22
- return new AssistantFileWriter(guidelineLoader);
23
- }
24
-
25
- private constructor(guidelineLoader: GuidelineLoader) {
26
- this.guidelineLoader = guidelineLoader;
27
- this.hookGenerator = new HookGenerator();
28
- this.subAgentGenerator = new SubAgentGenerator();
29
- }
30
-
31
- async generateFiles(
32
- assistant: AIAssistant,
33
- guidelineIds: string[],
34
- selection: ProfileSelection,
35
- projectPath: string
36
- ): Promise<GeneratedFile[]> {
37
- const files: GeneratedFile[] = [];
38
-
39
- const categoryTree = this.organizeByCategory(guidelineIds);
40
-
41
- switch (assistant) {
42
- case 'claude-code':
43
- files.push(...await this.generateClaudeCodeFiles(categoryTree, guidelineIds, selection, projectPath));
44
- break;
45
- case 'copilot':
46
- files.push(...await this.generateCopilotFiles(categoryTree, selection));
47
- break;
48
- case 'gemini':
49
- files.push(...await this.generateGeminiFiles(categoryTree, selection));
50
- break;
51
- case 'antigravity':
52
- files.push(...await this.generateAntigravityFiles(categoryTree, selection));
53
- break;
54
- case 'codex':
55
- files.push(...await this.generateCodexFiles(categoryTree, selection));
56
- break;
57
- }
58
-
59
- files.push(this.generateUniversalAgentsFile(categoryTree, selection));
60
-
61
- return files.map(file => ({
62
- ...file,
63
- path: join(projectPath, file.path)
64
- }));
65
- }
66
-
67
- async writeFiles(files: GeneratedFile[]): Promise<void> {
68
- for (const file of files) {
69
- await mkdir(dirname(file.path), { recursive: true });
70
- await writeFile(file.path, file.content, 'utf-8');
71
- }
72
- }
73
-
74
- private organizeByCategory(guidelineIds: string[]): Map<string, string[]> {
75
- const byCategory = new Map<string, string[]>();
76
-
77
- for (const id of guidelineIds) {
78
- const mapping = this.guidelineLoader.getMapping(id);
79
- if (mapping) {
80
- const category = mapping.category || 'General';
81
- if (!byCategory.has(category)) {
82
- byCategory.set(category, []);
83
- }
84
- byCategory.get(category)!.push(id);
85
- }
86
- }
87
-
88
- return byCategory;
89
- }
90
-
91
- private async generateClaudeCodeFiles(
92
- categoryTree: Map<string, string[]>,
93
- guidelineIds: string[],
94
- selection: ProfileSelection,
95
- projectPath: string
96
- ): Promise<GeneratedFile[]> {
97
- const files: GeneratedFile[] = [];
98
-
99
- const mainReferences: string[] = [];
100
- const guidelines: string[] = [];
101
-
102
- for (const [category, ids] of categoryTree) {
103
- const categoryFile = category.toLowerCase().replace(/\s+/g, '-');
104
- const categoryContent = ids.map(id => {
105
- const content = this.guidelineLoader.loadGuideline(id);
106
- guidelines.push(content);
107
- return content;
108
- }).join('\n\n---\n\n');
109
-
110
- files.push({
111
- path: `.claude/guidelines/${categoryFile}.md`,
112
- content: `# ${category}\n\n${categoryContent}`,
113
- type: 'guideline'
114
- });
115
-
116
- mainReferences.push(`- **${category}**: @.claude/guidelines/${categoryFile}.md`);
117
- }
118
-
119
- const archDescription = selection.architecture === 'other'
120
- ? ''
121
- : ` and ${selection.architecture} architecture`;
122
-
123
- const mainContent = `# ${selection.projectName} - Development Guidelines
124
-
125
- **Role:** You are an expert software engineer specialized in ${selection.language}${archDescription}.
126
- **User's Goal:** Build high-quality, maintainable software following strict project guidelines.
127
-
128
- ## Guidelines
129
-
130
- This project follows structured coding guidelines organized by category:
131
-
132
- ${mainReferences.join('\n')}
133
-
134
- ## Quick Reference
135
-
136
- - Run tests: Check package.json scripts
137
- - Build: Check package.json scripts
138
- - Code style: See Code Style guidelines above
139
- - Architecture: See Architecture guidelines above
140
-
141
- ## Important Notes
142
-
143
- - **Follow the guidelines** referenced above.
144
- - **Verification**: Use sub-agents in \`.claude/agents/\` to verify compliance.
145
- - **Constraints**: Hooks in \`.claude/settings.json\` enforce critical rules.
146
-
147
- ---
148
- *Generated by aicgen*
149
- `;
150
-
151
- files.push({
152
- path: 'CLAUDE.md',
153
- content: mainContent,
154
- type: 'main'
155
- });
156
-
157
- const hooks = await this.hookGenerator.generateHooks(guidelineIds);
158
- const settingsContent = this.hookGenerator.generateClaudeCodeSettings(hooks, projectPath, selection.level);
159
-
160
- files.push({
161
- path: '.claude/settings.json',
162
- content: settingsContent,
163
- type: 'config'
164
- });
165
-
166
- const subAgents = await this.subAgentGenerator.generateSubAgents(guidelineIds);
167
- for (const agent of subAgents) {
168
- files.push({
169
- path: `.claude/agents/${agent.name}.md`,
170
- content: agent.content,
171
- type: 'agent'
172
- });
173
- }
174
-
175
- return files;
176
- }
177
-
178
- private async generateCopilotFiles(
179
- categoryTree: Map<string, string[]>,
180
- selection: ProfileSelection
181
- ): Promise<GeneratedFile[]> {
182
- const files: GeneratedFile[] = [];
183
-
184
- const mainReferences: string[] = [];
185
-
186
- for (const [category, ids] of categoryTree) {
187
- const categoryFile = category.toLowerCase().replace(/\s+/g, '-');
188
- const categoryContent = ids.map(id =>
189
- this.guidelineLoader.loadGuideline(id)
190
- ).join('\n\n---\n\n');
191
-
192
- let applyTo = "**/*";
193
-
194
- // Smart globs for specific categories
195
- if (category.toLowerCase().includes('testing')) {
196
- applyTo = "**/*.test.ts, **/*.spec.ts, **/tests/**";
197
- } else if (category.toLowerCase().includes('language') || category.toLowerCase().includes('style')) {
198
- applyTo = "**/*.ts, **/*.js, **/*.tsx, **/*.jsx"; // Adjust based on language in future
199
- }
200
-
201
- const instructionsContent = `---
202
- applyTo: "${applyTo}"
203
- description: "${category} guidelines"
204
- ---
205
-
206
- # ${category}
207
-
208
- ${categoryContent}
209
- `;
210
-
211
- files.push({
212
- path: `.github/instructions/${categoryFile}.instructions.md`,
213
- content: instructionsContent,
214
- type: 'guideline'
215
- });
216
-
217
- mainReferences.push(`- ${category}: @.github/instructions/${categoryFile}.instructions.md`);
218
- }
219
-
220
- const archDescription = selection.architecture === 'other'
221
- ? ''
222
- : ` and ${selection.architecture}`;
223
-
224
- const mainContent = `# GitHub Copilot Instructions
225
-
226
- **Role:** You are an expert AI pair programmer specialized in ${selection.language}${archDescription}.
227
-
228
- ## Guidelines
229
-
230
- ${mainReferences.join('\n')}
231
-
232
- ## Development
233
-
234
- See the instruction files above for detailed guidelines on:
235
- - Code style and naming conventions
236
- - Architecture patterns and best practices
237
- - Testing requirements
238
- - Security considerations
239
-
240
- ---
241
- *Generated by aicgen*
242
- `;
243
-
244
- files.push({
245
- path: '.github/copilot-instructions.md',
246
- content: mainContent,
247
- type: 'main'
248
- });
249
-
250
- return files;
251
- }
252
-
253
- private async generateGeminiFiles(
254
- categoryTree: Map<string, string[]>,
255
- selection: ProfileSelection
256
- ): Promise<GeneratedFile[]> {
257
- const files: GeneratedFile[] = [];
258
-
259
- let allGuidelines = '';
260
- for (const [category, ids] of categoryTree) {
261
- const categoryContent = ids.map(id =>
262
- this.guidelineLoader.loadGuideline(id)
263
- ).join('\n\n');
264
-
265
- allGuidelines += `\n\n## ${category}\n\n${categoryContent}\n\n---\n`;
266
- }
267
-
268
- const archDescription = selection.architecture === 'other'
269
- ? ''
270
- : ` and ${selection.architecture} architecture`;
271
-
272
- const content = `# Gemini Development Guide
273
-
274
- **Role:** You are an expert software engineer specialized in ${selection.language}${archDescription}.
275
- **Objective:** Write clean, efficient, and maintainable code following the guidelines below.
276
-
277
- ## Guiding Principles
278
- 1. **Quality First**: Prioritize code quality and maintainability over speed.
279
- 2. **Step-by-Step**: Think through problems systematically.
280
- 3. **Verify**: Double-check your code against the guidelines.
281
-
282
- ${allGuidelines}
283
-
284
- ---
285
- *Generated by aicgen*
286
- `;
287
-
288
- files.push({
289
- path: '.gemini/instructions.md',
290
- content,
291
- type: 'main'
292
- });
293
-
294
- return files;
295
- }
296
-
297
- private async generateAntigravityFiles(
298
- categoryTree: Map<string, string[]>,
299
- selection: ProfileSelection
300
- ): Promise<GeneratedFile[]> {
301
- const files: GeneratedFile[] = [];
302
- const ruleFiles: string[] = [];
303
-
304
- // Generate separate rule files for each category
305
- for (const [category, ids] of categoryTree) {
306
- const guidelines = ids.map(id => {
307
- const guideline = this.guidelineLoader.loadGuideline(id);
308
- return guideline;
309
- }).filter(Boolean).join('\n\n---\n\n');
310
-
311
- if (guidelines) {
312
- const fileName = category.toLowerCase().replace(/\s+/g, '-');
313
-
314
- const content = `# ${category} Rules
315
-
316
- ${guidelines}
317
-
318
- ---
319
- *Generated by aicgen*
320
- `;
321
-
322
- files.push({
323
- path: `.agent/rules/${fileName}.md`,
324
- content,
325
- type: 'guideline'
326
- });
327
-
328
- ruleFiles.push(`- **${category}**: @.agent/rules/${fileName}.md`);
329
- }
330
- }
331
-
332
- // Generate main instruction file (Index/System Prompt)
333
- const archDescription = selection.architecture === 'other'
334
- ? ''
335
- : ` and ${selection.architecture} architecture`;
336
-
337
- const mainContent = `# Google Antigravity Instructions
338
-
339
- **Role:** You are an expert software engineer specialized in ${selection.language}${archDescription}.
340
- **Objective:** Assist the user in building high-quality, maintainable software following strict project guidelines.
341
-
342
- ## Rule Index
343
-
344
- This project is governed by the following rule sets:
345
-
346
- ${ruleFiles.join('\n')}
347
-
348
- ## Core Principles
349
- 1. **Act as an Agent**: Don't just answer; perform actions, verify results, and course-correct.
350
- 2. **Follow Guidelines**: Strictly adhere to the rules linked above.
351
- 3. **Think Step-by-Step**: Break down complex tasks into smaller, verifiable steps.
352
-
353
- ---
354
- *Generated by aicgen*
355
- `;
356
-
357
- files.push({
358
- path: '.agent/rules/instructions.md',
359
- content: mainContent,
360
- type: 'main'
361
- });
362
-
363
- // Generate workflows based on instruction level
364
- const workflows = this.getWorkflowsForLevel(selection.level);
365
- for (const workflow of workflows) {
366
- files.push({
367
- path: `.agent/workflows/${workflow.name}.md`,
368
- content: workflow.content,
369
- type: 'config'
370
- });
371
- }
372
-
373
- return files;
374
- }
375
-
376
-
377
- private getWorkflowsForLevel(level: string): Array<{ name: string; content: string }> {
378
- const workflows: Array<{ name: string; content: string }> = [];
379
-
380
- // Basic workflows for all levels
381
- workflows.push({
382
- name: 'generate-unit-tests',
383
- content: `---
384
- description: Generate comprehensive unit tests for all functions and methods
385
- ---
386
-
387
- * Analyze the selected file or directory for testable code
388
- * Generate test files with appropriate naming conventions
389
- * Create test cases covering happy path, edge cases, and error handling
390
- * Mock external dependencies appropriately
391
- * Follow language-specific testing best practices
392
- * Aim for >80% code coverage
393
- * Include setup and teardown methods where needed`
394
- });
395
-
396
- workflows.push({
397
- name: 'add-documentation',
398
- content: `---
399
- description: Add or update comprehensive documentation for code
400
- ---
401
-
402
- * Analyze the selected code for documentation needs
403
- * Add inline documentation with clear descriptions
404
- * Include parameter types and return value documentation
405
- * Add usage examples for complex functions
406
- * Follow language-specific documentation standards
407
- * Update README.md if adding new features`
408
- });
409
-
410
- // Standard level and above
411
- if (level === 'standard' || level === 'expert' || level === 'full') {
412
- workflows.push({
413
- name: 'refactor-extract-module',
414
- content: `---
415
- description: Extract code into a separate, reusable module
416
- ---
417
-
418
- * Identify the code section to extract
419
- * Analyze dependencies and determine module interface
420
- * Create a new module file following project conventions
421
- * Maintain original functionality and behavior
422
- * Update imports and exports appropriately
423
- * Ensure no circular dependencies
424
- * Add documentation to the new module
425
- * Verify all tests still pass`
426
- });
427
-
428
- workflows.push({
429
- name: 'generate-integration-tests',
430
- content: `---
431
- description: Generate integration tests for API endpoints and system components
432
- ---
433
-
434
- * Identify integration points (APIs, databases, services)
435
- * Create integration test files
436
- * Test end-to-end workflows
437
- * Use realistic test data and fixtures
438
- * Include proper setup and teardown
439
- * Ensure tests are idempotent`
440
- });
441
- }
442
-
443
- // Expert and full levels
444
- if (level === 'expert' || level === 'full') {
445
- workflows.push({
446
- name: 'security-audit',
447
- content: `---
448
- description: Perform comprehensive security audit of the codebase
449
- ---
450
-
451
- * Scan for common vulnerabilities (SQL injection, XSS, etc.)
452
- * Check authentication and authorization logic
453
- * Review input validation and sanitization
454
- * Examine error handling for information leakage
455
- * Verify secure handling of sensitive data
456
- * Check third-party dependencies
457
- * Suggest remediation steps
458
- * Prioritize findings by severity`
459
- });
460
-
461
- workflows.push({
462
- name: 'performance-audit',
463
- content: `---
464
- description: Analyze code for performance bottlenecks and optimization opportunities
465
- ---
466
-
467
- * Profile code to identify hotspots
468
- * Check for N+1 queries and inefficient algorithms
469
- * Analyze caching opportunities
470
- * Review resource management
471
- * Suggest specific optimizations
472
- * Estimate performance impact
473
- * Prioritize recommendations`
474
- });
475
- }
476
-
477
- return workflows;
478
- }
479
-
480
- private async generateCodexFiles(
481
- categoryTree: Map<string, string[]>,
482
- selection: ProfileSelection
483
- ): Promise<GeneratedFile[]> {
484
- const files: GeneratedFile[] = [];
485
-
486
- let allGuidelines = '';
487
- for (const [category, ids] of categoryTree) {
488
- const categoryContent = ids.map(id =>
489
- this.guidelineLoader.loadGuideline(id)
490
- ).join('\n\n');
491
-
492
- allGuidelines += `\n\n## ${category}\n\n${categoryContent}\n\n---\n`;
493
- }
494
-
495
- const content = `# Development Guide
496
-
497
- **Role:** You are an expert software engineer specialized in ${selection.language}.
498
- **Objective:** Assist the user in writing high-quality code.
499
-
500
- **Language:** ${selection.language}
501
- **Type:** ${selection.projectType}
502
-
503
- ${allGuidelines}
504
-
505
- ---
506
- *Generated by aicgen*
507
- `;
508
-
509
- files.push({
510
- path: '.codex/instructions.md',
511
- content,
512
- type: 'main'
513
- });
514
-
515
- return files;
516
- }
517
-
518
- private generateUniversalAgentsFile(
519
- categoryTree: Map<string, string[]>,
520
- selection: ProfileSelection
521
- ): GeneratedFile {
522
- const categories: string[] = [];
523
-
524
- for (const [category, ids] of categoryTree) {
525
- const examples = ids.slice(0, 3).map(id => {
526
- const mapping = this.guidelineLoader.getMapping(id);
527
- const fileName = mapping?.path.split('/').pop()?.replace('.md', '') || id;
528
- return `- ${fileName}`;
529
- }).join('\n ');
530
-
531
- categories.push(`### ${category}\n\n ${examples}\n`);
532
- }
533
-
534
- const archLine = selection.architecture === 'other'
535
- ? ''
536
- : `**Architecture:** ${selection.architecture}\n`;
537
-
538
- const archSection = selection.architecture === 'other'
539
- ? ''
540
- : `## Architecture
541
-
542
- This project follows **${selection.architecture}** architecture. See architecture guidelines in tool-specific files.
543
-
544
- `;
545
-
546
- const content = `# AGENTS.md
547
-
548
- ## Project Overview
549
-
550
- **Language:** ${selection.language}
551
- **Type:** ${selection.projectType}
552
- ${archLine}
553
- ## Development Guidelines
554
-
555
- This project follows structured coding guidelines across multiple categories:
556
-
557
- ${categories.join('\n')}
558
-
559
- ## Commands
560
-
561
- **Install dependencies:**
562
- \`\`\`bash
563
- # Check package.json for package manager
564
- npm install
565
- # or yarn install
566
- # or pnpm install
567
- # or bun install
568
- \`\`\`
569
-
570
- **Run tests:**
571
- \`\`\`bash
572
- # Check package.json scripts section
573
- npm test
574
- \`\`\`
575
-
576
- **Build:**
577
- \`\`\`bash
578
- # Check package.json scripts section
579
- npm run build
580
- \`\`\`
581
-
582
- ## Code Style
583
-
584
- See tool-specific instruction files for detailed code style guidelines:
585
- - Claude Code: \`CLAUDE.md\`
586
- - GitHub Copilot: \`.github/copilot-instructions.md\`
587
- - Gemini: \`.gemini/instructions.md\`
588
- - Antigravity: \`.agent/rules/instructions.md\`
589
-
590
- ${archSection}## Testing
591
-
592
- Follow testing guidelines in tool-specific instruction files.
593
-
594
- ## Git Workflow
595
-
596
- - Write clear commit messages
597
- - Follow conventional commits if configured
598
- - Run tests before pushing
599
- - Keep PRs focused and reviewable
600
-
601
- ---
602
-
603
- *Generated by aicgen - Universal AI agent instructions following the AGENTS.md standard*
604
- `;
605
-
606
- return {
607
- path: 'AGENTS.md',
608
- content,
609
- type: 'universal'
610
- };
611
- }
612
- }