@vybestack/llxprt-code-storage 0.10.0-nightly.260613.1adad3b34
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/.last_build +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/config/storage.d.ts +39 -0
- package/dist/src/config/storage.js +118 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/conversation/ConversationFileWriter.d.ts +27 -0
- package/dist/src/conversation/ConversationFileWriter.js +78 -0
- package/dist/src/conversation/ConversationFileWriter.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/secure-store/provider-key-storage.d.ts +53 -0
- package/dist/src/secure-store/provider-key-storage.js +117 -0
- package/dist/src/secure-store/provider-key-storage.js.map +1 -0
- package/dist/src/secure-store/secure-store.d.ts +69 -0
- package/dist/src/secure-store/secure-store.js +606 -0
- package/dist/src/secure-store/secure-store.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.d.ts +48 -0
- package/dist/src/services/fileDiscoveryService.js +154 -0
- package/dist/src/services/fileDiscoveryService.js.map +1 -0
- package/dist/src/services/fileSystemService.d.ts +33 -0
- package/dist/src/services/fileSystemService.js +25 -0
- package/dist/src/services/fileSystemService.js.map +1 -0
- package/dist/src/session/sessionTypes.d.ts +39 -0
- package/dist/src/session/sessionTypes.js +10 -0
- package/dist/src/session/sessionTypes.js.map +1 -0
- package/dist/src/testing.d.ts +1 -0
- package/dist/src/testing.js +4 -0
- package/dist/src/testing.js.map +1 -0
- package/dist/src/types/logger.d.ts +17 -0
- package/dist/src/types/logger.js +17 -0
- package/dist/src/types/logger.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.d.ts +29 -0
- package/dist/src/utils/gitIgnoreParser.js +199 -0
- package/dist/src/utils/gitIgnoreParser.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +17 -0
- package/dist/src/utils/gitUtils.js +68 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface FilterFilesOptions {
|
|
7
|
+
respectGitIgnore?: boolean;
|
|
8
|
+
respectLlxprtIgnore?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FilterReport {
|
|
11
|
+
filteredPaths: string[];
|
|
12
|
+
ignoredCount: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class FileDiscoveryService {
|
|
15
|
+
private gitIgnoreFilter;
|
|
16
|
+
private llxprtIgnoreFilter;
|
|
17
|
+
private combinedIgnoreFilter;
|
|
18
|
+
private projectRoot;
|
|
19
|
+
constructor(projectRoot: string);
|
|
20
|
+
/**
|
|
21
|
+
* Filters a list of file paths based on git ignore rules
|
|
22
|
+
*/
|
|
23
|
+
filterFiles(filePaths: string[], options?: FilterFilesOptions): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Filters a list of file paths based on git ignore rules and returns a report
|
|
26
|
+
* with counts of ignored files.
|
|
27
|
+
*/
|
|
28
|
+
filterFilesWithReport(filePaths: string[], opts?: FilterFilesOptions): FilterReport;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a single file should be git-ignored
|
|
31
|
+
*/
|
|
32
|
+
shouldGitIgnoreFile(filePath: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a single file should be llxprt-ignored
|
|
35
|
+
*/
|
|
36
|
+
shouldLlxprtIgnoreFile(filePath: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Unified method to check if a file should be ignored based on filtering options
|
|
39
|
+
*/
|
|
40
|
+
shouldIgnoreFile(filePath: string, options?: FilterFilesOptions): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Returns loaded patterns from .llxprtignore
|
|
43
|
+
*/
|
|
44
|
+
getLlxprtIgnorePatterns(): string[];
|
|
45
|
+
private resolveAbsolutePath;
|
|
46
|
+
private readIgnorePatterns;
|
|
47
|
+
private tryRealpath;
|
|
48
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GitIgnoreParser, } from '../utils/gitIgnoreParser.js';
|
|
7
|
+
import { findGitRoot } from '../utils/gitUtils.js';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
const LLXPRT_IGNORE_FILE_NAME = '.llxprtignore';
|
|
11
|
+
export class FileDiscoveryService {
|
|
12
|
+
gitIgnoreFilter = null;
|
|
13
|
+
llxprtIgnoreFilter = null;
|
|
14
|
+
combinedIgnoreFilter = null;
|
|
15
|
+
projectRoot;
|
|
16
|
+
constructor(projectRoot) {
|
|
17
|
+
const absoluteRoot = path.resolve(projectRoot);
|
|
18
|
+
this.projectRoot = this.tryRealpath(absoluteRoot);
|
|
19
|
+
const gitRootCandidate = findGitRoot(this.projectRoot);
|
|
20
|
+
const resolvedGitRoot = gitRootCandidate
|
|
21
|
+
? this.tryRealpath(gitRootCandidate)
|
|
22
|
+
: null;
|
|
23
|
+
// Read .llxprtignore patterns for both dedicated and combined filters
|
|
24
|
+
const llxprtPatterns = this.readIgnorePatterns(path.join(this.projectRoot, LLXPRT_IGNORE_FILE_NAME));
|
|
25
|
+
if (resolvedGitRoot) {
|
|
26
|
+
// GitIgnoreParser lazily discovers .gitignore patterns on isIgnored()
|
|
27
|
+
this.gitIgnoreFilter = new GitIgnoreParser(resolvedGitRoot);
|
|
28
|
+
// Combined filter: .gitignore + .llxprtignore via extraPatterns
|
|
29
|
+
this.combinedIgnoreFilter = new GitIgnoreParser(resolvedGitRoot, llxprtPatterns);
|
|
30
|
+
}
|
|
31
|
+
// Dedicated .llxprtignore filter (also passes patterns as extraPatterns)
|
|
32
|
+
this.llxprtIgnoreFilter = new GitIgnoreParser(this.projectRoot, llxprtPatterns);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Filters a list of file paths based on git ignore rules
|
|
36
|
+
*/
|
|
37
|
+
filterFiles(filePaths, options = {
|
|
38
|
+
respectGitIgnore: true,
|
|
39
|
+
respectLlxprtIgnore: true,
|
|
40
|
+
}) {
|
|
41
|
+
const { respectGitIgnore = true, respectLlxprtIgnore = true } = options;
|
|
42
|
+
return filePaths.filter((filePath) => {
|
|
43
|
+
if (respectGitIgnore &&
|
|
44
|
+
respectLlxprtIgnore &&
|
|
45
|
+
this.combinedIgnoreFilter) {
|
|
46
|
+
return !this.combinedIgnoreFilter.isIgnored(filePath);
|
|
47
|
+
}
|
|
48
|
+
const absolutePath = this.resolveAbsolutePath(filePath);
|
|
49
|
+
if (respectGitIgnore && this.shouldGitIgnoreFile(absolutePath)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (respectLlxprtIgnore && this.shouldLlxprtIgnoreFile(absolutePath)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Filters a list of file paths based on git ignore rules and returns a report
|
|
60
|
+
* with counts of ignored files.
|
|
61
|
+
*/
|
|
62
|
+
filterFilesWithReport(filePaths, opts = {
|
|
63
|
+
respectGitIgnore: true,
|
|
64
|
+
respectLlxprtIgnore: true,
|
|
65
|
+
}) {
|
|
66
|
+
const filteredPaths = this.filterFiles(filePaths, opts);
|
|
67
|
+
const ignoredCount = filePaths.length - filteredPaths.length;
|
|
68
|
+
return {
|
|
69
|
+
filteredPaths,
|
|
70
|
+
ignoredCount,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if a single file should be git-ignored
|
|
75
|
+
*/
|
|
76
|
+
shouldGitIgnoreFile(filePath) {
|
|
77
|
+
if (!this.gitIgnoreFilter) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const absolutePath = this.resolveAbsolutePath(filePath);
|
|
81
|
+
return this.gitIgnoreFilter.isIgnored(absolutePath);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks if a single file should be llxprt-ignored
|
|
85
|
+
*/
|
|
86
|
+
shouldLlxprtIgnoreFile(filePath) {
|
|
87
|
+
if (!this.llxprtIgnoreFilter) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const absolutePath = this.resolveAbsolutePath(filePath);
|
|
91
|
+
return this.llxprtIgnoreFilter.isIgnored(absolutePath);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Unified method to check if a file should be ignored based on filtering options
|
|
95
|
+
*/
|
|
96
|
+
shouldIgnoreFile(filePath, options = {}) {
|
|
97
|
+
const { respectGitIgnore = true, respectLlxprtIgnore = true } = options;
|
|
98
|
+
const absolutePath = this.resolveAbsolutePath(filePath);
|
|
99
|
+
if (respectGitIgnore && this.shouldGitIgnoreFile(absolutePath)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (respectLlxprtIgnore && this.shouldLlxprtIgnoreFile(absolutePath)) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns loaded patterns from .llxprtignore
|
|
109
|
+
*/
|
|
110
|
+
getLlxprtIgnorePatterns() {
|
|
111
|
+
return this.llxprtIgnoreFilter?.getPatterns() ?? [];
|
|
112
|
+
}
|
|
113
|
+
resolveAbsolutePath(filePath) {
|
|
114
|
+
if (path.isAbsolute(filePath)) {
|
|
115
|
+
try {
|
|
116
|
+
return fs.realpathSync(filePath);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// Path doesn't exist; return normalized path.
|
|
120
|
+
return path.normalize(filePath);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const resolved = path.resolve(this.projectRoot, filePath);
|
|
124
|
+
try {
|
|
125
|
+
return fs.realpathSync(resolved);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Path doesn't exist; return normalized path.
|
|
129
|
+
return path.normalize(resolved);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
readIgnorePatterns(filePath) {
|
|
133
|
+
try {
|
|
134
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
135
|
+
return content
|
|
136
|
+
.split('\n')
|
|
137
|
+
.filter((line) => line.trim() !== '' && !line.startsWith('#'));
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// File doesn't exist or can't be read; return empty patterns.
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
tryRealpath(p) {
|
|
145
|
+
try {
|
|
146
|
+
return fs.realpathSync(p);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Path doesn't exist; return normalized path.
|
|
150
|
+
return path.normalize(p);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=fileDiscoveryService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileDiscoveryService.js","sourceRoot":"","sources":["../../../src/services/fileDiscoveryService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,GAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAYhD,MAAM,OAAO,oBAAoB;IACvB,eAAe,GAA2B,IAAI,CAAC;IAC/C,kBAAkB,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BAAkB,CAAC,QAAgB;QACzC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,OAAO,OAAO;iBACX,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;YAC9D,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,CAAS;QAC3B,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;YAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for file system operations that may be delegated to different implementations.
|
|
8
|
+
* Provides runtime identity (unlike a pure interface) so consumers can use `instanceof` checks
|
|
9
|
+
* and the symbol is available at the package root for compatibility verification.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class FileSystemService {
|
|
12
|
+
/**
|
|
13
|
+
* Read text content from a file
|
|
14
|
+
*
|
|
15
|
+
* @param filePath - The path to the file to read
|
|
16
|
+
* @returns The file content as a string
|
|
17
|
+
*/
|
|
18
|
+
abstract readTextFile(filePath: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Write text content to a file
|
|
21
|
+
*
|
|
22
|
+
* @param filePath - The path to the file to write
|
|
23
|
+
* @param content - The content to write
|
|
24
|
+
*/
|
|
25
|
+
abstract writeTextFile(filePath: string, content: string): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Standard file system implementation
|
|
29
|
+
*/
|
|
30
|
+
export declare class StandardFileSystemService implements FileSystemService {
|
|
31
|
+
readTextFile(filePath: string): Promise<string>;
|
|
32
|
+
writeTextFile(filePath: string, content: string): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'node:fs/promises';
|
|
7
|
+
/**
|
|
8
|
+
* Abstract base class for file system operations that may be delegated to different implementations.
|
|
9
|
+
* Provides runtime identity (unlike a pure interface) so consumers can use `instanceof` checks
|
|
10
|
+
* and the symbol is available at the package root for compatibility verification.
|
|
11
|
+
*/
|
|
12
|
+
export class FileSystemService {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Standard file system implementation
|
|
16
|
+
*/
|
|
17
|
+
export class StandardFileSystemService {
|
|
18
|
+
async readTextFile(filePath) {
|
|
19
|
+
return fs.readFile(filePath, 'utf-8');
|
|
20
|
+
}
|
|
21
|
+
async writeTextFile(filePath, content) {
|
|
22
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=fileSystemService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileSystemService.js","sourceRoot":"","sources":["../../../src/services/fileSystemService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC;;;;GAIG;AACH,MAAM,OAAgB,iBAAiB;CAgBtC;AAED;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,OAAe;QACnD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Session file naming prefix
|
|
8
|
+
*/
|
|
9
|
+
export declare const SESSION_FILE_PREFIX = "session-";
|
|
10
|
+
/**
|
|
11
|
+
* Recorded tool call within a message (minimal for rewind purposes)
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolCallRecord {
|
|
14
|
+
toolName: string;
|
|
15
|
+
args?: Record<string, unknown>;
|
|
16
|
+
resultDisplay?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Base message record structure (minimal for session cleanup purposes)
|
|
20
|
+
*/
|
|
21
|
+
export interface BaseMessageRecord {
|
|
22
|
+
id?: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
role: 'user' | 'model';
|
|
25
|
+
type?: string;
|
|
26
|
+
content?: string;
|
|
27
|
+
toolCalls?: ToolCallRecord[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Conversation record structure (minimal for session cleanup purposes)
|
|
31
|
+
*/
|
|
32
|
+
export interface ConversationRecord {
|
|
33
|
+
id: string;
|
|
34
|
+
sessionId: string;
|
|
35
|
+
timestamp: string;
|
|
36
|
+
startTime: string;
|
|
37
|
+
lastUpdated?: string;
|
|
38
|
+
messages: BaseMessageRecord[];
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionTypes.js","sourceRoot":"","sources":["../../../src/session/sessionTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resetConversationFileWriterForTesting } from './conversation/ConversationFileWriter.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/testing.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,yDAAyD;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger interface for the storage package.
|
|
3
|
+
* Injected by consumers to decouple storage from core's logging.
|
|
4
|
+
*/
|
|
5
|
+
export interface StorageLogger {
|
|
6
|
+
debug(message: string | (() => string), ...context: unknown[]): void;
|
|
7
|
+
warn(message: string | (() => string), ...context: unknown[]): void;
|
|
8
|
+
error(message: string | (() => string), ...context: unknown[]): void;
|
|
9
|
+
}
|
|
10
|
+
/** Type-only marker for the null-logger (no runtime footprint). */
|
|
11
|
+
export type NullStorageLogger = StorageLogger;
|
|
12
|
+
/** Concrete null-logger that silently discards all output. */
|
|
13
|
+
export declare class NullStorageLoggerImpl implements StorageLogger {
|
|
14
|
+
debug(_message: string | (() => string), ..._context: unknown[]): void;
|
|
15
|
+
warn(_message: string | (() => string), ..._context: unknown[]): void;
|
|
16
|
+
error(_message: string | (() => string), ..._context: unknown[]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger interface for the storage package.
|
|
3
|
+
* Injected by consumers to decouple storage from core's logging.
|
|
4
|
+
*/
|
|
5
|
+
/** Concrete null-logger that silently discards all output. */
|
|
6
|
+
export class NullStorageLoggerImpl {
|
|
7
|
+
debug(_message, ..._context) {
|
|
8
|
+
// no-op
|
|
9
|
+
}
|
|
10
|
+
warn(_message, ..._context) {
|
|
11
|
+
// no-op
|
|
12
|
+
}
|
|
13
|
+
error(_message, ..._context) {
|
|
14
|
+
// no-op
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,8DAA8D;AAC9D,MAAM,OAAO,qBAAqB;IAChC,KAAK,CAAC,QAAiC,EAAE,GAAG,QAAmB;QAC7D,QAAQ;IACV,CAAC;IACD,IAAI,CAAC,QAAiC,EAAE,GAAG,QAAmB;QAC5D,QAAQ;IACV,CAAC;IACD,KAAK,CAAC,QAAiC,EAAE,GAAG,QAAmB;QAC7D,QAAQ;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface GitIgnoreFilter {
|
|
7
|
+
isIgnored(filePath: string): boolean;
|
|
8
|
+
getPatterns(): string[];
|
|
9
|
+
}
|
|
10
|
+
export declare class GitIgnoreParser implements GitIgnoreFilter {
|
|
11
|
+
private readonly extraPatterns?;
|
|
12
|
+
private projectRoot;
|
|
13
|
+
private cache;
|
|
14
|
+
private globalPatterns;
|
|
15
|
+
private processedExtraPatterns;
|
|
16
|
+
constructor(projectRoot: string, extraPatterns?: string[] | undefined);
|
|
17
|
+
private loadPatternsForFile;
|
|
18
|
+
private processPatterns;
|
|
19
|
+
isIgnored(filePath: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the explicitly added ("extra") ignore patterns.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: Despite the generic name, this does NOT return globally loaded
|
|
24
|
+
* patterns. The underlying `ignore` library does not expose its compiled
|
|
25
|
+
* patterns, so global patterns cannot be enumerated here. Only the
|
|
26
|
+
* `extraPatterns` supplied to the constructor are returned.
|
|
27
|
+
*/
|
|
28
|
+
getPatterns(): string[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import ignore from 'ignore';
|
|
9
|
+
export class GitIgnoreParser {
|
|
10
|
+
extraPatterns;
|
|
11
|
+
projectRoot;
|
|
12
|
+
cache = new Map();
|
|
13
|
+
globalPatterns;
|
|
14
|
+
processedExtraPatterns;
|
|
15
|
+
constructor(projectRoot, extraPatterns) {
|
|
16
|
+
this.extraPatterns = extraPatterns;
|
|
17
|
+
this.projectRoot = path.resolve(projectRoot);
|
|
18
|
+
this.processedExtraPatterns = ignore();
|
|
19
|
+
if (this.extraPatterns) {
|
|
20
|
+
// extraPatterns are assumed to be from project root (like .geminiignore)
|
|
21
|
+
this.processedExtraPatterns.add(this.processPatterns(this.extraPatterns, '.'));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
loadPatternsForFile(patternsFilePath) {
|
|
25
|
+
let content;
|
|
26
|
+
try {
|
|
27
|
+
content = fs.readFileSync(patternsFilePath, 'utf-8');
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// File not readable; return empty ignore.
|
|
31
|
+
return ignore();
|
|
32
|
+
}
|
|
33
|
+
// .git/info/exclude file patterns are relative to project root and not file directory
|
|
34
|
+
const isExcludeFile = patternsFilePath.endsWith(path.join('.git', 'info', 'exclude'));
|
|
35
|
+
// Use posix path for patterns to preserve escaped characters (e.g., \#, \!)
|
|
36
|
+
const relativeBaseDir = isExcludeFile
|
|
37
|
+
? '.'
|
|
38
|
+
: path
|
|
39
|
+
.dirname(path.relative(this.projectRoot, patternsFilePath))
|
|
40
|
+
.split(path.sep)
|
|
41
|
+
.join(path.posix.sep);
|
|
42
|
+
const rawPatterns = content.split('\n');
|
|
43
|
+
return ignore().add(this.processPatterns(rawPatterns, relativeBaseDir));
|
|
44
|
+
}
|
|
45
|
+
processPatterns(rawPatterns, relativeBaseDir) {
|
|
46
|
+
return rawPatterns
|
|
47
|
+
.map((p) => p.trimStart())
|
|
48
|
+
.filter((p) => p !== '' && !p.startsWith('#'))
|
|
49
|
+
.map((p) => {
|
|
50
|
+
// Handle escaped special chars at the start: \! or \#
|
|
51
|
+
// These mean the pattern literally starts with ! or #
|
|
52
|
+
// We need to KEEP the backslash for the ignore library to interpret correctly
|
|
53
|
+
// Note: Do NOT strip the backslash - ignore library needs it
|
|
54
|
+
const isEscapedBang = p.startsWith('\\!');
|
|
55
|
+
const isNegative = !isEscapedBang && p.startsWith('!');
|
|
56
|
+
if (isNegative) {
|
|
57
|
+
p = p.substring(1);
|
|
58
|
+
}
|
|
59
|
+
const isAnchoredInFile = p.startsWith('/');
|
|
60
|
+
if (isAnchoredInFile) {
|
|
61
|
+
p = p.substring(1);
|
|
62
|
+
}
|
|
63
|
+
// An empty pattern can result from a negated pattern like `!`,
|
|
64
|
+
// which we can ignore.
|
|
65
|
+
if (p === '') {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
let newPattern = p;
|
|
69
|
+
if (relativeBaseDir && relativeBaseDir !== '.') {
|
|
70
|
+
// Only in nested .gitignore files, the patterns need to be modified according to:
|
|
71
|
+
// - If `a/b/.gitignore` defines `/c` then it needs to be changed to `/a/b/c`
|
|
72
|
+
// - If `a/b/.gitignore` defines `c` then it needs to be changed to `/a/b/**/c`
|
|
73
|
+
// - If `a/b/.gitignore` defines `c/d` then it needs to be changed to `/a/b/c/d`
|
|
74
|
+
if (!isAnchoredInFile && !p.includes('/')) {
|
|
75
|
+
// If no slash and not anchored in file, it matches files in any
|
|
76
|
+
// subdirectory.
|
|
77
|
+
newPattern = path.posix.join('**', p);
|
|
78
|
+
}
|
|
79
|
+
// Prepend the .gitignore file's directory.
|
|
80
|
+
newPattern = path.posix.join(relativeBaseDir, newPattern);
|
|
81
|
+
// Anchor the pattern to a nested gitignore directory.
|
|
82
|
+
if (!newPattern.startsWith('/')) {
|
|
83
|
+
newPattern = '/' + newPattern;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Anchor the pattern if originally anchored
|
|
87
|
+
if (isAnchoredInFile && !newPattern.startsWith('/')) {
|
|
88
|
+
newPattern = '/' + newPattern;
|
|
89
|
+
}
|
|
90
|
+
if (isNegative) {
|
|
91
|
+
newPattern = '!' + newPattern;
|
|
92
|
+
}
|
|
93
|
+
return newPattern;
|
|
94
|
+
})
|
|
95
|
+
.filter((p) => p !== '');
|
|
96
|
+
}
|
|
97
|
+
isIgnored(filePath) {
|
|
98
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (filePath.startsWith('\\') ||
|
|
102
|
+
filePath === '/' ||
|
|
103
|
+
filePath.includes('\0')) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
const resolved = path.resolve(this.projectRoot, filePath);
|
|
108
|
+
const relativePath = path.relative(this.projectRoot, resolved);
|
|
109
|
+
if (relativePath === '' || relativePath.startsWith('..')) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
// Even in windows, Ignore expects forward slashes.
|
|
113
|
+
const normalizedPath = relativePath.replace(/\\/g, '/');
|
|
114
|
+
if (normalizedPath.startsWith('/') || normalizedPath === '') {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const ig = ignore();
|
|
118
|
+
// Always ignore .git directory
|
|
119
|
+
ig.add('.git');
|
|
120
|
+
// Load global patterns from .git/info/exclude on first call
|
|
121
|
+
if (this.globalPatterns === undefined) {
|
|
122
|
+
const excludeFile = path.join(this.projectRoot, '.git', 'info', 'exclude');
|
|
123
|
+
this.globalPatterns = fs.existsSync(excludeFile)
|
|
124
|
+
? this.loadPatternsForFile(excludeFile)
|
|
125
|
+
: ignore();
|
|
126
|
+
}
|
|
127
|
+
ig.add(this.globalPatterns);
|
|
128
|
+
const pathParts = relativePath.split(path.sep);
|
|
129
|
+
const dirsToVisit = [this.projectRoot];
|
|
130
|
+
let currentAbsDir = this.projectRoot;
|
|
131
|
+
// Collect all directories in the path
|
|
132
|
+
for (let i = 0; i < pathParts.length - 1; i++) {
|
|
133
|
+
currentAbsDir = path.join(currentAbsDir, pathParts[i]);
|
|
134
|
+
dirsToVisit.push(currentAbsDir);
|
|
135
|
+
}
|
|
136
|
+
for (const dir of dirsToVisit) {
|
|
137
|
+
const relativeDir = path.relative(this.projectRoot, dir);
|
|
138
|
+
if (relativeDir) {
|
|
139
|
+
const normalizedRelativeDir = relativeDir.replace(/\\/g, '/');
|
|
140
|
+
const igPlusExtras = ignore()
|
|
141
|
+
.add(ig)
|
|
142
|
+
.add(this.processedExtraPatterns);
|
|
143
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
144
|
+
if (igPlusExtras.ignores(normalizedRelativeDir)) {
|
|
145
|
+
// This directory is ignored by an ancestor's .gitignore.
|
|
146
|
+
// According to git behavior, we don't need to process this
|
|
147
|
+
// directory's .gitignore, as nothing inside it can be
|
|
148
|
+
// un-ignored.
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (this.cache.has(dir)) {
|
|
153
|
+
const patterns = this.cache.get(dir);
|
|
154
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
155
|
+
if (patterns) {
|
|
156
|
+
ig.add(patterns);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const gitignorePath = path.join(dir, '.gitignore');
|
|
161
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
162
|
+
if (fs.existsSync(gitignorePath)) {
|
|
163
|
+
const patterns = this.loadPatternsForFile(gitignorePath);
|
|
164
|
+
this.cache.set(dir, patterns);
|
|
165
|
+
ig.add(patterns);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this.cache.set(dir, ignore()); // Cache miss
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Apply extra patterns (e.g. from .geminiignore) last for precedence
|
|
173
|
+
ig.add(this.processedExtraPatterns);
|
|
174
|
+
return ig.ignores(normalizedPath);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Path resolution failed; not ignored.
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns the explicitly added ("extra") ignore patterns.
|
|
183
|
+
*
|
|
184
|
+
* NOTE: Despite the generic name, this does NOT return globally loaded
|
|
185
|
+
* patterns. The underlying `ignore` library does not expose its compiled
|
|
186
|
+
* patterns, so global patterns cannot be enumerated here. Only the
|
|
187
|
+
* `extraPatterns` supplied to the constructor are returned.
|
|
188
|
+
*/
|
|
189
|
+
getPatterns() {
|
|
190
|
+
const allPatterns = [];
|
|
191
|
+
// Global patterns cannot be enumerated: the `ignore` library does not
|
|
192
|
+
// expose its compiled pattern set. Intentionally omitted.
|
|
193
|
+
if (this.extraPatterns) {
|
|
194
|
+
allPatterns.push(...this.extraPatterns);
|
|
195
|
+
}
|
|
196
|
+
return allPatterns;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=gitIgnoreParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitIgnoreParser.js","sourceRoot":"","sources":["../../../src/utils/gitIgnoreParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAA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,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;wBACzD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;wBAC9B,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACnB,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,aAAa;oBAC9C,CAAC;gBACH,CAAC;YACH,CAAC;YAED,qEAAqE;YACrE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAEpC,OAAO,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,WAAW;QACT,MAAM,WAAW,GAAa,EAAE,CAAC;QAEjC,sEAAsE;QACtE,0DAA0D;QAE1D,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a directory is within a git repository
|
|
8
|
+
* @param directory The directory to check
|
|
9
|
+
* @returns true if the directory is in a git repository, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export declare function isGitRepository(directory: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Finds the root directory of a git repository
|
|
14
|
+
* @param directory Starting directory to search from
|
|
15
|
+
* @returns The git repository root path, or null if not in a git repository
|
|
16
|
+
*/
|
|
17
|
+
export declare function findGitRoot(directory: string): string | null;
|