@tplog/zendcli 1.0.0 → 1.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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/dist/cli.js +28 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -30,7 +30,7 @@ This is the recommended option for temporary or CI usage.
30
30
 
31
31
  ```bash
32
32
  export ZENDESK_SUBDOMAIN="your-subdomain"
33
- export ZENDESK_EMAIL="you@example.com"
33
+ export ZENDESK_EMAIL="foo@example.com"
34
34
  export ZENDESK_API_TOKEN="your_zendesk_api_token"
35
35
  ```
36
36
 
@@ -46,11 +46,11 @@ zend follower --help
46
46
  zend comments --help
47
47
  zend tickets --limit 10
48
48
  zend tickets --status open --limit 20
49
- zend email user@example.com
50
- zend email user@example.com --status unresolved
51
- zend email user@example.com --status open,pending
49
+ zend email foo@example.com
50
+ zend email foo@example.com --status unresolved
51
+ zend email foo@example.com --status open,pending
52
52
  zend follower
53
- zend follower tp@dify.ai --limit 3
53
+ zend follower foo@example.com --limit 3
54
54
  zend comments 12345
55
55
  zend comments 12345 --type public
56
56
  zend comments 12345 --json
package/dist/cli.js CHANGED
@@ -3730,7 +3730,33 @@ program2.command("configure").description("Set up Zendesk credentials interactiv
3730
3730
  saveConfig({ subdomain, email, api_token });
3731
3731
  printJson({ ok: true });
3732
3732
  }));
3733
- program2.command("ticket <id>").description("Get a single ticket").action(run(async (id) => {
3733
+ var TICKET_SUMMARY_FIELDS = [
3734
+ "id",
3735
+ "subject",
3736
+ "description",
3737
+ "status",
3738
+ "priority",
3739
+ "created_at",
3740
+ "updated_at",
3741
+ "tags",
3742
+ "requester_id",
3743
+ "assignee_id",
3744
+ "collaborator_ids",
3745
+ "follower_ids",
3746
+ "organization_id",
3747
+ "group_id",
3748
+ "type",
3749
+ "via",
3750
+ "url"
3751
+ ];
3752
+ function pickTicketFields(ticket) {
3753
+ const result = {};
3754
+ for (const key of TICKET_SUMMARY_FIELDS) {
3755
+ if (key in ticket) result[key] = ticket[key];
3756
+ }
3757
+ return result;
3758
+ }
3759
+ program2.command("ticket <id>").description("Get a single ticket").option("--raw", "Output full API response without field filtering").action(run(async (id, opts) => {
3734
3760
  if (!DIGITS_RE.test(id)) {
3735
3761
  throw new CliError("invalid_args", "ticket id must be numeric", { id });
3736
3762
  }
@@ -3739,7 +3765,7 @@ program2.command("ticket <id>").description("Get a single ticket").action(run(as
3739
3765
  if (!data.ticket) {
3740
3766
  throw new CliError("not_found", `Ticket ${id} not found`, { id: Number(id) });
3741
3767
  }
3742
- printJson(data.ticket);
3768
+ printJson(opts.raw ? data.ticket : pickTicketFields(data.ticket));
3743
3769
  } catch (error) {
3744
3770
  if (error instanceof ApiError && error.status === 404) {
3745
3771
  fail("not_found", `Ticket ${id} not found`, { id: Number(id) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplog/zendcli",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Minimal Zendesk CLI for tickets and comments",
5
5
  "repository": {
6
6
  "type": "git",