@quire-io/quire-cli 0.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 (94) hide show
  1. package/CHANGES.md +33 -0
  2. package/LICENSE +15 -0
  3. package/README.md +69 -0
  4. package/dist/cli.js +209 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/chat.js +200 -0
  7. package/dist/commands/chat.js.map +1 -0
  8. package/dist/commands/colors.js +34 -0
  9. package/dist/commands/colors.js.map +1 -0
  10. package/dist/commands/comment.js +128 -0
  11. package/dist/commands/comment.js.map +1 -0
  12. package/dist/commands/doc.js +139 -0
  13. package/dist/commands/doc.js.map +1 -0
  14. package/dist/commands/insight.js +234 -0
  15. package/dist/commands/insight.js.map +1 -0
  16. package/dist/commands/login.js +78 -0
  17. package/dist/commands/login.js.map +1 -0
  18. package/dist/commands/logout.js +25 -0
  19. package/dist/commands/logout.js.map +1 -0
  20. package/dist/commands/mine.js +61 -0
  21. package/dist/commands/mine.js.map +1 -0
  22. package/dist/commands/notify.js +25 -0
  23. package/dist/commands/notify.js.map +1 -0
  24. package/dist/commands/org.js +99 -0
  25. package/dist/commands/org.js.map +1 -0
  26. package/dist/commands/partner.js +36 -0
  27. package/dist/commands/partner.js.map +1 -0
  28. package/dist/commands/project.js +346 -0
  29. package/dist/commands/project.js.map +1 -0
  30. package/dist/commands/resolve.js +61 -0
  31. package/dist/commands/resolve.js.map +1 -0
  32. package/dist/commands/status.js +130 -0
  33. package/dist/commands/status.js.map +1 -0
  34. package/dist/commands/sublist.js +143 -0
  35. package/dist/commands/sublist.js.map +1 -0
  36. package/dist/commands/tag.js +108 -0
  37. package/dist/commands/tag.js.map +1 -0
  38. package/dist/commands/task.js +767 -0
  39. package/dist/commands/task.js.map +1 -0
  40. package/dist/commands/undo.js +64 -0
  41. package/dist/commands/undo.js.map +1 -0
  42. package/dist/commands/user.js +24 -0
  43. package/dist/commands/user.js.map +1 -0
  44. package/dist/commands/whoami.js +34 -0
  45. package/dist/commands/whoami.js.map +1 -0
  46. package/dist/config.js +37 -0
  47. package/dist/config.js.map +1 -0
  48. package/dist/credentials.js +28 -0
  49. package/dist/credentials.js.map +1 -0
  50. package/dist/errors.js +56 -0
  51. package/dist/errors.js.map +1 -0
  52. package/dist/log.js +37 -0
  53. package/dist/log.js.map +1 -0
  54. package/dist/oauth/config.js +22 -0
  55. package/dist/oauth/config.js.map +1 -0
  56. package/dist/oauth/loopback.js +101 -0
  57. package/dist/oauth/loopback.js.map +1 -0
  58. package/dist/oauth/pkce.js +16 -0
  59. package/dist/oauth/pkce.js.map +1 -0
  60. package/dist/options.js +2 -0
  61. package/dist/options.js.map +1 -0
  62. package/dist/output/colors.js +77 -0
  63. package/dist/output/colors.js.map +1 -0
  64. package/dist/output/columns.js +22 -0
  65. package/dist/output/columns.js.map +1 -0
  66. package/dist/output/keyvalue.js +18 -0
  67. package/dist/output/keyvalue.js.map +1 -0
  68. package/dist/output/render.js +30 -0
  69. package/dist/output/render.js.map +1 -0
  70. package/dist/output/table.js +35 -0
  71. package/dist/output/table.js.map +1 -0
  72. package/dist/quire-client.js +74 -0
  73. package/dist/quire-client.js.map +1 -0
  74. package/dist/util/attach-input.js +65 -0
  75. package/dist/util/attach-input.js.map +1 -0
  76. package/dist/util/bulk-input.js +80 -0
  77. package/dist/util/bulk-input.js.map +1 -0
  78. package/dist/util/confirm.js +31 -0
  79. package/dist/util/confirm.js.map +1 -0
  80. package/dist/util/field-flags.js +52 -0
  81. package/dist/util/field-flags.js.map +1 -0
  82. package/dist/util/open-url.js +39 -0
  83. package/dist/util/open-url.js.map +1 -0
  84. package/dist/util/recurrence.js +53 -0
  85. package/dist/util/recurrence.js.map +1 -0
  86. package/dist/util/retry-after.js +56 -0
  87. package/dist/util/retry-after.js.map +1 -0
  88. package/dist/util/task-id.js +34 -0
  89. package/dist/util/task-id.js.map +1 -0
  90. package/dist/util/text-input.js +26 -0
  91. package/dist/util/text-input.js.map +1 -0
  92. package/dist/version.js +19 -0
  93. package/dist/version.js.map +1 -0
  94. package/package.json +62 -0
