Commit Graph

175 Commits

Author SHA1 Message Date
96aedc8239 Fix log file sorting by using timestamp-first filename format
Some checks failed
CI / test (pull_request) Has been cancelled
Filenames are now timestamp_sha.jsonl instead of sha_timestamp.jsonl. This makes alphabetical sort equal to chronological sort, eliminating fragile string parsing and ensuring commit SHAs are ordered by their most recent log file timestamp.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 11:35:28 -07:00
7408c02d64 Merge pull request 'Add raw JSONL endpoint and improve error display' (#17) from probablycorey/raw-jsonl-endpoint into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #17
2026-03-10 18:05:26 +00:00
afb15a8584 Improve error display in logs viewer: show message and stack trace
Some checks failed
CI / test (pull_request) Has been cancelled
Errors from JSONL files are serialized as plain objects with message/stack
properties, not Error instances. The summary line now displays the error
message correctly, and the expandable detail panel shows the full stack
trace in a monospace preformatted block for easier debugging.
2026-03-10 11:05:01 -07:00
2943f24c17 Merge pull request 'Document Gitea webhook setup and fix log file sorting' (#15) from probablycorey/pr-to-discord-flow into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #15
2026-03-10 18:02:49 +00:00
c3000e954b Merge branch 'main' into probablycorey/pr-to-discord-flow
Some checks failed
CI / test (pull_request) Has been cancelled
2026-03-10 18:02:44 +00:00
cb10121fb5 Merge pull request 'Add content negotiation for raw JSONL logs' (#16) from probablycorey/raw-jsonl-endpoint into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #16
2026-03-10 18:02:08 +00:00
f750663eca Add content negotiation for raw JSONL logs endpoint
Some checks failed
CI / test (pull_request) Has been cancelled
The /logs endpoint now returns different formats based on Accept headers:
- Browsers (Accept: text/html) get the interactive HTML log viewer
- Agents/fetch requests get raw JSONL when no Accept header includes text/html
- Without a file parameter, agents get a JSON array of available log files

Also improved security: invalid filenames now throw errors (500) instead of silently failing (404).
2026-03-10 10:58:58 -07:00
bafb6fe93b Document Gitea webhook setup and fix log file sidebar sorting
Some checks failed
CI / test (pull_request) Has been cancelled
- Add setup instructions for system-wide and org/repo webhooks
- Fix sidebar to sort log file groups by most recent file timestamp
- Maintains chronological order when viewing logs across different git commits

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 10:38:29 -07:00
b5eb553d74 Merge pull request 'Add richer metadata to logs and expandable detail panel' (#14) from probablycorey/richer-log-metadata into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #14
2026-03-10 17:34:00 +00:00
926b9b17c9 Merge branch 'main' into probablycorey/richer-log-metadata
Some checks failed
CI / test (pull_request) Has been cancelled
2026-03-10 17:33:30 +00:00
6555be012a Add richer metadata to logs and expandable detail panel
Some checks failed
CI / test (pull_request) Has been cancelled
Enriches webhook logs with sender and ref for better visibility into who triggered events and what they affected (e.g. which branch). PR logs now include the title, comment logs include the first 200 characters of the comment body.

Adds an expandable detail row in the log viewer UI that shows all metadata as key-value pairs when clicked, keeping the summary line clean.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 10:25:47 -07:00
4fba215f21 Merge pull request 'Fix Discord message rendering' (#13) from probablycorey/fix-discord-message into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #13
2026-03-10 17:09:28 +00:00
d12ee5c52d Fix Discord message rendering: remove stray blockquote character
Some checks failed
CI / test (pull_request) Has been cancelled
The empty blockquote line after the repo name was rendering as a literal ">" in Discord. Add a trailing space so it renders as a blank line within the blockquote instead.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 10:02:17 -07:00
726c76cf96 Merge pull request 'Fix crash log file not found error in spike' (#12) from probablycorey/fix-crash-log-path into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #12
2026-03-10 16:54:32 +00:00
c9fc834f4e Fix crash log file not found error in spike
Some checks failed
CI / test (pull_request) Has been cancelled
Use getConfig("dataDir") and ensure directory exists before writing crash log, fixing ENOENT error when spike crashes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 09:53:24 -07:00
1f386df256 Merge pull request 'Add typed event logging and restructure server' (#11) from probablycorey/simple-logging into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #11
2026-03-10 16:28:40 +00:00
57fcf9616d Merge origin/main into probablycorey/simple-logging
Some checks failed
CI / test (pull_request) Has been cancelled
Resolve conflicts:
- package.json: keep server/index.tsx paths, adopt new test commands
- discord/index.ts: adopt startDiscord() wrapper, keep log() calls
- server/index.tsx: use startDiscord() import, keep logging structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:27:12 -07:00
abdb81572b Merge pull request 'Add integration tests for Spike PR→Discord bridge' (#10) from probablycorey/test-other-user-pr into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #10
2026-03-10 16:25:01 +00:00
96b6a4311b Remove redundant sha from StoredLogEvent type
Some checks failed
CI / test (pull_request) Has been cancelled
The sha is already encoded in the log filename (releaseSha_timestamp.jsonl), so there's no need to include it per-event. This simplifies the type and storage format.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 09:23:51 -07:00
6b30715fa1 Add integration tests for Spike PR→Discord bridge
Some checks failed
CI / test (pull_request) Has been cancelled
Move webhook tests to root tests/ dir and restructure to be non-flaky. Setup webhook capture server once via preload, tear down on process exit. Tests now clean up their own PRs in afterEach. Added bridge test to verify Spike PRs create Discord threads. Made Discord client login explicit via startDiscord(). Updated config with new dev Discord channel and Spike username mappings.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 09:16:52 -07:00
04aa7c1c91 Add typed event logging system and restructure server
Implement a centralized logging system with typed events (webhook, PR, comment, review, Discord relay, errors, etc.) that feeds a pub/sub pattern. Events are logged to console (with ANSI colors: green=normal, yellow=skipped, red=errors, cyan=PR#) and persisted to JSONL files organized by git commit SHA.

Restructure server code into src/server/ directory with separate route handlers. Add a new /logs endpoint with an HTML viewer that displays events in a searchable table with type/repo filtering and browser timezone conversion. Remove the old /errors endpoint.

Improvements:
- All webhook handlers, Discord events, and errors now use log() instead of console.* calls
- Error objects are properly serialized to JSONL (message + stack extracted)
- Path traversal vulnerability fixed in readLogFile()
- Failed API calls and caught errors are now always logged
- Graceful error handling with fallbacks where appropriate (e.g., missing Discord users)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 08:58:47 -07:00
f7684cf141 Merge pull request 'Untangle Spike architecture with bridge pattern' (#9) from probablycorey/ai-project-structure into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #9
2026-03-09 23:03:30 +00:00
4bcec23c22 Merge branch 'main' into probablycorey/ai-project-structure
Some checks failed
CI / test (pull_request) Has been cancelled
2026-03-09 23:03:25 +00:00
ff98255588 Merge pull request 'Refactor config structure for better readability' (#8) from probablycorey/split-config-type into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #8
2026-03-09 22:59:48 +00:00
85eea2f4ef Refactor config structure for better readability
Some checks failed
CI / test (pull_request) Has been cancelled
Split nested dev/prod config object into a Config type with separate devConfig and prodConfig objects. This makes it clearer which values apply to which environment and ensures both configs match the type.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-09 15:56:30 -07:00
a71bf2d492 Make webhook tests independent with isolated PRs and retry on merge timing issues
Some checks failed
CI / test (pull_request) Has been cancelled
Each test now creates its own PR and cleans up after itself. Tests no longer depend on shared state or ordering, making them resilient to failures.

Added retry logic to mergePR for Gitea's 404/405 responses while computing mergeability. Used crypto.randomUUID() for unique branch names instead of Date.now() to eliminate collision risk.
2026-03-09 15:56:09 -07:00
238df92888 Untangle Spike architecture with bridge pattern
Split the monolithic gitea/helpers.ts (which had Discord imports and created circular dependencies) into three focused libs:

1. **gitea/** — Pure API client: fetchPR, fetchReviewComments, convertUsername, threadName. No side effects or external deps.

2. **discord/** — Discord client setup: bot login, event listeners, slash commands. Now isolated from Gitea internals.

3. **bridge/** — New integration layer: webhook handler, DB mappings (Gitea PR ↔ Discord thread), Discord helpers, and createPRComment.

Dependencies now flow one direction: bridge → gitea and bridge → discord. No circular imports.

Added:
- Barrel exports (index.ts) for each lib with public API
- README.md for each lib documenting the barrel exports
- Comprehensive spike README.md with setup guide and architecture explanation
- Integration tests for webhooks (callback-based, no race conditions)
- Unit tests for pure API functions
- CLAUDE.md with links to each lib's README

This architecture makes it possible for AI to understand a lib by reading just its README, keeping context focused and small.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-09 15:23:11 -07:00
bb401f8252 Update README.md
Some checks failed
CI / test (push) Has been cancelled
2025-12-03 11:20:16 -08:00
78c0dcf2e5 Merge pull request 'Discord has a max message length of 2000, keep the PR title below that!' (#7) from max-message-length into main
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #7
2025-12-03 18:55:32 +00:00
e46fb0dd7a Discord has a max message length of 2000, keep the PR title below that!
Some checks failed
CI / test (pull_request) Has been cancelled
2025-12-03 10:51:54 -08:00
d169c19e8a Merge pull request 'Good enough gitea/discord integration' (#6) from review-comments into main
Some checks failed
CI / test (push) Has been cancelled
Reviewed-on: #6
2025-11-13 22:55:24 +00:00
9e7eb70b4f better
Some checks failed
CI / test (pull_request) Has been cancelled
2025-11-13 14:53:34 -08:00
f156e91bcd this is good enough
Some checks are pending
CI / test (push) Waiting to run
2025-11-13 10:59:49 -08:00
e2feb9cc1a great 2025-11-12 17:13:25 -08:00
34de1f8e40 Much better 2025-11-12 16:38:33 -08:00
fd939af0b7 This is much better
Some checks are pending
CI / test (push) Waiting to run
2025-11-12 11:49:10 -08:00
1bd8ecba7a Update webhook-handler.ts
Some checks are pending
CI / test (push) Waiting to run
2025-11-12 10:03:43 -08:00
726961ca99 let me cook
Some checks are pending
CI / test (push) Waiting to run
2025-11-12 09:55:23 -08:00
c85c61ed95 Update defunkt's name
Some checks failed
CI / test (push) Has been cancelled
2025-11-07 15:43:03 -08:00
c2cf89f1d2 Only one proc needed
Some checks are pending
CI / test (push) Waiting to run
2025-11-07 15:29:27 -08:00
f404f7c99b add logs 2025-11-07 15:07:24 -08:00
bff5aa05f5 spike, you are alive
Some checks failed
CI / test (push) Waiting to run
CI / test (pull_request) Has been cancelled
2025-11-07 14:58:20 -08:00
59d51c4be4 cool dude 2025-11-07 14:40:11 -08:00
a41e086d76 yes
Some checks failed
CI / test (pull_request) Has been cancelled
2025-11-07 10:31:37 -08:00
883c69d517 get that subdomain
Some checks are pending
CI / test (push) Waiting to run
2025-11-07 09:52:53 -08:00
bdf6a288b1 try it out!
Some checks are pending
CI / test (push) Waiting to run
2025-11-07 09:39:57 -08:00
142d9ddf9b no more
Some checks are pending
CI / test (push) Waiting to run
2025-10-07 19:26:16 -07:00
e5904927eb don't break on lowercase readmes 2025-09-25 21:15:53 -07:00
e4b0ebc3e1 apps 2025-09-23 19:03:37 -07:00
Chris Wanstrath
3fc9bfad4a sneaker wip 2025-09-23 17:55:41 -07:00