claude-flow-novice 2.18.2 → 2.18.3

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 (106) hide show
  1. package/README.md +106 -712
  2. package/claude-assets/agents/AGENT_LIFECYCLE.md +2 -0
  3. package/claude-assets/agents/SHARED_PROTOCOL.md +64 -0
  4. package/claude-assets/agents/cfn-dev-team/analysts/analyst.md +2 -0
  5. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +2 -0
  6. package/claude-assets/agents/cfn-dev-team/architecture/api-designer-persona.md +2 -0
  7. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +2 -0
  8. package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +2 -0
  9. package/claude-assets/agents/cfn-dev-team/architecture/planner.md +2 -0
  10. package/claude-assets/agents/cfn-dev-team/architecture/system-architect.md +2 -0
  11. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +2 -0
  12. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +2 -0
  13. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +2 -0
  14. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +2 -0
  15. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +2 -0
  16. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +2 -0
  17. package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -0
  18. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +2 -0
  19. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +2 -0
  20. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +2 -0
  21. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +2 -0
  22. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +2 -0
  23. package/claude-assets/agents/cfn-dev-team/developers/database/supabase-specialist.md +2 -0
  24. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +2 -0
  25. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +2 -0
  26. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +2 -0
  27. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +2 -0
  28. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +2 -0
  29. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +2 -0
  30. package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +2 -0
  31. package/claude-assets/agents/cfn-dev-team/documentation/api-documentation.md +2 -0
  32. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +2 -0
  33. package/claude-assets/agents/cfn-dev-team/documentation/specification-agent.md +2 -0
  34. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +2 -0
  35. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +2 -0
  36. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +2 -0
  37. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +2 -0
  38. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +2 -0
  39. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +2 -0
  40. package/claude-assets/agents/cfn-dev-team/reviewers/quality/cyclomatic-complexity-reducer.md +2 -0
  41. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +2 -0
  42. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +2 -0
  43. package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +2 -0
  44. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +2 -0
  45. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +2 -0
  46. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +2 -0
  47. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +2 -0
  48. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +2 -0
  49. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +2 -0
  50. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +2 -0
  51. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +2 -0
  52. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +2 -0
  53. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +2 -0
  54. package/claude-assets/agents/cfn-dev-team/testers/tester.md +2 -0
  55. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +2 -0
  56. package/claude-assets/agents/cfn-dev-team/testers/validation/validation-production-validator.md +2 -0
  57. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +2 -0
  58. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +39 -16
  59. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +2 -0
  60. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +2 -0
  61. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +2 -0
  62. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +2 -0
  63. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +2 -0
  64. package/claude-assets/agents/custom/cfn-docker-expert.md +2 -0
  65. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +2 -0
  66. package/claude-assets/agents/custom/cfn-redis-operations.md +2 -0
  67. package/claude-assets/agents/custom/cfn-system-expert.md +2 -0
  68. package/claude-assets/agents/custom/claude-code-expert.md +2 -0
  69. package/claude-assets/agents/custom/mdap-trigger-specialist.md +2 -0
  70. package/claude-assets/agents/custom/trigger-dev-expert.md +2 -0
  71. package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +2 -0
  72. package/claude-assets/agents/docker-ts-fixer.md +2 -0
  73. package/claude-assets/agents/project-only-agents/npm-package-specialist.md +2 -0
  74. package/claude-assets/skills/cfn-cerebras-mcp/SKILL.md +58 -0
  75. package/claude-assets/skills/cfn-ruvector-codebase-index/.cfn-manifest.json +37 -0
  76. package/claude-assets/skills/cfn-ruvector-codebase-index/check-db.js +8 -0
  77. package/claude-assets/skills/cfn-ruvector-codebase-index/config.json +1 -1
  78. package/claude-assets/skills/cfn-ruvector-codebase-index/data/codebase_index.db +0 -0
  79. package/claude-assets/skills/cfn-ruvector-codebase-index/debug-search.js +19 -0
  80. package/claude-assets/skills/cfn-ruvector-codebase-index/get-embedding-text.js +26 -0
  81. package/claude-assets/skills/cfn-ruvector-codebase-index/index.sh +22 -11
  82. package/claude-assets/skills/cfn-ruvector-codebase-index/search.js +55 -0
  83. package/claude-assets/skills/cfn-ruvector-codebase-index/search.sh +32 -36
  84. package/claude-assets/skills/cfn-ruvector-codebase-index/standalone-indexer.js +129 -0
  85. package/dist/agents/agent-loader.js +165 -146
  86. package/dist/agents/agent-loader.js.map +1 -1
  87. package/dist/index.js +1 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/ruvector/cli.js +62 -0
  90. package/dist/ruvector/cli.js.map +1 -0
  91. package/dist/ruvector/core/file-processor.js +72 -0
  92. package/dist/ruvector/core/file-processor.js.map +1 -0
  93. package/dist/ruvector/core/index.js +133 -0
  94. package/dist/ruvector/core/index.js.map +1 -0
  95. package/dist/ruvector/embeddings/index.js +24 -0
  96. package/dist/ruvector/embeddings/index.js.map +1 -0
  97. package/dist/ruvector/embeddings/openai.js +67 -0
  98. package/dist/ruvector/embeddings/openai.js.map +1 -0
  99. package/dist/ruvector/embeddings/provider.js +12 -0
  100. package/dist/ruvector/embeddings/provider.js.map +1 -0
  101. package/dist/ruvector/index.js +9 -0
  102. package/dist/ruvector/index.js.map +1 -0
  103. package/package.json +13 -5
  104. package/readme/README.md +25 -15
  105. package/scripts/update-agent-protocols.sh +116 -0
  106. package/LICENSE +0 -21
