aiknowsys 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.template.md +207 -0
- package/CODEBASE_CHANGELOG.template.md +145 -0
- package/CODEBASE_ESSENTIALS.template.md +382 -0
- package/LICENSE +21 -0
- package/README.md +714 -0
- package/bin/cli.js +81 -0
- package/lib/commands/init.js +227 -0
- package/lib/commands/install-agents.js +100 -0
- package/lib/commands/install-skills.js +92 -0
- package/lib/commands/migrate.js +161 -0
- package/lib/commands/scan.js +418 -0
- package/lib/utils.js +93 -0
- package/package.json +53 -0
- package/scripts/migrate-existing.sh +222 -0
- package/scripts/scan-codebase.sh +379 -0
- package/scripts/setup.sh +273 -0
- package/templates/agents/README.md +270 -0
- package/templates/agents/architect.agent.template.md +58 -0
- package/templates/agents/developer.agent.template.md +27 -0
- package/templates/agents/setup-agents.sh +65 -0
- package/templates/skills/code-refactoring/SKILL.md +662 -0
- package/templates/skills/dependency-updates/SKILL.md +561 -0
- package/templates/skills/documentation-management/SKILL.md +744 -0
- package/templates/skills/skill-creator/SKILL.md +252 -0
- package/templates/skills/skill-creator/template.md +89 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# Codebase Essentials - {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
**Last Updated:** {{DATE}}
|
|
4
|
+
**Purpose:** Single-source reference for architecture, patterns, and critical invariants. Read this at session start before making any changes.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🚨 CRITICAL RULE: Never Rush - Always Follow Process
|
|
9
|
+
|
|
10
|
+
**"Never rush, just fix it well and ALWAYS follow knowledge system procedures"**
|
|
11
|
+
|
|
12
|
+
**This applies to ALL changes, including:**
|
|
13
|
+
- ✅ "Quick fixes" and "little bugs"
|
|
14
|
+
- ✅ Urgent production issues
|
|
15
|
+
- ✅ Simple one-line changes
|
|
16
|
+
- ✅ Documentation updates
|
|
17
|
+
- ✅ Configuration tweaks
|
|
18
|
+
|
|
19
|
+
**Why this matters:**
|
|
20
|
+
- Quick fixes often create inconsistencies
|
|
21
|
+
- Skipping validation causes production bugs
|
|
22
|
+
- Not documenting patterns means repeating mistakes
|
|
23
|
+
- Rushing breaks the single source of truth
|
|
24
|
+
|
|
25
|
+
**The process (non-negotiable):**
|
|
26
|
+
1. Read CODEBASE_ESSENTIALS.md at session start
|
|
27
|
+
2. Check for existing patterns before implementing
|
|
28
|
+
3. Make changes + write/update tests
|
|
29
|
+
4. Run validation (see matrix below)
|
|
30
|
+
5. Update documentation if patterns changed
|
|
31
|
+
6. Commit with proper message
|
|
32
|
+
|
|
33
|
+
**Remember:** Taking 10 extra minutes to follow the process saves hours debugging later.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Document Purpose & Usage
|
|
38
|
+
|
|
39
|
+
**When to read this document:**
|
|
40
|
+
- At the start of EVERY session before making changes
|
|
41
|
+
- Before implementing new features (patterns + constraints)
|
|
42
|
+
- When debugging issues (gotchas + known quirks)
|
|
43
|
+
- Before updating dependencies (stack snapshot)
|
|
44
|
+
|
|
45
|
+
**Related documentation:**
|
|
46
|
+
- Session history: [CODEBASE_CHANGELOG.md](CODEBASE_CHANGELOG.md)
|
|
47
|
+
- AI workflow: [AGENTS.md](AGENTS.md)
|
|
48
|
+
- Skills: [.github/skills/](.github/skills/)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Technology Stack
|
|
53
|
+
|
|
54
|
+
**{{STACK_CATEGORY}}:**
|
|
55
|
+
- **Framework:** {{FRAMEWORK}}
|
|
56
|
+
- **Version:** {{VERSION}}
|
|
57
|
+
- **Language:** {{LANGUAGE}}
|
|
58
|
+
- **Build Tool:** {{BUILD_TOOL}}
|
|
59
|
+
- **Package Manager:** {{PACKAGE_MANAGER}}
|
|
60
|
+
|
|
61
|
+
**Testing:**
|
|
62
|
+
- **Framework:** {{TEST_FRAMEWORK}}
|
|
63
|
+
- **Coverage Tool:** {{COVERAGE_TOOL}}
|
|
64
|
+
- **Linting:** {{LINTER}}
|
|
65
|
+
|
|
66
|
+
**Infrastructure:**
|
|
67
|
+
- **Containerization:** {{CONTAINER_PLATFORM}}
|
|
68
|
+
- **Database:** {{DATABASE}}
|
|
69
|
+
- **Deployment:** {{DEPLOYMENT_PLATFORM}}
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Validation Matrix
|
|
74
|
+
|
|
75
|
+
**Run these commands before claiming work is complete:**
|
|
76
|
+
|
|
77
|
+
| Changed | Command | Required |
|
|
78
|
+
|---------|---------|----------|
|
|
79
|
+
{{VALIDATION_ROWS}}
|
|
80
|
+
|
|
81
|
+
**🚨 RULE: Never claim work is complete without running validation!**
|
|
82
|
+
|
|
83
|
+
**Example validation commands:**
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Backend (Python example)
|
|
87
|
+
{{BACKEND_TEST_CMD}}
|
|
88
|
+
|
|
89
|
+
# Frontend (TypeScript example)
|
|
90
|
+
{{FRONTEND_TEST_CMD}}
|
|
91
|
+
|
|
92
|
+
# Type checking
|
|
93
|
+
{{TYPE_CHECK_CMD}}
|
|
94
|
+
|
|
95
|
+
# Linting
|
|
96
|
+
{{LINT_CMD}}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Expected output:**
|
|
100
|
+
- ✅ "X passed, Y skipped" with no failures
|
|
101
|
+
- ✅ No TypeScript errors (empty output = success)
|
|
102
|
+
- ✅ No linting errors
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Project Structure
|
|
107
|
+
|
|
108
|
+
**{{PROJECT_TYPE}} structure:**
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
{{PROJECT_ROOT}}/
|
|
112
|
+
├── {{BACKEND_DIR}}/ # {{BACKEND_DESCRIPTION}}
|
|
113
|
+
├── {{FRONTEND_DIR}}/ # {{FRONTEND_DESCRIPTION}}
|
|
114
|
+
├── {{TEST_DIR}}/ # {{TEST_DESCRIPTION}}
|
|
115
|
+
└── {{CONFIG_DIR}}/ # {{CONFIG_DESCRIPTION}}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Key directories:**
|
|
119
|
+
- `{{SOURCE_DIR}}` - {{SOURCE_DESCRIPTION}}
|
|
120
|
+
- `{{TEST_DIR}}` - {{TEST_DESCRIPTION}}
|
|
121
|
+
- `{{BUILD_DIR}}` - {{BUILD_DESCRIPTION}}
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Core Patterns
|
|
126
|
+
|
|
127
|
+
### {{PATTERN_CATEGORY_1}}
|
|
128
|
+
|
|
129
|
+
**Pattern:** {{PATTERN_DESCRIPTION}}
|
|
130
|
+
|
|
131
|
+
**Why:** {{PATTERN_RATIONALE}}
|
|
132
|
+
|
|
133
|
+
**Example:**
|
|
134
|
+
```{{LANGUAGE}}
|
|
135
|
+
{{PATTERN_EXAMPLE}}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Anti-pattern:**
|
|
139
|
+
```{{LANGUAGE}}
|
|
140
|
+
{{ANTI_PATTERN_EXAMPLE}}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### {{PATTERN_CATEGORY_2}}
|
|
146
|
+
|
|
147
|
+
**Pattern:** {{PATTERN_DESCRIPTION_2}}
|
|
148
|
+
|
|
149
|
+
**Why:** {{PATTERN_RATIONALE_2}}
|
|
150
|
+
|
|
151
|
+
**Example:**
|
|
152
|
+
```{{LANGUAGE}}
|
|
153
|
+
{{PATTERN_EXAMPLE_2}}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Critical Invariants
|
|
159
|
+
|
|
160
|
+
**Rules that must NEVER be violated:**
|
|
161
|
+
|
|
162
|
+
1. **{{INVARIANT_1}}**
|
|
163
|
+
- What: {{INVARIANT_1_DESCRIPTION}}
|
|
164
|
+
- Why: {{INVARIANT_1_RATIONALE}}
|
|
165
|
+
- Example: {{INVARIANT_1_EXAMPLE}}
|
|
166
|
+
|
|
167
|
+
2. **{{INVARIANT_2}}**
|
|
168
|
+
- What: {{INVARIANT_2_DESCRIPTION}}
|
|
169
|
+
- Why: {{INVARIANT_2_RATIONALE}}
|
|
170
|
+
- Example: {{INVARIANT_2_EXAMPLE}}
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Common Gotchas
|
|
175
|
+
|
|
176
|
+
### {{GOTCHA_1}}
|
|
177
|
+
|
|
178
|
+
**Problem:** {{GOTCHA_1_DESCRIPTION}}
|
|
179
|
+
|
|
180
|
+
**Solution:** {{GOTCHA_1_SOLUTION}}
|
|
181
|
+
|
|
182
|
+
**Example:**
|
|
183
|
+
```{{LANGUAGE}}
|
|
184
|
+
{{GOTCHA_1_EXAMPLE}}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### {{GOTCHA_2}}
|
|
190
|
+
|
|
191
|
+
**Problem:** {{GOTCHA_2_DESCRIPTION}}
|
|
192
|
+
|
|
193
|
+
**Solution:** {{GOTCHA_2_SOLUTION}}
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Architecture Decisions
|
|
198
|
+
|
|
199
|
+
### {{DECISION_1}}
|
|
200
|
+
|
|
201
|
+
**Decision:** {{DECISION_1_WHAT}}
|
|
202
|
+
|
|
203
|
+
**Rationale:** {{DECISION_1_WHY}}
|
|
204
|
+
|
|
205
|
+
**Trade-offs:**
|
|
206
|
+
- ✅ {{DECISION_1_PRO}}
|
|
207
|
+
- ⚠️ {{DECISION_1_CON}}
|
|
208
|
+
|
|
209
|
+
**Alternatives considered:** {{DECISION_1_ALTERNATIVES}}
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Change Management (OpenSpec)
|
|
214
|
+
|
|
215
|
+
**Recommended:** Use OpenSpec for spec-driven development on major changes.
|
|
216
|
+
|
|
217
|
+
### When to Create OpenSpec Proposals:
|
|
218
|
+
|
|
219
|
+
| Change Type | Create Proposal? |
|
|
220
|
+
|-------------|------------------|
|
|
221
|
+
| New features or capabilities | ✅ Yes |
|
|
222
|
+
| Breaking changes (API, schema) | ✅ Yes |
|
|
223
|
+
| Architecture changes | ✅ Yes |
|
|
224
|
+
| Security-related changes | ✅ Yes |
|
|
225
|
+
| Bug fixes, typos, formatting | ❌ No |
|
|
226
|
+
| Non-breaking dependency updates | ❌ No |
|
|
227
|
+
| Configuration changes | ❌ No |
|
|
228
|
+
|
|
229
|
+
### OpenSpec Commands:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
openspec list # List active changes
|
|
233
|
+
openspec list --specs # List specifications
|
|
234
|
+
openspec create add-X # Create new proposal
|
|
235
|
+
openspec validate --strict # Validate all specs
|
|
236
|
+
openspec archive X --yes # Archive after deployment
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### OpenSpec Workflow:
|
|
240
|
+
|
|
241
|
+
1. **Create proposal:** `openspec create add-feature-name`
|
|
242
|
+
2. **Fill out:** `proposal.md`, `tasks.md`, spec deltas
|
|
243
|
+
3. **Validate:** `openspec validate add-feature-name --strict`
|
|
244
|
+
4. **Get approval** before implementing
|
|
245
|
+
5. **Implement** following tasks.md checklist
|
|
246
|
+
6. **Archive** after deployment
|
|
247
|
+
|
|
248
|
+
**See:** `openspec/AGENTS.md` for full workflow (if OpenSpec is installed)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Development Workflow
|
|
253
|
+
|
|
254
|
+
### Setting Up Local Environment
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
{{SETUP_COMMANDS}}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Running Tests
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
{{TEST_COMMANDS}}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Building for Production
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
{{BUILD_COMMANDS}}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Deployment
|
|
273
|
+
|
|
274
|
+
{{DEPLOYMENT_WORKFLOW}}
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Dependencies Management
|
|
279
|
+
|
|
280
|
+
**Update strategy:** {{UPDATE_STRATEGY}}
|
|
281
|
+
|
|
282
|
+
**Security:** {{SECURITY_POLICY}}
|
|
283
|
+
|
|
284
|
+
**Deprecated dependencies:** {{DEPRECATED_DEPS}}
|
|
285
|
+
|
|
286
|
+
**See also:** [dependency-updates skill](.github/skills/dependency-updates/SKILL.md)
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Testing Guidelines
|
|
291
|
+
|
|
292
|
+
### Test Organization
|
|
293
|
+
|
|
294
|
+
{{TEST_ORGANIZATION}}
|
|
295
|
+
|
|
296
|
+
### Coverage Requirements
|
|
297
|
+
|
|
298
|
+
{{COVERAGE_REQUIREMENTS}}
|
|
299
|
+
|
|
300
|
+
### Testing Patterns
|
|
301
|
+
|
|
302
|
+
**Unit tests:**
|
|
303
|
+
```{{LANGUAGE}}
|
|
304
|
+
{{UNIT_TEST_EXAMPLE}}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Integration tests:**
|
|
308
|
+
```{{LANGUAGE}}
|
|
309
|
+
{{INTEGRATION_TEST_EXAMPLE}}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Security Considerations
|
|
315
|
+
|
|
316
|
+
{{SECURITY_CONSIDERATIONS}}
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Performance Guidelines
|
|
321
|
+
|
|
322
|
+
{{PERFORMANCE_GUIDELINES}}
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Accessibility Standards
|
|
327
|
+
|
|
328
|
+
{{ACCESSIBILITY_STANDARDS}}
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Documentation Standards
|
|
333
|
+
|
|
334
|
+
**Code comments:**
|
|
335
|
+
{{COMMENT_STANDARDS}}
|
|
336
|
+
|
|
337
|
+
**README updates:**
|
|
338
|
+
{{README_STANDARDS}}
|
|
339
|
+
|
|
340
|
+
**API documentation:**
|
|
341
|
+
{{API_DOC_STANDARDS}}
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Version Control
|
|
346
|
+
|
|
347
|
+
**Branch strategy:** {{BRANCH_STRATEGY}}
|
|
348
|
+
|
|
349
|
+
**Commit message format:** {{COMMIT_FORMAT}}
|
|
350
|
+
|
|
351
|
+
**PR requirements:** {{PR_REQUIREMENTS}}
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## 📝 Customization Instructions
|
|
356
|
+
|
|
357
|
+
**This is a template file. To use it:**
|
|
358
|
+
|
|
359
|
+
1. **Replace all {{PLACEHOLDERS}}** with your actual values
|
|
360
|
+
2. **Remove sections** that don't apply to your project
|
|
361
|
+
3. **Add sections** for your specific patterns
|
|
362
|
+
4. **Fill in examples** with real code from your project
|
|
363
|
+
5. **Update regularly** as patterns evolve
|
|
364
|
+
|
|
365
|
+
**Common placeholders:**
|
|
366
|
+
- `{{PROJECT_NAME}}` - Your project name
|
|
367
|
+
- `{{DATE}}` - Current date
|
|
368
|
+
- `{{FRAMEWORK}}` - Framework name and version
|
|
369
|
+
- `{{LANGUAGE}}` - Programming language
|
|
370
|
+
- `{{*_CMD}}` - Actual commands to run
|
|
371
|
+
- `{{*_DESCRIPTION}}` - Your explanations
|
|
372
|
+
- `{{*_EXAMPLE}}` - Real code examples
|
|
373
|
+
|
|
374
|
+
**After customization:**
|
|
375
|
+
1. Rename to `CODEBASE_ESSENTIALS.md`
|
|
376
|
+
2. Commit to repository
|
|
377
|
+
3. Reference in AGENTS.md
|
|
378
|
+
4. Update as patterns change
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
*This template is part of the Knowledge System Template. See [README](README.md) for full documentation.*
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Knowledge System Template Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|