@davesheffer/hunch 1.26.0 → 1.26.1

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/dist/cli/serve.js CHANGED
@@ -11,12 +11,13 @@ function parseScopeArg(value) {
11
11
  return parsed.data;
12
12
  }
13
13
  export function registerServeCommands(program) {
14
+ const DEFAULT_CONFIG = "hunch-serve.json";
14
15
  const serve = program.command("serve")
15
16
  .description("Serve nuryel.state/1 over HTTP for organization / team / user / repository partitions (binds 127.0.0.1; put it behind SSH or a reverse proxy)")
16
- .option("--config <file>", "serve config (nuryel.serve-config/1)", "hunch-serve.json")
17
+ .option("--config <file>", `serve config (nuryel.serve-config/1); default ${DEFAULT_CONFIG}`)
17
18
  .option("--port <n>", "override the configured port")
18
19
  .action((opts) => {
19
- const config = readServeConfig(resolve(opts.config));
20
+ const config = readServeConfig(resolve(opts.config ?? DEFAULT_CONFIG));
20
21
  const port = opts.port ? Number(opts.port) : config.port;
21
22
  if (!Number.isInteger(port) || port < 1 || port > 65535)
22
23
  throw new Error(`invalid port ${opts.port}`);
@@ -34,7 +35,7 @@ export function registerServeCommands(program) {
34
35
  .description("Declare a partition directory and mint a principal token (printed once; only its hash is stored)")
35
36
  .requiredOption("--partition <kind:id>", "the scope this directory IS, e.g. user:david or organization:ylm")
36
37
  .requiredOption("--root <dir>", "directory whose .hunch/ holds the partition (created if missing)")
37
- .option("--config <file>", "serve config to create or extend", "hunch-serve.json")
38
+ .option("--config <file>", `serve config to create or extend; default ${DEFAULT_CONFIG}`)
38
39
  .option("--principal <id>", "principal to add or rotate, granted this partition")
39
40
  .option("--kind <kind>", "principal kind: human | agent | service", "agent")
40
41
  .option("--grant <kind:id...>", "additional partitions to grant the principal (must be served by this config)")
@@ -43,22 +44,28 @@ export function registerServeCommands(program) {
43
44
  .action((opts) => {
44
45
  if (!["human", "agent", "service"].includes(opts.kind))
45
46
  throw new Error("--kind must be human, agent or service");
47
+ // `serve` and `serve init` both take --config; Commander hands an option written after
48
+ // `init` to whichever command claims it first, and that was the parent — so 1.26.0's
49
+ // `serve init --config X` silently wrote the default file into the cwd. Read both.
50
+ const parent = serve.opts();
51
+ const configFile = resolve(parent.config ?? opts.config ?? DEFAULT_CONFIG);
52
+ const port = parent.port ?? opts.port;
46
53
  const scope = parseScopeArg(opts.partition);
47
54
  const grants = [scope, ...(opts.grant ?? []).map(parseScopeArg)];
48
55
  const result = initServeConfig({
49
- file: resolve(opts.config), scope, root: resolve(opts.root),
56
+ file: configFile, scope, root: resolve(opts.root),
50
57
  ...(opts.principal ? { principal: { id: opts.principal, kind: opts.kind, grants } } : {}),
51
- ...(opts.port ? { port: Number(opts.port) } : {}),
58
+ ...(port ? { port: Number(port) } : {}),
52
59
  });
53
60
  if (opts.json) {
54
- console.log(JSON.stringify({ config: resolve(opts.config), partition: result.partition, token: result.token }));
61
+ console.log(JSON.stringify({ config: configFile, partition: result.partition, token: result.token }));
55
62
  return;
56
63
  }
57
64
  console.log(`partition ${scopePath(scope)} → ${result.partition.root}`);
58
- console.log(`config: ${resolve(opts.config)} (${result.config.partitions.length} partition(s), ${result.config.principals.length} principal(s))`);
65
+ console.log(`config: ${configFile} (${result.config.partitions.length} partition(s), ${result.config.principals.length} principal(s))`);
59
66
  if (result.token)
60
67
  console.log(`token for ${opts.principal} (shown once — only its sha256 is stored): ${result.token}`);
61
- console.log(`start: hunch serve --config ${opts.config}`);
68
+ console.log(`start: hunch serve --config ${configFile}`);
62
69
  });
63
70
  }
64
71
  //# sourceMappingURL=serve.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "mcpName": "io.github.davesheffer/hunch",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
package/server.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "source": "github"
8
8
  },
9
9
  "websiteUrl": "https://www.hunchmemory.com",
10
- "version": "1.26.0",
10
+ "version": "1.26.1",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "registryBaseUrl": "https://registry.npmjs.org",
15
15
  "identifier": "@davesheffer/hunch",
16
- "version": "1.26.0",
16
+ "version": "1.26.1",
17
17
  "runtimeHint": "npx",
18
18
  "packageArguments": [
19
19
  {