geeto 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +152 -0
- package/lib/api/copilot-adapter.d.ts +11 -0
- package/lib/api/copilot-adapter.d.ts.map +1 -0
- package/lib/api/copilot-adapter.js +41 -0
- package/lib/api/copilot-adapter.js.map +1 -0
- package/lib/api/copilot-sdk.d.ts +48 -0
- package/lib/api/copilot-sdk.d.ts.map +1 -0
- package/lib/api/copilot-sdk.js +451 -0
- package/lib/api/copilot-sdk.js.map +1 -0
- package/lib/api/copilot.d.ts +21 -0
- package/lib/api/copilot.d.ts.map +1 -0
- package/lib/api/copilot.js +87 -0
- package/lib/api/copilot.js.map +1 -0
- package/lib/api/gemini-sdk.d.ts +24 -0
- package/lib/api/gemini-sdk.d.ts.map +1 -0
- package/lib/api/gemini-sdk.js +245 -0
- package/lib/api/gemini-sdk.js.map +1 -0
- package/lib/api/gemini.d.ts +21 -0
- package/lib/api/gemini.d.ts.map +1 -0
- package/lib/api/gemini.js +87 -0
- package/lib/api/gemini.js.map +1 -0
- package/lib/api/openrouter-sdk.d.ts +58 -0
- package/lib/api/openrouter-sdk.d.ts.map +1 -0
- package/lib/api/openrouter-sdk.js +341 -0
- package/lib/api/openrouter-sdk.js.map +1 -0
- package/lib/api/openrouter.d.ts +17 -0
- package/lib/api/openrouter.d.ts.map +1 -0
- package/lib/api/openrouter.js +111 -0
- package/lib/api/openrouter.js.map +1 -0
- package/lib/api/trello.d.ts +17 -0
- package/lib/api/trello.d.ts.map +1 -0
- package/lib/api/trello.js +72 -0
- package/lib/api/trello.js.map +1 -0
- package/lib/cli/input.d.ts +39 -0
- package/lib/cli/input.d.ts.map +1 -0
- package/lib/cli/input.js +119 -0
- package/lib/cli/input.js.map +1 -0
- package/lib/cli/menu.d.ts +9 -0
- package/lib/cli/menu.d.ts.map +1 -0
- package/lib/cli/menu.js +201 -0
- package/lib/cli/menu.js.map +1 -0
- package/lib/core/constants.d.ts +22 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/constants.js +24 -0
- package/lib/core/constants.js.map +1 -0
- package/lib/core/copilot-setup.d.ts +13 -0
- package/lib/core/copilot-setup.d.ts.map +1 -0
- package/lib/core/copilot-setup.js +447 -0
- package/lib/core/copilot-setup.js.map +1 -0
- package/lib/core/gemini-setup.d.ts +8 -0
- package/lib/core/gemini-setup.d.ts.map +1 -0
- package/lib/core/gemini-setup.js +84 -0
- package/lib/core/gemini-setup.js.map +1 -0
- package/lib/core/menu-constants.d.ts +24 -0
- package/lib/core/menu-constants.d.ts.map +1 -0
- package/lib/core/menu-constants.js +22 -0
- package/lib/core/menu-constants.js.map +1 -0
- package/lib/core/openrouter-setup.d.ts +8 -0
- package/lib/core/openrouter-setup.d.ts.map +1 -0
- package/lib/core/openrouter-setup.js +73 -0
- package/lib/core/openrouter-setup.js.map +1 -0
- package/lib/core/setup.d.ts +21 -0
- package/lib/core/setup.d.ts.map +1 -0
- package/lib/core/setup.js +88 -0
- package/lib/core/setup.js.map +1 -0
- package/lib/core/trello-setup.d.ts +8 -0
- package/lib/core/trello-setup.d.ts.map +1 -0
- package/lib/core/trello-setup.js +107 -0
- package/lib/core/trello-setup.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +250 -0
- package/lib/index.js.map +1 -0
- package/lib/types/index.d.ts +78 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -0
- package/lib/utils/branch-naming.d.ts +11 -0
- package/lib/utils/branch-naming.d.ts.map +1 -0
- package/lib/utils/branch-naming.js +396 -0
- package/lib/utils/branch-naming.js.map +1 -0
- package/lib/utils/colors.d.ts +14 -0
- package/lib/utils/colors.d.ts.map +1 -0
- package/lib/utils/colors.js +14 -0
- package/lib/utils/colors.js.map +1 -0
- package/lib/utils/commit-helpers.d.ts +53 -0
- package/lib/utils/commit-helpers.d.ts.map +1 -0
- package/lib/utils/commit-helpers.js +177 -0
- package/lib/utils/commit-helpers.js.map +1 -0
- package/lib/utils/config.d.ts +87 -0
- package/lib/utils/config.d.ts.map +1 -0
- package/lib/utils/config.js +326 -0
- package/lib/utils/config.js.map +1 -0
- package/lib/utils/display.d.ts +27 -0
- package/lib/utils/display.d.ts.map +1 -0
- package/lib/utils/display.js +116 -0
- package/lib/utils/display.js.map +1 -0
- package/lib/utils/error-helpers.d.ts +27 -0
- package/lib/utils/error-helpers.d.ts.map +1 -0
- package/lib/utils/error-helpers.js +102 -0
- package/lib/utils/error-helpers.js.map +1 -0
- package/lib/utils/exec.d.ts +18 -0
- package/lib/utils/exec.d.ts.map +1 -0
- package/lib/utils/exec.js +96 -0
- package/lib/utils/exec.js.map +1 -0
- package/lib/utils/git-ai-errors.d.ts +10 -0
- package/lib/utils/git-ai-errors.d.ts.map +1 -0
- package/lib/utils/git-ai-errors.js +71 -0
- package/lib/utils/git-ai-errors.js.map +1 -0
- package/lib/utils/git-ai.d.ts +26 -0
- package/lib/utils/git-ai.d.ts.map +1 -0
- package/lib/utils/git-ai.js +603 -0
- package/lib/utils/git-ai.js.map +1 -0
- package/lib/utils/git-commands.d.ts +21 -0
- package/lib/utils/git-commands.d.ts.map +1 -0
- package/lib/utils/git-commands.js +58 -0
- package/lib/utils/git-commands.js.map +1 -0
- package/lib/utils/git-errors.d.ts +76 -0
- package/lib/utils/git-errors.d.ts.map +1 -0
- package/lib/utils/git-errors.js +565 -0
- package/lib/utils/git-errors.js.map +1 -0
- package/lib/utils/git.d.ts +61 -0
- package/lib/utils/git.d.ts.map +1 -0
- package/lib/utils/git.js +245 -0
- package/lib/utils/git.js.map +1 -0
- package/lib/utils/logging.d.ts +25 -0
- package/lib/utils/logging.d.ts.map +1 -0
- package/lib/utils/logging.js +71 -0
- package/lib/utils/logging.js.map +1 -0
- package/lib/utils/menu-builders.d.ts +47 -0
- package/lib/utils/menu-builders.d.ts.map +1 -0
- package/lib/utils/menu-builders.js +34 -0
- package/lib/utils/menu-builders.js.map +1 -0
- package/lib/utils/platform.d.ts +13 -0
- package/lib/utils/platform.d.ts.map +1 -0
- package/lib/utils/platform.js +32 -0
- package/lib/utils/platform.js.map +1 -0
- package/lib/utils/spinner-wrapper.d.ts +16 -0
- package/lib/utils/spinner-wrapper.d.ts.map +1 -0
- package/lib/utils/spinner-wrapper.js +56 -0
- package/lib/utils/spinner-wrapper.js.map +1 -0
- package/lib/utils/state.d.ts +22 -0
- package/lib/utils/state.d.ts.map +1 -0
- package/lib/utils/state.js +75 -0
- package/lib/utils/state.js.map +1 -0
- package/lib/utils/time.d.ts +4 -0
- package/lib/utils/time.d.ts.map +1 -0
- package/lib/utils/time.js +29 -0
- package/lib/utils/time.js.map +1 -0
- package/lib/utils/type-guards.d.ts +10 -0
- package/lib/utils/type-guards.d.ts.map +1 -0
- package/lib/utils/type-guards.js +29 -0
- package/lib/utils/type-guards.js.map +1 -0
- package/lib/workflows/ai-provider.d.ts +13 -0
- package/lib/workflows/ai-provider.d.ts.map +1 -0
- package/lib/workflows/ai-provider.js +55 -0
- package/lib/workflows/ai-provider.js.map +1 -0
- package/lib/workflows/author.d.ts +4 -0
- package/lib/workflows/author.d.ts.map +1 -0
- package/lib/workflows/author.js +80 -0
- package/lib/workflows/author.js.map +1 -0
- package/lib/workflows/branch-helpers.d.ts +9 -0
- package/lib/workflows/branch-helpers.d.ts.map +1 -0
- package/lib/workflows/branch-helpers.js +406 -0
- package/lib/workflows/branch-helpers.js.map +1 -0
- package/lib/workflows/branch-utils.d.ts +9 -0
- package/lib/workflows/branch-utils.d.ts.map +1 -0
- package/lib/workflows/branch-utils.js +61 -0
- package/lib/workflows/branch-utils.js.map +1 -0
- package/lib/workflows/branch.d.ts +12 -0
- package/lib/workflows/branch.d.ts.map +1 -0
- package/lib/workflows/branch.js +555 -0
- package/lib/workflows/branch.js.map +1 -0
- package/lib/workflows/cleanup.d.ts +10 -0
- package/lib/workflows/cleanup.d.ts.map +1 -0
- package/lib/workflows/cleanup.js +287 -0
- package/lib/workflows/cleanup.js.map +1 -0
- package/lib/workflows/commit.d.ts +10 -0
- package/lib/workflows/commit.d.ts.map +1 -0
- package/lib/workflows/commit.js +771 -0
- package/lib/workflows/commit.js.map +1 -0
- package/lib/workflows/main-steps.d.ts +12 -0
- package/lib/workflows/main-steps.d.ts.map +1 -0
- package/lib/workflows/main-steps.js +407 -0
- package/lib/workflows/main-steps.js.map +1 -0
- package/lib/workflows/main.d.ts +8 -0
- package/lib/workflows/main.d.ts.map +1 -0
- package/lib/workflows/main.js +720 -0
- package/lib/workflows/main.js.map +1 -0
- package/lib/workflows/security-gate.d.ts +8 -0
- package/lib/workflows/security-gate.d.ts.map +1 -0
- package/lib/workflows/security-gate.js +447 -0
- package/lib/workflows/security-gate.js.map +1 -0
- package/lib/workflows/settings.d.ts +15 -0
- package/lib/workflows/settings.d.ts.map +1 -0
- package/lib/workflows/settings.js +438 -0
- package/lib/workflows/settings.js.map +1 -0
- package/lib/workflows/trello-menu.d.ts +16 -0
- package/lib/workflows/trello-menu.d.ts.map +1 -0
- package/lib/workflows/trello-menu.js +361 -0
- package/lib/workflows/trello-menu.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display helpers for showing git and provider status
|
|
3
|
+
*/
|
|
4
|
+
import { colors } from './colors.js';
|
|
5
|
+
import { getTrelloConfig } from './config.js';
|
|
6
|
+
import { getGitUser, getRemoteUrl, getUpstreamBranch } from './git-commands.js';
|
|
7
|
+
import { withSpinnerSync } from './spinner-wrapper.js';
|
|
8
|
+
/**
|
|
9
|
+
* Display current git configuration and Trello board info
|
|
10
|
+
*/
|
|
11
|
+
export function displayCurrentProviderStatus() {
|
|
12
|
+
const gitInfo = withSpinnerSync('Loading git information...', () => {
|
|
13
|
+
const gitUser = getGitUser();
|
|
14
|
+
const remoteUrl = getRemoteUrl();
|
|
15
|
+
const upstream = getUpstreamBranch();
|
|
16
|
+
const trelloConfig = getTrelloConfig();
|
|
17
|
+
return { gitUser, remoteUrl, upstream, trelloConfig };
|
|
18
|
+
});
|
|
19
|
+
console.log(`${colors.cyan}┌─ Git Information ───────────────────────────────────────┐${colors.reset}`);
|
|
20
|
+
if (gitInfo.gitUser.name) {
|
|
21
|
+
console.log(`${colors.cyan}│${colors.reset} Username: ${colors.cyan}${gitInfo.gitUser.name}${colors.reset}`);
|
|
22
|
+
console.log(`${colors.cyan}│${colors.reset} Email: ${colors.cyan}${gitInfo.gitUser.email}${colors.reset}`);
|
|
23
|
+
}
|
|
24
|
+
if (gitInfo.remoteUrl) {
|
|
25
|
+
console.log(`${colors.cyan}│${colors.reset} Remote: ${colors.cyan}${gitInfo.remoteUrl}${colors.reset}`);
|
|
26
|
+
}
|
|
27
|
+
if (gitInfo.upstream) {
|
|
28
|
+
console.log(`${colors.cyan}│${colors.reset} Remote branch: ${colors.cyan}${gitInfo.upstream}${colors.reset}`);
|
|
29
|
+
}
|
|
30
|
+
if (gitInfo.trelloConfig.boardId) {
|
|
31
|
+
console.log(`${colors.cyan}│${colors.reset} Trello board: ${colors.cyan}${gitInfo.trelloConfig.boardId}${colors.reset}`);
|
|
32
|
+
}
|
|
33
|
+
console.log(`${colors.cyan}└─────────────────────────────────────────────────────────┘${colors.reset}`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get step name from step number
|
|
37
|
+
*/
|
|
38
|
+
export function getStepName(step) {
|
|
39
|
+
const STEP = {
|
|
40
|
+
NONE: 0,
|
|
41
|
+
STAGED: 1,
|
|
42
|
+
BRANCH_CREATED: 2,
|
|
43
|
+
COMMITTED: 3,
|
|
44
|
+
PUSHED: 4,
|
|
45
|
+
MERGED: 5,
|
|
46
|
+
CLEANUP: 6,
|
|
47
|
+
};
|
|
48
|
+
switch (step) {
|
|
49
|
+
case STEP.STAGED: {
|
|
50
|
+
return 'Staging completed';
|
|
51
|
+
}
|
|
52
|
+
case STEP.BRANCH_CREATED: {
|
|
53
|
+
return 'Branch created';
|
|
54
|
+
}
|
|
55
|
+
case STEP.COMMITTED: {
|
|
56
|
+
return 'Commit completed';
|
|
57
|
+
}
|
|
58
|
+
case STEP.PUSHED: {
|
|
59
|
+
return 'Push completed';
|
|
60
|
+
}
|
|
61
|
+
case STEP.MERGED: {
|
|
62
|
+
return 'Merge completed';
|
|
63
|
+
}
|
|
64
|
+
case STEP.CLEANUP: {
|
|
65
|
+
return 'Cleanup';
|
|
66
|
+
}
|
|
67
|
+
default: {
|
|
68
|
+
return 'Unknown';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Generate step progress visualization
|
|
74
|
+
* Format: [1✓ 2✓ 3● 4○ 5○ 6○]
|
|
75
|
+
* ✓ = completed, ● = current, ○ = pending
|
|
76
|
+
*/
|
|
77
|
+
export function getStepProgress(currentStep) {
|
|
78
|
+
const steps = [1, 2, 3, 4, 5, 6];
|
|
79
|
+
const icons = steps.map((stepNum) => {
|
|
80
|
+
if (stepNum < currentStep) {
|
|
81
|
+
return `${stepNum}✓`;
|
|
82
|
+
}
|
|
83
|
+
if (stepNum === currentStep) {
|
|
84
|
+
return `${stepNum}●`;
|
|
85
|
+
}
|
|
86
|
+
return `${stepNum}○`;
|
|
87
|
+
});
|
|
88
|
+
return `[${icons.join(' ')}]`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Display enhanced workflow completion summary
|
|
92
|
+
*/
|
|
93
|
+
export function displayCompletionSummary(state) {
|
|
94
|
+
console.log(`\n${colors.green}✓ Workflow Complete!${colors.reset}\n`);
|
|
95
|
+
console.log(`${colors.cyan}┌─ Summary ───────────────────────────────────────────────┐${colors.reset}`);
|
|
96
|
+
console.log(`${colors.cyan}│${colors.reset} Files staged: ${colors.bright}${state.stagedFiles}${colors.reset}`);
|
|
97
|
+
console.log(`${colors.cyan}│${colors.reset} Branch: ${colors.cyan}${state.workingBranch}${colors.reset}`);
|
|
98
|
+
if (state.commitMessage) {
|
|
99
|
+
const truncated = state.commitMessage.length > 50
|
|
100
|
+
? state.commitMessage.slice(0, 47) + '...'
|
|
101
|
+
: state.commitMessage;
|
|
102
|
+
console.log(`${colors.cyan}│${colors.reset} Commit: ${colors.gray}${truncated}${colors.reset}`);
|
|
103
|
+
}
|
|
104
|
+
if (state.targetBranch) {
|
|
105
|
+
console.log(`${colors.cyan}│${colors.reset} Merged to: ${colors.cyan}${state.targetBranch}${colors.reset}`);
|
|
106
|
+
}
|
|
107
|
+
console.log(`${colors.cyan}└─────────────────────────────────────────────────────────┘${colors.reset}`);
|
|
108
|
+
// Next steps suggestion
|
|
109
|
+
if (state.targetBranch) {
|
|
110
|
+
console.log(`\n${colors.gray}Next: Continue working on ${state.targetBranch}${colors.reset}\n`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
console.log(`\n${colors.gray}Next: Create a pull request or merge your changes${colors.reset}\n`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/utils/display.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD;;GAEG;AACH,MAAM,UAAU,4BAA4B;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACjE,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;QAC5B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;QAChC,MAAM,QAAQ,GAAG,iBAAiB,EAAE,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AAC,aAAa,CAAA;QACzB,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IACjG,CAAC;IAED,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CACT,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,eAAe,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,CAC/F,CAAA;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,GAAG,MAAM,CAAC,IAAI,8DAA8D,MAAM,CAAC,KAAK,EAAE,CAC3F,CAAA;IAED,wBAAwB;IACxB,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,IAAI,6BAA6B,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAA;IACjG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,KAAK,MAAM,CAAC,IAAI,oDAAoD,MAAM,CAAC,KAAK,IAAI,CACrF,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured error message helpers
|
|
3
|
+
*/
|
|
4
|
+
export interface ErrorWithHints {
|
|
5
|
+
message: string;
|
|
6
|
+
hints?: string[];
|
|
7
|
+
retry?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Display a structured error with actionable hints
|
|
11
|
+
*/
|
|
12
|
+
export declare function displayError(error: ErrorWithHints): void;
|
|
13
|
+
/**
|
|
14
|
+
* Common error scenarios with hints
|
|
15
|
+
*/
|
|
16
|
+
export declare const ErrorMessages: {
|
|
17
|
+
notGitRepo: () => ErrorWithHints;
|
|
18
|
+
noStagedFiles: () => ErrorWithHints;
|
|
19
|
+
pushFailed: (details?: string) => ErrorWithHints;
|
|
20
|
+
mergeConflict: () => ErrorWithHints;
|
|
21
|
+
authFailed: (service: string) => ErrorWithHints;
|
|
22
|
+
trelloNotConfigured: () => ErrorWithHints;
|
|
23
|
+
invalidBranchName: (reason: string) => ErrorWithHints;
|
|
24
|
+
branchExists: (branchName: string) => ErrorWithHints;
|
|
25
|
+
commitFailed: (reason?: string) => ErrorWithHints;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=error-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/error-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAcxD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;sBACR,cAAc;yBASX,cAAc;2BASV,MAAM,KAAG,cAAc;yBAW3B,cAAc;0BAUX,MAAM,KAAG,cAAc;+BAUpB,cAAc;gCASX,MAAM,KAAG,cAAc;+BASxB,MAAM,KAAG,cAAc;4BAS1B,MAAM,KAAG,cAAc;CAShD,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured error message helpers
|
|
3
|
+
*/
|
|
4
|
+
import { colors } from './colors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Display a structured error with actionable hints
|
|
7
|
+
*/
|
|
8
|
+
export function displayError(error) {
|
|
9
|
+
console.log(`\n${colors.red}✗ ${error.message}${colors.reset}`);
|
|
10
|
+
if (error.hints && error.hints.length > 0) {
|
|
11
|
+
for (const hint of error.hints) {
|
|
12
|
+
console.log(`${colors.yellow} → ${hint}${colors.reset}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (error.retry) {
|
|
16
|
+
console.log(`${colors.gray} ? Try again? (y/n)${colors.reset}`);
|
|
17
|
+
}
|
|
18
|
+
console.log('');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Common error scenarios with hints
|
|
22
|
+
*/
|
|
23
|
+
export const ErrorMessages = {
|
|
24
|
+
notGitRepo: () => ({
|
|
25
|
+
message: 'Not a git repository',
|
|
26
|
+
hints: [
|
|
27
|
+
'Initialize git with: git init',
|
|
28
|
+
'Or clone an existing repository',
|
|
29
|
+
'Make sure you are in the correct directory',
|
|
30
|
+
],
|
|
31
|
+
}),
|
|
32
|
+
noStagedFiles: () => ({
|
|
33
|
+
message: 'No staged files found',
|
|
34
|
+
hints: [
|
|
35
|
+
'Stage your changes with: git add <files>',
|
|
36
|
+
'Or use the staging step in the workflow',
|
|
37
|
+
'Check if there are changes: git status',
|
|
38
|
+
],
|
|
39
|
+
}),
|
|
40
|
+
pushFailed: (details) => ({
|
|
41
|
+
message: details ?? 'Push to remote failed',
|
|
42
|
+
hints: [
|
|
43
|
+
'Check your network connection',
|
|
44
|
+
'Verify remote repository access',
|
|
45
|
+
'Pull latest changes first: git pull',
|
|
46
|
+
'Check git output above for specific error',
|
|
47
|
+
],
|
|
48
|
+
retry: true,
|
|
49
|
+
}),
|
|
50
|
+
mergeConflict: () => ({
|
|
51
|
+
message: 'Merge conflict detected',
|
|
52
|
+
hints: [
|
|
53
|
+
'Resolve conflicts manually in your editor',
|
|
54
|
+
'Use: git status to see conflicted files',
|
|
55
|
+
'After resolving: git add <files> && git commit',
|
|
56
|
+
'Or abort merge: git merge --abort',
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
authFailed: (service) => ({
|
|
60
|
+
message: `${service} authentication failed`,
|
|
61
|
+
hints: [
|
|
62
|
+
`Verify your ${service} credentials`,
|
|
63
|
+
'Check if access token is valid',
|
|
64
|
+
'Run setup again to re-authenticate',
|
|
65
|
+
],
|
|
66
|
+
retry: true,
|
|
67
|
+
}),
|
|
68
|
+
trelloNotConfigured: () => ({
|
|
69
|
+
message: 'Trello integration not configured',
|
|
70
|
+
hints: [
|
|
71
|
+
'Run setup from Settings menu',
|
|
72
|
+
'Get API key from: https://trello.com/app-key',
|
|
73
|
+
"You'll need both API key and token",
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
invalidBranchName: (reason) => ({
|
|
77
|
+
message: `Invalid branch name: ${reason}`,
|
|
78
|
+
hints: [
|
|
79
|
+
'Branch names cannot contain spaces or special characters',
|
|
80
|
+
'Use lowercase letters, numbers, hyphens, and underscores',
|
|
81
|
+
'Follow format: type/description (e.g., feat/add-login)',
|
|
82
|
+
],
|
|
83
|
+
}),
|
|
84
|
+
branchExists: (branchName) => ({
|
|
85
|
+
message: `Branch '${branchName}' already exists`,
|
|
86
|
+
hints: [
|
|
87
|
+
'Use a different branch name',
|
|
88
|
+
'Switch to existing branch: git checkout ' + branchName,
|
|
89
|
+
'Delete existing branch: git branch -D ' + branchName,
|
|
90
|
+
],
|
|
91
|
+
}),
|
|
92
|
+
commitFailed: (reason) => ({
|
|
93
|
+
message: reason ?? 'Commit failed',
|
|
94
|
+
hints: [
|
|
95
|
+
'Check if commit hooks are passing',
|
|
96
|
+
'Ensure commit message is not empty',
|
|
97
|
+
'Review git hook errors in output above',
|
|
98
|
+
],
|
|
99
|
+
retry: true,
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=error-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-helpers.js","sourceRoot":"","sources":["../../src/utils/error-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAQpC;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,OAA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AAyB;QAClC,KAAK,EAAE;YACL,2CAA2C;YAC3C,yCAAyC;YACzC,gDAAgD;YAChD,mCAAmC;SACpC;KACF,CAAC;IAEF,UAAU,EAAE,CAAC,OAAe,EAAkB,EAAE,CAAC,CAAC;QAChD,OAAO,EAAE,GAAG,OAAO,wBAAwB;QAC3C,KAAK,EAAE;YACL,eAAe,OAAO,cAAc;YACpC,gCAAgC;YAChC,oCAAoC;SACrC;QACD,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,mBAAmB,EAAE,GAAmB,EAAE,CAAC,CAAC;QAC1C,OAAO,EAAE,mCAAmC;QAC5C,KAAK,EAAE;YACL,8BAA8B;YAC9B,8CAA8C;YAC9C,oCAAoC;SACrC;KACF,CAAC;IAEF,iBAAiB,EAAE,CAAC,MAAc,EAAkB,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,wBAAwB,MAAM,EAAE;QACzC,KAAK,EAAE;YACL,0DAA0D;YAC1D,0DAA0D;YAC1D,wDAAwD;SACzD;KACF,CAAC;IAEF,YAAY,EAAE,CAAC,UAAkB,EAAkB,EAAE,CAAC,CAAC;QACrD,OAAO,EAAE,WAAW,UAAU,kBAAkB;QAChD,KAAK,EAAE;YACL,6BAA6B;YAC7B,0CAA0C,GAAG,UAAU;YACvD,wCAAwC,GAAG,UAAU;SACtD;KACF,CAAC;IAEF,YAAY,EAAE,CAAC,MAAe,EAAkB,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,MAAM,IAAI,eAAe;QAClC,KAAK,EAAE;YACL,mCAAmC;YACnC,oCAAoC;YACpC,wCAAwC;SACzC;QACD,KAAK,EAAE,IAAI;KACZ,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Execute shell commands and helpers. */
|
|
2
|
+
/** Run a command and return its trimmed stdout. */
|
|
3
|
+
export declare const exec: (command: string, silent?: boolean) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Run a command asynchronously and return a promise that resolves when it exits.
|
|
6
|
+
* Streams output to stdout/stderr unless `silent` is true, in which case output is captured.
|
|
7
|
+
*/
|
|
8
|
+
export declare const execAsync: (command: string, silent?: boolean) => Promise<{
|
|
9
|
+
code: number;
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Run git commands and handle common non-zero exit codes gracefully. */
|
|
14
|
+
export declare const execGit: (command: string, silent?: boolean) => string;
|
|
15
|
+
export declare const execSilent: (command: string) => string;
|
|
16
|
+
/** Check whether an executable is available on PATH. */
|
|
17
|
+
export declare const commandExists: (command: string) => boolean;
|
|
18
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAM1C,mDAAmD;AACnD,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,EAAE,gBAAc,KAAG,MAUtD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,GACpB,SAAS,MAAM,EACf,SAAQ,OAAe,KACtB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAyC1D,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,EAAE,gBAAc,KAAG,MAgBzD,CAAA;AAGD,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,MAE5C,CAAA;AAED,wDAAwD;AACxD,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,OAS/C,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Execute shell commands and helpers. */
|
|
2
|
+
import { execSync, spawn } from 'node:child_process';
|
|
3
|
+
import { log } from './logging.js';
|
|
4
|
+
/** Run a command and return its trimmed stdout. */
|
|
5
|
+
export const exec = (command, silent = false) => {
|
|
6
|
+
try {
|
|
7
|
+
const result = execSync(command, { encoding: 'utf8', stdio: silent ? 'pipe' : 'inherit' });
|
|
8
|
+
return result?.trim() || '';
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (!silent) {
|
|
12
|
+
log.error(`Error executing: ${command}`);
|
|
13
|
+
}
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Run a command asynchronously and return a promise that resolves when it exits.
|
|
19
|
+
* Streams output to stdout/stderr unless `silent` is true, in which case output is captured.
|
|
20
|
+
*/
|
|
21
|
+
export const execAsync = (command, silent = false) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
try {
|
|
24
|
+
const child = spawn(command, { shell: true });
|
|
25
|
+
let out = '';
|
|
26
|
+
let err = '';
|
|
27
|
+
if (child.stdout) {
|
|
28
|
+
child.stdout.on('data', (d) => {
|
|
29
|
+
const s = d.toString();
|
|
30
|
+
out += s;
|
|
31
|
+
if (!silent)
|
|
32
|
+
process.stdout.write(s);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (child.stderr) {
|
|
36
|
+
child.stderr.on('data', (d) => {
|
|
37
|
+
const s = d.toString();
|
|
38
|
+
err += s;
|
|
39
|
+
if (!silent)
|
|
40
|
+
process.stderr.write(s);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
child.on('close', (code) => {
|
|
44
|
+
if (code === 0) {
|
|
45
|
+
resolve({ code: code ?? 0, stdout: out.trim(), stderr: err.trim() });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const errObj = new Error(`Command failed: ${command} (code ${code})`);
|
|
49
|
+
errObj.code = code ?? 0;
|
|
50
|
+
errObj.stdout = out;
|
|
51
|
+
errObj.stderr = err;
|
|
52
|
+
reject(errObj);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
reject(error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/** Run git commands and handle common non-zero exit codes gracefully. */
|
|
62
|
+
export const execGit = (command, silent = false) => {
|
|
63
|
+
try {
|
|
64
|
+
const result = execSync(command, { encoding: 'utf8', stdio: silent ? 'pipe' : 'inherit' });
|
|
65
|
+
return result?.trim() || '';
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
// For git commands, exit code 1 is often not an error (e.g., git diff when there are changes)
|
|
69
|
+
const execError = error;
|
|
70
|
+
if (execError.status === 1 && command.includes('git diff')) {
|
|
71
|
+
// Return empty string for git diff when there are no changes to diff
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
if (!silent) {
|
|
75
|
+
log.error(`Error executing: ${command}`);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// /** Run a command silently and return stdout. */
|
|
81
|
+
export const execSilent = (command) => {
|
|
82
|
+
return exec(command, true);
|
|
83
|
+
};
|
|
84
|
+
/** Check whether an executable is available on PATH. */
|
|
85
|
+
export const commandExists = (command) => {
|
|
86
|
+
const platform = process.platform;
|
|
87
|
+
const checkCommand = platform === 'win32' ? 'where' : 'which';
|
|
88
|
+
try {
|
|
89
|
+
exec(`${checkCommand} ${command}`, true);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAElC,mDAAmD;AACnD,MAAM,CAAC,MAAM,IAA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
export declare function isTransientAIFailure(s: string | null | undefined): boolean;
|
|
8
|
+
/** Detect errors caused by model/context token length limits. */
|
|
9
|
+
export declare function isContextLimitFailure(s: string | null | undefined): boolean;
|
|
10
|
+
//# sourceMappingURL=git-ai-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ai-errors.d.ts","sourceRoot":"","sources":["../../src/utils/git-ai-errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CA4C1E;AAED,iEAAiE;AACjE,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAqC3E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI error detection utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Heuristics to detect transient AI errors (rate limits, quota, billing).
|
|
6
|
+
*/
|
|
7
|
+
export function isTransientAIFailure(s) {
|
|
8
|
+
// Empty/null isn't considered transient; callers decide whether to fallback
|
|
9
|
+
if (!s) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const low = String(s).toLowerCase();
|
|
13
|
+
// If the assistant returns something that looks like a model name, it's probably not
|
|
14
|
+
if (low.includes('-') || low.includes('_')) {
|
|
15
|
+
const allowed = /^[\d_a-z-]+$/.test(low);
|
|
16
|
+
const hasToken = low.split(/[_-]/).every((t) => t.length > 0);
|
|
17
|
+
if (allowed && hasToken) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (/rate[\s_-]?limit(ed)?/.test(low)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (/quota/.test(low)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (/insufficient\s+credit|insufficient\s+credits|out\s+of\s+credits|out_of_credits/.test(low)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (/payment\s+required|payment\s+failed|billing/.test(low)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
const subscriptionPattern = /subscription\s+required|requires\s+subscription|must\s+upgrade|upgrade\s+required/;
|
|
34
|
+
if (subscriptionPattern.test(low)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (/not a valid model|model not found|invalid model id|model.*not found/.test(low)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
/** Detect errors caused by model/context token length limits. */
|
|
43
|
+
export function isContextLimitFailure(s) {
|
|
44
|
+
if (!s) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const low = String(s).toLowerCase();
|
|
48
|
+
// Common phrases from OpenRouter/Gemini/OpenAI about context length / token limits
|
|
49
|
+
if (low.includes('maximum context length') || low.includes('context length is')) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (low.includes('requested about') && low.includes('tokens')) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (low.includes('middle-out')) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (low.includes('context window') || low.includes('token limit')) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if (low.includes('large') || low.includes('many files')) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
// fallback: mention of tokens + too many/too long
|
|
65
|
+
if (low.includes('tokens') &&
|
|
66
|
+
(low.includes('too') || low.includes('exceed') || low.includes('exceeded'))) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=git-ai-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ai-errors.js","sourceRoot":"","sources":["../../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AED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CopilotModel } from '../api/copilot.js';
|
|
2
|
+
import type { GeminiModel } from '../api/gemini.js';
|
|
3
|
+
import type { OpenRouterModel } from '../api/openrouter.js';
|
|
4
|
+
import { isContextLimitFailure, isTransientAIFailure } from './git-ai-errors.js';
|
|
5
|
+
export { isContextLimitFailure, isTransientAIFailure };
|
|
6
|
+
/** Return the canonical string value for a model (object or string) */
|
|
7
|
+
export declare function getModelValue(m?: CopilotModel | OpenRouterModel | GeminiModel | string): string | undefined;
|
|
8
|
+
/** Return a friendly provider name. */
|
|
9
|
+
export declare function getAIProviderDisplayName(aiProvider: string): string;
|
|
10
|
+
/** Short provider name for brief displays. */
|
|
11
|
+
export declare function getAIProviderShortName(aiProvider: string): string;
|
|
12
|
+
/** Return the model to show for a provider. */
|
|
13
|
+
export declare function getModelDisplayName(aiProvider: string, model?: string): string;
|
|
14
|
+
/** Ask the right provider to generate a branch-name suffix. */
|
|
15
|
+
export declare function generateBranchNameWithProvider(aiProvider: string, title: string, correction?: string, copilotModel?: CopilotModel, openrouterModel?: OpenRouterModel, geminiModel?: GeminiModel): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Interactive fallback menu when AI generation fails.
|
|
18
|
+
*/
|
|
19
|
+
export declare function interactiveAIFallback(currentSuffix: string | null, aiProvider: 'gemini' | 'copilot' | 'openrouter', model: CopilotModel | OpenRouterModel | GeminiModel | string, diff: string, correction: string, _currentBranch: string, updateModel: (provider: 'gemini' | 'copilot' | 'openrouter', model?: CopilotModel | OpenRouterModel | GeminiModel | string) => void, isCommit?: boolean): Promise<string | null>;
|
|
20
|
+
export declare function getBranchNameFromDiffUsingProvider(provider: 'gemini' | 'copilot' | 'openrouter', diff: string, correction?: string, copilotModel?: CopilotModel, openrouterModel?: OpenRouterModel): Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Ensure provider setup and prompt the user to choose a model for that provider.
|
|
23
|
+
* Returns the chosen model value string or 'back' if the user went back, or undefined if setup failed.
|
|
24
|
+
*/
|
|
25
|
+
export declare function chooseModelForProvider(provider: 'gemini' | 'copilot' | 'openrouter', prompt?: string, backLabel?: string): Promise<string | 'back' | undefined>;
|
|
26
|
+
//# sourceMappingURL=git-ai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ai.d.ts","sourceRoot":"","sources":["../../src/utils/git-ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAIhF,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;AAItD,uEAAuE;AACvE,wBAAgB,aAAa,CAC3B,CAAC,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,WAAW,GAAG,MAAM,GACxD,MAAM,GAAG,SAAS,CASpB;AAED,uCAAuC;AACvC,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAenE;AAED,8CAA8C;AAC9C,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAejE;AAED,+CAA+C;AAC/C,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAW9E;AAED,+DAA+D;AAC/D,wBAAsB,8BAA8B,CAClD,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,YAAY,EAC3B,eAAe,CAAC,EAAE,eAAe,EACjC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,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