mudra-skills 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/bin/install.js +60 -4
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -7,10 +7,66 @@ import { execSync } from 'child_process';
7
7
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
8
  const pluginSrc = path.resolve(__dirname, '..');
9
9
  const homeDir = process.env.HOME || process.env.USERPROFILE;
10
- const target = path.join(homeDir, '.claude', 'plugins', 'mudra');
10
+ const pluginsDir = path.join(homeDir, '.claude', 'plugins');
11
11
 
12
- fs.mkdirSync(target, { recursive: true });
13
- execSync(`cp -r "${pluginSrc}/." "${target}"`);
12
+ const pkg = JSON.parse(fs.readFileSync(path.join(pluginSrc, 'package.json'), 'utf8'));
13
+ const version = pkg.version;
14
+ const MARKETPLACE = 'mudra-band';
15
+ const PLUGIN_NAME = 'mudra';
16
+ const PLUGIN_KEY = `${PLUGIN_NAME}@${MARKETPLACE}`;
17
+
18
+ // Install to the cache location Claude Code expects for marketplace plugins
19
+ const cacheTarget = path.join(pluginsDir, 'cache', MARKETPLACE, PLUGIN_NAME, version);
20
+ fs.mkdirSync(cacheTarget, { recursive: true });
21
+ execSync(`cp -r "${pluginSrc}/." "${cacheTarget}"`);
22
+
23
+ // Register the marketplace in known_marketplaces.json if not already there
24
+ const marketplacesFile = path.join(pluginsDir, 'known_marketplaces.json');
25
+ let marketplaces = {};
26
+ if (fs.existsSync(marketplacesFile)) {
27
+ marketplaces = JSON.parse(fs.readFileSync(marketplacesFile, 'utf8'));
28
+ }
29
+ if (!marketplaces[MARKETPLACE]) {
30
+ marketplaces[MARKETPLACE] = {
31
+ source: {
32
+ source: 'git',
33
+ url: 'https://github.com/jabbourWearable/mudra-skill.git',
34
+ },
35
+ installLocation: path.join(pluginsDir, 'marketplaces', MARKETPLACE),
36
+ lastUpdated: new Date().toISOString(),
37
+ };
38
+ fs.writeFileSync(marketplacesFile, JSON.stringify(marketplaces, null, 2));
39
+ }
40
+
41
+ // Register the plugin in installed_plugins.json
42
+ const installedFile = path.join(pluginsDir, 'installed_plugins.json');
43
+ let installed = { version: 2, plugins: {} };
44
+ if (fs.existsSync(installedFile)) {
45
+ installed = JSON.parse(fs.readFileSync(installedFile, 'utf8'));
46
+ }
47
+
48
+ // Remove stale npm entry from previous installs
49
+ delete installed.plugins['mudra@npm'];
50
+
51
+ const now = new Date().toISOString();
52
+ const previousInstall = installed.plugins[PLUGIN_KEY]?.[0];
53
+ installed.plugins[PLUGIN_KEY] = [
54
+ {
55
+ scope: 'user',
56
+ installPath: cacheTarget,
57
+ version,
58
+ installedAt: previousInstall?.installedAt ?? now,
59
+ lastUpdated: now,
60
+ },
61
+ ];
62
+
63
+ fs.writeFileSync(installedFile, JSON.stringify(installed, null, 2));
64
+
65
+ // Clean up the old direct-copy install location if it exists
66
+ const oldTarget = path.join(pluginsDir, 'mudra');
67
+ if (fs.existsSync(oldTarget)) {
68
+ fs.rmSync(oldTarget, { recursive: true, force: true });
69
+ }
14
70
 
15
71
  console.log('');
16
72
  console.log('Mudra skills installed successfully!');
@@ -22,4 +78,4 @@ console.log(' /mudra:mudra-master — auto-classify and route');
22
78
  console.log(' /mudra:mudra-preview — generate 2D app');
23
79
  console.log(' /mudra:mudra-xr — generate 3D/XR app');
24
80
  console.log('');
25
- console.log(`Plugin location: ${target}`);
81
+ console.log(`Plugin location: ${cacheTarget}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mudra-skills",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Claude Code skills for building Mudra Band apps — 2D, 3D/XR, or auto-classified",
5
5
  "type": "module",
6
6
  "bin": {