fix: rename @bool to @ocas/bool + add OCAS_HOME env var
- @bool alias missed in namespace rebranding, now @ocas/bool - CLI respects OCAS_HOME env var for store path (--store > OCAS_HOME > ~/.ocas) - Update help text and snapshots
This commit is contained in:
@@ -89,7 +89,9 @@ const { flags, positional } = parseArgs(process.argv.slice(2));
|
||||
|
||||
const defaultStorePath = join(homedir(), ".ocas");
|
||||
const storePath =
|
||||
typeof flags.store === "string" ? flags.store : defaultStorePath;
|
||||
typeof flags.store === "string"
|
||||
? flags.store
|
||||
: (process.env["OCAS_HOME"] ?? defaultStorePath);
|
||||
const compact = flags.json === true;
|
||||
|
||||
const defaultVarDbPath = join(storePath, "variables.db");
|
||||
@@ -878,7 +880,7 @@ Commands:
|
||||
gc Run garbage collection (@ocas/output/gc)
|
||||
|
||||
Flags:
|
||||
--store <path> Store directory (default: ~/.ocas)
|
||||
--store <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
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/number");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/object");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/array");
|
||||
expect(builtinSchemas).toHaveProperty("@bool");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/bool");
|
||||
|
||||
for (const alias of OUTPUT_ALIASES) {
|
||||
expect(builtinSchemas).toHaveProperty(alias);
|
||||
@@ -114,12 +114,12 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
expect(arraySchema).toEqual({ type: "array" });
|
||||
});
|
||||
|
||||
test("should register @bool schema correctly", async () => {
|
||||
test("should register @ocas/bool schema correctly", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const boolHash = builtinSchemas["@bool"];
|
||||
if (!boolHash) throw new Error("@bool not found");
|
||||
const boolHash = builtinSchemas["@ocas/bool"];
|
||||
if (!boolHash) throw new Error("@ocas/bool not found");
|
||||
|
||||
const boolSchema = getSchema(store, boolHash);
|
||||
expect(boolSchema).toEqual({ type: "boolean" });
|
||||
@@ -137,7 +137,7 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
expect(first["@ocas/number"]).toBe(second["@ocas/number"]);
|
||||
expect(first["@ocas/object"]).toBe(second["@ocas/object"]);
|
||||
expect(first["@ocas/array"]).toBe(second["@ocas/array"]);
|
||||
expect(first["@bool"]).toBe(second["@bool"]);
|
||||
expect(first["@ocas/bool"]).toBe(second["@ocas/bool"]);
|
||||
expect(first["@ocas/schema"]).toBe(second["@ocas/schema"]);
|
||||
});
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ export async function bootstrap(store: Store): Promise<Record<string, Hash>> {
|
||||
"@ocas/number": numberHash,
|
||||
"@ocas/object": objectHash,
|
||||
"@ocas/array": arrayHash,
|
||||
"@bool": boolHash,
|
||||
"@ocas/bool": boolHash,
|
||||
};
|
||||
|
||||
for (const [alias, schema] of OUTPUT_SCHEMAS) {
|
||||
|
||||
@@ -207,7 +207,7 @@ describe("createMemoryStore – listByType", () => {
|
||||
expect(allTypedByMeta).toContain(builtinSchemas["@ocas/number"] ?? "");
|
||||
expect(allTypedByMeta).toContain(builtinSchemas["@ocas/object"] ?? "");
|
||||
expect(allTypedByMeta).toContain(builtinSchemas["@ocas/array"] ?? "");
|
||||
expect(allTypedByMeta).toContain(builtinSchemas["@bool"] ?? "");
|
||||
expect(allTypedByMeta).toContain(builtinSchemas["@ocas/bool"] ?? "");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -273,7 +273,7 @@ describe("bootstrap", () => {
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/number");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/object");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/array");
|
||||
expect(builtinSchemas).toHaveProperty("@bool");
|
||||
expect(builtinSchemas).toHaveProperty("@ocas/bool");
|
||||
|
||||
// All values should be valid hashes
|
||||
for (const hash of Object.values(builtinSchemas)) {
|
||||
|
||||
@@ -386,7 +386,7 @@ describe("openStore – async with auto-bootstrap", () => {
|
||||
expect(store.has(builtinSchemas["@ocas/number"] as string)).toBe(true);
|
||||
expect(store.has(builtinSchemas["@ocas/object"] as string)).toBe(true);
|
||||
expect(store.has(builtinSchemas["@ocas/array"] as string)).toBe(true);
|
||||
expect(store.has(builtinSchemas["@bool"] as string)).toBe(true);
|
||||
expect(store.has(builtinSchemas["@ocas/bool"] as string)).toBe(true);
|
||||
expect(store.has(builtinSchemas["@ocas/schema"] as string)).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user