Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions skills/sync-docs/SKILL.md
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

Check notice on line 4 in skills/sync-docs/SKILL.md

View workflow job for this annotation

GitHub Actions / agnix / agnix

skill uses client-specific field 'version' which is not part of the universal Agent Skills spec [XP-SK-001]
argument-hint: "[report|apply] [--scope=all|recent|before-pr] [--include-undocumented]"

Check notice on line 5 in skills/sync-docs/SKILL.md

View workflow job for this annotation

GitHub Actions / agnix / agnix

skill uses client-specific field 'argument-hint' which is not part of the universal Agent Skills spec [XP-SK-001]
allowed-tools: Bash(git:*), Read, Grep, Glob
---

Expand All @@ -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';
Comment on lines +33 to +34
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 implementation for determining the stateDir is a simplified version of the logic in lib/platform/state-dir.js. It is incorrect as it does not respect the AI_STATE_DIR environment variable, which can lead to inconsistent behavior.

To fix this and avoid code duplication, please use the centralized getStateDir function from lib/platform/state-dir.js.

Suggested change
const stateDir = ['.claude', '.opencode', '.codex']
.find(d => fs.existsSync(path.join(cwd, d))) || '.claude';
const stateDir = require('../../lib/platform/state-dir').getStateDir(cwd);

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
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 catch block is too broad and silently ignores all errors, including failures in file system operations like mkdirSync or writeFileSync. If generating the repo-intel.json file fails after the user has opted in, they should be notified. The comment is also misleading as this block will catch any error within the try block, not just the binary being unavailable.

Suggested change
} catch (e) {
// Binary not available - proceed without
}
} catch (e) {
// The operation to generate repo-intel failed. This can be due to the
// binary not being available or a file system error. Proceeding without.
console.error(`Failed to generate repo-intel: ${e.message}`);
}

}
}
```

**Step 1**: Get changed files (use Bash):
```bash
# Recent changes (default scope)
Expand Down
Loading