Skip to content

refactor: share describeError helper across CLI, hooks, extract, and MCP#94

Open
barry166 wants to merge 1 commit into
agentctxhq:mainfrom
barry166:fix/issue-89-describe-error
Open

refactor: share describeError helper across CLI, hooks, extract, and MCP#94
barry166 wants to merge 1 commit into
agentctxhq:mainfrom
barry166:fix/issue-89-describe-error

Conversation

@barry166

Copy link
Copy Markdown
Contributor

Summary

  • add a shared describeError(error) helper for unknown-error stringification
  • replace the duplicated helper bodies and local ternaries across CLI, hooks, extract, and MCP surfaces
  • add a focused regression test covering both Error and non-Error throwables

Related Issues

Closes #89

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Docs / chore

How Has This Been Tested?

  • npm test --workspace @agentctxhq/agentctx
  • npm run typecheck --workspace @agentctxhq/agentctx
  • npm run build --workspace @agentctxhq/agentctx
  • npm run lint

Disclosure

  • AI-assisted: yes
  • Human reviewed: yes

Checklist

  • My code builds and runs locally without errors
  • I have added or updated tests where applicable
  • I have updated relevant documentation
  • I have read CONTRIBUTING.md and my contribution aligns with its guidelines.

Issue agentctxhq#89 called out repeated unknown-error stringification helpers across hooks, extraction, MCP, and CLI surfaces. This change adds one shared helper, switches the duplicated and inlined call sites to it, and adds a small regression test for Error and non-Error throwables.\n\nConstraint: Keep behavior unchanged while removing the duplicated helper logic\nRejected: Leave remaining inline sites untouched | would keep the same single-purpose duplication inside the issue scope\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Reuse describeError for future unknown-error reporting instead of adding local ternaries\nTested: npm test --workspace @agentctxhq/agentctx; npm run typecheck --workspace @agentctxhq/agentctx; npm run build --workspace @agentctxhq/agentctx; npm run lint\nNot-tested: End-to-end npm package install on a fresh machine
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.

describe(error) error-formatting helper is copy-pasted verbatim across 5+ modules

1 participant