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 +0 -0
- package/README.md +0 -0
- package/dist/commands/init.js +38 -13
- package/dist/index.js +0 -0
- package/package.json +1 -1
- package/templates/.ai/active-context.md +0 -0
- package/templates/.ai/architecture.md +0 -0
- package/templates/.ai/roadmap.md +0 -0
- package/templates/.ai/rules.md +0 -0
- package/templates/.ai/story.md +0 -0
- package/templates/.cursor/rules/context-bank.mdc +14 -0
- package/templates/.cursorrules +0 -0
- package/templates/.github/copilot-instructions.md +0 -0
- package/templates/.windsurf/rules/context-bank.md +7 -0
- package/templates/.windsurfrules +0 -0
- package/templates/CONVENTIONS.md +0 -0
- package/templates/GEMINI.md +6 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/commands/init.js
CHANGED
|
@@ -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
|
-
|
|
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
|
File without changes
|
|
File without changes
|
package/templates/.ai/roadmap.md
CHANGED
|
File without changes
|
package/templates/.ai/rules.md
CHANGED
|
File without changes
|
package/templates/.ai/story.md
CHANGED
|
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`**.
|
package/templates/.cursorrules
CHANGED
|
File without changes
|
|
File without changes
|
package/templates/.windsurfrules
CHANGED
|
File without changes
|
package/templates/CONVENTIONS.md
CHANGED
|
File without changes
|