@becrafter/prompt-manager 0.1.1 → 0.1.8

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 (110) hide show
  1. package/README.md +304 -121
  2. package/app/cli/commands/start.js +28 -4
  3. package/app/cli/support/argv.js +6 -0
  4. package/env.example +32 -0
  5. package/package.json +36 -6
  6. package/packages/server/api/admin.routes.js +409 -1
  7. package/packages/server/api/open.routes.js +7 -2
  8. package/packages/server/api/tool.routes.js +479 -0
  9. package/packages/server/app.js +97 -25
  10. package/packages/server/configs/models/built-in/bigmodel.yaml +6 -0
  11. package/packages/server/configs/models/providers.yaml +50 -0
  12. package/packages/server/configs/templates/built-in/general-iteration.yaml +60 -0
  13. package/packages/server/configs/templates/built-in/general-optimize.yaml +63 -0
  14. package/packages/server/configs/templates/built-in/output-format-optimize.yaml +95 -0
  15. package/packages/server/mcp/heartbeat-patch.js +73 -0
  16. package/packages/server/mcp/mcp.server.js +63 -314
  17. package/packages/server/mcp/prompt.handler.js +26 -0
  18. package/packages/server/mcp/thinking-toolkit.handler.js +380 -0
  19. package/packages/server/package.json +35 -3
  20. package/packages/server/server.js +114 -12
  21. package/packages/server/services/TerminalService.js +498 -0
  22. package/packages/server/services/WebSocketService.js +484 -0
  23. package/packages/server/services/manager.js +38 -7
  24. package/packages/server/services/model.service.js +473 -0
  25. package/packages/server/services/optimization.service.js +457 -0
  26. package/packages/server/services/template.service.js +333 -0
  27. package/packages/server/toolm/tool-description-generator-optimized.service.js +5 -2
  28. package/packages/server/toolm/tool-sync.service.js +47 -3
  29. package/packages/server/utils/config.js +8 -1
  30. package/packages/server/utils/port-checker.js +63 -0
  31. package/packages/server/utils/util.js +27 -0
  32. package/IFLOW.md +0 -175
  33. package/app/desktop/assets/app.1.png +0 -0
  34. package/app/desktop/assets/app.png +0 -0
  35. package/app/desktop/assets/icons/icon.icns +0 -0
  36. package/app/desktop/assets/icons/icon.ico +0 -0
  37. package/app/desktop/assets/icons/icon.png +0 -0
  38. package/app/desktop/assets/icons/tray.png +0 -0
  39. package/app/desktop/assets/templates/about.html +0 -147
  40. package/app/desktop/assets/tray.1.png +0 -0
  41. package/app/desktop/assets/tray.png +0 -0
  42. package/app/desktop/main.js +0 -241
  43. package/app/desktop/package-lock.json +0 -4997
  44. package/app/desktop/package.json +0 -100
  45. package/app/desktop/preload.js +0 -7
  46. package/app/desktop/src/core/error-handler.js +0 -108
  47. package/app/desktop/src/core/event-emitter.js +0 -84
  48. package/app/desktop/src/core/logger.js +0 -108
  49. package/app/desktop/src/core/state-manager.js +0 -125
  50. package/app/desktop/src/services/module-loader.js +0 -214
  51. package/app/desktop/src/services/runtime-manager.js +0 -301
  52. package/app/desktop/src/services/service-manager.js +0 -169
  53. package/app/desktop/src/services/update-manager.js +0 -268
  54. package/app/desktop/src/ui/about-dialog-manager.js +0 -208
  55. package/app/desktop/src/ui/admin-window-manager.js +0 -757
  56. package/app/desktop/src/ui/splash-manager.js +0 -253
  57. package/app/desktop/src/ui/tray-manager.js +0 -186
  58. package/app/desktop/src/utils/icon-manager.js +0 -133
  59. package/app/desktop/src/utils/path-utils.js +0 -58
  60. package/app/desktop/src/utils/resource-paths.js +0 -49
  61. package/app/desktop/src/utils/resource-sync.js +0 -260
  62. package/app/desktop/src/utils/runtime-sync.js +0 -241
  63. package/app/desktop/src/utils/template-renderer.js +0 -284
  64. package/app/desktop/src/utils/version-utils.js +0 -59
  65. package/examples/prompts/developer/code-review.yaml +0 -32
  66. package/examples/prompts/developer/code_refactoring.yaml +0 -31
  67. package/examples/prompts/developer/doc-generator.yaml +0 -36
  68. package/examples/prompts/developer/error-code-fixer.yaml +0 -35
  69. package/examples/prompts/engineer/engineer-professional.yaml +0 -92
  70. package/examples/prompts/engineer/laowang-engineer.yaml +0 -132
  71. package/examples/prompts/engineer/nekomata-engineer.yaml +0 -123
  72. package/examples/prompts/engineer/ojousama-engineer.yaml +0 -124
  73. package/examples/prompts/generator/gen_3d_edu_webpage_html.yaml +0 -117
  74. package/examples/prompts/generator/gen_3d_webpage_html.yaml +0 -75
  75. package/examples/prompts/generator/gen_bento_grid_html.yaml +0 -112
  76. package/examples/prompts/generator/gen_html_web_page.yaml +0 -88
  77. package/examples/prompts/generator/gen_knowledge_card_html.yaml +0 -83
  78. package/examples/prompts/generator/gen_magazine_card_html.yaml +0 -82
  79. package/examples/prompts/generator/gen_mimeng_headline_title.yaml +0 -71
  80. package/examples/prompts/generator/gen_podcast_script.yaml +0 -69
  81. package/examples/prompts/generator/gen_prd_prototype_html.yaml +0 -175
  82. package/examples/prompts/generator/gen_summarize.yaml +0 -157
  83. package/examples/prompts/generator/gen_title.yaml +0 -119
  84. package/examples/prompts/generator/others/api_documentation.yaml +0 -32
  85. package/examples/prompts/generator/others/build_mcp_server.yaml +0 -26
  86. package/examples/prompts/generator/others/project_architecture.yaml +0 -31
  87. package/examples/prompts/generator/others/test_case_generator.yaml +0 -30
  88. package/examples/prompts/generator/others/writing_assistant.yaml +0 -72
  89. package/examples/prompts/recommend/human_3-0_growth_diagnostic_coach_prompt.yaml +0 -105
  90. package/examples/prompts/workflow/sixstep-workflow.yaml +0 -192
  91. package/packages/admin-ui/.babelrc +0 -3
  92. package/packages/admin-ui/admin.html +0 -412
  93. package/packages/admin-ui/css/codemirror-theme_xq-light.css +0 -43
  94. package/packages/admin-ui/css/codemirror.css +0 -344
  95. package/packages/admin-ui/css/main.css +0 -2592
  96. package/packages/admin-ui/css/recommended-prompts.css +0 -610
  97. package/packages/admin-ui/package-lock.json +0 -6981
  98. package/packages/admin-ui/package.json +0 -36
  99. package/packages/admin-ui/src/codemirror.js +0 -53
  100. package/packages/admin-ui/src/index.js +0 -3188
  101. package/packages/admin-ui/webpack.config.js +0 -76
  102. package/packages/server/toolm/test-tools.js +0 -264
  103. package/scripts/build-icons.js +0 -135
  104. package/scripts/build.sh +0 -57
  105. package/scripts/postinstall.js +0 -34
  106. package/scripts/surge/CNAME +0 -1
  107. package/scripts/surge/README.md +0 -47
  108. package/scripts/surge/package-lock.json +0 -34
  109. package/scripts/surge/package.json +0 -20
  110. package/scripts/surge/sync-to-surge.js +0 -151