@@ -7,6 +7,8 @@ acl_level: 4
7
7
  capabilities: [agent-design, template-creation, agent-maintenance, validation]
8
8
  ---
9
9
 
10
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
11
+
10
12
  # Agent Builder
11
13
 
12
14
  You are a specialized agent for creating, validating, and designing agent templates and CFN Loop workflows. Your expertise includes agent architecture, template validation, capability mapping, and coordination patterns.
@@ -407,7 +409,9 @@ Before finalizing an agent template, verify:
407
409
 
408
410
  ## Post-Creation Validation
409
411
 
410
- **CRITICAL: After creating or updating any agent file, run agent name validation:**
412
+ **CRITICAL: After creating or updating any agent file, run these validation steps:**
413
+
414
+ ### 1. Agent Name Validation
411
415
 
412
416
  ```bash
413
417
  ./.claude/skills/agent-name-validation/validate-agent-names.sh
@@ -418,27 +422,46 @@ This ensures:
418
422
  - Agent can be discovered by spawning system
419
423
  - Naming consistency across codebase
420
424
 
421
- **Example:**
425
+ **Common Issues:**
426
+ - Filename: `backend-dev.md` but frontmatter: `name: backend-developer` ❌
427
+ - Filename: `backend-developer.md` and frontmatter: `name: backend-developer` ✅
428
+
429
+ See: `.claude/skills/agent-name-validation/SKILL.md` for full documentation
430
+
431
+ ### 2. Shared Protocol Injection
432
+
433
+ **After creating new agents, inject the shared protocol reference:**
434
+
422
435
  ```bash
