obsidian-dev-skills 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -6,10 +6,10 @@ This repository contains centralized AI agent skills for Obsidian plugin and the
6
6
 
7
7
  ```
8
8
  obsidian-dev-skills/
9
- ├── obsidian-dev-plugins/ # Plugin development skills
10
- ├── obsidian-dev-themes/ # Theme development skills
11
- ├── obsidian-ops/ # Operations & workflows
12
- └── obsidian-ref/ # Technical references
9
+ ├── obsidian-dev/ # Plugin development skills
10
+ ├── obsidian-theme-dev/ # Theme development skills
11
+ ├── obsidian-ops/ # Operations & workflows
12
+ └── obsidian-ref/ # Technical references
13
13
  ```
14
14
 
15
15
  ## Getting Started
@@ -28,13 +28,13 @@ The `setup-ref-links` script clones this repository to your `.ref` folder and cr
28
28
 
29
29
  ## Skills Overview
30
30
 
31
- ### obsidian-dev-plugins
31
+ ### obsidian-dev
32
32
  - TypeScript/JavaScript development patterns
33
33
  - Obsidian API usage
34
34
  - Plugin lifecycle management
35
35
  - Command and settings implementation
36
36
 
37
- ### obsidian-dev-themes
37
+ ### obsidian-theme-dev
38
38
  - CSS/SCSS development patterns
39
39
  - Obsidian CSS variables
40
40
  - Responsive design
@@ -70,10 +70,11 @@ When skills are updated in this repository, all linked projects automatically ge
70
70
 
71
71
  Each project maintains its own `sync-status.json` file to track when reference materials were last updated.
72
72
 
