WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage from it! :)
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add initial pull request work

+44 -7
+15 -3
README.md
··· 91 91 tangled issue create "Bug: Something is broken" --body "Detailed description of the bug here." 92 92 echo "Another bug description from stdin." | tangled issue create "Bug: From stdin" --body-file - 93 93 tangled issue list --json "id,title" 94 + tangled pr create --base main --head my-feature --title "Add new feature" --body-file ./pr_description.md 95 + tangled pr view 123 96 + tangled pr comment 123 --body "Looks good, small change needed." 94 97 ``` 95 98 96 99 ## 7. Basic Commands 97 100 98 - Basic commands include auth, key management, repo creation, and issue management. 101 + Basic commands include auth, key management, repo creation, issue management, and pull request management. 99 102 100 103 `tangled auth login` 101 104 ··· 112 115 - Displays details about the current repository. If `--json` is provided, outputs only the specified fields in JSON format. 113 116 `tangled issue create "<title>" [--body "<body>" | --body-file <file> | -F -]` 114 117 - Creates a new issue in the current repository with the given title and optional body, which can be provided via flag, file, or stdin. 118 + `tangled pr create --base <base-branch> --head <head-branch> --title <title> [--body <body> | --body-file <file> | -F -]` 119 + - Creates a new pull request in the current repository from a head branch to a base branch. 120 + `tangled pr list [--json <fields>]` 121 + - Lists pull requests for the current repository. 122 + `tangled pr view <id> [--json <fields>]` 123 + - Displays detailed information about a specific pull request, including comments. 124 + `tangled pr comment <id> [--body <body> | --body-file <file> | -F -]` 125 + - Adds a comment to a pull request. 126 + `tangled pr review <id> --comment <comment> [--approve | --request-changes]` 127 + - Submits a review for a pull request, with optional approval or request for changes. 115 128 116 129 ## 8. Design Decisions & Outstanding Issues 117 130 ··· 149 162 150 163 The 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: 151 164 152 - * **Pull Requests:** A full suite of commands for creating, viewing, listing, merging, and commenting on pull requests. 153 165 * **CI/CD Pipelines:** Commands to view pipeline status and manage CI/CD jobs. 154 166 * **Repository Secrets:** A dedicated command set for managing CI/CD secrets within a repository (`tangled repo secret ...`). 155 167 * **Advanced Git Operations:** Commands to interact with the commit log, diffs, branches, and tags directly via the API, augmenting local `git` commands. ··· 160 172 161 173 ## 10. Task Management 162 174 163 - 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. 175 + 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
··· 42 42 - [ ] Implement `tangled issue list [--json "id,title"]` command. 43 43 - [ ] Support `--json` output with field filtering. 44 44 45 - ## 7. Output & LLM Integration 45 + ## 7. Pull Request Management 46 + 47 + This section outlines the phased implementation for Pull Request (PR) support, following `gh` CLI patterns. 48 + 49 + ### Phase 1: Creating a Pull Request from a Branch (Author Workflow) 50 + - [ ] Implement `tangled pr create --base <base-branch> --head <head-branch> --title <title> [--body <body> | --body-file <file> | -F -]` command. 51 + - [ ] Generate the `git diff` patch between the `--head` and `--base` branches. 52 + - [ ] Upload the generated patch as a blob using `com.atproto.repo.uploadBlob` (or equivalent). 53 + - [ ] 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. 54 + - [ ] Implement `tangled pr list [--json <fields>]` command to list pull requests for the current repository. 55 + - [ ] Use `com.atproto.repo.listRecords` with `collection: "sh.tangled.repo.pull"`. 56 + - [ ] Implement `tangled pr view <id> [--json <fields>]` command to display detailed information about a specific pull request. 57 + - [ ] Use `com.atproto.repo.getRecord` for the `sh.tangled.repo.pull` record. 58 + - [ ] Fetch associated comments using `com.atproto.repo.listRecords` with `collection: "sh.tangled.repo.pull.comment"`. 59 + 60 + ### Phase 2: Working as a Reviewer (Commenting) 61 + - [ ] Implement `tangled pr comment <id> [--body <body> | --body-file <file> | -F -]` command. 62 + - [ ] Create a `sh.tangled.repo.pull.comment` record using `com.atproto.repo.createRecord`, linking it to the pull request's AT-URI. 63 + - [ ] Implement `tangled pr review <id> --comment <comment> [--approve | --request-changes]` command. 64 + - [ ] Create a `sh.tangled.repo.pull.comment` record. 65 + - [ ] 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). 66 + 67 + ### Phase 3: Responding to a Review (Author Workflow) 68 + - [ ] 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. 69 + 70 + ## 8. Output & LLM Integration 46 71 - [ ] Implement output formatting based on `is-interactive` check. 47 72 - [ ] "Human Mode" (TTY): Use `cli-table3` for pretty tables. 48 73 - [ ] "Machine Mode" (Pipe/`--json`): Plain text or JSON output. 49 74 - [ ] Implement `--json` flag for structured output. 50 75 - [ ] Implement `--no-input` flag to force CLI to error on unresolved context or missing flags (Fail Fast, Fail Loud principle). 51 76 52 - ## 8. Testing 77 + ## 9. Testing 53 78 - [ ] Set up a testing framework (e.g., Jest, Vitest). 54 79 - [ ] Write unit tests for core modules (Auth, Context Resolver, API client). 55 80 - [ ] Write integration tests for CLI commands. 56 81 57 - ## 9. Documentation & Deployment 82 + ## 10. Documentation & Deployment 58 83 - [ ] Generate CLI help documentation (`commander` usually handles this). 59 84 - [ ] Consider packaging/distribution strategy (npm, standalone binary). 60 85 61 - ## 10. Outstanding Issues / Future Considerations (from README) 86 + ## 11. Outstanding Issues / Future Considerations (from README) 62 87 - [ ] Secure cross-platform AT Proto session storage (OS keychain). 63 88 - [ ] Git authentication management similar to GitHub CLI (SSH keys, 1Password integration). 64 89 - [ ] Define clear precedence order for settings resolution (local config, home folder, CLI flags).