Create @chatcops/store-sqlite, a store for single-server setups
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- express, node.js, sqlite, typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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(withappend,updateMessage,removeMessage,list,purge),counters,kv(withsetIfAbsent) andevents(withquery). - 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 smallchatcops_metatable so later releases can migrate. Turn onPRAGMA foreign_keys = ON. appendruns in one transaction (BEGIN IMMEDIATE) that checksexpectedVersion, inserts the messages with the nextseqvalues and bumps the version. ThrowConflictErrorfrom@chatcops/coreon a mismatch.- Counters: one
INSERT ... ON CONFLICT DO UPDATE ... RETURNINGthat starts over when the stored row has expired. - Expired kv and counter rows count as missing when read.
purgedeletes old conversations, and their messages go with them through the cascade. node:sqliteis the default. Accept a better-sqlite3Databasetoo, 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 withnode:sqliteunflagged."private": trueinpackage.json. A maintainer publishes it for the first time.
Where to look
packages/core/src/storage/types.tsandpackages/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 lintandpnpm publintpass
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.
- Langage dominant
- TypeScript
- Étoiles
- 13
- Forks
- 7
- Merge moyen
- 4 h 11 min
- PR mergées (30 j)
- 122
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de codercops/chatcops
-
enhancement hacktoberfest help wanted server
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Document the pre-chat formPeut-être pris @masyarakatai l’a pris il y a 5 jours. Ouvertedocumentation good first issue hacktoberfest widget
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
codercops/chatcops#70 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement hacktoberfest help wanted server
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
Les mainteneurs répondent en général sous 1 jour
-
Create @chatcops/store-redis for Upstash and other Redis clientsPeut-être pris @bhushan4work l’a pris il y a 1 jour. Ouverteenhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
core enhancement hacktoberfest help wanted
Difficulté 3/5 1-2 jours Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de codercops/chatcops
Issues similaires
-
ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
xavxyz/bei-shan-lin-shui#57 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG] rag: sentence content can cross the reported sentence boundariesPeut-être pris @LJK-ikun l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
bug needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
platformatic/mcp#361 ·
Les mainteneurs répondent en général sous 1 jour
-
最近文档这个弹窗,左右宽度没有最小宽度限制Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
siyuan-note/siyuan#20799 · 7 commentaires ·
Les mainteneurs répondent en général sous 1 jour