@gajae-code/utils 0.12.21 → 0.13.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.
@@ -6,6 +6,8 @@ export interface FlagDescriptor<K extends "string" | "boolean" | "integer" = "st
6
6
  multiple?: boolean;
7
7
  options?: readonly string[];
8
8
  required?: boolean;
9
+ /** The string value may be omitted; parsers decide whether to consume it. */
10
+ optionalValue?: boolean;
9
11
  }
10
12
  export interface ArgDescriptor {
11
13
  kind: "string";
@@ -21,6 +23,8 @@ interface FlagInput {
21
23
  multiple?: boolean;
22
24
  options?: readonly string[];
23
25
  required?: boolean;
26
+ /** The string value may be omitted; parsers decide whether to consume it. */
27
+ optionalValue?: boolean;
24
28
  }
25
29
  interface ArgInput {
26
30
  description?: string;
@@ -137,6 +137,8 @@ export declare function getSessionsDir(agentDir?: string): string;
137
137
  export declare function getBlobsDir(agentDir?: string): string;
138
138
  /** Get the resident-text cache root for a profile agent directory. */
139
139
  export declare function getResidentCacheRootDir(profileAgentDir: string): string;
140
+ /** Get the managed cold-history sidecar cache root for a profile agent directory. */
141
+ export declare function getSidecarCacheRootDir(profileAgentDir: string): string;
140
142
  /** Get the custom themes directory (~/.gjc/agent/themes). */
141
143
  export declare function getCustomThemesDir(agentDir?: string): string;
142
144
  /** Get the tools directory (~/.gjc/agent/tools). */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/utils",
4
- "version": "0.12.21",
4
+ "version": "0.13.0",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@gajae-code/natives": "0.12.21",
34
+ "@gajae-code/natives": "0.13.0",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/cli.ts CHANGED
@@ -23,6 +23,8 @@ export interface FlagDescriptor<K extends "string" | "boolean" | "integer" = "st
23
23
  multiple?: boolean;
24
24
  options?: readonly string[];
25
25
  required?: boolean;
26
+ /** The string value may be omitted; parsers decide whether to consume it. */
27
+ optionalValue?: boolean;
26
28
  }
27
29
 
28
30
  export interface ArgDescriptor {
@@ -40,6 +42,8 @@ interface FlagInput {
40
42
  multiple?: boolean;
41
43
  options?: readonly string[];
42
44
  required?: boolean;
45
+ /** The string value may be omitted; parsers decide whether to consume it. */
46
+ optionalValue?: boolean;
43
47
  }
44
48
 
45
49
  interface ArgInput {
@@ -352,7 +356,14 @@ function renderCommandBody(lines: string[], Cmd: CommandCtor): void {
352
356
  for (const [name, desc] of flagEntries) {
353
357
  const charPart = desc.char ? `-${desc.char}, ` : " ";
354
358
  const namePart = `--${name}`;
355
- const typePart = desc.kind === "boolean" ? "" : desc.kind === "integer" ? "=<int>" : "=<value>";
359
+ const typePart =
360
+ desc.kind === "boolean"
361
+ ? ""
362
+ : desc.kind === "integer"
363
+ ? "=<int>"
364
+ : desc.optionalValue
365
+ ? "[=<value>]"
366
+ : "=<value>";
356
367
  formatted.push([` ${charPart}${namePart}${typePart}`, desc.description ?? ""]);
357
368
  }
358
369
  const maxLeft = Math.max(...formatted.map(([l]) => l.length));
@@ -430,7 +441,9 @@ export async function run(opts: RunOptions): Promise<void> {
430
441
 
431
442
  // Per-command help. Commands with nested subcommands can opt into receiving
432
443
  // help flags themselves so `cmd subcommand --help` can render subcommand help.
433
- if (commandArgv.includes("--help") || commandArgv.includes("-h")) {
444
+ const delimiterIndex = commandArgv.indexOf("--");
445
+ const helpArgs = delimiterIndex === -1 ? commandArgv : commandArgv.slice(0, delimiterIndex);
446
+ if (helpArgs.includes("--help") || helpArgs.includes("-h")) {
434
447
  const entry = findEntry(opts.commands, commandId);
435
448
  if (!entry) {
436
449
  process.stderr.write(`Unknown command: ${commandId}\n`);
package/src/dirs.ts CHANGED
@@ -551,6 +551,11 @@ export function getResidentCacheRootDir(profileAgentDir: string): string {
551
551
  return dirs.agentSubdir(profileAgentDir, "resident-cache", "cache");
552
552
  }
553
553
 
554
+ /** Get the managed cold-history sidecar cache root for a profile agent directory. */
555
+ export function getSidecarCacheRootDir(profileAgentDir: string): string {
556
+ return dirs.agentSubdir(profileAgentDir, "sidecar-cache", "cache");
557
+ }
558
+
554
559
  /** Get the custom themes directory (~/.gjc/agent/themes). */
555
560
  export function getCustomThemesDir(agentDir?: string): string {
556
561
  return dirs.agentSubdir(agentDir, "themes");