@contextforge/cli 0.1.5 → 0.1.6
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 +10 -62
- 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 { checkbox
|
|
131
|
+
import { checkbox } 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
|
}
|
|
@@ -175,51 +169,15 @@ async function selectTools() {
|
|
|
175
169
|
});
|
|
176
170
|
return selected.includes("all") ? DEFAULT_TOOLS : selected.filter((tool) => tool !== "all");
|
|
177
171
|
}
|
|
178
|
-
|
|
172
|
+
function printRecommendedAddCommands(recommended) {
|
|
179
173
|
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 [];
|
|
174
|
+
return;
|
|
206
175
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return [];
|
|
176
|
+
console.log("");
|
|
177
|
+
console.log(pc3.bold("Recommended packs:"));
|
|
178
|
+
for (const pack of recommended) {
|
|
179
|
+
console.log(`npx @contextforge/cli add ${pack.name}`);
|
|
212
180
|
}
|
|
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
181
|
}
|
|
224
182
|
async function initCommand(options = {}) {
|
|
225
183
|
const root = process.cwd();
|
|
@@ -234,21 +192,10 @@ async function initCommand(options = {}) {
|
|
|
234
192
|
console.log(pc3.yellow(`Mandatory packs missing from registry: ${missingMandatory.join(", ")}`));
|
|
235
193
|
console.log("");
|
|
236
194
|
}
|
|
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
195
|
const tools = await selectTools();
|
|
245
|
-
const optionalPacks = await selectRecommendedPacks(recommended);
|
|
246
|
-
const capabilityPacks = await selectCapabilityPacks(registry.packs);
|
|
247
196
|
const packNames = [
|
|
248
197
|
.../* @__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)
|
|
198
|
+
...DEFAULT_CORE_PACKS.filter((packName) => registry.packs.some((pack) => pack.name === packName))
|
|
252
199
|
])
|
|
253
200
|
];
|
|
254
201
|
for (const packName of packNames) {
|
|
@@ -263,6 +210,7 @@ async function initCommand(options = {}) {
|
|
|
263
210
|
const result = await syncProject(root, initialConfig);
|
|
264
211
|
console.log(pc3.green("ContextForge initialized."));
|
|
265
212
|
console.log(formatGeneratedFiles(result.generatedFiles));
|
|
213
|
+
printRecommendedAddCommands(recommended);
|
|
266
214
|
}
|
|
267
215
|
|
|
268
216
|
// src/commands/list.ts
|
|
@@ -332,7 +280,7 @@ async function syncCommand(options = {}) {
|
|
|
332
280
|
|
|
333
281
|
// src/index.ts
|
|
334
282
|
var program = new Command();
|
|
335
|
-
program.name("contextforge").description("Make existing codebases AI-agent ready").version("0.1.
|
|
283
|
+
program.name("contextforge").description("Make existing codebases AI-agent ready").version("0.1.6");
|
|
336
284
|
program.command("init").description("Initialize AI-agent instructions").option("--registry <url>", "Static remote registry index URL", collectRegistryOption, []).action(initCommand);
|
|
337
285
|
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
286
|
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.6",
|
|
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.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsx": "^4.20.0"
|