thatgfsj-code 0.5.0 → 0.7.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.
Files changed (185) hide show
  1. package/README.md +7 -12
  2. package/dist/app/index.d.ts +2 -0
  3. package/dist/app/index.d.ts.map +1 -1
  4. package/dist/app/index.js +11 -6
  5. package/dist/app/index.js.map +1 -1
  6. package/dist/cmd/index.d.ts +1 -2
  7. package/dist/cmd/index.d.ts.map +1 -1
  8. package/dist/cmd/index.js +26 -23
  9. package/dist/cmd/index.js.map +1 -1
  10. package/dist/config/index.d.ts.map +1 -1
  11. package/dist/config/index.js +1 -0
  12. package/dist/config/index.js.map +1 -1
  13. package/dist/config/types.d.ts +1 -0
  14. package/dist/config/types.d.ts.map +1 -1
  15. package/dist/prompts/index.d.ts +2 -0
  16. package/dist/prompts/index.d.ts.map +1 -1
  17. package/dist/prompts/index.js +7 -0
  18. package/dist/prompts/index.js.map +1 -1
  19. package/dist/skills/brainstorming.d.ts +3 -0
  20. package/dist/skills/brainstorming.d.ts.map +1 -0
  21. package/dist/skills/brainstorming.js +42 -0
  22. package/dist/skills/brainstorming.js.map +1 -0
  23. package/dist/skills/code-review.d.ts +3 -0
  24. package/dist/skills/code-review.d.ts.map +1 -0
  25. package/dist/skills/code-review.js +44 -0
  26. package/dist/skills/code-review.js.map +1 -0
  27. package/dist/skills/executing-plans.d.ts +3 -0
  28. package/dist/skills/executing-plans.d.ts.map +1 -0
  29. package/dist/skills/executing-plans.js +26 -0
  30. package/dist/skills/executing-plans.js.map +1 -0
  31. package/dist/skills/frontend-design.d.ts +3 -0
  32. package/dist/skills/frontend-design.d.ts.map +1 -0
  33. package/dist/skills/frontend-design.js +34 -0
  34. package/dist/skills/frontend-design.js.map +1 -0
  35. package/dist/skills/git-workflow.d.ts +3 -0
  36. package/dist/skills/git-workflow.d.ts.map +1 -0
  37. package/dist/skills/git-workflow.js +35 -0
  38. package/dist/skills/git-workflow.js.map +1 -0
  39. package/dist/skills/improve-architecture.d.ts +3 -0
  40. package/dist/skills/improve-architecture.d.ts.map +1 -0
  41. package/dist/skills/improve-architecture.js +37 -0
  42. package/dist/skills/improve-architecture.js.map +1 -0
  43. package/dist/skills/index.d.ts +50 -0
  44. package/dist/skills/index.d.ts.map +1 -0
  45. package/dist/skills/index.js +98 -0
  46. package/dist/skills/index.js.map +1 -0
  47. package/dist/skills/neuroweave.d.ts +3 -0
  48. package/dist/skills/neuroweave.d.ts.map +1 -0
  49. package/dist/skills/neuroweave.js +46 -0
  50. package/dist/skills/neuroweave.js.map +1 -0
  51. package/dist/skills/playwright.d.ts +3 -0
  52. package/dist/skills/playwright.d.ts.map +1 -0
  53. package/dist/skills/playwright.js +71 -0
  54. package/dist/skills/playwright.js.map +1 -0
  55. package/dist/skills/prototype.d.ts +3 -0
  56. package/dist/skills/prototype.d.ts.map +1 -0
  57. package/dist/skills/prototype.js +29 -0
  58. package/dist/skills/prototype.js.map +1 -0
  59. package/dist/skills/subagent.d.ts +3 -0
  60. package/dist/skills/subagent.d.ts.map +1 -0
  61. package/dist/skills/subagent.js +27 -0
  62. package/dist/skills/subagent.js.map +1 -0
  63. package/dist/skills/supabase.d.ts +3 -0
  64. package/dist/skills/supabase.d.ts.map +1 -0
  65. package/dist/skills/supabase.js +43 -0
  66. package/dist/skills/supabase.js.map +1 -0
  67. package/dist/skills/systematic-debugging.d.ts +3 -0
  68. package/dist/skills/systematic-debugging.d.ts.map +1 -0
  69. package/dist/skills/systematic-debugging.js +43 -0
  70. package/dist/skills/systematic-debugging.js.map +1 -0
  71. package/dist/skills/tdd.d.ts +3 -0
  72. package/dist/skills/tdd.d.ts.map +1 -0
  73. package/dist/skills/tdd.js +38 -0
  74. package/dist/skills/tdd.js.map +1 -0
  75. package/dist/skills/triage.d.ts +3 -0
  76. package/dist/skills/triage.d.ts.map +1 -0
  77. package/dist/skills/triage.js +34 -0
  78. package/dist/skills/triage.js.map +1 -0
  79. package/dist/skills/verification.d.ts +3 -0
  80. package/dist/skills/verification.d.ts.map +1 -0
  81. package/dist/skills/verification.js +30 -0
  82. package/dist/skills/verification.js.map +1 -0
  83. package/dist/skills/writing-plans.d.ts +3 -0
  84. package/dist/skills/writing-plans.d.ts.map +1 -0
  85. package/dist/skills/writing-plans.js +41 -0
  86. package/dist/skills/writing-plans.js.map +1 -0
  87. package/dist/tools/index.d.ts +1 -0
  88. package/dist/tools/index.d.ts.map +1 -1
  89. package/dist/tools/index.js +3 -0
  90. package/dist/tools/index.js.map +1 -1
  91. package/dist/tools/nwt.d.ts +70 -0
  92. package/dist/tools/nwt.d.ts.map +1 -0
  93. package/dist/tools/nwt.js +289 -0
  94. package/dist/tools/nwt.js.map +1 -0
  95. package/dist/tui/app.d.ts +9 -0
  96. package/dist/tui/app.d.ts.map +1 -0
  97. package/dist/tui/app.js +40 -0
  98. package/dist/tui/app.js.map +1 -0
  99. package/dist/tui/components/ChatList.d.ts +13 -0
  100. package/dist/tui/components/ChatList.d.ts.map +1 -0
  101. package/dist/tui/components/ChatList.js +11 -0
  102. package/dist/tui/components/ChatList.js.map +1 -0
  103. package/dist/tui/components/ChatMessage.d.ts +15 -0
  104. package/dist/tui/components/ChatMessage.d.ts.map +1 -0
  105. package/dist/tui/components/ChatMessage.js +17 -0
  106. package/dist/tui/components/ChatMessage.js.map +1 -0
  107. package/dist/tui/components/Header.d.ts +9 -0
  108. package/dist/tui/components/Header.d.ts.map +1 -0
  109. package/dist/tui/components/Header.js +6 -0
  110. package/dist/tui/components/Header.js.map +1 -0
  111. package/dist/tui/components/Markdown.d.ts +8 -0
  112. package/dist/tui/components/Markdown.d.ts.map +1 -0
  113. package/dist/tui/components/Markdown.js +31 -0
  114. package/dist/tui/components/Markdown.js.map +1 -0
  115. package/dist/tui/components/StatusBar.d.ts +9 -0
  116. package/dist/tui/components/StatusBar.d.ts.map +1 -0
  117. package/dist/tui/components/StatusBar.js +8 -0
  118. package/dist/tui/components/StatusBar.js.map +1 -0
  119. package/dist/tui/components/Thinking.d.ts +8 -0
  120. package/dist/tui/components/Thinking.d.ts.map +1 -0
  121. package/dist/tui/components/Thinking.js +7 -0
  122. package/dist/tui/components/Thinking.js.map +1 -0
  123. package/dist/tui/components/ToolCall.d.ts +15 -0
  124. package/dist/tui/components/ToolCall.d.ts.map +1 -0
  125. package/dist/tui/components/ToolCall.js +42 -0
  126. package/dist/tui/components/ToolCall.js.map +1 -0
  127. package/dist/tui/components/UserInput.d.ts +9 -0
  128. package/dist/tui/components/UserInput.d.ts.map +1 -0
  129. package/dist/tui/components/UserInput.js +76 -0
  130. package/dist/tui/components/UserInput.js.map +1 -0
  131. package/dist/tui/hooks/useChat.d.ts +11 -0
  132. package/dist/tui/hooks/useChat.d.ts.map +1 -0
  133. package/dist/tui/hooks/useChat.js +138 -0
  134. package/dist/tui/hooks/useChat.js.map +1 -0
  135. package/dist/tui/hooks/useCommands.d.ts +10 -0
  136. package/dist/tui/hooks/useCommands.d.ts.map +1 -0
  137. package/dist/tui/hooks/useCommands.js +78 -0
  138. package/dist/tui/hooks/useCommands.js.map +1 -0
  139. package/dist/tui/index.d.ts +2 -4
  140. package/dist/tui/index.d.ts.map +1 -1
  141. package/dist/tui/index.js +2 -4
  142. package/dist/tui/index.js.map +1 -1
  143. package/dist/tui/welcome.d.ts.map +1 -1
  144. package/dist/tui/welcome.js +22 -4
  145. package/dist/tui/welcome.js.map +1 -1
  146. package/install.ps1 +171 -192
  147. package/package.json +9 -1
  148. package/src/app/index.ts +13 -7
  149. package/src/cmd/{index.ts → index.tsx} +28 -27
  150. package/src/config/index.ts +1 -0
  151. package/src/config/types.ts +1 -0
  152. package/src/prompts/index.ts +8 -0
  153. package/src/skills/brainstorming.ts +43 -0
  154. package/src/skills/code-review.ts +45 -0
  155. package/src/skills/executing-plans.ts +27 -0
  156. package/src/skills/frontend-design.ts +35 -0
  157. package/src/skills/git-workflow.ts +36 -0
  158. package/src/skills/improve-architecture.ts +38 -0
  159. package/src/skills/index.ts +136 -0
  160. package/src/skills/neuroweave.ts +47 -0
  161. package/src/skills/playwright.ts +72 -0
  162. package/src/skills/prototype.ts +30 -0
  163. package/src/skills/subagent.ts +28 -0
  164. package/src/skills/supabase.ts +44 -0
  165. package/src/skills/systematic-debugging.ts +44 -0
  166. package/src/skills/tdd.ts +39 -0
  167. package/src/skills/triage.ts +35 -0
  168. package/src/skills/verification.ts +31 -0
  169. package/src/skills/writing-plans.ts +42 -0
  170. package/src/tools/index.ts +3 -0
  171. package/src/tools/nwt.ts +362 -0
  172. package/src/tui/app.tsx +61 -0
  173. package/src/tui/components/ChatList.tsx +32 -0
  174. package/src/tui/components/ChatMessage.tsx +54 -0
  175. package/src/tui/components/Header.tsx +28 -0
  176. package/src/tui/components/Markdown.tsx +35 -0
  177. package/src/tui/components/StatusBar.tsx +30 -0
  178. package/src/tui/components/Thinking.tsx +19 -0
  179. package/src/tui/components/ToolCall.tsx +74 -0
  180. package/src/tui/components/UserInput.tsx +83 -0
  181. package/src/tui/hooks/useChat.ts +154 -0
  182. package/src/tui/hooks/useCommands.ts +91 -0
  183. package/src/tui/index.ts +2 -4
  184. package/src/tui/welcome.ts +24 -5
  185. package/tsconfig.json +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thatgfsj-code",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Thatgfsj Code - AI Coding Assistant",
