Skip to content

Commit cf5dd62

Browse files
committed
feat: implement the first version
Signed-off-by: suin <[email protected]>
1 parent 4ce8fe9 commit cf5dd62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2509
-26
lines changed

.clinerules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Contributing
2+
Please read CONTRIBUTING.md for development setup and guidelines.

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: nix develop --command bash -e {0}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: DeterminateSystems/nix-installer-action@main
22+
- uses: DeterminateSystems/flakehub-cache-action@main
23+
- run: "true" # warm up the nix store
24+
- run: biome ci
25+
- run: cd pkg/emitters/websocket/static && bun install
26+
- run: cd pkg/emitters/websocket/static && bun run build
27+
- run: test -z "$(gofmt -l . | tee /dev/stderr)"
28+
- run: go vet ./...
29+
- run: go test -v ./...

.github/workflows/homebrew.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Homebrew
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Publish"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
env:
14+
FORMULA_NAME: kutelog
15+
TAP_OWNER: ${{ github.repository_owner }}
16+
TAP_NAME: homebrew-tap
17+
18+
jobs:
19+
update-formula:
20+
runs-on: ubuntu-latest
21+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
22+
steps:
23+
- name: Checkout main repo
24+
uses: actions/checkout@v4
25+
26+
- name: Checkout tap repo
27+
uses: actions/checkout@v4
28+
with:
29+
repository: ${{ env.TAP_OWNER }}/${{ env.TAP_NAME }}
30+
path: tap
31+
token: ${{ secrets.TAP_TOKEN }}
32+
33+
- name: Get latest release
34+
id: get_release
35+
run: |
36+
RELEASE_TAG=$(gh api repos/${{ github.repository }}/releases/latest --jq .tag_name)
37+
echo "VERSION=$RELEASE_TAG" >> $GITHUB_ENV
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
41+
- name: Download release assets
42+
run: |
43+
mkdir -p tmp
44+
gh release download ${{ env.VERSION }} -D tmp --clobber
45+
env:
46+
GH_TOKEN: ${{ github.token }}
47+
48+
- name: Calculate SHA256
49+
id: sha256
50+
run: |
51+
echo "DARWIN_ARM64=$(sha256sum tmp/${{ env.FORMULA_NAME }}-darwin-arm64 | cut -d ' ' -f 1)" >> $GITHUB_ENV
52+
echo "DARWIN_AMD64=$(sha256sum tmp/${{ env.FORMULA_NAME }}-darwin-amd64 | cut -d ' ' -f 1)" >> $GITHUB_ENV
53+
echo "LINUX_ARM64=$(sha256sum tmp/${{ env.FORMULA_NAME }}-linux-arm64 | cut -d ' ' -f 1)" >> $GITHUB_ENV
54+
echo "LINUX_AMD64=$(sha256sum tmp/${{ env.FORMULA_NAME }}-linux-amd64 | cut -d ' ' -f 1)" >> $GITHUB_ENV
55+
56+
- name: Update Formula
57+
run: |
58+
mkdir -p tap/Formula
59+
go run homebrew/generate.go > tap/Formula/${{ env.FORMULA_NAME }}.rb
60+
61+
- name: Create Pull Request
62+
uses: peter-evans/create-pull-request@v5
63+
with:
64+
path: tap
65+
token: ${{ secrets.TAP_TOKEN }}
66+
commit-message: "brew(${{ env.FORMULA_NAME }}): update formula to ${{ env.VERSION }}"
67+
title: "brew(${{ env.FORMULA_NAME }}): update formula to ${{ env.VERSION }}"
68+
body: |
69+
Update Homebrew formula for [${{ env.FORMULA_NAME }}](https://github.com/${{ github.repository }})
70+
71+
## Changes
72+
- Version: [${{ env.VERSION }}](https://github.com/${{ github.repository }}/releases/tag/${{ env.VERSION }})
73+
- Repository: ${{ github.repository }}
74+
75+
## SHA256 Checksums
76+
- Darwin ARM64: `${{ env.DARWIN_ARM64 }}`
77+
- Darwin AMD64: `${{ env.DARWIN_AMD64 }}`
78+
- Linux ARM64: `${{ env.LINUX_ARM64 }}`
79+
- Linux AMD64: `${{ env.LINUX_AMD64 }}`
80+
81+
## Installation
82+
```bash
83+
brew tap ${{ env.TAP_OWNER }}/${{ env.TAP_NAME }}
84+
brew install ${{ env.FORMULA_NAME }}
85+
```
86+
87+
## Links
88+
- [Release Notes](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.VERSION }})
89+
branch: ${{ env.FORMULA_NAME }}/update-brew-formula
90+
delete-branch: true
91+
signoff: true

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
permissions:
8+
contents: write
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
shell: nix develop --command bash -e {0}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: DeterminateSystems/nix-installer-action@main
18+
- uses: DeterminateSystems/flakehub-cache-action@main
19+
- run: "true" # warm up the nix store
20+
- run: cd pkg/emitters/websocket/static && bun install
21+
- run: cd pkg/emitters/websocket/static && bun run build
22+
- id: get_version
23+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
24+
- run: just version="${{ env.VERSION }}" build-all
25+
- run: |
26+
cd dist
27+
sha256sum * > checksums.txt
28+
- uses: softprops/action-gh-release@v1
29+
with:
30+
files: |
31+
dist/*
32+
draft: false
33+
prerelease: false
34+
generate_release_notes: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# 🌸 Contributing to Kutelog
2+
3+
## Development Environment Setup
4+
5+
### Prerequisites
6+
- [Nix](https://nixos.org) package manager
7+
- Nix flakes enabled
8+
9+
### Setting Up Development Environment
10+
11+
1. Clone the repository:
12+
```bash
13+
git clone https://github.com/appthrust/kutelog.git
14+
cd kutelog
15+
```
16+
17+
2. Enter development shell:
18+
```bash
19+
nix develop
20+
```
21+
This will make the following tools available:
22+
- Go
23+
- Bun
24+
- Biome
25+
- kind
26+
- kubectl
27+
28+
3. Install dependencies:
29+
```bash
30+
cd pkg/emitters/websocket/static
31+
bun install
32+
```
33+
34+
### Running Development Server
35+
36+
1. Start frontend development server (in a new terminal):
37+
```bash
38+
cd pkg/emitters/websocket/static
39+
bun run dev # runs build in watch mode
40+
```
41+
42+
2. Start backend server (in another terminal):
43+
```bash
44+
go run cmd/main.go
45+
```
46+
47+
3. Access development server in browser:
48+
- http://localhost:9106
49+
50+
### Building
51+
52+
1. Build frontend:
53+
```bash
54+
cd pkg/emitters/websocket/static
55+
bun run build
56+
```
57+
58+
2. Build backend:
59+
```bash
60+
go build -o kutelog cmd/main.go
61+
```
62+
63+
## Release Process
64+
65+
### Creating a New Release
66+
67+
1. Determine the new version number based on changes:
68+
- Major version: Breaking changes
69+
- Minor version: New features
70+
- Patch version: Bug fixes
71+
72+
2. Create and push a new tag:
73+
```bash
74+
git tag -a v1.2.3 -m "Release v1.2.3" # Replace with actual version
75+
git push origin v1.2.3
76+
```
77+
78+
3. The release process is automated through GitHub Actions:
79+
- Publish workflow:
80+
1. Builds binaries for all supported platforms
81+
2. Creates a GitHub release with the binaries
82+
3. Generates release notes from commits
83+
- Homebrew workflow:
84+
1. Triggered after successful publish
85+
2. Updates the Homebrew formula with new version and checksums
86+
3. Creates a pull request in homebrew-tap repository
87+
88+
### Supported Platforms
89+
- macOS (ARM64, AMD64)
90+
- Linux (ARM64, AMD64)
91+
- Windows (AMD64)

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# 🌸 AppThrust Kutelog
2+
3+
Kutelog is a development tool that leverages your browser's Console to make structured logs from Kubebuilder controllers easy to read in real-time. By utilizing the Console's powerful features, it helps developers see and analyze what their controllers are doing while they work on them.
4+
5+
Works with Chrome, Firefox, Safari, and Edge.
6+
7+
![Kutelog Screenshot](screenshots/image.png)
8+
9+
## 📦 Installation
10+
11+
### Using Homebrew
12+
13+
```bash
14+
brew tap appthrust/tap
15+
brew install kutelog
16+
```
17+
18+
### Manual Installation
19+
20+
Download the latest binary from [GitHub Releases](https://github.com/appthrust/kutelog/releases).
21+
22+
## 🚀 Usage
23+
24+
### With Kubebuilder Controllers
25+
```bash
26+
make run 2>&1 | kutelog
27+
```
28+
29+
### With Kubernetes Logs
30+
```bash
31+
kubectl logs -f deployment/myapp | kutelog
32+
```
33+
34+
## 🤔 Why Browser Console?
35+
36+
Traditional CLI tools are great, but Browser Console offers unique advantages for structured logs:
37+
38+
- **JSON Handling**
39+
- CLI: Long, hard-to-read single-line JSON strings
40+
- Console: Interactive object explorer with expand/collapse functionality
41+
- Easily navigate through nested data structures
42+
43+
- **Filtering Capabilities**
44+
- CLI: Limited to grep-like text filtering
45+
- Console: Rich filtering options using built-in Console filters
46+
- Quickly switch between log levels (error, warn, info)
47+
48+
- **Search Experience**
49+
- CLI: Basic text search
50+
- Console: Advanced search with pattern matching
51+
- Search within specific log fields
52+
53+
## 💡 Console Tips
54+
55+
- **Log Level Filtering**
56+
- Use `error` to show only error logs
57+
- Use `warn` to show warnings and errors
58+
- Use `info` to show info, warnings, and errors
59+
- Click the level icons in the Console toolbar for quick filtering
60+
61+
- **Search Techniques**
62+
- Use `/pattern/` for regex search
63+
- Use `-word` to exclude entries containing "word"
64+
65+
- **Object Navigation**
66+
- Click the ▶ arrow to expand objects
67+
- Right-click properties for copy options
68+
69+
- **Console Management**
70+
- Click clear button (⊘ in Chrome/Edge, 🗑️ in Firefox/Safari) or press Cmd+K (macOS) / Ctrl+L (Windows/Linux) to clear console
71+
- Type `////////////////////////////////////` to add a visual separator
72+
73+
## ✨ Features
74+
75+
- 🔍 **Browser Console Benefits**
76+
- Interactive exploration of structured JSON data
77+
- Expand/collapse nested objects with ease
78+
- No more dealing with single-line JSON strings
79+
80+
- 🎯 **Powerful Filtering**
81+
- Filter by log levels using Console filters (error, warn, info)
82+
- Advanced text search capabilities
83+
- Focus on what matters to you
84+
85+
- 🔄 **Real-time Updates**
86+
- WebSocket-based live streaming
87+
- Automatic reconnection if connection is lost
88+
89+
## 🛠️ How to Use
90+
91+
1. Start Kutelog with your log stream
92+
2. Open `http://localhost:9106` in your browser
93+
3. Open DevTools Console (F12 or Cmd+Option+J)
94+
4. Use Console filters to focus on specific log levels

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true
23+
}
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"quoteStyle": "double"
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)