From 13b12ef50c6b44a22880fb560449da76963cd380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A2=E5=AD=90?= Date: Thu, 4 Jun 2026 00:11:28 +0000 Subject: [PATCH 1/2] fix: resolve prompt files from package root instead of dist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prompts/*.md files are not copied to dist/ during tsc build, causing `ocas prompt setup/usage` to fail with ENOENT. - Change join(__dirname, "prompts") → join(__dirname, "..", "prompts") - Add prompts/ to package.json "files" for npm publishing - Update snapshots (Node.js SQLite ExperimentalWarning + version string) --- packages/cli/package.json | 4 +++ packages/cli/src/index.ts | 4 +-- .../__snapshots__/edge-cases.test.ts.snap | 32 +++++++++++++++---- .../schema-validation.test.ts.snap | 6 +++- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 89b9673..308bbdb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -14,6 +14,10 @@ "bin": { "ocas": "dist/index.js" }, + "files": [ + "dist", + "prompts" + ], "dependencies": { "@ocas/core": "workspace:*", "@ocas/fs": "workspace:*" diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 6108423..385e32c 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1234,7 +1234,7 @@ switch (cmd) { switch (sub) { case "usage": { const content = readFileSync( - join(__dirname, "prompts", "usage.md"), + join(__dirname, "..", "prompts", "usage.md"), "utf-8", ); process.stdout.write(content); @@ -1242,7 +1242,7 @@ switch (cmd) { } case "setup": { const content = readFileSync( - join(__dirname, "prompts", "setup.md"), + join(__dirname, "..", "prompts", "setup.md"), "utf-8", ); process.stdout.write(content); diff --git a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap index 96cb78c..dfed0d3 100644 --- a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap +++ b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap @@ -373,7 +373,11 @@ 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 3: Variable System > 3.11 var get deleted variable returns not found 1`] = ` +"(node:310067) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +Error: Variable not found: name=@myapp/config, schema=FRBAB1BF0ZBCS" +`; exports[`Phase 4: Template System > 4.1 template set registers template 1`] = ` { @@ -413,13 +417,29 @@ 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 4: Template System > 4.5 template get deleted template returns not found 1`] = ` +"(node:310291) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +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.1 get non-existent hash errors gracefully 1`] = ` +"(node:309275) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +Node not found: AAAAAAAAAAAAA" +`; -exports[`Phase 7: Edge Cases > 7.3 var set empty name errors 1`] = `"Usage: ocas var set [--tag ...]"`; +exports[`Phase 7: Edge Cases > 7.3 var set empty name errors 1`] = ` +"(node:309358) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +Usage: ocas var set [--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.4 var set name with invalid chars errors 1`] = ` +"(node:309380) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +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 ] [--json] [args] @@ -466,5 +486,5 @@ Flags: --epsilon 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.3.0), run \`ocas prompt setup\` and follow the instructions." +Agent: If you have not installed the ocas skill for this version (0.3.1), run \`ocas prompt setup\` and follow the instructions." `; diff --git a/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap b/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap index e255fdb..f46b8f5 100644 --- a/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap +++ b/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap @@ -1,3 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Phase 2: Schema Validation > 2.3 put against non-existent schema hash fails 1`] = `"Schema not found: AAAAAAAAAAAAA"`; +exports[`Phase 2: Schema Validation > 2.3 put against non-existent schema hash fails 1`] = ` +"(node:311027) ExperimentalWarning: SQLite is an experimental feature and might change at any time +(Use \`node --trace-warnings ...\` to show where the warning was created) +Schema not found: AAAAAAAAAAAAA" +`; -- 2.43.0 From e4e4ce0f7380ccd4e0e42848a0e6ef68b0745c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A2=E5=AD=90?= Date: Thu, 4 Jun 2026 00:36:38 +0000 Subject: [PATCH 2/2] fix: suppress SQLite ExperimentalWarning in edge-cases and schema-validation tests The local runCli helpers in edge-cases.test.ts (Phase 3/4/7) and raw execFileSync calls in schema-validation.test.ts (tests 2.1, 2.3) were missing NODE_NO_WARNINGS=1, causing ExperimentalWarning to leak into stderr snapshots. Added env override to match what helpers.runCli already does. --- .../__snapshots__/edge-cases.test.ts.snap | 30 ++++--------------- .../schema-validation.test.ts.snap | 6 +--- packages/cli/tests/edge-cases.test.ts | 3 ++ packages/cli/tests/schema-validation.test.ts | 2 ++ 4 files changed, 11 insertions(+), 30 deletions(-) diff --git a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap index dfed0d3..6712568 100644 --- a/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap +++ b/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap @@ -373,11 +373,7 @@ 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`] = ` -"(node:310067) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Error: Variable not found: name=@myapp/config, schema=FRBAB1BF0ZBCS" -`; +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`] = ` { @@ -417,29 +413,13 @@ 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`] = ` -"(node:310291) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Error: Template not found for schema: FRBAB1BF0ZBCS" -`; +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:309275) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Node not found: AAAAAAAAAAAAA" -`; +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`] = ` -"(node:309358) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Usage: ocas var set [--tag ...]" -`; +exports[`Phase 7: Edge Cases > 7.3 var set empty name errors 1`] = `"Usage: ocas var set [--tag ...]"`; -exports[`Phase 7: Edge Cases > 7.4 var set name with invalid chars errors 1`] = ` -"(node:309380) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Error: Invalid variable name "invalid name!": Name must follow @scope/name format (e.g. @myapp/config)" -`; +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 ] [--json] [args] diff --git a/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap b/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap index f46b8f5..e255fdb 100644 --- a/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap +++ b/packages/cli/tests/__snapshots__/schema-validation.test.ts.snap @@ -1,7 +1,3 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Phase 2: Schema Validation > 2.3 put against non-existent schema hash fails 1`] = ` -"(node:311027) ExperimentalWarning: SQLite is an experimental feature and might change at any time -(Use \`node --trace-warnings ...\` to show where the warning was created) -Schema not found: AAAAAAAAAAAAA" -`; +exports[`Phase 2: Schema Validation > 2.3 put against non-existent schema hash fails 1`] = `"Schema not found: AAAAAAAAAAAAA"`; diff --git a/packages/cli/tests/edge-cases.test.ts b/packages/cli/tests/edge-cases.test.ts index f55fd2e..715fdd3 100644 --- a/packages/cli/tests/edge-cases.test.ts +++ b/packages/cli/tests/edge-cases.test.ts @@ -52,6 +52,7 @@ describe("Phase 7: Edge Cases", () => { { encoding: "utf-8", timeout: 10000, + env: { ...process.env, NODE_NO_WARNINGS: "1" }, }, ); return { stdout: stdout.trim(), stderr: "", exitCode: 0 }; @@ -177,6 +178,7 @@ describe("Phase 3: Variable System", () => { { encoding: "utf-8", timeout: 10000, + env: { ...process.env, NODE_NO_WARNINGS: "1" }, }, ); return { stdout: stdout.trim(), stderr: "", exitCode: 0 }; @@ -379,6 +381,7 @@ describe("Phase 4: Template System", () => { { encoding: "utf-8", timeout: 10000, + env: { ...process.env, NODE_NO_WARNINGS: "1" }, }, ); return { stdout: stdout.trim(), stderr: "", exitCode: 0 }; diff --git a/packages/cli/tests/schema-validation.test.ts b/packages/cli/tests/schema-validation.test.ts index 5325f5e..52a8952 100644 --- a/packages/cli/tests/schema-validation.test.ts +++ b/packages/cli/tests/schema-validation.test.ts @@ -610,6 +610,7 @@ describe("Phase 2: Schema Validation", () => { { encoding: "utf-8", timeout: 10000, + env: { ...process.env, NODE_NO_WARNINGS: "1" }, }, ).trim(); } catch (e: unknown) { @@ -635,6 +636,7 @@ describe("Phase 2: Schema Validation", () => { { encoding: "utf-8", timeout: 10000, + env: { ...process.env, NODE_NO_WARNINGS: "1" }, }, ); } catch (e: unknown) { -- 2.43.0