context-bank 0.0.7 → 0.0.9

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/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -40,33 +40,58 @@ export async function initCommand(options) {
40
40
  }
41
41
  s.message("Copying context files...");
42
42
  try {
43
+ // Helper for safe copying/merging
44
+ async function copyOrMerge(src, dest, isAiDir = false) {
45
+ const stats = await fs.stat(src);
46
+ if (stats.isDirectory()) {
47
+ await fs.ensureDir(dest);
48
+ const files = await fs.readdir(src);
49
+ for (const file of files) {
50
+ await copyOrMerge(path.join(src, file), path.join(dest, file), isAiDir || path.basename(src) === ".ai");
51
+ }
52
+ }
53
+ else {
54
+ if (await fs.pathExists(dest)) {
55
+ if (isAiDir) {
56
+ // Skip .ai files if they exist to protect project memory
57
+ return;
58
+ }
59
+ const srcContent = await fs.readFile(src, "utf-8");
60
+ const destContent = await fs.readFile(dest, "utf-8");
61
+ if (!destContent.includes(srcContent.trim())) {
62
+ // Prepend for rules files to ensure priority
63
+ await fs.writeFile(dest, `${srcContent}\n\n${destContent}`);
64
+ }
65
+ }
66
+ else {
67
+ await fs.copy(src, dest);
68
+ // Special handling for new story.md
69
+ if (path.basename(dest) === "story.md" && isAiDir) {
70
+ let storyContent = await fs.readFile(dest, "utf-8");
71
+ storyContent = storyContent.replace("[Auto-filled by init]", new Date().toISOString().split("T")[0]);
72
+ await fs.writeFile(dest, storyContent);
73
+ }
74
+ }
75
+ }
76
+ }
43
77
  // List of files/folders to copy
44
78
  const itemsToCopy = [
45
79
  ".ai",
80
+ ".cursor",
46
81
  ".cursorrules",
82
+ ".windsurf",
47
83
  ".windsurfrules",
48
84
  ".github",
49
85
  "CONVENTIONS.md",
86
+ "GEMINI.md",
50
87
  ];
51
88
  for (const item of itemsToCopy) {
52
89
  const srcPath = path.join(templateDir, item);
53
90
  const destPath = path.join(targetDir, item);
54
91
  if (fs.existsSync(srcPath)) {
55
- if (fs.existsSync(destPath)) {
56
- await fs.copy(srcPath, destPath, { overwrite: true });
57
- }
58
- else {
59
- await fs.copy(srcPath, destPath);
60
- }
92
+ await copyOrMerge(srcPath, destPath);
61
93
  }
62
94
  }
63
- // Special handling for story.md date
64
- const storyPath = path.join(targetDir, ".ai/story.md");
65
- if (fs.existsSync(storyPath)) {
66
- let storyContent = await fs.readFile(storyPath, "utf-8");
67
- storyContent = storyContent.replace("[Auto-filled by init]", new Date().toISOString().split("T")[0]);
68
- await fs.writeFile(storyPath, storyContent);
69
- }
70
95
  // Special handling for README.md
71
96
  const readmePath = path.join(targetDir, "README.md");
72
97
  const aiContextMarker = "<!-- AI-CONTEXT: .ai/rules.md -->";
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-bank",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "A CLI tool to standardise AI context in projects.",
5
5
  "type": "module",
6
6
  "bin": {
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Global project rules and context source of truth
3
+ globs: *
4
+ ---
5
+
6
+ # Context Bank Integration
7
+
8
+ You MUST read and follow the rules defined in **`.ai/rules.md`**.
9
+ This file is the Single Source of Truth for:
10
+ 1. Tech Stack
11
+ 2. Coding Standards
12
+ 3. Architecture
13
+
14
+ Before starting any task, verify the current state in **`.ai/active-context.md`**.
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ # Windsurf Project Rules
2
+
3
+ You MUST read and follow the rules defined in **`.ai/rules.md`**.
4
+ This file is the Single Source of Truth for this project.
5
+
6
+ 1. **Read `.ai/rules.md`** first.
7
+ 2. **Read `.ai/active-context.md`** to understand the current task.
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ # Project Context
2
+
3
+ This project uses Context Bank for AI coordination.
4
+ Always read and follow the instructions in:
5
+ 1. .ai/rules.md (Single Source of Truth)
6
+ 2. .ai/active-context.md (Current Task)