harvask-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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -0
  3. package/dist/api-base.js +8 -0
  4. package/dist/api-base.js.map +1 -0
  5. package/dist/api-client.js +221 -0
  6. package/dist/api-client.js.map +1 -0
  7. package/dist/cli.js +154 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/commands/_exec.js +63 -0
  10. package/dist/commands/_exec.js.map +1 -0
  11. package/dist/commands/api/index.js +88 -0
  12. package/dist/commands/api/index.js.map +1 -0
  13. package/dist/commands/attachment/index.js +54 -0
  14. package/dist/commands/attachment/index.js.map +1 -0
  15. package/dist/commands/auth/index.js +238 -0
  16. package/dist/commands/auth/index.js.map +1 -0
  17. package/dist/commands/calendar/index.js +167 -0
  18. package/dist/commands/calendar/index.js.map +1 -0
  19. package/dist/commands/chat/index.js +97 -0
  20. package/dist/commands/chat/index.js.map +1 -0
  21. package/dist/commands/file/index.js +42 -0
  22. package/dist/commands/file/index.js.map +1 -0
  23. package/dist/commands/global-wiki/index.js +196 -0
  24. package/dist/commands/global-wiki/index.js.map +1 -0
  25. package/dist/commands/issue/builds.js +160 -0
  26. package/dist/commands/issue/builds.js.map +1 -0
  27. package/dist/commands/issue/index.js +169 -0
  28. package/dist/commands/issue/index.js.map +1 -0
  29. package/dist/commands/issue/sub.js +149 -0
  30. package/dist/commands/issue/sub.js.map +1 -0
  31. package/dist/commands/issue/subbuilds.js +174 -0
  32. package/dist/commands/issue/subbuilds.js.map +1 -0
  33. package/dist/commands/milestone/index.js +104 -0
  34. package/dist/commands/milestone/index.js.map +1 -0
  35. package/dist/commands/note/builds.js +68 -0
  36. package/dist/commands/note/builds.js.map +1 -0
  37. package/dist/commands/note/index.js +122 -0
  38. package/dist/commands/note/index.js.map +1 -0
  39. package/dist/commands/preview-config/index.js +87 -0
  40. package/dist/commands/preview-config/index.js.map +1 -0
  41. package/dist/commands/project/builds.js +78 -0
  42. package/dist/commands/project/builds.js.map +1 -0
  43. package/dist/commands/project/index.js +103 -0
  44. package/dist/commands/project/index.js.map +1 -0
  45. package/dist/commands/scheduled-task/index.js +196 -0
  46. package/dist/commands/scheduled-task/index.js.map +1 -0
  47. package/dist/commands/site-credential/index.js +23 -0
  48. package/dist/commands/site-credential/index.js.map +1 -0
  49. package/dist/commands/skill/index.js +121 -0
  50. package/dist/commands/skill/index.js.map +1 -0
  51. package/dist/commands/storage/index.js +103 -0
  52. package/dist/commands/storage/index.js.map +1 -0
  53. package/dist/commands/user/index.js +55 -0
  54. package/dist/commands/user/index.js.map +1 -0
  55. package/dist/commands/wiki/builds.js +135 -0
  56. package/dist/commands/wiki/builds.js.map +1 -0
  57. package/dist/commands/wiki/index.js +177 -0
  58. package/dist/commands/wiki/index.js.map +1 -0
  59. package/dist/commands/workflow/index.js +111 -0
  60. package/dist/commands/workflow/index.js.map +1 -0
  61. package/dist/config.js +123 -0
  62. package/dist/config.js.map +1 -0
  63. package/dist/context.js +61 -0
  64. package/dist/context.js.map +1 -0
  65. package/dist/errors/hint-map.js +81 -0
  66. package/dist/errors/hint-map.js.map +1 -0
  67. package/dist/errors/index.js +132 -0
  68. package/dist/errors/index.js.map +1 -0
  69. package/dist/index.js +17 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/output/format.js +108 -0
  72. package/dist/output/format.js.map +1 -0
  73. package/dist/output/index.js +3 -0
  74. package/dist/output/index.js.map +1 -0
  75. package/dist/output/tty.js +22 -0
  76. package/dist/output/tty.js.map +1 -0
  77. package/dist/registry.js +47 -0
  78. package/dist/registry.js.map +1 -0
  79. package/dist/token-store.js +92 -0
  80. package/dist/token-store.js.map +1 -0
  81. package/dist/types/api.js +8 -0
  82. package/dist/types/api.js.map +1 -0
  83. package/dist/utils/bulk.js +29 -0
  84. package/dist/utils/bulk.js.map +1 -0
  85. package/dist/utils/download.js +36 -0
  86. package/dist/utils/download.js.map +1 -0
  87. package/dist/utils/file-utils.js +58 -0
  88. package/dist/utils/file-utils.js.map +1 -0
  89. package/dist/utils/input.js +66 -0
  90. package/dist/utils/input.js.map +1 -0
  91. package/dist/utils/issue-resolver.js +20 -0
  92. package/dist/utils/issue-resolver.js.map +1 -0
  93. package/dist/utils/loopback.js +86 -0
  94. package/dist/utils/loopback.js.map +1 -0
  95. package/dist/utils/pkce.js +20 -0
  96. package/dist/utils/pkce.js.map +1 -0
  97. package/dist/utils/project-resolver.js +63 -0
  98. package/dist/utils/project-resolver.js.map +1 -0
  99. package/dist/utils/prompt.js +17 -0
  100. package/dist/utils/prompt.js.map +1 -0
  101. package/dist/utils/upload.js +32 -0
  102. package/dist/utils/upload.js.map +1 -0
  103. package/package.json +44 -0
  104. package/skills/harvask/AGENTS.md +131 -0
  105. package/skills/harvask/GEMINI.md +131 -0
  106. package/skills/harvask/SKILL.md +134 -0
