refactor: Phase 2 architectural refactor (2A-2E)#41
Merged
digitarald merged 2 commits intomainfrom Mar 5, 2026
Merged
Conversation
Extract shared-core package, modularize large services, add facade tests.
2A: Create @agentrc/core workspace package under packages/core/
- Move all services, utils, config to packages/core/src/
- Configure npm workspaces, TypeScript paths, vitest alias, esbuild alias
- CLI commands import from @agentrc/core; extension resolves via path alias
2B: Fix SDK build-time fragility in vscode-extension/esbuild.mjs
- Add shim guard for @github/copilot-sdk resolution
- Graceful fallback when SDK not installed
2C: Modularize readiness service (1381 LOC → 6 submodules)
- packages/core/src/services/readiness/{types,scoring,checkers,criteria,extras,index}.ts
2D: Modularize analyzer service (1373 LOC → 6 submodules)
- packages/core/src/services/analyzer/{types,apps,areas,config,workspaces,index}.ts
2E: Add facade boundary tests (12 tests)
- Verify @agentrc/core re-exports match original module surface
Verification:
Extract shared-core package, modularize large services, a
tsup externalized @agentrc/core (matched /^[^./]/ regex), causing ERR_MODULE_NOT_FOUND at runtime since workspace exports point to .ts source files. Add noExternal + esbuild alias to inline the package.
There was a problem hiding this comment.
Pull request overview
This PR advances the Phase 2 architectural refactor by introducing a shared @agentrc/core workspace and rewiring the CLI + VS Code extension to consume it, alongside build/test wiring and a Copilot SDK shim for extension bundling stability.
Changes:
- Add
packages/coreworkspace package and shift extension/CLI imports to@agentrc/core/*. - Add an esbuild shim guard for
@github/copilot-sdk’simport.meta.resolveusage in the VS Code extension bundle. - Add facade/boundary tests and update vitest/tsconfig path resolution for the new package layout.
Reviewed changes
Copilot reviewed 63 out of 92 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vscode-extension/tsconfig.json | Updates TS path mapping to @agentrc/core/* for extension typechecking. |
| vscode-extension/src/types.ts | Re-points extension type re-exports to @agentrc/core. |
| vscode-extension/src/services.ts | Re-points extension service facade re-exports to @agentrc/core. |
| vscode-extension/src/progress.ts | Updates ProgressReporter import to @agentrc/core. |
| vscode-extension/esbuild.mjs | Adds guarded Copilot SDK shim + switches esbuild alias to @agentrc/core. |
| vitest.config.ts | Adds Vitest alias for @agentrc/core to core sources. |
| tsconfig.json | Adds TS path mapping for @agentrc/core/* and includes core sources. |
| src/ui/*.tsx | Repoints TUI imports from local services/utils to @agentrc/core. |
| src/services/tests/*.test.ts | Updates tests to import from @agentrc/core and adds facade boundary test. |
| src/commands/*.ts(x) | Repoints CLI commands to use @agentrc/core services/utils. |
| src/cli.ts | Imports defaults from @agentrc/core/config. |
| packages/core/* | Introduces the new core workspace package (services/utils/config, policy + readiness/analyzer refactors). |
| package.json / package-lock.json | Enables npm workspaces and links @agentrc/core locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Technical Debt Phase 2: Architectural Refactor
Extract a shared-core package, modularize oversized services, harden build boundaries, and add facade tests. No breaking changes to command names, flags, or extension command IDs.
Changes
@agentrc/coreworkspace package underpackages/core/— move all services, utils, config; wire npm workspaces, TypeScript paths, vitest alias, esbuild alias@github/copilot-sdkresolution invscode-extension/esbuild.mjstypes,scoring,checkers,criteria,extras,indextypes,apps,areas,config,workspaces,index@agentrc/corere-exports match original module surfaceNew structure
Verification
npm run typecheck- cleannpm run lint- 0 errors, 0 warningsnpm run test- 552/552 passing