@gitgov/core 1.13.0 → 2.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/README.md +151 -270
- package/dist/src/agent_runner-ByOUWOt6.d.ts +2580 -0
- package/dist/src/fs.d.ts +1369 -0
- package/dist/src/fs.js +8483 -0
- package/dist/src/fs.js.map +1 -0
- package/dist/src/index--ahcnsG3.d.ts +798 -0
- package/dist/src/index.d.ts +1706 -5213
- package/dist/src/index.js +4779 -8956
- package/dist/src/index.js.map +1 -1
- package/dist/src/memory.d.ts +262 -0
- package/dist/src/memory.js +790 -0
- package/dist/src/memory.js.map +1 -0
- package/dist/src/memory_file_lister-BkQ_C3ZU.d.ts +221 -0
- package/package.json +19 -8
- package/prompts/gitgov_agent_prompt.md +0 -480
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { R as RecordStore, C as ConfigStore, G as GitGovConfig, S as SessionStore, a as GitGovSession, I as IGitModule, f as CommitInfo, E as ExecOptions, c as ExecResult, d as ChangedFile, e as GetCommitHistoryOptions, g as CommitAuthor } from './index--ahcnsG3.js';
|
|
2
|
+
export { M as MemoryFileListerOptions } from './index--ahcnsG3.js';
|
|
3
|
+
export { E as EnvKeyProvider, a as EnvKeyProviderOptions, c as MemoryFileLister, M as MockKeyProvider, b as MockKeyProviderOptions } from './memory_file_lister-BkQ_C3ZU.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options for MemoryRecordStore
|
|
7
|
+
*/
|
|
8
|
+
interface MemoryRecordStoreOptions<T> {
|
|
9
|
+
/** Initial data */
|
|
10
|
+
initial?: Map<string, T>;
|
|
11
|
+
/** Clone data on get/put (default: true) */
|
|
12
|
+
deepClone?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* MemoryRecordStore<T> - In-memory implementation of RecordStore<T>
|
|
16
|
+
*
|
|
17
|
+
* Designed for unit tests and scenarios without persistence.
|
|
18
|
+
* By default, clones values on get/put to prevent accidental mutations.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Test setup
|
|
22
|
+
* const store = new MemoryRecordStore<TaskRecord>();
|
|
23
|
+
* await store.put('test-task-1', mockTask);
|
|
24
|
+
*
|
|
25
|
+
* // Assertions
|
|
26
|
+
* expect(await store.exists('test-task-1')).toBe(true);
|
|
27
|
+
* expect(store.size()).toBe(1);
|
|
28
|
+
*
|
|
29
|
+
* // Cleanup
|
|
30
|
+
* store.clear();
|
|
31
|
+
*/
|
|
32
|
+
declare class MemoryRecordStore<T> implements RecordStore<T> {
|
|
33
|
+
private readonly data;
|
|
34
|
+
private readonly deepClone;
|
|
35
|
+
constructor(options?: MemoryRecordStoreOptions<T>);
|
|
36
|
+
private clone;
|
|
37
|
+
get(id: string): Promise<T | null>;
|
|
38
|
+
put(id: string, value: T): Promise<void>;
|
|
39
|
+
delete(id: string): Promise<void>;
|
|
40
|
+
list(): Promise<string[]>;
|
|
41
|
+
exists(id: string): Promise<boolean>;
|
|
42
|
+
/** Clears all records from the store */
|
|
43
|
+
clear(): void;
|
|
44
|
+
/** Returns the number of records */
|
|
45
|
+
size(): number;
|
|
46
|
+
/** Returns a copy of the internal Map (for assertions) */
|
|
47
|
+
getAll(): Map<string, T>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* MemoryConfigStore - In-memory implementation of ConfigStore
|
|
52
|
+
*
|
|
53
|
+
* Useful for testing and serverless environments where filesystem
|
|
54
|
+
* access is not available or not desired.
|
|
55
|
+
*
|
|
56
|
+
* NOTE: Session state is handled by MemorySessionStore, not this class.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* In-memory ConfigStore implementation for tests.
|
|
61
|
+
*
|
|
62
|
+
* Stores configuration in memory without filesystem I/O.
|
|
63
|
+
* Provides methods to pre-populate data for testing scenarios.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const configStore = new MemoryConfigStore();
|
|
68
|
+
* const sessionStore = new MemorySessionStore();
|
|
69
|
+
*
|
|
70
|
+
* // Pre-populate for testing
|
|
71
|
+
* configStore.setConfig({
|
|
72
|
+
* protocolVersion: '1.0',
|
|
73
|
+
* projectId: 'test-project',
|
|
74
|
+
* projectName: 'Test Project',
|
|
75
|
+
* rootCycle: '1234567890-cycle-test'
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* // Use in ConfigManager
|
|
79
|
+
* const manager = new ConfigManager(configStore, sessionStore);
|
|
80
|
+
* const config = await manager.loadConfig();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare class MemoryConfigStore implements ConfigStore {
|
|
84
|
+
private config;
|
|
85
|
+
/**
|
|
86
|
+
* Load configuration from memory
|
|
87
|
+
*
|
|
88
|
+
* [EARS-A1] Returns null if no config set
|
|
89
|
+
* [EARS-A2] Returns config set via setConfig
|
|
90
|
+
* [EARS-A3] Returns config saved via saveConfig
|
|
91
|
+
*
|
|
92
|
+
* @returns GitGovConfig or null if not set
|
|
93
|
+
*/
|
|
94
|
+
loadConfig(): Promise<GitGovConfig | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Save configuration to memory
|
|
97
|
+
*
|
|
98
|
+
* [EARS-A4] Persists config in memory, accessible via getConfig()
|
|
99
|
+
*/
|
|
100
|
+
saveConfig(config: GitGovConfig): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Set configuration directly (for test setup)
|
|
103
|
+
*
|
|
104
|
+
* [EARS-B1] Sets config synchronously, available via getConfig()
|
|
105
|
+
* [EARS-B2] Accepts null to clear config
|
|
106
|
+
*/
|
|
107
|
+
setConfig(config: GitGovConfig | null): void;
|
|
108
|
+
/**
|
|
109
|
+
* Get current configuration (for test assertions)
|
|
110
|
+
*/
|
|
111
|
+
getConfig(): GitGovConfig | null;
|
|
112
|
+
/**
|
|
113
|
+
* Clear all stored data (for test cleanup)
|
|
114
|
+
*
|
|
115
|
+
* [EARS-B3] Resets store to initial state (config = null)
|
|
116
|
+
*/
|
|
117
|
+
clear(): void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* MemorySessionStore - In-memory implementation of SessionStore
|
|
122
|
+
*
|
|
123
|
+
* Useful for testing and serverless environments where filesystem
|
|
124
|
+
* access is not available or not desired.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* In-memory SessionStore implementation for tests.
|
|
129
|
+
*
|
|
130
|
+
* Stores session state in memory without filesystem I/O.
|
|
131
|
+
* Provides methods to pre-populate data for testing scenarios.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const store = new MemorySessionStore();
|
|
136
|
+
*
|
|
137
|
+
* // Pre-populate for testing
|
|
138
|
+
* store.setSession({
|
|
139
|
+
* lastSession: { actorId: 'human:test', timestamp: '2024-01-01T00:00:00Z' },
|
|
140
|
+
* actorState: {}
|
|
141
|
+
* });
|
|
142
|
+
*
|
|
143
|
+
* // Use in ConfigManager
|
|
144
|
+
* const manager = new ConfigManager(configStore, store);
|
|
145
|
+
* const session = await manager.loadSession();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare class MemorySessionStore implements SessionStore {
|
|
149
|
+
private session;
|
|
150
|
+
private keyFiles;
|
|
151
|
+
/**
|
|
152
|
+
* Load session from memory
|
|
153
|
+
* @returns GitGovSession or null if not set
|
|
154
|
+
*/
|
|
155
|
+
loadSession(): Promise<GitGovSession | null>;
|
|
156
|
+
/**
|
|
157
|
+
* Save session to memory
|
|
158
|
+
*/
|
|
159
|
+
saveSession(session: GitGovSession): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Detect actor from simulated .key files
|
|
162
|
+
*
|
|
163
|
+
* In MemorySessionStore, .key files are simulated via setKeyFiles().
|
|
164
|
+
*
|
|
165
|
+
* @returns Actor ID or null if no key files configured
|
|
166
|
+
*/
|
|
167
|
+
detectActorFromKeyFiles(): Promise<string | null>;
|
|
168
|
+
/**
|
|
169
|
+
* Set session directly (for test setup)
|
|
170
|
+
*/
|
|
171
|
+
setSession(session: GitGovSession | null): void;
|
|
172
|
+
/**
|
|
173
|
+
* Get current session (for test assertions)
|
|
174
|
+
*/
|
|
175
|
+
getSession(): GitGovSession | null;
|
|
176
|
+
/**
|
|
177
|
+
* Set simulated .key files (for EARS-B9 testing)
|
|
178
|
+
* @param keyFiles - Array of key filenames (e.g., ["human:camilo.key"])
|
|
179
|
+
*/
|
|
180
|
+
setKeyFiles(keyFiles: string[]): void;
|
|
181
|
+
/**
|
|
182
|
+
* Clear all stored data (for test cleanup)
|
|
183
|
+
*/
|
|
184
|
+
clear(): void;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* MemoryGitModule - In-memory Git implementation for tests
|
|
189
|
+
*
|
|
190
|
+
* This module provides a mock implementation of IGitModule for unit testing.
|
|
191
|
+
* All state is kept in memory with no filesystem operations.
|
|
192
|
+
*
|
|
193
|
+
* Test Helpers:
|
|
194
|
+
* - setBranch(name): Set current branch
|
|
195
|
+
* - setCommits(commits[]): Set commit history
|
|
196
|
+
* - setFiles(files): Set file contents
|
|
197
|
+
* - clear(): Reset all state
|
|
198
|
+
*
|
|
199
|
+
* @module git/memory
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* MemoryGitModule - In-memory Git mock for unit tests
|
|
204
|
+
*/
|
|
205
|
+
declare class MemoryGitModule implements IGitModule {
|
|
206
|
+
private state;
|
|
207
|
+
constructor(repoRoot?: string);
|
|
208
|
+
setBranch(name: string): void;
|
|
209
|
+
setBranches(names: string[]): void;
|
|
210
|
+
setCommits(commits: CommitInfo[]): void;
|
|
211
|
+
setFiles(files: Record<string, string>): void;
|
|
212
|
+
setFileContent(commitHash: string, filePath: string, content: string): void;
|
|
213
|
+
setStagedFiles(files: string[]): void;
|
|
214
|
+
setRebaseInProgress(inProgress: boolean, conflictedFiles?: string[]): void;
|
|
215
|
+
setRemoteBranches(remote: string, branches: string[]): void;
|
|
216
|
+
clear(): void;
|
|
217
|
+
exec(_command: string, _args: string[], _options?: ExecOptions): Promise<ExecResult>;
|
|
218
|
+
init(): Promise<void>;
|
|
219
|
+
getRepoRoot(): Promise<string>;
|
|
220
|
+
getCurrentBranch(): Promise<string>;
|
|
221
|
+
getCommitHash(ref?: string): Promise<string>;
|
|
222
|
+
setConfig(key: string, value: string, _scope?: 'local' | 'global' | 'system'): Promise<void>;
|
|
223
|
+
getMergeBase(branchA: string, branchB: string): Promise<string>;
|
|
224
|
+
getChangedFiles(_fromCommit: string, _toCommit: string, _pathFilter: string): Promise<ChangedFile[]>;
|
|
225
|
+
getStagedFiles(): Promise<string[]>;
|
|
226
|
+
getFileContent(commitHash: string, filePath: string): Promise<string>;
|
|
227
|
+
getCommitHistory(_branch: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
|
|
228
|
+
getCommitHistoryRange(fromHash: string, toHash: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
|
|
229
|
+
getCommitMessage(commitHash: string): Promise<string>;
|
|
230
|
+
hasUncommittedChanges(_pathFilter?: string): Promise<boolean>;
|
|
231
|
+
isRebaseInProgress(): Promise<boolean>;
|
|
232
|
+
branchExists(branchName: string): Promise<boolean>;
|
|
233
|
+
listRemoteBranches(remoteName: string): Promise<string[]>;
|
|
234
|
+
isRemoteConfigured(remoteName: string): Promise<boolean>;
|
|
235
|
+
getBranchRemote(branchName: string): Promise<string | null>;
|
|
236
|
+
getConflictedFiles(): Promise<string[]>;
|
|
237
|
+
checkoutBranch(branchName: string): Promise<void>;
|
|
238
|
+
stash(message?: string): Promise<string | null>;
|
|
239
|
+
stashPop(): Promise<boolean>;
|
|
240
|
+
stashDrop(_stashHash?: string): Promise<void>;
|
|
241
|
+
checkoutOrphanBranch(branchName: string): Promise<void>;
|
|
242
|
+
fetch(_remote: string): Promise<void>;
|
|
243
|
+
pull(_remote: string, _branchName: string): Promise<void>;
|
|
244
|
+
pullRebase(_remote: string, _branchName: string): Promise<void>;
|
|
245
|
+
resetHard(_target: string): Promise<void>;
|
|
246
|
+
checkoutFilesFromBranch(sourceBranch: string, _filePaths: string[]): Promise<void>;
|
|
247
|
+
add(filePaths: string[], _options?: {
|
|
248
|
+
force?: boolean;
|
|
249
|
+
}): Promise<void>;
|
|
250
|
+
rm(filePaths: string[]): Promise<void>;
|
|
251
|
+
commit(message: string, author?: CommitAuthor): Promise<string>;
|
|
252
|
+
commitAllowEmpty(message: string, author?: CommitAuthor): Promise<string>;
|
|
253
|
+
push(_remote: string, branchName: string): Promise<void>;
|
|
254
|
+
pushWithUpstream(_remote: string, branchName: string): Promise<void>;
|
|
255
|
+
setUpstream(branchName: string, _remote: string, _remoteBranch: string): Promise<void>;
|
|
256
|
+
rebaseContinue(): Promise<string>;
|
|
257
|
+
rebaseAbort(): Promise<void>;
|
|
258
|
+
createBranch(branchName: string, _startPoint?: string): Promise<void>;
|
|
259
|
+
rebase(_targetBranch: string): Promise<void>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { MemoryConfigStore, MemoryGitModule, MemoryRecordStore, MemorySessionStore };
|