import type { Config } from '../../types/index.js'; /** * Classify a push error message as a retryable remote-movement race. * Defaults to `false` (non-retryable) for anything unrecognized so a genuine * error (auth, network, permissions) is never masked by retrying. */ export declare function isRaceError(message: string): boolean; /** * Options shared by publish/delete operations. */ export interface FilePublishOptions { /** Commit message to use for the change. */ commitMessage?: string; /** Target branch to publish to. Defaults to `config.uploadBranch ?? 'main'`. */ branch?: string; /** * Ref to base the worktree on when the target branch does not exist on the * remote yet (e.g. `origin/main`). When set, the push creates the branch on * origin (`HEAD:refs/heads/`); the worktree is created from this ref * instead of `origin/`. */ createFromRef?: string; } /** * FilePublishService — commit a single repo-relative file to a remote branch * (default `origin/main`) using a temporary detached worktree, without ever * touching the user's current branch or working tree. * * This encapsulates the worktree publish/delete dance that was previously * inlined in `executeUpload`. Both plan upload and `/hula-schedule` skill * publishing share this one tested implementation. * * The flow for each operation is: * 1. validate the target branch (injection guard) * 2. resolve an absolute worktree base path * 3. create a detached worktree off `origin/` * 4. write (publish) or remove (delete) the file at `/` * 5. stage + commit (`git add .` stages deletions too) when there are changes * 6. push `HEAD:` * 7. always remove the worktree in `finally` */ export declare class FilePublishService { private readonly config; private readonly cwd?; /** * @param config - Loaded config (worktree base path, upload branch). * @param cwd - Optional repository working directory. When supplied * (multi-repo `--folder` fan-out) every top-level git command and the repo * info lookup run against this directory. Undefined preserves the historical * process-cwd behavior for every existing caller. */ constructor(config: Config, cwd?: string); /** * Default branch this service publishes to. */ private defaultBranch; /** * Validate a branch value to prevent command injection in the git push * refspec. Mirrors the guard in `executeUpload`. */ private validateBranch; /** * Resolve the absolute worktree base path from config, identical to * `executeUpload`'s behavior. */ private resolveWorktreeBasePath; /** * Run `operation` inside a fresh detached worktree off `origin/`, * commit (with `commitMessage`) if it produced changes, push to the branch, * and always remove the worktree afterward. */ private withWorktree; /** * Publish (create or update) a file on the target branch. * * @param relativePath - Repo-relative path of the file to write. * @param content - The full content to write. * @param opts - Optional commit message and branch override. */ publishFile(relativePath: string, content: string, opts?: FilePublishOptions): Promise; /** * Delete a file from the target branch. * * @param relativePath - Repo-relative path of the file to remove. * @param opts - Optional commit message and branch override. */ deleteFile(relativePath: string, opts?: FilePublishOptions): Promise; } //# sourceMappingURL=FilePublishService.d.ts.map