5
5
  "main": "dist/cmd/index.js",
6
6
  "type": "module",
@@ -25,12 +25,20 @@
25
25
  "dependencies": {
26
26
  "chalk": "^5.3.0",
27
27
  "commander": "^11.1.0",
28
+ "ink": "^7.1.0",
29
+ "ink-spinner": "^5.0.0",
30
+ "ink-text-input": "^6.0.0",
28
31
  "inquirer": "^13.3.2",
32
+ "marked": "^15.0.12",
33
+ "marked-terminal": "^7.3.0",
29
34
  "ora": "^7.0.1",
35
+ "react": "^19.2.7",
30
36
  "readline": "^1.3.0"
31
37
  },
32
38
  "devDependencies": {
39
+ "@types/marked-terminal": "^6.1.1",
33
40
  "@types/node": "^20.10.0",
41
+ "@types/react": "^19.2.17",
34
42
  "typescript": "^5.3.0"
35
43
  }
36
44
  }
package/src/app/index.ts CHANGED
@@ -9,6 +9,7 @@ import { SessionManager } from '../session/index.js';
9
9
  import { ToolRegistry } from '../tools/index.js';
10
10
  import { HookManager } from '../hooks/index.js';
11
11
  import { SystemPromptBuilder } from '../prompts/index.js';
