@tplog/zendcli 0.1.0 → 0.2.2
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 +125 -5
- package/dist/cli.js +3396 -1961
- package/package.json +15 -9
package/README.md
CHANGED
|
@@ -1,15 +1,135 @@
|
|
|
1
1
|
# zendcli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Minimal Zendesk CLI for listing tickets and reading ticket comment threads.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @tplog/zendcli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configure
|
|
12
|
+
|
|
13
|
+
### Option 1: interactive setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
zend configure
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Credentials are stored locally in:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
~/.zendcli/config.json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The CLI writes this file with restricted permissions.
|
|
26
|
+
|
|
27
|
+
### Option 2: environment variables
|
|
28
|
+
|
|
29
|
+
This is the recommended option for temporary or CI usage.
|
|
4
30
|
|
|
5
31
|
```bash
|
|
6
|
-
|
|
32
|
+
export ZENDESK_SUBDOMAIN="your-subdomain"
|
|
33
|
+
export ZENDESK_EMAIL="you@example.com"
|
|
34
|
+
export ZENDESK_API_TOKEN="your_zendesk_api_token"
|
|
7
35
|
```
|
|
8
36
|
|
|
9
|
-
|
|
37
|
+
Environment variables take precedence over the config file.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
10
40
|
|
|
11
41
|
```bash
|
|
12
|
-
|
|
42
|
+
zend tickets --limit 10
|
|
43
|
+
zend tickets --status open --limit 20
|
|
44
|
+
zend email user@example.com
|
|
45
|
+
zend email user@example.com --status unresolved
|
|
46
|
+
zend email user@example.com --status open,pending
|
|
47
|
+
zend comments 12345
|
|
48
|
+
zend comments 12345 --type public
|
|
49
|
+
zend comments 12345 --json
|
|
13
50
|
```
|
|
14
51
|
|
|
15
|
-
|
|
52
|
+
## Development workflow
|
|
53
|
+
|
|
54
|
+
### Daily development
|
|
55
|
+
|
|
56
|
+
1. Create a feature branch from `main`
|
|
57
|
+
2. Develop locally
|
|
58
|
+
3. Commit as needed
|
|
59
|
+
4. Push branch to GitHub
|
|
60
|
+
5. Open a PR to `main`
|
|
61
|
+
6. Merge after CI passes
|
|
62
|
+
|
|
63
|
+
Example:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git checkout main
|
|
67
|
+
git pull
|
|
68
|
+
git checkout -b feat/some-change
|
|
69
|
+
|
|
70
|
+
# work locally
|
|
71
|
+
npm ci
|
|
72
|
+
npm run build
|
|
73
|
+
|
|
74
|
+
git add .
|
|
75
|
+
git commit -m "feat: add some change"
|
|
76
|
+
git push -u origin feat/some-change
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Release workflow
|
|
80
|
+
|
|
81
|
+
This repository uses a safer release flow:
|
|
82
|
+
|
|
83
|
+
- normal merges to `main` do **not** publish automatically
|
|
84
|
+
- npm publishing happens only when a version tag is pushed
|
|
85
|
+
- the release tag must match `package.json` version exactly
|
|
86
|
+
|
|
87
|
+
### Publish a new version
|
|
88
|
+
|
|
89
|
+
1. Make sure `main` is in the state you want to release
|
|
90
|
+
2. Bump the version locally
|
|
91
|
+
3. Push `main` and the new tag
|
|
92
|
+
4. GitHub Actions publishes to npm
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git checkout main
|
|
96
|
+
git pull
|
|
97
|
+
npm version patch
|
|
98
|
+
git push origin main --tags
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or for a feature release:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm version minor
|
|
105
|
+
git push origin main --tags
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This creates tags like `v0.1.2`, and the publish workflow verifies that the tag matches `package.json`.
|
|
109
|
+
|
|
110
|
+
## CI/CD
|
|
111
|
+
|
|
112
|
+
- `CI`: runs on branch pushes, PRs to `main`, and pushes to `main`
|
|
113
|
+
- `Publish to npm`: runs only on `v*` tags or manual trigger
|
|
114
|
+
|
|
115
|
+
## Trusted publishing
|
|
116
|
+
|
|
117
|
+
The publish workflow is set up for npm trusted publishing via GitHub Actions OIDC.
|
|
118
|
+
|
|
119
|
+
Recommended setup on npm:
|
|
120
|
+
|
|
121
|
+
1. Go to the package settings on npm
|
|
122
|
+
2. Add a Trusted Publisher for GitHub Actions
|
|
123
|
+
3. Point it to:
|
|
124
|
+
- owner: `tplog`
|
|
125
|
+
- repo: `zendcli`
|
|
126
|
+
- workflow file: `publish.yml`
|
|
127
|
+
|
|
128
|
+
This avoids storing long-lived npm tokens in the repository.
|
|
129
|
+
|
|
130
|
+
## Security notes
|
|
131
|
+
|
|
132
|
+
- Never commit real Zendesk credentials
|
|
133
|
+
- Prefer environment variables for temporary use
|
|
134
|
+
- If a token is ever exposed, revoke and rotate it immediately
|
|
135
|
+
- Do not store npm publish credentials in the repo or in gitignored files
|