pingcode-cli-unofficial 2.2.0 → 2.3.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 +63 -17
- package/dist/bin/pingcode.js +479 -164
- package/dist/bin/pingcode.js.map +1 -1
- package/package.json +3 -1
- package/skills/pingcode/SKILL.md +19 -0
- package/skills/pingcode/modules/api.md +11 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pingcode-cli-unofficial",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Command-line client for the PingCode Open API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"skill:install": "node dist/bin/pingcode.js skill install",
|
|
28
28
|
"preskill:install": "npm run build",
|
|
29
29
|
"scan:secrets": "node --experimental-strip-types scripts/scan-secrets.ts",
|
|
30
|
+
"check:npm-ownership": "node scripts/check-npm-ownership.mjs",
|
|
31
|
+
"smoke:npm-package": "node scripts/smoke-npm-package.mjs",
|
|
30
32
|
"check:commits": "node --experimental-strip-types scripts/check-commits.ts",
|
|
31
33
|
"hooks:install": "node scripts/install-hooks.mjs",
|
|
32
34
|
"prepare": "node scripts/install-hooks.mjs"
|
package/skills/pingcode/SKILL.md
CHANGED
|
@@ -158,6 +158,21 @@ pingcode auth status --check
|
|
|
158
158
|
served from `<host>/open` there.
|
|
159
159
|
- `pingcode auth logout` removes the token, the stored credentials and the metadata cache.
|
|
160
160
|
|
|
161
|
+
**No app? Use a personal access token.** If you cannot register an OAuth app — a script, a CI job,
|
|
162
|
+
someone else's machine — create a token in PingCode 个人设置 (validity and `scopes` are chosen there,
|
|
163
|
+
shown once) and either paste it or export it. It acts as you, needs no `client_id`/`client_secret`,
|
|
164
|
+
and `PINGCODE_TOKEN` alone is enough to run any command:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
PINGCODE_TOKEN=<token> pingcode project list # no login, no config file
|
|
168
|
+
pingcode auth login --mode pat --token <token> # store it in the config file
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
A PAT cannot be refreshed: an expired or revoked token fails with exit 3 (`auth:`) and tells you to
|
|
172
|
+
mint a new one. It also carries the same identity-based reach as a user token, so the seven
|
|
173
|
+
user-token-only endpoints (`/v1/myself`, `/v1/permission/my/*`, `/v1/permission/check/*`) work
|
|
174
|
+
whenever the token's scopes cover them.
|
|
175
|
+
|
|
161
176
|
**Security:** a Client Credentials token has organisation-wide system-administrator authority and is
|
|
162
177
|
valid for 30 days. It is not tied to a user. Never print it, never copy it into a file in a
|
|
163
178
|
repository, and treat `~/.pingcode/config.json` as a secret. The CLI redacts the secret and the token
|
|
@@ -246,6 +261,10 @@ pingcode auth login --client-id <id> --client-secret <secret> --save
|
|
|
246
261
|
pingcode auth status
|
|
247
262
|
pingcode auth status --check # adds one live API call: GET /v1/pjm/projects?page_size=1
|
|
248
263
|
pingcode auth logout
|
|
264
|
+
|
|
265
|
+
# personal access token — no OAuth app needed (scripts, CI, shared machines)
|
|
266
|
+
pingcode auth login --mode pat --token <token>
|
|
267
|
+
PINGCODE_TOKEN=<token> pingcode project list
|
|
249
268
|
```
|
|
250
269
|
|
|
251
270
|
### Settings — 后台设置
|
|
@@ -98,18 +98,21 @@ field that its `PATCH` sibling preserves. Unless you truly mean "replace everyth
|
|
|
98
98
|
| a **user-token-only** endpoint | told this CLI holds an enterprise token |
|
|
99
99
|
|
|
100
100
|
The seven user-token endpoints — `/v1/myself`, `/v1/permission/my/*` (3) and
|
|
101
|
-
`/v1/permission/check/*` (3) —
|
|
102
|
-
|
|
103
|
-
`GET /v1/permission/points` **does**
|
|
104
|
-
|
|
101
|
+
`/v1/permission/check/*` (3) — need a token bound to a human: either the OAuth2
|
|
102
|
+
authorization-code flow (`pingcode auth login --mode user`) or a personal access token whose
|
|
103
|
+
scopes cover them (`--mode pat` / `PINGCODE_TOKEN`). Note that `GET /v1/permission/points` **does**
|
|
104
|
+
work. Everything else, including all 61 enterprise-token-only DevOps endpoints, is reachable with
|
|
105
|
+
the credentials from `pingcode auth login`.
|
|
105
106
|
|
|
106
107
|
## 5. Everything else behaves exactly as it does elsewhere
|
|
107
108
|
|
|
108
109
|
`--dry-run` halts every write (search reads excepted, above) and prints the full request plan
|
|
109
|
-
with the `Authorization` header and any `client_secret` redacted. A `401`
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
with the `Authorization` header and any `client_secret` redacted. A `401` on a **refreshable**
|
|
111
|
+
token (enterprise or user) re-acquires it and replays once; with a **personal access token**
|
|
112
|
+
there is nothing to re-acquire, so it fails immediately with exit `3` and tells you to replace
|
|
113
|
+
the token (expired or revoked). A `429` honours `x-pc-retry-after` once. Any `2xx` is success. The
|
|
114
|
+
exit-code table in [`../SKILL.md`](../SKILL.md) applies unchanged; on a `403` the scope the docs
|
|
115
|
+
declare for that endpoint is printed to stderr (or an honest "the docs declare no scope" when they
|
|
113
116
|
declare none).
|
|
114
117
|
|
|
115
118
|
The rate limit is shared with everything else, so a `--all` sweep over a large collection spends
|