mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-16 05:34:44 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
35 lines
951 B
TypeScript
35 lines
951 B
TypeScript
import { glob, globSync, type GlobOptions } from "glob"
|
|
import { minimatch } from "minimatch"
|
|
|
|
export namespace Glob {
|
|
export interface Options {
|
|
cwd?: string
|
|
absolute?: boolean
|
|
include?: "file" | "all"
|
|
dot?: boolean
|
|
symlink?: boolean
|
|
}
|
|
|
|
function toGlobOptions(options: Options): GlobOptions {
|
|
return {
|
|
cwd: options.cwd,
|
|
absolute: options.absolute,
|
|
dot: options.dot,
|
|
follow: options.symlink ?? false,
|
|
nodir: options.include !== "all",
|
|
}
|
|
}
|
|
|
|
export async function scan(pattern: string, options: Options = {}): Promise<string[]> {
|
|
return glob(pattern, toGlobOptions(options)) as Promise<string[]>
|
|
}
|
|
|
|
export function scanSync(pattern: string, options: Options = {}): string[] {
|
|
return globSync(pattern, toGlobOptions(options)) as string[]
|
|
}
|
|
|
|
export function match(pattern: string, filepath: string): boolean {
|
|
return minimatch(filepath, pattern, { dot: true })
|
|
}
|
|
}
|