kfctl 0.1.4 → 0.1.8

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 (2) hide show
  1. package/README.md +50 -223
  2. 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 UI, built with **TypeScript + Ink**.
5
+ A beautiful CLI tool for following Kubernetes deployment logs with rich syntax highlighting and interactive filtering.
6
6
 
7
7
  ![Version](https://img.shields.io/badge/version-0.1.3-blue)
8
8
  ![License](https://img.shields.io/badge/license-MIT-green)
@@ -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** - JSON, strings, numbers, booleans, URLs, IPs, and more
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 Ink-powered deployment selector
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
- pnpm install -g @logan/kfc
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,97 @@ kfctl -n production my-deployment
67
53
  # Specify context and namespace
68
54
  kfctl -c staging-cluster -n production my-deployment
69
55
 
70
- # Custom tail lines
71
- kfctl --tail 200 my-deployment
56
+ # Filter logs with grep
57
+ kfctl -n production -g "ERROR" my-deployment
72
58
 
73
- # Custom retry attempts
74
- kfctl --max-retry 5 my-deployment
59
+ # Show context lines around matches
60
+ kfctl -n production -g "ERROR" -C 3 my-deployment
75
61
  ```
76
62
 
77
- ### Interactive Mode
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 Kubernetes namespace (default: default)
146
- --context, -c Kubernetes context
147
- --tail Number of lines to show from the end (default: 100)
148
- --max-retry Maximum retry attempts (default: 10)
149
- --grep, -g Filter logs by pattern (regex supported)
150
- --after, -A Show N lines after match (default: 0)
151
- --before, -B Show N lines before match (default: 0)
152
- --context, -C Show N lines before and after match (default: 0)
153
- --ignore-case, -i Case-insensitive pattern matching
154
- --invert, -v Invert match (show non-matching lines)
155
- --version, -v Show version
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
89
+ ## ⌨️ Interactive Mode
162
90
 
163
- ### Project Structure
91
+ Once logs are streaming, use these keyboard shortcuts:
164
92
 
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
93
+ ### Filtering
94
+ - `/` - Enter filter mode (type pattern and press Enter)
95
+ - `c` - Clear all filters
96
+ - `i` - Toggle case-insensitive matching
97
+ - `v` - Toggle invert match (show non-matching lines)
187
98
 
188
- # Development mode (with tsx)
189
- pnpm run dev -- -n production my-deployment
99
+ ### Context
100
+ - `+` - Increase context lines (show more lines around matches)
101
+ - `-` - Decrease context lines
190
102
 
191
- # Build
192
- pnpm run build
103
+ ### Playback
104
+ - `p` - Pause/resume log stream
105
+ - `q` - Quit
193
106
 
194
- # Run built version
195
- pnpm start -- --help
107
+ ### Help
108
+ - `?` - Show help
196
109
 
197
- # Test
198
- pnpm test
110
+ **Example workflow:**
111
+ ```
112
+ 1. Start: kfctl -n production api
113
+ 2. Press / and type "ERROR" to filter errors
114
+ 3. Press + three times to see 3 lines of context
115
+ 4. Press i to ignore case
116
+ 5. Press p to pause and examine
117
+ 6. Press q to quit
199
118
  ```
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
119
 
249
120
  ---
250
121
 
251
122
  ## 🐛 Troubleshooting
252
123
 
253
124
  ### Deployment Not Found
254
-
255
125
  ```bash
256
- # Check if namespace is correct
126
+ # Check namespace
257
127
  kubectl get deployments -n <namespace>
258
-
259
- # Use correct namespace
260
- kfctl -n <namespace>
128
+ kfctl -n <namespace> <deployment>
261
129
  ```
262
130
 
263
131
  ### Cannot Connect to Kubernetes
264
-
265
132
  ```bash
266
- # Check kubectl configuration
133
+ # Verify kubectl configuration
267
134
  kubectl config current-context
268
135
  kubectl get pods
269
136
 
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
137
+ # Specify context explicitly
138
+ kfctl -c <context> -n <namespace> <deployment>
284
139
  ```
285
140
 
286
141
  ---
287
142
 
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
143
  ## 📝 License
297
144
 
298
145
  MIT
299
146
 
300
147
  ---
301
148
 
302
- ## 🙏 Acknowledgments
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!** 🚀✨
149
+ **Enjoy beautiful Kubernetes logs!** 🚀
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kfctl",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
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"