obsidian-dev-skills 1.0.0 → 1.0.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.
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ // The package root is one level up from scripts/
11
+ const packageRoot = path.join(__dirname, '..');
12
+
13
+ // The project root is where the user is running the command (usually their Obsidian project)
14
+ const projectRoot = process.cwd();
15
+
16
+ let agentDir = path.join(projectRoot, '.agent');
17
+ // If .agents exists but .agent doesn't, use .agents
18
+ if (!fs.existsSync(agentDir) && fs.existsSync(path.join(projectRoot, '.agents'))) {
19
+ agentDir = path.join(projectRoot, '.agents');
20
+ }
21
+ const skillsDir = path.join(agentDir, 'skills');
22
+
23
+ const skillMappings = {
24
+ 'obsidian-dev': 'obsidian-dev-plugins',
25
+ 'obsidian-theme-dev': 'obsidian-dev-themes',
26
+ 'obsidian-ops': 'obsidian-ops',
27
+ 'obsidian-ref': 'obsidian-ref'
28
+ };
29
+
30
+ function copyRecursiveSync(src, dest) {
31
+ const exists = fs.existsSync(src);
32
+ const stats = exists && fs.statSync(src);
33
+ const isDirectory = exists && stats.isDirectory();
34
+ if (isDirectory) {
35
+ if (!fs.existsSync(dest)) {
36
+ fs.mkdirSync(dest, { recursive: true });
37
+ }
38
+ fs.readdirSync(src).forEach((childItemName) => {
39
+ copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
40
+ });
41
+ } else {
42
+ fs.copyFileSync(src, dest);
43
+ }
44
+ }
45
+
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)) {
50
+ 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;
55
+ }
56
+ } catch (e) {}
57
+ }
58
+
59
+ console.log('šŸš€ Initializing Obsidian Dev Skills...');
60
+
61
+ try {
62
+ // Create .agent/skills directory if it doesn't exist
63
+ if (!fs.existsSync(skillsDir)) {
64
+ console.log(`šŸ“ Creating directory: ${skillsDir}`);
65
+ fs.mkdirSync(skillsDir, { recursive: true });
66
+ }
67
+
68
+ for (const [targetName, sourceName] of Object.entries(skillMappings)) {
69
+ const sourcePath = path.join(packageRoot, sourceName);
70
+ const targetPath = path.join(skillsDir, targetName);
71
+
72
+ if (fs.existsSync(sourcePath)) {
73
+ console.log(`✨ Copying skill: ${targetName}...`);
74
+ // Remove existing if it exists to ensure fresh copy
75
+ if (fs.existsSync(targetPath)) {
76
+ fs.rmSync(targetPath, { recursive: true, force: true });
77
+ }
78
+ copyRecursiveSync(sourcePath, targetPath);
79
+ } else {
80
+ console.warn(`āš ļø Warning: Source skill not found at ${sourcePath}`);
81
+ }
82
+ }
83
+
84
+ // Update or create sync-status.json
85
+ const syncStatusPath = path.join(agentDir, 'sync-status.json');
86
+ const today = new Date().toISOString().split('T')[0];
87
+
88
+ let syncStatus = {
89
+ lastFullSync: today,
90
+ lastSyncSource: 'obsidian-dev-skills initialization'
91
+ };
92
+
93
+ if (fs.existsSync(syncStatusPath)) {
94
+ try {
95
+ const existingStatus = JSON.parse(fs.readFileSync(syncStatusPath, 'utf8'));
96
+ syncStatus = { ...existingStatus, ...syncStatus };
97
+ } catch (e) {
98
+ // Ignore JSON parse errors and overwrite
99
+ }
100
+ }
101
+
102
+ fs.writeFileSync(syncStatusPath, JSON.stringify(syncStatus, null, 2), 'utf8');
103
+ console.log('āœ… Updated .agent/sync-status.json');
104
+
105
+ console.log('\nšŸŽ‰ Successfully installed Obsidian Dev Skills!');
106
+ console.log('Your Cursor agent now has access to specialized Obsidian development knowledge.');
107
+ } catch (error) {
108
+ console.error('āŒ Error during initialization:', error.message);
109
+ process.exit(1);
110
+ }
111
+ }
112
+
113
+ init();
@@ -0,0 +1,52 @@
1
+ # Setup skills symlinks for Obsidian Sample Plugin Plus
2
+ # This script creates symlinks to the obsidian-dev-skills repository
3
+
4
+ param(
5
+ [string]$SkillsRepoPath = "$PSScriptRoot\..\obsidian-dev-skills"
6
+ )
7
+
8
+ $ErrorActionPreference = "Stop"
9
+
10
+ Write-Host "Setting up skills symlinks..." -ForegroundColor Cyan
11
+
12
+ # Check if skills repo exists
13
+ if (-not (Test-Path $SkillsRepoPath)) {
14
+ Write-Host "Skills repository not found at: $SkillsRepoPath" -ForegroundColor Red
15
+ Write-Host "Please clone obsidian-dev-skills to a sibling directory." -ForegroundColor Yellow
16
+ Write-Host "Example: git clone https://github.com/davidvkimball/obsidian-dev-skills.git obsidian-dev-skills" -ForegroundColor Yellow
17
+ exit 1
18
+ }
19
+
20
+ $skillsDir = "$PSScriptRoot\..\.agent\skills"
21
+
22
+ # Create skills directory if it doesn't exist
23
+ if (-not (Test-Path $skillsDir)) {
24
+ New-Item -ItemType Directory -Path $skillsDir -Force | Out-Null
25
+ }
26
+
27
+ $skills = @("obsidian-dev", "obsidian-ops", "obsidian-ref")
28
+
29
+ foreach ($skill in $skills) {
30
+ $targetPath = Join-Path $skillsDir $skill
31
+ $sourcePath = Join-Path $SkillsRepoPath $skill
32
+
33
+ # Remove existing symlink/directory if it exists
34
+ if (Test-Path $targetPath) {
35
+ $item = Get-Item $targetPath
36
+ if ($item.LinkType -eq "Junction" -or $item.LinkType -eq "SymbolicLink") {
37
+ Remove-Item $targetPath -Force
38
+ } else {
39
+ Remove-Item $targetPath -Recurse -Force
40
+ }
41
+ }
42
+
43
+ # Create symlink
44
+ Write-Host "Creating symlink: $skill" -ForegroundColor Green
45
+ cmd /c mklink /J "$targetPath" "$sourcePath" | Out-Null
46
+ }
47
+
48
+ Write-Host "Skills setup complete!" -ForegroundColor Cyan
49
+ Write-Host "The following skills are now available:" -ForegroundColor Gray
50
+ Write-Host " - obsidian-dev (core development)" -ForegroundColor Gray
51
+ Write-Host " - obsidian-ops (operations & workflows)" -ForegroundColor Gray
52
+ Write-Host " - obsidian-ref (technical references)" -ForegroundColor Gray