kfctl 0.1.4 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -233
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="assets/logo.png" width="200" alt="KFC Logo">
|
|
4
4
|
|
|
5
|
-
A beautiful CLI tool for following Kubernetes deployment logs with rich syntax highlighting and interactive
|
|
5
|
+
A beautiful CLI tool for following Kubernetes deployment logs with rich syntax highlighting and interactive filtering.
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|

|
|
@@ -12,12 +12,11 @@ A beautiful CLI tool for following Kubernetes deployment logs with rich syntax h
|
|
|
12
12
|
|
|
13
13
|
## ✨ Features
|
|
14
14
|
|
|
15
|
-
- 🎨 **Rich Syntax Highlighting** -
|
|
15
|
+
- 🎨 **Rich Syntax Highlighting** - Colorized log levels, JSON, timestamps, URLs, IPs
|
|
16
16
|
- 🔄 **Auto-Reconnect** - Automatically reconnects when connection is lost
|
|
17
|
-
- 🎯 **Interactive Selection** - Beautiful
|
|
17
|
+
- 🎯 **Interactive Selection** - Beautiful deployment selector when no deployment specified
|
|
18
|
+
- ⌨️ **Interactive Filtering** - Real-time log filtering with keyboard shortcuts
|
|
18
19
|
- 📊 **Real-time Status** - Live connection status indicator
|
|
19
|
-
- 🚀 **Fast & Lightweight** - Built with TypeScript for performance
|
|
20
|
-
- 🎭 **React for CLI** - Powered by Ink (React for terminal)
|
|
21
20
|
- 🌍 **Cross-platform** - Works on Windows, macOS, and Linux
|
|
22
21
|
- 📦 **Zero Config** - Works out of the box with kubectl
|
|
23
22
|
|
|
@@ -29,25 +28,12 @@ A beautiful CLI tool for following Kubernetes deployment logs with rich syntax h
|
|
|
29
28
|
|
|
30
29
|
```bash
|
|
31
30
|
npx kfctl -n production my-deployment
|
|
32
|
-
# or
|
|
33
|
-
pnpx kfctl -n production my-deployment
|
|
34
31
|
```
|
|
35
32
|
|
|
36
33
|
### Global Installation
|
|
37
34
|
|
|
38
35
|
```bash
|
|
39
|
-
|
|
40
|
-
kfctl --help
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### From Source
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
git clone <repository_url>
|
|
47
|
-
cd kfc
|
|
48
|
-
pnpm install
|
|
49
|
-
pnpm run build
|
|
50
|
-
pnpm link --global
|
|
36
|
+
npm install -g @logan/kfc
|
|
51
37
|
kfctl --help
|
|
52
38
|
```
|
|
53
39
|
|
|
@@ -67,256 +53,64 @@ kfctl -n production my-deployment
|
|
|
67
53
|
# Specify context and namespace
|
|
68
54
|
kfctl -c staging-cluster -n production my-deployment
|
|
69
55
|
|
|
70
|
-
#
|
|
71
|
-
kfctl
|
|
56
|
+
# Filter logs with grep
|
|
57
|
+
kfctl -n production -g "ERROR" my-deployment
|
|
72
58
|
|
|
73
|
-
#
|
|
74
|
-
kfctl
|
|
59
|
+
# Show context lines around matches
|
|
60
|
+
kfctl -n production -g "ERROR" -C 3 my-deployment
|
|
75
61
|
```
|
|
76
62
|
|
|
77
|
-
### Interactive
|
|
63
|
+
### Interactive Selector
|
|
78
64
|
|
|
79
65
|
```bash
|
|
80
66
|
# Without deployment name, shows interactive selector
|
|
81
67
|
kfctl -n production
|
|
82
|
-
|
|
83
|
-
# Output:
|
|
84
|
-
# Select deployment:
|
|
85
|
-
# ❯ app-deployment
|
|
86
|
-
# api-deployment
|
|
87
|
-
# worker-deployment
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## 🎨 Syntax Highlighting
|
|
93
|
-
|
|
94
|
-
KFC provides rich syntax highlighting for various log formats:
|
|
95
|
-
|
|
96
|
-
### Log Levels
|
|
97
|
-
|
|
98
|
-
- 🔴 **ERROR/FATAL** - Red bold
|
|
99
|
-
- 🟡 **WARN/WARNING** - Yellow
|
|
100
|
-
- 🟢 **INFO** - Green
|
|
101
|
-
- 🔵 **DEBUG** - Cyan
|
|
102
|
-
- ⚪ **TRACE** - White
|
|
103
|
-
|
|
104
|
-
### Syntax Elements
|
|
105
|
-
|
|
106
|
-
- 🔵 **Timestamps** - Blue (ISO 8601)
|
|
107
|
-
- 🟢 **Strings** - Green (`"..."`)
|
|
108
|
-
- 🟣 **Numbers** - Magenta (`123`, `3.14`)
|
|
109
|
-
- 🟡 **Booleans** - Yellow (`true`, `false`)
|
|
110
|
-
- ⚫ **Null** - Gray (`null`)
|
|
111
|
-
- 🔵 **URLs** - Blue underlined
|
|
112
|
-
- 🟣 **IP Addresses** - Magenta
|
|
113
|
-
- 🔵 **File Paths** - Cyan
|
|
114
|
-
|
|
115
|
-
### JSON Support
|
|
116
|
-
|
|
117
|
-
```json
|
|
118
|
-
{
|
|
119
|
-
"timestamp": "2026-01-29T13:00:00Z", // Cyan key, Green value
|
|
120
|
-
"level": "INFO", // Cyan key, Green value
|
|
121
|
-
"user_id": 12345, // Cyan key, Magenta number
|
|
122
|
-
"success": true, // Cyan key, Yellow boolean
|
|
123
|
-
"error": null // Cyan key, Gray null
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## ⚙️ Configuration
|
|
130
|
-
|
|
131
|
-
### Environment Variables
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
export KFCTL_NAMESPACE=production # Default namespace
|
|
135
|
-
export KFCTL_TAIL_LINES=200 # Default tail lines
|
|
136
|
-
export KFCTL_MAX_RETRY=5 # Default max retry attempts
|
|
137
68
|
```
|
|
138
69
|
|
|
139
70
|
### Command Line Options
|
|
140
71
|
|
|
141
72
|
```bash
|
|
142
|
-
kfctl --help
|
|
143
|
-
|
|
144
73
|
Options:
|
|
145
|
-
--namespace, -n
|
|
146
|
-
--context, -c
|
|
147
|
-
--tail
|
|
148
|
-
--max-retry
|
|
149
|
-
--grep, -g
|
|
150
|
-
--after, -A
|
|
151
|
-
--before, -B
|
|
152
|
-
--context, -C
|
|
153
|
-
--ignore-case, -i Case-insensitive
|
|
154
|
-
--invert, -v
|
|
155
|
-
--
|
|
156
|
-
--help, -h Show help
|
|
74
|
+
--namespace, -n Kubernetes namespace (default: default)
|
|
75
|
+
--context, -c Kubernetes context
|
|
76
|
+
--tail Number of lines to show (default: 100)
|
|
77
|
+
--max-retry Maximum retry attempts (default: 10)
|
|
78
|
+
--grep, -g Filter logs by pattern (regex supported)
|
|
79
|
+
--after, -A Show N lines after match
|
|
80
|
+
--before, -B Show N lines before match
|
|
81
|
+
--context, -C Show N lines before and after match
|
|
82
|
+
--ignore-case, -i Case-insensitive matching
|
|
83
|
+
--invert, -v Invert match (show non-matching lines)
|
|
84
|
+
--help, -h Show help
|
|
157
85
|
```
|
|
158
86
|
|
|
159
87
|
---
|
|
160
88
|
|
|
161
|
-
## 🛠️ Development
|
|
162
|
-
|
|
163
|
-
### Project Structure
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
kfc/
|
|
167
|
-
├── src/
|
|
168
|
-
│ ├── cli.tsx # CLI entry point
|
|
169
|
-
│ ├── components/
|
|
170
|
-
│ │ ├── App.tsx # Main app component
|
|
171
|
-
│ │ └── LogViewer.tsx # Log viewer component
|
|
172
|
-
│ ├── k8s/
|
|
173
|
-
│ │ └── client.ts # Kubernetes client
|
|
174
|
-
│ └── utils/
|
|
175
|
-
│ └── colorize.ts # Colorization utilities
|
|
176
|
-
├── dist/ # Compiled output
|
|
177
|
-
├── bin/kfctl # CLI executable
|
|
178
|
-
├── package.json
|
|
179
|
-
└── tsconfig.json
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Development Commands
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
# Install dependencies
|
|
186
|
-
pnpm install
|
|
187
|
-
|
|
188
|
-
# Development mode (with tsx)
|
|
189
|
-
pnpm run dev -- -n production my-deployment
|
|
190
|
-
|
|
191
|
-
# Build
|
|
192
|
-
pnpm run build
|
|
193
|
-
|
|
194
|
-
# Run built version
|
|
195
|
-
pnpm start -- --help
|
|
196
|
-
|
|
197
|
-
# Test
|
|
198
|
-
pnpm test
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Tech Stack
|
|
202
|
-
|
|
203
|
-
- **TypeScript** - Type-safe JavaScript
|
|
204
|
-
- **Ink** - React for CLI
|
|
205
|
-
- **@kubernetes/client-node** - Official Kubernetes Node.js client
|
|
206
|
-
- **chalk** - Terminal colors
|
|
207
|
-
- **meow** - CLI argument parsing
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## 📦 Dependencies
|
|
212
|
-
|
|
213
|
-
### Required
|
|
214
|
-
|
|
215
|
-
- ✅ **kubectl** - Kubernetes command-line tool
|
|
216
|
-
- ✅ **Node.js** - v14 or higher
|
|
217
|
-
|
|
218
|
-
### Not Required
|
|
219
|
-
|
|
220
|
-
- ❌ kubecolor (built-in syntax highlighting)
|
|
221
|
-
- ❌ fzf (built-in Ink selector)
|
|
222
|
-
- ❌ Go toolchain
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 🎯 Why TypeScript + Ink?
|
|
227
|
-
|
|
228
|
-
### Advantages
|
|
229
|
-
|
|
230
|
-
- ✅ **Type Safety** - Full TypeScript type checking
|
|
231
|
-
- ✅ **React for CLI** - Build CLI with React components
|
|
232
|
-
- ✅ **Rich UI** - Built-in Spinner, SelectInput, and more
|
|
233
|
-
- ✅ **Easy Maintenance** - Familiar React development patterns
|
|
234
|
-
- ✅ **npx Friendly** - Run directly with `npx kfctl`
|
|
235
|
-
- ✅ **No Compilation Dependencies** - No need for Go toolchain
|
|
236
|
-
|
|
237
|
-
### Comparison with Other Approaches
|
|
238
|
-
|
|
239
|
-
| Feature | zsh Script | Go CLI | TypeScript + Ink |
|
|
240
|
-
| -------------- | ----------------------- | ------------- | ---------------- |
|
|
241
|
-
| Language | Shell | Go | TypeScript |
|
|
242
|
-
| UI Framework | None | None | Ink (React) |
|
|
243
|
-
| Type Safety | ❌ | ✅ | ✅ |
|
|
244
|
-
| Cross-platform | ❌ | ✅ | ✅ |
|
|
245
|
-
| npx Support | ❌ | Needs wrapper | ✅ Native |
|
|
246
|
-
| Development | Simple | Traditional | React Components |
|
|
247
|
-
| Dependencies | kubectl, kubecolor, fzf | kubectl | kubectl, Node.js |
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
89
|
## 🐛 Troubleshooting
|
|
252
90
|
|
|
253
91
|
### Deployment Not Found
|
|
254
|
-
|
|
255
92
|
```bash
|
|
256
|
-
# Check
|
|
93
|
+
# Check namespace
|
|
257
94
|
kubectl get deployments -n <namespace>
|
|
258
|
-
|
|
259
|
-
# Use correct namespace
|
|
260
|
-
kfctl -n <namespace>
|
|
95
|
+
kfctl -n <namespace> <deployment>
|
|
261
96
|
```
|
|
262
97
|
|
|
263
98
|
### Cannot Connect to Kubernetes
|
|
264
|
-
|
|
265
99
|
```bash
|
|
266
|
-
#
|
|
100
|
+
# Verify kubectl configuration
|
|
267
101
|
kubectl config current-context
|
|
268
102
|
kubectl get pods
|
|
269
103
|
|
|
270
|
-
# Specify context
|
|
271
|
-
kfctl -c <context> -n <namespace>
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Node.js Version Too Old
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
# Check Node.js version
|
|
278
|
-
node --version
|
|
279
|
-
|
|
280
|
-
# Requires v14 or higher
|
|
281
|
-
# Use nvm to upgrade
|
|
282
|
-
nvm install 18
|
|
283
|
-
nvm use 18
|
|
104
|
+
# Specify context explicitly
|
|
105
|
+
kfctl -c <context> -n <namespace> <deployment>
|
|
284
106
|
```
|
|
285
107
|
|
|
286
108
|
---
|
|
287
109
|
|
|
288
|
-
## 📚 Documentation
|
|
289
|
-
|
|
290
|
-
- [README_TS.md](README_TS.md) - Detailed TypeScript version documentation
|
|
291
|
-
- [COLOR_OUTPUT.md](COLOR_OUTPUT.md) - Color output features
|
|
292
|
-
- [KUBERNETES_SETUP.md](KUBERNETES_SETUP.md) - Kubernetes environment setup
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
110
|
## 📝 License
|
|
297
111
|
|
|
298
112
|
MIT
|
|
299
113
|
|
|
300
114
|
---
|
|
301
115
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
- [Ink](https://github.com/vadimdemedes/ink) - React for CLI
|
|
305
|
-
- [kubectl](https://kubernetes.io/docs/reference/kubectl/) - Kubernetes CLI
|
|
306
|
-
- [@kubernetes/client-node](https://github.com/kubernetes-client/javascript) - Kubernetes Node.js client
|
|
307
|
-
- [chalk](https://github.com/chalk/chalk) - Terminal colors
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## 🎊 Get Started
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
# Try it now!
|
|
315
|
-
npx kfctl -n kube-system coredns
|
|
316
|
-
|
|
317
|
-
# Or install globally
|
|
318
|
-
pnpm install -g @logan/kfc
|
|
319
|
-
kfctl --help
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
**Enjoy beautiful Kubernetes logs!** 🚀✨
|
|
116
|
+
**Enjoy beautiful Kubernetes logs!** 🚀
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kfctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Kubernetes Follow Colorful - Follow Kubernetes deployment logs with style",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
],
|
|
28
28
|
"author": "iml88503",
|
|
29
29
|
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/iml885203/kfc.git"
|
|
33
|
+
},
|
|
30
34
|
"files": [
|
|
31
35
|
"dist/",
|
|
32
36
|
"README.md"
|