ai-hero-cli 0.3.1 → 0.4.0
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 +75 -19
- package/package.json +1 -1
package/bin.cjs
CHANGED
|
@@ -84936,6 +84936,7 @@ var parseCommits = (commitHistory) => {
|
|
|
84936
84936
|
var selectLessonCommit = ({
|
|
84937
84937
|
branch,
|
|
84938
84938
|
excludeCurrentBranch,
|
|
84939
|
+
extraChoices,
|
|
84939
84940
|
lessonId,
|
|
84940
84941
|
promptMessage
|
|
84941
84942
|
}) => Effect_exports.gen(function* () {
|
|
@@ -84979,14 +84980,27 @@ var selectLessonCommit = ({
|
|
|
84979
84980
|
const sortedCommits = commitsWithLessonIds.sort((a, b) => {
|
|
84980
84981
|
return a.lessonId.localeCompare(b.lessonId);
|
|
84981
84982
|
});
|
|
84982
|
-
|
|
84983
|
-
|
|
84983
|
+
const choices = [
|
|
84984
|
+
...extraChoices ?? [],
|
|
84985
|
+
...sortedCommits.map((commit) => ({
|
|
84984
84986
|
lessonId: commit.lessonId,
|
|
84985
84987
|
message: commit.message
|
|
84986
|
-
}))
|
|
84988
|
+
}))
|
|
84989
|
+
];
|
|
84990
|
+
selectedLessonId = yield* promptService.selectLessonCommit(
|
|
84991
|
+
choices,
|
|
84987
84992
|
promptMessage
|
|
84988
84993
|
);
|
|
84989
84994
|
}
|
|
84995
|
+
const isExtraChoice = extraChoices?.some(
|
|
84996
|
+
(c) => c.lessonId === selectedLessonId
|
|
84997
|
+
);
|
|
84998
|
+
if (isExtraChoice) {
|
|
84999
|
+
return {
|
|
85000
|
+
commit: { sha: "", message: "", lessonId: null },
|
|
85001
|
+
lessonId: selectedLessonId
|
|
85002
|
+
};
|
|
85003
|
+
}
|
|
84990
85004
|
const matchingCommits = commits.filter(
|
|
84991
85005
|
(commit) => commit.lessonId === selectedLessonId
|
|
84992
85006
|
);
|
|
@@ -87688,10 +87702,10 @@ var internal = Command_exports.make("internal").pipe(
|
|
|
87688
87702
|
);
|
|
87689
87703
|
|
|
87690
87704
|
// src/pull.ts
|
|
87691
|
-
|
|
87705
|
+
(class extends Data_exports.TaggedError(
|
|
87692
87706
|
"InvalidBranchOperationError"
|
|
87693
87707
|
) {
|
|
87694
|
-
};
|
|
87708
|
+
});
|
|
87695
87709
|
var UncommittedChangesError = class extends Data_exports.TaggedError(
|
|
87696
87710
|
"UncommittedChangesError"
|
|
87697
87711
|
) {
|
|
@@ -87699,11 +87713,17 @@ var UncommittedChangesError = class extends Data_exports.TaggedError(
|
|
|
87699
87713
|
var runPull = (opts) => Effect_exports.gen(function* () {
|
|
87700
87714
|
const git = yield* GitService;
|
|
87701
87715
|
yield* git.ensureIsGitRepo();
|
|
87702
|
-
|
|
87703
|
-
if (
|
|
87704
|
-
|
|
87705
|
-
|
|
87706
|
-
|
|
87716
|
+
let workingBranch = yield* git.getCurrentBranch();
|
|
87717
|
+
if (workingBranch === "main") {
|
|
87718
|
+
const promptService = yield* PromptService;
|
|
87719
|
+
yield* Console_exports.log(
|
|
87720
|
+
"You're on the main branch. To avoid losing work, create a dev branch to pull upstream changes into."
|
|
87721
|
+
);
|
|
87722
|
+
const branchName = yield* promptService.inputBranchName(
|
|
87723
|
+
"working"
|
|
87724
|
+
);
|
|
87725
|
+
yield* git.checkoutNewBranch(branchName);
|
|
87726
|
+
workingBranch = branchName;
|
|
87707
87727
|
}
|
|
87708
87728
|
const { hasUncommittedChanges, statusOutput } = yield* git.getUncommittedChanges();
|
|
87709
87729
|
if (hasUncommittedChanges) {
|
|
@@ -87715,12 +87735,12 @@ var runPull = (opts) => Effect_exports.gen(function* () {
|
|
|
87715
87735
|
yield* Console_exports.log("Fetching main from upstream...");
|
|
87716
87736
|
yield* git.fetch("upstream", "main");
|
|
87717
87737
|
yield* Console_exports.log(
|
|
87718
|
-
`Merging upstream/main into ${
|
|
87738
|
+
`Merging upstream/main into ${workingBranch}...`
|
|
87719
87739
|
);
|
|
87720
87740
|
yield* git.merge("upstream/main");
|
|
87721
87741
|
yield* Console_exports.log(
|
|
87722
87742
|
`
|
|
87723
|
-
\u2713 Successfully merged upstream/main into ${
|
|
87743
|
+
\u2713 Successfully merged upstream/main into ${workingBranch}`
|
|
87724
87744
|
);
|
|
87725
87745
|
});
|
|
87726
87746
|
var pull = Command_exports.make(
|
|
@@ -87777,6 +87797,17 @@ var pull = Command_exports.make(
|
|
|
87777
87797
|
);
|
|
87778
87798
|
process.exitCode = 1;
|
|
87779
87799
|
});
|
|
87800
|
+
},
|
|
87801
|
+
PromptCancelledError: () => {
|
|
87802
|
+
return Effect_exports.gen(function* () {
|
|
87803
|
+
yield* Console_exports.log("\nPull cancelled.");
|
|
87804
|
+
});
|
|
87805
|
+
},
|
|
87806
|
+
FailedToCreateBranchError: (error4) => {
|
|
87807
|
+
return Effect_exports.gen(function* () {
|
|
87808
|
+
yield* Console_exports.error(`Error: ${error4.message}`);
|
|
87809
|
+
process.exitCode = 1;
|
|
87810
|
+
});
|
|
87780
87811
|
}
|
|
87781
87812
|
}),
|
|
87782
87813
|
Effect_exports.catchAll((error4) => {
|
|
@@ -87811,14 +87842,39 @@ var runReset = ({
|
|
|
87811
87842
|
yield* git.ensureUpstreamBranchConnected({
|
|
87812
87843
|
targetBranch: branch
|
|
87813
87844
|
});
|
|
87814
|
-
const
|
|
87815
|
-
|
|
87816
|
-
|
|
87817
|
-
|
|
87818
|
-
|
|
87819
|
-
|
|
87820
|
-
|
|
87845
|
+
const isExplicitMain = Option_exports.isSome(lessonId) && lessonId.value === "main";
|
|
87846
|
+
let commitToUse;
|
|
87847
|
+
let selectedLessonId;
|
|
87848
|
+
if (isExplicitMain) {
|
|
87849
|
+
yield* git.fetch("upstream", "main");
|
|
87850
|
+
commitToUse = yield* git.revParse("upstream/main");
|
|
87851
|
+
selectedLessonId = "main";
|
|
87852
|
+
} else {
|
|
87853
|
+
const result = yield* selectLessonCommit({
|
|
87854
|
+
branch,
|
|
87855
|
+
lessonId,
|
|
87856
|
+
promptMessage: "Which lesson do you want to reset to? (type to search)",
|
|
87857
|
+
excludeCurrentBranch: false,
|
|
87858
|
+
extraChoices: [
|
|
87859
|
+
{ lessonId: "main", message: "Reset to the starting point" }
|
|
87860
|
+
]
|
|
87861
|
+
});
|
|
87862
|
+
if (result.lessonId === "main") {
|
|
87863
|
+
yield* git.fetch("upstream", "main");
|
|
87864
|
+
commitToUse = yield* git.revParse("upstream/main");
|
|
87865
|
+
selectedLessonId = "main";
|
|
87866
|
+
} else {
|
|
87867
|
+
commitToUse = result.commit.sha;
|
|
87868
|
+
selectedLessonId = result.lessonId;
|
|
87869
|
+
}
|
|
87870
|
+
}
|
|
87871
|
+
const isResetToMain = selectedLessonId === "main";
|
|
87821
87872
|
const currentBranch = yield* git.getCurrentBranch();
|
|
87873
|
+
if (isResetToMain && currentBranch === "main") {
|
|
87874
|
+
return yield* new InvalidBranchOperationError3({
|
|
87875
|
+
message: "Cannot reset to main while on the main branch. Create a new branch first."
|
|
87876
|
+
});
|
|
87877
|
+
}
|
|
87822
87878
|
let action;
|
|
87823
87879
|
if (currentBranch === "main") {
|
|
87824
87880
|
yield* Console_exports.log(
|