obsidian-agent-fleet 0.3.0 → 0.3.2
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/bin/cli.js +53 -0
- package/package.json +1 -1
- package/plugin/main.js +5 -4
package/bin/cli.js
CHANGED
|
@@ -35,6 +35,43 @@ function getVaults() {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function resolveClaudePath() {
|
|
39
|
+
const { execSync } = require("child_process");
|
|
40
|
+
// Try to resolve claude full path via login shell (picks up nvm/fnm/etc)
|
|
41
|
+
const shells = ["/bin/zsh", "/bin/bash", "/bin/sh"];
|
|
42
|
+
for (const shell of shells) {
|
|
43
|
+
if (!fs.existsSync(shell)) continue;
|
|
44
|
+
try {
|
|
45
|
+
const result = execSync(`${shell} -l -c "which claude"`, {
|
|
46
|
+
encoding: "utf8",
|
|
47
|
+
timeout: 5000,
|
|
48
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
49
|
+
}).trim();
|
|
50
|
+
if (result && fs.existsSync(result)) return result;
|
|
51
|
+
} catch { /* skip */ }
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function writePluginSettings(vaultPath, claudePath) {
|
|
57
|
+
const dataPath = path.join(vaultPath, ".obsidian", "plugins", PLUGIN_ID, "data.json");
|
|
58
|
+
|
|
59
|
+
let settings = {};
|
|
60
|
+
// Preserve existing settings if they exist
|
|
61
|
+
if (fs.existsSync(dataPath)) {
|
|
62
|
+
try {
|
|
63
|
+
settings = JSON.parse(fs.readFileSync(dataPath, "utf8"));
|
|
64
|
+
} catch { /* start fresh */ }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Only set claudeCliPath if we found it and user hasn't manually set one
|
|
68
|
+
if (claudePath && (!settings.claudeCliPath || settings.claudeCliPath === "claude")) {
|
|
69
|
+
settings.claudeCliPath = claudePath;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fs.writeFileSync(dataPath, JSON.stringify(settings, null, 2));
|
|
73
|
+
}
|
|
74
|
+
|
|
38
75
|
function installToVault(vaultPath) {
|
|
39
76
|
const pluginDir = path.join(vaultPath, ".obsidian", "plugins", PLUGIN_ID);
|
|
40
77
|
|
|
@@ -73,11 +110,24 @@ function main() {
|
|
|
73
110
|
process.exit(1);
|
|
74
111
|
}
|
|
75
112
|
|
|
113
|
+
// Resolve Claude CLI full path
|
|
114
|
+
const claudePath = resolveClaudePath();
|
|
115
|
+
if (!isAuto) {
|
|
116
|
+
if (claudePath) {
|
|
117
|
+
console.log(`🔍 Found Claude CLI: ${claudePath}`);
|
|
118
|
+
} else {
|
|
119
|
+
console.log("⚠️ Claude CLI not found. Install it: npm install -g @anthropic-ai/claude-code");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
76
123
|
// Install to all vaults
|
|
77
124
|
let installed = 0;
|
|
78
125
|
for (const vault of vaults) {
|
|
79
126
|
try {
|
|
80
127
|
const dest = installToVault(vault.path);
|
|
128
|
+
if (claudePath) {
|
|
129
|
+
writePluginSettings(vault.path, claudePath);
|
|
130
|
+
}
|
|
81
131
|
const vaultName = path.basename(vault.path);
|
|
82
132
|
console.log(`✅ Installed to "${vaultName}" → ${dest}`);
|
|
83
133
|
installed++;
|
|
@@ -92,6 +142,9 @@ function main() {
|
|
|
92
142
|
if (installed > 0 && !isAuto) {
|
|
93
143
|
console.log("");
|
|
94
144
|
console.log(`🎉 Agent Fleet installed to ${installed} vault${installed > 1 ? "s" : ""}.`);
|
|
145
|
+
if (claudePath) {
|
|
146
|
+
console.log(` Claude CLI path saved: ${claudePath}`);
|
|
147
|
+
}
|
|
95
148
|
console.log(" Restart Obsidian, then enable Agent Fleet in Settings → Community Plugins.");
|
|
96
149
|
}
|
|
97
150
|
} else if (command === "vaults") {
|
package/package.json
CHANGED