Commit Graph

6 Commits

Author SHA1 Message Date
Enes Gules 1c081df0b6 CTX7-1872: Improve Context7 documentation queries (#2941)
* focus Context7 documentation queries

* narrow documentation query prompt changes

* remove focused from query prompts

* use lookup wording in query prompts

* distinguish documentation lookup from task

* allow live Pi test more time

* add prompt guidance changeset
2026-07-25 06:23:59 +03:00
Enes Gules 33229cb332 docs: enhance query descriptions for clarity and specificity (#2868)
* docs: enhance query descriptions for clarity and specificity

* update all propmts/skills

* format

* address pr review
2026-07-06 15:12:06 +03:00
Enes Akar 1aa3430bf6 feat: remove research mode (#2554)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: enesgules <abdullah.enes.gules@gmail.com>
2026-05-04 20:33:42 +03:00
Enes Akar 17b864f23f expose research mode through MCP and CLI (#2498)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: enesgules <abdullah.enes.gules@gmail.com>
2026-04-24 20:48:05 +03:00
Enes Gules 83228794e4 docs: enhance library name guidelines in CLI and documentation (#2408) 2026-04-06 20:40:00 +03:00
Fahreddin Özcan 4f13168535 feat(setup): install rules alongside skills, update rule/skill content for better trigger rates (#2320)
* refactor(setup): update rule template to be selective with examples

Based on eval benchmarks showing that selective rules with explicit
should/should-not examples achieve 98% recall with 0 false positives,
vs the previous broad rule.

Split RULE_CONTENT into MCP_RULE_CONTENT and CLI_RULE_CONTENT to
support both MCP and CLI setup modes with appropriate tool references.

* feat(setup): install CLI rule alongside skill in ctx7 setup --cli

Previously, CLI setup mode only installed the find-docs skill (66% trigger
rate). Now it also installs a rule file with ctx7 CLI instructions for each
selected agent, matching the MCP setup behavior.

Benchmarks show skill + rule achieves 96-98% trigger rate vs 66% skill-only.

* feat(find-docs): update skill description to improve trigger rate

Replace passive description with pushy version that explicitly names common
libraries and counters Claude's undertriggering tendency.

Eval results: 66% -> 98% clean recall, 72% -> 92% with-context recall.

* chore(setup): remove deprecated RULE_CONTENT export and alwaysApply frontmatter

alwaysApply is not a Claude Code feature (it's Cursor-specific). Claude Code
rules without paths frontmatter load unconditionally by default. Remove the
deprecated alias now that all callers use MCP_RULE_CONTENT or CLI_RULE_CONTENT.

* refactor(setup): fetch rules from GitHub, add alwaysApply for Cursor

- Rule source of truth in rules/context7-mcp.md and rules/context7-cli.md
- templates.ts fetches from GitHub raw (master then main)
- getRuleContent(mode, agent) adds alwaysApply frontmatter for Cursor
- CLI setup now logs rule install failures instead of silently swallowing

* refactor(setup): add Codex agent, remove needsAlwaysApply field, use shared installRule

- Add Codex agent config with AGENTS.md append support
- Remove needsAlwaysApply field (hardcoded cursor check in templates.ts)
- CLI setup uses shared installRule instead of inline CLI_RULE_PATHS
- installRule handles both file-based (Claude/Cursor/OpenCode) and
  append-based (Codex/AGENTS.md) rule installation

* refactor(setup): unify CLI setup with MCP agent picker, group output by agent

- CLI setup now uses the same agent picker as MCP setup (no auto-detection)
- Output grouped by agent instead of repeating find-docs for each path
- Removed unused promptForInstallTargets/getTargetDirs imports

* fix(setup): add branch fallback URL for rule fetch, show error on rule failure

* fix(setup): OpenCode uses AGENTS.md, fix append logic for existing files

- OpenCode rule changed from .opencode/rules/ to AGENTS.md (append type)
  since OpenCode reads AGENTS.md natively, not a rules directory
- Fixed append logic: proper spacing for empty/non-empty files, clean
  idempotent replacement on re-run, preserves existing content

* test(setup): add tests for rule install, MCP config, and AGENTS.md append

* chore(setup): remove unused mergeInstructions and instructionsGlob

* fix: lint formatting, add changeset

* fix(setup): Codex global rule goes to ~/.codex/AGENTS.md

* fix(setup): align CLI output format with MCP output

* feat(setup): add --codex flag for MCP and CLI setup

* docs(rules): align trigger language with skill, use npx ctx7@latest in CLI rule

* docs(rules): prefer ctx7 over web search for library docs

* docs(find-docs): prefer skill over web search in description

* docs(rules): consolidate trigger language, add selection criteria

* docs(rules): add query quality guidance and auth env var to CLI rule

* cleanup

* fix: remove branch URL, add offline fallback matching rule files exactly

* fix(setup): support opencode.jsonc, strip JSON comments, fix detect path

- readJsonConfig now strips // and /* */ comments before parsing (JSONC support)
- resolveMcpPath checks for .jsonc variant when .json is specified
- OpenCode detect paths include both opencode.json and opencode.jsonc
- Fixed OpenCode project path from .opencode.json to opencode.json

* fix(setup): fix JSONC comment stripping to preserve URLs in strings

The regex-based comment stripper was matching // inside string values
(e.g., https:// URLs), corrupting the JSON. Replaced with a character-
level parser that skips string literals before stripping comments.

* fix(setup): Codex uses TOML config.toml, detect .opencode.json variant

- Codex MCP writes to ~/.codex/config.toml using [mcp_servers.context7]
  TOML sections instead of JSON (matches Codex docs and add-mcp tool)
- OpenCode detection checks opencode.json, opencode.jsonc, and .opencode.json
- Added TOML server block writer with idempotent append
- stripJsonComments now handles URLs in strings correctly

* test(setup): add JSONC, TOML, and resolveMcpPath tests

12 new tests covering:
- JSONC: comment stripping preserves URLs, block comments, plain JSON
- resolveMcpPath: .jsonc resolution, .json fallback, non-json passthrough
- TOML: buildTomlServerBlock output, http_headers, readTomlServerExists,
  appendTomlServer (empty file, preserve existing, idempotent)

* fix(setup): Codex MCP needs type=http, fix checkbox disabled item selection

- Codex TOML entry now includes type = "http" (required by Codex)
- Checkbox cursor starts on first non-disabled item
- Checkbox navigation skips disabled items

* fix: address PR review feedback on rules and skill description

- Surface libraryId format (/org/project) in step 2 where selection happens
- Suggest retrying with alternate names/queries instead of just punctuation
- MCP rule: explicitly require resolve-library-id unless /org/repo provided
- Skill description: explicitly warn against relying on training data for APIs

* fix: consistent /org/project format in MCP rule

* fix: revert opencode detection paths to original
2026-03-27 11:47:08 +03:00