Skip to content

ci: setup#3

Merged
thiagozf merged 3 commits into
mainfrom
ci-setup
Jul 23, 2025
Merged

ci: setup#3
thiagozf merged 3 commits into
mainfrom
ci-setup

Conversation

@thiagozf
Copy link
Copy Markdown
Contributor

@thiagozf thiagozf commented Jul 23, 2025

Add CI/CD workflows

Overview

Adds GitHub Actions workflows for automated testing, building, and publishing.

Workflows Added

Build (.github/workflows/build.yml)

  • Triggers on pushes to main and pull requests
  • Runs linting, tests, and builds the project

Release (.github/workflows/release.yml)

  • Triggers on GitHub releases
  • Automatically publishes to npm with correct version from git tag
  • Supports both stable releases and prereleases (published with canary tag)
  • Updates package.json version to match release tag

Summary by CodeRabbit

  • Chores

    • Added automated build and release workflows for continuous integration and package publishing.
    • Updated ignore patterns and configuration files for improved compatibility and clarity.
    • Standardized Node.js import statements across the codebase.
    • Adjusted formatting in migration metadata and configuration files.
    • Added a mock OpenAI API key for testing environments.
  • New Features

    • Introduced a lint script for code quality checks.
  • Refactor

    • Streamlined and clarified function signatures and parameter handling in command and handler logic.
    • Improved type safety and default generic types in command interfaces.
  • Style

    • Removed unnecessary trailing commas and improved code formatting.
  • Tests

    • Updated test mocks to align with revised function signatures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 23, 2025

Walkthrough

This update introduces two new GitHub Actions workflows for build and release automation, adjusts ignore and configuration files, and refactors several TypeScript modules for improved type safety, clarity, and modern Node.js import conventions. Minor formatting and script enhancements are also included, along with small test and migration metadata adjustments.

Changes

File(s) Change Summary
.github/workflows/build.yaml, .github/workflows/release.yaml Added CI/CD workflows for build (on push/PR) and release (on release event) using Bun and GitHub Actions.
.gitignore Changed dist to dist/ to explicitly ignore the directory.
biome.json Added "includes" array to specify included/excluded files for processing.
migrations/meta/0000_snapshot.json, migrations/meta/0001_snapshot.json Reformatted foreign key array syntax to single-line; added trailing newline.
migrations/meta/_journal.json Added trailing newline.
package.json Downgraded version to "0.0.0"; added "lint" script.
src/types/index.d.ts Changed default generic for Command from {} to never.
src/commands/list.ts Removed explicit generic from Command type annotation.
src/db/migrations.ts, src/utils/package.ts, src/utils/paths.ts, src/db/settings.ts Updated Node.js core module imports to use node: prefix; minor error handling tweaks in settings.ts.
src/handlers/get.ts Refactored for improved type safety, parameter destructuring, and streamlined control flow.
src/handlers/get.test.ts Changed mock embed function signature; no change to test logic or returned data.
tsconfig.json Removed trailing commas for stricter JSON compatibility.
.env.test Added OPENAI_API_KEY environment variable for testing.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub
    participant CI_Build
    participant CI_Release

    Developer->>GitHub: Push or PR to main
    GitHub->>CI_Build: Trigger build workflow
    CI_Build->>CI_Build: Checkout code, setup Bun, install, lint, test, build

    Developer->>GitHub: Publish release
    GitHub->>CI_Release: Trigger release workflow
    CI_Release->>CI_Release: Checkout code, setup Bun, install, build, update version, publish
Loading

Estimated code review effort

2 (~15 minutes)

Poem

A bunny hops through code anew,
With workflows set and tests in queue.
Imports tidy, types refined,
Linting scripts and builds aligned.
In every file a gentle trace—
CI/CD in perfect pace!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48e52ce and 6a397dc.

📒 Files selected for processing (1)
  • .github/workflows/release.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/release.yaml

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
biome.json (1)

9-9: Verify the file inclusion patterns are appropriate.

The current pattern "**" includes all files and then excludes specific patterns. Consider being more explicit about which files to include (e.g., ["src/**/*.ts", "src/**/*.js"]) to avoid accidentally processing unexpected file types.

-    "includes": ["**", "!**/*.test.ts", "!tests", "!dist", "!node_modules"],
+    "includes": ["src/**/*.ts", "src/**/*.js", "!**/*.test.ts", "!tests", "!dist", "!node_modules"],
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81f8b0b and 5935f12.

