···9191tangled issue create "Bug: Something is broken" --body "Detailed description of the bug here."
9292echo "Another bug description from stdin." | tangled issue create "Bug: From stdin" --body-file -
9393tangled issue list --json "id,title"
9494+tangled pr create --base main --head my-feature --title "Add new feature" --body-file ./pr_description.md
9595+tangled pr view 123
9696+tangled pr comment 123 --body "Looks good, small change needed."
9497```
95989699## 7. Basic Commands
971009898-Basic commands include auth, key management, repo creation, and issue management.
101101+Basic commands include auth, key management, repo creation, issue management, and pull request management.
99102100103`tangled auth login`
101104···112115- Displays details about the current repository. If `--json` is provided, outputs only the specified fields in JSON format.
113116 `tangled issue create "<title>" [--body "<body>" | --body-file <file> | -F -]`
114117- Creates a new issue in the current repository with the given title and optional body, which can be provided via flag, file, or stdin.
118118+ `tangled pr create --base <base-branch> --head <head-branch> --title <title> [--body <body> | --body-file <file> | -F -]`
119119+- Creates a new pull request in the current repository from a head branch to a base branch.
120120+ `tangled pr list [--json <fields>]`
121121+- Lists pull requests for the current repository.
122122+ `tangled pr view <id> [--json <fields>]`
123123+- Displays detailed information about a specific pull request, including comments.
124124+ `tangled pr comment <id> [--body <body> | --body-file <file> | -F -]`
125125+- Adds a comment to a pull request.
126126+ `tangled pr review <id> --comment <comment> [--approve | --request-changes]`
127127+- Submits a review for a pull request, with optional approval or request for changes.
115128116129## 8. Design Decisions & Outstanding Issues
117130···149162150163The analysis of the `tangled.org` API revealed a rich set of features that are not yet part of the initial CLI plan but represent significant opportunities for future expansion. These include:
151164152152-* **Pull Requests:** A full suite of commands for creating, viewing, listing, merging, and commenting on pull requests.
153165* **CI/CD Pipelines:** Commands to view pipeline status and manage CI/CD jobs.
154166* **Repository Secrets:** A dedicated command set for managing CI/CD secrets within a repository (`tangled repo secret ...`).
155167* **Advanced Git Operations:** Commands to interact with the commit log, diffs, branches, and tags directly via the API, augmenting local `git` commands.
···160172161173## 10. Task Management
162174163163-We're bootstrapping task tracking with TODO.md, but will migrate all tasks into Tangled issues and dog food the product as soon as we have basic issue creation and listing working.
175175+We're bootstrapping task tracking with TODO.md, but will migrate all tasks into Tangled issues and dog food the product as soon as we have basic issue creation and listing working.
+29-4
TODO.md
···4242- [ ] Implement `tangled issue list [--json "id,title"]` command.
4343 - [ ] Support `--json` output with field filtering.
44444545-## 7. Output & LLM Integration
4545+## 7. Pull Request Management
4646+4747+This section outlines the phased implementation for Pull Request (PR) support, following `gh` CLI patterns.
4848+4949+### Phase 1: Creating a Pull Request from a Branch (Author Workflow)
5050+- [ ] Implement `tangled pr create --base <base-branch> --head <head-branch> --title <title> [--body <body> | --body-file <file> | -F -]` command.
5151+ - [ ] Generate the `git diff` patch between the `--head` and `--base` branches.
5252+ - [ ] Upload the generated patch as a blob using `com.atproto.repo.uploadBlob` (or equivalent).
5353+ - [ ] Create a `sh.tangled.repo.pull` record using `com.atproto.repo.createRecord`, including `target` (repo and base branch), `source` (head branch and SHA), `title`, `body`, and the `patchBlob` reference.
5454+- [ ] Implement `tangled pr list [--json <fields>]` command to list pull requests for the current repository.
5555+ - [ ] Use `com.atproto.repo.listRecords` with `collection: "sh.tangled.repo.pull"`.
5656+- [ ] Implement `tangled pr view <id> [--json <fields>]` command to display detailed information about a specific pull request.
5757+ - [ ] Use `com.atproto.repo.getRecord` for the `sh.tangled.repo.pull` record.
5858+ - [ ] Fetch associated comments using `com.atproto.repo.listRecords` with `collection: "sh.tangled.repo.pull.comment"`.
5959+6060+### Phase 2: Working as a Reviewer (Commenting)
6161+- [ ] Implement `tangled pr comment <id> [--body <body> | --body-file <file> | -F -]` command.
6262+ - [ ] Create a `sh.tangled.repo.pull.comment` record using `com.atproto.repo.createRecord`, linking it to the pull request's AT-URI.
6363+- [ ] Implement `tangled pr review <id> --comment <comment> [--approve | --request-changes]` command.
6464+ - [ ] Create a `sh.tangled.repo.pull.comment` record.
6565+ - [ ] Update the `sh.tangled.repo.pull.status` record (if applicable) to reflect approval or requested changes. (Further API research might be needed to map approve/request-changes to status updates).
6666+6767+### Phase 3: Responding to a Review (Author Workflow)
6868+- [ ] This phase primarily involves local Git operations (pushing new commits) and using `tangled pr comment` for clarifications, which are covered by existing or planned commands.
6969+7070+## 8. Output & LLM Integration
4671- [ ] Implement output formatting based on `is-interactive` check.
4772 - [ ] "Human Mode" (TTY): Use `cli-table3` for pretty tables.
4873 - [ ] "Machine Mode" (Pipe/`--json`): Plain text or JSON output.
4974- [ ] Implement `--json` flag for structured output.
5075- [ ] Implement `--no-input` flag to force CLI to error on unresolved context or missing flags (Fail Fast, Fail Loud principle).
51765252-## 8. Testing
7777+## 9. Testing
5378- [ ] Set up a testing framework (e.g., Jest, Vitest).
5479- [ ] Write unit tests for core modules (Auth, Context Resolver, API client).
5580- [ ] Write integration tests for CLI commands.
56815757-## 9. Documentation & Deployment
8282+## 10. Documentation & Deployment
5883- [ ] Generate CLI help documentation (`commander` usually handles this).
5984- [ ] Consider packaging/distribution strategy (npm, standalone binary).
60856161-## 10. Outstanding Issues / Future Considerations (from README)
8686+## 11. Outstanding Issues / Future Considerations (from README)
6287- [ ] Secure cross-platform AT Proto session storage (OS keychain).
6388- [ ] Git authentication management similar to GitHub CLI (SSH keys, 1Password integration).
6489- [ ] Define clear precedence order for settings resolution (local config, home folder, CLI flags).