@solaqua/gji 0.14.0 → 0.16.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/README.md +63 -120
- package/dist/cli/commands/back.d.ts +1 -1
- package/dist/cli/commands/back.js +1 -0
- package/dist/cli/commands/clean.d.ts +2 -1
- package/dist/cli/commands/clean.js +66 -18
- package/dist/cli/commands/done.js +3 -2
- package/dist/cli/commands/go.js +18 -5
- package/dist/cli/commands/init.js +0 -14
- package/dist/cli/commands/new.d.ts +2 -1
- package/dist/cli/commands/new.js +71 -63
- package/dist/cli/commands/open.js +1 -1
- package/dist/cli/commands/pr-open.js +2 -2
- package/dist/cli/commands/pr.js +17 -6
- package/dist/cli/commands/run-hook.js +4 -0
- package/dist/cli/commands/undo.js +10 -74
- package/dist/cli/dependencies.d.ts +5 -1
- package/dist/cli/dependencies.js +7 -2
- package/dist/cli/program.js +6 -56
- package/dist/cli/runtime/headless.d.ts +3 -3
- package/dist/cli/runtime/headless.js +6 -4
- package/dist/domain/worktree/path-filter.d.ts +13 -0
- package/dist/domain/worktree/path-filter.js +72 -0
- package/dist/domain/worktree/policy.d.ts +1 -0
- package/dist/domain/worktree/policy.js +1 -1
- package/dist/gji-bundle.mjs +738 -969
- package/dist/infrastructure/filesystem/locked-file.d.ts +4 -0
- package/dist/infrastructure/filesystem/locked-file.js +53 -0
- package/dist/infrastructure/git/runner.d.ts +7 -0
- package/dist/infrastructure/git/runner.js +35 -1
- package/dist/infrastructure/persistence/history.js +12 -10
- package/dist/infrastructure/persistence/slots.js +24 -21
- package/dist/infrastructure/process/hooks.js +2 -0
- package/dist/infrastructure/repository/registry.js +11 -41
- package/dist/infrastructure/worktree/lifecycle.d.ts +25 -0
- package/dist/infrastructure/worktree/lifecycle.js +120 -19
- package/dist/ports/git.d.ts +1 -0
- package/dist/ports/hooks.d.ts +7 -0
- package/dist/presentation/shell/completion.js +14 -32
- package/dist/presentation/terminal/context-card.js +1 -1
- package/man/man1/gji-back.1 +1 -1
- package/man/man1/gji-clean.1 +4 -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-root.1 +1 -1
- package/man/man1/gji-run-hook.1 +3 -3
- 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.1 +2 -12
- package/package.json +3 -2
- package/dist/cli/commands/remove.d.ts +0 -21
- package/dist/cli/commands/remove.js +0 -189
- package/dist/cli/commands/warp.d.ts +0 -28
- package/dist/cli/commands/warp.js +0 -123
- package/man/man1/gji-remove.1 +0 -19
- package/man/man1/gji-warp.1 +0 -16
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a predicate that matches worktree paths against any of the absolute
|
|
3
|
+
* patterns. A pattern without glob characters matches that directory and
|
|
4
|
+
* anything inside it. A pattern with `*` (within one segment), `**` (across
|
|
5
|
+
* segments), or `?` (one character) must match the whole path. A backslash
|
|
6
|
+
* makes the next character literal, so `\*` and `\?` match themselves. No
|
|
7
|
+
* patterns match every path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createWorktreePathFilter(patterns: readonly string[]): (worktreePath: string) => boolean;
|
|
10
|
+
/** Returns the index of the first unescaped glob character, or -1. */
|
|
11
|
+
export declare function findGlobIndex(pattern: string): number;
|
|
12
|
+
export declare function escapePathPattern(path: string): string;
|
|
13
|
+
export declare function unescapePathPattern(pattern: string): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a predicate that matches worktree paths against any of the absolute
|
|
3
|
+
* patterns. A pattern without glob characters matches that directory and
|
|
4
|
+
* anything inside it. A pattern with `*` (within one segment), `**` (across
|
|
5
|
+
* segments), or `?` (one character) must match the whole path. A backslash
|
|
6
|
+
* makes the next character literal, so `\*` and `\?` match themselves. No
|
|
7
|
+
* patterns match every path.
|
|
8
|
+
*/
|
|
9
|
+
export function createWorktreePathFilter(patterns) {
|
|
10
|
+
const matchers = patterns.map(createPathMatcher);
|
|
11
|
+
if (matchers.length === 0)
|
|
12
|
+
return () => true;
|
|
13
|
+
return (worktreePath) => matchers.some((matches) => matches(worktreePath));
|
|
14
|
+
}
|
|
15
|
+
/** Returns the index of the first unescaped glob character, or -1. */
|
|
16
|
+
export function findGlobIndex(pattern) {
|
|
17
|
+
for (let index = 0; index < pattern.length; index += 1) {
|
|
18
|
+
const character = pattern[index];
|
|
19
|
+
if (character === "\\")
|
|
20
|
+
index += 1;
|
|
21
|
+
else if (character === "*" || character === "?")
|
|
22
|
+
return index;
|
|
23
|
+
}
|
|
24
|
+
return -1;
|
|
25
|
+
}
|
|
26
|
+
export function escapePathPattern(path) {
|
|
27
|
+
return path.replace(/[\\*?]/g, "\\$&");
|
|
28
|
+
}
|
|
29
|
+
export function unescapePathPattern(pattern) {
|
|
30
|
+
return pattern.replace(/\\(.)/g, "$1");
|
|
31
|
+
}
|
|
32
|
+
function createPathMatcher(pattern) {
|
|
33
|
+
if (findGlobIndex(pattern) !== -1) {
|
|
34
|
+
const regExp = globToRegExp(pattern);
|
|
35
|
+
return (path) => regExp.test(path);
|
|
36
|
+
}
|
|
37
|
+
const literal = unescapePathPattern(pattern);
|
|
38
|
+
const prefix = literal === "/" ? "/" : `${literal}/`;
|
|
39
|
+
return (path) => path === literal || path.startsWith(prefix);
|
|
40
|
+
}
|
|
41
|
+
function globToRegExp(pattern) {
|
|
42
|
+
let source = "";
|
|
43
|
+
for (let index = 0; index < pattern.length; index += 1) {
|
|
44
|
+
let character = pattern[index];
|
|
45
|
+
if (character === "*") {
|
|
46
|
+
if (pattern[index + 1] === "*") {
|
|
47
|
+
index += 1;
|
|
48
|
+
if (pattern[index + 1] === "/") {
|
|
49
|
+
index += 1;
|
|
50
|
+
source += "(?:.*/)?";
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
source += ".*";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
source += "[^/]*";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (character === "?") {
|
|
61
|
+
source += "[^/]";
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (character === "\\" && index + 1 < pattern.length) {
|
|
65
|
+
index += 1;
|
|
66
|
+
character = pattern[index];
|
|
67
|
+
}
|
|
68
|
+
source += character.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return new RegExp(`^${source}$`);
|
|
72
|
+
}
|