Create @chatcops/store-sqlite, a store for single-server setups
维护者通常 1 天内回复
评估
- 难度
- 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
- 平均合并
- 3 小时 33 分钟
- 30 天内合并 PR
- 176
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/chatcops 的其他 Issue
-
Add startup checks that catch weak or leaked security settings可能已有人在做 @varun-pahuja 于 2 天前认领。 未关闭enhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Type-check the TypeScript samples in the docs可能已有人在做 @An16og 于 2 天前认领。 未关闭documentation hacktoberfest help wanted testing
难度 4/5 3-5 天 新手友好度 70/100
codercops/chatcops#201 · 7 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
hacktoberfest
难度 1/5 1 小时以内 新手友好度 35/100
维护者通常 1 天内回复
-
Add built-in translations to the widget可能已有人在做 @piyusshhjangid 于 1 天前认领。 未关闭help wanted widget
难度 4/5 3-5 天 新手友好度 52/100
codercops/chatcops#55 · 3 条评论 ·
维护者通常 1 天内回复
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
area:agent-view area:tui bug platform:macos
难度 2/5 1-3 小时 新手友好度 70/100
anthropics/claude-code#104558 ·
维护者通常 1 天内回复
-
updater
难度 2/5 1-3 小时 新手友好度 68/100
UniversityOfHelsinkiCS/oodikone#5141 ·
-
maintanance
难度 2/5 1-3 小时 新手友好度 74/100
inmanta/web-console#7606 ·
维护者通常 1 天内回复
-
bug skills
难度 2/5 1-3 小时 新手友好度 77/100
equinor/fusion-framework#5846 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 74/100