obsidian-dev-skills 1.1.0 → 1.1.2
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/obsidian-ops/references/build-workflow.md +2 -2
- package/obsidian-ops/references/security-privacy.md +1 -1
- package/obsidian-ref/references/file-conventions.md +3 -3
- package/obsidian-ref/references/manifest.md +3 -3
- package/obsidian-ref/references/obsidian-file-formats.md +1 -1
- package/package.json +1 -1
- package/scripts/init.mjs +36 -11
|
@@ -10,7 +10,7 @@ Update frequency: Update as build process evolves
|
|
|
10
10
|
|
|
11
11
|
After making any changes to theme code:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Simple CSS Themes
|
|
14
14
|
|
|
15
15
|
If your theme is simple with just `theme.css` in the root and no build tools:
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ If your theme is simple with just `theme.css` in the root and no build tools:
|
|
|
20
20
|
|
|
21
21
|
**How to detect**: If you have `theme.css` in root and no `src/scss/` directory, you have a simple CSS theme.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Complex Themes (SCSS + Build Tools)
|
|
24
24
|
|
|
25
25
|
If your theme uses build tools (Grunt, npm scripts, SCSS compiler, etc.) and has `src/scss/` directory:
|
|
26
26
|
|
|
@@ -15,7 +15,7 @@ Follow Obsidian's **Developer Policies** (https://docs.obsidian.md/Developer+pol
|
|
|
15
15
|
- **Code obfuscation**: CSS must be readable and not minified/obfuscated
|
|
16
16
|
- **Dynamic ads**: No dynamic advertising
|
|
17
17
|
- **Client-side telemetry**: No hidden telemetry. If you collect optional analytics, require explicit opt-in and document clearly in `README.md`
|
|
18
|
-
- **Self-updating mechanisms**: No automatic code updates outside
|
|
18
|
+
- **Self-updating mechanisms**: No automatic code updates outside normal releases. Never execute remote code, fetch and eval scripts, or auto-update code
|
|
19
19
|
|
|
20
20
|
### Mandatory Disclosures
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@ Update frequency: Check Obsidian Sample Theme repo for updates
|
|
|
15
15
|
## Simple CSS Theme Structure
|
|
16
16
|
|
|
17
17
|
**Recommended for simple themes** (like the sample theme template):
|
|
18
|
-
```
|
|
18
|
+
```text
|
|
19
19
|
theme.css # ✅ Source CSS file (edit directly)
|
|
20
20
|
manifest.json
|
|
21
21
|
package.json
|
|
@@ -28,7 +28,7 @@ package.json
|
|
|
28
28
|
## Complex Theme Structure (SCSS + Build Tools)
|
|
29
29
|
|
|
30
30
|
**For themes using SCSS, Grunt, npm scripts, or other build tools**:
|
|
31
|
-
```
|
|
31
|
+
```text
|
|
32
32
|
src/
|
|
33
33
|
scss/ # ✅ SCSS source files
|
|
34
34
|
index.scss
|
|
@@ -49,7 +49,7 @@ package.json
|
|
|
49
49
|
|
|
50
50
|
## Wrong Structure (Common Mistakes)
|
|
51
51
|
|
|
52
|
-
```
|
|
52
|
+
```text
|
|
53
53
|
theme.css # ❌ DON'T have both
|
|
54
54
|
src/
|
|
55
55
|
scss/ # ❌ This causes confusion about which is the source
|
|
@@ -6,7 +6,7 @@ Update frequency: Check Obsidian releases repo for validation requirements
|
|
|
6
6
|
|
|
7
7
|
# Manifest rules (`manifest.json`)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Required Fields
|
|
10
10
|
|
|
11
11
|
All themes must include these fields in `manifest.json`:
|
|
12
12
|
|
|
@@ -15,12 +15,12 @@ All themes must include these fields in `manifest.json`:
|
|
|
15
15
|
- **`minAppVersion`** (string, required) - Minimum Obsidian version required
|
|
16
16
|
- **`author`** (string, required) - Author name (required for themes)
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## Optional Fields
|
|
19
19
|
|
|
20
20
|
- **`authorUrl`** (string, optional) - URL to author's website or profile
|
|
21
21
|
- **`fundingUrl`** (string, optional) - URL for funding/support
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Important Notes
|
|
24
24
|
|
|
25
25
|
- Themes do **not** use `id` or `isDesktopOnly` fields.
|
|
26
26
|
- Canonical requirements: https://github.com/obsidianmd/obsidian-releases/blob/master/.github/workflows/validate-theme-entry.yml
|
|
@@ -451,7 +451,7 @@ ___
|
|
|
451
451
|
|
|
452
452
|
### Properties (YAML metadata)
|
|
453
453
|
|
|
454
|
-
**Important**: Obsidian uses the term "properties" (
|
|
454
|
+
**Important**: Obsidian uses the term "properties" (the editable UI/metadata interface) and "frontmatter" (the YAML block serialization). While both terms are valid and complementary, this guide prefers "properties" for consistency with Obsidian's modern UI terminology.
|
|
455
455
|
|
|
456
456
|
Properties use YAML metadata (properties) at the start of a note:
|
|
457
457
|
|
package/package.json
CHANGED
package/scripts/init.mjs
CHANGED
|
@@ -11,16 +11,29 @@ const __dirname = path.dirname(__filename);
|
|
|
11
11
|
// The package root is one level up from scripts/
|
|
12
12
|
const packageRoot = path.join(__dirname, '..');
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Compares two paths for equality, handling platform-specific differences.
|
|
16
|
+
*/
|
|
17
|
+
function arePathsEqual(path1, path2) {
|
|
18
|
+
if (!path1 || !path2) return false;
|
|
19
|
+
const norm1 = path.normalize(path1).replace(/[\\/]$/, '');
|
|
20
|
+
const norm2 = path.normalize(path2).replace(/[\\/]$/, '');
|
|
21
|
+
|
|
22
|
+
if (process.platform === 'win32') {
|
|
23
|
+
return norm1.toLowerCase() === norm2.toLowerCase();
|
|
24
|
+
}
|
|
25
|
+
return norm1 === norm2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Find the real project root where the package is being installed
|
|
14
29
|
// Find the real project root where the package is being installed
|
|
15
30
|
function getProjectRoot() {
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
// We want to find the root of the project, which is the directory containing
|
|
32
|
+
// the first package.json that isn't for 'obsidian-dev-skills' (unless it's the dev repo).
|
|
33
|
+
// We start from INIT_CWD (where the command was run) or process.cwd() as fallback.
|
|
34
|
+
const initial = process.env.INIT_CWD || process.cwd();
|
|
35
|
+
let current = initial;
|
|
20
36
|
|
|
21
|
-
// Fallback: traverse up from process.cwd() to find the first package.json
|
|
22
|
-
// that isn't the one in this package
|
|
23
|
-
let current = process.cwd();
|
|
24
37
|
while (current !== path.parse(current).root) {
|
|
25
38
|
const pkgPath = path.join(current, 'package.json');
|
|
26
39
|
if (fs.existsSync(pkgPath)) {
|
|
@@ -29,11 +42,20 @@ function getProjectRoot() {
|
|
|
29
42
|
if (pkg.name !== 'obsidian-dev-skills') {
|
|
30
43
|
return current;
|
|
31
44
|
}
|
|
45
|
+
// If we found 'obsidian-dev-skills', check if we are in node_modules.
|
|
46
|
+
// If we are NOT in node_modules, this is likely the development repository.
|
|
47
|
+
if (!current.toLowerCase().includes('node_modules')) {
|
|
48
|
+
return current;
|
|
49
|
+
}
|
|
32
50
|
} catch (e) { }
|
|
33
51
|
}
|
|
34
|
-
|
|
52
|
+
const parent = path.dirname(current);
|
|
53
|
+
if (parent === current) break;
|
|
54
|
+
current = parent;
|
|
35
55
|
}
|
|
36
|
-
|
|
56
|
+
|
|
57
|
+
// Fallback to the initial directory if no project root found
|
|
58
|
+
return initial;
|
|
37
59
|
}
|
|
38
60
|
|
|
39
61
|
const projectRoot = getProjectRoot();
|
|
@@ -303,10 +325,13 @@ Example:
|
|
|
303
325
|
|
|
304
326
|
async function init() {
|
|
305
327
|
// Determine if we are running in the package's own directory (development)
|
|
306
|
-
const isDevelopment = projectRoot
|
|
328
|
+
const isDevelopment = arePathsEqual(projectRoot, packageRoot);
|
|
307
329
|
|
|
308
330
|
if (isDevelopment && !process.env.FORCE_INIT) {
|
|
309
|
-
console.log('🛠️ Development mode detected
|
|
331
|
+
console.log('🛠️ Development mode detected: skipping initialization in the skills repository.');
|
|
332
|
+
console.log('💡 To force initialization (e.g., for testing), run:');
|
|
333
|
+
console.log(' $env:FORCE_INIT=1; pnpm obsidian-dev-skills (PowerShell)');
|
|
334
|
+
console.log(' FORCE_INIT=1 pnpm obsidian-dev-skills (Bash/Zsh)');
|
|
310
335
|
return;
|
|
311
336
|
}
|
|
312
337
|
|