aiknowsys 0.0.1 → 0.0.3
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/README.md +43 -0
- package/bin/cli.js +1 -1
- package/lib/commands/init.js +377 -95
- package/lib/commands/migrate.js +14 -2
- package/lib/commands/scan.js +12 -2
- package/lib/utils.js +18 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -72,6 +72,44 @@ aiknowsys init
|
|
|
72
72
|
| `npx aiknowsys install-agents` | Install Developer + Architect agents |
|
|
73
73
|
| `npx aiknowsys install-skills` | Install universal skills |
|
|
74
74
|
|
|
75
|
+
**💡 AI-Assisted Completion:** After running any command, you'll receive a ready-to-copy prompt that you can paste to your AI assistant (Claude, GPT-4, etc.) to automatically complete the TODO sections based on your actual codebase. No more manual documentation work!
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## AI Tool Compatibility
|
|
80
|
+
|
|
81
|
+
### ✅ Works with ANY AI Tool
|
|
82
|
+
|
|
83
|
+
These components work with **all AI assistants** (Claude Desktop, ChatGPT, Cursor, Gemini CLI, etc.):
|
|
84
|
+
|
|
85
|
+
- **`CODEBASE_ESSENTIALS.md`** - Reference this file manually: `@CODEBASE_ESSENTIALS.md`
|
|
86
|
+
- **`AGENTS.md`** - Copy/paste workflow instructions to any AI
|
|
87
|
+
- **`CODEBASE_CHANGELOG.md`** - Historical context for any AI
|
|
88
|
+
- **`.github/skills/`** - Read skills with: `@.github/skills/feature-implementation/SKILL.md`
|
|
89
|
+
|
|
90
|
+
You can use the core knowledge system with any AI tool by manually referencing these files.
|
|
91
|
+
|
|
92
|
+
### 🎯 GitHub Copilot-Specific Features
|
|
93
|
+
|
|
94
|
+
These features **only work in VS Code with GitHub Copilot Chat**:
|
|
95
|
+
|
|
96
|
+
- **Custom Agents** (`@Developer`, `@SeniorArchitect`) - Automatic agent triggering
|
|
97
|
+
- **Auto-handoff workflow** - Developer → Architect review pipeline
|
|
98
|
+
- **`.github/agents/`** directory - Auto-loaded by Copilot's Agent Skills feature
|
|
99
|
+
|
|
100
|
+
**Without Copilot:** You can still follow the Developer → Architect workflow by manually copying prompts to your AI tool. The automation just won't be automatic.
|
|
101
|
+
|
|
102
|
+
### 🔮 Roadmap: Multi-Tool Support
|
|
103
|
+
|
|
104
|
+
**Planned for near future:**
|
|
105
|
+
- **Claude Desktop MCP Server** - Native agent support for Claude Desktop
|
|
106
|
+
- **Cursor integration** - Custom agent support
|
|
107
|
+
- **Universal agent format** - Tool-agnostic agent definitions
|
|
108
|
+
|
|
109
|
+
Stay tuned for updates!
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
75
113
|
### Alternative: Manual Setup
|
|
76
114
|
|
|
77
115
|
<details>
|
|
@@ -141,6 +179,8 @@ cp -r temp-template/templates ./
|
|
|
141
179
|
|
|
142
180
|
**Purpose:** Automated quality gate enforcing documented patterns.
|
|
143
181
|
|
|
182
|
+
**Platform:** GitHub Copilot in VS Code (other AI tools: see [AI Tool Compatibility](#ai-tool-compatibility))
|
|
183
|
+
|
|
144
184
|
**Workflow:**
|
|
145
185
|
```
|
|
146
186
|
User → @Developer → Implements feature → Auto-handoff → @SeniorArchitect → Reviews against ESSENTIALS → ✅ Approve or 🔄 Refactor
|
|
@@ -639,6 +679,9 @@ A: Create separate validation commands per language. Example: `pytest` for Pytho
|
|
|
639
679
|
**Q: Can I use this without AI assistants?**
|
|
640
680
|
A: Yes! The documentation and workflow benefit human developers too. Think of it as "docs that AI can also read."
|
|
641
681
|
|
|
682
|
+
**Q: Does this only work with GitHub Copilot?**
|
|
683
|
+
A: No! Core knowledge files (CODEBASE_ESSENTIALS.md, skills) work with any AI tool. The custom agents (`@Developer`, `@SeniorArchitect`) require GitHub Copilot in VS Code, but you can manually follow the same workflow with Claude Desktop, ChatGPT, Cursor, or any AI assistant. See [AI Tool Compatibility](#ai-tool-compatibility) for details.
|
|
684
|
+
|
|
642
685
|
**Q: How do I update the system as my project evolves?**
|
|
643
686
|
A: Update CODEBASE_ESSENTIALS.md when patterns change. Agents automatically enforce the updated patterns. Add changelog entry documenting the evolution.
|
|
644
687
|
|
package/bin/cli.js
CHANGED
|
@@ -34,7 +34,7 @@ program
|
|
|
34
34
|
|
|
35
35
|
program
|
|
36
36
|
.command('init')
|
|
37
|
-
.description('Initialize knowledge system
|
|
37
|
+
.description('Initialize knowledge system with AI-assisted setup')
|
|
38
38
|
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
39
39
|
.option('-y, --yes', 'Skip prompts and use defaults')
|
|
40
40
|
.action(init);
|
package/lib/commands/init.js
CHANGED
|
@@ -4,7 +4,278 @@ import { execSync } from 'child_process';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import ora from 'ora';
|
|
7
|
-
import { getPackageDir, copyTemplate, hasExistingProject } from '../utils.js';
|
|
7
|
+
import { getPackageDir, copyTemplate, hasExistingProject, displayAIPrompt } from '../utils.js';
|
|
8
|
+
|
|
9
|
+
// Helper functions for prompt logic (KISS principle)
|
|
10
|
+
async function getBasicProjectInfo(targetDir) {
|
|
11
|
+
return inquirer.prompt([
|
|
12
|
+
{
|
|
13
|
+
type: 'input',
|
|
14
|
+
name: 'projectName',
|
|
15
|
+
message: '📦 Project name:',
|
|
16
|
+
default: path.basename(targetDir),
|
|
17
|
+
validate: (input) => input.trim().length > 0 || 'Project name is required'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'input',
|
|
21
|
+
name: 'projectDescription',
|
|
22
|
+
message: '📝 Brief description (what does this project do?):',
|
|
23
|
+
default: ''
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'list',
|
|
27
|
+
name: 'projectType',
|
|
28
|
+
message: '🎯 What type of project are you building?',
|
|
29
|
+
choices: [
|
|
30
|
+
{ name: '🌐 Web Application (frontend + backend)', value: 'web-app' },
|
|
31
|
+
{ name: '🎨 Frontend Only (SPA, static site)', value: 'frontend' },
|
|
32
|
+
{ name: '⚙️ Backend API/Service', value: 'backend' },
|
|
33
|
+
{ name: '📦 Library/Package', value: 'library' },
|
|
34
|
+
{ name: '🔧 CLI Tool', value: 'cli' },
|
|
35
|
+
{ name: '🤖 Other', value: 'other' }
|
|
36
|
+
],
|
|
37
|
+
default: 'web-app'
|
|
38
|
+
}
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getTechStack(basicInfo) {
|
|
43
|
+
const prompts = [
|
|
44
|
+
{
|
|
45
|
+
type: 'list',
|
|
46
|
+
name: 'language',
|
|
47
|
+
message: '💻 Primary programming language:',
|
|
48
|
+
choices: [
|
|
49
|
+
{ name: 'TypeScript/JavaScript', value: 'typescript' },
|
|
50
|
+
{ name: 'Python', value: 'python' },
|
|
51
|
+
{ name: 'Rust', value: 'rust' },
|
|
52
|
+
{ name: 'Go', value: 'go' },
|
|
53
|
+
{ name: 'Java/Kotlin', value: 'java' },
|
|
54
|
+
{ name: 'C#/.NET', value: 'csharp' },
|
|
55
|
+
{ name: 'Other', value: 'other' }
|
|
56
|
+
],
|
|
57
|
+
default: 'typescript'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'input',
|
|
61
|
+
name: 'customLanguage',
|
|
62
|
+
message: 'Enter language name:',
|
|
63
|
+
when: (ans) => ans.language === 'other'
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const needsFrontendFramework = basicInfo.projectType === 'web-app' || basicInfo.projectType === 'frontend';
|
|
68
|
+
const needsBackendFramework = basicInfo.projectType === 'web-app' || basicInfo.projectType === 'backend';
|
|
69
|
+
|
|
70
|
+
if (needsFrontendFramework) {
|
|
71
|
+
prompts.push({
|
|
72
|
+
type: 'list',
|
|
73
|
+
name: 'framework',
|
|
74
|
+
message: '🎨 Frontend framework:',
|
|
75
|
+
when: (ans) => ans.language === 'typescript',
|
|
76
|
+
choices: [
|
|
77
|
+
{ name: 'Vue 3', value: 'vue' },
|
|
78
|
+
{ name: 'React', value: 'react' },
|
|
79
|
+
{ name: 'Next.js (React)', value: 'nextjs' },
|
|
80
|
+
{ name: 'Svelte/SvelteKit', value: 'svelte' },
|
|
81
|
+
{ name: 'Angular', value: 'angular' },
|
|
82
|
+
{ name: 'Solid.js', value: 'solid' },
|
|
83
|
+
{ name: 'Vanilla JS/HTML', value: 'vanilla' },
|
|
84
|
+
{ name: 'Other', value: 'other' }
|
|
85
|
+
],
|
|
86
|
+
default: 'vue'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (needsBackendFramework) {
|
|
91
|
+
prompts.push(
|
|
92
|
+
{
|
|
93
|
+
type: 'list',
|
|
94
|
+
name: 'framework',
|
|
95
|
+
message: '⚙️ Backend framework:',
|
|
96
|
+
when: (ans) => ans.language === 'python',
|
|
97
|
+
choices: [
|
|
98
|
+
{ name: 'Django', value: 'django' },
|
|
99
|
+
{ name: 'FastAPI', value: 'fastapi' },
|
|
100
|
+
{ name: 'Flask', value: 'flask' },
|
|
101
|
+
{ name: 'Other', value: 'other' }
|
|
102
|
+
],
|
|
103
|
+
default: 'fastapi'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: 'list',
|
|
107
|
+
name: 'framework',
|
|
108
|
+
message: '⚙️ Backend framework:',
|
|
109
|
+
when: (ans) => ans.language === 'typescript',
|
|
110
|
+
choices: [
|
|
111
|
+
{ name: 'Express.js', value: 'express' },
|
|
112
|
+
{ name: 'Fastify', value: 'fastify' },
|
|
113
|
+
{ name: 'NestJS', value: 'nestjs' },
|
|
114
|
+
{ name: 'Hono', value: 'hono' },
|
|
115
|
+
{ name: 'Other', value: 'other' }
|
|
116
|
+
],
|
|
117
|
+
default: 'express'
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return inquirer.prompt(prompts);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function getWorkflowPreferences() {
|
|
126
|
+
return inquirer.prompt([
|
|
127
|
+
{
|
|
128
|
+
type: 'confirm',
|
|
129
|
+
name: 'isTeamProject',
|
|
130
|
+
message: '👥 Is this a team project (multiple developers)?',
|
|
131
|
+
default: false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'confirm',
|
|
135
|
+
name: 'useOpenSpec',
|
|
136
|
+
message: '📋 Use OpenSpec for spec-driven development?',
|
|
137
|
+
when: (ans) => ans.isTeamProject,
|
|
138
|
+
default: true
|
|
139
|
+
}
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function displayProjectSummary(answers) {
|
|
144
|
+
console.log('');
|
|
145
|
+
console.log(chalk.cyan.bold('📋 Summary:'));
|
|
146
|
+
console.log(chalk.white(` Project: ${answers.projectName}`));
|
|
147
|
+
if (answers.projectDescription) {
|
|
148
|
+
console.log(chalk.gray(` Description: ${answers.projectDescription}`));
|
|
149
|
+
}
|
|
150
|
+
console.log(chalk.white(` Type: ${getProjectTypeName(answers.projectType)}`));
|
|
151
|
+
console.log(chalk.white(` Language: ${getLanguageName(answers.customLanguage || answers.language)}`));
|
|
152
|
+
if (answers.framework) {
|
|
153
|
+
console.log(chalk.white(` Framework: ${getFrameworkName(answers.framework)}`));
|
|
154
|
+
}
|
|
155
|
+
if (answers.useOpenSpec) {
|
|
156
|
+
console.log(chalk.white(` Workflow: Spec-driven (OpenSpec)`));
|
|
157
|
+
}
|
|
158
|
+
console.log('');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function displayAIAssistedInstructions() {
|
|
162
|
+
console.log('');
|
|
163
|
+
console.log(chalk.cyan.bold('🚀 AI-Assisted Setup (Recommended)'));
|
|
164
|
+
console.log('');
|
|
165
|
+
console.log(chalk.white('Perfect! Let\'s use your AI assistant to complete the setup.'));
|
|
166
|
+
console.log('');
|
|
167
|
+
console.log(chalk.yellow.bold('👉 COPY AND PASTE THIS PROMPT TO YOUR AI ASSISTANT:'));
|
|
168
|
+
console.log(chalk.gray(' (GitHub Copilot Chat, Claude, ChatGPT, etc.)'));
|
|
169
|
+
console.log('');
|
|
170
|
+
|
|
171
|
+
displayAIPrompt(chalk, [
|
|
172
|
+
'"I just initialized aiknowsys in my project. Please help me complete',
|
|
173
|
+
'the TODO sections in CODEBASE_ESSENTIALS.md and AGENTS.md based on my',
|
|
174
|
+
'codebase. Read those files, scan my project structure, and fill in:',
|
|
175
|
+
'',
|
|
176
|
+
'1. Technology Snapshot - detect all frameworks/tools',
|
|
177
|
+
'2. Validation Matrix - add appropriate test/lint/build commands',
|
|
178
|
+
'3. Core Patterns - identify common patterns in my code',
|
|
179
|
+
'4. Architecture Decisions - document key choices',
|
|
180
|
+
'',
|
|
181
|
+
'Make the documentation specific to MY project, not generic."'
|
|
182
|
+
]);
|
|
183
|
+
|
|
184
|
+
console.log('');
|
|
185
|
+
console.log(chalk.cyan('💡 What happens next:'));
|
|
186
|
+
console.log(chalk.white(' 1. Your AI will read the generated files'));
|
|
187
|
+
console.log(chalk.white(' 2. It will scan your project structure'));
|
|
188
|
+
console.log(chalk.white(' 3. It will complete all TODO sections automatically'));
|
|
189
|
+
console.log(chalk.white(' 4. Review and approve the changes'));
|
|
190
|
+
console.log('');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function displayManualSetupInstructions() {
|
|
194
|
+
console.log('');
|
|
195
|
+
console.log(chalk.cyan.bold('📖 Manual Setup'));
|
|
196
|
+
console.log('');
|
|
197
|
+
console.log(chalk.white('No problem! Complete these steps manually:'));
|
|
198
|
+
console.log('');
|
|
199
|
+
console.log(chalk.white(' 1. Open CODEBASE_ESSENTIALS.md'));
|
|
200
|
+
console.log(chalk.white(' 2. Fill in TODO sections:'));
|
|
201
|
+
console.log(chalk.gray(' • Technology Snapshot'));
|
|
202
|
+
console.log(chalk.gray(' • Validation Matrix'));
|
|
203
|
+
console.log(chalk.gray(' • Core Patterns'));
|
|
204
|
+
console.log(chalk.gray(' • Architecture Decisions'));
|
|
205
|
+
console.log('');
|
|
206
|
+
console.log(chalk.white(' 3. Customize AGENTS.md validation matrix'));
|
|
207
|
+
console.log('');
|
|
208
|
+
console.log(chalk.yellow('💡 Tip: You can still use AI later with @Developer'));
|
|
209
|
+
console.log('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function displayQuickAIPrompt() {
|
|
213
|
+
console.log(chalk.cyan('📖 Next step:'));
|
|
214
|
+
console.log(chalk.white(' Use AI to complete TODO sections in CODEBASE_ESSENTIALS.md'));
|
|
215
|
+
console.log('');
|
|
216
|
+
|
|
217
|
+
displayAIPrompt(chalk, [
|
|
218
|
+
'"Complete TODO sections in CODEBASE_ESSENTIALS.md and AGENTS.md',
|
|
219
|
+
'based on my project structure."'
|
|
220
|
+
]);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async function setupOpenSpec(targetDir) {
|
|
224
|
+
const openSpecSpinner = ora('Setting up OpenSpec...').start();
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
// Check if openspec is already installed globally
|
|
228
|
+
let openspecInstalled = false;
|
|
229
|
+
try {
|
|
230
|
+
execSync('openspec --version', { stdio: 'pipe' });
|
|
231
|
+
openspecInstalled = true;
|
|
232
|
+
} catch {
|
|
233
|
+
// Not installed
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!openspecInstalled) {
|
|
237
|
+
openSpecSpinner.text = 'Installing OpenSpec globally (requires npm permissions)...';
|
|
238
|
+
try {
|
|
239
|
+
execSync('npm install -g openspec', { stdio: 'inherit' });
|
|
240
|
+
openspecInstalled = true;
|
|
241
|
+
} catch {
|
|
242
|
+
// Installation failed - show instructions and exit gracefully
|
|
243
|
+
openSpecSpinner.warn('Global install failed (may need sudo/admin permissions)');
|
|
244
|
+
console.log('');
|
|
245
|
+
console.log(chalk.yellow('💡 To install OpenSpec manually:'));
|
|
246
|
+
console.log(chalk.white(' sudo npm install -g openspec'));
|
|
247
|
+
console.log(chalk.white(' # or'));
|
|
248
|
+
console.log(chalk.white(' npx openspec init'));
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (openspecInstalled) {
|
|
254
|
+
openSpecSpinner.text = 'Initializing OpenSpec in your project...';
|
|
255
|
+
execSync('openspec init', { stdio: 'pipe', cwd: targetDir });
|
|
256
|
+
openSpecSpinner.succeed('OpenSpec installed and initialized');
|
|
257
|
+
|
|
258
|
+
console.log(chalk.gray(' • openspec/project.md'));
|
|
259
|
+
console.log(chalk.gray(' • openspec/AGENTS.md'));
|
|
260
|
+
console.log('');
|
|
261
|
+
console.log(chalk.cyan('📖 OpenSpec Tips:'));
|
|
262
|
+
console.log(chalk.white(' • Create specs: openspec create <feature-name>'));
|
|
263
|
+
console.log(chalk.white(' • Get approval before coding to align the team'));
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
} catch (error) {
|
|
267
|
+
openSpecSpinner.fail('OpenSpec initialization failed');
|
|
268
|
+
console.log('');
|
|
269
|
+
console.log(chalk.yellow('⚠️ OpenSpec setup encountered an issue:'));
|
|
270
|
+
console.log(chalk.gray(` ${error.message.split('\n')[0]}`));
|
|
271
|
+
console.log('');
|
|
272
|
+
console.log(chalk.white('You can set it up later with:'));
|
|
273
|
+
console.log(chalk.gray(' npm install -g openspec && openspec init'));
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
8
279
|
|
|
9
280
|
export async function init(options) {
|
|
10
281
|
const targetDir = path.resolve(options.dir);
|
|
@@ -36,68 +307,55 @@ export async function init(options) {
|
|
|
36
307
|
}
|
|
37
308
|
}
|
|
38
309
|
|
|
39
|
-
console.log(chalk.blue('📝
|
|
310
|
+
console.log(chalk.blue('📝 Let\'s set up your project documentation!'));
|
|
311
|
+
console.log('');
|
|
312
|
+
console.log(chalk.gray('I\'ll ask a few questions to customize the knowledge system for your project.'));
|
|
313
|
+
console.log(chalk.gray('This helps AI assistants understand your codebase better.'));
|
|
40
314
|
console.log('');
|
|
41
315
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
type: 'list',
|
|
78
|
-
name: 'framework',
|
|
79
|
-
message: 'Backend framework?',
|
|
80
|
-
when: (ans) => ans.language === 'python',
|
|
81
|
-
choices: [
|
|
82
|
-
{ name: 'Django', value: 'django' },
|
|
83
|
-
{ name: 'FastAPI', value: 'fastapi' },
|
|
84
|
-
{ name: 'Flask', value: 'flask' },
|
|
85
|
-
{ name: 'Other', value: 'other' }
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'input',
|
|
90
|
-
name: 'projectName',
|
|
91
|
-
message: 'Project name:',
|
|
92
|
-
default: path.basename(targetDir)
|
|
93
|
-
},
|
|
94
|
-
{
|
|
316
|
+
// Use defaults if --yes flag is provided
|
|
317
|
+
let answers;
|
|
318
|
+
if (options.yes) {
|
|
319
|
+
answers = {
|
|
320
|
+
projectType: 'web-app',
|
|
321
|
+
language: 'typescript',
|
|
322
|
+
framework: 'vue',
|
|
323
|
+
projectName: path.basename(targetDir),
|
|
324
|
+
projectDescription: '',
|
|
325
|
+
useOpenSpec: false
|
|
326
|
+
};
|
|
327
|
+
console.log(chalk.gray('Using defaults (--yes flag):'));
|
|
328
|
+
console.log(chalk.gray(` Project: ${answers.projectName}`));
|
|
329
|
+
console.log(chalk.gray(` Type: Web Application`));
|
|
330
|
+
console.log(chalk.gray(` Stack: TypeScript + Vue`));
|
|
331
|
+
console.log('');
|
|
332
|
+
} else {
|
|
333
|
+
// Step 1: Project Info
|
|
334
|
+
const basicInfo = await getBasicProjectInfo(targetDir);
|
|
335
|
+
|
|
336
|
+
// Step 2: Technology Stack
|
|
337
|
+
const techStack = await getTechStack(basicInfo);
|
|
338
|
+
|
|
339
|
+
// Step 3: Team & Workflow
|
|
340
|
+
const workflow = await getWorkflowPreferences();
|
|
341
|
+
|
|
342
|
+
answers = { ...basicInfo, ...techStack, ...workflow };
|
|
343
|
+
|
|
344
|
+
// Show summary
|
|
345
|
+
displayProjectSummary(answers);
|
|
346
|
+
|
|
347
|
+
const { confirm } = await inquirer.prompt([{
|
|
95
348
|
type: 'confirm',
|
|
96
|
-
name: '
|
|
97
|
-
message: '
|
|
98
|
-
default:
|
|
349
|
+
name: 'confirm',
|
|
350
|
+
message: 'Looks good?',
|
|
351
|
+
default: true
|
|
352
|
+
}]);
|
|
353
|
+
|
|
354
|
+
if (!confirm) {
|
|
355
|
+
console.log(chalk.yellow('Setup cancelled. Run the command again to start over.'));
|
|
356
|
+
return;
|
|
99
357
|
}
|
|
100
|
-
|
|
358
|
+
}
|
|
101
359
|
|
|
102
360
|
const spinner = ora('Creating knowledge system files...').start();
|
|
103
361
|
|
|
@@ -115,9 +373,21 @@ export async function init(options) {
|
|
|
115
373
|
path.join(targetDir, 'CODEBASE_ESSENTIALS.md'),
|
|
116
374
|
{
|
|
117
375
|
'{{PROJECT_NAME}}': answers.projectName,
|
|
376
|
+
'{{PROJECT_TYPE}}': getProjectTypeName(answers.projectType || 'web-app'),
|
|
118
377
|
'{{LANGUAGE}}': answers.customLanguage || getLanguageName(answers.language),
|
|
119
378
|
'{{FRAMEWORK}}': getFrameworkName(answers.framework),
|
|
120
|
-
'{{DATE}}': new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })
|
|
379
|
+
'{{DATE}}': new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }),
|
|
380
|
+
'{{STACK_CATEGORY}}': answers.projectType === 'backend' ? 'Backend Stack' : (answers.projectType === 'frontend' ? 'Frontend Stack' : 'Full Stack'),
|
|
381
|
+
'{{VERSION}}': 'TBD',
|
|
382
|
+
'{{BUILD_TOOL}}': 'TBD',
|
|
383
|
+
'{{PACKAGE_MANAGER}}': 'TBD',
|
|
384
|
+
'{{TEST_FRAMEWORK}}': 'TBD',
|
|
385
|
+
'{{COVERAGE_TOOL}}': 'TBD',
|
|
386
|
+
'{{LINTER}}': 'TBD',
|
|
387
|
+
'{{CONTAINER_PLATFORM}}': 'TBD',
|
|
388
|
+
'{{DATABASE}}': 'TBD',
|
|
389
|
+
'{{DEPLOYMENT_PLATFORM}}': 'TBD',
|
|
390
|
+
'{{VALIDATION_ROWS}}': '| Any file | `npm test` (or equivalent) | ✅ Before commit |'
|
|
121
391
|
}
|
|
122
392
|
);
|
|
123
393
|
|
|
@@ -153,46 +423,38 @@ export async function init(options) {
|
|
|
153
423
|
console.log(chalk.green.bold('✅ Knowledge system initialized!'));
|
|
154
424
|
console.log('');
|
|
155
425
|
console.log(chalk.white('📁 Created files:'));
|
|
156
|
-
console.log(chalk.gray(' • CODEBASE_ESSENTIALS.md'));
|
|
157
|
-
console.log(chalk.gray(' • AGENTS.md'));
|
|
426
|
+
console.log(chalk.gray(' • CODEBASE_ESSENTIALS.md (with TODO sections)'));
|
|
427
|
+
console.log(chalk.gray(' • AGENTS.md (custom Developer & Architect agents)'));
|
|
158
428
|
console.log(chalk.gray(' • CODEBASE_CHANGELOG.md'));
|
|
159
|
-
console.log(chalk.gray(' • .github/agents/
|
|
160
|
-
console.log(chalk.gray(' • .github/
|
|
161
|
-
console.log(chalk.gray(' • .github/skills/'));
|
|
429
|
+
console.log(chalk.gray(' • .github/agents/ (agent definitions)'));
|
|
430
|
+
console.log(chalk.gray(' • .github/skills/ (reusable workflows)'));
|
|
162
431
|
console.log('');
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
432
|
+
|
|
433
|
+
// AI-assisted completion (recommended)
|
|
434
|
+
if (!options.yes) {
|
|
435
|
+
const { useAI } = await inquirer.prompt([{
|
|
436
|
+
type: 'confirm',
|
|
437
|
+
name: 'useAI',
|
|
438
|
+
message: '🤖 Use AI assistant to complete the documentation now? (Recommended)',
|
|
439
|
+
default: true
|
|
440
|
+
}]);
|
|
441
|
+
|
|
442
|
+
if (useAI) {
|
|
443
|
+
displayAIAssistedInstructions();
|
|
444
|
+
} else {
|
|
445
|
+
displayManualSetupInstructions();
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
// --yes flag: Show quick AI prompt for automation
|
|
449
|
+
displayQuickAIPrompt();
|
|
450
|
+
}
|
|
167
451
|
|
|
168
452
|
// OpenSpec installation
|
|
169
453
|
if (answers.useOpenSpec) {
|
|
170
454
|
console.log('');
|
|
171
|
-
|
|
172
|
-
try {
|
|
173
|
-
// Check if openspec is already installed globally
|
|
174
|
-
try {
|
|
175
|
-
execSync('openspec --version', { stdio: 'pipe' });
|
|
176
|
-
openSpecSpinner.text = 'OpenSpec already installed, initializing...';
|
|
177
|
-
} catch {
|
|
178
|
-
// Not installed, install it
|
|
179
|
-
execSync('npm install -g openspec', { stdio: 'pipe', cwd: targetDir });
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Initialize openspec in the project
|
|
183
|
-
execSync('openspec init', { stdio: 'pipe', cwd: targetDir });
|
|
184
|
-
openSpecSpinner.succeed('OpenSpec installed and initialized');
|
|
185
|
-
|
|
186
|
-
console.log(chalk.gray(' • openspec/project.md'));
|
|
187
|
-
console.log(chalk.gray(' • openspec/AGENTS.md'));
|
|
188
|
-
} catch (error) {
|
|
189
|
-
openSpecSpinner.warn('OpenSpec installation failed (you can install manually)');
|
|
190
|
-
if (error.message) {
|
|
191
|
-
console.log(chalk.gray(` Reason: ${error.message.split('\n')[0]}`));
|
|
192
|
-
}
|
|
193
|
-
console.log(chalk.gray(' Run: npm install -g openspec && openspec init'));
|
|
194
|
-
}
|
|
455
|
+
await setupOpenSpec(targetDir);
|
|
195
456
|
}
|
|
457
|
+
|
|
196
458
|
console.log('');
|
|
197
459
|
|
|
198
460
|
} catch (error) {
|
|
@@ -202,12 +464,26 @@ export async function init(options) {
|
|
|
202
464
|
}
|
|
203
465
|
}
|
|
204
466
|
|
|
467
|
+
function getProjectTypeName(key) {
|
|
468
|
+
const names = {
|
|
469
|
+
'web-app': 'Web Application',
|
|
470
|
+
'frontend': 'Frontend Application',
|
|
471
|
+
'backend': 'Backend Service/API',
|
|
472
|
+
'library': 'Library/Package',
|
|
473
|
+
'cli': 'CLI Tool',
|
|
474
|
+
'other': 'Other'
|
|
475
|
+
};
|
|
476
|
+
return names[key] || key;
|
|
477
|
+
}
|
|
478
|
+
|
|
205
479
|
function getLanguageName(key) {
|
|
206
480
|
const names = {
|
|
207
481
|
typescript: 'TypeScript',
|
|
208
482
|
python: 'Python',
|
|
209
483
|
rust: 'Rust',
|
|
210
|
-
go: 'Go'
|
|
484
|
+
go: 'Go',
|
|
485
|
+
java: 'Java',
|
|
486
|
+
csharp: 'C#'
|
|
211
487
|
};
|
|
212
488
|
return names[key] || key;
|
|
213
489
|
}
|
|
@@ -219,9 +495,15 @@ function getFrameworkName(key) {
|
|
|
219
495
|
svelte: 'Svelte',
|
|
220
496
|
angular: 'Angular',
|
|
221
497
|
nextjs: 'Next.js',
|
|
498
|
+
solid: 'Solid.js',
|
|
499
|
+
vanilla: 'Vanilla JS',
|
|
222
500
|
django: 'Django',
|
|
223
501
|
fastapi: 'FastAPI',
|
|
224
|
-
flask: 'Flask'
|
|
502
|
+
flask: 'Flask',
|
|
503
|
+
express: 'Express.js',
|
|
504
|
+
fastify: 'Fastify',
|
|
505
|
+
nestjs: 'NestJS',
|
|
506
|
+
hono: 'Hono'
|
|
225
507
|
};
|
|
226
508
|
return names[key] || key || 'None specified';
|
|
227
509
|
}
|
package/lib/commands/migrate.js
CHANGED
|
@@ -6,7 +6,7 @@ import ora from 'ora';
|
|
|
6
6
|
import { scan } from './scan.js';
|
|
7
7
|
import { installAgents } from './install-agents.js';
|
|
8
8
|
import { installSkills } from './install-skills.js';
|
|
9
|
-
import { getPackageDir, copyTemplate } from '../utils.js';
|
|
9
|
+
import { getPackageDir, copyTemplate, displayAIPrompt } from '../utils.js';
|
|
10
10
|
|
|
11
11
|
export async function migrate(options) {
|
|
12
12
|
const targetDir = path.resolve(options.dir);
|
|
@@ -157,5 +157,17 @@ export async function migrate(options) {
|
|
|
157
157
|
console.log('');
|
|
158
158
|
console.log(chalk.cyan.bold('🚀 Start using:'));
|
|
159
159
|
console.log(chalk.white(' @Developer <your request>'));
|
|
160
|
-
|
|
160
|
+
|
|
161
|
+
displayAIPrompt(chalk, [
|
|
162
|
+
'If there are still TODO sections, copy this prompt:',
|
|
163
|
+
'',
|
|
164
|
+
'"I migrated my project to aiknowsys. Please review CODEBASE_ESSENTIALS.md',
|
|
165
|
+
'and complete any remaining TODO sections by:',
|
|
166
|
+
'1. Analyzing my actual codebase structure and patterns',
|
|
167
|
+
'2. Filling in specific validation commands (not generic examples)',
|
|
168
|
+
'3. Documenting the core patterns I actually use',
|
|
169
|
+
'4. Recording critical invariants and gotchas',
|
|
170
|
+
'5. Explaining architecture decisions',
|
|
171
|
+
'Make it project-specific, not a template!"'
|
|
172
|
+
]);
|
|
161
173
|
}
|
package/lib/commands/scan.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import ora from 'ora';
|
|
5
|
-
import { getPackageDir } from '../utils.js';
|
|
5
|
+
import { getPackageDir, displayAIPrompt } from '../utils.js';
|
|
6
6
|
|
|
7
7
|
export async function scan(options) {
|
|
8
8
|
const targetDir = path.resolve(options.dir);
|
|
@@ -202,7 +202,17 @@ export async function scan(options) {
|
|
|
202
202
|
console.log(chalk.white(` 1. Review and complete TODO sections in ${outputFile}`));
|
|
203
203
|
console.log(chalk.white(` 2. Rename to CODEBASE_ESSENTIALS.md when ready`));
|
|
204
204
|
console.log(chalk.white(` 3. Run: ${chalk.cyan('npx aiknowsys install-agents')}`));
|
|
205
|
-
|
|
205
|
+
|
|
206
|
+
displayAIPrompt(chalk, [
|
|
207
|
+
'"I just ran aiknowsys scan on my project. Please help me complete',
|
|
208
|
+
`${outputFile} by:`,
|
|
209
|
+
'1. Filling in all TODO sections with accurate project details',
|
|
210
|
+
'2. Adding missing validation commands (tests, linting, type-checking)',
|
|
211
|
+
'3. Documenting core patterns you find in my codebase',
|
|
212
|
+
'4. Identifying architecture decisions and rationale',
|
|
213
|
+
'5. Once complete, rename it to CODEBASE_ESSENTIALS.md',
|
|
214
|
+
'Then run: npx aiknowsys install-agents"'
|
|
215
|
+
]);
|
|
206
216
|
|
|
207
217
|
return findings;
|
|
208
218
|
|
package/lib/utils.js
CHANGED
|
@@ -85,6 +85,24 @@ export function copyDirectory(source, dest) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Display AI assistant completion prompt
|
|
90
|
+
* @param {Object} chalk - Chalk instance for styling
|
|
91
|
+
* @param {Array<string>} promptLines - Lines of the prompt message
|
|
92
|
+
*/
|
|
93
|
+
export function displayAIPrompt(chalk, promptLines) {
|
|
94
|
+
console.log('');
|
|
95
|
+
console.log(chalk.yellow.bold('🤖 AI Assistant Prompt:'));
|
|
96
|
+
console.log(chalk.gray(' Copy this prompt to your AI assistant to complete setup:'));
|
|
97
|
+
console.log('');
|
|
98
|
+
|
|
99
|
+
for (const line of promptLines) {
|
|
100
|
+
console.log(chalk.cyan(` ${line}`));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
console.log('');
|
|
104
|
+
}
|
|
105
|
+
|
|
88
106
|
/**
|
|
89
107
|
* Escape special regex characters
|
|
90
108
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiknowsys",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "AI-Powered Development Workflow for Consistent, High-Quality Code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
"node": ">=20.0.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"test": "node
|
|
44
|
-
"
|
|
43
|
+
"test": "node --test test/*.test.js",
|
|
44
|
+
"test:cli": "node bin/cli.js --help",
|
|
45
|
+
"prepublishOnly": "npm run test:cli && npm pack --dry-run",
|
|
45
46
|
"postversion": "git push && git push --tags"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|