@hivehub/rulebook 1.2.0
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.
- package/LICENSE +191 -0
- package/README.md +539 -0
- package/dist/agents/claude-code.d.ts +69 -0
- package/dist/agents/claude-code.d.ts.map +1 -0
- package/dist/agents/claude-code.js +180 -0
- package/dist/agents/claude-code.js.map +1 -0
- package/dist/agents/cursor-agent.d.ts +184 -0
- package/dist/agents/cursor-agent.d.ts.map +1 -0
- package/dist/agents/cursor-agent.js +299 -0
- package/dist/agents/cursor-agent.js.map +1 -0
- package/dist/agents/gemini-cli.d.ts +69 -0
- package/dist/agents/gemini-cli.d.ts.map +1 -0
- package/dist/agents/gemini-cli.js +180 -0
- package/dist/agents/gemini-cli.js.map +1 -0
- package/dist/cli/commands.d.ts +57 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1370 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/docs-prompts.d.ts +3 -0
- package/dist/cli/docs-prompts.d.ts.map +1 -0
- package/dist/cli/docs-prompts.js +45 -0
- package/dist/cli/docs-prompts.js.map +1 -0
- package/dist/cli/prompts.d.ts +6 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/prompts.js +376 -0
- package/dist/cli/prompts.js.map +1 -0
- package/dist/core/agent-manager.d.ts +89 -0
- package/dist/core/agent-manager.d.ts.map +1 -0
- package/dist/core/agent-manager.js +546 -0
- package/dist/core/agent-manager.js.map +1 -0
- package/dist/core/auto-fixer.d.ts +14 -0
- package/dist/core/auto-fixer.d.ts.map +1 -0
- package/dist/core/auto-fixer.js +207 -0
- package/dist/core/auto-fixer.js.map +1 -0
- package/dist/core/changelog-generator.d.ts +44 -0
- package/dist/core/changelog-generator.d.ts.map +1 -0
- package/dist/core/changelog-generator.js +222 -0
- package/dist/core/changelog-generator.js.map +1 -0
- package/dist/core/cli-bridge.d.ts +113 -0
- package/dist/core/cli-bridge.d.ts.map +1 -0
- package/dist/core/cli-bridge.js +1094 -0
- package/dist/core/cli-bridge.js.map +1 -0
- package/dist/core/config-manager.d.ts +65 -0
- package/dist/core/config-manager.d.ts.map +1 -0
- package/dist/core/config-manager.js +266 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/coverage-checker.d.ts +14 -0
- package/dist/core/coverage-checker.d.ts.map +1 -0
- package/dist/core/coverage-checker.js +176 -0
- package/dist/core/coverage-checker.js.map +1 -0
- package/dist/core/custom-templates.d.ts +27 -0
- package/dist/core/custom-templates.d.ts.map +1 -0
- package/dist/core/custom-templates.js +122 -0
- package/dist/core/custom-templates.js.map +1 -0
- package/dist/core/dependency-checker.d.ts +21 -0
- package/dist/core/dependency-checker.d.ts.map +1 -0
- package/dist/core/dependency-checker.js +247 -0
- package/dist/core/dependency-checker.js.map +1 -0
- package/dist/core/detector.d.ts +3 -0
- package/dist/core/detector.d.ts.map +1 -0
- package/dist/core/detector.js +1443 -0
- package/dist/core/detector.js.map +1 -0
- package/dist/core/docs-generator.d.ts +9 -0
- package/dist/core/docs-generator.d.ts.map +1 -0
- package/dist/core/docs-generator.js +531 -0
- package/dist/core/docs-generator.js.map +1 -0
- package/dist/core/generator.d.ts +16 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/dist/core/generator.js +561 -0
- package/dist/core/generator.js.map +1 -0
- package/dist/core/gitignore-generator.d.ts +13 -0
- package/dist/core/gitignore-generator.d.ts.map +1 -0
- package/dist/core/gitignore-generator.js +307 -0
- package/dist/core/gitignore-generator.js.map +1 -0
- package/dist/core/health-scorer.d.ts +22 -0
- package/dist/core/health-scorer.d.ts.map +1 -0
- package/dist/core/health-scorer.js +395 -0
- package/dist/core/health-scorer.js.map +1 -0
- package/dist/core/logger.d.ts +116 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +289 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/merger.d.ts +6 -0
- package/dist/core/merger.d.ts.map +1 -0
- package/dist/core/merger.js +131 -0
- package/dist/core/merger.js.map +1 -0
- package/dist/core/migrator.d.ts +19 -0
- package/dist/core/migrator.d.ts.map +1 -0
- package/dist/core/migrator.js +102 -0
- package/dist/core/migrator.js.map +1 -0
- package/dist/core/minimal-scaffolder.d.ts +8 -0
- package/dist/core/minimal-scaffolder.d.ts.map +1 -0
- package/dist/core/minimal-scaffolder.js +51 -0
- package/dist/core/minimal-scaffolder.js.map +1 -0
- package/dist/core/modern-console-new.d.ts +81 -0
- package/dist/core/modern-console-new.d.ts.map +1 -0
- package/dist/core/modern-console-new.js +340 -0
- package/dist/core/modern-console-new.js.map +1 -0
- package/dist/core/modern-console.d.ts +99 -0
- package/dist/core/modern-console.d.ts.map +1 -0
- package/dist/core/modern-console.js +568 -0
- package/dist/core/modern-console.js.map +1 -0
- package/dist/core/openspec-manager.d.ts +133 -0
- package/dist/core/openspec-manager.d.ts.map +1 -0
- package/dist/core/openspec-manager.js +605 -0
- package/dist/core/openspec-manager.js.map +1 -0
- package/dist/core/openspec-migrator.d.ts +27 -0
- package/dist/core/openspec-migrator.d.ts.map +1 -0
- package/dist/core/openspec-migrator.js +255 -0
- package/dist/core/openspec-migrator.js.map +1 -0
- package/dist/core/task-manager.d.ts +65 -0
- package/dist/core/task-manager.d.ts.map +1 -0
- package/dist/core/task-manager.js +318 -0
- package/dist/core/task-manager.js.map +1 -0
- package/dist/core/test-task-manager.d.ts +49 -0
- package/dist/core/test-task-manager.d.ts.map +1 -0
- package/dist/core/test-task-manager.js +121 -0
- package/dist/core/test-task-manager.js.map +1 -0
- package/dist/core/validator.d.ts +21 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +177 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/core/version-bumper.d.ts +19 -0
- package/dist/core/version-bumper.d.ts.map +1 -0
- package/dist/core/version-bumper.js +180 -0
- package/dist/core/version-bumper.js.map +1 -0
- package/dist/core/watcher.d.ts +9 -0
- package/dist/core/watcher.d.ts.map +1 -0
- package/dist/core/watcher.js +22 -0
- package/dist/core/watcher.js.map +1 -0
- package/dist/core/workflow-generator.d.ts +10 -0
- package/dist/core/workflow-generator.d.ts.map +1 -0
- package/dist/core/workflow-generator.js +279 -0
- package/dist/core/workflow-generator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/handlers/archive-task.d.ts +17 -0
- package/dist/mcp/handlers/archive-task.d.ts.map +1 -0
- package/dist/mcp/handlers/archive-task.js +36 -0
- package/dist/mcp/handlers/archive-task.js.map +1 -0
- package/dist/mcp/handlers/create-task.d.ts +17 -0
- package/dist/mcp/handlers/create-task.d.ts.map +1 -0
- package/dist/mcp/handlers/create-task.js +56 -0
- package/dist/mcp/handlers/create-task.js.map +1 -0
- package/dist/mcp/handlers/list-tasks.d.ts +22 -0
- package/dist/mcp/handlers/list-tasks.d.ts.map +1 -0
- package/dist/mcp/handlers/list-tasks.js +42 -0
- package/dist/mcp/handlers/list-tasks.js.map +1 -0
- package/dist/mcp/handlers/show-task.d.ts +25 -0
- package/dist/mcp/handlers/show-task.d.ts.map +1 -0
- package/dist/mcp/handlers/show-task.js +43 -0
- package/dist/mcp/handlers/show-task.js.map +1 -0
- package/dist/mcp/handlers/update-task.d.ts +17 -0
- package/dist/mcp/handlers/update-task.d.ts.map +1 -0
- package/dist/mcp/handlers/update-task.js +35 -0
- package/dist/mcp/handlers/update-task.js.map +1 -0
- package/dist/mcp/handlers/validate-task.d.ts +15 -0
- package/dist/mcp/handlers/validate-task.d.ts.map +1 -0
- package/dist/mcp/handlers/validate-task.js +27 -0
- package/dist/mcp/handlers/validate-task.js.map +1 -0
- package/dist/mcp/rulebook-config.d.ts +22 -0
- package/dist/mcp/rulebook-config.d.ts.map +1 -0
- package/dist/mcp/rulebook-config.js +65 -0
- package/dist/mcp/rulebook-config.js.map +1 -0
- package/dist/mcp/rulebook-server.d.ts +4 -0
- package/dist/mcp/rulebook-server.d.ts.map +1 -0
- package/dist/mcp/rulebook-server.js +246 -0
- package/dist/mcp/rulebook-server.js.map +1 -0
- package/dist/types.d.ts +190 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/file-system.d.ts +9 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +51 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/git-hooks.d.ts +8 -0
- package/dist/utils/git-hooks.d.ts.map +1 -0
- package/dist/utils/git-hooks.js +440 -0
- package/dist/utils/git-hooks.js.map +1 -0
- package/dist/utils/rulesignore.d.ts +9 -0
- package/dist/utils/rulesignore.d.ts.map +1 -0
- package/dist/utils/rulesignore.js +42 -0
- package/dist/utils/rulesignore.js.map +1 -0
- package/package.json +106 -0
- package/templates/cli/AIDER.md +49 -0
- package/templates/cli/AMAZON_Q.md +25 -0
- package/templates/cli/AUGGIE.md +32 -0
- package/templates/cli/CLAUDE.md +32 -0
- package/templates/cli/CLAUDE_CODE.md +35 -0
- package/templates/cli/CLINE.md +32 -0
- package/templates/cli/CODEBUDDY.md +20 -0
- package/templates/cli/CODEIUM.md +20 -0
- package/templates/cli/CODEX.md +21 -0
- package/templates/cli/CONTINUE.md +34 -0
- package/templates/cli/CURSOR_CLI.md +28 -0
- package/templates/cli/FACTORY.md +18 -0
- package/templates/cli/GEMINI.md +35 -0
- package/templates/cli/KILOCODE.md +18 -0
- package/templates/cli/OPENCODE.md +18 -0
- package/templates/cli/_GENERIC_TEMPLATE.md +29 -0
- package/templates/commands/rulebook-task-apply.md +67 -0
- package/templates/commands/rulebook-task-archive.md +70 -0
- package/templates/commands/rulebook-task-create.md +93 -0
- package/templates/commands/rulebook-task-list.md +42 -0
- package/templates/commands/rulebook-task-show.md +52 -0
- package/templates/commands/rulebook-task-validate.md +53 -0
- package/templates/core/AGENT_AUTOMATION.md +184 -0
- package/templates/core/DAG.md +304 -0
- package/templates/core/DOCUMENTATION_RULES.md +37 -0
- package/templates/core/QUALITY_ENFORCEMENT.md +68 -0
- package/templates/core/RULEBOOK.md +1874 -0
- package/templates/frameworks/ANGULAR.md +36 -0
- package/templates/frameworks/DJANGO.md +83 -0
- package/templates/frameworks/ELECTRON.md +147 -0
- package/templates/frameworks/FLASK.md +38 -0
- package/templates/frameworks/FLUTTER.md +55 -0
- package/templates/frameworks/JQUERY.md +32 -0
- package/templates/frameworks/LARAVEL.md +38 -0
- package/templates/frameworks/NESTJS.md +43 -0
- package/templates/frameworks/NEXTJS.md +127 -0
- package/templates/frameworks/NUXT.md +40 -0
- package/templates/frameworks/RAILS.md +66 -0
- package/templates/frameworks/REACT.md +38 -0
- package/templates/frameworks/REACT_NATIVE.md +47 -0
- package/templates/frameworks/SPRING.md +39 -0
- package/templates/frameworks/SYMFONY.md +36 -0
- package/templates/frameworks/VUE.md +36 -0
- package/templates/frameworks/ZEND.md +35 -0
- package/templates/git/CI_CD_PATTERNS.md +661 -0
- package/templates/git/GITHUB_ACTIONS.md +728 -0
- package/templates/git/GITLAB_CI.md +730 -0
- package/templates/git/GIT_WORKFLOW.md +1157 -0
- package/templates/git/SECRETS_MANAGEMENT.md +585 -0
- package/templates/hooks/COMMIT_MSG.md +530 -0
- package/templates/hooks/POST_CHECKOUT.md +546 -0
- package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -0
- package/templates/hooks/PRE_COMMIT.md +414 -0
- package/templates/hooks/PRE_PUSH.md +601 -0
- package/templates/hooks/csharp-pre-commit.sh +23 -0
- package/templates/hooks/csharp-pre-push.sh +23 -0
- package/templates/hooks/dart-pre-commit.sh +30 -0
- package/templates/hooks/dart-pre-push.sh +25 -0
- package/templates/hooks/elixir-pre-commit.sh +32 -0
- package/templates/hooks/elixir-pre-push.sh +31 -0
- package/templates/hooks/erlang-pre-commit.sh +30 -0
- package/templates/hooks/erlang-pre-push.sh +37 -0
- package/templates/hooks/go-pre-commit.sh +40 -0
- package/templates/hooks/go-pre-push.sh +31 -0
- package/templates/hooks/haskell-pre-commit.sh +41 -0
- package/templates/hooks/haskell-pre-push.sh +37 -0
- package/templates/hooks/java-pre-commit.sh +34 -0
- package/templates/hooks/java-pre-push.sh +24 -0
- package/templates/hooks/kotlin-pre-commit.sh +32 -0
- package/templates/hooks/kotlin-pre-push.sh +16 -0
- package/templates/hooks/php-pre-commit.sh +36 -0
- package/templates/hooks/php-pre-push.sh +26 -0
- package/templates/hooks/python-pre-commit.sh +51 -0
- package/templates/hooks/python-pre-push.sh +25 -0
- package/templates/hooks/ruby-pre-commit.sh +33 -0
- package/templates/hooks/ruby-pre-push.sh +32 -0
- package/templates/hooks/rust-pre-commit.sh +30 -0
- package/templates/hooks/rust-pre-push.sh +30 -0
- package/templates/hooks/scala-pre-commit.sh +32 -0
- package/templates/hooks/scala-pre-push.sh +24 -0
- package/templates/hooks/swift-pre-commit.sh +25 -0
- package/templates/hooks/swift-pre-push.sh +23 -0
- package/templates/hooks/typescript-pre-commit.sh +37 -0
- package/templates/hooks/typescript-pre-push.sh +36 -0
- package/templates/ides/COPILOT.md +37 -0
- package/templates/ides/CURSOR.md +43 -0
- package/templates/ides/JETBRAINS_AI.md +35 -0
- package/templates/ides/REPLIT.md +36 -0
- package/templates/ides/TABNINE.md +29 -0
- package/templates/ides/VSCODE.md +40 -0
- package/templates/ides/WINDSURF.md +36 -0
- package/templates/ides/ZED.md +32 -0
- package/templates/languages/ADA.md +58 -0
- package/templates/languages/C.md +333 -0
- package/templates/languages/CPP.md +743 -0
- package/templates/languages/CSHARP.md +417 -0
- package/templates/languages/DART.md +332 -0
- package/templates/languages/ELIXIR.md +454 -0
- package/templates/languages/ERLANG.md +361 -0
- package/templates/languages/GO.md +645 -0
- package/templates/languages/HASKELL.md +177 -0
- package/templates/languages/JAVA.md +607 -0
- package/templates/languages/JAVASCRIPT.md +631 -0
- package/templates/languages/JULIA.md +97 -0
- package/templates/languages/KOTLIN.md +511 -0
- package/templates/languages/LISP.md +100 -0
- package/templates/languages/LUA.md +74 -0
- package/templates/languages/OBJECTIVEC.md +90 -0
- package/templates/languages/PHP.md +416 -0
- package/templates/languages/PYTHON.md +682 -0
- package/templates/languages/R.md +350 -0
- package/templates/languages/RUBY.md +421 -0
- package/templates/languages/RUST.md +477 -0
- package/templates/languages/SAS.md +73 -0
- package/templates/languages/SCALA.md +348 -0
- package/templates/languages/SOLIDITY.md +580 -0
- package/templates/languages/SQL.md +137 -0
- package/templates/languages/SWIFT.md +466 -0
- package/templates/languages/TYPESCRIPT.md +591 -0
- package/templates/languages/ZIG.md +265 -0
- package/templates/modules/ATLASSIAN.md +255 -0
- package/templates/modules/CONTEXT7.md +54 -0
- package/templates/modules/FIGMA.md +267 -0
- package/templates/modules/GITHUB_MCP.md +64 -0
- package/templates/modules/GRAFANA.md +328 -0
- package/templates/modules/NOTION.md +247 -0
- package/templates/modules/PLAYWRIGHT.md +90 -0
- package/templates/modules/RULEBOOK_MCP.md +156 -0
- package/templates/modules/SERENA.md +337 -0
- package/templates/modules/SUPABASE.md +223 -0
- package/templates/modules/SYNAP.md +69 -0
- package/templates/modules/VECTORIZER.md +63 -0
- package/templates/services/AZURE_BLOB.md +184 -0
- package/templates/services/CASSANDRA.md +239 -0
- package/templates/services/DYNAMODB.md +308 -0
- package/templates/services/ELASTICSEARCH.md +347 -0
- package/templates/services/GCS.md +178 -0
- package/templates/services/INFLUXDB.md +265 -0
- package/templates/services/KAFKA.md +341 -0
- package/templates/services/MARIADB.md +183 -0
- package/templates/services/MEMCACHED.md +242 -0
- package/templates/services/MINIO.md +201 -0
- package/templates/services/MONGODB.md +268 -0
- package/templates/services/MYSQL.md +358 -0
- package/templates/services/NEO4J.md +247 -0
- package/templates/services/ORACLE.md +290 -0
- package/templates/services/POSTGRESQL.md +326 -0
- package/templates/services/RABBITMQ.md +286 -0
- package/templates/services/REDIS.md +292 -0
- package/templates/services/S3.md +298 -0
- package/templates/services/SQLITE.md +294 -0
- package/templates/services/SQLSERVER.md +294 -0
- package/templates/workflows/codespell.yml +31 -0
- package/templates/workflows/cpp-lint.yml +47 -0
- package/templates/workflows/cpp-publish.yml +119 -0
- package/templates/workflows/cpp-test.yml +77 -0
- package/templates/workflows/dotnet-lint.yml +29 -0
- package/templates/workflows/dotnet-publish.yml +40 -0
- package/templates/workflows/dotnet-test.yml +41 -0
- package/templates/workflows/elixir-lint.yml +45 -0
- package/templates/workflows/elixir-publish.yml +49 -0
- package/templates/workflows/elixir-test.yml +54 -0
- package/templates/workflows/erlang-lint.yml +47 -0
- package/templates/workflows/erlang-test.yml +62 -0
- package/templates/workflows/go-lint.yml +39 -0
- package/templates/workflows/go-publish.yml +95 -0
- package/templates/workflows/go-test.yml +59 -0
- package/templates/workflows/java-lint.yml +60 -0
- package/templates/workflows/java-publish.yml +120 -0
- package/templates/workflows/java-test.yml +85 -0
- package/templates/workflows/kotlin-lint.yml +34 -0
- package/templates/workflows/kotlin-publish.yml +56 -0
- package/templates/workflows/kotlin-test.yml +48 -0
- package/templates/workflows/php-lint.yml +39 -0
- package/templates/workflows/php-publish.yml +50 -0
- package/templates/workflows/php-test.yml +54 -0
- package/templates/workflows/python-lint.yml +47 -0
- package/templates/workflows/python-publish.yml +91 -0
- package/templates/workflows/python-test.yml +59 -0
- package/templates/workflows/rust-lint.yml +54 -0
- package/templates/workflows/rust-publish.yml +66 -0
- package/templates/workflows/rust-test.yml +75 -0
- package/templates/workflows/solidity-lint.yml +41 -0
- package/templates/workflows/solidity-test.yml +47 -0
- package/templates/workflows/swift-lint.yml +32 -0
- package/templates/workflows/swift-publish.yml +58 -0
- package/templates/workflows/swift-test.yml +44 -0
- package/templates/workflows/typescript-lint.yml +61 -0
- package/templates/workflows/typescript-publish.yml +60 -0
- package/templates/workflows/typescript-test.yml +73 -0
- package/templates/workflows/zig-lint.yml +27 -0
- package/templates/workflows/zig-test.yml +40 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<!-- SERENA:START -->
|
|
2
|
+
# Serena MCP Instructions
|
|
3
|
+
|
|
4
|
+
**CRITICAL**: Use MCP Serena for AI-powered development assistance, code analysis, and intelligent automation.
|
|
5
|
+
|
|
6
|
+
## Core Operations
|
|
7
|
+
|
|
8
|
+
### Code Analysis
|
|
9
|
+
```typescript
|
|
10
|
+
// Analyze code quality
|
|
11
|
+
serena.analyze({
|
|
12
|
+
file: 'src/auth/login.ts',
|
|
13
|
+
checks: ['security', 'performance', 'best-practices']
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// Get refactoring suggestions
|
|
17
|
+
serena.suggest({
|
|
18
|
+
file: 'src/legacy-code.js',
|
|
19
|
+
type: 'refactor',
|
|
20
|
+
target: 'modern'
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
// Detect code smells
|
|
24
|
+
serena.detectSmells({
|
|
25
|
+
directory: 'src/',
|
|
26
|
+
severity: 'high'
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Code Generation
|
|
31
|
+
```typescript
|
|
32
|
+
// Generate tests
|
|
33
|
+
serena.generateTests({
|
|
34
|
+
sourceFile: 'src/utils/validator.ts',
|
|
35
|
+
framework: 'vitest',
|
|
36
|
+
coverage: 'comprehensive'
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Generate documentation
|
|
40
|
+
serena.generateDocs({
|
|
41
|
+
files: ['src/**/*.ts'],
|
|
42
|
+
format: 'markdown',
|
|
43
|
+
includeExamples: true
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Generate types
|
|
47
|
+
serena.generateTypes({
|
|
48
|
+
from: 'api-schema.json',
|
|
49
|
+
to: 'src/types/api.ts',
|
|
50
|
+
style: 'strict'
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Intelligent Refactoring
|
|
55
|
+
```typescript
|
|
56
|
+
// Extract function
|
|
57
|
+
serena.refactor({
|
|
58
|
+
action: 'extract-function',
|
|
59
|
+
file: 'src/complex-logic.ts',
|
|
60
|
+
selection: { start: 45, end: 78 },
|
|
61
|
+
newFunctionName: 'processUserData'
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
// Rename symbol
|
|
65
|
+
serena.refactor({
|
|
66
|
+
action: 'rename',
|
|
67
|
+
symbol: 'oldFunctionName',
|
|
68
|
+
newName: 'newFunctionName',
|
|
69
|
+
scope: 'project'
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Convert to async
|
|
73
|
+
serena.refactor({
|
|
74
|
+
action: 'convert-to-async',
|
|
75
|
+
file: 'src/sync-operations.ts'
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Code Review
|
|
80
|
+
```typescript
|
|
81
|
+
// Get code review
|
|
82
|
+
serena.review({
|
|
83
|
+
files: ['src/new-feature/**/*.ts'],
|
|
84
|
+
focus: ['security', 'performance', 'maintainability'],
|
|
85
|
+
severity: 'warning-and-above'
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Check best practices
|
|
89
|
+
serena.checkBestPractices({
|
|
90
|
+
language: 'typescript',
|
|
91
|
+
framework: 'react',
|
|
92
|
+
files: 'src/components/**/*.tsx'
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Common Patterns
|
|
97
|
+
|
|
98
|
+
### Pre-Commit Analysis
|
|
99
|
+
```typescript
|
|
100
|
+
// Analyze changed files before commit
|
|
101
|
+
const changedFiles = execSync('git diff --cached --name-only').toString().split('\n')
|
|
102
|
+
|
|
103
|
+
for (const file of changedFiles) {
|
|
104
|
+
const analysis = await serena.analyze({
|
|
105
|
+
file,
|
|
106
|
+
checks: ['security', 'performance', 'best-practices']
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
if (analysis.issues.filter(i => i.severity === 'high').length > 0) {
|
|
110
|
+
console.error(`❌ High severity issues found in ${file}`)
|
|
111
|
+
process.exit(1)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Test Generation Workflow
|
|
117
|
+
```typescript
|
|
118
|
+
// Generate tests for new features
|
|
119
|
+
const newFiles = findFilesWithoutTests('src/features/new-feature')
|
|
120
|
+
|
|
121
|
+
for (const file of newFiles) {
|
|
122
|
+
const tests = await serena.generateTests({
|
|
123
|
+
sourceFile: file,
|
|
124
|
+
framework: 'vitest',
|
|
125
|
+
coverage: 'comprehensive'
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const testFile = file.replace('.ts', '.test.ts')
|
|
129
|
+
fs.writeFileSync(testFile, tests.code)
|
|
130
|
+
|
|
131
|
+
console.log(`✅ Generated tests for ${file}`)
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Code Quality Dashboard
|
|
136
|
+
```typescript
|
|
137
|
+
// Generate project health report
|
|
138
|
+
const files = glob.sync('src/**/*.ts')
|
|
139
|
+
|
|
140
|
+
const report = {
|
|
141
|
+
totalFiles: files.length,
|
|
142
|
+
issues: [],
|
|
143
|
+
codeSmells: [],
|
|
144
|
+
coverage: 0
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
for (const file of files) {
|
|
148
|
+
const analysis = await serena.analyze({ file })
|
|
149
|
+
report.issues.push(...analysis.issues)
|
|
150
|
+
|
|
151
|
+
const smells = await serena.detectSmells({ file })
|
|
152
|
+
report.codeSmells.push(...smells)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Post to dashboard
|
|
156
|
+
await grafana.dashboards.updateDashboard({
|
|
157
|
+
panels: [
|
|
158
|
+
{ title: 'Code Quality', value: calculateQualityScore(report) },
|
|
159
|
+
{ title: 'Issues', value: report.issues.length },
|
|
160
|
+
{ title: 'Code Smells', value: report.codeSmells.length }
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Automated Refactoring Pipeline
|
|
166
|
+
```typescript
|
|
167
|
+
// Identify and fix code smells automatically
|
|
168
|
+
const smells = await serena.detectSmells({
|
|
169
|
+
directory: 'src/',
|
|
170
|
+
severity: 'medium-and-above'
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
for (const smell of smells) {
|
|
174
|
+
if (smell.autoFixable) {
|
|
175
|
+
const result = await serena.refactor({
|
|
176
|
+
action: smell.suggestedAction,
|
|
177
|
+
file: smell.file,
|
|
178
|
+
selection: smell.location
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
if (result.success) {
|
|
182
|
+
console.log(`✅ Fixed: ${smell.description}`)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Documentation Sync
|
|
189
|
+
```typescript
|
|
190
|
+
// Keep documentation in sync with code
|
|
191
|
+
const apiFiles = glob.sync('src/api/**/*.ts')
|
|
192
|
+
|
|
193
|
+
for (const file of apiFiles) {
|
|
194
|
+
const docs = await serena.generateDocs({
|
|
195
|
+
files: [file],
|
|
196
|
+
format: 'markdown',
|
|
197
|
+
includeExamples: true
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
const docFile = `docs/api/${path.basename(file, '.ts')}.md`
|
|
201
|
+
fs.writeFileSync(docFile, docs)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Update CHANGELOG with AI summary
|
|
205
|
+
const changes = execSync('git log --oneline --since="1 week ago"').toString()
|
|
206
|
+
const summary = await serena.summarize({
|
|
207
|
+
text: changes,
|
|
208
|
+
format: 'changelog',
|
|
209
|
+
categorize: true
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
updateChangelog(summary)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Intelligent Code Migration
|
|
216
|
+
```typescript
|
|
217
|
+
// Migrate from old to new API
|
|
218
|
+
await serena.migrate({
|
|
219
|
+
from: 'old-api-v1',
|
|
220
|
+
to: 'new-api-v2',
|
|
221
|
+
files: 'src/**/*.ts',
|
|
222
|
+
strategy: 'safe', // safe, aggressive, manual
|
|
223
|
+
createBackup: true
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
// Update imports
|
|
227
|
+
await serena.refactor({
|
|
228
|
+
action: 'update-imports',
|
|
229
|
+
from: '@old-package',
|
|
230
|
+
to: '@new-package',
|
|
231
|
+
scope: 'project'
|
|
232
|
+
})
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Best Practices
|
|
236
|
+
|
|
237
|
+
✅ **DO:**
|
|
238
|
+
- Run analysis before commits
|
|
239
|
+
- Generate tests for new code
|
|
240
|
+
- Use AI suggestions as starting point
|
|
241
|
+
- Review generated code before accepting
|
|
242
|
+
- Keep AI-generated docs in sync
|
|
243
|
+
- Use for repetitive refactoring tasks
|
|
244
|
+
- Leverage for code review automation
|
|
245
|
+
|
|
246
|
+
❌ **DON'T:**
|
|
247
|
+
- Blindly accept all suggestions
|
|
248
|
+
- Skip manual code review
|
|
249
|
+
- Use for critical security decisions
|
|
250
|
+
- Ignore high-severity issues
|
|
251
|
+
- Over-rely on automation
|
|
252
|
+
- Skip testing generated code
|
|
253
|
+
|
|
254
|
+
## Configuration
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"mcpServers": {
|
|
259
|
+
"serena": {
|
|
260
|
+
"command": "npx",
|
|
261
|
+
"args": ["-y", "@modelcontextprotocol/server-serena"],
|
|
262
|
+
"env": {
|
|
263
|
+
"SERENA_API_KEY": "your-api-key",
|
|
264
|
+
"SERENA_MODEL": "gpt-4",
|
|
265
|
+
"SERENA_TEMPERATURE": "0.2"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Configuration Options:**
|
|
273
|
+
- `SERENA_MODEL`: AI model to use (gpt-4, claude-3, etc.)
|
|
274
|
+
- `SERENA_TEMPERATURE`: Creativity level (0.0-1.0, lower = more deterministic)
|
|
275
|
+
- `SERENA_MAX_TOKENS`: Maximum response length
|
|
276
|
+
- `SERENA_TIMEOUT`: Request timeout in seconds
|
|
277
|
+
|
|
278
|
+
## Integration with AGENT_AUTOMATION
|
|
279
|
+
|
|
280
|
+
Enhance automation workflow with AI assistance:
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
// Step 1: AI-powered code review before quality checks
|
|
284
|
+
const review = await serena.review({
|
|
285
|
+
files: changedFiles,
|
|
286
|
+
focus: ['security', 'performance']
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
if (review.criticalIssues.length > 0) {
|
|
290
|
+
console.error('Critical issues found. Fix before proceeding.')
|
|
291
|
+
process.exit(1)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Step 2: Generate missing tests
|
|
295
|
+
const filesWithoutTests = findFilesWithoutTests()
|
|
296
|
+
for (const file of filesWithoutTests) {
|
|
297
|
+
await serena.generateTests({ sourceFile: file })
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Step 3: Normal AGENT_AUTOMATION workflow
|
|
301
|
+
// (lint, test, coverage, etc.)
|
|
302
|
+
|
|
303
|
+
// Step 4: AI-powered commit message
|
|
304
|
+
const commitMessage = await serena.generateCommitMessage({
|
|
305
|
+
diff: execSync('git diff --cached').toString(),
|
|
306
|
+
style: 'conventional'
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
git commit -m "${commitMessage}"
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## CI/CD Integration
|
|
313
|
+
|
|
314
|
+
```yaml
|
|
315
|
+
# .github/workflows/serena-review.yml
|
|
316
|
+
name: AI Code Review
|
|
317
|
+
|
|
318
|
+
on: [pull_request]
|
|
319
|
+
|
|
320
|
+
jobs:
|
|
321
|
+
review:
|
|
322
|
+
runs-on: ubuntu-latest
|
|
323
|
+
steps:
|
|
324
|
+
- uses: actions/checkout@v4
|
|
325
|
+
|
|
326
|
+
- name: AI Code Review
|
|
327
|
+
run: |
|
|
328
|
+
npx serena review \
|
|
329
|
+
--files="$(git diff --name-only origin/main)" \
|
|
330
|
+
--severity=warning \
|
|
331
|
+
--format=github-comment
|
|
332
|
+
env:
|
|
333
|
+
SERENA_API_KEY: ${{ secrets.SERENA_API_KEY }}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
<!-- SERENA:END -->
|
|
337
|
+
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<!-- SUPABASE:START -->
|
|
2
|
+
# Supabase MCP Instructions
|
|
3
|
+
|
|
4
|
+
**CRITICAL**: Use MCP Supabase for database operations, authentication, and storage.
|
|
5
|
+
|
|
6
|
+
## Core Features
|
|
7
|
+
|
|
8
|
+
### Database Operations
|
|
9
|
+
```typescript
|
|
10
|
+
// Query data
|
|
11
|
+
supabase.from('users').select('*')
|
|
12
|
+
supabase.from('users').select('id, name, email')
|
|
13
|
+
|
|
14
|
+
// Insert
|
|
15
|
+
supabase.from('users').insert({ name: 'John', email: 'john@example.com' })
|
|
16
|
+
|
|
17
|
+
// Update
|
|
18
|
+
supabase.from('users').update({ name: 'Jane' }).eq('id', 1)
|
|
19
|
+
|
|
20
|
+
// Delete
|
|
21
|
+
supabase.from('users').delete().eq('id', 1)
|
|
22
|
+
|
|
23
|
+
// Filters
|
|
24
|
+
supabase.from('users').select('*').eq('status', 'active')
|
|
25
|
+
supabase.from('users').select('*').gt('age', 18)
|
|
26
|
+
supabase.from('users').select('*').like('name', '%John%')
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Authentication
|
|
30
|
+
```typescript
|
|
31
|
+
// Sign up
|
|
32
|
+
supabase.auth.signUp({ email, password })
|
|
33
|
+
|
|
34
|
+
// Sign in
|
|
35
|
+
supabase.auth.signInWithPassword({ email, password })
|
|
36
|
+
|
|
37
|
+
// Sign out
|
|
38
|
+
supabase.auth.signOut()
|
|
39
|
+
|
|
40
|
+
// Get session
|
|
41
|
+
supabase.auth.getSession()
|
|
42
|
+
|
|
43
|
+
// Get user
|
|
44
|
+
supabase.auth.getUser()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Storage
|
|
48
|
+
```typescript
|
|
49
|
+
// Upload file
|
|
50
|
+
supabase.storage.from('avatars').upload('path/file.jpg', file)
|
|
51
|
+
|
|
52
|
+
// Download file
|
|
53
|
+
supabase.storage.from('avatars').download('path/file.jpg')
|
|
54
|
+
|
|
55
|
+
// List files
|
|
56
|
+
supabase.storage.from('avatars').list('folder')
|
|
57
|
+
|
|
58
|
+
// Delete file
|
|
59
|
+
supabase.storage.from('avatars').remove(['path/file.jpg'])
|
|
60
|
+
|
|
61
|
+
// Get public URL
|
|
62
|
+
supabase.storage.from('avatars').getPublicUrl('path/file.jpg')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Real-time Subscriptions
|
|
66
|
+
```typescript
|
|
67
|
+
// Subscribe to changes
|
|
68
|
+
supabase
|
|
69
|
+
.channel('room1')
|
|
70
|
+
.on('postgres_changes', {
|
|
71
|
+
event: '*',
|
|
72
|
+
schema: 'public',
|
|
73
|
+
table: 'users'
|
|
74
|
+
}, (payload) => {
|
|
75
|
+
console.log('Change received!', payload)
|
|
76
|
+
})
|
|
77
|
+
.subscribe()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Common Patterns
|
|
81
|
+
|
|
82
|
+
### CRUD Operations
|
|
83
|
+
```typescript
|
|
84
|
+
// Create
|
|
85
|
+
const { data, error } = await supabase
|
|
86
|
+
.from('tasks')
|
|
87
|
+
.insert({ title: 'New Task', completed: false })
|
|
88
|
+
.select()
|
|
89
|
+
|
|
90
|
+
// Read
|
|
91
|
+
const { data, error } = await supabase
|
|
92
|
+
.from('tasks')
|
|
93
|
+
.select('*')
|
|
94
|
+
.eq('completed', false)
|
|
95
|
+
|
|
96
|
+
// Update
|
|
97
|
+
const { data, error } = await supabase
|
|
98
|
+
.from('tasks')
|
|
99
|
+
.update({ completed: true })
|
|
100
|
+
.eq('id', taskId)
|
|
101
|
+
|
|
102
|
+
// Delete
|
|
103
|
+
const { data, error } = await supabase
|
|
104
|
+
.from('tasks')
|
|
105
|
+
.delete()
|
|
106
|
+
.eq('id', taskId)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Authentication Flow
|
|
110
|
+
```typescript
|
|
111
|
+
// 1. Sign up user
|
|
112
|
+
const { data: signUpData, error: signUpError } = await supabase.auth.signUp({
|
|
113
|
+
email: 'user@example.com',
|
|
114
|
+
password: 'secure-password'
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// 2. Sign in
|
|
118
|
+
const { data: signInData, error: signInError } = await supabase.auth.signInWithPassword({
|
|
119
|
+
email: 'user@example.com',
|
|
120
|
+
password: 'secure-password'
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// 3. Check session
|
|
124
|
+
const { data: { session } } = await supabase.auth.getSession()
|
|
125
|
+
|
|
126
|
+
// 4. Sign out
|
|
127
|
+
await supabase.auth.signOut()
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### File Upload with Validation
|
|
131
|
+
```typescript
|
|
132
|
+
// 1. Validate file
|
|
133
|
+
if (file.size > 5 * 1024 * 1024) {
|
|
134
|
+
throw new Error('File too large (max 5MB)')
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// 2. Upload
|
|
138
|
+
const { data, error } = await supabase.storage
|
|
139
|
+
.from('uploads')
|
|
140
|
+
.upload(`${userId}/${file.name}`, file, {
|
|
141
|
+
cacheControl: '3600',
|
|
142
|
+
upsert: false
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
// 3. Get public URL
|
|
146
|
+
if (!error) {
|
|
147
|
+
const { data: { publicUrl } } = supabase.storage
|
|
148
|
+
.from('uploads')
|
|
149
|
+
.getPublicUrl(`${userId}/${file.name}`)
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Best Practices
|
|
154
|
+
|
|
155
|
+
✅ **DO:**
|
|
156
|
+
- Use Row Level Security (RLS) policies
|
|
157
|
+
- Handle errors properly (`if (error) throw error`)
|
|
158
|
+
- Use `.select()` after insert/update to get returned data
|
|
159
|
+
- Use prepared statements (automatic with Supabase)
|
|
160
|
+
- Enable real-time only when needed
|
|
161
|
+
- Use storage buckets with proper permissions
|
|
162
|
+
|
|
163
|
+
❌ **DON'T:**
|
|
164
|
+
- Expose service role key in client code
|
|
165
|
+
- Skip RLS policies (always enable)
|
|
166
|
+
- Ignore error responses
|
|
167
|
+
- Store sensitive data without encryption
|
|
168
|
+
- Use anon key for admin operations
|
|
169
|
+
|
|
170
|
+
## Configuration
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"mcpServers": {
|
|
175
|
+
"supabase": {
|
|
176
|
+
"command": "npx",
|
|
177
|
+
"args": ["-y", "@modelcontextprotocol/server-supabase"],
|
|
178
|
+
"env": {
|
|
179
|
+
"SUPABASE_URL": "https://your-project.supabase.co",
|
|
180
|
+
"SUPABASE_ANON_KEY": "your-anon-key",
|
|
181
|
+
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Security:**
|
|
189
|
+
- Use `SUPABASE_ANON_KEY` for client-side operations
|
|
190
|
+
- Use `SUPABASE_SERVICE_ROLE_KEY` only server-side
|
|
191
|
+
- Never commit keys to version control
|
|
192
|
+
- Enable RLS on all tables
|
|
193
|
+
|
|
194
|
+
## Integration with Development
|
|
195
|
+
|
|
196
|
+
### Testing
|
|
197
|
+
```typescript
|
|
198
|
+
// Use test database for development
|
|
199
|
+
const supabase = createClient(
|
|
200
|
+
process.env.SUPABASE_TEST_URL,
|
|
201
|
+
process.env.SUPABASE_TEST_KEY
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
// Clean up after tests
|
|
205
|
+
afterEach(async () => {
|
|
206
|
+
await supabase.from('test_table').delete().neq('id', 0)
|
|
207
|
+
})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Migrations
|
|
211
|
+
```bash
|
|
212
|
+
# Create migration
|
|
213
|
+
supabase migration new add_users_table
|
|
214
|
+
|
|
215
|
+
# Apply migrations
|
|
216
|
+
supabase db push
|
|
217
|
+
|
|
218
|
+
# Reset database
|
|
219
|
+
supabase db reset
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
<!-- SUPABASE:END -->
|
|
223
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!-- SYNAP:START -->
|
|
2
|
+
# Synap Instructions
|
|
3
|
+
|
|
4
|
+
**CRITICAL**: Use MCP Synap for persistent task and data storage across context windows.
|
|
5
|
+
|
|
6
|
+
## Core Features
|
|
7
|
+
|
|
8
|
+
### Key-Value Store
|
|
9
|
+
```
|
|
10
|
+
synap_kv_set(key, value, ttl?) # Store with optional TTL
|
|
11
|
+
synap_kv_get(key) # Retrieve
|
|
12
|
+
synap_kv_delete(key) # Remove
|
|
13
|
+
synap_kv_scan(prefix) # List by prefix
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Queue & Pub/Sub
|
|
17
|
+
```
|
|
18
|
+
synap_queue_publish(queue, message, priority) # Add to queue
|
|
19
|
+
synap_queue_consume(queue) # Process from queue
|
|
20
|
+
synap_pubsub_publish(topic, message) # Broadcast
|
|
21
|
+
synap_stream_publish(room, event) # Stream events
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Common Patterns
|
|
25
|
+
|
|
26
|
+
### Task Tracking
|
|
27
|
+
```
|
|
28
|
+
Pattern: "task:<feature>:<subtask-id>"
|
|
29
|
+
|
|
30
|
+
synap_kv_set("task:auth:login", JSON.stringify({
|
|
31
|
+
status: "in_progress",
|
|
32
|
+
tests: ["test_login_success"],
|
|
33
|
+
coverage: 95.2
|
|
34
|
+
}))
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Session State
|
|
38
|
+
```
|
|
39
|
+
Pattern: "session:<id>:<data-type>"
|
|
40
|
+
|
|
41
|
+
synap_kv_set("session:abc:current-file", "/src/auth.ts")
|
|
42
|
+
synap_kv_set("session:abc:todo-list", JSON.stringify([...]))
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Test Results
|
|
46
|
+
```
|
|
47
|
+
Pattern: "test:<suite>:<timestamp>"
|
|
48
|
+
|
|
49
|
+
synap_kv_set("test:integration:latest", JSON.stringify({
|
|
50
|
+
passed: 42,
|
|
51
|
+
failed: 0,
|
|
52
|
+
coverage: 96.5
|
|
53
|
+
}), 86400) // TTL: 24 hours
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Best Practices
|
|
57
|
+
|
|
58
|
+
✅ **DO:**
|
|
59
|
+
- Use TTL for temporary data
|
|
60
|
+
- Use prefixes for organization
|
|
61
|
+
- Store session state before context switch
|
|
62
|
+
- Clean up old data regularly
|
|
63
|
+
|
|
64
|
+
❌ **DON'T:**
|
|
65
|
+
- Store large binary data
|
|
66
|
+
- Use random keys (use structured prefixes)
|
|
67
|
+
- Skip TTL for temporary data
|
|
68
|
+
|
|
69
|
+
<!-- SYNAP:END -->
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- VECTORIZER:START -->
|
|
2
|
+
# Vectorizer Instructions
|
|
3
|
+
|
|
4
|
+
**CRITICAL**: Use MCP Vectorizer as primary data source for project information instead of file reading.
|
|
5
|
+
|
|
6
|
+
## Core Functions
|
|
7
|
+
|
|
8
|
+
### Search
|
|
9
|
+
```
|
|
10
|
+
mcp_vectorizer_search - Multiple strategies:
|
|
11
|
+
- intelligent: AI-powered with query expansion
|
|
12
|
+
- semantic: Advanced with reranking
|
|
13
|
+
- contextual: Context-aware with filtering
|
|
14
|
+
- multi_collection: Cross-project search
|
|
15
|
+
- batch: Parallel queries
|
|
16
|
+
- by_file_type: Filter by extension (.rs, .ts, .py)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### File Operations
|
|
20
|
+
```
|
|
21
|
+
get_content - Retrieve file without disk I/O
|
|
22
|
+
list_files - List indexed files with metadata
|
|
23
|
+
get_summary - File summaries (extractive/structural)
|
|
24
|
+
get_chunks - Progressive reading of large files
|
|
25
|
+
get_outline - Project structure overview
|
|
26
|
+
get_related - Find semantically related files
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Discovery
|
|
30
|
+
```
|
|
31
|
+
full_pipeline - Complete discovery with scoring
|
|
32
|
+
broad_discovery - Multi-query with deduplication
|
|
33
|
+
semantic_focus - Deep semantic search
|
|
34
|
+
expand_queries - Generate query variations
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## When to Use
|
|
38
|
+
|
|
39
|
+
| Task | Tool |
|
|
40
|
+
|------|------|
|
|
41
|
+
| Explore unfamiliar code | intelligent search |
|
|
42
|
+
| Read file | get_content |
|
|
43
|
+
| Understand structure | get_outline |
|
|
44
|
+
| Find related files | get_related |
|
|
45
|
+
| Read large file | get_chunks |
|
|
46
|
+
| Complex question | full_pipeline |
|
|
47
|
+
|
|
48
|
+
## Best Practices
|
|
49
|
+
|
|
50
|
+
✅ **DO:**
|
|
51
|
+
- Start with intelligent search for exploration
|
|
52
|
+
- Use file_operations to avoid disk I/O
|
|
53
|
+
- Batch queries for related items
|
|
54
|
+
- Set similarity thresholds (0.6-0.8)
|
|
55
|
+
- Use specific collections when known
|
|
56
|
+
|
|
57
|
+
❌ **DON'T:**
|
|
58
|
+
- Read files from disk when available in vectorizer
|
|
59
|
+
- Use sequential searches (batch instead)
|
|
60
|
+
- Skip similarity thresholds
|
|
61
|
+
- Search entire codebase when collection is known
|
|
62
|
+
|
|
63
|
+
<!-- VECTORIZER:END -->
|