@hardfin/cli 0.1.1-dev.59 → 0.1.1-dev.61

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
@@ -131,6 +131,10 @@ for.
131
131
  A person at a terminal reads one plain line on stderr. Anything else reads JSON, also on
132
132
  stderr, so a pipe still carries only the result.
133
133
 
134
+ JSON is written on one line when a program reads it, and indented when a terminal shows it.
135
+ The indentation of a page of records is close to half its size, which an agent would
136
+ otherwise have to read. Pipe a result through `jq .` to read it indented.
137
+
134
138
  | Field | Holds |
135
139
  | ----------- | ------------------------------------------------------------------------ |
136
140
  | `code` | A fixed name for the failure, such as `not_found` or `missing_flag` |
@@ -446,6 +450,7 @@ types are stale.
446
450
  ```sh
447
451
  hardfin init # the working directory
448
452
  hardfin init --dry-run # what it would write, writing nothing
453
+ hardfin init --local # set up the server this CLI runs, in place of the hosted one
449
454
  ```
450
455
 
451
456
  `hardfin init` gets a project ready for a coding agent to use Hardfin, the way EmDash's starter
@@ -465,6 +470,11 @@ by default. [Serving an agent](#serving-an-agent) says how it differs from the l
465
470
  this CLI runs. Every other server in an MCP config, and everything in `AGENTS.md` outside the
466
471
  markers, is left as it was. A config that does not hold JSON is skipped, never overwritten.
467
472
 
473
+ `hardfin init --local` writes the local server in its place: the command `hardfin mcp`, which
474
+ each client starts by name. It needs `hardfin` on the `PATH` of whoever opens the project, and
475
+ it writes no address, so it works in a folder set up for a local build. Run `init` again
476
+ without `--local` to go back to the hosted server.
477
+
468
478
  `init` refuses an address that `config.local.json` or `.env` in the folder chose, because the
469
479
  address goes into files every agent in the project reads. Pass `--issuer-url` to use it. The
470
480
  address must be https, or this machine.
@@ -477,16 +487,16 @@ package, so `init` writes the copy that matches the installed CLI.
477
487
  Hardfin has two MCP servers, and an agent needs only one of them. Hardfin hosts one. The
478
488
  other is this CLI, run on your machine. Read this section to choose between them.
479
489
 
480
- | | The hosted server | The local server |
481
- | --------------------- | -------------------------------------------------------------------- | ------------------------------------------------------ |
482
- | Runs | At Hardfin, at `https://api.hardfin.com/mcp` | On your machine, started by the agent's client |
483
- | Needs installed | Nothing | This CLI, and Node 20.12 or later |
484
- | Set up by | `hardfin init` | `claude mcp add hardfin -- hardfin mcp` |
485
- | Signs in as | Whoever signs in to Hardfin from the client | Whoever ran `hardfin login` here, or `HARDFIN_API_KEY` |
486
- | Tools | `hardfin_read`, `hardfin_create`, `hardfin_update`, `hardfin_delete` | `hardfin_read`, `hardfin_write`, `hardfin_delete` |
487
- | A call names | An operation from the API reference, with its parameters and body | A command, as the words typed after `hardfin` |
488
- | Read-only when | The sign in was not granted `hardfin:write` | The same, or it was started with `--read-only` |
489
- | Files on your machine | Out of reach | Uploaded and downloaded, inside the folder it runs in |
490
+ | | The hosted server | The local server |
491
+ | --------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------ |
492
+ | Runs | At Hardfin, at `https://api.hardfin.com/mcp` | On your machine, started by the agent's client |
493
+ | Needs installed | Nothing | This CLI, and Node 20.12 or later |
494
+ | Set up by | `hardfin init` | `hardfin init --local`, or `claude mcp add hardfin -- hardfin mcp` |
495
+ | Signs in as | Whoever signs in to Hardfin from the client | Whoever ran `hardfin login` here, or `HARDFIN_API_KEY` |
496
+ | Tools | `hardfin_read`, `hardfin_create`, `hardfin_update`, `hardfin_delete` | `hardfin_read`, `hardfin_write`, `hardfin_delete` |
497
+ | A call names | An operation from the API reference, with its parameters and body | A command, as the words typed after `hardfin` |
498
+ | Read-only when | The sign in was not granted `hardfin:write` | The same, or it was started with `--read-only` |
499
+ | Files on your machine | Out of reach | Uploaded and downloaded, inside the folder it runs in |
490
500
 
491
501
  Choose the hosted server unless one of these holds.
492
502
 
@@ -548,13 +558,17 @@ connector directory requires.
548
558
  A tool call runs the CLI itself, so an agent and a person get identical parsing, output and
549
559
  exit codes. Each call has these limits:
550
560
 
551
- | Limit | Value | Past it |
552
- | ---------------- | --------------------------------------- | ------------------------------------------ |
553
- | Time | 120 seconds | The command is stopped, and the call fails |
554
- | Commands running | 4 at once | The next call waits for one to finish |
555
- | One argument | 128 KiB | Refused, pointing at the `input` argument |
556
- | Standard input | The call's `input` argument, or nothing | Always closed, so `--input -` never waits |
557
- | One result | 200,000 characters | Cut, with a line saying it is not complete |
561
+ | Limit | Value | Past it |
562
+ | ---------------- | --------------------------------------- | -------------------------------------------------------- |
563
+ | Time | 120 seconds | The command is stopped, and the call fails |
564
+ | Commands running | 4 at once | The next call waits for one to finish |
565
+ | One argument | 128 KiB | Refused, pointing at the `input` argument |
566
+ | Standard input | The call's `input` argument, or nothing | Always closed, so `--input -` never waits |
567
+ | One result | 200,000 characters | A list is shortened to the records that fit, and says so |
568
+
569
+ A list that is too long comes back as valid JSON holding the records that fit, with
570
+ `truncated` saying how many were shown, how many were asked for, and to narrow the list or
571
+ count with `--limit 1`. An asset is about 6 kB, so 30 fit in one result.
558
572
 
559
573
  A failed call also carries the failure as `structuredContent`, with the same `code`,
560
574
  `message`, `errors`, `requestId` and `status` the CLI prints, plus `exitCode`. A file that is
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0244e0c8-4f66-5b42-b025-5f487baeab82")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d233e4e5-e149-5533-80be-917bfd948db3")}catch(e){}}();
4
4
  import module from "node:module";
5
5
  //#region src/cli.ts
6
6
  module.enableCompileCache?.();
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
14
14
  try {
15
15
  const answer = await toQuickAnswer(process.argv.slice(2));
16
16
  if (answer === void 0) {
17
- const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-DJuADiEQ.js");
17
+ const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-CkKf46kC.js");
18
18
  try {
19
19
  await toCli().parseAsync(process.argv);
20
20
  } catch (error) {
@@ -33,7 +33,7 @@ async function toCrash(error) {
33
33
  isCrashing = true;
34
34
  const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
35
35
  try {
36
- const { toReported, writeCrash } = await import("./program-DJuADiEQ.js");
36
+ const { toReported, writeCrash } = await import("./program-CkKf46kC.js");
37
37
  writeCrash(error, isJSON);
38
38
  await toReported(error, isJSON, void 0, "fatal");
39
39
  } catch {
@@ -54,4 +54,4 @@ async function toQuickAnswer(args) {
54
54
  export {};
55
55
 
56
56
  //# sourceMappingURL=cli.js.map
57
- //# debugId=0244e0c8-4f66-5b42-b025-5f487baeab82
57
+ //# debugId=d233e4e5-e149-5533-80be-917bfd948db3