dsh-env-manager-plugin 0.1.0 → 0.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.
Files changed (81) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +274 -250
  3. package/client.js +2581 -2581
  4. package/cordis.patch.yml +4 -4
  5. package/docs/00-project/current-state.md +32 -6
  6. package/docs/00-project/glossary.md +215 -215
  7. package/docs/00-project/project-brief.md +114 -114
  8. package/docs/00-project/roadmap.md +89 -89
  9. package/docs/01-architecture/DSH_Environment_Service_Memory_Skill_Brainstorm.md +493 -493
  10. package/docs/01-architecture/api-verification.md +416 -416
  11. package/docs/01-architecture/architecture-overview.md +222 -222
  12. package/docs/01-architecture/data-model.md +930 -930
  13. package/docs/01-architecture/decisions/ADR-0001-plugin-as-bundle.md +29 -29
  14. package/docs/01-architecture/decisions/ADR-0002-file-based-storage.md +25 -25
  15. package/docs/01-architecture/decisions/ADR-0003-skill-router-over-search.md +25 -25
  16. package/docs/01-architecture/decisions/ADR-0004-typescript-host-js-client.md +31 -31
  17. package/docs/01-architecture/decisions/ADR-0005-layered-rule-resolution.md +36 -36
  18. package/docs/01-architecture/decisions/ADR-0006-credentials-as-references.md +30 -30
  19. package/docs/01-architecture/decisions/ADR-0007-session-scoped-default-environment.md +28 -28
  20. package/docs/01-architecture/decisions/ADR-0008-memory-bridge-not-second-store.md +31 -31
  21. package/docs/01-architecture/decisions/ADR-0009-client-host-http-transport.md +87 -87
  22. package/docs/01-architecture/decisions/ADR-0010-environment-plane-model.md +87 -87
  23. package/docs/01-architecture/decisions/ADR-0011-k8s-node-execution-model.md +92 -92
  24. package/docs/01-architecture/design.md +666 -666
  25. package/docs/01-architecture/detailed-design.md +961 -961
  26. package/docs/01-architecture/implementation-plan.md +323 -323
  27. package/docs/01-architecture/module-boundaries.md +306 -306
  28. package/docs/01-architecture/security-model.md +227 -227
  29. package/docs/01-architecture/storage-contract.md +224 -224
  30. package/docs/01-architecture/tool-contract.md +438 -438
  31. package/docs/01-architecture/ui-design.md +587 -587
  32. package/docs/02-harness/agent-behavior.md +36 -36
  33. package/docs/02-harness/change-snapshot-policy.md +29 -29
  34. package/docs/02-harness/client-ui-integration.md +110 -110
  35. package/docs/02-harness/context-policy.md +43 -43
  36. package/docs/02-harness/harness-standard.md +91 -91
  37. package/docs/02-harness/task-execution-policy.md +26 -26
  38. package/docs/02-harness/verification-policy.md +97 -97
  39. package/docs/03-openspec/archive-rule.md +25 -25
  40. package/docs/03-openspec/bugfix-rule.md +30 -30
  41. package/docs/03-openspec/design-rule.md +33 -33
  42. package/docs/03-openspec/openspec-usage-guide.md +31 -31
  43. package/docs/03-openspec/proposal-rule.md +70 -70
  44. package/docs/03-openspec/spec-rule.md +33 -33
  45. package/docs/03-openspec/tasks-rule.md +31 -31
  46. package/docs/04-development/coding-style.md +67 -67
  47. package/docs/04-development/dependency-policy.md +43 -43
  48. package/docs/04-development/development-guide.md +85 -85
  49. package/docs/04-development/directory-convention.md +105 -105
  50. package/docs/04-development/local-run-guide.md +61 -55
  51. package/docs/04-development/testing-guide.md +102 -102
  52. package/docs/05-domain/deployment-template.md +76 -76
  53. package/docs/05-domain/environment-template.md +165 -165
  54. package/docs/05-domain/operation-binding-template.md +55 -55
  55. package/docs/05-domain/operation-record-template.md +55 -55
  56. package/docs/05-domain/prompt-template.md +90 -90
  57. package/docs/05-domain/rule-template.md +73 -73
  58. package/docs/05-domain/service-template.md +39 -39
  59. package/docs/06-operations/deployment-guide.md +54 -54
  60. package/docs/06-operations/release.md +198 -188
  61. package/docs/06-operations/security-policy.md +53 -53
  62. package/docs/06-operations/troubleshooting.md +141 -91
  63. package/docs/07-templates/adr-template.md +21 -21
  64. package/docs/07-templates/bugfix-template.md +11 -11
  65. package/docs/07-templates/case-template.md +15 -15
  66. package/docs/07-templates/design-template.md +29 -29
  67. package/docs/07-templates/proposal-template.md +19 -19
  68. package/docs/07-templates/spec-template.md +15 -15
  69. package/docs/07-templates/tasks-template.md +12 -12
  70. package/docs/99-archive/README.md +13 -13
  71. package/docs/README.md +142 -142
  72. package/icon.svg +4 -4
  73. package/index.js +31 -8
  74. package/lib/app/app.d.ts +1 -1
  75. package/lib/app/app.js +4 -1
  76. package/lib/app/app.js.map +1 -1
  77. package/lib/skill.js +37 -37
  78. package/locale/en.json +6 -6
  79. package/locale/zh.json +6 -6
  80. package/package.json +101 -99
  81. package/scripts/repair-profile.mjs +141 -0
