codex-link 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // src/index.ts
4
4
  import { watch as watch2 } from "fs";
5
5
  import { join as join4 } from "path";
6
+ import { fileURLToPath } from "url";
6
7
  import { Command } from "commander";
7
8
 
8
9
  // ../shared/src/env.ts
@@ -971,25 +972,32 @@ async function runUnshare(target, apiUrl) {
971
972
  await revokeTrackedSession(target, context);
972
973
  context.logger.log(`Revoked ${target}`);
973
974
  }
974
- var program = new Command();
975
- program.name("cdxl").description("Publish and track Codex chats");
976
- program.command("share").argument("<sessionId>").option("--api-url <url>").action(async (sessionId, options) => {
977
- await runShare(sessionId, options.apiUrl);
978
- });
979
- program.command("track").argument("<sessionId>").option("--api-url <url>").action(async (sessionId, options) => {
980
- await runTrack(sessionId, options.apiUrl);
981
- });
982
- program.command("monitor").option("--api-url <url>").action(async (options) => {
983
- await runMonitor(options.apiUrl);
984
- });
985
- program.command("unshare").argument("<shareOrSessionId>").option("--api-url <url>").action(async (target, options) => {
986
- await runUnshare(target, options.apiUrl);
987
- });
988
- program.parseAsync(process.argv).catch((error) => {
989
- console.error(error);
990
- process.exitCode = 1;
991
- });
975
+ function createProgram() {
976
+ const program = new Command();
977
+ program.name("cdxl").description("Publish and track Codex chats").showHelpAfterError().showSuggestionAfterError();
978
+ program.command("share").description("Create a public share for one Codex session and print its URL.").argument("<sessionId>", "Codex session ID to publish").option("--api-url <url>", "Override the CodexLink API base URL").action(async (sessionId, options) => {
979
+ await runShare(sessionId, options.apiUrl);
980
+ });
981
+ program.command("track").description("Keep one session synced to the same public link as new messages arrive.").argument("<sessionId>", "Codex session ID to track continuously").option("--api-url <url>", "Override the CodexLink API base URL").action(async (sessionId, options) => {
982
+ await runTrack(sessionId, options.apiUrl);
983
+ });
984
+ program.command("monitor").description("Watch for new local Codex sessions and offer to start tracking them.").option("--api-url <url>", "Override the CodexLink API base URL").action(async (options) => {
985
+ await runMonitor(options.apiUrl);
986
+ });
987
+ program.command("unshare").description("Revoke a public share by share ID or by a locally tracked session ID.").argument("<shareOrSessionId>", "Share ID or tracked session ID to revoke").option("--api-url <url>", "Override the CodexLink API base URL").action(async (target, options) => {
988
+ await runUnshare(target, options.apiUrl);
989
+ });
990
+ return program;
991
+ }
992
+ var isMainModule = process.argv[1] === fileURLToPath(import.meta.url);
993
+ if (isMainModule) {
994
+ createProgram().parseAsync(process.argv).catch((error) => {
995
+ console.error(error);
996
+ process.exitCode = 1;
997
+ });
998
+ }
992
999
  export {
1000
+ createProgram,
993
1001
  runMonitor,
994
1002
  runShare,
995
1003
  runTrack,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-link",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "cdxl": "dist/index.js"