@ia-ccun/code-agent-cli 0.0.39 → 0.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ia-ccun/code-agent-cli",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "AI Coding Agent CLI - 基于OpenClaw🦞底层Agent原理实现的的编码智能体(供学习使用)。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -169,16 +169,60 @@ const packageConfigDir = join(__dirname, '..', 'config', 'agent');
169
169
  const FORCE_OVERWRITE_LIST = [
170
170
  'extensions/working-msg.ts',
171
171
  'extensions/custom-footer.ts',
172
- // Add more files or folders here to force overwrite on every install
173
- // Examples:
174
- // 'skills/some-skill',
175
- // 'prompts/some-prompt.md',
176
- // 'themes/dark.json',
172
+ // Force overwrite all skills SKILL.md files
173
+ 'skills/*/SKILL.md',
177
174
  ];
178
175
 
176
+ // Function to expand glob patterns like "skills/*/SKILL.md"
177
+ function expandGlob(pattern) {
178
+ const results = [];
179
+
180
+ if (pattern.includes('*')) {
181
+ const parts = pattern.split('/');
182
+ let currentPaths = [packageConfigDir];
183
+
184
+ for (const part of parts) {
185
+ const nextPaths = [];
186
+ for (const cp of currentPaths) {
187
+ if (part === '*') {
188
+ // Match any single directory level
189
+ if (existsSync(cp)) {
190
+ const entries = readdirSync(cp);
191
+ for (const entry of entries) {
192
+ const fullPath = join(cp, entry);
193
+ if (statSync(fullPath).isDirectory()) {
194
+ nextPaths.push(fullPath);
195
+ }
196
+ }
197
+ }
198
+ } else {
199
+ nextPaths.push(join(cp, part));
200
+ }
201
+ }
202
+ currentPaths = nextPaths;
203
+ }
204
+
205
+ for (const p of currentPaths) {
206
+ if (existsSync(p)) {
207
+ results.push(relative(packageConfigDir, p));
208
+ }
209
+ }
210
+ } else {
211
+ results.push(pattern);
212
+ }
213
+
214
+ return results;
215
+ }
216
+
179
217
  // Function to force overwrite specific files/folders
180
218
  function forceOverwriteList(relativePaths) {
181
- relativePaths.forEach(relativePath => {
219
+ // Expand glob patterns first
220
+ const expandedPaths = [];
221
+ for (const relativePath of relativePaths) {
222
+ expandedPaths.push(...expandGlob(relativePath));
223
+ }
224
+
225
+ expandedPaths.forEach(relativePath => {
182
226
  const srcPath = join(packageConfigDir, relativePath);
183
227
  const destPath = join(agentDir, relativePath);
184
228
 
@@ -203,9 +247,6 @@ function forceOverwriteList(relativePaths) {
203
247
  }
204
248
  } catch (e) {
205
249
  console.log(`⚠ Could not force overwrite ${relativePath}: ${e.message}`);
206
- if (e.stack) {
207
- console.log(e.stack);
208
- }
209
250
  }
210
251
  } else {
211
252
  console.log(`⚠ Source path does not exist: ${relativePath}`);