package/package.json CHANGED
@@ -1,99 +1,101 @@
1
- {
2
- "name": "dsh-env-manager-plugin",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "description": "Environment registry, service catalog and operation-to-Skill routing for DSH.",
6
- "author": "zhiwuli0228",
7
- "homepage": "https://github.com/zhiwuli0228/dsh-env-manager#readme",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/zhiwuli0228/dsh-env-manager.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/zhiwuli0228/dsh-env-manager/issues"
14
- },
15
- "exports": {
16
- ".": "./index.js",
17
- "./client": "./client.js",
18
- "./locale/*.json": "./locale/*.json",
19
- "./icon": "./icon.svg",
20
- "./package.json": "./package.json"
21
- },
22
- "files": [
23
- "index.js",
24
- "client.js",
25
- "cordis.patch.yml",
26
- "lib/",
27
- "locale/*.json",
28
- "icon.svg",
29
- "README.md",
30
- "LICENSE",
31
- "docs/"
32
- ],
33
- "keywords": [
34
- "dsh",
35
- "dsh-plugin",
36
- "environment",
37
- "service-registry",
38
- "ops"
39
- ],
40
- "license": "MIT",
41
- "engines": {
42
- "node": ">=20",
43
- "dsh": ">=0.2.1-rc.5"
44
- },
45
- "publishConfig": {
46
- "access": "public"
47
- },
48
- "dsh": {
49
- "bundle": {
50
- "patch": "./cordis.patch.yml"
51
- },
52
- "client": {
53
- "platform": "web",
54
- "immediately": true
55
- }
56
- },
57
- "dependencies": {
58
- "@deepseek-ai/schemastery": "^3.18.5",
59
- "yaml": "^2.9.1",
60
- "zod": "^4.6.7"
61
- },
62
- "devDependencies": {
63
- "@deepseek-ai/cordis": "~4.0.5",
64
- "@deepseek-ai/dsh-agent": "0.2.1-rc.5",
65
- "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
66
- "@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.5",
67
- "@deepseek-ai/dsh-sandbox": "0.2.1-rc.5",
68
- "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.5",
69
- "@deepseek-ai/dsh-scope": "0.2.1-rc.5",
70
- "@deepseek-ai/dsh-session": "0.2.1-rc.5",
71
- "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
72
- "@deepseek-ai/dsh-tools": "0.2.1-rc.5",
73
- "@deepseek-ai/dsh-user-approval": "0.2.1-rc.5",
74
- "@deepseek-ai/dsh-util-values": "0.2.1-rc.5",
75
- "@deepseek-ai/dsh-working-directory": "0.2.1-rc.5",
76
- "@types/node": "^24.19.2",
77
- "typescript": "^5.9.3",
78
- "vitest": "^3.2.7"
79
- },
80
- "scripts": {
81
- "build": "tsc -p tsconfig.json",
82
- "typecheck": "tsc -p tsconfig.json --noEmit",
83
- "test": "vitest run",
84
- "test:watch": "vitest",
85
- "check": "npm run typecheck && npm run build && npm test && node --check client.js",
86
- "prepack": "npm run build"
87
- },
88
- "main": "index.js",
89
- "peerDependencies": {
90
- "@deepseek-ai/cordis": "~4.0.5",
91
- "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
92
- "@deepseek-ai/dsh-tools": "0.2.1-rc.5"
93
- },
94
- "peerDependenciesMeta": {
95
- "@deepseek-ai/cordis": {
96
- "optional": "true"
97
- }
98
- }
99
- }
1
+ {
2
+ "name": "dsh-env-manager-plugin",
3
+ "version": "0.1.2",
4
+ "type": "module",
5
+ "description": "Environment registry, service catalog and operation-to-Skill routing for DSH.",
6
+ "author": "zhiwuli0228",
7
+ "homepage": "https://github.com/zhiwuli0228/dsh-env-manager#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/zhiwuli0228/dsh-env-manager.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/zhiwuli0228/dsh-env-manager/issues"
14
+ },
15
+ "exports": {
16
+ ".": "./index.js",
17
+ "./client": "./client.js",
18
+ "./locale/*.json": "./locale/*.json",
19
+ "./icon": "./icon.svg",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "index.js",
24
+ "client.js",
25
+ "cordis.patch.yml",
26
+ "lib/",
27
+ "locale/*.json",
28
+ "icon.svg",
29
+ "README.md",
30
+ "LICENSE",
31
+ "docs/",
32
+ "scripts/repair-profile.mjs"
33
+ ],
34
+ "keywords": [
35
+ "dsh",
36
+ "dsh-plugin",
37
+ "environment",
38
+ "service-registry",
39
+ "ops"
40
+ ],
41
+ "license": "MIT",
42
+ "engines": {
43
+ "node": ">=20",
44
+ "dsh": ">=0.2.1-rc.5"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "dsh": {
50
+ "bundle": {
51
+ "patch": "./cordis.patch.yml"
52
+ },
53
+ "client": {
54
+ "platform": "web",
55
+ "immediately": true
56
+ }
57
+ },
58
+ "dependencies": {
59
+ "@deepseek-ai/schemastery": "^3.18.5",
60
+ "yaml": "^2.9.1",
61
+ "zod": "^4.6.7"
62
+ },
63
+ "devDependencies": {
64
+ "@deepseek-ai/cordis": "~4.0.5",
65
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.5",
66
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
67
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.5",
68
+ "@deepseek-ai/dsh-sandbox": "0.2.1-rc.5",
69
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.5",
70
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.5",
71
+ "@deepseek-ai/dsh-session": "0.2.1-rc.5",
72
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
73
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.5",
74
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.5",
75
+ "@deepseek-ai/dsh-util-values": "0.2.1-rc.5",
76
+ "@deepseek-ai/dsh-working-directory": "0.2.1-rc.5",
77
+ "@types/node": "^24.19.2",
78
+ "typescript": "^5.9.3",
79
+ "vitest": "^3.2.7"
80
+ },
81
+ "scripts": {
82
+ "build": "tsc -p tsconfig.json",
83
+ "typecheck": "tsc -p tsconfig.json --noEmit",
84
+ "test": "vitest run",
85
+ "test:watch": "vitest",
86
+ "check": "npm run typecheck && npm run build && npm test && node --check client.js && node --check index.js",
87
+ "repair:profile": "node scripts/repair-profile.mjs",
88
+ "prepack": "npm run build"
89
+ },
90
+ "main": "index.js",
91
+ "peerDependencies": {
92
+ "@deepseek-ai/cordis": "~4.0.5",
93
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
94
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.5"
95
+ },
96
+ "peerDependenciesMeta": {
97
+ "@deepseek-ai/cordis": {
98
+ "optional": "true"
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Repair a DSH profile that has a duplicated or half-removed environment-manager
4
+ * bundle. This script only edits the profile's package.json; it never installs
5
+ * packages and never touches registry data under `data/`.
6
+ *
7
+ * Usage:
8
+ * node scripts/repair-profile.mjs [--profile <name>] [--fix]
9
+ *
10
+ * Without --fix it reports problems and exits nonzero. With --fix it rewrites the
11
+ * package.json atomically after creating a timestamped backup.
12
+ */
13
+
14
+ import fs from 'node:fs'
15
+ import os from 'node:os'
16
+ import path from 'node:path'
17
+
18
+ const PLUGIN = 'dsh-env-manager-plugin'
19
+ const LEGACY = 'dsh-env-manager'
20
+
21
+ function pathEntryExists(candidate) {
22
+ try {
23
+ fs.lstatSync(candidate)
24
+ return true
25
+ } catch {
26
+ return false
27
+ }
28
+ }
29
+
30
+ const argv = process.argv.slice(2)
31
+ const fix = argv.includes('--fix')
32
+ const profileIndex = argv.indexOf('--profile')
33
+ const profile =
34
+ profileIndex >= 0 && argv[profileIndex + 1]
35
+ ? argv[profileIndex + 1]
36
+ : process.env.DSH_PROFILE
37
+
38
+ if (!profile) {
39
+ console.error('Missing profile. Pass --profile <name> or set DSH_PROFILE.')
40
+ process.exit(2)
41
+ }
42
+
43
+ const dshHome = process.env.DSH_HOME || path.join(os.homedir(), '.dsh')
44
+ const profileDir = path.join(dshHome, 'profiles', profile)
45
+ const packagePath = path.join(profileDir, 'package.json')
46
+
47
+ if (!fs.existsSync(packagePath)) {
48
+ console.error(`Profile package.json not found: ${packagePath}`)
49
+ process.exit(2)
50
+ }
51
+
52
+ let pkg
53
+ try {
54
+ pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
55
+ } catch (error) {
56
+ console.error(`Cannot parse ${packagePath}: ${error.message}`)
57
+ process.exit(2)
58
+ }
59
+
60
+ const dependencies = pkg.dependencies && typeof pkg.dependencies === 'object' ? pkg.dependencies : {}
61
+ const profileConfig = pkg.dsh?.profile
62
+ const bundles = Array.isArray(profileConfig?.bundles) ? profileConfig.bundles : []
63
+ const pluginEntries = bundles.filter((entry) => entry === PLUGIN).length
64
+ const legacyEntries = bundles.filter((entry) => entry === LEGACY).length
65
+ const dependencyEntries = Object.prototype.hasOwnProperty.call(dependencies, PLUGIN)
66
+ const legacyDependency = Object.prototype.hasOwnProperty.call(dependencies, LEGACY)
67
+ const pluginLib = path.join(profileDir, 'node_modules', PLUGIN, 'lib', 'index.js')
68
+ const legacyLink = path.join(profileDir, 'node_modules', LEGACY)
69
+
70
+ const problems = []
71
+ if (pluginEntries > 1) {
72
+ problems.push(`${PLUGIN} appears ${pluginEntries} times in dsh.profile.bundles`)
73
+ }
74
+ if (legacyEntries > 0) {
75
+ problems.push(`legacy ${LEGACY} still appears in dsh.profile.bundles`)
76
+ }
77
+ if (legacyDependency) {
78
+ problems.push(`legacy ${LEGACY} is still a dependency`)
79
+ }
80
+ if (dependencyEntries && pluginEntries === 0) {
81
+ problems.push(`${PLUGIN} is a dependency but missing from dsh.profile.bundles`)
82
+ }
83
+ if (dependencyEntries && !fs.existsSync(pluginLib)) {
84
+ problems.push(`installed package is missing ${pluginLib}`)
85
+ }
86
+ if (legacyLink && pathEntryExists(legacyLink)) {
87
+ problems.push(`stale legacy node_modules entry exists: ${legacyLink}`)
88
+ }
89
+
90
+ console.log(`profile: ${profileDir}`)
91
+ console.log(`package: ${packagePath}`)
92
+ if (problems.length === 0) {
93
+ console.log('OK: one plugin dependency and one bundle entry; build output present.')
94
+ process.exit(0)
95
+ }
96
+
97
+ console.log('Problems:')
98
+ for (const problem of problems) console.log(`- ${problem}`)
99
+
100
+ if (!fix) {
101
+ console.log('Run again with --fix to repair package.json (registry data is untouched).')
102
+ process.exit(1)
103
+ }
104
+
105
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
106
+ const backupPath = `${packagePath}.bak-repair-${timestamp}`
107
+ fs.copyFileSync(packagePath, backupPath)
108
+
109
+ const nextBundles = []
110
+ let seenPlugin = false
111
+ for (const entry of bundles) {
112
+ if (entry === LEGACY) continue
113
+ if (entry === PLUGIN) {
114
+ if (seenPlugin) continue
115
+ seenPlugin = true
116
+ }
117
+ nextBundles.push(entry)
118
+ }
119
+ if (dependencyEntries && !seenPlugin) nextBundles.push(PLUGIN)
120
+
121
+ const nextDependencies = { ...dependencies }
122
+ delete nextDependencies[LEGACY]
123
+ pkg.dependencies = nextDependencies
124
+ pkg.dsh = pkg.dsh || {}
125
+ pkg.dsh.profile = pkg.dsh.profile || {}
126
+ pkg.dsh.profile.bundles = nextBundles
127
+
128
+ const temporary = `${packagePath}.tmp-repair-${process.pid}`
129
+ fs.writeFileSync(temporary, `${JSON.stringify(pkg, null, 2)}\n`, 'utf8')
130
+ fs.renameSync(temporary, packagePath)
131
+
132
+ console.log(`Backup: ${backupPath}`)
133
+ console.log('Repaired package.json. Restart DSH, then reinstall with plugin_manager if needed.')
134
+ if (legacyLink && pathEntryExists(legacyLink)) {
135
+ console.log(`Warning: remove the stale link manually after verifying it: ${legacyLink}`)
136
+ }
137
+ if (dependencyEntries && !fs.existsSync(pluginLib)) {
138
+ console.error(`Still missing after repair: ${pluginLib}`)
139
+ console.error('Reinstall the bundle with plugin_manager; do not copy files by hand.')
140
+ process.exit(1)
141
+ }