obsidian-dev-skills 1.0.7 ā 1.0.8
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/package.json +1 -1
- package/scripts/init.mjs +49 -2
package/package.json
CHANGED
package/scripts/init.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import readline from 'readline';
|
|
5
6
|
import { fileURLToPath } from 'url';
|
|
6
7
|
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -109,6 +110,47 @@ function detectProjectType(root) {
|
|
|
109
110
|
return isPlugin ? 'plugin' : 'theme';
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Asks the user to select a project type if it's ambiguous.
|
|
115
|
+
* @returns {Promise<'plugin' | 'theme' | 'both'>}
|
|
116
|
+
*/
|
|
117
|
+
function askProjectType() {
|
|
118
|
+
return new Promise((resolve) => {
|
|
119
|
+
if (!process.stdin.isTTY) {
|
|
120
|
+
resolve('both');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const rl = readline.createInterface({
|
|
125
|
+
input: process.stdin,
|
|
126
|
+
output: process.stdout
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
console.log('\nā The project type is not immediately clear.');
|
|
130
|
+
console.log('Is this an Obsidian plugin project, a theme project, or both?');
|
|
131
|
+
console.log('Choices: [p]lugin, [t]heme, [b]oth (default)');
|
|
132
|
+
|
|
133
|
+
const handleAnswer = (answer) => {
|
|
134
|
+
const cleanAnswer = answer.trim().toLowerCase();
|
|
135
|
+
if (cleanAnswer === 'p' || cleanAnswer === 'plugin') {
|
|
136
|
+
rl.close();
|
|
137
|
+
resolve('plugin');
|
|
138
|
+
} else if (cleanAnswer === 't' || cleanAnswer === 'theme') {
|
|
139
|
+
rl.close();
|
|
140
|
+
resolve('theme');
|
|
141
|
+
} else if (cleanAnswer === 'b' || cleanAnswer === 'both' || cleanAnswer === '') {
|
|
142
|
+
rl.close();
|
|
143
|
+
resolve('both');
|
|
144
|
+
} else {
|
|
145
|
+
console.log('Invalid choice. Please enter p, t, or b.');
|
|
146
|
+
rl.question('> ', handleAnswer);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
rl.question('> ', handleAnswer);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
112
154
|
/**
|
|
113
155
|
* Updates AGENTS.md in the project root to include the installed skills in the openskills format.
|
|
114
156
|
*/
|
|
@@ -270,8 +312,13 @@ async function init() {
|
|
|
270
312
|
|
|
271
313
|
console.log(`š Initializing Obsidian Dev Skills in: ${projectRoot}`);
|
|
272
314
|
try {
|
|
273
|
-
|
|
274
|
-
|
|
315
|
+
let projectType = detectProjectType(projectRoot);
|
|
316
|
+
|
|
317
|
+
if (projectType === 'both' && process.stdin.isTTY) {
|
|
318
|
+
projectType = await askProjectType();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
console.log(`š Using project type: ${projectType}`);
|
|
275
322
|
|
|
276
323
|
// Create .agent/skills directory if it doesn't exist
|
|
277
324
|
if (!fs.existsSync(skillsDir)) {
|