chore: remove dead code and unused exports (no behavior change)#1574
Draft
jariy17 wants to merge 1 commit into
Draft
chore: remove dead code and unused exports (no behavior change)#1574jariy17 wants to merge 1 commit into
jariy17 wants to merge 1 commit into
Conversation
Whole-repo over-engineering audit. Removes verified-dead code only —
no CLI command, flag, help text, output, or public API surface changes.
All cuts confirmed zero-caller across src + tests + e2e/integ/browser
suites before removal.
Deletions (whole files, zero importers):
- tui/hooks/useAttach.ts (12 unused hooks)
- tui/hooks/usePanelNavigation.ts (+ test)
- tui/hooks/use-gradient.ts ("kept for future use")
- tui/components/ScrollableText.tsx, TwoColumn.tsx (+ tests, + barrel lines)
- lib/packaging/types/archiver.d.ts (archiver never imported; uses fflate)
- schema/schemas/primitives/index.ts (unreachable re-export barrel)
- cli/cloudformation/types.ts (4 unused exports, + barrel line)
- cli/commands/index.ts (stale unused register* barrel)
Dead exports / members removed:
- operations/session: getSessionId/saveSessionId/clearSessionId/getOrCreateSessionId
- aws/agentcore: stopRuntimeSession (+ types, + barrel + SDK import)
- primitives: PolicyEnginePrimitive.getDeployedGatewayArn, RuntimeEndpoint stub
- lib/constants: HARNESS_DIR, NPM_INSTALL_HINT
- lib/utils/platform: isLinux, getShellCommand, getShellArgs, normalizeCommand (+ test)
- lib/packaging/helpers: runCommand wrapper
- schema harness: HarnessSkillInput
- cdk wrapper: getProjectDir
- tui-harness: session-manager get/listAll, screen formatNumbered, availability.unavailableReason
- dead barrel re-export lines in templates/, external-requirements/, primitives/, commands/add/types
- dropped unused `export` keyword on internal-only helpers (otel transforms, span-collector
executeQuery, feedback build-payload, ab-test resolve)
Stdlib: replace two hand-rolled sleep() helpers with node:timers/promises
setTimeout (dataset/push, insights/run-insights).
Verified: tsc --noEmit (src+tests), eslint (0 errors), npm run build,
npm test (5345 passed).
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
Package TarballHow to installgh release download pr-1574-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.0.tgz |
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.
Summary
Whole-repo over-engineering audit (ponytail-style). Removes only verified-dead code — no CLI command, flag, argument, help text, stdout/stderr output, serialized schema, or public API change. Every cut was grep-confirmed zero-caller across
src/+ unit/e2e/integ/browser tests before removal, then validated by a full build + test run.tsc --noEmit(src + tests) — cleaneslint src/— 0 errors (3 pre-existing warnings in untouched files)npm run build— lib + esbuild bundle + assets all succeednpm test— 5345 passed, 0 failedWhat was removed
Whole files (zero importers):
tui/hooks/useAttach.tstui/hooks/usePanelNavigation.ts(+test)tui/hooks/use-gradient.tstui/components/ScrollableText.tsx,TwoColumn.tsx(+tests)lib/packaging/types/archiver.d.tsarchiver, never imported (zipping usesfflate)schema/schemas/primitives/index.tscli/cloudformation/types.tscli/commands/index.tsregister*barrel nothing importsDead exports / members: unused session-id helpers (
getSessionId/saveSessionId/clearSessionId/getOrCreateSessionId),stopRuntimeSession(+ its types, SDK import, barrel entry),PolicyEnginePrimitive.getDeployedGatewayArn, a dangling stub doc-comment,HARNESS_DIR,NPM_INSTALL_HINT,isLinux,getShellCommand/getShellArgs/normalizeCommand(+ test),runCommandwrapper,HarnessSkillInput,CdkToolkitWrapper.getProjectDir, harnesssession-manager.get/listAll,screen.formatNumbered,availability.unavailableReason,CFN_RESOURCE_IDENTIFIERS,AddDatasetResult, deprecatedAddIdentityOptions, and dead re-export lines intemplates/,external-requirements/,primitives/.Tightened visibility: dropped the unnecessary
exportkeyword on internal-only helpers (oteltransforms, span-collectorexecuteQuery, feedbackbuild-payload, ab-testresolve) — same module-private behavior, smaller public surface.Stdlib: replaced two hand-rolled
sleep()helpers withnode:timers/promisessetTimeout(dataset/push,insights/run-insights).Deliberately NOT included (left for a follow-up / human call)
These showed up in the audit but were excluded to keep this PR 100% safe:
commander,yaml,@aws-cdk/cdk-assets-lib,@aws-sdk/region-config-resolver) — all have zero direct imports, but each is load-bearing:commanderis a peer dep of@commander-js/extra-typings,yaml/cdk-assets-libare transitive of@aws-cdk/toolkit-lib, andregion-config-resolveris a deliberate bundling-crash workaround. Removing any requiresnpm-shrinkwrap.jsonregeneration → out of scope for a no-behavior-change PR.?? defaultProvider()credential-fallback removals — statically unreachable, but it's a security-adjacent path and sibling call sites have tests that mockgetCredentialProvider → undefinedto exercise it. Not worth the risk for ~9 LOC.src/lib+src/schemade-duplication vs@aws/agentcore-cdk— ~6k LOC of vendored copies, but the two have diverged; consolidating needs reconciling two schema sources of truth.Test plan
npm ci && npm run build && npm test→ 5345 passing.