423
- # After creating new agent
424
- Write: file_path=".claude/agents/cfn-dev-team/developers/api-developer.md"
436
+ # Bulk update all agent files with shared protocol reference
437
+ bash scripts/update-agent-protocols.sh
438
+ ```
425
439
 
426
- # Validate filename matches frontmatter
427
- ./.claude/skills/agent-name-validation/validate-agent-names.sh
440
+ This script:
441
+ - Scans all `.md` files in `.claude/agents/`
442
+ - Inserts protocol reference after YAML frontmatter (if missing)
443
+ - Skips files that already have the reference
444
+ - Reports updated/skipped/errored files
428
445
 
429
- # Check result
430
- if [ $? -eq 0 ]; then
431
- echo "✅ Agent name validation passed"
432
- else
433
- echo "❌ Agent name mismatch detected - review output"
434
- fi
446
+ **What gets added:**
447
+ ```markdown
448
+ **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
435
449
  ```
436
450
 
437
- **Common Issues:**
438
- - Filename: `backend-dev.md` but frontmatter: `name: backend-developer`
439
- - Filename: `backend-developer.md` and frontmatter: `name: backend-developer` ✅
451
+ **Manual insertion (for single files):**
452
+ Add immediately after the closing `---` of frontmatter:
453
+ ```markdown
454
+ ---
455
+ name: my-agent
456
+ ...
457
+ ---
440
458
 