package/CHANGES.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-05-08
4
+
5
+ Initial release.
6
+
7
+ ### Commands
8
+
9
+ - `quire login` / `quire logout` / `quire whoami` — OAuth PKCE login, credential management, and identity.
10
+ - `quire org list` / `quire org get` / `quire org limit` — organization listing, detail, and rate-limit inspection.
11
+ - `quire project list` / `quire project get` / `quire project members` — project browsing and membership.
12
+ - `quire project field` — custom-field management (add / update / rename / move / remove).
13
+ - `quire project approval-category` — approval-category management.
14
+ - `quire task list` / `quire task get` / `quire task tree` / `quire task search` / `quire task subtasks` / `quire task comments` — task reads.
15
+ - `quire task create` / `quire task subtask` / `quire task update` / `quire task complete` / `quire task uncomplete` / `quire task move` / `quire task transfer` / `quire task delete` — task writes.
16
+ - `quire task dates` / `quire task peekaboo` — date and visibility management.
17
+ - `quire task approve` / `quire task revoke-approval` — approval flow.
18
+ - `quire task timelog add` / `quire task timelog update` / `quire task timelog remove` — time logging.
19
+ - `quire task bulk-create` / `quire task bulk-update` / `quire task bulk-delete` / `quire task bulk-move` / `quire task bulk-transfer` / `quire task bulk-approve` — bulk operations (up to 300 tasks).
20
+ - `quire mine` — tasks assigned to the signed-in user.
21
+ - `quire tag` / `quire sublist` / `quire status` — project metadata (create / update / delete).
22
+ - `quire comment` / `quire chat` / `quire doc` / `quire insight` — comments, chats, documents, and insights.
23
+ - `quire undo` — restore recently deleted resources.
24
+ - `quire resolve` — resolve any Quire URL to the typed resource.
25
+ - `quire colors` — list Quire's 48-slot color palette.
26
+
27
+ ### Output
28
+
29
+ - Human-readable tables with per-cell truncation (disable with `--no-truncate`).
30
+ - `--json` for raw API JSON; `-q` / `--quiet` for ID-only lines (xargs-friendly).
31
+ - `--color-mode always|never|auto`; `--profile` for named credential profiles.
32
+ - Auto-retry on HTTP 429 with `Retry-After` back-off.
33
+ - `User-Agent: quire-cli/<version>` on every request.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Potix Corporation
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Quire CLI
2
+
3
+ A command-line interface to the [Quire API](https://quire.io/dev/api/) for terminal users and shell scripts.
4
+
5
+ > **Status: pre-release.** Active development; the first published version will be tagged here as `v0.1.0`.
6
+
7
+ ## What it is
8
+
9
+ `@quire-io/quire-cli` wraps the Quire REST API for direct human + shell use:
10
+
11
+ - **Single-user, runs locally.** No server, no database. The signed-in user is whoever ran `quire login` on this machine.
12
+ - **OAuth login** via loopback redirect + PKCE. Tokens stored in `~/.config/quire/credentials.json` (mode `0600`) or the OS keychain when available.
13
+ - **Composable output.** Human-readable tables by default; `--json` for `jq`; `--quiet` for ID-only output that pipes into `xargs`.
14
+ - **Full Quire API coverage** — tasks (incl. recurrence, approval, timelogs, bulk ops), projects, organizations, comments, chats, documents, insights, custom fields, undo-remove.
15
+
16
+ ## What it isn't
17
+
18
+ - Not a hosted / SaaS tool — runs on your laptop.
19
+ - Not an interactive TUI dashboard — v1 is headless subcommands only.
20
+
21
+ ## Install (planned)
22
+
23
+ Once the first version ships:
24
+
25
+ ```bash
26
+ # npm (most users)
27
+ npm i -g @quire-io/quire-cli
28
+
29
+ # Homebrew tap (macOS / Linux)
30
+ brew install quire-io/quire/quire
31
+
32
+ # Try without installing
33
+ npx @quire-io/quire-cli --help
34
+
35
+ # Or grab a single-file binary from GitHub Releases
36
+ # https://github.com/quire-io/quire-cli/releases
37
+ ```
38
+
39
+ ## Usage (planned)
40
+
41
+ ```bash
42
+ quire login # one-time OAuth setup
43
+ quire whoami # confirm you're signed in
44
+
45
+ quire project list
46
+ quire task list <project>
47
+ quire task tree <task-id> --depth full # recursive subtree view
48
+ quire task search "release notes" --mine
49
+
50
+ quire task create <project> --name "Ship CLI v1" --due 2026-06-30
51
+ quire task complete <task-id>
52
+
53
+ quire mine --all-orgs --json | jq '.[].name' # script-friendly
54
+ ```
55
+
56
+ Full command reference will be added once the first commands land.
57
+
58
+ ## Related
59
+
60
+ - [Quire](https://quire.io) — the product this CLI talks to.
61
+ - [Quire API docs](https://quire.io/dev/api/)
62
+
63
+ ## Contributing
64
+
65
+ Open an issue to discuss before sending a PR.
66
+
67
+ ## License
68
+
69
+ [ISC](LICENSE) © Potix Corporation
package/dist/cli.js ADDED
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { registerChatCommand } from "./commands/chat.js";
4
+ import { registerColorsCommand } from "./commands/colors.js";
5
+ import { registerCommentCommand } from "./commands/comment.js";
6
+ import { registerDocCommand } from "./commands/doc.js";
7
+ import { registerInsightCommand } from "./commands/insight.js";
8
+ import { registerLoginCommand } from "./commands/login.js";
9
+ import { registerLogoutCommand } from "./commands/logout.js";
10
+ import { registerMineCommand } from "./commands/mine.js";
11
+ import { registerNotifyCommand } from "./commands/notify.js";
12
+ import { registerOrgCommand } from "./commands/org.js";
13
+ import { registerPartnerCommand } from "./commands/partner.js";
14
+ import { registerProjectCommand } from "./commands/project.js";
15
+ import { registerResolveCommand } from "./commands/resolve.js";
16
+ import { registerStatusCommand } from "./commands/status.js";
17
+ import { registerSublistCommand } from "./commands/sublist.js";
18
+ import { registerTagCommand } from "./commands/tag.js";
19
+ import { registerTaskCommand } from "./commands/task.js";
20
+ import { registerUndoCommand } from "./commands/undo.js";
21
+ import { registerUserCommand } from "./commands/user.js";
22
+ import { registerWhoamiCommand } from "./commands/whoami.js";
23
+ import { handleError } from "./errors.js";
24
+ import { createLogger } from "./log.js";
25
+ import { readVersion } from "./version.js";
26
+ // Exit cleanly when the downstream pipe consumer dies (e.g. `quire … | head`).
27
+ // Without this, the next stdout.write throws an unhandled EPIPE and Node
28
+ // crashes loudly with a stack trace — bad UX for a CLI built to compose with
29
+ // shell pipelines (Phase 6 stdout discipline).
30
+ process.stdout.on("error", (err) => {
31
+ if (err.code === "EPIPE")
32
+ process.exit(0);
33
+ throw err;
34
+ });
35
+ const program = new Command();
36
+ program
37
+ .name("quire")
38
+ .description("Command-line interface for the Quire API.")
39
+ .version(readVersion(), "-v, --version", "Print the CLI version")
40
+ .option("--verbose", "Enable verbose (debug) logging on stderr")
41
+ .option("--json", "Emit raw API JSON (no human formatting)")
42
+ .option("-q, --quiet", "Print only IDs (one per line) — designed for xargs pipelines")
43
+ .option("--color-mode <mode>", "Color output mode: always|never|auto", "auto")
44
+ .option("--profile <name>", "Use a named credential profile (default: $QUIRE_PROFILE or 'default')")
45
+ .option("--yes", "Auto-confirm destructive prompts (required for non-interactive mutating commands)")
46
+ .option("--no-truncate", "Disable per-cell truncation in human-readable tables");
47
+ registerLoginCommand(program);
48
+ registerLogoutCommand(program);
49
+ registerWhoamiCommand(program);
50
+ registerUserCommand(program);
51
+ registerOrgCommand(program);
52
+ registerProjectCommand(program);
53
+ registerPartnerCommand(program);
54
+ registerTaskCommand(program);
55
+ registerMineCommand(program);
56
+ registerTagCommand(program);
57
+ registerSublistCommand(program);
58
+ registerStatusCommand(program);
59
+ registerCommentCommand(program);
60
+ registerChatCommand(program);
61
+ registerDocCommand(program);
62
+ registerInsightCommand(program);
63
+ registerResolveCommand(program);
64
+ registerColorsCommand(program);
65
+ registerNotifyCommand(program);
66
+ registerUndoCommand(program);
67
+ program.addHelpText("after", `
68
+ Auth:
69
+ quire login Sign in via OAuth (loopback + PKCE)
70
+ quire logout Remove the local credentials file
71
+ quire whoami Show the signed-in user
72
+ quire user get <oid> Show one user by OID
73
+
74
+ Orgs / projects:
75
+ quire org list List your organizations
76
+ quire org get <id> Show one organization
77
+ quire org update <id> Update name / description / followers
78
+ quire org limit <id> Show API rate-limit usage for an organization
79
+ quire project list List projects you can see (or --org <id> to scope)
80
+ quire project get <id> Show one project
81
+ quire project update <id> Update name / description / dates / archive / public / followers
82
+ quire project members <id> List a project's members
83
+ quire project export <id> Export the project as CSV (default) or JSON (--format json [--output file])
84
+
85
+ Tasks (read):
86
+ quire task list <project> List tasks in a project
87
+ quire task get <id> Show task details (id = OID, slug/#N, or URL)
88
+ quire task tree <id> Render the recursive subtree (default depth 3)
89
+ quire task search <query> Search tasks; scope with --project / --org / --folder
90
+ quire task subtasks <id> List a task's direct subtasks
91
+ quire task comments <id> List a task's comments
92
+ quire mine List tasks assigned to me; scope with --project / --org / --all-orgs
93
+
94
+ Tasks (write):
95
+ quire task create <project> --name "..." Create a new task (--parent / --sibling+--position to nest)
96
+ quire task subtask <parent> --name "..." Shorthand for "task create --parent"
97
+ quire task update <id> Update fields: --name / --status / --priority / --add-tag / etc.
98
+ quire task complete <id> / uncomplete <id> Toggle status to 100 / 0
99
+ quire task move <id> --to <id|root> Re-parent within the same project
100
+ quire task transfer <id> --to <project> Cross-project transfer (--keep-tags / --keep-status / --invite)
101
+ quire task dates <id> --start ... --due ... Set / clear dates (pass 'null' to clear)
102
+ quire task peekaboo <id> [--reshow-at ISO] Hide a task; optional auto-reshow time
103
+ quire task delete <id> Delete a task (prompts unless --yes)
104
+ quire task undo-remove <oid> Restore a deleted task
105
+ quire task attach <id> <file> Attach a file to a task ('-' = stdin; --filename / --content-type optional)
106
+
107
+ Tasks (bulk):
108
+ quire task bulk-create <project> --from-file tasks.json Create up to 300 tasks atomically
109
+ quire task bulk-subtasks <parent> --from-file tasks.json Create up to 300 subtasks under one parent
110
+ quire task bulk-update <project> --from-file updates.json Update many tasks atomically (each item needs an oid)
111
+ quire task bulk-delete <project> --from-file ids.txt Delete many (prompts unless --yes); refs one per line or JSON array
112
+ quire task bulk-move <project> --to <id|root> --from-file ids.txt
113
+ quire task bulk-transfer <project> --to <project> --from-file ids.txt
114
+ quire task bulk-approve <project> --state request|approve|reject|change --from-file ids.txt
115
+
116
+ Tasks (approval / timelogs / recurrence):
117
+ quire task approve <id> --state ... Set a task's approval state
118
+ quire task revoke-approval <id> Revoke any approval state
119
+ quire task timelog add <id> --start --end [--user / --billable / --note]
120
+ quire task timelog update <id> --start --end [--new-start / --new-end / --note / ...]
121
+ quire task timelog remove <id> --start --end (prompts unless --yes)
122
+ --recurrence-freq / --recurrence-interval / --recurrence-byweekday / --recurrence-until
123
+ Add / clear recurrence on "task create" / "task subtask" / "task update"
124
+
125
+ Project metadata (approval categories):
126
+ quire project approval-category add <project> --id ... --name ... [--claimer / --approver]
127
+ quire project approval-category update <project> <id> [--name / --claimer / --approver / --claimers-anyone / --claimers-admins-only / ...]
128
+ quire project approval-category remove <project> <id> (prompts unless --yes)
129
+
130
+ Project metadata (custom-field definitions):
131
+ quire project field add <project> --name --type [--hidden / --private / --percent / --multiple / --clear-on-dup / --extra k=v]
132
+ quire project field update <project> <name> [--type / --hidden / --private / --percent / --multiple / --extra k=v]
133
+ quire project field rename <project> <name> --new-name ...
134
+ quire project field move <project> <name> [--before <name>] [--to-end]
135
+ quire project field remove <project> <name> (prompts unless --yes)
136
+ quire insight field add <insight-oid> --name --type [...] (formula / lookup only)
137
+ quire insight field {update / rename / move / remove} (same flag shape as project field)
138
+
139
+ Project metadata (read):
140
+ quire tag list <project> List tags defined on a project (also: 'tag get <oid>')
141
+ quire sublist list <project> List sublists on a project (also: 'sublist get <oid>')
142
+ quire status list <project> List custom statuses on a project (also: 'status get <project> <value>')
143
+ quire partner list <project> List partner orgs (external teams) on a project
144
+ quire partner get <oid> Show one partner organization
145
+
146
+ Project metadata (write):
147
+ quire tag create <project> Create a tag (--name / --color)
148
+ quire tag update <oid> Update tag --name / --color
149
+ quire tag delete <oid> Delete a tag (prompts unless --yes)
150
+ quire sublist create <project> Create a sublist (--name / --description)
151
+ quire sublist update <oid> Update sublist (--name / --description / --start / --due / --archive / --unarchive)
152
+ quire sublist add-task <oid> <task> Add a task to a sublist
153
+ quire sublist remove-task <oid> <task> Remove a task from a sublist
154
+ quire sublist delete <oid> Delete a sublist (prompts unless --yes)
155
+ quire sublist undo-remove <oid> Restore a deleted sublist
156
+ quire status create <project> Create a status (--name / --value / --color)
157
+ quire status update <project> <value> Update a status (--name / --color / --new-value)
158
+ quire status delete <project> <value> Delete a status (prompts unless --yes)
159
+
160
+ Comments / chats / docs / insights (read):
161
+ quire comment list <task> List comments on a task (alias for "quire task comments"; also: 'comment get <oid>')
162
+ quire chat list <project> List chats / chat get <id> / chat comments <id>
163
+ quire doc list <project> List documents / doc get <id>
164
+ quire insight list <project> List insights / insight get <id>
165
+
166
+ Comments (write):
167
+ quire comment add <task> --text "..." Add a comment ('-' = stdin, '@file' = read file)
168
+ quire comment update <oid> Update --text and/or --pin / --unpin
169
+ quire comment attach <oid> <file> Attach a file to a comment ('-' = stdin; --filename / --content-type optional)
170
+ quire comment delete <oid> Delete a comment (prompts unless --yes)
171
+
172
+ Chats / docs / insights (write):
173
+ quire chat create <project> --name [--description / --partner]
174
+ quire chat update <oid> [--name / --description / --archive / --unarchive / --add-follower / --remove-follower]
175
+ quire chat delete <oid> (prompts unless --yes)
176
+ quire chat undo-remove <oid>
177
+ quire chat comment add <chat-id> --text [--pin]
178
+ quire doc create <project> --name [--description]
179
+ quire doc update <oid> [--name / --description / --archive / --unarchive]
180
+ quire doc delete <oid> (prompts unless --yes)
181
+ quire doc undo-remove <oid>
182
+ quire insight create <project> --name [--id / --description / --icon-color / --image]
183
+ quire insight update <oid> [--name / --description / --icon-color / --image / --archive / --unarchive]
184
+ quire insight delete <oid> (prompts unless --yes)
185
+ quire insight undo-remove <oid>
186
+
187
+ Generic undo:
188
+ quire undo <kind> <oid> kind = task | chat | comment | document | insight | sublist
189
+
190
+ URL resolver:
191
+ quire resolve <url> Paste any Quire URL, get the typed resource back
192
+
193
+ Notifications:
194
+ quire notify --message ... Send an in-app notification to yourself ('-' / '@file' for stdin / file)
195
+
196
+ Reference:
197
+ quire colors List Quire's 48-slot palette (code, hex, name)
198
+ `);
199
+ async function main() {
200
+ await program.parseAsync(process.argv);
201
+ }
202
+ main().catch((err) => {
203
+ const log = createLogger({
204
+ verbose: program.opts().verbose === true,
205
+ color: program.opts().colorMode,
206
+ });
207
+ handleError(err, log);
208
+ });
209
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EA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ACA,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,GAAG,GAAG,YAAY,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,KAAK,IAAI;QACxC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,SAAoD;KAC3E,CAAC,CAAC;IACH,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,200 @@
1
+ import { looksLikeOid, parseQuireUrl } from "@quire-io/api-client";
2
+ import { ValidationError } from "../errors.js";
3
+ import { renderList, renderObject } from "../output/render.js";
4
+ import { createQuireClient } from "../quire-client.js";
5
+ import { confirmDestructive } from "../util/confirm.js";
6
+ import { resolveTextInput } from "../util/text-input.js";
7
+ const append = (val, prev) => [...(prev ?? []), val];
8
+ const CHAT_FIELDS = [
9
+ { label: "Name", get: (c) => c.nameText ?? c.name },
10
+ { label: "ID", get: (c) => c.id },
11
+ { label: "OID", get: (c) => c.oid },
12
+ { label: "Description", get: (c) => c.descriptionText },
13
+ { label: "URL", get: (c) => c.url },
14
+ ];
15
+ const CHAT_COMMENT_FIELDS = [
16
+ { label: "OID", get: (c) => c.oid },
17
+ { label: "When", get: (c) => c.createdAt },
18
+ { label: "Who", get: (c) => c.createdBy?.name },
19
+ { label: "Pinned at", get: (c) => c.pinAt },
20
+ { label: "Text", get: (c) => c.descriptionText },
21
+ { label: "URL", get: (c) => c.url },
22
+ ];
23
+ async function resolveChatOid(client, input) {
24
+ if (looksLikeOid(input))
25
+ return input;
26
+ if (/^https?:\/\//i.test(input)) {
27
+ const parsed = parseQuireUrl(input);
28
+ if (parsed?.kind === "chat") {
29
+ const c = await client.getChatByProjectAndId(parsed.projectId, parsed.chatId);
30
+ return c.oid;
31
+ }
32
+ throw new ValidationError(`URL is not a Quire chat: "${input}"`);
33
+ }
34
+ const slug = input.match(/^([^/]+)\/(.+)$/);
35
+ if (slug) {
36
+ const projectId = slug[1];
37
+ const chatId = slug[2];
38
+ const c = await client.getChatByProjectAndId(projectId, chatId);
39
+ return c.oid;
40
+ }
41
+ throw new ValidationError(`Cannot resolve chat: "${input}". Expected a chat OID, "project-slug/<chat-id>", or a full Quire chat URL.`);
42
+ }
43
+ export function registerChatCommand(program) {
44
+ const chat = program.command("chat").description("Quire chats.");
45
+ chat
46
+ .command("list <project>")
47
+ .description("List chats in a project. <project> = OID, slug, or URL.")
48
+ .action(async (project) => {
49
+ const root = program.opts();
50
+ const client = createQuireClient({ profile: root.profile });
51
+ const oid = await client.resolveProjectOid(project);
52
+ const chats = await client.listChats("project", oid);
53
+ renderList(chats, root, {
54
+ columns: [
55
+ { header: "ID", get: (c) => c.id },
56
+ { header: "NAME", get: (c) => c.nameText ?? c.name },
57
+ { header: "OID", get: (c) => c.oid },
58
+ ],
59
+ toId: (c) => c.oid,
60
+ });
61
+ });
62
+ chat
63
+ .command("get <id>")
64
+ .description("Show chat details. <id> = OID, project-slug/<chat-id>, or URL.")
65
+ .action(async (id) => {
66
+ const root = program.opts();
67
+ const client = createQuireClient({ profile: root.profile });
68
+ const oid = await resolveChatOid(client, id);
69
+ const c = await client.getChat(oid);
70
+ renderObject(c, root, { fields: CHAT_FIELDS, toId: (c) => c.oid });
71
+ });
72
+ chat
73
+ .command("comments <id>")
74
+ .description("List comments in a chat. <id> = OID, project-slug/<chat-id>, or URL.")
75
+ .action(async (id) => {
76
+ const root = program.opts();
77
+ const client = createQuireClient({ profile: root.profile });
78
+ const oid = await resolveChatOid(client, id);
79
+ const comments = await client.listChatComments(oid);
80
+ renderList(comments, root, {
81
+ columns: [
82
+ {
83
+ header: "WHEN",
84
+ get: (c) => c.createdAt ?? "",
85
+ },
86
+ { header: "WHO", get: (c) => c.createdBy?.name ?? "" },
87
+ {
88
+ header: "TEXT",
89
+ get: (c) => (c.descriptionText ?? "").replace(/\s+/g, " ").trim(),
90
+ },
91
+ { header: "OID", get: (c) => c.oid },
92
+ ],
93
+ toId: (c) => c.oid,
94
+ });
95
+ });
96
+ chat
97
+ .command("create <project>")
98
+ .description("Create a chat in a project.")
99
+ .requiredOption("--name <name>", "Chat name (required)")
100
+ .option("--description <text>", "Description; '-' for stdin or '@file' for a file")
101
+ .option("--partner <oid>", "Partner OID, if this is a partner chat")
102
+ .action(async (project, cmdOpts) => {
103
+ const root = program.opts();
104
+ const client = createQuireClient({ profile: root.profile });
105
+ const projectOid = await client.resolveProjectOid(project);
106
+ const description = cmdOpts.description !== undefined ? await resolveTextInput(cmdOpts.description) : undefined;
107
+ const c = await client.createChat("project", projectOid, {
108
+ name: cmdOpts.name,
109
+ ...(description !== undefined ? { description } : {}),
110
+ ...(cmdOpts.partner !== undefined ? { partner: cmdOpts.partner } : {}),
111
+ });
112
+ renderObject(c, root, { fields: CHAT_FIELDS, toId: (c) => c.oid });
113
+ });
114
+ chat
115
+ .command("update <oid>")
116
+ .description("Update a chat.")
117
+ .option("--name <name>", "New name")
118
+ .option("--description <text>", "New description ('-' = stdin, '@file' = file)")
119
+ .option("--archive", "Archive the chat")
120
+ .option("--unarchive", "Unarchive the chat")
121
+ .option("--add-follower <user>", "Add follower; repeat for multiple", append, [])
122
+ .option("--remove-follower <user>", "Remove follower; repeat for multiple", append, [])
123
+ .action(async (oid, cmdOpts) => {
124
+ const root = program.opts();
125
+ const client = createQuireClient({ profile: root.profile });
126
+ if (cmdOpts.archive === true && cmdOpts.unarchive === true) {
127
+ throw new ValidationError("Cannot combine --archive and --unarchive.");
128
+ }
129
+ const description = cmdOpts.description !== undefined ? await resolveTextInput(cmdOpts.description) : undefined;
130
+ const body = {};
131
+ if (cmdOpts.name !== undefined)
132
+ body.name = cmdOpts.name;
133
+ if (description !== undefined)
134
+ body.description = description;
135
+ if (cmdOpts.archive === true)
136
+ body.archived = true;
137
+ if (cmdOpts.unarchive === true)
138
+ body.archived = false;
139
+ if ((cmdOpts.addFollower?.length ?? 0) > 0)
140
+ body.addFollowers = cmdOpts.addFollower;
141
+ if ((cmdOpts.removeFollower?.length ?? 0) > 0)
142
+ body.removeFollowers = cmdOpts.removeFollower;
143
+ if (Object.keys(body).length === 0) {
144
+ throw new ValidationError("`chat update` requires at least one of --name / --description / --archive / --unarchive / --add-follower / --remove-follower.");
145
+ }
146
+ const c = await client.updateChat(oid, body);
147
+ renderObject(c, root, { fields: CHAT_FIELDS, toId: (c) => c.oid });
148
+ });
149
+ chat
150
+ .command("delete <oid>")
151
+ .description("Delete a chat. Prompts unless --yes.")
152
+ .action(async (oid) => {
153
+ const root = program.opts();
154
+ const client = createQuireClient({ profile: root.profile });
155
+ await confirmDestructive({
156
+ question: `Delete chat ${oid}? Run \`quire chat undo-remove ${oid}\` (or \`quire undo chat ${oid}\`) to restore.`,
157
+ yes: root.yes,
158
+ });
159
+ await client.deleteChat(oid);
160
+ if (root.json === true) {
161
+ process.stdout.write(`${JSON.stringify({ oid, deleted: true })}\n`);
162
+ }
163
+ else if (root.quiet === true) {
164
+ process.stdout.write(`${oid}\n`);
165
+ }
166
+ else {
167
+ process.stderr.write(`Deleted chat ${oid}.\n`);
168
+ }
169
+ });
170
+ chat
171
+ .command("undo-remove <oid>")
172
+ .description("Restore a deleted chat.")
173
+ .action(async (oid) => {
174
+ const root = program.opts();
175
+ const client = createQuireClient({ profile: root.profile });
176
+ const c = await client.undoRemoveChat(oid);
177
+ renderObject(c, root, { fields: CHAT_FIELDS, toId: (c) => c.oid });
178
+ });
179
+ // -------- Chat comments (Phase 5.4) --------
180
+ const chatComment = chat
181
+ .command("comment")
182
+ .description("Manage comments inside a chat.");
183
+ chatComment
184
+ .command("add <chat-id>")
185
+ .description("Post a comment to a chat. --text accepts '-' (stdin) or '@file'.")
186
+ .requiredOption("--text <text>", "Comment text; '-' for stdin or '@file' to read from disk.")
187
+ .option("--pin", "Pin the comment after creating it")
188
+ .action(async (chatId, cmdOpts) => {
189
+ const root = program.opts();
190
+ const client = createQuireClient({ profile: root.profile });
191
+ const oid = await resolveChatOid(client, chatId);
192
+ const description = await resolveTextInput(cmdOpts.text);
193
+ const c = await client.addChatComment(oid, {
194
+ description,
195
+ ...(cmdOpts.pin === true ? { pinned: true } : {}),
196
+ });
197
+ renderObject(c, root, { fields: CHAT_COMMENT_FIELDS, toId: (c) => c.oid });
198
+ });
199
+ }
200
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,IAA0B,EAAY,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAE7F,MAAM,WAAW,GAAG;IAClB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAsC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE;IACxF,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IACjD,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAkB,EAAE,EAAE,CAAC,CAAC,CAAC,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C,IAAI,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE;YACzC,WAAW;YACX,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClD,CAAC,CAAC;QACH,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { COLOR_TABLE, NAMED_COLORS } from "@quire-io/api-client";
2
+ import { ansiSwatch, friendlyColor } from "../output/colors.js";
3
+ import { printTable } from "../output/table.js";
4
+ export function registerColorsCommand(program) {
5
+ program
6
+ .command("colors")
7
+ .description("List Quire's 48-slot icon-color palette (codes, hex, friendly names).")
8
+ .action(() => {
9
+ const root = program.opts();
10
+ const rows = Object.entries(COLOR_TABLE)
11
+ .map(([code, hex]) => ({
12
+ code,
13
+ hex,
14
+ name: friendlyColor(code) ?? "",
15
+ }))
16
+ .sort((a, b) => a.code.localeCompare(b.code));
17
+ if (root.json === true) {
18
+ process.stdout.write(`${JSON.stringify({ palette: rows, namedColors: NAMED_COLORS })}\n`);
19
+ return;
20
+ }
21
+ if (root.quiet === true) {
22
+ for (const r of rows)
23
+ process.stdout.write(`${r.code}\n`);
24
+ return;
25
+ }
26
+ printTable(rows, [
27
+ { header: "", get: (r) => ansiSwatch(r.code) },
28
+ { header: "CODE", get: (r) => r.code },
29
+ { header: "HEX", get: (r) => r.hex },
30
+ { header: "NAME", get: (r) => r.name },
31
+ ]);
32
+ });
33
+ }
34
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/comm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