📒 Files selected for processing (17)
  • .github/workflows/build.yaml (1 hunks)
  • .github/workflows/release.yaml (1 hunks)
  • .gitignore (1 hunks)
  • biome.json (1 hunks)
  • migrations/meta/0000_snapshot.json (2 hunks)
  • migrations/meta/0001_snapshot.json (2 hunks)
  • migrations/meta/_journal.json (1 hunks)
  • package.json (2 hunks)
  • src/commands/list.ts (1 hunks)
  • src/db/migrations.ts (1 hunks)
  • src/db/settings.ts (1 hunks)
  • src/handlers/get.test.ts (1 hunks)
  • src/handlers/get.ts (3 hunks)
  • src/types/index.d.ts (1 hunks)
  • src/utils/package.ts (1 hunks)
  • src/utils/paths.ts (1 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
migrations/meta/0000_snapshot.json (1)

Learnt from: thiagozf
PR: #1
File: migrations/meta/_journal.json:2-2
Timestamp: 2025-07-23T15:06:03.860Z
Learning: In Drizzle migration journals (migrations/meta/_journal.json), the top-level "version" field refers to the journal file format version, while the "version" field in individual migration entries refers to the Drizzle migration format version for each migration. These are separate versioning schemes and do not need to match.

migrations/meta/_journal.json (1)

Learnt from: thiagozf
PR: #1
File: migrations/meta/_journal.json:2-2
Timestamp: 2025-07-23T15:06:03.860Z
Learning: In Drizzle migration journals (migrations/meta/_journal.json), the top-level "version" field refers to the journal file format version, while the "version" field in individual migration entries refers to the Drizzle migration format version for each migration. These are separate versioning schemes and do not need to match.

.gitignore (1)

Learnt from: thiagozf
PR: #1
File: .gitignore:5-11
Timestamp: 2025-07-23T15:08:17.446Z
Learning: The user indicated that the .gitignore patterns in their Node.js project represent the de-facto standard, suggesting that official .gitignore templates should be trusted over automated analysis when the user explicitly confirms they are using standard templates.

src/db/settings.ts (1)

Learnt from: thiagozf
PR: #1
File: src/mcp/server.ts:6-7
Timestamp: 2025-07-23T14:52:59.802Z
Learning: The libcontext project targets modern Node.js environments and is comfortable using top-level await for module initialization, even for database operations. Error handling at the module level for database unavailability is not a concern in their deployment context.

src/utils/paths.ts (1)

Learnt from: thiagozf
PR: #1
File: src/mcp/server.ts:6-7
Timestamp: 2025-07-23T14:52:59.802Z
Learning: The libcontext project targets modern Node.js environments and is comfortable using top-level await for module initialization, even for database operations. Error handling at the module level for database unavailability is not a concern in their deployment context.

src/db/migrations.ts (1)

Learnt from: thiagozf
PR: #1
File: src/mcp/server.ts:6-7
Timestamp: 2025-07-23T14:52:59.802Z
Learning: The libcontext project targets modern Node.js environments and is comfortable using top-level await for module initialization, even for database operations. Error handling at the module level for database unavailability is not a concern in their deployment context.

tsconfig.json (1)

Learnt from: thiagozf
PR: #1
File: src/mcp/server.ts:6-7
Timestamp: 2025-07-23T14:52:59.802Z
Learning: The libcontext project targets modern Node.js environments and is comfortable using top-level await for module initialization, even for database operations. Error handling at the module level for database unavailability is not a concern in their deployment context.

migrations/meta/0001_snapshot.json (1)

Learnt from: thiagozf
PR: #1
File: migrations/meta/_journal.json:2-2
Timestamp: 2025-07-23T15:06:03.860Z
Learning: In Drizzle migration journals (migrations/meta/_journal.json), the top-level "version" field refers to the journal file format version, while the "version" field in individual migration entries refers to the Drizzle migration format version for each migration. These are separate versioning schemes and do not need to match.

biome.json (1)

Learnt from: thiagozf
PR: #1
File: .gitignore:5-11
Timestamp: 2025-07-23T15:08:17.446Z
Learning: The user indicated that the .gitignore patterns in their Node.js project represent the de-facto standard, suggesting that official .gitignore templates should be trusted over automated analysis when the user explicitly confirms they are using standard templates.

package.json (1)

Learnt from: thiagozf
PR: #1
File: src/mcp/server.ts:6-7
Timestamp: 2025-07-23T14:52:59.802Z
Learning: The libcontext project targets modern Node.js environments and is comfortable using top-level await for module initialization, even for database operations. Error handling at the module level for database unavailability is not a concern in their deployment context.

🧬 Code Graph Analysis (2)
src/commands/list.ts (2)
src/handlers/list.ts (1)
  • list (3-5)
src/types/index.d.ts (1)
  • Command (3-8)
src/handlers/get.test.ts (1)
src/ai/embed.ts (1)
  • embed (3-14)
🔇 Additional comments (19)
src/types/index.d.ts (1)

3-3: Excellent type safety improvement!

Changing the default generic parameter from {} to never is a great enhancement. The never type more accurately represents commands that don't expect arguments, providing better type safety than the permissive {} type. This prevents accidental usage of argv parameters in commands that shouldn't have them.

src/commands/list.ts (1)

4-4: Perfect coordination with the interface change!

Removing the explicit <{}> generic parameter aligns perfectly with the Command interface change to use never as the default. Since the list command doesn't require any arguments and the handler doesn't reference argv, using the default never type is more appropriate and type-safe.

migrations/meta/_journal.json (1)

20-20: Consistent newline at EOF looks good

Adding a trailing newline meets POSIX conventions and keeps git diff noise low in future edits.

migrations/meta/0000_snapshot.json (1)

157-158: Formatting-only change; no semantic impact

Converting columnsFrom / columnsTo to single-line arrays retains valid JSON and matches the style adopted in other snapshots. Nothing else changed.

Also applies to: 178-178

migrations/meta/0001_snapshot.json (1)

156-158: Cosmetic JSON tidy-up acknowledged

Same single-line array formatting applied here; data integrity untouched.

Also applies to: 178-178

src/db/migrations.ts (1)

1-1: LGTM! Modern Node.js import pattern.

The update to use the explicit node:path prefix follows modern Node.js best practices and improves clarity by distinguishing core modules from npm packages.

src/db/settings.ts (2)

1-1: LGTM! Modern Node.js import pattern.

The update to use the explicit node:fs prefix follows modern Node.js best practices and maintains consistency with other files in this PR.


8-11: Great improvement to error handling!

The changes enhance error handling by:

  • Using a more descriptive variable name (error vs e)
  • Including the actual error object in console.error for better debugging

This provides more detailed error information when directory creation fails.

src/utils/paths.ts (1)

1-3: Excellent standardization of Node.js core module imports!

All three core module imports (os, path, process) have been consistently updated to use the explicit node: prefix. This comprehensive modernization improves code clarity and follows current Node.js best practices.

src/utils/package.ts (1)

1-3: Perfect completion of Node.js core module standardization!

All Node.js core module imports (fs, path, url) have been updated to use the explicit node: prefix, including both default and named imports. This completes the modernization effort seen across all reviewed files and demonstrates consistent application of current Node.js best practices.

tsconfig.json (1)

27-29: Good formatting improvement for JSON compatibility.

Removing trailing commas ensures compatibility with strict JSON parsers that may be used in CI/CD workflows.

package.json (2)

3-3: Version reset aligns with automated release workflow.

Setting version to "0.0.0" is appropriate since the release workflow will automatically update this based on git tags during publishing.


18-18: Good addition of lint script for CI/CD integration.

The new lint script integrates well with the biome configuration and will be used in the automated build workflow.

.gitignore (1)

121-121: Good improvement to explicitly mark dist as a directory.

Changing from dist to dist/ makes it explicit that this is a directory pattern, which is a best practice for .gitignore files and ensures proper exclusion of build artifacts from CI/CD workflows.

.github/workflows/build.yaml (3)

9-11: LGTM: Proper concurrency control setup.

The concurrency configuration correctly prevents duplicate workflow runs on the same branch, which saves CI resources and prevents race conditions.


21-24: LGTM: Efficient caching strategy.

The Bun cache configuration is well-structured, using the lockfile hash as the cache key which ensures cache invalidation when dependencies change.


26-32: LGTM: Logical step sequence.

The workflow steps follow a proper CI sequence: install dependencies with frozen lockfile, run linting, execute tests, and finally build. The --frozen-lockfile flag ensures reproducible builds.

src/handlers/get.ts (2)

19-23: LGTM: Improved type safety.

The intersection type GetOptions & { topic: string } properly ensures that topic is defined when calling the similarity function, preventing potential runtime errors.


39-39: LGTM: Clean destructuring and error handling.

The refactoring improves code readability by:

  • Using parameter destructuring directly in the function signature
  • Using destructured variables in the return message
  • Properly ignoring the unused error variable with _error

Also applies to: 46-46, 59-59

Comment thread .github/workflows/release.yaml
Comment thread src/handlers/get.test.ts
Comment thread src/handlers/get.ts
@thiagozf thiagozf merged commit 64043e5 into main Jul 23, 2025
2 checks passed
@thiagozf thiagozf deleted the ci-setup branch July 23, 2025 18:19
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.

1 participant