Browse Source

Fix install

Alvin Unreal 6 months ago
parent
commit
09341fa980
3 changed files with 9 additions and 10 deletions
  1. 2 1
      package.json
  2. 5 6
      src/cli/custom-skills.ts
  3. 2 3
      src/cli/install.ts

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "oh-my-opencode-slim",
-  "version": "0.6.0",
+  "version": "0.6.2",
   "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
   "main": "dist/index.js",
   "types": "dist/index.d.ts",
@@ -30,6 +30,7 @@
   "homepage": "https://github.com/alvinunreal/oh-my-opencode-slim#readme",
   "files": [
     "dist",
+    "src/skills",
     "README.md",
     "LICENSE"
   ],

+ 5 - 6
src/cli/custom-skills.ts

@@ -5,8 +5,9 @@ import {
   readdirSync,
   statSync,
 } from 'node:fs';
-import { join, dirname } from 'node:path';
 import { homedir } from 'node:os';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 /**
  * A custom skill bundled in this repository.
@@ -74,12 +75,10 @@ function copyDirRecursive(src: string, dest: string): void {
  * @param projectRoot - Root directory of oh-my-opencode-slim project
  * @returns True if installation succeeded, false otherwise
  */
-export function installCustomSkill(
-  skill: CustomSkill,
-  projectRoot: string,
-): boolean {
+export function installCustomSkill(skill: CustomSkill): boolean {
   try {
-    const sourcePath = join(projectRoot, skill.sourcePath);
+    const packageRoot = fileURLToPath(new URL('../..', import.meta.url));
+    const sourcePath = join(packageRoot, skill.sourcePath);
     const targetPath = join(getCustomSkillsDir(), skill.name);
 
     // Validate source exists

+ 2 - 3
src/cli/install.ts

@@ -9,8 +9,8 @@ import {
   isOpenCodeInstalled,
   writeLiteConfig,
 } from './config-manager';
-import { RECOMMENDED_SKILLS, installSkill } from './skills';
 import { CUSTOM_SKILLS, installCustomSkill } from './custom-skills';
+import { installSkill, RECOMMENDED_SKILLS } from './skills';
 import type {
   BooleanArg,
   ConfigMergeResult,
@@ -311,10 +311,9 @@ async function runInstall(config: InstallConfig): Promise<number> {
   if (config.installCustomSkills) {
     printStep(step++, totalSteps, 'Installing custom skills...');
     let customSkillsInstalled = 0;
-    const projectRoot = process.cwd(); // Assumes running from project root
     for (const skill of CUSTOM_SKILLS) {
       printInfo(`Installing ${skill.name}...`);
-      if (installCustomSkill(skill, projectRoot)) {
+      if (installCustomSkill(skill)) {
         printSuccess(`Installed: ${skill.name}`);
         customSkillsInstalled++;
       } else {