obsidian-dev-skills 1.0.2 → 1.0.4

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.2",
3
+ "version": "1.0.4",
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
@@ -28,7 +28,7 @@ function getProjectRoot() {
28
28
  if (pkg.name !== 'obsidian-dev-skills') {
29
29
  return current;
30
30
  }
31
- } catch (e) {}
31
+ } catch (e) { }
32
32
  }
33
33
  current = path.dirname(current);
34
34
  }
@@ -45,8 +45,8 @@ if (!fs.existsSync(agentDir) && fs.existsSync(path.join(projectRoot, '.agents'))
45
45
  const skillsDir = path.join(agentDir, 'skills');
46
46
 
47
47
  const skillMappings = {
48
- 'obsidian-dev': 'obsidian-dev-plugins',
49
- 'obsidian-theme-dev': 'obsidian-dev-themes',
48
+ 'obsidian-dev': 'obsidian-dev',
49
+ 'obsidian-theme-dev': 'obsidian-theme-dev',
50
50
  'obsidian-ops': 'obsidian-ops',
51
51
  'obsidian-ref': 'obsidian-ref'
52
52
  };
@@ -67,11 +67,97 @@ function copyRecursiveSync(src, dest) {
67
67
  }
68
68
  }
69
69
 
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)) {
82
+ try {
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;
89
+ }
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';
102
+ }
103
+
104
+ // If detected neither, return 'both' (fallback)
105
+ if (!isPlugin && !isTheme) {
106
+ return 'both';
107
+ }
108
+
109
+ return isPlugin ? 'plugin' : 'theme';
110
+ }
111
+
112
+ /**
113
+ * Ensures a project-specific skill exists, creating a template if it doesn't.
114
+ */
115
+ function initializeProjectSkill(targetSkillsDir) {
116
+ const projectSkillDir = path.join(targetSkillsDir, 'project');
117
+ const projectSkillFile = path.join(projectSkillDir, 'SKILL.md');
118
+
119
+ if (!fs.existsSync(projectSkillFile)) {
120
+ console.log('📝 Initializing project-specific skill template...');
121
+ if (!fs.existsSync(projectSkillDir)) {
122
+ fs.mkdirSync(projectSkillDir, { recursive: true });
123
+ }
124
+
125
+ const template = `---
126
+ name: project
127
+ description: Project-specific architecture, maintenance tasks, and unique conventions. Load when performing project-wide maintenance or working with the core architecture.
128
+ ---
129
+
130
+ # Project Skill
131
+
132
+ Provide a high-level overview of this project's specific goals and architecture here.
133
+
134
+ ## Core Architecture
135
+
136
+ - Detail the primary technical stack and how components interact.
137
+
138
+ ## Project-Specific Conventions
139
+
140
+ - **Naming**: Describe any specific naming patterns used in this repo.
141
+ - **Patterns**: Document unique implementation patterns (e.g., custom hooks, specific state management).
142
+
143
+ ## Key Files
144
+
145
+ - \`src/main.ts\`: [Description]
146
+ - \`manifest.json\`: [Description]
147
+
148
+ ## Maintenance Tasks
149
+
150
+ - List recurring tasks like version bumping, CSS testing, or dependency updates.
151
+ `;
152
+ fs.writeFileSync(projectSkillFile, template, 'utf8');
153
+ }
154
+ }
155
+
70
156
  async function init() {
71
157
  // Determine if we are running in the package's own directory (development)
72
- const isDevelopment = projectRoot === packageRoot ||
73
- (fs.existsSync(path.join(packageRoot, 'obsidian-dev-plugins')) &&
74
- !fs.existsSync(path.join(projectRoot, 'node_modules', 'obsidian-dev-skills')));
158
+ const isDevelopment = projectRoot === packageRoot ||
159
+ (fs.existsSync(path.join(packageRoot, 'obsidian-dev')) &&
160
+ !fs.existsSync(path.join(projectRoot, 'node_modules', 'obsidian-dev-skills')));
75
161
 
76
162
  if (isDevelopment && !process.env.FORCE_INIT) {
77
163
  console.log('🛠️ Development mode detected (or forced skip), skipping initialization.');
@@ -80,6 +166,9 @@ async function init() {
80
166
 
81
167
  console.log(`🚀 Initializing Obsidian Dev Skills in: ${projectRoot}`);
82
168
  try {
169
+ const projectType = detectProjectType(projectRoot);
170
+ console.log(`🔍 Detected project type: ${projectType}`);
171
+
83
172
  // Create .agent/skills directory if it doesn't exist
84
173
  if (!fs.existsSync(skillsDir)) {
85
174
  console.log(`📁 Creating directory: ${skillsDir}`);
@@ -87,6 +176,14 @@ async function init() {
87
176
  }
88
177
 
89
178
  for (const [targetName, sourceName] of Object.entries(skillMappings)) {
179
+ // Filter based on project type
180
+ if (projectType === 'plugin' && targetName === 'obsidian-theme-dev') {
181
+ continue;
182
+ }
183
+ if (projectType === 'theme' && targetName === 'obsidian-dev') {
184
+ continue;
185
+ }
186
+
90
187
  const sourcePath = path.join(packageRoot, sourceName);
91
188
  const targetPath = path.join(skillsDir, targetName);
92
189
 
@@ -102,10 +199,13 @@ async function init() {
102
199
  }
103
200
  }
104
201
 
202
+ // Ensure project-specific skill exists
203
+ initializeProjectSkill(skillsDir);
204
+
105
205
  // Update or create sync-status.json
106
206
  const syncStatusPath = path.join(agentDir, 'sync-status.json');
107
207
  const today = new Date().toISOString().split('T')[0];
108
-
208
+
109
209
  let syncStatus = {
110
210
  lastFullSync: today,
111
211
  lastSyncSource: 'obsidian-dev-skills initialization'
@@ -124,7 +224,7 @@ async function init() {
124
224
  console.log('✅ Updated .agent/sync-status.json');
125
225
 
126
226
  console.log('\n🎉 Successfully installed Obsidian Dev Skills!');
127
- console.log('Your Cursor agent now has access to specialized Obsidian development knowledge.');
227
+ console.log('Your AI agent now has access to specialized Obsidian development knowledge.');
128
228
  } catch (error) {
129
229
  console.error('❌ Error during initialization:', error.message);
130
230
  process.exit(1);
File without changes