thatgfsj-code 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +10 -5
- package/dist/app/index.js.map +1 -1
- package/dist/cmd/index.js +1 -1
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/skills/brainstorming.d.ts +3 -0
- package/dist/skills/brainstorming.d.ts.map +1 -0
- package/dist/skills/brainstorming.js +42 -0
- package/dist/skills/brainstorming.js.map +1 -0
- package/dist/skills/code-review.d.ts +3 -0
- package/dist/skills/code-review.d.ts.map +1 -0
- package/dist/skills/code-review.js +44 -0
- package/dist/skills/code-review.js.map +1 -0
- package/dist/skills/executing-plans.d.ts +3 -0
- package/dist/skills/executing-plans.d.ts.map +1 -0
- package/dist/skills/executing-plans.js +26 -0
- package/dist/skills/executing-plans.js.map +1 -0
- package/dist/skills/frontend-design.d.ts +3 -0
- package/dist/skills/frontend-design.d.ts.map +1 -0
- package/dist/skills/frontend-design.js +34 -0
- package/dist/skills/frontend-design.js.map +1 -0
- package/dist/skills/git-workflow.d.ts +3 -0
- package/dist/skills/git-workflow.d.ts.map +1 -0
- package/dist/skills/git-workflow.js +35 -0
- package/dist/skills/git-workflow.js.map +1 -0
- package/dist/skills/improve-architecture.d.ts +3 -0
- package/dist/skills/improve-architecture.d.ts.map +1 -0
- package/dist/skills/improve-architecture.js +37 -0
- package/dist/skills/improve-architecture.js.map +1 -0
- package/dist/skills/index.d.ts +50 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +98 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/neuroweave.d.ts +3 -0
- package/dist/skills/neuroweave.d.ts.map +1 -0
- package/dist/skills/neuroweave.js +46 -0
- package/dist/skills/neuroweave.js.map +1 -0
- package/dist/skills/playwright.d.ts +3 -0
- package/dist/skills/playwright.d.ts.map +1 -0
- package/dist/skills/playwright.js +71 -0
- package/dist/skills/playwright.js.map +1 -0
- package/dist/skills/prototype.d.ts +3 -0
- package/dist/skills/prototype.d.ts.map +1 -0
- package/dist/skills/prototype.js +29 -0
- package/dist/skills/prototype.js.map +1 -0
- package/dist/skills/subagent.d.ts +3 -0
- package/dist/skills/subagent.d.ts.map +1 -0
- package/dist/skills/subagent.js +27 -0
- package/dist/skills/subagent.js.map +1 -0
- package/dist/skills/supabase.d.ts +3 -0
- package/dist/skills/supabase.d.ts.map +1 -0
- package/dist/skills/supabase.js +43 -0
- package/dist/skills/supabase.js.map +1 -0
- package/dist/skills/systematic-debugging.d.ts +3 -0
- package/dist/skills/systematic-debugging.d.ts.map +1 -0
- package/dist/skills/systematic-debugging.js +43 -0
- package/dist/skills/systematic-debugging.js.map +1 -0
- package/dist/skills/tdd.d.ts +3 -0
- package/dist/skills/tdd.d.ts.map +1 -0
- package/dist/skills/tdd.js +38 -0
- package/dist/skills/tdd.js.map +1 -0
- package/dist/skills/triage.d.ts +3 -0
- package/dist/skills/triage.d.ts.map +1 -0
- package/dist/skills/triage.js +34 -0
- package/dist/skills/triage.js.map +1 -0
- package/dist/skills/verification.d.ts +3 -0
- package/dist/skills/verification.d.ts.map +1 -0
- package/dist/skills/verification.js +30 -0
- package/dist/skills/verification.js.map +1 -0
- package/dist/skills/writing-plans.d.ts +3 -0
- package/dist/skills/writing-plans.d.ts.map +1 -0
- package/dist/skills/writing-plans.js +41 -0
- package/dist/skills/writing-plans.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nwt.d.ts +70 -0
- package/dist/tools/nwt.d.ts.map +1 -0
- package/dist/tools/nwt.js +289 -0
- package/dist/tools/nwt.js.map +1 -0
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/app.js +6 -6
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/components/ChatList.d.ts +4 -5
- package/dist/tui/components/ChatList.d.ts.map +1 -1
- package/dist/tui/components/ChatList.js +6 -4
- package/dist/tui/components/ChatList.js.map +1 -1
- package/dist/tui/components/ChatMessage.d.ts +2 -1
- package/dist/tui/components/ChatMessage.d.ts.map +1 -1
- package/dist/tui/components/ChatMessage.js +10 -8
- package/dist/tui/components/ChatMessage.js.map +1 -1
- package/dist/tui/components/Header.d.ts +1 -1
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +5 -3
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/StatusBar.d.ts +9 -0
- package/dist/tui/components/StatusBar.d.ts.map +1 -0
- package/dist/tui/components/StatusBar.js +10 -0
- package/dist/tui/components/StatusBar.js.map +1 -0
- package/dist/tui/components/Thinking.js +1 -1
- package/dist/tui/components/Thinking.js.map +1 -1
- package/dist/tui/components/ToolCall.d.ts +2 -1
- package/dist/tui/components/ToolCall.d.ts.map +1 -1
- package/dist/tui/components/ToolCall.js +29 -24
- package/dist/tui/components/ToolCall.js.map +1 -1
- package/dist/tui/components/UserInput.d.ts +1 -1
- package/dist/tui/components/UserInput.d.ts.map +1 -1
- package/dist/tui/components/UserInput.js +19 -42
- package/dist/tui/components/UserInput.js.map +1 -1
- package/dist/tui/hooks/useCommands.d.ts.map +1 -1
- package/dist/tui/hooks/useCommands.js +28 -1
- package/dist/tui/hooks/useCommands.js.map +1 -1
- package/package.json +1 -1
- package/src/app/index.ts +12 -6
- package/src/cmd/index.tsx +1 -1
- package/src/prompts/index.ts +8 -0
- package/src/skills/brainstorming.ts +43 -0
- package/src/skills/code-review.ts +45 -0
- package/src/skills/executing-plans.ts +27 -0
- package/src/skills/frontend-design.ts +35 -0
- package/src/skills/git-workflow.ts +36 -0
- package/src/skills/improve-architecture.ts +38 -0
- package/src/skills/index.ts +136 -0
- package/src/skills/neuroweave.ts +47 -0
- package/src/skills/playwright.ts +72 -0
- package/src/skills/prototype.ts +30 -0
- package/src/skills/subagent.ts +28 -0
- package/src/skills/supabase.ts +44 -0
- package/src/skills/systematic-debugging.ts +44 -0
- package/src/skills/tdd.ts +39 -0
- package/src/skills/triage.ts +35 -0
- package/src/skills/verification.ts +31 -0
- package/src/skills/writing-plans.ts +42 -0
- package/src/tools/index.ts +3 -0
- package/src/tools/nwt.ts +362 -0
- package/src/tui/app.tsx +9 -8
- package/src/tui/components/ChatList.tsx +8 -5
- package/src/tui/components/ChatMessage.tsx +16 -13
- package/src/tui/components/Header.tsx +15 -9
- package/src/tui/components/StatusBar.tsx +30 -0
- package/src/tui/components/Thinking.tsx +3 -3
- package/src/tui/components/ToolCall.tsx +34 -32
- package/src/tui/components/UserInput.tsx +20 -54
- package/src/tui/hooks/useCommands.ts +29 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../../src/tui/components/StatusBar.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAOhC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,EAAE,YAAY,EAAE,MAAM,EAAS;IACpF,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAErE,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,aACtC,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,YAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAQ,EAC7C,MAAC,GAAG,IAAC,cAAc,EAAC,eAAe,EAAC,KAAK,EAAC,MAAM,aAC9C,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,eAAe,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS,EAAC,IAAI,6CAAyB,EAC7E,MAAC,IAAI,IAAC,QAAQ,+BAAK,YAAY,iBAAiB,IAC5C,EACN,KAAC,GAAG,cACD,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,MAAC,IAAI,IAAC,QAAQ,gCAAW,YAAY,EAAE,UAAU,SAAS,CAC3D,GACG,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import Spinner from 'ink-spinner';
|
|
4
4
|
export function Thinking({ message = 'Thinking' }) {
|
|
5
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: "
|
|
5
|
+
return (_jsxs(Box, { paddingLeft: 1, children: [_jsx(Text, { color: "#06B6D4", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { color: "#06B6D4", children: [" ", message] })] }));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=Thinking.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thinking.js","sourceRoot":"","sources":["../../../src/tui/components/Thinking.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,aAAa,CAAC;AAMlC,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,EAAS;IACtD,OAAO,CACL,MAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"Thinking.js","sourceRoot":"","sources":["../../../src/tui/components/Thinking.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,aAAa,CAAC;AAMlC,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,EAAS;IACtD,OAAO,CACL,MAAC,GAAG,IAAC,WAAW,EAAE,CAAC,aACjB,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,YACnB,KAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG,GAClB,EACP,MAAC,IAAI,IAAC,KAAK,EAAC,SAAS,kBAAG,OAAO,IAAQ,IACnC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,8 @@ interface ToolCallData {
|
|
|
8
8
|
}
|
|
9
9
|
interface Props {
|
|
10
10
|
tool: ToolCallData;
|
|
11
|
+
width?: number;
|
|
11
12
|
}
|
|
12
|
-
export declare function ToolCall({ tool }: Props): React.JSX.Element;
|
|
13
|
+
export declare function ToolCall({ tool, width }: Props): React.JSX.Element;
|
|
13
14
|
export type { ToolCallData };
|
|
14
15
|
//# sourceMappingURL=ToolCall.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCall.d.ts","sourceRoot":"","sources":["../../../src/tui/components/ToolCall.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,KAAK;IACb,IAAI,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolCall.d.ts","sourceRoot":"","sources":["../../../src/tui/components/ToolCall.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,KAAK;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmCD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,qBAsB9C;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
function
|
|
3
|
+
function formatToolParams(name, args) {
|
|
4
4
|
try {
|
|
5
5
|
const obj = JSON.parse(args);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
switch (name) {
|
|
7
|
+
case 'file': {
|
|
8
|
+
const action = obj.action || '';
|
|
9
|
+
const path = (obj.path || '').replace(/.*[/\\]/, '');
|
|
10
|
+
return `${action} ${path || obj.path || ''}`;
|
|
11
|
+
}
|
|
12
|
+
case 'shell': return obj.command || '';
|
|
13
|
+
case 'git': return obj.command || '';
|
|
14
|
+
case 'search': return obj.query || obj.pattern || '';
|
|
15
|
+
case 'nwt': return obj.action || '';
|
|
16
|
+
default: {
|
|
17
|
+
const first = Object.entries(obj)[0];
|
|
18
|
+
if (!first)
|
|
19
|
+
return '';
|
|
20
|
+
const val = typeof first[1] === 'string' && first[1].length > 40
|
|
21
|
+
? first[1].slice(0, 40) + '...'
|
|
22
|
+
: JSON.stringify(first[1]);
|
|
23
|
+
return `${first[0]}=${val}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
27
|
catch {
|
|
19
|
-
return args.length >
|
|
28
|
+
return args.length > 50 ? args.slice(0, 50) + '...' : args;
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
|
-
function formatResult(output, maxLines =
|
|
31
|
+
function formatResult(output, maxLines = 10) {
|
|
23
32
|
const lines = output.split('\n');
|
|
24
|
-
if (lines.length <= maxLines)
|
|
33
|
+
if (lines.length <= maxLines)
|
|
25
34
|
return { text: output, truncated: false };
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
text: lines.slice(0, maxLines).join('\n'),
|
|
29
|
-
truncated: true,
|
|
30
|
-
};
|
|
35
|
+
return { text: lines.slice(0, maxLines).join('\n'), truncated: true };
|
|
31
36
|
}
|
|
32
|
-
export function ToolCall({ tool }) {
|
|
33
|
-
const
|
|
37
|
+
export function ToolCall({ tool, width }) {
|
|
38
|
+
const params = formatToolParams(tool.name, tool.args);
|
|
34
39
|
const result = tool.result ? formatResult(tool.result) : null;
|
|
35
|
-
return (_jsxs(Box, { flexDirection: "column",
|
|
40
|
+
return (_jsxs(Box, { borderStyle: "round", borderLeft: true, borderColor: "#06B6D4", paddingLeft: 1, flexDirection: "column", marginBottom: 0, children: [_jsxs(Box, { children: [_jsxs(Text, { color: "#06B6D4", bold: true, children: ["\u2699 ", tool.name, ": "] }), _jsx(Text, { color: "#94A3B8", children: params })] }), result && (_jsxs(Box, { paddingLeft: 1, flexDirection: "column", children: [result.text.split('\n').map((line, i) => (_jsx(Text, { color: tool.isError ? '#EF4444' : '#64748B', children: line }, i))), result.truncated && _jsx(Text, { dimColor: true, children: "..." })] }))] }));
|
|
36
41
|
}
|
|
37
42
|
//# sourceMappingURL=ToolCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCall.js","sourceRoot":"","sources":["../../../src/tui/components/ToolCall.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,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SAAS,EAAC,WAAW,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aAC9G,MAAC,GAAG,eACF,MAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,8BAAI,IAAI,CAAC,IAAI,UAAU,EACjD,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,YAAE,MAAM,GAAQ,IACjC,EACL,MAAM,IAAI,CACT,MAAC,GAAG,IAAC,WAAW,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACxC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACxC,KAAC,IAAI,IAAS,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,YACtD,IAAI,IADI,CAAC,CAEL,CACR,CAAC,EACD,MAAM,CAAC,SAAS,IAAI,KAAC,IAAI,IAAC,QAAQ,0BAAW,IAC1C,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,6 @@ interface Props {
|
|
|
4
4
|
onSubmit: (input: string) => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare const UserInput: React.NamedExoticComponent<Props>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=UserInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserInput.d.ts","sourceRoot":"","sources":["../../../src/tui/components/UserInput.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"UserInput.d.ts","sourceRoot":"","sources":["../../../src/tui/components/UserInput.tsx"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,KAAyB,MAAM,OAAO,CAAC;AAG9C,UAAU,KAAK;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,mCAyDpB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource react */
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useState, memo } from 'react';
|
|
4
4
|
import { Box, Text, useInput, useApp } from 'ink';
|
|
5
|
-
export function UserInput({ onSubmit, disabled }) {
|
|
5
|
+
export const UserInput = memo(function UserInput({ onSubmit, disabled }) {
|
|
6
6
|
const [value, setValue] = useState('');
|
|
7
|
-
const [cursorPos, setCursorPos] = useState(0);
|
|
8
7
|
const [history, setHistory] = useState([]);
|
|
9
8
|
const [historyIdx, setHistoryIdx] = useState(-1);
|
|
10
9
|
const { exit } = useApp();
|
|
@@ -22,61 +21,39 @@ export function UserInput({ onSubmit, disabled }) {
|
|
|
22
21
|
setHistoryIdx(-1);
|
|
23
22
|
onSubmit(trimmed);
|
|
24
23
|
setValue('');
|
|
25
|
-
setCursorPos(0);
|
|
26
24
|
}
|
|
27
25
|
return;
|
|
28
26
|
}
|
|
29
|
-
if (key.upArrow) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
setValue(history[newIdx]);
|
|
34
|
-
setCursorPos(history[newIdx].length);
|
|
35
|
-
}
|
|
27
|
+
if (key.upArrow && history.length > 0) {
|
|
28
|
+
const newIdx = historyIdx === -1 ? history.length - 1 : Math.max(0, historyIdx - 1);
|
|
29
|
+
setHistoryIdx(newIdx);
|
|
30
|
+
setValue(history[newIdx]);
|
|
36
31
|
return;
|
|
37
32
|
}
|
|
38
|
-
if (key.downArrow) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setValue('');
|
|
44
|
-
setCursorPos(0);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setHistoryIdx(newIdx);
|
|
48
|
-
setValue(history[newIdx]);
|
|
49
|
-
setCursorPos(history[newIdx].length);
|
|
50
|
-
}
|
|
33
|
+
if (key.downArrow && historyIdx >= 0) {
|
|
34
|
+
const newIdx = historyIdx + 1;
|
|
35
|
+
if (newIdx >= history.length) {
|
|
36
|
+
setHistoryIdx(-1);
|
|
37
|
+
setValue('');
|
|
51
38
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (cursorPos > 0) {
|
|
56
|
-
setValue(v => v.slice(0, cursorPos - 1) + v.slice(cursorPos));
|
|
57
|
-
setCursorPos(p => p - 1);
|
|
39
|
+
else {
|
|
40
|
+
setHistoryIdx(newIdx);
|
|
41
|
+
setValue(history[newIdx]);
|
|
58
42
|
}
|
|
59
43
|
return;
|
|
60
44
|
}
|
|
61
|
-
if (key.
|
|
62
|
-
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (key.rightArrow) {
|
|
66
|
-
setCursorPos(p => Math.min(value.length, p + 1));
|
|
45
|
+
if (key.backspace || key.delete) {
|
|
46
|
+
setValue(v => v.slice(0, -1));
|
|
67
47
|
return;
|
|
68
48
|
}
|
|
69
49
|
if (key.ctrl && input === 'c') {
|
|
70
50
|
exit();
|
|
71
51
|
return;
|
|
72
52
|
}
|
|
73
|
-
// Regular character input
|
|
74
53
|
if (input && !key.ctrl && !key.meta) {
|
|
75
|
-
setValue(v => v
|
|
76
|
-
setCursorPos(p => p + input.length);
|
|
54
|
+
setValue(v => v + input);
|
|
77
55
|
}
|
|
78
56
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
57
|
+
return (_jsxs(Box, { paddingY: 0, children: [_jsx(Text, { color: "#06B6D4", bold: true, children: disabled ? ' ' : '❯ ' }), _jsx(Text, { children: value }), !disabled && _jsx(Text, { color: "#06B6D4", children: "\u2588" })] }));
|
|
58
|
+
});
|
|
82
59
|
//# sourceMappingURL=UserInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserInput.js","sourceRoot":"","sources":["../../../src/tui/components/UserInput.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAc,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"UserInput.js","sourceRoot":"","sources":["../../../src/tui/components/UserInput.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAOlD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAS;IAC5E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAE1B,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACtB,IAAI,QAAQ;YAAE,OAAO;QAErB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAC7B,IAAI,OAAO,EAAE,CAAC;gBACZ,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;oBAAC,IAAI,EAAE,CAAC;oBAAC,OAAO;gBAAC,CAAC;gBACjE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAA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AAC,CAAC;QAElD,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACpC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,MAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,aACd,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,kBAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAQ,EAC1D,KAAC,IAAI,cAAE,KAAK,GAAQ,EACnB,CAAC,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,uBAAS,IACxC,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommands.d.ts","sourceRoot":"","sources":["../../../src/tui/hooks/useCommands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAE9C,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG;2BACQ,MAAM,KAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"useCommands.d.ts","sourceRoot":"","sources":["../../../src/tui/hooks/useCommands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAE9C,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG;2BACQ,MAAM,KAAG,aAAa;EAiFjE"}
|
|
@@ -40,9 +40,36 @@ export function useCommands(app) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
case 'clear':
|
|
43
|
-
// Handled separately in the App component
|
|
44
43
|
return { handled: true };
|
|
45
44
|
default:
|
|
45
|
+
// Handle /skill commands
|
|
46
|
+
if (cmd.startsWith('skill') || cmd.startsWith('/skill')) {
|
|
47
|
+
const parts = input.trim().split(/\s+/);
|
|
48
|
+
const sub = parts[1] || 'list';
|
|
49
|
+
if (sub === 'list') {
|
|
50
|
+
const all = app.skills.list();
|
|
51
|
+
const lines = all.map(s => {
|
|
52
|
+
const active = app.skills.isActive(s.id) ? '✓' : ' ';
|
|
53
|
+
return ` [${active}] ${s.name.padEnd(28)} ${s.description}`;
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
handled: true,
|
|
57
|
+
output: ['Skills ([✓] = active):', ...lines, '', 'Usage: skill <id> to toggle'].join('\n'),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Toggle skill
|
|
61
|
+
const skillId = sub;
|
|
62
|
+
if (app.skills.isActive(skillId)) {
|
|
63
|
+
app.skills.deactivate(skillId);
|
|
64
|
+
return { handled: true, output: ` Deactivated: ${skillId}` };
|
|
65
|
+
}
|
|
66
|
+
else if (app.skills.activate(skillId)) {
|
|
67
|
+
return { handled: true, output: ` Activated: ${skillId}` };
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return { handled: true, output: ` Unknown skill: ${skillId}` };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
46
73
|
return { handled: false };
|
|
47
74
|
}
|
|
48
75
|
}, [app]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommands.js","sourceRoot":"","sources":["../../../src/tui/hooks/useCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAQpC,MAAM,UAAU,WAAW,CAAC,GAAQ;IAClC,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,KAAa,EAAiB,EAAE;QACjE,MAAM,GAAG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G,CAAC;oBACpB,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;wBACjC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAC/B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,OAAO,EAAE,EAAE,CAAC;oBAChE,CAAC;yBAAM,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;wBACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,OAAO,EAAE,EAAE,CAAC;oBAC9D,CAAC;yBAAM,CAAC;wBACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,oBAAoB,OAAO,EAAE,EAAE,CAAC;oBAClE,CAAC;gBACH,CAAC;gBAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
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> {
|
|
@@ -43,19 +47,21 @@ export class App {
|
|
|
43
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
|
/**
|
package/src/cmd/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@ process.on('unhandledRejection', (reason) => {
|
|
|
39
39
|
program
|
|
40
40
|
.name('gfcode')
|
|
41
41
|
.description('Thatgfsj Code - AI Coding Assistant')
|
|
42
|
-
.version('0.
|
|
42
|
+
.version('0.7.1')
|
|
43
43
|
.argument('[prompt]', 'Task to execute (omit to start interactive mode)')
|
|
44
44
|
.option('-m, --model <model>', 'Specify model')
|
|
45
45
|
.option('-i, --interactive', 'Force interactive mode')
|
package/src/prompts/index.ts
CHANGED
|
@@ -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
|
+
};
|