Commit Graph

146 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
8f8c70e10e fixed runner 2025-09-19 17:35:22 -07:00
329550f44a arg completer 2025-09-19 17:32:19 -07:00
Chris Wanstrath
881ed132c0 ignore local sqlite file 2025-09-08 14:05:12 -07:00
Chris Wanstrath
5d7f27e296 nose-bbs 2025-09-08 13:49:14 -07:00
f20e280b19 REMEMBER US FOR A YEAR! 2025-08-13 09:39:31 -07:00
Chris Wanstrath
c6977cd760 github api 2025-07-30 13:30:04 -07:00
Chris Wanstrath
eac2e4e009 truisms 2025-07-28 18:00:39 -07:00
Chris Wanstrath
a85ce30c2d TODO 2025-07-28 16:03:55 -07:00
Chris Wanstrath
65f3cbb74f full project metadata in json 2025-07-28 12:59:35 -07:00
Chris Wanstrath
d8f34197c4 big 2025-07-28 12:53:43 -07:00
Chris Wanstrath
f882b535d6 futuristic css (not really) 2025-07-28 11:36:48 -07:00
Chris Wanstrath
14d983974b index cards 2025-07-28 11:33:37 -07:00
Chris Wanstrath
3159b3c160 shhh 2025-07-28 11:26:45 -07:00
Chris Wanstrath
8df0c3d80b use DATA_DIR 2025-07-28 11:24:18 -07:00
Chris Wanstrath
ae6d191b91 project urls 2025-07-28 11:21:48 -07:00
Chris Wanstrath
ed7e1349b5 activity 2025-07-28 10:41:45 -07:00
Chris Wanstrath
6ac231ce36 api 2025-07-28 10:06:54 -07:00
Chris Wanstrath
11b693c5cb jazz it up 2025-07-28 09:57:29 -07:00
Chris Wanstrath
2613e241fa move things around 2025-07-28 09:54:31 -07:00
4d7041f2b1 better docs 2025-07-25 14:39:14 -07:00
3abadc3b51 Clean up 2025-07-25 14:31:11 -07:00
e7b334a72b Merge branch 'main' of https://github.com/probablycorey/the-workshop 2025-07-25 14:15:25 -07:00