mirror of
https://fastgit.cc/github.com/Yeachan-Heo/oh-my-claudecode
synced 2026-04-21 05:12:30 +08:00
Adds the missing developer/contributor documentation for running OMC from a local checkout, and teaches `omc doctor` to accept `--plugin-dir` in parity with `omc` and `omc setup`. Docs - New CONTRIBUTING.md at repo root covering fork & upstream setup, three linking flows (plugin-dir, marketplace, no-plugin) with a comparison table, suggested shell aliases, rebuilding, tests/lint, and rebasing onto upstream/dev or upstream/main. - New docs/REFERENCE.md "Plugin directory flags" section documenting omc --plugin-dir, claude --plugin-dir (direct), omc setup --plugin-dir-mode, omc doctor --plugin-dir (NEW), OMC_PLUGIN_ROOT env var, and a decision matrix. Also calls out --plugin-dir as the recommended local-dev flow (no plugin cache = hot iteration). - docs/LOCAL_PLUGIN_INSTALL.md: adds a hot-reload caveat for the marketplace flow and a no-marketplace alternative subsection. - docs/GETTING-STARTED.md: one-paragraph "running from a local checkout" callout. - docs/DEVELOPERS.md: 3-line pointer to CONTRIBUTING.md. - README.md and 11 translated READMEs: cross-links to the new REFERENCE section and a Contributing pointer. Translated files carry <!-- TODO(i18n) --> markers for maintainer-driven translation sync. Code - New src/lib/plugin-dir.ts exposing resolvePluginDirArg(), reused by src/cli/launch.ts (refactor, no behavior change) and src/cli/index.ts. - omc doctor and omc doctor conflicts now accept --plugin-dir <path>. A preAction hook on the parent doctor command resolves the path, warns if it overrides a pre-existing OMC_PLUGIN_ROOT, and exits with a red error on empty/whitespace input instead of a raw stack. - New npm run dev:full script running tsc --watch plus all six esbuild bundle steps in watch mode concurrently. scripts/build-*.mjs gained a --watch flag via esbuild.context().watch(). concurrently added as a devDependency. Tests - src/lib/__tests__/plugin-dir.test.ts: 6 unit tests covering absolute, relative, empty, whitespace-only, and ~-non-expansion edge cases. - src/cli/__tests__/doctor-plugin-dir.test.ts: 10 tests including a real Commander parseAsync on `doctor conflicts --plugin-dir /tmp/foo` that would catch silent unwiring of the flag. Constraint: Existing --plugin-dir launcher semantics in launch.ts must not change (plugin-dir-capture tests still pass). Constraint: REFERENCE.md must only gain additions; no existing sections touched. Rejected: Expanding ~ in resolvePluginDirArg | path.resolve() does not and the behavior is now pinned by test + documented instead. Rejected: Translating the 11 localized READMEs in-place | maintainer handles i18n sync post-merge per upstream convention. Confidence: high Scope-risk: moderate Directive: Any new --plugin-dir consumer must import resolvePluginDirArg from src/lib/plugin-dir.ts rather than re-implementing path resolution. Not-tested: dev:full watcher behavior on Windows (concurrently SIGINT forwarding). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
import * as esbuild from 'esbuild';
|
|
import { mkdir } from 'fs/promises';
|
|
|
|
const watchMode = process.argv.includes('--watch');
|
|
const outfile = 'bridge/cli.cjs';
|
|
await mkdir('bridge', { recursive: true });
|
|
|
|
const sharedExternal = [
|
|
'fs', 'fs/promises', 'path', 'os', 'util', 'stream', 'events',
|
|
'buffer', 'crypto', 'http', 'https', 'url',
|
|
'child_process', 'assert', 'module', 'net', 'tls',
|
|
'dns', 'readline', 'tty', 'worker_threads',
|
|
'@ast-grep/napi', 'better-sqlite3',
|
|
// Avoid bundling jsonc-parser's UMD internals
|
|
'jsonc-parser',
|
|
];
|
|
|
|
const cliConfig = {
|
|
entryPoints: ['src/cli/index.ts'],
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node18',
|
|
format: 'cjs',
|
|
outfile,
|
|
// Inject import.meta.url polyfill for CJS format
|
|
banner: {
|
|
js: 'const importMetaUrl = require("url").pathToFileURL(__filename);',
|
|
},
|
|
define: {
|
|
'import.meta.url': 'importMetaUrl',
|
|
},
|
|
external: sharedExternal,
|
|
};
|
|
|
|
const teamOutfile = 'bridge/team.js';
|
|
const teamConfig = {
|
|
entryPoints: ['src/cli/team.ts'],
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node18',
|
|
format: 'esm',
|
|
outfile: teamOutfile,
|
|
external: sharedExternal,
|
|
};
|
|
|
|
if (watchMode) {
|
|
const cliCtx = await esbuild.context(cliConfig);
|
|
const teamCtx = await esbuild.context(teamConfig);
|
|
await Promise.all([cliCtx.watch(), teamCtx.watch()]);
|
|
console.log(`Watching ${outfile} and ${teamOutfile}...`);
|
|
} else {
|
|
await esbuild.build(cliConfig);
|
|
console.log(`Built ${outfile}`);
|
|
await esbuild.build(teamConfig);
|
|
console.log(`Built ${teamOutfile}`);
|
|
}
|