mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-04-04 19:52:36 +02:00
Restructure into apps/worker, apps/cli, packages/mcp-server with Turborepo task orchestration, pnpm workspaces, Biome linting/formatting, and tsdown CLI bundling. Key changes: - src/ -> apps/worker/src/, cli/ -> apps/cli/, mcp-server/ -> packages/mcp-server/ - prompts/ and configs/ moved into apps/worker/ - npm replaced with pnpm, package-lock.json replaced with pnpm-lock.yaml - Dockerfile updated for pnpm-based builds - CLI logs command rewritten with chokidar for cross-platform reliability - Router health checking added for auto-detected router mode - Centralized path resolution via apps/worker/src/paths.ts
26 lines
627 B
TypeScript
26 lines
627 B
TypeScript
/**
|
|
* Runtime mode detection — local (build from source) vs npx (Docker Hub).
|
|
*
|
|
* The root `./shannon` entry point sets SHANNON_LOCAL=1 before importing.
|
|
* When run via npx, `cli/dist/index.js` is executed directly without it.
|
|
*/
|
|
|
|
export type Mode = 'local' | 'npx';
|
|
|
|
let cachedMode: Mode | undefined;
|
|
|
|
export function getMode(): Mode {
|
|
if (cachedMode !== undefined) return cachedMode;
|
|
|
|
cachedMode = process.env.SHANNON_LOCAL === '1' ? 'local' : 'npx';
|
|
return cachedMode;
|
|
}
|
|
|
|
export function setMode(mode: Mode): void {
|
|
cachedMode = mode;
|
|
}
|
|
|
|
export function isLocal(): boolean {
|
|
return getMode() === 'local';
|
|
}
|