Skip to content

feat: pre-fetch doc-drift in sync-docs command#10

Merged
avifenesh merged 2 commits intomainfrom
feat/command-prefetch-repo-intel
Mar 15, 2026
Merged

feat: pre-fetch doc-drift in sync-docs command#10
avifenesh merged 2 commits intomainfrom
feat/command-prefetch-repo-intel

Conversation

@avifenesh
Copy link
Copy Markdown
Contributor

Pre-fetch doc-drift before spawning sync-docs-agent.

Prompt user when repo-intel.json is missing instead of silently
skipping doc-drift detection.
Queries doc-drift before spawning sync-docs-agent, passes stale
doc paths directly in the agent prompt.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@avifenesh avifenesh merged commit 76682f0 into main Mar 15, 2026
4 checks passed
@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 documentation synchronization process by integrating repo-intel doc-drift analysis. The sync-docs command will now proactively gather information about documentation drift, identifying potentially stale or uncoupled documentation, and pass this context to the synchronization agent. This ensures that the agent has a more informed starting point, leading to more accurate and efficient documentation updates.

Highlights

  • Enhanced sync-docs command: The sync-docs command now pre-fetches repo-intel doc-drift data, providing valuable context to the sync-docs-agent before it begins its operation.
  • Repo-intel map pre-check: A new pre-check has been added to the sync-docs skill to ensure the repo-intel.json map file exists, prompting the user to generate it if it's not found.
Changelog
  • commands/sync-docs.md
    • Introduced a new "Step 2: Pre-fetch repo-intel doc-drift data" section, including JavaScript code to query repo-intel for doc-drift information.
    • Modified the Task call in the agent spawning step to include the repoIntelContext in the agent's input.
    • Renumbered the subsequent steps (Step 2 became Step 3, Step 3 became Step 4, etc.) to accommodate the new step.
  • skills/sync-docs/SKILL.md
    • Added a "Pre-check: Ensure Repo-Intel" section.
    • Implemented JavaScript logic to check for the existence of repo-intel.json.
    • Included an AskUserQuestion prompt to offer generation of the repo-intel map if it's missing, explaining its benefits for doc-drift detection.
    • Added a try-catch block for binary.runAnalyzer to handle cases where the binary might not be available.
Activity
  • No activity has occurred on this pull request yet.
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.

@avifenesh avifenesh deleted the feat/command-prefetch-repo-intel branch March 15, 2026 17:21
Copy link
Copy Markdown
Contributor

@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 a pre-fetch mechanism for 'doc-drift' data, which is a great enhancement for the sync-docs command. The changes look good overall. I've added a few comments with suggestions to improve maintainability by reducing code duplication and magic numbers, and to enhance debuggability by adding logging to error-handling blocks that currently fail silently. These changes should make the code more robust and easier to manage in the long run.

const fs = require('fs');
const path = require('path');
const cwd = process.cwd();
const stateDir = ['.claude', '.opencode', '.codex'].find(d => fs.existsSync(path.join(cwd, d))) || '.claude';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This logic for determining stateDir is duplicated in skills/sync-docs/SKILL.md. To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, consider centralizing this logic. The @agentsys/lib library appears to provide xplat.getStateDir() which could potentially be used here and in other places where this logic is repeated.

const mapFile = path.join(cwd, stateDir, 'repo-intel.json');

if (fs.existsSync(mapFile)) {
const docDrift = JSON.parse(binary.runAnalyzer(['repo-intel', 'query', 'doc-drift', '--top', '20', '--map-file', mapFile, cwd]));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The value '20' is used here as a magic number. For better readability and maintainability, it's recommended to define it as a constant at the top of the script block, e.g., const TOP_N_DOC_DRIFT = '20';, and use this constant here.

repoIntelContext += '\nFull doc-drift data: ' + JSON.stringify(docDrift);
}
}
} catch (e) { /* unavailable */ }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Silently catching and ignoring errors can hide issues and make debugging difficult. While this feature might be opportunistic, logging the error (e.g., using console.warn) would provide valuable diagnostic information without interrupting the application's flow.

Suggested change
} catch (e) { /* unavailable */ }
} catch (e) { console.warn('Failed to pre-fetch repo-intel doc-drift data:', e); }

Comment on lines +33 to +34
const stateDir = ['.claude', '.opencode', '.codex']
.find(d => fs.existsSync(path.join(cwd, d))) || '.claude';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This logic for determining stateDir is duplicated in commands/sync-docs.md. To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, this logic should be centralized. The @agentsys/lib library appears to provide xplat.getStateDir() which could potentially be used. Using a shared utility would require some refactoring here, as the require for @agentsys/lib is currently inside a conditional block.

Comment on lines +56 to +58
} catch (e) {
// Binary not available - proceed without
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Silently catching and ignoring errors can hide issues and make debugging difficult. Even if the binary is unavailable, logging the error (e.g., using console.warn) would provide valuable diagnostic information for developers without interrupting the user's flow.

Suggested change
} catch (e) {
// Binary not available - proceed without
}
} catch (e) {
console.warn('Failed to generate repo-intel map:', e);
// Binary not available or failed to run - proceed without
}

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