oc-codex-multi-auth 6.1.6 → 6.1.8

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 (40) hide show
  1. package/README.md +276 -121
  2. package/config/minimal-opencode.json +2 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/auto-update-checker.d.ts +7 -1
  7. package/dist/lib/auto-update-checker.d.ts.map +1 -1
  8. package/dist/lib/auto-update-checker.js +51 -3
  9. package/dist/lib/auto-update-checker.js.map +1 -1
  10. package/dist/lib/config.d.ts +1 -0
  11. package/dist/lib/config.d.ts.map +1 -1
  12. package/dist/lib/config.js +4 -0
  13. package/dist/lib/config.js.map +1 -1
  14. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  15. package/dist/lib/request/request-transformer.js +7 -2
  16. package/dist/lib/request/request-transformer.js.map +1 -1
  17. package/dist/lib/runtime.d.ts +1 -1
  18. package/dist/lib/runtime.js +1 -1
  19. package/dist/lib/schemas.d.ts +1 -0
  20. package/dist/lib/schemas.d.ts.map +1 -1
  21. package/dist/lib/schemas.js +1 -0
  22. package/dist/lib/schemas.js.map +1 -1
  23. package/dist/lib/tools/codex-export.js +2 -2
  24. package/dist/lib/tools/codex-export.js.map +1 -1
  25. package/dist/lib/tools/codex-help.js +3 -3
  26. package/dist/lib/tools/codex-help.js.map +1 -1
  27. package/dist/lib/tools/codex-remove.js +3 -3
  28. package/dist/lib/tools/codex-remove.js.map +1 -1
  29. package/dist/lib/tools/index.d.ts +8 -14
  30. package/dist/lib/tools/index.d.ts.map +1 -1
  31. package/dist/lib/tools/index.js +4 -6
  32. package/dist/lib/tools/index.js.map +1 -1
  33. package/package.json +2 -2
  34. package/scripts/clean-dist.js +27 -0
  35. package/scripts/install-oc-codex-multi-auth-core.js +19 -1
  36. package/scripts/install-oc-codex-multi-auth.js +15 -3
  37. package/dist/lib/tools/_shared.d.ts +0 -16
  38. package/dist/lib/tools/_shared.d.ts.map +0 -1
  39. package/dist/lib/tools/_shared.js +0 -21
  40. package/dist/lib/tools/_shared.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tool registry — RC-1 Phase 2 (incremental).
2
+ * Tool registry.
3
3
  *
4
4
  * `ToolContext` bundles the plugin-closure state and helpers each
5
5
  * `codex-*` tool needs. The plugin builds a `ToolContext` inside
@@ -7,11 +7,9 @@
7
7
  * tool factory can access closure state (mutable refs, helpers) without
8
8
  * living inside the plugin function body.
9
9
  *
10
- * **Status**: This PR lands the scaffolding plus the first three tool
11
- * extractions (`codex-help`, `codex-next`, `codex-setup`). The remaining
12
- * 15 inline tools in `index.ts` will move into per-file modules in
13
- * follow-up PRs using the same pattern. The factories below reference
14
- * only the already-extracted files to keep the build green.
10
+ * **Status**: all registered `codex-*` tools live in per-tool modules under
11
+ * `lib/tools/`. The plugin entrypoint wires the shared context once and
12
+ * exposes the returned registry on the OpenCode plugin surface.
15
13
  *
16
14
  * See `docs/audits/07-refactoring-plan.md#rc-1` and `lib/tools/AGENTS.md`.
17
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoBH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC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,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACtC,aAAa,EAAE,oBAAoB,CAAC,GAAG,CAAC;QACxC,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC;QACpC,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACtC,iBAAiB,EAAE,wBAAwB,CAAC,GAAG,CAAC;QAChD,cAAc,EAAE,qBAAqB,CAAC,GAAG,CAAC;QAC1C,cAAc,EAAE,qBAAqB,CAAC,GAAG,CAAC;QAC1C,eAAe,EAAE,sBAAsB,CAAC,GAAG,CAAC;QAC5C,cAAc,EAAE,qBAAqB,CAAC,GAAG,CAAC;QAC1C,cAAc,EAAE,qBAAqB,CAAC,GAAG,CAAC;QAC1C,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACtC,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACtC,gBAAgB,EAAE,uBAAuB,CAAC,GAAG,CAAC;KAC9C,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-codex-multi-auth",
3
- "version": "6.1.6",
3
+ "version": "6.1.8",
4
4
  "description": "OpenCode plugin for Codex-first GPT-5 workflows with ChatGPT Plus/Pro OAuth, multi-account rotation, and guided setup",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "url": "https://github.com/ndycode/oc-codex-multi-auth/issues"
45
45
  },
