expxagents 0.29.3 → 0.29.5

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.
@@ -107,55 +107,58 @@ export async function cliChatCommand(options) {
107
107
  rl.prompt();
108
108
  return;
109
109
  }
110
- // Handle slash commands
110
+ // Handle slash commands (only internal ones — unknown commands are sent to the agent)
111
111
  if (input.startsWith('/')) {
112
112
  const [cmd, ...args] = input.split(' ');
113
- switch (cmd) {
114
- case '/quit':
115
- case '/exit':
116
- case '/q':
117
- console.log(`\n ${C.dim}Goodbye! ${C.cyan}✦${C.reset}\n`);
118
- process.exit(0);
119
- break;
120
- case '/help':
121
- printHelp();
122
- rl.prompt();
123
- return;
124
- case '/models':
125
- console.log(`\n${C.bold}Available models:${C.reset}`);
126
- for (const m of SUPPORTED_MODELS) {
127
- const active = m.id === model ? ` ${C.green}(active)${C.reset}` : '';
128
- console.log(` ${C.cyan}${m.id}${C.reset} — ${m.name} (${(m.contextWindow / 1000).toFixed(0)}K ctx)${active}`);
129
- }
130
- console.log('');
131
- rl.prompt();
132
- return;
133
- case '/model':
134
- if (!args[0]) {
135
- console.log(`Current model: ${C.yellow}${model}${C.reset}`);
136
- }
137
- else {
138
- model = args[0];
139
- const info = SUPPORTED_MODELS.find(m => m.id === model);
140
- if (info) {
141
- console.log(`${C.green}Switched to ${info.name}${C.reset}`);
113
+ const knownCommands = ['/quit', '/exit', '/q', '/help', '/models', '/model', '/clear'];
114
+ if (!knownCommands.includes(cmd)) {
115
+ // Not a known command — send the full input to the agent (e.g., /expxagents, /commit)
116
+ // Fall through to agent execution below
117
+ }
118
+ else {
119
+ switch (cmd) {
120
+ case '/quit':
121
+ case '/exit':
122
+ case '/q':
123
+ console.log(`\n ${C.dim}Goodbye! ${C.cyan}✦${C.reset}\n`);
124
+ process.exit(0);
125
+ break;
126
+ case '/help':
127
+ printHelp();
128
+ rl.prompt();
129
+ return;
130
+ case '/models':
131
+ console.log(`\n${C.bold}Available models:${C.reset}`);
132
+ for (const m of SUPPORTED_MODELS) {
133
+ const active = m.id === model ? ` ${C.green}(active)${C.reset}` : '';
134
+ console.log(` ${C.cyan}${m.id}${C.reset} — ${m.name} (${(m.contextWindow / 1000).toFixed(0)}K ctx)${active}`);
135
+ }
136
+ console.log('');
137
+ rl.prompt();
138
+ return;
139
+ case '/model':
140
+ if (!args[0]) {
141
+ console.log(`Current model: ${C.yellow}${model}${C.reset}`);
142
142
  }
143
143
  else {
144
- console.log(`${C.yellow}Warning: "${model}" is not in curated list. Tool use may not work.${C.reset}`);
144
+ model = args[0];
145
+ const info = SUPPORTED_MODELS.find(m => m.id === model);
146
+ if (info) {
147
+ console.log(`${C.green}Switched to ${info.name}${C.reset}`);
148
+ }
149
+ else {
150
+ console.log(`${C.yellow}Warning: "${model}" is not in curated list. Tool use may not work.${C.reset}`);
151
+ }
145
152
  }
146
- }
147
- rl.prompt();
148
- return;
149
- case '/clear':
150
- sessionManager.create(sessionId, process.cwd());
151
- console.log(`${C.dim}Conversation cleared.${C.reset}`);
152
- rl.prompt();
153
- return;
154
- default:
155
- console.log(`${C.dim}Unknown command: ${cmd}. Type /help for commands.${C.reset}`);
156
- rl.prompt();
157
- return;
158
- }
153
+ rl.prompt();
154
+ return;
155
+ case '/clear':
156
+ sessionManager.create(sessionId, process.cwd());
157
+ console.log(`${C.dim}Conversation cleared.${C.reset}`);
158
+ rl.prompt();
159
+ return;
160
+ }
161
+ } // close else for known commands
159
162
  }
160
163
  // Send to agent
161
164
  console.log('');
@@ -1 +1,6 @@
1
+ /**
2
+ * Loads skill files from .claude/skills/ directories.
3
+ * Returns a map of skill name → skill content.
4
+ */
5
+ export declare function loadSkills(cwd: string): Map<string, string>;
1
6
  export declare function buildSystemPrompt(cwd: string): string;
@@ -1,5 +1,100 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ /**
4
+ * Loads skill files from .claude/skills/ directories.
5
+ * Returns a map of skill name → skill content.
6
+ */
7
+ export function loadSkills(cwd) {
8
+ const skills = new Map();
9
+ const skillsDir = path.join(cwd, '.claude', 'skills');
10
+ if (!fs.existsSync(skillsDir))
11
+ return skills;
12
+ try {
13
+ const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
14
+ for (const entry of entries) {
15
+ if (!entry.isDirectory())
16
+ continue;
17
+ const skillFile = path.join(skillsDir, entry.name, 'SKILL.md');
18
+ if (fs.existsSync(skillFile)) {
19
+ const content = fs.readFileSync(skillFile, 'utf-8').trim();
20
+ if (content) {
21
+ skills.set(entry.name, content);
22
+ }
23
+ }
24
+ }
25
+ }
26
+ catch { /* skip unreadable dirs */ }
27
+ return skills;
28
+ }
29
+ /**
30
+ * Loads project context files (CLAUDE.md, AGENTS.md, README.md, etc.)
31
+ * from the working directory, similar to how Claude Code loads CLAUDE.md.
32
+ */
33
+ function loadProjectContext(cwd) {
34
+ const contextFiles = [
35
+ 'CLAUDE.md',
36
+ 'AGENTS.md',
37
+ 'GEMINI.md',
38
+ '.claude/rules/*.md',
39
+ ];
40
+ const sections = [];
41
+ for (const pattern of contextFiles) {
42
+ if (pattern.includes('*')) {
43
+ // Glob pattern — expand manually
44
+ const dir = path.join(cwd, path.dirname(pattern));
45
+ const ext = path.extname(pattern);
46
+ if (fs.existsSync(dir)) {
47
+ try {
48
+ const files = fs.readdirSync(dir).filter(f => f.endsWith(ext)).sort();
49
+ for (const file of files) {
50
+ const content = fs.readFileSync(path.join(dir, file), 'utf-8').trim();
51
+ if (content) {
52
+ sections.push(`### ${path.dirname(pattern)}/${file}\n\n${content}`);
53
+ }
54
+ }
55
+ }
56
+ catch { /* skip unreadable dirs */ }
57
+ }
58
+ }
59
+ else {
60
+ const filePath = path.join(cwd, pattern);
61
+ if (fs.existsSync(filePath)) {
62
+ try {
63
+ const content = fs.readFileSync(filePath, 'utf-8').trim();
64
+ if (content) {
65
+ sections.push(`### ${pattern}\n\n${content}`);
66
+ }
67
+ }
68
+ catch { /* skip unreadable files */ }
69
+ }
70
+ }
71
+ }
72
+ if (sections.length === 0)
73
+ return '';
74
+ return `\n\n## Project Context\n\nThe following project documentation was loaded from the working directory. Use this to understand the project structure, conventions, and rules.\n\n${sections.join('\n\n---\n\n')}`;
75
+ }
1
76
  export function buildSystemPrompt(cwd) {
2
- return `You are an AI coding agent running in the user's project directory.
77
+ const projectContext = loadProjectContext(cwd);
78
+ const skills = loadSkills(cwd);
79
+ const dirName = path.basename(cwd);
80
+ // Build skills section
81
+ let skillsSection = '';
82
+ if (skills.size > 0) {
83
+ const skillNames = [...skills.keys()].map(s => `/${s}`).join(', ');
84
+ const skillContents = [...skills.entries()]
85
+ .map(([name, content]) => `### Skill: /${name}\n\n${content}`)
86
+ .join('\n\n---\n\n');
87
+ skillsSection = `
88
+
89
+ ## Installed Skills
90
+
91
+ The following skills are available as slash commands: ${skillNames}
92
+
93
+ When the user types a slash command that matches an installed skill, you MUST follow the skill's instructions exactly. Load any files the skill references (memory, agents, configs) using your tools. Use ask_user for interactive menus and questions.
94
+
95
+ ${skillContents}`;
96
+ }
97
+ return `You are an AI coding agent working on the "${dirName}" project.
3
98
  You have access to tools for reading, writing, and searching files, running shell commands, and fetching web content.
4
99
 
5
100
  Working directory: ${cwd}
@@ -14,10 +109,12 @@ Working directory: ${cwd}
14
109
  - When you encounter an error, diagnose the root cause before retrying
15
110
  - Do not modify files you were not asked to change
16
111
  - Prefer small, focused changes over large rewrites
112
+ - Follow the project conventions described in the project context below
113
+ - When the user types a slash command (e.g. /expxagents), check if it matches an installed skill and execute it
17
114
 
18
115
  ## Output
19
116
 
20
117
  When you have completed the task, provide a brief summary of what you did.
21
- Do not wrap your final response in markdown code blocks unless the user asked for code.`;
118
+ Do not wrap your final response in markdown code blocks unless the user asked for code.${projectContext}${skillsSection}`;
22
119
  }
23
120
  //# sourceMappingURL=system-prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,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,aAAa,CAAC,CAAC;QAEvB,aAAa,GAAG;;;;wDAIoC,UAAU;;;;EAIhE,aAAa,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,8CAA8C,OAAO;;;qBAGzC,GAAG;;;;;;;;;;;;;;;;;;yFAkBiE,cAAc,GAAG,aAAa,EAAE,CAAC;AAC1H,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expxagents",
3
- "version": "0.29.3",
3
+ "version": "0.29.5",
4
4
  "description": "Multi-agent orchestration platform for AI squads",
5
5
  "author": "ExpxAgents",
6
6
  "license": "MIT",