diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 4fa4ef0..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: Lint Code Base - -on: - pull_request: - branches: [main] - -############################################ -# Grant status permission for MULTI_STATUS # -############################################ -permissions: - contents: read - packages: read - statuses: write - -jobs: - build: - name: Lint Code Base - runs-on: ubuntu-latest - - ################## - # Load all steps # - ################## - steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - ################################ - # Run Linter against code base # - ################################ - - name: Lint Code Base - uses: super-linter/super-linter@v6 - env: - VALIDATE_ALL_CODEBASE: false - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index d2eb1a0..37041fb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ xcuserdata/ # Build I/O .env pkg/ + +# Claude Code +.claude/settings.local.json \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..262e442 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,55 @@ +# AGENTS.md + +This file provides guidance to coding agents when working with code in this repository. + +## Build Commands + +```bash +# Install/update dependencies +make install + +# Build debug +make build + +# Build and run a quick test (5 second pomodoro) +make run-test + +# Build release and install to /usr/local/bin +make deploy + +# Run tests +swift test + +# Run a single test +swift test --filter TimeIntervalFormatterTests + +# Format code +make format + +# Lint code +make lint +``` + +## Architecture + +This is a Swift command-line tool built with Swift Package Manager. The executable is `pomodoro-cli`. + +**Target structure:** + +- `PomodoroCLI` - Executable target with `RootCommand.swift` (entry point using swift-argument-parser) +- `Pomodoro` - Library target with core logic +- `PomodoroTests` - Test target + +**Key components in the Pomodoro library:** + +- `TimerViewCLI` - Main CLI view that manages the timer display, progress bar, interrupt handling, and coordinates hooks/logging +- `TimerViewModel` - Tracks timer state (start date, duration, progress) +- `Hook` - Executes shell scripts at pomodoro lifecycle events (didStart/didFinish) from `~/.pomodoro-cli/` +- `LogWriter` - Writes completed pomodoros to `~/.pomodoro-cli/journal.yml` +- `PomodoroDescription` - Value type holding pomodoro data (duration, message, start/end dates) +- `InterruptHandler` - Handles Ctrl+C signals for graceful interruption + +**Dependencies:** + +- `swift-argument-parser` - CLI argument parsing +- `swift-blocks` (dirtyhenry/swift-blocks) - Utility library (provides `CLIUtils`, `Blocks`) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Resources/SampleHooks/mickf-pomodoro-finish.sh b/Resources/SampleHooks/mickf-pomodoro-finish.sh index c270c3f..19d576f 100755 --- a/Resources/SampleHooks/mickf-pomodoro-finish.sh +++ b/Resources/SampleHooks/mickf-pomodoro-finish.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash set -e # Check if exactly 4 arguments are provided if [ "$#" -ne 4 ]; then - echo "Usage: $0 arg1 arg2 arg3 arg4" - exit 1 + echo "Usage: $0 arg1 arg2 arg3 arg4" + exit 1 fi # This would stop focus. @@ -26,9 +26,12 @@ CREATE TABLE IF NOT EXISTS $TABLE ( EOF # Insert the 4 arguments into the table +# Escape single quotes for SQL (replace ' with '') +SQ="'" +SAFE_MESSAGE="${4//$SQ/$SQ$SQ}" sqlite3 "$DATABASE" <