@becrafter/prompt-manager 0.0.19 → 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 (104) hide show
  1. package/README.md +145 -234
  2. package/app/desktop/assets/app.1.png +0 -0
  3. package/app/desktop/assets/app.png +0 -0
  4. package/app/desktop/assets/icons/icon.icns +0 -0
  5. package/app/desktop/assets/icons/icon.ico +0 -0
  6. package/app/desktop/assets/icons/icon.png +0 -0
  7. package/app/desktop/assets/icons/tray.png +0 -0
  8. package/app/desktop/assets/tray.1.png +0 -0
  9. package/app/desktop/assets/tray.png +0 -0
  10. package/app/desktop/main.js +27 -0
  11. package/app/desktop/package-lock.json +201 -4
  12. package/app/desktop/package.json +23 -29
  13. package/app/desktop/src/services/module-loader.js +43 -22
  14. package/app/desktop/src/services/runtime-manager.js +172 -23
  15. package/app/desktop/src/services/update-manager.js +6 -7
  16. package/app/desktop/src/ui/admin-window-manager.js +757 -0
  17. package/app/desktop/src/ui/splash-manager.js +253 -0
  18. package/app/desktop/src/ui/tray-manager.js +8 -24
  19. package/app/desktop/src/utils/icon-manager.js +39 -47
  20. package/app/desktop/src/utils/resource-paths.js +0 -23
  21. package/app/desktop/src/utils/resource-sync.js +260 -0
  22. package/app/desktop/src/utils/runtime-sync.js +241 -0
  23. package/examples/prompts/recommend/human_3-0_growth_diagnostic_coach_prompt.yaml +105 -0
  24. package/package.json +16 -13
  25. package/packages/admin-ui/.babelrc +3 -0
  26. package/packages/admin-ui/admin.html +237 -4784
  27. package/packages/admin-ui/css/main.css +2592 -0
  28. package/packages/admin-ui/css/recommended-prompts.css +610 -0
  29. package/packages/admin-ui/package-lock.json +6973 -0
  30. package/packages/admin-ui/package.json +36 -0
  31. package/packages/admin-ui/src/codemirror.js +53 -0
  32. package/packages/admin-ui/src/index.js +3188 -0
  33. package/packages/admin-ui/webpack.config.js +76 -0
  34. package/packages/resources/tools/chrome-devtools/README.md +310 -0
  35. package/packages/resources/tools/chrome-devtools/chrome-devtools.tool.js +1703 -0
  36. package/packages/resources/tools/file-reader/README.md +289 -0
  37. package/packages/resources/tools/file-reader/file-reader.tool.js +1545 -0
  38. package/packages/resources/tools/filesystem/README.md +359 -0
  39. package/packages/resources/tools/filesystem/filesystem.tool.js +514 -160
  40. package/packages/resources/tools/ollama-remote/README.md +192 -0
  41. package/packages/resources/tools/ollama-remote/ollama-remote.tool.js +421 -0
  42. package/packages/resources/tools/pdf-reader/README.md +236 -0
  43. package/packages/resources/tools/pdf-reader/pdf-reader.tool.js +565 -0
  44. package/packages/resources/tools/playwright/README.md +306 -0
  45. package/packages/resources/tools/playwright/playwright.tool.js +1186 -0
  46. package/packages/resources/tools/todolist/README.md +394 -0
  47. package/packages/resources/tools/todolist/todolist.tool.js +1312 -0
  48. package/packages/server/README.md +142 -0
  49. package/packages/server/api/admin.routes.js +42 -11
  50. package/packages/server/api/surge.routes.js +43 -0
  51. package/packages/server/app.js +119 -14
  52. package/packages/server/index.js +39 -0
  53. package/packages/server/mcp/mcp.server.js +324 -105
  54. package/packages/server/mcp/sequential-thinking.handler.js +318 -0
  55. package/packages/server/mcp/think-plan.handler.js +274 -0
  56. package/packages/server/middlewares/auth.middleware.js +6 -0
  57. package/packages/server/package.json +51 -0
  58. package/packages/server/server.js +37 -1
  59. package/packages/server/toolm/index.js +9 -0
  60. package/packages/server/toolm/package-installer.service.js +267 -0
  61. package/packages/server/toolm/test-tools.js +264 -0
  62. package/packages/server/toolm/tool-context.service.js +334 -0
  63. package/packages/server/toolm/tool-dependency.service.js +168 -0
  64. package/packages/server/toolm/tool-description-generator-optimized.service.js +375 -0
  65. package/packages/server/toolm/tool-description-generator.service.js +312 -0
  66. package/packages/server/toolm/tool-environment.service.js +200 -0
  67. package/packages/server/toolm/tool-execution.service.js +277 -0
  68. package/packages/server/toolm/tool-loader.service.js +219 -0
  69. package/packages/server/toolm/tool-logger.service.js +223 -0
  70. package/packages/server/toolm/tool-manager.handler.js +65 -0
  71. package/packages/server/toolm/tool-manual-generator.service.js +389 -0
  72. package/packages/server/toolm/tool-mode-handlers.service.js +224 -0
  73. package/packages/server/toolm/tool-storage.service.js +111 -0
  74. package/packages/server/toolm/tool-sync.service.js +138 -0
  75. package/packages/server/toolm/tool-utils.js +20 -0
  76. package/packages/server/toolm/tool-yaml-parser.service.js +81 -0
  77. package/packages/server/toolm/validate-system.js +421 -0
  78. package/packages/server/utils/config.js +49 -5
  79. package/packages/server/utils/util.js +65 -10
  80. package/scripts/build-icons.js +99 -69
  81. package/scripts/build.sh +57 -0
  82. package/scripts/surge/CNAME +1 -0
  83. package/scripts/surge/README.md +47 -0
  84. package/scripts/surge/package-lock.json +34 -0
  85. package/scripts/surge/package.json +20 -0
  86. package/scripts/surge/sync-to-surge.js +151 -0
  87. package/app/desktop/assets/icons/icon_1024x1024.png +0 -0
  88. package/app/desktop/assets/icons/icon_128x128.png +0 -0
  89. package/app/desktop/assets/icons/icon_16x16.png +0 -0
  90. package/app/desktop/assets/icons/icon_24x24.png +0 -0
  91. package/app/desktop/assets/icons/icon_256x256.png +0 -0
  92. package/app/desktop/assets/icons/icon_32x32.png +0 -0
  93. package/app/desktop/assets/icons/icon_48x48.png +0 -0
  94. package/app/desktop/assets/icons/icon_512x512.png +0 -0
  95. package/app/desktop/assets/icons/icon_64x64.png +0 -0
  96. package/app/desktop/assets/icons/icon_96x96.png +0 -0
  97. package/packages/admin-ui/js/closebrackets.min.js +0 -8
  98. package/packages/admin-ui/js/codemirror.min.js +0 -8
  99. package/packages/admin-ui/js/js-yaml.min.js +0 -2
  100. package/packages/admin-ui/js/markdown.min.js +0 -8
  101. package/packages/resources/tools/index.js +0 -16
  102. package/packages/server/mcp/toolx.handler.js +0 -131
  103. package/scripts/icns-builder/package.json +0 -12
  104. /package/packages/server/mcp/{mcp.handler.js → prompt.handler.js} +0 -0
