opctl 0.1.0 → 0.1.1
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 +71 -12
- package/dist/cli.js +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,13 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
`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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Published package:
|
|
8
|
+
|
|
9
|
+
- npm: <https://www.npmjs.com/package/opctl>
|
|
10
|
+
- current package: `opctl@0.1.0`
|
|
11
|
+
- binary: `opctl`
|
|
12
|
+
|
|
13
|
+
Install globally:
|
|
6
14
|
|
|
7
15
|
```sh
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
npm install -g opctl
|
|
17
|
+
opctl --help
|
|
10
18
|
```
|
|
11
19
|
|
|
20
|
+
Or run without a global install:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx opctl --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
12
28
|
Export variables in your shell; `opctl` intentionally does not read `.env` files.
|
|
13
29
|
|
|
14
30
|
Required:
|
|
@@ -22,22 +38,65 @@ Optional:
|
|
|
22
38
|
- `OPENPROJECT_DEFAULT_PROJECT`: project identifier/id used by `wp search` when `--project` is omitted.
|
|
23
39
|
- `OPENPROJECT_ALLOW_WRITE`: must be exactly `1` to allow write-capable commands.
|
|
24
40
|
|
|
25
|
-
##
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Show the authenticated OpenProject user:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
opctl me
|
|
47
|
+
opctl me --json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Inspect API root links:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
opctl api-root
|
|
54
|
+
opctl api-root --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
List projects:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
opctl projects --page-size 20
|
|
61
|
+
opctl projects --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Read work packages:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
opctl wp get 123
|
|
68
|
+
opctl wp get 123 --json
|
|
69
|
+
opctl wp get 123 --raw-json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Search work packages:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
opctl wp search --project my-project --subject "pump"
|
|
76
|
+
opctl wp search --project my-project --assignee-me --status open
|
|
77
|
+
opctl wp search --subject "pump" --json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If `--project` is omitted, `opctl wp search` uses `OPENPROJECT_DEFAULT_PROJECT` when set. Without either, it searches the instance-wide work package endpoint.
|
|
81
|
+
|
|
82
|
+
List work packages assigned to the authenticated user:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
opctl wp mine
|
|
86
|
+
opctl wp mine --project my-project --page-size 50
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Pull the OpenAPI spec from your configured instance:
|
|
26
90
|
|
|
27
91
|
```sh
|
|
28
|
-
|
|
29
|
-
npm run dev -- api-root
|
|
30
|
-
npm run dev -- projects --page-size 20
|
|
31
|
-
npm run dev -- wp get 123 --json
|
|
32
|
-
npm run dev -- wp search --project my-project --subject "pump" --assignee-me
|
|
33
|
-
npm run dev -- wp mine --project my-project
|
|
92
|
+
opctl spec pull
|
|
34
93
|
```
|
|
35
94
|
|
|
36
95
|
Write-capable command:
|
|
37
96
|
|
|
38
97
|
```sh
|
|
39
|
-
OPENPROJECT_ALLOW_WRITE=1
|
|
40
|
-
OPENPROJECT_ALLOW_WRITE=1
|
|
98
|
+
OPENPROJECT_ALLOW_WRITE=1 opctl wp comment 123 "Investigating" --dry-run
|
|
99
|
+
OPENPROJECT_ALLOW_WRITE=1 opctl wp comment 123 "Investigating"
|
|
41
100
|
```
|
|
42
101
|
|
|
43
102
|
`wp comment` fetches the work package first and posts only when a documented HAL comment action link is present. It fails safely instead of guessing a mutation URL.
|
package/dist/cli.js
CHANGED
|
File without changes
|