Skip to content

Commit

Permalink
wiring up globlas
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Sep 30, 2024
1 parent 574fb12 commit 3b19e95
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/core/src/git.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { runtimeHost } from "./host"

export class GitClient implements Git {
async selectModifiedFiles(
scope: "branch" | "staged" | "modified",
options?: {
endsWith?: ElementOrArray<string>
glob?: ElementOrArray<string>
}
): Promise<WorkspaceFile[]> {
let args: string[] = []
switch (scope) {
case "branch": {
}
case "staged": {
args = ["diff", "--cached", "--name-only", "--diff-filter=AM"]
break
}
case "modified": {
args = ["diff", "--name-only", "--diff-filter=AM"]
break
}
}
return undefined
}
}
3 changes: 3 additions & 0 deletions packages/core/src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { createFetch } from "./fetch"
import { readText } from "./fs"
import { logVerbose } from "./util"
import { GitHubClient } from "./github"
import { GitClient } from "./git"

/**
* Resolves the global context depending on the environment.
Expand Down Expand Up @@ -107,6 +108,8 @@ export function installGlobals() {

glb.github = new GitHubClient()

glb.git = new GitClient()

/**
* Asynchronous function to fetch text from a URL or file.
* Handles both HTTP(S) URLs and local workspace files.
Expand Down

0 comments on commit 3b19e95

Please sign in to comment.