opencode-gitbutler 0.1.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/cli.d.ts ADDED
@@ -0,0 +1,85 @@
1
+ import type { Logger } from "./logger.js";
2
+ export type ButStatusChange = {
3
+ cliId?: string;
4
+ filePath?: string;
5
+ };
6
+ export type ButStatusCommit = {
7
+ changes?: ButStatusChange[];
8
+ };
9
+ export type ButStatusJson = {
10
+ unassignedChanges?: ButStatusChange[];
11
+ stacks?: Array<{
12
+ assignedChanges?: ButStatusChange[];
13
+ branches?: Array<{
14
+ cliId?: string;
15
+ name?: string;
16
+ commits?: ButStatusCommit[];
17
+ }>;
18
+ }>;
19
+ };
20
+ export type FileBranchResult = {
21
+ inBranch: boolean;
22
+ branchCliId?: string;
23
+ branchName?: string;
24
+ unassignedCliId?: string;
25
+ };
26
+ export type ButStatusBranch = {
27
+ cliId: string;
28
+ name: string;
29
+ branchStatus: string;
30
+ commits: Array<{
31
+ cliId: string;
32
+ commitId: string;
33
+ message: string;
34
+ changes?: ButStatusChange[];
35
+ }>;
36
+ };
37
+ export type ButStatusFull = {
38
+ unassignedChanges?: ButStatusChange[];
39
+ stacks?: Array<{
40
+ assignedChanges?: ButStatusChange[];
41
+ branches?: ButStatusBranch[];
42
+ }>;
43
+ };
44
+ export type HookOutput = {
45
+ title?: string;
46
+ output?: string;
47
+ metadata?: {
48
+ /** edit tool: file diff with before/after content */
49
+ filediff?: {
50
+ file?: string;
51
+ before?: string;
52
+ after?: string;
53
+ };
54
+ /** write tool: absolute file path */
55
+ filepath?: string;
56
+ diff?: string;
57
+ [key: string]: unknown;
58
+ };
59
+ [key: string]: unknown;
60
+ };
61
+ export type Cli = {
62
+ isWorkspaceMode: () => boolean;
63
+ findFileBranch: (filePath: string, statusData?: ButStatusFull | null) => FileBranchResult;
64
+ butRub: (source: string, dest: string) => boolean;
65
+ butUnapply: (branchCliId: string) => {
66
+ ok: boolean;
67
+ stderr: string;
68
+ };
69
+ butUnapplyWithRetry: (branchCliId: string, branchName: string, maxRetries?: number) => Promise<boolean>;
70
+ getFullStatus: () => ButStatusFull | null;
71
+ butReword: (target: string, message: string) => {
72
+ ok: boolean;
73
+ stderr: string;
74
+ };
75
+ butCursor: (subcommand: string, payload: Record<string, unknown>) => Promise<void>;
76
+ extractFilePath: (output: HookOutput) => string | undefined;
77
+ extractEdits: (output: HookOutput) => Array<{
78
+ old_string: string;
79
+ new_string: string;
80
+ }>;
81
+ hasMultiBranchHunks: (filePath: string, statusData?: ButStatusFull | null) => boolean;
82
+ toRelativePath: (absPath: string) => string;
83
+ };
84
+ export declare function createCli(cwd: string, log: Logger): Cli;
85
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;QACpC,QAAQ,CAAC,EAAE,KAAK,CAAC;YACf,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;SAC7B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,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,36 @@
1
+ export type GitButlerPluginConfig = {
2
+ /** Enable debug logging to .opencode/plugin/debug.log */
3
+ log_enabled: boolean;
4
+ /** Model ID for LLM commit message generation */
5
+ commit_message_model: string;
6
+ /** Provider ID for LLM commit message generation */
7
+ commit_message_provider: string;
8
+ /** Timeout in ms for LLM commit message generation */
9
+ llm_timeout_ms: number;
10
+ /** Maximum characters of diff to send to LLM */
11
+ max_diff_chars: number;
12
+ /** Maximum length of generated branch slug */
13
+ branch_slug_max_length: number;
14
+ /** Enable automatic version update checks */
15
+ auto_update: boolean;
16
+ /** Regex pattern string for default branch names (will be compiled to RegExp) */
17
+ default_branch_pattern: string;
18
+ /** Milliseconds before a file lock is considered stale */
19
+ stale_lock_ms: number;
20
+ /** Debounce window in ms for per-file edit hooks (0 to disable) */
21
+ edit_debounce_ms: number;
22
+ /** Run lightweight GC on session start (remove empty ge-branch-* branches) */
23
+ gc_on_session_start: boolean;
24
+ /** Max age in ms for pending notifications before they are considered expired (0 to disable) */
25
+ notification_max_age_ms: number;
26
+ /** When set, all sessions use this value for conversation_id instead of rootSessionID */
27
+ branch_target?: string;
28
+ };
29
+ export declare const DEFAULT_CONFIG: Readonly<GitButlerPluginConfig>;
30
+ /**
31
+ * Strip JSONC comments and trailing commas so the result is valid JSON.
32
+ * Tracks quote state to avoid stripping inside string literals.
33
+ */
34
+ export declare function stripJsonComments(input: string): string;
35
+ export declare function loadConfig(cwd: string): Promise<GitButlerPluginConfig>;
36
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,yDAAyD;IACzD,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,uBAAuB,EAAE,MAAM,CAAC;IAChC,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,6CAA6C;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,iFAAiF;IACjF,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gGAAgG;IAChG,uBAAuB,EAAE,MAAM,CAAC;IAChC,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,qBAAqB,CAa1D,CAAC;AAIF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA6CvD;AAYD,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,qBAAqB,CAAC,CA4DhC"}
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ declare const GitButlerPlugin: Plugin;
3
+ export default GitButlerPlugin;
4
+ export { GitButlerPlugin };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA8HlD,QAAA,MAAM,eAAe,EAAE,MAyEtB,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,CAAC"}