opctl 0.1.5 → 0.1.7
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 +73 -8
- package/dist/cli.js +652 -75
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# opctl
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/opctl)
|
|
4
|
+
|
|
3
5
|
`opctl` is a small local Node.js + TypeScript CLI bridge for OpenProject API v3. It uses the current user's personal API token and is read-only by default.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
@@ -7,7 +9,7 @@
|
|
|
7
9
|
Published package:
|
|
8
10
|
|
|
9
11
|
- npmjs.com: `opctl`
|
|
10
|
-
- current package: `opctl@0.1.
|
|
12
|
+
- current package: `opctl@0.1.7`
|
|
11
13
|
- binary: `opctl`
|
|
12
14
|
|
|
13
15
|
Install globally:
|
|
@@ -81,15 +83,21 @@ opctl wp get 123 --raw-json
|
|
|
81
83
|
opctl wp get 123 124 --table
|
|
82
84
|
opctl wp get --ids 123,124 --fields id,subject,status,assignee --table
|
|
83
85
|
opctl wp get --ids 123,124 --jsonl
|
|
86
|
+
opctl wp get --ids 123,124 --raw-json
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
`--raw-json` emits a single raw OpenProject object for one ID and JSONL for multiple IDs.
|
|
90
|
+
|
|
91
|
+
Field selection supports `id,subject,status,type,assignee,responsible,project,href,browserUrl,updatedAt,description,shortDescription,attachmentsCount,lockVersion,priority`; aliases: `title=subject`, `url=href`.
|
|
87
92
|
|
|
88
93
|
Search work packages:
|
|
89
94
|
|
|
90
95
|
```sh
|
|
91
96
|
opctl wp search --project my-project --subject "pump"
|
|
92
97
|
opctl wp search --project my-project --assignee-me --status open
|
|
98
|
+
opctl wp search --responsible-me --open
|
|
99
|
+
opctl wp search --responsible 18 --not-status "In Client Review"
|
|
100
|
+
opctl wp search --filter responsible=me --filter status=o --sort updated_at:desc
|
|
93
101
|
opctl wp search --open --subject "pump" --compact
|
|
94
102
|
opctl wp search --subject "pump" --fields id,subject,status --json
|
|
95
103
|
|
|
@@ -97,6 +105,15 @@ opctl wp search --subject "pump" --fields id,subject,status --json
|
|
|
97
105
|
|
|
98
106
|
If `--project` is omitted, `opctl wp search` uses `OPENPROJECT_DEFAULT_PROJECT` when set. Without either, it searches the instance-wide work package endpoint.
|
|
99
107
|
|
|
108
|
+
Lookup work package types, statuses, and priorities:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
opctl types --project my-project
|
|
112
|
+
opctl types --json
|
|
113
|
+
opctl statuses
|
|
114
|
+
opctl priorities
|
|
115
|
+
```
|
|
116
|
+
|
|
100
117
|
List work packages assigned to the authenticated user:
|
|
101
118
|
|
|
102
119
|
```sh
|
|
@@ -105,6 +122,13 @@ opctl wp mine --open --table
|
|
|
105
122
|
opctl wp mine --project my-project --page-size 50 --fields id,subject,status,updatedAt
|
|
106
123
|
```
|
|
107
124
|
|
|
125
|
+
List open work packages accountable/responsible to the authenticated user:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
opctl wp accountable
|
|
129
|
+
opctl wp accountable --table --fields id,subject,status,responsible,updatedAt
|
|
130
|
+
```
|
|
131
|
+
|
|
108
132
|
Triage a known list:
|
|
109
133
|
|
|
110
134
|
```sh
|
|
@@ -112,30 +136,70 @@ opctl wp check 123 124
|
|
|
112
136
|
opctl wp check --ids 123,124 --fields id,title,status,assignee,shortDescription,attachmentsCount --table
|
|
113
137
|
```
|
|
114
138
|
|
|
115
|
-
|
|
139
|
+
Inspect and download work package attachments:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
opctl wp attachments 123
|
|
143
|
+
opctl wp attachments 123 --json
|
|
144
|
+
opctl wp download-attachments 123 --dir /tmp/op-attachments
|
|
145
|
+
opctl wp download-attachments 123 --dir /tmp/op-attachments --overwrite --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Show redacted diagnostics:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
opctl doctor
|
|
152
|
+
opctl doctor --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Pull the OpenAPI spec (defaults to the public community instance):
|
|
116
156
|
|
|
117
157
|
```sh
|
|
118
158
|
opctl spec pull
|
|
159
|
+
opctl spec pull --output openapi/my-spec.json
|
|
160
|
+
opctl spec pull --url https://openproject.example.com
|
|
119
161
|
```
|
|
120
162
|
|
|
121
|
-
Write-capable
|
|
163
|
+
Write-capable commands:
|
|
122
164
|
|
|
123
165
|
```sh
|
|
166
|
+
# Comment on a work package
|
|
124
167
|
OPENPROJECT_ALLOW_WRITE=1 opctl wp comment 123 --dry-run "Investigating"
|
|
125
168
|
OPENPROJECT_ALLOW_WRITE=1 opctl wp comment 123 "Investigating"
|
|
169
|
+
|
|
170
|
+
# Create a work package (dry-run validates through /api/v3/work_packages/form)
|
|
171
|
+
OPENPROJECT_ALLOW_WRITE=1 opctl wp create --project alspc --type Feature --subject "Improve Ask NAVLIN Explore messaging experience" --description-file ticket.md --dry-run
|
|
172
|
+
OPENPROJECT_ALLOW_WRITE=1 opctl wp create --project alspc --type Feature --subject "S" --json < ticket.md
|
|
173
|
+
|
|
174
|
+
# Use a user-story template
|
|
175
|
+
opctl wp create --template user-story > ticket.md
|
|
176
|
+
OPENPROJECT_ALLOW_WRITE=1 opctl wp create --project alspc --type Feature --subject "New feature" --template user-story --dry-run
|
|
126
177
|
```
|
|
127
178
|
|
|
128
|
-
`wp comment`
|
|
179
|
+
`wp comment` and `wp create` both require `OPENPROJECT_ALLOW_WRITE=1`. `wp create --dry-run` validates through `/api/v3/work_packages/form` before any create call. Write-capable commands support `--dry-run` and avoid mutation in dry-run mode.
|
|
180
|
+
|
|
181
|
+
`wp create` resolves `--type`, `--status`, and `--priority` by name (case-insensitive exact match), numeric id, or full `/api/v3/...` href. Use `opctl types`, `opctl statuses`, or `opctl priorities` to list valid values. Description can come from `--description <text>`, `--description-file <path>` (use `-` for stdin), piped stdin, or `--template user-story`.
|
|
129
182
|
|
|
130
183
|
## OpenAPI
|
|
131
184
|
|
|
132
|
-
The repository commits `openapi/openproject.json` and generated types in `src/generated/openproject.ts`. The committed spec is an auditable public OpenProject baseline
|
|
185
|
+
The repository commits `openapi/openproject.json` and generated types in `src/generated/openproject.ts`. The committed spec is an auditable public OpenProject baseline.
|
|
186
|
+
|
|
187
|
+
`npm run openapi:pull` and `opctl spec pull` default to the official public spec at `https://community.openproject.org`. They do **not** read `OPENPROJECT_URL` or `OPENPROJECT_TOKEN`, so running tests or pulling the spec never sends credentials to a private instance.
|
|
133
188
|
|
|
134
189
|
```sh
|
|
135
|
-
|
|
190
|
+
# Refresh from the public community spec (safe, no credentials needed)
|
|
191
|
+
npm run openapi:update
|
|
192
|
+
|
|
193
|
+
# Pull from a specific private instance (explicit opt-in)
|
|
194
|
+
OPENPROJECT_SPEC_URL=https://openproject.example.com \
|
|
195
|
+
OPENPROJECT_SPEC_TOKEN=... \
|
|
196
|
+
npm run openapi:pull
|
|
197
|
+
|
|
198
|
+
# Or via the CLI
|
|
199
|
+
opctl spec pull --url https://openproject.example.com
|
|
136
200
|
```
|
|
137
201
|
|
|
138
|
-
|
|
202
|
+
Private-instance pulls use dedicated `OPENPROJECT_SPEC_URL` / `OPENPROJECT_SPEC_TOKEN` / `OPENPROJECT_SPEC_AUTH_MODE` variables. Normal `OPENPROJECT_URL` and `OPENPROJECT_TOKEN` are never used for spec pulling.
|
|
139
203
|
|
|
140
204
|
## Build and verification
|
|
141
205
|
|
|
@@ -150,6 +214,7 @@ node dist/cli.js wp --help
|
|
|
150
214
|
## Safety model
|
|
151
215
|
|
|
152
216
|
- No token or `Authorization` header is printed by normal errors, JSON output, spec pulling, or tests.
|
|
217
|
+
- Spec pulling defaults to the public community spec and ignores `OPENPROJECT_URL` / `OPENPROJECT_TOKEN`; private-instance pulls require explicit `--url` or `OPENPROJECT_SPEC_URL`.
|
|
153
218
|
- Local `.env` files are loaded for read configuration by default; `--no-env` disables that, and `.env` cannot enable writes.
|
|
154
219
|
- OpenProject writes are blocked unless the real process environment contains `OPENPROJECT_ALLOW_WRITE=1` exactly.
|
|
155
220
|
- Every write-capable command supports `--dry-run` and avoids mutation in dry-run mode.
|