thatgfsj-code 0.7.5 → 0.7.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.
package/dist/cmd/index.js CHANGED
@@ -24,7 +24,7 @@ process.on('unhandledRejection', (reason) => {
24
24
  program
25
25
  .name('gfcode')
26
26
  .description('Thatgfsj Code - AI Coding Assistant')
27
- .version('0.7.5')
27
+ .version('0.7.7')
28
28
  .argument('[prompt]', 'Task to execute (omit to start interactive mode)')
29
29
  .option('-m, --model <model>', 'Specify model')
30
30
  .option('-i, --interactive', 'Force interactive mode')
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * System Prompt Builder - Dynamic prompt construction
3
- * Migrated from old src/core/system-prompt.ts
4
3
  */
5
4
  import type { Tool } from '../tools/types.js';
6
5
  export interface SystemPromptConfig {
@@ -19,7 +18,14 @@ export declare class SystemPromptBuilder {
19
18
  private buildToolInstructions;
20
19
  private buildEnvironment;
21
20
  private buildPermissionMode;
21
+ /**
22
+ * Read ALL matching project instruction files (not just the first one)
23
+ */
22
24
  private buildProjectInstructions;
25
+ /**
26
+ * Auto-inject recent NWT history into system prompt
27
+ */
28
+ private buildNwtHistory;
23
29
  private buildSkills;
24
30
  private buildDateInfo;
25
31
  setTools(tools: Tool[]): this;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;IAC3C,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC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WAAW;IAKnB,OAAO,CAAC,aAAa;IAMrB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAC7B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IACzB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI;CACzD"}
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * System Prompt Builder - Dynamic prompt construction
3
- * Migrated from old src/core/system-prompt.ts
4
3
  */
5
- import { readFileSync, existsSync } from 'fs';
4
+ import { readFileSync, existsSync, readdirSync } from 'fs';
6
5
  import { join } from 'path';
7
6
  export class SystemPromptBuilder {
8
7
  config;
@@ -23,6 +22,7 @@ export class SystemPromptBuilder {
23
22
  this.buildEnvironment(),
24
23
  this.buildPermissionMode(),
25
24
  this.buildProjectInstructions(),
25
+ this.buildNwtHistory(),
26
26
  this.buildSkills(),
27
27
  this.buildDateInfo(),
28
28
  ];
@@ -32,14 +32,15 @@ export class SystemPromptBuilder {
32
32
  return [
33
33
  'You are Thatgfsj Code, an interactive coding agent running in the user\'s terminal.',
34
34
  '',
35
- 'You have access to tools (file operations, shell commands, git, search) that let you',
36
- 'read, write, and modify files and run commands to help with coding tasks.',
35
+ 'You have access to tools (file operations, shell commands, git, search, nwt) that let you',
36
+ 'read, write, and modify files, run commands, and track project evolution.',
37
37
  '',
38
38
  'When working on a task:',
39
39
  '1. First understand what files are involved',
40
40
  '2. Read necessary files to understand the codebase',
41
41
  '3. Make changes using appropriate tools',
42
42
  '4. Verify the changes work',
43
+ '5. Log important changes to NWT (nwt log)',
43
44
  '',
44
45
  'Be concise but thorough. Show your reasoning.',
45
46
  '',
@@ -51,16 +52,15 @@ export class SystemPromptBuilder {
51
52
  }
52
53
  buildToolInstructions() {
53
54
  const tools = this.config.tools;
54
- if (tools.length === 0) {
55
+ if (tools.length === 0)
55
56
  return '## Tools\n\nNo tools are currently registered.';
56
- }
57
57
  const toolDescs = tools.map(t => {
58
58
  const params = t.parameters
59
59
  .map(p => ` - ${p.name} (${p.type}${p.required ? ', required' : ''}): ${p.description}`)
60
60
  .join('\n');
61
61
  return `### ${t.name}\n${t.description}\n\nParameters:\n${params}`;
62
62
  }).join('\n\n');
63
- return `## Tools\n\nYou have access to the following tools:\n\n${toolDescs}\n\nTo use a tool, respond with a tool call. Each tool call must include the tool name and parameters as a JSON object.`;
63
+ return `## Tools\n\nYou have access to the following tools:\n\n${toolDescs}\n\nTo use a tool, respond with a tool call.`;
64
64
  }
65
65
  buildEnvironment() {
66
66
  return `## Environment\n\nWorking directory: ${this.config.cwd}`;
@@ -74,12 +74,17 @@ export class SystemPromptBuilder {
74
74
  };
75
75
  return `## Permission Mode\n\nCurrent mode: ${mode}\n\n${explanations[mode] || ''}`;
76
76
  }
77
+ /**
78
+ * Read ALL matching project instruction files (not just the first one)
79
+ */
77
80
  buildProjectInstructions() {
78
81
  if (!this.config.includeProjectMd)
79
82
  return '';
80
83
  const cwd = this.config.cwd;
81
84
  const home = process.env.USERPROFILE || process.env.HOME || '';
85
+ // All paths to check
82
86
  const paths = [
87
+ // Project-level
83
88
  join(cwd, 'CLAUDE.md'),
84
89
  join(cwd, '.claude.md'),
85
90
  join(cwd, 'AGENTS.md'),
@@ -87,22 +92,64 @@ export class SystemPromptBuilder {
87
92
  join(cwd, '.Codex.md'),
88
93
  join(cwd, 'CODEX.md'),
89
94
  join(cwd, '.codex.md'),
95
+ // User-level
96
+ join(home, '.claude', 'CLAUDE.md'),
97
+ join(home, '.claude', 'SKILLS.md'),
90
98
  join(home, '.Codex', 'SKILLS.md'),
99
+ join(home, '.Codex', 'AGENTS.md'),
91
100
  join(home, '.agents', 'AGENTS.md'),
92
- join(home, '.claude', 'CLAUDE.md'),
93
101
  ];
102
+ const sections = [];
94
103
  for (const path of paths) {
95
104
  if (existsSync(path)) {
96
105
  try {
97
- const content = readFileSync(path, 'utf-8');
98
- return `## Project Instructions (from ${path.split(/[/\\]/).pop()})\n\n${content}`;
106
+ const content = readFileSync(path, 'utf-8').trim();
107
+ if (content) {
108
+ const filename = path.split(/[/\\]/).pop();
109
+ sections.push(`### From ${filename}\n\n${content}`);
110
+ }
99
111
  }
100
112
  catch {
101
- // Ignore
113
+ // Skip unreadable files
102
114
  }
103
115
  }
104
116
  }
105
- return '';
117
+ if (sections.length === 0)
118
+ return '';
119
+ return `## Project Instructions\n\n${sections.join('\n\n---\n\n')}`;
120
+ }
121
+ /**
122
+ * Auto-inject recent NWT history into system prompt
123
+ */
124
+ buildNwtHistory() {
125
+ try {
126
+ const nwtDir = join(this.config.cwd, '.nwt', 'events');
127
+ if (!existsSync(nwtDir))
128
+ return '';
129
+ const files = readdirSync(nwtDir)
130
+ .filter(f => f.endsWith('.json'))
131
+ .sort()
132
+ .slice(-10); // Last 10 events
133
+ if (files.length === 0)
134
+ return '';
135
+ const events = files.map(f => {
136
+ try {
137
+ const ev = JSON.parse(readFileSync(join(nwtDir, f), 'utf-8'));
138
+ const time = ev.timestamp?.split('T')[0] || '';
139
+ const files = ev.files?.length > 0 ? ` [${ev.files.join(', ')}]` : '';
140
+ return `- [${ev.id}] ${time} ${ev.task}: ${ev.summary}${files}`;
141
+ }
142
+ catch {
143
+ return null;
144
+ }
145
+ }).filter(Boolean);
146
+ if (events.length === 0)
147
+ return '';
148
+ return `## Project History (NWT)\n\nRecent evolution events:\n\n${events.join('\n')}`;
149
+ }
150
+ catch {
151
+ return '';
152
+ }
106
153
  }
107
154
  buildSkills() {
108
155
  if (!this.config.skillsPrompt)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY5B,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAA+B;IAE7C,YAAY,SAA6B,EAAE;QACzC,IAA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C,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,OAAO,sBAAsB,GAAG,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ,CAAC,KAAa,IAAU,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;IACzE,MAAM,CAAC,GAAW,IAAU,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;IACjE,iBAAiB,CAAC,IAA+B,IAAU,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;CAC7G"}
@@ -3,6 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React from 'react';
4
4
  import { Box, Text } from 'ink';
5
5
  export const Header = React.memo(function Header({ provider, model }) {
6
- return (_jsxs(Box, { flexDirection: "column", marginBottom: 0, children: [_jsxs(Box, { justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [_jsx(Text, { color: "#06B6D4", bold: true, children: " \u26A1 " }), _jsx(Text, { color: "#22D3EE", bold: true, children: "THATGFSJ CODE" }), _jsx(Text, { dimColor: true, children: " v0.7.5" })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#06B6D4", bold: true, children: [" ", provider, " "] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: "#22D3EE", children: [" ", model, " "] })] })] }), _jsx(Text, { color: "#374151", children: '─'.repeat(80) })] }));
6
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 0, children: [_jsxs(Box, { justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [_jsx(Text, { color: "#06B6D4", bold: true, children: " \u26A1 " }), _jsx(Text, { color: "#22D3EE", bold: true, children: "THATGFSJ CODE" }), _jsx(Text, { dimColor: true, children: " v0.7.7" })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#06B6D4", bold: true, children: [" ", provider, " "] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: "#22D3EE", children: [" ", model, " "] })] })] }), _jsx(Text, { color: "#374151", children: '─'.repeat(80) })] }));
7
7
  });
8
8
  //# sourceMappingURL=Header.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thatgfsj-code",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Thatgfsj Code - AI Coding Assistant",
5
5
  "main": "dist/cmd/index.js",
6
6
  "type": "module",
package/src/cmd/index.tsx CHANGED
@@ -28,7 +28,7 @@ process.on('unhandledRejection', (reason) => {
28
28
  program
29
29
  .name('gfcode')
30
30
  .description('Thatgfsj Code - AI Coding Assistant')
31
- .version('0.7.5')
31
+ .version('0.7.7')
32
32
  .argument('[prompt]', 'Task to execute (omit to start interactive mode)')
33
33
  .option('-m, --model <model>', 'Specify model')
34
34
  .option('-i, --interactive', 'Force interactive mode')
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * System Prompt Builder - Dynamic prompt construction
3
- * Migrated from old src/core/system-prompt.ts
4
3
  */
5
4
 
6
- import { readFileSync, existsSync } from 'fs';
5
+ import { readFileSync, existsSync, readdirSync } from 'fs';
7
6
  import { join } from 'path';
8
7
  import type { Tool } from '../tools/types.js';
9
8
 
@@ -37,6 +36,7 @@ export class SystemPromptBuilder {
37
36
  this.buildEnvironment(),
38
37
  this.buildPermissionMode(),
39
38
  this.buildProjectInstructions(),
39
+ this.buildNwtHistory(),
40
40
  this.buildSkills(),
41
41
  this.buildDateInfo(),
42
42
  ];
@@ -47,14 +47,15 @@ export class SystemPromptBuilder {
47
47
  return [
48
48
  'You are Thatgfsj Code, an interactive coding agent running in the user\'s terminal.',
49
49
  '',
50
- 'You have access to tools (file operations, shell commands, git, search) that let you',
51
- 'read, write, and modify files and run commands to help with coding tasks.',
50
+ 'You have access to tools (file operations, shell commands, git, search, nwt) that let you',
51
+ 'read, write, and modify files, run commands, and track project evolution.',
52
52
  '',
53
53
  'When working on a task:',
54
54
  '1. First understand what files are involved',
55
55
  '2. Read necessary files to understand the codebase',
56
56
  '3. Make changes using appropriate tools',
57
57
  '4. Verify the changes work',
58
+ '5. Log important changes to NWT (nwt log)',
58
59
  '',
59
60
  'Be concise but thorough. Show your reasoning.',
60
61
  '',
@@ -67,9 +68,7 @@ export class SystemPromptBuilder {
67
68
 
68
69
  private buildToolInstructions(): string {
69
70
  const tools = this.config.tools;
70
- if (tools.length === 0) {
71
- return '## Tools\n\nNo tools are currently registered.';
72
- }
71
+ if (tools.length === 0) return '## Tools\n\nNo tools are currently registered.';
73
72
 
74
73
  const toolDescs = tools.map(t => {
75
74
  const params = t.parameters
@@ -78,7 +77,7 @@ export class SystemPromptBuilder {
78
77
  return `### ${t.name}\n${t.description}\n\nParameters:\n${params}`;
79
78
  }).join('\n\n');
80
79
 
81
- return `## Tools\n\nYou have access to the following tools:\n\n${toolDescs}\n\nTo use a tool, respond with a tool call. Each tool call must include the tool name and parameters as a JSON object.`;
80
+ return `## Tools\n\nYou have access to the following tools:\n\n${toolDescs}\n\nTo use a tool, respond with a tool call.`;
82
81
  }
83
82
 
84
83
  private buildEnvironment(): string {
@@ -95,12 +94,18 @@ export class SystemPromptBuilder {
95
94
  return `## Permission Mode\n\nCurrent mode: ${mode}\n\n${explanations[mode] || ''}`;
96
95
  }
97
96
 
97
+ /**
98
+ * Read ALL matching project instruction files (not just the first one)
99
+ */
98
100
  private buildProjectInstructions(): string {
99
101
  if (!this.config.includeProjectMd) return '';
100
102
 
101
103
  const cwd = this.config.cwd;
102
104
  const home = process.env.USERPROFILE || process.env.HOME || '';
105
+
106
+ // All paths to check
103
107
  const paths = [
108
+ // Project-level
104
109
  join(cwd, 'CLAUDE.md'),
105
110
  join(cwd, '.claude.md'),
106
111
  join(cwd, 'AGENTS.md'),
@@ -108,22 +113,66 @@ export class SystemPromptBuilder {
108
113
  join(cwd, '.Codex.md'),
109
114
  join(cwd, 'CODEX.md'),
110
115
  join(cwd, '.codex.md'),
116
+ // User-level
117
+ join(home, '.claude', 'CLAUDE.md'),
118
+ join(home, '.claude', 'SKILLS.md'),
111
119
  join(home, '.Codex', 'SKILLS.md'),
120
+ join(home, '.Codex', 'AGENTS.md'),
112
121
  join(home, '.agents', 'AGENTS.md'),
113
- join(home, '.claude', 'CLAUDE.md'),
114
122
  ];
115
123
 
124
+ const sections: string[] = [];
125
+
116
126
  for (const path of paths) {
117
127
  if (existsSync(path)) {
118
128
  try {
119
- const content = readFileSync(path, 'utf-8');
120
- return `## Project Instructions (from ${path.split(/[/\\]/).pop()})\n\n${content}`;
129
+ const content = readFileSync(path, 'utf-8').trim();
130
+ if (content) {
131
+ const filename = path.split(/[/\\]/).pop();
132
+ sections.push(`### From ${filename}\n\n${content}`);
133
+ }
121
134
  } catch {
122
- // Ignore
135
+ // Skip unreadable files
123
136
  }
124
137
  }
125
138
  }
126
- return '';
139
+
140
+ if (sections.length === 0) return '';
141
+ return `## Project Instructions\n\n${sections.join('\n\n---\n\n')}`;
142
+ }
143
+
144
+ /**
145
+ * Auto-inject recent NWT history into system prompt
146
+ */
147
+ private buildNwtHistory(): string {
148
+ try {
149
+ const nwtDir = join(this.config.cwd, '.nwt', 'events');
150
+ if (!existsSync(nwtDir)) return '';
151
+
152
+ const files = readdirSync(nwtDir)
153
+ .filter(f => f.endsWith('.json'))
154
+ .sort()
155
+ .slice(-10); // Last 10 events
156
+
157
+ if (files.length === 0) return '';
158
+
159
+ const events = files.map(f => {
160
+ try {
161
+ const ev = JSON.parse(readFileSync(join(nwtDir, f), 'utf-8'));
162
+ const time = ev.timestamp?.split('T')[0] || '';
163
+ const files = ev.files?.length > 0 ? ` [${ev.files.join(', ')}]` : '';
164
+ return `- [${ev.id}] ${time} ${ev.task}: ${ev.summary}${files}`;
165
+ } catch {
166
+ return null;
167
+ }
168
+ }).filter(Boolean);
169
+
170
+ if (events.length === 0) return '';
171
+
172
+ return `## Project History (NWT)\n\nRecent evolution events:\n\n${events.join('\n')}`;
173
+ } catch {
174
+ return '';
175
+ }
127
176
  }
128
177
 
129
178
  private buildSkills(): string {
@@ -14,7 +14,7 @@ export const Header = React.memo(function Header({ provider, model }: Props) {
14
14
  <Box>
15
15
  <Text color="#06B6D4" bold> ⚡ </Text>
16
16
  <Text color="#22D3EE" bold>THATGFSJ CODE</Text>
17
- <Text dimColor> v0.7.5</Text>
17
+ <Text dimColor> v0.7.7</Text>
18
18
  </Box>
19
19
  <Box>
20
20
  <Text color="#06B6D4" bold> {provider} </Text>