@chaim-tools/chaim 0.1.5 → 0.1.7
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/README.md +406 -117
- package/dist/commands/bump.d.ts +10 -0
- package/dist/commands/bump.d.ts.map +1 -0
- package/dist/commands/bump.js +90 -0
- package/dist/commands/bump.js.map +1 -0
- package/dist/commands/context.d.ts +19 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +368 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/types/snapshot-payload.d.ts +1 -1
- package/package.json +9 -8
- package/shared/scripts/setup.sh +20 -26
- package/shared/templates/CHAIM_AGENT_CONTEXT.md +666 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.bumpCommand = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const fs = __importStar(require("fs"));
|
|
32
|
+
const path = __importStar(require("path"));
|
|
33
|
+
/**
|
|
34
|
+
* Increment the schemaVersion in a .bprint file.
|
|
35
|
+
*
|
|
36
|
+
* Default is a minor bump (e.g., 1.3 -> 1.4).
|
|
37
|
+
* With --major, performs a major bump (e.g., 1.3 -> 2.0).
|
|
38
|
+
*/
|
|
39
|
+
async function bumpCommand(schemaFile, options) {
|
|
40
|
+
try {
|
|
41
|
+
const resolvedPath = path.resolve(schemaFile);
|
|
42
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
43
|
+
console.error(chalk_1.default.red(`Error: File not found: ${schemaFile}`));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
if (!schemaFile.endsWith('.bprint')) {
|
|
47
|
+
console.error(chalk_1.default.red('Error: File must have a .bprint extension'));
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
const content = fs.readFileSync(resolvedPath, 'utf-8');
|
|
51
|
+
let schema;
|
|
52
|
+
try {
|
|
53
|
+
schema = JSON.parse(content);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
console.error(chalk_1.default.red('Error: File is not valid JSON'));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
const currentVersion = schema.schemaVersion;
|
|
60
|
+
if (!currentVersion || typeof currentVersion !== 'string') {
|
|
61
|
+
console.error(chalk_1.default.red('Error: File does not contain a valid schemaVersion field'));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
const versionPattern = /^\d+\.\d+$/;
|
|
65
|
+
if (!versionPattern.test(currentVersion)) {
|
|
66
|
+
console.error(chalk_1.default.red(`Error: Current schemaVersion "${currentVersion}" is not in "major.minor" format`));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const [major, minor] = currentVersion.split('.').map(Number);
|
|
70
|
+
let newVersion;
|
|
71
|
+
if (options.major) {
|
|
72
|
+
newVersion = `${major + 1}.0`;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
newVersion = `${major}.${minor + 1}`;
|
|
76
|
+
}
|
|
77
|
+
schema.schemaVersion = newVersion;
|
|
78
|
+
fs.writeFileSync(resolvedPath, JSON.stringify(schema, null, 2) + '\n', 'utf-8');
|
|
79
|
+
const fileName = path.basename(schemaFile);
|
|
80
|
+
const bumpType = options.major ? 'major' : 'minor';
|
|
81
|
+
console.log(chalk_1.default.green(`Bumped ${fileName}: ${currentVersion} -> ${newVersion}`) +
|
|
82
|
+
chalk_1.default.gray(` (${bumpType})`));
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : error);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.bumpCommand = bumpCommand;
|
|
90
|
+
//# sourceMappingURL=bump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bump.js","sourceRoot":"","sources":["../../src/commands/bump.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAE7B;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAC/B,UAAkB,EAClB,OAA4B;IAE5B,IAAI;QACF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,CAAC,EA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
|
+
path: string;
|
|
7
|
+
strategy: 'overwrite' | 'append' | 'reference';
|
|
8
|
+
}
|
|
9
|
+
export interface ContextOptions {
|
|
10
|
+
agent?: string;
|
|
11
|
+
noAuto?: boolean;
|
|
12
|
+
remove?: boolean;
|
|
13
|
+
listAgents?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Main context command handler.
|
|
17
|
+
*/
|
|
18
|
+
export declare function contextCommand(options: ContextOptions): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAChD;AA0ED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAyMD;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2F3E"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.contextCommand = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const fs = __importStar(require("fs"));
|
|
32
|
+
const path = __importStar(require("path"));
|
|
33
|
+
const FENCE_START = '<!-- CHAIM_AGENT_CONTEXT_START - managed by chaim-cli, do not edit -->';
|
|
34
|
+
const FENCE_END = '<!-- CHAIM_AGENT_CONTEXT_END -->';
|
|
35
|
+
const CANONICAL_DIR = '.chaim';
|
|
36
|
+
const CANONICAL_FILE = 'CHAIM_AGENT_CONTEXT.md';
|
|
37
|
+
/**
|
|
38
|
+
* Registry of supported AI agent targets.
|
|
39
|
+
*/
|
|
40
|
+
function getAgentTargets() {
|
|
41
|
+
return {
|
|
42
|
+
cursor: {
|
|
43
|
+
name: 'Cursor',
|
|
44
|
+
key: 'cursor',
|
|
45
|
+
detect: (cwd) => fs.existsSync(path.join(cwd, '.cursor')),
|
|
46
|
+
place: (cwd, content) => {
|
|
47
|
+
const dir = path.join(cwd, '.cursor', 'rules');
|
|
48
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
49
|
+
fs.writeFileSync(path.join(dir, 'chaim.md'), content, 'utf-8');
|
|
50
|
+
},
|
|
51
|
+
path: '.cursor/rules/chaim.md',
|
|
52
|
+
strategy: 'overwrite',
|
|
53
|
+
},
|
|
54
|
+
copilot: {
|
|
55
|
+
name: 'GitHub Copilot',
|
|
56
|
+
key: 'copilot',
|
|
57
|
+
detect: (cwd) => fs.existsSync(path.join(cwd, '.github', 'copilot-instructions.md')),
|
|
58
|
+
place: (cwd, content) => {
|
|
59
|
+
const filePath = path.join(cwd, '.github', 'copilot-instructions.md');
|
|
60
|
+
fs.mkdirSync(path.join(cwd, '.github'), { recursive: true });
|
|
61
|
+
appendFenced(filePath, content);
|
|
62
|
+
},
|
|
63
|
+
path: '.github/copilot-instructions.md',
|
|
64
|
+
strategy: 'append',
|
|
65
|
+
},
|
|
66
|
+
claude: {
|
|
67
|
+
name: 'Claude Code',
|
|
68
|
+
key: 'claude',
|
|
69
|
+
detect: (cwd) => fs.existsSync(path.join(cwd, 'CLAUDE.md')),
|
|
70
|
+
place: (cwd, content) => {
|
|
71
|
+
appendFenced(path.join(cwd, 'CLAUDE.md'), content);
|
|
72
|
+
},
|
|
73
|
+
path: 'CLAUDE.md',
|
|
74
|
+
strategy: 'append',
|
|
75
|
+
},
|
|
76
|
+
windsurf: {
|
|
77
|
+
name: 'Windsurf',
|
|
78
|
+
key: 'windsurf',
|
|
79
|
+
detect: (cwd) => fs.existsSync(path.join(cwd, '.windsurfrules')),
|
|
80
|
+
place: (cwd, content) => {
|
|
81
|
+
appendFenced(path.join(cwd, '.windsurfrules'), content);
|
|
82
|
+
},
|
|
83
|
+
path: '.windsurfrules',
|
|
84
|
+
strategy: 'append',
|
|
85
|
+
},
|
|
86
|
+
aider: {
|
|
87
|
+
name: 'Aider',
|
|
88
|
+
key: 'aider',
|
|
89
|
+
detect: (cwd) => fs.existsSync(path.join(cwd, '.aider.conf.yml')),
|
|
90
|
+
place: (cwd, _content) => {
|
|
91
|
+
addAiderReadOnly(path.join(cwd, '.aider.conf.yml'), `${CANONICAL_DIR}/${CANONICAL_FILE}`);
|
|
92
|
+
},
|
|
93
|
+
path: '.aider.conf.yml (read-only reference)',
|
|
94
|
+
strategy: 'reference',
|
|
95
|
+
},
|
|
96
|
+
generic: {
|
|
97
|
+
name: 'AGENTS.md (cross-tool)',
|
|
98
|
+
key: 'generic',
|
|
99
|
+
detect: () => true,
|
|
100
|
+
place: (cwd, content) => {
|
|
101
|
+
appendFenced(path.join(cwd, 'AGENTS.md'), content);
|
|
102
|
+
},
|
|
103
|
+
path: 'AGENTS.md',
|
|
104
|
+
strategy: 'append',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get the CLI version from package.json.
|
|
110
|
+
*/
|
|
111
|
+
function getCliVersion() {
|
|
112
|
+
try {
|
|
113
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf-8'));
|
|
114
|
+
return pkg.version || '0.0.0';
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return '0.0.0';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Load the bundled agent context template and substitute placeholders.
|
|
122
|
+
*/
|
|
123
|
+
function loadBundledContent() {
|
|
124
|
+
const templatePath = path.join(__dirname, '..', '..', 'shared', 'templates', 'CHAIM_AGENT_CONTEXT.md');
|
|
125
|
+
if (!fs.existsSync(templatePath)) {
|
|
126
|
+
throw new Error(`Bundled template not found at: ${templatePath}`);
|
|
127
|
+
}
|
|
128
|
+
let content = fs.readFileSync(templatePath, 'utf-8');
|
|
129
|
+
content = content.replace('{{CLI_VERSION}}', getCliVersion());
|
|
130
|
+
content = content.replace('{{GENERATED_AT}}', new Date().toISOString().split('T')[0]);
|
|
131
|
+
return content;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Append content inside a managed fenced block. Idempotent — replaces existing block if present.
|
|
135
|
+
*/
|
|
136
|
+
function appendFenced(filePath, content) {
|
|
137
|
+
const fencedBlock = `\n${FENCE_START}\n${content}\n${FENCE_END}\n`;
|
|
138
|
+
if (!fs.existsSync(filePath)) {
|
|
139
|
+
fs.writeFileSync(filePath, fencedBlock.trimStart(), 'utf-8');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let existing = fs.readFileSync(filePath, 'utf-8');
|
|
143
|
+
const startIdx = existing.indexOf(FENCE_START);
|
|
144
|
+
const endIdx = existing.indexOf(FENCE_END);
|
|
145
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
146
|
+
existing = existing.slice(0, startIdx) + existing.slice(endIdx + FENCE_END.length);
|
|
147
|
+
}
|
|
148
|
+
fs.writeFileSync(filePath, existing.trimEnd() + '\n' + fencedBlock, 'utf-8');
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Remove the managed fenced block from a file.
|
|
152
|
+
*/
|
|
153
|
+
function removeFenced(filePath) {
|
|
154
|
+
if (!fs.existsSync(filePath)) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
const existing = fs.readFileSync(filePath, 'utf-8');
|
|
158
|
+
const startIdx = existing.indexOf(FENCE_START);
|
|
159
|
+
const endIdx = existing.indexOf(FENCE_END);
|
|
160
|
+
if (startIdx === -1 || endIdx === -1) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const cleaned = existing.slice(0, startIdx) + existing.slice(endIdx + FENCE_END.length);
|
|
164
|
+
const trimmed = cleaned.trimEnd();
|
|
165
|
+
if (trimmed.length === 0) {
|
|
166
|
+
fs.unlinkSync(filePath);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
fs.writeFileSync(filePath, trimmed + '\n', 'utf-8');
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Add a read-only reference to the Aider config file.
|
|
175
|
+
*/
|
|
176
|
+
function addAiderReadOnly(confPath, contextPath) {
|
|
177
|
+
if (!fs.existsSync(confPath)) {
|
|
178
|
+
fs.writeFileSync(confPath, `# Added by chaim-cli\nread:\n - ${contextPath}\n`, 'utf-8');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const existing = fs.readFileSync(confPath, 'utf-8');
|
|
182
|
+
if (existing.includes(contextPath)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (/^read(?:-only)?:\s*$/m.test(existing)) {
|
|
186
|
+
const updated = existing.replace(/^(read(?:-only)?:\s*\n)/m, `$1 - ${contextPath}\n`);
|
|
187
|
+
fs.writeFileSync(confPath, updated, 'utf-8');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
fs.writeFileSync(confPath, existing.trimEnd() + `\n\nread:\n - ${contextPath}\n`, 'utf-8');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Remove the Aider read-only reference from the config file.
|
|
195
|
+
*/
|
|
196
|
+
function removeAiderReadOnly(confPath, contextPath) {
|
|
197
|
+
if (!fs.existsSync(confPath)) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
const existing = fs.readFileSync(confPath, 'utf-8');
|
|
201
|
+
if (!existing.includes(contextPath)) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
const updated = existing.replace(new RegExp(`\\s*- ${contextPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'g'), '');
|
|
205
|
+
fs.writeFileSync(confPath, updated, 'utf-8');
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* List supported agents and their detection status.
|
|
210
|
+
*/
|
|
211
|
+
function listAgents(cwd) {
|
|
212
|
+
const agents = getAgentTargets();
|
|
213
|
+
console.log(chalk_1.default.cyan('Supported AI agents:'));
|
|
214
|
+
console.log('');
|
|
215
|
+
console.log(chalk_1.default.white(' Agent Status Path'));
|
|
216
|
+
console.log(chalk_1.default.gray(' ───── ────── ────'));
|
|
217
|
+
for (const [key, agent] of Object.entries(agents)) {
|
|
218
|
+
if (key === 'generic')
|
|
219
|
+
continue;
|
|
220
|
+
const detected = agent.detect(cwd);
|
|
221
|
+
const status = detected
|
|
222
|
+
? chalk_1.default.green('detected ')
|
|
223
|
+
: chalk_1.default.gray('not found ');
|
|
224
|
+
const name = key.padEnd(12);
|
|
225
|
+
console.log(` ${chalk_1.default.white(name)}${status}${chalk_1.default.gray(agent.path)}`);
|
|
226
|
+
}
|
|
227
|
+
const genericAgent = agents['generic'];
|
|
228
|
+
console.log(` ${chalk_1.default.white('generic ')}${chalk_1.default.blue('available ')}${chalk_1.default.gray(genericAgent.path)}`);
|
|
229
|
+
console.log('');
|
|
230
|
+
console.log(chalk_1.default.gray('Detected agents will be auto-configured when you run: chaim context'));
|
|
231
|
+
console.log(chalk_1.default.gray('Use --agent <name> to target a specific tool, or --agent all for all.'));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Remove managed Chaim context from all agent locations.
|
|
235
|
+
*/
|
|
236
|
+
function removeContext(cwd) {
|
|
237
|
+
const agents = getAgentTargets();
|
|
238
|
+
let removedCount = 0;
|
|
239
|
+
// Remove canonical file
|
|
240
|
+
const canonicalPath = path.join(cwd, CANONICAL_DIR, CANONICAL_FILE);
|
|
241
|
+
if (fs.existsSync(canonicalPath)) {
|
|
242
|
+
fs.unlinkSync(canonicalPath);
|
|
243
|
+
console.log(chalk_1.default.green(` Removed ${CANONICAL_DIR}/${CANONICAL_FILE}`));
|
|
244
|
+
removedCount++;
|
|
245
|
+
}
|
|
246
|
+
// Remove from each agent target
|
|
247
|
+
for (const [key, agent] of Object.entries(agents)) {
|
|
248
|
+
if (key === 'aider') {
|
|
249
|
+
const confPath = path.join(cwd, '.aider.conf.yml');
|
|
250
|
+
if (removeAiderReadOnly(confPath, `${CANONICAL_DIR}/${CANONICAL_FILE}`)) {
|
|
251
|
+
console.log(chalk_1.default.green(` Removed reference from ${agent.path}`));
|
|
252
|
+
removedCount++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
else if (agent.strategy === 'overwrite') {
|
|
256
|
+
const filePath = path.join(cwd, agent.path);
|
|
257
|
+
if (fs.existsSync(filePath)) {
|
|
258
|
+
fs.unlinkSync(filePath);
|
|
259
|
+
console.log(chalk_1.default.green(` Removed ${agent.path}`));
|
|
260
|
+
removedCount++;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (agent.strategy === 'append') {
|
|
264
|
+
const filePath = path.join(cwd, agent.path);
|
|
265
|
+
if (removeFenced(filePath)) {
|
|
266
|
+
console.log(chalk_1.default.green(` Removed managed block from ${agent.path}`));
|
|
267
|
+
removedCount++;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (removedCount === 0) {
|
|
272
|
+
console.log(chalk_1.default.yellow('No Chaim context files found to remove.'));
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
console.log('');
|
|
276
|
+
console.log(chalk_1.default.green(`Removed Chaim context from ${removedCount} location(s).`));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Main context command handler.
|
|
281
|
+
*/
|
|
282
|
+
async function contextCommand(options) {
|
|
283
|
+
const cwd = process.cwd();
|
|
284
|
+
// --list-agents
|
|
285
|
+
if (options.listAgents) {
|
|
286
|
+
listAgents(cwd);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
// --remove
|
|
290
|
+
if (options.remove) {
|
|
291
|
+
console.log(chalk_1.default.cyan('Removing Chaim agent context...'));
|
|
292
|
+
console.log('');
|
|
293
|
+
removeContext(cwd);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const agents = getAgentTargets();
|
|
297
|
+
// Load content
|
|
298
|
+
let content;
|
|
299
|
+
try {
|
|
300
|
+
content = loadBundledContent();
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : error);
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
console.log(chalk_1.default.cyan('Chaim Agent Context'));
|
|
307
|
+
console.log('');
|
|
308
|
+
// 1. Always write canonical file
|
|
309
|
+
const canonicalDir = path.join(cwd, CANONICAL_DIR);
|
|
310
|
+
fs.mkdirSync(canonicalDir, { recursive: true });
|
|
311
|
+
fs.writeFileSync(path.join(canonicalDir, CANONICAL_FILE), content, 'utf-8');
|
|
312
|
+
console.log(chalk_1.default.green(` ${CANONICAL_DIR}/${CANONICAL_FILE}`));
|
|
313
|
+
// 2. Determine targets
|
|
314
|
+
let targets;
|
|
315
|
+
if (options.agent === 'all') {
|
|
316
|
+
targets = Object.keys(agents);
|
|
317
|
+
}
|
|
318
|
+
else if (options.agent) {
|
|
319
|
+
if (!agents[options.agent]) {
|
|
320
|
+
console.error('');
|
|
321
|
+
console.error(chalk_1.default.red(`Unknown agent: ${options.agent}`));
|
|
322
|
+
console.error(chalk_1.default.gray(`Supported: ${Object.keys(agents).join(', ')}, all`));
|
|
323
|
+
process.exit(1);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
targets = [options.agent];
|
|
327
|
+
}
|
|
328
|
+
else if (options.noAuto) {
|
|
329
|
+
targets = [];
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
// Auto-detect
|
|
333
|
+
targets = Object.entries(agents)
|
|
334
|
+
.filter(([key, a]) => key !== 'generic' && a.detect(cwd))
|
|
335
|
+
.map(([key]) => key);
|
|
336
|
+
if (targets.length > 0) {
|
|
337
|
+
console.log('');
|
|
338
|
+
console.log(chalk_1.default.blue(` Detected: ${targets.map(t => agents[t].name).join(', ')}`));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// 3. Place for each target
|
|
342
|
+
for (const key of targets) {
|
|
343
|
+
const agent = agents[key];
|
|
344
|
+
try {
|
|
345
|
+
agent.place(cwd, content);
|
|
346
|
+
console.log(chalk_1.default.green(` ${agent.path}`) + chalk_1.default.gray(` (${agent.name})`));
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
console.error(chalk_1.default.yellow(` Failed: ${agent.path} — ${error instanceof Error ? error.message : error}`));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// 4. Summary
|
|
353
|
+
const totalLocations = targets.length + 1;
|
|
354
|
+
console.log('');
|
|
355
|
+
console.log(chalk_1.default.white(`Context v${getCliVersion()} written to ${totalLocations} location(s).`));
|
|
356
|
+
if (targets.length === 0) {
|
|
357
|
+
console.log('');
|
|
358
|
+
console.log(chalk_1.default.gray('Tip: Use --agent <name> or --agent all to target your AI tool.'));
|
|
359
|
+
console.log(chalk_1.default.gray(' Run chaim context --list-agents to see supported agents.'));
|
|
360
|
+
}
|
|
361
|
+
// Note about CLAUDE.md case sensitivity
|
|
362
|
+
if (targets.includes('claude')) {
|
|
363
|
+
console.log('');
|
|
364
|
+
console.log(chalk_1.default.gray('Note: Claude expects exactly CLAUDE.md (case-sensitive) in project root.'));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
exports.contextCommand = contextCommand;
|
|
368
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAE7B,MAAM,WAAW,GAAG,wEAAwE,CAAC;AAC7F,MAAM,SAAS,GAAG,k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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC5G;KACF;IAED,aAAa;IACb,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,YAAY,aAAa,EAAE,eAAe,cAAc,eAAe,CAAC,CAAC,CAAC;IAElG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC,CAAC;QAC1F,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC,CAAC;KAC1F;IAED,wCAAwC;IACxC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC,CAAC;KACrG;AACH,CAAC;AA3FD,wCA2FC"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ const validate_1 = require("./commands/validate");
|
|
|
12
12
|
const doctor_1 = require("./commands/doctor");
|
|
13
13
|
const init_1 = require("./commands/init");
|
|
14
14
|
const clean_1 = require("./commands/clean");
|
|
15
|
+
const bump_1 = require("./commands/bump");
|
|
16
|
+
const context_1 = require("./commands/context");
|
|
15
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
16
18
|
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf-8'));
|
|
17
19
|
/**
|
|
@@ -78,6 +80,20 @@ program
|
|
|
78
80
|
.option('--dry-run', 'Show what would be deleted without deleting')
|
|
79
81
|
.option('--verbose', 'Show detailed output')
|
|
80
82
|
.action(clean_1.cleanCommand);
|
|
83
|
+
program
|
|
84
|
+
.command('bump')
|
|
85
|
+
.description('Increment the schemaVersion in a .bprint file')
|
|
86
|
+
.argument('<schemaFile>', '.bprint file to version bump')
|
|
87
|
+
.option('--major', 'Major version bump (X.Y -> X+1.0) instead of minor (X.Y -> X.Y+1)')
|
|
88
|
+
.action(bump_1.bumpCommand);
|
|
89
|
+
program
|
|
90
|
+
.command('context')
|
|
91
|
+
.description('Download AI agent context for using Chaim in your project')
|
|
92
|
+
.option('--agent <name>', 'Target a specific AI tool: cursor, copilot, claude, windsurf, aider, generic, all')
|
|
93
|
+
.option('--no-auto', 'Skip auto-detection; only write canonical .chaim/ file')
|
|
94
|
+
.option('--remove', 'Remove managed Chaim context from all agent locations')
|
|
95
|
+
.option('--list-agents', 'Show supported agents, detection status, and file paths')
|
|
96
|
+
.action(context_1.contextCommand);
|
|
81
97
|
/**
|
|
82
98
|
* ==========================
|
|
83
99
|
* Planned Command Registration
|
|
@@ -107,8 +123,10 @@ if (process.argv.length <= 2) {
|
|
|
107
123
|
console.log(' init - Verify and install all prerequisites');
|
|
108
124
|
console.log(' generate - Generate SDK code from CDK snapshot (default: java)');
|
|
109
125
|
console.log(' validate - Validate a .bprint schema file');
|
|
126
|
+
console.log(' bump - Increment the schemaVersion in a .bprint file');
|
|
110
127
|
console.log(' doctor - Check system environment and dependencies');
|
|
111
128
|
console.log(' clean - Clean snapshot cache (remove old or stale snapshots)');
|
|
129
|
+
console.log(' context - Download AI agent context for using Chaim in your project');
|
|
112
130
|
console.log('');
|
|
113
131
|
console.log('Use \'chaim <command> --help\' for more information');
|
|
114
132
|
process.exit(0);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,2BAAkC;AAClC,+B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AAoD,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -55,7 +55,7 @@ export interface Annotations {
|
|
|
55
55
|
* Schema v1.1 - flattened structure (no nested entity object).
|
|
56
56
|
*/
|
|
57
57
|
export interface SchemaData {
|
|
58
|
-
schemaVersion:
|
|
58
|
+
schemaVersion: string;
|
|
59
59
|
entityName: string;
|
|
60
60
|
description: string;
|
|
61
61
|
primaryKey: PrimaryKey;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaim-tools/chaim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Schema-driven code generation tool for DynamoDB - Pure TypeScript CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"shared/scripts",
|
|
10
|
+
"shared/templates",
|
|
10
11
|
"README.md",
|
|
11
12
|
"LICENSE"
|
|
12
13
|
],
|
|
@@ -18,13 +19,13 @@
|
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
21
|
"build": "npm run build:cli",
|
|
21
|
-
"build:cli": "tsc",
|
|
22
|
+
"build:cli": "npx tsc",
|
|
22
23
|
"setup": "./shared/scripts/setup.sh",
|
|
23
24
|
"clean": "rm -rf dist",
|
|
24
|
-
"test": "vitest",
|
|
25
|
-
"lint": "eslint . --ext .ts",
|
|
26
|
-
"lint:fix": "eslint . --ext .ts --fix",
|
|
27
|
-
"dev": "ts-node src/index.ts",
|
|
25
|
+
"test": "npx vitest",
|
|
26
|
+
"lint": "npx eslint . --ext .ts",
|
|
27
|
+
"lint:fix": "npx eslint . --ext .ts --fix",
|
|
28
|
+
"dev": "npx ts-node src/index.ts",
|
|
28
29
|
"start": "node dist/index.js"
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"homepage": "https://github.com/chaim-tools/chaim-cli#readme",
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@aws-sdk/client-sts": "^3.883.0",
|
|
50
|
-
"@chaim-tools/chaim-bprint-spec": "^0.2.
|
|
51
|
-
"@chaim-tools/client-java": "^0.1.
|
|
51
|
+
"@chaim-tools/chaim-bprint-spec": "^0.2.5",
|
|
52
|
+
"@chaim-tools/client-java": "^0.1.5",
|
|
52
53
|
"chalk": "^4.1.2",
|
|
53
54
|
"commander": "^11.0.0",
|
|
54
55
|
"ora": "^5.4.1"
|