Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ All agents share these rules that cannot be overridden:

```
opencode-skills/
├── package.json # npm package config (v1.3.4)
├── package.json # npm package config (v1.3.5)
├── bin/cli.js # CLI entry point
├── src/ # Source files
│ ├── init.js
Expand Down Expand Up @@ -392,7 +392,7 @@ Usage:

### Stats showing zeros or MAX LEVEL incorrectly

Make sure you're on v1.3.4 or later:
Make sure you're on v1.3.5 or later:
```bash
npx ocs-stats update
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ocs-stats",
"version": "1.3.4",
"version": "1.3.5",
"description": "OpenCode Skills - One-click installer with gamified XP stats",
"type": "module",
"bin": {
Expand Down
28 changes: 25 additions & 3 deletions src/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FILE_CATEGORY = {
};

const PROTECTED_CATEGORIES = [FILE_CATEGORY.XP_DATA, FILE_CATEGORY.MEMORIES];
const SMART_MERGE_CATEGORIES = [FILE_CATEGORY.XP_DATA, FILE_CATEGORY.MEMORIES, FILE_CATEGORY.KNOWLEDGE, FILE_CATEGORY.AGENT];
const SMART_MERGE_CATEGORIES = [FILE_CATEGORY.XP_DATA, FILE_CATEGORY.MEMORIES, FILE_CATEGORY.KNOWLEDGE, FILE_CATEGORY.AGENT, FILE_CATEGORY.SKILL];

const USER_PRESERVE_FIELDS = ['mode', 'tools', 'model', 'temperature', 'permission', 'hidden', 'color'];

Expand Down Expand Up @@ -145,10 +145,10 @@ function getCategory(relativePath) {
if (pathLower.includes('/knowledge.md')) {
return FILE_CATEGORY.KNOWLEDGE;
}
if (pathLower.includes('/skills/')) {
if (pathLower.includes('/skills/') || pathLower.startsWith('skills/')) {
return FILE_CATEGORY.SKILL;
}
if (pathLower.includes('/agents/')) {
if (pathLower.includes('/agents/') || pathLower.startsWith('agents/')) {
return FILE_CATEGORY.AGENT;
}
return FILE_CATEGORY.SKILL;
Expand Down Expand Up @@ -561,6 +561,28 @@ export async function performUpdate(targetDir, options = {}) {
});
continue;
}

if (category === FILE_CATEGORY.SKILL) {
const userContent = fs.readFileSync(targetPath, 'utf-8');
const templateContent = fs.readFileSync(templatePath, 'utf-8');

const mergeResult = smartMergeAgent(userContent, templateContent);

if (!checkOnly) {
fs.writeFileSync(targetPath, mergeResult.content, 'utf-8');
}

const preserveInfo = mergeResult.preservedFields.length > 0
? `${mergeResult.preservedFields.join(', ')} preserved`
: 'updated';

results.merged.push({
path: relativePath,
action: 'smart-merged',
preserveInfo
});
continue;
}
}

if (PROTECTED_CATEGORIES.includes(category)) {
Expand Down
1 change: 1 addition & 0 deletions templates/.ocs-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1.3.5: Fix agent and skill files showing as conflicts instead of being smart merged on update
1.3.4: Re-release to trigger npm publish pipeline
1.3.3: Fix mandatory level-up reset and XP carry-over rule missing from all agents and skills
1.3.2: Fix stats display and smart merge to use correct xp.json field names
Expand Down
Loading