claude-autopm 3.24.0 → 3.24.1
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",
|
|
@@ -158,7 +158,12 @@ function substituteTemplate(content, vars) {
|
|
|
158
158
|
// ─── Template generation ────────────────────────────────────────────
|
|
159
159
|
|
|
160
160
|
function generateTemplates(vaultDest, prefix, projectRoot) {
|
|
161
|
-
|
|
161
|
+
// Find templates: check relative to script first, then source repo from project root
|
|
162
|
+
const candidates = [
|
|
163
|
+
join(__dirname, '..', '..', 'templates'),
|
|
164
|
+
join(projectRoot, 'packages', 'plugin-obsidian', 'templates'),
|
|
165
|
+
];
|
|
166
|
+
const templatesDir = candidates.find(d => existsSync(join(d, 'MOC.md.tmpl'))) || candidates[0];
|
|
162
167
|
const createdDate = new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
163
168
|
const projectName = prefix;
|
|
164
169
|
|