Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Create @chatcops/store-sqlite, a store for single-server setups

Chiusa
#247 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@srikar-naidu ci sta già lavorando.

Dal 21/10/2026.

  • #293 di @srikar-naidu — integrata

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
express, node.js, sqlite, typescript
Ambito
backend, database

Direzione di ricerca

Read packages/core/src/storage/types.ts and packages/core/src/storage/memory.ts to understand the storage contract and reference behavior, then review packages/core/tests/storage/conformance.test.ts and the store package layout in CONTRIBUTING.md. Implement packages/store-sqlite with all four capabilities and run runStorageConformance on both in-memory and temporary file databases. Done means the listed acceptance checks pass, including persistence after reopening, README, changeset, build, coverage, lint, and publint.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement hacktoberfest help wanted server

ChatCops keeps conversations in memory unless you write your own store, so an Express server on a VPS forgets every chat on restart. SQLite is the easiest fix for that setup: one file, no service to run. Node 22 ships node:sqlite, so there's no native build step either.

This is a bigger one, for someone who has had a few PRs merged here. The interfaces and the tests it has to pass already exist: packages/core/src/storage/types.ts and runStorageConformance from @chatcops/core/testing. CONTRIBUTING.md has a "Writing a store package" section with the package layout.

What to do
Create packages/store-sqlite:

import { sqliteStorage } from '@chatcops/store-sqlite';

storage: sqliteStorage({ path: './chatcops.db' })     // or ':memory:'
storage: sqliteStorage({ database: db })              // an open node:sqlite DatabaseSync or a better-sqlite3 Database
  • All four capabilities: conversations (with append, updateMessage, removeMessage, list, purge), counters, kv (with setIfAbsent) and events (with query).
  • Tables: chatcops_conversations (id, metadata JSON, version, created_at, updated_at), chatcops_messages (conversation_id, seq, id, the message as JSON, primary key on conversation_id and seq, unique on conversation_id and id, ON DELETE CASCADE), chatcops_counters, chatcops_kv, chatcops_events. Times are integer milliseconds. Create them on first use (CREATE TABLE IF NOT EXISTS) and record a schema version in a small chatcops_meta table so later releases can migrate. Turn on PRAGMA foreign_keys = ON.
  • append runs in one transaction (BEGIN IMMEDIATE) that checks expectedVersion, inserts the messages with the next seq values and bumps the version. Throw ConflictError from @chatcops/core on a mismatch.
  • Counters: one INSERT ... ON CONFLICT DO UPDATE ... RETURNING that starts over when the stored row has expired.
  • Expired kv and counter rows count as missing when read. purge deletes old conversations, and their messages go with them through the cascade.
  • node:sqlite is the default. Accept a better-sqlite3 Database too, through a tiny shim over the few methods you use (prepare, run, get, all, exec). Don't add better-sqlite3 as a dependency; use it only in a test if you want to cover the shim.
  • "engines": { "node": ">=22.13" }. That's the first Node 22 with node:sqlite unflagged.
  • "private": true in package.json. A maintainer publishes it for the first time.

Where to look

  • packages/core/src/storage/types.ts and packages/core/src/storage/memory.ts (the reference implementation)
  • packages/core/tests/storage/conformance.test.ts (how the suite is called)
  • node:sqlite docs

Acceptance criteria

  • runStorageConformance('sqlite', ...) passes with nothing skipped, on a :memory: database and on a temp file
  • Data survives closing and reopening a file database
  • A short README with the setup for Express
  • Changeset for @chatcops/store-sqlite (minor)
  • pnpm -r build, pnpm test:coverage (90% lines, 80% branches for store packages), pnpm lint and pnpm publint pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

Lingua principale
TypeScript
Stelle
13
Fork
7
Merge medio
3h 33m
PR unite (30g)
176

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/chatcops

Tutte le issue di codercops/chatcops

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.