Files
onyx-prebootstrap/notes/checklist.md
2025-10-09 18:36:07 -04:00

2.7 KiB

Complete Implementation Plan for Onyx Phase 1

Milestone 0: Foundation and Core Abstractions

Project Structure Setup

  1. Create directory structure

    onyx/
    ├── cmd/
    │   ├── onx/           # CLI entry point
    │   └── onxd/          # Daemon entry point
    ├── internal/
    │   ├── core/          # Core abstractions
    │   ├── git/           # Git interaction layer
    │   ├── models/        # Data models
    │   ├── storage/       # .onx directory management
    │   ├── commands/      # CLI command implementations
    │   ├── daemon/        # Daemon implementation
    │   └── utils/         # Utilities
    ├── pkg/               # Public APIs (if needed)
    ├── test/              # Integration tests
    ├── docs/              # Documentation
    └── scripts/           # Build/deployment scripts
    
  2. Set up dependency management

    go get github.com/go-git/go-git/v5@latest
    go get github.com/spf13/cobra@latest
    go get github.com/fsnotify/fsnotify@latest
    
  3. Create Makefile

    # Makefile
    .PHONY: build test clean install
    
    build:
        go build -o bin/onx ./cmd/onx
        go build -o bin/onxd ./cmd/onxd
    
    test:
        go test -v ./...
    
    install:
        go install ./cmd/onx
        go install ./cmd/onxd
    
    clean:
        rm -rf bin/
    

Core Abstractions Implementation

  1. Define core interfaces (internal/core/interfaces.go)

    type Repository interface {
        Init(path string) error
        GetGitRepo() *git.Repository
        GetOnyxMetadata() *OnyxMetadata
    }
    
    type GitBackend interface {
        CreateCommit(tree, parent, message string) (string, error)
        CreateTree(entries []TreeEntry) (string, error)
        UpdateRef(name, sha string) error
        GetRef(name string) (string, error)
    }
    
  2. Implement Repository struct (internal/core/repository.go)

    • Fields: gitRepo (*git.Repository), onyxPath (string), gitPath (string)
    • Methods: Open(), Close(), IsOnyxRepo()
    • Error handling for missing .git or .onx directories
  3. Implement Git object operations (internal/git/objects.go)

    • CreateBlob(content []byte) (string, error)
    • CreateTree(entries []TreeEntry) (string, error)
    • CreateCommit(tree, parent, message, author string) (string, error)
    • GetObject(sha string) (Object, error)
  4. Create data models (internal/models/)

    • oplog.go: OplogEntry struct with serialization
    • workstream.go: Workstream, WorkstreamCommit structs
    • workspace.go: WorkspaceState struct