contextgit 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.d.ts +10 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +43 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/commands/branch.d.ts +13 -0
- package/dist/commands/branch.d.ts.map +1 -0
- package/dist/commands/branch.js +52 -0
- package/dist/commands/branch.js.map +1 -0
- package/dist/commands/claim.d.ts +13 -0
- package/dist/commands/claim.d.ts.map +1 -0
- package/dist/commands/claim.js +50 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/commit.d.ts +14 -0
- package/dist/commands/commit.d.ts.map +1 -0
- package/dist/commands/commit.js +71 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/context.d.ts +9 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +38 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/doctor.d.ts +6 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +84 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +126 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/keygen.d.ts +10 -0
- package/dist/commands/keygen.d.ts.map +1 -0
- package/dist/commands/keygen.js +57 -0
- package/dist/commands/keygen.js.map +1 -0
- package/dist/commands/log.d.ts +13 -0
- package/dist/commands/log.d.ts.map +1 -0
- package/dist/commands/log.js +91 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/merge.d.ts +12 -0
- package/dist/commands/merge.d.ts.map +1 -0
- package/dist/commands/merge.js +29 -0
- package/dist/commands/merge.js.map +1 -0
- package/dist/commands/pull.d.ts +10 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +123 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +10 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +141 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/remote-show.d.ts +6 -0
- package/dist/commands/remote-show.d.ts.map +1 -0
- package/dist/commands/remote-show.js +71 -0
- package/dist/commands/remote-show.js.map +1 -0
- package/dist/commands/search.d.ts +11 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +47 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/serve.d.ts +9 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +51 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/set-remote.d.ts +9 -0
- package/dist/commands/set-remote.d.ts.map +1 -0
- package/dist/commands/set-remote.js +26 -0
- package/dist/commands/set-remote.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +54 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/unclaim.d.ts +9 -0
- package/dist/commands/unclaim.d.ts.map +1 -0
- package/dist/commands/unclaim.js +22 -0
- package/dist/commands/unclaim.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +58 -0
- package/dist/config.js.map +1 -0
- package/dist/git-hooks.d.ts +6 -0
- package/dist/git-hooks.d.ts.map +1 -0
- package/dist/git-hooks.js +58 -0
- package/dist/git-hooks.js.map +1 -0
- package/package.json +22 -19
- package/.claude/settings.local.json +0 -41
- package/.contextgit/config.json +0 -10
- package/.contextgit/system-prompt.md +0 -4
- package/.github/workflows/contextgit-ci.yml +0 -40
- package/CLAUDE.md +0 -123
- package/CLAUDE.md.next +0 -65
- package/docs/ContextGit_ARCHITECTURE_v3.md +0 -1141
- package/docs/ContextGit_DELTA.md +0 -84
- package/docs/ContextGit_PHASE1_PLAN.md +0 -177
- package/docs/ContextGit_PHASE2_PLAN.md +0 -535
- package/docs/ContextGit_PRD_v4.md +0 -488
- package/docs/decisions.md +0 -370
- package/packages/api/package.json +0 -25
- package/packages/api/src/bootstrap.ts +0 -64
- package/packages/api/src/config.ts +0 -45
- package/packages/api/src/index.ts +0 -17
- package/packages/api/src/middleware/auth.test.ts +0 -83
- package/packages/api/src/middleware/auth.ts +0 -41
- package/packages/api/src/remote-store.test.ts +0 -301
- package/packages/api/src/router.ts +0 -121
- package/packages/api/src/server-config.ts +0 -34
- package/packages/api/src/server.ts +0 -38
- package/packages/api/src/store-router.ts +0 -241
- package/packages/api/tsconfig.json +0 -8
- package/packages/cli/package.json +0 -29
- package/packages/cli/src/bootstrap.ts +0 -68
- package/packages/cli/src/commands/branch.ts +0 -58
- package/packages/cli/src/commands/claim.ts +0 -58
- package/packages/cli/src/commands/commit.ts +0 -79
- package/packages/cli/src/commands/context.ts +0 -46
- package/packages/cli/src/commands/doctor.ts +0 -99
- package/packages/cli/src/commands/init.ts +0 -141
- package/packages/cli/src/commands/keygen.ts +0 -65
- package/packages/cli/src/commands/log.ts +0 -103
- package/packages/cli/src/commands/merge.ts +0 -36
- package/packages/cli/src/commands/pull.ts +0 -145
- package/packages/cli/src/commands/push.ts +0 -158
- package/packages/cli/src/commands/remote-show.ts +0 -87
- package/packages/cli/src/commands/search.ts +0 -54
- package/packages/cli/src/commands/serve.ts +0 -61
- package/packages/cli/src/commands/set-remote.ts +0 -30
- package/packages/cli/src/commands/status.ts +0 -62
- package/packages/cli/src/commands/unclaim.ts +0 -28
- package/packages/cli/src/config.ts +0 -64
- package/packages/cli/src/git-hooks.ts +0 -61
- package/packages/cli/tsconfig.json +0 -9
- package/packages/core/package.json +0 -28
- package/packages/core/src/embeddings.test.ts +0 -58
- package/packages/core/src/embeddings.ts +0 -75
- package/packages/core/src/engine.ts +0 -274
- package/packages/core/src/index.ts +0 -6
- package/packages/core/src/snapshot.ts +0 -82
- package/packages/core/src/summarizer.test.ts +0 -120
- package/packages/core/src/summarizer.ts +0 -113
- package/packages/core/src/threads.ts +0 -29
- package/packages/core/src/types.ts +0 -240
- package/packages/core/tsconfig.json +0 -9
- package/packages/mcp/package.json +0 -31
- package/packages/mcp/src/auto-snapshot.ts +0 -83
- package/packages/mcp/src/config.ts +0 -53
- package/packages/mcp/src/git-sync.ts +0 -94
- package/packages/mcp/src/index.ts +0 -19
- package/packages/mcp/src/server.ts +0 -377
- package/packages/mcp/tsconfig.json +0 -9
- package/packages/store/package.json +0 -30
- package/packages/store/src/branch-merge.test.ts +0 -127
- package/packages/store/src/engine-integration.test.ts +0 -93
- package/packages/store/src/index.ts +0 -3
- package/packages/store/src/interface.ts +0 -62
- package/packages/store/src/local/claims.test.ts +0 -190
- package/packages/store/src/local/index.ts +0 -380
- package/packages/store/src/local/local-store.test.ts +0 -164
- package/packages/store/src/local/migrations.ts +0 -99
- package/packages/store/src/local/queries.ts +0 -760
- package/packages/store/src/local/schema.ts +0 -157
- package/packages/store/src/remote/index.ts +0 -300
- package/packages/store/tsconfig.json +0 -9
- package/pnpm-workspace.yaml +0 -2
- package/scripts/build.sh +0 -28
- package/tsconfig.base.json +0 -14
- package/vitest.config.ts +0 -15
- /package/{packages/cli/bin → bin}/run.js +0 -0
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(git add:*)",
|
|
5
|
-
"Bash(git commit:*)",
|
|
6
|
-
"Skill(claude-api)",
|
|
7
|
-
"Skill(claude-api:*)",
|
|
8
|
-
"Bash(pnpm typecheck:*)",
|
|
9
|
-
"Bash(pnpm test:*)",
|
|
10
|
-
"Bash(pnpm build:*)",
|
|
11
|
-
"Bash(git push:*)",
|
|
12
|
-
"Read(//private/tmp/**)",
|
|
13
|
-
"Bash(node /Users/mendetrajovski/contextgit/packages/cli/bin/run.js --help)",
|
|
14
|
-
"Bash(node /Users/mendetrajovski/contextgit/packages/cli/bin/run.js commit -m \"First commit\" -c \"Set up the project structure\")",
|
|
15
|
-
"Bash(node /Users/mendetrajovski/contextgit/packages/cli/bin/run.js context)",
|
|
16
|
-
"Bash(pnpm install:*)",
|
|
17
|
-
"Bash(node packages/cli/bin/run.js init)",
|
|
18
|
-
"Bash(node packages/cli/bin/run.js context)",
|
|
19
|
-
"Bash(chmod +x /Users/mendetrajovski/contextgit/scripts/build.sh)",
|
|
20
|
-
"Bash(node packages/cli/bin/run.js context -f agents-md)",
|
|
21
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Gate 2 ralph-loop: iteration 1\" -c \"Running ralph-loop validation gate. Wired RemoteStore into CLI+MCP bootstrap. Added scripts/build.sh. All 32 tests pass.\")",
|
|
22
|
-
"Bash(sed -e 's/@contextgit\\\\//@contextgit\\\\//g' -e 's/ContextGit/ContextGit/g' -e 's/contextgit/contextgit/g' CLAUDE.md)",
|
|
23
|
-
"Bash(mv CLAUDE.md.tmp CLAUDE.md)",
|
|
24
|
-
"Bash(node packages/cli/bin/run.js --help)",
|
|
25
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: Days 14-15 oclif CLI Skeleton \\(2026-03-10\\) #6\" -c \"Built: packages/cli scaffolded \\(package.json, tsconfig.json, bin/run.js\\). config.ts: loadConfig/findConfigPath \\(duplicated from mcp to preserve dep graph\\). bootstrap.ts: shared setup for commit/context commands. commands/init.ts: generates nanoid projectId, creates project+branch, writes .contextgit/config.json, guards against double-init. commands/commit.ts: -m msg -c content -t threads --close ids. commands/context.ts: -f format prints store.getFormattedSnapshot\\(\\). core/types.ts: id? added to ProjectInput. LocalStore.createProject uses input.id ?? nanoid\\(\\). E2E validated in fresh tmp dir. Decided: config.ts duplicated in CLI \\(mcp→cli dep not allowed\\), ProjectInput.id? for init to match DB path key to entity ID, bootstrap\\(\\) shared helper, context command reads directly from store, commit --content defaults to --message. Unresolved: semanticSearch [], context scopes, server.tool\\(\\) deprecated, CLI not installable globally \\(chmod +x\\). Next: Days 16-17 Express REST API \\(POST /commits, GET /snapshot, GET /search\\).\")",
|
|
26
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: Days 18-19 System-Prompt Fragment + AutoSnapshotManager \\(2026-03-10\\) #8\" -c \"Built: CLI init.ts self-heal: when config.json exists but DB empty, reads config, detects git branch, recreates project+branch instead of bailing. CLI init.ts: system-prompt fragment written to .contextgit/system-prompt.md and printed to stdout. AutoSnapshotManager: counts tool calls, fires engine.commit\\({commitType:''auto''}\\) every N=10 non-commit calls, resets on context_commit, swallows failures. mcp/server.ts: AutoSnapshotManager wired, autoSnapshot.onToolCall\\(toolName\\) in each tool handler. Dogfooded: contextgit init on this repo \\(self-heal triggered\\), contextgit commit and context confirmed. Decided: getBranchByGitName as DB health check for self-heal, AutoSnapshotManager counts context_get and context_search toward interval, loadConfig\\(\\) called twice in createServer\\(\\) \\(acceptable\\), commitType:''auto'' for observability. Unresolved: MCP not yet live-validated, server.tool\\(\\) deprecated, loadConfig\\(\\) called twice. Next: Days 20-21 configure Claude Code MCP, EmbeddingService with @xenova/transformers all-MiniLM-L6-v2.\")",
|
|
27
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: Days 22-23 RemoteStore + FTS5 Fix \\(2026-03-11\\) #10\" -c \"Built: packages/api/src/store-router.ts: Express router exposing all 20 ContextStore methods as HTTP at /v1/store/... Float32Array serialized as number[]. packages/store/src/remote/index.ts: RemoteStore implementing ContextStore via fetch against store router, date-parsing helpers, Float32Array serialization. barrel exports updated. 7 integration tests \\(project/branch CRUD, commit retrieval, formatted snapshot identical to LocalStore, open thread round-trip, FTS search, mergeBranch\\). schema.ts: CREATE_FTS_TRIGGER AFTER INSERT ON commits, SCHEMA_V3_DDL. migrations.ts: v3 fts_trigger + FTS rebuild. queries.ts: fullTextSearch JOIN fixed from commits_fts.commit_id to c.rowid = commits_fts.rowid \\(content table rowid join\\). MCP confirmed live: context_get/context_commit/context_search visible in Claude Code — Gate 1 MCP validation PASS. All 32 tests pass. Decided: createStoreRouter separate from createApp \\(project-agnostic\\), integration test in api package, afterAll Promise-based cleanup, FTS5 content table bug fixed \\(rowid join\\), migration v3 trigger covers all INSERT paths. Unresolved: RemoteStore not wired in CLI/MCP bootstrap, server.tool\\(\\) deprecated, loadConfig\\(\\) twice, Gate 2/3 not yet validated. Next: Day 24 wire RemoteStore into CLI/MCP, Gate 2 ralph-loop CLI, Gate 3 REST curl, npx packaging.\")",
|
|
28
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: Day 24 RemoteStore wiring + npx packaging + Phase 1 gates \\(2026-03-11\\) #11\" -c \"Built: packages/cli/src/bootstrap.ts: checks config.store !== ''local'', creates RemoteStore\\(config.store\\) when URL configured. mcp/server.ts: same RemoteStore/LocalStore switch. scripts/build.sh: builds all 5 packages in dep order via pnpm --filter. Root package.json: bin contextgit -> packages/cli/bin/run.js for npx. Gate 2 PASS \\(ralph-loop CLI\\): 3 iterations contextgit context -f agents-md -> contextgit commit, all 4 sections present \\(Project State, Current Branch, Recent Activity, Open Threads\\). Gate 3 PASS \\(REST API\\): GET /snapshot returns Project State, POST /commits returns {id,message,createdAt} 201. All 32 tests pass. Decided: config.store && !== ''local'' guard \\(handles missing field and explicit local\\), root package.json bin entry for npx, scripts/build.sh uses pnpm --filter for explicit ordering, Gate 3 uses flat routes not versioned URLs. Unresolved: server.tool\\(\\) deprecated, loadConfig\\(\\) twice, npx not tested in clean temp dir, Gate 1 formal cold-start not re-run. Next: Days 25-26 npx clean-install validation, Gate 1 formal cold-start.\")",
|
|
29
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: Phase 1 Complete \\(2026-03-11\\)\" -c \"Full Phase 1 complete. Gate 1 MCP PASS, Gate 2 ralph-loop CLI PASS, Gate 3 REST API PASS, npx clean-install PASS. Renamed contexthub -> contextgit, npm name claimed. Slipped to Phase 2: git hooks integration, semantic search e2e validation. Next: Plan Phase 2 — RemoteStore, multi-agent, team support.\")",
|
|
30
|
-
"Bash(node packages/cli/bin/run.js commit -m \"Session: 2026-03-11 Phase 2 Kickoff\" -c \"Planning session only — nothing built. Phase 2 plan written and reviewed. Three updates added: busy_timeout mitigation, atomic pull transaction, doctor check, localhost hosting note. CLAUDE.md updated to point at Phase 2 plan. Remote hosting deferred to Phase 3 \\(Railway/fly.io\\) — localhost sufficient for Phase 2 validation. Plan is locked and ready to build. Next: Start Week 5. Build packages/mcp/src/git-sync.ts \\(captureGitMetadata + installGitHooks\\). Wire gitCommitSha and gitBranch into engine.commit\\(\\) via MCP and CLI. Fix double loadConfig\\(\\) bug in mcp/src/server.ts. Add context_branch and context_merge MCP tools.\")",
|
|
31
|
-
"mcp__contextgit__context_get",
|
|
32
|
-
"mcp__contextgit__context_commit",
|
|
33
|
-
"Bash(pnpm --filter @contextgit/core build)",
|
|
34
|
-
"Bash(git reset:*)",
|
|
35
|
-
"Bash(node packages/cli/dist/commands/remote-show.js --help)",
|
|
36
|
-
"Bash(node packages/cli/bin/run.js serve --help)",
|
|
37
|
-
"Bash(node packages/cli/bin/run.js doctor --help)",
|
|
38
|
-
"Bash(node packages/cli/bin/run.js commit --help)"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
}
|
package/.contextgit/config.json
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
You have access to ContextGit memory tools. At the start of every session, call
|
|
2
|
-
context_get with scope=global to load project state. After completing significant
|
|
3
|
-
work, call context_commit with a message describing what was done and any open
|
|
4
|
-
threads. Use context_branch before exploring risky changes.
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# contextgit-ci.yml — template for capturing CI context into ContextGit.
|
|
2
|
-
#
|
|
3
|
-
# Copy this into your project's .github/workflows/ directory and set the
|
|
4
|
-
# required secrets (see below). Commits are written with agentRole=ci so
|
|
5
|
-
# they can be filtered from agent snapshots using:
|
|
6
|
-
# context_get agent_role=ci (MCP)
|
|
7
|
-
# contextgit log --all (CLI)
|
|
8
|
-
|
|
9
|
-
name: ContextGit CI
|
|
10
|
-
|
|
11
|
-
on: [push, pull_request]
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
capture-context:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
|
|
19
|
-
- uses: actions/setup-node@v4
|
|
20
|
-
with:
|
|
21
|
-
node-version: '20'
|
|
22
|
-
|
|
23
|
-
- name: Install contextgit
|
|
24
|
-
run: npm install -g contextgit
|
|
25
|
-
|
|
26
|
-
- name: Capture CI context
|
|
27
|
-
run: |
|
|
28
|
-
contextgit commit \
|
|
29
|
-
-m "CI run ${{ github.run_number }}: ${{ github.event.head_commit.message }}" \
|
|
30
|
-
--ci-run-id "${{ github.run_id }}" \
|
|
31
|
-
--pipeline "${{ github.workflow }}"
|
|
32
|
-
env:
|
|
33
|
-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
34
|
-
CONTEXTGIT_REMOTE: ${{ secrets.CONTEXTGIT_REMOTE_URL }}
|
|
35
|
-
CONTEXTGIT_API_KEY: ${{ secrets.CONTEXTGIT_API_KEY }}
|
|
36
|
-
|
|
37
|
-
# Required secrets:
|
|
38
|
-
# ANTHROPIC_API_KEY — for the rolling summarizer (Claude Haiku)
|
|
39
|
-
# CONTEXTGIT_REMOTE_URL — URL of your ContextGit API server (from: contextgit serve)
|
|
40
|
-
# CONTEXTGIT_API_KEY — API key (from: contextgit keygen --save)
|
package/CLAUDE.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project
|
|
6
|
-
ContextGit is a persistent memory layer for AI agent workflows — solving the
|
|
7
|
-
"amnesia problem" where agents lose context between sessions.
|
|
8
|
-
|
|
9
|
-
## Repository
|
|
10
|
-
GitHub: https://github.com/MendeTr/contextgit
|
|
11
|
-
Branch: main
|
|
12
|
-
Clone: git clone https://github.com/MendeTr/contextgit
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Session Start (do this every time)
|
|
17
|
-
Call context_get with scope=global immediately.
|
|
18
|
-
Do not read decisions.md. Do not ask questions first.
|
|
19
|
-
Read the snapshot. Then start working.
|
|
20
|
-
Do not ask what to work on. Start the highest priority item from the snapshot.
|
|
21
|
-
If unclear, follow the Phase 2 plan: docs/ContextGit_PHASE2_PLAN.md
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## After EVERY completed task
|
|
25
|
-
git add .
|
|
26
|
-
git commit -m "feat/fix: <what was done>"
|
|
27
|
-
git push
|
|
28
|
-
context_commit "what was built | key decisions | next task"
|
|
29
|
-
|
|
30
|
-
Do not wait to be asked. Every completed task = immediate commit.
|
|
31
|
-
This applies to bug fixes, feature additions, and refactors alike.
|
|
32
|
-
|
|
33
|
-
## Session End (do this every time)
|
|
34
|
-
Call context_commit with:
|
|
35
|
-
- what was built
|
|
36
|
-
- key decisions and why
|
|
37
|
-
- open threads
|
|
38
|
-
- the first concrete task for the next session
|
|
39
|
-
Then: git add . && git commit -m "..." && git push
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Then commit everything:
|
|
43
|
-
```bash
|
|
44
|
-
git add .
|
|
45
|
-
git commit -m ": "
|
|
46
|
-
git push
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Commit Convention
|
|
50
|
-
- `feat:` new functionality
|
|
51
|
-
- `feat(package):` scoped to a package e.g. `feat(core):`
|
|
52
|
-
- `fix:` bug fix
|
|
53
|
-
- `chore:` config, tooling, deps
|
|
54
|
-
- `docs:` documentation only
|
|
55
|
-
- `test:` tests only
|
|
56
|
-
|
|
57
|
-
## Commands
|
|
58
|
-
```bash
|
|
59
|
-
pnpm install # install dependencies
|
|
60
|
-
pnpm build # build all packages
|
|
61
|
-
pnpm test # run all tests
|
|
62
|
-
pnpm test:watch # watch mode
|
|
63
|
-
pnpm typecheck # type check all packages
|
|
64
|
-
|
|
65
|
-
# Single package
|
|
66
|
-
cd packages/store && pnpm test
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Node.js >=20 and pnpm >=9 required.
|
|
70
|
-
|
|
71
|
-
## Architecture
|
|
72
|
-
|
|
73
|
-
Strict dependency graph — no circular deps:
|
|
74
|
-
```
|
|
75
|
-
core → @anthropic-ai/sdk, @xenova/transformers, nanoid
|
|
76
|
-
store → core (types only), better-sqlite3, sqlite-vec
|
|
77
|
-
mcp → core, store, @modelcontextprotocol/sdk, simple-git
|
|
78
|
-
cli → core, store, @oclif/core
|
|
79
|
-
api → core, store, express
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Packages
|
|
83
|
-
- **`@contextgit/core`** — types, engine, summarizer, snapshot formatter, embeddings
|
|
84
|
-
- **`@contextgit/store`** — ContextStore interface + LocalStore (SQLite)
|
|
85
|
-
- **`packages/mcp`** — MCP server (Week 3)
|
|
86
|
-
- **`packages/cli`** — oclif CLI (Week 3)
|
|
87
|
-
- **`packages/api`** — Express REST API (Week 4)
|
|
88
|
-
|
|
89
|
-
### Storage layer (`packages/store/src/local/`)
|
|
90
|
-
| File | Role |
|
|
91
|
-
|------|------|
|
|
92
|
-
| `schema.ts` | DDL — tables, sqlite-vec, FTS5, indexes |
|
|
93
|
-
| `migrations.ts` | Versioned migration runner |
|
|
94
|
-
| `queries.ts` | All prepared statements + row→domain converters |
|
|
95
|
-
| `index.ts` | LocalStore implementing ContextStore |
|
|
96
|
-
|
|
97
|
-
### Key Rules (never break these)
|
|
98
|
-
- TEXT primary keys via `nanoid()` — never auto-increment integers
|
|
99
|
-
- `better-sqlite3` sync API wrapped in `Promise.resolve()` at interface boundary
|
|
100
|
-
- Open threads **never** passed to summarizer — immune to compression guarantee
|
|
101
|
-
- Never fail a COMMIT due to summarizer — graceful fallback always
|
|
102
|
-
- DB path: `~/.contextgit/projects/<projectId>.db` — tests use `:memory:`
|
|
103
|
-
- sqlite-vec loaded via `createRequire` shim — load failure degrades gracefully
|
|
104
|
-
|
|
105
|
-
### Domain Model
|
|
106
|
-
`Project → Branch → Commit` core hierarchy.
|
|
107
|
-
`Thread` tracks open questions scoped to a project.
|
|
108
|
-
`Agent` records active agents per project.
|
|
109
|
-
All types in `packages/core/src/types.ts`.
|
|
110
|
-
|
|
111
|
-
## TypeScript
|
|
112
|
-
All packages extend `tsconfig.base.json`. Target: ES2022, module: NodeNext,
|
|
113
|
-
strict mode, declaration maps, source maps. Output: `./dist` per package.
|
|
114
|
-
|
|
115
|
-
## Tests
|
|
116
|
-
Vitest, in-memory SQLite. Each test file closes DB in `afterEach`.
|
|
117
|
-
Root vitest config collects `packages/*/src/**/*.test.ts`.
|
|
118
|
-
|
|
119
|
-
## Key Docs
|
|
120
|
-
- `docs/decisions.md` — session history (read this first)
|
|
121
|
-
- `docs/ContextGit_PHASE1_PLAN.md` — current build plan
|
|
122
|
-
- `docs/ContextGit_ARCHITECTURE_v3.md` — full architecture
|
|
123
|
-
- `docs/ContextGit_PRD_v4.md` — product requirements
|
package/CLAUDE.md.next
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md — ContextGit Agent Instructions
|
|
2
|
-
|
|
3
|
-
## Session Start (do this every time)
|
|
4
|
-
Call context_get with scope=global immediately.
|
|
5
|
-
Do not read decisions.md. Do not ask questions first.
|
|
6
|
-
Read the snapshot. Then start working.
|
|
7
|
-
Do not ask what to work on. Start the highest priority item from the snapshot.
|
|
8
|
-
If unclear, follow the phase plan: docs/ContextGit_PHASE2_PLAN.md
|
|
9
|
-
If phase plan is complete, check docs/ContextGit_DELTA.md for open deltas.
|
|
10
|
-
|
|
11
|
-
## After EVERY completed task
|
|
12
|
-
git add .
|
|
13
|
-
git commit -m "feat/fix: <what was done>"
|
|
14
|
-
git push
|
|
15
|
-
context_commit "what was built | key decisions | next task"
|
|
16
|
-
|
|
17
|
-
Do not wait to be asked. Every completed task = immediate commit.
|
|
18
|
-
This applies to bug fixes, feature additions, and refactors alike.
|
|
19
|
-
|
|
20
|
-
## When scope changes mid-session
|
|
21
|
-
1. Write a context_commit with replan: prefix immediately:
|
|
22
|
-
`context_commit "replan: <what changed and why. what is new scope. what is no longer in scope>"`
|
|
23
|
-
2. Then build the new scope
|
|
24
|
-
3. Write a normal context_commit when done
|
|
25
|
-
|
|
26
|
-
Do not build first and replan after. Replan commit must come first.
|
|
27
|
-
Other agents are reading the snapshot in real time.
|
|
28
|
-
|
|
29
|
-
## When starting a task
|
|
30
|
-
Before building anything, call:
|
|
31
|
-
contextgit claim "<task name>"
|
|
32
|
-
|
|
33
|
-
This prevents other agents from picking up the same task simultaneously.
|
|
34
|
-
Claims auto-release on your next commit. You do not need to manually unclaim.
|
|
35
|
-
If you abandon a task without committing, call: contextgit unclaim "<task name>"
|
|
36
|
-
|
|
37
|
-
## Claim lifecycle
|
|
38
|
-
proposed → active → released
|
|
39
|
-
|
|
40
|
-
In plan mode: claim is written as proposed.
|
|
41
|
-
On user approval: claim flips to active.
|
|
42
|
-
On commit: claim is auto-released.
|
|
43
|
-
On crash or abandon: claim expires after 2 hours (TTL).
|
|
44
|
-
|
|
45
|
-
## Session End (do this every time)
|
|
46
|
-
Call context_commit with:
|
|
47
|
-
- what was built
|
|
48
|
-
- key decisions and why
|
|
49
|
-
- open threads
|
|
50
|
-
- the first concrete task for the next session
|
|
51
|
-
|
|
52
|
-
Then: git add . && git commit -m "..." && git push
|
|
53
|
-
|
|
54
|
-
## Commit message conventions
|
|
55
|
-
feat: new functionality
|
|
56
|
-
fix: bug fix
|
|
57
|
-
chore: config, tooling, deps
|
|
58
|
-
docs: documentation only
|
|
59
|
-
test: tests only
|
|
60
|
-
replan: scope change (use contextgit replan, not just a commit message)
|
|
61
|
-
|
|
62
|
-
## Key files
|
|
63
|
-
docs/ContextGit_PHASE2_PLAN.md — current phase plan and status
|
|
64
|
-
docs/ContextGit_DELTA.md — scope changes discovered during development
|
|
65
|
-
docs/IDEAS.md — future vision, do not build yet
|