codebase-snapshot 0.9.4 → 0.9.5
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/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/dist/bin.js +190 -102
- package/dist/{chunk-EWZYK3VX.js → chunk-4AHHSNGG.js} +3 -3
- package/dist/{chunk-FCWD4LY7.js → chunk-B336MMNC.js} +188 -99
- package/dist/cli.cjs +190 -102
- package/dist/cli.js +5 -6
- package/dist/index.cjs +186 -97
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +2 -2
- package/docs/cli.md +12 -2
- package/docs/mcp.md +3 -3
- package/package.json +1 -1
|
@@ -5473,7 +5473,7 @@ function validateSnapshot(configInput) {
|
|
|
5473
5473
|
|
|
5474
5474
|
// src/version.ts
|
|
5475
5475
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
5476
|
-
var GENERATOR_VERSION = "0.9.
|
|
5476
|
+
var GENERATOR_VERSION = "0.9.5";
|
|
5477
5477
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
5478
5478
|
function isOurGeneratorName(name) {
|
|
5479
5479
|
if (typeof name !== "string") return false;
|
|
@@ -6049,6 +6049,12 @@ var PromptCancelled = class extends Error {
|
|
|
6049
6049
|
this.name = "PromptCancelled";
|
|
6050
6050
|
}
|
|
6051
6051
|
};
|
|
6052
|
+
var PromptBack = class extends Error {
|
|
6053
|
+
constructor() {
|
|
6054
|
+
super("Prompt back");
|
|
6055
|
+
this.name = "PromptBack";
|
|
6056
|
+
}
|
|
6057
|
+
};
|
|
6052
6058
|
function defaultIO() {
|
|
6053
6059
|
return { input: process.stdin, output: process.stdout };
|
|
6054
6060
|
}
|
|
@@ -6072,35 +6078,40 @@ function choiceLine(choice, active) {
|
|
|
6072
6078
|
const hint = choice.hint ? ` ${choice.hint}` : "";
|
|
6073
6079
|
return ` ${marker(active)} ${choice.label}${hint}`;
|
|
6074
6080
|
}
|
|
6075
|
-
function
|
|
6081
|
+
function listFooter(base, allowBack) {
|
|
6082
|
+
return allowBack ? `${base} \xB7 \u2190 back` : base;
|
|
6083
|
+
}
|
|
6084
|
+
function renderSelect(message, choices, index, allowBack = false) {
|
|
6076
6085
|
const lines = [`\u25C6 ${message}`, ""];
|
|
6077
6086
|
choices.forEach((choice, position) => lines.push(choiceLine(choice, position === index)));
|
|
6078
|
-
lines.push("", "
|
|
6087
|
+
lines.push("", ` ${listFooter("\u2191\u2193 move \xB7 enter select", allowBack)}`);
|
|
6079
6088
|
return lines.join("\n");
|
|
6080
6089
|
}
|
|
6081
|
-
function renderMultiSelect(message, choices, index, selected) {
|
|
6090
|
+
function renderMultiSelect(message, choices, index, selected, allowBack = false) {
|
|
6082
6091
|
const lines = [`\u25C6 ${message}`, ""];
|
|
6083
6092
|
choices.forEach((choice, position) => {
|
|
6084
6093
|
const box = selected.has(position) ? "\u25FC" : "\u25FB";
|
|
6085
6094
|
const hint = choice.hint ? ` ${choice.hint}` : "";
|
|
6086
6095
|
lines.push(` ${marker(position === index)} ${box} ${choice.label}${hint}`);
|
|
6087
6096
|
});
|
|
6088
|
-
lines.push("", "
|
|
6097
|
+
lines.push("", ` ${listFooter("\u2191\u2193 move \xB7 space toggle \xB7 enter confirm", allowBack)}`);
|
|
6089
6098
|
return lines.join("\n");
|
|
6090
6099
|
}
|
|
6091
|
-
function renderConfirm(message, value) {
|
|
6100
|
+
function renderConfirm(message, value, allowBack = false) {
|
|
6101
|
+
const footer = allowBack ? "\u2190\u2192 or y/n \xB7 enter confirm \xB7 b back" : "\u2190\u2192 or y/n \xB7 enter confirm";
|
|
6092
6102
|
return [
|
|
6093
6103
|
`\u25C6 ${message}`,
|
|
6094
6104
|
"",
|
|
6095
6105
|
` ${marker(value)} Yes`,
|
|
6096
6106
|
` ${marker(!value)} No`,
|
|
6097
6107
|
"",
|
|
6098
|
-
|
|
6108
|
+
` ${footer}`
|
|
6099
6109
|
].join("\n");
|
|
6100
6110
|
}
|
|
6101
|
-
function renderText(message, value, error) {
|
|
6111
|
+
function renderText(message, value, error, allowBack = false) {
|
|
6102
6112
|
const lines = [`\u25C6 ${message}`, "", ` ${value || "\u258F"}`];
|
|
6103
6113
|
if (error) lines.push("", ` \u2716 ${error}`);
|
|
6114
|
+
if (allowBack) lines.push("", " enter confirm \xB7 \u2190 back");
|
|
6104
6115
|
return lines.join("\n");
|
|
6105
6116
|
}
|
|
6106
6117
|
function keyReader(input) {
|
|
@@ -6149,14 +6160,18 @@ var Frame = class {
|
|
|
6149
6160
|
function isCancel(key) {
|
|
6150
6161
|
return key.ctrl === true && key.name === "c" || key.ctrl === true && key.name === "d";
|
|
6151
6162
|
}
|
|
6163
|
+
function isListBack(key, allowBack) {
|
|
6164
|
+
return allowBack && (key.name === "left" || key.name === "b");
|
|
6165
|
+
}
|
|
6152
6166
|
async function select(io, message, choices, options = {}) {
|
|
6153
6167
|
if (choices.length === 0) throw new Error("select() requires at least one choice.");
|
|
6168
|
+
const allowBack = options.allowBack === true;
|
|
6154
6169
|
const fallbackIndex = Math.max(
|
|
6155
6170
|
0,
|
|
6156
6171
|
choices.findIndex((choice) => choice.value === options.defaultValue)
|
|
6157
6172
|
);
|
|
6158
6173
|
if (!isInteractive(io)) {
|
|
6159
|
-
io.output.write(`${renderSelect(message, choices, fallbackIndex)}
|
|
6174
|
+
io.output.write(`${renderSelect(message, choices, fallbackIndex, allowBack)}
|
|
6160
6175
|
`);
|
|
6161
6176
|
return choices[fallbackIndex].value;
|
|
6162
6177
|
}
|
|
@@ -6165,9 +6180,10 @@ async function select(io, message, choices, options = {}) {
|
|
|
6165
6180
|
let index = fallbackIndex;
|
|
6166
6181
|
try {
|
|
6167
6182
|
for (; ; ) {
|
|
6168
|
-
frame.draw(renderSelect(message, choices, index));
|
|
6183
|
+
frame.draw(renderSelect(message, choices, index, allowBack));
|
|
6169
6184
|
const key = await reader.next();
|
|
6170
6185
|
if (isCancel(key)) throw new PromptCancelled();
|
|
6186
|
+
if (isListBack(key, allowBack)) throw new PromptBack();
|
|
6171
6187
|
if (key.name === "up") index = moveSelection(index, -1, choices.length);
|
|
6172
6188
|
else if (key.name === "down") index = moveSelection(index, 1, choices.length);
|
|
6173
6189
|
else if (key.name === "return" || key.name === "enter") {
|
|
@@ -6176,18 +6192,22 @@ async function select(io, message, choices, options = {}) {
|
|
|
6176
6192
|
} else if (key.name === "j") index = moveSelection(index, 1, choices.length);
|
|
6177
6193
|
else if (key.name === "k") index = moveSelection(index, -1, choices.length);
|
|
6178
6194
|
}
|
|
6195
|
+
} catch (error) {
|
|
6196
|
+
frame.erase();
|
|
6197
|
+
throw error;
|
|
6179
6198
|
} finally {
|
|
6180
6199
|
reader.close();
|
|
6181
6200
|
}
|
|
6182
6201
|
}
|
|
6183
6202
|
async function multiSelect(io, message, choices, options = {}) {
|
|
6203
|
+
const allowBack = options.allowBack === true;
|
|
6184
6204
|
const selected = /* @__PURE__ */ new Set();
|
|
6185
6205
|
choices.forEach((choice, position) => {
|
|
6186
6206
|
if (options.defaults?.includes(choice.value)) selected.add(position);
|
|
6187
6207
|
});
|
|
6188
6208
|
const result = () => choices.filter((_, position) => selected.has(position)).map((choice) => choice.value);
|
|
6189
6209
|
if (!isInteractive(io)) {
|
|
6190
|
-
io.output.write(`${renderMultiSelect(message, choices, 0, selected)}
|
|
6210
|
+
io.output.write(`${renderMultiSelect(message, choices, 0, selected, allowBack)}
|
|
6191
6211
|
`);
|
|
6192
6212
|
return result();
|
|
6193
6213
|
}
|
|
@@ -6196,9 +6216,10 @@ async function multiSelect(io, message, choices, options = {}) {
|
|
|
6196
6216
|
let index = 0;
|
|
6197
6217
|
try {
|
|
6198
6218
|
for (; ; ) {
|
|
6199
|
-
frame.draw(renderMultiSelect(message, choices, index, selected));
|
|
6219
|
+
frame.draw(renderMultiSelect(message, choices, index, selected, allowBack));
|
|
6200
6220
|
const key = await reader.next();
|
|
6201
6221
|
if (isCancel(key)) throw new PromptCancelled();
|
|
6222
|
+
if (isListBack(key, allowBack)) throw new PromptBack();
|
|
6202
6223
|
if (key.name === "up") index = moveSelection(index, -1, choices.length);
|
|
6203
6224
|
else if (key.name === "down") index = moveSelection(index, 1, choices.length);
|
|
6204
6225
|
else if (key.name === "space") {
|
|
@@ -6213,14 +6234,18 @@ async function multiSelect(io, message, choices, options = {}) {
|
|
|
6213
6234
|
return result();
|
|
6214
6235
|
}
|
|
6215
6236
|
}
|
|
6237
|
+
} catch (error) {
|
|
6238
|
+
frame.erase();
|
|
6239
|
+
throw error;
|
|
6216
6240
|
} finally {
|
|
6217
6241
|
reader.close();
|
|
6218
6242
|
}
|
|
6219
6243
|
}
|
|
6220
6244
|
async function confirm(io, message, options = {}) {
|
|
6245
|
+
const allowBack = options.allowBack === true;
|
|
6221
6246
|
let value = options.defaultValue ?? true;
|
|
6222
6247
|
if (!isInteractive(io)) {
|
|
6223
|
-
io.output.write(`${renderConfirm(message, value)}
|
|
6248
|
+
io.output.write(`${renderConfirm(message, value, allowBack)}
|
|
6224
6249
|
`);
|
|
6225
6250
|
return value;
|
|
6226
6251
|
}
|
|
@@ -6228,9 +6253,10 @@ async function confirm(io, message, options = {}) {
|
|
|
6228
6253
|
const reader = keyReader(io.input);
|
|
6229
6254
|
try {
|
|
6230
6255
|
for (; ; ) {
|
|
6231
|
-
frame.draw(renderConfirm(message, value));
|
|
6256
|
+
frame.draw(renderConfirm(message, value, allowBack));
|
|
6232
6257
|
const key = await reader.next();
|
|
6233
6258
|
if (isCancel(key)) throw new PromptCancelled();
|
|
6259
|
+
if (allowBack && key.name === "b") throw new PromptBack();
|
|
6234
6260
|
if (key.name === "up" || key.name === "left") value = true;
|
|
6235
6261
|
else if (key.name === "down" || key.name === "right") value = false;
|
|
6236
6262
|
else if (key.name === "y") value = true;
|
|
@@ -6240,14 +6266,18 @@ async function confirm(io, message, options = {}) {
|
|
|
6240
6266
|
return value;
|
|
6241
6267
|
}
|
|
6242
6268
|
}
|
|
6269
|
+
} catch (error) {
|
|
6270
|
+
frame.erase();
|
|
6271
|
+
throw error;
|
|
6243
6272
|
} finally {
|
|
6244
6273
|
reader.close();
|
|
6245
6274
|
}
|
|
6246
6275
|
}
|
|
6247
6276
|
async function text(io, message, options = {}) {
|
|
6277
|
+
const allowBack = options.allowBack === true;
|
|
6248
6278
|
const fallback = options.defaultValue ?? "";
|
|
6249
6279
|
if (!isInteractive(io)) {
|
|
6250
|
-
io.output.write(`${renderText(message, fallback)}
|
|
6280
|
+
io.output.write(`${renderText(message, fallback, void 0, allowBack)}
|
|
6251
6281
|
`);
|
|
6252
6282
|
return fallback;
|
|
6253
6283
|
}
|
|
@@ -6257,9 +6287,10 @@ async function text(io, message, options = {}) {
|
|
|
6257
6287
|
let error;
|
|
6258
6288
|
try {
|
|
6259
6289
|
for (; ; ) {
|
|
6260
|
-
frame.draw(renderText(message, value, error));
|
|
6290
|
+
frame.draw(renderText(message, value, error, allowBack));
|
|
6261
6291
|
const key = await reader.next();
|
|
6262
6292
|
if (isCancel(key)) throw new PromptCancelled();
|
|
6293
|
+
if (allowBack && key.name === "left") throw new PromptBack();
|
|
6263
6294
|
error = void 0;
|
|
6264
6295
|
if (key.name === "return" || key.name === "enter") {
|
|
6265
6296
|
const problem = options.validate ? options.validate(value) : null;
|
|
@@ -6280,6 +6311,9 @@ async function text(io, message, options = {}) {
|
|
|
6280
6311
|
}
|
|
6281
6312
|
if (_isPrintable(key)) value += _keyText(key);
|
|
6282
6313
|
}
|
|
6314
|
+
} catch (error_) {
|
|
6315
|
+
frame.erase();
|
|
6316
|
+
throw error_;
|
|
6283
6317
|
} finally {
|
|
6284
6318
|
reader.close();
|
|
6285
6319
|
}
|
|
@@ -6536,98 +6570,108 @@ async function runInit(options) {
|
|
|
6536
6570
|
{ value: "walk", label: "Go through each setting", hint: "every question starts on its default" },
|
|
6537
6571
|
{ value: "choose", label: "Pick a different preset", hint: "everything else stays at the defaults" }
|
|
6538
6572
|
];
|
|
6539
|
-
const
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
{
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
]
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6573
|
+
const baseInclude = [...answers.include];
|
|
6574
|
+
const baseExclude = [...answers.excludePatterns];
|
|
6575
|
+
let lastScope = "all";
|
|
6576
|
+
const artifactChoices = [
|
|
6577
|
+
{ value: "readme", label: "README.md", hint: "orientation page" },
|
|
6578
|
+
{ value: "manifest", label: "manifest.json", hint: "required by validate and report" },
|
|
6579
|
+
{ value: "parts", label: "parts/", hint: "the code payload" },
|
|
6580
|
+
{ value: "navigation", label: "reports/navigation.md", hint: "file \u2192 part index" },
|
|
6581
|
+
{ value: "projectTree", label: "reports/project-tree.md", hint: "ASCII tree" },
|
|
6582
|
+
{ value: "audit", label: "reports/audit.md", hint: "security and health findings" },
|
|
6583
|
+
{ value: "monolith", label: "full-codebase.json + .md", hint: "roughly doubles output" }
|
|
6584
|
+
];
|
|
6585
|
+
const scopeStep = async () => {
|
|
6586
|
+
for (; ; ) {
|
|
6587
|
+
const scope = await select(
|
|
6588
|
+
io,
|
|
6589
|
+
"What should go into the snapshot?",
|
|
6590
|
+
[
|
|
6591
|
+
{ value: "all", label: "Everything the scanner finds", hint: "recommended \xB7 respects .gitignore" },
|
|
6592
|
+
{ value: "folders", label: "Only specific folders\u2026" },
|
|
6593
|
+
{ value: "no-tests", label: "Everything, but skip tests" },
|
|
6594
|
+
{ value: "custom", label: "Let me write glob patterns" }
|
|
6595
|
+
],
|
|
6596
|
+
{ defaultValue: lastScope, allowBack: true }
|
|
6597
|
+
);
|
|
6598
|
+
lastScope = scope;
|
|
6599
|
+
answers.include = [...baseInclude];
|
|
6600
|
+
answers.excludePatterns = [...baseExclude];
|
|
6601
|
+
try {
|
|
6602
|
+
if (scope === "folders") {
|
|
6603
|
+
const dirs = topLevelDirs(options.cwd).slice(0, 40);
|
|
6604
|
+
if (dirs.length === 0) {
|
|
6605
|
+
notes.push("No top-level directories found; the snapshot will include everything.");
|
|
6606
|
+
} else {
|
|
6607
|
+
const chosen = await multiSelect(
|
|
6608
|
+
io,
|
|
6609
|
+
"Select folders",
|
|
6610
|
+
dirs.map((name) => ({ value: name, label: `${name}/` })),
|
|
6611
|
+
{ defaults: dirs, allowBack: true }
|
|
6612
|
+
);
|
|
6613
|
+
answers.include = chosen.map((name) => `${name}/**`);
|
|
6614
|
+
}
|
|
6615
|
+
} else if (scope === "no-tests") {
|
|
6616
|
+
answers.excludePatterns = [...baseExclude, "**/*.test.*", "**/*.spec.*", "tests", "test"];
|
|
6617
|
+
} else if (scope === "custom") {
|
|
6618
|
+
const raw = await text(io, "Glob patterns to include (comma separated)", {
|
|
6619
|
+
defaultValue: baseInclude.join(", "),
|
|
6620
|
+
allowBack: true
|
|
6621
|
+
});
|
|
6622
|
+
answers.include = raw.split(",").map((value) => value.trim()).filter(Boolean);
|
|
6623
|
+
}
|
|
6624
|
+
return;
|
|
6625
|
+
} catch (error) {
|
|
6626
|
+
if (error instanceof PromptBack) continue;
|
|
6627
|
+
throw error;
|
|
6580
6628
|
}
|
|
6581
|
-
} else if (scope === "no-tests") {
|
|
6582
|
-
answers.excludePatterns = [
|
|
6583
|
-
...answers.excludePatterns,
|
|
6584
|
-
"**/*.test.*",
|
|
6585
|
-
"**/*.spec.*",
|
|
6586
|
-
"tests",
|
|
6587
|
-
"test"
|
|
6588
|
-
];
|
|
6589
|
-
} else if (scope === "custom") {
|
|
6590
|
-
const raw = await text(io, "Glob patterns to include (comma separated)", {
|
|
6591
|
-
defaultValue: ""
|
|
6592
|
-
});
|
|
6593
|
-
answers.include = raw.split(",").map((value) => value.trim()).filter(Boolean);
|
|
6594
6629
|
}
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
validate: (value) => parseByteSize(value) === void 0 ? "Not a valid size." : null
|
|
6630
|
+
};
|
|
6631
|
+
const sizeStep = async () => {
|
|
6632
|
+
for (; ; ) {
|
|
6633
|
+
const currentBudget = String(answers.maxPartBytes);
|
|
6634
|
+
const sizeChoice = await select(io, "How large should each part be?", SIZE_CHOICES, {
|
|
6635
|
+
defaultValue: SIZE_CHOICES.some((choice) => choice.value === currentBudget) ? currentBudget : "custom",
|
|
6636
|
+
allowBack: true
|
|
6603
6637
|
});
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6638
|
+
if (sizeChoice !== "custom") {
|
|
6639
|
+
answers.maxPartBytes = sizeChoice;
|
|
6640
|
+
return;
|
|
6641
|
+
}
|
|
6642
|
+
try {
|
|
6643
|
+
const raw = await text(io, "Part size (e.g. 150k, 1.5mb, 900000)", {
|
|
6644
|
+
defaultValue: currentBudget,
|
|
6645
|
+
validate: (value) => parseByteSize(value) === void 0 ? "Not a valid size." : null,
|
|
6646
|
+
allowBack: true
|
|
6647
|
+
});
|
|
6648
|
+
answers.maxPartBytes = parseByteSize(raw) ?? answers.maxPartBytes;
|
|
6649
|
+
return;
|
|
6650
|
+
} catch (error) {
|
|
6651
|
+
if (error instanceof PromptBack) continue;
|
|
6652
|
+
throw error;
|
|
6653
|
+
}
|
|
6607
6654
|
}
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
{ value: "parts", label: "parts/", hint: "the code payload" },
|
|
6612
|
-
{ value: "navigation", label: "reports/navigation.md", hint: "file \u2192 part index" },
|
|
6613
|
-
{ value: "projectTree", label: "reports/project-tree.md", hint: "ASCII tree" },
|
|
6614
|
-
{ value: "audit", label: "reports/audit.md", hint: "security and health findings" },
|
|
6615
|
-
{ value: "monolith", label: "full-codebase.json + .md", hint: "roughly doubles output" }
|
|
6616
|
-
];
|
|
6617
|
-
const presetEnabled = ARTIFACT_NAMES.filter((name) => answers.artifacts[name]);
|
|
6655
|
+
};
|
|
6656
|
+
const artifactsStep = async () => {
|
|
6657
|
+
const enabled = ARTIFACT_NAMES.filter((name) => answers.artifacts[name]);
|
|
6618
6658
|
const selectedArtifacts = await multiSelect(
|
|
6619
6659
|
io,
|
|
6620
6660
|
"Which artifacts should be generated?",
|
|
6621
6661
|
artifactChoices,
|
|
6622
|
-
{ defaults:
|
|
6662
|
+
{ defaults: enabled, allowBack: true }
|
|
6623
6663
|
);
|
|
6624
6664
|
for (const name of ARTIFACT_NAMES) answers.artifacts[name] = selectedArtifacts.includes(name);
|
|
6625
|
-
|
|
6665
|
+
};
|
|
6666
|
+
const credentialsStep = async () => {
|
|
6626
6667
|
answers.includeSensitiveFiles = await confirm(
|
|
6627
6668
|
io,
|
|
6628
|
-
"Include credential files (.env, *.pem,
|
|
6629
|
-
{ defaultValue:
|
|
6669
|
+
"Include credential files (.env, *.pem, *.npmrc, *.ssh/)?",
|
|
6670
|
+
{ defaultValue: answers.includeSensitiveFiles, allowBack: true }
|
|
6630
6671
|
);
|
|
6672
|
+
};
|
|
6673
|
+
const reviewStep = async () => {
|
|
6674
|
+
const enabledCount = ARTIFACT_NAMES.filter((name) => answers.artifacts[name]).length;
|
|
6631
6675
|
io.output.write("\n Review\n\n");
|
|
6632
6676
|
io.output.write(` project ${answers.preset}
|
|
6633
6677
|
`);
|
|
@@ -6642,8 +6686,53 @@ async function runInit(options) {
|
|
|
6642
6686
|
`);
|
|
6643
6687
|
io.output.write(" Will write snapshot.config with your answers, plus every other setting\n");
|
|
6644
6688
|
io.output.write(" at its default \u2014 so nothing is hidden behind the docs.\n\n");
|
|
6645
|
-
const proceed = await confirm(io, "Write this and continue?", {
|
|
6646
|
-
|
|
6689
|
+
const proceed = await confirm(io, "Write this and continue?", {
|
|
6690
|
+
defaultValue: true,
|
|
6691
|
+
allowBack: true
|
|
6692
|
+
});
|
|
6693
|
+
if (!proceed) throw new PromptBack();
|
|
6694
|
+
};
|
|
6695
|
+
const walk = async () => {
|
|
6696
|
+
const steps = [scopeStep, sizeStep, artifactsStep, credentialsStep, reviewStep];
|
|
6697
|
+
let index = 0;
|
|
6698
|
+
while (index < steps.length) {
|
|
6699
|
+
try {
|
|
6700
|
+
await steps[index]();
|
|
6701
|
+
index += 1;
|
|
6702
|
+
} catch (error) {
|
|
6703
|
+
if (!(error instanceof PromptBack)) throw error;
|
|
6704
|
+
if (index === 0) return false;
|
|
6705
|
+
index -= 1;
|
|
6706
|
+
io.output.write("\n");
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
return true;
|
|
6710
|
+
};
|
|
6711
|
+
for (; ; ) {
|
|
6712
|
+
const pace = await select(io, "How should I set this up?", paceChoices, {
|
|
6713
|
+
defaultValue: fallback ? "choose" : "recommended"
|
|
6714
|
+
});
|
|
6715
|
+
if (pace === "choose") {
|
|
6716
|
+
try {
|
|
6717
|
+
answers.preset = await select(
|
|
6718
|
+
io,
|
|
6719
|
+
"What kind of project is this?",
|
|
6720
|
+
listPresetNames().map(
|
|
6721
|
+
(name) => resolvePresetChoice(fallback ? null : detected.presetName, name)
|
|
6722
|
+
),
|
|
6723
|
+
{ defaultValue: answers.preset, allowBack: true }
|
|
6724
|
+
);
|
|
6725
|
+
} catch (error) {
|
|
6726
|
+
if (error instanceof PromptBack) continue;
|
|
6727
|
+
throw error;
|
|
6728
|
+
}
|
|
6729
|
+
const chosen = detectPreset(options.cwd, answers.preset);
|
|
6730
|
+
answers.preset = chosen.presetName;
|
|
6731
|
+
reason = null;
|
|
6732
|
+
fallback = false;
|
|
6733
|
+
}
|
|
6734
|
+
if (pace === "walk" && !await walk()) continue;
|
|
6735
|
+
break;
|
|
6647
6736
|
}
|
|
6648
6737
|
}
|
|
6649
6738
|
const configText = renderConfig(answers);
|
|
@@ -8012,5 +8101,5 @@ async function generateSnapshotAsync(configInput, options) {
|
|
|
8012
8101
|
}
|
|
8013
8102
|
|
|
8014
8103
|
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defaultIO, defineConfig, describeManifestShapeProblem, detectLanguage, detectPreset, escapeControls, explainPath, fenceForContent, fenceForText, findConfigFile, firstRunMessage, formatNumber, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, isBinaryBuffer, isBinaryExtension, isBinaryFile, isDiscoveryMode, isEffectivelyEmpty, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, unknownPresetMessage, validateSnapshot };
|
|
8015
|
-
//# sourceMappingURL=chunk-
|
|
8016
|
-
//# sourceMappingURL=chunk-
|
|
8104
|
+
//# sourceMappingURL=chunk-B336MMNC.js.map
|
|
8105
|
+
//# sourceMappingURL=chunk-B336MMNC.js.map
|