Skip to content

Commit c24b988

Browse files
authored
Merge pull request #1 from leonardomso/feat/start
start
2 parents 40af49c + bf6f4cc commit c24b988

80 files changed

Lines changed: 13514 additions & 1 deletion

Some content is hidden

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

.claude/CLAUDE.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Gone - Dead Link Detector
2+
3+
## Project Overview
4+
5+
Gone is a CLI tool that scans markdown files for dead links. It extracts all HTTP/HTTPS URLs and checks if they're still alive (return 200 status code).
6+
7+
## Goals
8+
9+
1. **Learn Go** - This project is a learning exercise for Go programming
10+
2. **Build a useful tool** - A practical dead link detector for markdown documentation
11+
3. **Explore Go patterns** - Concurrency (goroutines/channels), CLI frameworks, TUI development
12+
13+
## Tech Stack
14+
15+
- **Go** - Programming language
16+
- **Cobra** - CLI framework for argument parsing and subcommands
17+
- **Bubble Tea** - TUI framework (Model-View-Update architecture)
18+
- **Lipgloss** - Terminal styling (colors, borders, etc.)
19+
- **Bubbles** - Pre-built TUI components (spinners, etc.)
20+
21+
## Commands
22+
23+
```bash
24+
gone check # Scan current dir, text output
25+
gone check --format=json # JSON output for CI/scripts
26+
gone check ./docs # Scan specific directory
27+
gone interactive # Launch interactive TUI
28+
```
29+
30+
## Project Structure
31+
32+
```
33+
gone/
34+
├── main.go # Entry point
35+
├── cmd/
36+
│ ├── root.go # Cobra root command
37+
│ ├── check.go # CLI mode (text/JSON output)
38+
│ └── interactive.go # TUI mode (Bubble Tea)
39+
├── internal/
40+
│ ├── scanner/ # Find .md files in directories
41+
│ ├── parser/ # Extract URLs from content
42+
│ └── checker/ # HTTP checking with concurrency
43+
```
44+
45+
## Development Commands
46+
47+
```bash
48+
go run . check # Run without building
49+
go run . interactive # Run TUI mode
50+
go build . # Build binary
51+
go test ./... # Run tests (when added)
52+
```
53+
54+
## Conventions
55+
56+
- Keep packages in `internal/` for encapsulation
57+
- Error handling: always check and return errors, don't panic
58+
- Concurrency: use goroutines + channels for parallel work
59+
60+
## Git Commit Guidelines
61+
62+
**CRITICAL - READ THIS FIRST**
63+
64+
NEVER commit without explicit user permission. NEVER use git reset on pushed commits.
65+
66+
Rules:
67+
68+
- DO NOT run git commit unless user explicitly says "commit" or "commit our changes"
69+
- DO NOT run git reset on commits that have been pushed to remote
70+
- DO NOT undo commits without explicit user instruction
71+
- WAIT for user to ask before committing
72+
- ASK user if unsure about whether to commit
73+
74+
IMPORTANT: ONLY commit changes when explicitly asked by the user.
75+
76+
### Pre-Commit Checklist
77+
78+
1. Stage changes: ALWAYS use `git add -A` (not `git add .`) to stage all changes including deletions
79+
2. Verify staged files: Run `git status` to review what will be committed
80+
3. Review changes: Run `git diff --cached --stat` to see a summary of changes
81+
4. Check authorship: Run `git log -1 --format='%an %ae'` to verify git user configuration
82+
83+
### Commit Message Format
84+
85+
Follow the Conventional Commits specification strictly:
86+
87+
```
88+
<type>[optional scope]: <description>
89+
90+
[optional body]
91+
92+
[optional footer(s)]
93+
```
94+
95+
### Structure Rules
96+
97+
- **Type**: Required (feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert)
98+
- **Scope**: Optional, use package or feature name
99+
- **Description**: Required, concise summary in imperative mood
100+
- **Body**: Optional, detailed explanation separated by blank line
101+
- **Footer**: Optional, for references or breaking changes
102+
103+
### Writing Style
104+
105+
Use imperative mood - write as commands:
106+
107+
- "add feature" (correct)
108+
- "added feature" or "adds feature" (incorrect)
109+
110+
Think: "If applied, this commit will ___"
111+
112+
Subject line format:
113+
114+
- Start with lowercase after colon
115+
- No period at end
116+
- Keep under 72 characters
117+
- Be specific and descriptive
118+
119+
Body guidelines (when needed):
120+
121+
- Explain what and why, not how
122+
- Wrap lines at 72 characters
123+
- Use present tense
124+
- Separate from subject with blank line
125+
- Can include bullet points for multiple changes
126+
127+
Breaking changes:
128+
129+
- Add `!` after type/scope: `feat(parser)!: change URL extraction`
130+
- OR include footer: `BREAKING CHANGE: description`
131+
132+
### Scope Names for Gone
133+
134+
Packages:
135+
136+
- `scanner` - markdown file discovery
137+
- `parser` - URL extraction
138+
- `checker` - HTTP link validation
139+
- `cmd` - CLI commands
140+
141+
Features:
142+
143+
- `check` - CLI check command
144+
- `interactive` - TUI mode
145+
- `output` - text/JSON formatting
146+
147+
Infrastructure:
148+
149+
- `deps` - dependencies
150+
- `ci` - continuous integration
151+
- `docs` - documentation
152+
- `config` - configuration files
153+
154+
### Examples
155+
156+
Simple feature:
157+
158+
```
159+
feat(checker): add timeout configuration for HTTP requests
160+
```
161+
162+
Bug fix:
163+
164+
```
165+
fix(parser): handle URLs with trailing punctuation
166+
```
167+
168+
With body:
169+
170+
```
171+
feat(interactive): add progress bar during link checking
172+
173+
Replace spinner with progress bar showing checked/total count.
174+
Updates in real-time as each link check completes.
175+
```
176+
177+
Breaking change:
178+
179+
```
180+
feat(checker)!: change Result struct fields
181+
182+
BREAKING CHANGE: Renamed StatusCode to Status and added
183+
new fields for response headers.
184+
```
185+
186+
Chore:
187+
188+
```
189+
chore(deps): update bubble tea to v1.4
190+
```
191+
192+
Documentation:
193+
194+
```
195+
docs: add usage examples to README
196+
```
197+
198+
## Future Improvements
199+
200+
- [ ] Recursive directory scanning flag
201+
- [ ] Follow redirects option (treat 301/302 as alive)
202+
- [ ] Timeout configuration
203+
- [ ] Ignore patterns (skip certain domains)
204+
- [ ] Unit tests for all packages
205+
- [ ] Remove dead links from files (interactive mode feature)

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.25.5'
19+
20+
- name: Run golangci-lint
21+
uses: golangci/golangci-lint-action@v7
22+
with:
23+
version: latest
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.25.5'
23+
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v6
26+
with:
27+
version: latest
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.25.5'
19+
20+
- name: Run tests
21+
run: go test ./... -cover

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.dll
88
*.so
99
*.dylib
10+
gone
1011

1112
# Test binary, built with `go test -c`
1213
*.test
@@ -30,3 +31,4 @@ go.work.sum
3031
# Editor/IDE
3132
# .idea/
3233
# .vscode/
34+
.DS_Store

0 commit comments

Comments
 (0)