Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

[fix] Skills copier path resolution - fixed in both bin/init and src/cli locations

rUv16ebe473573b
diff --git a/bin/init/skills-copier.js b/bin/init/skills-copier.js
index 758664b9ad..979967ff0e 100644
--- a/bin/init/skills-copier.js
+++ b/bin/init/skills-copier.js
@@ -10,37 +10,54 @@ const __dirname = dirname(__filename);
* Copy all skill files from the installed package to project directory
*/
export async function copySkillFiles(targetDir, options = {}) {
+ console.log(' πŸš€ copySkillFiles function called');
+ console.log(` πŸ“‚ Target directory: ${targetDir}`);
+ console.log(` βš™οΈ Options:`, options);
+ console.log(` πŸ“ __dirname: ${__dirname}`);
+
const { force = false, dryRun = false } = options;
// Path to skill files - try multiple locations
- const packageSkillsDir = join(__dirname, '../../../../.claude/skills'); // From npm package
- const localSkillsDir = '/workspaces/claude-code-flow/.claude/skills'; // Local development
- const cwdSkillsDir = join(process.cwd(), '.claude/skills'); // Current working directory
+ const packageSkillsDir = join(__dirname, '../../.claude/skills'); // From npm package (bin/init/ -> root)
+ const localSkillsDir = join(__dirname, '../../../.claude/skills'); // Local development (for testing)
+ const globalNpmSkillsDir = '/usr/local/lib/node_modules/claude-flow/.claude/skills'; // Global npm install
let sourceSkillsDir;
- // Try local development first, then package, then cwd
- try {
- await fs.access(localSkillsDir);
- sourceSkillsDir = localSkillsDir;
- console.log(' πŸ“ Using local development skill files');
- } catch {
+ // Try package location first (most common for npm installs), then local dev, then global npm
+ const locationsToTry = [
+ { path: packageSkillsDir, label: 'packaged skill files' },
+ { path: localSkillsDir, label: 'local development skill files' },
+ { path: globalNpmSkillsDir, label: 'global npm skill files' }
+ ];
+
+ for (const location of locationsToTry) {
try {
- await fs.access(packageSkillsDir);
- sourceSkillsDir = packageSkillsDir;
- console.log(' πŸ“ Using packaged skill files');
- } catch {
- try {
- await fs.access(cwdSkillsDir);
- sourceSkillsDir = cwdSkillsDir;
- console.log(' πŸ“ Using current directory skill files');
- } catch {
- console.log(' ⚠️ No skill files found in any location');
- return { success: false, error: 'Skill files not found' };
+ console.log(` πŸ” Checking: ${location.path}`);
+ await fs.access(location.path);
+ // Verify it's actually a directory with skills
+ const items = await fs.readdir(location.path);
+ console.log(` πŸ“Š Found ${items.length} items at ${location.path}`);
+ if (items.length > 0) {
+ sourceSkillsDir = location.path;
+ console.log(` πŸ“ Using ${location.label}`);
+ console.log(` πŸ“ Path: ${location.path}`);
+ break;
}
+ } catch (err) {
+ console.log(` ❌ Failed to access ${location.path}: ${err.message}`);
+ // Try next location
+ continue;
}
}
+ if (!sourceSkillsDir) {
+ console.log(' ⚠️ No skill files found in any location');
+ console.log(' πŸ” Searched locations:');
+ locationsToTry.forEach(loc => console.log(` - ${loc.path}`));
+ return { success: false, error: 'Skill files not found' };
+ }
+
const targetSkillsDir = join(targetDir, '.claude/skills');
console.log('πŸ“ Copying skill system files...');
diff --git a/src/cli/simple-commands/init/skills-copier.js b/src/cli/simple-commands/init/skills-copier.js
index a0b936b8e9..e7730594c4 100644
--- a/src/cli/simple-commands/init/skills-copier.js
+++ b/src/cli/simple-commands/init/skills-copier.js
@@ -10,37 +10,55 @@ const __dirname = dirname(__filename);
* Copy all skill files from the installed package to project directory
*/
export async function copySkillFiles(targetDir, options = {}) {
+ console.log(' πŸš€ copySkillFiles function called');
+ console.log(` πŸ“‚ Target directory: ${targetDir}`);
+ console.log(` βš™οΈ Options:`, options);
+ console.log(` πŸ“ __dirname: ${__dirname}`);
+
const { force = false, dryRun = false } = options;
// Path to skill files - try multiple locations
- const packageSkillsDir = join(__dirname, '../../../../../.claude/skills'); // From npm package
- const localSkillsDir = '/workspaces/claude-code-flow/.claude/skills'; // Local development
- const cwdSkillsDir = join(process.cwd(), '.claude/skills'); // Current working directory
+ // From npm package: src/cli/simple-commands/init/ -> root = ../../../../
+ const packageSkillsDir = join(__dirname, '../../../../.claude/skills');
+ const localSkillsDir = join(__dirname, '../../../../../.claude/skills'); // Local development (one more level up)
+ const globalNpmSkillsDir = '/usr/local/lib/node_modules/claude-flow/.claude/skills'; // Global npm install
let sourceSkillsDir;
- // Try local development first, then package, then cwd
- try {
- await fs.access(localSkillsDir);
- sourceSkillsDir = localSkillsDir;
- console.log(' πŸ“ Using local development skill files');
- } catch {
+ // Try package location first (most common for npm installs), then local dev, then global npm
+ const locationsToTry = [
+ { path: packageSkillsDir, label: 'packaged skill files' },
+ { path: localSkillsDir, label: 'local development skill files' },
+ { path: globalNpmSkillsDir, label: 'global npm skill files' }
+ ];
+
+ for (const location of locationsToTry) {
try {
- await fs.access(packageSkillsDir);
- sourceSkillsDir = packageSkillsDir;
- console.log(' πŸ“ Using packaged skill files');
- } catch {
- try {
- await fs.access(cwdSkillsDir);
- sourceSkillsDir = cwdSkillsDir;
- console.log(' πŸ“ Using current directory skill files');
- } catch {
- console.log(' ⚠️ No skill files found in any location');
- return { success: false, error: 'Skill files not found' };
+ console.log(` πŸ” Checking: ${location.path}`);
+ await fs.access(location.path);
+ // Verify it's actually a directory with skills
+ const items = await fs.readdir(location.path);
+ console.log(` πŸ“Š Found ${items.length} items at ${location.path}`);
+ if (items.length > 0) {
+ sourceSkillsDir = location.path;
+ console.log(` πŸ“ Using ${location.label}`);
+ console.log(` πŸ“ Path: ${location.path}`);
+ break;
}
+ } catch (err) {
+ console.log(` ❌ Failed to access ${location.path}: ${err.message}`);
+ // Try next location
+ continue;
}
}
+ if (!sourceSkillsDir) {
+ console.log(' ⚠️ No skill files found in any location');
+ console.log(' πŸ” Searched locations:');
+ locationsToTry.forEach(loc => console.log(` - ${loc.path}`));
+ return { success: false, error: 'Skill files not found' };
+ }
+
const targetSkillsDir = join(targetDir, '.claude/skills');
console.log('πŸ“ Copying skill system files...');