Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .vibe/development-plan-publish-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ if (args.length === 0) {
- [x] Resolve test timeout issues and improve test reliability
- [x] Fix remaining test failures in MCP server and E2E tests
- [x] Update all test configurations from old format (web_sources, local_path) to new sources format
- [x] Fix CLI routing issue - entry point was not properly awaiting imports

### Completed

Expand All @@ -164,6 +165,7 @@ if (args.length === 0) {
- [x] CLI integration tests working with new entry point architecture
- [x] All test failures resolved - MCP server tests (21/21), E2E tests (12/12)
- [x] Full test suite passing (178/178 tests, 100% success rate)
- [x] CLI routing issue fixed - entry point now properly routes to CLI vs MCP server

## Key Decisions

Expand Down
32 changes: 19 additions & 13 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ import { existsSync } from "node:fs";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const args = process.argv.slice(2);
async function main() {
const args = process.argv.slice(2);

if (args.length === 0) {
// No arguments, start MCP server
const isLocal = existsSync(join(__dirname, "../../mcp-server/dist/index.js"));
if (isLocal) {
import("../../mcp-server/dist/index.js");
if (args.length === 0) {
// No arguments, start MCP server
const isLocal = existsSync(
join(__dirname, "../../mcp-server/dist/index.js"),
);
if (isLocal) {
await import("../../mcp-server/dist/index.js");
} else {
// Use string literal to avoid TypeScript resolution issues
const mcpServerModule = "@codemcp/knowledge-mcp-server";
await import(mcpServerModule);
}
} else {
// Use string literal to avoid TypeScript resolution issues
const mcpServerModule = "@codemcp/knowledge-mcp-server";
import(mcpServerModule);
// Any arguments, run CLI
const { runCli } = await import("./cli.js");
runCli();
}
} else {
// Any arguments, run CLI
const { runCli } = await import("./cli.js");
runCli();
}

main().catch(console.error);
Loading