Merge pull request 'feat: rename --store to --home for OCAS_HOME consistency' (#11) from feat/rename-store-to-home into main

This commit was merged in pull request #11.
This commit is contained in:
2026-06-01 08:20:05 +00:00
13 changed files with 31 additions and 31 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ type Flags = Record<string, string | boolean | string[]>;
/** 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<void> {
function printUsage(): void {
console.log(`\
Usage: ocas [--store <path>] [--json] <command> [args]
Usage: ocas [--home <path>] [--json] <command> [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 <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--var-db <path> Variable database path (default: <store>/variables.db)
--json Compact JSON output
--schema <hash> Schema hash filter for var get/delete/tag/list
@@ -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 <path>] [--json] <command> [args]
"Usage: ocas [--home <path>] [--json] <command> [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 <path> Store directory (default: ~/.ocas)
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--var-db <path> Variable database path (default: <store>/variables.db)
--json Compact JSON output
--schema <hash> Schema hash filter for var get/delete/tag/list
+1 -1
View File
@@ -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",
+5 -5
View File
@@ -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;
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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);
+3 -3
View File
@@ -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,
+1 -1
View File
@@ -49,7 +49,7 @@ async function runCli(...args: string[]): Promise<{
"bun",
"run",
cliPath,
"--store",
"--home",
storePath,
"--var-db",
varDbPath,
+4 -4
View File
@@ -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,
+1 -1
View File
@@ -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;