harubashi 0.1.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 (172) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +293 -0
  3. package/README.ru.md +293 -0
  4. package/dist/agent/agent.module.d.ts +2 -0
  5. package/dist/agent/agent.module.js +34 -0
  6. package/dist/agent/agent.module.js.map +1 -0
  7. package/dist/agent/agent.processor.d.ts +31 -0
  8. package/dist/agent/agent.processor.js +266 -0
  9. package/dist/agent/agent.processor.js.map +1 -0
  10. package/dist/agent/command-guard.service.d.ts +10 -0
  11. package/dist/agent/command-guard.service.js +48 -0
  12. package/dist/agent/command-guard.service.js.map +1 -0
  13. package/dist/agent/interruption.service.d.ts +11 -0
  14. package/dist/agent/interruption.service.js +52 -0
  15. package/dist/agent/interruption.service.js.map +1 -0
  16. package/dist/agent/system-executor.service.d.ts +32 -0
  17. package/dist/agent/system-executor.service.js +200 -0
  18. package/dist/agent/system-executor.service.js.map +1 -0
  19. package/dist/app.module.d.ts +2 -0
  20. package/dist/app.module.js +38 -0
  21. package/dist/app.module.js.map +1 -0
  22. package/dist/bin.d.ts +2 -0
  23. package/dist/bin.js +137 -0
  24. package/dist/bin.js.map +1 -0
  25. package/dist/cli.d.ts +2 -0
  26. package/dist/cli.js +141 -0
  27. package/dist/cli.js.map +1 -0
  28. package/dist/commands/config.command.d.ts +2 -0
  29. package/dist/commands/config.command.js +83 -0
  30. package/dist/commands/config.command.js.map +1 -0
  31. package/dist/commands/logs.command.d.ts +5 -0
  32. package/dist/commands/logs.command.js +130 -0
  33. package/dist/commands/logs.command.js.map +1 -0
  34. package/dist/commands/profile.command.d.ts +5 -0
  35. package/dist/commands/profile.command.js +293 -0
  36. package/dist/commands/profile.command.js.map +1 -0
  37. package/dist/commands/setup.command.d.ts +1 -0
  38. package/dist/commands/setup.command.js +94 -0
  39. package/dist/commands/setup.command.js.map +1 -0
  40. package/dist/commands/setup.helpers.d.ts +34 -0
  41. package/dist/commands/setup.helpers.js +265 -0
  42. package/dist/commands/setup.helpers.js.map +1 -0
  43. package/dist/commands/skills.command.d.ts +2 -0
  44. package/dist/commands/skills.command.js +111 -0
  45. package/dist/commands/skills.command.js.map +1 -0
  46. package/dist/common/adapters/cli-interaction.adapter.d.ts +8 -0
  47. package/dist/common/adapters/cli-interaction.adapter.js +67 -0
  48. package/dist/common/adapters/cli-interaction.adapter.js.map +1 -0
  49. package/dist/common/adapters/interaction-adapter.interface.d.ts +6 -0
  50. package/dist/common/adapters/interaction-adapter.interface.js +10 -0
  51. package/dist/common/adapters/interaction-adapter.interface.js.map +1 -0
  52. package/dist/common/constants.d.ts +3 -0
  53. package/dist/common/constants.js +7 -0
  54. package/dist/common/constants.js.map +1 -0
  55. package/dist/common/index.d.ts +4 -0
  56. package/dist/common/index.js +21 -0
  57. package/dist/common/index.js.map +1 -0
  58. package/dist/common/logger.d.ts +9 -0
  59. package/dist/common/logger.js +87 -0
  60. package/dist/common/logger.js.map +1 -0
  61. package/dist/common/paths.d.ts +12 -0
  62. package/dist/common/paths.js +28 -0
  63. package/dist/common/paths.js.map +1 -0
  64. package/dist/common/types/message.types.d.ts +48 -0
  65. package/dist/common/types/message.types.js +18 -0
  66. package/dist/common/types/message.types.js.map +1 -0
  67. package/dist/common/types/tool.types.d.ts +20 -0
  68. package/dist/common/types/tool.types.js +3 -0
  69. package/dist/common/types/tool.types.js.map +1 -0
  70. package/dist/common/utils/type-guards.d.ts +8 -0
  71. package/dist/common/utils/type-guards.js +46 -0
  72. package/dist/common/utils/type-guards.js.map +1 -0
  73. package/dist/config/config-loader.d.ts +6 -0
  74. package/dist/config/config-loader.js +90 -0
  75. package/dist/config/config-loader.js.map +1 -0
  76. package/dist/config/config.module.d.ts +2 -0
  77. package/dist/config/config.module.js +28 -0
  78. package/dist/config/config.module.js.map +1 -0
  79. package/dist/config/config.types.d.ts +55 -0
  80. package/dist/config/config.types.js +21 -0
  81. package/dist/config/config.types.js.map +1 -0
  82. package/dist/daemon.d.ts +2 -0
  83. package/dist/daemon.js +28 -0
  84. package/dist/daemon.js.map +1 -0
  85. package/dist/llm/anthropic/anthropic.provider.d.ts +15 -0
  86. package/dist/llm/anthropic/anthropic.provider.js +162 -0
  87. package/dist/llm/anthropic/anthropic.provider.js.map +1 -0
  88. package/dist/llm/google/google.provider.d.ts +14 -0
  89. package/dist/llm/google/google.provider.js +189 -0
  90. package/dist/llm/google/google.provider.js.map +1 -0
  91. package/dist/llm/llm-factory.service.d.ts +24 -0
  92. package/dist/llm/llm-factory.service.js +76 -0
  93. package/dist/llm/llm-factory.service.js.map +1 -0
  94. package/dist/llm/llm.interface.d.ts +19 -0
  95. package/dist/llm/llm.interface.js +5 -0
  96. package/dist/llm/llm.interface.js.map +1 -0
  97. package/dist/llm/llm.module.d.ts +2 -0
  98. package/dist/llm/llm.module.js +34 -0
  99. package/dist/llm/llm.module.js.map +1 -0
  100. package/dist/llm/nvidia/nvidia.provider.d.ts +11 -0
  101. package/dist/llm/nvidia/nvidia.provider.js +49 -0
  102. package/dist/llm/nvidia/nvidia.provider.js.map +1 -0
  103. package/dist/llm/openai/openai.provider.d.ts +9 -0
  104. package/dist/llm/openai/openai.provider.js +35 -0
  105. package/dist/llm/openai/openai.provider.js.map +1 -0
  106. package/dist/llm/openai-compatible/openai-compatible.helper.d.ts +4 -0
  107. package/dist/llm/openai-compatible/openai-compatible.helper.js +155 -0
  108. package/dist/llm/openai-compatible/openai-compatible.helper.js.map +1 -0
  109. package/dist/llm/proxy/proxy.provider.d.ts +9 -0
  110. package/dist/llm/proxy/proxy.provider.js +35 -0
  111. package/dist/llm/proxy/proxy.provider.js.map +1 -0
  112. package/dist/main.d.ts +1 -0
  113. package/dist/main.js +14 -0
  114. package/dist/main.js.map +1 -0
  115. package/dist/prisma/prisma.module.d.ts +2 -0
  116. package/dist/prisma/prisma.module.js +22 -0
  117. package/dist/prisma/prisma.module.js.map +1 -0
  118. package/dist/prisma/prisma.service.d.ts +9 -0
  119. package/dist/prisma/prisma.service.js +40 -0
  120. package/dist/prisma/prisma.service.js.map +1 -0
  121. package/dist/sessions/sessions.module.d.ts +2 -0
  122. package/dist/sessions/sessions.module.js +23 -0
  123. package/dist/sessions/sessions.module.js.map +1 -0
  124. package/dist/sessions/sessions.service.d.ts +21 -0
  125. package/dist/sessions/sessions.service.js +82 -0
  126. package/dist/sessions/sessions.service.js.map +1 -0
  127. package/dist/skills/definitions/directory_explorer.md +69 -0
  128. package/dist/skills/definitions/execute_command.md +27 -0
  129. package/dist/skills/definitions/git_manager.md +98 -0
  130. package/dist/skills/definitions/read_file.md +25 -0
  131. package/dist/skills/skills-bundle.d.ts +7 -0
  132. package/dist/skills/skills-bundle.js +27 -0
  133. package/dist/skills/skills-bundle.js.map +1 -0
  134. package/dist/skills/skills-parser.d.ts +8 -0
  135. package/dist/skills/skills-parser.js +67 -0
  136. package/dist/skills/skills-parser.js.map +1 -0
  137. package/dist/skills/skills.module.d.ts +2 -0
  138. package/dist/skills/skills.module.js +22 -0
  139. package/dist/skills/skills.module.js.map +1 -0
  140. package/dist/skills/skills.service.d.ts +22 -0
  141. package/dist/skills/skills.service.js +150 -0
  142. package/dist/skills/skills.service.js.map +1 -0
  143. package/dist/skills/skills.types.d.ts +16 -0
  144. package/dist/skills/skills.types.js +3 -0
  145. package/dist/skills/skills.types.js.map +1 -0
  146. package/dist/soul/prompts/core.md +28 -0
  147. package/dist/soul/prompts/rules.md +40 -0
  148. package/dist/soul/prompts/runtime.md +13 -0
  149. package/dist/soul/prompts/voice.md +45 -0
  150. package/dist/soul/soul.module.d.ts +2 -0
  151. package/dist/soul/soul.module.js +22 -0
  152. package/dist/soul/soul.module.js.map +1 -0
  153. package/dist/soul/soul.service.d.ts +22 -0
  154. package/dist/soul/soul.service.js +89 -0
  155. package/dist/soul/soul.service.js.map +1 -0
  156. package/dist/telegram/pairing.service.d.ts +11 -0
  157. package/dist/telegram/pairing.service.js +81 -0
  158. package/dist/telegram/pairing.service.js.map +1 -0
  159. package/dist/telegram/telegram-interaction.adapter.d.ts +16 -0
  160. package/dist/telegram/telegram-interaction.adapter.js +54 -0
  161. package/dist/telegram/telegram-interaction.adapter.js.map +1 -0
  162. package/dist/telegram/telegram.module.d.ts +2 -0
  163. package/dist/telegram/telegram.module.js +25 -0
  164. package/dist/telegram/telegram.module.js.map +1 -0
  165. package/dist/telegram/telegram.service.d.ts +28 -0
  166. package/dist/telegram/telegram.service.js +255 -0
  167. package/dist/telegram/telegram.service.js.map +1 -0
  168. package/dist/tsconfig.build.tsbuildinfo +1 -0
  169. package/package.json +68 -0
  170. package/prisma/migrations/20260403134611_init/migration.sql +40 -0
  171. package/prisma/migrations/migration_lock.toml +3 -0
  172. package/prisma/schema.prisma +74 -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 [yyyy] [name of copyright owner]
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,293 @@
1
+ 🌍 **Read in:** [English](README.md) | [Русский](README.ru.md)
2
+
3
+ # 🌉 Harubashi
4
+
5
+ **A headless, multi-profile system-use AI agent — installable as a global npm package.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/harubashi.svg?style=flat-square)](https://www.npmjs.com/package/harubashi)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
9
+ [![Node](https://img.shields.io/node/v/harubashi.svg?style=flat-square)](https://nodejs.org)
10
+
11
+ Harubashi turns your terminal — and your Telegram chat — into a thinking interface to your machine. It executes shell commands, reads files, manages git, and grows with hot-reloadable skills you can write yourself in plain Markdown.
12
+
13
+ ---
14
+
15
+ ## ✨ Why Harubashi?
16
+
17
+ - **🔁 Multi-profile** — keep separate profiles for work, personal, experiments. Each profile has its own provider, API keys, model, and SQLite database. Switch with one command.
18
+ - **🧠 Skills as Markdown** — drop a `.md` file into `~/.harubashi/skills/` and the agent picks it up instantly via hot-reload. Two kinds: **Tools** (callable functions) and **Guidance** (system-prompt augmentation).
19
+ - **🔐 Secret-masked logs** — Winston file logs redact NVIDIA / OpenAI / Anthropic / Google keys, Telegram bot tokens, and Bearer headers automatically. Daily rotation, 14-day retention.
20
+ - **📡 Telegram-ready** — run `harubashi daemon` and chat with your machine from your phone. Or stay in the terminal with `harubashi cli`.
21
+ - **🛡 Auto-healing** — accidentally delete `~/.harubashi/skills/`? The next daemon boot restores the bundled skills automatically.
22
+
23
+ ---
24
+
25
+ ## 📦 Installation
26
+
27
+ ```bash
28
+ npm install -g harubashi
29
+ ```
30
+
31
+ Requires **Node.js ≥ 18**. The first time you launch any command after install, run the setup wizard:
32
+
33
+ ```bash
34
+ harubashi setup
35
+ ```
36
+
37
+ This creates `~/.harubashi/` containing:
38
+
39
+ ```
40
+ ~/.harubashi/
41
+ ├── config.yaml # All profiles + active selection
42
+ ├── databases/ # One SQLite file per profile
43
+ │ └── default.db
44
+ ├── skills/ # Hot-reloadable Markdown skills
45
+ │ ├── system_execute_command.md
46
+ │ ├── system_read_file.md
47
+ │ ├── directory_explorer.md (guidance)
48
+ │ └── git_manager.md (guidance)
49
+ └── logs/ # Daily-rotated JSON logs
50
+ └── harubashi-YYYY-MM-DD.log
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 🚀 Quick Start
56
+
57
+ ```bash
58
+ # 1. Configure your first profile (interactive wizard)
59
+ harubashi setup
60
+
61
+ # 2. Talk to the agent in your terminal
62
+ harubashi cli
63
+
64
+ # 3. Or run as a Telegram daemon (background)
65
+ harubashi daemon
66
+
67
+ # 4. Tail the logs from another terminal
68
+ harubashi logs
69
+ ```
70
+
71
+ The wizard asks for your LLM provider (Nvidia NIM, Google Gemini, with Anthropic / OpenAI / Proxy coming soon), an API key, a model, and optionally a Telegram bot token.
72
+
73
+ ---
74
+
75
+ ## 👤 Profiles
76
+
77
+ A **profile** is a complete agent identity: provider, credentials, model, optional Telegram bot, and a dedicated SQLite database.
78
+
79
+ ```bash
80
+ harubashi profile list # Show all profiles, mark the active one
81
+ harubashi profile use work # Switch active profile
82
+ harubashi profile create staging # Wizard with pre-fill from active profile
83
+ harubashi profile edit work # Wizard, but skips DB init (config-only edit)
84
+ ```
85
+
86
+ The **edit flow is instant** — if `~/.harubashi/databases/<name>.db` already exists, the wizard skips the Prisma init step. The **create flow is rollback-safe** — if database initialization fails, the profile is *not* added to `config.yaml`.
87
+
88
+ Re-running `harubashi setup` when a config exists shows a unified picker:
89
+
90
+ ```
91
+ ? Select profile to configure:
92
+ [+] Create new profile...
93
+ ❯ work (active) · nvidia · meta/llama-3.1-70b-instruct
94
+ staging · google · gemini-1.5-pro
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🧩 Skills
100
+
101
+ Skills are Markdown files in `~/.harubashi/skills/`. Each one has a YAML frontmatter and a body. There are **two kinds**:
102
+
103
+ ### Active Tool — `input_schema` is **present**
104
+
105
+ The skill is registered as a callable LLM function. The body becomes the tool's documentation in the system prompt.
106
+
107
+ ```markdown
108
+ ---
109
+ name: system_execute_command
110
+ description: Execute a shell command on the host OS.
111
+ input_schema:
112
+ type: object
113
+ properties:
114
+ command:
115
+ type: string
116
+ description: The shell command to execute
117
+ required: [command]
118
+ ---
119
+
120
+ ## Usage Guidelines
121
+
122
+ - Prefer simple commands over complex pipelines.
123
+ - Always specify `workdir` when operating on a project.
124
+ - Never run destructive commands without explicit user confirmation.
125
+ ```
126
+
127
+ ### Guidance-only — `input_schema` is **absent**
128
+
129
+ The skill is **not** exposed as a tool, but its body is concatenated into the agent's system prompt under `## Guidance: <name>`. Use this to teach the agent how to wield existing tools.
130
+
131
+ ```markdown
132
+ ---
133
+ name: git_manager
134
+ description: Workflow guidance for using Git via system_execute_command.
135
+ ---
136
+
137
+ ## The mandatory workflow
138
+
139
+ 1. **`git status`** — understand state before any mutation.
140
+ 2. **`git diff`** — inspect changes.
141
+ 3. **`git add <path>`** — stage selectively.
142
+ 4. **`git commit -m "..."`** — Conventional Commits style.
143
+ ```
144
+
145
+ ### Built-in skills
146
+
147
+ | Name | Kind | Purpose |
148
+ |----------------------------|----------|-------------------------------------------------------|
149
+ | `system_execute_command` | Tool | Run shell commands cross-platform |
150
+ | `system_read_file` | Tool | Read a file by absolute path |
151
+ | `directory_explorer` | Guidance | Safe, shallow-first FS exploration; ignore heavy dirs |
152
+ | `git_manager` | Guidance | Status → diff → add → commit; forbid destructive ops |
153
+
154
+ ### Manage skills
155
+
156
+ ```bash
157
+ harubashi skills list # Pretty-print all skills, split by Tools / Guidance
158
+ harubashi skills open # Open ~/.harubashi/skills/ in the OS file manager
159
+ ```
160
+
161
+ Edit any `.md` file → the running daemon picks up the change instantly via chokidar hot-reload.
162
+
163
+ ### Auto-heal
164
+
165
+ If you delete `~/.harubashi/skills/` (or it ends up empty), the next daemon boot **restores the bundled skills** from the npm package automatically:
166
+
167
+ ```
168
+ [SkillsService] Auto-healed skills from bundled package (4 file(s)) into ~/.harubashi/skills/
169
+ ```
170
+
171
+ This means the daemon is hard to break. Bundled skills are read-only sources; user edits live in the home directory.
172
+
173
+ ---
174
+
175
+ ## 📜 Logs
176
+
177
+ ```bash
178
+ harubashi logs # Tail the latest log file
179
+ harubashi logs --no-follow # Print and exit
180
+ harubashi logs --lines 200 # 200 lines of history before tailing
181
+ ```
182
+
183
+ - **File format**: line-delimited JSON, one record per line. Daily rotation (`harubashi-YYYY-MM-DD.log`), 14-day retention, 20 MB cap per file.
184
+ - **Console rendering**: pretty-printed, colored by level: `INFO` green, `WARN` yellow, `ERROR` red, `DEBUG` blue.
185
+ - **Secret masking**: API keys (`nvapi-***`, `sk-***`, `AIza***`), Telegram bot tokens, and `Bearer` headers are redacted in **both** transports.
186
+ - **Cross-platform tail**: implemented via `chokidar` instead of `tail -f`, so it works the same on Windows / macOS / Linux. Day-rollover is detected automatically.
187
+
188
+ ---
189
+
190
+ ## ⚙️ Configuration
191
+
192
+ The single source of truth is `~/.harubashi/config.yaml`. Find its absolute path:
193
+
194
+ ```bash
195
+ harubashi config path
196
+ ```
197
+
198
+ This emits the bare path (no decoration), so it pipes cleanly:
199
+
200
+ ```bash
201
+ code "$(harubashi config path)" # open in VS Code
202
+ cd "$(dirname "$(harubashi config path)")" # cd into ~/.harubashi
203
+ ```
204
+
205
+ Schema (abbreviated):
206
+
207
+ ```yaml
208
+ activeProfile: work
209
+ profiles:
210
+ work:
211
+ llmProvider: nvidia # nvidia | google | anthropic | openai | proxy
212
+ providers:
213
+ nvidia:
214
+ apiKey: nvapi-***
215
+ model: meta/llama-3.1-70b-instruct
216
+ telegram:
217
+ enabled: true
218
+ botToken: ***
219
+ staging:
220
+ llmProvider: google
221
+ providers:
222
+ google:
223
+ apiKey: AIza***
224
+ model: gemini-1.5-pro
225
+ ```
226
+
227
+ Manual edits are fine; the wizard simply automates them.
228
+
229
+ ---
230
+
231
+ ## 📚 Command Reference
232
+
233
+ | Command | Purpose |
234
+ |-------------------------------|----------------------------------------------------------------------|
235
+ | `harubashi setup` | First-time wizard, or pick-existing-or-create when config exists |
236
+ | `harubashi cli` | Launch the interactive REPL |
237
+ | `harubashi daemon` | Launch the Telegram-facing background daemon |
238
+ | `harubashi logs [opts]` | Tail the daily log; `-n <N>`, `--no-follow` |
239
+ | `harubashi profile list` | List profiles, mark the active one |
240
+ | `harubashi profile use <name>`| Switch active profile |
241
+ | `harubashi profile create [name]` | Wizard for a new profile (rollback-safe, pre-fill from active) |
242
+ | `harubashi profile edit [name]` | Edit an existing profile (skips DB init when DB exists) |
243
+ | `harubashi skills list` | List installed skills, split by Tools and Guidance |
244
+ | `harubashi skills open` | Open `~/.harubashi/skills/` in the OS file manager |
245
+ | `harubashi config path` | Print the absolute path to `config.yaml` (pipeable) |
246
+ | `harubashi -V` / `--version` | Print the package version |
247
+
248
+ ---
249
+
250
+ ## 🏗 Architecture
251
+
252
+ - **NestJS standalone application** — no HTTP server; the agent runs as a context held by `cli` or `daemon`.
253
+ - **Prisma + SQLite** — one database per profile under `~/.harubashi/databases/<name>.db`. Schema bundled with the npm package.
254
+ - **Telegraf** — Telegram bot integration (optional, daemon-only).
255
+ - **chokidar** — file-watching for skills hot-reload and the cross-platform log tail.
256
+ - **Winston + winston-daily-rotate-file** — colored console + JSON file logs with secret masking.
257
+ - **Commander** — CLI surface, lazy dynamic imports per subcommand for fast cold-start.
258
+ - **Inquirer** — interactive wizards for setup and profile management.
259
+
260
+ ---
261
+
262
+ ## 🛠 Development
263
+
264
+ ```bash
265
+ git clone https://github.com/Hilrein/harubashi.git
266
+ cd harubashi
267
+ npm install
268
+ npm run build
269
+
270
+ # Local beta-test as if it were globally installed
271
+ npm link
272
+ harubashi setup
273
+ ```
274
+
275
+ Useful scripts:
276
+
277
+ ```bash
278
+ npm run build # nest build
279
+ npm run lint # eslint
280
+ npm run format # prettier
281
+ npm run cli # ts-node src/bin.ts cli
282
+ npm run daemon # ts-node src/bin.ts daemon
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 📄 License
288
+
289
+ MIT — see [LICENSE](LICENSE).
290
+
291
+ ---
292
+
293
+ <sub>Made with care. Open an issue if anything feels rough.</sub>