Create @chatcops/store-sqlite, a store for single-server setups
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- express, node.js, sqlite, typescript
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 13
- 分支
- 7
- 平均合併
- 4 小時 11 分鐘
- 30 天內合併 PR
- 122
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codercops/chatcops 的其他 Issue
-
enhancement hacktoberfest help wanted server
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
Document the pre-chat form可能已有人在做 @masyarakatai 於 4 天前認領。 未關閉documentation good first issue hacktoberfest widget
難度 2/5 1-3 小時 新手友好度 88/100
codercops/chatcops#70 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
enhancement hacktoberfest help wanted server
難度 5/5 一週以上 新手友好度 25/100
維護者通常 1 天內回覆
-
Create @chatcops/store-redis for Upstash and other Redis clients可能已有人在做 @bhushan4work 今天認領。 未關閉enhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
core enhancement hacktoberfest help wanted
難度 3/5 1-2 天 新手友好度 78/100
維護者通常 1 天內回覆
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
mobile-next/mobile-mcp#526 ·
維護者通常 1 天內回覆
-
e2e-failure ready-to-code
難度 1/5 1 小時以內 新手友好度 73/100
redhat-developer/rhdh-plugin-export-overlays#4470 · 1 則留言 ·
維護者通常 1 天內回覆