@solaqua/gji 0.13.0 → 0.14.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/dist/application/worktree/go-resolution.js +5 -3
- package/dist/application/worktree/sources.d.ts +13 -4
- package/dist/application/worktree/sources.js +34 -13
- package/dist/cli/commands/clean.d.ts +3 -2
- package/dist/cli/commands/clean.js +299 -65
- package/dist/cli/commands/go.d.ts +2 -1
- package/dist/cli/commands/go.js +17 -13
- package/dist/cli/commands/hub.js +4 -1
- package/dist/cli/commands/warp.js +6 -4
- package/dist/domain/shared/concurrency.d.ts +1 -1
- package/dist/domain/shared/concurrency.js +6 -1
- package/dist/gji-bundle.mjs +492 -225
- package/dist/infrastructure/git/refs.js +3 -11
- package/dist/presentation/worktree/picker.d.ts +9 -6
- package/dist/presentation/worktree/picker.js +19 -2
- 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-doctor.1 +1 -1
- package/man/man1/gji-done.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 +1 -1
- 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-task.1 +1 -1
- package/man/man1/gji-undo.1 +1 -1
- package/man/man1/gji-warp.1 +1 -1
- package/man/man1/gji.1 +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorktreeCatalogDependencies } from "../../application/worktree/catalog.js";
|
|
1
2
|
import { type QueryWorktreePullRequests, type WorktreePromptEntry, type WorktreePromptScope } from "../../presentation/worktree/picker.js";
|
|
2
3
|
import { type CliRuntime } from "../dependencies.js";
|
|
3
4
|
export interface GoCommandOptions {
|
|
@@ -14,7 +15,7 @@ export interface GoCommandOptions {
|
|
|
14
15
|
type GoRuntime = CliRuntime<"bootstrap" | "config" | "contextCard" | "git" | "history" | "historyStore" | "hooks" | "integrations" | "repositoryContext" | "repositoryRefs" | "repositoryRegistry" | "slots" | "tasks" | "worktrees" | "worktreeCatalog">;
|
|
15
16
|
export interface GoCommandDependencies {
|
|
16
17
|
confirmBranchCreation: (branch: string) => Promise<boolean>;
|
|
17
|
-
promptForWorktree: (worktrees: WorktreePromptEntry[], scope?: WorktreePromptScope) => Promise<string | null>;
|
|
18
|
+
promptForWorktree: (worktrees: WorktreePromptEntry[], scope?: WorktreePromptScope, catalog?: WorktreeCatalogDependencies) => Promise<string | null>;
|
|
18
19
|
queryPullRequests: QueryWorktreePullRequests;
|
|
19
20
|
runtime: GoRuntime;
|
|
20
21
|
}
|
package/dist/cli/commands/go.js
CHANGED
|
@@ -49,13 +49,16 @@ export function createGoCommand(dependencies = {}) {
|
|
|
49
49
|
let promptSources = currentSources;
|
|
50
50
|
const loadAllSources = async () => {
|
|
51
51
|
if (registeredSources === null) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const registered = await listRegisteredWorktreeSources({
|
|
53
|
+
cwd: options.cwd,
|
|
54
|
+
repositoryPort: {
|
|
55
|
+
...runtime.repositoryContext,
|
|
56
|
+
...runtime.repositoryRegistry,
|
|
57
|
+
...runtime.worktrees,
|
|
58
|
+
},
|
|
58
59
|
});
|
|
60
|
+
registeredSources = registered.sources;
|
|
61
|
+
skippedRegisteredRepos = registered.skipped.length;
|
|
59
62
|
}
|
|
60
63
|
return deduplicateSources([...currentSources, ...registeredSources]);
|
|
61
64
|
};
|
|
@@ -79,10 +82,8 @@ export function createGoCommand(dependencies = {}) {
|
|
|
79
82
|
currentRepositoryScope = nextCurrentRepositoryScope;
|
|
80
83
|
promptSources = nextSources;
|
|
81
84
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
catalog: withPullRequestQueries(runtime, dependencies.queryPullRequests),
|
|
85
|
-
}),
|
|
85
|
+
sources: promptSources,
|
|
86
|
+
metadata: currentRepositoryScope ? "full" : "fast",
|
|
86
87
|
label: currentRepositoryScope
|
|
87
88
|
? "current repository"
|
|
88
89
|
: "all repositories",
|
|
@@ -97,7 +98,7 @@ export function createGoCommand(dependencies = {}) {
|
|
|
97
98
|
metadata: repository ? "full" : "fast",
|
|
98
99
|
catalog: withPullRequestQueries(runtime, dependencies.queryPullRequests),
|
|
99
100
|
});
|
|
100
|
-
const selectedPath = await prompt(promptEntries, scope);
|
|
101
|
+
const selectedPath = await prompt(promptEntries, scope, withPullRequestQueries(runtime, dependencies.queryPullRequests));
|
|
101
102
|
if (!selectedPath) {
|
|
102
103
|
options.stderr("Aborted\n");
|
|
103
104
|
return 1;
|
|
@@ -304,6 +305,9 @@ async function defaultConfirmBranchCreation(branch) {
|
|
|
304
305
|
});
|
|
305
306
|
return !isCancel(choice) && choice;
|
|
306
307
|
}
|
|
307
|
-
async function promptForWorktree(worktrees, scope) {
|
|
308
|
-
return promptForSingleWorktree("Choose a worktree", worktrees, {
|
|
308
|
+
async function promptForWorktree(worktrees, scope, catalog) {
|
|
309
|
+
return promptForSingleWorktree("Choose a worktree", worktrees, {
|
|
310
|
+
catalog,
|
|
311
|
+
scope,
|
|
312
|
+
});
|
|
309
313
|
}
|
package/dist/cli/commands/hub.js
CHANGED
|
@@ -18,7 +18,10 @@ export async function buildHubData(cwd, dependencies = {}, runtime = defaultCliD
|
|
|
18
18
|
const queryRepositoryPullRequests = dependencies.queryRepositoryPullRequests ??
|
|
19
19
|
runtime.pullRequests.listOpenPullRequestsForRepository;
|
|
20
20
|
const currentRepository = await detectRepository(cwd).catch(() => null);
|
|
21
|
-
const sources = await listDiscoverableWorktreeSources(
|
|
21
|
+
const { sources } = await listDiscoverableWorktreeSources({
|
|
22
|
+
cwd,
|
|
23
|
+
repositoryPort: sourceDependencies,
|
|
24
|
+
});
|
|
22
25
|
const groups = new Map();
|
|
23
26
|
for (const source of sources) {
|
|
24
27
|
if (!source.repoRoot)
|
|
@@ -65,10 +65,12 @@ export async function resolveWarpTarget(options) {
|
|
|
65
65
|
emitError("not in a git repository and no repos registered yet.", "Use any gji command inside a repository to register it.\n");
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
68
|
+
const registered = await listRegisteredWorktreeSources({
|
|
69
|
+
cwd: options.cwd,
|
|
70
|
+
repositoryPort: sourceDependencies,
|
|
71
|
+
});
|
|
72
|
+
const skippedRegisteredRepos = registered.skipped.length;
|
|
73
|
+
const allItems = registered.sources.filter((item) => item.repoRoot !== options.excludeRepoRoot);
|
|
72
74
|
if (allItems.length === 0) {
|
|
73
75
|
emitError("no accessible worktrees found in any registered repo.", skippedRegisteredRepos > 0
|
|
74
76
|
? "Hint: Run 'gji doctor' to inspect stale repository entries.\n"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function mapWithConcurrency<Input, Output>(items: readonly Input[], limit: number, mapper: (item: Input) => Promise<Output
|
|
1
|
+
export declare function mapWithConcurrency<Input, Output>(items: readonly Input[], limit: number, mapper: (item: Input) => Promise<Output>, signal?: AbortSignal): Promise<Output[]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export async function mapWithConcurrency(items, limit, mapper) {
|
|
1
|
+
export async function mapWithConcurrency(items, limit, mapper, signal) {
|
|
2
2
|
const results = new Array(items.length);
|
|
3
3
|
let nextIndex = 0;
|
|
4
4
|
async function readNext() {
|
|
5
5
|
for (;;) {
|
|
6
|
+
throwIfAborted(signal);
|
|
6
7
|
const index = nextIndex;
|
|
7
8
|
nextIndex += 1;
|
|
8
9
|
if (index >= items.length)
|
|
@@ -13,3 +14,7 @@ export async function mapWithConcurrency(items, limit, mapper) {
|
|
|
13
14
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => readNext()));
|
|
14
15
|
return results;
|
|
15
16
|
}
|
|
17
|
+
function throwIfAborted(signal) {
|
|
18
|
+
if (signal?.aborted)
|
|
19
|
+
throw new Error("Operation cancelled");
|
|
20
|
+
}
|