-
Notifications
You must be signed in to change notification settings - Fork 0
feat: prompt user to generate repo-intel in skill #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,8 @@ | ||||||||||||||||||
| --- | ||||||||||||||||||
| name: sync-docs | ||||||||||||||||||
| description: "Sync documentation with code. Use when user asks to update docs, check docs, fix stale documentation, update changelog, or after code changes." | ||||||||||||||||||
| version: 5.1.0 | ||||||||||||||||||
| argument-hint: "[report|apply] [--scope=all|recent|before-pr] [--include-undocumented]" | ||||||||||||||||||
| allowed-tools: Bash(git:*), Read, Grep, Glob | ||||||||||||||||||
| --- | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -21,6 +21,45 @@ | |||||||||||||||||
|
|
||||||||||||||||||
| ## Quick Start - Agent Instructions | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Pre-check: Ensure Repo-Intel | ||||||||||||||||||
|
|
||||||||||||||||||
| Before starting analysis, check if the repo-intel map exists: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```javascript | ||||||||||||||||||
| 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'; | ||||||||||||||||||
| const mapFile = path.join(cwd, stateDir, 'repo-intel.json'); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (!fs.existsSync(mapFile)) { | ||||||||||||||||||
| const response = await AskUserQuestion({ | ||||||||||||||||||
| questions: [{ | ||||||||||||||||||
| question: 'Generate repo-intel?', | ||||||||||||||||||
| description: 'No repo-intel map found. Generating one enables doc-drift detection (identifies stale docs by code coupling). Takes ~5 seconds.', | ||||||||||||||||||
| options: [ | ||||||||||||||||||
| { label: 'Yes, generate it', value: 'yes' }, | ||||||||||||||||||
| { label: 'Skip', value: 'no' } | ||||||||||||||||||
| ] | ||||||||||||||||||
| }] | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (response === 'yes' || response?.['Generate repo-intel?'] === 'yes') { | ||||||||||||||||||
| try { | ||||||||||||||||||
| const { binary } = require('@agentsys/lib'); | ||||||||||||||||||
| const output = binary.runAnalyzer(['repo-intel', 'init', cwd]); | ||||||||||||||||||
| const stateDirPath = path.join(cwd, stateDir); | ||||||||||||||||||
| if (!fs.existsSync(stateDirPath)) fs.mkdirSync(stateDirPath, { recursive: true }); | ||||||||||||||||||
| fs.writeFileSync(mapFile, output); | ||||||||||||||||||
| } catch (e) { | ||||||||||||||||||
| // Binary not available - proceed without | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+56
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| **Step 1**: Get changed files (use Bash): | ||||||||||||||||||
| ```bash | ||||||||||||||||||
| # Recent changes (default scope) | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation for determining the
stateDiris a simplified version of the logic inlib/platform/state-dir.js. It is incorrect as it does not respect theAI_STATE_DIRenvironment variable, which can lead to inconsistent behavior.To fix this and avoid code duplication, please use the centralized
getStateDirfunction fromlib/platform/state-dir.js.