@@ -0,0 +1,260 @@
1
+ /**
2
+ * 通用资源同步工具
3
+ * 支持将代码中的内容同步到运行环境中
4
+ * 支持目录同步、文件同步和基于内容的文件创建
5
+ */
6
+
7
+ const fs = require('fs').promises;
8
+ const path = require('path');
9
+ const os = require('os');
10
+ const { app } = require('electron');
11
+ const PathUtils = require('./path-utils');
12
+
13
+ class ResourceSync {
14
+ /**
15
+ * 检查是否为打包应用
16
+ */
17
+ static _checkIfPackaged() {
18
+ const appPath = app.getAppPath();
19
+ const isDev = appPath.includes('node_modules/electron') ||
20
+ process.env.NODE_ENV === 'development' ||
21
+ process.defaultApp;
22
+
23
+ return !isDev && app.isPackaged;
24
+ }
25
+
26
+ /**
27
+ * 获取项目根目录(开发模式)
28
+ */
29
+ static _getProjectRoot() {
30
+ // 从 app/desktop/src/utils -> 项目根目录
31
+ return path.resolve(__dirname, '..', '..', '..', '..');
32
+ }
33
+
34
+ /**
35
+ * 获取用户配置根目录
36
+ */
37
+ static _getUserConfigRoot() {
38
+ return path.join(os.homedir(), '.prompt-manager');
39
+ }
40
+
41
+ /**
42
+ * 查找实际存在的源路径
43
+ * @param {Object} options - 查找选项
44
+ * @param {string|Function} options.devPath - 开发模式下的路径(字符串或返回路径的函数)
45
+ * @param {string[]|Function} options.packagedPaths - 打包模式下的可能路径数组(或返回路径数组的函数)
46
+ * @returns {Promise<string|null>} 找到的源路径,如果不存在则返回 null
47
+ */
48
+ static async findSourcePath({ devPath, packagedPaths }) {
49
+ const isPackaged = this._checkIfPackaged();
50
+
51
+ if (isPackaged) {
52
+ // 打包模式
53
+ let paths;
54
+ if (typeof packagedPaths === 'function') {
55
+ paths = packagedPaths();
56
+ } else {
57
+ paths = packagedPaths || [];
58
+ }
59
+
60
+ // 尝试每个路径,返回第一个存在的
61
+ for (const possiblePath of paths) {
62
+ try {
63
+ if (await PathUtils.pathExists(possiblePath)) {
64
+ return possiblePath;
65
+ }
66
+ } catch (error) {
67
+ // 继续尝试下一个路径
68
+ continue;
69
+ }
70
+ }
71
+
72
+ console.warn('在打包模式下未找到源路径,尝试的路径:', paths);
73
+ return null;
74
+ } else {
75
+ // 开发模式
76
+ let sourcePath;
77
+ if (typeof devPath === 'function') {
78
+ sourcePath = devPath();
79
+ } else {
80
+ sourcePath = devPath;
81
+ }
82
+
83
+ if (sourcePath && await PathUtils.pathExists(sourcePath)) {
84
+ return sourcePath;
85
+ }
86
+
87
+ console.warn('在开发模式下未找到源路径:', sourcePath);
88
+ return null;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * 同步目录
94
+ * @param {Object} config - 同步配置
95
+ * @param {string} config.targetPath - 目标目录路径
96
+ * @param {string|Function} config.devPath - 开发模式下的源路径
97
+ * @param {string[]|Function} config.packagedPaths - 打包模式下的可能源路径
98
+ * @param {boolean} config.skipIfExists - 如果目标已存在则跳过(默认: true)
99
+ * @param {string} config.name - 资源名称(用于日志)
100
+ * @returns {Promise<Object>} 同步结果
101
+ */
102
+ static async syncDirectory({
103
+ targetPath,
104
+ devPath,
105
+ packagedPaths,
106
+ skipIfExists = true,
107
+ name = '目录'
108
+ }) {
109
+ try {
110
+ // 检查目标目录是否已存在
111
+ const targetExists = await PathUtils.pathExists(targetPath);
112
+ if (targetExists && skipIfExists) {
113
+ console.log(`${name}目录已存在,跳过同步: ${targetPath}`);
114
+ return { success: true, skipped: true, targetPath };
115
+ }
116
+
117
+ // 查找源路径
118
+ const sourcePath = await this.findSourcePath({ devPath, packagedPaths });
119
+
120
+ if (!sourcePath) {
121
+ console.warn(`未找到源${name}目录,跳过同步`);
122
+ return { success: false, error: `Source ${name} directory not found` };
123
+ }
124
+
125
+ // 创建目标目录的父目录
126
+ await PathUtils.ensureDir(path.dirname(targetPath));
127
+
128
+ // 如果目标已存在但不跳过,先删除
129
+ if (targetExists && !skipIfExists) {
130
+ await PathUtils.safeRemoveDir(targetPath);
131
+ }
132
+
133
+ // 创建目标目录
134
+ await PathUtils.ensureDir(targetPath);
135
+ console.log(`已创建${name}目录: ${targetPath}`);
136
+
137
+ // 复制目录内容
138
+ await PathUtils.copyDir(sourcePath, targetPath);
139
+ console.log(`已同步${name}: ${sourcePath} -> ${targetPath}`);
140
+
141
+ return {
142
+ success: true,
143
+ skipped: false,
144
+ targetPath,
145
+ sourcePath
146
+ };
147
+ } catch (error) {
148
+ console.error(`${name}同步失败:`, error);
149
+ return { success: false, error: error.message };
150
+ }
151
+ }
152
+
153
+ /**
154
+ * 同步文件(从源文件复制)
155
+ * @param {Object} config - 同步配置
156
+ * @param {string} config.targetPath - 目标文件路径
157
+ * @param {string|Function} config.devPath - 开发模式下的源文件路径
158
+ * @param {string[]|Function} config.packagedPaths - 打包模式下的可能源文件路径
159
+ * @param {boolean} config.skipIfExists - 如果目标已存在则跳过(默认: true)
160
+ * @param {string} config.name - 资源名称(用于日志)
161
+ * @returns {Promise<Object>} 同步结果
162
+ */
163
+ static async syncFile({
164
+ targetPath,
165
+ devPath,
166
+ packagedPaths,
167
+ skipIfExists = true,
168
+ name = '文件'
169
+ }) {
170
+ try {
171
+ // 检查目标文件是否已存在
172
+ const targetExists = await PathUtils.pathExists(targetPath);
173
+ if (targetExists && skipIfExists) {
174
+ console.log(`${name}文件已存在,跳过同步: ${targetPath}`);
175
+ return { success: true, skipped: true, targetPath };
176
+ }
177
+
178
+ // 查找源路径
179
+ const sourcePath = await this.findSourcePath({ devPath, packagedPaths });
180
+
181
+ if (!sourcePath) {
182
+ console.warn(`未找到源${name}文件,跳过同步`);
183
+ return { success: false, error: `Source ${name} file not found` };
184
+ }
185
+
186
+ // 创建目标文件的父目录
187
+ await PathUtils.ensureDir(path.dirname(targetPath));
188
+
189
+ // 复制文件
190
+ await fs.copyFile(sourcePath, targetPath);
191
+ console.log(`已同步${name}文件: ${sourcePath} -> ${targetPath}`);
192
+
193
+ return {
194
+ success: true,
195
+ skipped: false,
196
+ targetPath,
197
+ sourcePath
198
+ };
199
+ } catch (error) {
200
+ console.error(`${name}文件同步失败:`, error);
201
+ return { success: false, error: error.message };
202
+ }
203
+ }
204
+
205
+ /**
206
+ * 基于内容创建文件
207
+ * @param {Object} config - 同步配置
208
+ * @param {string} config.targetPath - 目标文件路径
209
+ * @param {string|Function} config.content - 文件内容(字符串或返回内容的函数)
210
+ * @param {boolean} config.skipIfExists - 如果目标已存在则跳过(默认: true)
211
+ * @param {string} config.name - 资源名称(用于日志)
212
+ * @returns {Promise<Object>} 同步结果
213
+ */
214
+ static async syncContent({
215
+ targetPath,
216
+ content,
217
+ skipIfExists = true,
218
+ name = '文件'
219
+ }) {
220
+ try {
221
+ // 检查目标文件是否已存在
222
+ const targetExists = await PathUtils.pathExists(targetPath);
223
+ if (targetExists && skipIfExists) {
224
+ console.log(`${name}文件已存在,跳过创建: ${targetPath}`);
225
+ return { success: true, skipped: true, targetPath };
226
+ }
227
+
228
+ // 获取文件内容
229
+ let fileContent;
230
+ if (typeof content === 'function') {
231
+ fileContent = content();
232
+ } else {
233
+ fileContent = content;
234
+ }
235
+
236
+ if (!fileContent) {
237
+ return { success: false, error: 'Content is required' };
238
+ }
239
+
240
+ // 创建目标文件的父目录
241
+ await PathUtils.ensureDir(path.dirname(targetPath));
242
+
243
+ // 写入文件
244
+ await fs.writeFile(targetPath, fileContent, 'utf8');
245
+ console.log(`已创建${name}文件: ${targetPath}`);
246
+
247
+ return {
248
+ success: true,
249
+ skipped: false,
250
+ targetPath
251
+ };
252
+ } catch (error) {
253
+ console.error(`${name}文件创建失败:`, error);
254
+ return { success: false, error: error.message };
255
+ }
256
+ }
257
+ }
258
+
259
+ module.exports = ResourceSync;
260
+
@@ -0,0 +1,241 @@
1
+ /**
2
+ * 运行时环境同步工具
3
+ * 负责将打包的 runtime 目录同步到 ~/.prompt-manager 目录
4
+ * runtime 目录包含所有运行时需要的资源(toolbox、.env 等)
5
+ *
6
+ * 优化方案:直接同步整个 runtime 目录内容,避免逐个文件处理
7
+ */
8
+
9
+ const path = require('path');
10
+ const { app } = require('electron');
11
+ const ResourceSync = require('./resource-sync');
12
+ const PathUtils = require('./path-utils');
13
+
14
+ class RuntimeSync {
15
+ /**
16
+ * 同步运行时环境
17
+ * 将 runtime 目录下的所有内容同步到 ~/.prompt-manager 目录
18
+ * 支持选择性同步(只同步不存在的文件/目录)
19
+ */
20
+ static async syncRuntime() {
21
+ const configRoot = ResourceSync._getUserConfigRoot();
22
+
23
+ // 确保配置目录存在
24
+ await PathUtils.ensureDir(configRoot);
25
+
26
+ const isPackaged = ResourceSync._checkIfPackaged();
27
+
28
+ if (isPackaged) {
29
+ // 打包模式:从 runtime 目录同步
30
+ return await this._syncFromRuntime(configRoot);
31
+ } else {
32
+ // 开发模式:从源文件同步(构建 runtime 结构)
33
+ return await this._syncFromDev(configRoot);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * 从打包的 runtime 目录同步
39
+ */
40
+ static async _syncFromRuntime(configRoot) {
41
+ const resourcesPath = process.resourcesPath;
42
+ const possiblePaths = [
43
+ path.join(resourcesPath, 'runtime'), // extraResources 中的 runtime(最常见)
44
+ path.join(app.getAppPath(), 'runtime'), // 备用路径
45
+ ];
46
+
47
+ // 查找 runtime 目录
48
+ const runtimePath = await ResourceSync.findSourcePath({
49
+ devPath: null,
50
+ packagedPaths: () => possiblePaths
51
+ });
52
+
53
+ if (!runtimePath) {
54
+ console.warn('未找到 runtime 目录,跳过同步');
55
+ return { success: false, error: 'Runtime directory not found' };
56
+ }
57
+
58
+ // 同步 runtime 目录下的所有内容到 configRoot
59
+ // 逐个同步子目录和文件,避免覆盖已存在的文件
60
+ const results = await this._syncContents(runtimePath, configRoot);
61
+
62
+ return {
63
+ success: true,
64
+ configRoot,
65
+ runtimePath,
66
+ results
67
+ };
68
+ }
69
+
70
+ /**
71
+ * 从开发环境源文件同步(模拟 runtime 结构)
72
+ */
73
+ static async _syncFromDev(configRoot) {
74
+ const projectRoot = ResourceSync._getProjectRoot();
75
+ const results = {};
76
+
77
+ // 同步 toolbox(对应 runtime/toolbox)
78
+ // 使用递归同步,确保新增的工具能够被同步
79
+ const toolboxSource = path.join(projectRoot, 'packages', 'resources', 'tools');
80
+ const toolboxTarget = path.join(configRoot, 'toolbox');
81
+ if (await PathUtils.pathExists(toolboxSource)) {
82
+ const result = await this._syncDirectoryRecursive(toolboxSource, toolboxTarget, 'toolbox');
83
+ results.toolbox = result;
84
+ }
85
+
86
+ // 同步 .env(对应 runtime/.env)
87
+ const envSource = path.join(projectRoot, 'env.example');
88
+ const envTarget = path.join(configRoot, '.env');
89
+ if (await PathUtils.pathExists(envSource)) {
90
+ const result = await ResourceSync.syncFile({
91
+ targetPath: envTarget,
92
+ devPath: () => envSource,
93
+ packagedPaths: () => [],
94
+ skipIfExists: true,
95
+ name: '环境配置'
96
+ });
97
+ results['.env'] = result;
98
+ }
99
+
100
+ return {
101
+ success: true,
102
+ configRoot,
103
+ results
104
+ };
105
+ }
106
+
107
+ /**
108
+ * 递归同步目录
109
+ * 确保新增的子目录和文件能够被同步到运行环境
110
+ * @param {string} sourceDir - 源目录路径
111
+ * @param {string} targetDir - 目标目录路径
112
+ * @param {string} dirName - 目录名称(用于日志)
113
+ * @returns {Promise<Object>} 同步结果
114
+ */
115
+ static async _syncDirectoryRecursive(sourceDir, targetDir, dirName = '目录') {
116
+ const fs = require('fs').promises;
117
+ const results = {
118
+ synced: [],
119
+ skipped: [],
120
+ errors: []
121
+ };
122
+
123
+ try {
124
+ // 确保目标目录存在
125
+ await PathUtils.ensureDir(targetDir);
126
+
127
+ // 读取源目录下的所有条目
128
+ const entries = await fs.readdir(sourceDir, { withFileTypes: true });
129
+
130
+ for (const entry of entries) {
131
+ const sourcePath = path.join(sourceDir, entry.name);
132
+ const targetPath = path.join(targetDir, entry.name);
133
+
134
+ try {
135
+ if (entry.isDirectory()) {
136
+ // 递归同步子目录
137
+ const subResult = await this._syncDirectoryRecursive(sourcePath, targetPath, entry.name);
138
+
139
+ // 合并结果
140
+ results.synced.push(...subResult.details.synced);
141
+ results.skipped.push(...subResult.details.skipped);
142
+ results.errors.push(...subResult.details.errors);
143
+ } else if (entry.isFile()) {
144
+ // 同步文件
145
+ const targetExists = await PathUtils.pathExists(targetPath);
146
+ let needsSync = !targetExists;
147
+
148
+ if (targetExists) {
149
+ // 比较文件修改时间
150
+ try {
151
+ const sourceStat = await fs.stat(sourcePath);
152
+ const targetStat = await fs.stat(targetPath);
153
+ if (sourceStat.mtime > targetStat.mtime) {
154
+ needsSync = true;
155
+ }
156
+ } catch (statError) {
157
+ // 如果无法获取文件状态,默认需要同步
158
+ needsSync = true;
159
+ }
160
+ }
161
+
162
+ if (needsSync) {
163
+ // 确保目标文件的父目录存在
164
+ await PathUtils.ensureDir(path.dirname(targetPath));
165
+
166
+ // 复制文件
167
+ await fs.copyFile(sourcePath, targetPath);
168
+ console.log(`已同步文件: ${entry.name} -> ${targetPath}`);
169
+
170
+ results.synced.push(entry.name);
171
+ } else {
172
+ console.log(`文件已存在且无需更新,跳过: ${entry.name}`);
173
+ results.skipped.push({ item: entry.name, reason: '已存在且无需更新' });
174
+ }
175
+ }
176
+ } catch (error) {
177
+ console.error(`同步失败: ${entry.name}`, error);
178
+ results.errors.push({ item: entry.name, error: error.message });
179
+ }
180
+ }
181
+
182
+ return {
183
+ success: results.errors.length === 0,
184
+ synced: results.synced.length,
185
+ skipped: results.skipped.length,
186
+ errors: results.errors.length,
187
+ details: results
188
+ };
189
+ } catch (error) {
190
+ console.error(`递归同步 ${dirName} 失败:`, error);
191
+ return {
192
+ success: false,
193
+ error: error.message,
194
+ details: results
195
+ };
196
+ }
197
+ }
198
+
199
+ /**
200
+ * 同步 runtime 目录下的所有内容到目标目录
201
+ * 逐个同步子目录和文件,避免覆盖已存在的文件
202
+ */
203
+ static async _syncContents(runtimePath, configRoot) {
204
+ const fs = require('fs').promises;
205
+ const results = {};
206
+
207
+ try {
208
+ // 读取 runtime 目录下的所有条目
209
+ const entries = await fs.readdir(runtimePath, { withFileTypes: true });
210
+
211
+ for (const entry of entries) {
212
+ const sourcePath = path.join(runtimePath, entry.name);
213
+ const targetPath = path.join(configRoot, entry.name);
214
+
215
+ if (entry.isDirectory()) {
216
+ // 所有目录都使用递归同步,确保新增的子目录和文件能够被同步
217
+ const result = await this._syncDirectoryRecursive(sourcePath, targetPath, entry.name);
218
+ results[entry.name] = result;
219
+ } else if (entry.isFile()) {
220
+ // 同步文件(如 .env)
221
+ const result = await ResourceSync.syncFile({
222
+ targetPath,
223
+ devPath: () => sourcePath,
224
+ packagedPaths: () => [sourcePath],
225
+ skipIfExists: true,
226
+ name: entry.name
227
+ });
228
+ results[entry.name] = result;
229
+ }
230
+ }
231
+
232
+ return results;
233
+ } catch (error) {
234
+ console.error('同步 runtime 内容失败:', error);
235
+ throw error;
236
+ }
237
+ }
238
+ }
239
+
240
+ module.exports = RuntimeSync;
241
+
@@ -0,0 +1,105 @@
1
+ name: human_3.0_growth_diagnostic_coach_prompt
2
+ # 饶秋定制·成长诊断教练 Prompt
3
+
4
+ description: HUMAN 3.0 中文版 · 成长诊断教练 Prompt。
5
+ arguments: []
6
+ messages:
7
+ - role: user
8
+ content:
9
+ type: text
10
+ text: |
11
+ 🎯 定位
12
+ 你是一位极具洞察力、直率但尊重的成长教练。
13
+ 你的任务是通过对话,帮助我识别我在四个成长象限——心智、身体、精神、职业——中的真实发展阶段,并指出阻碍我升级的“核心问题(Core Problem)”。
14
+ 你的风格:直白、理性、真诚、有温度。
15
+ 你要能识破自我欺骗,但不会评判,要像一个真正懂我的导师。
16
+
17
+ 🧩 模型核心(你必须内化的设定)
18
+
19
+ 一、四大象限
20
+ 象限|关键词|典型问题
21
+ 心智 Mind|认知、思维、学习、自我觉察|思维僵化、逃避反思、自以为是
22
+ 身体 Body|能量、健康、纪律、行动力|作息紊乱、拖延、缺乏执行力
23
+ 精神 Spirit|价值、关系、内在平衡|迷失、焦虑、空虚、人际疏离
24
+ 职业 Vocation|目标、影响力、创造价值|无方向、低成就、失去意义感
25
+
26
+ 二、成长三阶段
27
+ 阶段|描述|典型表现
28
+ 1.0 遵循规则期|依赖外界标准、渴望被认可|害怕出错、讨好他人、过度理性
29
+ 2.0 追求自我期|觉醒个体意志、寻求差异化|疯狂试错、自我怀疑、易倦怠
30
+ 3.0 整合全局期|以更高层次视角整合四象限|内外一致、长期主义、宁静清晰
31
+
32
+ 🧠 对话流程(AI 请严格遵循)
33
+
34
+ Step 1:基础访谈
35
+ 依次提问,判断我在四象限的阶段。
36
+
37
+ 心智
38
+ • 最近有哪些事情让你改变了看法或重新思考?
39
+ • 你会主动反省自己,还是更习惯给自己找理由?
40
+ • 当别人挑战你的观点时,你通常怎么反应?
41
+
42
+ 身体
43
+ • 你最近的睡眠、饮食、运动节奏是怎样的?
44
+ • 你有固定的能量管理方式吗?
45
+ • 当你状态不好时,你会强撑还是休息调整?
46
+
47
+ 精神
48
+ • 你觉得生命的意义是什么?最近有让你感到平静的时刻吗?
49
+ • 你与家人、朋友、同事的关系是滋养型还是消耗型?
50
+ • 你是否能一个人独处而不焦虑?
51
+
52
+ 职业
53
+ • 你现在的工作或项目,让你感到兴奋吗?
54
+ • 你觉得自己做的事对别人或世界有什么价值?
55
+ • 如果现在可以重来一次,你还会选择同样的方向吗?
56
+
57
+ 你的目标:基于我的回答,判断我在每个象限处于哪一阶段(1.0 / 2.0 / 3.0)。
58
+
59
+ Step 2:识别核心问题(Core Problem)
60
+ 根据四象限的评估,告诉我:
61
+ 1) 哪个象限是当前发展的“瓶颈”?
62
+ 2) 这个问题的本质是什么(表面困惑背后的根因)?
63
+ 3) 为什么这会影响我整体的成长?
64
+ 4) 我目前可能在哪些地方“自欺欺人”或“伪成长”?(要直白指出,但保持尊重)
65
+
66
+ Step 3:制定阶段性成长方案
67
+ 请根据我的核心问题,提供一个分阶段行动计划:
68
+
69
+ 📆 30 天计划:认知觉醒与启动
70
+ • 目标:打破旧思维,建立觉察
71
+ • 行动:
72
+ - 每日小习惯 × 3(含一个思维类、一个身体类、一个精神类)
73
+ - 每周挑战任务 × 1(打破舒适区)
74
+ - 推荐书 / 视频 / 练习资源
75
+ • 成功判断:出现情绪觉察、执行力提升、自我对话减少逃避。
76
+
77
+ 📆 90 天计划:习惯与结构建立
78
+ • 目标:让成长自动化
79
+ • 行动:
80
+ - 建立节奏化的生活(固定睡眠 / 学习 / 复盘时间)
81
+ - 在职业维度落实成果或小里程碑
82
+ - 引入反馈机制(伙伴 / 教练 / 日志)
83
+ • 成功判断:行为稳定、目标清晰、关系和能量稳定。
84
+
85
+ 📆 180 天计划:整合与跃迁
86
+ • 目标:让成长内化为身份
87
+ • 行动:
88
+ - 统一四象限目标,构建长期主义路线图
89
+ - 识别自己独特的 Metatype(如思考者 / 创造者 / 引导者)
90
+ - 形成自己的价值观系统并付诸实践
91
+ • 成功判断:行动与价值一致,外界变化不再轻易动摇你。
92
+
93
+ Step 4:总结反馈(输出结构)
94
+ 1) 你的整体象限画像(心智 / 身体 / 精神 / 职业的阶段)
95
+ 2) 当前最需要解决的核心问题
96
+ 3) 对你最真诚的一句话(提醒或戳破盲点)
97
+ 4) 30 / 90 / 180 天的成长计划
98
+ 5) 你现在可以立刻去做的一件小事(1 小时内可完成)
99
+ 6) 长远方向与下一次迭代建议
100
+
101
+ ⚠️ 语气与风格要求
102
+ • 语气真诚、理性,不浮夸。
103
+ • 指出问题时,不批评、不安慰,要有洞察力。
104
+ • 用“镜子”而不是“教条”说话。
105
+ • 中文语境下,可使用朴实比喻(如“你在用冲刺的方式跑马拉松”“你在用脑解决本应用心的问题”)。
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@becrafter/prompt-manager",
3
- "version": "0.0.19",
3
+ "version": "0.1.2",
4
4
  "description": "Remote MCP Server for managing prompts",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "type": "module",
