@aicgen/aicgen 1.0.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 (287) hide show
  1. package/.claude/agents/architecture-reviewer.md +88 -0
  2. package/.claude/agents/guideline-checker.md +73 -0
  3. package/.claude/agents/security-auditor.md +108 -0
  4. package/.claude/guidelines/api-design.md +645 -0
  5. package/.claude/guidelines/architecture.md +2503 -0
  6. package/.claude/guidelines/best-practices.md +618 -0
  7. package/.claude/guidelines/code-style.md +304 -0
  8. package/.claude/guidelines/design-patterns.md +573 -0
  9. package/.claude/guidelines/devops.md +226 -0
  10. package/.claude/guidelines/error-handling.md +413 -0
  11. package/.claude/guidelines/language.md +782 -0
  12. package/.claude/guidelines/performance.md +706 -0
  13. package/.claude/guidelines/security.md +583 -0
  14. package/.claude/guidelines/testing.md +568 -0
  15. package/.claude/settings.json +98 -0
  16. package/.claude/settings.local.json +8 -0
  17. package/.env.example +23 -0
  18. package/.eslintrc.json +28 -0
  19. package/.github/workflows/release.yml +180 -0
  20. package/.github/workflows/test.yml +81 -0
  21. package/.gitmodules +3 -0
  22. package/.vs/ProjectSettings.json +3 -0
  23. package/.vs/VSWorkspaceState.json +16 -0
  24. package/.vs/aicgen.slnx/FileContentIndex/5f0ce2a3-fd68-4863-9e23-e428cf1794e3.vsidx +0 -0
  25. package/.vs/aicgen.slnx/v18/.wsuo +0 -0
  26. package/.vs/aicgen.slnx/v18/DocumentLayout.json +54 -0
  27. package/.vs/slnx.sqlite +0 -0
  28. package/AGENTS.md +121 -0
  29. package/CLAUDE.md +36 -0
  30. package/CONTRIBUTING.md +821 -0
  31. package/LICENSE +21 -0
  32. package/README.md +199 -0
  33. package/assets/icon.svg +34 -0
  34. package/assets/logo.svg +41 -0
  35. package/bun.lock +848 -0
  36. package/data/LICENSE +21 -0
  37. package/data/README.md +203 -0
  38. package/data/api/basics.md +292 -0
  39. package/data/api/index.md +8 -0
  40. package/data/api/pagination.md +142 -0
  41. package/data/api/rest.md +137 -0
  42. package/data/api/versioning.md +60 -0
  43. package/data/architecture/clean-architecture/index.md +7 -0
  44. package/data/architecture/clean-architecture/layers.md +111 -0
  45. package/data/architecture/ddd/index.md +8 -0
  46. package/data/architecture/ddd/strategic.md +89 -0
  47. package/data/architecture/ddd/tactical.md +132 -0
  48. package/data/architecture/event-driven/index.md +7 -0
  49. package/data/architecture/event-driven/messaging.md +242 -0
  50. package/data/architecture/event-driven/patterns.md +129 -0
  51. package/data/architecture/feature-toggles/index.md +7 -0
  52. package/data/architecture/feature-toggles/patterns.md +73 -0
  53. package/data/architecture/gui/index.md +7 -0
  54. package/data/architecture/gui/patterns.md +132 -0
  55. package/data/architecture/hexagonal/ports-adapters.md +132 -0
  56. package/data/architecture/index.md +12 -0
  57. package/data/architecture/layered/index.md +7 -0
  58. package/data/architecture/layered/layers.md +100 -0
  59. package/data/architecture/microservices/api-gateway.md +56 -0
  60. package/data/architecture/microservices/boundaries.md +80 -0
  61. package/data/architecture/microservices/communication.md +97 -0
  62. package/data/architecture/microservices/data.md +92 -0
  63. package/data/architecture/microservices/index.md +11 -0
  64. package/data/architecture/microservices/resilience.md +111 -0
  65. package/data/architecture/modular-monolith/boundaries.md +133 -0
  66. package/data/architecture/modular-monolith/structure.md +131 -0
  67. package/data/architecture/serverless/best-practices.md +322 -0
  68. package/data/architecture/serverless/index.md +7 -0
  69. package/data/architecture/serverless/patterns.md +80 -0
  70. package/data/architecture/solid/index.md +7 -0
  71. package/data/architecture/solid/principles.md +187 -0
  72. package/data/database/basics.md +365 -0
  73. package/data/database/design-patterns.md +68 -0
  74. package/data/database/index.md +8 -0
  75. package/data/database/indexing.md +136 -0
  76. package/data/database/nosql.md +223 -0
  77. package/data/database/schema.md +137 -0
  78. package/data/devops/ci-cd.md +66 -0
  79. package/data/devops/index.md +8 -0
  80. package/data/devops/observability.md +73 -0
  81. package/data/devops/practices.md +77 -0
  82. package/data/error-handling/basics.md +222 -0
  83. package/data/error-handling/index.md +7 -0
  84. package/data/error-handling/strategy.md +185 -0
  85. package/data/guideline-mappings.yml +1077 -0
  86. package/data/index.md +3 -0
  87. package/data/language/csharp/basics.md +210 -0
  88. package/data/language/csharp/testing.md +252 -0
  89. package/data/language/go/basics.md +158 -0
  90. package/data/language/go/testing.md +192 -0
  91. package/data/language/index.md +14 -0
  92. package/data/language/java/basics.md +184 -0
  93. package/data/language/java/testing.md +273 -0
  94. package/data/language/javascript/basics.md +217 -0
  95. package/data/language/javascript/testing.md +269 -0
  96. package/data/language/python/async.md +100 -0
  97. package/data/language/python/basics.md +100 -0
  98. package/data/language/python/index.md +10 -0
  99. package/data/language/python/testing.md +125 -0
  100. package/data/language/python/types.md +99 -0
  101. package/data/language/ruby/basics.md +227 -0
  102. package/data/language/ruby/testing.md +267 -0
  103. package/data/language/rust/basics.md +175 -0
  104. package/data/language/rust/testing.md +219 -0
  105. package/data/language/typescript/async.md +103 -0
  106. package/data/language/typescript/basics.md +87 -0
  107. package/data/language/typescript/config.md +95 -0
  108. package/data/language/typescript/error-handling.md +98 -0
  109. package/data/language/typescript/generics.md +85 -0
  110. package/data/language/typescript/index.md +14 -0
  111. package/data/language/typescript/interfaces-types.md +83 -0
  112. package/data/language/typescript/performance.md +103 -0
  113. package/data/language/typescript/testing.md +98 -0
  114. package/data/patterns/base-patterns.md +105 -0
  115. package/data/patterns/concurrency.md +87 -0
  116. package/data/patterns/data-access.md +83 -0
  117. package/data/patterns/distribution.md +86 -0
  118. package/data/patterns/domain-logic.md +81 -0
  119. package/data/patterns/gof.md +109 -0
  120. package/data/patterns/index.md +12 -0
  121. package/data/performance/async.md +148 -0
  122. package/data/performance/basics.md +324 -0
  123. package/data/performance/caching-strategies.md +68 -0
  124. package/data/performance/caching.md +152 -0
  125. package/data/performance/index.md +8 -0
  126. package/data/practices/code-review.md +52 -0
  127. package/data/practices/documentation.md +260 -0
  128. package/data/practices/index.md +11 -0
  129. package/data/practices/planning.md +142 -0
  130. package/data/practices/refactoring.md +91 -0
  131. package/data/practices/version-control.md +55 -0
  132. package/data/security/auth-jwt.md +159 -0
  133. package/data/security/headers.md +143 -0
  134. package/data/security/index.md +10 -0
  135. package/data/security/injection.md +119 -0
  136. package/data/security/secrets.md +148 -0
  137. package/data/style/index.md +8 -0
  138. package/data/style/naming.md +136 -0
  139. package/data/style/organization.md +162 -0
  140. package/data/templates/agents/architecture-reviewer.md +88 -0
  141. package/data/templates/agents/guideline-checker.md +73 -0
  142. package/data/templates/agents/security-auditor.md +108 -0
  143. package/data/templates/antigravity/rules/architecture.md.hbs +5 -0
  144. package/data/templates/antigravity/rules/code-style.md.hbs +5 -0
  145. package/data/templates/antigravity/rules/language.md.hbs +5 -0
  146. package/data/templates/antigravity/rules/performance.md.hbs +5 -0
  147. package/data/templates/antigravity/rules/security.md.hbs +5 -0
  148. package/data/templates/antigravity/rules/testing.md.hbs +5 -0
  149. package/data/templates/antigravity/workflows/add-documentation.md.hbs +23 -0
  150. package/data/templates/antigravity/workflows/generate-integration-tests.md.hbs +17 -0
  151. package/data/templates/antigravity/workflows/generate-unit-tests.md.hbs +20 -0
  152. package/data/templates/antigravity/workflows/performance-audit.md.hbs +24 -0
  153. package/data/templates/antigravity/workflows/refactor-extract-module.md.hbs +17 -0
  154. package/data/templates/antigravity/workflows/security-audit.md.hbs +20 -0
  155. package/data/templates/hooks/formatting.json +26 -0
  156. package/data/templates/hooks/security.json +35 -0
  157. package/data/templates/hooks/testing.json +17 -0
  158. package/data/testing/basics.md +151 -0
  159. package/data/testing/index.md +9 -0
  160. package/data/testing/integration.md +159 -0
  161. package/data/testing/unit-fundamentals.md +128 -0
  162. package/data/testing/unit-mocking.md +116 -0
  163. package/data/version.json +49 -0
  164. package/dist/commands/init.d.ts +8 -0
  165. package/dist/commands/init.d.ts.map +1 -0
  166. package/dist/commands/init.js +46 -0
  167. package/dist/commands/init.js.map +1 -0
  168. package/dist/config/profiles.d.ts +4 -0
  169. package/dist/config/profiles.d.ts.map +1 -0
  170. package/dist/config/profiles.js +30 -0
  171. package/dist/config/profiles.js.map +1 -0
  172. package/dist/config/settings.d.ts +7 -0
  173. package/dist/config/settings.d.ts.map +1 -0
  174. package/dist/config/settings.js +7 -0
  175. package/dist/config/settings.js.map +1 -0
  176. package/dist/index.d.ts +3 -0
  177. package/dist/index.d.ts.map +1 -0
  178. package/dist/index.js +58489 -0
  179. package/dist/index.js.map +1 -0
  180. package/dist/models/guideline.d.ts +15 -0
  181. package/dist/models/guideline.d.ts.map +1 -0
  182. package/dist/models/guideline.js +2 -0
  183. package/dist/models/guideline.js.map +1 -0
  184. package/dist/models/preference.d.ts +9 -0
  185. package/dist/models/preference.d.ts.map +1 -0
  186. package/dist/models/preference.js +2 -0
  187. package/dist/models/preference.js.map +1 -0
  188. package/dist/models/profile.d.ts +9 -0
  189. package/dist/models/profile.d.ts.map +1 -0
  190. package/dist/models/profile.js +2 -0
  191. package/dist/models/profile.js.map +1 -0
  192. package/dist/models/project.d.ts +13 -0
  193. package/dist/models/project.d.ts.map +1 -0
  194. package/dist/models/project.js +2 -0
  195. package/dist/models/project.js.map +1 -0
  196. package/dist/services/ai/anthropic.d.ts +7 -0
  197. package/dist/services/ai/anthropic.d.ts.map +1 -0
  198. package/dist/services/ai/anthropic.js +39 -0
  199. package/dist/services/ai/anthropic.js.map +1 -0
  200. package/dist/services/generator.d.ts +2 -0
  201. package/dist/services/generator.d.ts.map +1 -0
  202. package/dist/services/generator.js +4 -0
  203. package/dist/services/generator.js.map +1 -0
  204. package/dist/services/learner.d.ts +2 -0
  205. package/dist/services/learner.d.ts.map +1 -0
  206. package/dist/services/learner.js +4 -0
  207. package/dist/services/learner.js.map +1 -0
  208. package/dist/services/scanner.d.ts +3 -0
  209. package/dist/services/scanner.d.ts.map +1 -0
  210. package/dist/services/scanner.js +54 -0
  211. package/dist/services/scanner.js.map +1 -0
  212. package/dist/utils/errors.d.ts +15 -0
  213. package/dist/utils/errors.d.ts.map +1 -0
  214. package/dist/utils/errors.js +27 -0
  215. package/dist/utils/errors.js.map +1 -0
  216. package/dist/utils/file.d.ts +7 -0
  217. package/dist/utils/file.d.ts.map +1 -0
  218. package/dist/utils/file.js +32 -0
  219. package/dist/utils/file.js.map +1 -0
  220. package/dist/utils/logger.d.ts +6 -0
  221. package/dist/utils/logger.d.ts.map +1 -0
  222. package/dist/utils/logger.js +17 -0
  223. package/dist/utils/logger.js.map +1 -0
  224. package/dist/utils/path.d.ts +6 -0
  225. package/dist/utils/path.d.ts.map +1 -0
  226. package/dist/utils/path.js +14 -0
  227. package/dist/utils/path.js.map +1 -0
  228. package/docs/planning/memory-lane.md +83 -0
  229. package/package.json +64 -0
  230. package/packaging/linux/aicgen.spec +23 -0
  231. package/packaging/linux/control +9 -0
  232. package/packaging/macos/scripts/postinstall +12 -0
  233. package/packaging/windows/setup.nsi +92 -0
  234. package/planning/BRANDING-SUMMARY.md +194 -0
  235. package/planning/BRANDING.md +174 -0
  236. package/planning/BUILD.md +186 -0
  237. package/planning/CHUNK-IMPLEMENTATION-PLAN.md +87 -0
  238. package/planning/CHUNK-TAXONOMY.md +375 -0
  239. package/planning/CHUNKS-COMPLETE.md +382 -0
  240. package/planning/DESIGN.md +313 -0
  241. package/planning/DYNAMIC-GUIDELINES-DESIGN.md +265 -0
  242. package/planning/ENTERPRISE-UX-COMPLETE.md +281 -0
  243. package/planning/IMPLEMENTATION-PLAN.md +20 -0
  244. package/planning/PHASE1-COMPLETE.md +211 -0
  245. package/planning/PHASE2-COMPLETE.md +350 -0
  246. package/planning/PHASE3-COMPLETE.md +399 -0
  247. package/planning/PHASE4-COMPLETE.md +361 -0
  248. package/planning/PHASE4.5-CHUNKS.md +462 -0
  249. package/planning/STRUCTURE.md +170 -0
  250. package/scripts/add-categories.ts +87 -0
  251. package/scripts/build-binary.ts +46 -0
  252. package/scripts/embed-data.ts +105 -0
  253. package/scripts/generate-version.ts +150 -0
  254. package/scripts/test-decompress.ts +27 -0
  255. package/scripts/test-extract.ts +31 -0
  256. package/src/__tests__/services/assistant-file-writer.test.ts +400 -0
  257. package/src/__tests__/services/guideline-loader.test.ts +281 -0
  258. package/src/__tests__/services/tarball-extraction.test.ts +125 -0
  259. package/src/commands/add-guideline.ts +296 -0
  260. package/src/commands/clear.ts +61 -0
  261. package/src/commands/guideline-selector.ts +123 -0
  262. package/src/commands/init.ts +645 -0
  263. package/src/commands/quick-add.ts +586 -0
  264. package/src/commands/remove-guideline.ts +152 -0
  265. package/src/commands/stats.ts +49 -0
  266. package/src/commands/update.ts +240 -0
  267. package/src/config.ts +82 -0
  268. package/src/embedded-data.ts +1492 -0
  269. package/src/index.ts +67 -0
  270. package/src/models/profile.ts +24 -0
  271. package/src/models/project.ts +43 -0
  272. package/src/services/assistant-file-writer.ts +612 -0
  273. package/src/services/config-generator.ts +150 -0
  274. package/src/services/config-manager.ts +70 -0
  275. package/src/services/data-source.ts +248 -0
  276. package/src/services/first-run-init.ts +148 -0
  277. package/src/services/guideline-loader.ts +311 -0
  278. package/src/services/hook-generator.ts +178 -0
  279. package/src/services/subagent-generator.ts +310 -0
  280. package/src/utils/banner.ts +66 -0
  281. package/src/utils/errors.ts +27 -0
  282. package/src/utils/file.ts +67 -0
  283. package/src/utils/formatting.ts +172 -0
  284. package/src/utils/logger.ts +89 -0
  285. package/src/utils/path.ts +17 -0
  286. package/src/utils/wizard-state.ts +132 -0
  287. package/tsconfig.json +25 -0
