thatgfsj-code 3.0.4 → 3.0.7

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 (205) hide show
  1. package/README.md +64 -21
  2. package/dist/app/index.d.ts +93 -22
  3. package/dist/app/index.d.ts.map +1 -1
  4. package/dist/app/index.js +232 -40
  5. package/dist/app/index.js.map +1 -1
  6. package/dist/cmd/index.d.ts +12 -20
  7. package/dist/cmd/index.d.ts.map +1 -1
  8. package/dist/cmd/index.js +192 -146
  9. package/dist/cmd/index.js.map +1 -1
  10. package/dist/config/index.d.ts +4 -0
  11. package/dist/config/index.d.ts.map +1 -1
  12. package/dist/config/index.js +5 -0
  13. package/dist/config/index.js.map +1 -1
  14. package/dist/config/types.d.ts +5 -0
  15. package/dist/config/types.d.ts.map +1 -1
  16. package/dist/llm/anthropic.d.ts +1 -1
  17. package/dist/llm/anthropic.d.ts.map +1 -1
  18. package/dist/llm/anthropic.js +116 -84
  19. package/dist/llm/anthropic.js.map +1 -1
  20. package/dist/llm/gemini.d.ts +27 -3
  21. package/dist/llm/gemini.d.ts.map +1 -1
  22. package/dist/llm/gemini.js +196 -73
  23. package/dist/llm/gemini.js.map +1 -1
  24. package/dist/llm/index.d.ts +20 -1
  25. package/dist/llm/index.d.ts.map +1 -1
  26. package/dist/llm/index.js +66 -6
  27. package/dist/llm/index.js.map +1 -1
  28. package/dist/llm/openai.d.ts +5 -1
  29. package/dist/llm/openai.d.ts.map +1 -1
  30. package/dist/llm/openai.js +126 -66
  31. package/dist/llm/openai.js.map +1 -1
  32. package/dist/mcp/client.d.ts +84 -34
  33. package/dist/mcp/client.d.ts.map +1 -1
  34. package/dist/mcp/client.js +291 -126
  35. package/dist/mcp/client.js.map +1 -1
  36. package/dist/session/compactor.d.ts +27 -7
  37. package/dist/session/compactor.d.ts.map +1 -1
  38. package/dist/session/compactor.js +78 -23
  39. package/dist/session/compactor.js.map +1 -1
  40. package/dist/session/index.d.ts +96 -33
  41. package/dist/session/index.d.ts.map +1 -1
  42. package/dist/session/index.js +278 -60
  43. package/dist/session/index.js.map +1 -1
  44. package/dist/tools/file.d.ts +10 -2
  45. package/dist/tools/file.d.ts.map +1 -1
  46. package/dist/tools/file.js +54 -5
  47. package/dist/tools/file.js.map +1 -1
  48. package/dist/tools/git.d.ts +16 -2
  49. package/dist/tools/git.d.ts.map +1 -1
  50. package/dist/tools/git.js +61 -18
  51. package/dist/tools/git.js.map +1 -1
  52. package/dist/tools/nwt.d.ts.map +1 -1
  53. package/dist/tools/nwt.js +8 -1
  54. package/dist/tools/nwt.js.map +1 -1
  55. package/dist/tools/search.d.ts +8 -1
  56. package/dist/tools/search.d.ts.map +1 -1
  57. package/dist/tools/search.js +105 -34
  58. package/dist/tools/search.js.map +1 -1
  59. package/dist/tools/shell.d.ts +0 -4
  60. package/dist/tools/shell.d.ts.map +1 -1
  61. package/dist/tools/shell.js +11 -26
  62. package/dist/tools/shell.js.map +1 -1
  63. package/dist/tools/types.d.ts +7 -0
  64. package/dist/tools/types.d.ts.map +1 -1
  65. package/dist/tools/types.js.map +1 -1
  66. package/dist/tui/app.d.ts.map +1 -1
  67. package/dist/tui/app.js +90 -18
  68. package/dist/tui/app.js.map +1 -1
  69. package/dist/tui/components/ChatMessage.d.ts.map +1 -1
  70. package/dist/tui/components/ChatMessage.js +9 -2
  71. package/dist/tui/components/ChatMessage.js.map +1 -1
  72. package/dist/tui/components/ConfirmPrompt.d.ts +21 -0
  73. package/dist/tui/components/ConfirmPrompt.d.ts.map +1 -0
  74. package/dist/tui/components/ConfirmPrompt.js +45 -0
  75. package/dist/tui/components/ConfirmPrompt.js.map +1 -0
  76. package/dist/tui/components/Header.d.ts +10 -5
  77. package/dist/tui/components/Header.d.ts.map +1 -1
  78. package/dist/tui/components/Header.js +13 -5
  79. package/dist/tui/components/Header.js.map +1 -1
  80. package/dist/tui/components/StatusBar.d.ts +7 -0
  81. package/dist/tui/components/StatusBar.d.ts.map +1 -1
  82. package/dist/tui/components/StatusBar.js +8 -3
  83. package/dist/tui/components/StatusBar.js.map +1 -1
  84. package/dist/tui/components/Thinking.d.ts +5 -0
  85. package/dist/tui/components/Thinking.d.ts.map +1 -1
  86. package/dist/tui/components/Thinking.js +24 -2
  87. package/dist/tui/components/Thinking.js.map +1 -1
  88. package/dist/tui/components/ToolCall.d.ts +6 -1
  89. package/dist/tui/components/ToolCall.d.ts.map +1 -1
  90. package/dist/tui/components/ToolCall.js +50 -22
  91. package/dist/tui/components/ToolCall.js.map +1 -1
  92. package/dist/tui/components/UserInput.d.ts +5 -0
  93. package/dist/tui/components/UserInput.d.ts.map +1 -1
  94. package/dist/tui/components/UserInput.js +9 -13
  95. package/dist/tui/components/UserInput.js.map +1 -1
  96. package/dist/tui/hooks/useChat.d.ts +1 -0
  97. package/dist/tui/hooks/useChat.d.ts.map +1 -1
  98. package/dist/tui/hooks/useChat.js +36 -16
  99. package/dist/tui/hooks/useChat.js.map +1 -1
  100. package/dist/tui/hooks/useCommands.d.ts +7 -1
  101. package/dist/tui/hooks/useCommands.d.ts.map +1 -1
  102. package/dist/tui/hooks/useCommands.js +77 -41
  103. package/dist/tui/hooks/useCommands.js.map +1 -1
  104. package/dist/tui/theme.d.ts +34 -0
  105. package/dist/tui/theme.d.ts.map +1 -0
  106. package/dist/tui/theme.js +34 -0
  107. package/dist/tui/theme.js.map +1 -0
  108. package/dist/tui/welcome.d.ts.map +1 -1
  109. package/dist/tui/welcome.js +9 -7
  110. package/dist/tui/welcome.js.map +1 -1
  111. package/dist/types.d.ts +16 -1
  112. package/dist/types.d.ts.map +1 -1
  113. package/dist/utils/diff.d.ts +5 -0
  114. package/dist/utils/diff.d.ts.map +1 -1
  115. package/dist/utils/diff.js +15 -0
  116. package/dist/utils/diff.js.map +1 -1
  117. package/dist/version.d.ts +12 -0
  118. package/dist/version.d.ts.map +1 -0
  119. package/dist/version.js +29 -0
  120. package/dist/version.js.map +1 -0
  121. package/package.json +19 -7
  122. package/CHANGELOG.md +0 -192
  123. package/DEVELOPMENT.md +0 -286
  124. package/ROADMAP.md +0 -91
  125. package/docs/API_KEY_GUIDE.md +0 -236
  126. package/docs/FAQ.md +0 -182
  127. package/install.bat +0 -63
  128. package/install.ps1 +0 -238
  129. package/install.sh +0 -113
  130. package/src/app/index.ts +0 -197
  131. package/src/cache/fingerprint.ts +0 -101
  132. package/src/cache/index.ts +0 -21
  133. package/src/cache/smartModel.ts +0 -133
  134. package/src/cache/stats.ts +0 -199
  135. package/src/cache/volatile.ts +0 -47
  136. package/src/cmd/index.tsx +0 -288
  137. package/src/config/index.ts +0 -156
  138. package/src/config/providers.ts +0 -234
  139. package/src/config/types.ts +0 -71
  140. package/src/hooks/index.ts +0 -111
  141. package/src/llm/anthropic.ts +0 -413
  142. package/src/llm/gemini.ts +0 -169
  143. package/src/llm/index.ts +0 -303
  144. package/src/llm/openai.ts +0 -243
  145. package/src/llm/provider.ts +0 -71
  146. package/src/mcp/client.ts +0 -330
  147. package/src/prompts/index.ts +0 -260
  148. package/src/session/compactor.ts +0 -103
  149. package/src/session/index.ts +0 -181
  150. package/src/session/message.ts +0 -42
  151. package/src/skills/brainstorming.ts +0 -43
  152. package/src/skills/code-review.ts +0 -45
  153. package/src/skills/executing-plans.ts +0 -27
  154. package/src/skills/frontend-design.ts +0 -35
  155. package/src/skills/git-workflow.ts +0 -36
  156. package/src/skills/improve-architecture.ts +0 -38
  157. package/src/skills/index.ts +0 -136
  158. package/src/skills/neuroweave.ts +0 -47
  159. package/src/skills/playwright.ts +0 -72
  160. package/src/skills/prototype.ts +0 -30
  161. package/src/skills/subagent.ts +0 -28
  162. package/src/skills/supabase.ts +0 -44
  163. package/src/skills/systematic-debugging.ts +0 -44
  164. package/src/skills/tdd.ts +0 -39
  165. package/src/skills/triage.ts +0 -35
  166. package/src/skills/verification.ts +0 -31
  167. package/src/skills/writing-plans.ts +0 -42
  168. package/src/tools/file.ts +0 -143
  169. package/src/tools/git.ts +0 -132
  170. package/src/tools/index.ts +0 -111
  171. package/src/tools/nwt.ts +0 -598
  172. package/src/tools/search.ts +0 -263
  173. package/src/tools/shell.ts +0 -136
  174. package/src/tools/types.ts +0 -122
  175. package/src/tui/app.tsx +0 -159
  176. package/src/tui/components/ChatList.tsx +0 -41
  177. package/src/tui/components/ChatMessage.tsx +0 -54
  178. package/src/tui/components/Header.tsx +0 -66
  179. package/src/tui/components/InitWizard.tsx +0 -247
  180. package/src/tui/components/Markdown.tsx +0 -35
  181. package/src/tui/components/ModelSelector.tsx +0 -107
  182. package/src/tui/components/StatusBar.tsx +0 -30
  183. package/src/tui/components/Thinking.tsx +0 -17
  184. package/src/tui/components/ToolCall.tsx +0 -102
  185. package/src/tui/components/UserInput.tsx +0 -151
  186. package/src/tui/hooks/useChat.ts +0 -287
  187. package/src/tui/hooks/useCommands.ts +0 -271
  188. package/src/tui/index.ts +0 -6
  189. package/src/tui/welcome.ts +0 -177
  190. package/src/types.ts +0 -104
  191. package/src/utils/diff.ts +0 -71
  192. package/src/utils/project.ts +0 -99
  193. package/src/utils/stableStringify.ts +0 -47
  194. package/src/utils/thinking.ts +0 -119
  195. package/tests/cache/fingerprint.test.ts +0 -75
  196. package/tests/cache/providerCatalog.test.ts +0 -31
  197. package/tests/cache/smartModel.test.ts +0 -100
  198. package/tests/cache/stableStringify.test.ts +0 -43
  199. package/tests/cache/stats.test.ts +0 -146
  200. package/tests/cache/volatile.test.ts +0 -75
  201. package/tests/smoke-pollution.mjs +0 -78
  202. package/tests/smoke-thinking.mjs +0 -110
  203. package/tests/smoke-tool-stream.mjs +0 -69
  204. package/tests/smoke-tool.mjs +0 -117
  205. package/tsconfig.json +0 -21
