|
| 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) |
0 commit comments