thatgfsj-code 1.0.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +192 -0
- package/DEVELOPMENT.md +286 -0
- package/dist/app/index.d.ts +40 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +87 -12
- package/dist/app/index.js.map +1 -1
- package/dist/cache/fingerprint.d.ts +49 -0
- package/dist/cache/fingerprint.d.ts.map +1 -0
- package/dist/cache/fingerprint.js +100 -0
- package/dist/cache/fingerprint.js.map +1 -0
- package/dist/cache/index.d.ts +15 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +15 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/smartModel.d.ts +40 -0
- package/dist/cache/smartModel.d.ts.map +1 -0
- package/dist/cache/smartModel.js +43 -0
- package/dist/cache/smartModel.js.map +1 -0
- package/dist/cache/stats.d.ts +93 -0
- package/dist/cache/stats.d.ts.map +1 -0
- package/dist/cache/stats.js +155 -0
- package/dist/cache/stats.js.map +1 -0
- package/dist/cache/volatile.d.ts +32 -0
- package/dist/cache/volatile.d.ts.map +1 -0
- package/dist/cache/volatile.js +44 -0
- package/dist/cache/volatile.js.map +1 -0
- package/dist/cmd/index.d.ts +21 -0
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +155 -31
- package/dist/cmd/index.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/types.d.ts +14 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/llm/anthropic.d.ts +55 -5
- package/dist/llm/anthropic.d.ts.map +1 -1
- package/dist/llm/anthropic.js +172 -26
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/index.d.ts +26 -8
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +83 -15
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/openai.d.ts +28 -8
- package/dist/llm/openai.d.ts.map +1 -1
- package/dist/llm/openai.js +58 -8
- package/dist/llm/openai.js.map +1 -1
- package/dist/llm/provider.d.ts +40 -8
- package/dist/llm/provider.d.ts.map +1 -1
- package/dist/llm/provider.js +8 -1
- package/dist/llm/provider.js.map +1 -1
- package/dist/prompts/index.d.ts +32 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +33 -11
- package/dist/prompts/index.js.map +1 -1
- package/dist/session/index.d.ts +43 -3
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +114 -17
- package/dist/session/index.js.map +1 -1
- package/dist/skills/brainstorming.js +33 -33
- package/dist/skills/code-review.js +35 -35
- package/dist/skills/executing-plans.js +18 -18
- package/dist/skills/frontend-design.js +25 -25
- package/dist/skills/git-workflow.js +26 -26
- package/dist/skills/improve-architecture.js +28 -28
- package/dist/skills/neuroweave.js +37 -37
- package/dist/skills/playwright.js +62 -62
- package/dist/skills/prototype.js +20 -20
- package/dist/skills/subagent.js +19 -19
- package/dist/skills/supabase.js +34 -34
- package/dist/skills/systematic-debugging.js +34 -34
- package/dist/skills/tdd.js +29 -29
- package/dist/skills/triage.js +25 -25
- package/dist/skills/verification.js +22 -22
- package/dist/skills/writing-plans.js +32 -32
- package/dist/tools/nwt.js +16 -16
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/app.js +9 -2
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/components/ChatList.d.ts.map +1 -1
- package/dist/tui/components/ChatList.js +4 -3
- package/dist/tui/components/ChatList.js.map +1 -1
- package/dist/tui/components/Header.d.ts +8 -0
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +17 -3
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/InitWizard.d.ts +12 -1
- package/dist/tui/components/InitWizard.d.ts.map +1 -1
- package/dist/tui/components/InitWizard.js +58 -3
- package/dist/tui/components/InitWizard.js.map +1 -1
- package/dist/tui/components/ToolCall.d.ts +1 -1
- package/dist/tui/components/ToolCall.d.ts.map +1 -1
- package/dist/tui/components/ToolCall.js +4 -4
- package/dist/tui/components/ToolCall.js.map +1 -1
- package/dist/tui/hooks/useChat.d.ts +22 -0
- package/dist/tui/hooks/useChat.d.ts.map +1 -1
- package/dist/tui/hooks/useChat.js +127 -50
- package/dist/tui/hooks/useChat.js.map +1 -1
- package/dist/tui/hooks/useCommands.d.ts.map +1 -1
- package/dist/tui/hooks/useCommands.js +78 -0
- package/dist/tui/hooks/useCommands.js.map +1 -1
- package/dist/types.d.ts +79 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/stableStringify.d.ts +21 -0
- package/dist/utils/stableStringify.d.ts.map +1 -0
- package/dist/utils/stableStringify.js +53 -0
- package/dist/utils/stableStringify.js.map +1 -0
- package/dist/utils/thinking.d.ts +59 -0
- package/dist/utils/thinking.d.ts.map +1 -0
- package/dist/utils/thinking.js +104 -0
- package/dist/utils/thinking.js.map +1 -0
- package/install.bat +63 -0
- package/install.ps1 +238 -0
- package/install.sh +113 -0
- package/package.json +7 -4
- package/src/app/index.ts +180 -108
- package/src/cache/fingerprint.ts +101 -0
- package/src/cache/index.ts +15 -0
- package/src/cache/smartModel.ts +52 -0
- package/src/cache/stats.ts +199 -0
- package/src/cache/volatile.ts +47 -0
- package/src/cmd/index.tsx +288 -160
- package/src/config/index.ts +156 -148
- package/src/config/providers.ts +234 -234
- package/src/config/types.ts +67 -53
- package/src/hooks/index.ts +111 -111
- package/src/llm/anthropic.ts +388 -243
- package/src/llm/gemini.ts +169 -169
- package/src/llm/index.ts +265 -200
- package/src/llm/openai.ts +243 -196
- package/src/llm/provider.ts +66 -34
- package/src/prompts/index.ts +260 -220
- package/src/session/compactor.ts +103 -103
- package/src/session/index.ts +181 -87
- package/src/session/message.ts +42 -42
- package/src/skills/brainstorming.ts +43 -43
- package/src/skills/code-review.ts +45 -45
- package/src/skills/executing-plans.ts +27 -27
- package/src/skills/frontend-design.ts +35 -35
- package/src/skills/git-workflow.ts +36 -36
- package/src/skills/improve-architecture.ts +38 -38
- package/src/skills/index.ts +136 -136
- package/src/skills/neuroweave.ts +47 -47
- package/src/skills/playwright.ts +72 -72
- package/src/skills/prototype.ts +30 -30
- package/src/skills/subagent.ts +28 -28
- package/src/skills/supabase.ts +44 -44
- package/src/skills/systematic-debugging.ts +44 -44
- package/src/skills/tdd.ts +39 -39
- package/src/skills/triage.ts +35 -35
- package/src/skills/verification.ts +31 -31
- package/src/skills/writing-plans.ts +42 -42
- package/src/tools/nwt.ts +598 -598
- package/src/tools/types.ts +122 -122
- package/src/tui/app.tsx +199 -186
- package/src/tui/components/ChatList.tsx +41 -32
- package/src/tui/components/ChatMessage.tsx +54 -54
- package/src/tui/components/Header.tsx +56 -28
- package/src/tui/components/InitWizard.tsx +217 -132
- package/src/tui/components/Markdown.tsx +35 -35
- package/src/tui/components/ModelSelector.tsx +87 -87
- package/src/tui/components/StatusBar.tsx +30 -30
- package/src/tui/components/Thinking.tsx +17 -17
- package/src/tui/components/ToolCall.tsx +102 -71
- package/src/tui/components/UserInput.tsx +131 -131
- package/src/tui/hooks/useChat.ts +287 -194
- package/src/tui/hooks/useCommands.ts +234 -154
- package/src/tui/index.ts +6 -6
- package/src/tui/welcome.ts +177 -177
- package/src/types.ts +104 -42
- package/src/utils/diff.ts +71 -71
- package/src/utils/project.ts +99 -99
- package/src/utils/stableStringify.ts +47 -0
- package/src/utils/thinking.ts +119 -0
- package/tests/cache/fingerprint.test.ts +75 -0
- package/tests/cache/stableStringify.test.ts +43 -0
- package/tests/cache/stats.test.ts +146 -0
- package/tests/cache/volatile.test.ts +75 -0
- package/tests/smoke-pollution.mjs +78 -0
- package/tests/smoke-thinking.mjs +110 -0
- package/tests/smoke-tool-stream.mjs +69 -0
- package/tests/smoke-tool.mjs +117 -0
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import type { Skill } from './index.js';
|
|
2
|
-
|
|
3
|
-
export const codeReviewSkill: Skill = {
|
|
4
|
-
id: 'code-review',
|
|
5
|
-
name: 'Code Review',
|
|
6
|
-
description: 'Systematic code review for quality, security, and correctness',
|
|
7
|
-
category: 'review',
|
|
8
|
-
autoActivate: ['review', '审查', '检查代码', 'code quality'],
|
|
9
|
-
prompt: `## Code Review Checklist
|
|
10
|
-
|
|
11
|
-
When reviewing code (your own or others):
|
|
12
|
-
|
|
13
|
-
### Correctness
|
|
14
|
-
- Does it do what it's supposed to?
|
|
15
|
-
- Are edge cases handled?
|
|
16
|
-
- Are error cases handled?
|
|
17
|
-
|
|
18
|
-
### Security
|
|
19
|
-
- No hardcoded secrets or API keys
|
|
20
|
-
- Input validation on user data
|
|
21
|
-
- No SQL injection, XSS, or path traversal risks
|
|
22
|
-
|
|
23
|
-
### Performance
|
|
24
|
-
- No unnecessary loops or allocations
|
|
25
|
-
- Efficient data structures
|
|
26
|
-
- No N+1 queries or blocking calls
|
|
27
|
-
|
|
28
|
-
### Readability
|
|
29
|
-
- Clear variable/function names
|
|
30
|
-
- Appropriate comments (why, not what)
|
|
31
|
-
- Consistent style with codebase
|
|
32
|
-
|
|
33
|
-
### Testability
|
|
34
|
-
- Can this be easily tested?
|
|
35
|
-
- Are dependencies injectable?
|
|
36
|
-
- Are side effects isolated?
|
|
37
|
-
|
|
38
|
-
### Output Format
|
|
39
|
-
\`\`\`
|
|
40
|
-
## Review Summary
|
|
41
|
-
✅ Good: [what's done well]
|
|
42
|
-
⚠️ Suggestions: [improvements]
|
|
43
|
-
🔴 Issues: [must fix]
|
|
44
|
-
\`\`\``,
|
|
45
|
-
};
|
|
1
|
+
import type { Skill } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const codeReviewSkill: Skill = {
|
|
4
|
+
id: 'code-review',
|
|
5
|
+
name: 'Code Review',
|
|
6
|
+
description: 'Systematic code review for quality, security, and correctness',
|
|
7
|
+
category: 'review',
|
|
8
|
+
autoActivate: ['review', '审查', '检查代码', 'code quality'],
|
|
9
|
+
prompt: `## Code Review Checklist
|
|
10
|
+
|
|
11
|
+
When reviewing code (your own or others):
|
|
12
|
+
|
|
13
|
+
### Correctness
|
|
14
|
+
- Does it do what it's supposed to?
|
|
15
|
+
- Are edge cases handled?
|
|
16
|
+
- Are error cases handled?
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
- No hardcoded secrets or API keys
|
|
20
|
+
- Input validation on user data
|
|
21
|
+
- No SQL injection, XSS, or path traversal risks
|
|
22
|
+
|
|
23
|
+
### Performance
|
|
24
|
+
- No unnecessary loops or allocations
|
|
25
|
+
- Efficient data structures
|
|
26
|
+
- No N+1 queries or blocking calls
|
|
27
|
+
|
|
28
|
+
### Readability
|
|
29
|
+
- Clear variable/function names
|
|
30
|
+
- Appropriate comments (why, not what)
|
|
31
|
+
- Consistent style with codebase
|
|
32
|
+
|
|
33
|
+
### Testability
|
|
34
|
+
- Can this be easily tested?
|
|
35
|
+
- Are dependencies injectable?
|
|
36
|
+
- Are side effects isolated?
|
|
37
|
+
|
|
38
|
+
### Output Format
|
|
39
|
+
\`\`\`
|
|
40
|
+
## Review Summary
|
|
41
|
+
✅ Good: [what's done well]
|
|
42
|
+
⚠️ Suggestions: [improvements]
|
|
43
|
+
🔴 Issues: [must fix]
|
|
44
|
+
\`\`\``,
|
|
45
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { Skill } from './index.js';
|
|
2
|
-
|
|
3
|
-
export const executingPlansSkill: Skill = {
|
|
4
|
-
id: 'executing-plans',
|
|
5
|
-
name: 'Executing Plans',
|
|
6
|
-
description: 'Execute multi-step plans methodically with verification',
|
|
7
|
-
category: 'planning',
|
|
8
|
-
prompt: `## Plan Execution Mode
|
|
9
|
-
|
|
10
|
-
When executing a plan or multi-step task:
|
|
11
|
-
|
|
12
|
-
1. **One step at a time** - Complete each step fully before moving to the next
|
|
13
|
-
2. **Verify each step** - After each change, verify it works (read the file, run a test, check syntax)
|
|
14
|
-
3. **Report progress** - Tell the user what you did for each step
|
|
15
|
-
4. **Handle failures** - If a step fails, stop and explain. Don't silently skip.
|
|
16
|
-
5. **Commit checkpoints** - After successful steps, suggest a git commit
|
|
17
|
-
|
|
18
|
-
### Progress Format
|
|
19
|
-
\`\`\`
|
|
20
|
-
✅ Step 1: [What was done] - Verified
|
|
21
|
-
✅ Step 2: [What was done] - Verified
|
|
22
|
-
⏳ Step 3: [Currently working on]
|
|
23
|
-
⬜ Step 4: [Pending]
|
|
24
|
-
\`\`\`
|
|
25
|
-
|
|
26
|
-
If you encounter an unexpected issue, stop and ask the user how to proceed.`,
|
|
27
|
-
};
|
|
1
|
+
import type { Skill } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const executingPlansSkill: Skill = {
|
|
4
|
+
id: 'executing-plans',
|
|
5
|
+
name: 'Executing Plans',
|
|
6
|
+
description: 'Execute multi-step plans methodically with verification',
|
|
7
|
+
category: 'planning',
|
|
8
|
+
prompt: `## Plan Execution Mode
|
|
9
|
+
|
|
10
|
+
When executing a plan or multi-step task:
|
|
11
|
+
|
|
12
|
+
1. **One step at a time** - Complete each step fully before moving to the next
|
|
13
|
+
2. **Verify each step** - After each change, verify it works (read the file, run a test, check syntax)
|
|
14
|
+
3. **Report progress** - Tell the user what you did for each step
|
|
15
|
+
4. **Handle failures** - If a step fails, stop and explain. Don't silently skip.
|
|
16
|
+
5. **Commit checkpoints** - After successful steps, suggest a git commit
|
|
17
|
+
|
|
18
|
+
### Progress Format
|
|
19
|
+
\`\`\`
|
|
20
|
+
✅ Step 1: [What was done] - Verified
|
|
21
|
+
✅ Step 2: [What was done] - Verified
|
|
22
|
+
⏳ Step 3: [Currently working on]
|
|
23
|
+
⬜ Step 4: [Pending]
|
|
24
|
+
\`\`\`
|
|
25
|
+
|
|
26
|
+
If you encounter an unexpected issue, stop and ask the user how to proceed.`,
|
|
27
|
+
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type { Skill } from './index.js';
|
|
2
|
-
|
|
3
|
-
export const frontendDesignSkill: Skill = {
|
|
4
|
-
id: 'frontend-design',
|
|
5
|
-
name: 'Frontend Design',
|
|
6
|
-
description: 'UI/UX best practices for web interfaces',
|
|
7
|
-
category: 'architecture',
|
|
8
|
-
autoActivate: ['ui', 'ux', 'frontend', 'css', 'layout', 'design', '界面', '页面'],
|
|
9
|
-
prompt: `## Frontend Design Principles
|
|
10
|
-
|
|
11
|
-
### Layout
|
|
12
|
-
- Use CSS Grid for 2D layouts, Flexbox for 1D
|
|
13
|
-
- Mobile-first: design for small screens, enhance for larger
|
|
14
|
-
- Consistent spacing: use a 4px or 8px grid system
|
|
15
|
-
|
|
16
|
-
### Typography
|
|
17
|
-
- Max 2-3 font sizes per page
|
|
18
|
-
- Line height: 1.5 for body, 1.2 for headings
|
|
19
|
-
- Max line length: 60-80 characters
|
|
20
|
-
|
|
21
|
-
### Color
|
|
22
|
-
- Use a limited palette (primary, secondary, accent, neutral)
|
|
23
|
-
- Ensure contrast ratio ≥ 4.5:1 for text
|
|
24
|
-
- Use color purposefully (not just decoration)
|
|
25
|
-
|
|
26
|
-
### Components
|
|
27
|
-
- Keep components small and focused
|
|
28
|
-
- Extract reusable patterns early
|
|
29
|
-
- Props should be explicit, not spread
|
|
30
|
-
|
|
31
|
-
### Performance
|
|
32
|
-
- Lazy load images and heavy components
|
|
33
|
-
- Minimize bundle size
|
|
34
|
-
- Use skeleton loaders for async content`,
|
|
35
|
-
};
|
|
1
|
+
import type { Skill } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const frontendDesignSkill: Skill = {
|
|
4
|
+
id: 'frontend-design',
|
|
5
|
+
name: 'Frontend Design',
|
|
6
|
+
description: 'UI/UX best practices for web interfaces',
|
|
7
|
+
category: 'architecture',
|
|
8
|
+
autoActivate: ['ui', 'ux', 'frontend', 'css', 'layout', 'design', '界面', '页面'],
|
|
9
|
+
prompt: `## Frontend Design Principles
|
|
10
|
+
|
|
11
|
+
### Layout
|
|
12
|
+
- Use CSS Grid for 2D layouts, Flexbox for 1D
|
|
13
|
+
- Mobile-first: design for small screens, enhance for larger
|
|
14
|
+
- Consistent spacing: use a 4px or 8px grid system
|
|
15
|
+
|
|
16
|
+
### Typography
|
|
17
|
+
- Max 2-3 font sizes per page
|
|
18
|
+
- Line height: 1.5 for body, 1.2 for headings
|
|
19
|
+
- Max line length: 60-80 characters
|
|
20
|
+
|
|
21
|
+
### Color
|
|
22
|
+
- Use a limited palette (primary, secondary, accent, neutral)
|
|
23
|
+
- Ensure contrast ratio ≥ 4.5:1 for text
|
|
24
|
+
- Use color purposefully (not just decoration)
|
|
25
|
+
|
|
26
|
+
### Components
|
|
27
|
+
- Keep components small and focused
|
|
28
|
+
- Extract reusable patterns early
|
|
29
|
+
- Props should be explicit, not spread
|
|
30
|
+
|
|
31
|
+
### Performance
|
|
32
|
+
- Lazy load images and heavy components
|
|
33
|
+
- Minimize bundle size
|
|
34
|
+
- Use skeleton loaders for async content`,
|
|
35
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import type { Skill } from './index.js';
|
|
2
|
-
|
|
3
|
-
export const gitWorkflowSkill: Skill = {
|
|
4
|
-
id: 'git-workflow',
|
|
5
|
-
name: 'Git Workflow',
|
|
6
|
-
description: 'Clean git practices: commits, branches, PRs',
|
|
7
|
-
category: 'workflow',
|
|
8
|
-
autoActivate: ['git', 'commit', 'branch', 'merge', 'push', 'pull request'],
|
|
9
|
-
prompt: `## Git Best Practices
|
|
10
|
-
|
|
11
|
-
### Commits
|
|
12
|
-
- **Atomic**: One logical change per commit
|
|
13
|
-
- **Message format**: \`type(scope): description\`
|
|
14
|
-
- feat: new feature
|
|
15
|
-
- fix: bug fix
|
|
16
|
-
- refactor: code restructuring
|
|
17
|
-
- docs: documentation
|
|
18
|
-
- test: adding tests
|
|
19
|
-
- chore: maintenance
|
|
20
|
-
|
|
21
|
-
### Before Committing
|
|
22
|
-
1. Review changes: \`git diff --staged\`
|
|
23
|
-
2. Run tests
|
|
24
|
-
3. Check for secrets or debug code
|
|
25
|
-
|
|
26
|
-
### Branch Naming
|
|
27
|
-
- \`feature/description\` - New features
|
|
28
|
-
- \`fix/description\` - Bug fixes
|
|
29
|
-
- \`refactor/description\` - Code improvements
|
|
30
|
-
|
|
31
|
-
### Workflow
|
|
32
|
-
1. Create branch from main
|
|
33
|
-
2. Make changes with atomic commits
|
|
34
|
-
3. Push and create PR
|
|
35
|
-
4. Squash merge to main`,
|
|
36
|
-
};
|
|
1
|
+
import type { Skill } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const gitWorkflowSkill: Skill = {
|
|
4
|
+
id: 'git-workflow',
|
|
5
|
+
name: 'Git Workflow',
|
|
6
|
+
description: 'Clean git practices: commits, branches, PRs',
|
|
7
|
+
category: 'workflow',
|
|
8
|
+
autoActivate: ['git', 'commit', 'branch', 'merge', 'push', 'pull request'],
|
|
9
|
+
prompt: `## Git Best Practices
|
|
10
|
+
|
|
11
|
+
### Commits
|
|
12
|
+
- **Atomic**: One logical change per commit
|
|
13
|
+
- **Message format**: \`type(scope): description\`
|
|
14
|
+
- feat: new feature
|
|
15
|
+
- fix: bug fix
|
|
16
|
+
- refactor: code restructuring
|
|
17
|
+
- docs: documentation
|
|
18
|
+
- test: adding tests
|
|
19
|
+
- chore: maintenance
|
|
20
|
+
|
|
21
|
+
### Before Committing
|
|
22
|
+
1. Review changes: \`git diff --staged\`
|
|
23
|
+
2. Run tests
|
|
24
|
+
3. Check for secrets or debug code
|
|
25
|
+
|
|
26
|
+
### Branch Naming
|
|
27
|
+
- \`feature/description\` - New features
|
|
28
|
+
- \`fix/description\` - Bug fixes
|
|
29
|
+
- \`refactor/description\` - Code improvements
|
|
30
|
+
|
|
31
|
+
### Workflow
|
|
32
|
+
1. Create branch from main
|
|
33
|
+
2. Make changes with atomic commits
|
|
34
|
+
3. Push and create PR
|
|
35
|
+
4. Squash merge to main`,
|
|
36
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { Skill } from './index.js';
|
|
2
|
-
|
|
3
|
-
export const improveArchitectureSkill: Skill = {
|
|
4
|
-
id: 'improve-architecture',
|
|
5
|
-
name: 'Improve Architecture',
|
|
6
|
-
description: 'Systematically improve codebase structure and quality',
|
|
7
|
-
category: 'architecture',
|
|
8
|
-
autoActivate: ['重构', 'refactor', '架构', 'architecture', 'clean', 'improve'],
|
|
9
|
-
prompt: `## Architecture Improvement Protocol
|
|
10
|
-
|
|
11
|
-
When improving code structure:
|
|
12
|
-
|
|
13
|
-
### 1. Assess Current State
|
|
14
|
-
- Read the code and identify pain points
|
|
15
|
-
- Look for: god classes, circular dependencies, tight coupling, code duplication
|
|
16
|
-
|
|
17
|
-
### 2. Identify Patterns
|
|
18
|
-
- **Single Responsibility**: Does each module/class do ONE thing?
|
|
19
|
-
- **Dependency Direction**: Do high-level modules depend on low-level ones?
|
|
20
|
-
- **Abstraction Level**: Is each layer at the right abstraction?
|
|
21
|
-
|
|
22
|
-
### 3. Plan Changes
|
|
23
|
-
- Start with the highest-impact, lowest-risk change
|
|
24
|
-
- Each change should be independently valuable
|
|
25
|
-
- Never refactor everything at once
|
|
26
|
-
|
|
27
|
-
### 4. Execute Safely
|
|
28
|
-
- Make one change at a time
|
|
29
|
-
- Verify after each change
|
|
30
|
-
- Commit frequently
|
|
31
|
-
|
|
32
|
-
### Red Flags to Fix
|
|
33
|
-
- Files over 300 lines
|
|
34
|
-
- Functions over 50 lines
|
|
35
|
-
- More than 3 levels of nesting
|
|
36
|
-
- Copy-pasted code blocks
|
|
37
|
-
- Circular imports`,
|
|
38
|
-
};
|
|
1
|
+
import type { Skill } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const improveArchitectureSkill: Skill = {
|
|
4
|
+
id: 'improve-architecture',
|
|
5
|
+
name: 'Improve Architecture',
|
|
6
|
+
description: 'Systematically improve codebase structure and quality',
|
|
7
|
+
category: 'architecture',
|
|
8
|
+
autoActivate: ['重构', 'refactor', '架构', 'architecture', 'clean', 'improve'],
|
|
9
|
+
prompt: `## Architecture Improvement Protocol
|
|
10
|
+
|
|
11
|
+
When improving code structure:
|
|
12
|
+
|
|
13
|
+
### 1. Assess Current State
|
|
14
|
+
- Read the code and identify pain points
|
|
15
|
+
- Look for: god classes, circular dependencies, tight coupling, code duplication
|
|
16
|
+
|
|
17
|
+
### 2. Identify Patterns
|
|
18
|
+
- **Single Responsibility**: Does each module/class do ONE thing?
|
|
19
|
+
- **Dependency Direction**: Do high-level modules depend on low-level ones?
|
|
20
|
+
- **Abstraction Level**: Is each layer at the right abstraction?
|
|
21
|
+
|
|
22
|
+
### 3. Plan Changes
|
|
23
|
+
- Start with the highest-impact, lowest-risk change
|
|
24
|
+
- Each change should be independently valuable
|
|
25
|
+
- Never refactor everything at once
|
|
26
|
+
|
|
27
|
+
### 4. Execute Safely
|
|
28
|
+
- Make one change at a time
|
|
29
|
+
- Verify after each change
|
|
30
|
+
- Commit frequently
|
|
31
|
+
|
|
32
|
+
### Red Flags to Fix
|
|
33
|
+
- Files over 300 lines
|
|
34
|
+
- Functions over 50 lines
|
|
35
|
+
- More than 3 levels of nesting
|
|
36
|
+
- Copy-pasted code blocks
|
|
37
|
+
- Circular imports`,
|
|
38
|
+
};
|
package/src/skills/index.ts
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skills Registry - Built-in skills for development workflows
|
|
3
|
-
* Inspired by skills.sh (obra/superpowers, mattpocock/skills, anthropics/skills)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface Skill {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
category: 'planning' | 'debugging' | 'testing' | 'architecture' | 'workflow' | 'browser' | 'review';
|
|
11
|
-
prompt: string;
|
|
12
|
-
autoActivate?: string[]; // Keywords that auto-activate this skill
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Import all skills
|
|
16
|
-
import { writingPlansSkill } from './writing-plans.js';
|
|
17
|
-
import { executingPlansSkill } from './executing-plans.js';
|
|
18
|
-
import { systematicDebuggingSkill } from './systematic-debugging.js';
|
|
19
|
-
import { brainstormingSkill } from './brainstorming.js';
|
|
20
|
-
import { tddSkill } from './tdd.js';
|
|
21
|
-
import { improveArchitectureSkill } from './improve-architecture.js';
|
|
22
|
-
import { verificationSkill } from './verification.js';
|
|
23
|
-
import { codeReviewSkill } from './code-review.js';
|
|
24
|
-
import { prototypeSkill } from './prototype.js';
|
|
25
|
-
import { triageSkill } from './triage.js';
|
|
26
|
-
import { gitWorkflowSkill } from './git-workflow.js';
|
|
27
|
-
import { subagentSkill } from './subagent.js';
|
|
28
|
-
import { playwrightSkill } from './playwright.js';
|
|
29
|
-
import { frontendDesignSkill } from './frontend-design.js';
|
|
30
|
-
import { supabaseSkill } from './supabase.js';
|
|
31
|
-
import { neuroweaveSkill } from './neuroweave.js';
|
|
32
|
-
|
|
33
|
-
// All built-in skills (16 total)
|
|
34
|
-
export const BUILTIN_SKILLS: Skill[] = [
|
|
35
|
-
writingPlansSkill,
|
|
36
|
-
executingPlansSkill,
|
|
37
|
-
systematicDebuggingSkill,
|
|
38
|
-
brainstormingSkill,
|
|
39
|
-
tddSkill,
|
|
40
|
-
improveArchitectureSkill,
|
|
41
|
-
verificationSkill,
|
|
42
|
-
codeReviewSkill,
|
|
43
|
-
prototypeSkill,
|
|
44
|
-
triageSkill,
|
|
45
|
-
gitWorkflowSkill,
|
|
46
|
-
subagentSkill,
|
|
47
|
-
playwrightSkill,
|
|
48
|
-
frontendDesignSkill,
|
|
49
|
-
supabaseSkill,
|
|
50
|
-
neuroweaveSkill,
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
// Skill registry
|
|
54
|
-
export class SkillRegistry {
|
|
55
|
-
private skills: Map<string, Skill> = new Map();
|
|
56
|
-
private activeSkills: Set<string> = new Set();
|
|
57
|
-
|
|
58
|
-
constructor() {
|
|
59
|
-
for (const skill of BUILTIN_SKILLS) {
|
|
60
|
-
this.skills.set(skill.id, skill);
|
|
61
|
-
}
|
|
62
|
-
// Default active skills
|
|
63
|
-
this.activeSkills.add('writing-plans');
|
|
64
|
-
this.activeSkills.add('systematic-debugging');
|
|
65
|
-
this.activeSkills.add('verification');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
get(id: string): Skill | undefined {
|
|
69
|
-
return this.skills.get(id);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
list(): Skill[] {
|
|
73
|
-
return [...this.skills.values()];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
listActive(): Skill[] {
|
|
77
|
-
return [...this.activeSkills].map(id => this.skills.get(id)!).filter(Boolean);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
activate(id: string): boolean {
|
|
81
|
-
if (this.skills.has(id)) {
|
|
82
|
-
this.activeSkills.add(id);
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
deactivate(id: string): boolean {
|
|
89
|
-
return this.activeSkills.delete(id);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
isActive(id: string): boolean {
|
|
93
|
-
return this.activeSkills.has(id);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get all active skill prompts for system prompt injection
|
|
98
|
-
*/
|
|
99
|
-
getActivePrompts(): string {
|
|
100
|
-
const active = this.listActive();
|
|
101
|
-
if (active.length === 0) return '';
|
|
102
|
-
|
|
103
|
-
return active.map(s => `### Skill: ${s.name}\n${s.prompt}`).join('\n\n');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Auto-activate skills based on user input
|
|
108
|
-
*/
|
|
109
|
-
autoActivate(input: string): void {
|
|
110
|
-
const lower = input.toLowerCase();
|
|
111
|
-
for (const skill of this.skills.values()) {
|
|
112
|
-
if (skill.autoActivate?.some(kw => lower.includes(kw))) {
|
|
113
|
-
this.activeSkills.add(skill.id);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export {
|
|
120
|
-
writingPlansSkill,
|
|
121
|
-
executingPlansSkill,
|
|
122
|
-
systematicDebuggingSkill,
|
|
123
|
-
brainstormingSkill,
|
|
124
|
-
tddSkill,
|
|
125
|
-
improveArchitectureSkill,
|
|
126
|
-
verificationSkill,
|
|
127
|
-
codeReviewSkill,
|
|
128
|
-
prototypeSkill,
|
|
129
|
-
triageSkill,
|
|
130
|
-
gitWorkflowSkill,
|
|
131
|
-
subagentSkill,
|
|
132
|
-
playwrightSkill,
|
|
133
|
-
frontendDesignSkill,
|
|
134
|
-
supabaseSkill,
|
|
135
|
-
neuroweaveSkill,
|
|
136
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Skills Registry - Built-in skills for development workflows
|
|
3
|
+
* Inspired by skills.sh (obra/superpowers, mattpocock/skills, anthropics/skills)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface Skill {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
category: 'planning' | 'debugging' | 'testing' | 'architecture' | 'workflow' | 'browser' | 'review';
|
|
11
|
+
prompt: string;
|
|
12
|
+
autoActivate?: string[]; // Keywords that auto-activate this skill
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Import all skills
|
|
16
|
+
import { writingPlansSkill } from './writing-plans.js';
|
|
17
|
+
import { executingPlansSkill } from './executing-plans.js';
|
|
18
|
+
import { systematicDebuggingSkill } from './systematic-debugging.js';
|
|
19
|
+
import { brainstormingSkill } from './brainstorming.js';
|
|
20
|
+
import { tddSkill } from './tdd.js';
|
|
21
|
+
import { improveArchitectureSkill } from './improve-architecture.js';
|
|
22
|
+
import { verificationSkill } from './verification.js';
|
|
23
|
+
import { codeReviewSkill } from './code-review.js';
|
|
24
|
+
import { prototypeSkill } from './prototype.js';
|
|
25
|
+
import { triageSkill } from './triage.js';
|
|
26
|
+
import { gitWorkflowSkill } from './git-workflow.js';
|
|
27
|
+
import { subagentSkill } from './subagent.js';
|
|
28
|
+
import { playwrightSkill } from './playwright.js';
|
|
29
|
+
import { frontendDesignSkill } from './frontend-design.js';
|
|
30
|
+
import { supabaseSkill } from './supabase.js';
|
|
31
|
+
import { neuroweaveSkill } from './neuroweave.js';
|
|
32
|
+
|
|
33
|
+
// All built-in skills (16 total)
|
|
34
|
+
export const BUILTIN_SKILLS: Skill[] = [
|
|
35
|
+
writingPlansSkill,
|
|
36
|
+
executingPlansSkill,
|
|
37
|
+
systematicDebuggingSkill,
|
|
38
|
+
brainstormingSkill,
|
|
39
|
+
tddSkill,
|
|
40
|
+
improveArchitectureSkill,
|
|
41
|
+
verificationSkill,
|
|
42
|
+
codeReviewSkill,
|
|
43
|
+
prototypeSkill,
|
|
44
|
+
triageSkill,
|
|
45
|
+
gitWorkflowSkill,
|
|
46
|
+
subagentSkill,
|
|
47
|
+
playwrightSkill,
|
|
48
|
+
frontendDesignSkill,
|
|
49
|
+
supabaseSkill,
|
|
50
|
+
neuroweaveSkill,
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
// Skill registry
|
|
54
|
+
export class SkillRegistry {
|
|
55
|
+
private skills: Map<string, Skill> = new Map();
|
|
56
|
+
private activeSkills: Set<string> = new Set();
|
|
57
|
+
|
|
58
|
+
constructor() {
|
|
59
|
+
for (const skill of BUILTIN_SKILLS) {
|
|
60
|
+
this.skills.set(skill.id, skill);
|
|
61
|
+
}
|
|
62
|
+
// Default active skills
|
|
63
|
+
this.activeSkills.add('writing-plans');
|
|
64
|
+
this.activeSkills.add('systematic-debugging');
|
|
65
|
+
this.activeSkills.add('verification');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get(id: string): Skill | undefined {
|
|
69
|
+
return this.skills.get(id);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
list(): Skill[] {
|
|
73
|
+
return [...this.skills.values()];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
listActive(): Skill[] {
|
|
77
|
+
return [...this.activeSkills].map(id => this.skills.get(id)!).filter(Boolean);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
activate(id: string): boolean {
|
|
81
|
+
if (this.skills.has(id)) {
|
|
82
|
+
this.activeSkills.add(id);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
deactivate(id: string): boolean {
|
|
89
|
+
return this.activeSkills.delete(id);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
isActive(id: string): boolean {
|
|
93
|
+
return this.activeSkills.has(id);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get all active skill prompts for system prompt injection
|
|
98
|
+
*/
|
|
99
|
+
getActivePrompts(): string {
|
|
100
|
+
const active = this.listActive();
|
|
101
|
+
if (active.length === 0) return '';
|
|
102
|
+
|
|
103
|
+
return active.map(s => `### Skill: ${s.name}\n${s.prompt}`).join('\n\n');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Auto-activate skills based on user input
|
|
108
|
+
*/
|
|
109
|
+
autoActivate(input: string): void {
|
|
110
|
+
const lower = input.toLowerCase();
|
|
111
|
+
for (const skill of this.skills.values()) {
|
|
112
|
+
if (skill.autoActivate?.some(kw => lower.includes(kw))) {
|
|
113
|
+
this.activeSkills.add(skill.id);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
writingPlansSkill,
|
|
121
|
+
executingPlansSkill,
|
|
122
|
+
systematicDebuggingSkill,
|
|
123
|
+
brainstormingSkill,
|
|
124
|
+
tddSkill,
|
|
125
|
+
improveArchitectureSkill,
|
|
126
|
+
verificationSkill,
|
|
127
|
+
codeReviewSkill,
|
|
128
|
+
prototypeSkill,
|
|
129
|
+
triageSkill,
|
|
130
|
+
gitWorkflowSkill,
|
|
131
|
+
subagentSkill,
|
|
132
|
+
playwrightSkill,
|
|
133
|
+
frontendDesignSkill,
|
|
134
|
+
supabaseSkill,
|
|
135
|
+
neuroweaveSkill,
|
|
136
|
+
};
|