prompt-skill-armory 0.4.2 → 0.4.3

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/cli.cjs +44 -35
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -2,25 +2,22 @@
2
2
  /**
3
3
  * prompt-skill-armory — one-command installer.
4
4
  *
5
- * npx prompt-skill-armory # install into the DeepSeek Harness web profile
5
+ * npx prompt-skill-armory # install into all DeepSeek Harness profiles
6
6
  * npx prompt-skill-armory --postinstall
7
7
  *
8
8
  * What it does:
9
9
  * 1. Locates the harness home (~/.dsh, or $DSH_HOME).
10
- * 2. Ensures the web profile exists.
11
- * 3. Copies the bundled plugin packages
12
- * (@deepseek-ai/dsh-switchblade + @deepseek-ai/dsh-client-ui-switchblade)
13
- * into the profile's node_modules/@deepseek-ai/.
14
- * 4. Adds the Host bundle to the profile's dsh.profile.bundles.
15
- * 5. Prints next steps (build + launch).
10
+ * 2. Finds every profile under profiles/ (web, desktop, …) and installs the
11
+ * bundled plugin packages into each profile's node_modules/@deepseek-ai/.
12
+ * 3. Adds the Host bundle to each profile's dsh.profile.bundles.
13
+ * 4. Prints next steps (build + launch).
16
14
  *
17
- * The plugin packages ship inside this installer under packages/ (built lib +
18
- * source + manifests), so no separate DSH repo checkout is needed to install
19
- * the plugin itself — the DSH runtime is still required to RUN it.
15
+ * Works with both the official `dsh` and the DSH Desktop client, which use the
16
+ * same ~/.dsh/profiles layout.
20
17
  */
21
18
  'use strict'
22
19
 
23
- const { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } = require('node:fs')
20
+ const { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } = require('node:fs')
24
21
  const { homedir } = require('node:os')
25
22
  const { join } = require('node:path')
26
23
 
@@ -30,9 +27,6 @@ const BUNDLED = join(here, 'packages')
30
27
  /** Harness home; default ~/.dsh, overridable via DSH_HOME. */
31
28
  const dshHome = process.env.DSH_HOME ?? join(homedir(), '.dsh')
32
29
  const profilesDir = join(dshHome, 'profiles')
33
- const webProfile = join(profilesDir, 'web')
34
- const scopedDir = join(webProfile, 'node_modules', '@deepseek-ai')
35
- const manifestPath = join(webProfile, 'package.json')
36
30
 
37
31
  const HOST_BUNDLE = '@deepseek-ai/dsh-switchblade'
38
32
 
@@ -48,25 +42,34 @@ function bundledPackages() {
48
42
  return out
49
43
  }
50
44
 
51
- /** Copy one bundled package into the profile's @deepseek-ai scope. */
52
- function installPackage(pkg) {
45
+ /** Profiles that exist and look like dsh profiles (have node_modules + package.json). */
46
+ function findProfiles() {
47
+ if (!existsSync(profilesDir)) return []
48
+ const out = []
49
+ for (const name of readdirSync(profilesDir)) {
50
+ const dir = join(profilesDir, name)
51
+ if (!existsSync(join(dir, 'package.json'))) continue
52
+ if (!existsSync(join(dir, 'node_modules'))) continue
53
+ out.push(dir)
54
+ }
55
+ return out
56
+ }
57
+
58
+ /** Copy one bundled package into a profile's @deepseek-ai scope. */
59
+ function installPackage(pkg, profileDir) {
60
+ const scopedDir = join(profileDir, 'node_modules', '@deepseek-ai')
53
61
  const short = pkg.name.slice('@deepseek-ai/'.length)
54
62
  const dest = join(scopedDir, short)
55
63
  mkdirSync(scopedDir, { recursive: true })
64
+ rmSync(dest, { recursive: true, force: true })
56
65
  cpSync(pkg.from, dest, { recursive: true, force: true })
57
66
  console.log(` ✓ ${pkg.name} → ${dest}`)
58
67
  }
59
68
 
60
- /** Add the Host bundle to the web profile's dsh.profile.bundles. */
61
- function addBundle() {
62
- if (!existsSync(manifestPath)) {
63
- writeFileSync(manifestPath, JSON.stringify({
64
- name: 'dsh-profile-web',
65
- private: true,
66
- dependencies: {},
67
- dsh: { profile: { bundles: ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app'] } },
68
- }, null, 2))
69
- }
69
+ /** Add the Host bundle to a profile's dsh.profile.bundles. */
70
+ function addBundle(profileDir) {
71
+ const manifestPath = join(profileDir, 'package.json')
72
+ if (!existsSync(manifestPath)) return
70
73
  const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))
71
74
  const bundles = manifest.dsh?.profile?.bundles ?? []
72
75
  if (!bundles.includes(HOST_BUNDLE)) {
@@ -75,7 +78,7 @@ function addBundle() {
75
78
  writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`)
76
79
  console.log(` ✓ added ${HOST_BUNDLE} to ${manifestPath}`)
77
80
  } else {
78
- console.log(` · ${HOST_BUNDLE} already in bundles`)
81
+ console.log(` · ${HOST_BUNDLE} already in ${manifestPath}`)
79
82
  }
80
83
  }
81
84
 
@@ -93,16 +96,22 @@ function main() {
93
96
  process.exit(1)
94
97
  }
95
98
 
96
- mkdirSync(webProfile, { recursive: true })
97
- console.log(` profile: ${webProfile}`)
98
- for (const pkg of pkgs) installPackage(pkg)
99
- addBundle()
99
+ const profiles = findProfiles()
100
+ if (profiles.length === 0) {
101
+ console.error(` no dsh profiles found under ${profilesDir}`)
102
+ console.error(' (start dsh once so the profile is created, then re-run this)')
103
+ process.exit(1)
104
+ }
105
+
106
+ for (const profileDir of profiles) {
107
+ console.log(` profile: ${profileDir}`)
108
+ for (const pkg of pkgs) installPackage(pkg, profileDir)
109
+ addBundle(profileDir)
110
+ }
100
111
 
101
112
  console.log('')
102
- console.log(' Next steps (run in your DeepSeek Harness checkout):')
103
- console.log(' cd deepseek-harness')
104
- console.log(' pnpm run build')
105
- console.log(' pnpm dsh web')
113
+ console.log(' Next steps:')
114
+ console.log(' dsh web (or relaunch the DSH Desktop client)')
106
115
  console.log('')
107
116
  console.log(' Open Settings → Prompt-SkillArmory (book icon).')
108
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prompt-skill-armory",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "One-command installer for Prompt-SkillArmory (prompts + skills manager) into a DeepSeek Harness web profile",
5
5
  "type": "module",
6
6
  "bin": {