Skip to content

refactor: simplify core modules#784

Merged
jackwener merged 8 commits intomainfrom
refactor/simplify-core-modules
Apr 4, 2026
Merged

refactor: simplify core modules#784
jackwener merged 8 commits intomainfrom
refactor/simplify-core-modules

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Remove root-level shim files: Deleted errors.ts, logger.ts, registry.ts, types.ts, utils.ts, launcher.ts from root. Updated ~840 adapter imports in clis/ to reference src/ directly, eliminating the indirection layer.
  • Consolidate error classification: Unified classifyGenericError to return a ClassifiedError object with icon/exitCode/hint, eliminating duplicated pattern matching between resolveExitCode() and renderError() in commanderAdapter.ts.
  • Simplify cascade probe: Replaced 3 repetitive switch cases in probeEndpoint() with a PROBE_OPTIONS lookup map in cascade.ts.
  • Consolidate interceptor: Reuse shared DISGUISE_FN in tap interceptor instead of a simplified reimplementation in interceptor.ts.
  • Clean up synthesize: Removed deprecated snake_case field aliases (recommended_args, recommended_columns, recommendedColumnsLegacy) and unnecessary constant aliases in synthesize.ts.

Test plan

  • TypeScript type check passes (tsc --noEmit)
  • All 167 unit test files pass (1234 tests)
  • e2e/smoke tests (require browser/network infrastructure)

🤖 Generated with Claude Code

jackwener and others added 8 commits April 5, 2026 03:06
…r classification, streamline cascade/interceptor, clean up synthesize

1. Remove root-level shim files (errors.ts, logger.ts, registry.ts, types.ts, utils.ts, launcher.ts) — update all ~840 adapter imports to reference src/ directly
2. Consolidate interceptor: reuse shared DISGUISE_FN in tap interceptor instead of reimplementing
3. Unify error classification: single ClassifiedError type with icon/exitCode/hint lookup table, eliminating duplicated pattern matching between resolveExitCode and renderError
4. Simplify cascade probe: replace repetitive switch cases with PROBE_OPTIONS lookup map
12. Clean up synthesize.ts: remove deprecated snake_case field aliases (recommended_args, recommended_columns, recommendedColumnsLegacy) and unnecessary constant aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update all documentation and skill files to reference src/ directly,
matching the shim removal in the previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix imports in newly added deep-research adapter files that were
still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests now expect /search_result/<id> for bare note IDs (matching
the note-helpers.ts change from PR #774) and updated empty-shell
hint assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix imports in newly merged LessWrong and hupu/mentions adapter
files that were still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jackwener jackwener merged commit 12176de into main Apr 4, 2026
11 checks passed
@jackwener jackwener deleted the refactor/simplify-core-modules branch April 4, 2026 19:35
Astro-Han added a commit to Astro-Han/opencli that referenced this pull request Apr 5, 2026
Bug 1: version.ts used a single-level parent lookup for package.json,
which broke after jackwener#784 changed rootDir from "src" to "." (version.js
now lives in dist/src/ instead of dist/).  Walk up until package.json
is found — works in both dev (src/) and prod (dist/src/).

Bug 2: adapters copied to ~/.opencli/clis/ import ../../src/registry.js
etc., which resolves to ~/.opencli/src/.  Derive src/ compat shims from
the existing rootShims list so these imports resolve correctly.
jackwener pushed a commit that referenced this pull request Apr 5, 2026
Bug 1: version.ts used a single-level parent lookup for package.json,
which broke after #784 changed rootDir from "src" to "." (version.js
now lives in dist/src/ instead of dist/).  Walk up until package.json
is found — works in both dev (src/) and prod (dist/src/).

Bug 2: adapters copied to ~/.opencli/clis/ import ../../src/registry.js
etc., which resolves to ~/.opencli/src/.  Derive src/ compat shims from
the existing rootShims list so these imports resolve correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant