Skip to content

Conversation

@valuecodes
Copy link
Owner

What

Enhance the overall structure and type safety of the project by clarifying the organization of files and improving code readability. This includes the addition of new lint rules, better error handling, and improved documentation. The refactor also enforces the use of TypeScript path aliases for imports, which simplifies import statements across the codebase.

  • Refactored code for better readability and organization in various modules.

  • Added new lint rules and a Prettier plugin for sorting imports.

  • Enhanced type safety in query methods and improved type definitions.

  • Updated documentation with JSDoc comments for clarity.

  • Introduced .npmrc for package management configuration.

How to test

  • Run pnpm lint to check for linting issues.

  • Execute pnpm typecheck to ensure type safety across the codebase.

  • Run pnpm test to verify that all tests pass.

Expected results include no linting errors, successful type checks, and passing tests.

Security review

  • Secrets / env vars: not changed.

  • Auth / session: not changed.

  • Network / API calls: not changed.

  • Data handling / PII: not changed.

  • Dependencies: added/updated. New dependencies include a Prettier plugin for sorting imports.

No security-impacting changes identified.

  • No new dependencies and no network calls.

  • No env var changes and no auth/session logic touched.

- Add optional row mapping to query methods in NameDatabase
- Update extractedAt type to use z.iso.datetime in Publication type
- Refactor timeout handling for better readability in fetch tools
- Improve type definitions in parseArgs and question-handler utilities
- Add new prettier plugin for sorting imports
- Clean up import statements for better readability
- Improve code organization in various modules
- Add JSDoc comments to classes and methods for better clarity
- Improve error messages in URL validation and fetch operations
- Refactor ESLint rules for stricter type checks and template expressions
- Replace relative imports with absolute paths using path aliases
- Delete unused index.ts file in tools directory
- Add ESLint rule to restrict deep relative imports
- Update AGENTS.md and README.md to prefer path aliases
Copilot AI review requested due to automatic review settings January 24, 2026 10:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the codebase to improve type safety, code organization, and maintainability by introducing stricter linting rules, enforcing TypeScript path aliases, and standardizing code style patterns.

Changes:

  • Added TypeScript path aliases (~tools, ~clients, ~utils) and enforced their use via ESLint
  • Converted all interface declarations to type for consistency
  • Converted all function declarations to arrow functions (const)
  • Added comprehensive JSDoc comments across the codebase
  • Introduced stricter ESLint rules including strictTypeChecked, curly: "all", and func-style: "expression"
  • Added Prettier plugin for automatic import sorting
  • Improved Zod type definitions (z.ZodTypeAnyz.ZodType)
  • Added .npmrc for exact version pinning
  • Updated documentation (README, AGENTS.md) to reflect new conventions

Reviewed changes

Copilot reviewed 45 out of 48 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Added path aliases configuration for ~tools, ~clients, ~utils
vitest.config.ts Added path alias resolution for test environment
prettier.config.ts Added import sorting plugin with custom order configuration
eslint.config.ts Added strict type checking, curly braces, arrow function enforcement, and path alias rules
package.json Added prettier import sorting plugin and lint:fix script
.npmrc Added exact version pinning configuration
src/**/*.ts Converted interfaces to types, functions to arrows, relative imports to aliases, added JSDoc
src/cli/scrape-publications/types/index.ts Updated Zod schemas (contains critical bug with z.iso API)
src/cli/name-explorer/constants.ts Extracted FIRST_DECADE and LAST_DECADE constants
src/tools/index.ts Removed barrel export file in favor of direct imports
README.md, AGENTS.md Updated documentation with path alias conventions
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/cli/scrape-publications/types/index.ts:28

  • The Zod API z.iso.datetime() does not exist. The correct Zod API for datetime validation is z.string().datetime(). The z.iso namespace is not a valid Zod API. This will cause runtime errors when validating Publication objects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

package.json Outdated
"devDependencies": {
"@eslint/compat": "2.0.1",
"@eslint/js": "9.39.2",
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description claims "No new dependencies" under the security review section, but this is incorrect. The PR adds a new devDependency: @ianvs/prettier-plugin-sort-imports version ^4.7.0. While this is a devDependency (not a runtime dependency) and appears to be a legitimate Prettier plugin, the security review statement is inaccurate.

Copilot uses AI. Check for mistakes.
package.json Outdated
"devDependencies": {
"@eslint/compat": "2.0.1",
"@eslint/js": "9.39.2",
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .npmrc configuration specifies save-exact=true and save-prefix= (empty) to enforce exact version pinning without carets or tildes. However, the new dependency @ianvs/prettier-plugin-sort-imports uses ^4.7.0 with a caret prefix. This conflicts with the project's versioning policy. The version should be 4.7.0 without the caret to match the .npmrc configuration.

Suggested change
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
"@ianvs/prettier-plugin-sort-imports": "4.7.0",

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24a8cdada5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.npmrc Outdated
Comment on lines 1 to 2
save-prefix= # Don't use caret (^) or tilde (~) in package versions
save-exact=true # Always save exact versions No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move npmrc comments onto their own lines

When tools like pnpm add or npm install --save read .npmrc, inline comments are not stripped, so the # … text becomes part of the value. That means save-prefix will be set to a literal string containing the comment and save-exact won’t parse as a boolean, which can cause dependency adds to write invalid version strings or ignore the “exact versions” intent. Put comments on separate lines so the values are just save-prefix= and save-exact=true.

Useful? React with 👍 / 👎.

@valuecodes valuecodes merged commit f6a9bd9 into main Jan 24, 2026
4 checks passed
@valuecodes valuecodes deleted the refactor-codebase branch January 24, 2026 11:28
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.

2 participants