@contextforge/cli 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/dist/index.js +15 -69
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -128,7 +128,7 @@ async function doctorCommand(options = {}) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// src/commands/init.ts
|
|
131
|
-
import {
|
|
131
|
+
import { select } from "@inquirer/prompts";
|
|
132
132
|
import {
|
|
133
133
|
DEFAULT_CORE_PACKS,
|
|
134
134
|
DEFAULT_TOOLS,
|
|
@@ -148,12 +148,6 @@ var TOOL_LABELS = {
|
|
|
148
148
|
cursor: "Cursor",
|
|
149
149
|
copilot: "GitHub Copilot"
|
|
150
150
|
};
|
|
151
|
-
var CAPABILITY_PACKS = [
|
|
152
|
-
"system-design",
|
|
153
|
-
"frontend-system-design",
|
|
154
|
-
"api-design",
|
|
155
|
-
"test-driven-development"
|
|
156
|
-
];
|
|
157
151
|
function canPrompt() {
|
|
158
152
|
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
159
153
|
}
|
|
@@ -161,65 +155,27 @@ async function selectTools() {
|
|
|
161
155
|
if (!canPrompt()) {
|
|
162
156
|
return DEFAULT_TOOLS;
|
|
163
157
|
}
|
|
164
|
-
const selected = await
|
|
158
|
+
const selected = await select({
|
|
165
159
|
message: "Which AI tools should ContextForge configure?",
|
|
166
|
-
required: true,
|
|
167
160
|
choices: [
|
|
168
|
-
{ name: "All agents", value: "all"
|
|
161
|
+
{ name: "All agents", value: "all" },
|
|
169
162
|
...DEFAULT_TOOLS.map((tool) => ({
|
|
170
|
-
name: TOOL_LABELS[tool]
|
|
171
|
-
value: tool
|
|
172
|
-
checked: false
|
|
163
|
+
name: `${TOOL_LABELS[tool]} only`,
|
|
164
|
+
value: tool
|
|
173
165
|
}))
|
|
174
166
|
]
|
|
175
167
|
});
|
|
176
|
-
return selected
|
|
168
|
+
return selected === "all" ? DEFAULT_TOOLS : [selected];
|
|
177
169
|
}
|
|
178
|
-
|
|
170
|
+
function printRecommendedAddCommands(recommended) {
|
|
179
171
|
if (recommended.length === 0) {
|
|
180
|
-
return
|
|
181
|
-
}
|
|
182
|
-
if (!canPrompt()) {
|
|
183
|
-
return [];
|
|
184
|
-
}
|
|
185
|
-
const wantsRecommendations = await confirm({
|
|
186
|
-
message: "Install recommended stack-specific packs?",
|
|
187
|
-
default: true
|
|
188
|
-
});
|
|
189
|
-
if (!wantsRecommendations) {
|
|
190
|
-
return [];
|
|
191
|
-
}
|
|
192
|
-
const selected = await checkbox({
|
|
193
|
-
message: "Select recommended packs to install",
|
|
194
|
-
choices: recommended.map((pack) => ({
|
|
195
|
-
name: `${pack.title} (${pack.name})`,
|
|
196
|
-
value: pack.name,
|
|
197
|
-
description: pack.description,
|
|
198
|
-
checked: true
|
|
199
|
-
}))
|
|
200
|
-
});
|
|
201
|
-
return recommended.filter((pack) => selected.includes(pack.name));
|
|
202
|
-
}
|
|
203
|
-
async function selectCapabilityPacks(registryPacks) {
|
|
204
|
-
if (!canPrompt()) {
|
|
205
|
-
return [];
|
|
172
|
+
return;
|
|
206
173
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return [];
|
|
174
|
+
console.log("");
|
|
175
|
+
console.log(pc3.bold("Recommended packs:"));
|
|
176
|
+
for (const pack of recommended) {
|
|
177
|
+
console.log(`npx @contextforge/cli add ${pack.name}`);
|
|
212
178
|
}
|
|
213
|
-
const selected = await checkbox({
|
|
214
|
-
message: "Add optional architecture or testing packs?",
|
|
215
|
-
choices: available.map((pack) => ({
|
|
216
|
-
name: `${pack.title} (${pack.name})`,
|
|
217
|
-
value: pack.name,
|
|
218
|
-
description: pack.description,
|
|
219
|
-
checked: false
|
|
220
|
-
}))
|
|
221
|
-
});
|
|
222
|
-
return available.filter((pack) => selected.includes(pack.name));
|
|
223
179
|
}
|
|
224
180
|
async function initCommand(options = {}) {
|
|
225
181
|
const root = process.cwd();
|
|
@@ -234,21 +190,10 @@ async function initCommand(options = {}) {
|
|
|
234
190
|
console.log(pc3.yellow(`Mandatory packs missing from registry: ${missingMandatory.join(", ")}`));
|
|
235
191
|
console.log("");
|
|
236
192
|
}
|
|
237
|
-
if (recommended.length > 0) {
|
|
238
|
-
console.log(pc3.bold("Recommended optional packs:"));
|
|
239
|
-
for (const pack of recommended) {
|
|
240
|
-
console.log(`${pc3.green("OK")} ${pack.name}`);
|
|
241
|
-
}
|
|
242
|
-
console.log("");
|
|
243
|
-
}
|
|
244
193
|
const tools = await selectTools();
|
|
245
|
-
const optionalPacks = await selectRecommendedPacks(recommended);
|
|
246
|
-
const capabilityPacks = await selectCapabilityPacks(registry.packs);
|
|
247
194
|
const packNames = [
|
|
248
195
|
.../* @__PURE__ */ new Set([
|
|
249
|
-
...DEFAULT_CORE_PACKS.filter((packName) => registry.packs.some((pack) => pack.name === packName))
|
|
250
|
-
...optionalPacks.map((pack) => pack.name),
|
|
251
|
-
...capabilityPacks.map((pack) => pack.name)
|
|
196
|
+
...DEFAULT_CORE_PACKS.filter((packName) => registry.packs.some((pack) => pack.name === packName))
|
|
252
197
|
])
|
|
253
198
|
];
|
|
254
199
|
for (const packName of packNames) {
|
|
@@ -263,6 +208,7 @@ async function initCommand(options = {}) {
|
|
|
263
208
|
const result = await syncProject(root, initialConfig);
|
|
264
209
|
console.log(pc3.green("ContextForge initialized."));
|
|
265
210
|
console.log(formatGeneratedFiles(result.generatedFiles));
|
|
211
|
+
printRecommendedAddCommands(recommended);
|
|
266
212
|
}
|
|
267
213
|
|
|
268
214
|
// src/commands/list.ts
|
|
@@ -332,7 +278,7 @@ async function syncCommand(options = {}) {
|
|
|
332
278
|
|
|
333
279
|
// src/index.ts
|
|
334
280
|
var program = new Command();
|
|
335
|
-
program.name("contextforge").description("Make existing codebases AI-agent ready").version("0.1.
|
|
281
|
+
program.name("contextforge").description("Make existing codebases AI-agent ready").version("0.1.7");
|
|
336
282
|
program.command("init").description("Initialize AI-agent instructions").option("--registry <url>", "Static remote registry index URL", collectRegistryOption, []).action(initCommand);
|
|
337
283
|
program.command("add").argument("<pack>").description("Add an instruction pack").option("--registry <url>", "Static remote registry index URL", collectRegistryOption, []).option("--force", "Re-download and regenerate even when the pack is already installed").option("--dry-run", "Show what would be installed without writing files").action(addCommand);
|
|
338
284
|
program.command("sync").description("Sync generated AI instruction files").option("--registry <url>", "Static remote registry index URL", collectRegistryOption, []).action(syncCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contextforge/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contextforge": "dist/index.js"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"commander": "^14.0.0",
|
|
14
14
|
"ora": "^8.2.0",
|
|
15
15
|
"picocolors": "^1.1.1",
|
|
16
|
-
"@contextforge/core": "0.1.
|
|
16
|
+
"@contextforge/core": "0.1.7"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsx": "^4.20.0"
|