Claude/fix tick engine v16wt (#165)
* fix: wire up tick engine scheduler + add journal + systemd timer The ThinkingEngine was fully implemented but never called — the background scheduler was lost during the Celery removal in #133. This commit: - Add _thinking_scheduler() to dashboard lifespan (5-min cycle) - Add _write_journal() that appends thoughts to data/journal/YYYY-MM-DD.md - Add `timmy tick` CLI command for one-shot thinking (systemd-friendly) - Add deploy/timmy-tick.{service,timer} systemd units https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge * Add macOS launchd plist for Timmy tick timer Equivalent of the existing systemd service/timer for Linux. Runs `timmy tick` every 5 minutes via launchd on macOS. https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge * fix: make macOS launchd timer work with user-local paths The plist had hardcoded /opt/timmy paths that don't exist on Mac. Now uses a template with __PROJECT_DIR__ placeholders, a wrapper script for PATH setup, and an install script that wires it all up. Usage: ./deploy/install-mac-timer.sh https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge * fix: add missing tox pre-commit env + pre-push hook to prevent broken builds RCA: the pre-commit hook referenced `tox -e pre-commit` which didn't exist in tox.ini, so commits went unchecked. There was also no pre-push hook, so broken code could reach GitHub without running the CI-mirror suite. - Add [testenv:pre-commit] to tox.ini (format check + unit tests) - Add .githooks/pre-push that runs `tox -e pre-push` (full CI mirror) https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
622a6a9204
commit
1191ea2f9a
18
.githooks/pre-push
Executable file
18
.githooks/pre-push
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pre-push hook: runs the full CI-mirror suite before allowing a push.
|
||||
# Prevents broken builds from reaching GitHub.
|
||||
#
|
||||
# Auto-activated by `make install` via git core.hooksPath.
|
||||
|
||||
set -e
|
||||
|
||||
echo "Running pre-push gate (tox -e pre-push — mirrors CI exactly)..."
|
||||
tox -e pre-push
|
||||
|
||||
exit_code=$?
|
||||
|
||||
if [ "$exit_code" -ne 0 ]; then
|
||||
echo ""
|
||||
echo "BLOCKED: pre-push gate failed. Fix the issues above before pushing."
|
||||
exit 1
|
||||
fi
|
||||
26
deploy/com.timmy.tick.plist
Normal file
26
deploy/com.timmy.tick.plist
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.timmy.tick</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>__PROJECT_DIR__/deploy/timmy-tick-mac.sh</string>
|
||||
</array>
|
||||
|
||||
<key>WorkingDirectory</key>
|
||||
<string>__PROJECT_DIR__</string>
|
||||
|
||||
<key>StartInterval</key>
|
||||
<integer>300</integer>
|
||||
|
||||
<key>StandardOutPath</key>
|
||||
<string>__PROJECT_DIR__/data/tick.log</string>
|
||||
|
||||
<key>StandardErrorPath</key>
|
||||
<string>__PROJECT_DIR__/data/tick-error.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
32
deploy/install-mac-timer.sh
Executable file
32
deploy/install-mac-timer.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Install the Timmy tick timer on macOS via launchd.
|
||||
# Usage: ./deploy/install-mac-timer.sh
|
||||
set -e
|
||||
|
||||
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PLIST_SRC="$PROJECT_DIR/deploy/com.timmy.tick.plist"
|
||||
PLIST_DST="$HOME/Library/LaunchAgents/com.timmy.tick.plist"
|
||||
LABEL="com.timmy.tick"
|
||||
|
||||
# Ensure data dir exists for logs
|
||||
mkdir -p "$PROJECT_DIR/data"
|
||||
|
||||
# Make wrapper executable
|
||||
chmod +x "$PROJECT_DIR/deploy/timmy-tick-mac.sh"
|
||||
|
||||
# Unload if already installed
|
||||
if launchctl list "$LABEL" >/dev/null 2>&1; then
|
||||
echo "Unloading existing $LABEL..."
|
||||
launchctl bootout "gui/$(id -u)/$LABEL" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Fill in project path and install
|
||||
sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$PLIST_SRC" > "$PLIST_DST"
|
||||
|
||||
# Load
|
||||
launchctl bootstrap "gui/$(id -u)" "$PLIST_DST"
|
||||
|
||||
echo "Installed! Timmy will tick every 5 minutes."
|
||||
echo " Logs: $PROJECT_DIR/data/tick.log"
|
||||
echo " Check: launchctl list | grep timmy"
|
||||
echo " Stop: launchctl bootout gui/\$(id -u)/com.timmy.tick"
|
||||
6
deploy/timmy-tick-mac.sh
Executable file
6
deploy/timmy-tick-mac.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Wrapper script for the launchd tick timer on macOS.
|
||||
# Ensures PATH is set so tox/python can be found.
|
||||
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
exec tox -e dev -- timmy tick
|
||||
16
tox.ini
16
tox.ini
@@ -145,6 +145,22 @@ commands =
|
||||
-p no:xdist \
|
||||
-m "not ollama and not docker and not selenium and not external_api"
|
||||
|
||||
# ── Pre-commit (fast local gate) ────────────────────────────────────────────
|
||||
|
||||
[testenv:pre-commit]
|
||||
description = Fast pre-commit gate — format check + unit tests (30s budget)
|
||||
deps =
|
||||
black
|
||||
isort
|
||||
commands =
|
||||
black --check --line-length 100 src/ tests/
|
||||
isort --check-only --profile black --line-length 100 src/ tests/
|
||||
pytest tests/ -q --tb=short \
|
||||
--ignore=tests/e2e \
|
||||
--ignore=tests/functional \
|
||||
-m "not ollama and not docker and not selenium and not external_api and not skip_ci" \
|
||||
-n auto --dist worksteal
|
||||
|
||||
# ── Dev Server ───────────────────────────────────────────────────────────────
|
||||
|
||||
[testenv:dev]
|
||||
|
||||
Reference in New Issue
Block a user