ai-hero-cli 0.2.9 → 0.2.10
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/bin.cjs +215 -81
- package/package.json +1 -1
package/bin.cjs
CHANGED
|
@@ -11482,10 +11482,10 @@ var require_clear = __commonJS({
|
|
|
11482
11482
|
var erase = _require.erase;
|
|
11483
11483
|
var cursor = _require.cursor;
|
|
11484
11484
|
var width3 = (str) => [...strip(str)].length;
|
|
11485
|
-
module.exports = function(
|
|
11485
|
+
module.exports = function(prompt9, perLine) {
|
|
11486
11486
|
if (!perLine) return erase.line + cursor.to(0);
|
|
11487
11487
|
let rows = 0;
|
|
11488
|
-
const lines4 =
|
|
11488
|
+
const lines4 = prompt9.split(/\r?\n/);
|
|
11489
11489
|
var _iterator = _createForOfIteratorHelper(lines4), _step;
|
|
11490
11490
|
try {
|
|
11491
11491
|
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
@@ -13086,14 +13086,14 @@ Instructions:
|
|
|
13086
13086
|
if (this.closed) return;
|
|
13087
13087
|
if (this.firstRender) this.out.write(cursor.hide);
|
|
13088
13088
|
super.render();
|
|
13089
|
-
let
|
|
13089
|
+
let prompt9 = [style.symbol(this.done, this.aborted), color3.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
|
|
13090
13090
|
if (this.showMinError) {
|
|
13091
|
-
|
|
13091
|
+
prompt9 += color3.red(`You must select a minimum of ${this.minSelected} choices.`);
|
|
13092
13092
|
this.showMinError = false;
|
|
13093
13093
|
}
|
|
13094
|
-
|
|
13095
|
-
this.out.write(this.clear +
|
|
13096
|
-
this.clear = clear3(
|
|
13094
|
+
prompt9 += this.renderOptions(this.value);
|
|
13095
|
+
this.out.write(this.clear + prompt9);
|
|
13096
|
+
this.clear = clear3(prompt9, this.out.columns);
|
|
13097
13097
|
}
|
|
13098
13098
|
};
|
|
13099
13099
|
module.exports = MultiselectPrompt;
|
|
@@ -13498,14 +13498,14 @@ Filtered results for: ${this.inputValue ? this.inputValue : color3.gray("Enter s
|
|
|
13498
13498
|
if (this.closed) return;
|
|
13499
13499
|
if (this.firstRender) this.out.write(cursor.hide);
|
|
13500
13500
|
super.render();
|
|
13501
|
-
let
|
|
13501
|
+
let prompt9 = [style.symbol(this.done, this.aborted), color3.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
|
|
13502
13502
|
if (this.showMinError) {
|
|
13503
|
-
|
|
13503
|
+
prompt9 += color3.red(`You must select a minimum of ${this.minSelected} choices.`);
|
|
13504
13504
|
this.showMinError = false;
|
|
13505
13505
|
}
|
|
13506
|
-
|
|
13507
|
-
this.out.write(this.clear +
|
|
13508
|
-
this.clear = clear3(
|
|
13506
|
+
prompt9 += this.renderOptions(this.filteredOptions);
|
|
13507
|
+
this.out.write(this.clear + prompt9);
|
|
13508
|
+
this.clear = clear3(prompt9, this.out.columns);
|
|
13509
13509
|
}
|
|
13510
13510
|
};
|
|
13511
13511
|
module.exports = AutocompleteMultiselectPrompt;
|
|
@@ -13785,7 +13785,7 @@ var require_dist2 = __commonJS({
|
|
|
13785
13785
|
var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
|
|
13786
13786
|
var noop = () => {
|
|
13787
13787
|
};
|
|
13788
|
-
function
|
|
13788
|
+
function prompt9() {
|
|
13789
13789
|
return _prompt.apply(this, arguments);
|
|
13790
13790
|
}
|
|
13791
13791
|
function _prompt() {
|
|
@@ -13794,7 +13794,7 @@ var require_dist2 = __commonJS({
|
|
|
13794
13794
|
onCancel = noop
|
|
13795
13795
|
} = {}) {
|
|
13796
13796
|
const answers = {};
|
|
13797
|
-
const override2 =
|
|
13797
|
+
const override2 = prompt9._override || {};
|
|
13798
13798
|
questions = [].concat(questions);
|
|
13799
13799
|
let answer, question, quit, name, type2, lastPrompt;
|
|
13800
13800
|
const getFormattedAnswer = /* @__PURE__ */ (function() {
|
|
@@ -13843,7 +13843,7 @@ var require_dist2 = __commonJS({
|
|
|
13843
13843
|
}
|
|
13844
13844
|
}
|
|
13845
13845
|
try {
|
|
13846
|
-
answer =
|
|
13846
|
+
answer = prompt9._injected ? getInjectedAnswer(prompt9._injected, question.initial) : yield prompts[type2](question);
|
|
13847
13847
|
answers[name] = answer = yield getFormattedAnswer(question, answer, true);
|
|
13848
13848
|
quit = yield onSubmit(question, answer, answers);
|
|
13849
13849
|
} catch (err) {
|
|
@@ -13868,13 +13868,13 @@ var require_dist2 = __commonJS({
|
|
|
13868
13868
|
return answer === void 0 ? deafultValue : answer;
|
|
13869
13869
|
}
|
|
13870
13870
|
function inject(answers) {
|
|
13871
|
-
|
|
13871
|
+
prompt9._injected = (prompt9._injected || []).concat(answers);
|
|
13872
13872
|
}
|
|
13873
13873
|
function override(answers) {
|
|
13874
|
-
|
|
13874
|
+
prompt9._override = Object.assign({}, answers);
|
|
13875
13875
|
}
|
|
13876
|
-
module.exports = Object.assign(
|
|
13877
|
-
prompt:
|
|
13876
|
+
module.exports = Object.assign(prompt9, {
|
|
13877
|
+
prompt: prompt9,
|
|
13878
13878
|
prompts,
|
|
13879
13879
|
inject,
|
|
13880
13880
|
override
|
|
@@ -13938,10 +13938,10 @@ var require_clear2 = __commonJS({
|
|
|
13938
13938
|
var strip = require_strip2();
|
|
13939
13939
|
var { erase, cursor } = require_src();
|
|
13940
13940
|
var width3 = (str) => [...strip(str)].length;
|
|
13941
|
-
module.exports = function(
|
|
13941
|
+
module.exports = function(prompt9, perLine) {
|
|
13942
13942
|
if (!perLine) return erase.line + cursor.to(0);
|
|
13943
13943
|
let rows = 0;
|
|
13944
|
-
const lines4 =
|
|
13944
|
+
const lines4 = prompt9.split(/\r?\n/);
|
|
13945
13945
|
for (let line4 of lines4) {
|
|
13946
13946
|
rows += 1 + Math.floor(Math.max(width3(line4) - 1, 0) / perLine);
|
|
13947
13947
|
}
|
|
@@ -15380,19 +15380,19 @@ Instructions:
|
|
|
15380
15380
|
if (this.closed) return;
|
|
15381
15381
|
if (this.firstRender) this.out.write(cursor.hide);
|
|
15382
15382
|
super.render();
|
|
15383
|
-
let
|
|
15383
|
+
let prompt9 = [
|
|
15384
15384
|
style.symbol(this.done, this.aborted),
|
|
15385
15385
|
color3.bold(this.msg),
|
|
15386
15386
|
style.delimiter(false),
|
|
15387
15387
|
this.renderDoneOrInstructions()
|
|
15388
15388
|
].join(" ");
|
|
15389
15389
|
if (this.showMinError) {
|
|
15390
|
-
|
|
15390
|
+
prompt9 += color3.red(`You must select a minimum of ${this.minSelected} choices.`);
|
|
15391
15391
|
this.showMinError = false;
|
|
15392
15392
|
}
|
|
15393
|
-
|
|
15394
|
-
this.out.write(this.clear +
|
|
15395
|
-
this.clear = clear3(
|
|
15393
|
+
prompt9 += this.renderOptions(this.value);
|
|
15394
|
+
this.out.write(this.clear + prompt9);
|
|
15395
|
+
this.clear = clear3(prompt9, this.out.columns);
|
|
15396
15396
|
}
|
|
15397
15397
|
};
|
|
15398
15398
|
module.exports = MultiselectPrompt;
|
|
@@ -15754,19 +15754,19 @@ Filtered results for: ${this.inputValue ? this.inputValue : color3.gray("Enter s
|
|
|
15754
15754
|
if (this.closed) return;
|
|
15755
15755
|
if (this.firstRender) this.out.write(cursor.hide);
|
|
15756
15756
|
super.render();
|
|
15757
|
-
let
|
|
15757
|
+
let prompt9 = [
|
|
15758
15758
|
style.symbol(this.done, this.aborted),
|
|
15759
15759
|
color3.bold(this.msg),
|
|
15760
15760
|
style.delimiter(false),
|
|
15761
15761
|
this.renderDoneOrInstructions()
|
|
15762
15762
|
].join(" ");
|
|
15763
15763
|
if (this.showMinError) {
|
|
15764
|
-
|
|
15764
|
+
prompt9 += color3.red(`You must select a minimum of ${this.minSelected} choices.`);
|
|
15765
15765
|
this.showMinError = false;
|
|
15766
15766
|
}
|
|
15767
|
-
|
|
15768
|
-
this.out.write(this.clear +
|
|
15769
|
-
this.clear = clear3(
|
|
15767
|
+
prompt9 += this.renderOptions(this.filteredOptions);
|
|
15768
|
+
this.out.write(this.clear + prompt9);
|
|
15769
|
+
this.clear = clear3(prompt9, this.out.columns);
|
|
15770
15770
|
}
|
|
15771
15771
|
};
|
|
15772
15772
|
module.exports = AutocompleteMultiselectPrompt;
|
|
@@ -15934,9 +15934,9 @@ var require_lib = __commonJS({
|
|
|
15934
15934
|
var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
|
|
15935
15935
|
var noop = () => {
|
|
15936
15936
|
};
|
|
15937
|
-
async function
|
|
15937
|
+
async function prompt9(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
|
|
15938
15938
|
const answers = {};
|
|
15939
|
-
const override2 =
|
|
15939
|
+
const override2 = prompt9._override || {};
|
|
15940
15940
|
questions = [].concat(questions);
|
|
15941
15941
|
let answer, question, quit, name, type2, lastPrompt;
|
|
15942
15942
|
const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
|
|
@@ -15973,7 +15973,7 @@ var require_lib = __commonJS({
|
|
|
15973
15973
|
}
|
|
15974
15974
|
}
|
|
15975
15975
|
try {
|
|
15976
|
-
answer =
|
|
15976
|
+
answer = prompt9._injected ? getInjectedAnswer(prompt9._injected, question.initial) : await prompts[type2](question);
|
|
15977
15977
|
answers[name] = answer = await getFormattedAnswer(question, answer, true);
|
|
15978
15978
|
quit = await onSubmit(question, answer, answers);
|
|
15979
15979
|
} catch (err) {
|
|
@@ -15991,12 +15991,12 @@ var require_lib = __commonJS({
|
|
|
15991
15991
|
return answer === void 0 ? deafultValue : answer;
|
|
15992
15992
|
}
|
|
15993
15993
|
function inject(answers) {
|
|
15994
|
-
|
|
15994
|
+
prompt9._injected = (prompt9._injected || []).concat(answers);
|
|
15995
15995
|
}
|
|
15996
15996
|
function override(answers) {
|
|
15997
|
-
|
|
15997
|
+
prompt9._override = Object.assign({}, answers);
|
|
15998
15998
|
}
|
|
15999
|
-
module.exports = Object.assign(
|
|
15999
|
+
module.exports = Object.assign(prompt9, { prompt: prompt9, prompts, inject, override });
|
|
16000
16000
|
}
|
|
16001
16001
|
});
|
|
16002
16002
|
|
|
@@ -76896,8 +76896,8 @@ var run5 = /* @__PURE__ */ fnUntraced2(function* (self2) {
|
|
|
76896
76896
|
const input = yield* terminal.readInput;
|
|
76897
76897
|
return yield* runWithInput(self2, terminal, input);
|
|
76898
76898
|
}, /* @__PURE__ */ mapError3(() => new QuitException()), scoped2);
|
|
76899
|
-
var runWithInput = (
|
|
76900
|
-
const op =
|
|
76899
|
+
var runWithInput = (prompt9, terminal, input) => suspend4(() => {
|
|
76900
|
+
const op = prompt9;
|
|
76901
76901
|
switch (op._tag) {
|
|
76902
76902
|
case "Loop": {
|
|
76903
76903
|
return runLoop(op, terminal, input);
|
|
@@ -77110,8 +77110,8 @@ function eraseText(text11, columns) {
|
|
|
77110
77110
|
}
|
|
77111
77111
|
return eraseLines3(rows);
|
|
77112
77112
|
}
|
|
77113
|
-
function lines(
|
|
77114
|
-
const lines4 =
|
|
77113
|
+
function lines(prompt9, columns) {
|
|
77114
|
+
const lines4 = prompt9.split(/\r?\n/);
|
|
77115
77115
|
return columns === 0 ? lines4.length : pipe(map3(lines4, (line4) => Math.ceil(line4.length / columns)), reduce(0, (left3, right3) => left3 + right3));
|
|
77116
77116
|
}
|
|
77117
77117
|
|
|
@@ -80182,11 +80182,11 @@ var withFallbackConfig3 = /* @__PURE__ */ dual(2, (self2, config3) => {
|
|
|
80182
80182
|
}
|
|
80183
80183
|
return makeWithFallback(self2, config3);
|
|
80184
80184
|
});
|
|
80185
|
-
var withFallbackPrompt = /* @__PURE__ */ dual(2, (self2,
|
|
80185
|
+
var withFallbackPrompt = /* @__PURE__ */ dual(2, (self2, prompt9) => {
|
|
80186
80186
|
if (isInstruction2(self2) && isWithDefault2(self2)) {
|
|
80187
|
-
return makeWithDefault2(withFallbackPrompt(self2.options,
|
|
80187
|
+
return makeWithDefault2(withFallbackPrompt(self2.options, prompt9), self2.fallback);
|
|
80188
80188
|
}
|
|
80189
|
-
return makeWithFallback(self2,
|
|
80189
|
+
return makeWithFallback(self2, prompt9);
|
|
80190
80190
|
});
|
|
80191
80191
|
var withDescription5 = /* @__PURE__ */ dual(2, (self2, desc) => modifySingle(self2, (single2) => {
|
|
80192
80192
|
const description = sequence(single2.description, p(desc));
|
|
@@ -81329,12 +81329,12 @@ var make59 = (name, options3 = none14, args2 = none12) => {
|
|
|
81329
81329
|
op.args = args2;
|
|
81330
81330
|
return op;
|
|
81331
81331
|
};
|
|
81332
|
-
var prompt = (name,
|
|
81332
|
+
var prompt = (name, prompt9) => {
|
|
81333
81333
|
const op = Object.create(proto23);
|
|
81334
81334
|
op._tag = "GetUserInput";
|
|
81335
81335
|
op.name = name;
|
|
81336
81336
|
op.description = empty39;
|
|
81337
|
-
op.prompt =
|
|
81337
|
+
op.prompt = prompt9;
|
|
81338
81338
|
return op;
|
|
81339
81339
|
};
|
|
81340
81340
|
var getHelp7 = (self2, config3) => getHelpInternal4(self2, config3);
|
|
@@ -82175,7 +82175,7 @@ var getUsage6 = (self2) => getUsage5(self2.descriptor);
|
|
|
82175
82175
|
var mapDescriptor = /* @__PURE__ */ dual(2, (self2, f) => makeDerive(self2, {
|
|
82176
82176
|
descriptor: f(self2.descriptor)
|
|
82177
82177
|
}));
|
|
82178
|
-
var prompt2 = (name,
|
|
82178
|
+
var prompt2 = (name, prompt9, handler) => makeProto(map37(prompt(name, prompt9), (_) => _.value), handler, GenericTag(`@effect/cli/Prompt/${name}`));
|
|
82179
82179
|
var withHandler = /* @__PURE__ */ dual(2, (self2, handler) => makeDerive(self2, {
|
|
82180
82180
|
handler,
|
|
82181
82181
|
transform: identity
|
|
@@ -83316,9 +83316,10 @@ var makeCacheStats2 = makeCacheStats;
|
|
|
83316
83316
|
var makeEntryStats2 = makeEntryStats;
|
|
83317
83317
|
|
|
83318
83318
|
// src/commit-utils.ts
|
|
83319
|
-
var
|
|
83319
|
+
var import_prompts2 = __toESM(require_prompts3());
|
|
83320
83320
|
|
|
83321
83321
|
// src/prompt-utils.ts
|
|
83322
|
+
var import_prompts = __toESM(require_prompts3());
|
|
83322
83323
|
var PromptCancelledError = class extends Data_exports.TaggedError(
|
|
83323
83324
|
"PromptCancelledError"
|
|
83324
83325
|
) {
|
|
@@ -83332,6 +83333,23 @@ var runPrompt = (promptFn) => {
|
|
|
83332
83333
|
return result;
|
|
83333
83334
|
});
|
|
83334
83335
|
};
|
|
83336
|
+
var confirmContinue = Effect_exports.fn("confirmContinue")(
|
|
83337
|
+
function* (message, defaultToContinue = true) {
|
|
83338
|
+
const { confirm } = yield* runPrompt(
|
|
83339
|
+
() => (0, import_prompts.prompt)([
|
|
83340
|
+
{
|
|
83341
|
+
type: "confirm",
|
|
83342
|
+
name: "confirm",
|
|
83343
|
+
message,
|
|
83344
|
+
initial: defaultToContinue
|
|
83345
|
+
}
|
|
83346
|
+
])
|
|
83347
|
+
);
|
|
83348
|
+
if (!confirm) {
|
|
83349
|
+
return yield* new PromptCancelledError();
|
|
83350
|
+
}
|
|
83351
|
+
}
|
|
83352
|
+
);
|
|
83335
83353
|
|
|
83336
83354
|
// src/commit-utils.ts
|
|
83337
83355
|
var CommitNotFoundError = class extends Data_exports.TaggedError(
|
|
@@ -83433,7 +83451,7 @@ var selectLessonCommit = ({
|
|
|
83433
83451
|
return a.lessonId.localeCompare(b.lessonId);
|
|
83434
83452
|
});
|
|
83435
83453
|
const { lesson } = yield* runPrompt(
|
|
83436
|
-
() => (0,
|
|
83454
|
+
() => (0, import_prompts2.default)([
|
|
83437
83455
|
{
|
|
83438
83456
|
type: "autocomplete",
|
|
83439
83457
|
name: "lesson",
|
|
@@ -84205,8 +84223,8 @@ var make70 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
|
|
|
84205
84223
|
readlineInterface.once("line", onLine);
|
|
84206
84224
|
return sync5(() => readlineInterface.off("line", onLine));
|
|
84207
84225
|
})), scoped2);
|
|
84208
|
-
const display = (
|
|
84209
|
-
stdout3.write(
|
|
84226
|
+
const display = (prompt9) => uninterruptible2(async2((resume2) => {
|
|
84227
|
+
stdout3.write(prompt9, (err) => err ? resume2(fail9(new BadArgument({
|
|
84210
84228
|
module: "Terminal",
|
|
84211
84229
|
method: "display",
|
|
84212
84230
|
description: "Failed to write prompt to stdout",
|
|
@@ -84315,6 +84333,15 @@ var GitService = class extends Effect_exports.Service()(
|
|
|
84315
84333
|
{
|
|
84316
84334
|
effect: Effect_exports.gen(function* () {
|
|
84317
84335
|
const fs = yield* FileSystem_exports.FileSystem;
|
|
84336
|
+
const runCommandWithString = Effect_exports.fn(
|
|
84337
|
+
"runCommandWithString"
|
|
84338
|
+
)(function* (...commandArgs) {
|
|
84339
|
+
const cwd = yield* Config_exports.string("cwd");
|
|
84340
|
+
const command2 = Command_exports2.make(...commandArgs).pipe(
|
|
84341
|
+
Command_exports2.workingDirectory(cwd)
|
|
84342
|
+
);
|
|
84343
|
+
return (yield* Command_exports2.string(command2)).trim();
|
|
84344
|
+
});
|
|
84318
84345
|
return {
|
|
84319
84346
|
ensureIsGitRepo: Effect_exports.fn("ensureIsGitRepo")(
|
|
84320
84347
|
function* () {
|
|
@@ -84329,6 +84356,19 @@ var GitService = class extends Effect_exports.Service()(
|
|
|
84329
84356
|
}
|
|
84330
84357
|
}
|
|
84331
84358
|
),
|
|
84359
|
+
getUncommittedChanges: Effect_exports.fn(
|
|
84360
|
+
"getUncommittedChanges"
|
|
84361
|
+
)(function* () {
|
|
84362
|
+
const statusOutput = yield* runCommandWithString(
|
|
84363
|
+
"git",
|
|
84364
|
+
"status",
|
|
84365
|
+
"--porcelain"
|
|
84366
|
+
);
|
|
84367
|
+
return {
|
|
84368
|
+
hasUncommittedChanges: statusOutput !== "",
|
|
84369
|
+
statusOutput
|
|
84370
|
+
};
|
|
84371
|
+
}),
|
|
84332
84372
|
ensureBranchConnected: Effect_exports.fn(
|
|
84333
84373
|
"ensureBranchConnected"
|
|
84334
84374
|
)(function* (targetBranch) {
|
|
@@ -84387,15 +84427,7 @@ var GitService = class extends Effect_exports.Service()(
|
|
|
84387
84427
|
);
|
|
84388
84428
|
return yield* Command_exports2.exitCode(command2);
|
|
84389
84429
|
}),
|
|
84390
|
-
runCommandWithString
|
|
84391
|
-
function* (...commandArgs) {
|
|
84392
|
-
const cwd = yield* Config_exports.string("cwd");
|
|
84393
|
-
const command2 = Command_exports2.make(...commandArgs).pipe(
|
|
84394
|
-
Command_exports2.workingDirectory(cwd)
|
|
84395
|
-
);
|
|
84396
|
-
return (yield* Command_exports2.string(command2)).trim();
|
|
84397
|
-
}
|
|
84398
|
-
)
|
|
84430
|
+
runCommandWithString
|
|
84399
84431
|
};
|
|
84400
84432
|
}),
|
|
84401
84433
|
dependencies: [NodeContext_exports.layer]
|
|
@@ -84529,7 +84561,7 @@ var cherryPick = Command_exports.make(
|
|
|
84529
84561
|
);
|
|
84530
84562
|
|
|
84531
84563
|
// src/exercise.ts
|
|
84532
|
-
var
|
|
84564
|
+
var import_prompts3 = __toESM(require_prompts3());
|
|
84533
84565
|
var InvalidPathError = class extends Data_exports.TaggedError(
|
|
84534
84566
|
"InvalidPathError"
|
|
84535
84567
|
) {
|
|
@@ -84887,7 +84919,7 @@ var runLesson = Effect_exports.fn("runLesson")(function* (opts) {
|
|
|
84887
84919
|
readmeMessage: "Once you've read the readme, you can go to the next exercise."
|
|
84888
84920
|
};
|
|
84889
84921
|
const { choice: choice6 } = yield* runPrompt(
|
|
84890
|
-
() => (0,
|
|
84922
|
+
() => (0, import_prompts3.default)([
|
|
84891
84923
|
{
|
|
84892
84924
|
type: "select",
|
|
84893
84925
|
name: "choice",
|
|
@@ -84978,7 +85010,7 @@ var chooseLessonAndRunIt = (opts) => Effect_exports.gen(function* () {
|
|
|
84978
85010
|
);
|
|
84979
85011
|
yield* Console_exports.clear;
|
|
84980
85012
|
const { lesson: lessonNumber } = yield* runPrompt(
|
|
84981
|
-
() => (0,
|
|
85013
|
+
() => (0, import_prompts3.default)([
|
|
84982
85014
|
{
|
|
84983
85015
|
type: "autocomplete",
|
|
84984
85016
|
name: "lesson",
|
|
@@ -85086,7 +85118,7 @@ var selectSubfolderIndex = Effect_exports.fn("selectSubfolder")(
|
|
|
85086
85118
|
});
|
|
85087
85119
|
}
|
|
85088
85120
|
const result = yield* runPrompt(
|
|
85089
|
-
() => (0,
|
|
85121
|
+
() => (0, import_prompts3.default)([
|
|
85090
85122
|
{
|
|
85091
85123
|
type: "select",
|
|
85092
85124
|
name: "subfolderIndex",
|
|
@@ -86062,7 +86094,7 @@ var getDiffs = Command_exports.make(
|
|
|
86062
86094
|
);
|
|
86063
86095
|
|
|
86064
86096
|
// src/internal/edit-commit.ts
|
|
86065
|
-
var
|
|
86097
|
+
var import_prompts4 = __toESM(require_prompts3());
|
|
86066
86098
|
var NotAGitRepoError3 = class extends Data_exports.TaggedError(
|
|
86067
86099
|
"NotAGitRepoError"
|
|
86068
86100
|
) {
|
|
@@ -86240,7 +86272,7 @@ var editCommit = Command_exports.make(
|
|
|
86240
86272
|
"\nSession active. Make your changes to the code. ALL unstaged changes will be added to the commit."
|
|
86241
86273
|
);
|
|
86242
86274
|
const { ready } = yield* runPrompt(
|
|
86243
|
-
() => (0,
|
|
86275
|
+
() => (0, import_prompts4.default)([
|
|
86244
86276
|
{
|
|
86245
86277
|
type: "confirm",
|
|
86246
86278
|
name: "ready",
|
|
@@ -86326,7 +86358,7 @@ Cherry-picking ${followingCommitCount} commit${followingCommitCount === 1 ? "" :
|
|
|
86326
86358
|
\u2713 Edit complete! Lesson ${selectedLessonId} updated.`
|
|
86327
86359
|
);
|
|
86328
86360
|
const { saveToTarget } = yield* runPrompt(
|
|
86329
|
-
() => (0,
|
|
86361
|
+
() => (0, import_prompts4.default)([
|
|
86330
86362
|
{
|
|
86331
86363
|
type: "confirm",
|
|
86332
86364
|
name: "saveToTarget",
|
|
@@ -86387,7 +86419,7 @@ Cherry-picking ${followingCommitCount} commit${followingCommitCount === 1 ? "" :
|
|
|
86387
86419
|
`\u2713 ${branch} updated with your changes`
|
|
86388
86420
|
);
|
|
86389
86421
|
const { forcePush } = yield* runPrompt(
|
|
86390
|
-
() => (0,
|
|
86422
|
+
() => (0, import_prompts4.default)([
|
|
86391
86423
|
{
|
|
86392
86424
|
type: "confirm",
|
|
86393
86425
|
name: "forcePush",
|
|
@@ -86491,7 +86523,7 @@ function resolveConflictLoop(cwd) {
|
|
|
86491
86523
|
);
|
|
86492
86524
|
yield* Command_exports2.exitCode(statusCommand);
|
|
86493
86525
|
const { action } = yield* runPrompt(
|
|
86494
|
-
() => (0,
|
|
86526
|
+
() => (0, import_prompts4.default)([
|
|
86495
86527
|
{
|
|
86496
86528
|
type: "select",
|
|
86497
86529
|
name: "action",
|
|
@@ -86560,6 +86592,111 @@ function resolveConflictLoop(cwd) {
|
|
|
86560
86592
|
});
|
|
86561
86593
|
}
|
|
86562
86594
|
|
|
86595
|
+
// src/internal/rebase-to-main.ts
|
|
86596
|
+
var rebaseToMain = Command_exports.make(
|
|
86597
|
+
"rebase-to-main",
|
|
86598
|
+
{
|
|
86599
|
+
cwd: Options_exports.text("cwd").pipe(
|
|
86600
|
+
Options_exports.withDescription(
|
|
86601
|
+
"The directory to run the rebase-to-main command in"
|
|
86602
|
+
),
|
|
86603
|
+
Options_exports.withDefault(process.cwd())
|
|
86604
|
+
),
|
|
86605
|
+
target: Options_exports.text("target").pipe(
|
|
86606
|
+
Options_exports.withDescription("The target branch to rebase to"),
|
|
86607
|
+
Options_exports.withDefault(DEFAULT_PROJECT_TARGET_BRANCH)
|
|
86608
|
+
)
|
|
86609
|
+
},
|
|
86610
|
+
(opts) => Effect_exports.gen(function* () {
|
|
86611
|
+
const git = yield* GitService;
|
|
86612
|
+
yield* git.ensureIsGitRepo();
|
|
86613
|
+
const currentBranch = yield* git.getCurrentBranch();
|
|
86614
|
+
if (currentBranch !== "main") {
|
|
86615
|
+
return yield* Effect_exports.fail(
|
|
86616
|
+
new InvalidBranchOperationError({
|
|
86617
|
+
message: `Cannot rebase to main when not on main branch`
|
|
86618
|
+
})
|
|
86619
|
+
);
|
|
86620
|
+
}
|
|
86621
|
+
yield* git.ensureBranchConnected(opts.target);
|
|
86622
|
+
const { hasUncommittedChanges } = yield* git.getUncommittedChanges();
|
|
86623
|
+
if (hasUncommittedChanges) {
|
|
86624
|
+
return yield* Effect_exports.fail(
|
|
86625
|
+
new InvalidBranchOperationError({
|
|
86626
|
+
message: `Cannot rebase to main when there are uncommitted changes`
|
|
86627
|
+
})
|
|
86628
|
+
);
|
|
86629
|
+
}
|
|
86630
|
+
yield* confirmContinue(
|
|
86631
|
+
`Do you want to checkout ${opts.target}?`
|
|
86632
|
+
);
|
|
86633
|
+
const checkoutExitCode = yield* git.runCommandWithExitCode(
|
|
86634
|
+
"git",
|
|
86635
|
+
"checkout",
|
|
86636
|
+
opts.target
|
|
86637
|
+
);
|
|
86638
|
+
if (checkoutExitCode !== 0) {
|
|
86639
|
+
return yield* Effect_exports.fail(
|
|
86640
|
+
new InvalidBranchOperationError({
|
|
86641
|
+
message: `Failed to checkout ${opts.target}`
|
|
86642
|
+
})
|
|
86643
|
+
);
|
|
86644
|
+
}
|
|
86645
|
+
yield* confirmContinue(`Do you want to rebase to main?`);
|
|
86646
|
+
const rebaseExitCode = yield* git.runCommandWithExitCode(
|
|
86647
|
+
"git",
|
|
86648
|
+
"rebase",
|
|
86649
|
+
"main"
|
|
86650
|
+
);
|
|
86651
|
+
if (rebaseExitCode !== 0) {
|
|
86652
|
+
return yield* Effect_exports.fail(
|
|
86653
|
+
new InvalidBranchOperationError({
|
|
86654
|
+
message: `Failed to rebase to main`
|
|
86655
|
+
})
|
|
86656
|
+
);
|
|
86657
|
+
}
|
|
86658
|
+
yield* confirmContinue(
|
|
86659
|
+
`Do you want to force push to ${opts.target}?`
|
|
86660
|
+
);
|
|
86661
|
+
const forcePushExitCode = yield* git.runCommandWithExitCode(
|
|
86662
|
+
"git",
|
|
86663
|
+
"push",
|
|
86664
|
+
"origin",
|
|
86665
|
+
opts.target,
|
|
86666
|
+
"--force-with-lease"
|
|
86667
|
+
);
|
|
86668
|
+
if (forcePushExitCode !== 0) {
|
|
86669
|
+
return yield* Effect_exports.fail(
|
|
86670
|
+
new InvalidBranchOperationError({
|
|
86671
|
+
message: `Failed to force push to ${opts.target}`
|
|
86672
|
+
})
|
|
86673
|
+
);
|
|
86674
|
+
}
|
|
86675
|
+
yield* confirmContinue(`Do you want to checkout main?`);
|
|
86676
|
+
const backToMainExitCode = yield* git.runCommandWithExitCode(
|
|
86677
|
+
"git",
|
|
86678
|
+
"checkout",
|
|
86679
|
+
"main"
|
|
86680
|
+
);
|
|
86681
|
+
if (backToMainExitCode !== 0) {
|
|
86682
|
+
return yield* Effect_exports.fail(
|
|
86683
|
+
new InvalidBranchOperationError({
|
|
86684
|
+
message: `Failed to checkout main`
|
|
86685
|
+
})
|
|
86686
|
+
);
|
|
86687
|
+
}
|
|
86688
|
+
yield* Console_exports.log(
|
|
86689
|
+
`\u2713 Successfully rebased ${opts.target} to main and force pushed`
|
|
86690
|
+
);
|
|
86691
|
+
}).pipe(
|
|
86692
|
+
Effect_exports.withConfigProvider(
|
|
86693
|
+
ConfigProvider_exports.fromJson({
|
|
86694
|
+
cwd: opts.cwd
|
|
86695
|
+
})
|
|
86696
|
+
)
|
|
86697
|
+
)
|
|
86698
|
+
);
|
|
86699
|
+
|
|
86563
86700
|
// src/internal/internal.ts
|
|
86564
86701
|
var upgradePackages = Command_exports.make(
|
|
86565
86702
|
"upgrade",
|
|
@@ -86612,13 +86749,14 @@ var internal = Command_exports.make("internal").pipe(
|
|
|
86612
86749
|
rename4,
|
|
86613
86750
|
uploadToCloudinary,
|
|
86614
86751
|
getDiffs,
|
|
86615
|
-
editCommit
|
|
86752
|
+
editCommit,
|
|
86753
|
+
rebaseToMain
|
|
86616
86754
|
]),
|
|
86617
86755
|
Command_exports.withDescription("Internal commands for AI Hero")
|
|
86618
86756
|
);
|
|
86619
86757
|
|
|
86620
86758
|
// src/reset.ts
|
|
86621
|
-
var
|
|
86759
|
+
var import_prompts5 = __toESM(require_prompts3());
|
|
86622
86760
|
(class extends Data_exports.TaggedError(
|
|
86623
86761
|
"NotAGitRepoError"
|
|
86624
86762
|
) {
|
|
@@ -86686,7 +86824,7 @@ var reset2 = Command_exports.make(
|
|
|
86686
86824
|
}
|
|
86687
86825
|
if (!problem && !solution && !demo) {
|
|
86688
86826
|
const { state } = yield* runPrompt(
|
|
86689
|
-
() => (0,
|
|
86827
|
+
() => (0, import_prompts5.default)([
|
|
86690
86828
|
{
|
|
86691
86829
|
type: "select",
|
|
86692
86830
|
name: "state",
|
|
@@ -86731,7 +86869,7 @@ var reset2 = Command_exports.make(
|
|
|
86731
86869
|
action = "reset-current";
|
|
86732
86870
|
} else {
|
|
86733
86871
|
const result = yield* runPrompt(
|
|
86734
|
-
() => (0,
|
|
86872
|
+
() => (0, import_prompts5.default)([
|
|
86735
86873
|
{
|
|
86736
86874
|
type: "select",
|
|
86737
86875
|
name: "action",
|
|
@@ -86760,7 +86898,7 @@ var reset2 = Command_exports.make(
|
|
|
86760
86898
|
}
|
|
86761
86899
|
if (action === "create-branch") {
|
|
86762
86900
|
const { branchName } = yield* runPrompt(
|
|
86763
|
-
() => (0,
|
|
86901
|
+
() => (0, import_prompts5.default)([
|
|
86764
86902
|
{
|
|
86765
86903
|
type: "text",
|
|
86766
86904
|
name: "branchName",
|
|
@@ -86789,18 +86927,14 @@ var reset2 = Command_exports.make(
|
|
|
86789
86927
|
return;
|
|
86790
86928
|
}
|
|
86791
86929
|
if (!demo) {
|
|
86792
|
-
const statusOutput = yield* git.
|
|
86793
|
-
|
|
86794
|
-
"status",
|
|
86795
|
-
"--porcelain"
|
|
86796
|
-
);
|
|
86797
|
-
if (statusOutput !== "") {
|
|
86930
|
+
const { hasUncommittedChanges, statusOutput } = yield* git.getUncommittedChanges();
|
|
86931
|
+
if (hasUncommittedChanges) {
|
|
86798
86932
|
yield* Console_exports.log(
|
|
86799
86933
|
"\nWarning: You have uncommitted changes:"
|
|
86800
86934
|
);
|
|
86801
86935
|
yield* Console_exports.log(statusOutput);
|
|
86802
86936
|
const { confirm } = yield* runPrompt(
|
|
86803
|
-
() => (0,
|
|
86937
|
+
() => (0, import_prompts5.default)([
|
|
86804
86938
|
{
|
|
86805
86939
|
type: "confirm",
|
|
86806
86940
|
name: "confirm",
|