claude-autopm 3.24.0 → 3.24.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.
|
@@ -7,9 +7,6 @@ const { spawn } = require('child_process');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
|
|
10
|
-
const PLUGIN_DIR = 'packages/plugin-obsidian';
|
|
11
|
-
const SCRIPTS_DIR = path.join(PLUGIN_DIR, 'scripts', 'obsidian');
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Find project root by walking up from cwd
|
|
15
12
|
*/
|
|
@@ -26,15 +23,29 @@ function findProjectRoot() {
|
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
|
-
*
|
|
26
|
+
* Find scripts directory — checks installed location first, then source repo
|
|
27
|
+
*/
|
|
28
|
+
function findScriptsDir(root) {
|
|
29
|
+
const installed = path.join(root, '.claude', 'scripts', 'obsidian');
|
|
30
|
+
if (fs.existsSync(installed)) return installed;
|
|
31
|
+
|
|
32
|
+
const source = path.join(root, 'packages', 'plugin-obsidian', 'scripts', 'obsidian');
|
|
33
|
+
if (fs.existsSync(source)) return source;
|
|
34
|
+
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check if plugin-obsidian is installed, return scripts dir
|
|
30
40
|
*/
|
|
31
41
|
function checkPlugin(root) {
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
42
|
+
const scriptsDir = findScriptsDir(root);
|
|
43
|
+
if (!scriptsDir) {
|
|
34
44
|
console.error('❌ plugin-obsidian not installed.');
|
|
35
45
|
console.error(' Run: autopm install --scenario=obsidian');
|
|
36
46
|
process.exit(1);
|
|
37
47
|
}
|
|
48
|
+
return scriptsDir;
|
|
38
49
|
}
|
|
39
50
|
|
|
40
51
|
/**
|
|
@@ -42,9 +53,9 @@ function checkPlugin(root) {
|
|
|
42
53
|
*/
|
|
43
54
|
async function obsidianSetup(argv) {
|
|
44
55
|
const root = findProjectRoot();
|
|
45
|
-
checkPlugin(root);
|
|
56
|
+
const scriptsDir = checkPlugin(root);
|
|
46
57
|
|
|
47
|
-
const scriptPath = path.join(
|
|
58
|
+
const scriptPath = path.join(scriptsDir, 'setup.js');
|
|
48
59
|
if (!fs.existsSync(scriptPath)) {
|
|
49
60
|
console.error('❌ Setup script not found:', scriptPath);
|
|
50
61
|
process.exit(1);
|
|
@@ -70,11 +81,11 @@ async function obsidianSetup(argv) {
|
|
|
70
81
|
*/
|
|
71
82
|
async function obsidianSync(argv) {
|
|
72
83
|
const root = findProjectRoot();
|
|
73
|
-
checkPlugin(root);
|
|
84
|
+
const scriptsDir = checkPlugin(root);
|
|
74
85
|
|
|
75
86
|
// Prefer shell script, fall back to Node
|
|
76
|
-
const shPath = path.join(
|
|
77
|
-
const jsPath = path.join(
|
|
87
|
+
const shPath = path.join(scriptsDir, 'sync-to-obsidian.sh');
|
|
88
|
+
const jsPath = path.join(scriptsDir, 'sync-to-obsidian.js');
|
|
78
89
|
|
|
79
90
|
const args = [];
|
|
80
91
|
if (argv.watch) args.push('--watch');
|
|
@@ -107,9 +118,9 @@ async function obsidianSync(argv) {
|
|
|
107
118
|
*/
|
|
108
119
|
async function obsidianDoctor(argv) {
|
|
109
120
|
const root = findProjectRoot();
|
|
110
|
-
checkPlugin(root);
|
|
121
|
+
const scriptsDir = checkPlugin(root);
|
|
111
122
|
|
|
112
|
-
const scriptPath = path.join(
|
|
123
|
+
const scriptPath = path.join(scriptsDir, 'doctor.js');
|
|
113
124
|
if (!fs.existsSync(scriptPath)) {
|
|
114
125
|
console.error('❌ Doctor script not found:', scriptPath);
|
|
115
126
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -20,6 +20,24 @@
|
|
|
20
20
|
"tags": ["obsidian", "vault", "sync", "dataview", "integration"]
|
|
21
21
|
},
|
|
22
22
|
"scripts": [
|
|
23
|
+
{
|
|
24
|
+
"name": "setup",
|
|
25
|
+
"file": "scripts/obsidian/setup.js",
|
|
26
|
+
"description": "Interactive vault configuration wizard",
|
|
27
|
+
"type": "workflow",
|
|
28
|
+
"executable": true,
|
|
29
|
+
"category": "setup",
|
|
30
|
+
"tags": ["setup", "wizard", "vault"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "doctor",
|
|
34
|
+
"file": "scripts/obsidian/doctor.js",
|
|
35
|
+
"description": "Diagnostic checks for common integration issues",
|
|
36
|
+
"type": "utility",
|
|
37
|
+
"executable": true,
|
|
38
|
+
"category": "diagnostics",
|
|
39
|
+
"tags": ["doctor", "diagnostics", "vault"]
|
|
40
|
+
},
|
|
23
41
|
{
|
|
24
42
|
"name": "sync-to-obsidian",
|
|
25
43
|
"file": "scripts/obsidian/sync-to-obsidian.sh",
|
|
@@ -115,6 +115,11 @@ function findProjectRoot(startDir) {
|
|
|
115
115
|
function validateVaultPath(vaultPath) {
|
|
116
116
|
if (!existsSync(vaultPath)) {
|
|
117
117
|
err(`Vault path does not exist: ${vaultPath}`);
|
|
118
|
+
if (/^[A-Za-z]:[\\\/]/.test(vaultPath)) {
|
|
119
|
+
err('Detected Windows path format. On WSL, use /mnt/c/... format:');
|
|
120
|
+
const drive = vaultPath[0].toLowerCase();
|
|
121
|
+
err(` ${'/mnt/' + drive + vaultPath.slice(2).replace(/\\/g, '/')}`);
|
|
122
|
+
}
|
|
118
123
|
process.exit(1);
|
|
119
124
|
}
|
|
120
125
|
try {
|
|
@@ -158,7 +163,12 @@ function substituteTemplate(content, vars) {
|
|
|
158
163
|
// ─── Template generation ────────────────────────────────────────────
|
|
159
164
|
|
|
160
165
|
function generateTemplates(vaultDest, prefix, projectRoot) {
|
|
161
|
-
|
|
166
|
+
// Find templates: check relative to script first, then source repo from project root
|
|
167
|
+
const candidates = [
|
|
168
|
+
join(__dirname, '..', '..', 'templates'),
|
|
169
|
+
join(projectRoot, 'packages', 'plugin-obsidian', 'templates'),
|
|
170
|
+
];
|
|
171
|
+
const templatesDir = candidates.find(d => existsSync(join(d, 'MOC.md.tmpl'))) || candidates[0];
|
|
162
172
|
const createdDate = new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
163
173
|
const projectName = prefix;
|
|
164
174
|
|
|
@@ -368,8 +378,16 @@ function main() {
|
|
|
368
378
|
process.exit(1);
|
|
369
379
|
}
|
|
370
380
|
|
|
381
|
+
// Convert Windows paths to WSL paths if needed (e.g., C:\Users\... → /mnt/c/Users/...)
|
|
382
|
+
let rawVaultPath = args.vaultPath;
|
|
383
|
+
if (detectEnvironment() === 'wsl' && /^[A-Za-z]:[\\\/]/.test(rawVaultPath)) {
|
|
384
|
+
const drive = rawVaultPath[0].toLowerCase();
|
|
385
|
+
rawVaultPath = '/mnt/' + drive + rawVaultPath.slice(2).replace(/\\/g, '/');
|
|
386
|
+
log(`Converted Windows path to WSL: ${rawVaultPath}`);
|
|
387
|
+
}
|
|
388
|
+
|
|
371
389
|
// Resolve paths
|
|
372
|
-
const vaultPath = resolve(
|
|
390
|
+
const vaultPath = resolve(rawVaultPath);
|
|
373
391
|
const projectRoot = args.projectRoot ? resolve(args.projectRoot) : findProjectRoot(process.cwd());
|
|
374
392
|
const prefix = args.prefix || basename(projectRoot);
|
|
375
393
|
const configPath = join(projectRoot, '.claude', 'config.json');
|