Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@inquirer/prompts": "^8.2.1",
"commander": "^14.0.2",
"firecrawl": "4.24.0",
"strip-json-comments": "^5.0.0",

@cubic-dev-ai cubic-dev-ai Bot Jul 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: The added dependency strip-json-comments@^5.0.0 is ESM-only ("type": "module"), but the project compiles TypeScript to CommonJS ("module": "commonjs" in tsconfig.json). At runtime, require('strip-json-comments') will throw ERR_REQUIRE_ESM on any code path that calls stripJsonComments() — such as parsing Claude Code settings.json. Use strip-json-comments@^3.1.1 instead, which is published as CommonJS (no "type": "module") and compatible with the project's current module system.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 77:

<comment>The added dependency strip-json-comments@^5.0.0 is ESM-only ("type": "module"), but the project compiles TypeScript to CommonJS ("module": "commonjs" in tsconfig.json). At runtime, require('strip-json-comments') will throw ERR_REQUIRE_ESM on any code path that calls stripJsonComments() — such as parsing Claude Code settings.json. Use strip-json-comments@^3.1.1 instead, which is published as CommonJS (no "type": "module") and compatible with the project's current module system.</comment>

<file context>
@@ -74,6 +74,7 @@
     "@inquirer/prompts": "^8.2.1",
     "commander": "^14.0.2",
     "firecrawl": "4.24.0",
+    "strip-json-comments": "^5.0.0",
     "yaml": "^2.9.0",
     "zod-to-json-schema": "3.24.6"
</file context>
Fix with cubic

"yaml": "^2.9.0",
"zod-to-json-schema": "3.24.6"
}
Expand Down
9 changes: 2 additions & 7 deletions src/utils/web-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { promises as fs } from 'fs';
import os from 'os';
import path from 'path';
import stripJsonComments from 'strip-json-comments';

const CLAUDE_DENY_TOOLS = ['WebSearch', 'WebFetch'] as const;
const CODEX_WEB_SEARCH_DISABLED = 'web_search = "disabled"';
Expand Down Expand Up @@ -37,12 +38,6 @@ async function writeText(filePath: string, content: string): Promise<void> {
await fs.writeFile(filePath, content, 'utf8');
}

function removeJsonComments(content: string): string {
return content
.replace(/\/\*[\s\S]*?\*\//g, '')
.replace(/(^|[^:\\])\/\/.*$/gm, '$1');
}

async function configureClaudeDefaults(
undo: boolean
): Promise<WebDefaultResult> {
Expand All @@ -52,7 +47,7 @@ async function configureClaudeDefaults(

if (existing && existing.trim()) {
try {
config = JSON.parse(removeJsonComments(existing));
config = JSON.parse(stripJsonComments(existing));
} catch {
return {
agent: 'Claude Code',
Expand Down