Simple storage #1

Closed
opened 2026-07-13 19:53:33 +00:00 by alex · 2 comments
Owner

Let's add a simple disk storage mechanism to keep track of already greeted nicks and skip them

Let's add a simple disk storage mechanism to keep track of already greeted nicks and skip them
Author
Owner

/pi new pr, use std Deno libs if it makes sense

/pi new pr, use std Deno libs if it makes sense
Contributor

Now I understand the project. Let me check the current state after the fmt fix and look at what needs to change:Let me create the storage module, tests, and update the related files:Now update config.ts to add the optional storePath:Now update main.ts to integrate the store:Now update deno.json to add --allow-write permissions:Now update .env.example and .gitignore:Now update the README to document the new feature:Now let me run all the CI checks to make sure everything passes:All checks pass — 8 tests, fmt, lint, and type-check all green. Let me do a final review of all the changes:Let me verify the final state of the key files and also run deno check on the test file specifically:Everything passes. Let me create the PR:PR #2 created. Let me check the CI status:PR #2 is created and open. Here's a summary of what was done:

PR #2: feat: add disk storage for already-greeted nickscloses #1

The PR adds a simple disk-backed store (GreetedNicksStore in src/storage.ts) that persists greeted nicks to a JSON file so the bot skips people it has already greeted, even after a restart.

Key design decisions:

  • Built-in Deno I/O — uses Deno.readTextFile/Deno.writeTextFile (part of the runtime, no @std/* package needed). This is the simplest fit for "simple disk storage."
  • Crash-safe ordering — nicks are persisted after the greeting is sent, so a crash can cause a duplicate greeting but never a skipped one.
  • Optional configIRC_STORE_PATH defaults to greeted-nicks.json if not set, following the existing resolve() pattern.
  • 8 unit tests covering load/persist round-trips, no-op adds, non-string filtering, and error cases (malformed JSON, non-array files).

All CI checks pass locally: deno fmt --check, deno lint, deno check, and deno test (8/8 passed).


View action run | Model: zai/glm-5.2 (thinking: max) | Time: 9m 35s | Tokens: 558.8K | Pi SDK v0.80.6 | Action v2.25.1-develop (develop @ 9c24480)

Now I understand the project. Let me check the current state after the fmt fix and look at what needs to change:Let me create the storage module, tests, and update the related files:Now update `config.ts` to add the optional `storePath`:Now update `main.ts` to integrate the store:Now update `deno.json` to add `--allow-write` permissions:Now update `.env.example` and `.gitignore`:Now update the README to document the new feature:Now let me run all the CI checks to make sure everything passes:All checks pass — 8 tests, fmt, lint, and type-check all green. Let me do a final review of all the changes:Let me verify the final state of the key files and also run `deno check` on the test file specifically:Everything passes. Let me create the PR:PR #2 created. Let me check the CI status:PR #2 is created and open. Here's a summary of what was done: **PR #2: feat: add disk storage for already-greeted nicks** — closes #1 The PR adds a simple disk-backed store (`GreetedNicksStore` in `src/storage.ts`) that persists greeted nicks to a JSON file so the bot skips people it has already greeted, even after a restart. **Key design decisions:** - **Built-in Deno I/O** — uses `Deno.readTextFile`/`Deno.writeTextFile` (part of the runtime, no `@std/*` package needed). This is the simplest fit for "simple disk storage." - **Crash-safe ordering** — nicks are persisted *after* the greeting is sent, so a crash can cause a duplicate greeting but never a skipped one. - **Optional config** — `IRC_STORE_PATH` defaults to `greeted-nicks.json` if not set, following the existing `resolve()` pattern. - **8 unit tests** covering load/persist round-trips, no-op adds, non-string filtering, and error cases (malformed JSON, non-array files). All CI checks pass locally: `deno fmt --check`, `deno lint`, `deno check`, and `deno test` (8/8 passed). --- [View action run](https://forge.l3x.in/alex/irc-horsegift-greeter/actions/runs/3) | Model: zai/glm-5.2 (thinking: max) | Time: 9m 35s | Tokens: 558.8K | Pi SDK v0.80.6 | Action v2.25.1-develop (develop @ 9c24480)
alex closed this issue 2026-07-14 01:58:51 +00:00
Sign in to join this conversation.
No labels
dependencies
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
alex/irc-greeter-bot#1
No description provided.