nia-opencode 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +25 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -10,10 +10,26 @@ var NIA_CONFIG_PATH = join(OPENCODE_CONFIG_DIR, "nia.json");
10
10
  var AGENTS_MD_PATH = join(OPENCODE_CONFIG_DIR, "AGENTS.md");
11
11
  var PLUGIN_NAME = "nia-opencode@latest";
12
12
  var NIA_AGENTS_INSTRUCTIONS = `
13
+ ---
14
+ name: nia
15
+ description: Use Nia MCP server for external documentation, GitHub repos, package source code, and research. Invoke when needing to index/search remote codebases, fetch library docs, explore packages, or do web research.
16
+ ---
17
+
13
18
  # How to use Nia
14
19
 
15
20
  Nia provides tools for indexing and searching external repositories, research papers, local folders, documentation, packages, and performing AI-powered research. Its primary goal is to reduce hallucinations in LLMs and provide up-to-date context for AI agents.
16
21
 
22
+ ## CRITICAL: Nia-First Workflow
23
+
24
+ **BEFORE using WebFetch or WebSearch, you MUST:**
25
+
26
+ 1. **Check indexed sources first**: \`manage_resource(action='list', query='relevant-keyword')\` - Many sources may already be indexed
27
+ 2. **If source exists**: Use \`search\`, \`nia_grep\`, \`nia_read\`, \`nia_explore\` for targeted queries
28
+ 3. **If source doesn't exist but you know the URL**: Index it with \`index\` tool, then search
29
+ 4. **Only if source unknown**: Use \`nia_research(mode='quick')\` to discover URLs, then index
30
+
31
+ **Why this matters**: Indexed sources provide more accurate, complete context than web fetches. WebFetch returns truncated/summarized content while Nia provides full source code and documentation.
32
+
17
33
  ## Deterministic Workflow
18
34
 
19
35
  1. Check if the source is already indexed using manage_resource (when listing sources, use targeted query to save tokens since users can have multiple sources indexed) or check any nia.md files for already indexed sources.
@@ -24,10 +40,18 @@ Nia provides tools for indexing and searching external repositories, research pa
24
40
 
25
41
  ## Notes
26
42
 
27
- - DO NOT USE WEB RESEARCH TOOLS IF INFORMATION IS INDEXED IN NIA BY USING 'manage_resource' tool.
43
+ - **IMPORTANT**: Always prefer Nia tools over WebFetch/WebSearch. Nia provides full, structured content while web tools give truncated summaries.
28
44
  - If the source isn't indexed, index it. Note that for docs you should always index the root link like docs.stripe.com so it will always scrape all pages.
29
45
  - If you need to index something but don't know the link for that source, use nia_research (quick or deep modes).
30
46
  - Once you use the index tool, do not expect it to finish in 1-3 seconds. Stop your work or do something that will make your work pause for 1-5 minutes until the source is indexed, then run manage_resource again to check its status. You can also prompt the user to wait if needed.
47
+
48
+ ## Pre-WebFetch Checklist
49
+
50
+ Before ANY WebFetch or WebSearch call, verify:
51
+ - [ ] Ran \`manage_resource(action='list', query='...')\` for relevant keywords
52
+ - [ ] Checked nia-sources.md or nia.md files for previously indexed sources
53
+ - [ ] Confirmed no indexed source covers this information
54
+ - [ ] For GitHub/npm/PyPI URLs: These should ALWAYS be indexed, not fetched
31
55
  `;
32
56
  function stripJsoncComments(content) {
33
57
  return content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nia-opencode",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "OpenCode plugin that integrates Nia Knowledge Agent for research and documentation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",