diff --git a/apps/kimi-code/scripts/dev.mjs b/apps/kimi-code/scripts/dev.mjs index 1e9ca8c3f..3f50b969c 100644 --- a/apps/kimi-code/scripts/dev.mjs +++ b/apps/kimi-code/scripts/dev.mjs @@ -2,13 +2,16 @@ import { spawn } from 'node:child_process'; import { createRequire } from 'node:module'; import { dirname, resolve } from 'node:path'; -import { fileURLToPath } from 'node:url'; +import { fileURLToPath, pathToFileURL } from 'node:url'; import { startPluginMarketplaceServer } from './dev-plugin-marketplace-server.mjs'; const require = createRequire(import.meta.url); const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)); const APP_ROOT = resolve(SCRIPT_DIR, '..'); +// Monorepo root. Used as the dev CLI's working directory so `make dev` opens +// the whole repo instead of just apps/kimi-code. +const REPO_ROOT = resolve(APP_ROOT, '../..'); // Runtime variable the CLI reads to locate the marketplace JSON. const MARKETPLACE_ENV = 'KIMI_CODE_PLUGIN_MARKETPLACE_URL'; // Opt-in for dev: point this run at an external marketplace instead of a local one. @@ -48,14 +51,14 @@ const child = spawn( // esbuild transform sees `experimentalDecorators: true` for DI parameter // decorators in agent-core. Mirrors `dev:server` in package.json. '--tsconfig', - './tsconfig.dev.json', + resolve(APP_ROOT, 'tsconfig.dev.json'), '--import', - '../../build/register-raw-text-loader.mjs', - './src/main.ts', + pathToFileURL(resolve(REPO_ROOT, 'build/register-raw-text-loader.mjs')).href, + resolve(APP_ROOT, 'src/main.ts'), ...cliArgs, ], { - cwd: APP_ROOT, + cwd: REPO_ROOT, env, stdio: 'inherit', },