casabot 1.0.0

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 (61) hide show
  1. package/.github/workflows/publish.yml +28 -0
  2. package/LICENSE +190 -0
  3. package/README.md +112 -0
  4. package/dist/agent/base.d.ts +5 -0
  5. package/dist/agent/base.js +82 -0
  6. package/dist/agent/tools.d.ts +4 -0
  7. package/dist/agent/tools.js +36 -0
  8. package/dist/cli/index.d.ts +3 -0
  9. package/dist/cli/index.js +70 -0
  10. package/dist/cli/setup.d.ts +2 -0
  11. package/dist/cli/setup.js +356 -0
  12. package/dist/config/manager.d.ts +14 -0
  13. package/dist/config/manager.js +46 -0
  14. package/dist/config/types.d.ts +38 -0
  15. package/dist/config/types.js +2 -0
  16. package/dist/history/store.d.ts +7 -0
  17. package/dist/history/store.js +52 -0
  18. package/dist/index.d.ts +9 -0
  19. package/dist/index.js +7 -0
  20. package/dist/providers/anthropic.d.ts +10 -0
  21. package/dist/providers/anthropic.js +98 -0
  22. package/dist/providers/base.d.ts +11 -0
  23. package/dist/providers/base.js +2 -0
  24. package/dist/providers/custom.d.ts +4 -0
  25. package/dist/providers/custom.js +9 -0
  26. package/dist/providers/huggingface.d.ts +6 -0
  27. package/dist/providers/huggingface.js +8 -0
  28. package/dist/providers/index.d.ts +5 -0
  29. package/dist/providers/index.js +25 -0
  30. package/dist/providers/openai.d.ts +10 -0
  31. package/dist/providers/openai.js +76 -0
  32. package/dist/providers/openrouter.d.ts +6 -0
  33. package/dist/providers/openrouter.js +8 -0
  34. package/dist/skills/loader.d.ts +4 -0
  35. package/dist/skills/loader.js +48 -0
  36. package/dist/tui/app.d.ts +4 -0
  37. package/dist/tui/app.js +88 -0
  38. package/package.json +40 -0
  39. package/skills/agent/SKILL.md +180 -0
  40. package/skills/chat/SKILL.md +165 -0
  41. package/skills/config/SKILL.md +168 -0
  42. package/skills/memory/SKILL.md +245 -0
  43. package/skills/service/SKILL.md +224 -0
  44. package/src/agent/base.ts +98 -0
  45. package/src/agent/tools.ts +40 -0
  46. package/src/cli/index.ts +81 -0
  47. package/src/cli/setup.ts +378 -0
  48. package/src/config/manager.ts +53 -0
  49. package/src/config/types.ts +49 -0
  50. package/src/history/store.ts +59 -0
  51. package/src/index.ts +22 -0
  52. package/src/providers/anthropic.ts +115 -0
  53. package/src/providers/base.ts +12 -0
  54. package/src/providers/custom.ts +11 -0
  55. package/src/providers/huggingface.ts +10 -0
  56. package/src/providers/index.ts +29 -0
  57. package/src/providers/openai.ts +87 -0
  58. package/src/providers/openrouter.ts +10 -0
  59. package/src/skills/loader.ts +52 -0
  60. package/src/tui/app.tsx +158 -0
  61. package/tsconfig.json +20 -0