46
46
  "scripts": {
47
- "build": "tsc && node scripts/copy-oauth-success.js",
47
+ "build": "node scripts/clean-dist.js && tsc && node scripts/copy-oauth-success.js",
48
48
  "typecheck": "tsc --noEmit",
49
49
  "lint": "npm run lint:ts && npm run lint:scripts",
50
50
  "lint:ts": "eslint . --ext .ts",
@@ -0,0 +1,27 @@
1
+ import { promises as fs } from "node:fs";
2
+ import { dirname, relative, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ function normalizeRelativePath(path) {
9
+ return path.replaceAll("\\", "/");
10
+ }
11
+
12
+ export async function cleanDist(options = {}) {
13
+ const repoRoot = resolve(options.repoRoot ?? resolve(__dirname, ".."));
14
+ const distDir = resolve(options.distDir ?? resolve(repoRoot, "dist"));
15
+ const relativeDist = normalizeRelativePath(relative(repoRoot, distDir));
16
+
17
+ if (relativeDist !== "dist") {
18
+ throw new Error(`Refusing to clean non-dist path: ${distDir}`);
19
+ }
20
+
21
+ await fs.rm(distDir, { recursive: true, force: true });
22
+ return { distDir };
23
+ }
24
+
25
+ if (process.argv[1] && resolve(process.argv[1]) === __filename) {
26
+ await cleanDist();
27
+ }
@@ -1,4 +1,4 @@
1
- import { existsSync } from "node:fs";
1
+ import { existsSync, realpathSync } from "node:fs";
2
2
  import { copyFile, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { dirname, join, resolve } from "node:path";
@@ -18,6 +18,24 @@ function getManagedPackageNames() {
18
18
  return [PACKAGE_NAME, ...LEGACY_PACKAGE_NAMES];
19
19
  }
20
20
 
21
+ export function normalizePathForCompare(path, resolveRealPath = realpathSync) {
22
+ const resolved = resolve(path);
23
+ try {
24
+ const realPath = resolveRealPath(resolved);
25
+ return process.platform === "win32" ? realPath.toLowerCase() : realPath;
26
+ } catch {
27
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
28
+ }
29
+ }
30
+
31
+ export function isDirectRunPath(argvPath, modulePath, resolveRealPath = realpathSync) {
32
+ if (!argvPath || !modulePath) return false;
33
+ return (
34
+ normalizePathForCompare(argvPath, resolveRealPath) ===
35
+ normalizePathForCompare(modulePath, resolveRealPath)
36
+ );
37
+ }
38
+
21
39
  function printHelp() {
22
40
  console.log(`Usage: ${PACKAGE_NAME} [--modern|--full|--legacy] [--dry-run] [--no-cache-clear]\n\n` +
23
41
  "Default behavior:\n" +
@@ -1,12 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { resolve } from "node:path";
4
3
  import { fileURLToPath } from "node:url";
5
- import { runInstaller } from "./install-oc-codex-multi-auth-core.js";
4
+ import {
5
+ isDirectRunPath as isDirectRunPathCore,
6
+ runInstaller,
7
+ } from "./install-oc-codex-multi-auth-core.js";
6
8
 
7
9
  export * from "./install-oc-codex-multi-auth-core.js";
8
10
 
9
- if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
11
+ const __filename = fileURLToPath(import.meta.url);
12
+
13
+ export function isDirectRunPath(
14
+ argvPath = process.argv[1],
15
+ modulePath = __filename,
16
+ resolveRealPath,
17
+ ) {
18
+ return isDirectRunPathCore(argvPath, modulePath, resolveRealPath);
19
+ }
20
+
21
+ if (isDirectRunPath()) {
10
22
  runInstaller().catch((error) => {
11
23
  const message = error instanceof Error ? error.message : String(error);
12
24
  console.error(`Installer failed: ${message}`);
@@ -1,16 +0,0 @@
1
- /**
2
- * Shared helpers re-exported for codex-* tool modules.
3
- *
4
- * As RC-1 extracts the 18 inline tools from `index.ts` into per-file modules
5
- * under `lib/tools/<name>.ts`, each tool will import its pure, closure-free
6
- * helpers from this barrel. Helpers that depend on the plugin closure
7
- * (e.g. `resolveUiRuntime`, `cachedAccountManager`, `formatCommandAccountLabel`)
8
- * will be threaded through a `ToolContext` factory argument once the full
9
- * split lands.
10
- *
11
- * See `docs/audits/07-refactoring-plan.md#rc-1` and
12
- * `docs/audits/13-phased-roadmap.md` §2.1.
13
- */
14
- export { normalizeToolOutputFormat, renderJsonOutput, type ToolOutputFormat, } from "../runtime.js";
15
- export { formatRoutingValue, formatExplainabilitySummary, serializeSelectionExplainability, type SerializedSelectionExplainability, type RoutingVisibilitySnapshot, type SelectionSnapshot, type RuntimeMetrics, } from "../runtime.js";
16
- //# sourceMappingURL=_shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../../lib/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,gBAAgB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,gCAAgC,EAChC,KAAK,iCAAiC,EACtC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACnB,MAAM,eAAe,CAAC"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Shared helpers re-exported for codex-* tool modules.
3
- *
4
- * As RC-1 extracts the 18 inline tools from `index.ts` into per-file modules
5
- * under `lib/tools/<name>.ts`, each tool will import its pure, closure-free
6
- * helpers from this barrel. Helpers that depend on the plugin closure
7
- * (e.g. `resolveUiRuntime`, `cachedAccountManager`, `formatCommandAccountLabel`)
8
- * will be threaded through a `ToolContext` factory argument once the full
9
- * split lands.
10
- *
11
- * See `docs/audits/07-refactoring-plan.md#rc-1` and
12
- * `docs/audits/13-phased-roadmap.md` §2.1.
13
- */
14
- export { normalizeToolOutputFormat, renderJsonOutput, } from "../runtime.js";
15
- export { formatRoutingValue, formatExplainabilitySummary, serializeSelectionExplainability, } from "../runtime.js";
16
- // Note: `toolOutputFormatSchema` and `toolSensitiveJsonSchema` cannot be
17
- // exported from `lib/runtime.ts` because their Zod return type cannot be
18
- // named without a path into the plugin's bundled zod copy (TS2742). They
19
- // remain inline inside `index.ts`. Per-tool files moved out of `index.ts`
20
- // during the next RC-1 follow-up will receive them via `ToolContext`.
21
- //# sourceMappingURL=_shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../lib/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,yBAAyB,EACzB,gBAAgB,GAEhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,gCAAgC,GAKhC,MAAM,eAAe,CAAC;AAEvB,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE"}