@solaqua/gji 0.7.0 → 0.7.2
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/back.js +1 -1
- package/dist/clean.d.ts +2 -1
- package/dist/clean.js +8 -16
- package/dist/cli.js +7 -6
- package/dist/gji-bundle.mjs +568 -273
- package/dist/go.d.ts +2 -4
- package/dist/go.js +19 -48
- package/dist/history.d.ts +1 -0
- package/dist/history.js +12 -5
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +3 -3
- package/dist/init.d.ts +3 -3
- package/dist/init.js +12 -12
- package/dist/install-prompt.js +22 -21
- package/dist/new.js +72 -10
- package/dist/open.d.ts +2 -2
- package/dist/open.js +22 -18
- package/dist/pr.js +4 -4
- package/dist/remove.d.ts +3 -2
- package/dist/remove.js +8 -13
- package/dist/repo.d.ts +0 -1
- package/dist/repo.js +0 -9
- package/dist/run-hook.d.ts +6 -0
- package/dist/{trigger-hook.js → run-hook.js} +13 -7
- package/dist/shell-completion.js +5 -5
- package/dist/warp.js +24 -53
- package/dist/worktree-info.d.ts +0 -1
- package/dist/worktree-info.js +17 -11
- package/dist/worktree-picker.d.ts +14 -0
- package/dist/worktree-picker.js +228 -0
- package/man/man1/gji-back.1 +1 -1
- package/man/man1/gji-clean.1 +1 -1
- package/man/man1/gji-completion.1 +1 -1
- package/man/man1/gji-config.1 +1 -1
- package/man/man1/gji-go.1 +1 -1
- package/man/man1/gji-history.1 +1 -1
- package/man/man1/gji-init.1 +1 -1
- package/man/man1/gji-ls.1 +1 -1
- package/man/man1/gji-new.1 +1 -1
- package/man/man1/gji-open.1 +1 -1
- package/man/man1/gji-pr.1 +1 -1
- package/man/man1/gji-remove.1 +1 -1
- package/man/man1/gji-root.1 +1 -1
- package/man/man1/gji-run-hook.1 +9 -0
- package/man/man1/gji-status.1 +1 -1
- package/man/man1/gji-sync-files.1 +1 -1
- package/man/man1/gji-sync.1 +1 -1
- package/man/man1/gji-warp.1 +1 -1
- package/man/man1/gji.1 +6 -4
- package/package.json +3 -7
- package/dist/trigger-hook.d.ts +0 -6
- package/man/man1/gji-trigger-hook.1 +0 -9
package/dist/back.js
CHANGED
|
@@ -39,7 +39,7 @@ export async function runBackCommand(options) {
|
|
|
39
39
|
const repository = await detectRepository(target.path);
|
|
40
40
|
const config = await loadEffectiveConfig(repository.repoRoot, options.home, options.stderr);
|
|
41
41
|
const hooks = extractHooks(config);
|
|
42
|
-
await runHook(hooks
|
|
42
|
+
await runHook(hooks["after-enter"], target.path, {
|
|
43
43
|
branch: target.branch ?? undefined,
|
|
44
44
|
path: target.path,
|
|
45
45
|
repo: basename(repository.repoRoot),
|
package/dist/clean.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WorktreeEntry } from "./repo.js";
|
|
2
|
+
import { type WorktreePromptEntry } from "./worktree-picker.js";
|
|
2
3
|
export interface CleanCommandOptions {
|
|
3
4
|
cwd: string;
|
|
4
5
|
dryRun?: boolean;
|
|
@@ -12,7 +13,7 @@ export interface CleanCommandDependencies {
|
|
|
12
13
|
confirmForceDeleteBranch: (branch: string) => Promise<boolean>;
|
|
13
14
|
confirmForceRemoveWorktree: (worktreePath: string) => Promise<boolean>;
|
|
14
15
|
confirmRemoval: (worktrees: WorktreeEntry[]) => Promise<boolean>;
|
|
15
|
-
promptForWorktrees: (worktrees:
|
|
16
|
+
promptForWorktrees: (worktrees: WorktreePromptEntry[]) => Promise<string[] | null>;
|
|
16
17
|
}
|
|
17
18
|
export declare function createCleanCommand(dependencies?: Partial<CleanCommandDependencies>): (options: CleanCommandOptions) => Promise<number>;
|
|
18
19
|
export declare const runCleanCommand: (options: CleanCommandOptions) => Promise<number>;
|
package/dist/clean.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { confirm, isCancel
|
|
1
|
+
import { confirm, isCancel } from "@clack/prompts";
|
|
2
2
|
import { loadEffectiveConfig } from "./config.js";
|
|
3
3
|
import { isBranchMergedInto, readWorktreeHealth, resolveRemoteDefaultBranch, runGit, } from "./git.js";
|
|
4
4
|
import { isHeadless } from "./headless.js";
|
|
5
|
-
import { formatLastCommit, formatUpstreamState,
|
|
5
|
+
import { formatLastCommit, formatUpstreamState, readWorktreeInfos, serializeWorktreeInfo, } from "./worktree-info.js";
|
|
6
6
|
import { deleteBranch, forceDeleteBranch, forceRemoveWorktree, isBranchUnmergedError, isWorktreeDirtyError, loadLinkedWorktrees, removeWorktree, } from "./worktree-management.js";
|
|
7
|
+
import { buildWorktreePromptEntries, promptForMultipleWorktrees, } from "./worktree-picker.js";
|
|
7
8
|
import { defaultConfirmForceDeleteBranch, defaultConfirmForceRemoveWorktree, } from "./worktree-prompts.js";
|
|
8
9
|
export function createCleanCommand(dependencies = {}) {
|
|
9
10
|
const promptForWorktrees = dependencies.promptForWorktrees ?? defaultPromptForWorktrees;
|
|
@@ -43,7 +44,10 @@ export function createCleanCommand(dependencies = {}) {
|
|
|
43
44
|
(options.dryRun && (options.stale || options.json || isHeadless()));
|
|
44
45
|
const selections = shouldSelectAll
|
|
45
46
|
? cleanupCandidates.map((w) => w.path)
|
|
46
|
-
: await promptForWorktrees(cleanupCandidates)
|
|
47
|
+
: await promptForWorktrees(await buildWorktreePromptEntries(cleanupCandidates.map((worktree) => ({
|
|
48
|
+
repoName: repository.repoName,
|
|
49
|
+
worktree,
|
|
50
|
+
}))));
|
|
47
51
|
if (!selections || selections.length === 0) {
|
|
48
52
|
options.stderr("Aborted\n");
|
|
49
53
|
return 1;
|
|
@@ -246,19 +250,7 @@ function toMessage(error) {
|
|
|
246
250
|
return error instanceof Error ? error.message : String(error);
|
|
247
251
|
}
|
|
248
252
|
async function defaultPromptForWorktrees(worktrees) {
|
|
249
|
-
|
|
250
|
-
const choice = await multiselect({
|
|
251
|
-
message: "Choose worktrees to clean",
|
|
252
|
-
options: worktrees.map((worktree, i) => {
|
|
253
|
-
return {
|
|
254
|
-
hint: formatWorktreeHint(infos[i]),
|
|
255
|
-
label: worktree.branch ?? "(detached)",
|
|
256
|
-
value: worktree.path,
|
|
257
|
-
};
|
|
258
|
-
}),
|
|
259
|
-
required: true,
|
|
260
|
-
});
|
|
261
|
-
return isCancel(choice) ? null : choice;
|
|
253
|
+
return promptForMultipleWorktrees("Choose worktrees to clean", worktrees);
|
|
262
254
|
}
|
|
263
255
|
async function defaultConfirmRemoval(worktrees) {
|
|
264
256
|
const branchCount = worktrees.filter((worktree) => worktree.branch !== null).length;
|
package/dist/cli.js
CHANGED
|
@@ -17,10 +17,10 @@ import { runRemoveCommand } from "./remove.js";
|
|
|
17
17
|
import { detectRepository } from "./repo.js";
|
|
18
18
|
import { registerRepo } from "./repo-registry.js";
|
|
19
19
|
import { runRootCommand } from "./root.js";
|
|
20
|
+
import { runHookCommand } from "./run-hook.js";
|
|
20
21
|
import { runStatusCommand } from "./status.js";
|
|
21
22
|
import { runSyncCommand } from "./sync.js";
|
|
22
23
|
import { runSyncFilesCommand } from "./sync-files-command.js";
|
|
23
|
-
import { runTriggerHookCommand } from "./trigger-hook.js";
|
|
24
24
|
import { runWarpCommand } from "./warp.js";
|
|
25
25
|
export function createProgram() {
|
|
26
26
|
const program = new Command();
|
|
@@ -214,9 +214,10 @@ function registerCommands(program) {
|
|
|
214
214
|
.option("--json", "emit JSON on success or error instead of human-readable output")
|
|
215
215
|
.action(notImplemented("remove"));
|
|
216
216
|
program
|
|
217
|
-
.command("
|
|
218
|
-
.
|
|
219
|
-
.
|
|
217
|
+
.command("run-hook <hook>")
|
|
218
|
+
.alias("trigger-hook")
|
|
219
|
+
.description("run a named hook (after-create, after-enter, before-remove) in the current worktree")
|
|
220
|
+
.action(notImplemented("run-hook"));
|
|
220
221
|
program
|
|
221
222
|
.command("warp [branch]")
|
|
222
223
|
.description("jump to any worktree across all known repos")
|
|
@@ -506,9 +507,9 @@ function attachCommandActions(program, options) {
|
|
|
506
507
|
.find((command) => command.name() === "remove")
|
|
507
508
|
?.action(runRemovalCommand);
|
|
508
509
|
program.commands
|
|
509
|
-
.find((command) => command.name() === "
|
|
510
|
+
.find((command) => command.name() === "run-hook")
|
|
510
511
|
?.action(async (hook) => {
|
|
511
|
-
const exitCode = await
|
|
512
|
+
const exitCode = await runHookCommand({
|
|
512
513
|
cwd: options.cwd,
|
|
513
514
|
hook,
|
|
514
515
|
stderr: options.stderr,
|