73
- ## Compatibility
74
-
75
- - **Cursor**: Primary supported AI agent
76
- - **Open Cognitive Skills (OCS) Specification**: [https://github.com/AI-CAMEL/Skills-Specification](https://github.com/AI-CAMEL/Skills-Specification)
73
+ ## Compatibility
74
+
75
+ - **AI Agents**: Compatible with any AI agent supporting the Open Cognitive Skills (OCS) Specification
76
+ - **IDEs**: Works across all development environments (VS Code, Cursor, JetBrains IDEs, etc.)
77
+ - **Specification**: Open Cognitive Skills (OCS) - [https://github.com/AI-CAMEL/Skills-Specification](https://github.com/AI-CAMEL/Skills-Specification)
77
78
 
78
79
  ## Contributing
79
80
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: obsidian-dev-themes
2
+ name: obsidian-theme-dev
3
3
  description: CSS/SCSS development patterns for Obsidian themes. Load when working with theme.css, SCSS variables, or CSS selectors.
4
4
  ---
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-dev-skills",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Agent skills for Obsidian plugin and theme development",
5
5
  "keywords": [
6
6
  "obsidian",
@@ -19,8 +19,8 @@
19
19
  "license": "MIT",
20
20
  "author": "David V. Kimball",
21
21
  "files": [
22
- "obsidian-dev-plugins/",
23
- "obsidian-dev-themes/",
22
+ "obsidian-dev/",
23
+ "obsidian-theme-dev/",
24
24
  "obsidian-ops/",
25
25
  "obsidian-ref/",
26
26
  "scripts/"
@@ -34,4 +34,4 @@
34
34
  "engines": {
35
35
  "node": ">=16.0.0"
36
36
  }
37
- }
37
+ }
package/scripts/init.mjs CHANGED
@@ -10,8 +10,32 @@ const __dirname = path.dirname(__filename);
10
10
  // The package root is one level up from scripts/
11
11
  const packageRoot = path.join(__dirname, '..');
12
12
 
13
- // The project root is where the user is running the command (usually their Obsidian project)
14
- const projectRoot = process.cwd();
13
+ // Find the real project root where the package is being installed
14
+ function getProjectRoot() {
15
+ // INIT_CWD is set by npm/pnpm/yarn to the directory where the command was run
16
+ if (process.env.INIT_CWD) {
17
+ return process.env.INIT_CWD;
18
+ }
19
+
20
+ // Fallback: traverse up from process.cwd() to find the first package.json
21
+ // that isn't the one in this package
22
+ let current = process.cwd();
23
+ while (current !== path.parse(current).root) {
24
+ const pkgPath = path.join(current, 'package.json');
25
+ if (fs.existsSync(pkgPath)) {
26
+ try {
27
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
28
+ if (pkg.name !== 'obsidian-dev-skills') {
29
+ return current;
30
+ }
31
+ } catch (e) { }
32
+ }
33
+ current = path.dirname(current);
34
+ }
35
+ return process.cwd();
36
+ }
37
+
38
+ const projectRoot = getProjectRoot();
15
39
 
16
40
  let agentDir = path.join(projectRoot, '.agent');
17
41
  // If .agents exists but .agent doesn't, use .agents
@@ -21,8 +45,8 @@ if (!fs.existsSync(agentDir) && fs.existsSync(path.join(projectRoot, '.agents'))
21
45
  const skillsDir = path.join(agentDir, 'skills');
22
46
 
23
47
  const skillMappings = {
24
- 'obsidian-dev': 'obsidian-dev-plugins',
25
- 'obsidian-theme-dev': 'obsidian-dev-themes',
48
+ 'obsidian-dev': 'obsidian-dev',
49
+ 'obsidian-theme-dev': 'obsidian-theme-dev',
26
50
  'obsidian-ops': 'obsidian-ops',
27
51
  'obsidian-ref': 'obsidian-ref'
28
52
  };
@@ -43,22 +67,64 @@ function copyRecursiveSync(src, dest) {
43
67
  }
44
68
  }
45
69
 
46
- async function init() {
47
- // Skip if we're running inside the obsidian-dev-skills repo itself (development)
48
- const pkgJsonPath = path.join(projectRoot, 'package.json');
49
- if (fs.existsSync(pkgJsonPath)) {
70
+ /**
71
+ * Detects if the project is an Obsidian plugin, theme, or both.
72
+ * @returns {'plugin' | 'theme' | 'both'}
73
+ */
74
+ function detectProjectType(root) {
75
+ const manifestPath = path.join(root, 'manifest.json');
76
+ const themeCssPath = path.join(root, 'theme.css');
77
+
78
+ let isPlugin = false;
79
+ let isTheme = false;
80
+
81
+ if (fs.existsSync(manifestPath)) {
50
82
  try {
51
- const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
52
- if (pkg.name === 'obsidian-dev-skills' && projectRoot === packageRoot) {
53
- console.log('🛠️ Development mode detected, skipping initialization.');
54
- return;
83
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
84
+ if (manifest.id) {
85
+ isPlugin = true;
86
+ } else {
87
+ // Obsidian themes also have a manifest.json but typically no 'id' field
88
+ isTheme = true;
55
89
  }
56
- } catch (e) {}
90
+ } catch (e) {
91
+ console.warn(`⚠️ Warning: Failed to parse manifest.json at ${manifestPath}`);
92
+ }
93
+ }
94
+
95
+ if (fs.existsSync(themeCssPath)) {
96
+ isTheme = true;
97
+ }
98
+
99
+ // If detected both, return 'both'
100
+ if (isPlugin && isTheme) {
101
+ return 'both';
57
102
  }
58
103
 
59
- console.log('🚀 Initializing Obsidian Dev Skills...');
104
+ // If detected neither, return 'both' (fallback)
105
+ if (!isPlugin && !isTheme) {
106
+ return 'both';
107
+ }
108
+
109
+ return isPlugin ? 'plugin' : 'theme';
110
+ }
111
+
112
+ async function init() {
113
+ // Determine if we are running in the package's own directory (development)
114
+ const isDevelopment = projectRoot === packageRoot ||
115
+ (fs.existsSync(path.join(packageRoot, 'obsidian-dev')) &&
116
+ !fs.existsSync(path.join(projectRoot, 'node_modules', 'obsidian-dev-skills')));
117
+
118
+ if (isDevelopment && !process.env.FORCE_INIT) {
119
+ console.log('🛠️ Development mode detected (or forced skip), skipping initialization.');
120
+ return;
121
+ }
60
122
 
123
+ console.log(`🚀 Initializing Obsidian Dev Skills in: ${projectRoot}`);
61
124
  try {
125
+ const projectType = detectProjectType(projectRoot);
126
+ console.log(`🔍 Detected project type: ${projectType}`);
127
+
62
128
  // Create .agent/skills directory if it doesn't exist
63
129
  if (!fs.existsSync(skillsDir)) {
64
130
  console.log(`📁 Creating directory: ${skillsDir}`);
@@ -66,6 +132,14 @@ async function init() {
66
132
  }
67
133
 
68
134
  for (const [targetName, sourceName] of Object.entries(skillMappings)) {
135
+ // Filter based on project type
136
+ if (projectType === 'plugin' && targetName === 'obsidian-theme-dev') {
137
+ continue;
138
+ }
139
+ if (projectType === 'theme' && targetName === 'obsidian-dev') {
140
+ continue;
141
+ }
142
+
69
143
  const sourcePath = path.join(packageRoot, sourceName);
70
144
  const targetPath = path.join(skillsDir, targetName);
71
145
 
@@ -84,7 +158,7 @@ async function init() {
84
158
  // Update or create sync-status.json
85
159
  const syncStatusPath = path.join(agentDir, 'sync-status.json');
86
160
  const today = new Date().toISOString().split('T')[0];
87
-
161
+
88
162
  let syncStatus = {
89
163
  lastFullSync: today,
90
164
  lastSyncSource: 'obsidian-dev-skills initialization'
@@ -103,7 +177,7 @@ async function init() {
103
177
  console.log('✅ Updated .agent/sync-status.json');
104
178
 
105
179
  console.log('\n🎉 Successfully installed Obsidian Dev Skills!');
106
- console.log('Your Cursor agent now has access to specialized Obsidian development knowledge.');
180
+ console.log('Your AI agent now has access to specialized Obsidian development knowledge.');
107
181
  } catch (error) {
108
182
  console.error('❌ Error during initialization:', error.message);
109
183
  process.exit(1);
File without changes