fix: clean build 兼容性修复

- 根 package.json 加 @types/node(clean install 后 tsc 需要)
- CLI tests entrypoint 从 src/index.ts 改为 dist/index.js
- 局部 runCli 支持 rest 和 array 两种调用模式(rawArgs.flat())
- 所有剩余 tsx 引用改为 node

36/36 files pass, 617/617 tests pass

Fixes #64
This commit is contained in:
2026-06-03 06:32:39 +00:00
parent dd75c1f39d
commit fe56634160
18 changed files with 191 additions and 176 deletions
@@ -375,154 +375,6 @@ exports[`Phase 3: Variable System > 3.10 var delete removes variable 1`] = `
exports[`Phase 3: Variable System > 3.11 var get deleted variable returns not found 1`] = `"Error: Variable not found: name=@myapp/config, schema=FRBAB1BF0ZBCS"`;
exports[`Phase 4: Template System > 4.1 template set registers template 1`] = `
{
"type": "BJDHPAE4Q8TXM",
"value": {
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
}
`;
exports[`Phase 4: Template System > 4.2 template get returns template text 1`] = `
{
"type": "0B0HBHZGYHR84",
"value": "Name: {{ payload.name }}, Age: {{ payload.age }}",
}
`;
exports[`Phase 4: Template System > 4.3 template list shows registered templates 1`] = `
{
"type": "8917JQTD1R5JF",
"value": [
{
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
],
}
`;
exports[`Phase 4: Template System > 4.4 template delete removes template 1`] = `
{
"type": "BY7BGZJND3N7R",
"value": {
"deleted": true,
},
}
`;
exports[`Phase 4: Template System > 4.5 template get deleted template returns not found 1`] = `"Error: Template not found for schema: FRBAB1BF0ZBCS"`;
exports[`Phase 7: Edge Cases > 7.1 get non-existent hash errors gracefully 1`] = `"Node not found: AAAAAAAAAAAAA"`;
exports[`Phase 7: Edge Cases > 7.3 var set empty name errors 1`] = `"Usage: ocas var set <name> <hash> [--tag <tag>...]"`;
exports[`Phase 7: Edge Cases > 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Name must follow @scope/name format (e.g. @myapp/config)"`;
exports[`Phase 7: Edge Cases > 7.5 no subcommand shows help text 1`] = `
"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
\`render -p\` to render its value (ocas_ref hashes are expanded).
Commands:
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@ocas/output/put)
get <hash> Print node as envelope (@ocas/output/get)
has <hash> Print envelope (value=boolean) (@ocas/output/has)
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@ocas/output/verify)
refs <hash> List direct ocas_ref edges (@ocas/output/refs)
walk <hash> [--format tree] Recursive traversal (@ocas/output/walk)
hash <type-hash> <file.json|--pipe> Compute hash without storing (@ocas/output/hash)
render <hash> [options] Render node as text with resolution decay (raw output)
render --pipe/-p [options] Render { type, value } from stdin (raw output)
list --type <hash-or-name> [--tag <tag>...] List hashes for a type, optionally filtered by tags (@ocas/output/list)
list-meta List meta-schema hashes (value=string[]) (@ocas/output/list-meta)
list-schema List all schema hashes (value=string[]) (@ocas/output/list-schema)
tag <target> <tag>... Apply tags/labels to a target (@ocas/output/tag)
untag <target> <tag>... Remove tags/labels from a target (@ocas/output/untag)
var set <name> <hash> [--tag <tag>...] Create/update a variable (@ocas/output/var-set)
var get <name> --schema <hash> Get a variable by name + schema (@ocas/output/var-get)
var delete <name> [--schema <hash>] Delete variable(s) (@ocas/output/var-delete)
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@ocas/output/var-list)
var history <name> [--schema <hash>] Show value history (LRU) (@ocas/output/var-history)
template set <schema-hash> <file> | --inline <text> Set template for schema (@ocas/output/template-set)
template get <schema-hash> Get template content (value=string) (@ocas/output/template-get)
template list List all templates (@ocas/output/template-list)
template delete <schema-hash> Delete template for schema (@ocas/output/template-delete)
gc Run garbage collection (@ocas/output/gc)
Flags:
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--json Compact JSON output
--render, -r Render output inline (equivalent to | ocas render -p)
--schema <hash> Schema hash filter for var get/delete/tag/list
--tag <tag> Tag/label (can be repeated): key:value (tag), name (label), :name (delete)
--inline <text> Inline text content for template set
--resolution <n> Initial resolution for render (default: 1.0)
--decay <n> Decay factor for render (default: 0.5)
--epsilon <n> Cutoff threshold for render (default: 0.01)
--pipe, -p Read from stdin (put/hash: raw JSON payload; render: { type, value } envelope)
Agent: If you have not installed the ocas skill for this version (0.2.0), run \`ocas prompt setup\` and follow the instructions."
`;
exports[`Phase 7: Edge Cases 7.1 get non-existent hash errors gracefully 1`] = `"Node not found: AAAAAAAAAAAAA"`;
exports[`Phase 7: Edge Cases 7.3 var set empty name errors 1`] = `"Usage: ocas var set <name> <hash> [--tag <tag>...]"`;
exports[`Phase 7: Edge Cases 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Name must follow @scope/name format (e.g. @myapp/config)"`;
exports[`Phase 7: Edge Cases 7.5 no subcommand shows help text 1`] = `
"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
\`render -p\` to render its value (ocas_ref hashes are expanded).
Commands:
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@ocas/output/put)
get <hash> Print node as envelope (@ocas/output/get)
has <hash> Print envelope (value=boolean) (@ocas/output/has)
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@ocas/output/verify)
refs <hash> List direct ocas_ref edges (@ocas/output/refs)
walk <hash> [--format tree] Recursive traversal (@ocas/output/walk)
hash <type-hash> <file.json|--pipe> Compute hash without storing (@ocas/output/hash)
render <hash> [options] Render node as text with resolution decay (raw output)
render --pipe/-p [options] Render { type, value } from stdin (raw output)
list --type <hash-or-name> [--tag <tag>...] List hashes for a type, optionally filtered by tags (@ocas/output/list)
list-meta List meta-schema hashes (value=string[]) (@ocas/output/list-meta)
list-schema List all schema hashes (value=string[]) (@ocas/output/list-schema)
tag <target> <tag>... Apply tags/labels to a target (@ocas/output/tag)
untag <target> <tag>... Remove tags/labels from a target (@ocas/output/untag)
var set <name> <hash> [--tag <tag>...] Create/update a variable (@ocas/output/var-set)
var get <name> --schema <hash> Get a variable by name + schema (@ocas/output/var-get)
var delete <name> [--schema <hash>] Delete variable(s) (@ocas/output/var-delete)
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@ocas/output/var-list)
var history <name> [--schema <hash>] Show value history (LRU) (@ocas/output/var-history)
template set <schema-hash> <file> | --inline <text> Set template for schema (@ocas/output/template-set)
template get <schema-hash> Get template content (value=string) (@ocas/output/template-get)
template list List all templates (@ocas/output/template-list)
template delete <schema-hash> Delete template for schema (@ocas/output/template-delete)
gc Run garbage collection (@ocas/output/gc)
Flags:
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--json Compact JSON output
--render, -r Render output inline (equivalent to | ocas render -p)
--schema <hash> Schema hash filter for var get/delete/tag/list
--tag <tag> Tag/label (can be repeated): key:value (tag), name (label), :name (delete)
--inline <text> Inline text content for template set
--resolution <n> Initial resolution for render (default: 1.0)
--decay <n> Decay factor for render (default: 0.5)
--epsilon <n> Cutoff threshold for render (default: 0.01)
--pipe, -p Read from stdin (put/hash: raw JSON payload; render: { type, value } envelope)
Agent: If you have not installed the ocas skill for this version (0.2.0), run \`ocas prompt setup\` and follow the instructions."
`;
exports[`Phase 3: Variable System 3.1 var set creates variable 1`] = `
{
"type": "0Q5EMYK4SYSS9",
@@ -898,6 +750,46 @@ exports[`Phase 3: Variable System 3.10 var delete removes variable 1`] = `
exports[`Phase 3: Variable System 3.11 var get deleted variable returns not found 1`] = `"Error: Variable not found: name=@myapp/config, schema=FRBAB1BF0ZBCS"`;
exports[`Phase 4: Template System > 4.1 template set registers template 1`] = `
{
"type": "BJDHPAE4Q8TXM",
"value": {
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
}
`;
exports[`Phase 4: Template System > 4.2 template get returns template text 1`] = `
{
"type": "0B0HBHZGYHR84",
"value": "Name: {{ payload.name }}, Age: {{ payload.age }}",
}
`;
exports[`Phase 4: Template System > 4.3 template list shows registered templates 1`] = `
{
"type": "8917JQTD1R5JF",
"value": [
{
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
],
}
`;
exports[`Phase 4: Template System > 4.4 template delete removes template 1`] = `
{
"type": "BY7BGZJND3N7R",
"value": {
"deleted": true,
},
}
`;
exports[`Phase 4: Template System > 4.5 template get deleted template returns not found 1`] = `"Error: Template not found for schema: FRBAB1BF0ZBCS"`;
exports[`Phase 4: Template System 4.1 template set registers template 1`] = `
{
"type": "BJDHPAE4Q8TXM",
@@ -937,3 +829,111 @@ exports[`Phase 4: Template System 4.4 template delete removes template 1`] = `
`;
exports[`Phase 4: Template System 4.5 template get deleted template returns not found 1`] = `"Error: Template not found for schema: FRBAB1BF0ZBCS"`;
exports[`Phase 7: Edge Cases > 7.1 get non-existent hash errors gracefully 1`] = `"Node not found: AAAAAAAAAAAAA"`;
exports[`Phase 7: Edge Cases > 7.3 var set empty name errors 1`] = `"Usage: ocas var set <name> <hash> [--tag <tag>...]"`;
exports[`Phase 7: Edge Cases > 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Name must follow @scope/name format (e.g. @myapp/config)"`;
exports[`Phase 7: Edge Cases > 7.5 no subcommand shows help text 1`] = `
"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
\`render -p\` to render its value (ocas_ref hashes are expanded).
Commands:
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@ocas/output/put)
get <hash> Print node as envelope (@ocas/output/get)
has <hash> Print envelope (value=boolean) (@ocas/output/has)
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@ocas/output/verify)
refs <hash> List direct ocas_ref edges (@ocas/output/refs)
walk <hash> [--format tree] Recursive traversal (@ocas/output/walk)
hash <type-hash> <file.json|--pipe> Compute hash without storing (@ocas/output/hash)
render <hash> [options] Render node as text with resolution decay (raw output)
render --pipe/-p [options] Render { type, value } from stdin (raw output)
list --type <hash-or-name> [--tag <tag>...] List hashes for a type, optionally filtered by tags (@ocas/output/list)
list-meta List meta-schema hashes (value=string[]) (@ocas/output/list-meta)
list-schema List all schema hashes (value=string[]) (@ocas/output/list-schema)
tag <target> <tag>... Apply tags/labels to a target (@ocas/output/tag)
untag <target> <tag>... Remove tags/labels from a target (@ocas/output/untag)
var set <name> <hash> [--tag <tag>...] Create/update a variable (@ocas/output/var-set)
var get <name> --schema <hash> Get a variable by name + schema (@ocas/output/var-get)
var delete <name> [--schema <hash>] Delete variable(s) (@ocas/output/var-delete)
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@ocas/output/var-list)
var history <name> [--schema <hash>] Show value history (LRU) (@ocas/output/var-history)
template set <schema-hash> <file> | --inline <text> Set template for schema (@ocas/output/template-set)
template get <schema-hash> Get template content (value=string) (@ocas/output/template-get)
template list List all templates (@ocas/output/template-list)
template delete <schema-hash> Delete template for schema (@ocas/output/template-delete)
gc Run garbage collection (@ocas/output/gc)
Flags:
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--json Compact JSON output
--render, -r Render output inline (equivalent to | ocas render -p)
--schema <hash> Schema hash filter for var get/delete/tag/list
--tag <tag> Tag/label (can be repeated): key:value (tag), name (label), :name (delete)
--inline <text> Inline text content for template set
--resolution <n> Initial resolution for render (default: 1.0)
--decay <n> Decay factor for render (default: 0.5)
--epsilon <n> Cutoff threshold for render (default: 0.01)
--pipe, -p Read from stdin (put/hash: raw JSON payload; render: { type, value } envelope)
Agent: If you have not installed the ocas skill for this version (0.2.0), run \`ocas prompt setup\` and follow the instructions."
`;
exports[`Phase 7: Edge Cases 7.1 get non-existent hash errors gracefully 1`] = `"Node not found: AAAAAAAAAAAAA"`;
exports[`Phase 7: Edge Cases 7.3 var set empty name errors 1`] = `"Usage: ocas var set <name> <hash> [--tag <tag>...]"`;
exports[`Phase 7: Edge Cases 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Name must follow @scope/name format (e.g. @myapp/config)"`;
exports[`Phase 7: Edge Cases 7.5 no subcommand shows help text 1`] = `
"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
\`render -p\` to render its value (ocas_ref hashes are expanded).
Commands:
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@ocas/output/put)
get <hash> Print node as envelope (@ocas/output/get)
has <hash> Print envelope (value=boolean) (@ocas/output/has)
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@ocas/output/verify)
refs <hash> List direct ocas_ref edges (@ocas/output/refs)
walk <hash> [--format tree] Recursive traversal (@ocas/output/walk)
hash <type-hash> <file.json|--pipe> Compute hash without storing (@ocas/output/hash)
render <hash> [options] Render node as text with resolution decay (raw output)
render --pipe/-p [options] Render { type, value } from stdin (raw output)
list --type <hash-or-name> [--tag <tag>...] List hashes for a type, optionally filtered by tags (@ocas/output/list)
list-meta List meta-schema hashes (value=string[]) (@ocas/output/list-meta)
list-schema List all schema hashes (value=string[]) (@ocas/output/list-schema)
tag <target> <tag>... Apply tags/labels to a target (@ocas/output/tag)
untag <target> <tag>... Remove tags/labels from a target (@ocas/output/untag)
var set <name> <hash> [--tag <tag>...] Create/update a variable (@ocas/output/var-set)
var get <name> --schema <hash> Get a variable by name + schema (@ocas/output/var-get)
var delete <name> [--schema <hash>] Delete variable(s) (@ocas/output/var-delete)
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@ocas/output/var-list)
var history <name> [--schema <hash>] Show value history (LRU) (@ocas/output/var-history)
template set <schema-hash> <file> | --inline <text> Set template for schema (@ocas/output/template-set)
template get <schema-hash> Get template content (value=string) (@ocas/output/template-get)
template list List all templates (@ocas/output/template-list)
template delete <schema-hash> Delete template for schema (@ocas/output/template-delete)
gc Run garbage collection (@ocas/output/gc)
Flags:
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
--json Compact JSON output
--render, -r Render output inline (equivalent to | ocas render -p)
--schema <hash> Schema hash filter for var get/delete/tag/list
--tag <tag> Tag/label (can be repeated): key:value (tag), name (label), :name (delete)
--inline <text> Inline text content for template set
--resolution <n> Initial resolution for render (default: 1.0)
--decay <n> Decay factor for render (default: 0.5)
--epsilon <n> Cutoff threshold for render (default: 0.01)
--pipe, -p Read from stdin (put/hash: raw JSON payload; render: { type, value } envelope)
Agent: If you have not installed the ocas skill for this version (0.2.0), run \`ocas prompt setup\` and follow the instructions."
`;
+3 -2
View File
@@ -17,7 +17,7 @@ beforeEach(() => {
`ocas-cli-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
@@ -35,7 +35,8 @@ afterEach(() => {
/**
* Run CLI command and return stdout, stderr, and exit code
*/
function runCliAlias(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCliAlias(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+7 -4
View File
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { envValue, stripVolatile } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
const pkgPath = resolve(import.meta.dirname, "../package.json");
// --- ocas command alias tests (from cli.test.ts) ---
@@ -39,7 +39,8 @@ describe("Phase 7: Edge Cases", () => {
let typeHash: string;
let nodeHash: string;
function runCli(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
@@ -147,7 +148,8 @@ describe("Phase 3: Variable System", () => {
let typeHash: string;
let nodeHash: string;
function runCli(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
@@ -336,7 +338,8 @@ describe("Phase 4: Template System", () => {
let tmpStore: string;
let typeHash: string;
function runCli(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { envValue } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
let tmpStore: string;
let typeHash: string;
@@ -42,7 +42,8 @@ afterAll(() => {
rmSync(tmpStore, { recursive: true, force: true });
});
function runCli(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -17,7 +17,7 @@ beforeEach(() => {
`ocas-get-tag-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
});
@@ -30,7 +30,8 @@ afterEach(() => {
}
});
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+1 -1
View File
@@ -19,7 +19,7 @@ afterEach(() => {
});
async function putString(text: string): Promise<string> {
const entrypoint = join(import.meta.dirname, "../src/index.ts");
const entrypoint = join(import.meta.dirname, "../dist/index.js");
const out = execFileSync("node", [entrypoint, "--home", storePath, "put", "@ocas/string", "--pipe"], {
input: JSON.stringify(text),
encoding: "utf-8",
+3 -2
View File
@@ -14,7 +14,7 @@ beforeEach(() => {
`ocas-list-tag-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
});
@@ -27,7 +27,8 @@ afterEach(() => {
}
});
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { envValue } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
let tmpStore: string;
let typeHash: string;
@@ -44,7 +44,8 @@ afterAll(() => {
rmSync(tmpStore, { recursive: true, force: true });
});
function runCli(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
+1 -1
View File
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { envValue, stripVolatile } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
let tmpStore: string;
let typeHash: string;
+3 -2
View File
@@ -7,7 +7,7 @@ import { bootstrap } from "@ocas/core";
import { openStore as openFsStore } from "@ocas/fs";
import { envValue, putSchemaFile, runCli, runCliWithStdin } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
// --- Standalone render tests from cli.test.ts ---
@@ -58,7 +58,8 @@ describe("Phase 5: Render", () => {
let typeHash: string;
let nodeHash: string;
function runCliE2e(args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCliE2e(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [entrypoint, "--home", tmpStore, ...args], {
encoding: "utf-8",
+1 -1
View File
@@ -560,7 +560,7 @@ describe("Phase 2: Schema Validation", () => {
let typeHash: string;
let _nodeHash: string;
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
beforeAll(async () => {
tmpStore = mkdtempSync(join(tmpdir(), "ocas-e2e-"));
+3 -2
View File
@@ -17,7 +17,7 @@ beforeEach(() => {
`ocas-tag-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
});
@@ -30,7 +30,8 @@ afterEach(() => {
}
});
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -20,7 +20,7 @@ beforeEach(() => {
`ocas-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
@@ -38,7 +38,8 @@ afterEach(() => {
/**
* Run CLI command and return stdout, stderr, and exit code
*/
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -17,7 +17,7 @@ beforeEach(() => {
`ocas-history-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
@@ -31,7 +31,8 @@ afterEach(() => {
}
});
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+3 -2
View File
@@ -20,7 +20,7 @@ beforeEach(() => {
`ocas-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
);
storePath = join(testDir, "store");
cliPath = join(import.meta.dirname, "../src/index.ts");
cliPath = join(import.meta.dirname, "../dist/index.js");
mkdirSync(testDir, { recursive: true });
mkdirSync(storePath, { recursive: true });
@@ -38,7 +38,8 @@ afterEach(() => {
/**
* Run CLI command and return stdout, stderr, and exit code
*/
function runCli(...args: string[]): { stdout: string; stderr: string; exitCode: number } {
function runCli(...rawArgs: (string | string[])[]): { stdout: string; stderr: string; exitCode: number } {
const args = rawArgs.flat();
try {
const stdout = execFileSync("node", [cliPath, "--home", storePath, ...args], {
encoding: "utf-8",
+1 -1
View File
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { envValue, stripVolatile } from "./helpers";
const entrypoint = resolve(import.meta.dirname, "../src/index.ts");
const entrypoint = resolve(import.meta.dirname, "../dist/index.js");
let tmpStore: string;
let typeHash: string;