@@ -1,181 +0,0 @@
1
- /**
2
- * Session Manager - Manages conversation history with auto-compaction
3
- */
4
-
5
- import type { ChatMessage } from '../types.js';
6
- import { ContextCompactor } from './compactor.js';
7
-
8
- /**
9
- * v2.2.4 (port from v2.1.0): patterns that, if found in an assistant
10
- * message, indicate the message is a truncated/aborted response that
11
- * should NOT be persisted into history. Without this filter, the next
12
- * turn's LLM sees the marker and starts echoing it back, creating a
13
- * self-reinforcing "[已中断]" hallucination loop.
14
- *
15
- * v2.2.6.1 tightening (smoke-test driven): the design here is a
16
- * two-tier check:
17
- * 1. STRONG markers — unambiguous pollution, always drop:
18
- * - `[已中断]` bracketed (the model emits this exact form)
19
- * - `[interrupted]` bracketed English equivalent
20
- * 2. WEAK markers — only drop if the message is also short (<200
21
- * chars). Long messages mentioning "response truncated" are
22
- * legitimate conversation (e.g. user complaints about past
23
- * behavior), not pollution.
24
- *
25
- * Earlier drafts matched bare `已中断` substrings and "response
26
- * truncated" anywhere in the message — both were too greedy and
27
- * dropped legitimate Chinese/English conversation.
28
- */
29
- const POLLUTION_STRONG: RegExp[] = [
30
- /\[已中断\]/,
31
- /\[interrupted\]/i,
32
- ];
33
-
34
- const POLLUTION_WEAK: RegExp[] = [
35
- /^\s*[\*#>\-`]*\s*\[已中断\]/m,
36
- /^\s*[\*#>\-`]*\s*\[interrupted\]/im,
37
- /\bresponse (was )?(truncated|cut off|interrupted)\b/i,
38
- /\boutput (was )?(truncated|cut off|interrupted)\b/i,
39
- ];
40
-
41
- function looksPolluted(content: string): boolean {
42
- if (!content) return false;
43
- if (POLLUTION_STRONG.some(p => p.test(content))) return true;
44
- // WEAK pattern gate:
45
- // - Message must be short (model got cut off mid-stream, so it
46
- // can't be long)
47
- // - Message must NOT end with '?' (questions are user complaints
48
- // about past behavior, not pollution)
49
- // - Message must NOT contain "last time" / "earlier" / "before"
50
- // (temporal references indicate user discussing past behavior)
51
- if (content.length >= 200) return false;
52
- if (/\?\s*$/.test(content.trim())) return false;
53
- if (/\b(last time|earlier|before|previously|yesterday)\b/i.test(content)) return false;
54
- if (POLLUTION_WEAK.some(p => p.test(content))) return true;
55
- return false;
56
- }
57
-
58
- export class SessionManager {
59
- private messages: ChatMessage[] = [];
60
- private sessionId: string;
61
- private createdAt: Date;
62
- private compactor: ContextCompactor;
63
- private maxMessages: number;
64
- /** v2.2.4: counter for messages dropped by the pollution filter. */
65
- private droppedCount: number = 0;
66
- /**
67
- * v3.0.0: callback invoked when the message count exceeds maxMessages.
68
- * Reasonix principle: do not mutate messages to compact; instead, signal
69
- * the TUI to suggest the user call /new (start a fresh session) so that
70
- * the upstream prompt cache keeps a stable prefix. NWT auto-logs every
71
- * meaningful event, so no history is lost — it just moves out of the
72
- * live cache window.
73
- */
74
- public onSuggestNewSession?: (info: { currentLength: number; max: number }) => void;
75
-
76
- constructor(maxMessages = 50, options?: { onSuggestNewSession?: SessionManager['onSuggestNewSession'] }) {
77
- this.maxMessages = maxMessages;
78
- this.sessionId = `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
79
- this.createdAt = new Date();
80
- this.compactor = new ContextCompactor({ maxMessages });
81
- this.onSuggestNewSession = options?.onSuggestNewSession;
82
- }
83
-
84
- addMessage(role: ChatMessage['role'], content: string, extras?: Partial<ChatMessage>): void {
85
- this.messages.push({ role, content, ...extras });
86
- this.autoCompact();
87
- }
88
-
89
- /**
90
- * v2.2.4 (port from v2.1.0): same as addMessage but returns false
91
- * (and skips the push) if the message content matches a known
92
- * truncation/abort pollution pattern. Use this for assistant
93
- * messages whose stream might have been aborted.
94
- */
95
- addMessageSafe(role: ChatMessage['role'], content: string, extras?: Partial<ChatMessage>): boolean {
96
- if (role === 'assistant' && looksPolluted(content)) {
97
- this.droppedCount++;
98
- return false;
99
- }
100
- this.addMessage(role, content, extras);
101
- return true;
102
- }
103
-
104
- /** v2.2.4: total messages dropped by addMessageSafe since session start. */
105
- getDroppedCount(): number {
106
- return this.droppedCount;
107
- }
108
-
109
- getMessages(): ChatMessage[] {
110
- return [...this.messages];
111
- }
112
-
113
- getMessageCount(): number {
114
- return this.messages.length;
115
- }
116
-
117
- clear(): void {
118
- this.messages = [];
119
- }
120
-
121
- /**
122
- * v3.0.0: "auto-compact" is now a no-op on `messages`. We instead invoke
123
- * the registered `onSuggestNewSession` callback (if any) so the TUI can
124
- * surface a "context is getting long, consider /new" hint. This keeps
125
- * the messages array byte-stable across rounds, which is critical for
126
- * prompt-cache hit-rate: any reordering or summary insertion would
127
- * invalidate every cache breakpoint the upstream provider has set.
128
- *
129
- * Rationale (Reasonix-style): when context exceeds the model window or
130
- * the configured maxMessages threshold, the right action is to start a
131
- * NEW session, not to silently truncate or summarize. NWT auto-logs
132
- * every meaningful event, so the user does not lose context — it just
133
- * moves out of the live cache window. If the user wants a longer
134
- * session, they can bump maxMessages in `~/.thatgfsj/config.json`.
135
- *
136
- * The original "fake compact" logic (insert `[Earlier conversation...]`
137
- * summary) is preserved as `truncate()` for callers that explicitly
138
- * want to compact (e.g. /new command hard-reset).
139
- */
140
- private autoCompact(): void {
141
- if (this.messages.length <= this.maxMessages) return;
142
-
143
- // Notify the TUI. The default TUI behavior is to render a toast:
144
- // ⚠️ 上下文超长({currentLength}/{max}),建议调 /new 开新会话
145
- // (NWT 已自动归档历史)
146
- try {
147
- this.onSuggestNewSession?.({
148
- currentLength: this.messages.length,
149
- max: this.maxMessages,
150
- });
151
- } catch {
152
- // Callback failure must not break the chat loop.
153
- }
154
- // Intentionally do NOT mutate this.messages. Prefix stability matters more.
155
- }
156
-
157
- truncate(maxMessages?: number): void {
158
- if (maxMessages) {
159
- this.maxMessages = maxMessages;
160
- this.compactor = new ContextCompactor({ maxMessages });
161
- }
162
- const { compacted } = this.compactor.compact(this.messages);
163
- this.messages = compacted;
164
- }
165
-
166
- getId(): string {
167
- return this.sessionId;
168
- }
169
-
170
- getInfo(): { id: string; messageCount: number; createdAt: Date } {
171
- return {
172
- id: this.sessionId,
173
- messageCount: this.messages.length,
174
- createdAt: this.createdAt,
175
- };
176
- }
177
- }
178
-
179
- export { ContextCompactor } from './compactor.js';
180
- export type { CompactorConfig, CompressionResult } from './compactor.js';
181
- export * from './message.js';
@@ -1,42 +0,0 @@
1
- /**
2
- * Message types and utilities
3
- */
4
-
5
- import type { ChatMessage, Role } from '../types.js';
6
-
7
- export { ChatMessage, Role };
8
-
9
- /**
10
- * Create a message
11
- */
12
- export function createMessage(role: Role, content: string, extras?: Partial<ChatMessage>): ChatMessage {
13
- return { role, content, ...extras };
14
- }
15
-
16
- /**
17
- * Create a system message
18
- */
19
- export function systemMessage(content: string): ChatMessage {
20
- return { role: 'system', content };
21
- }
22
-
23
- /**
24
- * Create a user message
25
- */
26
- export function userMessage(content: string): ChatMessage {
27
- return { role: 'user', content };
28
- }
29
-
30
- /**
31
- * Create an assistant message
32
- */
33
- export function assistantMessage(content: string): ChatMessage {
34
- return { role: 'assistant', content };
35
- }
36
-
37
- /**
38
- * Create a tool result message
39
- */
40
- export function toolMessage(content: string, toolCallId: string, name: string): ChatMessage {
41
- return { role: 'tool', content, tool_call_id: toolCallId, name };
42
- }
@@ -1,43 +0,0 @@
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
- };
@@ -1,45 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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,136 +0,0 @@
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,47 +0,0 @@
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
- };