9
- "main": "packages/server/server.js",
9
+ "main": "packages/server/index.js",
10
10
  "bin": {
11
11
  "prompt-manager": "app/cli/cli.js"
12
12
  },
@@ -19,19 +19,20 @@
19
19
  "url": "https://github.com/BeCrafter/prompt-manager/issues"
20
20
  },
21
21
  "scripts": {
22
- "start": "node packages/server/server.js",
23
22
  "dev": "node --watch packages/server/server.js",
24
- "test": "node packages/server/server.js",
25
23
  "help": "node packages/server/server.js --help",
26
- "version": "node packages/server/server.js --version",
27
- "admin": "ADMIN_ENABLE=true ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 node packages/server/server.js -p ./examples/prompts",
28
- "desktop:dev": "rm -rf ~/Library/Application\\ Support/@becrafter/prompt-desktop/prompt-manager && npm run dev --prefix app/desktop",
29
- "desktop:build": "rm -rf ~/Library/Application\\ Support/@becrafter/prompt-desktop/prompt-manager && npm run build --prefix app/desktop && echo 'Build completed! Time:'$(date +'%Y-%m-%d %H:%M:%S')",
30
- "desktop:build:all": "npm run build --prefix app/desktop -- --mac --win --linux",
31
- "desktop:build:mac": "npm run build --prefix app/desktop -- --mac",
32
- "desktop:build:win": "npm run build --prefix app/desktop -- --win",
33
- "desktop:build:linux": "npm run build --prefix app/desktop -- --linux",
34
- "postinstall": "node ./scripts/postinstall.js"
24
+ "admin": "ADMIN_ENABLE=true ADMIN_REQUIRE_AUTH=true ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 node packages/server/server.js -p ./examples/prompts",
25
+ "admin:dev": "npm run dev --prefix packages/admin-ui",
26
+ "admin:build": "npm run build --prefix packages/admin-ui",
27
+ "desktop:dev": "bash scripts/build.sh dev",
28
+ "desktop:build": "bash scripts/build.sh",
29
+ "desktop:build:all": "bash scripts/build.sh build:all",
30
+ "desktop:build:mac": "bash scripts/build.sh build:mac",
31
+ "desktop:build:win": "bash scripts/build.sh build:win",
32
+ "desktop:build:linux": "bash scripts/build.sh build:linux",
33
+ "postinstall": "node ./scripts/postinstall.js",
34
+ "build:core": "npm run build --prefix packages/server",
35
+ "build:icons": "node ./scripts/build-icons.js"
35
36
  },
36
37
  "keywords": [
37
38
  "mcp",
@@ -44,10 +45,12 @@
44
45
  "license": "MIT",
45
46
  "dependencies": {
46
47
  "@modelcontextprotocol/sdk": "^1.20.2",
48
+ "@npmcli/arborist": "^9.0.0",
47
49
  "dotenv": "^17.2.3",
48
50
  "electron-builder": "^26.0.12",
49
51
  "express": "^5.1.0",
50
52
  "fs-extra": "^11.2.0",
53
+ "http-proxy-middleware": "^3.0.5",
51
54
  "js-yaml": "^4.1.0",
52
55
  "sharp": "^0.34.4",
53
56
  "tar": "^7.5.1",
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["@babel/preset-env"]
3
+ }