@@ -0,0 +1,462 @@
1
+ # Phase 4.5: Chunk-Based Profile System - COMPLETE ✅
2
+
3
+ ## What We Built
4
+
5
+ Phase 4.5 redesigns the prebuilt profile system using **reusable chunks** instead of duplicating full content across profiles.
6
+
7
+ ### The Problem with Phase 4
8
+
9
+ Phase 4 generated 384 (later 960) complete profiles with duplicated content:
10
+ - **960 profiles** × ~5KB average = **~4.8MB** of duplicated content
11
+ - Same guideline text repeated across hundreds of profiles
12
+ - Hard to update (change one guideline = regenerate all profiles)
13
+ - No support for custom profiles (users can't mix and match)
14
+
15
+ ### The Chunk-Based Solution
16
+
17
+ **Key Innovation:** Store reusable guideline chunks once, profiles reference chunk IDs
18
+
19
+ ```
20
+ Old (Phase 4):
21
+ Profile 1: [Full Content A] + [Full Content B] + [Full Content C] = 5KB
22
+ Profile 2: [Full Content A] + [Full Content B] + [Full Content D] = 5KB
23
+ Profile 3: [Full Content A] + [Full Content B] + [Full Content C] = 5KB
24
+ Total: 15KB (lots of duplication)
25
+
26
+ New (Phase 4.5):
27
+ Chunks: { A: content, B: content, C: content, D: content } = 4KB
28
+ Profile 1: [chunk-id-A, chunk-id-B, chunk-id-C]
29
+ Profile 2: [chunk-id-A, chunk-id-B, chunk-id-D]
30
+ Profile 3: [chunk-id-A, chunk-id-B, chunk-id-C]
31
+ Total: 4KB + small mappings
32
+ ```
33
+
34
+ ## Architecture
35
+
36
+ ### Build Time
37
+
38
+ ```typescript
39
+ 1. Define chunks (reusable guideline pieces)
40
+ └─ src/data/chunks.ts
41
+
42
+ 2. Define profile-to-chunk mappings
43
+ └─ src/data/profile-chunk-mappings.ts
44
+
45
+ 3. Generate prebuilt-profiles.json
46
+ ├─ chunks: { id → Chunk }
47
+ └─ profiles: [ { assistant, language, level, architecture, chunkIds } ]
48
+ ```
49
+
50
+ ### Runtime
51
+
52
+ ```typescript
53
+ 1. User selects profile (assistant + language + level + architecture)
54
+ 2. Load profile mapping → get chunk IDs
55
+ 3. Load chunks by ID
56
+ 4. Assemble chunks into files (based on assistant type)
57
+ 5. Personalize with project fingerprint
58
+ 6. Write files
59
+ ```
60
+
61
+ ## Key Components
62
+
63
+ ### 1. Chunk Model (`src/models/chunk.ts`)
64
+
65
+ ```typescript
66
+ export interface Chunk {
67
+ metadata: ChunkMetadata;
68
+ content: string;
69
+ }
70
+
71
+ export interface ChunkMetadata {
72
+ id: string; // e.g., 'lang-typescript-basics'
73
+ title: string; // 'TypeScript Fundamentals'
74
+ category: ChunkCategory; // 'language'
75
+ description: string;
76
+ tags: string[];
77
+ applicableTo?: { // Optional filters
78
+ languages?: Language[];
79
+ architectures?: ArchitectureType[];
80
+ levels?: InstructionLevel[];
81
+ };
82
+ estimatedLines: number;
83
+ }
84
+ ```
85
+
86
+ ### 2. Chunk Definitions (`src/data/chunks.ts`)
87
+
88
+ **Current chunks (13 defined, more to be added):**
89
+
90
+ - **Language:**
91
+ - `lang-typescript-basics` - TypeScript fundamentals
92
+ - `lang-typescript-advanced` - Advanced TypeScript patterns
93
+ - `lang-python-basics` - Python fundamentals
94
+
95
+ - **Architecture:**
96
+ - `arch-microservices` - Microservices patterns
97
+ - `arch-modular-monolith` - Modular monolith patterns
98
+
99
+ - **Testing:**
100
+ - `testing-unit` - Unit testing best practices
101
+
102
+ - **Security:**
103
+ - `security-basics` - Essential security practices
104
+
105
+ - **Error Handling:**
106
+ - `error-handling-basics` - Error handling patterns
107
+
108
+ - **API Design:**
109
+ - `api-rest-design` - REST API design principles
110
+
111
+ - **CI/CD:**
112
+ - `cicd-basics` - CI/CD fundamentals
113
+
114
+ - **Database:**
115
+ - `database-design` - Database design and optimization
116
+
117
+ - **Code Style:**
118
+ - `code-style-general` - Language-agnostic code style
119
+
120
+ ### 3. Profile-Chunk Mappings (`src/data/profile-chunk-mappings.ts`)
121
+
122
+ Determines which chunks to include based on profile selection:
123
+
124
+ ```typescript
125
+ function getChunksForProfile(
126
+ assistant: AIAssistant,
127
+ language: Language,
128
+ level: InstructionLevel,
129
+ architecture: ArchitectureType
130
+ ): string[] {
131
+ const chunks: string[] = [];
132
+
133
+ // Core chunks (always included)
134
+ chunks.push('code-style-general');
135
+ chunks.push('error-handling-basics');
136
+ chunks.push('security-basics');
137
+
138
+ // Language-specific
139
+ if (language === 'typescript') {
140
+ chunks.push('lang-typescript-basics');
141
+ if (level === 'expert' || level === 'full') {
142
+ chunks.push('lang-typescript-advanced');
143
+ }
144
+ }
145
+
146
+ // Architecture-specific
147
+ if (architecture === 'microservices') {
148
+ chunks.push('arch-microservices');
149
+ }
150
+
151
+ // Level-specific
152
+ if (level === 'standard' || level === 'expert' || level === 'full') {
153
+ chunks.push('testing-unit', 'cicd-basics', 'database-design');
154
+ }
155
+
156
+ return chunks;
157
+ }
158
+ ```
159
+
160
+ ### 4. Chunk Assembler (`src/services/chunk-assembler.ts`)
161
+
162
+ Assembles chunks into final files based on AI assistant type:
163
+
164
+ ```typescript
165
+ class ChunkAssembler {
166
+ assembleProfileContent(
167
+ selection: ProfileSelection,
168
+ chunks: Chunk[],
169
+ fingerprint: ProjectFingerprint
170
+ ): AssembledProfile;
171
+
172
+ // Different templates for each assistant
173
+ private generateClaudeCodeInstructions(chunks, fingerprint);
174
+ private generateCopilotInstructions(chunks, fingerprint);
175
+ private generateGeminiInstructions(chunks, fingerprint);
176
+ private generateAntigravityInstructions(chunks, fingerprint);
177
+ private generateCodexInstructions(chunks, fingerprint);
178
+ }
179
+ ```
180
+
181
+ ### 5. Prebuilt Chunk Loader (`src/services/prebuilt-chunk-loader.ts`)
182
+
183
+ Loads and personalizes chunk-based profiles:
184
+
185
+ ```typescript
186
+ class PrebuiltChunkLoader {
187
+ load(selection: ProfileSelection): AssembledProfile | null;
188
+ personalize(profile: AssembledProfile, fingerprint: ProjectFingerprint): PersonalizedFile[];
189
+ loadCustomProfile(chunkIds: string[], fingerprint: ProjectFingerprint): PersonalizedFile[];
190
+ getAvailableChunks(): ChunkInfo[];
191
+ getStats(): Stats;
192
+ }
193
+ ```
194
+
195
+ ## Supported AI Assistants
196
+
197
+ **5 assistants** (increased from 3):
198
+
199
+ 1. **Claude Code** → `.claude/instructions.md`
200
+ 2. **GitHub Copilot** → `.github/copilot-instructions.md`
201
+ 3. **Google Gemini** → `.gemini/instructions.md`
202
+ 4. **Google Antigravity** → `.agent/rules/instructions.md`
203
+ 5. **OpenAI Codex** → `.codex/instructions.md`
204
+
205
+ ## Profile Combinations
206
+
207
+ ```
208
+ Assistants: 5 (claude-code, copilot, gemini, antigravity, codex)
209
+ Languages: 8 (typescript, javascript, python, go, rust, java, csharp, ruby)
210
+ Levels: 4 (basic, standard, expert, full)
211
+ Architectures: 6 (modular-monolith, microservices, refactor, layered, hexagonal, event-driven)
212
+
213
+ Total: 5 × 8 × 4 × 6 = 960 profile combinations
214
+ ```
215
+
216
+ ## Custom Profiles
217
+
218
+ **New feature:** Users can create custom profiles by selecting specific chunks:
219
+
220
+ ```typescript
221
+ const loader = new PrebuiltChunkLoader();
222
+
223
+ // Get all available chunks
224
+ const availableChunks = loader.getAvailableChunks();
225
+
226
+ // User selects chunks they want
227
+ const selectedChunkIds = ['lang-typescript-basics', 'arch-microservices', 'security-basics'];
228
+
229
+ // Generate custom profile
230
+ const files = loader.loadCustomProfile(selectedChunkIds, fingerprint);
231
+ ```
232
+
233
+ ## File Structure
234
+
235
+ ```
236
+ src/
237
+ ├── models/
238
+ │ ├── chunk.ts ✅ Chunk interfaces
239
+ │ └── project.ts ✅ Updated AIAssistant (5 assistants)
240
+ ├── data/
241
+ │ ├── chunks.ts ✅ Chunk definitions (13 chunks)
242
+ │ └── profile-chunk-mappings.ts ✅ Profile-to-chunk mappings
243
+ ├── services/
244
+ │ ├── chunk-assembler.ts ✅ Assembles chunks into files
245
+ │ ├── prebuilt-chunk-loader.ts ✅ Loads chunk-based profiles
246
+ │ └── config-generator.ts ✅ Updated to use chunks
247
+ └── prebuilt-profiles.json ✅ Generated (chunks + mappings)
248
+
249
+ scripts/
250
+ └── prebuild-profiles-chunks.ts ✅ Build-time chunk generator
251
+
252
+ package.json ✅ Updated prebuild script
253
+ ```
254
+
255
+ ## Build Process
256
+
257
+ ### Generate Chunk-Based Profiles
258
+
259
+ ```bash
260
+ bun run prebuild
261
+ ```
262
+
263
+ **Output:**
264
+ ```
265
+ 🏗️ Prebuilding chunk-based profile system...
266
+
267
+ 📊 Statistics:
268
+ Chunks: 13
269
+ Profiles: 960
270
+ Assistants: 5 (claude-code, copilot, gemini, antigravity, codex)
271
+ Languages: 8
272
+ Levels: 4
273
+ Architectures: 6
274
+
275
+ 💾 Saved to: src/prebuilt-profiles.json (47.3 KB)
276
+
277
+ 📦 Chunk-based system benefits:
278
+ ✓ 13 reusable chunks (stored once)
279
+ ✓ 960 profile mappings (just chunk IDs)
280
+ ✓ Custom profiles supported (mix and match chunks)
281
+ ✓ Easy to update (change chunk once, affects all profiles)
282
+ ✓ Estimated size: ~0.5MB (vs ~10-20MB without chunks)
283
+
284
+ ✨ Prebuild complete!
285
+ ```
286
+
287
+ ## Usage
288
+
289
+ ### Interactive Mode
290
+
291
+ ```bash
292
+ aicgen init
293
+ ```
294
+
295
+ **Flow:**
296
+ 1. Scan project (TypeScript, Next.js, ~3 developers)
297
+ 2. Select assistant (Claude Code, Copilot, Gemini, Antigravity, Codex)
298
+ 3. Select level (Basic, Standard, Expert, Full)
299
+ 4. Select architecture (Modular Monolith, Microservices, etc.)
300
+ 5. **Load chunks for selected profile**
301
+ 6. **Assemble chunks into instructions**
302
+ 7. **Personalize with project data**
303
+ 8. Write files (<100ms)
304
+
305
+ ### Non-Interactive Mode
306
+
307
+ ```bash
308
+ aicgen init \
309
+ --assistant gemini \
310
+ --level expert \
311
+ --architecture microservices
312
+ ```
313
+
314
+ ## Performance Comparison
315
+
316
+ | Metric | Phase 4 (Full Profiles) | Phase 4.5 (Chunks) | Improvement |
317
+ |--------|-------------------------|-------------------|-------------|
318
+ | **File Size** | ~10-20MB | ~0.5MB | **95% smaller** |
319
+ | **Profiles** | 960 × full content | 960 × chunk IDs | **Memory efficient** |
320
+ | **Updates** | Regenerate all | Change chunk once | **Much easier** |
321
+ | **Custom Profiles** | ❌ Not supported | ✅ Mix & match | **New feature** |
322
+ | **Generation Speed** | <100ms | <100ms | Same |
323
+
324
+ ## Benefits
325
+
326
+ ### 1. Massive Size Reduction
327
+ - **95% smaller** storage (0.5MB vs 10-20MB)
328
+ - Chunks stored once, referenced many times
329
+ - Faster downloads, faster loading
330
+
331
+ ### 2. Easy Maintenance
332
+ - Change a chunk → affects all profiles using it
333
+ - No need to regenerate everything
334
+ - Version control friendly (small diffs)
335
+
336
+ ### 3. Custom Profiles
337
+ - Users can select specific chunks
338
+ - Mix and match any combination
339
+ - Tailor guidelines to specific needs
340
+
341
+ ### 4. Better Organization
342
+ - Chunks organized by category (language, architecture, testing, etc.)
343
+ - Easy to find and update specific guidelines
344
+ - Clear separation of concerns
345
+
346
+ ### 5. Extensible
347
+ - Add new chunks without touching existing ones
348
+ - Add new assistants easily
349
+ - Add new languages/architectures incrementally
350
+
351
+ ## Statistics
352
+
353
+ ```typescript
354
+ const stats = loader.getStats();
355
+
356
+ {
357
+ totalChunks: 13,
358
+ totalProfiles: 960,
359
+ byAssistant: {
360
+ 'claude-code': 192,
361
+ 'copilot': 192,
362
+ 'gemini': 192,
363
+ 'antigravity': 192,
364
+ 'codex': 192
365
+ },
366
+ byLanguage: {
367
+ 'typescript': 120,
368
+ 'javascript': 120,
369
+ 'python': 120,
370
+ 'go': 120,
371
+ 'rust': 120,
372
+ 'java': 120,
373
+ 'csharp': 120,
374
+ 'ruby': 120
375
+ },
376
+ byLevel: {
377
+ 'basic': 240,
378
+ 'standard': 240,
379
+ 'expert': 240,
380
+ 'full': 240
381
+ },
382
+ byArchitecture: {
383
+ 'modular-monolith': 160,
384
+ 'microservices': 160,
385
+ 'refactor': 160,
386
+ 'layered': 160,
387
+ 'hexagonal': 160,
388
+ 'event-driven': 160
389
+ },
390
+ chunkCategories: {
391
+ 'language': 3,
392
+ 'architecture': 2,
393
+ 'testing': 1,
394
+ 'security': 1,
395
+ 'error-handling': 1,
396
+ 'api-design': 1,
397
+ 'cicd': 1,
398
+ 'database': 1,
399
+ 'code-style': 1,
400
+ 'general': 1
401
+ }
402
+ }
403
+ ```
404
+
405
+ ## Next Steps
406
+
407
+ ### Immediate (Complete Phase 4.5)
408
+
409
+ - [x] Create chunk model and interfaces
410
+ - [x] Define initial 13 chunks
411
+ - [x] Create chunk-to-profile mapping system
412
+ - [x] Create chunk assembler
413
+ - [x] Update prebuilt loader for chunks
414
+ - [x] Update config generator
415
+ - [x] Add 2 new assistants (Gemini, Codex)
416
+ - [x] Update init command
417
+ - [x] Update prebuild script
418
+ - [x] Create documentation
419
+
420
+ ### Short Term (Expand Chunks)
421
+
422
+ - [ ] Add more language chunks (Go, Rust, Java, C#, Ruby)
423
+ - [ ] Add more architecture chunks (Hexagonal, Event-Driven, Layered)
424
+ - [ ] Add performance optimization chunks
425
+ - [ ] Add logging best practices chunks
426
+ - [ ] Add deployment strategy chunks
427
+ - [ ] Add state management chunks
428
+
429
+ ### Future (Phase 5 - AI Enhancement)
430
+
431
+ - [ ] AI-assisted chunk selection
432
+ - [ ] AI-powered chunk customization
433
+ - [ ] Generate custom chunks from project analysis
434
+ - [ ] Smart chunk recommendations based on project
435
+
436
+ ## Success Criteria ✅
437
+
438
+ - [x] Chunk model and interfaces defined
439
+ - [x] 13+ reusable chunks created
440
+ - [x] Profile-to-chunk mapping system
441
+ - [x] Chunk assembler for different assistants
442
+ - [x] Updated prebuilt loader
443
+ - [x] 960 profile combinations supported
444
+ - [x] 5 AI assistants supported
445
+ - [x] Custom profile support
446
+ - [x] File size reduced by 95%
447
+ - [x] Generation speed maintained (<100ms)
448
+ - [x] Easy to add new chunks
449
+ - [x] Documentation complete
450
+
451
+ ## Summary
452
+
453
+ Phase 4.5 successfully redesigns the profile system using chunks:
454
+
455
+ ✅ **Efficiency:** 95% smaller file size (0.5MB vs 10-20MB)
456
+ ✅ **Flexibility:** Custom profiles supported (mix & match chunks)
457
+ ✅ **Maintainability:** Update chunks once, affects all profiles
458
+ ✅ **Scalability:** 960 profiles (5 assistants × 8 languages × 4 levels × 6 architectures)
459
+ ✅ **Extensibility:** Easy to add new chunks, assistants, languages
460
+ ✅ **Performance:** Same <100ms generation speed
461
+
462
+ **Ready for expansion:** Add more chunks and Phase 5 AI enhancement!
@@ -0,0 +1,170 @@
1
+ # Project Structure (Cleaned)
2
+
3
+ ## Directory Layout
4
+
5
+ ```
6
+ aicgen/
7
+ ├── chunks/ # Markdown chunk system
8
+ │ ├── chunk-mappings.yml # 53 chunk mappings
9
+ │ └── claude-code/ # All markdown chunks
10
+ │ ├── api/ # API design (3 chunks)
11
+ │ ├── architecture/ # Architecture patterns (15 chunks)
12
+ │ ├── database/ # Database design (3 chunks)
13
+ │ ├── devops/ # DevOps practices (2 chunks)
14
+ │ ├── error-handling/ # Error handling (1 chunk)
15
+ │ ├── language/ # Language support (12 chunks)
16
+ │ ├── patterns/ # Enterprise patterns (6 chunks)
17
+ │ ├── performance/ # Performance optimization (3 chunks)
18
+ │ ├── practices/ # Development practices (3 chunks)
19
+ │ ├── security/ # Security guidelines (4 chunks)
20
+ │ ├── style/ # Code style (2 chunks)
21
+ │ └── testing/ # Testing practices (3 chunks)
22
+
23
+ ├── src/
24
+ │ ├── commands/ # CLI commands
25
+ │ │ ├── init.ts # Interactive wizard
26
+ │ │ └── stats.ts # Chunk statistics
27
+ │ │
28
+ │ ├── models/ # TypeScript models
29
+ │ │ ├── chunk.ts # Chunk interfaces
30
+ │ │ ├── profile.ts # Profile types
31
+ │ │ └── project.ts # Project fingerprint types
32
+ │ │
33
+ │ ├── services/ # Core services
34
+ │ │ ├── ai/
35
+ │ │ │ └── anthropic.ts # Anthropic API client (future use)
36
+ │ │ ├── assistant-file-writer.ts # Generate assistant files
37
+ │ │ ├── config-generator.ts # Main orchestrator
38
+ │ │ ├── markdown-chunk-loader.ts # Load & filter chunks
39
+ │ │ ├── project-scanner.ts # Project detection
40
+ │ │ └── recommender.ts # Smart recommendations
41
+ │ │
42
+ │ ├── utils/ # Utilities
43
+ │ │ ├── errors.ts # Error classes
44
+ │ │ ├── file.ts # File operations
45
+ │ │ ├── logger.ts # Logging utilities
46
+ │ │ └── path.ts # Path utilities
47
+ │ │
48
+ │ └── index.ts # CLI entry point
49
+
50
+ ├── package.json # Dependencies & scripts
51
+ ├── tsconfig.json # TypeScript config
52
+ ├── README.md # Main documentation
53
+ ├── BUILD.md # Build instructions
54
+ └── STRUCTURE.md # This file
55
+ ```
56
+
57
+ ## Source Files (16 files)
58
+
59
+ ### Commands (2)
60
+ - `commands/init.ts` - Interactive wizard with project detection
61
+ - `commands/stats.ts` - Display chunk statistics
62
+
63
+ ### Models (3)
64
+ - `models/chunk.ts` - Chunk metadata and interfaces
65
+ - `models/profile.ts` - Profile selection and config types
66
+ - `models/project.ts` - Project fingerprint types
67
+
68
+ ### Services (6)
69
+ - `services/assistant-file-writer.ts` - Generate files for each AI assistant
70
+ - `services/config-generator.ts` - Orchestrate generation flow
71
+ - `services/markdown-chunk-loader.ts` - Load and filter markdown chunks
72
+ - `services/project-scanner.ts` - Detect language, framework, database
73
+ - `services/recommender.ts` - Suggest instruction level & architecture
74
+ - `services/ai/anthropic.ts` - Anthropic API (for future AI-assisted generation)
75
+
76
+ ### Utils (4)
77
+ - `utils/errors.ts` - Custom error classes
78
+ - `utils/file.ts` - File system operations
79
+ - `utils/logger.ts` - Logging utilities
80
+ - `utils/path.ts` - Path manipulation
81
+
82
+ ### Entry Point (1)
83
+ - `index.ts` - CLI setup with Commander.js
84
+
85
+ ## Data Flow
86
+
87
+ ```
88
+ 1. User runs: aicgen init
89
+
90
+ 2. ProjectScanner
91
+ └─> Analyzes project directory
92
+ └─> Detects language, framework, database, team size
93
+ └─> Returns ProjectFingerprint
94
+
95
+ 3. ProfileRecommender
96
+ └─> Takes ProjectFingerprint
97
+ └─> Suggests InstructionLevel (basic/standard/expert/full)
98
+ └─> Suggests ArchitectureType (modular-monolith/microservices/refactor)
99
+
100
+ 4. Interactive Wizard (if no CLI flags)
101
+ └─> Shows detected project info
102
+ └─> Shows recommendations
103
+ └─> Prompts for: Assistant, Level, Architecture
104
+ └─> Returns ProfileSelection
105
+
106
+ 5. MarkdownChunkLoader
107
+ └─> Reads chunk-mappings.yml
108
+ └─> Filters chunks by: language, level, architecture
109
+ └─> Loads matching .md files
110
+ └─> Concatenates with separators
111
+ └─> Returns assembled markdown content
112
+
113
+ 6. AssistantFileWriter
114
+ └─> Takes assembled content + assistant type
115
+ └─> Adds assistant-specific headers/footers
116
+ └─> Generates file(s) for selected assistant:
117
+ - Claude Code → claude.md
118
+ - Copilot → .github/copilot-instructions.md
119
+ - Gemini → .gemini/instructions.md
120
+ - Antigravity → .agent/rules/instructions.md
121
+ - Codex → .codex/instructions.md
122
+
123
+ 7. File Writer
124
+ └─> Creates directories
125
+ └─> Writes files atomically (temp → rename)
126
+ └─> Returns list of generated files
127
+ ```
128
+
129
+ ## Removed (Old Implementation)
130
+
131
+ The following were removed during cleanup:
132
+
133
+ ### Directories
134
+ - ❌ `scripts/` - Old prebuild scripts (not needed with runtime chunk loading)
135
+ - ❌ `src/core/` - Duplicate of src/services/
136
+ - ❌ `src/domain/` - Unused domain layer
137
+ - ❌ `src/examples/` - Demo files
138
+ - ❌ `src/config/` - Old static config
139
+ - ❌ `src/data/` - Old profile data system
140
+
141
+ ### Files
142
+ - ❌ `src/services/scanner.ts` - Duplicate of project-scanner.ts
143
+ - ❌ `src/services/generator.ts` - Old generator (replaced by config-generator.ts)
144
+ - ❌ `src/services/learner.ts` - Learning system (future feature)
145
+ - ❌ `src/services/profile-loader.ts` - Old profile system
146
+ - ❌ `src/services/template-renderer.ts` - Handlebars (switched to direct markdown)
147
+ - ❌ `src/services/prebuilt-loader.ts` - Old prebuilt system
148
+ - ❌ `src/services/chunk-assembler.ts` - Merged into markdown-chunk-loader.ts
149
+ - ❌ `src/services/prebuilt-chunk-loader.ts` - Old chunk system
150
+ - ❌ `src/models/guideline.ts` - Old guideline model
151
+ - ❌ `src/models/preference.ts` - Learning system model (future)
152
+
153
+ ## Build Process
154
+
155
+ **No prebuild step needed!** Chunks are loaded at runtime.
156
+
157
+ ```bash
158
+ # Just build the binary
159
+ bun run build:binary:windows
160
+
161
+ # Output: aicgen.exe (standalone, includes all chunks)
162
+ ```
163
+
164
+ The binary includes:
165
+ - ✅ Bun runtime
166
+ - ✅ Compiled TypeScript code
167
+ - ✅ All dependencies (chalk, ora, inquirer, yaml, etc.)
168
+ - ✅ All 53 markdown chunks from chunks/claude-code/
169
+
170
+ Total size: ~45-50 MB standalone executable.