open-azdo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -0
- package/SECURITY.md +64 -0
- package/dist/open-azdo.js +29787 -0
- package/dist/open-azdo.js.map +151 -0
- package/examples/azure-pipelines.review.yml +32 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# open-azdo
|
|
2
|
+
|
|
3
|
+
`open-azdo` is a Bun CLI for Azure DevOps pull-request review runs in Azure Pipelines. It reviews the checked-out workspace with OpenCode, posts one managed summary thread plus managed inline finding threads, and stays comment-only in v1.
|
|
4
|
+
|
|
5
|
+
## Why This Exists
|
|
6
|
+
|
|
7
|
+
This package is the published-package path for secure PR review automation. Unlike the Marketplace extension reference, v1 intentionally does not:
|
|
8
|
+
|
|
9
|
+
- edit the repository
|
|
10
|
+
- commit or push changes
|
|
11
|
+
- expose command-triggered execution modes
|
|
12
|
+
- run a long-lived OpenCode server
|
|
13
|
+
- rely on tokenized clone URLs
|
|
14
|
+
|
|
15
|
+
The CLI consumes the Azure Pipeline checkout workspace directly and uses the built-in `System.AccessToken` for the minimal Azure DevOps REST surface.
|
|
16
|
+
|
|
17
|
+
## Install And Run
|
|
18
|
+
|
|
19
|
+
Use Bun 1.3.10 or newer.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bunx open-azdo review --model "openai/gpt-5.4"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Required inputs:
|
|
26
|
+
|
|
27
|
+
- `--model` or `OPEN_AZDO_MODEL`
|
|
28
|
+
- `SYSTEM_ACCESSTOKEN`
|
|
29
|
+
|
|
30
|
+
Common Azure Pipeline defaults:
|
|
31
|
+
|
|
32
|
+
- `OPEN_AZDO_WORKSPACE` or `BUILD_SOURCESDIRECTORY`
|
|
33
|
+
- `OPEN_AZDO_COLLECTION_URL` or `SYSTEM_COLLECTIONURI`
|
|
34
|
+
- `OPEN_AZDO_PROJECT` or `SYSTEM_TEAMPROJECT`
|
|
35
|
+
- `OPEN_AZDO_REPOSITORY_ID` or `BUILD_REPOSITORY_ID`
|
|
36
|
+
- `OPEN_AZDO_PULL_REQUEST_ID` or `SYSTEM_PULLREQUEST_PULLREQUESTID`
|
|
37
|
+
|
|
38
|
+
Optional flags:
|
|
39
|
+
|
|
40
|
+
- `--workspace <path>`
|
|
41
|
+
- `--organization <name>`
|
|
42
|
+
- `--project <name>`
|
|
43
|
+
- `--repository-id <id>`
|
|
44
|
+
- `--pull-request-id <id>`
|
|
45
|
+
- `--collection-url <url>`
|
|
46
|
+
- `--agent <name>` default `azdo-review`
|
|
47
|
+
- `--prompt-file <path>`
|
|
48
|
+
- `--dry-run`
|
|
49
|
+
- `--json`
|
|
50
|
+
|
|
51
|
+
Exit behavior:
|
|
52
|
+
|
|
53
|
+
- successful review runs return `0`, even when findings are posted
|
|
54
|
+
- operational failures return non-zero
|
|
55
|
+
|
|
56
|
+
## Azure Pipelines
|
|
57
|
+
|
|
58
|
+
The canonical example is in [examples/azure-pipelines.review.yml](/home/ponbac/dev/open-azdo/examples/azure-pipelines.review.yml).
|
|
59
|
+
|
|
60
|
+
Key requirements:
|
|
61
|
+
|
|
62
|
+
- use `checkout: self`
|
|
63
|
+
- set `fetchDepth: 0`
|
|
64
|
+
- keep `persistCredentials: false`
|
|
65
|
+
- enable “Allow scripts to access the OAuth token”
|
|
66
|
+
- grant repository read and pull request thread read/write permissions
|
|
67
|
+
|
|
68
|
+
Attach the pipeline as a branch build-validation policy. Findings are posted as PR comments by default and do not fail the build.
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
trigger: none
|
|
72
|
+
|
|
73
|
+
pool:
|
|
74
|
+
vmImage: ubuntu-latest
|
|
75
|
+
|
|
76
|
+
steps:
|
|
77
|
+
- checkout: self
|
|
78
|
+
clean: true
|
|
79
|
+
fetchDepth: 0
|
|
80
|
+
persistCredentials: false
|
|
81
|
+
|
|
82
|
+
- bash: |
|
|
83
|
+
set -euo pipefail
|
|
84
|
+
curl -fsSL https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-linux-x64.zip -o bun.zip
|
|
85
|
+
unzip -q bun.zip
|
|
86
|
+
export PATH="$PWD/bun-linux-x64:$PATH"
|
|
87
|
+
|
|
88
|
+
curl -fsSL https://github.com/sst/opencode/releases/download/v1.2.27/opencode-linux-x64.tar.gz -o opencode.tar.gz
|
|
89
|
+
mkdir -p opencode-bin
|
|
90
|
+
tar -xzf opencode.tar.gz -C opencode-bin
|
|
91
|
+
export PATH="$PWD/opencode-bin:$PATH"
|
|
92
|
+
|
|
93
|
+
bunx open-azdo review --model "$(OpenCodeModel)"
|
|
94
|
+
displayName: Review Pull Request
|
|
95
|
+
env:
|
|
96
|
+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
97
|
+
OPENAI_API_KEY: $(OpenAIApiKey)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
Reference assets live under `.reference/`, including `t3code` for Effect v4
|
|
103
|
+
service and command-runner patterns. Refresh them with:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
./scripts/pull-ref-repos.sh
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Project checks:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
bun run check
|
|
113
|
+
bun run build
|
|
114
|
+
```
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
`open-azdo` is review-only in v1. It reads the checked-out workspace, calls OpenCode in read-only mode, and writes Azure DevOps PR threads. It does not edit files, commit, push, or invoke arbitrary helper scripts for mutations.
|
|
6
|
+
|
|
7
|
+
## Threat Model
|
|
8
|
+
|
|
9
|
+
Inputs are treated as untrusted:
|
|
10
|
+
|
|
11
|
+
- pull-request title and description
|
|
12
|
+
- repository contents
|
|
13
|
+
- generated diffs and file excerpts
|
|
14
|
+
- model output
|
|
15
|
+
|
|
16
|
+
Primary goals:
|
|
17
|
+
|
|
18
|
+
- never leak secrets to stdout, stderr, or structured logs
|
|
19
|
+
- avoid broad repository or network mutation paths
|
|
20
|
+
- keep Azure DevOps permissions limited to repository read plus PR thread read/write
|
|
21
|
+
|
|
22
|
+
## Checkout-First Design
|
|
23
|
+
|
|
24
|
+
The CLI uses the Azure Pipeline checkout workspace instead of PAT-based clone URLs. This avoids embedding tokens in clone commands or remote URLs and keeps auth scoped to the pipeline-provided `System.AccessToken`.
|
|
25
|
+
|
|
26
|
+
For correct diff resolution, use:
|
|
27
|
+
|
|
28
|
+
- `checkout: self`
|
|
29
|
+
- `fetchDepth: 0`
|
|
30
|
+
- `persistCredentials: false`
|
|
31
|
+
|
|
32
|
+
If required history is missing, `open-azdo` fails with a remediation message instead of guessing.
|
|
33
|
+
|
|
34
|
+
## Secret Handling
|
|
35
|
+
|
|
36
|
+
- Azure DevOps auth comes from `SYSTEM_ACCESSTOKEN`
|
|
37
|
+
- secrets are wrapped with Effect `Redacted`
|
|
38
|
+
- log rendering sanitizes token-like fields before output
|
|
39
|
+
- authenticated git URLs are never constructed
|
|
40
|
+
|
|
41
|
+
## OpenCode Containment
|
|
42
|
+
|
|
43
|
+
Each review run creates a temporary OpenCode config directory and removes it on exit. The generated `azdo-review` agent is read-only:
|
|
44
|
+
|
|
45
|
+
- read/search/listing tools allowed
|
|
46
|
+
- edit and write denied
|
|
47
|
+
- web fetch and web search denied
|
|
48
|
+
- bash denied by default, with a narrow allowlist for read-style commands
|
|
49
|
+
|
|
50
|
+
The CLI uses `opencode run --format json` directly. There is no long-lived server and no fixed local port to secure.
|
|
51
|
+
|
|
52
|
+
## Azure DevOps Mutations
|
|
53
|
+
|
|
54
|
+
The only intended write surface is PR thread management:
|
|
55
|
+
|
|
56
|
+
- one managed summary thread
|
|
57
|
+
- one managed inline thread per finding fingerprint
|
|
58
|
+
- stale managed finding threads marked `fixed`
|
|
59
|
+
|
|
60
|
+
Comment-post failures are surfaced as operational failures and do not get swallowed.
|
|
61
|
+
|
|
62
|
+
## Reporting
|
|
63
|
+
|
|
64
|
+
If you find a security issue, avoid opening a public issue with exploit details. Share a minimal reproduction and impact summary privately through the repository’s preferred disclosure channel.
|