toolpack-cli 0.1.0-SNAPSHOT

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 (99) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +131 -0
  3. package/dist/app.d.ts +1 -0
  4. package/dist/app.js +15 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +29 -0
  7. package/dist/commands/clear.d.ts +3 -0
  8. package/dist/commands/clear.js +15 -0
  9. package/dist/commands/help.d.ts +3 -0
  10. package/dist/commands/help.js +29 -0
  11. package/dist/commands/index.d.ts +15 -0
  12. package/dist/commands/index.js +16 -0
  13. package/dist/commands/info.d.ts +3 -0
  14. package/dist/commands/info.js +24 -0
  15. package/dist/commands/mode.d.ts +3 -0
  16. package/dist/commands/mode.js +51 -0
  17. package/dist/commands/model.d.ts +3 -0
  18. package/dist/commands/model.js +14 -0
  19. package/dist/commands/registry.d.ts +32 -0
  20. package/dist/commands/registry.js +86 -0
  21. package/dist/commands/tool-log.d.ts +3 -0
  22. package/dist/commands/tool-log.js +17 -0
  23. package/dist/commands/tool-search.d.ts +3 -0
  24. package/dist/commands/tool-search.js +57 -0
  25. package/dist/commands/tools.d.ts +3 -0
  26. package/dist/commands/tools.js +45 -0
  27. package/dist/commands/types.d.ts +25 -0
  28. package/dist/commands/types.js +4 -0
  29. package/dist/commands/version.d.ts +3 -0
  30. package/dist/commands/version.js +25 -0
  31. package/dist/components/AppInfo.d.ts +1 -0
  32. package/dist/components/AppInfo.js +10 -0
  33. package/dist/components/HomeInput.d.ts +11 -0
  34. package/dist/components/HomeInput.js +328 -0
  35. package/dist/components/Logo.d.ts +1 -0
  36. package/dist/components/Logo.js +15 -0
  37. package/dist/components/Markdown.d.ts +5 -0
  38. package/dist/components/Markdown.js +121 -0
  39. package/dist/components/ProviderBar.d.ts +12 -0
  40. package/dist/components/ProviderBar.js +32 -0
  41. package/dist/components/ShimmerText.d.ts +8 -0
  42. package/dist/components/ShimmerText.js +20 -0
  43. package/dist/components/ToolLogPopup.d.ts +7 -0
  44. package/dist/components/ToolLogPopup.js +87 -0
  45. package/dist/components/common/HistorySelect.d.ts +6 -0
  46. package/dist/components/common/HistorySelect.js +57 -0
  47. package/dist/components/common/Modal.d.ts +10 -0
  48. package/dist/components/common/Modal.js +13 -0
  49. package/dist/components/common/ModeSelect.d.ts +6 -0
  50. package/dist/components/common/ModeSelect.js +13 -0
  51. package/dist/components/common/ModelSelect.d.ts +9 -0
  52. package/dist/components/common/ModelSelect.js +45 -0
  53. package/dist/context/ConversationContext.d.ts +44 -0
  54. package/dist/context/ConversationContext.js +113 -0
  55. package/dist/context/ToolpackContext.d.ts +55 -0
  56. package/dist/context/ToolpackContext.js +221 -0
  57. package/dist/custom-providers/AnthropicCustomAdapter.d.ts +49 -0
  58. package/dist/custom-providers/AnthropicCustomAdapter.js +297 -0
  59. package/dist/custom-providers/XAIAdapter.d.ts +40 -0
  60. package/dist/custom-providers/XAIAdapter.js +295 -0
  61. package/dist/custom-tools/skill-tools/index.d.ts +33 -0
  62. package/dist/custom-tools/skill-tools/index.js +63 -0
  63. package/dist/custom-tools/skill-tools/tools/create/index.d.ts +2 -0
  64. package/dist/custom-tools/skill-tools/tools/create/index.js +93 -0
  65. package/dist/custom-tools/skill-tools/tools/create/schema.d.ts +6 -0
  66. package/dist/custom-tools/skill-tools/tools/create/schema.js +41 -0
  67. package/dist/custom-tools/skill-tools/tools/list/index.d.ts +2 -0
  68. package/dist/custom-tools/skill-tools/tools/list/index.js +113 -0
  69. package/dist/custom-tools/skill-tools/tools/list/schema.d.ts +6 -0
  70. package/dist/custom-tools/skill-tools/tools/list/schema.js +19 -0
  71. package/dist/custom-tools/skill-tools/tools/read/index.d.ts +2 -0
  72. package/dist/custom-tools/skill-tools/tools/read/index.js +124 -0
  73. package/dist/custom-tools/skill-tools/tools/read/schema.d.ts +6 -0
  74. package/dist/custom-tools/skill-tools/tools/read/schema.js +27 -0
  75. package/dist/custom-tools/skill-tools/tools/search/bm25.d.ts +71 -0
  76. package/dist/custom-tools/skill-tools/tools/search/bm25.js +305 -0
  77. package/dist/custom-tools/skill-tools/tools/search/index.d.ts +8 -0
  78. package/dist/custom-tools/skill-tools/tools/search/index.js +63 -0
  79. package/dist/custom-tools/skill-tools/tools/search/schema.d.ts +6 -0
  80. package/dist/custom-tools/skill-tools/tools/search/schema.js +19 -0
  81. package/dist/custom-tools/skill-tools/tools/search/skill-index.d.ts +54 -0
  82. package/dist/custom-tools/skill-tools/tools/search/skill-index.js +251 -0
  83. package/dist/custom-tools/skill-tools/tools/update/index.d.ts +2 -0
  84. package/dist/custom-tools/skill-tools/tools/update/index.js +115 -0
  85. package/dist/custom-tools/skill-tools/tools/update/schema.d.ts +6 -0
  86. package/dist/custom-tools/skill-tools/tools/update/schema.js +41 -0
  87. package/dist/screens/ChatScreen.d.ts +1 -0
  88. package/dist/screens/ChatScreen.js +327 -0
  89. package/dist/screens/HomeScreen.d.ts +1 -0
  90. package/dist/screens/HomeScreen.js +68 -0
  91. package/dist/screens/SettingsScreen.d.ts +1 -0
  92. package/dist/screens/SettingsScreen.js +35 -0
  93. package/dist/services/db.d.ts +31 -0
  94. package/dist/services/db.js +108 -0
  95. package/dist/theme/ThemeContext.d.ts +11 -0
  96. package/dist/theme/ThemeContext.js +31 -0
  97. package/dist/theme/theme.d.ts +17 -0
  98. package/dist/theme/theme.js +82 -0
  99. package/package.json +101 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Sajeer
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # Toolpack CLI
2
+
3
+ **The intelligent command-line interface directly powering the [Toolpack SDK](https://github.com/toolpack-ai/toolpack-sdk).**
4
+
5
+ Bring the power of multi-provider AI agents, dynamic tools, and autonomous workflows directly to your terminal.
6
+
7
+ [![npm version](https://badge.fury.io/js/toolpack-cli.svg)](https://badge.fury.io/js/toolpack-cli)
8
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
9
+
10
+ ## Overview
11
+
12
+ The `toolpack-cli` is an interactive, terminal-based user interface (TUI) designed to demonstrate the capabilities of the Toolpack SDK. It provides a highly polished, React/Ink-powered chat experience inside your terminal, allowing you to fluidly interact with multiple AI providers (OpenAI, Anthropic, Gemini, Ollama) and trigger dozens of built-in system file operations without leaving the command line.
13
+
14
+ ## Installation
15
+
16
+ Install globally via npm to use the `toolpack` command anywhere:
17
+
18
+ ```bash
19
+ npm i -g toolpack-cli
20
+ ```
21
+
22
+ Or run via `npx` without installing:
23
+
24
+ ```bash
25
+ npx toolpack-cli
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ Run the application:
31
+
32
+ ```bash
33
+ toolpack
34
+ ```
35
+
36
+ _(Note: For cloud providers like OpenAI, Anthropic, or Gemini, you will need to set API keys as environment variables such as `TOOLPACK_OPENAI_KEY` inside `.env` or exported to your shell)._
37
+
38
+ ## Features & Commands
39
+
40
+ The CLI supports a robust set of slash (`/`) commands entered directly into the chat input to manage context, tools, and models dynamically.
41
+
42
+ ### Core Commands
43
+
44
+ | Command | Description |
45
+ | ---------- | --------------------------------------------------------------------------- |
46
+ | `/help` | Display the help menu with all available slash commands. |
47
+ | `/clear` | Clear the current conversation history and reset the session. |
48
+ | `/info` | Display current SDK configuration, session memory usage, and backend stats. |
49
+ | `/version` | Show the currently installed version of the CLI and SDK. |
50
+
51
+ ### Configuration Commands
52
+
53
+ | Command | Description |
54
+ | --------------------- | ------------------------------------------------------------------------------------------- |
55
+ | `/mode [mode_name]` | Switch the active AI mode (e.g., `chat`, `architect`, `code`). Leave empty to view current. |
56
+ | `/model [model_name]` | Switch the active AI model/provider. Leave empty to view current. |
57
+
58
+ ### Tool Commands
59
+
60
+ | Command | Description |
61
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
62
+ | `/tools` | List all available built-in tools (File system, Web search, System execution, etc). |
63
+ | `/tool-search [query]` | Search the tool registry by name or capability description to find the right tool. |
64
+ | `/tool-log` | Preview the execution logs and outputs of all tools triggered during the current session. |
65
+
66
+ ## Advanced Configuration
67
+
68
+ You can fully customize the behavior of the SDK and this CLI by placing a `toolpack.config.json` in the root of your project territory. (The CLI will automatically discover it).
69
+
70
+ **Example Configuration:**
71
+
72
+ ```json
73
+ {
74
+ "fastAIModels": {
75
+ "openai": "gpt-4o-mini",
76
+ "anthropic": "claude-3-haiku-20240307"
77
+ },
78
+ "ollama": {
79
+ "baseUrl": "http://localhost:11434"
80
+ },
81
+ "tools": {
82
+ "enabled": true,
83
+ "toolChoicePolicy": "required_for_actions",
84
+ "toolSearch": {
85
+ "enabled": true,
86
+ "searchResultLimit": 5
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Related
93
+
94
+ - [**Toolpack SDK**](https://github.com/toolpack-ai/toolpack-sdk) - The foundational TypeScript SDK library behind this product.
95
+
96
+ ---
97
+
98
+ ## Status
99
+
100
+ **Current Version:** 0.1.0
101
+
102
+ - ✓ **Multi-Provider Support** — See [supported providers](https://github.com/toolpack-ai/toolpack-sdk#providers) in the SDK
103
+ - ✓ **Built-in Tools** — See [all tools](https://github.com/toolpack-ai/toolpack-sdk#built-in-tools) in the SDK
104
+ - ✓ **Mode System** — See [modes](https://github.com/toolpack-ai/toolpack-sdk#modes) in the SDK
105
+ - ✓ **Workflow Engine** — Execute complex AI-driven plans and parallel steps interactively
106
+ - ✓ **BM25 Search** — On-demand tool discovery for large agentic libraries directly in the chat
107
+
108
+ ### Custom Tools (CLI-specific)
109
+
110
+ The CLI includes additional tools not in the base SDK:
111
+
112
+ | Tool | Description |
113
+ |------|-------------|
114
+ | `skill.create` | Create a new skill file in `.skills/` |
115
+ | `skill.list` | List all available skills |
116
+ | `skill.read` | Read a skill file content |
117
+ | `skill.search` | Search skills by name or description |
118
+ | `skill.update` | Update an existing skill |
119
+
120
+ ## Contributing
121
+
122
+ Contributions welcome! Please read the [contributing guide](./CONTRIBUTING.md) first to get started with local development.
123
+
124
+ ## License
125
+
126
+ Apache 2.0 © [Sajeer](https://sajeerzeji.com)
127
+
128
+ ## Support
129
+
130
+ - 🐛 [Issue Tracker](https://github.com/toolpack-ai/toolpack-cli/issues) (Please use our [Bug Report](.github/ISSUE_TEMPLATE/bug_report.md) or [Feature Request](.github/ISSUE_TEMPLATE/feature_request.md) templates)
131
+ - 💬 [Discussions](https://github.com/toolpack-ai/toolpack-cli/discussions)
package/dist/app.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
package/dist/app.js ADDED
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ThemeProvider } from './theme/ThemeContext.js';
3
+ import { ToolpackProvider } from './context/ToolpackContext.js';
4
+ import { ConversationProvider, useConversation, } from './context/ConversationContext.js';
5
+ import { HomeScreen } from './screens/HomeScreen.js';
6
+ import { ChatScreen } from './screens/ChatScreen.js';
7
+ import { SettingsScreen } from './screens/SettingsScreen.js';
8
+ import { Box } from 'ink';
9
+ function Router() {
10
+ const { screen } = useConversation();
11
+ return (_jsxs(Box, { width: "100%", height: "100%", flexDirection: "column", children: [screen === 'home' && _jsx(HomeScreen, {}), screen === 'chat' && _jsx(ChatScreen, {}), screen === 'settings' && _jsx(SettingsScreen, {})] }));
12
+ }
13
+ export default function App() {
14
+ return (_jsx(ThemeProvider, { children: _jsx(ToolpackProvider, { children: _jsx(ConversationProvider, { children: _jsx(Router, {}) }) }) }));
15
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as dotenv from 'dotenv';
4
+ dotenv.config();
5
+ import { render } from 'ink';
6
+ import meow from 'meow';
7
+ import { initializeGlobalConfigIfFirstRun } from 'toolpack-sdk';
8
+ import App from './app.js';
9
+ // Initialize configuration directory and seed global config if this is the first run
10
+ initializeGlobalConfigIfFirstRun();
11
+ meow(`
12
+ Usage
13
+ $ toolpack
14
+ `, {
15
+ importMeta: import.meta,
16
+ });
17
+ // We can't use the alternate screen buffer (\x1b[?1049h) because it physically
18
+ // locks text selection and link clicking in native macOS Terminal.app and iTerm.
19
+ // Instead, we clear the standard screen buffer on boot to simulate a TUI environment
20
+ // while retaining native terminal mouse capabilities.
21
+ process.stdout.write('\x1b[2J\x1b[H'); // Clear entire screen and move cursor to top-left
22
+ process.stdout.write('\x1b[3J'); // Clear scrollback buffer (optional, makes it feel more like a dedicated app)
23
+ const { waitUntilExit } = render(_jsx(App, {}), { exitOnCtrlC: true });
24
+ try {
25
+ await waitUntilExit();
26
+ }
27
+ finally {
28
+ // Fallback cleanup natively handled by exit hook
29
+ }
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ declare const clearCommand: Command;
3
+ export default clearCommand;
@@ -0,0 +1,15 @@
1
+ import { registerCommand } from './registry.js';
2
+ const clearCommand = {
3
+ name: 'clear',
4
+ aliases: ['c'],
5
+ description: 'Clear current conversation and go to home screen',
6
+ execute: (_, context) => {
7
+ context.clearHistory();
8
+ return {
9
+ success: true,
10
+ action: 'navigate',
11
+ };
12
+ },
13
+ };
14
+ registerCommand(clearCommand);
15
+ export default clearCommand;
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ declare const helpCommand: Command;
3
+ export default helpCommand;
@@ -0,0 +1,29 @@
1
+ import { registerCommand, getAllCommands } from './registry.js';
2
+ const helpCommand = {
3
+ name: 'help',
4
+ aliases: ['h', '?'],
5
+ description: 'Show available commands',
6
+ execute: () => {
7
+ const cmds = getAllCommands();
8
+ const lines = [
9
+ '**Available Commands:**',
10
+ '',
11
+ ...cmds.map(cmd => {
12
+ const aliases = cmd.aliases?.length
13
+ ? ` (${cmd.aliases.map(a => `/${a}`).join(', ')})`
14
+ : '';
15
+ const usage = cmd.usage ? ` Usage: ${cmd.usage}` : '';
16
+ return `- **/${cmd.name}**${aliases}: ${cmd.description}${usage}`;
17
+ }),
18
+ '',
19
+ '_Tip: Commands are case-insensitive_',
20
+ ];
21
+ return {
22
+ success: true,
23
+ message: lines.join('\n'),
24
+ action: 'display',
25
+ };
26
+ },
27
+ };
28
+ registerCommand(helpCommand);
29
+ export default helpCommand;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CLI Commands Module
3
+ * Handles slash commands triggered from chat input (e.g., /help, /tool_log)
4
+ */
5
+ export type { Command, CommandContext, CommandResult } from './types.js';
6
+ export { registerCommand, getCommand, getAllCommands, isCommand, parseCommand, executeCommand, } from './registry.js';
7
+ import './help.js';
8
+ import './clear.js';
9
+ import './mode.js';
10
+ import './model.js';
11
+ import './tools.js';
12
+ import './tool-log.js';
13
+ import './tool-search.js';
14
+ import './info.js';
15
+ import './version.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * CLI Commands Module
3
+ * Handles slash commands triggered from chat input (e.g., /help, /tool_log)
4
+ */
5
+ // Re-export registry functions
6
+ export { registerCommand, getCommand, getAllCommands, isCommand, parseCommand, executeCommand, } from './registry.js';
7
+ // Import all commands to register them
8
+ import './help.js';
9
+ import './clear.js';
10
+ import './mode.js';
11
+ import './model.js';
12
+ import './tools.js';
13
+ import './tool-log.js';
14
+ import './tool-search.js';
15
+ import './info.js';
16
+ import './version.js';
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ declare const infoCommand: Command;
3
+ export default infoCommand;
@@ -0,0 +1,24 @@
1
+ import { registerCommand } from './registry.js';
2
+ const infoCommand = {
3
+ name: 'info',
4
+ aliases: ['i'],
5
+ description: 'Show SDK and session info',
6
+ execute: (_, context) => {
7
+ const lines = [
8
+ '**Toolpack SDK CLI Info:**',
9
+ '',
10
+ `- **Mode:** ${context.activeMode?.displayName || 'All'}`,
11
+ `- **Model:** ${context.activeModel}`,
12
+ `- **SDK Initialized:** ${context.toolpack ? 'Yes' : 'No'}`,
13
+ `- **Tools Enabled:** ${context.toolpack?.getToolRegistry?.() ? 'Yes' : 'No'}`,
14
+ `- **CWD:** ${process.cwd()}`,
15
+ ];
16
+ return {
17
+ success: true,
18
+ message: lines.join('\n'),
19
+ action: 'display',
20
+ };
21
+ },
22
+ };
23
+ registerCommand(infoCommand);
24
+ export default infoCommand;
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ declare const modeCommand: Command;
3
+ export default modeCommand;
@@ -0,0 +1,51 @@
1
+ import { registerCommand } from './registry.js';
2
+ const modeCommand = {
3
+ name: 'mode',
4
+ aliases: ['m'],
5
+ description: 'Show or change the current mode',
6
+ usage: '/mode [mode_name]',
7
+ execute: (args, context) => {
8
+ if (!context.toolpack) {
9
+ return {
10
+ success: false,
11
+ message: 'Toolpack not initialized',
12
+ action: 'display',
13
+ };
14
+ }
15
+ if (args.length === 0) {
16
+ const modes = context.toolpack.getModes?.() || [];
17
+ const lines = [
18
+ `**Current Mode:** ${context.activeMode?.displayName || 'All'}`,
19
+ '',
20
+ '**Available Modes:**',
21
+ ...modes.map((m) => `- ${m.name}: ${m.displayName}`),
22
+ '',
23
+ `_Use /mode <name> to switch_`,
24
+ ];
25
+ return {
26
+ success: true,
27
+ message: lines.join('\n'),
28
+ action: 'display',
29
+ };
30
+ }
31
+ const modeName = args[0];
32
+ try {
33
+ context.toolpack.setMode(modeName);
34
+ const newMode = context.toolpack.getMode();
35
+ return {
36
+ success: true,
37
+ message: `Mode changed to: **${newMode?.displayName || modeName}**`,
38
+ action: 'display',
39
+ };
40
+ }
41
+ catch (error) {
42
+ return {
43
+ success: false,
44
+ message: `Failed to set mode: ${error.message}`,
45
+ action: 'display',
46
+ };
47
+ }
48
+ },
49
+ };
50
+ registerCommand(modeCommand);
51
+ export default modeCommand;
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ declare const modelCommand: Command;
3
+ export default modelCommand;
@@ -0,0 +1,14 @@
1
+ import { registerCommand } from './registry.js';
2
+ const modelCommand = {
3
+ name: 'model',
4
+ description: 'Show current model',
5
+ execute: (_, context) => {
6
+ return {
7
+ success: true,
8
+ message: `**Current Model:** ${context.activeModel}`,
9
+ action: 'display',
10
+ };
11
+ },
12
+ };
13
+ registerCommand(modelCommand);
14
+ export default modelCommand;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Command Registry
3
+ * Manages command registration and lookup
4
+ */
5
+ import { Command } from './types.js';
6
+ /**
7
+ * Register a command
8
+ */
9
+ export declare function registerCommand(command: Command): void;
10
+ /**
11
+ * Get a command by name
12
+ */
13
+ export declare function getCommand(name: string): Command | undefined;
14
+ /**
15
+ * Get all unique commands (excluding aliases)
16
+ */
17
+ export declare function getAllCommands(): Command[];
18
+ /**
19
+ * Check if input is a command
20
+ */
21
+ export declare function isCommand(input: string): boolean;
22
+ /**
23
+ * Parse command input into name and arguments
24
+ */
25
+ export declare function parseCommand(input: string): {
26
+ name: string;
27
+ args: string[];
28
+ };
29
+ /**
30
+ * Execute a command
31
+ */
32
+ export declare function executeCommand(input: string, context: import('./types.js').CommandContext): Promise<import('./types.js').CommandResult>;