Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Summary

Adds comprehensive documentation to @outfitter/file-ops package:

  • README.md — Installation, quick start, security considerations, workspace detection, file locking, atomic writes
  • CHANGELOG.md — Initial 0.1.0 release notes
  • TSDoc comments — All exported functions, types, and interfaces documented with @param, @returns, and @example

Highlights

  • Security documentation — Path traversal protection, null byte rejection, symlink detection
  • Documents workspace marker priority (.git, package.json)
  • Shows advisory file locking with withLock() pattern
  • Covers atomic writes (temp file + rename)

Test plan

  • bun run typecheck passes
  • bun run build succeeds

🤖 Generated with Claude Code

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@galligan galligan marked this pull request as ready for review January 23, 2026 03:12
This was referenced Jan 23, 2026
@galligan galligan added the documentation Improvements or additions to documentation label Jan 23, 2026
@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Adds comprehensive documentation to @outfitter/file-ops package including README, CHANGELOG, and TSDoc comments for all exported functions, types, and interfaces
  • Documentation covers critical security features like path traversal protection, workspace detection, file locking patterns, and atomic write operations
  • Follows established project conventions with proper @param, @returns, @defaultValue annotations and Result-based error handling examples

Important Files Changed

Filename Overview
packages/file-ops/src/index.ts Added comprehensive TSDoc documentation to all exported functions and interfaces with security warnings and usage examples
packages/file-ops/README.md New comprehensive API documentation with installation guide, security model, and detailed usage examples for all features
packages/file-ops/CHANGELOG.md New changelog documenting initial 0.1.0 release with complete feature inventory

Confidence score: 5/5

  • This PR is extremely safe to merge as it only adds documentation without any functional code changes
  • Score reflects documentation-only changes with no risk to existing functionality or behavior
  • No files require special attention as all changes are purely additive documentation

Sequence Diagram

sequenceDiagram
    participant User
    participant FileOps as "@outfitter/file-ops"
    participant FileSystem as "File System"
    participant BunGlob as "Bun.Glob"

    Note over User, FileSystem: Workspace Detection Flow
    User->>FileOps: "findWorkspaceRoot(startPath, options?)"
    FileOps->>FileOps: "resolve(startPath)"
    loop "Walk up directory tree"
        FileOps->>FileSystem: "stat(markerPath)"
        FileSystem-->>FileOps: "marker exists/not found"
        alt "marker found"
            FileOps-->>User: "Result.ok(workspaceRoot)"
        else "continue search"
            FileOps->>FileOps: "dirname(currentDir)"
        end
    end

    Note over User, FileSystem: Secure Path Validation Flow
    User->>FileOps: "securePath(path, basePath)"
    FileOps->>FileOps: "validate null bytes"
    FileOps->>FileOps: "check path traversal"
    FileOps->>FileOps: "normalize and join paths"
    FileOps->>FileOps: "verify within basePath"
    FileOps-->>User: "Result.ok(safePath)"

    Note over User, BunGlob: Glob Pattern Matching Flow
    User->>FileOps: "glob(pattern, options?)"
    FileOps->>BunGlob: "new Bun.Glob(pattern)"
    FileOps->>FileOps: "createIgnoreFilter(options.ignore)"
    FileOps->>BunGlob: "glob.scan(scanOptions)"
    loop "for each matched file"
        BunGlob-->>FileOps: "file path"
        FileOps->>FileOps: "apply ignore filter"
        FileOps->>FileOps: "resolve to absolute path"
    end
    FileOps-->>User: "Result.ok(absolutePaths[])"

    Note over User, FileSystem: File Locking Flow
    User->>FileOps: "withLock(path, callback)"
    FileOps->>FileOps: "acquireLock(path)"
    FileOps->>FileSystem: "writeFile(lockPath, metadata, {flag: 'wx'})"
    FileSystem-->>FileOps: "lock acquired"
    FileOps->>User: "execute callback()"
    User-->>FileOps: "callback result"
    FileOps->>FileSystem: "unlink(lockPath)"
    FileSystem-->>FileOps: "lock released"
    FileOps-->>User: "Result.ok(callbackResult)"

    Note over User, FileSystem: Atomic Write Flow
    User->>FileOps: "atomicWrite(path, content, options?)"
    FileOps->>FileSystem: "mkdir(parentDir, {recursive: true})"
    FileOps->>FileOps: "generate tempPath"
    FileOps->>FileSystem: "writeFile(tempPath, content)"
    FileSystem-->>FileOps: "temp file written"
    FileOps->>FileSystem: "rename(tempPath, path)"
    FileSystem-->>FileOps: "atomic rename complete"
    FileOps-->>User: "Result.ok()"
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants