@sanurb/ringi 0.1.0 → 0.2.0
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.
- package/dist/{chunk-3JLVANJR.js → chunk-KMYSGMD3.js} +1819 -75
- package/dist/chunk-KMYSGMD3.js.map +1 -0
- package/dist/cli.js +108 -39
- package/dist/cli.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/package.json +10 -83
- package/LICENSE +0 -674
- package/README.md +0 -378
- package/dist/chunk-3JLVANJR.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { ReviewService, TodoService, CommentService, ExportService, GitService, parseDiff, getDiffSummary, ReviewNotFound, TodoNotFound, CoreLive } from './chunk-
|
|
2
|
+
import { ReviewService, TodoService, CommentService, ExportService, GitService, parseDiff, getDiffSummary, ReviewNotFound, TodoNotFound, CoreLive } from './chunk-KMYSGMD3.js';
|
|
3
|
+
import { fork, exec, execFileSync } from 'node:child_process';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
3
6
|
import * as Either from 'effect/Either';
|
|
4
7
|
import { writeFile } from 'node:fs/promises';
|
|
5
|
-
import { resolve } from 'node:path';
|
|
6
8
|
import * as Effect from 'effect/Effect';
|
|
7
9
|
import * as Context from 'effect/Context';
|
|
8
10
|
import * as Layer2 from 'effect/Layer';
|
|
9
11
|
import * as Schema from 'effect/Schema';
|
|
10
12
|
import * as Option from 'effect/Option';
|
|
11
|
-
import { execFileSync } from 'node:child_process';
|
|
12
|
-
import { existsSync } from 'node:fs';
|
|
13
13
|
import * as ConfigProvider from 'effect/ConfigProvider';
|
|
14
14
|
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
15
15
|
|
|
@@ -1305,7 +1305,7 @@ var createCliRuntimeResources = (command, args) => {
|
|
|
1305
1305
|
};
|
|
1306
1306
|
|
|
1307
1307
|
// src/cli/main.ts
|
|
1308
|
-
var CLI_VERSION = "0.
|
|
1308
|
+
var CLI_VERSION = "0.2.0";
|
|
1309
1309
|
var COMMAND_TREE = {
|
|
1310
1310
|
commands: [
|
|
1311
1311
|
{
|
|
@@ -1675,16 +1675,89 @@ var installSignalHandlers = (dispose) => {
|
|
|
1675
1675
|
process.off("SIGTERM", shutdown);
|
|
1676
1676
|
};
|
|
1677
1677
|
};
|
|
1678
|
+
var resolveServerEntry = () => {
|
|
1679
|
+
const candidates = [resolve(process.cwd(), ".output", "server", "index.mjs")];
|
|
1680
|
+
if (import.meta.dirname) {
|
|
1681
|
+
candidates.push(
|
|
1682
|
+
resolve(import.meta.dirname, "..", ".output", "server", "index.mjs")
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
return candidates.find((candidate) => existsSync(candidate));
|
|
1686
|
+
};
|
|
1687
|
+
var runServe = (command) => {
|
|
1688
|
+
const serverEntry = resolveServerEntry();
|
|
1689
|
+
if (!serverEntry) {
|
|
1690
|
+
process.stderr.write(
|
|
1691
|
+
"No built server found. Run 'pnpm build' first, then retry 'ringi serve'.\n"
|
|
1692
|
+
);
|
|
1693
|
+
process.exit(ExitCode.RuntimeFailure);
|
|
1694
|
+
}
|
|
1695
|
+
const env = {
|
|
1696
|
+
...process.env,
|
|
1697
|
+
NITRO_HOST: command.host,
|
|
1698
|
+
NITRO_PORT: String(command.port)
|
|
1699
|
+
};
|
|
1700
|
+
if (command.https && command.cert && command.key) {
|
|
1701
|
+
env.NITRO_SSL_CERT = command.cert;
|
|
1702
|
+
env.NITRO_SSL_KEY = command.key;
|
|
1703
|
+
}
|
|
1704
|
+
const protocol = command.https ? "https" : "http";
|
|
1705
|
+
const url = `${protocol}://${command.host === "0.0.0.0" ? "localhost" : command.host}:${command.port}`;
|
|
1706
|
+
process.stderr.write(`ringi server starting on ${url}
|
|
1707
|
+
`);
|
|
1708
|
+
const child = fork(serverEntry, [], {
|
|
1709
|
+
env,
|
|
1710
|
+
// Clear execArgv so tsx/ts-node loaders from the parent don't interfere
|
|
1711
|
+
// with the built Nitro server (plain ESM).
|
|
1712
|
+
execArgv: [],
|
|
1713
|
+
stdio: "inherit"
|
|
1714
|
+
});
|
|
1715
|
+
if (!command.noOpen) {
|
|
1716
|
+
setTimeout(() => {
|
|
1717
|
+
let openCmd = "xdg-open";
|
|
1718
|
+
if (process.platform === "darwin") {
|
|
1719
|
+
openCmd = "open";
|
|
1720
|
+
} else if (process.platform === "win32") {
|
|
1721
|
+
openCmd = "start";
|
|
1722
|
+
}
|
|
1723
|
+
exec(`${openCmd} ${url}`, () => {
|
|
1724
|
+
});
|
|
1725
|
+
}, 1500);
|
|
1726
|
+
}
|
|
1727
|
+
const shutdown = () => {
|
|
1728
|
+
child.kill("SIGTERM");
|
|
1729
|
+
};
|
|
1730
|
+
process.once("SIGINT", shutdown);
|
|
1731
|
+
process.once("SIGTERM", shutdown);
|
|
1732
|
+
child.on("exit", (code) => {
|
|
1733
|
+
process.off("SIGINT", shutdown);
|
|
1734
|
+
process.off("SIGTERM", shutdown);
|
|
1735
|
+
process.exit(code ?? ExitCode.Success);
|
|
1736
|
+
});
|
|
1737
|
+
};
|
|
1738
|
+
var failAndExit = (opts) => {
|
|
1739
|
+
const normalized = mapFailure(opts.error);
|
|
1740
|
+
if (opts.json) {
|
|
1741
|
+
writeJson(buildErrorEnvelope(opts.cmdStr, normalized));
|
|
1742
|
+
}
|
|
1743
|
+
process.stderr.write(`${normalized.message}
|
|
1744
|
+
`);
|
|
1745
|
+
if (opts.verbose && normalized.verbose) {
|
|
1746
|
+
process.stderr.write(`${normalized.verbose}
|
|
1747
|
+
`);
|
|
1748
|
+
}
|
|
1749
|
+
return process.exit(normalized.exitCode);
|
|
1750
|
+
};
|
|
1678
1751
|
var main = async () => {
|
|
1679
|
-
const
|
|
1752
|
+
const argv = process.argv.slice(2);
|
|
1753
|
+
const parseResult = parseCliArgs(argv);
|
|
1680
1754
|
if (Either.isLeft(parseResult)) {
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
process.exit(normalized.exitCode);
|
|
1755
|
+
return failAndExit({
|
|
1756
|
+
cmdStr: "ringi",
|
|
1757
|
+
error: parseResult.left,
|
|
1758
|
+
json: argv.includes("--json"),
|
|
1759
|
+
verbose: false
|
|
1760
|
+
});
|
|
1688
1761
|
}
|
|
1689
1762
|
const { command, options } = parseResult.right;
|
|
1690
1763
|
if (command.kind === "help") {
|
|
@@ -1703,6 +1776,10 @@ var main = async () => {
|
|
|
1703
1776
|
}
|
|
1704
1777
|
process.exit(ExitCode.Success);
|
|
1705
1778
|
}
|
|
1779
|
+
if (command.kind === "serve") {
|
|
1780
|
+
runServe(command);
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1706
1783
|
const runtimeResources = createCliRuntimeResources(command, {
|
|
1707
1784
|
color: options.color,
|
|
1708
1785
|
dbPath: options.dbPath,
|
|
@@ -1715,13 +1792,12 @@ var main = async () => {
|
|
|
1715
1792
|
}
|
|
1716
1793
|
const cmdStr = commandLabel(command);
|
|
1717
1794
|
if (runtimeResources instanceof CliFailure) {
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
process.exit(normalized.exitCode);
|
|
1795
|
+
return failAndExit({
|
|
1796
|
+
cmdStr,
|
|
1797
|
+
error: runtimeResources,
|
|
1798
|
+
json: options.json,
|
|
1799
|
+
verbose: options.verbose
|
|
1800
|
+
});
|
|
1725
1801
|
}
|
|
1726
1802
|
const removeSignalHandlers = installSignalHandlers(
|
|
1727
1803
|
() => runtimeResources.runtime.dispose()
|
|
@@ -1739,32 +1815,25 @@ var main = async () => {
|
|
|
1739
1815
|
removeSignalHandlers();
|
|
1740
1816
|
process.exit(ExitCode.Success);
|
|
1741
1817
|
} catch (error) {
|
|
1742
|
-
const normalized = mapFailure(error);
|
|
1743
|
-
if (options.json) {
|
|
1744
|
-
writeJson(buildErrorEnvelope(cmdStr, normalized));
|
|
1745
|
-
}
|
|
1746
|
-
process.stderr.write(`${normalized.message}
|
|
1747
|
-
`);
|
|
1748
|
-
if (options.verbose && normalized.verbose) {
|
|
1749
|
-
process.stderr.write(`${normalized.verbose}
|
|
1750
|
-
`);
|
|
1751
|
-
}
|
|
1752
1818
|
await runtimeResources.runtime.dispose();
|
|
1753
1819
|
removeSignalHandlers();
|
|
1754
|
-
|
|
1820
|
+
failAndExit({
|
|
1821
|
+
cmdStr,
|
|
1822
|
+
error,
|
|
1823
|
+
json: options.json,
|
|
1824
|
+
verbose: options.verbose
|
|
1825
|
+
});
|
|
1755
1826
|
}
|
|
1756
1827
|
};
|
|
1757
1828
|
try {
|
|
1758
1829
|
await main();
|
|
1759
1830
|
} catch (error) {
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
`);
|
|
1767
|
-
process.exit(normalized.exitCode);
|
|
1831
|
+
failAndExit({
|
|
1832
|
+
cmdStr: "ringi",
|
|
1833
|
+
error,
|
|
1834
|
+
json: process.argv.slice(2).includes("--json"),
|
|
1835
|
+
verbose: false
|
|
1836
|
+
});
|
|
1768
1837
|
}
|
|
1769
1838
|
//# sourceMappingURL=cli.js.map
|
|
1770
1839
|
//# sourceMappingURL=cli.js.map
|