threadbase 0.1.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/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +83 -0
- package/dist/cli.js.map +1 -0
- package/dist/init.d.ts +16 -0
- package/dist/init.js +107 -0
- package/dist/init.js.map +1 -0
- package/dist/templates.d.ts +7 -0
- package/dist/templates.js +271 -0
- package/dist/templates.js.map +1 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ani3198
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Threadbase
|
|
2
|
+
|
|
3
|
+
Threadbase makes the repository itself the memory layer for AI-assisted development.
|
|
4
|
+
|
|
5
|
+
Instead of keeping project context trapped inside one chat thread, one IDE, or one vendor-specific memory system, Threadbase stores it in plain Markdown inside the repo. That means your architecture decisions, recent changes, requirements, and known issues live alongside the code, under version control, where any coding agent can use them.
|
|
6
|
+
|
|
7
|
+
## What Threadbase Is
|
|
8
|
+
|
|
9
|
+
Threadbase is:
|
|
10
|
+
|
|
11
|
+
- repo-native: project memory lives in the repository
|
|
12
|
+
- git-native: memory is stored as normal files and folders that work with commits, diffs, branches, and reviews
|
|
13
|
+
- agent-agnostic: the core memory is plain Markdown, and the tool-specific adapter files all point agents at the same shared context
|
|
14
|
+
- lightweight: no backend, database, daemon, browser UI, or cloud dependency
|
|
15
|
+
|
|
16
|
+
Threadbase is not:
|
|
17
|
+
|
|
18
|
+
- a SaaS memory product
|
|
19
|
+
- a vector database
|
|
20
|
+
- a workflow orchestrator
|
|
21
|
+
- a tool that only works with one coding assistant
|
|
22
|
+
|
|
23
|
+
## Why This Exists
|
|
24
|
+
|
|
25
|
+
Teams repeatedly re-explain the same project context to different agents:
|
|
26
|
+
|
|
27
|
+
- what the architecture looks like
|
|
28
|
+
- what changed recently
|
|
29
|
+
- what constraints matter
|
|
30
|
+
- what issues are still open
|
|
31
|
+
|
|
32
|
+
Threadbase solves that by making those facts durable and versioned inside the codebase itself.
|
|
33
|
+
|
|
34
|
+
## Core Idea
|
|
35
|
+
|
|
36
|
+
Threadbase creates a small `.ai/` directory in a repository.
|
|
37
|
+
|
|
38
|
+
The important rule is simple:
|
|
39
|
+
|
|
40
|
+
- `.ai/memory/*` is the source of truth
|
|
41
|
+
- `.ai/generated/context.md` is derived from that memory
|
|
42
|
+
- adapter files such as `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md` tell different agents to read the same shared context
|
|
43
|
+
|
|
44
|
+
So the memory model is shared, even if the agents are different.
|
|
45
|
+
|
|
46
|
+
## How It Works
|
|
47
|
+
|
|
48
|
+
1. Run `threadbase init` in a repository.
|
|
49
|
+
2. Threadbase creates the shared memory structure in `.ai/` plus agent-specific adapter files.
|
|
50
|
+
3. Before coding, an agent reads `.ai/rules.md` and `.ai/generated/context.md`.
|
|
51
|
+
4. After meaningful work, the agent adds or updates memory entries in `.ai/memory/*`.
|
|
52
|
+
5. When context becomes stale, the agent regenerates `.ai/generated/context.md` from the memory files.
|
|
53
|
+
|
|
54
|
+
This keeps the repo usable across sessions, branches, and different AI tools without changing the underlying memory model.
|
|
55
|
+
|
|
56
|
+
## Supported Agents
|
|
57
|
+
|
|
58
|
+
Threadbase currently generates adapter files for:
|
|
59
|
+
|
|
60
|
+
- Codex via `AGENTS.md`
|
|
61
|
+
- Claude Code via `CLAUDE.md`
|
|
62
|
+
- Gemini CLI / Gemini Code Assist via `GEMINI.md`
|
|
63
|
+
- GitHub Copilot via `.github/copilot-instructions.md`
|
|
64
|
+
- Cursor via `.cursor/rules/threadbase.mdc`
|
|
65
|
+
- Continue via `.continue/rules/threadbase.md`
|
|
66
|
+
- Windsurf via `.windsurf/rules/threadbase.md`
|
|
67
|
+
- Cline via `.clinerules/threadbase.md`
|
|
68
|
+
|
|
69
|
+
These files are adapters, not separate memory systems. They all point back to the same repo-native Threadbase memory.
|
|
70
|
+
|
|
71
|
+
## Install
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install -g threadbase
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then in any repository:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
threadbase init
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If you want the generated Threadbase files to stay local and untracked in your current working tree:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
threadbase init --local
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Until the first npm release is published, local development still uses:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install
|
|
93
|
+
npm run build
|
|
94
|
+
npm link
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Commands
|
|
98
|
+
|
|
99
|
+
Initialize Threadbase in the current repository:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
threadbase init
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Initialize Threadbase and add its generated files to `.gitignore`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
threadbase init --local
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Overwrite only Threadbase-managed starter files:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
threadbase init --force
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`--force` is safe by design:
|
|
118
|
+
|
|
119
|
+
- it rewrites starter templates managed by Threadbase
|
|
120
|
+
- it recreates missing directories
|
|
121
|
+
- it does not delete unknown files
|
|
122
|
+
- it does not rewrite files under `.ai/memory/*`
|
|
123
|
+
|
|
124
|
+
`--local` adds Threadbase-managed paths to `.gitignore`:
|
|
125
|
+
|
|
126
|
+
- `.ai/`
|
|
127
|
+
- `AGENTS.md`
|
|
128
|
+
- `CLAUDE.md`
|
|
129
|
+
- `GEMINI.md`
|
|
130
|
+
- `.cursor/rules/threadbase.mdc`
|
|
131
|
+
- `.github/copilot-instructions.md`
|
|
132
|
+
- `.continue/rules/threadbase.md`
|
|
133
|
+
- `.windsurf/rules/threadbase.md`
|
|
134
|
+
- `.clinerules/threadbase.md`
|
|
135
|
+
|
|
136
|
+
## Generated Structure
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
.ai/
|
|
140
|
+
├── config.yml
|
|
141
|
+
├── generated/
|
|
142
|
+
│ └── context.md
|
|
143
|
+
├── memory/
|
|
144
|
+
│ ├── changes/
|
|
145
|
+
│ ├── decisions/
|
|
146
|
+
│ ├── issues/
|
|
147
|
+
│ └── requirements/
|
|
148
|
+
├── prompts/
|
|
149
|
+
│ └── generate_context.md
|
|
150
|
+
├── rules.md
|
|
151
|
+
└── schema.md
|
|
152
|
+
|
|
153
|
+
AGENTS.md
|
|
154
|
+
CLAUDE.md
|
|
155
|
+
GEMINI.md
|
|
156
|
+
.continue/rules/threadbase.md
|
|
157
|
+
.clinerules/threadbase.md
|
|
158
|
+
.cursor/rules/threadbase.mdc
|
|
159
|
+
.github/copilot-instructions.md
|
|
160
|
+
.windsurf/rules/threadbase.md
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
What matters most in that structure:
|
|
164
|
+
|
|
165
|
+
- `.ai/memory/*` is the authoritative memory layer
|
|
166
|
+
- `.ai/generated/context.md` is a compact generated summary for fast agent onboarding
|
|
167
|
+
- adapter files at the repo root or tool-specific folders help different agents discover the same memory
|
|
168
|
+
|
|
169
|
+
## Example Workflow
|
|
170
|
+
|
|
171
|
+
1. Initialize Threadbase in a repository.
|
|
172
|
+
2. Let your coding agent read `.ai/generated/context.md` before making meaningful changes.
|
|
173
|
+
3. Make code changes.
|
|
174
|
+
4. Record important changes, decisions, requirements, or issues in `.ai/memory/*`.
|
|
175
|
+
5. Regenerate `.ai/generated/context.md` when it becomes stale.
|
|
176
|
+
|
|
177
|
+
See [examples/workflow.md](/Users/aniketrode/Documents/Threadbase/threadbase/examples/workflow.md) for a simple end-to-end example.
|
|
178
|
+
See [examples/sample-repo](/Users/aniketrode/Documents/Threadbase/threadbase/examples/sample-repo) for a sample initialized repository snapshot.
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npm run check
|
|
184
|
+
npm run build
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Publishing
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm login
|
|
191
|
+
npm whoami
|
|
192
|
+
npm publish
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`prepublishOnly` runs typecheck and build before publish so the npm package includes the compiled CLI.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { runInit } from "./init.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = args[0];
|
|
7
|
+
const force = args.includes("--force");
|
|
8
|
+
const local = args.includes("--local");
|
|
9
|
+
const help = args.includes("--help") || args.includes("-h");
|
|
10
|
+
if (help || !command) {
|
|
11
|
+
printHelp();
|
|
12
|
+
process.exit(help ? 0 : 1);
|
|
13
|
+
}
|
|
14
|
+
if (command !== "init") {
|
|
15
|
+
console.error(`Unknown command: ${command}`);
|
|
16
|
+
printHelp();
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
const result = await runInit({
|
|
20
|
+
cwd: process.cwd(),
|
|
21
|
+
force,
|
|
22
|
+
local
|
|
23
|
+
});
|
|
24
|
+
console.log("Threadbase initialized.");
|
|
25
|
+
console.log(`Directories ensured: ${result.directoriesEnsured.length}`);
|
|
26
|
+
console.log(`Files created: ${result.created.length}`);
|
|
27
|
+
console.log(`Files overwritten: ${result.overwritten.length}`);
|
|
28
|
+
console.log(`Files skipped: ${result.skipped.length}`);
|
|
29
|
+
if (local) {
|
|
30
|
+
console.log(`.gitignore created: ${result.gitignoreCreated ? "yes" : "no"}`);
|
|
31
|
+
console.log(`.gitignore updated: ${result.gitignoreUpdated ? "yes" : "no"}`);
|
|
32
|
+
console.log(`.gitignore entries added: ${result.gitignoreEntriesAdded.length}`);
|
|
33
|
+
}
|
|
34
|
+
if (result.created.length > 0) {
|
|
35
|
+
console.log("");
|
|
36
|
+
console.log("Created:");
|
|
37
|
+
for (const item of result.created) {
|
|
38
|
+
console.log(`- ${item}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (result.overwritten.length > 0) {
|
|
42
|
+
console.log("");
|
|
43
|
+
console.log("Overwritten:");
|
|
44
|
+
for (const item of result.overwritten) {
|
|
45
|
+
console.log(`- ${item}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (result.skipped.length > 0) {
|
|
49
|
+
console.log("");
|
|
50
|
+
console.log("Skipped existing files:");
|
|
51
|
+
for (const item of result.skipped) {
|
|
52
|
+
console.log(`- ${item}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (local && result.gitignoreEntriesAdded.length > 0) {
|
|
56
|
+
console.log("");
|
|
57
|
+
console.log("Added to .gitignore:");
|
|
58
|
+
for (const item of result.gitignoreEntriesAdded) {
|
|
59
|
+
console.log(`- ${item}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function printHelp() {
|
|
64
|
+
console.log(`Threadbase
|
|
65
|
+
|
|
66
|
+
Usage:
|
|
67
|
+
threadbase init [--force] [--local]
|
|
68
|
+
|
|
69
|
+
Commands:
|
|
70
|
+
init Create the Threadbase repository structure in the current directory
|
|
71
|
+
|
|
72
|
+
Options:
|
|
73
|
+
--force Overwrite Threadbase-managed starter files
|
|
74
|
+
--local Add Threadbase-managed paths to .gitignore
|
|
75
|
+
-h, --help Show help
|
|
76
|
+
`);
|
|
77
|
+
}
|
|
78
|
+
main().catch((error) => {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
console.error(`threadbase failed: ${message}`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,G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3B,CAAC;IACH,CAAC;IAED,IAAI,KAAK,IAAI,MAAM,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;CAYb,CAAC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type InitResult = {
|
|
2
|
+
created: string[];
|
|
3
|
+
overwritten: string[];
|
|
4
|
+
skipped: string[];
|
|
5
|
+
directoriesEnsured: string[];
|
|
6
|
+
gitignoreCreated: boolean;
|
|
7
|
+
gitignoreUpdated: boolean;
|
|
8
|
+
gitignoreEntriesAdded: string[];
|
|
9
|
+
};
|
|
10
|
+
type InitOptions = {
|
|
11
|
+
cwd: string;
|
|
12
|
+
force: boolean;
|
|
13
|
+
local: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function runInit(options: InitOptions): Promise<InitResult>;
|
|
16
|
+
export {};
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { localIgnoreEntries, managedTemplates, memoryDirectories } from "./templates.js";
|
|
4
|
+
export async function runInit(options) {
|
|
5
|
+
const directoriesEnsured = [
|
|
6
|
+
".ai",
|
|
7
|
+
".ai/prompts",
|
|
8
|
+
".ai/generated",
|
|
9
|
+
".ai/memory",
|
|
10
|
+
".continue",
|
|
11
|
+
".continue/rules",
|
|
12
|
+
".cursor",
|
|
13
|
+
".cursor/rules",
|
|
14
|
+
".github",
|
|
15
|
+
".windsurf",
|
|
16
|
+
".windsurf/rules",
|
|
17
|
+
".clinerules",
|
|
18
|
+
...memoryDirectories
|
|
19
|
+
];
|
|
20
|
+
for (const relativeDir of directoriesEnsured) {
|
|
21
|
+
await mkdir(path.join(options.cwd, relativeDir), { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
const result = {
|
|
24
|
+
created: [],
|
|
25
|
+
overwritten: [],
|
|
26
|
+
skipped: [],
|
|
27
|
+
directoriesEnsured,
|
|
28
|
+
gitignoreCreated: false,
|
|
29
|
+
gitignoreUpdated: false,
|
|
30
|
+
gitignoreEntriesAdded: []
|
|
31
|
+
};
|
|
32
|
+
for (const template of managedTemplates) {
|
|
33
|
+
const targetPath = path.join(options.cwd, template.path);
|
|
34
|
+
const existingContents = await tryReadFile(targetPath);
|
|
35
|
+
if (existingContents !== null && !options.force) {
|
|
36
|
+
result.skipped.push(template.path);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
await writeFile(targetPath, template.contents, "utf8");
|
|
40
|
+
if (existingContents === null) {
|
|
41
|
+
result.created.push(template.path);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result.overwritten.push(template.path);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (options.local) {
|
|
48
|
+
const gitignoreUpdate = await ensureLocalGitignore(options.cwd);
|
|
49
|
+
result.gitignoreCreated = gitignoreUpdate.created;
|
|
50
|
+
result.gitignoreUpdated = gitignoreUpdate.updated;
|
|
51
|
+
result.gitignoreEntriesAdded = gitignoreUpdate.entriesAdded;
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
async function ensureLocalGitignore(cwd) {
|
|
56
|
+
const gitignorePath = path.join(cwd, ".gitignore");
|
|
57
|
+
const existingContents = await tryReadFile(gitignorePath);
|
|
58
|
+
const normalized = existingContents ?? "";
|
|
59
|
+
const entriesAdded = localIgnoreEntries.filter((entry) => !hasGitignoreEntry(normalized, entry));
|
|
60
|
+
if (existingContents === null) {
|
|
61
|
+
await writeFile(gitignorePath, buildLocalGitignoreBlock(localIgnoreEntries), "utf8");
|
|
62
|
+
return {
|
|
63
|
+
created: true,
|
|
64
|
+
updated: true,
|
|
65
|
+
entriesAdded: [...localIgnoreEntries]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (entriesAdded.length === 0) {
|
|
69
|
+
return {
|
|
70
|
+
created: false,
|
|
71
|
+
updated: false,
|
|
72
|
+
entriesAdded: []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const prefix = normalized.endsWith("\n") || normalized.length === 0 ? normalized : `${normalized}\n`;
|
|
76
|
+
const block = buildLocalGitignoreBlock(entriesAdded);
|
|
77
|
+
await writeFile(gitignorePath, `${prefix}${block}`, "utf8");
|
|
78
|
+
return {
|
|
79
|
+
created: false,
|
|
80
|
+
updated: true,
|
|
81
|
+
entriesAdded
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function hasGitignoreEntry(contents, entry) {
|
|
85
|
+
const lines = contents.split(/\r?\n/).map((line) => line.trim());
|
|
86
|
+
return lines.includes(entry);
|
|
87
|
+
}
|
|
88
|
+
function buildLocalGitignoreBlock(entries) {
|
|
89
|
+
return [
|
|
90
|
+
"# Threadbase local mode",
|
|
91
|
+
...entries,
|
|
92
|
+
""
|
|
93
|
+
].join("\n");
|
|
94
|
+
}
|
|
95
|
+
async function tryReadFile(filePath) {
|
|
96
|
+
try {
|
|
97
|
+
return await readFile(filePath, "utf8");
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const code = error.code;
|
|
101
|
+
if (code === "ENOENT") {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAkBxB,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAoB;IAChD,MAAM,kBAAkB,GAAG;QACzB,KAAK;QACL,aAAa;QACb,eAAe;QACf,YAAY;QACZ,WAAW;QACX,iBAAiB;QACjB,SAAS;QACT,eAAe;QACf,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,GAAG,iBAAiB;KACrB,CAAC;IAEF,KAAK,MAAM,WAAW,IAAI,kBAAkB,EAAE,CAAC;QAC7C,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,MAAM,GAAe;QACzB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,kBAAkB;QAClB,gBAAgB,EAAE,KAAK;QACvB,gBAAgB,EAAE,KAAK;QACvB,qBAAqB,EAAE,EAAE;KAC1B,CAAC;IAEF,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AC,CAAC;AAC/B,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAiB;IACjD,OAAO;QACL,yBAAyB;QACzB,GAAG,OAAO;QACV,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAgB;IACzC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,GAAI,KAA+B,CAAC,IAAI,CAAC;QACnD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
export const localIgnoreEntries = [
|
|
2
|
+
".ai/",
|
|
3
|
+
"AGENTS.md",
|
|
4
|
+
"CLAUDE.md",
|
|
5
|
+
"GEMINI.md",
|
|
6
|
+
".cursor/rules/threadbase.mdc",
|
|
7
|
+
".github/copilot-instructions.md",
|
|
8
|
+
".continue/rules/threadbase.md",
|
|
9
|
+
".windsurf/rules/threadbase.md",
|
|
10
|
+
".clinerules/threadbase.md"
|
|
11
|
+
];
|
|
12
|
+
export const managedTemplates = [
|
|
13
|
+
{
|
|
14
|
+
path: ".ai/rules.md",
|
|
15
|
+
contents: `# Threadbase Rules
|
|
16
|
+
|
|
17
|
+
Read \`.ai/generated/context.md\` before making meaningful code changes.
|
|
18
|
+
|
|
19
|
+
## Expectations
|
|
20
|
+
|
|
21
|
+
- Treat \`.ai/memory/*\` as the source of truth.
|
|
22
|
+
- Update memory after important implementation changes, decisions, or newly discovered issues.
|
|
23
|
+
- Regenerate \`.ai/generated/context.md\` if it is missing, empty, or outdated.
|
|
24
|
+
- Never store secrets, tokens, API keys, or credentials in Threadbase files.
|
|
25
|
+
|
|
26
|
+
## Safety
|
|
27
|
+
|
|
28
|
+
- Keep memory entries small, focused, and append-only.
|
|
29
|
+
- Prefer one markdown file per decision, change, requirement, or issue.
|
|
30
|
+
- Do not manually maintain \`.ai/generated/context.md\`; regenerate it from memory.
|
|
31
|
+
`
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: ".ai/prompts/generate_context.md",
|
|
35
|
+
contents: `# Generate Threadbase Context
|
|
36
|
+
|
|
37
|
+
You are generating \`.ai/generated/context.md\` for this repository.
|
|
38
|
+
|
|
39
|
+
## Goal
|
|
40
|
+
|
|
41
|
+
Create a compact, information-dense project context that helps coding agents get oriented quickly.
|
|
42
|
+
|
|
43
|
+
## Inputs
|
|
44
|
+
|
|
45
|
+
Read all markdown files under:
|
|
46
|
+
|
|
47
|
+
- \`.ai/memory/decisions/\`
|
|
48
|
+
- \`.ai/memory/changes/\`
|
|
49
|
+
- \`.ai/memory/requirements/\`
|
|
50
|
+
- \`.ai/memory/issues/\`
|
|
51
|
+
|
|
52
|
+
Treat those files as the source of truth.
|
|
53
|
+
|
|
54
|
+
## Output Rules
|
|
55
|
+
|
|
56
|
+
- Write to \`.ai/generated/context.md\`.
|
|
57
|
+
- Use YAML frontmatter with:
|
|
58
|
+
- \`generated_at\`
|
|
59
|
+
- \`source_file_count\`
|
|
60
|
+
- Keep the summary concise and architecture-focused.
|
|
61
|
+
- Prefer concrete implementation facts over vague prose.
|
|
62
|
+
- Mention contradictions or open questions plainly.
|
|
63
|
+
|
|
64
|
+
## Required Sections
|
|
65
|
+
|
|
66
|
+
1. Architecture
|
|
67
|
+
2. Current State
|
|
68
|
+
3. Constraints
|
|
69
|
+
4. Recent Changes
|
|
70
|
+
5. Important Decisions
|
|
71
|
+
6. Known Issues
|
|
72
|
+
`
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
path: ".ai/generated/context.md",
|
|
76
|
+
contents: `---
|
|
77
|
+
generated_at: 1970-01-01T00:00:00Z
|
|
78
|
+
source_file_count: 0
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
# Project Context
|
|
82
|
+
|
|
83
|
+
## Architecture
|
|
84
|
+
|
|
85
|
+
Context has not been generated from memory yet.
|
|
86
|
+
|
|
87
|
+
## Current State
|
|
88
|
+
|
|
89
|
+
Threadbase was initialized, but no memory entries exist yet.
|
|
90
|
+
|
|
91
|
+
## Constraints
|
|
92
|
+
|
|
93
|
+
- \`.ai/memory/*\` is the source of truth.
|
|
94
|
+
- This file is derived and can be regenerated at any time.
|
|
95
|
+
|
|
96
|
+
## Recent Changes
|
|
97
|
+
|
|
98
|
+
- Initialized Threadbase structure.
|
|
99
|
+
|
|
100
|
+
## Important Decisions
|
|
101
|
+
|
|
102
|
+
- None recorded yet.
|
|
103
|
+
|
|
104
|
+
## Known Issues
|
|
105
|
+
|
|
106
|
+
- Context should be regenerated after the first real memory entries are added.
|
|
107
|
+
`
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
path: ".ai/schema.md",
|
|
111
|
+
contents: `# Threadbase V1 Schema
|
|
112
|
+
|
|
113
|
+
## Source of Truth
|
|
114
|
+
|
|
115
|
+
- Authoritative project memory lives in \`.ai/memory/*\`.
|
|
116
|
+
- \`.ai/generated/context.md\` is derived and disposable.
|
|
117
|
+
|
|
118
|
+
## Memory Folders
|
|
119
|
+
|
|
120
|
+
- \`.ai/memory/decisions/\`: architectural and product decisions.
|
|
121
|
+
- \`.ai/memory/changes/\`: notable implementation changes.
|
|
122
|
+
- \`.ai/memory/requirements/\`: evolving requirements and constraints.
|
|
123
|
+
- \`.ai/memory/issues/\`: known bugs, risks, and open problems.
|
|
124
|
+
|
|
125
|
+
## File Naming
|
|
126
|
+
|
|
127
|
+
- One memory entry per file.
|
|
128
|
+
- Use: \`YYYYMMDD-HHMM-short-slug.md\`
|
|
129
|
+
|
|
130
|
+
Example:
|
|
131
|
+
|
|
132
|
+
\`20260517-1430-add-init-command.md\`
|
|
133
|
+
|
|
134
|
+
## Required Frontmatter
|
|
135
|
+
|
|
136
|
+
- \`id\`
|
|
137
|
+
- \`type\`
|
|
138
|
+
- \`created_at\`
|
|
139
|
+
- \`summary\`
|
|
140
|
+
|
|
141
|
+
## Minimum Body Structure
|
|
142
|
+
|
|
143
|
+
Every memory entry should include:
|
|
144
|
+
|
|
145
|
+
- \`## Context\`
|
|
146
|
+
- \`## Details\`
|
|
147
|
+
`
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
path: ".ai/config.yml",
|
|
151
|
+
contents: `version: 1
|
|
152
|
+
context_file: .ai/generated/context.md
|
|
153
|
+
memory_root: .ai/memory
|
|
154
|
+
generate_context_prompt: .ai/prompts/generate_context.md
|
|
155
|
+
`
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
path: "AGENTS.md",
|
|
159
|
+
contents: `# Threadbase Agent Instructions
|
|
160
|
+
|
|
161
|
+
Before coding:
|
|
162
|
+
|
|
163
|
+
1. Read \`.ai/rules.md\`
|
|
164
|
+
2. Read \`.ai/generated/context.md\`
|
|
165
|
+
|
|
166
|
+
After coding:
|
|
167
|
+
|
|
168
|
+
1. Update relevant memory files in \`.ai/memory/*\`
|
|
169
|
+
2. Regenerate \`.ai/generated/context.md\` if it is missing, empty, or outdated
|
|
170
|
+
|
|
171
|
+
Never store secrets in Threadbase files.
|
|
172
|
+
`
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
path: "CLAUDE.md",
|
|
176
|
+
contents: `# Threadbase Instructions for Claude Code
|
|
177
|
+
|
|
178
|
+
- Read \`.ai/rules.md\` before starting implementation work.
|
|
179
|
+
- Read \`.ai/generated/context.md\` to understand current architecture and project state.
|
|
180
|
+
- Treat \`.ai/memory/*\` as authoritative.
|
|
181
|
+
- Record meaningful changes, decisions, requirements, and issues in small markdown files.
|
|
182
|
+
- Never store secrets in Threadbase memory.
|
|
183
|
+
`
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
path: "GEMINI.md",
|
|
187
|
+
contents: `# Threadbase Instructions for Gemini CLI
|
|
188
|
+
|
|
189
|
+
- Read \`.ai/rules.md\` and \`.ai/generated/context.md\` before making meaningful code changes.
|
|
190
|
+
- Treat \`.ai/memory/*\` as the authoritative project memory.
|
|
191
|
+
- Record meaningful changes, decisions, requirements, and issues in small markdown files.
|
|
192
|
+
- Regenerate \`.ai/generated/context.md\` if it is missing, empty, or outdated.
|
|
193
|
+
- Never store secrets, tokens, API keys, or credentials in Threadbase files.
|
|
194
|
+
`
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
path: ".cursor/rules/threadbase.mdc",
|
|
198
|
+
contents: `---
|
|
199
|
+
description: Threadbase repository memory workflow
|
|
200
|
+
alwaysApply: true
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
Read \`.ai/rules.md\` and \`.ai/generated/context.md\` before making meaningful changes.
|
|
204
|
+
|
|
205
|
+
Treat \`.ai/memory/*\` as the source of truth.
|
|
206
|
+
|
|
207
|
+
After important work:
|
|
208
|
+
|
|
209
|
+
- update memory
|
|
210
|
+
- regenerate context if missing or outdated
|
|
211
|
+
|
|
212
|
+
Never store secrets in Threadbase files.
|
|
213
|
+
`
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
path: ".github/copilot-instructions.md",
|
|
217
|
+
contents: `# Threadbase Instructions for GitHub Copilot
|
|
218
|
+
|
|
219
|
+
- Read \`.ai/generated/context.md\` before making important changes.
|
|
220
|
+
- Use \`.ai/memory/*\` as the source of truth for decisions, changes, requirements, and issues.
|
|
221
|
+
- Update project memory after meaningful work.
|
|
222
|
+
- Regenerate context from memory when context is missing, empty, or stale.
|
|
223
|
+
- Do not store secrets in Threadbase files.
|
|
224
|
+
`
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
path: ".continue/rules/threadbase.md",
|
|
228
|
+
contents: `# Threadbase Rule
|
|
229
|
+
|
|
230
|
+
- Read \`.ai/generated/context.md\` before making meaningful code changes.
|
|
231
|
+
- Treat \`.ai/memory/*\` as the source of truth for decisions, changes, requirements, and issues.
|
|
232
|
+
- Update Threadbase memory after important implementation work.
|
|
233
|
+
- Regenerate \`.ai/generated/context.md\` when it is missing, empty, or stale.
|
|
234
|
+
- Never store secrets in Threadbase files.
|
|
235
|
+
`
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
path: ".windsurf/rules/threadbase.md",
|
|
239
|
+
contents: `---
|
|
240
|
+
trigger: always_on
|
|
241
|
+
description: Threadbase project memory workflow
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
# Threadbase Rule
|
|
245
|
+
|
|
246
|
+
- Read \`.ai/generated/context.md\` before making meaningful code changes.
|
|
247
|
+
- Treat \`.ai/memory/*\` as the source of truth for decisions, changes, requirements, and issues.
|
|
248
|
+
- Update Threadbase memory after important implementation work.
|
|
249
|
+
- Regenerate \`.ai/generated/context.md\` when it is missing, empty, or stale.
|
|
250
|
+
- Never store secrets in Threadbase files.
|
|
251
|
+
`
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
path: ".clinerules/threadbase.md",
|
|
255
|
+
contents: `# Threadbase Rule
|
|
256
|
+
|
|
257
|
+
- Read \`.ai/generated/context.md\` before making meaningful code changes.
|
|
258
|
+
- Treat \`.ai/memory/*\` as the source of truth for decisions, changes, requirements, and issues.
|
|
259
|
+
- Update Threadbase memory after important implementation work.
|
|
260
|
+
- Regenerate \`.ai/generated/context.md\` when it is missing, empty, or stale.
|
|
261
|
+
- Never store secrets in Threadbase files.
|
|
262
|
+
`
|
|
263
|
+
}
|
|
264
|
+
];
|
|
265
|
+
export const memoryDirectories = [
|
|
266
|
+
".ai/memory/decisions",
|
|
267
|
+
".ai/memory/changes",
|
|
268
|
+
".ai/memory/requirements",
|
|
269
|
+
".ai/memory/issues"
|
|
270
|
+
];
|
|
271
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM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AAG;IAC/B,sBAAsB;IACtB,oBAAoB;IACpB,yBAAyB;IACzB,mBAAmB;CACpB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "threadbase",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Repo-native persistent memory for AI-assisted software development.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"threadbase": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.json",
|
|
15
|
+
"check": "tsc --noEmit -p tsconfig.json",
|
|
16
|
+
"prepublishOnly": "npm run check && npm run build",
|
|
17
|
+
"start": "node dist/cli.js",
|
|
18
|
+
"prepare": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ai",
|
|
22
|
+
"cli",
|
|
23
|
+
"developer-tools",
|
|
24
|
+
"memory",
|
|
25
|
+
"threadbase"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^25.8.0",
|
|
32
|
+
"typescript": "^6.0.3"
|
|
33
|
+
}
|
|
34
|
+
}
|