@@ -0,0 +1,28 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: '20'
18
+ registry-url: 'https://registry.npmjs.org'
19
+
20
+ - run: npm ci
21
+
22
+ - run: npm run build
23
+
24
+ - run: npm run typecheck
25
+
26
+ - run: npm publish --access public
27
+ env:
28
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE ADDED
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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
+ Copyright 2025 CasAbot Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # CasAbot
2
+
3
+ > **Cassiopeia A** — Create anything freely, like a supernova explosion.
4
+
5
+ A skill-driven multi-agent orchestrator system. The base agent reads skill documents, spawns sub-agents, and delegates all tasks through them.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i -g casabot
11
+ ```
12
+
13
+ ## Getting Started
14
+
15
+ ```bash
16
+ # Initial setup (select provider and model)
17
+ casabot setup
18
+
19
+ # Open the TUI chat interface
20
+ casabot
21
+
22
+ # Reset to default configuration
23
+ casabot reset
24
+ ```
25
+
26
+ ## Core Philosophy
27
+
28
+ - **Skills are everything** — The base agent doesn't hardcode any logic. It reads skill documents (SKILL.md) and executes them via the terminal. Need a new capability? Just add a skill document.
29
+ - **Base doesn't do the work** — The base agent is purely an orchestrator. It never performs tasks directly — it delegates everything to sub-agents.
30
+
31
+ ## Architecture
32
+
33
+ ```
34
+ User ↔ TUI (Terminal UI) ↔ Base Agent (terminal access)
35
+
36
+ ├── Read skill documents
37
+ ├── Execute terminal commands
38
+
39
+ ├── Sub-agent A (podman container)
40
+ │ └── Own workspace + tools
41
+ ├── Sub-agent B (podman container)
42
+ │ └── Own workspace + tools
43
+ └── ...
44
+ ```
45
+
46
+ ## Directory Structure
47
+
48
+ ```
49
+ ~/casabot/
50
+ ├── casabot.json # All configuration (providers, models, etc.)
51
+ ├── skills/ # Skill documents (AgentSkills standard)
52
+ │ ├── agent/SKILL.md # Agent creation and management
53
+ │ ├── config/SKILL.md # CasAbot configuration
54
+ │ ├── chat/SKILL.md # Conversation management
55
+ │ ├── service/SKILL.md # System service registration
56
+ │ └── memory/SKILL.md # Memory management
57
+ ├── workspaces/ # Per-agent workspaces
58
+ ├── history/ # Full conversation logs (raw)
59
+ └── memory/ # Agent-authored notes (.md)
60
+ ```
61
+
62
+ ## Supported Providers
63
+
64
+ | Provider | Type |
65
+ |----------|------|
66
+ | OpenAI | `openai` |
67
+ | Anthropic | `anthropic` |
68
+ | Hugging Face | `huggingface` |
69
+ | OpenRouter | `openrouter` |
70
+ | Custom (OpenAI-compatible) | `custom-openai` |
71
+ | Custom (Anthropic-compatible) | `custom-anthropic` |
72
+
73
+ ## Built-in Skills
74
+
75
+ | Skill | Description |
76
+ |-------|-------------|
77
+ | `agent` | Create, delegate to, and manage podman-based sub-agents |
78
+ | `config` | CasAbot configuration structure and modification |
79
+ | `chat` | Conversation session management and search |
80
+ | `service` | systemd service registration and automation |
81
+ | `memory` | Write, query, and search agent notes |
82
+
83
+ ## Adding Skills
84
+
85
+ Create a directory under `~/casabot/skills/` and write a `SKILL.md` file:
86
+
87
+ ```yaml
88
+ ---
89
+ name: skill-name
90
+ description: What this skill does
91
+ metadata:
92
+ casabot:
93
+ requires:
94
+ bins: []
95
+ ---
96
+
97
+ # Skill Title
98
+
99
+ (Instructions for the base agent to read, interpret, and execute via terminal)
100
+ ```
101
+
102
+ ## Tech Stack
103
+
104
+ - **Runtime**: Node.js
105
+ - **Language**: TypeScript
106
+ - **TUI**: [Ink](https://github.com/vadimdemedes/ink) (React for CLI)
107
+ - **Containers**: podman
108
+ - **LLM SDKs**: OpenAI, Anthropic
109
+
110
+ ## License
111
+
112
+ Apache License 2.0 — see [LICENSE](./LICENSE)
@@ -0,0 +1,5 @@
1
+ import type { ChatProvider } from "../providers/base.js";
2
+ import type { Message, Skill, ConversationHistory } from "../config/types.js";
3
+ export declare function buildSystemPrompt(skills: Skill[]): string;
4
+ export declare function runAgent(provider: ChatProvider, userMessage: string, conversation: ConversationHistory, skills: Skill[]): AsyncGenerator<Message>;
5
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1,82 @@
1
+ import { TERMINAL_TOOL, executeCommand } from "./tools.js";
2
+ import { appendMessage } from "../history/store.js";
3
+ import { formatSkillsForPrompt } from "../skills/loader.js";
4
+ import { CASABOT_HOME } from "../config/manager.js";
5
+ const MAX_ITERATIONS = 20;
6
+ export function buildSystemPrompt(skills) {
7
+ const skillList = formatSkillsForPrompt(skills);
8
+ return `당신은 CasAbot의 base 에이전트입니다. Cassiopeia A — 초신성 폭발과 같이 모든 것을 자유롭게 창조합니다.
9
+
10
+ ## 핵심 원칙
11
+ 1. 당신은 오케스트레이터입니다. 실제 작업을 직접 수행하지 마세요.
12
+ 2. 스킬 문서를 우선적으로 참조하세요. 필요한 스킬의 SKILL.md를 읽고 지침을 따르세요.
13
+ 3. 적합한 서브에이전트가 있으면 위임하고, 없으면 새로 만들어서 위임하세요.
14
+ 4. 오케스트레이션(에이전트 생성/위임/관리)만 직접 수행하세요.
15
+
16
+ ## 사용 가능한 도구
17
+ - \`run_command\`: 터미널 명령어를 실행합니다. 이 도구 하나로 스킬을 읽고, 서브에이전트를 관리하고, 모든 오케스트레이션을 수행합니다.
18
+
19
+ ## 작업 순서
20
+ 1. 사용자의 요청을 분석합니다.
21
+ 2. 관련 스킬 문서를 읽습니다: \`cat <스킬경로>\`
22
+ 3. 스킬 지침에 따라 서브에이전트를 생성하거나 기존 에이전트에 위임합니다.
23
+ 4. 결과를 수집하여 사용자에게 보고합니다.
24
+
25
+ ## CasAbot 디렉토리 구조
26
+ - 홈: ${CASABOT_HOME}
27
+ - 스킬: ${CASABOT_HOME}/skills/
28
+ - 워크스페이스: ${CASABOT_HOME}/workspaces/
29
+ - 대화 기록: ${CASABOT_HOME}/history/
30
+ - 기록(메모): ${CASABOT_HOME}/memory/
31
+ - 설정: ${CASABOT_HOME}/casabot.json
32
+
33
+ ## ${skillList}
34
+ `;
35
+ }
36
+ export async function* runAgent(provider, userMessage, conversation, skills) {
37
+ const systemPrompt = buildSystemPrompt(skills);
38
+ const userMsg = { role: "user", content: userMessage };
39
+ await appendMessage(conversation, userMsg);
40
+ const tools = [TERMINAL_TOOL];
41
+ for (let i = 0; i < MAX_ITERATIONS; i++) {
42
+ const messagesWithSystem = [
43
+ { role: "system", content: systemPrompt },
44
+ ...conversation.messages,
45
+ ];
46
+ const assistantMsg = await provider.chat(messagesWithSystem, tools);
47
+ await appendMessage(conversation, assistantMsg);
48
+ yield assistantMsg;
49
+ if (!assistantMsg.toolCalls?.length) {
50
+ return;
51
+ }
52
+ for (const toolCall of assistantMsg.toolCalls) {
53
+ let result;
54
+ if (toolCall.name === "run_command") {
55
+ try {
56
+ const args = JSON.parse(toolCall.arguments);
57
+ result = await executeCommand(args.command);
58
+ }
59
+ catch {
60
+ result = `오류: 도구 인자 파싱 실패 — ${toolCall.arguments}`;
61
+ }
62
+ }
63
+ else {
64
+ result = `알 수 없는 도구: ${toolCall.name}`;
65
+ }
66
+ const toolMsg = {
67
+ role: "tool",
68
+ content: result,
69
+ toolCallId: toolCall.id,
70
+ };
71
+ await appendMessage(conversation, toolMsg);
72
+ yield toolMsg;
73
+ }
74
+ }
75
+ const limitMsg = {
76
+ role: "assistant",
77
+ content: "⚠️ 최대 반복 횟수에 도달했습니다. 요청을 다시 시도해 주세요.",
78
+ };
79
+ await appendMessage(conversation, limitMsg);
80
+ yield limitMsg;
81
+ }
82
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1,4 @@
1
+ import type { ToolDefinition } from "../providers/base.js";
2
+ export declare const TERMINAL_TOOL: ToolDefinition;
3
+ export declare function executeCommand(command: string): Promise<string>;
4
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { exec } from "child_process";
2
+ import { promisify } from "util";
3
+ const execAsync = promisify(exec);
4
+ const MAX_BUFFER = 10 * 1024 * 1024;
5
+ const TIMEOUT_MS = 60_000;
6
+ export const TERMINAL_TOOL = {
7
+ name: "run_command",
8
+ description: "터미널에서 명령어를 실행합니다. 스킬 문서를 읽거나, 서브에이전트를 관리하거나, 시스템 작업을 수행할 때 사용합니다.",
9
+ parameters: {
10
+ type: "object",
11
+ properties: {
12
+ command: {
13
+ type: "string",
14
+ description: "실행할 터미널 명령어",
15
+ },
16
+ },
17
+ required: ["command"],
18
+ },
19
+ };
20
+ export async function executeCommand(command) {
21
+ try {
22
+ const { stdout, stderr } = await execAsync(command, {
23
+ timeout: TIMEOUT_MS,
24
+ maxBuffer: MAX_BUFFER,
25
+ shell: "/bin/bash",
26
+ });
27
+ const output = [stdout, stderr].filter(Boolean).join("\n");
28
+ return output || "(명령어가 출력 없이 완료되었습니다)";
29
+ }
30
+ catch (err) {
31
+ const error = err;
32
+ const parts = [error.stdout, error.stderr, error.message].filter(Boolean);
33
+ return `오류 발생:\n${parts.join("\n")}`;
34
+ }
35
+ }
36
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { loadConfig, saveConfig, getDefaultConfig, ensureDirectories } from "../config/manager.js";
4
+ import { createProvider } from "../providers/index.js";
5
+ import { loadSkills } from "../skills/loader.js";
6
+ import { createConversation } from "../history/store.js";
7
+ import { startTUI } from "../tui/app.js";
8
+ import { setupWizard } from "./setup.js";
9
+ const program = new Command();
10
+ program
11
+ .name("casabot")
12
+ .description("CasAbot — 스킬 중심 멀티에이전트 오케스트레이터")
13
+ .version("1.0.0");
14
+ program
15
+ .command("setup")
16
+ .description("최초 설정 (공급자, 모델 등 전체 설정)")
17
+ .action(async () => {
18
+ try {
19
+ await setupWizard();
20
+ }
21
+ catch (err) {
22
+ const msg = err instanceof Error ? err.message : String(err);
23
+ console.error(`❌ 설정 중 오류 발생: ${msg}`);
24
+ process.exit(1);
25
+ }
26
+ });
27
+ program
28
+ .command("reset")
29
+ .description("초기 설정으로 되돌리기")
30
+ .action(async () => {
31
+ try {
32
+ await saveConfig(getDefaultConfig());
33
+ console.log("✅ 설정이 초기화되었습니다.");
34
+ console.log("'casabot setup' 명령어로 다시 설정하세요.");
35
+ }
36
+ catch (err) {
37
+ const msg = err instanceof Error ? err.message : String(err);
38
+ console.error(`❌ 초기화 중 오류 발생: ${msg}`);
39
+ process.exit(1);
40
+ }
41
+ });
42
+ program
43
+ .action(async () => {
44
+ try {
45
+ await ensureDirectories();
46
+ const config = await loadConfig();
47
+ if (!config.activeProvider || config.providers.length === 0) {
48
+ console.log("⚠️ 공급자가 설정되지 않았습니다.");
49
+ console.log("'casabot setup' 명령어로 먼저 설정하세요.\n");
50
+ process.exit(1);
51
+ }
52
+ const providerConfig = config.providers.find((p) => p.name === config.activeProvider);
53
+ if (!providerConfig) {
54
+ console.error(`❌ 활성 공급자 '${config.activeProvider}'를 찾을 수 없습니다.`);
55
+ console.error("'casabot setup' 명령어로 다시 설정하세요.");
56
+ process.exit(1);
57
+ }
58
+ const provider = createProvider(providerConfig);
59
+ const skills = await loadSkills();
60
+ const conversation = createConversation();
61
+ startTUI(provider, conversation, skills);
62
+ }
63
+ catch (err) {
64
+ const msg = err instanceof Error ? err.message : String(err);
65
+ console.error(`❌ 시작 중 오류 발생: ${msg}`);
66
+ process.exit(1);
67
+ }
68
+ });
69
+ program.parse();
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export declare function setupWizard(): Promise<void>;
2
+ //# sourceMappingURL=setup.d.ts.map