Skip to content

Chore/docs#1

Merged
Adjanour merged 3 commits intomasterfrom
chore/docs
Feb 24, 2026
Merged

Chore/docs#1
Adjanour merged 3 commits intomasterfrom
chore/docs

Conversation

@Adjanour
Copy link
Copy Markdown
Contributor

This pull request focuses on improving developer ergonomics and documentation for backend API utilities, as well as making minor enhancements to project scripts. The most significant changes are a thorough documentation pass and refactoring of the apps/backend/src/lib/types.ts module to clarify its exports and usage, plus a small update to database script targets and a new module creation script in package.json.

API utility documentation and ergonomics improvements:

  • Thoroughly documented and clarified all exports in apps/backend/src/lib/types.ts, including API response helpers, HTTP status codes, type-safe route handlers, and wide event logging types, making the file much easier for developers to use and understand. [1] [2] [3] [4]

Project script enhancements:

  • Added a new new-module script to package.json for easier module scaffolding.
  • Updated database-related scripts in package.json to target the @repo/db package instead of the backend app, improving accuracy and maintainability.

Copilot AI review requested due to automatic review settings February 24, 2026 14:45
Copy link
Copy Markdown
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 improves developer ergonomics by enhancing documentation and clarifying exports for backend API utility types, and it updates root-level project scripts to better target the database package and streamline module scaffolding.

Changes:

  • Expanded/clarified inline documentation and export intent in apps/backend/src/lib/types.ts (API response helpers, OpenAPI helpers, and wide-event logging types).
  • Updated root db:* scripts to run against @repo/db instead of the backend app.
  • Added an additional root script name for module scaffolding.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
package.json Adds a module scaffolding script and retargets database scripts to @repo/db.
apps/backend/src/lib/types.ts Documentation pass and clearer structure around API helpers, handler typing, and wide-event types/utilities.
Comments suppressed due to low confidence (1)

apps/backend/src/lib/types.ts:217

  • addToEvent uses Object.assign, which performs a shallow merge. For nested objects like user or error, subsequent calls will overwrite the entire nested object rather than merging fields. Consider clarifying in the docstring that merging is shallow (and callers should spread existing nested objects when extending them), or implement a deep-merge strategy if progressive nested enrichment is expected.
/**
 * Merges additional fields into the active wide event.
 *
 * Safe no-op if the wide-event middleware has not initialized
 * an event object for the request.
 *
 * @param c - Hono request context
 * @param fields - Partial event fields to merge
 */
export function addToEvent(
	c: Context<AppEnv>,
	fields: Partial<WideEvent>,
): void {
	const event = c.get("wideEvent");
	if (event) Object.assign(event, fields);
}

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Adjanour Adjanour self-assigned this Feb 24, 2026
@Adjanour Adjanour merged commit 619c153 into master Feb 24, 2026
1 check failed
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