Skip to content

feat: init auto detection of typescript and javascript flag#355

Merged
jaredwray merged 2 commits intomainfrom
feat-init-auto-detection-of-typescript-and-javascript-flag
Mar 13, 2026
Merged

feat: init auto detection of typescript and javascript flag#355
jaredwray merged 2 commits intomainfrom
feat-init-auto-detection-of-typescript-and-javascript-flag

Conversation

@jaredwray
Copy link
Owner

@jaredwray jaredwray commented Mar 13, 2026

Please check if the PR fulfills these requirements

  • Followed the Contributing and Code of Conduct guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feat: init auto detection of typescript and javascript flag

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the docula init command by implementing automatic detection of TypeScript or JavaScript projects. This feature streamlines the initial setup process, allowing Docula to intelligently generate the appropriate configuration file (docula.config.ts or docula.config.mjs) based on the presence of a tsconfig.json. Additionally, a new --javascript flag provides explicit control for users who wish to force a JavaScript configuration, even in a TypeScript project.

Highlights

  • Automatic Configuration Detection: The docula init command now automatically detects whether a project uses TypeScript by checking for a tsconfig.json file, generating docula.config.ts or docula.config.mjs accordingly.
  • New --javascript Flag: A new --javascript flag has been added to the docula init command, allowing users to explicitly force the generation of a JavaScript configuration file (docula.config.mjs), overriding auto-detection.
  • Updated Documentation: All relevant documentation files (cli.md, configuration.md, index.md) have been updated to reflect the new auto-detection behavior and the --javascript flag.
  • Enhanced Test Coverage: New unit tests were added to ensure the correct functionality of TypeScript auto-detection, the --javascript flag, and the override logic.
Changelog
  • site/docs/cli.md
    • Added a new introductory paragraph explaining the auto-detection logic for TypeScript and JavaScript config files.
    • Updated the --typescript flag description to clarify it now forces a TypeScript config.
    • Introduced the new --javascript flag with its description and default value.
    • Revised example commands to reflect auto-detection and the new --javascript flag usage.
    • Updated workflow comments to mention auto-detection.
  • site/docs/configuration.md
    • Rewrote the 'Initializing with TypeScript' section to detail the auto-detection mechanism.
    • Added examples for explicitly forcing TypeScript or JavaScript config files.
    • Clarified that TypeScript config provides full type support.
  • site/docs/index.md
    • Updated the note regarding TypeScript configuration to explain auto-detection and explicit flag usage.
  • src/console.ts
    • Added --javascript flag to the help output message.
    • Included javascript property in DoculaConsoleArguments type definition.
    • Initialized javascript argument to false in DoculaConsole constructor.
    • Added parsing logic for the --javascript command-line argument.
  • src/docula.ts
    • Implemented a detectTypeScript method to check for the existence of tsconfig.json.
    • Modified the init command logic to incorporate auto-detection of TypeScript if neither --typescript nor --javascript flags are explicitly set.
    • Updated the generateInit call to use the determined useTypeScript value.
  • test/console.test.ts
    • Adjusted the expected number of help messages due to the addition of the --javascript flag.
  • test/docula.test.ts
    • Renamed an existing test case to reflect auto-detection.
    • Modified an existing test to assert the creation of docula.config.ts instead of docula.config.mjs due to auto-detection.
    • Added a new test case to verify initialization with --javascript flag.
    • Added a new test case to confirm correct TypeScript auto-detection when tsconfig.json exists.
    • Added a new test case to ensure the --javascript flag correctly overrides TypeScript auto-detection.
    • Added a new test case to directly test the detectTypeScript method.
Activity
  • No specific review comments or discussions have been recorded yet.
  • The pull request was created by jaredwray.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a724b40) to head (fb4be66).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #355   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines         1574      1589   +15     
  Branches       459       464    +5     
=========================================
+ Hits          1574      1589   +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces auto-detection for TypeScript in docula init, creating a docula.config.ts if a tsconfig.json is found. It also adds a --javascript flag to force a JavaScript config. The changes include updates to the CLI logic, tests, and documentation. My review focuses on improving the argument handling logic for clarity and robustness, and on enhancing test code maintainability by reducing duplication.

@jaredwray jaredwray merged commit 5005b4c into main Mar 13, 2026
9 checks passed
@jaredwray jaredwray deleted the feat-init-auto-detection-of-typescript-and-javascript-flag branch March 13, 2026 20:33
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