cliskill 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,470 @@
1
+ <div align="center">
2
+
3
+ # πŸš€ cliskill
4
+
5
+ ### Universal Terminal AI CLI
6
+
7
+ **НСзависимый AI-ассистСнт для Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π»Π° с ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΎΠΉ Π»ΡŽΠ±Ρ‹Ρ… LLM ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€ΠΎΠ²**
8
+
9
+ [![Tests](https://img.shields.io/badge/tests-844%20passed-brightgreen)]()
10
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
11
+ [![Version](https://img.shields.io/badge/version-0.1.0-orange)]()
12
+ [![Node](https://img.shields.io/badge/node-%3E%3D20.0.0-green)]()
13
+
14
+ [БСсплатный](#) Β· [Π‘Π΅Π· подписок](#) Β· [Π‘Π΅Π· vendor lock-in](#) Β· [Π£Π½ΠΈΠ²Π΅Ρ€ΡΠ°Π»ΡŒΠ½Ρ‹ΠΉ](#)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## πŸ“‘ Π‘ΠΎΠ΄Π΅Ρ€ΠΆΠ°Π½ΠΈΠ΅
21
+
22
+ - [О ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π΅](#-ΠΎ-ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π΅)
23
+ - [ВозмоТности](#-возмоТности)
24
+ - [Установка](#-установка)
25
+ - [ИспользованиС](#-использованиС)
26
+ - [ΠšΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡ](#-конфигурация)
27
+ - [АрхитСктура](#-Π°Ρ€Ρ…ΠΈΡ‚Π΅ΠΊΡ‚ΡƒΡ€Π°)
28
+ - [Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ°](#-Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ°)
29
+ - [Π’Π΅Ρ…Π½ΠΎΠ»ΠΎΠ³ΠΈΠΈ](#-Ρ‚Π΅Ρ…Π½ΠΎΠ»ΠΎΠ³ΠΈΠΈ)
30
+ - [ЛицСнзия](#-лицСнзия)
31
+
32
+ ---
33
+
34
+ ## 🧠 О ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π΅
35
+
36
+ **cliskill** β€” это ΡƒΠ½ΠΈΠ²Π΅Ρ€ΡΠ°Π»ΡŒΠ½Ρ‹ΠΉ AI-ассистСнт для Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π»Π°, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ с **Π»ΡŽΠ±Ρ‹ΠΌ** LLM ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€ΠΎΠΌ Ρ‡Π΅Ρ€Π΅Π· стандартный `/chat/completions` API. Никакой привязки ΠΊ ΠΊΠΎΠ½ΠΊΡ€Π΅Ρ‚Π½ΠΎΠΌΡƒ Π²Π΅Π½Π΄ΠΎΡ€Ρƒ: ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ Π»ΠΎΠΊΠ°Π»ΡŒΠ½Ρ‹Π΅ ΠΌΠΎΠ΄Π΅Π»ΠΈ, ΠΎΠ±Π»Π°Ρ‡Π½Ρ‹Π΅ API ΠΈΠ»ΠΈ собствСнныС сСрвСры.
37
+
38
+ ### ΠšΠ»ΡŽΡ‡Π΅Π²Ρ‹Π΅ ΠΏΡ€ΠΈΠ½Ρ†ΠΈΠΏΡ‹
39
+
40
+ | ΠŸΡ€ΠΈΠ½Ρ†ΠΈΠΏ | ОписаниС |
41
+ |---------|----------|
42
+ | πŸ†“ **БСсплатный** | Никаких подписок ΠΈ ΠΎΠ³Ρ€Π°Π½ΠΈΡ‡Π΅Π½ΠΈΠΉ ΠΏΠΎ функциям |
43
+ | πŸ”“ **ΠžΡ‚ΠΊΡ€Ρ‹Ρ‚Ρ‹ΠΉ** | ΠŸΠΎΠ»Π½Ρ‹ΠΉ исходный ΠΊΠΎΠ΄, MIT лицСнзия |
44
+ | πŸ”Œ **Π£Π½ΠΈΠ²Π΅Ρ€ΡΠ°Π»ΡŒΠ½Ρ‹ΠΉ** | Π›ΡŽΠ±ΠΎΠΉ `/chat/completions` совмСстимый API |
45
+ | 🚫 **Π‘Π΅Π· vendor lock-in** | Π›Π΅Π³ΠΊΠΎ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°ΠΉΡ‚Π΅ΡΡŒ ΠΌΠ΅ΠΆΠ΄Ρƒ ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€Π°ΠΌΠΈ |
46
+ | πŸ€– **АгСнтский** | 15 инструмСнтов, ΠΌΡƒΠ»ΡŒΡ‚ΠΈ-агСнтная координация |
47
+ | πŸ›‘οΈ **БСзопасный** | НастраиваСмыС ΡƒΡ€ΠΎΠ²Π½ΠΈ довСрия ΠΈ Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΡ |
48
+
49
+ ---
50
+
51
+ ## ✨ ВозмоТности
52
+
53
+ ### πŸ”Œ ΠŸΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€Ρ‹ ΠΈ ΠΌΠΎΠ΄Π΅Π»ΠΈ
54
+
55
+ - **Π£Π½ΠΈΠ²Π΅Ρ€ΡΠ°Π»ΡŒΠ½Π°Ρ систСма ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€ΠΎΠ²** β€” ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ любого `/chat/completions` API
56
+ - **Алиасы ΠΌΠΎΠ΄Π΅Π»Π΅ΠΉ** β€” прСдустановлСнныС алиасы: `smart`, `fast`, `balanced`, `reasoning`, `code`
57
+ - **1M Ρ‚ΠΎΠΊΠ΅Π½ΠΎΠ² контСкста** β€” ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ, настраиваСмый Π»ΠΈΠΌΠΈΡ‚
58
+ - **АвтоматичСский fallback** β€” ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ Π½Π° Ρ€Π΅Π·Π΅Ρ€Π²Π½Ρ‹Π΅ ΠΌΠΎΠ΄Π΅Π»ΠΈ ΠΏΡ€ΠΈ ΠΎΡˆΠΈΠ±ΠΊΠ°Ρ…
59
+ - **Rate Limit Handler** β€” коррСктная ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° Π»ΠΈΠΌΠΈΡ‚ΠΎΠ² Π±Π΅Π· upsell
60
+
61
+ ### πŸ”§ Π˜Π½ΡΡ‚Ρ€ΡƒΠΌΠ΅Π½Ρ‚Ρ‹ (15 ΡˆΡ‚ΡƒΠΊ)
62
+
63
+ | Π˜Π½ΡΡ‚Ρ€ΡƒΠΌΠ΅Π½Ρ‚ | ОписаниС |
64
+ |------------|----------|
65
+ | πŸ–₯️ **Bash Tool** | Π’Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ shell ΠΊΠΎΠΌΠ°Π½Π΄ с инспСкциСй бСзопасности |
66
+ | πŸ“„ **File Read** | Π§Ρ‚Π΅Π½ΠΈΠ΅ Ρ„Π°ΠΉΠ»ΠΎΠ² с ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΎΠΉ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ |
67
+ | ✏️ **File Write** | Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΈ ΠΏΠ΅Ρ€Π΅Π·Π°ΠΏΠΈΡΡŒ Ρ„Π°ΠΉΠ»ΠΎΠ² |
68
+ | πŸ“ **File Edit** | Π’ΠΎΡ‡Π΅Ρ‡Π½ΠΎΠ΅ Ρ€Π΅Π΄Π°ΠΊΡ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Ρ„Π°ΠΉΠ»ΠΎΠ² (search/replace) |
69
+ | πŸ” **Glob** | Поиск Ρ„Π°ΠΉΠ»ΠΎΠ² ΠΏΠΎ ΠΏΠ°Ρ‚Ρ‚Π΅Ρ€Π½Π°ΠΌ |
70
+ | πŸ”Ž **Grep** | Поиск тСкста с ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΎΠΉ regex |
71
+ | 🌐 **Web Search** | Π’Π΅Π±-поиск Ρ‡Π΅Ρ€Π΅Π· поисковыС систСмы |
72
+ | 🌍 **Web Fetch** | Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ° ΠΈ парсинг Π²Π΅Π±-страниц |
73
+ | πŸ€– **Agent Tool** | ΠŸΠΎΡ€ΠΎΠΆΠ΄Π΅Π½ΠΈΠ΅ суб-Π°Π³Π΅Π½Ρ‚ΠΎΠ² для ΠΏΠΎΠ΄Π·Π°Π΄Π°Ρ‡ |
74
+ | πŸ“‘ **LSP Tool** | Π˜Π½Ρ‚Π΅Π³Ρ€Π°Ρ†ΠΈΡ с Language Server Protocol |
75
+ | βœ… **Todo Write** | Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ списками Π·Π°Π΄Π°Ρ‡ |
76
+ | πŸ–±οΈ **Computer Use** | Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΌΡ‹ΡˆΡŒΡŽ ΠΈ ΠΊΠ»Π°Π²ΠΈΠ°Ρ‚ΡƒΡ€ΠΎΠΉ |
77
+ | πŸ”— **Remote Tool** | Π’Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄ Π½Π° ΡƒΠ΄Π°Π»Ρ‘Π½Π½Ρ‹Ρ… сСрвСрах Ρ‡Π΅Ρ€Π΅Π· SSH |
78
+ | 🌳 **Worktree Tool** | Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ git worktree для ΠΏΠ°Ρ€Π°Π»Π»Π΅Π»ΡŒΠ½ΠΎΠΉ Ρ€Π°Π±ΠΎΡ‚Ρ‹ |
79
+ | πŸ“‹ **Plan Mode** | ΠŸΠ»Π°Π½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ с 3 ΠΏΠ°Ρ€Π°Π»Π»Π΅Π»ΡŒΠ½Ρ‹ΠΌΠΈ Π°Π³Π΅Π½Ρ‚Π°ΠΌΠΈ |
80
+
81
+ ### πŸ€– АгСнтская систСма
82
+
83
+ - **Auto Mode** β€” 3 уровня автономности:
84
+ - `full-auto` β€” полная автономия, всС дСйствия Π±Π΅Π· подтвСрТдСния
85
+ - `safe-auto` β€” автоматичСскоС Π²Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ бСзопасных ΠΎΠΏΠ΅Ρ€Π°Ρ†ΠΈΠΉ
86
+ - `ask` β€” ΠΏΠΎΠ΄Ρ‚Π²Π΅Ρ€ΠΆΠ΄Π΅Π½ΠΈΠ΅ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ дСйствия (ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ)
87
+ - **Fast Mode** β€” ΠΎΠΏΡ‚ΠΈΠΌΠΈΠ·Π°Ρ†ΠΈΠΈ скорости ΠΎΡ‚Π²Π΅Ρ‚ΠΎΠ²
88
+ - **Multi-Agent Plan Mode V2** β€” 3 ΠΏΠ°Ρ€Π°Π»Π»Π΅Π»ΡŒΠ½Ρ‹Ρ… Π°Π³Π΅Π½Ρ‚Π° для планирования
89
+ - **Swarm Coordinator** β€” ΠΌΡƒΠ»ΡŒΡ‚ΠΈ-агСнтная координация слоТных Π·Π°Π΄Π°Ρ‡
90
+ - **Task System** β€” Ρ„ΠΎΠ½ΠΎΠ²Ρ‹Π΅ Π·Π°Π΄Π°Ρ‡ΠΈ с отслСТиваниСм статуса
91
+
92
+ ### πŸ—οΈ Π˜Π½Ρ„Ρ€Π°ΡΡ‚Ρ€ΡƒΠΊΡ‚ΡƒΡ€Π°
93
+
94
+ | БистСма | ОписаниС |
95
+ |---------|----------|
96
+ | 🎨 **Theme System** | 6 Ρ‚Π΅ΠΌ оформлСния, Π²ΠΊΠ»ΡŽΡ‡Π°Ρ daltonized для Π΄Π°Π»ΡŒΡ‚ΠΎΠ½ΠΈΠΊΠΎΠ² |
97
+ | ⏰ **Cron Scheduler** | ΠžΡ‚Π»ΠΎΠΆΠ΅Π½Π½Ρ‹Π΅ ΠΈ ΠΏΠΎΠ²Ρ‚ΠΎΡ€ΡΡŽΡ‰ΠΈΠ΅ΡΡ Π·Π°Π΄Π°Ρ‡ΠΈ ΠΏΠΎ Ρ€Π°ΡΠΏΠΈΡΠ°Π½ΠΈΡŽ |
98
+ | ⌨️ **Keybinding System** | 10 контСкстов, 50+ Ρ…ΠΎΡ‚ΠΊΠ΅Π΅Π², ΠΏΠΎΠ»Π½ΠΎΡΡ‚ΡŒΡŽ настраиваСмыС |
99
+ | 🩺 **Doctor Diagnostic** | АвтоматичСская диагностика окруТСния |
100
+ | πŸͺ **Hooks System** | Pre/post hooks для кастомизации повСдСния |
101
+ | πŸ“‘ **MCP Client** | Model Context Protocol для Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ возмоТностСй |
102
+ | πŸ“š **Skills System** | Markdown-Π½Π°Π²Ρ‹ΠΊΠΈ для Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ |
103
+ | 🧠 **Memory** | Basic + Enhanced ΠΏΠ°ΠΌΡΡ‚ΡŒ с TF-IDF индСксациСй |
104
+
105
+ ### πŸ› οΈ Π£Ρ‚ΠΈΠ»ΠΈΡ‚Ρ‹
106
+
107
+ - 🎬 **Asciicast Recording** β€” запись сСссий Π² Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π΅ asciicast v2
108
+ - 🎨 **ANSIβ†’SVG** β€” Ρ€Π΅Π½Π΄Π΄Π΅Ρ€ΠΈΠ½Π³ Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π»ΡŒΠ½ΠΎΠ³ΠΎ Π²Ρ‹Π²ΠΎΠ΄Π° Π² SVG
109
+ - πŸ”„ **Conversation Recovery** β€” ΡƒΠΌΠ½ΠΎΠ΅ восстановлСниС сСссий с Ρ€Π΅ΠΌΠΎΠ½Ρ‚ΠΎΠΌ
110
+ - πŸ”— **Deep Links** β€” ΠΏΡ€ΠΎΡ‚ΠΎΠΊΠΎΠ» `cliskill://` для ΠΈΠ½Ρ‚Π΅Π³Ρ€Π°Ρ†ΠΈΠΈ с ОБ
111
+ - 🧹 **Background Housekeeping** β€” автоматичСская очистка ΠΈ обслуТиваниС
112
+ - πŸ”€ **Tool Pool** β€” слияниС ΠΈ Ρ„ΠΈΠ»ΡŒΡ‚Ρ€Π°Ρ†ΠΈΡ Π½Π°Π±ΠΎΡ€ΠΎΠ² инструмСнтов
113
+ - πŸ’° **Cost Tracker** β€” отслСТиваниС расходов Π½Π° API
114
+ - πŸ“Š **Token Estimation** β€” ΠΎΡ†Π΅Π½ΠΊΠ° Ρ‚ΠΎΠΊΠ΅Π½ΠΎΠ² ΠΏΠ΅Ρ€Π΅Π΄ ΠΎΡ‚ΠΏΡ€Π°Π²ΠΊΠΎΠΉ
115
+ - πŸ“¦ **Context Compaction** β€” автоматичСскоС сТатиС контСкста
116
+
117
+ ---
118
+
119
+ ## πŸ“¦ Установка
120
+
121
+ ### Из исходников
122
+
123
+ ```bash
124
+ # ΠšΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ рСпозитория
125
+ git clone <repo-url> cliskill
126
+ cd cliskill
127
+
128
+ # Установка зависимостСй
129
+ npm install
130
+
131
+ # Π‘Π±ΠΎΡ€ΠΊΠ° ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°
132
+ npm run build
133
+
134
+ # Π“Π»ΠΎΠ±Π°Π»ΡŒΠ½Π°Ρ установка (ΠΎΠΏΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎ)
135
+ npm link
136
+ ```
137
+
138
+ ### ВрСбования
139
+
140
+ - **Node.js** >= 20.0.0
141
+ - **npm** >= 9.0.0
142
+
143
+ ---
144
+
145
+ ## πŸš€ ИспользованиС
146
+
147
+ ### ΠžΡΠ½ΠΎΠ²Π½Ρ‹Π΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹
148
+
149
+ ```bash
150
+ # 🎯 Π˜Π½Ρ‚Π΅Ρ€Π°ΠΊΡ‚ΠΈΠ²Π½Ρ‹ΠΉ REPL
151
+ cliskill
152
+
153
+ # πŸ’¬ ΠžΠ΄Π½ΠΎΡ€Π°Π·ΠΎΠ²Ρ‹ΠΉ запрос
154
+ cliskill --prompt "ΠΈΡΠΏΡ€Π°Π²ΡŒ тСсты"
155
+
156
+ # 🧠 Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ алиас ΠΌΠΎΠ΄Π΅Π»ΠΈ
157
+ cliskill --model smart
158
+ cliskill --model fast
159
+ cliskill --model balanced
160
+
161
+ # πŸ€– Auto mode
162
+ cliskill --auto # safe-auto (ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ)
163
+ cliskill --auto-mode full-auto # полная автономия
164
+ cliskill --auto-mode safe-auto # бСзопасная автономия
165
+ cliskill --auto-mode ask # с ΠΏΠΎΠ΄Ρ‚Π²Π΅Ρ€ΠΆΠ΄Π΅Π½ΠΈΠ΅ΠΌ
166
+
167
+ # ⚑ Fast mode
168
+ cliskill --fast
169
+
170
+ # πŸ”„ ВосстановлСниС сСссий
171
+ cliskill --resume # послСдняя сСссия
172
+ cliskill --resume abc12345 # конкрСтная сСссия
173
+
174
+ # 🎬 Π—Π°ΠΏΠΈΡΡŒ сСссии
175
+ cliskill --record
176
+ cliskill --record --record-output ./my-session.cast
177
+
178
+ # 🎨 Π’Ρ‹Π±ΠΎΡ€ Ρ‚Π΅ΠΌΡ‹
179
+ cliskill --theme dark
180
+ cliskill --theme light
181
+ cliskill --theme dark-daltonized
182
+ cliskill --theme light-daltonized
183
+ cliskill --theme dark-ansi
184
+ cliskill --theme light-ansi
185
+ cliskill --theme auto
186
+
187
+ # πŸ–₯️ React TUI (Ink)
188
+ cliskill --tui
189
+
190
+ # πŸ”— Π£Π΄Π°Π»Ρ‘Π½Π½Ρ‹ΠΉ сСрвСр
191
+ cliskill --remote user@host
192
+
193
+ # πŸ“Š Π’Π΅Ρ€Π±ΠΎΡƒΠ·Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ
194
+ cliskill --verbose
195
+ ```
196
+
197
+ ### ΠŸΠΎΠ΄ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹
198
+
199
+ ```bash
200
+ # 🩺 Диагностика окруТСния
201
+ cliskill doctor
202
+
203
+ # πŸ“‹ Бписок сСссий
204
+ cliskill sessions
205
+
206
+ # ⏰ Cron Π·Π°Π΄Π°Ρ‡ΠΈ
207
+ cliskill cron list # список Π·Π°Π΄Π°Ρ‡
208
+ cliskill cron add "0 9 * * 1-5" "Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ тСсты" # Π΄ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ Π·Π°Π΄Π°Ρ‡Ρƒ
209
+ cliskill cron add "@daily" "ΠΎΡ‚Ρ‡Ρ‘Ρ‚" --one-shot # одноразовая Π·Π°Π΄Π°Ρ‡Π°
210
+ cliskill cron remove <id> # ΡƒΠ΄Π°Π»ΠΈΡ‚ΡŒ Π·Π°Π΄Π°Ρ‡Ρƒ
211
+ cliskill cron run <id> # Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π²Ρ€ΡƒΡ‡Π½ΡƒΡŽ
212
+
213
+ # πŸ”— Deep Links
214
+ cliskill register-protocol # Π·Π°Ρ€Π΅Π³ΠΈΡΡ‚Ρ€ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ cliskill://
215
+ cliskill unregister-protocol # ΠΎΡ‚ΠΌΠ΅Π½ΠΈΡ‚ΡŒ Ρ€Π΅Π³ΠΈΡΡ‚Ρ€Π°Ρ†ΠΈΡŽ
216
+ cliskill open-uri "cliskill://prompt?text=hello" # ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ URI
217
+ ```
218
+
219
+ ### ВсС ΠΎΠΏΡ†ΠΈΠΈ CLI
220
+
221
+ | ΠžΠΏΡ†ΠΈΡ | ОписаниС |
222
+ |-------|----------|
223
+ | `-m, --model <model>` | МодСль или алиас (smart, fast, balanced) |
224
+ | `--base-url <url>` | URL API ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€Π° |
225
+ | `--api-key <key>` | API ΠΊΠ»ΡŽΡ‡ ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€Π° |
226
+ | `-p, --prompt <text>` | ΠžΠ΄Π½ΠΎΡ€Π°Π·ΠΎΠ²Ρ‹ΠΉ запрос |
227
+ | `--config <path>` | ΠŸΡƒΡ‚ΡŒ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ |
228
+ | `--tui` | React TUI (Ink) вмСсто Π±Π°Π·ΠΎΠ²ΠΎΠ³ΠΎ REPL |
229
+ | `--verbose` | ΠŸΠΎΠ΄Ρ€ΠΎΠ±Π½ΠΎΠ΅ Π»ΠΎΠ³ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ |
230
+ | `--auto` | Auto mode (safe-auto) |
231
+ | `--auto-mode <level>` | Auto mode с ΡƒΡ€ΠΎΠ²Π½Π΅ΠΌ (full-auto, safe-auto, ask) |
232
+ | `--fast` | Быстрый Ρ€Π΅ΠΆΠΈΠΌ |
233
+ | `--max-context <tokens>` | МаксимальноС число Ρ‚ΠΎΠΊΠ΅Π½ΠΎΠ² контСкста |
234
+ | `--remote <host>` | ΠŸΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ΠΊ ΡƒΠ΄Π°Π»Ρ‘Π½Π½ΠΎΠΌΡƒ сСрвСру (SSH) |
235
+ | `--theme <name>` | ЦвСтовая Ρ‚Π΅ΠΌΠ° |
236
+ | `--record` | Π—Π°ΠΏΠΈΡΡŒ сСссии (asciicast v2) |
237
+ | `--record-output <path>` | ΠŸΡƒΡ‚ΡŒ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ записи |
238
+ | `--resume [id]` | Π’ΠΎΡΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ сСссию |
239
+ | `-v, --version` | ВСрсия |
240
+ | `-h, --help` | Π‘ΠΏΡ€Π°Π²ΠΊΠ° |
241
+
242
+ ---
243
+
244
+ ## βš™οΈ ΠšΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡ
245
+
246
+ ### Π€Π°ΠΉΠ» ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ
247
+
248
+ Π‘ΠΎΠ·Π΄Π°ΠΉΡ‚Π΅ `.cliskillrc.json` Π² домашнСй Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΠΈ ΠΈΠ»ΠΈ Π² ΠΊΠΎΡ€Π½Π΅ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°:
249
+
250
+ ```json
251
+ {
252
+ "defaultProvider": "my-provider",
253
+ "providers": [
254
+ {
255
+ "name": "my-provider",
256
+ "baseUrl": "https://api.example.com/v1",
257
+ "model": "gpt-4o",
258
+ "format": "openai-compatible",
259
+ "timeout": 120000,
260
+ "maxTokens": 4096
261
+ }
262
+ ],
263
+ "permissionMode": "ask",
264
+ "verbose": false,
265
+ "maxContextTokens": 1000000,
266
+ "theme": {
267
+ "name": "dark"
268
+ },
269
+ "autoMode": {
270
+ "enabled": false,
271
+ "trustLevel": "safe-auto"
272
+ },
273
+ "fastMode": {
274
+ "enabled": false
275
+ },
276
+ "models": {
277
+ "aliases": [
278
+ { "alias": "smart", "model": "gpt-4o" },
279
+ { "alias": "fast", "model": "gpt-4o-mini" },
280
+ { "alias": "balanced", "model": "gpt-4o" },
281
+ { "alias": "reasoning", "model": "o1" },
282
+ { "alias": "code", "model": "gpt-4o" }
283
+ ],
284
+ "maxContextTokens": 1000000
285
+ }
286
+ }
287
+ ```
288
+
289
+ ### ΠŸΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Π΅ окруТСния
290
+
291
+ ```bash
292
+ export CLISKILL_API_KEY="b0157800fd274691a6ba19a29ca11885.Ar0TPbB9buuhh8wJ"
293
+ export CLISKILL_BASE_URL="https://api.z.ai/api/coding/paas/v4"
294
+ ```
295
+
296
+ ### Π€ΠΎΡ€ΠΌΠ°Ρ‚Ρ‹ ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€ΠΎΠ²
297
+
298
+ | Π€ΠΎΡ€ΠΌΠ°Ρ‚ | ОписаниС |
299
+ |--------|----------|
300
+ | `openai-compatible` | Π›ΡŽΠ±ΠΎΠΉ `/v1/chat/completions` endpoint |
301
+ | `messages-compatible` | Messages API Ρ„ΠΎΡ€ΠΌΠ°Ρ‚ (compat adapter) |
302
+ | `custom` | ΠšΠ°ΡΡ‚ΠΎΠΌΠ½Ρ‹ΠΉ Π°Π΄Π°ΠΏΡ‚Π΅Ρ€ (программная рСгистрация) |
303
+
304
+ ### Π Π΅ΠΆΠΈΠΌΡ‹ Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΠΉ
305
+
306
+ | РСТим | ОписаниС |
307
+ |-------|----------|
308
+ | `ask` | ΠŸΠΎΠ΄Ρ‚Π²Π΅Ρ€ΠΆΠ΄Π΅Π½ΠΈΠ΅ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΎΠΏΠ΅Ρ€Π°Ρ†ΠΈΠΈ (ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ) |
309
+ | `auto-accept` | Π Π°Π·Ρ€Π΅ΡˆΠΈΡ‚ΡŒ всС ΠΎΠΏΠ΅Ρ€Π°Ρ†ΠΈΠΈ Π±Π΅Π· подтвСрТдСния |
310
+ | `plan` | Волько ΠΎΠΏΠ΅Ρ€Π°Ρ†ΠΈΠΈ чтСния |
311
+
312
+ ### Навыки (Skills)
313
+
314
+ Π‘ΠΎΠ·Π΄Π°Π²Π°ΠΉΡ‚Π΅ Ρ„Π°ΠΉΠ»Ρ‹ Π½Π°Π²Ρ‹ΠΊΠΎΠ² Π² Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΠΈ `.cliskill/skills/`:
315
+
316
+ ```markdown
317
+ ---
318
+ name: my-skill
319
+ description: ОписаниС Π½Π°Π²Ρ‹ΠΊΠ°
320
+ ---
321
+
322
+ # Π˜Π½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΠΈ для Π½Π°Π²Ρ‹ΠΊΠ°
323
+
324
+ ВСкст инструкций Π² Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π΅ Markdown...
325
+ ```
326
+
327
+ ---
328
+
329
+ ## πŸ›οΈ АрхитСктура
330
+
331
+ ```
332
+ src/
333
+ β”œβ”€β”€ πŸ“‘ bootstrap/ β€” CLI entry point, парсинг Π°Ρ€Π³ΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ²
334
+ β”œβ”€β”€ βš™οΈ config/ β€” Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ° ΠΈ валидация ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ
335
+ β”œβ”€β”€ πŸ”Œ connect/ β€” Абстракция ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€ΠΎΠ² (API Π°Π΄Π°ΠΏΡ‚Π΅Ρ€Ρ‹)
336
+ β”œβ”€β”€ 🧠 core/ β€” Agent Loop, QueryEngine (ядро систСмы)
337
+ β”œβ”€β”€ πŸ”§ tools/ β€” БистСма инструмСнтов (15 инструмСнтов)
338
+ β”œβ”€β”€ πŸ› οΈ services/ β€” БСрвисы (auto-mode, cron, doctor, ΠΈ Ρ‚.Π΄.)
339
+ β”œβ”€β”€ πŸ›‘οΈ safety/ β€” Π Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΡ, Command Inspector
340
+ β”œβ”€β”€ 🧠 memory/ β€” Memory Store (basic + TF-IDF)
341
+ β”œβ”€β”€ 🎨 ui/ β€” Theme, Keybindings, Ink TUI
342
+ β”œβ”€β”€ πŸͺ hooks/ β€” Hooks system (pre/post)
343
+ β”œβ”€β”€ πŸ“‘ mcp/ β€” MCP Client (Model Context Protocol)
344
+ β”œβ”€β”€ 🐝 swarm/ β€” ΠœΡƒΠ»ΡŒΡ‚ΠΈ-агСнтная координация
345
+ β”œβ”€β”€ πŸ“‹ tasks/ β€” Π€ΠΎΠ½ΠΎΠ²Ρ‹Π΅ Π·Π°Π΄Π°Ρ‡ΠΈ
346
+ β”œβ”€β”€ πŸ”— remote/ β€” SSH сСссии
347
+ β”œβ”€β”€ 🧩 extensions/ β€” Π Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ
348
+ β”œβ”€β”€ πŸ—οΈ infra/ β€” Π˜Π½Ρ„Ρ€Π°ΡΡ‚Ρ€ΡƒΠΊΡ‚ΡƒΡ€Π½Ρ‹Π΅ ΠΌΠΎΠ΄ΡƒΠ»ΠΈ
349
+ └── πŸ”€ utils/ β€” ΠžΠ±Ρ‰ΠΈΠ΅ ΡƒΡ‚ΠΈΠ»ΠΈΡ‚Ρ‹
350
+ ```
351
+
352
+ ### Π”ΠΈΠ°Π³Ρ€Π°ΠΌΠΌΠ° взаимодСйствия
353
+
354
+ ```mermaid
355
+ graph TB
356
+ CLI[CLI Entry] --> Config[Config Loader]
357
+ CLI --> REPL[REPL / TUI]
358
+ REPL --> Core[Agent Loop]
359
+ Core --> Provider[Provider Adapter]
360
+ Core --> Tools[Tool System]
361
+ Core --> Memory[Memory Store]
362
+ Core --> Safety[Safety Layer]
363
+ Tools --> Bash[Bash Tool]
364
+ Tools --> Files[File Tools]
365
+ Tools --> Web[Web Tools]
366
+ Tools --> Agent[Agent Tool]
367
+ Tools --> LSP[LSP Tool]
368
+ Tools --> Remote[Remote Tool]
369
+ Core --> Hooks[Hooks System]
370
+ Core --> MCP[MCP Client]
371
+ Core --> Swarm[Swarm Coordinator]
372
+ Swarm --> Tasks[Task System]
373
+ ```
374
+
375
+ ---
376
+
377
+ ## πŸ‘¨β€πŸ’» Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ°
378
+
379
+ ### ΠšΠΎΠΌΠ°Π½Π΄Ρ‹
380
+
381
+ ```bash
382
+ npm install # Π£ΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ зависимости
383
+ npm run build # Π‘Π±ΠΎΡ€ΠΊΠ° ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° (tsup)
384
+ npm run dev # Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° с watch-Ρ€Π΅ΠΆΠΈΠΌΠΎΠΌ
385
+ npm test # Π—Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ тСсты (844 тСста, Vitest)
386
+ npm run test:watch # ВСсты Π² watch-Ρ€Π΅ΠΆΠΈΠΌΠ΅
387
+ npm run typecheck # ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Ρ‚ΠΈΠΏΠΎΠ² TypeScript
388
+ npm run lint # Π›ΠΈΠ½Ρ‚ΠΈΠ½Π³ (= typecheck)
389
+ npm run start # Запуск собранного CLI
390
+ ```
391
+
392
+ ### Π‘Ρ‚Ρ€ΡƒΠΊΡ‚ΡƒΡ€Π° тСстов
393
+
394
+ ΠšΠ°ΠΆΠ΄Ρ‹ΠΉ ΠΌΠΎΠ΄ΡƒΠ»ΡŒ сопровоТдаСтся тСстами:
395
+
396
+ ```
397
+ src/
398
+ β”œβ”€β”€ services/
399
+ β”‚ β”œβ”€β”€ cron/
400
+ β”‚ β”‚ β”œβ”€β”€ parser.ts # ΠŸΠ°Ρ€ΡΠ΅Ρ€ cron-Π²Ρ‹Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ
401
+ β”‚ β”‚ β”œβ”€β”€ parser.test.ts # ВСсты парсСра
402
+ β”‚ β”‚ β”œβ”€β”€ scheduler.ts # ΠŸΠ»Π°Π½ΠΈΡ€ΠΎΠ²Ρ‰ΠΈΠΊ
403
+ β”‚ β”‚ β”œβ”€β”€ scheduler.test.ts # ВСсты ΠΏΠ»Π°Π½ΠΈΡ€ΠΎΠ²Ρ‰ΠΈΠΊΠ°
404
+ β”‚ β”‚ β”œβ”€β”€ task-store.ts # Π₯Ρ€Π°Π½ΠΈΠ»ΠΈΡ‰Π΅ Π·Π°Π΄Π°Ρ‡
405
+ β”‚ β”‚ └── task-store.test.ts # ВСсты Ρ…Ρ€Π°Π½ΠΈΠ»ΠΈΡ‰Π°
406
+ β”‚ β”œβ”€β”€ doctor.ts / .test.ts
407
+ β”‚ β”œβ”€β”€ asciicast.ts / .test.ts
408
+ β”‚ β”œβ”€β”€ housekeeping.ts / .test.ts
409
+ β”‚ └── tool-pool.ts / .test.ts
410
+ β”œβ”€β”€ ui/
411
+ β”‚ β”œβ”€β”€ theme.ts / .test.ts
412
+ β”‚ └── keybindings/
413
+ β”‚ β”œβ”€β”€ parser.ts / .test.ts
414
+ β”‚ β”œβ”€β”€ resolver.ts / .test.ts
415
+ β”‚ └── schema.ts / .test.ts
416
+ β”œβ”€β”€ tools/builtins/
417
+ β”‚ β”œβ”€β”€ worktree-tool.ts / .test.ts
418
+ β”‚ β”œβ”€β”€ todo-write-tool.ts / .test.ts
419
+ β”‚ β”œβ”€β”€ web-fetch-tool.ts / .test.ts
420
+ β”‚ └── web-search-tool.ts / .test.ts
421
+ └── utils/
422
+ β”œβ”€β”€ ansi-render.ts / .test.ts
423
+ └── bash-parser.ts / .test.ts
424
+ ```
425
+
426
+ ---
427
+
428
+ ## πŸ§ͺ Π’Π΅Ρ…Π½ΠΎΠ»ΠΎΠ³ΠΈΠΈ
429
+
430
+ ### Основной стСк
431
+
432
+ | ВСхнология | НазначСниС |
433
+ |------------|------------|
434
+ | **Node.js** LTS | Π‘Ρ€Π΅Π΄Π° выполнСния |
435
+ | **TypeScript** (strict) | Π’ΠΈΠΏΠΎΠ±Π΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡ‚ΡŒ |
436
+ | **ESM** | ΠœΠΎΠ΄ΡƒΠ»ΡŒΠ½Π°Ρ систСма |
437
+
438
+ ### Зависимости
439
+
440
+ | Π‘ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° | НазначСниС |
441
+ |------------|------------|
442
+ | [Commander.js](https://github.com/tj/commander.js) | ΠŸΠ°Ρ€ΡΠΈΠ½Π³ CLI Π°Ρ€Π³ΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ² |
443
+ | [Zod](https://zod.dev) | Валидация схСм Π΄Π°Π½Π½Ρ‹Ρ… |
444
+ | [Chalk](https://github.com/chalk/chalk) | Π¦Π²Π΅Ρ‚Π½ΠΎΠΉ Π²Ρ‹Π²ΠΎΠ΄ Π² Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π» |
445
+ | [Ink](https://github.com/vadimdemedes/ink) / [React](https://react.dev) | Terminal UI |
446
+ | [Ora](https://github.com/sindresorhus/ora) | Π‘ΠΏΠΈΠ½Π½Π΅Ρ€Ρ‹ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠΈ |
447
+ | [ssh2](https://github.com/mscdex/ssh2) | SSH ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΡ |
448
+ | [dotenv](https://github.com/motdotla/dotenv) | ΠŸΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Π΅ окруТСния |
449
+
450
+ ### Dev-зависимости
451
+
452
+ | Π‘ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° | НазначСниС |
453
+ |------------|------------|
454
+ | [tsup](https://tsup.egoist.dev) | Π‘Π±ΠΎΡ€ΠΊΠ° (esbuild-based) |
455
+ | [Vitest](https://vitest.dev) | ВСстированиС (844 тСста) |
456
+ | [TypeScript](https://www.typescriptlang.org) | ΠšΠΎΠΌΠΏΠΈΠ»ΡΡ‚ΠΎΡ€ ΠΈ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Ρ‚ΠΈΠΏΠΎΠ² |
457
+
458
+ ---
459
+
460
+ ## πŸ“„ ЛицСнзия
461
+
462
+ Π­Ρ‚ΠΎΡ‚ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ распространяСтся ΠΏΠΎΠ΄ Π»ΠΈΡ†Π΅Π½Π·ΠΈΠ΅ΠΉ **MIT**. ΠŸΠΎΠ΄Ρ€ΠΎΠ±Π½Π΅Π΅ см. [LICENSE](LICENSE).
463
+
464
+ ---
465
+
466
+ <div align="center">
467
+
468
+ **cliskill** β€” свободный AI-ассистСнт для Ρ‚Π΅Ρ…, ΠΊΡ‚ΠΎ Ρ†Π΅Π½ΠΈΡ‚ Π½Π΅Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡ‚ΡŒ.
469
+
470
+ </div>
@@ -0,0 +1,21 @@
1
+ interface CliOptions {
2
+ model?: string;
3
+ baseUrl?: string;
4
+ apiKey?: string;
5
+ prompt?: string;
6
+ config?: string;
7
+ tui?: boolean;
8
+ verbose?: boolean;
9
+ auto?: boolean;
10
+ autoMode?: string;
11
+ fast?: boolean;
12
+ maxContext?: number;
13
+ remote?: string;
14
+ theme?: string;
15
+ record?: boolean;
16
+ recordOutput?: string;
17
+ resume?: string | boolean;
18
+ }
19
+ declare function runCli(): Promise<void>;
20
+
21
+ export { type CliOptions, runCli };
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runCli
4
+ } from "../chunk-ULZHJVWD.js";
5
+ import "../chunk-AJENHWD3.js";
6
+ export {
7
+ runCli
8
+ };
9
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,103 @@
1
+ // src/config/paths.ts
2
+ import { join } from "path";
3
+ import { homedir } from "os";
4
+ import { existsSync, mkdirSync, renameSync, readFileSync } from "fs";
5
+ var DATA_DIR_NAME = ".cliskill";
6
+ var CONFIG_FILENAME = "config.json";
7
+ var LEGACY_CONFIG_FILENAME = ".cliskillrc.json";
8
+ function getDataDir() {
9
+ return join(homedir(), DATA_DIR_NAME);
10
+ }
11
+ function ensureDataDir() {
12
+ const dir = getDataDir();
13
+ if (!existsSync(dir)) {
14
+ mkdirSync(dir, { recursive: true });
15
+ }
16
+ return dir;
17
+ }
18
+ function getConfigPath() {
19
+ return join(getDataDir(), CONFIG_FILENAME);
20
+ }
21
+ function getLegacyConfigPath() {
22
+ return join(homedir(), LEGACY_CONFIG_FILENAME);
23
+ }
24
+ function getSessionsDir() {
25
+ return join(getDataDir(), "sessions");
26
+ }
27
+ function getGlobalSkillsDir() {
28
+ return join(getDataDir(), "skills");
29
+ }
30
+ function getHistoryPath() {
31
+ return join(getDataDir(), "history.jsonl");
32
+ }
33
+ function getScheduledTasksPath() {
34
+ return join(getDataDir(), "scheduled_tasks.json");
35
+ }
36
+ function getKeybindingsPath() {
37
+ return join(getDataDir(), "keybindings.json");
38
+ }
39
+ function getPlistPath() {
40
+ return join(getDataDir(), "Info.plist");
41
+ }
42
+ function getTmpDir() {
43
+ return join(getDataDir(), "tmp");
44
+ }
45
+ function getGlobalMemoryDir() {
46
+ return join(getDataDir(), "memory");
47
+ }
48
+ function getHistoryDir() {
49
+ return join(getDataDir(), "history");
50
+ }
51
+ function getDiskHistoryPath() {
52
+ return join(getDataDir(), "history.json");
53
+ }
54
+ function migrateLegacyConfig() {
55
+ const legacyPath = getLegacyConfigPath();
56
+ const newPath = getConfigPath();
57
+ if (!existsSync(legacyPath)) return false;
58
+ if (existsSync(newPath)) return false;
59
+ try {
60
+ const content = readFileSync(legacyPath, "utf-8");
61
+ JSON.parse(content);
62
+ ensureDataDir();
63
+ renameSync(legacyPath, newPath);
64
+ return true;
65
+ } catch {
66
+ return false;
67
+ }
68
+ }
69
+ function resolveConfigPath() {
70
+ const newPath = getConfigPath();
71
+ if (existsSync(newPath)) return newPath;
72
+ const legacyPath = getLegacyConfigPath();
73
+ if (existsSync(legacyPath)) return legacyPath;
74
+ return newPath;
75
+ }
76
+ function getConfigSearchPaths() {
77
+ return [
78
+ getConfigPath(),
79
+ getLegacyConfigPath(),
80
+ join(process.cwd(), ".cliskillrc.json")
81
+ ];
82
+ }
83
+
84
+ export {
85
+ getDataDir,
86
+ ensureDataDir,
87
+ getConfigPath,
88
+ getLegacyConfigPath,
89
+ getSessionsDir,
90
+ getGlobalSkillsDir,
91
+ getHistoryPath,
92
+ getScheduledTasksPath,
93
+ getKeybindingsPath,
94
+ getPlistPath,
95
+ getTmpDir,
96
+ getGlobalMemoryDir,
97
+ getHistoryDir,
98
+ getDiskHistoryPath,
99
+ migrateLegacyConfig,
100
+ resolveConfigPath,
101
+ getConfigSearchPaths
102
+ };
103
+ //# sourceMappingURL=chunk-AJENHWD3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/paths.ts"],"sourcesContent":["import { join } from 'node:path'\r\nimport { homedir } from 'node:os'\r\nimport { existsSync, mkdirSync, renameSync, readFileSync, writeFileSync } from 'node:fs'\r\n\r\n/**\r\n * Centralized path management for all cliskill data.\r\n *\r\n * All user data is stored under ~/.cliskill/:\r\n * config.json β€” main configuration\r\n * sessions/ β€” conversation session history\r\n * skills/ β€” global user skills\r\n * history.jsonl β€” command history\r\n * scheduled_tasks.json β€” cron/scheduled tasks\r\n * keybindings.json β€” custom keybindings\r\n * Info.plist β€” macOS URL scheme registration\r\n * tmp/ β€” temporary files\r\n * memory/ β€” global memory store\r\n */\r\n\r\nconst DATA_DIR_NAME = '.cliskill'\r\nconst CONFIG_FILENAME = 'config.json'\r\nconst LEGACY_CONFIG_FILENAME = '.cliskillrc.json'\r\n\r\n/** Get the base data directory: ~/.cliskill */\r\nexport function getDataDir(): string {\r\n return join(homedir(), DATA_DIR_NAME)\r\n}\r\n\r\n/** Ensure the data directory exists and return its path */\r\nexport function ensureDataDir(): string {\r\n const dir = getDataDir()\r\n if (!existsSync(dir)) {\r\n mkdirSync(dir, { recursive: true })\r\n }\r\n return dir\r\n}\r\n\r\n/** Path to the main config file: ~/.cliskill/config.json */\r\nexport function getConfigPath(): string {\r\n return join(getDataDir(), CONFIG_FILENAME)\r\n}\r\n\r\n/** Path to the legacy config file: ~/.cliskillrc.json */\r\nexport function getLegacyConfigPath(): string {\r\n return join(homedir(), LEGACY_CONFIG_FILENAME)\r\n}\r\n\r\n/** Path to sessions directory: ~/.cliskill/sessions/ */\r\nexport function getSessionsDir(): string {\r\n return join(getDataDir(), 'sessions')\r\n}\r\n\r\n/** Path to global skills directory: ~/.cliskill/skills/ */\r\nexport function getGlobalSkillsDir(): string {\r\n return join(getDataDir(), 'skills')\r\n}\r\n\r\n/** Path to command history: ~/.cliskill/history.jsonl */\r\nexport function getHistoryPath(): string {\r\n return join(getDataDir(), 'history.jsonl')\r\n}\r\n\r\n/** Path to scheduled tasks: ~/.cliskill/scheduled_tasks.json */\r\nexport function getScheduledTasksPath(): string {\r\n return join(getDataDir(), 'scheduled_tasks.json')\r\n}\r\n\r\n/** Path to custom keybindings: ~/.cliskill/keybindings.json */\r\nexport function getKeybindingsPath(): string {\r\n return join(getDataDir(), 'keybindings.json')\r\n}\r\n\r\n/** Path to macOS URL scheme plist: ~/.cliskill/Info.plist */\r\nexport function getPlistPath(): string {\r\n return join(getDataDir(), 'Info.plist')\r\n}\r\n\r\n/** Path to temp directory: ~/.cliskill/tmp/ */\r\nexport function getTmpDir(): string {\r\n return join(getDataDir(), 'tmp')\r\n}\r\n\r\n/** Path to global memory directory: ~/.cliskill/memory/ */\r\nexport function getGlobalMemoryDir(): string {\r\n return join(getDataDir(), 'memory')\r\n}\r\n\r\n/** Path to history subdirectory: ~/.cliskill/history/ */\r\nexport function getHistoryDir(): string {\r\n return join(getDataDir(), 'history')\r\n}\r\n\r\n/** Path to disk space check file: ~/.cliskill/history.json */\r\nexport function getDiskHistoryPath(): string {\r\n return join(getDataDir(), 'history.json')\r\n}\r\n\r\n/**\r\n * Migrate legacy config (~/.cliskillrc.json) to new location (~/.cliskill/config.json).\r\n * Returns true if migration was performed.\r\n */\r\nexport function migrateLegacyConfig(): boolean {\r\n const legacyPath = getLegacyConfigPath()\r\n const newPath = getConfigPath()\r\n\r\n if (!existsSync(legacyPath)) return false\r\n if (existsSync(newPath)) return false\r\n\r\n try {\r\n // Validate the legacy config is valid JSON before migrating\r\n const content = readFileSync(legacyPath, 'utf-8')\r\n JSON.parse(content)\r\n\r\n ensureDataDir()\r\n renameSync(legacyPath, newPath)\r\n return true\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\n/**\r\n * Get config path, checking both new and legacy locations.\r\n * Returns the path that exists, preferring the new location.\r\n */\r\nexport function resolveConfigPath(): string {\r\n const newPath = getConfigPath()\r\n if (existsSync(newPath)) return newPath\r\n\r\n const legacyPath = getLegacyConfigPath()\r\n if (existsSync(legacyPath)) return legacyPath\r\n\r\n return newPath\r\n}\r\n\r\n/**\r\n * Get all config search paths in priority order.\r\n * Used by doctor and loader to find config files.\r\n */\r\nexport function getConfigSearchPaths(): string[] {\r\n return [\r\n getConfigPath(),\r\n getLegacyConfigPath(),\r\n join(process.cwd(), '.cliskillrc.json'),\r\n ]\r\n}\r\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,YAAY,WAAW,YAAY,oBAAmC;AAiB/E,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,yBAAyB;AAGxB,SAAS,aAAqB;AACnC,SAAO,KAAK,QAAQ,GAAG,aAAa;AACtC;AAGO,SAAS,gBAAwB;AACtC,QAAM,MAAM,WAAW;AACvB,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,cAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACpC;AACA,SAAO;AACT;AAGO,SAAS,gBAAwB;AACtC,SAAO,KAAK,WAAW,GAAG,eAAe;AAC3C;AAGO,SAAS,sBAA8B;AAC5C,SAAO,KAAK,QAAQ,GAAG,sBAAsB;AAC/C;AAGO,SAAS,iBAAyB;AACvC,SAAO,KAAK,WAAW,GAAG,UAAU;AACtC;AAGO,SAAS,qBAA6B;AAC3C,SAAO,KAAK,WAAW,GAAG,QAAQ;AACpC;AAGO,SAAS,iBAAyB;AACvC,SAAO,KAAK,WAAW,GAAG,eAAe;AAC3C;AAGO,SAAS,wBAAgC;AAC9C,SAAO,KAAK,WAAW,GAAG,sBAAsB;AAClD;AAGO,SAAS,qBAA6B;AAC3C,SAAO,KAAK,WAAW,GAAG,kBAAkB;AAC9C;AAGO,SAAS,eAAuB;AACrC,SAAO,KAAK,WAAW,GAAG,YAAY;AACxC;AAGO,SAAS,YAAoB;AAClC,SAAO,KAAK,WAAW,GAAG,KAAK;AACjC;AAGO,SAAS,qBAA6B;AAC3C,SAAO,KAAK,WAAW,GAAG,QAAQ;AACpC;AAGO,SAAS,gBAAwB;AACtC,SAAO,KAAK,WAAW,GAAG,SAAS;AACrC;AAGO,SAAS,qBAA6B;AAC3C,SAAO,KAAK,WAAW,GAAG,cAAc;AAC1C;AAMO,SAAS,sBAA+B;AAC7C,QAAM,aAAa,oBAAoB;AACvC,QAAM,UAAU,cAAc;AAE9B,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO;AACpC,MAAI,WAAW,OAAO,EAAG,QAAO;AAEhC,MAAI;AAEF,UAAM,UAAU,aAAa,YAAY,OAAO;AAChD,SAAK,MAAM,OAAO;AAElB,kBAAc;AACd,eAAW,YAAY,OAAO;AAC9B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,oBAA4B;AAC1C,QAAM,UAAU,cAAc;AAC9B,MAAI,WAAW,OAAO,EAAG,QAAO;AAEhC,QAAM,aAAa,oBAAoB;AACvC,MAAI,WAAW,UAAU,EAAG,QAAO;AAEnC,SAAO;AACT;AAMO,SAAS,uBAAiC;AAC/C,SAAO;AAAA,IACL,cAAc;AAAA,IACd,oBAAoB;AAAA,IACpB,KAAK,QAAQ,IAAI,GAAG,kBAAkB;AAAA,EACxC;AACF;","names":[]}