@@ -1,151 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
- const yaml = require('js-yaml');
7
-
8
- // 源目录和目标目录
9
- const SOURCE_DIR = path.join(__dirname, '../../examples/prompts');
10
- const DIST_DIR = path.join(__dirname, './dist');
11
- const ASSETS_DIR = path.join(DIST_DIR, './assets');
12
- const PROMPTS_DIR = path.join(ASSETS_DIR, 'prompts');
13
-
14
- /**
15
- * 读取YAML文件并解析为JSON对象
16
- * @param {string} filePath - YAML文件路径
17
- * @returns {object} 解析后的对象
18
- */
19
- function readYamlFile(filePath) {
20
- const content = fs.readFileSync(filePath, 'utf8');
21
- return yaml.load(content);
22
- }
23
-
24
- /**
25
- * 递归遍历目录,查找所有YAML文件
26
- * @param {string} dir - 目录路径
27
- * @param {string[]} fileList - 文件列表
28
- * @returns {string[]} YAML文件路径列表
29
- */
30
- function walkDirectory(dir, fileList = []) {
31
- const files = fs.readdirSync(dir);
32
-
33
- files.forEach(file => {
34
- const filePath = path.join(dir, file);
35
- const stat = fs.statSync(filePath);
36
-
37
- if (stat.isDirectory()) {
38
- walkDirectory(filePath, fileList);
39
- } else if (file.endsWith('.yaml') || file.endsWith('.yml')) {
40
- fileList.push(filePath);
41
- }
42
- });
43
-
44
- return fileList;
45
- }
46
-
47
- /**
48
- * 确保目录存在,如果不存在则创建
49
- * @param {string} dirPath - 目录路径
50
- */
51
- function ensureDirectoryExists(dirPath) {
52
- if (!fs.existsSync(dirPath)) {
53
- fs.mkdirSync(dirPath, { recursive: true });
54
- }
55
- }
56
-
57
- /**
58
- * 从源文件路径计算出相对于源目录的目标路径
59
- * @param {string} sourceFilePath - 源文件路径
60
- * @param {string} sourceDir - 源目录
61
- * @param {string} targetDir - 目标目录
62
- * @returns {string} 目标文件路径
63
- */
64
- function getTargetPath(sourceFilePath, sourceDir, targetDir) {
65
- const relativePath = path.relative(sourceDir, sourceFilePath);
66
- const fileName = path.basename(sourceFilePath, path.extname(sourceFilePath));
67
- return path.join(targetDir, relativePath.replace(path.basename(sourceFilePath), `${fileName}.json`));
68
- }
69
-
70
- console.log('开始同步Prompt文件到Surge...');
71
-
72
- // 创建assets目录
73
- ensureDirectoryExists(ASSETS_DIR);
74
- ensureDirectoryExists(PROMPTS_DIR);
75
-
76
- // 查找所有YAML文件
77
- const yamlFiles = walkDirectory(SOURCE_DIR);
78
- console.log(`找到 ${yamlFiles.length} 个YAML文件`);
79
-
80
- // 解析YAML文件并转换为JSON
81
- const indexData = [];
82
-
83
- for (const yamlFile of yamlFiles) {
84
- try {
85
- console.log(`正在处理: ${yamlFile}`);
86
-
87
- // 读取并解析YAML文件
88
- const yamlData = readYamlFile(yamlFile);
89
-
90
- // 提取必要字段
91
- const { name, description, tags = [] } = yamlData;
92
-
93
- // 计算目标JSON文件路径
94
- const targetPath = getTargetPath(yamlFile, SOURCE_DIR, PROMPTS_DIR);
95
-
96
- // 确保目标目录存在
97
- ensureDirectoryExists(path.dirname(targetPath));
98
-
99
- // 写入JSON文件
100
- fs.writeFileSync(targetPath, JSON.stringify(yamlData, null, 2), 'utf8');
101
-
102
- // 添加到索引数据
103
- const relativePath = path.relative(ASSETS_DIR, targetPath);
104
- indexData.push({
105
- name: name || path.basename(yamlFile, path.extname(yamlFile)),
106
- description: description || '',
107
- tags,
108
- path: relativePath
109
- });
110
-
111
- console.log(`已生成: ${targetPath}`);
112
- } catch (error) {
113
- console.error(`处理文件 ${yamlFile} 时出错:`, error.message);
114
- }
115
- }
116
-
117
- // 生成索引文件
118
- const indexPath = path.join(ASSETS_DIR, 'prompts.json');
119
- fs.writeFileSync(indexPath, JSON.stringify(indexData, null, 2), 'utf8');
120
- console.log(`已生成索引文件: ${indexPath}`);
121
-
122
- console.log('YAML文件解析和转换完成');
123
-
124
- // 检查是否需要发布到Surge
125
- const shouldDeploy = process.argv.includes('--deploy') || process.argv.includes('-d');
126
-
127
- if (shouldDeploy) {
128
- try {
129
- console.log('开始发布到Surge...');
130
-
131
- // 检查是否安装了surge
132
- try {
133
- execSync('which surge', { stdio: 'ignore' });
134
- } catch (error) {
135
- console.error('错误: 未找到surge命令,请先安装surge: npm install -g surge');
136
- process.exit(1);
137
- }
138
-
139
- // 发布到Surge
140
- const deployCommand = `surge ${DIST_DIR}`;
141
- console.log(`执行命令: ${deployCommand}`);
142
- execSync(deployCommand, { stdio: 'inherit' });
143
-
144
- console.log('发布完成!');
145
- } catch (error) {
146
- console.error('发布到Surge时出错:', error.message);
147
- process.exit(1);
148
- }
149
- } else {
150
- console.log('同步完成。使用 --deploy 或 -d 参数发布到Surge。');
151
- }