@locusai/cli 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Database } from "bun:sqlite";
2
2
  import { existsSync } from "node:fs";
3
3
  import { writeFile } from "node:fs/promises";
4
- import { join } from "node:path";
4
+ import { join, resolve } from "node:path";
5
5
  import type { ProjectConfig } from "../types.js";
6
6
  import { ensureDir, writeJson } from "../utils.js";
7
7
 
@@ -92,11 +92,31 @@ export async function initializeLocus(config: ProjectConfig) {
92
92
  export async function logMcpConfig(config: ProjectConfig) {
93
93
  const { projectPath, projectName } = config;
94
94
 
95
+ // Detect for bundled vs source mode
96
+ const scriptDir = import.meta.dir;
97
+ const isBundled = scriptDir.endsWith("/bin") || scriptDir.endsWith("\\bin");
98
+
99
+ // In source mode, scriptDir is packages/cli/src/generators
100
+ // In bundled mode, scriptDir is packages/cli/bin
101
+ const locusRoot = isBundled
102
+ ? resolve(scriptDir, "../")
103
+ : resolve(scriptDir, "../../../../");
104
+
105
+ const mcpSourcePath = join(locusRoot, "apps/mcp/src/index.ts");
106
+ const mcpBundledPath = isBundled
107
+ ? join(scriptDir, "mcp.js")
108
+ : join(locusRoot, "packages/cli/bin/mcp.js");
109
+
110
+ const mcpExecPath = existsSync(mcpSourcePath)
111
+ ? mcpSourcePath
112
+ : mcpBundledPath;
113
+
95
114
  const mcpConfig = {
96
115
  mcpServers: {
97
- locus: {
98
- command: "npx",
99
- args: ["@locusai/cli", "mcp", "--project", projectPath],
116
+ [projectName]: {
117
+ command: "bun",
118
+ args: ["run", mcpExecPath, "--project", join(projectPath, ".locus")],
119
+ env: {},
100
120
  },
101
121
  },
102
122
  };
@@ -105,7 +125,7 @@ export async function logMcpConfig(config: ProjectConfig) {
105
125
  console.log("\nNext steps:");
106
126
  console.log(` cd ${projectName}`);
107
127
  console.log(" bun install");
108
- console.log(" npx @locusai/cli dev");
128
+ console.log(" bun run dev");
109
129
  console.log(
110
130
  "\nMCP Configuration (add to your IDE or Claude Desktop config):"
111
131
  );