Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/linter.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ xcuserdata/
# Build I/O
.env
pkg/

# Claude Code
.claude/settings.local.json
55 changes: 55 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -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`)
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
11 changes: 7 additions & 4 deletions Resources/SampleHooks/mickf-pomodoro-finish.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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" <<EOF
INSERT INTO $TABLE (start, end, message)
VALUES ('$1', '$2', '$4');
VALUES ('$1', '$2', '$SAFE_MESSAGE');
EOF

osascript -l JavaScript /Users/mick/.pomodoro-cli/notify.js "🍅 Pomodoro" "Completed" "$4" "Blow"
Expand Down
6 changes: 3 additions & 3 deletions Resources/SampleHooks/mickf-pomodoro-start.sh
Original file line number Diff line number Diff line change
@@ -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

afplay ~/Documents/Private/Pop\ Culture/be-curious-not-judgemental.mp3
8 changes: 4 additions & 4 deletions Resources/SampleHooks/sample-pomodoro-finish.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -31,7 +31,7 @@ fi
# VALUES ('$1', '$2', '$4');
# EOF

# Say with an Italian accent that the Pomodoro finished.
# Say with an Italian accent that the Pomodoro finished.
/usr/bin/say --voice=Alice "Il pomodoro è finito."

# Turn off the display after a 10 seconds delay.
Expand Down
6 changes: 3 additions & 3 deletions Resources/SampleHooks/sample-pomodoro-start.sh
Original file line number Diff line number Diff line change
@@ -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 start focus
Expand Down
9 changes: 7 additions & 2 deletions Sources/Pomodoro/TimerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class TimerViewModel: TimerViewModelType, TimerViewModelInputs, TimerViewModelOu

// MARK: - Define inputs & outputs

var inputs: TimerViewModelInputs { self }
var outputs: TimerViewModelOutputs { self }
var inputs: TimerViewModelInputs {
self
}

var outputs: TimerViewModelOutputs {
self
}
}
3 changes: 1 addition & 2 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import XCTest

import pomodoroTests
import XCTest

var tests = [XCTestCaseEntry]()
tests += pomodoroTests.allTests()
Expand Down