diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 48b74e3..973e4ed 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -32,7 +32,7 @@ type Flags = Record; /** Flags that consume the next token as their value. All others are boolean. */ const VALUE_FLAGS = new Set([ - "store", + "home", "format", "var-db", "tag", @@ -89,8 +89,8 @@ const { flags, positional } = parseArgs(process.argv.slice(2)); const defaultStorePath = join(homedir(), ".ocas"); const storePath = - typeof flags.store === "string" - ? flags.store + typeof flags.home === "string" + ? flags.home : (process.env["OCAS_HOME"] ?? defaultStorePath); const compact = flags.json === true; @@ -849,7 +849,7 @@ async function cmdListSchema(_args: string[]): Promise { function printUsage(): void { console.log(`\ -Usage: ocas [--store ] [--json] [args] +Usage: ocas [--home ] [--json] [args] All JSON commands emit a { type, value } envelope. The type is the hash of the command's @ocas/output/* schema (shown in parentheses); pipe any envelope into @@ -880,7 +880,7 @@ Commands: gc Run garbage collection (@ocas/output/gc) Flags: - --store Store directory (default: $OCAS_HOME or ~/.ocas) + --home Store directory (default: $OCAS_HOME or ~/.ocas) --var-db Variable database path (default: /variables.db) --json Compact JSON output --schema Schema hash filter for var get/delete/tag/list diff --git a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap index fb7cecc..ec785a3 100644 --- a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap +++ b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap @@ -7,7 +7,7 @@ exports[`Phase 7: Edge Cases 7.3 var set empty name errors 1`] = `"Usage: ocas v exports[`Phase 7: Edge Cases 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Segment "invalid name!" contains invalid characters (only @, a-z, A-Z, 0-9, ., _, - allowed)"`; exports[`Phase 7: Edge Cases 7.5 no subcommand shows help text 1`] = ` -"Usage: ocas [--store ] [--json] [args] +"Usage: ocas [--home ] [--json] [args] All JSON commands emit a { type, value } envelope. The type is the hash of the command's @ocas/output/* schema (shown in parentheses); pipe any envelope into @@ -38,7 +38,7 @@ Commands: gc Run garbage collection (@ocas/output/gc) Flags: - --store Store directory (default: ~/.ocas) + --home Store directory (default: $OCAS_HOME or ~/.ocas) --var-db Variable database path (default: /variables.db) --json Compact JSON output --schema Schema hash filter for var get/delete/tag/list diff --git a/packages/cli/tests/alias.test.ts b/packages/cli/tests/alias.test.ts index 8578194..7fd63be 100644 --- a/packages/cli/tests/alias.test.ts +++ b/packages/cli/tests/alias.test.ts @@ -40,7 +40,7 @@ async function runCliAlias(...args: string[]): Promise<{ exitCode: number; }> { const proc = Bun.spawn( - ["bun", "run", cliPath, "--store", storePath, ...args], + ["bun", "run", cliPath, "--home", storePath, ...args], { stdout: "pipe", stderr: "pipe", diff --git a/packages/cli/tests/edge-cases.test.ts b/packages/cli/tests/edge-cases.test.ts index 0e912f3..ff99563 100644 --- a/packages/cli/tests/edge-cases.test.ts +++ b/packages/cli/tests/edge-cases.test.ts @@ -46,7 +46,7 @@ describe("Phase 7: Edge Cases", () => { args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; @@ -130,14 +130,14 @@ describe("Phase 7: Edge Cases", () => { expect(combined.toLowerCase()).toContain("usage"); }); - test("7.6 --store path is a file errors", async () => { + test("7.6 --home path is a file errors", async () => { const fileAsStore = join(tmpStore, "not-a-directory"); writeFileSync(fileAsStore, "test"); const proc = Bun.spawn( [ "bun", entrypoint, - "--store", + "--home", fileAsStore, "--var-db", varDbPath, @@ -165,7 +165,7 @@ describe("Phase 3: Variable System", () => { args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; @@ -354,7 +354,7 @@ describe("Phase 4: Template System", () => { args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; diff --git a/packages/cli/tests/gc.test.ts b/packages/cli/tests/gc.test.ts index 6850c72..eb3e0bb 100644 --- a/packages/cli/tests/gc.test.ts +++ b/packages/cli/tests/gc.test.ts @@ -50,7 +50,7 @@ async function runCli( args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; @@ -84,7 +84,7 @@ describe("Phase 6: GC", () => { [ "bun", entrypoint, - "--store", + "--home", tmpStore, "--var-db", varDbPath, diff --git a/packages/cli/tests/helpers.ts b/packages/cli/tests/helpers.ts index b7d13e8..b3c4bbc 100644 --- a/packages/cli/tests/helpers.ts +++ b/packages/cli/tests/helpers.ts @@ -55,7 +55,7 @@ export async function runCli( storePath?: string, ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const finalArgs = storePath - ? ["bun", entrypoint, "--store", storePath, ...args] + ? ["bun", entrypoint, "--home", storePath, ...args] : ["bun", entrypoint, ...args]; const proc = Bun.spawn(finalArgs, { stdout: "pipe", @@ -72,7 +72,7 @@ export async function runCliWithStdin( storePath: string, stdin: string, ): Promise<{ stdout: string; stderr: string; exitCode: number }> { - const finalArgs = ["bun", entrypoint, "--store", storePath, ...args]; + const finalArgs = ["bun", entrypoint, "--home", storePath, ...args]; const proc = Bun.spawn(finalArgs, { stdout: "pipe", stderr: "pipe", diff --git a/packages/cli/tests/pipe.test.ts b/packages/cli/tests/pipe.test.ts index 6d1d60a..cec546a 100644 --- a/packages/cli/tests/pipe.test.ts +++ b/packages/cli/tests/pipe.test.ts @@ -52,7 +52,7 @@ async function runCli( args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; @@ -66,7 +66,7 @@ async function runCliWithStdin( stdin: string, ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdin: "pipe", stdout: "pipe", stderr: "pipe" }, ); proc.stdin.write(stdin); diff --git a/packages/cli/tests/put-get-has.test.ts b/packages/cli/tests/put-get-has.test.ts index 57242ee..04a4565 100644 --- a/packages/cli/tests/put-get-has.test.ts +++ b/packages/cli/tests/put-get-has.test.ts @@ -50,7 +50,7 @@ async function runCli( args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; diff --git a/packages/cli/tests/render.test.ts b/packages/cli/tests/render.test.ts index 7494af5..be0e360 100644 --- a/packages/cli/tests/render.test.ts +++ b/packages/cli/tests/render.test.ts @@ -62,7 +62,7 @@ describe("Phase 5: Render", () => { args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited; @@ -76,7 +76,7 @@ describe("Phase 5: Render", () => { stdin: string, ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdin: "pipe", stdout: "pipe", stderr: "pipe" }, ); proc.stdin.write(stdin); diff --git a/packages/cli/tests/schema-validation.test.ts b/packages/cli/tests/schema-validation.test.ts index cc70682..b89f4ea 100644 --- a/packages/cli/tests/schema-validation.test.ts +++ b/packages/cli/tests/schema-validation.test.ts @@ -590,7 +590,7 @@ describe("Phase 2: Schema Validation", () => { [ "bun", entrypoint, - "--store", + "--home", tmpStore, "--var-db", varDbPath, @@ -616,7 +616,7 @@ describe("Phase 2: Schema Validation", () => { [ "bun", entrypoint, - "--store", + "--home", tmpStore, "--var-db", varDbPath, @@ -641,7 +641,7 @@ describe("Phase 2: Schema Validation", () => { [ "bun", entrypoint, - "--store", + "--home", tmpStore, "--var-db", varDbPath, diff --git a/packages/cli/tests/template.test.ts b/packages/cli/tests/template.test.ts index c89d585..92326a6 100644 --- a/packages/cli/tests/template.test.ts +++ b/packages/cli/tests/template.test.ts @@ -49,7 +49,7 @@ async function runCli(...args: string[]): Promise<{ "bun", "run", cliPath, - "--store", + "--home", storePath, "--var-db", varDbPath, diff --git a/packages/cli/tests/variable.test.ts b/packages/cli/tests/variable.test.ts index b538c8f..266edef 100644 --- a/packages/cli/tests/variable.test.ts +++ b/packages/cli/tests/variable.test.ts @@ -49,7 +49,7 @@ async function runCli(...args: string[]): Promise<{ "bun", "run", cliPath, - "--store", + "--home", storePath, "--var-db", varDbPath, @@ -949,7 +949,7 @@ describe("global options", () => { expect(lines.length).toBe(1); }); - test("--store flag for custom store path", async () => { + test("--home flag for custom store path", async () => { const customStorePath = join(testDir, "custom-store"); mkdirSync(customStorePath, { recursive: true }); @@ -963,7 +963,7 @@ describe("global options", () => { "bun", "run", cliPath, - "--store", + "--home", customStorePath, "--var-db", varDbPath, @@ -994,7 +994,7 @@ describe("global options", () => { "bun", "run", cliPath, - "--store", + "--home", storePath, "--var-db", customDbPath, diff --git a/packages/cli/tests/verify-refs-walk.test.ts b/packages/cli/tests/verify-refs-walk.test.ts index 9c7fd41..9ca37ed 100644 --- a/packages/cli/tests/verify-refs-walk.test.ts +++ b/packages/cli/tests/verify-refs-walk.test.ts @@ -47,7 +47,7 @@ async function runCli( args: string[], ): Promise<{ stdout: string; stderr: string; exitCode: number }> { const proc = Bun.spawn( - ["bun", entrypoint, "--store", tmpStore, "--var-db", varDbPath, ...args], + ["bun", entrypoint, "--home", tmpStore, "--var-db", varDbPath, ...args], { stdout: "pipe", stderr: "pipe" }, ); const exitCode = await proc.exited;