Create @chatcops/store-sqlite, a store for single-server setups
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- express, node.js, sqlite, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 7
- Merge medio
- 4 h 11 min
- PR fusionados (30 d)
- 122
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/chatcops
-
enhancement hacktoberfest help wanted server
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Document the pre-chat formPosiblemente ocupada @masyarakatai la tomó hace 4 días. Abiertodocumentation good first issue hacktoberfest widget
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
codercops/chatcops#70 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
enhancement hacktoberfest help wanted server
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Create @chatcops/store-redis for Upstash and other Redis clientsPosiblemente ocupada @bhushan4work la tomó hoy. Abiertoenhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
core enhancement hacktoberfest help wanted
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
Area/Cloud Needs Triage Type/Bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
wso2/product-integrator#2847 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
bluesky-social/social-app#12118 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
heygen-com/hyperframes#6021 ·
Los mantenedores suelen responder en 1 día
-
Edit: Tele Posadas HDAbiertocheck:passed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día