@anysphere/file-service 0.0.0-c7f92fb0 → 0.0.0-c829a588

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.
Files changed (3) hide show
  1. package/index.d.ts +47 -26
  2. package/index.js +3 -3
  3. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -3,9 +3,6 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- export interface WalkDirConfig {
7
- maxNumFiles: number
8
- }
9
6
  export const enum DiffType {
10
7
  Insert = 'Insert',
11
8
  Delete = 'Delete',
@@ -15,6 +12,18 @@ export interface DiffChunk {
15
12
  diffType: DiffType
16
13
  text: string
17
14
  }
15
+ export const MULTI_ROOT_ABSOLUTE_PATH: string
16
+ export interface WalkDirConfig {
17
+ maxNumFiles: number
18
+ logFilePath?: string
19
+ blocklistPath?: string
20
+ unifiedJsonBlocklistPath?: string
21
+ }
22
+ export interface LocalCodebaseFileInfo {
23
+ unencryptedRelativePath: string
24
+ hash: string
25
+ children?: Array<LocalCodebaseFileInfo>
26
+ }
18
27
  export interface CommitData {
19
28
  sha: string
20
29
  date: number
@@ -45,11 +54,6 @@ export interface VerifyData {
45
54
  fileContent: string
46
55
  filePath: string
47
56
  }
48
- export interface Candidate {
49
- path: string
50
- locations: Array<number>
51
- weight: number
52
- }
53
57
  export declare class DiffClient {
54
58
  constructor()
55
59
  diff(text1: string, text2: string): Array<DiffChunk>
@@ -64,23 +68,20 @@ export declare class DiffClient {
64
68
  diffLines(text1: string, text2: string): Array<DiffChunk>
65
69
  }
66
70
  export declare class MerkleClient {
67
- constructor(absoluteRootDirectory: string)
68
- isTooBig(maxFiles: number, gitIgnoredFiles: Array<string>, isGitRepo: boolean): Promise<boolean>
69
- init(gitIgnoredFiles: Array<string>, isGitRepo: boolean): Promise<void>
70
- initWithRipgrepIgnore(logFilesPath: string | undefined | null, config: WalkDirConfig): Promise<void>
71
- computeMerkleTreeWithRipgrepIgnore(logFilesPath: string | undefined | null, config: WalkDirConfig): Promise<void>
72
- computeMerkleTree(gitIgnoredFiles: Array<string>, isGitRepo: boolean): Promise<void>
73
- updateFile(filePath: string): Promise<void>
74
- deleteFile(filePath: string): Promise<void>
71
+ constructor(rootPathsMap: Record<string, string>)
72
+ build(allowIncremental: boolean, config: WalkDirConfig): Promise<void>
75
73
  getSubtreeHash(relativePath: string): Promise<string>
76
74
  getNumEmbeddableFiles(): Promise<number>
75
+ getSimhash(): Promise<Float32Array>
77
76
  getImportantPaths(k: number): Promise<Array<string>>
78
77
  getAllFiles(): Promise<Array<string>>
79
78
  getAllDirFilesToEmbed(absoluteFilePath: string): Promise<Array<string>>
80
- getNextFileToEmbed(): Promise<Array<string>>
81
- getSpline(absoluteFilePath: string): Promise<Array<string>>
82
- getHashesForFiles(files: Array<string>): Promise<Array<string>>
83
- updateRootDirectory(rootDirectory: string): void
79
+ onDidCreate(absoluteFilePath: string): void
80
+ onDidChange(absoluteFilePath: string): void
81
+ onDidDelete(absoluteFilePath: string): void
82
+ static enableTracing(): void
83
+ getTreeStructure(): Promise<LocalCodebaseFileInfo | null>
84
+ dispose(): void
84
85
  }
85
86
  export declare class GitClient {
86
87
  constructor(absoluteRootDirectory: string)
@@ -91,10 +92,30 @@ export declare class GitClient {
91
92
  getRepoHeadSha(): Promise<string | null>
92
93
  getCommitChain(hash: string, depth: number, getFiles: CommitChainGetFiles): Promise<Array<CommitData>>
93
94
  }
94
- export declare class GitFile {
95
- findSimilarFiles(lineno: number): Promise<Array<Candidate>>
96
- }
97
- export declare class LocalGitGraph {
98
- constructor(repo: string)
99
- openFile(path: string): Promise<GitFile>
95
+ export declare class GitGraph {
96
+ constructor(repo: string, globalCursorIgnoreLegacy?: string | undefined | null, globalCursorJsonUnifiedBlocklist?: string | undefined | null)
97
+ /**
98
+ * Get a list of all paths in this repository, up to a maximum depth of `max_depth`. The
99
+ * paths are returned breadth-first, meaning that all paths at depth 0 are returned before any
100
+ * paths at depth 1, and so on.
101
+ * The iteration takes into account `gitignore` and `cursorignore` rules.
102
+ *
103
+ * @param maxDepth - maximum depth to search for paths. A depth of 0 means only the root path
104
+ * is returned.
105
+ * @param limit - maximum number of paths to return. If `None`, all paths are returned.
106
+ */
107
+ getBfsPaths(maxDepth: number, limit?: number | undefined | null): Promise<Array<string>>
108
+ /**
109
+ * Get a sorted list of relevant paths in this repository, from most relevant to least
110
+ * relevant. The list is biased towards the current user, using a heuristic that takes into account
111
+ * the most recently opened/edited files in the editor, which must be passed in as
112
+ * `lastEditedFiles`. If no recent files are provided, the returned paths will be sorted
113
+ * based on the global popularity of the files in the repository (i.e. the number of times each
114
+ * file has been modified throughout the Git history).
115
+ *
116
+ * @param lastEditedFiles - list of files that were recently opened/edited in the editor.
117
+ * @param maxCommits - maximum number of commits to consider when calculating the relevant paths.
118
+ * @param maxPaths - number of relevant paths to return
119
+ */
120
+ getRelevantPaths(lastEditedFiles: Array<string>, maxCommits: number, maxPaths: number): Promise<Array<string>>
100
121
  }
package/index.js CHANGED
@@ -310,13 +310,13 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { DiffType, DiffClient, MerkleClient, GitClient, CommitFileStatus, CommitChainGetFiles, GitFile, LocalGitGraph } = nativeBinding
313
+ const { DiffType, DiffClient, MULTI_ROOT_ABSOLUTE_PATH, MerkleClient, GitClient, CommitFileStatus, CommitChainGetFiles, GitGraph } = nativeBinding
314
314
 
315
315
  module.exports.DiffType = DiffType
316
316
  module.exports.DiffClient = DiffClient
317
+ module.exports.MULTI_ROOT_ABSOLUTE_PATH = MULTI_ROOT_ABSOLUTE_PATH
317
318
  module.exports.MerkleClient = MerkleClient
318
319
  module.exports.GitClient = GitClient
319
320
  module.exports.CommitFileStatus = CommitFileStatus
320
321
  module.exports.CommitChainGetFiles = CommitChainGetFiles
321
- module.exports.GitFile = GitFile
322
- module.exports.LocalGitGraph = LocalGitGraph
322
+ module.exports.GitGraph = GitGraph
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anysphere/file-service",
3
- "version": "0.0.0-c7f92fb0",
3
+ "version": "0.0.0-c829a588",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "napi": {
@@ -40,12 +40,12 @@
40
40
  "version": "napi version"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@anysphere/file-service-win32-x64-msvc": "0.0.0-c7f92fb0",
44
- "@anysphere/file-service-darwin-x64": "0.0.0-c7f92fb0",
45
- "@anysphere/file-service-linux-x64-gnu": "0.0.0-c7f92fb0",
46
- "@anysphere/file-service-darwin-arm64": "0.0.0-c7f92fb0",
47
- "@anysphere/file-service-win32-arm64-msvc": "0.0.0-c7f92fb0",
48
- "@anysphere/file-service-darwin-universal": "0.0.0-c7f92fb0",
49
- "@anysphere/file-service-linux-arm64-gnu": "0.0.0-c7f92fb0"
43
+ "@anysphere/file-service-win32-x64-msvc": "0.0.0-c829a588",
44
+ "@anysphere/file-service-darwin-x64": "0.0.0-c829a588",
45
+ "@anysphere/file-service-linux-x64-gnu": "0.0.0-c829a588",
46
+ "@anysphere/file-service-darwin-arm64": "0.0.0-c829a588",
47
+ "@anysphere/file-service-win32-arm64-msvc": "0.0.0-c829a588",
48
+ "@anysphere/file-service-darwin-universal": "0.0.0-c829a588",
49
+ "@anysphere/file-service-linux-arm64-gnu": "0.0.0-c829a588"
50
50
  }
51
51
  }