bluedither 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.
@@ -1,15 +1,11 @@
1
1
  /**
2
2
  * bluedither extract [dir] [--validate]
3
3
  *
4
- * Validates theme directory completeness.
5
- * Full Paper extraction is planned for Phase 5.
4
+ * Validates theme directory completeness using bluedither.config.json paths.
6
5
  */
7
6
 
8
7
  import { readFileSync, existsSync } from 'fs';
9
- import { resolve, dirname } from 'path';
10
- import { fileURLToPath } from 'url';
11
-
12
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ import { resolve } from 'path';
13
9
 
14
10
  export default async function extract(args) {
15
11
  if (args.includes('--help')) {
@@ -30,27 +26,52 @@ export default async function extract(args) {
30
26
 
31
27
  console.log(`Checking theme package in: ${dir}\n`);
32
28
 
29
+ // Read config to get actual paths
30
+ const configPath = resolve(dir, 'bluedither.config.json');
31
+ if (!existsSync(configPath)) {
32
+ console.error('✗ No bluedither.config.json found.');
33
+ process.exit(1);
34
+ }
35
+
36
+ const config = JSON.parse(readFileSync(configPath, 'utf-8'));
37
+
33
38
  const required = [
34
- { path: 'theme/tokens.json', label: 'Tokens' },
35
- { path: 'theme/tokens.defaults.json', label: 'Default tokens' },
36
- { path: 'theme/tokens.schema.json', label: 'Token schema' },
37
- { path: 'theme/structure.json', label: 'Structure contract' },
38
- { path: 'theme/rules.md', label: 'Design rules' },
39
- { path: 'theme/template/index.html', label: 'HTML template' },
40
- { path: 'theme/shaders/bluedither-shader.js', label: 'Shader module' },
41
- { path: 'theme/shaders/paper-shaders-bundle.js', label: 'Shader bundle' },
42
- { path: 'skill.md', label: 'Skill instructions' },
39
+ { path: config.tokens, label: 'Tokens' },
40
+ { path: config.defaults, label: 'Default tokens' },
41
+ { path: config.schema, label: 'Token schema' },
42
+ { path: config.structure, label: 'Structure contract' },
43
+ { path: config.rules, label: 'Design rules' },
44
+ { path: config.skill, label: 'Skill instructions' },
43
45
  { path: 'bluedither.config.json', label: 'Package manifest' },
44
46
  ];
45
47
 
46
- const optional = [
47
- { path: 'dist/bluedither-tuner.js', label: 'Tuner bundle' },
48
- { path: 'dist/bluedither-shader.js', label: 'Shader bundle (dist)' },
49
- { path: 'theme/generators/vanilla.md', label: 'Vanilla generator' },
50
- { path: 'theme/generators/react.md', label: 'React generator' },
51
- { path: 'theme/generators/vue.md', label: 'Vue generator' },
52
- { path: 'theme/generators/svelte.md', label: 'Svelte generator' },
53
- ];
48
+ // Add shader sources if present
49
+ if (config.shaderSources) {
50
+ for (const s of config.shaderSources) {
51
+ required.push({ path: s, label: `Shader source (${s})` });
52
+ }
53
+ }
54
+
55
+ // Template directory
56
+ for (const tmplPath of ['theme/template/index.html', 'template/index.html']) {
57
+ if (existsSync(resolve(dir, tmplPath))) {
58
+ required.push({ path: tmplPath, label: 'HTML template' });
59
+ break;
60
+ }
61
+ }
62
+
63
+ const optional = [];
64
+ if (config.tuner) optional.push({ path: config.tuner, label: 'Tuner bundle' });
65
+ if (config.shaders) {
66
+ for (const s of config.shaders) {
67
+ optional.push({ path: s, label: `Shader bundle (${s})` });
68
+ }
69
+ }
70
+ if (config.generators) {
71
+ for (const gen of ['vanilla.md', 'react.md', 'vue.md', 'svelte.md']) {
72
+ optional.push({ path: `${config.generators}${gen}`, label: `${gen.replace('.md', '')} generator` });
73
+ }
74
+ }
54
75
 
55
76
  let allPresent = true;
56
77
 
@@ -70,8 +91,8 @@ export default async function extract(args) {
70
91
  // Schema validation
71
92
  if (doValidate) {
72
93
  console.log('\nSchema validation:');
73
- const schemaPath = resolve(dir, 'theme', 'tokens.schema.json');
74
- const tokensPath = resolve(dir, 'theme', 'tokens.json');
94
+ const schemaPath = resolve(dir, config.schema);
95
+ const tokensPath = resolve(dir, config.tokens);
75
96
 
76
97
  if (!existsSync(schemaPath) || !existsSync(tokensPath)) {
77
98
  console.log(' ✗ Cannot validate: schema or tokens file missing');
@@ -92,8 +113,12 @@ export default async function extract(args) {
92
113
  allPresent = false;
93
114
  }
94
115
  } catch (e) {
95
- console.log(` ✗ Validation error: ${e.message}`);
96
- allPresent = false;
116
+ if (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND') {
117
+ console.log(' – Skipped (ajv not installed)');
118
+ } else {
119
+ console.log(` ✗ Validation error: ${e.message}`);
120
+ allPresent = false;
121
+ }
97
122
  }
98
123
  }
99
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bluedither",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A bold, dithered-shader hero theme for Claude Code — skill + fine-tuner",
5
5
  "type": "module",
6
6
  "bin": {