feat(cli): workspace biome.json with noConsole, remove dryRun console.log #107
@@ -21,6 +21,31 @@ reflexes:
|
||||
interval: 10s
|
||||
`;
|
||||
|
||||
const BIOME_JSON = `{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
|
||||
"formatter": {
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 2,
|
||||
"lineWidth": 100
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double",
|
||||
"semicolons": "always"
|
||||
}
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"suspicious": {
|
||||
"noConsole": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const PACKAGE_JSON = `{
|
||||
"name": "my-nerve-workspace",
|
||||
"version": "0.0.1",
|
||||
@@ -32,6 +57,7 @@ const PACKAGE_JSON = `{
|
||||
"drizzle-orm": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "latest",
|
||||
"drizzle-kit": "latest"
|
||||
},
|
||||
"pnpm": {
|
||||
@@ -320,6 +346,7 @@ async function runInitWorkspace(force: boolean): Promise<void> {
|
||||
|
||||
writeFile(join(nerveRoot, "nerve.yaml"), NERVE_YAML);
|
||||
writeFile(join(nerveRoot, "package.json"), PACKAGE_JSON);
|
||||
writeFile(join(nerveRoot, "biome.json"), BIOME_JSON);
|
||||
writeFile(join(nerveRoot, ".gitignore"), GITIGNORE);
|
||||
writeFile(join(nerveRoot, "senses", "cpu-usage", "schema.ts"), CPU_SCHEMA_TS);
|
||||
writeFile(join(nerveRoot, "senses", "cpu-usage", "index.js"), CPU_INDEX_JS);
|
||||
|
||||
@@ -109,7 +109,6 @@ describe("llmExtract", () => {
|
||||
});
|
||||
|
||||
it("dryRun skips fetch and returns an empty stub value", async () => {
|
||||
const logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
const fetchMock = vi.fn();
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
@@ -121,8 +120,6 @@ describe("llmExtract", () => {
|
||||
dryRun: true,
|
||||
});
|
||||
|
||||
logSpy.mockRestore();
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { spawnSafe } from "../spawn-safe.js";
|
||||
|
||||
@@ -38,8 +38,6 @@ describe("spawnSafe", () => {
|
||||
});
|
||||
|
||||
it("dryRun skips spawn and returns a zero-exit stub", async () => {
|
||||
const logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
|
||||
const result = await spawnSafe(process.execPath, ["-e", "process.exit(1)"], {
|
||||
cwd: null,
|
||||
env: null,
|
||||
@@ -47,8 +45,6 @@ describe("spawnSafe", () => {
|
||||
dryRun: true,
|
||||
});
|
||||
|
||||
logSpy.mockRestore();
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) {
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,6 @@ export async function cursorAgent(
|
||||
): Promise<Result<string, SpawnError>> {
|
||||
const dryRun = resolveCursorAgentDryRun(options);
|
||||
if (dryRun) {
|
||||
console.log("[dryRun] cursorAgent:", options.prompt, JSON.stringify(options));
|
||||
return ok("[dryRun] skipped");
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ export async function llmExtract<T>(
|
||||
): Promise<Result<T, LlmError>> {
|
||||
const dryRun = resolveLlmExtractDryRun(options);
|
||||
if (dryRun) {
|
||||
console.log("[dryRun] llmExtract:", options.text, JSON.stringify(options.schema));
|
||||
return ok({} as T);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ export function spawnSafe(
|
||||
): Promise<Result<SpawnResult, SpawnError>> {
|
||||
const dryRun = resolveDryRun(options);
|
||||
if (dryRun) {
|
||||
console.log("[dryRun] spawnSafe:", command, args, JSON.stringify(options));
|
||||
return Promise.resolve(
|
||||
ok({
|
||||
stdout: "[dryRun] skipped",
|
||||
|
||||
Reference in New Issue
Block a user