@allocator-one/harness-cli 1.3.0 → 1.4.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.
package/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  CLI and MCP server for [Harness](https://harness.infra.one), allocator.one's
4
4
  issue tracker. A standalone Node client — no backend checkout, no Erlang
5
- toolchain — that shares credentials with the Elixir escript (`bin/harness`
6
- in the `allocator-one` repo).
5
+ toolchain, and no local issue state: issues live server-side, so there is
6
+ nothing to commit or sync.
7
7
 
8
8
  ## Install
9
9
 
@@ -27,8 +27,8 @@ Requires Node >= 20.
27
27
  No setup needed: commands target `https://harness.infra.one` and start the
28
28
  browser login the first time. One login covers every shell, worktree, and
29
29
  agent slot on a machine — credentials are stored at
30
- `~/.config/harness/credentials.json` (0600), byte-compatible with the
31
- escript's, so either client can log in or out without breaking the other.
30
+ `~/.config/harness/credentials.json` (0600) as a single `{url, token}` pair,
31
+ and a token is only ever sent to the host that minted it.
32
32
 
33
33
  - `harness login` — browser flow (PKCE loopback); `--no-browser` prints the
34
34
  URL and prompts for a pasted token instead.
@@ -88,8 +88,7 @@ from the working directory, gives every clone of a repo its defaults:
88
88
  | `url` | Target host. `HARNESS_API_URL` wins. Tokens stay host-bound: a stored login only serves the host that minted it, an env `HARNESS_API_TOKEN` refuses to pair with a repo-named host (set `HARNESS_API_URL` explicitly), and before the interactive auto-login opens a browser at a host named only by the repo, the CLI asks once per host (remembered in `~/.config/harness/trusted-hosts.json`). |
89
89
  | `org` | Reserved for Harness org-scoping; parsed today, `url` wins meanwhile. |
90
90
 
91
- This is config, not state — issues stay server-side. The escript does not
92
- read this file (TS-CLI-only).
91
+ This is config, not state — issues stay server-side.
93
92
 
94
93
  ## Development
95
94
 
@@ -557,13 +557,14 @@ async function list(ctx, opts) {
557
557
  }
558
558
  async function search(ctx, queryWords, opts) {
559
559
  if (queryWords.length === 0) throw new UsageError("usage: harness search <query>");
560
- const params = {
561
- search: queryWords.join(" "),
562
- page_size: opts.limit ?? 50,
563
- page: opts.page ?? 1
564
- };
565
- const { records, notice } = await fetchIssues(ctx, params, opts);
566
- return { json: records, human: issuesTable(records), notice };
560
+ const deprecation = opts.page !== void 0 || opts.all === true ? "--page/--all are ignored: search returns one ranked list, capped at 20" : void 0;
561
+ let params = { q: queryWords.join(" ") };
562
+ if (opts.limit !== void 0) params = { ...params, limit: opts.limit };
563
+ const body = await ctx.client.get("/api/v1/issues/search", params);
564
+ const meta = body.meta ?? {};
565
+ const degraded = meta["mode"] === "lexical" ? "semantic search unavailable \u2014 showing lexical matches only" : void 0;
566
+ const notice = [deprecation, degraded].filter(Boolean).join("; ") || void 0;
567
+ return { json: body.data, human: issuesTable(body.data), notice };
567
568
  }
568
569
  async function show(ctx, identifier, opts) {
569
570
  requireIdentifiers([identifier]);
package/dist/cli.js CHANGED
@@ -59,7 +59,7 @@ import {
59
59
  version,
60
60
  workflowStates,
61
61
  writeCredentials
62
- } from "./chunk-3WR6YFU6.js";
62
+ } from "./chunk-MF7MQ2L6.js";
63
63
 
64
64
  // src/cli.ts
65
65
  import { createInterface as createInterface2 } from "readline";
@@ -935,7 +935,7 @@ program.command("blocked").description("issues waiting on a blocker").option("--
935
935
  program.command("list").description("list issues with filters").option("--status <status>", "open | in_progress | closed").option("--assignee <who>", 'me, a user id, an email, or a full name; "" for unassigned').option("--priority <name>", "urgent | high | medium | low | none").option("--label <name>", "label filter").option("--type <type>", "task | bug | feature | epic").option("--search <query>", "full-text search").option("--team <key>", "team filter").option("--parent <id>", "children of an epic").option("--scope <scope>", "all | archived").option("--limit <n>", "page size", integer).option("--page <n>", "page number", integer).option("--all", "follow every page").option("--json", "emit JSON").action(async (opts) => {
936
936
  await withConfig(opts.json === true, false, (ctx) => list(ctx, opts));
937
937
  });
938
- program.command("search").description("full-text search").argument("[query...]").option("--limit <n>", "page size", integer).option("--page <n>", "page number", integer).option("--all", "follow every page").option("--json", "emit JSON").action(async (query, opts) => {
938
+ program.command("search").description("search by meaning \u2014 ranked, exact identifier first; use list --search for paginated filtering").argument("[query...]").option("--limit <n>", "maximum results (default 10, capped at 20)", integer).option("--page <n>", "(deprecated, ignored \u2014 results are ranked and capped)", integer).option("--all", "(deprecated, ignored \u2014 results are ranked and capped)").option("--json", "emit JSON").action(async (query, opts) => {
939
939
  await withConfig(opts.json === true, false, (ctx) => search(ctx, query, opts));
940
940
  });
941
941
  program.command("show").description("full issue detail; downloads attached images locally").argument("[id]").option("--no-images", "skip attachment downloads").option("--json", "emit JSON").action(async (id, opts) => {
@@ -1123,7 +1123,7 @@ program.command("upload").description("upload a file; prints markdown to referen
1123
1123
  });
1124
1124
  });
1125
1125
  program.command("mcp").description("run the MCP server over stdio (for agents)").action(async () => {
1126
- const { startMcpServer } = await import("./server-TK2KFAOQ.js");
1126
+ const { startMcpServer } = await import("./server-LJXJLWNK.js");
1127
1127
  await startMcpServer();
1128
1128
  });
1129
1129
  program.command("login").description("sign in via the browser (infra.one session)").option("--url <url>", "host to sign in to").option("--no-browser", "print the URL and prompt for a pasted token instead").option("--timeout <ms>", "how long to wait for the browser callback", integer).option("--json", "emit JSON").action(async (opts) => {
@@ -30,6 +30,7 @@ import {
30
30
  projectUpdate,
31
31
  ready,
32
32
  resolveConfig,
33
+ search,
33
34
  show,
34
35
  stats,
35
36
  teamCreate,
@@ -38,7 +39,7 @@ import {
38
39
  upload,
39
40
  userList,
40
41
  workflowStates
41
- } from "./chunk-3WR6YFU6.js";
42
+ } from "./chunk-MF7MQ2L6.js";
42
43
 
43
44
  // src/mcp/server.ts
44
45
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -116,6 +117,19 @@ var TOOLS = [
116
117
  return list(ctx, args);
117
118
  }
118
119
  },
120
+ {
121
+ name: "issue_search",
122
+ description: "Search issues by meaning: ranked results across a lexical and a semantic signal, so describing a problem in your own words finds issues that share none of them. Pass the question as asked \u2014 plain language works better than keywords. An exact identifier always ranks first. Returns at most 20 results, no pagination; use issue_list with search for paginated lexical filtering.",
123
+ readOnly: true,
124
+ shape: {
125
+ query: z.string().describe("the question or phrase to search for"),
126
+ limit: z.number().int().optional().describe("maximum results (default 10, capped at 20)")
127
+ },
128
+ handler: (ctx, args) => {
129
+ const limit = args["limit"] === void 0 ? {} : { limit: args["limit"] };
130
+ return search(ctx, [String(args["query"])], limit);
131
+ }
132
+ },
119
133
  {
120
134
  name: "issue_show",
121
135
  description: "Full issue detail: fields, relations, children, comments. images=true downloads attached images to the local cache and includes their paths as local_images.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allocator-one/harness-cli",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "CLI and MCP server for Harness, allocator.one's issue tracker",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/spec/openapi.json CHANGED
@@ -517,6 +517,55 @@
517
517
  "tags": []
518
518
  }
519
519
  },
520
+ "/api/v1/issues/search": {
521
+ "get": {
522
+ "callbacks": {},
523
+ "deprecated": false,
524
+ "description": "Requires the `harness:read` scope. Ranked hybrid search: an exact identifier always comes first, then results ordered by relevance across a lexical and a semantic (embedding) signal — a query can match issues that share none of its words. Returns at most 20 results; there is no pagination. `meta.mode` is `hybrid` when the semantic side ran and `lexical` when it degraded (embeddings disabled or the provider unavailable). Unarchived issues only. For paginated, filterable listings use `GET /api/v1/issues` instead.",
525
+ "parameters": [
526
+ {
527
+ "description": "The question or phrase to search for — plain language works better than keywords",
528
+ "in": "query",
529
+ "name": "q",
530
+ "required": false,
531
+ "schema": {
532
+ "type": "string"
533
+ }
534
+ },
535
+ {
536
+ "description": "Maximum results (default 10, capped at 20)",
537
+ "in": "query",
538
+ "name": "limit",
539
+ "required": false,
540
+ "schema": {
541
+ "type": "integer"
542
+ }
543
+ }
544
+ ],
545
+ "responses": {
546
+ "200": {
547
+ "description": "Success"
548
+ },
549
+ "400": {
550
+ "description": "Bad request"
551
+ },
552
+ "401": {
553
+ "description": "Missing or invalid token"
554
+ },
555
+ "403": {
556
+ "description": "Token not permitted (org-scoped, non-admin, or missing scope)"
557
+ },
558
+ "404": {
559
+ "description": "Not found"
560
+ },
561
+ "422": {
562
+ "description": "Validation error"
563
+ }
564
+ },
565
+ "summary": "Search issues by meaning",
566
+ "tags": []
567
+ }
568
+ },
520
569
  "/api/v1/issues/{identifier}": {
521
570
  "get": {
522
571
  "callbacks": {},
@@ -524,7 +573,7 @@
524
573
  "description": "Requires the `harness:read` scope. The payload always carries `blocked` and `blocked_by` (identifiers of open blockers); `include` embeds relations (direction-aware), children, and recent comments in one response.",
525
574
  "parameters": [
526
575
  {
527
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
576
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
528
577
  "in": "path",
529
578
  "name": "identifier",
530
579
  "required": true,
@@ -571,7 +620,7 @@
571
620
  "description": "Requires the `harness:write` scope.",
572
621
  "parameters": [
573
622
  {
574
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
623
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
575
624
  "in": "path",
576
625
  "name": "identifier",
577
626
  "required": true,
@@ -656,7 +705,7 @@
656
705
  "description": "Requires the `harness:write` scope.",
657
706
  "parameters": [
658
707
  {
659
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
708
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
660
709
  "in": "path",
661
710
  "name": "identifier",
662
711
  "required": true,
@@ -711,7 +760,7 @@
711
760
  "description": "Requires the `harness:write` scope. Atomic compare-and-swap: assigns the caller and moves the issue to the team's first started-type state. Idempotent for the current claimant.",
712
761
  "parameters": [
713
762
  {
714
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
763
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
715
764
  "in": "path",
716
765
  "name": "identifier",
717
766
  "required": true,
@@ -754,7 +803,7 @@
754
803
  "description": "Requires the `harness:write` scope. Moves the issue to the team's first completed-type state (canceled-type with `cancel`), posting `reason` as a comment first. The response's `unblocked` lists identifiers of issues that became ready because this one closed.",
755
804
  "parameters": [
756
805
  {
757
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
806
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
758
807
  "in": "path",
759
808
  "name": "identifier",
760
809
  "required": true,
@@ -818,7 +867,7 @@
818
867
  "description": "Requires the `harness:read` scope.",
819
868
  "parameters": [
820
869
  {
821
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
870
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
822
871
  "in": "path",
823
872
  "name": "identifier",
824
873
  "required": true,
@@ -856,7 +905,7 @@
856
905
  "description": "Requires the `harness:write` scope.",
857
906
  "parameters": [
858
907
  {
859
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
908
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
860
909
  "in": "path",
861
910
  "name": "identifier",
862
911
  "required": true,
@@ -915,7 +964,7 @@
915
964
  "description": "Requires the `harness:write` scope.",
916
965
  "parameters": [
917
966
  {
918
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
967
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
919
968
  "in": "path",
920
969
  "name": "identifier",
921
970
  "required": true,
@@ -973,7 +1022,7 @@
973
1022
  "description": "Requires the `harness:read` scope.",
974
1023
  "parameters": [
975
1024
  {
976
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1025
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
977
1026
  "in": "path",
978
1027
  "name": "identifier",
979
1028
  "required": true,
@@ -1011,7 +1060,7 @@
1011
1060
  "description": "Requires the `harness:write` scope.",
1012
1061
  "parameters": [
1013
1062
  {
1014
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1063
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1015
1064
  "in": "path",
1016
1065
  "name": "identifier",
1017
1066
  "required": true,
@@ -1070,7 +1119,7 @@
1070
1119
  "description": "Requires the `harness:write` scope.",
1071
1120
  "parameters": [
1072
1121
  {
1073
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1122
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1074
1123
  "in": "path",
1075
1124
  "name": "identifier",
1076
1125
  "required": true,
@@ -1119,7 +1168,7 @@
1119
1168
  "description": "Requires the `harness:read` scope.",
1120
1169
  "parameters": [
1121
1170
  {
1122
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1171
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1123
1172
  "in": "path",
1124
1173
  "name": "identifier",
1125
1174
  "required": true,
@@ -1157,7 +1206,7 @@
1157
1206
  "description": "Requires the `harness:write` scope.",
1158
1207
  "parameters": [
1159
1208
  {
1160
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1209
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1161
1210
  "in": "path",
1162
1211
  "name": "identifier",
1163
1212
  "required": true,
@@ -1225,7 +1274,7 @@
1225
1274
  "description": "Requires the `harness:write` scope.",
1226
1275
  "parameters": [
1227
1276
  {
1228
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1277
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1229
1278
  "in": "path",
1230
1279
  "name": "identifier",
1231
1280
  "required": true,
@@ -1274,7 +1323,7 @@
1274
1323
  "description": "Requires the `harness:write` scope.",
1275
1324
  "parameters": [
1276
1325
  {
1277
- "description": "Issue identifier, e.g. IO-10001 (minted) or ALL-4223 (imported)",
1326
+ "description": "Issue identifier, e.g. ALL-4901 or CLI-12 (issues minted before team-prefixed numbering carry IO-)",
1278
1327
  "in": "path",
1279
1328
  "name": "identifier",
1280
1329
  "required": true,
@@ -1870,7 +1919,7 @@
1870
1919
  "post": {
1871
1920
  "callbacks": {},
1872
1921
  "deprecated": false,
1873
- "description": "Requires the `harness:write` scope. Creates a team seeded with the default workflow states (Backlog, Todo, In Progress, Done, Canceled), so it is immediately usable for the full issue lifecycle. The key is upcased, must match `^[A-Z][A-Z0-9]*$`, and `IO` is reserved for the issues Harness mints.",
1922
+ "description": "Requires the `harness:write` scope. Creates a team seeded with the default workflow states (Backlog, Todo, In Progress, Done, Canceled), so it is immediately usable for the full issue lifecycle. The key is upcased and must match `^[A-Z][A-Z0-9]*$`; numbering starts above any issues that already carry the key as their prefix.",
1874
1923
  "parameters": [],
1875
1924
  "requestBody": {
1876
1925
  "content": {
@@ -1878,7 +1927,7 @@
1878
1927
  "schema": {
1879
1928
  "properties": {
1880
1929
  "key": {
1881
- "description": "Identifier prefix for issues imported under the team (e.g. ALL). Upcased; create-only.",
1930
+ "description": "Identifier prefix for the team's issues (e.g. ALL in ALL-4901). Upcased; create-only.",
1882
1931
  "type": "string"
1883
1932
  },
1884
1933
  "name": {
@@ -2143,4 +2192,4 @@
2143
2192
  ],
2144
2193
  "servers": [],
2145
2194
  "tags": []
2146
- }
2195
+ }