12
+ import { SkillRegistry } from '../skills/index.js';
12
13
  import type { ChatMessage, ChatResponse } from '../types.js';
13
14
 
14
15
  export class App {
@@ -18,6 +19,7 @@ export class App {
18
19
  tools: ToolRegistry;
19
20
  hooks: HookManager;
20
21
  prompts: SystemPromptBuilder;
22
+ skills: SkillRegistry;
21
23
 
22
24
  private constructor(
23
25
  config: ConfigManager,
@@ -26,6 +28,7 @@ export class App {
26
28
  tools: ToolRegistry,
27
29
  hooks: HookManager,
28
30
  prompts: SystemPromptBuilder,
31
+ skills: SkillRegistry,
29
32
  ) {
30
33
  this.config = config;
31
34
  this.llm = llm;
@@ -33,6 +36,7 @@ export class App {
33
36
  this.tools = tools;
34
37
  this.hooks = hooks;
35
38
  this.prompts = prompts;
39
+ this.skills = skills;
36
40
  }
37
41
 
38
42
  static async create(): Promise<App> {
@@ -40,22 +44,24 @@ export class App {
40
44
  const aiConfig = config.getAIConfig();
41
45
 
42
46
  const llm = LLMService.fromConfig(aiConfig);
43
- const session = new SessionManager();
47
+ const session = new SessionManager(config.get().contextLength || 50);
44
48
  const tools = new ToolRegistry();
45
49
  const hooks = new HookManager();
50
+ const skills = new SkillRegistry();
51
+
52
+ // Register tools with LLM service
53
+ llm.registerTools(tools.list());
54
+
55
+ // Build system prompt with active skills
46
56
  const prompts = new SystemPromptBuilder({
47
57
  cwd: process.cwd(),
48
58
  tools: tools.list(),
49
59
  permissionMode: 'ask',
60
+ skillsPrompt: skills.getActivePrompts(),
50
61
  });
51
-
52
- // Register tools with LLM service
53
- llm.registerTools(tools.list());
54
-
55
- // Set up system prompt
56
62
  session.addMessage('system', prompts.build());
57
63
 
58
- return new App(config, llm, session, tools, hooks, prompts);
64
+ return new App(config, llm, session, tools, hooks, prompts, skills);
59
65
  }
60
66
 
61
67
  /**
@@ -2,10 +2,9 @@
2
2
 
3
3
  /**
4
4
  * Thatgfsj Code - CLI Entry Point
5
- * Simplified from old src/index.ts (655 lines → ~60 lines)
6
5
  *
7
6
  * Two modes:
8
- * gfcode → Interactive REPL
7
+ * gfcode → Interactive TUI (Ink)
9
8
  * gfcode "prompt" → Single prompt mode
10
9
  * gfcode init → Setup wizard
11
10
  */
@@ -20,18 +19,18 @@ if (process.platform === 'win32') {
20
19
  import { program } from 'commander';
21
20
  import chalk from 'chalk';
22
21
  import { App } from '../app/index.js';
23
- import { REPL } from '../tui/repl.js';
24
22
  import { WelcomeScreen } from '../tui/welcome.js';
23
+ import { REPLOutput } from '../tui/output.js';
25
24
 
26
25
  // ==================== Error Handling ====================
27
26
 
28
27
  process.on('uncaughtException', (error) => {
29
- console.error(chalk.red('\nError:'), error.message);
28
+ console.error(chalk.red('\n Error:'), error.message);
30
29
  process.exit(1);
31
30
  });
32
31
 
33
32
  process.on('unhandledRejection', (reason) => {
34
- console.error(chalk.red('\nError:'), reason);
33
+ console.error(chalk.red('\n Error:'), reason);
35
34
  process.exit(1);
36
35
  });
37
36
 
@@ -39,15 +38,13 @@ process.on('unhandledRejection', (reason) => {
39
38
 
40
39
  program
41
40
  .name('gfcode')
42
- .description('🤖 Thatgfsj Code - AI Coding Assistant')
43
- .version('0.5.0')
41
+ .description('Thatgfsj Code - AI Coding Assistant')
42
+ .version('0.7.0')
44
43
  .argument('[prompt]', 'Task to execute (omit to start interactive mode)')
45
44
  .option('-m, --model <model>', 'Specify model')
46
45
  .option('-i, --interactive', 'Force interactive mode')
47
- .option('--hooks', 'Enable audit logging hooks')
48
- .action(async (prompt: string | undefined, options: { model?: string; interactive?: boolean; hooks?: boolean }) => {
46
+ .action(async (prompt: string | undefined, options: { model?: string; interactive?: boolean }) => {
49
47
  try {
50
- // Initialize app
51
48
  const app = await App.create();
52
49
 
53
50
  // Show welcome if no API key
@@ -58,21 +55,27 @@ program
58
55
  await app.config.save({ model: options.model });
59
56
  }
60
57
 
61
- // Enable hooks if requested
62
- if (options.hooks) {
63
- const { auditLogHook } = await import('../hooks/index.js');
64
- app.hooks.register('afterToolCall', auditLogHook);
65
- }
66
-
67
58
  if (!prompt || options.interactive) {
68
- // Interactive REPL mode
69
- const repl = new REPL(app);
70
- await repl.start();
59
+ // Interactive mode - use Ink TUI
60
+ const { render } = await import('ink');
61
+ const { TuiApp } = await import('../tui/app.js');
62
+
63
+ const { unmount } = render(<TuiApp app={app} />);
64
+
65
+ // Wait for the app to exit
66
+ await new Promise<void>((resolve) => {
67
+ const check = setInterval(() => {
68
+ // Ink will call process.exit or we detect it
69
+ }, 1000);
70
+ process.on('exit', () => {
71
+ clearInterval(check);
72
+ unmount();
73
+ resolve();
74
+ });
75
+ });
71
76
  } else {
72
- // Single prompt mode - use same UI as REPL
73
- const { REPLOutput } = await import('../tui/output.js');
77
+ // Single prompt mode - use simple output
74
78
  const out = new REPLOutput();
75
-
76
79
  out.printBanner();
77
80
  out.printUserInput(prompt);
78
81
  out.startThinking();
@@ -111,7 +114,6 @@ program
111
114
  if (!hasStarted) { out.beginAssistant(); hasStarted = true; }
112
115
  out.writeChunk(chunk);
113
116
  }
114
-
115
117
  fullResponse += chunk;
116
118
  }
117
119
  if (hasStarted) out.endAssistant();
@@ -124,18 +126,17 @@ program
124
126
  app.session.addMessage('assistant', fullResponse);
125
127
  }
126
128
  } catch (error: any) {
127
- console.error(chalk.red(`\n${error.message}`));
129
+ console.error(chalk.red(`\n ${error.message}`));
128
130
  process.exit(1);
129
131
  }
130
132
  });
131
133
 
132
- // Init command - setup wizard
134
+ // Init command
133
135
  program
134
136
  .command('init')
135
- .description('配置 API Key 和模型')
137
+ .description('Configure API key and model')
136
138
  .action(async () => {
137
139
  await WelcomeScreen.interactiveSetup();
138
140
  });
139
141
 
140
- // Parse and run
141
142
  program.parse(process.argv);
@@ -14,6 +14,7 @@ const DEFAULT_CONFIG: Config = {
14
14
  apiKey: '',
15
15
  temperature: 0.7,
16
16
  maxTokens: 4096,
17
+ contextLength: 50,
17
18
  provider: 'siliconflow',
18
19
  };
19
20
 
@@ -32,6 +32,7 @@ export interface Config {
32
32
  apiKey: string;
33
33
  temperature: number;
34
34
  maxTokens: number;
35
+ contextLength: number;
35
36
  provider: ProviderName;
36
37
  baseUrl?: string;
37
38
  }
@@ -13,6 +13,7 @@ export interface SystemPromptConfig {
13
13
  includeProjectMd?: boolean;
14
14
  permissionMode?: 'accept' | 'deny' | 'ask';
15
15
  date?: Date;
16
+ skillsPrompt?: string;
16
17
  }
17
18
 
18
19
  export class SystemPromptBuilder {
@@ -25,6 +26,7 @@ export class SystemPromptBuilder {
25
26
  includeProjectMd: config.includeProjectMd ?? true,
26
27
  permissionMode: config.permissionMode ?? 'ask',
27
28
  date: config.date ?? new Date(),
29
+ skillsPrompt: config.skillsPrompt ?? '',
28
30
  };
29
31
  }
30
32
 
@@ -35,6 +37,7 @@ export class SystemPromptBuilder {
35
37
  this.buildEnvironment(),
36
38
  this.buildPermissionMode(),
37
39
  this.buildProjectInstructions(),
40
+ this.buildSkills(),
38
41
  this.buildDateInfo(),
39
42
  ];
40
43
  return fragments.filter(Boolean).join('\n\n');
@@ -111,6 +114,11 @@ export class SystemPromptBuilder {
111
114
  return '';
112
115
  }
113
116
 
117
+ private buildSkills(): string {
118
+ if (!this.config.skillsPrompt) return '';
119
+ return `## Active Skills\n\n${this.config.skillsPrompt}`;
120
+ }
121
+
114
122
  private buildDateInfo(): string {
115
123
  const now = this.config.date;
116
124
  const iso = now.toISOString().replace('T', ' ').split('.')[0];
@@ -0,0 +1,43 @@
1
+ import type { Skill } from './index.js';
2
+
3
+ export const brainstormingSkill: Skill = {
4
+ id: 'brainstorming',
5
+ name: 'Brainstorming',
6
+ description: 'Explore multiple approaches before committing to a solution',
7
+ category: 'planning',
8
+ autoActivate: ['怎么', 'how to', '方案', 'approach', '有没有', 'alternatives'],
9
+ prompt: `## Brainstorming Mode
10
+
11
+ When exploring solutions, don't jump to the first idea. Instead:
12
+
13
+ ### 1. Generate Options
14
+ List 3-5 different approaches, including at least one unconventional one.
15
+
16
+ ### 2. Evaluate Each
17
+ For each approach, briefly note:
18
+ - **Pros**: What makes it good
19
+ - **Cons**: What could go wrong
20
+ - **Effort**: How much work (quick/medium/heavy)
21
+
22
+ ### 3. Recommend
23
+ Pick the best approach and explain WHY it's the best fit for this specific situation.
24
+
25
+ ### Format
26
+ \`\`\`
27
+ ## Approaches
28
+
29
+ ### Option A: [Name]
30
+ - Pros: ...
31
+ - Cons: ...
32
+ - Effort: medium
33
+
34
+ ### Option B: [Name]
35
+ - Pros: ...
36
+ - Cons: ...
37
+ - Effort: quick
38
+
39
+ **Recommendation**: Option B because [specific reason]
40
+ \`\`\`
41
+
42
+ Don't just list options - give a clear recommendation with reasoning.`,
43
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +1,47 @@
1
+ import type { Skill } from './index.js';
2
+
3
+ export const neuroweaveSkill: Skill = {
4
+ id: 'neuroweave',
5
+ name: 'NeuroWeave Timeline',
6
+ description: 'Project evolution memory - track decisions, changes, and milestones',
7
+ category: 'workflow',
8
+ autoActivate: ['timeline', 'history', 'what changed', 'why was', 'track'],
9
+ prompt: `## NeuroWeave Timeline (NWT)
10
+
11
+ You have access to the NWT tool for tracking project evolution. Use it to:
12
+
13
+ ### When to Log Events
14
+ - **After significant changes**: New features, refactors, bug fixes
15
+ - **When making decisions**: Architecture choices, library selection, design patterns
16
+ - **At milestones**: Feature complete, tests passing, deployment ready
17
+
18
+ ### How to Log
19
+ \`\`\`
20
+ nwt log
21
+ task: "Add user authentication"
22
+ summary: "Implemented JWT-based auth with login/register endpoints"
23
+ reason: "Need user accounts for personalized features"
24
+ files: "src/auth.ts, src/routes/auth.ts"
25
+ tags: "feature, auth, api"
26
+ \`\`\`
27
+
28
+ ### Tags Convention
29
+ - \`feature\` - New functionality
30
+ - \`fix\` - Bug fixes
31
+ - \`refactor\` - Code restructuring
32
+ - \`decision\` - Architecture/design decisions
33
+ - \`milestone\` - Project milestones
34
+ - \`config\` - Configuration changes
35
+ - \`docs\` - Documentation updates
36
+
37
+ ### Auto-log Rule
38
+ After completing a multi-step task, automatically log it to NWT with:
39
+ - task: What was done (imperative)
40
+ - summary: How it was done
41
+ - reason: Why it was done
42
+ - files: What files changed
43
+ - tags: Category labels
44
+
45
+ ### Archives
46
+ Events older than 30 days are automatically archived. Use \`nwt story\` to see the full project narrative.`,
47
+ };