@@ -0,0 +1,131 @@
1
+ <!-- Generated from skills/harvask/SKILL.md by scripts/gen-agent-docs.mjs. Edit that file, then run `npm run gen:agents`. Do not edit skills/harvask/GEMINI.md by hand. -->
2
+
3
+ # harvask CLI
4
+
5
+ `harvask` is a command-line client for a harvask tenant, designed for coding
6
+ agents: output is JSON by default and errors are structured as
7
+ `Error / Why / Hint`.
8
+
9
+ ## First: authenticate
10
+
11
+ Login is browser-based (no password typed into the CLI):
12
+
13
+ ```
14
+ harvask login --tenant <tenant-domain> # opens browser, approve, done (loopback)
15
+ harvask login --tenant <tenant-domain> --no-browser # print URL, approve, paste the code (remote/headless)
16
+ ```
17
+
18
+ You must be logged into the web app to approve. Tokens are stored per tenant
19
+ under your OS config dir (mode 0600). Check status with `harvask whoami`.
20
+ Log out with `harvask logout`.
21
+
22
+ If a command fails with an auth error (exit code 3), run `harvask login` again.
23
+
24
+ ## Core workflow: discover → fetch → act
25
+
26
+ 1. **discover** the target
27
+ ```
28
+ harvask project list
29
+ harvask issue search -p PRJ "login bug"
30
+ ```
31
+ 2. **fetch** details
32
+ ```
33
+ harvask issue show -p PRJ 1234 --comments
34
+ harvask wiki show -p PRJ --slug api-documentation
35
+ ```
36
+ 3. **act**
37
+ ```
38
+ harvask issue create -p PRJ --title "Fix login" --type bug --priority high
39
+ harvask issue status -p PRJ 1234 in_progress
40
+ harvask issue assign -p PRJ 1234 --assignee-id 42
41
+ ```
42
+
43
+ ## project key vs id
44
+
45
+ - Humans know the **key** (e.g. `PRJ`); the API uses a numeric **id**.
46
+ - Every project-scoped command accepts either via `-p, --project <key|id>`
47
+ (`-p PRJ` or `-p 5`). The CLI resolves keys to ids automatically.
48
+ - For `issue show/update/status/assign`, the issue argument accepts a numeric id
49
+ or a key like `PRJ-12` (resolved via search).
50
+ - New to a tenant? Start with `harvask project list`.
51
+
52
+ ## Reading output
53
+
54
+ - Default output is pretty JSON.
55
+ - `--data` prints only the payload (unwraps `{issues:[...]}` → the array).
56
+ - `--raw` prints the unformatted response.
57
+ - `--json` forces machine-readable JSON (no color), even in a terminal.
58
+ - Results go to stdout; errors go to stderr.
59
+
60
+ ## Long input (Markdown / JSON)
61
+
62
+ - `--content` accepts a literal string, `@file.md` (read a file), or `-` (stdin).
63
+ ```
64
+ harvask wiki create -p PRJ --title "Docs" --content @docs.md
65
+ harvask note create --content - # read from stdin
66
+ ```
67
+ - The `api` escape hatch accepts a JSON body the same way (`@body.json`, `-`).
68
+
69
+ ## Common errors and what to do
70
+
71
+ - **exit 3 / 401** — token invalid or expired → `harvask login --tenant <domain>`.
72
+ - **403 tenant_mismatch** — token is for another tenant → use `--profile <domain>`
73
+ or re-login against the correct tenant.
74
+ - **403 not_project_member** — you are not a member of that project → pick a
75
+ project from `harvask project list` or ask an admin to add you.
76
+ - **404** — wrong id/key → verify with `harvask project list` / `harvask issue search`.
77
+ - **422** — validation: read `Why:` for the offending field
78
+ (e.g. `issue_type`/`priority` enums, `title` ≤ 255, wiki/note content ≤ 500000).
79
+
80
+ ## Escape hatch (anything not wrapped)
81
+
82
+ `harvask api <method> <path> [json]` calls any tenant API endpoint directly,
83
+ for anything not covered by a dedicated command. Relative paths are namespaced
84
+ automatically; absolute URLs and `..` are rejected.
85
+
86
+ ```
87
+ harvask api GET projects
88
+ harvask api GET projects/5/issues?status=open
89
+ harvask api POST notes '{"content":"hi","is_pinned":true}'
90
+ harvask api POST projects/5/issues @issue.json
91
+ ```
92
+
93
+ ## Command summary
94
+
95
+ ```
96
+ harvask login | logout | whoami
97
+
98
+ # project-scoped (pass -p <key|id>)
99
+ harvask project list | show <key|id> | create | members list|add|remove <key|id>
100
+ harvask issue list | show | create | update | search | status | assign
101
+ harvask issue comment list | create
102
+ harvask issue todo list | show | create | update | delete
103
+ harvask issue memory list | show | create | update | delete
104
+ harvask issue dependency list | add | remove
105
+ harvask issue bulk-create | bulk-update (--items @file.json [--atomic])
106
+ harvask wiki list | show | create | update | search | history | delete | bulk-create | bulk-update
107
+ harvask milestone list | create | update
108
+ harvask workflow list | show | create | update
109
+ harvask scheduled-task list | show | create | update
110
+ harvask file search | stats
111
+ harvask storage search | stats | upload | folder | move | download | content
112
+ harvask preview-config show | update
113
+ harvask site-credential # list browser credentials
114
+
115
+ # personal / tenant-wide (no -p)
116
+ harvask note list | show | create | update | delete | search
117
+ harvask calendar list | show | create | update | delete
118
+ harvask global-wiki list | show | create | update | search | delete | bulk-create | bulk-update
119
+ harvask user list | search
120
+ harvask chat history <chatId> | search <q> | list | thread <kind> <uuid>
121
+ harvask attachment upload | download <id>
122
+
123
+ harvask api <method> <path> [json] # escape hatch
124
+ ```
125
+
126
+ Notes:
127
+ - `personal-wiki` is intentionally not available via the CLI.
128
+ - File/binary: `storage upload` / `attachment upload` take `--file <path>`;
129
+ `storage download` / `attachment download` save with `--out <path>`.
130
+
131
+ Use `harvask <command> --help` for options, examples, and prerequisites.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: harvask
3
+ description: Operate a harvask tenant (issues, wiki, projects, notes, milestones, calendar, files, storage, chat, workflows, and more) from the command line via the `harvask` CLI. Use when the user asks to read/create/update tenant resources in harvask.
4
+ ---
5
+
6
+ # harvask CLI
7
+
8
+ `harvask` is a command-line client for a harvask tenant, designed for coding
9
+ agents: output is JSON by default and errors are structured as
10
+ `Error / Why / Hint`.
11
+
12
+ ## First: authenticate
13
+
14
+ Login is browser-based (no password typed into the CLI):
15
+
16
+ ```
17
+ harvask login --tenant <tenant-domain> # opens browser, approve, done (loopback)
18
+ harvask login --tenant <tenant-domain> --no-browser # print URL, approve, paste the code (remote/headless)
19
+ ```
20
+
21
+ You must be logged into the web app to approve. Tokens are stored per tenant
22
+ under your OS config dir (mode 0600). Check status with `harvask whoami`.
23
+ Log out with `harvask logout`.
24
+
25
+ If a command fails with an auth error (exit code 3), run `harvask login` again.
26
+
27
+ ## Core workflow: discover → fetch → act
28
+
29
+ 1. **discover** the target
30
+ ```
31
+ harvask project list
32
+ harvask issue search -p PRJ "login bug"
33
+ ```
34
+ 2. **fetch** details
35
+ ```
36
+ harvask issue show -p PRJ 1234 --comments
37
+ harvask wiki show -p PRJ --slug api-documentation
38
+ ```
39
+ 3. **act**
40
+ ```
41
+ harvask issue create -p PRJ --title "Fix login" --type bug --priority high
42
+ harvask issue status -p PRJ 1234 in_progress
43
+ harvask issue assign -p PRJ 1234 --assignee-id 42
44
+ ```
45
+
46
+ ## project key vs id
47
+
48
+ - Humans know the **key** (e.g. `PRJ`); the API uses a numeric **id**.
49
+ - Every project-scoped command accepts either via `-p, --project <key|id>`
50
+ (`-p PRJ` or `-p 5`). The CLI resolves keys to ids automatically.
51
+ - For `issue show/update/status/assign`, the issue argument accepts a numeric id
52
+ or a key like `PRJ-12` (resolved via search).
53
+ - New to a tenant? Start with `harvask project list`.
54
+
55
+ ## Reading output
56
+
57
+ - Default output is pretty JSON.
58
+ - `--data` prints only the payload (unwraps `{issues:[...]}` → the array).
59
+ - `--raw` prints the unformatted response.
60
+ - `--json` forces machine-readable JSON (no color), even in a terminal.
61
+ - Results go to stdout; errors go to stderr.
62
+
63
+ ## Long input (Markdown / JSON)
64
+
65
+ - `--content` accepts a literal string, `@file.md` (read a file), or `-` (stdin).
66
+ ```
67
+ harvask wiki create -p PRJ --title "Docs" --content @docs.md
68
+ harvask note create --content - # read from stdin
69
+ ```
70
+ - The `api` escape hatch accepts a JSON body the same way (`@body.json`, `-`).
71
+
72
+ ## Common errors and what to do
73
+
74
+ - **exit 3 / 401** — token invalid or expired → `harvask login --tenant <domain>`.
75
+ - **403 tenant_mismatch** — token is for another tenant → use `--profile <domain>`
76
+ or re-login against the correct tenant.
77
+ - **403 not_project_member** — you are not a member of that project → pick a
78
+ project from `harvask project list` or ask an admin to add you.
79
+ - **404** — wrong id/key → verify with `harvask project list` / `harvask issue search`.
80
+ - **422** — validation: read `Why:` for the offending field
81
+ (e.g. `issue_type`/`priority` enums, `title` ≤ 255, wiki/note content ≤ 500000).
82
+
83
+ ## Escape hatch (anything not wrapped)
84
+
85
+ `harvask api <method> <path> [json]` calls any tenant API endpoint directly,
86
+ for anything not covered by a dedicated command. Relative paths are namespaced
87
+ automatically; absolute URLs and `..` are rejected.
88
+
89
+ ```
90
+ harvask api GET projects
91
+ harvask api GET projects/5/issues?status=open
92
+ harvask api POST notes '{"content":"hi","is_pinned":true}'
93
+ harvask api POST projects/5/issues @issue.json
94
+ ```
95
+
96
+ ## Command summary
97
+
98
+ ```
99
+ harvask login | logout | whoami
100
+
101
+ # project-scoped (pass -p <key|id>)
102
+ harvask project list | show <key|id> | create | members list|add|remove <key|id>
103
+ harvask issue list | show | create | update | search | status | assign
104
+ harvask issue comment list | create
105
+ harvask issue todo list | show | create | update | delete
106
+ harvask issue memory list | show | create | update | delete
107
+ harvask issue dependency list | add | remove
108
+ harvask issue bulk-create | bulk-update (--items @file.json [--atomic])
109
+ harvask wiki list | show | create | update | search | history | delete | bulk-create | bulk-update
110
+ harvask milestone list | create | update
111
+ harvask workflow list | show | create | update
112
+ harvask scheduled-task list | show | create | update
113
+ harvask file search | stats
114
+ harvask storage search | stats | upload | folder | move | download | content
115
+ harvask preview-config show | update
116
+ harvask site-credential # list browser credentials
117
+
118
+ # personal / tenant-wide (no -p)
119
+ harvask note list | show | create | update | delete | search
120
+ harvask calendar list | show | create | update | delete
121
+ harvask global-wiki list | show | create | update | search | delete | bulk-create | bulk-update
122
+ harvask user list | search
123
+ harvask chat history <chatId> | search <q> | list | thread <kind> <uuid>
124
+ harvask attachment upload | download <id>
125
+
126
+ harvask api <method> <path> [json] # escape hatch
127
+ ```
128
+
129
+ Notes:
130
+ - `personal-wiki` is intentionally not available via the CLI.
131
+ - File/binary: `storage upload` / `attachment upload` take `--file <path>`;
132
+ `storage download` / `attachment download` save with `--out <path>`.
133
+
134
+ Use `harvask <command> --help` for options, examples, and prerequisites.