mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-22 07:34:26 +00:00
* feat(server): default to kap-server and remove the v1 server package - kimi server run / kimi web now boot kap-server (agent-core-v2 engine) unconditionally; the KIMI_CODE_EXPERIMENTAL_FLAG gate on the server path is gone (the kimi -p print-mode gate stays) - move the OS service manager (svc: launchd/systemd/schtasks) from packages/server into packages/kap-server and export it there - repoint the CLI server subcommands, tests, and dev scripts at kap-server; relabel the web dev backend presets default/multi - delete packages/server and update workspace bookkeeping (flake.nix, pnpm-lock.yaml, changeset ignore docs, AGENTS.md, agent-core-dev skill) * test(server-e2e): remove scenarios that depend on v1 debug endpoints Scenarios 04-stateless-controls, 10-prompt-queue-steer and 12-send-and-cancel assert through the /api/v1/debug/prompts/* introspection routes, which only the deleted v1 server mounted — kap-server's --debug-endpoints is a documented no-op, so these scenarios can only 404 now. The vitest e2e files using the same surface already skip when it is absent.
70 lines
2.2 KiB
JavaScript
70 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Enforce the VS Code-style service naming convention finalized in
|
|
* Phase 5 of the 2026.06.07 services-alignment plan:
|
|
*
|
|
* - packages/services/src/<domain>/<domain>.ts (+ <domain>Service.ts)
|
|
* - packages/kap-server/src/services/<domain>/<domain>.ts (+ <domain>Service.ts)
|
|
*
|
|
* Domain dirs and service-related .ts files must be camelCase — never
|
|
* kebab-case (no `-` in the name). Anything outside these two roots is
|
|
* ignored (test fixtures, agent-core, etc.).
|
|
*
|
|
* Exit code 0 if clean, 1 with an actionable report otherwise.
|
|
*/
|
|
|
|
import { readdirSync, statSync, existsSync } from "node:fs";
|
|
import { resolve, join, relative } from "node:path";
|
|
|
|
const ROOT = resolve(import.meta.dirname, "..");
|
|
const SERVICES_SRC = join(ROOT, "packages/services/src");
|
|
const SERVER_SERVICES_SRC = join(ROOT, "packages/kap-server/src/services");
|
|
|
|
/** @type {Array<{ kind: string, path: string }>} */
|
|
const violations = [];
|
|
|
|
function isKebab(name) {
|
|
return name.includes("-");
|
|
}
|
|
|
|
function report(kind, absPath) {
|
|
violations.push({ kind, path: relative(ROOT, absPath) });
|
|
}
|
|
|
|
/**
|
|
* Both roots are organised as <domain>/<files>.ts plus a few top-level files
|
|
* (index.ts, module.ts, pinoLoggerService.ts). Flag kebab in dir names and in
|
|
* any .ts file directly under a domain dir.
|
|
*/
|
|
function scanServicesSrc(srcRoot = SERVICES_SRC) {
|
|
if (!existsSync(srcRoot)) return;
|
|
for (const entry of readdirSync(srcRoot)) {
|
|
const abs = join(srcRoot, entry);
|
|
const st = statSync(abs);
|
|
if (st.isDirectory()) {
|
|
if (isKebab(entry)) report("kebab-dir", abs);
|
|
for (const f of readdirSync(abs)) {
|
|
if (!f.endsWith(".ts")) continue;
|
|
if (isKebab(f)) report("kebab-file", join(abs, f));
|
|
}
|
|
} else if (entry.endsWith(".ts") && isKebab(entry)) {
|
|
report("kebab-file", abs);
|
|
}
|
|
}
|
|
}
|
|
|
|
scanServicesSrc();
|
|
scanServicesSrc(SERVER_SERVICES_SRC);
|
|
|
|
if (violations.length > 0) {
|
|
console.error(
|
|
"Service naming violations (no kebab-case allowed for service files/dirs):"
|
|
);
|
|
for (const v of violations) console.error(` [${v.kind}] ${v.path}`);
|
|
console.error(
|
|
"\nRename to camelCase per VS Code convention: <domain>.ts + <domain>Service.ts."
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log("Service naming check passed.");
|