Skip to content
Draft
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
9 changes: 8 additions & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ export default defineBuildConfig({
entries: [
{
type: "bundle",
input: ["./src/index.ts", "./src/cli.ts", "./src/ai.ts", "./src/opencode.ts"],
input: [
"./src/index.ts",
"./src/cli.ts",
"./src/ai.ts",
"./src/opencode.ts",
"./src/claude-code.ts",
"./src/claude-code-hooks.ts",
],
},
],
});
7 changes: 7 additions & 0 deletions claude-code/hooks.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
import { runHookCli } from "obsxa/claude-code-hooks";

runHookCli(process.argv.slice(2)).catch((err) => {
console.error("[obsxa] Hook error:", err);
process.exit(1);
});
9 changes: 9 additions & 0 deletions claude-code/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export { registerTools, startMcpServer } from "../src/claude-code.ts";
export {
handleHookEvent,
handlePostToolUse,
handleSessionStart,
handleStop,
runHookCli,
} from "../src/claude-code-hooks.ts";
export type { HookInput } from "../src/claude-code-hooks.ts";
7 changes: 7 additions & 0 deletions claude-code/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
import { startMcpServer } from "obsxa/claude-code";

startMcpServer(process.argv.slice(2)).catch((err) => {
console.error("[obsxa] Fatal:", err);
process.exit(1);
});
35 changes: 35 additions & 0 deletions claude-code/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "obsxa-claude-code",
"version": "0.0.3",
"description": "Claude Code plugin wrapper package for obsxa (MCP server + hooks)",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/oritwoen/obsxa.git"
},
"bin": {
"obsxa-claude-code": "./index.mjs",
"obsxa-hooks": "./hooks.mjs",
"obsxa-mcp": "./index.mjs"
},
"files": [
"index.mjs",
"hooks.mjs",
"index.d.mts"
],
"type": "module",
"main": "./index.mjs",
"types": "./index.d.mts",
"exports": {
".": {
"types": "./index.d.mts",
"default": "./index.mjs"
},
"./hooks": {
"default": "./hooks.mjs"
}
Comment on lines +15 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Published typings point to files that are not in the tarball.

Per the claude-code/index.d.mts change in this PR, the type barrel re-exports ../src/claude-code.ts and ../src/claude-code-hooks.ts. This package only publishes index.mjs, hooks.mjs, and index.d.mts, so those declaration imports go dead after publish and tsc will fail on first import. Ship local .d.mts files for those modules or rewrite the barrel to only reference files included here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@claude-code/package.json` around lines 15 - 30, The package's published type
entrypoint index.d.mts re-exports ../src/claude-code.ts and
../src/claude-code-hooks.ts which aren't included in the published files,
breaking consumers' tsc; either publish the corresponding .d.mts files for those
modules or rewrite index.d.mts to re-export only the shipped declarations
(index.d.mts) or relative declarations that exist (e.g., create and include
./claude-code.d.mts and ./claude-code-hooks.d.mts), and update package.json
"files" and "exports" entries (index.d.mts, hooks.mjs, any new .d.mts) so the
declared types resolve after publish.

Comment on lines +21 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Don't export the CLI bootstrap as ".".

index.d.mts says this package has named APIs, but index.mjs just starts the MCP server on import and exports nothing. That means import "obsxa-claude-code" has side effects, and import { startMcpServer } from "obsxa-claude-code" cannot work at runtime. Keep the bootstrap in bin only and point "." at a pure re-export module instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@claude-code/package.json` around lines 21 - 30, The package currently maps
the package root (".") to index.mjs which runs the MCP server on import while
index.d.mts declares named exports (e.g., startMcpServer), causing side-effects
and breaking named imports; change the package.json "exports" entry for "." to
point to a pure re-export module (not the bootstrap) that exports the named APIs
declared in index.d.mts, move the side-effectful CLI bootstrap into the bin
entry only (leave the server-starting code in a separate bootstrap file, e.g.,
bin/bootstrap.mjs), and ensure the new root module (e.g., ./index.mjs or
./api.mjs) only re-exports startMcpServer and other named symbols to match
index.d.mts so imports like import { startMcpServer } from "obsxa-claude-code"
work without side effects.

},
"dependencies": {
"obsxa": "0.0.3"
}
}
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"url": "git+https://github.com/oritwoen/obsxa.git"
},
"bin": {
"obsxa": "./dist/cli.mjs"
"obsxa": "./dist/cli.mjs",
"obsxa-hooks": "./dist/claude-code-hooks.mjs",
"obsxa-mcp": "./dist/claude-code.mjs"
},
"files": [
"dist",
Expand All @@ -33,6 +35,14 @@
"./opencode": {
"types": "./dist/opencode.d.mts",
"import": "./dist/opencode.mjs"
},
"./claude-code": {
"types": "./dist/claude-code.d.mts",
"import": "./dist/claude-code.mjs"
},
"./claude-code-hooks": {
"types": "./dist/claude-code-hooks.d.mts",
"import": "./dist/claude-code-hooks.mjs"
}
},
"scripts": {
Expand All @@ -55,6 +65,7 @@
"drizzle-orm": "^0.44.0"
},
"devDependencies": {
"@modelcontextprotocol/sdk": "^1.27.1",
"@opencode-ai/plugin": "1.2.24",
"@types/node": "^25.3.0",
"@typescript/native-preview": "7.0.0-dev.20260310.1",
Expand All @@ -69,11 +80,15 @@
"zod": "^4.3.6"
},
"peerDependencies": {
"@modelcontextprotocol/sdk": ">=1.0.0",
"@opencode-ai/plugin": "*",
"ai": ">=6.0.0",
"zod": ">=4.0.0"
},
"peerDependenciesMeta": {
"@modelcontextprotocol/sdk": {
"optional": true
},
"@opencode-ai/plugin": {
"optional": true
},
Expand Down
Loading
Loading