441
- See: `.claude/skills/agent-name-validation/SKILL.md` for full documentation
459
+ **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
460
+
461
+ # Agent Title
462
+ ```
463
+
464
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
442
465
 
443
466
  ---
444
467
 
@@ -11,6 +11,8 @@ capabilities:
11
11
  acl_level: 3
12
12
  ---
13
13
 
14
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
15
+
14
16
  # Context Curator Agent
15
17
 
16
18
  ## Role
@@ -12,6 +12,8 @@ capabilities:
12
12
  acl_level: 3
13
13
  ---
14
14
 
15
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
16
+
15
17
  # Epic Creator Agent
16
18
 
17
19
  You transform high-level product requirements into structured epic configuration JSON files suitable for CFN Loop execution.
@@ -17,6 +17,8 @@ validation_hooks:
17
17
  - test-coverage-validator
18
18
  ---
19
19
 
20
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
21
+
20
22
  <!-- PROVIDER_PARAMETERS
21
23
  provider: zai
22
24
  model: glm-4.6
@@ -8,6 +8,8 @@ validation_hooks:
8
8
  - agent-template-validator
9
9
  ---
10
10
 
11
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
12
+
11
13
  # Researcher Agent
12
14
 
13
15
  ## Core Responsibilities
@@ -16,6 +16,8 @@ validation_hooks:
16
16
  - test-coverage-validator
17
17
  ---
18
18
 
19
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
20
+
19
21
  <!-- PROVIDER_PARAMETERS
20
22
  provider: zai
21
23
  model: glm-4.6
@@ -7,6 +7,8 @@ priority: P0
7
7
  version: 1.1.0
8
8
  ---
9
9
 
10
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
11
+
10
12
  # CFN Docker Mode Expert
11
13
 
12
14
  ## Purpose
@@ -8,6 +8,8 @@ skills: [cfn-dependency-ingestion]
8
8
  version: 1.3.0
9
9
  ---
10
10
 
11
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
12
+
11
13
  # CFN CLI Mode Expert (CLI + Trigger.dev)
12
14
 
13
15
  ## Purpose
@@ -7,6 +7,8 @@ acl_level: 3
7
7
  capabilities: [redis-diagnostics, key-inspection, redis-health-checks, coordination-debugging, redis-cleanup, log-analysis, connection-testing, performance-monitoring]
8
8
  ---
9
9
 
10
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
11
+
10
12
  # CFN Redis Operations Troubleshooting Specialist
11
13
 
12
14
  **Role**: Redis troubleshooting and diagnostics specialist (NOT CFN Loop coordination)
@@ -7,6 +7,8 @@ acl_level: 2
7
7
  capabilities: [cfn-system-architecture, workflow-optimization, troubleshooting, cost-optimization, redis-coordination, agent-spawning]
8
8
  ---
9
9
 
10
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
11
+
10
12
  # Claude Flow Novice System Expert
11
13
 
12
14
  You are a specialized expert with deep knowledge of the Claude Flow Novice system, including CFN Loop methodology, skills-based architecture, and all workflow optimization strategies.
@@ -10,6 +10,8 @@ capabilities:
10
10
  acl_level: 1
11
11
  ---
12
12
 
13
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
14
+
13
15
  # Claude Code Expert
14
16
 
15
17
  You are a specialized agent with deep expertise in Claude Code, Anthropic's official CLI tool. Your primary role is to provide accurate, up-to-date guidance on Claude Code features, sub-agents, and best practices.
@@ -8,6 +8,8 @@ skills: [mdap-context-injection]
8
8
  version: 1.0.0
9
9
  ---
10
10
 
11
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
12
+
11
13
  # MDAP/Trigger Workflow Specialist
12
14
 
13
15
  ## Purpose
@@ -8,6 +8,8 @@ skills: [cfn-dependency-ingestion]
8
8
  version: 2.0.0
9
9
  ---
10
10
 
11
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
12
+
11
13
  # Trigger.dev v4 Infrastructure Expert
12
14
 
13
15
  ## Purpose
@@ -8,6 +8,8 @@ capabilities: [docker-orchestration, container-management, mcp-authentication, r
8
8
  argument-hint: "[task-description] --mode=mvp|standard|enterprise --memory-limit=1g --docker-network=mcp-network"
9
9
  ---
10
10
 
11
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
12
+
11
13
  # CFN Docker V3 Coordinator
12
14
 
13
15
  I am the cfn-docker-v3-coordinator, a specialized coordinator agent for container-based CFN Loop execution with skill-based MCP isolation and resource management.
@@ -7,6 +7,8 @@ type: specialist
7
7
  skills: [docker-build]
8
8
  ---
9
9
 
10
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
11
+
10
12
  # Docker TypeScript Fixer
11
13
 
12
14
  ## Mission
@@ -19,6 +19,8 @@ coordination_role: implementer
19
19
  mode_support: [mvp, standard, enterprise]
20
20
  ---
21
21
 
22
+ → **Skills**: Cerebras MCP (blueprint prompts) | RuVector (semantic search) | Post-edit hook (file validation)
23
+
22
24
  # NPM Package Specialist
23
25
 
24
26
  You are a specialized NPM Package Developer with expertise in creating, configuring, and publishing npm packages.
@@ -0,0 +1,58 @@
1
+ # Cerebras MCP Code Generation
2
+
3
+ Fast code generation via `mcp__cerebras-mcp__write` tool.
4
+
5
+ ## When to Use
6
+
7
+ Use for generating or modifying code files when speed matters. Prompt must be SHORTER than expected output.
8
+
9
+ ## Usage
10
+
11
+ ```
12
+ mcp__cerebras-mcp__write:
13
+ file_path: /absolute/path/to/file.ts
14
+ prompt: |
15
+ Function: validateEmail(email: string): boolean
16
+ Steps:
17
+ - Regex test /^[^@]+@[^@]+\.[^@]+$/
18
+ - Return boolean result
19
+ Imports: none
20
+ Errors: none
21
+ context_files:
22
+ - /path/to/related/file.ts
23
+ ```
24
+
25
+ ## Prompt Format (Blueprint Style)
26
+
27
+ ```
28
+ File: /path/to/file.ts
29
+ Function: functionName(params): returnType
30
+ Steps:
31
+ - Step 1
32
+ - Step 2
33
+ Imports: import { X } from './y'
34
+ Errors: throw new Error("message")
35
+ ```
36
+
37
+ ## Rules
38
+
39
+ 1. **Prompt < Output**: Blueprint must be shorter than generated code
40
+ 2. **Always include context_files**: When code needs imports from existing files
41
+ 3. **Absolute paths only**: Use full paths, not relative
42
+ 4. **One file per call**: Generate/modify single file
43
+
44
+ ## Bad vs Good
45
+
46
+ **Bad** (verbose):
47
+ ```
48
+ I need you to create a function that validates email addresses.
49
+ The function should take an email string as input and return true
50
+ if valid or false if invalid...
51
+ ```
52
+
53
+ **Good** (blueprint):
54
+ ```
55
+ Function: validateEmail(email: string): boolean
56
+ - Regex: /^[^@]+@[^@]+\.[^@]+$/
57
+ - Return: true if match, false otherwise
58
+ ```
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": "2.18.2",
3
+ "description": "CFN RuVector Codebase Index - Semantic search for codebases",
4
+ "cfn_files": [
5
+ "index.sh",
6
+ "search.sh",
7
+ "search.js",
8
+ "indexer.js",
9
+ "standalone-indexer.js",
10
+ "embeddings.js",
11
+ "init-db.js",
12
+ "parser.js",
13
+ "get-embedding-text.js",
14
+ "ruvector-learning.js",
15
+ "clean-orphaned-entries.sh",
16
+ "detect-stale-docs.sh",
17
+ "handle-file-moves.sh",
18
+ "query-error-patterns.sh",
19
+ "query-learnings.sh",
20
+ "store-error-pattern.sh",
21
+ "store-learning.sh",
22
+ "install-hook.sh",
23
+ "package.json",
24
+ "SKILL.md",
25
+ ".cfn-manifest.json"
26
+ ],
27
+ "protected_files": [
28
+ "config.json",
29
+ "node_modules/*",
30
+ "package-lock.json"
31
+ ],
32
+ "standard_paths": {
33
+ "database": ".ruvector/",
34
+ "skill_root": ".claude/skills/cfn-ruvector-codebase-index"
35
+ },
36
+ "notes": "Files not in cfn_files or protected_files are custom, preserved on update. config.json ruvectorDbPath must point to PROJECT_ROOT/.ruvector/ (use ../../../.ruvector)."
37
+ }
@@ -0,0 +1,8 @@
1
+ import { VectorDB } from '@ruvector/core';
2
+
3
+ const db = new VectorDB({ dimensions: 1536, storagePath: './data/codebase_index.db' });
4
+
5
+ // Try a simple search
6
+ const results = await db.search({ vector: new Float32Array(1536).fill(0.01), k: 10 });
7
+ console.log('Search result count:', results.length);
8
+ console.log('All results:', JSON.stringify(results, null, 2));
@@ -61,5 +61,5 @@
61
61
  "embeddingModel": "text-embedding-3-small",
62
62
  "embeddingDimensions": 1536,
63
63
  "batchSize": 100,
64
- "ruvectorDbPath": "./docker/trigger-dev/data"
64
+ "ruvectorDbPath": "../../../.ruvector"
65
65
  }
@@ -0,0 +1,19 @@
1
+ import { initializeRuVector, getCollection, COLLECTIONS } from '../../../docker/trigger-dev/src/lib/ruvector-init.ts';
2
+
3
+ async function main() {
4
+ console.log("ENV RUVECTOR_DB_PATH:", process.env.RUVECTOR_DB_PATH);
5
+
6
+ await initializeRuVector();
7
+ const coll = getCollection(COLLECTIONS.CODEBASE_INDEX);
8
+ console.log("Got collection:", COLLECTIONS.CODEBASE_INDEX);
9
+
10
+ // Try a search with a simple vector
11
+ const results = await coll.search({
12
+ vector: new Float32Array(1536).fill(0.01),
13
+ k: 5,
14
+ });
15
+ console.log("Results count:", results.length);
16
+ console.log("Results:", JSON.stringify(results, null, 2));
17
+ }
18
+
19
+ main().catch(console.error);
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Get Embedding Text - Helper script to generate embedding text for a file
4
+ *
5
+ * Usage: npx tsx get-embedding-text.js <file_path>
6
+ *
7
+ * Returns the embedding text string for use with embeddings.js
8
+ */
9
+
10
+ import { createEmbeddingText, parseFile } from './parser.js';
11
+
12
+ const filePath = process.argv[2];
13
+
14
+ if (!filePath) {
15
+ console.error('Usage: npx tsx get-embedding-text.js <file_path>');
16
+ process.exit(1);
17
+ }
18
+
19
+ try {
20
+ const metadata = parseFile(filePath);
21
+ const embeddingText = createEmbeddingText(filePath, metadata);
22
+ console.log(embeddingText);
23
+ } catch (error) {
24
+ console.error('Error:', error.message);
25
+ process.exit(1);
26
+ }
@@ -110,8 +110,19 @@ find_indexable_files() {
110
110
  done
111
111
  ext_args+=(")" "-print")
112
112
 
113
+ # Change to project root for consistent path resolution
114
+ cd "$PROJECT_ROOT" || exit 1
115
+
113
116
  # Only search in the directories we actually want to index
114
117
  for dir in $INCLUDE_DIRS; do
118
+ # Convert . to project root for absolute paths
119
+ local search_dir="$dir"
120
+ if [[ "$dir" == "." ]]; then
121
+ search_dir="$PROJECT_ROOT"
122
+ elif [[ "$dir" != /* ]]; then
123
+ search_dir="$PROJECT_ROOT/$dir"
124
+ fi
125
+
115
126
  if [[ "$dir" == "." ]]; then
116
127
  # For root directory, only search files at depth 1 (not recursive)
117
128
  while IFS= read -r file; do
@@ -120,12 +131,13 @@ find_indexable_files() {
120
131
  # Check file size
121
132
  local size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null || echo "0")
122
133
  if [[ $size -le $MAX_FILE_SIZE ]]; then
134
+ # Output absolute path
123
135
  echo "$file"
124
136
  else
125
137
  log_warn "Skipping large file: $file (${size} bytes)" >&2
126
138
  fi
127
- done < <(find "$dir" -maxdepth 1 "${ext_args[@]}" 2>/dev/null)
128
- elif [[ -d "$dir" ]]; then
139
+ done < <(find "$search_dir" -maxdepth 1 "${ext_args[@]}" 2>/dev/null)
140
+ elif [[ -d "$search_dir" ]]; then
129
141
  # For other directories, search recursively but exclude build artifacts
130
142
  while IFS= read -r file; do
131
143
  [[ -z "$file" ]] && continue
@@ -133,11 +145,12 @@ find_indexable_files() {
133
145
  # Check file size
134
146
  local size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null || echo "0")
135
147
  if [[ $size -le $MAX_FILE_SIZE ]]; then
148
+ # Output absolute path
136
149
  echo "$file"
137
150
  else
138
151
  log_warn "Skipping large file: $file (${size} bytes)" >&2
139
152
  fi
140
- done < <(find "$dir" \
153
+ done < <(find "$search_dir" \
141
154
  \( -path "*/node_modules" -o -path "*/dist" -o -path "*/build" -o -path "*/coverage" -o -path "*/.trigger/tmp" -o -path "*/docker/trigger-dev/data" \) -prune -o \
142
155
  "${ext_args[@]}" 2>/dev/null)
143
156
  fi
@@ -157,13 +170,9 @@ index_file() {
157
170
  return 1
158
171
  }
159
172
 
160
- # Extract embedding text
173
+ # Extract embedding text (using tsx for ES module support)
161
174
  local embedding_text
162
- embedding_text=$(node -e "
163
- import { createEmbeddingText, parseFile } from '$PARSER_JS';
164
- const metadata = parseFile('$file_path');
165
- console.log(createEmbeddingText('$file_path', metadata));
166
- ") || {
175
+ embedding_text=$(npx tsx "$SCRIPT_DIR/get-embedding-text.js" "$file_path") || {
167
176
  log_error "Failed to create embedding text: $file_path"
168
177
  return 1
169
178
  }
@@ -207,15 +216,17 @@ full_reindex() {
207
216
  local total=${#files[@]}
208
217
  log_info "Found $total files to index"
209
218
 
210
- # Use batch indexer for performance (100x+ faster than per-file spawning)
219
+ # Use standalone indexer (direct @ruvector/core, no external dependencies)
211
220
  log_info "Starting batch indexer..."
212
221
 
213
222
  # Pass environment variables explicitly to Node.js subprocess
223
+ # Run from skill directory to use local node_modules
224
+ # Files are already absolute paths from find_indexable_files
214
225
  if printf '%s\n' "${files[@]}" | \
215
226
  OPENAI_API_KEY="$OPENAI_API_KEY" \
216
227
  ZAI_API_KEY="${ZAI_API_KEY:-}" \
217
228
  OPENAI_BASE_URL="${OPENAI_BASE_URL:-}" \
218
- npx tsx "$SCRIPT_DIR/batch-indexer.js"; then
229
+ bash -c "cd '$SCRIPT_DIR' && npx tsx standalone-indexer.js"; then
219
230
  log_success "Full reindex completed successfully"
220
231
  else
221
232
  log_error "Batch indexing failed with exit code $?"
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * RuVector Search - Searches codebase index for relevant files
4
+ *
5
+ * Usage: npx tsx search.js <query_embedding_json> [top_k]
6
+ *
7
+ * Returns JSON array of search results with file paths and relevance scores
8
+ *
9
+ * NOTE: Uses direct @ruvector/core import (from skill's local node_modules)
10
+ * instead of ruvector-init.ts which resolves to project root's stub module.
11
+ */
12
+
13
+ import { VectorDB } from '@ruvector/core';
14
+ import * as path from 'path';
15
+
16
+ async function searchCodebase(queryEmbedding, topK = 5) {
17
+ try {
18
+ // Get database path from environment
19
+ const dbPath = process.env.RUVECTOR_DB_PATH || './data/ruvector.db';
20
+ const dataDir = path.dirname(dbPath);
21
+ const codebaseIndexPath = path.join(dataDir, 'codebase_index.db');
22
+
23
+ // Open database directly (same pattern as check-db.js which works)
24
+ const db = new VectorDB({ dimensions: 1536, storagePath: codebaseIndexPath });
25
+
26
+ // Parse embedding
27
+ const embeddingArray = JSON.parse(queryEmbedding);
28
+
29
+ // Search
30
+ const results = await db.search({
31
+ vector: new Float32Array(embeddingArray),
32
+ k: topK,
33
+ });
34
+
35
+ // Output results as JSON
36
+ console.log(JSON.stringify(results, null, 2));
37
+ return results;
38
+ } catch (error) {
39
+ console.error('Search failed:', error.message);
40
+ process.exit(1);
41
+ }
42
+ }
43
+
44
+ // Parse command line arguments
45
+ const [queryEmbedding, topKArg] = process.argv.slice(2);
46
+ const topK = parseInt(topKArg, 10) || 5;
47
+
48
+ if (!queryEmbedding) {
49
+ console.error('Usage: npx tsx search.js <query_embedding_json> [top_k]');
50
+ process.exit(1);
51
+ }
52
+
53
+ // Use top-level await (ESM modules support this)
54
+ await searchCodebase(queryEmbedding, topK);
55
+ process.exit(0);
@@ -15,8 +15,14 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
15
15
  CONFIG_FILE="$SCRIPT_DIR/config.json"
16
16
  EMBEDDINGS_JS="$SCRIPT_DIR/embeddings.js"
17
17
 
18
- # Load configuration
19
- RUVECTOR_DB_PATH=$(jq -r '.ruvectorDbPath' "$CONFIG_FILE")
18
+ # Load configuration - resolve relative path from PROJECT_ROOT
19
+ RUVECTOR_DB_PATH_CONFIG=$(jq -r '.ruvectorDbPath' "$CONFIG_FILE")
20
+ # If path starts with ./, resolve it relative to PROJECT_ROOT
21
+ if [[ "$RUVECTOR_DB_PATH_CONFIG" == ./* ]]; then
22
+ RUVECTOR_DB_PATH="$PROJECT_ROOT/${RUVECTOR_DB_PATH_CONFIG#./}"
23
+ else
24
+ RUVECTOR_DB_PATH="$RUVECTOR_DB_PATH_CONFIG"
25
+ fi
20
26
 
21
27
  # Colors for output
22
28
  RED='\033[0;31m'
@@ -84,33 +90,29 @@ QUERY_EMBEDDING=$(node "$EMBEDDINGS_JS" "$QUERY") || {
84
90
  exit 1
85
91
  }
86
92
 
87
- # Search RuVector database
93
+ # Search RuVector database using search.js
88
94
  log_info "Searching codebase index..."
89
95
 
90
- SEARCH_RESULTS=$(node -e "
91
- import { getCollection, COLLECTIONS } from '$PROJECT_ROOT/docker/trigger-dev/src/lib/ruvector-init.ts';
92
-
93
- (async () => {
94
- try {
95
- const collection = getCollection(COLLECTIONS.CODEBASE_INDEX);
96
-
97
- const queryEmbedding = $QUERY_EMBEDDING;
98
-
99
- const results = await collection.search({
100
- vector: new Float32Array(queryEmbedding),
101
- k: $TOP_K,
102
- });
103
-
104
- console.log(JSON.stringify(results, null, 2));
105
- } catch (error) {
106
- console.error('Search failed:', error.message);
107
- process.exit(1);
108
- }
109
- })();
110
- ") || {
111
- log_error "Search failed"
96
+ # Run from skill directory to use local node_modules/@ruvector/core
97
+ # (project root has a stub module that doesn't work)
98
+ # Note: search.js expects RUVECTOR_DB_PATH to end with /ruvector.db
99
+ RAW_OUTPUT=$(cd "$SCRIPT_DIR" && RUVECTOR_DB_PATH="$RUVECTOR_DB_PATH/ruvector.db" npx tsx search.js "$QUERY_EMBEDDING" "$TOP_K" 2>&1)
100
+ SEARCH_EXIT=$?
101
+ if [[ $SEARCH_EXIT -ne 0 ]]; then
102
+ log_error "Search failed (exit $SEARCH_EXIT)"
103
+ echo "$RAW_OUTPUT" >&2
112
104
  exit 1
113
- }
105
+ fi
106
+
107
+ # The raw output should be JSON directly (search.js outputs pretty-printed JSON)
108
+ # Just use the raw output as search results - jq will validate
109
+ SEARCH_RESULTS="$RAW_OUTPUT"
110
+ # Validate it's valid JSON
111
+ if ! echo "$SEARCH_RESULTS" | jq empty 2>/dev/null; then
112
+ log_error "Invalid JSON in search results"
113
+ echo "$SEARCH_RESULTS" >&2
114
+ SEARCH_RESULTS="[]"
115
+ fi
114
116
 
115
117
  # Parse and display results
116
118
  echo ""
@@ -119,11 +121,9 @@ echo -e "${GREEN} Search Results for: \"$QUERY\"${NC}"
119
121
  echo -e "${GREEN}═══════════════════════════════════════════════════════${NC}"
120
122
  echo ""
121
123
 
124
+ # Display results - format matches search.js output: { id: "path", score: 0.xxx }
122
125
  echo "$SEARCH_RESULTS" | jq -r '.[] |
123
- "[\(.distance | tonumber | . * 100 | round / 100)] \(.metadata.metadata.filePath)\n" +
124
- " Purpose: \(.metadata.metadata.purpose // "N/A")\n" +
125
- " Exports: \(.metadata.metadata.exports | join(", ") // "N/A")\n" +
126
- " Lines: \(.metadata.metadata.lines), Complexity: \(.metadata.metadata.complexity)\n"
126
+ "[\(.score | . * 100 | round / 100)] \(.id)"
127
127
  '
128
128
 
129
129
  log_success "Search completed"
@@ -132,10 +132,6 @@ log_success "Search completed"
132
132
  echo ""
133
133
  echo -e "${CYAN}[JSON OUTPUT]${NC}"
134
134
  echo "$SEARCH_RESULTS" | jq -c '.[] | {
135
- filePath: .metadata.metadata.filePath,
136
- relevance: .distance,
137
- purpose: .metadata.metadata.purpose,
138
- exports: .metadata.metadata.exports,
139
- lines: .metadata.metadata.lines,
140
- complexity: .metadata.metadata.complexity
135
+ filePath: .id,
136
+ relevance: .score
141
137
  }'