sessionlog 0.0.1
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 +388 -0
- package/dist/agent/agents/claude-code.d.ts +76 -0
- package/dist/agent/agents/claude-code.d.ts.map +1 -0
- package/dist/agent/agents/claude-code.js +769 -0
- package/dist/agent/agents/claude-code.js.map +1 -0
- package/dist/agent/agents/cursor.d.ts +35 -0
- package/dist/agent/agents/cursor.d.ts.map +1 -0
- package/dist/agent/agents/cursor.js +294 -0
- package/dist/agent/agents/cursor.js.map +1 -0
- package/dist/agent/agents/gemini-cli.d.ts +62 -0
- package/dist/agent/agents/gemini-cli.d.ts.map +1 -0
- package/dist/agent/agents/gemini-cli.js +474 -0
- package/dist/agent/agents/gemini-cli.js.map +1 -0
- package/dist/agent/agents/opencode.d.ts +100 -0
- package/dist/agent/agents/opencode.d.ts.map +1 -0
- package/dist/agent/agents/opencode.js +423 -0
- package/dist/agent/agents/opencode.js.map +1 -0
- package/dist/agent/registry.d.ts +54 -0
- package/dist/agent/registry.d.ts.map +1 -0
- package/dist/agent/registry.js +123 -0
- package/dist/agent/registry.js.map +1 -0
- package/dist/agent/session-types.d.ts +45 -0
- package/dist/agent/session-types.d.ts.map +1 -0
- package/dist/agent/session-types.js +48 -0
- package/dist/agent/session-types.js.map +1 -0
- package/dist/agent/types.d.ts +126 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +40 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +425 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/clean.d.ts +30 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +98 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/disable.d.ts +23 -0
- package/dist/commands/disable.d.ts.map +1 -0
- package/dist/commands/disable.js +57 -0
- package/dist/commands/disable.js.map +1 -0
- package/dist/commands/doctor.d.ts +43 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +97 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/enable.d.ts +37 -0
- package/dist/commands/enable.d.ts.map +1 -0
- package/dist/commands/enable.js +133 -0
- package/dist/commands/enable.js.map +1 -0
- package/dist/commands/explain.d.ts +68 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +182 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/reset.d.ts +23 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +68 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/resume.d.ts +42 -0
- package/dist/commands/resume.d.ts.map +1 -0
- package/dist/commands/resume.js +133 -0
- package/dist/commands/resume.js.map +1 -0
- package/dist/commands/rewind.d.ts +34 -0
- package/dist/commands/rewind.d.ts.map +1 -0
- package/dist/commands/rewind.js +155 -0
- package/dist/commands/rewind.js.map +1 -0
- package/dist/commands/status.d.ts +51 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +112 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +127 -0
- package/dist/config.js.map +1 -0
- package/dist/git-operations.d.ts +191 -0
- package/dist/git-operations.d.ts.map +1 -0
- package/dist/git-operations.js +462 -0
- package/dist/git-operations.js.map +1 -0
- package/dist/hooks/git-hooks.d.ts +22 -0
- package/dist/hooks/git-hooks.d.ts.map +1 -0
- package/dist/hooks/git-hooks.js +139 -0
- package/dist/hooks/git-hooks.js.map +1 -0
- package/dist/hooks/lifecycle.d.ts +21 -0
- package/dist/hooks/lifecycle.d.ts.map +1 -0
- package/dist/hooks/lifecycle.js +179 -0
- package/dist/hooks/lifecycle.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/security/redaction.d.ts +35 -0
- package/dist/security/redaction.d.ts.map +1 -0
- package/dist/security/redaction.js +239 -0
- package/dist/security/redaction.js.map +1 -0
- package/dist/session/state-machine.d.ts +90 -0
- package/dist/session/state-machine.d.ts.map +1 -0
- package/dist/session/state-machine.js +345 -0
- package/dist/session/state-machine.js.map +1 -0
- package/dist/store/checkpoint-store.d.ts +59 -0
- package/dist/store/checkpoint-store.d.ts.map +1 -0
- package/dist/store/checkpoint-store.js +321 -0
- package/dist/store/checkpoint-store.js.map +1 -0
- package/dist/store/native-store.d.ts +14 -0
- package/dist/store/native-store.d.ts.map +1 -0
- package/dist/store/native-store.js +159 -0
- package/dist/store/native-store.js.map +1 -0
- package/dist/store/provider-types.d.ts +78 -0
- package/dist/store/provider-types.d.ts.map +1 -0
- package/dist/store/provider-types.js +12 -0
- package/dist/store/provider-types.js.map +1 -0
- package/dist/store/session-store.d.ts +36 -0
- package/dist/store/session-store.d.ts.map +1 -0
- package/dist/store/session-store.js +193 -0
- package/dist/store/session-store.js.map +1 -0
- package/dist/strategy/attribution.d.ts +39 -0
- package/dist/strategy/attribution.d.ts.map +1 -0
- package/dist/strategy/attribution.js +225 -0
- package/dist/strategy/attribution.js.map +1 -0
- package/dist/strategy/common.d.ts +57 -0
- package/dist/strategy/common.d.ts.map +1 -0
- package/dist/strategy/common.js +156 -0
- package/dist/strategy/common.js.map +1 -0
- package/dist/strategy/content-overlap.d.ts +33 -0
- package/dist/strategy/content-overlap.d.ts.map +1 -0
- package/dist/strategy/content-overlap.js +176 -0
- package/dist/strategy/content-overlap.js.map +1 -0
- package/dist/strategy/manual-commit.d.ts +36 -0
- package/dist/strategy/manual-commit.d.ts.map +1 -0
- package/dist/strategy/manual-commit.js +717 -0
- package/dist/strategy/manual-commit.js.map +1 -0
- package/dist/strategy/types.d.ts +163 -0
- package/dist/strategy/types.d.ts.map +1 -0
- package/dist/strategy/types.js +48 -0
- package/dist/strategy/types.js.map +1 -0
- package/dist/summarize/claude-generator.d.ts +25 -0
- package/dist/summarize/claude-generator.d.ts.map +1 -0
- package/dist/summarize/claude-generator.js +87 -0
- package/dist/summarize/claude-generator.js.map +1 -0
- package/dist/summarize/summarize.d.ts +52 -0
- package/dist/summarize/summarize.d.ts.map +1 -0
- package/dist/summarize/summarize.js +335 -0
- package/dist/summarize/summarize.js.map +1 -0
- package/dist/types.d.ts +293 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +94 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/chunk-files.d.ts +25 -0
- package/dist/utils/chunk-files.d.ts.map +1 -0
- package/dist/utils/chunk-files.js +47 -0
- package/dist/utils/chunk-files.js.map +1 -0
- package/dist/utils/commit-message.d.ts +11 -0
- package/dist/utils/commit-message.d.ts.map +1 -0
- package/dist/utils/commit-message.js +54 -0
- package/dist/utils/commit-message.js.map +1 -0
- package/dist/utils/detect-agent.d.ts +19 -0
- package/dist/utils/detect-agent.d.ts.map +1 -0
- package/dist/utils/detect-agent.js +34 -0
- package/dist/utils/detect-agent.js.map +1 -0
- package/dist/utils/hook-managers.d.ts +24 -0
- package/dist/utils/hook-managers.d.ts.map +1 -0
- package/dist/utils/hook-managers.js +96 -0
- package/dist/utils/hook-managers.js.map +1 -0
- package/dist/utils/ide-tags.d.ts +12 -0
- package/dist/utils/ide-tags.d.ts.map +1 -0
- package/dist/utils/ide-tags.js +30 -0
- package/dist/utils/ide-tags.js.map +1 -0
- package/dist/utils/paths.d.ts +32 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +55 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/preview-rewind.d.ts +23 -0
- package/dist/utils/preview-rewind.d.ts.map +1 -0
- package/dist/utils/preview-rewind.js +63 -0
- package/dist/utils/preview-rewind.js.map +1 -0
- package/dist/utils/rewind-conflict.d.ts +52 -0
- package/dist/utils/rewind-conflict.d.ts.map +1 -0
- package/dist/utils/rewind-conflict.js +79 -0
- package/dist/utils/rewind-conflict.js.map +1 -0
- package/dist/utils/shadow-branch.d.ts +44 -0
- package/dist/utils/shadow-branch.d.ts.map +1 -0
- package/dist/utils/shadow-branch.js +93 -0
- package/dist/utils/shadow-branch.js.map +1 -0
- package/dist/utils/string-utils.d.ts +24 -0
- package/dist/utils/string-utils.d.ts.map +1 -0
- package/dist/utils/string-utils.js +47 -0
- package/dist/utils/string-utils.js.map +1 -0
- package/dist/utils/todo-extract.d.ts +52 -0
- package/dist/utils/todo-extract.d.ts.map +1 -0
- package/dist/utils/todo-extract.js +167 -0
- package/dist/utils/todo-extract.js.map +1 -0
- package/dist/utils/trailers.d.ts +36 -0
- package/dist/utils/trailers.d.ts.map +1 -0
- package/dist/utils/trailers.js +148 -0
- package/dist/utils/trailers.js.map +1 -0
- package/dist/utils/transcript-parse.d.ts +57 -0
- package/dist/utils/transcript-parse.d.ts.map +1 -0
- package/dist/utils/transcript-parse.js +126 -0
- package/dist/utils/transcript-parse.js.map +1 -0
- package/dist/utils/transcript-timestamp.d.ts +22 -0
- package/dist/utils/transcript-timestamp.d.ts.map +1 -0
- package/dist/utils/transcript-timestamp.js +56 -0
- package/dist/utils/transcript-timestamp.js.map +1 -0
- package/dist/utils/tree-ops.d.ts +47 -0
- package/dist/utils/tree-ops.d.ts.map +1 -0
- package/dist/utils/tree-ops.js +145 -0
- package/dist/utils/tree-ops.js.map +1 -0
- package/dist/utils/tty.d.ts +25 -0
- package/dist/utils/tty.d.ts.map +1 -0
- package/dist/utils/tty.js +70 -0
- package/dist/utils/tty.js.map +1 -0
- package/dist/utils/validation.d.ts +31 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +59 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils/worktree.d.ts +16 -0
- package/dist/utils/worktree.d.ts.map +1 -0
- package/dist/utils/worktree.js +50 -0
- package/dist/utils/worktree.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Operations
|
|
3
|
+
*
|
|
4
|
+
* Low-level git operations that shell out to the git CLI.
|
|
5
|
+
* This approach avoids a dependency on a full git library while
|
|
6
|
+
* providing the operations needed for session and checkpoint management.
|
|
7
|
+
*/
|
|
8
|
+
export interface GitAuthor {
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GitExecOptions {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
env?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export declare class GitError extends Error {
|
|
18
|
+
readonly exitCode: number | null;
|
|
19
|
+
readonly stderr: string;
|
|
20
|
+
constructor(message: string, exitCode: number | null, stderr: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute a git command and return stdout
|
|
24
|
+
*/
|
|
25
|
+
export declare function git(args: string[], options?: GitExecOptions): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute a git command, returning null on error instead of throwing
|
|
28
|
+
*/
|
|
29
|
+
export declare function gitSafe(args: string[], options?: GitExecOptions): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the git directory for the working tree
|
|
32
|
+
*/
|
|
33
|
+
export declare function getGitDir(cwd?: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the git common directory (shared for worktrees)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getGitCommonDir(cwd?: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the worktree root directory
|
|
40
|
+
*/
|
|
41
|
+
export declare function getWorktreeRoot(cwd?: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if we're inside a git repository
|
|
44
|
+
*/
|
|
45
|
+
export declare function isGitRepository(cwd?: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Get the sessions directory path (.git/entire-sessions/)
|
|
48
|
+
*/
|
|
49
|
+
export declare function getSessionsDir(cwd?: string): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Initialize a separate git repository for session/checkpoint storage.
|
|
52
|
+
* Creates the repo if it doesn't already exist.
|
|
53
|
+
* Returns the absolute path to the initialized repo.
|
|
54
|
+
*/
|
|
55
|
+
export declare function initSessionRepo(repoPath: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve the session repo path to an absolute path (if configured).
|
|
58
|
+
* If the path is relative, it's resolved relative to the project root.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveSessionRepoPath(sessionRepoPath: string, projectRoot: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Derive a stable, human-readable project identifier from the project's worktree root.
|
|
63
|
+
* This is used to namespace data when multiple projects share a session repo.
|
|
64
|
+
*
|
|
65
|
+
* Format: `<dir-name>-<short-hash>` (e.g. "my-project-a1b2c3d4").
|
|
66
|
+
* The directory name is sanitized to lowercase alphanumeric + hyphens,
|
|
67
|
+
* and a short hash suffix ensures uniqueness when two projects share
|
|
68
|
+
* the same directory name at different paths.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getProjectID(projectRoot: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Get the current HEAD commit hash
|
|
73
|
+
*/
|
|
74
|
+
export declare function getHead(cwd?: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the short hash of a commit
|
|
77
|
+
*/
|
|
78
|
+
export declare function getShortHash(ref: string, cwd?: string): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Get current branch name, or null if detached HEAD
|
|
81
|
+
*/
|
|
82
|
+
export declare function getCurrentBranch(cwd?: string): Promise<string | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Check if a ref exists
|
|
85
|
+
*/
|
|
86
|
+
export declare function refExists(ref: string, cwd?: string): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Get the tree hash for a commit
|
|
89
|
+
*/
|
|
90
|
+
export declare function getTreeHash(ref: string, cwd?: string): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* List branches matching a pattern
|
|
93
|
+
*/
|
|
94
|
+
export declare function listBranches(pattern?: string, cwd?: string): Promise<string[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Create a branch at a ref
|
|
97
|
+
*/
|
|
98
|
+
export declare function createBranch(name: string, ref: string, cwd?: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Delete a branch
|
|
101
|
+
*/
|
|
102
|
+
export declare function deleteBranch(name: string, force?: boolean, cwd?: string): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Update a branch ref to point to a new commit
|
|
105
|
+
*/
|
|
106
|
+
export declare function updateRef(ref: string, commitHash: string, cwd?: string): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Get the git author from config
|
|
109
|
+
*/
|
|
110
|
+
export declare function getGitAuthor(cwd?: string): Promise<GitAuthor>;
|
|
111
|
+
/**
|
|
112
|
+
* Create a tree object from a list of entries
|
|
113
|
+
*/
|
|
114
|
+
export declare function mktree(entries: Array<{
|
|
115
|
+
mode: string;
|
|
116
|
+
type: string;
|
|
117
|
+
hash: string;
|
|
118
|
+
name: string;
|
|
119
|
+
}>, cwd?: string): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a blob from content
|
|
122
|
+
*/
|
|
123
|
+
export declare function hashObject(content: string | Buffer, cwd?: string): Promise<string>;
|
|
124
|
+
/**
|
|
125
|
+
* Create a commit object
|
|
126
|
+
*/
|
|
127
|
+
export declare function commitTree(treeHash: string, parentHash: string | null, message: string, author: GitAuthor, cwd?: string): Promise<string>;
|
|
128
|
+
/**
|
|
129
|
+
* List entries in a tree
|
|
130
|
+
*/
|
|
131
|
+
export declare function lsTree(ref: string, treePath?: string, cwd?: string): Promise<Array<{
|
|
132
|
+
mode: string;
|
|
133
|
+
type: string;
|
|
134
|
+
hash: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}>>;
|
|
137
|
+
/**
|
|
138
|
+
* Read a blob from the object store
|
|
139
|
+
*/
|
|
140
|
+
export declare function catFile(ref: string, cwd?: string): Promise<string>;
|
|
141
|
+
/**
|
|
142
|
+
* Read a file from a specific tree/commit
|
|
143
|
+
*/
|
|
144
|
+
export declare function showFile(ref: string, filePath: string, cwd?: string): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* Get log entries for a ref
|
|
147
|
+
*/
|
|
148
|
+
export declare function log(ref: string, options?: {
|
|
149
|
+
maxCount?: number;
|
|
150
|
+
format?: string;
|
|
151
|
+
}, cwd?: string): Promise<string>;
|
|
152
|
+
/**
|
|
153
|
+
* Get list of files changed between two refs
|
|
154
|
+
*/
|
|
155
|
+
export declare function diffNameOnly(refA: string, refB: string, cwd?: string): Promise<{
|
|
156
|
+
added: string[];
|
|
157
|
+
modified: string[];
|
|
158
|
+
deleted: string[];
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* Get stat of diff between two refs (line counts)
|
|
162
|
+
*/
|
|
163
|
+
export declare function diffStat(refA: string, refB: string, cwd?: string): Promise<{
|
|
164
|
+
additions: number;
|
|
165
|
+
deletions: number;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* Check if the working tree has uncommitted changes
|
|
169
|
+
*/
|
|
170
|
+
export declare function hasUncommittedChanges(cwd?: string): Promise<boolean>;
|
|
171
|
+
/**
|
|
172
|
+
* Get list of untracked files
|
|
173
|
+
*/
|
|
174
|
+
export declare function getUntrackedFiles(cwd?: string): Promise<string[]>;
|
|
175
|
+
/**
|
|
176
|
+
* Check if on the default branch (main/master)
|
|
177
|
+
*/
|
|
178
|
+
export declare function isOnDefaultBranch(cwd?: string): Promise<[boolean, string]>;
|
|
179
|
+
/**
|
|
180
|
+
* Push a branch to a remote
|
|
181
|
+
*/
|
|
182
|
+
export declare function pushBranch(remote: string, branch: string, force?: boolean, cwd?: string): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Resolve the git directory from a path, handling worktrees
|
|
185
|
+
*/
|
|
186
|
+
export declare function resolveGitDirSync(startPath: string): string | null;
|
|
187
|
+
/**
|
|
188
|
+
* Atomically write a file (write to tmp, then rename)
|
|
189
|
+
*/
|
|
190
|
+
export declare function atomicWriteFile(filePath: string, content: string | Buffer): Promise<void>;
|
|
191
|
+
//# sourceMappingURL=git-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.d.ts","sourceRoot":"","sources":["../src/git-operations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmCH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qBAAa,QAAS,SAAQ,KAAK;aAGf,QAAQ,EAAE,MAAM,GAAG,IAAI;aACvB,MAAM,EAAE,MAAM;gBAF9B,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,MAAM,EAAE,MAAM;CAKjC;AAMD;;GAEG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvF;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMxB;AAMD;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnE;AAED;;GAEG;AACH,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CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG1E;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIvE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAKhF;AAMD;;GAEG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,UAAQ,EACb,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAIf;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqBlE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/F"}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Operations
|
|
3
|
+
*
|
|
4
|
+
* Low-level git operations that shell out to the git CLI.
|
|
5
|
+
* This approach avoids a dependency on a full git library while
|
|
6
|
+
* providing the operations needed for session and checkpoint management.
|
|
7
|
+
*/
|
|
8
|
+
import { execFile } from 'node:child_process';
|
|
9
|
+
import { promisify } from 'node:util';
|
|
10
|
+
import * as crypto from 'node:crypto';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import * as fs from 'node:fs';
|
|
13
|
+
const execFileAsync = promisify(execFile);
|
|
14
|
+
/**
|
|
15
|
+
* Execute a command with stdin input
|
|
16
|
+
*/
|
|
17
|
+
function execWithInput(cmd, args, input, options) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const child = execFile(cmd, args, options, (err, stdout, stderr) => {
|
|
20
|
+
if (err)
|
|
21
|
+
reject(err);
|
|
22
|
+
else
|
|
23
|
+
resolve({ stdout: String(stdout), stderr: String(stderr) });
|
|
24
|
+
});
|
|
25
|
+
if (child.stdin) {
|
|
26
|
+
child.stdin.write(input);
|
|
27
|
+
child.stdin.end();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export class GitError extends Error {
|
|
32
|
+
exitCode;
|
|
33
|
+
stderr;
|
|
34
|
+
constructor(message, exitCode, stderr) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.exitCode = exitCode;
|
|
37
|
+
this.stderr = stderr;
|
|
38
|
+
this.name = 'GitError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Core Git Execution
|
|
43
|
+
// ============================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Execute a git command and return stdout
|
|
46
|
+
*/
|
|
47
|
+
export async function git(args, options = {}) {
|
|
48
|
+
const cwd = options.cwd ?? process.cwd();
|
|
49
|
+
const timeout = options.timeout ?? 30000;
|
|
50
|
+
try {
|
|
51
|
+
const result = await execFileAsync('git', args, {
|
|
52
|
+
cwd,
|
|
53
|
+
timeout,
|
|
54
|
+
env: { ...process.env, ...options.env, GIT_TERMINAL_PROMPT: '0' },
|
|
55
|
+
maxBuffer: 50 * 1024 * 1024, // 50MB
|
|
56
|
+
});
|
|
57
|
+
return result.stdout.trimEnd();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const execError = error;
|
|
61
|
+
throw new GitError(`git ${args.join(' ')} failed: ${execError.stderr ?? execError.message ?? 'unknown error'}`, typeof execError.code === 'number' ? execError.code : null, String(execError.stderr ?? ''));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Execute a git command, returning null on error instead of throwing
|
|
66
|
+
*/
|
|
67
|
+
export async function gitSafe(args, options = {}) {
|
|
68
|
+
try {
|
|
69
|
+
return await git(args, options);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Repository Discovery
|
|
77
|
+
// ============================================================================
|
|
78
|
+
/**
|
|
79
|
+
* Get the git directory for the working tree
|
|
80
|
+
*/
|
|
81
|
+
export async function getGitDir(cwd) {
|
|
82
|
+
return git(['rev-parse', '--git-dir'], { cwd });
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get the git common directory (shared for worktrees)
|
|
86
|
+
*/
|
|
87
|
+
export async function getGitCommonDir(cwd) {
|
|
88
|
+
return git(['rev-parse', '--git-common-dir'], { cwd });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get the worktree root directory
|
|
92
|
+
*/
|
|
93
|
+
export async function getWorktreeRoot(cwd) {
|
|
94
|
+
return git(['rev-parse', '--show-toplevel'], { cwd });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if we're inside a git repository
|
|
98
|
+
*/
|
|
99
|
+
export async function isGitRepository(cwd) {
|
|
100
|
+
const result = await gitSafe(['rev-parse', '--is-inside-work-tree'], { cwd });
|
|
101
|
+
return result === 'true';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the sessions directory path (.git/entire-sessions/)
|
|
105
|
+
*/
|
|
106
|
+
export async function getSessionsDir(cwd) {
|
|
107
|
+
const gitDir = await getGitDir(cwd);
|
|
108
|
+
return path.resolve(cwd ?? process.cwd(), gitDir, 'entire-sessions');
|
|
109
|
+
}
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// Session Repository
|
|
112
|
+
// ============================================================================
|
|
113
|
+
/**
|
|
114
|
+
* Initialize a separate git repository for session/checkpoint storage.
|
|
115
|
+
* Creates the repo if it doesn't already exist.
|
|
116
|
+
* Returns the absolute path to the initialized repo.
|
|
117
|
+
*/
|
|
118
|
+
export async function initSessionRepo(repoPath) {
|
|
119
|
+
const absPath = path.resolve(repoPath);
|
|
120
|
+
try {
|
|
121
|
+
await fs.promises.access(path.join(absPath, '.git'));
|
|
122
|
+
// Already initialized
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
await fs.promises.mkdir(absPath, { recursive: true });
|
|
126
|
+
await execFileAsync('git', ['init'], {
|
|
127
|
+
cwd: absPath,
|
|
128
|
+
timeout: 30000,
|
|
129
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
130
|
+
});
|
|
131
|
+
// Create an initial empty commit so refs work properly
|
|
132
|
+
await execFileAsync('git', ['commit', '--allow-empty', '-m', 'Initialize session repository'], {
|
|
133
|
+
cwd: absPath,
|
|
134
|
+
timeout: 30000,
|
|
135
|
+
env: {
|
|
136
|
+
...process.env,
|
|
137
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
138
|
+
GIT_AUTHOR_NAME: 'Entire',
|
|
139
|
+
GIT_AUTHOR_EMAIL: 'entire@localhost',
|
|
140
|
+
GIT_COMMITTER_NAME: 'Entire',
|
|
141
|
+
GIT_COMMITTER_EMAIL: 'entire@localhost',
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return absPath;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Resolve the session repo path to an absolute path (if configured).
|
|
149
|
+
* If the path is relative, it's resolved relative to the project root.
|
|
150
|
+
*/
|
|
151
|
+
export function resolveSessionRepoPath(sessionRepoPath, projectRoot) {
|
|
152
|
+
return path.resolve(projectRoot, sessionRepoPath);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Derive a stable, human-readable project identifier from the project's worktree root.
|
|
156
|
+
* This is used to namespace data when multiple projects share a session repo.
|
|
157
|
+
*
|
|
158
|
+
* Format: `<dir-name>-<short-hash>` (e.g. "my-project-a1b2c3d4").
|
|
159
|
+
* The directory name is sanitized to lowercase alphanumeric + hyphens,
|
|
160
|
+
* and a short hash suffix ensures uniqueness when two projects share
|
|
161
|
+
* the same directory name at different paths.
|
|
162
|
+
*/
|
|
163
|
+
export function getProjectID(projectRoot) {
|
|
164
|
+
const absRoot = path.resolve(projectRoot);
|
|
165
|
+
const dirName = path.basename(absRoot);
|
|
166
|
+
// Sanitize: lowercase, replace non-alphanumeric with hyphens, collapse/trim hyphens
|
|
167
|
+
const sanitized = dirName
|
|
168
|
+
.toLowerCase()
|
|
169
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
170
|
+
.replace(/-+/g, '-')
|
|
171
|
+
.replace(/^-|-$/g, '');
|
|
172
|
+
const shortHash = crypto.createHash('sha256').update(absRoot).digest('hex').slice(0, 8);
|
|
173
|
+
const prefix = sanitized || 'project';
|
|
174
|
+
return `${prefix}-${shortHash}`;
|
|
175
|
+
}
|
|
176
|
+
// ============================================================================
|
|
177
|
+
// Ref Operations
|
|
178
|
+
// ============================================================================
|
|
179
|
+
/**
|
|
180
|
+
* Get the current HEAD commit hash
|
|
181
|
+
*/
|
|
182
|
+
export async function getHead(cwd) {
|
|
183
|
+
return git(['rev-parse', 'HEAD'], { cwd });
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get the short hash of a commit
|
|
187
|
+
*/
|
|
188
|
+
export async function getShortHash(ref, cwd) {
|
|
189
|
+
return git(['rev-parse', '--short', ref], { cwd });
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get current branch name, or null if detached HEAD
|
|
193
|
+
*/
|
|
194
|
+
export async function getCurrentBranch(cwd) {
|
|
195
|
+
const result = await gitSafe(['symbolic-ref', '--short', 'HEAD'], { cwd });
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Check if a ref exists
|
|
200
|
+
*/
|
|
201
|
+
export async function refExists(ref, cwd) {
|
|
202
|
+
const result = await gitSafe(['rev-parse', '--verify', ref], { cwd });
|
|
203
|
+
return result !== null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get the tree hash for a commit
|
|
207
|
+
*/
|
|
208
|
+
export async function getTreeHash(ref, cwd) {
|
|
209
|
+
return git(['rev-parse', `${ref}^{tree}`], { cwd });
|
|
210
|
+
}
|
|
211
|
+
// ============================================================================
|
|
212
|
+
// Branch Operations
|
|
213
|
+
// ============================================================================
|
|
214
|
+
/**
|
|
215
|
+
* List branches matching a pattern
|
|
216
|
+
*/
|
|
217
|
+
export async function listBranches(pattern, cwd) {
|
|
218
|
+
const args = ['branch', '--list', '--format=%(refname:short)'];
|
|
219
|
+
if (pattern)
|
|
220
|
+
args.push(pattern);
|
|
221
|
+
const result = await git(args, { cwd });
|
|
222
|
+
if (!result)
|
|
223
|
+
return [];
|
|
224
|
+
return result.split('\n').filter(Boolean);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Create a branch at a ref
|
|
228
|
+
*/
|
|
229
|
+
export async function createBranch(name, ref, cwd) {
|
|
230
|
+
await git(['branch', name, ref], { cwd });
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Delete a branch
|
|
234
|
+
*/
|
|
235
|
+
export async function deleteBranch(name, force = false, cwd) {
|
|
236
|
+
await git(['branch', force ? '-D' : '-d', name], { cwd });
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Update a branch ref to point to a new commit
|
|
240
|
+
*/
|
|
241
|
+
export async function updateRef(ref, commitHash, cwd) {
|
|
242
|
+
await git(['update-ref', `refs/heads/${ref}`, commitHash], { cwd });
|
|
243
|
+
}
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// Commit & Tree Operations
|
|
246
|
+
// ============================================================================
|
|
247
|
+
/**
|
|
248
|
+
* Get the git author from config
|
|
249
|
+
*/
|
|
250
|
+
export async function getGitAuthor(cwd) {
|
|
251
|
+
const name = (await gitSafe(['config', 'user.name'], { cwd })) ?? 'Entire';
|
|
252
|
+
const email = (await gitSafe(['config', 'user.email'], { cwd })) ?? 'entire@localhost';
|
|
253
|
+
return { name, email };
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a tree object from a list of entries
|
|
257
|
+
*/
|
|
258
|
+
export async function mktree(entries, cwd) {
|
|
259
|
+
const input = entries.map((e) => `${e.mode} ${e.type} ${e.hash}\t${e.name}`).join('\n') + '\n';
|
|
260
|
+
const result = await execWithInput('git', ['mktree'], input, {
|
|
261
|
+
cwd: cwd ?? process.cwd(),
|
|
262
|
+
timeout: 30000,
|
|
263
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
264
|
+
});
|
|
265
|
+
return result.stdout.trim();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Create a blob from content
|
|
269
|
+
*/
|
|
270
|
+
export async function hashObject(content, cwd) {
|
|
271
|
+
const input = typeof content === 'string' ? content : content.toString('utf-8');
|
|
272
|
+
const result = await execWithInput('git', ['hash-object', '-w', '--stdin'], input, {
|
|
273
|
+
cwd: cwd ?? process.cwd(),
|
|
274
|
+
timeout: 30000,
|
|
275
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
276
|
+
});
|
|
277
|
+
return result.stdout.trim();
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Create a commit object
|
|
281
|
+
*/
|
|
282
|
+
export async function commitTree(treeHash, parentHash, message, author, cwd) {
|
|
283
|
+
const args = ['commit-tree', treeHash];
|
|
284
|
+
if (parentHash) {
|
|
285
|
+
args.push('-p', parentHash);
|
|
286
|
+
}
|
|
287
|
+
args.push('-m', message);
|
|
288
|
+
const env = {
|
|
289
|
+
GIT_AUTHOR_NAME: author.name,
|
|
290
|
+
GIT_AUTHOR_EMAIL: author.email,
|
|
291
|
+
GIT_COMMITTER_NAME: author.name,
|
|
292
|
+
GIT_COMMITTER_EMAIL: author.email,
|
|
293
|
+
};
|
|
294
|
+
return git(args, { cwd, env });
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* List entries in a tree
|
|
298
|
+
*/
|
|
299
|
+
export async function lsTree(ref, treePath, cwd) {
|
|
300
|
+
const args = ['ls-tree', ref];
|
|
301
|
+
if (treePath)
|
|
302
|
+
args.push(treePath);
|
|
303
|
+
const result = await gitSafe(args, { cwd });
|
|
304
|
+
if (!result)
|
|
305
|
+
return [];
|
|
306
|
+
return result
|
|
307
|
+
.split('\n')
|
|
308
|
+
.filter(Boolean)
|
|
309
|
+
.map((line) => {
|
|
310
|
+
const match = line.match(/^(\d+)\s+(\w+)\s+([0-9a-f]+)\t(.+)$/);
|
|
311
|
+
if (!match)
|
|
312
|
+
throw new Error(`Unexpected ls-tree output: ${line}`);
|
|
313
|
+
return { mode: match[1], type: match[2], hash: match[3], name: match[4] };
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Read a blob from the object store
|
|
318
|
+
*/
|
|
319
|
+
export async function catFile(ref, cwd) {
|
|
320
|
+
return git(['cat-file', '-p', ref], { cwd });
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Read a file from a specific tree/commit
|
|
324
|
+
*/
|
|
325
|
+
export async function showFile(ref, filePath, cwd) {
|
|
326
|
+
return git(['show', `${ref}:${filePath}`], { cwd });
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Get log entries for a ref
|
|
330
|
+
*/
|
|
331
|
+
export async function log(ref, options = {}, cwd) {
|
|
332
|
+
const args = ['log', ref];
|
|
333
|
+
if (options.maxCount)
|
|
334
|
+
args.push(`-${options.maxCount}`);
|
|
335
|
+
if (options.format)
|
|
336
|
+
args.push(`--format=${options.format}`);
|
|
337
|
+
return git(args, { cwd });
|
|
338
|
+
}
|
|
339
|
+
// ============================================================================
|
|
340
|
+
// Diff Operations
|
|
341
|
+
// ============================================================================
|
|
342
|
+
/**
|
|
343
|
+
* Get list of files changed between two refs
|
|
344
|
+
*/
|
|
345
|
+
export async function diffNameOnly(refA, refB, cwd) {
|
|
346
|
+
const result = await git(['diff', '--name-status', refA, refB], { cwd });
|
|
347
|
+
const added = [];
|
|
348
|
+
const modified = [];
|
|
349
|
+
const deleted = [];
|
|
350
|
+
for (const line of result.split('\n').filter(Boolean)) {
|
|
351
|
+
const [status, ...rest] = line.split('\t');
|
|
352
|
+
const file = rest.join('\t');
|
|
353
|
+
switch (status[0]) {
|
|
354
|
+
case 'A':
|
|
355
|
+
added.push(file);
|
|
356
|
+
break;
|
|
357
|
+
case 'D':
|
|
358
|
+
deleted.push(file);
|
|
359
|
+
break;
|
|
360
|
+
default:
|
|
361
|
+
modified.push(file);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return { added, modified, deleted };
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Get stat of diff between two refs (line counts)
|
|
369
|
+
*/
|
|
370
|
+
export async function diffStat(refA, refB, cwd) {
|
|
371
|
+
const result = await git(['diff', '--shortstat', refA, refB], { cwd });
|
|
372
|
+
let additions = 0;
|
|
373
|
+
let deletions = 0;
|
|
374
|
+
const addMatch = result.match(/(\d+) insertion/);
|
|
375
|
+
const delMatch = result.match(/(\d+) deletion/);
|
|
376
|
+
if (addMatch)
|
|
377
|
+
additions = parseInt(addMatch[1], 10);
|
|
378
|
+
if (delMatch)
|
|
379
|
+
deletions = parseInt(delMatch[1], 10);
|
|
380
|
+
return { additions, deletions };
|
|
381
|
+
}
|
|
382
|
+
// ============================================================================
|
|
383
|
+
// Working Tree Operations
|
|
384
|
+
// ============================================================================
|
|
385
|
+
/**
|
|
386
|
+
* Check if the working tree has uncommitted changes
|
|
387
|
+
*/
|
|
388
|
+
export async function hasUncommittedChanges(cwd) {
|
|
389
|
+
const result = await git(['status', '--porcelain'], { cwd });
|
|
390
|
+
return result.length > 0;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get list of untracked files
|
|
394
|
+
*/
|
|
395
|
+
export async function getUntrackedFiles(cwd) {
|
|
396
|
+
const result = await git(['ls-files', '--others', '--exclude-standard'], { cwd });
|
|
397
|
+
if (!result)
|
|
398
|
+
return [];
|
|
399
|
+
return result.split('\n').filter(Boolean);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Check if on the default branch (main/master)
|
|
403
|
+
*/
|
|
404
|
+
export async function isOnDefaultBranch(cwd) {
|
|
405
|
+
const branch = await getCurrentBranch(cwd);
|
|
406
|
+
if (!branch)
|
|
407
|
+
return [false, ''];
|
|
408
|
+
const isDefault = branch === 'main' || branch === 'master';
|
|
409
|
+
return [isDefault, branch];
|
|
410
|
+
}
|
|
411
|
+
// ============================================================================
|
|
412
|
+
// Push Operations
|
|
413
|
+
// ============================================================================
|
|
414
|
+
/**
|
|
415
|
+
* Push a branch to a remote
|
|
416
|
+
*/
|
|
417
|
+
export async function pushBranch(remote, branch, force = false, cwd) {
|
|
418
|
+
const args = ['push', remote, branch];
|
|
419
|
+
if (force)
|
|
420
|
+
args.push('--force');
|
|
421
|
+
await git(args, { cwd, timeout: 60000 });
|
|
422
|
+
}
|
|
423
|
+
// ============================================================================
|
|
424
|
+
// Filesystem Helpers
|
|
425
|
+
// ============================================================================
|
|
426
|
+
/**
|
|
427
|
+
* Resolve the git directory from a path, handling worktrees
|
|
428
|
+
*/
|
|
429
|
+
export function resolveGitDirSync(startPath) {
|
|
430
|
+
let dir = startPath;
|
|
431
|
+
const root = path.parse(dir).root;
|
|
432
|
+
while (dir !== root) {
|
|
433
|
+
const gitPath = path.join(dir, '.git');
|
|
434
|
+
try {
|
|
435
|
+
const stat = fs.statSync(gitPath);
|
|
436
|
+
if (stat.isDirectory())
|
|
437
|
+
return gitPath;
|
|
438
|
+
if (stat.isFile()) {
|
|
439
|
+
const content = fs.readFileSync(gitPath, 'utf-8').trim();
|
|
440
|
+
const match = content.match(/^gitdir:\s*(.+)$/);
|
|
441
|
+
if (match)
|
|
442
|
+
return path.resolve(dir, match[1]);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
catch {
|
|
446
|
+
// Not found at this level
|
|
447
|
+
}
|
|
448
|
+
dir = path.dirname(dir);
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Atomically write a file (write to tmp, then rename)
|
|
454
|
+
*/
|
|
455
|
+
export async function atomicWriteFile(filePath, content) {
|
|
456
|
+
const dir = path.dirname(filePath);
|
|
457
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
458
|
+
const tmpPath = `${filePath}.tmp.${process.pid}`;
|
|
459
|
+
await fs.promises.writeFile(tmpPath, content, 'utf-8');
|
|
460
|
+
await fs.promises.rename(tmpPath, filePath);
|
|
461
|
+
}
|
|
462
|
+
//# sourceMappingURL=git-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.js","sourceRoot":"","sources":["../src/git-operations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C;;GAEG;AACH,SAAS,aAAa,CACpB,GAAW,EACX,IAAc,EACd,KAAa,EACb,OAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACjE,IAAI,GAAG;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;gBAChB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAA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