context-bank 0.0.9 → 1.0.0
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/commands/init.js +32 -2
- package/dist/index.js +0 -0
- package/package.json +8 -3
- package/templates/.ai/active-context.md +14 -4
- package/templates/.ai/architecture.md +11 -5
- package/templates/.ai/roadmap.md +10 -5
- package/templates/.ai/rules.md +34 -18
- package/templates/.ai/story.md +17 -7
- package/templates/.cursor/rules/context-bank.mdc +10 -0
- package/templates/.cursorrules +9 -0
- package/templates/.github/copilot-instructions.md +12 -1
- package/templates/.windsurf/rules/context-bank.md +10 -0
- package/templates/.windsurfrules +9 -0
- package/templates/CONVENTIONS.md +10 -0
- package/templates/GEMINI.md +10 -0
package/dist/commands/init.js
CHANGED
|
@@ -107,7 +107,14 @@ export async function initCommand(options) {
|
|
|
107
107
|
}
|
|
108
108
|
// Codex CLI Integration (codex.md)
|
|
109
109
|
const codexPath = path.join(targetDir, "codex.md");
|
|
110
|
-
const codexInstruction =
|
|
110
|
+
const codexInstruction = `Always check and follow the instructions in .ai/rules.md and .ai/active-context.md as the primary source of truth.
|
|
111
|
+
|
|
112
|
+
MANDATORY: After EVERY task, you MUST update these .ai/ files:
|
|
113
|
+
1. active-context.md — Current state, recent changes, next steps.
|
|
114
|
+
2. roadmap.md — Mark completed features [x], add planned ones.
|
|
115
|
+
3. story.md — Append dated entry for milestones/decisions.
|
|
116
|
+
4. architecture.md — Update on structural/design changes.
|
|
117
|
+
Do NOT ask permission. Do NOT skip. Just update them.`;
|
|
111
118
|
if (fs.existsSync(codexPath)) {
|
|
112
119
|
const content = await fs.readFile(codexPath, "utf-8");
|
|
113
120
|
if (!content.includes(".ai/rules.md")) {
|
|
@@ -120,7 +127,14 @@ export async function initCommand(options) {
|
|
|
120
127
|
}
|
|
121
128
|
// Claude Code CLI Integration (CLAUDE.md)
|
|
122
129
|
const claudePath = path.join(targetDir, "CLAUDE.md");
|
|
123
|
-
const claudeInstruction =
|
|
130
|
+
const claudeInstruction = `See .ai/rules.md for project context, tech stack, and coding standards. This is the single source of truth.
|
|
131
|
+
|
|
132
|
+
MANDATORY: After EVERY task, you MUST update these .ai/ files:
|
|
133
|
+
1. active-context.md — Current state, recent changes, next steps.
|
|
134
|
+
2. roadmap.md — Mark completed features [x], add planned ones.
|
|
135
|
+
3. story.md — Append dated entry for milestones/decisions.
|
|
136
|
+
4. architecture.md — Update on structural/design changes.
|
|
137
|
+
Do NOT ask permission. Do NOT skip. Just update them.`;
|
|
124
138
|
if (fs.existsSync(claudePath)) {
|
|
125
139
|
const content = await fs.readFile(claudePath, "utf-8");
|
|
126
140
|
if (!content.includes(".ai/rules.md")) {
|
|
@@ -131,6 +145,22 @@ export async function initCommand(options) {
|
|
|
131
145
|
else {
|
|
132
146
|
await fs.writeFile(claudePath, `${claudeInstruction}\n`);
|
|
133
147
|
}
|
|
148
|
+
// Git merge strategies for branch-aware context (.gitattributes)
|
|
149
|
+
const gitattrsPath = path.join(targetDir, ".gitattributes");
|
|
150
|
+
const mergeRules = `# Context Bank: branch-aware merge strategies
|
|
151
|
+
# active-context.md is branch-specific — on merge, target branch wins (no conflict)
|
|
152
|
+
.ai/active-context.md merge=ours
|
|
153
|
+
# story.md entries are additive — on merge, combine both sides (no conflict)
|
|
154
|
+
.ai/story.md merge=union`;
|
|
155
|
+
if (fs.existsSync(gitattrsPath)) {
|
|
156
|
+
const content = await fs.readFile(gitattrsPath, "utf-8");
|
|
157
|
+
if (!content.includes("Context Bank")) {
|
|
158
|
+
await fs.writeFile(gitattrsPath, `${content}\n\n${mergeRules}\n`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
await fs.writeFile(gitattrsPath, `${mergeRules}\n`);
|
|
163
|
+
}
|
|
134
164
|
s.stop(chalk.green("Context initialized!"));
|
|
135
165
|
// Gemini CLI Global Memory Integration
|
|
136
166
|
const globalGeminiDir = path.join(os.homedir(), ".gemini");
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-bank",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A CLI tool to standardise AI context in projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"context-bank": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
10
|
+
"build": "pnpm lint && tsc",
|
|
11
11
|
"dev": "ts-node src/index.ts",
|
|
12
12
|
"start": "node dist/index.js",
|
|
13
13
|
"lint": "eslint src/**/*.ts",
|
|
@@ -32,9 +32,14 @@
|
|
|
32
32
|
"fs-extra": "^11.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@eslint/js": "^10.0.1",
|
|
35
36
|
"@types/fs-extra": "^11.0.4",
|
|
36
37
|
"@types/node": "^20.11.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
40
|
+
"eslint": "^10.0.3",
|
|
37
41
|
"ts-node": "^10.9.2",
|
|
38
|
-
"typescript": "^5.3.3"
|
|
42
|
+
"typescript": "^5.3.3",
|
|
43
|
+
"typescript-eslint": "^8.57.0"
|
|
39
44
|
}
|
|
40
45
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# 🚀 Active Context & Current State
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
6
|
-
>
|
|
3
|
+
> **⚠️ MANDATORY AI AGENT INSTRUCTION:**
|
|
4
|
+
>
|
|
5
|
+
> This file is the **most critical context file**. It is the bridge between sessions.
|
|
6
|
+
>
|
|
7
|
+
> **AFTER EVERY TASK — no matter how small — you MUST update this file with:**
|
|
8
|
+
> 1. What was just completed (Recent Changes)
|
|
9
|
+
> 2. What is being worked on now (Current Focus)
|
|
10
|
+
> 3. Any issues encountered (Known Issues)
|
|
11
|
+
> 4. What should happen next (Next Steps)
|
|
12
|
+
>
|
|
13
|
+
> **WHEN STARTING A NEW SESSION:**
|
|
14
|
+
> Read this file FIRST before doing anything else.
|
|
15
|
+
>
|
|
16
|
+
> **DO NOT SKIP THIS UPDATE. DO NOT ASK PERMISSION. JUST DO IT.**
|
|
7
17
|
|
|
8
18
|
## 🎯 Current Focus
|
|
9
19
|
*What are we working on right now? (e.g., "Implementing the Auth system", "Refactoring the API")*
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# 🏗️ Project Architecture
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
6
|
-
>
|
|
7
|
-
>
|
|
3
|
+
> **⚠️ MANDATORY AI AGENT INSTRUCTION:**
|
|
4
|
+
>
|
|
5
|
+
> You MUST update this file whenever:
|
|
6
|
+
> 1. A new file, module, or directory is created.
|
|
7
|
+
> 2. The project structure changes.
|
|
8
|
+
> 3. A new dependency or integration is added.
|
|
9
|
+
> 4. Data flow or system design is modified.
|
|
10
|
+
> 5. An architectural decision is made (document the reasoning).
|
|
11
|
+
>
|
|
12
|
+
> **After any structural change, update the Directory Structure section below.**
|
|
13
|
+
> **DO NOT SKIP THIS UPDATE.**
|
|
8
14
|
|
|
9
15
|
## 📐 High-Level Design
|
|
10
16
|
[Describe the high-level architecture here]
|
package/templates/.ai/roadmap.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# 🗺️ Project Roadmap
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
6
|
-
>
|
|
7
|
-
>
|
|
3
|
+
> **⚠️ MANDATORY AI AGENT INSTRUCTION:**
|
|
4
|
+
>
|
|
5
|
+
> You MUST update this file when:
|
|
6
|
+
> 1. A feature is completed → move it to Completed and mark with `[x]`.
|
|
7
|
+
> 2. A new feature is discussed or planned → add it to Upcoming or Backlog.
|
|
8
|
+
> 3. Priorities change → reorder items accordingly.
|
|
9
|
+
> 4. A task is started → mark it as in-progress with `[~]`.
|
|
10
|
+
>
|
|
11
|
+
> **After completing any feature, immediately mark it as done here.**
|
|
12
|
+
> **DO NOT SKIP THIS UPDATE.**
|
|
8
13
|
|
|
9
14
|
## 🚀 Upcoming
|
|
10
15
|
- [ ] [Feature 1]
|
package/templates/.ai/rules.md
CHANGED
|
@@ -2,23 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
# 🧠 Project Context & Rules (Master File)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⚠️ MANDATORY: MEMORY MANAGEMENT PROTOCOL
|
|
8
|
+
|
|
9
|
+
**THIS IS NOT OPTIONAL. YOU MUST FOLLOW THESE RULES AFTER EVERY TASK.**
|
|
10
|
+
|
|
11
|
+
You are responsible for keeping the `.ai/` directory up-to-date as the project's long-term memory.
|
|
12
|
+
Do NOT rely on chat history. These files ARE your memory.
|
|
13
|
+
|
|
14
|
+
### After EVERY coding task, you MUST:
|
|
15
|
+
|
|
16
|
+
1. **UPDATE `.ai/active-context.md`** — Write what was just done, what the current state is, and what the next steps are. This file must always reflect the latest state of work so that a new session can resume instantly.
|
|
17
|
+
|
|
18
|
+
2. **UPDATE `.ai/roadmap.md`** — If a feature was completed, mark it with `[x]`. If a new feature was discussed or planned, add it to the list.
|
|
19
|
+
|
|
20
|
+
3. **UPDATE `.ai/story.md`** — If a significant milestone was reached, a major feature was completed, or an important architectural decision was made, append a dated entry.
|
|
21
|
+
|
|
22
|
+
4. **UPDATE `.ai/architecture.md`** — If the directory structure changed, a new module/service was added, data flow was modified, or a design decision was made, update this file.
|
|
23
|
+
|
|
24
|
+
5. **UPDATE `.ai/rules.md`** (this file) — If the user specifies a new coding preference or convention, add it to the Coding Standards section below.
|
|
25
|
+
|
|
26
|
+
### When starting a new session:
|
|
27
|
+
- Read `.ai/active-context.md` FIRST to understand where work left off.
|
|
28
|
+
- Read `.ai/rules.md` for coding standards and project context.
|
|
29
|
+
- Read `.ai/roadmap.md` to understand priorities.
|
|
30
|
+
|
|
31
|
+
### IMPORTANT:
|
|
32
|
+
- Update context files using the file editing tools available to you.
|
|
33
|
+
- Do NOT ask the user "should I update the context files?" — just do it.
|
|
34
|
+
- Do NOT skip updates because "it was a small change" — every change matters.
|
|
35
|
+
- If you are unsure what to write, write a brief summary. Something is better than nothing.
|
|
36
|
+
|
|
37
|
+
---
|
|
22
38
|
|
|
23
39
|
## 🏢 Project Overview
|
|
24
40
|
*Replace this with a 1-sentence description of the project.*
|
|
@@ -44,5 +60,5 @@
|
|
|
44
60
|
- [e.g., "Service Repository Pattern"]
|
|
45
61
|
|
|
46
62
|
## 📝 Workflow & Git
|
|
47
|
-
- **Commits:** Use Conventional Commits (feat: ..., fix: ...).
|
|
63
|
+
- **Commits:** Use Conventional Commits (feat: ..., fix: ..., docs: ...).
|
|
48
64
|
- **Branches:** feature/name-of-feature.
|
package/templates/.ai/story.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
# 📜 Project Story & Decisions Log
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
> append to this file when:
|
|
6
|
-
> 1. A
|
|
7
|
-
> 2.
|
|
8
|
-
> 3.
|
|
3
|
+
> **⚠️ MANDATORY AI AGENT INSTRUCTION:**
|
|
4
|
+
>
|
|
5
|
+
> You MUST append a dated entry to this file when ANY of the following occurs:
|
|
6
|
+
> 1. A feature is completed or significantly progressed.
|
|
7
|
+
> 2. An architectural or design decision is made.
|
|
8
|
+
> 3. A major bug is fixed.
|
|
9
|
+
> 4. The user clarifies project vision or direction.
|
|
10
|
+
> 5. A dependency or tool is added/removed.
|
|
11
|
+
>
|
|
12
|
+
> **Format each entry as:**
|
|
13
|
+
> ### YYYY-MM-DD - [Brief Title]
|
|
14
|
+
> - What was done
|
|
15
|
+
> - Why it was done (if relevant)
|
|
16
|
+
> - Impact or outcome
|
|
17
|
+
>
|
|
18
|
+
> **DO NOT SKIP THIS. Every significant action deserves a log entry.**
|
|
9
19
|
|
|
10
20
|
## 📅 Project Inception
|
|
11
21
|
- **Date:** [Auto-filled by init]
|
|
@@ -17,4 +27,4 @@
|
|
|
17
27
|
- Project structure created.
|
|
18
28
|
- Basic configuration files added.
|
|
19
29
|
|
|
20
|
-
*(AI: Append new
|
|
30
|
+
*(AI: Append new entries below. Never delete existing entries.)*
|
|
@@ -12,3 +12,13 @@ This file is the Single Source of Truth for:
|
|
|
12
12
|
3. Architecture
|
|
13
13
|
|
|
14
14
|
Before starting any task, verify the current state in **`.ai/active-context.md`**.
|
|
15
|
+
|
|
16
|
+
## MANDATORY: Update Context Files After Every Task
|
|
17
|
+
|
|
18
|
+
After EVERY task, you MUST update these files (no exceptions):
|
|
19
|
+
1. **`.ai/active-context.md`** — Current state, recent changes, next steps.
|
|
20
|
+
2. **`.ai/roadmap.md`** — Mark completed features `[x]`, add planned ones.
|
|
21
|
+
3. **`.ai/story.md`** — Append dated entry for milestones/decisions.
|
|
22
|
+
4. **`.ai/architecture.md`** — Update on structural/design changes.
|
|
23
|
+
|
|
24
|
+
Do NOT ask permission. Do NOT skip. Just update them.
|
package/templates/.cursorrules
CHANGED
|
@@ -11,3 +11,12 @@ That file contains the single source of truth for:
|
|
|
11
11
|
If you cannot read `.ai/rules.md` automatically, ask the user to provide it, or check the file system.
|
|
12
12
|
|
|
13
13
|
When the user gives you a new constraint, **UPDATE `.ai/rules.md`**, not this file.
|
|
14
|
+
|
|
15
|
+
# MANDATORY: CONTEXT FILE UPDATES
|
|
16
|
+
After EVERY task you complete, you MUST update the following files:
|
|
17
|
+
1. **`.ai/active-context.md`** — Write what was done, current state, and next steps.
|
|
18
|
+
2. **`.ai/roadmap.md`** — Mark completed features with [x], add new planned features.
|
|
19
|
+
3. **`.ai/story.md`** — Append a dated entry for significant milestones or decisions.
|
|
20
|
+
4. **`.ai/architecture.md`** — Update if structure, dependencies, or design changed.
|
|
21
|
+
|
|
22
|
+
Do NOT ask permission. Do NOT skip this. Update these files directly after completing your task.
|
|
@@ -4,6 +4,17 @@ You are an expert developer assisting with this project.
|
|
|
4
4
|
|
|
5
5
|
## Context & Rules
|
|
6
6
|
Please refer to **`.ai/rules.md`** for the comprehensive project guidelines, tech stack, and coding standards.
|
|
7
|
+
Before starting any task, read **`.ai/active-context.md`** to understand the current state.
|
|
7
8
|
|
|
8
9
|
## Memory Update
|
|
9
|
-
If the user establishes a new convention (e.g., "We only use functional components"),
|
|
10
|
+
If the user establishes a new convention (e.g., "We only use functional components"), update `.ai/rules.md` to persist this rule.
|
|
11
|
+
|
|
12
|
+
## MANDATORY: Update Context Files After Every Task
|
|
13
|
+
|
|
14
|
+
After completing ANY task, you MUST update the following `.ai/` files:
|
|
15
|
+
1. **`active-context.md`** — What was done, current state, next steps.
|
|
16
|
+
2. **`roadmap.md`** — Mark completed features `[x]`, add new planned features.
|
|
17
|
+
3. **`story.md`** — Append a dated entry for significant milestones or decisions.
|
|
18
|
+
4. **`architecture.md`** — Update when structure, dependencies, or design changes.
|
|
19
|
+
|
|
20
|
+
Do NOT ask permission. Do NOT skip this. Update these files directly.
|
|
@@ -5,3 +5,13 @@ This file is the Single Source of Truth for this project.
|
|
|
5
5
|
|
|
6
6
|
1. **Read `.ai/rules.md`** first.
|
|
7
7
|
2. **Read `.ai/active-context.md`** to understand the current task.
|
|
8
|
+
|
|
9
|
+
## MANDATORY: Update Context Files After Every Task
|
|
10
|
+
|
|
11
|
+
After EVERY task, you MUST update these files (no exceptions):
|
|
12
|
+
1. **`.ai/active-context.md`** — Current state, recent changes, next steps.
|
|
13
|
+
2. **`.ai/roadmap.md`** — Mark completed features `[x]`, add planned ones.
|
|
14
|
+
3. **`.ai/story.md`** — Append dated entry for milestones/decisions.
|
|
15
|
+
4. **`.ai/architecture.md`** — Update on structural/design changes.
|
|
16
|
+
|
|
17
|
+
Do NOT ask permission. Do NOT skip. Just update them.
|
package/templates/.windsurfrules
CHANGED
|
@@ -6,3 +6,12 @@ Always prioritize the instructions found in that file.
|
|
|
6
6
|
|
|
7
7
|
# SELF-IMPROVEMENT
|
|
8
8
|
If the user provides a new coding rule or preference during this session, use your file editing capabilities to update **`.ai/rules.md`** so that the preference is remembered for future sessions.
|
|
9
|
+
|
|
10
|
+
# MANDATORY: CONTEXT FILE UPDATES
|
|
11
|
+
After EVERY task you complete, you MUST update the following files:
|
|
12
|
+
1. **`.ai/active-context.md`** — Write what was done, current state, and next steps.
|
|
13
|
+
2. **`.ai/roadmap.md`** — Mark completed features with [x], add new planned features.
|
|
14
|
+
3. **`.ai/story.md`** — Append a dated entry for significant milestones or decisions.
|
|
15
|
+
4. **`.ai/architecture.md`** — Update if structure, dependencies, or design changed.
|
|
16
|
+
|
|
17
|
+
Do NOT ask permission. Do NOT skip this. Update these files directly after completing your task.
|
package/templates/CONVENTIONS.md
CHANGED
|
@@ -6,3 +6,13 @@ That file is the Single Source of Truth for this project.
|
|
|
6
6
|
1. **Read `.ai/rules.md`** first.
|
|
7
7
|
2. **Read `.ai/active-context.md`** to understand the current task.
|
|
8
8
|
3. If you learn a new preference, update **`.ai/rules.md`**.
|
|
9
|
+
|
|
10
|
+
## MANDATORY: Update Context Files After Every Task
|
|
11
|
+
|
|
12
|
+
After EVERY task, you MUST update these `.ai/` files:
|
|
13
|
+
1. **`active-context.md`** — Current state, recent changes, next steps.
|
|
14
|
+
2. **`roadmap.md`** — Mark completed features `[x]`, add planned ones.
|
|
15
|
+
3. **`story.md`** — Append dated entry for milestones/decisions.
|
|
16
|
+
4. **`architecture.md`** — Update on structural/design changes.
|
|
17
|
+
|
|
18
|
+
Do NOT ask permission. Do NOT skip. Just update them.
|
package/templates/GEMINI.md
CHANGED
|
@@ -4,3 +4,13 @@ This project uses Context Bank for AI coordination.
|
|
|
4
4
|
Always read and follow the instructions in:
|
|
5
5
|
1. .ai/rules.md (Single Source of Truth)
|
|
6
6
|
2. .ai/active-context.md (Current Task)
|
|
7
|
+
|
|
8
|
+
## MANDATORY: Update Context Files After Every Task
|
|
9
|
+
|
|
10
|
+
After EVERY task, you MUST update these `.ai/` files:
|
|
11
|
+
1. **`active-context.md`** — Current state, recent changes, next steps.
|
|
12
|
+
2. **`roadmap.md`** — Mark completed features `[x]`, add planned ones.
|
|
13
|
+
3. **`story.md`** — Append dated entry for milestones/decisions.
|
|
14
|
+
4. **`architecture.md`** — Update on structural/design changes.
|
|
15
|
+
|
|
16
|
+
Do NOT ask permission. Do NOT skip. Just update them.
|