tianxincode 1.0.48 → 1.0.49
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.
- package/README.md +200 -200
- package/dist/cli/commands.js +18 -18
- package/dist/core/ai/agents/caller/prompts/role.txt +50 -50
- package/dist/core/ai/agents/chat/chat.agent.js +30 -30
- package/dist/core/ai/agents/chat/prompts/role.txt +30 -30
- package/dist/core/ai/agents/code/code.agent.js +6 -6
- package/dist/core/ai/agents/code/prompts/role.txt +50 -50
- package/dist/core/ai/agents/common/prompt/role.txt +51 -51
- package/dist/core/ai/agents/common/prompts.js +26 -26
- package/dist/core/ai/agents/design/design.agent.js +6 -6
- package/dist/core/ai/agents/design/prompts/role.txt +36 -36
- package/dist/core/ai/agents/dream/prompts/init.txt +20 -20
- package/dist/core/ai/agents/mem/mem.agent.js +5 -5
- package/dist/core/ai/agents/mem/prompts/role.txt +35 -35
- package/dist/core/ai/agents/skill/prompts/role.txt +61 -61
- package/dist/core/ai/agents/skill/skill.agent.js +26 -26
- package/dist/core/ai/agents/summarizer/prompts/role.txt +30 -30
- package/dist/core/ai/agents/task/prompts/role.txt +50 -50
- package/dist/core/ai/agents/task/task.agent.js +30 -30
- package/dist/core/db/db.service.d.ts.map +1 -1
- package/dist/core/db/db.service.js +2 -0
- package/dist/core/db/db.service.js.map +1 -1
- package/dist/core/db/init_sql/ai_log.init.js +15 -15
- package/dist/core/db/init_sql/code_snippet.init.js +11 -11
- package/dist/core/db/init_sql/config.init.js +15 -15
- package/dist/core/db/init_sql/custom_action.init.js +10 -10
- package/dist/core/db/init_sql/dingding.init.js +9 -9
- package/dist/core/db/init_sql/email.init.js +14 -14
- package/dist/core/db/init_sql/lsp.init.js +8 -8
- package/dist/core/db/init_sql/message_file.init.js +11 -11
- package/dist/core/db/init_sql/project.init.js +20 -20
- package/dist/core/db/init_sql/provider.init.js +35 -35
- package/dist/core/db/init_sql/scheduler.init.js +32 -32
- package/dist/core/db/init_sql/session.init.js +23 -23
- package/dist/core/db/init_sql/spec.init.js +15 -15
- package/dist/core/db/init_sql/waf_gateway.init.js +9 -9
- package/dist/core/db/init_sql/zihao.init.js +11 -11
- package/dist/core/lsp/sql.js +11 -11
- package/dist/core/tools/provider/bash.txt +47 -47
- package/dist/core/tools/provider/code_search.txt +20 -20
- package/dist/core/tools/provider/edit_file.txt +13 -13
- package/dist/core/tools/provider/glob.txt +12 -12
- package/dist/core/tools/provider/grep.txt +14 -14
- package/dist/core/tools/provider/lsp.txt +19 -19
- package/dist/core/tools/provider/memory.txt +21 -21
- package/dist/core/tools/provider/read_file.txt +17 -17
- package/dist/core/tools/provider/todo_read.txt +16 -16
- package/dist/core/tools/provider/todo_write.txt +48 -48
- package/dist/core/tools/provider/web_fetch.txt +17 -17
- package/dist/core/tools/provider/web_search.txt +18 -18
- package/dist/core/tools/provider/write_file.txt +11 -11
- package/dist/gateway/api/skill/detail_skill.d.ts.map +1 -1
- package/dist/gateway/api/skill/detail_skill.js +7 -5
- package/dist/gateway/api/skill/detail_skill.js.map +1 -1
- package/dist/gateway/cli/commands.js +18 -18
- package/dist/modules/ai/agents/chat/prompts/role.txt +30 -30
- package/dist/modules/ai/agents/code/prompts/role.txt +50 -50
- package/dist/modules/ai/agents/mem/prompts/role.txt +35 -35
- package/dist/modules/ai/agents/skill/prompts/role.txt +61 -61
- package/dist/modules/ai/agents/task/prompts/role.txt +50 -50
- package/dist/modules/ai/ai-log.service.js +10 -10
- package/dist/modules/ai/provider/openai/prompt/role.txt +51 -51
- package/dist/modules/ai/summarizer/summarizer.prompts.js +30 -30
- package/dist/modules/config/config.service.js +5 -5
- package/dist/modules/db/db.service.js +252 -252
- package/dist/modules/email/email.config.repository.js +1 -1
- package/dist/modules/repositories/project.repository.d.ts +28 -0
- package/dist/modules/repositories/project.repository.d.ts.map +1 -0
- package/dist/modules/repositories/project.repository.js +47 -0
- package/dist/modules/repositories/project.repository.js.map +1 -0
- package/dist/modules/scheduler/task-log.service.js +1 -1
- package/dist/modules/services/project/project.service.d.ts +14 -0
- package/dist/modules/services/project/project.service.d.ts.map +1 -0
- package/dist/modules/services/project/project.service.js +47 -0
- package/dist/modules/services/project/project.service.js.map +1 -0
- package/dist/modules/skill/skill.txt +36 -36
- package/dist/modules/spec/spec.injector.js +24 -24
- package/dist/modules/tools/provider/bash.txt +47 -47
- package/dist/modules/tools/provider/code_search.txt +20 -20
- package/dist/modules/tools/provider/edit_file.txt +13 -13
- package/dist/modules/tools/provider/glob.txt +12 -12
- package/dist/modules/tools/provider/grep.txt +14 -14
- package/dist/modules/tools/provider/lsp.txt +19 -19
- package/dist/modules/tools/provider/memory.txt +21 -21
- package/dist/modules/tools/provider/read_file.txt +17 -17
- package/dist/modules/tools/provider/todo_read.txt +16 -16
- package/dist/modules/tools/provider/todo_write.txt +48 -48
- package/dist/modules/tools/provider/web_fetch.txt +17 -17
- package/dist/modules/tools/provider/web_search.txt +18 -18
- package/dist/modules/tools/provider/write_file.txt +11 -11
- package/dist/modules/waf-gateway/waf-gateway.module.js +8 -8
- package/dist/modules/waf-gateway/waf-gateway.service.js +12 -12
- package/dist/repositories/project.repository.d.ts +28 -0
- package/dist/repositories/project.repository.d.ts.map +1 -0
- package/dist/repositories/project.repository.js +47 -0
- package/dist/repositories/project.repository.js.map +1 -0
- package/dist/repository/ai_log.repository.js +1 -1
- package/dist/repository/config.repository.js +5 -5
- package/dist/repository/email.repository.js +1 -1
- package/dist/repository/memory.repository.js +1 -1
- package/dist/repository/project.repository.js +3 -3
- package/dist/repository/scheduler.repository.js +2 -2
- package/dist/repository/session.repository.js +1 -1
- package/dist/repository/zihao-config.repository.js +1 -1
- package/dist/services/skill/skill.tool.d.ts.map +1 -1
- package/dist/services/skill/skill.tool.js +6 -1
- package/dist/services/skill/skill.tool.js.map +1 -1
- package/dist/services/skill/skill.txt +36 -36
- package/package.json +76 -76
- package/scripts/copy-txt.js +31 -31
- package/scripts/ink-scroll-demo.tsx +147 -147
- package/tsconfig.test.json +9 -9
- package/web/dist/assets/{ConfirmDialog-B2bVsPFI.js → ConfirmDialog-B03GcCHQ.js} +1 -1
- package/web/dist/assets/PcLayout-CYW3zqcs.css +1 -0
- package/web/dist/assets/{PcLayout-DeXNBHu2.js → PcLayout-ZTdJNg7G.js} +1 -1
- package/web/dist/assets/{aiLogsView-JvjhLmyo.js → aiLogsView-Bt8Xg1Qx.js} +1 -1
- package/web/dist/assets/{cssMode-sYHhwUZh.js → cssMode-CBb6D87U.js} +1 -1
- package/web/dist/assets/{customActionsView-Cvmzxvl4.js → customActionsView-DdjnHzwm.js} +1 -1
- package/web/dist/assets/deployView-CD7ji9IS.css +1 -0
- package/web/dist/assets/{deployView-CjV4ySrf.js → deployView-Cj51_Job.js} +1 -1
- package/web/dist/assets/designView-C3pSX4nP.css +1 -0
- package/web/dist/assets/designView-RT8tKEN9.js +18 -0
- package/web/dist/assets/devWorkflowView-BTozmaiN.js +36 -0
- package/web/dist/assets/devWorkflowView-DYhIfbCB.css +1 -0
- package/web/dist/assets/devWorkflowViewApp-CErbhC2s.css +1 -0
- package/web/dist/assets/{devWorkflowViewApp-DPlFgiS_.js → devWorkflowViewApp-DLslXEq9.js} +3 -3
- package/web/dist/assets/{fileZihao-DvZmuTYu.js → fileZihao-CtZ4bUIH.js} +1 -1
- package/web/dist/assets/{freemarker2-DTyAQBBj.js → freemarker2-CX3jc3l2.js} +1 -1
- package/web/dist/assets/gitChanges-D6QxPcii.css +1 -0
- package/web/dist/assets/{gitChanges-Cpf4HHoF.js → gitChanges-DFRvzL5I.js} +1 -1
- package/web/dist/assets/gitChangesApp-Bjn-MCmr.css +1 -0
- package/web/dist/assets/{gitChangesApp-BOURDd_l.js → gitChangesApp-ZI7-V8oB.js} +2 -2
- package/web/dist/assets/{handlebars-DiWIXxOG.js → handlebars-CTaQD6FN.js} +1 -1
- package/web/dist/assets/{html-BCQWkFzH.js → html-BruJsfYv.js} +1 -1
- package/web/dist/assets/{htmlMode-BbMA34cR.js → htmlMode-wewroXLr.js} +1 -1
- package/web/dist/assets/{index-C_tz4Wda.css → index-C0xmVTIn.css} +1 -1
- package/web/dist/assets/{index-C7axH05o.js → index-Cn73hS12.js} +9 -9
- package/web/dist/assets/{javascript-By4MYHaO.js → javascript-B4ku8P1-.js} +1 -1
- package/web/dist/assets/{jsonMode-5JIz7tDN.js → jsonMode-BIvVuBMG.js} +1 -1
- package/web/dist/assets/{liquid-BQBVii4f.js → liquid-Bo3G0Ep7.js} +1 -1
- package/web/dist/assets/{mdx-Cwk7nqzM.js → mdx-Duv0ylZz.js} +1 -1
- package/web/dist/assets/{mediaChat-DivTDoIv.js → mediaChat-RT7iqqYb.js} +1 -1
- package/web/dist/assets/{python-L_kGfe1T.js → python-CEhCctGm.js} +1 -1
- package/web/dist/assets/{razor-XGuHliMI.js → razor-DPK8nTD7.js} +1 -1
- package/web/dist/assets/{taskView-BcJ3LAxp.js → taskView-sOyebRqn.js} +1 -1
- package/web/dist/assets/{terminalView-q-UKzK0M.js → terminalView-GTYtDlus.js} +2 -2
- package/web/dist/assets/{terminalView-CQVYh6D3.css → terminalView-eZ0agsPP.css} +1 -1
- package/web/dist/assets/{tsMode-SuiD3mJa.js → tsMode-BZvUU1nf.js} +1 -1
- package/web/dist/assets/{typescript-DJcyqRjT.js → typescript-CmEn-k1B.js} +1 -1
- package/web/dist/assets/{wikiView-ygHSGyPp.css → wikiView-C-oqMnJM.css} +1 -1
- package/web/dist/assets/{wikiView-B3GIPUlD.js → wikiView-CRjg-cZ8.js} +1 -1
- package/web/dist/assets/{xml-DQgCzk55.js → xml-bjvdKeyy.js} +1 -1
- package/web/dist/assets/{yaml-DBdEYBPA.js → yaml-N5RXWxJk.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/package.json +28 -28
- package/dist/modules/ai/react/index.d.ts +0 -5
- package/dist/modules/ai/react/index.d.ts.map +0 -1
- package/dist/modules/ai/react/index.js +0 -4
- package/dist/modules/ai/react/index.js.map +0 -1
- package/dist/modules/ai/react/prompt/role.txt +0 -51
- package/dist/modules/ai/react/provider.parser.d.ts +0 -20
- package/dist/modules/ai/react/provider.parser.d.ts.map +0 -1
- package/dist/modules/ai/react/provider.parser.js +0 -88
- package/dist/modules/ai/react/provider.parser.js.map +0 -1
- package/dist/modules/ai/react/react.parser.d.ts +0 -80
- package/dist/modules/ai/react/react.parser.d.ts.map +0 -1
- package/dist/modules/ai/react/react.parser.js +0 -365
- package/dist/modules/ai/react/react.parser.js.map +0 -1
- package/dist/modules/ai/react/react.prompts.d.ts +0 -26
- package/dist/modules/ai/react/react.prompts.d.ts.map +0 -1
- package/dist/modules/ai/react/react.prompts.js +0 -170
- package/dist/modules/ai/react/react.prompts.js.map +0 -1
- package/dist/modules/ai/react/react.types.d.ts +0 -50
- package/dist/modules/ai/react/react.types.d.ts.map +0 -1
- package/dist/modules/ai/react/react.types.js +0 -2
- package/dist/modules/ai/react/react.types.js.map +0 -1
- package/dist/modules/ai/react/react.validator.d.ts +0 -14
- package/dist/modules/ai/react/react.validator.d.ts.map +0 -1
- package/dist/modules/ai/react/react.validator.js +0 -53
- package/dist/modules/ai/react/react.validator.js.map +0 -1
- package/dist/modules/ai/react.agent.d.ts +0 -82
- package/dist/modules/ai/react.agent.d.ts.map +0 -1
- package/dist/modules/ai/react.agent.js +0 -220
- package/dist/modules/ai/react.agent.js.map +0 -1
- package/dist/modules/skill/skill.service.d.ts +0 -72
- package/dist/modules/skill/skill.service.d.ts.map +0 -1
- package/dist/modules/skill/skill.service.js +0 -283
- package/dist/modules/skill/skill.service.js.map +0 -1
- package/dist/modules/tools/builtin/bash.d.ts +0 -3
- package/dist/modules/tools/builtin/bash.d.ts.map +0 -1
- package/dist/modules/tools/builtin/bash.js +0 -126
- package/dist/modules/tools/builtin/bash.js.map +0 -1
- package/dist/modules/tools/builtin/bash.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/bash.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/bash.tool.js +0 -52
- package/dist/modules/tools/builtin/bash.tool.js.map +0 -1
- package/dist/modules/tools/builtin/bash.txt +0 -69
- package/dist/modules/tools/builtin/code_search.d.ts +0 -3
- package/dist/modules/tools/builtin/code_search.d.ts.map +0 -1
- package/dist/modules/tools/builtin/code_search.js +0 -86
- package/dist/modules/tools/builtin/code_search.js.map +0 -1
- package/dist/modules/tools/builtin/code_search.txt +0 -41
- package/dist/modules/tools/builtin/edit-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/edit-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/edit-file.tool.js +0 -58
- package/dist/modules/tools/builtin/edit-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/edit_file.d.ts +0 -3
- package/dist/modules/tools/builtin/edit_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/edit_file.js +0 -105
- package/dist/modules/tools/builtin/edit_file.js.map +0 -1
- package/dist/modules/tools/builtin/edit_file.txt +0 -61
- package/dist/modules/tools/builtin/glob.d.ts +0 -3
- package/dist/modules/tools/builtin/glob.d.ts.map +0 -1
- package/dist/modules/tools/builtin/glob.js +0 -85
- package/dist/modules/tools/builtin/glob.js.map +0 -1
- package/dist/modules/tools/builtin/glob.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/glob.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/glob.tool.js +0 -81
- package/dist/modules/tools/builtin/glob.tool.js.map +0 -1
- package/dist/modules/tools/builtin/glob.txt +0 -33
- package/dist/modules/tools/builtin/grep.d.ts +0 -3
- package/dist/modules/tools/builtin/grep.d.ts.map +0 -1
- package/dist/modules/tools/builtin/grep.js +0 -94
- package/dist/modules/tools/builtin/grep.js.map +0 -1
- package/dist/modules/tools/builtin/grep.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/grep.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/grep.tool.js +0 -96
- package/dist/modules/tools/builtin/grep.tool.js.map +0 -1
- package/dist/modules/tools/builtin/grep.txt +0 -37
- package/dist/modules/tools/builtin/index.d.ts +0 -8
- package/dist/modules/tools/builtin/index.d.ts.map +0 -1
- package/dist/modules/tools/builtin/index.js +0 -80
- package/dist/modules/tools/builtin/index.js.map +0 -1
- package/dist/modules/tools/builtin/lsp.d.ts +0 -7
- package/dist/modules/tools/builtin/lsp.d.ts.map +0 -1
- package/dist/modules/tools/builtin/lsp.js +0 -126
- package/dist/modules/tools/builtin/lsp.js.map +0 -1
- package/dist/modules/tools/builtin/lsp.txt +0 -45
- package/dist/modules/tools/builtin/memory.d.ts +0 -3
- package/dist/modules/tools/builtin/memory.d.ts.map +0 -1
- package/dist/modules/tools/builtin/memory.js +0 -77
- package/dist/modules/tools/builtin/memory.js.map +0 -1
- package/dist/modules/tools/builtin/memory.txt +0 -58
- package/dist/modules/tools/builtin/read-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/read-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/read-file.tool.js +0 -46
- package/dist/modules/tools/builtin/read-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/read_file.d.ts +0 -3
- package/dist/modules/tools/builtin/read_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/read_file.js +0 -107
- package/dist/modules/tools/builtin/read_file.js.map +0 -1
- package/dist/modules/tools/builtin/read_file.txt +0 -38
- package/dist/modules/tools/builtin/todo_read.d.ts +0 -6
- package/dist/modules/tools/builtin/todo_read.d.ts.map +0 -1
- package/dist/modules/tools/builtin/todo_read.js +0 -25
- package/dist/modules/tools/builtin/todo_read.js.map +0 -1
- package/dist/modules/tools/builtin/todo_read.txt +0 -34
- package/dist/modules/tools/builtin/todo_write.d.ts +0 -6
- package/dist/modules/tools/builtin/todo_write.d.ts.map +0 -1
- package/dist/modules/tools/builtin/todo_write.js +0 -46
- package/dist/modules/tools/builtin/todo_write.js.map +0 -1
- package/dist/modules/tools/builtin/todo_write.txt +0 -67
- package/dist/modules/tools/builtin/web_fetch.d.ts +0 -3
- package/dist/modules/tools/builtin/web_fetch.d.ts.map +0 -1
- package/dist/modules/tools/builtin/web_fetch.js +0 -52
- package/dist/modules/tools/builtin/web_fetch.js.map +0 -1
- package/dist/modules/tools/builtin/web_fetch.txt +0 -38
- package/dist/modules/tools/builtin/web_search.d.ts +0 -3
- package/dist/modules/tools/builtin/web_search.d.ts.map +0 -1
- package/dist/modules/tools/builtin/web_search.js +0 -100
- package/dist/modules/tools/builtin/web_search.js.map +0 -1
- package/dist/modules/tools/builtin/web_search.txt +0 -43
- package/dist/modules/tools/builtin/write-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/write-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/write-file.tool.js +0 -38
- package/dist/modules/tools/builtin/write-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/write_file.d.ts +0 -3
- package/dist/modules/tools/builtin/write_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/write_file.js +0 -61
- package/dist/modules/tools/builtin/write_file.js.map +0 -1
- package/dist/modules/tools/builtin/write_file.txt +0 -58
- package/dist/modules/tools/provider/openai/tools.d.ts +0 -3
- package/dist/modules/tools/provider/openai/tools.d.ts.map +0 -1
- package/dist/modules/tools/provider/openai/tools.js +0 -212
- package/dist/modules/tools/provider/openai/tools.js.map +0 -1
- package/dist/modules/tools/provider/skill.d.ts +0 -6
- package/dist/modules/tools/provider/skill.d.ts.map +0 -1
- package/dist/modules/tools/provider/skill.js +0 -64
- package/dist/modules/tools/provider/skill.js.map +0 -1
- package/web/dist/assets/PcLayout-L-XuK1oQ.css +0 -1
- package/web/dist/assets/deployView-hCh3_M8H.css +0 -1
- package/web/dist/assets/designView-CqZ75hOS.css +0 -1
- package/web/dist/assets/designView-DrUNRVEE.js +0 -18
- package/web/dist/assets/devWorkflowView-BpdJTMEb.js +0 -36
- package/web/dist/assets/devWorkflowView-D7EKjoLj.css +0 -1
- package/web/dist/assets/devWorkflowViewApp-BYYMIdCm.css +0 -1
- package/web/dist/assets/gitChanges-BYj-Y2K-.css +0 -1
- package/web/dist/assets/gitChangesApp-Btw-XKcP.css +0 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
### 工具skill
|
|
2
|
-
加载一个专门的 Skill(技能),该技能提供特定领域的指令和工作流程。
|
|
3
|
-
|
|
4
|
-
**功能**:
|
|
5
|
-
- 当你识别到任务匹配以下列出的可用技能时,使用此工具加载完整的技能说明
|
|
6
|
-
- Skill 会将详细的指令、工作流程和访问绑定资源(脚本、参考、模板)注入对话上下文
|
|
7
|
-
- 工具输出包含一个 `<skill_content name="...">` 块,其中包含加载的内容
|
|
8
|
-
|
|
9
|
-
**使用说明**:
|
|
10
|
-
- 当你识别到任务匹配某个可用 Skill 时,使用此工具加载该技能的完整说明
|
|
11
|
-
- 技能会注入详细的指令、工作流程,以及对捆绑资源(脚本、参考、模板)的访问
|
|
12
|
-
- 工具输出包含一个 `<skill_content name="...">` 块,其中包含加载的内容
|
|
13
|
-
- 该技能的相对路径(如 scripts/、reference/)是相对于技能的基础目录
|
|
14
|
-
|
|
15
|
-
**当前可用的 Skills**:
|
|
16
|
-
Invoke this tool to load a skill when a task matches one of the available skills listed above.
|
|
17
|
-
|
|
18
|
-
举例:
|
|
19
|
-
```xml
|
|
20
|
-
<react>
|
|
21
|
-
<thought>加载代码审查技能</thought>
|
|
22
|
-
<action>
|
|
23
|
-
<action_name>skill</action_name>
|
|
24
|
-
<action_input>
|
|
25
|
-
<name>code-review</name>
|
|
26
|
-
</action_input>
|
|
27
|
-
</action>
|
|
28
|
-
<keep_context>true</keep_context>
|
|
29
|
-
</react>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
参数说明:
|
|
33
|
-
|
|
34
|
-
| 字段 | 类型 | 说明 |
|
|
35
|
-
|------|------|
|
|
36
|
-
| `name` | string | Skill 的名称(必需) |
|
|
1
|
+
### 工具skill
|
|
2
|
+
加载一个专门的 Skill(技能),该技能提供特定领域的指令和工作流程。
|
|
3
|
+
|
|
4
|
+
**功能**:
|
|
5
|
+
- 当你识别到任务匹配以下列出的可用技能时,使用此工具加载完整的技能说明
|
|
6
|
+
- Skill 会将详细的指令、工作流程和访问绑定资源(脚本、参考、模板)注入对话上下文
|
|
7
|
+
- 工具输出包含一个 `<skill_content name="...">` 块,其中包含加载的内容
|
|
8
|
+
|
|
9
|
+
**使用说明**:
|
|
10
|
+
- 当你识别到任务匹配某个可用 Skill 时,使用此工具加载该技能的完整说明
|
|
11
|
+
- 技能会注入详细的指令、工作流程,以及对捆绑资源(脚本、参考、模板)的访问
|
|
12
|
+
- 工具输出包含一个 `<skill_content name="...">` 块,其中包含加载的内容
|
|
13
|
+
- 该技能的相对路径(如 scripts/、reference/)是相对于技能的基础目录
|
|
14
|
+
|
|
15
|
+
**当前可用的 Skills**:
|
|
16
|
+
Invoke this tool to load a skill when a task matches one of the available skills listed above.
|
|
17
|
+
|
|
18
|
+
举例:
|
|
19
|
+
```xml
|
|
20
|
+
<react>
|
|
21
|
+
<thought>加载代码审查技能</thought>
|
|
22
|
+
<action>
|
|
23
|
+
<action_name>skill</action_name>
|
|
24
|
+
<action_input>
|
|
25
|
+
<name>code-review</name>
|
|
26
|
+
</action_input>
|
|
27
|
+
</action>
|
|
28
|
+
<keep_context>true</keep_context>
|
|
29
|
+
</react>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
参数说明:
|
|
33
|
+
|
|
34
|
+
| 字段 | 类型 | 说明 |
|
|
35
|
+
|------|------|
|
|
36
|
+
| `name` | string | Skill 的名称(必需) |
|
package/package.json
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tianxincode",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "AI Coding Assistant",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"txcode": "dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc && tsc-alias && npm run copy-txt",
|
|
13
|
-
"copy-txt": "node scripts/copy-txt.js",
|
|
14
|
-
"dev": "tsx src/index.ts",
|
|
15
|
-
"demo:ink-scroll": "tsx scripts/ink-scroll-demo.tsx",
|
|
16
|
-
"start": "node dist/index.js",
|
|
17
|
-
"start:web": "node dist/index.js web",
|
|
18
|
-
"web:dev": "cd web && npm run dev",
|
|
19
|
-
"web:build": "cd web && npm install && npm run build",
|
|
20
|
-
"test": "jest",
|
|
21
|
-
"test:coverage": "jest --coverage"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"ai",
|
|
25
|
-
"coding",
|
|
26
|
-
"assistant"
|
|
27
|
-
],
|
|
28
|
-
"author": "",
|
|
29
|
-
"license": "ISC",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@lydell/node-pty": "^1.0.0",
|
|
32
|
-
"@types/diff": "^7.0.2",
|
|
33
|
-
"@types/nodemailer": "^7.0.11",
|
|
34
|
-
"cors": "^2.8.6",
|
|
35
|
-
"diff": "^7.0.0",
|
|
36
|
-
"dingtalk-stream-sdk-nodejs": "^2.0.4",
|
|
37
|
-
"express": "^5.2.1",
|
|
38
|
-
"ink": "^6.8.0",
|
|
39
|
-
"js-yaml": "^4.1.1",
|
|
40
|
-
"multer": "^2.1.1",
|
|
41
|
-
"node-cron": "^4.2.1",
|
|
42
|
-
"nodemailer": "^8.0.4",
|
|
43
|
-
"openai": "^5.5.1",
|
|
44
|
-
"react": "^19.2.4",
|
|
45
|
-
"react-dom": "^19.2.4",
|
|
46
|
-
"sql.js": "^1.12.0",
|
|
47
|
-
"undici": "^7.25.0",
|
|
48
|
-
"uuid": "^9.0.1",
|
|
49
|
-
"which": "^6.0.1",
|
|
50
|
-
"ws": "^8.20.0",
|
|
51
|
-
"xml2js": "^0.6.2",
|
|
52
|
-
"yaml": "^2.8.3"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@types/cors": "^2.8.19",
|
|
56
|
-
"@types/express": "^5.0.6",
|
|
57
|
-
"@types/jest": "^30.0.0",
|
|
58
|
-
"@types/js-yaml": "^4.0.9",
|
|
59
|
-
"@types/multer": "^2.1.0",
|
|
60
|
-
"@types/node": "^25.5.0",
|
|
61
|
-
"@types/node-cron": "^3.0.11",
|
|
62
|
-
"@types/react": "^19.2.14",
|
|
63
|
-
"@types/react-dom": "^19.2.3",
|
|
64
|
-
"@types/sql.js": "^1.4.9",
|
|
65
|
-
"@types/uuid": "^10.0.0",
|
|
66
|
-
"@types/which": "^3.0.4",
|
|
67
|
-
"@types/ws": "^8.18.1",
|
|
68
|
-
"@types/xml2js": "^0.4.14",
|
|
69
|
-
"jest": "^30.3.0",
|
|
70
|
-
"ts-jest": "^29.4.6",
|
|
71
|
-
"ts-node": "^10.9.2",
|
|
72
|
-
"tsc-alias": "^1.8.10",
|
|
73
|
-
"tsx": "^4.21.0",
|
|
74
|
-
"typescript": "^5.9.3"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tianxincode",
|
|
3
|
+
"version": "1.0.49",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "AI Coding Assistant",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"txcode": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && tsc-alias && npm run copy-txt",
|
|
13
|
+
"copy-txt": "node scripts/copy-txt.js",
|
|
14
|
+
"dev": "tsx src/index.ts",
|
|
15
|
+
"demo:ink-scroll": "tsx scripts/ink-scroll-demo.tsx",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"start:web": "node dist/index.js web",
|
|
18
|
+
"web:dev": "cd web && npm run dev",
|
|
19
|
+
"web:build": "cd web && npm install && npm run build",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:coverage": "jest --coverage"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ai",
|
|
25
|
+
"coding",
|
|
26
|
+
"assistant"
|
|
27
|
+
],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "ISC",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@lydell/node-pty": "^1.0.0",
|
|
32
|
+
"@types/diff": "^7.0.2",
|
|
33
|
+
"@types/nodemailer": "^7.0.11",
|
|
34
|
+
"cors": "^2.8.6",
|
|
35
|
+
"diff": "^7.0.0",
|
|
36
|
+
"dingtalk-stream-sdk-nodejs": "^2.0.4",
|
|
37
|
+
"express": "^5.2.1",
|
|
38
|
+
"ink": "^6.8.0",
|
|
39
|
+
"js-yaml": "^4.1.1",
|
|
40
|
+
"multer": "^2.1.1",
|
|
41
|
+
"node-cron": "^4.2.1",
|
|
42
|
+
"nodemailer": "^8.0.4",
|
|
43
|
+
"openai": "^5.5.1",
|
|
44
|
+
"react": "^19.2.4",
|
|
45
|
+
"react-dom": "^19.2.4",
|
|
46
|
+
"sql.js": "^1.12.0",
|
|
47
|
+
"undici": "^7.25.0",
|
|
48
|
+
"uuid": "^9.0.1",
|
|
49
|
+
"which": "^6.0.1",
|
|
50
|
+
"ws": "^8.20.0",
|
|
51
|
+
"xml2js": "^0.6.2",
|
|
52
|
+
"yaml": "^2.8.3"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/cors": "^2.8.19",
|
|
56
|
+
"@types/express": "^5.0.6",
|
|
57
|
+
"@types/jest": "^30.0.0",
|
|
58
|
+
"@types/js-yaml": "^4.0.9",
|
|
59
|
+
"@types/multer": "^2.1.0",
|
|
60
|
+
"@types/node": "^25.5.0",
|
|
61
|
+
"@types/node-cron": "^3.0.11",
|
|
62
|
+
"@types/react": "^19.2.14",
|
|
63
|
+
"@types/react-dom": "^19.2.3",
|
|
64
|
+
"@types/sql.js": "^1.4.9",
|
|
65
|
+
"@types/uuid": "^10.0.0",
|
|
66
|
+
"@types/which": "^3.0.4",
|
|
67
|
+
"@types/ws": "^8.18.1",
|
|
68
|
+
"@types/xml2js": "^0.4.14",
|
|
69
|
+
"jest": "^30.3.0",
|
|
70
|
+
"ts-jest": "^29.4.6",
|
|
71
|
+
"ts-node": "^10.9.2",
|
|
72
|
+
"tsc-alias": "^1.8.10",
|
|
73
|
+
"tsx": "^4.21.0",
|
|
74
|
+
"typescript": "^5.9.3"
|
|
75
|
+
}
|
|
76
|
+
}
|
package/scripts/copy-txt.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { readdirSync, mkdirSync, copyFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
|
-
function copyDirFiles(srcDir, dstDir, filter) {
|
|
5
|
-
readdirSync(srcDir).filter(filter).forEach(f => {
|
|
6
|
-
mkdirSync(dstDir, { recursive: true });
|
|
7
|
-
copyFileSync(join(srcDir, f), join(dstDir, f));
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function copyFile(srcPath, dstPath) {
|
|
12
|
-
const dstDir = dstPath.substring(0, dstPath.lastIndexOf('/'));
|
|
13
|
-
mkdirSync(dstDir, { recursive: true });
|
|
14
|
-
copyFileSync(srcPath, dstPath);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
copyDirFiles('src/core/tools/provider', 'dist/core/tools/provider', f => f.endsWith('.txt'));
|
|
18
|
-
copyFile('src/services/skill/skill.txt', 'dist/services/skill/skill.txt');
|
|
19
|
-
copyFile('src/core/ai/agents/common/prompt/role.txt', 'dist/core/ai/agents/common/prompt/role.txt');
|
|
20
|
-
|
|
21
|
-
const agents = ['code', 'chat', 'task', 'mem', 'skill', 'caller', 'summarizer', 'design'];
|
|
22
|
-
agents.forEach(agent => {
|
|
23
|
-
copyFile(
|
|
24
|
-
`src/core/ai/agents/${agent}/prompts/role.txt`,
|
|
25
|
-
`dist/core/ai/agents/${agent}/prompts/role.txt`
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
copyFile('src/core/ai/agents/dream/prompts/init.txt', 'dist/core/ai/agents/dream/prompts/init.txt');
|
|
30
|
-
|
|
31
|
-
console.log('Copied .txt files to dist');
|
|
1
|
+
import { readdirSync, mkdirSync, copyFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
function copyDirFiles(srcDir, dstDir, filter) {
|
|
5
|
+
readdirSync(srcDir).filter(filter).forEach(f => {
|
|
6
|
+
mkdirSync(dstDir, { recursive: true });
|
|
7
|
+
copyFileSync(join(srcDir, f), join(dstDir, f));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function copyFile(srcPath, dstPath) {
|
|
12
|
+
const dstDir = dstPath.substring(0, dstPath.lastIndexOf('/'));
|
|
13
|
+
mkdirSync(dstDir, { recursive: true });
|
|
14
|
+
copyFileSync(srcPath, dstPath);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
copyDirFiles('src/core/tools/provider', 'dist/core/tools/provider', f => f.endsWith('.txt'));
|
|
18
|
+
copyFile('src/services/skill/skill.txt', 'dist/services/skill/skill.txt');
|
|
19
|
+
copyFile('src/core/ai/agents/common/prompt/role.txt', 'dist/core/ai/agents/common/prompt/role.txt');
|
|
20
|
+
|
|
21
|
+
const agents = ['code', 'chat', 'task', 'mem', 'skill', 'caller', 'summarizer', 'design'];
|
|
22
|
+
agents.forEach(agent => {
|
|
23
|
+
copyFile(
|
|
24
|
+
`src/core/ai/agents/${agent}/prompts/role.txt`,
|
|
25
|
+
`dist/core/ai/agents/${agent}/prompts/role.txt`
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
copyFile('src/core/ai/agents/dream/prompts/init.txt', 'dist/core/ai/agents/dream/prompts/init.txt');
|
|
30
|
+
|
|
31
|
+
console.log('Copied .txt files to dist');
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Ink Static 模式 demo:上 Logo / 中历史消息(Static) / 下输入框
|
|
4
|
-
*
|
|
5
|
-
* - 历史消息使用 Ink 的 Static 渲染。
|
|
6
|
-
* - 回车:输入追加到历史区(Static 仅新增这一条)。
|
|
7
|
-
* - q / Esc:退出
|
|
8
|
-
*
|
|
9
|
-
* 运行:npm run demo:ink-scroll
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import React, { useEffect, useState } from 'react';
|
|
13
|
-
import { Box, Static, Text, render, useApp, useInput, useStdout } from 'ink';
|
|
14
|
-
|
|
15
|
-
const LOGO_LINES = 6;
|
|
16
|
-
const FOOTER_LINES = 3;
|
|
17
|
-
|
|
18
|
-
interface HistoryItem {
|
|
19
|
-
id: string;
|
|
20
|
-
text: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function InkScrollDemoApp() {
|
|
24
|
-
const { exit } = useApp();
|
|
25
|
-
const { stdout } = useStdout();
|
|
26
|
-
|
|
27
|
-
const [terminalSize, setTerminalSize] = useState(() => ({
|
|
28
|
-
rows: stdout.rows || 24,
|
|
29
|
-
cols: stdout.columns || 80,
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const onResize = () => {
|
|
34
|
-
setTerminalSize({
|
|
35
|
-
rows: stdout.rows || 24,
|
|
36
|
-
cols: stdout.columns || 80,
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
stdout.on('resize', onResize);
|
|
40
|
-
return () => {
|
|
41
|
-
stdout.off('resize', onResize);
|
|
42
|
-
};
|
|
43
|
-
}, [stdout]);
|
|
44
|
-
|
|
45
|
-
const terminalRows = terminalSize.rows;
|
|
46
|
-
const terminalCols = terminalSize.cols;
|
|
47
|
-
const historyViewportLines = 30;
|
|
48
|
-
|
|
49
|
-
const [history, setHistory] = useState<HistoryItem[]>(() => [
|
|
50
|
-
{ id: 'boot-1', text: '欢迎使用 Static demo:回车会把输入追加到历史。' },
|
|
51
|
-
{ id: 'boot-2', text: '你可以持续输入,观察输入框更新时历史不重绘。' },
|
|
52
|
-
]);
|
|
53
|
-
const logoStaticItems: HistoryItem[] = [
|
|
54
|
-
{ id: 'logo-1', text: '╔══════════════════════════════════╗' },
|
|
55
|
-
{ id: 'logo-2', text: '║ INK LAYOUT DEMO ║' },
|
|
56
|
-
{ id: 'logo-3', text: '║ Logo / History / Input ║' },
|
|
57
|
-
{ id: 'logo-4', text: '╚══════════════════════════════════╝' },
|
|
58
|
-
];
|
|
59
|
-
const [input, setInput] = useState('');
|
|
60
|
-
const [cursorPosition, setCursorPosition] = useState(0);
|
|
61
|
-
|
|
62
|
-
useInput((chunk, key) => {
|
|
63
|
-
const text = typeof chunk === 'string' ? chunk : '';
|
|
64
|
-
const keyAny = key as { leftArrow?: boolean; rightArrow?: boolean };
|
|
65
|
-
|
|
66
|
-
if (key.escape || (text === 'q' && !key.ctrl && !key.meta)) {
|
|
67
|
-
exit();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (key.return) {
|
|
72
|
-
const line = input.trim();
|
|
73
|
-
if (line) {
|
|
74
|
-
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
75
|
-
setHistory(prev => [...prev, { id, text: line }]);
|
|
76
|
-
}
|
|
77
|
-
setInput('');
|
|
78
|
-
setCursorPosition(0);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (key.backspace || key.delete) {
|
|
83
|
-
if (cursorPosition > 0) {
|
|
84
|
-
const next = input.slice(0, cursorPosition - 1) + input.slice(cursorPosition);
|
|
85
|
-
setInput(next);
|
|
86
|
-
setCursorPosition(c => c - 1);
|
|
87
|
-
}
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (keyAny.leftArrow) {
|
|
92
|
-
setCursorPosition(c => Math.max(0, c - 1));
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (keyAny.rightArrow) {
|
|
96
|
-
setCursorPosition(c => Math.min(input.length, c + 1));
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (text && !key.ctrl && !key.meta) {
|
|
101
|
-
const next = input.slice(0, cursorPosition) + text + input.slice(cursorPosition);
|
|
102
|
-
setInput(next);
|
|
103
|
-
setCursorPosition(cursorPosition + text.length);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<Box flexDirection="column" width={terminalCols} height={5}>
|
|
109
|
-
{/* 顶部 Logo */}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
{/* 中间历史(Static) */}
|
|
113
|
-
<Box flexDirection="column" flexGrow={1} minHeight={0}>
|
|
114
|
-
<Static items={logoStaticItems}>
|
|
115
|
-
{item => (
|
|
116
|
-
<Text key={item.id} bold color="cyan">
|
|
117
|
-
{item.text}
|
|
118
|
-
</Text>
|
|
119
|
-
)}
|
|
120
|
-
</Static>
|
|
121
|
-
<Static items={history}>
|
|
122
|
-
{(item, index) => (
|
|
123
|
-
<Text key={item.id}>
|
|
124
|
-
<Text dimColor>{String(index + 1).padStart(3, ' ')}. </Text>
|
|
125
|
-
<Text>{item.text}</Text>
|
|
126
|
-
</Text>
|
|
127
|
-
)}
|
|
128
|
-
</Static>
|
|
129
|
-
</Box>
|
|
130
|
-
|
|
131
|
-
{/* 底部输入框 */}
|
|
132
|
-
<Box flexDirection="column" flexShrink={0} marginTop={0}>
|
|
133
|
-
<Box borderStyle="single" borderColor="gray" paddingX={1}>
|
|
134
|
-
<Text dimColor>{'> '}</Text>
|
|
135
|
-
<Text>{input.slice(0, cursorPosition)}</Text>
|
|
136
|
-
<Text color="cyan">▋</Text>
|
|
137
|
-
<Text>{input.slice(cursorPosition)}</Text>
|
|
138
|
-
</Box>
|
|
139
|
-
<Text dimColor>
|
|
140
|
-
Static 历史模式 | 回车追加历史 | q / Esc 退出
|
|
141
|
-
</Text>
|
|
142
|
-
</Box>
|
|
143
|
-
</Box>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
render(<InkScrollDemoApp />);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Ink Static 模式 demo:上 Logo / 中历史消息(Static) / 下输入框
|
|
4
|
+
*
|
|
5
|
+
* - 历史消息使用 Ink 的 Static 渲染。
|
|
6
|
+
* - 回车:输入追加到历史区(Static 仅新增这一条)。
|
|
7
|
+
* - q / Esc:退出
|
|
8
|
+
*
|
|
9
|
+
* 运行:npm run demo:ink-scroll
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
|
+
import { Box, Static, Text, render, useApp, useInput, useStdout } from 'ink';
|
|
14
|
+
|
|
15
|
+
const LOGO_LINES = 6;
|
|
16
|
+
const FOOTER_LINES = 3;
|
|
17
|
+
|
|
18
|
+
interface HistoryItem {
|
|
19
|
+
id: string;
|
|
20
|
+
text: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function InkScrollDemoApp() {
|
|
24
|
+
const { exit } = useApp();
|
|
25
|
+
const { stdout } = useStdout();
|
|
26
|
+
|
|
27
|
+
const [terminalSize, setTerminalSize] = useState(() => ({
|
|
28
|
+
rows: stdout.rows || 24,
|
|
29
|
+
cols: stdout.columns || 80,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const onResize = () => {
|
|
34
|
+
setTerminalSize({
|
|
35
|
+
rows: stdout.rows || 24,
|
|
36
|
+
cols: stdout.columns || 80,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
stdout.on('resize', onResize);
|
|
40
|
+
return () => {
|
|
41
|
+
stdout.off('resize', onResize);
|
|
42
|
+
};
|
|
43
|
+
}, [stdout]);
|
|
44
|
+
|
|
45
|
+
const terminalRows = terminalSize.rows;
|
|
46
|
+
const terminalCols = terminalSize.cols;
|
|
47
|
+
const historyViewportLines = 30;
|
|
48
|
+
|
|
49
|
+
const [history, setHistory] = useState<HistoryItem[]>(() => [
|
|
50
|
+
{ id: 'boot-1', text: '欢迎使用 Static demo:回车会把输入追加到历史。' },
|
|
51
|
+
{ id: 'boot-2', text: '你可以持续输入,观察输入框更新时历史不重绘。' },
|
|
52
|
+
]);
|
|
53
|
+
const logoStaticItems: HistoryItem[] = [
|
|
54
|
+
{ id: 'logo-1', text: '╔══════════════════════════════════╗' },
|
|
55
|
+
{ id: 'logo-2', text: '║ INK LAYOUT DEMO ║' },
|
|
56
|
+
{ id: 'logo-3', text: '║ Logo / History / Input ║' },
|
|
57
|
+
{ id: 'logo-4', text: '╚══════════════════════════════════╝' },
|
|
58
|
+
];
|
|
59
|
+
const [input, setInput] = useState('');
|
|
60
|
+
const [cursorPosition, setCursorPosition] = useState(0);
|
|
61
|
+
|
|
62
|
+
useInput((chunk, key) => {
|
|
63
|
+
const text = typeof chunk === 'string' ? chunk : '';
|
|
64
|
+
const keyAny = key as { leftArrow?: boolean; rightArrow?: boolean };
|
|
65
|
+
|
|
66
|
+
if (key.escape || (text === 'q' && !key.ctrl && !key.meta)) {
|
|
67
|
+
exit();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (key.return) {
|
|
72
|
+
const line = input.trim();
|
|
73
|
+
if (line) {
|
|
74
|
+
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
75
|
+
setHistory(prev => [...prev, { id, text: line }]);
|
|
76
|
+
}
|
|
77
|
+
setInput('');
|
|
78
|
+
setCursorPosition(0);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (key.backspace || key.delete) {
|
|
83
|
+
if (cursorPosition > 0) {
|
|
84
|
+
const next = input.slice(0, cursorPosition - 1) + input.slice(cursorPosition);
|
|
85
|
+
setInput(next);
|
|
86
|
+
setCursorPosition(c => c - 1);
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (keyAny.leftArrow) {
|
|
92
|
+
setCursorPosition(c => Math.max(0, c - 1));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (keyAny.rightArrow) {
|
|
96
|
+
setCursorPosition(c => Math.min(input.length, c + 1));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (text && !key.ctrl && !key.meta) {
|
|
101
|
+
const next = input.slice(0, cursorPosition) + text + input.slice(cursorPosition);
|
|
102
|
+
setInput(next);
|
|
103
|
+
setCursorPosition(cursorPosition + text.length);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Box flexDirection="column" width={terminalCols} height={5}>
|
|
109
|
+
{/* 顶部 Logo */}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
{/* 中间历史(Static) */}
|
|
113
|
+
<Box flexDirection="column" flexGrow={1} minHeight={0}>
|
|
114
|
+
<Static items={logoStaticItems}>
|
|
115
|
+
{item => (
|
|
116
|
+
<Text key={item.id} bold color="cyan">
|
|
117
|
+
{item.text}
|
|
118
|
+
</Text>
|
|
119
|
+
)}
|
|
120
|
+
</Static>
|
|
121
|
+
<Static items={history}>
|
|
122
|
+
{(item, index) => (
|
|
123
|
+
<Text key={item.id}>
|
|
124
|
+
<Text dimColor>{String(index + 1).padStart(3, ' ')}. </Text>
|
|
125
|
+
<Text>{item.text}</Text>
|
|
126
|
+
</Text>
|
|
127
|
+
)}
|
|
128
|
+
</Static>
|
|
129
|
+
</Box>
|
|
130
|
+
|
|
131
|
+
{/* 底部输入框 */}
|
|
132
|
+
<Box flexDirection="column" flexShrink={0} marginTop={0}>
|
|
133
|
+
<Box borderStyle="single" borderColor="gray" paddingX={1}>
|
|
134
|
+
<Text dimColor>{'> '}</Text>
|
|
135
|
+
<Text>{input.slice(0, cursorPosition)}</Text>
|
|
136
|
+
<Text color="cyan">▋</Text>
|
|
137
|
+
<Text>{input.slice(cursorPosition)}</Text>
|
|
138
|
+
</Box>
|
|
139
|
+
<Text dimColor>
|
|
140
|
+
Static 历史模式 | 回车追加历史 | q / Esc 退出
|
|
141
|
+
</Text>
|
|
142
|
+
</Box>
|
|
143
|
+
</Box>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render(<InkScrollDemoApp />);
|
package/tsconfig.test.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"isolatedModules": true
|
|
7
|
-
},
|
|
8
|
-
"include": ["src/**/*", "tests/**/*"]
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"isolatedModules": true
|
|
7
|
+
},
|
|
8
|
+
"include": ["src/**/*", "tests/**/*"]
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"./index-
|
|
1
|
+
import{n}from"./index-Cn73hS12.js";const r={name:"ConfirmDialog",props:{visible:{type:Boolean,default:!1},message:{type:String,default:""}}};var i=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-96"},[t("p",{staticClass:"text-gray-200 text-sm mb-4"},[e._v(e._s(e.message))]),t("div",{staticClass:"flex justify-end gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs text-gray-400 hover:text-white",on:{click:function(s){return e.$emit("cancel")}}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700",on:{click:function(s){return e.$emit("confirm")}}},[e._v("确定")])])])]):e._e()},a=[],o=n(r,i,a,!1,null,null);const d=o.exports;export{d as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.select-project-dialog{display:flex;flex-direction:column;gap:12px}.select-project-dialog+.el-dialog{z-index:2003!important}.select-project-dialog[data-v-e90f8022]{display:flex;gap:8px;flex-wrap:wrap}.file-list-container[data-v-e90f8022]{border:1px solid #ddd;border-radius:4px;max-height:300px;overflow:auto}.current-path[data-v-e90f8022]{padding:8px 12px;background:#f5f5f5;border-bottom:1px solid #ddd;font-size:12px}.path-label[data-v-e90f8022]{color:#666}.path-value[data-v-e90f8022]{color:#333;word-break:break-all}.file-list[data-v-e90f8022]{padding:4px}.file-item[data-v-e90f8022]{display:flex;align-items:center;gap:8px;padding:6px 8px;cursor:pointer;border-radius:4px}.file-item[data-v-e90f8022]:hover{background:#f0f0f0}.file-item.selected[data-v-e90f8022]{background:#e6f7ff;border:1px solid #1890ff}.file-item.parent[data-v-e90f8022]{color:#666}.file-name[data-v-e90f8022]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.empty-tip[data-v-e90f8022]{padding:40px;text-align:center;color:#999}.底部状态栏[data-v-e90f8022]{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#f5f5f5;border-radius:4px;font-size:12px}.selected-info[data-v-e90f8022]{color:#333}.project-name-input[data-v-e90f8022]{display:flex;align-items:center;gap:8px}
|