@useconductor/conductor 1.0.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/.claude-plugin/marketplace.json +33 -0
- package/.claude-plugin/plugin.json +23 -0
- package/.eslintrc.json +23 -0
- package/.gitattributes +6 -0
- package/.github/FUNDING.yml +15 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +91 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +63 -0
- package/.github/ISSUE_TEMPLATE/plugin_request.yml +71 -0
- package/.github/README.md +13 -0
- package/.github/workflows/README.md +22 -0
- package/.github/workflows/auto-release.yml +112 -0
- package/.github/workflows/ci.yml +49 -0
- package/.github/workflows/claude-code-review.yml +44 -0
- package/.github/workflows/claude.yml +36 -0
- package/.github/workflows/sync-install.yml +47 -0
- package/.mcp.json +9 -0
- package/.prettierrc.json +7 -0
- package/C.png +0 -0
- package/CHANGELOG.md +74 -0
- package/CLAUDE.md +118 -0
- package/CONTRIBUTING.md +231 -0
- package/LICENSE +201 -0
- package/README.md +179 -0
- package/SECURITY.md +47 -0
- package/commands/conductor-setup.md +11 -0
- package/commands/conductor-status.md +7 -0
- package/dist/ai/base.d.ts +44 -0
- package/dist/ai/base.d.ts.map +1 -0
- package/dist/ai/base.js +47 -0
- package/dist/ai/base.js.map +1 -0
- package/dist/ai/claude.d.ts +11 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +149 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/gemini.d.ts +15 -0
- package/dist/ai/gemini.d.ts.map +1 -0
- package/dist/ai/gemini.js +156 -0
- package/dist/ai/gemini.js.map +1 -0
- package/dist/ai/maestro.d.ts +22 -0
- package/dist/ai/maestro.d.ts.map +1 -0
- package/dist/ai/maestro.js +142 -0
- package/dist/ai/maestro.js.map +1 -0
- package/dist/ai/manager.d.ts +47 -0
- package/dist/ai/manager.d.ts.map +1 -0
- package/dist/ai/manager.js +450 -0
- package/dist/ai/manager.js.map +1 -0
- package/dist/ai/ollama.d.ts +16 -0
- package/dist/ai/ollama.d.ts.map +1 -0
- package/dist/ai/ollama.js +151 -0
- package/dist/ai/ollama.js.map +1 -0
- package/dist/ai/openai.d.ts +11 -0
- package/dist/ai/openai.d.ts.map +1 -0
- package/dist/ai/openai.js +132 -0
- package/dist/ai/openai.js.map +1 -0
- package/dist/ai/openrouter.d.ts +11 -0
- package/dist/ai/openrouter.d.ts.map +1 -0
- package/dist/ai/openrouter.js +139 -0
- package/dist/ai/openrouter.js.map +1 -0
- package/dist/bot/slack.d.ts +17 -0
- package/dist/bot/slack.d.ts.map +1 -0
- package/dist/bot/slack.js +144 -0
- package/dist/bot/slack.js.map +1 -0
- package/dist/bot/telegram.d.ts +19 -0
- package/dist/bot/telegram.d.ts.map +1 -0
- package/dist/bot/telegram.js +157 -0
- package/dist/bot/telegram.js.map +1 -0
- package/dist/cli/commands/ai.d.ts +4 -0
- package/dist/cli/commands/ai.d.ts.map +1 -0
- package/dist/cli/commands/ai.js +161 -0
- package/dist/cli/commands/ai.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +213 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +281 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +16 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +750 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts +4 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/lifecycle.js +84 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/marketplace.d.ts +13 -0
- package/dist/cli/commands/marketplace.d.ts.map +1 -0
- package/dist/cli/commands/marketplace.js +197 -0
- package/dist/cli/commands/marketplace.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +83 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +10 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +207 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/plugin-create.d.ts +13 -0
- package/dist/cli/commands/plugin-create.d.ts.map +1 -0
- package/dist/cli/commands/plugin-create.js +122 -0
- package/dist/cli/commands/plugin-create.js.map +1 -0
- package/dist/cli/commands/plugins.d.ts +5 -0
- package/dist/cli/commands/plugins.d.ts.map +1 -0
- package/dist/cli/commands/plugins.js +30 -0
- package/dist/cli/commands/plugins.js.map +1 -0
- package/dist/cli/commands/release.d.ts +13 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +243 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/telegram.d.ts +3 -0
- package/dist/cli/commands/telegram.d.ts.map +1 -0
- package/dist/cli/commands/telegram.js +20 -0
- package/dist/cli/commands/telegram.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +402 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/oauth.d.ts +8 -0
- package/dist/config/oauth.d.ts.map +1 -0
- package/dist/config/oauth.js +13 -0
- package/dist/config/oauth.js.map +1 -0
- package/dist/core/audit.d.ts +91 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +233 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/circuit-breaker.d.ts +56 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -0
- package/dist/core/circuit-breaker.js +107 -0
- package/dist/core/circuit-breaker.js.map +1 -0
- package/dist/core/conductor.d.ts +44 -0
- package/dist/core/conductor.d.ts.map +1 -0
- package/dist/core/conductor.js +200 -0
- package/dist/core/conductor.js.map +1 -0
- package/dist/core/config.d.ts +66 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +86 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/database.d.ts +59 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +342 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/errors.d.ts +231 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +254 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/health.d.ts +72 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +116 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/interfaces.d.ts +62 -0
- package/dist/core/interfaces.d.ts.map +1 -0
- package/dist/core/interfaces.js +8 -0
- package/dist/core/interfaces.js.map +1 -0
- package/dist/core/logger.d.ts +15 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +30 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/rbac.d.ts +132 -0
- package/dist/core/rbac.d.ts.map +1 -0
- package/dist/core/rbac.js +230 -0
- package/dist/core/rbac.js.map +1 -0
- package/dist/core/retry.d.ts +22 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +41 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/webhooks.d.ts +92 -0
- package/dist/core/webhooks.d.ts.map +1 -0
- package/dist/core/webhooks.js +176 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/core/zero-config.d.ts +22 -0
- package/dist/core/zero-config.d.ts.map +1 -0
- package/dist/core/zero-config.js +59 -0
- package/dist/core/zero-config.js.map +1 -0
- package/dist/dashboard/cli.d.ts +6 -0
- package/dist/dashboard/cli.d.ts.map +1 -0
- package/dist/dashboard/cli.js +42 -0
- package/dist/dashboard/cli.js.map +1 -0
- package/dist/dashboard/index.html +3426 -0
- package/dist/dashboard/server.d.ts +7 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +1427 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +380 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/misc.d.ts +15 -0
- package/dist/mcp/tools/misc.d.ts.map +1 -0
- package/dist/mcp/tools/misc.js +49 -0
- package/dist/mcp/tools/misc.js.map +1 -0
- package/dist/plugins/builtin/calculator.d.ts +11 -0
- package/dist/plugins/builtin/calculator.d.ts.map +1 -0
- package/dist/plugins/builtin/calculator.js +166 -0
- package/dist/plugins/builtin/calculator.js.map +1 -0
- package/dist/plugins/builtin/colors.d.ts +15 -0
- package/dist/plugins/builtin/colors.d.ts.map +1 -0
- package/dist/plugins/builtin/colors.js +193 -0
- package/dist/plugins/builtin/colors.js.map +1 -0
- package/dist/plugins/builtin/cron.d.ts +40 -0
- package/dist/plugins/builtin/cron.d.ts.map +1 -0
- package/dist/plugins/builtin/cron.js +578 -0
- package/dist/plugins/builtin/cron.js.map +1 -0
- package/dist/plugins/builtin/crypto.d.ts +11 -0
- package/dist/plugins/builtin/crypto.d.ts.map +1 -0
- package/dist/plugins/builtin/crypto.js +83 -0
- package/dist/plugins/builtin/crypto.js.map +1 -0
- package/dist/plugins/builtin/database.d.ts +29 -0
- package/dist/plugins/builtin/database.d.ts.map +1 -0
- package/dist/plugins/builtin/database.js +230 -0
- package/dist/plugins/builtin/database.js.map +1 -0
- package/dist/plugins/builtin/docker.d.ts +12 -0
- package/dist/plugins/builtin/docker.d.ts.map +1 -0
- package/dist/plugins/builtin/docker.js +436 -0
- package/dist/plugins/builtin/docker.js.map +1 -0
- package/dist/plugins/builtin/fun.d.ts +11 -0
- package/dist/plugins/builtin/fun.d.ts.map +1 -0
- package/dist/plugins/builtin/fun.js +114 -0
- package/dist/plugins/builtin/fun.js.map +1 -0
- package/dist/plugins/builtin/gcal.d.ts +38 -0
- package/dist/plugins/builtin/gcal.d.ts.map +1 -0
- package/dist/plugins/builtin/gcal.js +280 -0
- package/dist/plugins/builtin/gcal.js.map +1 -0
- package/dist/plugins/builtin/gdrive.d.ts +26 -0
- package/dist/plugins/builtin/gdrive.d.ts.map +1 -0
- package/dist/plugins/builtin/gdrive.js +295 -0
- package/dist/plugins/builtin/gdrive.js.map +1 -0
- package/dist/plugins/builtin/github-actions.d.ts +38 -0
- package/dist/plugins/builtin/github-actions.d.ts.map +1 -0
- package/dist/plugins/builtin/github-actions.js +629 -0
- package/dist/plugins/builtin/github-actions.js.map +1 -0
- package/dist/plugins/builtin/github.d.ts +26 -0
- package/dist/plugins/builtin/github.d.ts.map +1 -0
- package/dist/plugins/builtin/github.js +800 -0
- package/dist/plugins/builtin/github.js.map +1 -0
- package/dist/plugins/builtin/gmail.d.ts +50 -0
- package/dist/plugins/builtin/gmail.d.ts.map +1 -0
- package/dist/plugins/builtin/gmail.js +445 -0
- package/dist/plugins/builtin/gmail.js.map +1 -0
- package/dist/plugins/builtin/hash.d.ts +11 -0
- package/dist/plugins/builtin/hash.d.ts.map +1 -0
- package/dist/plugins/builtin/hash.js +95 -0
- package/dist/plugins/builtin/hash.js.map +1 -0
- package/dist/plugins/builtin/homekit.d.ts +53 -0
- package/dist/plugins/builtin/homekit.d.ts.map +1 -0
- package/dist/plugins/builtin/homekit.js +341 -0
- package/dist/plugins/builtin/homekit.js.map +1 -0
- package/dist/plugins/builtin/index.d.ts +4 -0
- package/dist/plugins/builtin/index.d.ts.map +1 -0
- package/dist/plugins/builtin/index.js +96 -0
- package/dist/plugins/builtin/index.js.map +1 -0
- package/dist/plugins/builtin/jira.d.ts +50 -0
- package/dist/plugins/builtin/jira.d.ts.map +1 -0
- package/dist/plugins/builtin/jira.js +353 -0
- package/dist/plugins/builtin/jira.js.map +1 -0
- package/dist/plugins/builtin/linear.d.ts +35 -0
- package/dist/plugins/builtin/linear.d.ts.map +1 -0
- package/dist/plugins/builtin/linear.js +397 -0
- package/dist/plugins/builtin/linear.js.map +1 -0
- package/dist/plugins/builtin/lumen.d.ts +21 -0
- package/dist/plugins/builtin/lumen.d.ts.map +1 -0
- package/dist/plugins/builtin/lumen.js +404 -0
- package/dist/plugins/builtin/lumen.js.map +1 -0
- package/dist/plugins/builtin/memory.d.ts +22 -0
- package/dist/plugins/builtin/memory.d.ts.map +1 -0
- package/dist/plugins/builtin/memory.js +184 -0
- package/dist/plugins/builtin/memory.js.map +1 -0
- package/dist/plugins/builtin/n8n.d.ts +60 -0
- package/dist/plugins/builtin/n8n.d.ts.map +1 -0
- package/dist/plugins/builtin/n8n.js +519 -0
- package/dist/plugins/builtin/n8n.js.map +1 -0
- package/dist/plugins/builtin/network.d.ts +11 -0
- package/dist/plugins/builtin/network.d.ts.map +1 -0
- package/dist/plugins/builtin/network.js +88 -0
- package/dist/plugins/builtin/network.js.map +1 -0
- package/dist/plugins/builtin/notes.d.ts +47 -0
- package/dist/plugins/builtin/notes.d.ts.map +1 -0
- package/dist/plugins/builtin/notes.js +641 -0
- package/dist/plugins/builtin/notes.js.map +1 -0
- package/dist/plugins/builtin/notion.d.ts +47 -0
- package/dist/plugins/builtin/notion.d.ts.map +1 -0
- package/dist/plugins/builtin/notion.js +317 -0
- package/dist/plugins/builtin/notion.js.map +1 -0
- package/dist/plugins/builtin/shell.d.ts +12 -0
- package/dist/plugins/builtin/shell.d.ts.map +1 -0
- package/dist/plugins/builtin/shell.js +310 -0
- package/dist/plugins/builtin/shell.js.map +1 -0
- package/dist/plugins/builtin/slack.d.ts +31 -0
- package/dist/plugins/builtin/slack.d.ts.map +1 -0
- package/dist/plugins/builtin/slack.js +295 -0
- package/dist/plugins/builtin/slack.js.map +1 -0
- package/dist/plugins/builtin/spotify.d.ts +55 -0
- package/dist/plugins/builtin/spotify.d.ts.map +1 -0
- package/dist/plugins/builtin/spotify.js +623 -0
- package/dist/plugins/builtin/spotify.js.map +1 -0
- package/dist/plugins/builtin/stripe.d.ts +35 -0
- package/dist/plugins/builtin/stripe.d.ts.map +1 -0
- package/dist/plugins/builtin/stripe.js +376 -0
- package/dist/plugins/builtin/stripe.js.map +1 -0
- package/dist/plugins/builtin/system.d.ts +11 -0
- package/dist/plugins/builtin/system.d.ts.map +1 -0
- package/dist/plugins/builtin/system.js +91 -0
- package/dist/plugins/builtin/system.js.map +1 -0
- package/dist/plugins/builtin/text-tools.d.ts +11 -0
- package/dist/plugins/builtin/text-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/text-tools.js +146 -0
- package/dist/plugins/builtin/text-tools.js.map +1 -0
- package/dist/plugins/builtin/timezone.d.ts +13 -0
- package/dist/plugins/builtin/timezone.d.ts.map +1 -0
- package/dist/plugins/builtin/timezone.js +164 -0
- package/dist/plugins/builtin/timezone.js.map +1 -0
- package/dist/plugins/builtin/todoist.d.ts +49 -0
- package/dist/plugins/builtin/todoist.d.ts.map +1 -0
- package/dist/plugins/builtin/todoist.js +540 -0
- package/dist/plugins/builtin/todoist.js.map +1 -0
- package/dist/plugins/builtin/translate.d.ts +11 -0
- package/dist/plugins/builtin/translate.d.ts.map +1 -0
- package/dist/plugins/builtin/translate.js +42 -0
- package/dist/plugins/builtin/translate.js.map +1 -0
- package/dist/plugins/builtin/url-tools.d.ts +11 -0
- package/dist/plugins/builtin/url-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/url-tools.js +70 -0
- package/dist/plugins/builtin/url-tools.js.map +1 -0
- package/dist/plugins/builtin/vercel.d.ts +55 -0
- package/dist/plugins/builtin/vercel.d.ts.map +1 -0
- package/dist/plugins/builtin/vercel.js +514 -0
- package/dist/plugins/builtin/vercel.js.map +1 -0
- package/dist/plugins/builtin/weather.d.ts +13 -0
- package/dist/plugins/builtin/weather.d.ts.map +1 -0
- package/dist/plugins/builtin/weather.js +103 -0
- package/dist/plugins/builtin/weather.js.map +1 -0
- package/dist/plugins/builtin/x.d.ts +54 -0
- package/dist/plugins/builtin/x.d.ts.map +1 -0
- package/dist/plugins/builtin/x.js +402 -0
- package/dist/plugins/builtin/x.js.map +1 -0
- package/dist/plugins/manager.d.ts +77 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +141 -0
- package/dist/plugins/manager.js.map +1 -0
- package/dist/plugins/validation.d.ts +18 -0
- package/dist/plugins/validation.d.ts.map +1 -0
- package/dist/plugins/validation.js +81 -0
- package/dist/plugins/validation.js.map +1 -0
- package/dist/security/auth.d.ts +23 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +56 -0
- package/dist/security/auth.js.map +1 -0
- package/dist/security/keychain.d.ts +60 -0
- package/dist/security/keychain.d.ts.map +1 -0
- package/dist/security/keychain.js +213 -0
- package/dist/security/keychain.js.map +1 -0
- package/dist/utils/google-auth.d.ts +21 -0
- package/dist/utils/google-auth.d.ts.map +1 -0
- package/dist/utils/google-auth.js +135 -0
- package/dist/utils/google-auth.js.map +1 -0
- package/dist/utils/retry.d.ts +5 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +34 -0
- package/dist/utils/retry.js.map +1 -0
- package/docs/README.md +13 -0
- package/docs/api.md +210 -0
- package/docs/getting-started.md +100 -0
- package/docs/plugins.md +306 -0
- package/docs-site/.vitepress/config.ts +59 -0
- package/docs-site/README.md +12 -0
- package/docs-site/index.md +30 -0
- package/eslint.config.js +29 -0
- package/install.ps1 +334 -0
- package/install.sh +1119 -0
- package/local-install.sh +304 -0
- package/package.json +90 -0
- package/packages/README.md +11 -0
- package/packages/plugin-sdk/README.md +12 -0
- package/packages/plugin-sdk/package.json +22 -0
- package/packages/plugin-sdk/src/README.md +11 -0
- package/packages/plugin-sdk/src/index.ts +191 -0
- package/sdks/README.md +26 -0
- package/sdks/csharp/ConductorClient.cs +65 -0
- package/sdks/csharp/README.md +11 -0
- package/sdks/go/README.md +11 -0
- package/sdks/go/conductor.go +257 -0
- package/sdks/java/ConductorClient.java +27 -0
- package/sdks/java/README.md +11 -0
- package/sdks/php/README.md +11 -0
- package/sdks/php/src/Client.php +72 -0
- package/sdks/python/README.md +12 -0
- package/sdks/python/conductor/__init__.py +227 -0
- package/sdks/python/pyproject.toml +30 -0
- package/sdks/ruby/README.md +11 -0
- package/sdks/ruby/lib/conductor.rb +46 -0
- package/sdks/rust/Cargo.toml +14 -0
- package/sdks/rust/README.md +11 -0
- package/sdks/swift/README.md +11 -0
- package/sdks/swift/Sources/Conductor/ConductorClient.swift +65 -0
- package/skills/conductor-mcp/SKILL.md +38 -0
- package/src/README.md +20 -0
- package/src/ai/README.md +18 -0
- package/src/ai/base.ts +93 -0
- package/src/ai/claude.ts +162 -0
- package/src/ai/gemini.ts +188 -0
- package/src/ai/maestro.ts +168 -0
- package/src/ai/manager.ts +537 -0
- package/src/ai/ollama.ts +186 -0
- package/src/ai/openai.ts +147 -0
- package/src/ai/openrouter.ts +152 -0
- package/src/bot/README.md +12 -0
- package/src/bot/slack.ts +164 -0
- package/src/bot/telegram.ts +185 -0
- package/src/cli/README.md +24 -0
- package/src/cli/commands/README.md +20 -0
- package/src/cli/commands/ai.ts +170 -0
- package/src/cli/commands/doctor.ts +221 -0
- package/src/cli/commands/init.ts +348 -0
- package/src/cli/commands/install.ts +792 -0
- package/src/cli/commands/lifecycle.ts +95 -0
- package/src/cli/commands/marketplace.ts +253 -0
- package/src/cli/commands/mcp.ts +92 -0
- package/src/cli/commands/onboard.ts +248 -0
- package/src/cli/commands/plugin-create.ts +130 -0
- package/src/cli/commands/plugins.ts +36 -0
- package/src/cli/commands/release.ts +251 -0
- package/src/cli/commands/telegram.ts +25 -0
- package/src/cli/index.ts +450 -0
- package/src/config/README.md +11 -0
- package/src/config/oauth.ts +26 -0
- package/src/core/README.md +22 -0
- package/src/core/audit.ts +291 -0
- package/src/core/circuit-breaker.ts +129 -0
- package/src/core/conductor.ts +240 -0
- package/src/core/config.ts +149 -0
- package/src/core/database.ts +411 -0
- package/src/core/errors.ts +275 -0
- package/src/core/health.ts +159 -0
- package/src/core/interfaces.ts +75 -0
- package/src/core/logger.ts +33 -0
- package/src/core/rbac.ts +321 -0
- package/src/core/retry.ts +61 -0
- package/src/core/webhooks.ts +234 -0
- package/src/core/zero-config.ts +72 -0
- package/src/dashboard/README.md +15 -0
- package/src/dashboard/cli.ts +48 -0
- package/src/dashboard/index.html +3426 -0
- package/src/dashboard/server.ts +1544 -0
- package/src/mcp/README.md +20 -0
- package/src/mcp/server.ts +475 -0
- package/src/mcp/tools/README.md +11 -0
- package/src/mcp/tools/misc.ts +61 -0
- package/src/plugins/README.md +28 -0
- package/src/plugins/builtin/README.md +23 -0
- package/src/plugins/builtin/calculator.ts +178 -0
- package/src/plugins/builtin/colors.ts +201 -0
- package/src/plugins/builtin/cron.ts +649 -0
- package/src/plugins/builtin/crypto.ts +85 -0
- package/src/plugins/builtin/database.ts +235 -0
- package/src/plugins/builtin/docker.ts +426 -0
- package/src/plugins/builtin/fun.ts +118 -0
- package/src/plugins/builtin/gcal.ts +305 -0
- package/src/plugins/builtin/gdrive.ts +326 -0
- package/src/plugins/builtin/github-actions.ts +666 -0
- package/src/plugins/builtin/github.ts +912 -0
- package/src/plugins/builtin/gmail.ts +492 -0
- package/src/plugins/builtin/hash.ts +98 -0
- package/src/plugins/builtin/homekit.ts +389 -0
- package/src/plugins/builtin/index.ts +116 -0
- package/src/plugins/builtin/jira.ts +380 -0
- package/src/plugins/builtin/linear.ts +448 -0
- package/src/plugins/builtin/lumen.ts +497 -0
- package/src/plugins/builtin/memory.ts +200 -0
- package/src/plugins/builtin/n8n.ts +565 -0
- package/src/plugins/builtin/network.ts +92 -0
- package/src/plugins/builtin/notes.ts +689 -0
- package/src/plugins/builtin/notion.ts +348 -0
- package/src/plugins/builtin/shell.ts +334 -0
- package/src/plugins/builtin/slack.ts +327 -0
- package/src/plugins/builtin/spotify.ts +665 -0
- package/src/plugins/builtin/stripe.ts +388 -0
- package/src/plugins/builtin/system.ts +93 -0
- package/src/plugins/builtin/text-tools.ts +150 -0
- package/src/plugins/builtin/timezone.ts +173 -0
- package/src/plugins/builtin/todoist.ts +625 -0
- package/src/plugins/builtin/translate.ts +47 -0
- package/src/plugins/builtin/url-tools.ts +73 -0
- package/src/plugins/builtin/vercel.ts +546 -0
- package/src/plugins/builtin/weather.ts +112 -0
- package/src/plugins/builtin/x.ts +440 -0
- package/src/plugins/manager.ts +213 -0
- package/src/plugins/validation.ts +94 -0
- package/src/security/README.md +12 -0
- package/src/security/auth.ts +72 -0
- package/src/security/keychain.ts +226 -0
- package/src/utils/README.md +12 -0
- package/src/utils/google-auth.ts +159 -0
- package/src/utils/retry.ts +41 -0
- package/test-all.mjs +1256 -0
- package/test.mjs +633 -0
- package/tests/README.md +19 -0
- package/tests/calculator.test.ts +54 -0
- package/tests/docker.test.ts +42 -0
- package/tests/load.test.ts +129 -0
- package/tests/mcp.test.ts +14 -0
- package/tests/shell.test.ts +42 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notes Plugin — TheAlxLabs / Conductor
|
|
3
|
+
*
|
|
4
|
+
* Local markdown notes that the AI can read, write, and search.
|
|
5
|
+
* Zero API dependencies — works completely offline.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Full-text search across all notes
|
|
9
|
+
* - Tag system with auto-detection
|
|
10
|
+
* - Daily journal with automatic dating
|
|
11
|
+
* - Note templates (meeting, todo, idea, project)
|
|
12
|
+
* - Pinning, archiving
|
|
13
|
+
* - Link detection between notes (wiki-style [[note-name]])
|
|
14
|
+
* - Automatic backlinks
|
|
15
|
+
*
|
|
16
|
+
* Stored at: ~/.conductor/notes/ (plain .md files)
|
|
17
|
+
*
|
|
18
|
+
* No setup required — just use it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import crypto from 'crypto';
|
|
22
|
+
import fs from 'fs/promises';
|
|
23
|
+
import path from 'path';
|
|
24
|
+
import { Plugin, PluginTool } from '../manager.js';
|
|
25
|
+
import { Conductor } from '../../core/conductor.js';
|
|
26
|
+
|
|
27
|
+
interface NoteMetadata {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
tags: string[];
|
|
31
|
+
pinned: boolean;
|
|
32
|
+
archived: boolean;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
wordCount: number;
|
|
36
|
+
backlinks: string[]; // IDs of notes that link to this one
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface Note extends NoteMetadata {
|
|
40
|
+
content: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const TEMPLATES: Record<string, string> = {
|
|
44
|
+
meeting: `# Meeting: {title}
|
|
45
|
+
|
|
46
|
+
**Date:** {date}
|
|
47
|
+
**Attendees:**
|
|
48
|
+
|
|
49
|
+
## Agenda
|
|
50
|
+
-
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Action Items
|
|
56
|
+
- [ ]
|
|
57
|
+
|
|
58
|
+
## Decisions Made
|
|
59
|
+
|
|
60
|
+
`,
|
|
61
|
+
todo: `# {title}
|
|
62
|
+
|
|
63
|
+
## To Do
|
|
64
|
+
- [ ]
|
|
65
|
+
- [ ]
|
|
66
|
+
- [ ]
|
|
67
|
+
|
|
68
|
+
## In Progress
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Done
|
|
72
|
+
|
|
73
|
+
`,
|
|
74
|
+
idea: `# Idea: {title}
|
|
75
|
+
|
|
76
|
+
**Date:** {date}
|
|
77
|
+
|
|
78
|
+
## The Concept
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Why It Matters
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## How It Could Work
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Next Steps
|
|
88
|
+
- [ ]
|
|
89
|
+
|
|
90
|
+
`,
|
|
91
|
+
project: `# Project: {title}
|
|
92
|
+
|
|
93
|
+
**Started:** {date}
|
|
94
|
+
**Status:** Planning
|
|
95
|
+
|
|
96
|
+
## Goal
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Technical Approach
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## Tasks
|
|
103
|
+
- [ ]
|
|
104
|
+
|
|
105
|
+
## Notes
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## Links & Resources
|
|
109
|
+
|
|
110
|
+
`,
|
|
111
|
+
daily: `# {date}
|
|
112
|
+
|
|
113
|
+
## What I'm Working On
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## Notes
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## Ideas
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## End of Day Reflection
|
|
123
|
+
|
|
124
|
+
`,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export class NotesPlugin implements Plugin {
|
|
128
|
+
name = 'notes';
|
|
129
|
+
description = 'Local markdown notes — create, search, tag, link, and manage notes entirely offline';
|
|
130
|
+
version = '1.0.0';
|
|
131
|
+
|
|
132
|
+
private notesDir!: string;
|
|
133
|
+
private indexPath!: string;
|
|
134
|
+
private index: Map<string, NoteMetadata> = new Map();
|
|
135
|
+
private indexLoaded = false;
|
|
136
|
+
|
|
137
|
+
async initialize(conductor: Conductor): Promise<void> {
|
|
138
|
+
const configDir = conductor.getConfig().getConfigDir();
|
|
139
|
+
this.notesDir = path.join(configDir, 'notes');
|
|
140
|
+
this.indexPath = path.join(this.notesDir, '.index.json');
|
|
141
|
+
await fs.mkdir(this.notesDir, { recursive: true });
|
|
142
|
+
await this.loadIndex();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
isConfigured(): boolean {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ── Index management ────────────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
private async loadIndex(): Promise<void> {
|
|
152
|
+
if (this.indexLoaded) return;
|
|
153
|
+
try {
|
|
154
|
+
const raw = await fs.readFile(this.indexPath, 'utf-8');
|
|
155
|
+
const arr: NoteMetadata[] = JSON.parse(raw);
|
|
156
|
+
this.index = new Map(arr.map((n) => [n.id, n]));
|
|
157
|
+
} catch {
|
|
158
|
+
this.index = new Map();
|
|
159
|
+
}
|
|
160
|
+
this.indexLoaded = true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private async saveIndex(): Promise<void> {
|
|
164
|
+
const arr = Array.from(this.index.values());
|
|
165
|
+
const tmp = this.indexPath + '.tmp';
|
|
166
|
+
await fs.writeFile(tmp, JSON.stringify(arr, null, 2));
|
|
167
|
+
await fs.rename(tmp, this.indexPath);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
private noteFilePath(id: string): string {
|
|
171
|
+
return path.join(this.notesDir, `${id}.md`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private async readNote(id: string): Promise<Note | null> {
|
|
175
|
+
const meta = this.index.get(id);
|
|
176
|
+
if (!meta) return null;
|
|
177
|
+
try {
|
|
178
|
+
const content = await fs.readFile(this.noteFilePath(id), 'utf-8');
|
|
179
|
+
return { ...meta, content };
|
|
180
|
+
} catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ── Helpers ─────────────────────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
private extractTags(content: string): string[] {
|
|
188
|
+
const matches = content.match(/#([a-zA-Z][a-zA-Z0-9_-]*)/g) ?? [];
|
|
189
|
+
return [...new Set(matches.map((t) => t.slice(1).toLowerCase()))];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private extractLinks(content: string): string[] {
|
|
193
|
+
// [[note-title]] style links
|
|
194
|
+
const matches = content.match(/\[\[([^\]]+)\]\]/g) ?? [];
|
|
195
|
+
return matches.map((m) => m.slice(2, -2));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private extractTitle(content: string, fallback: string): string {
|
|
199
|
+
const h1 = content.match(/^#\s+(.+)/m);
|
|
200
|
+
return h1?.[1]?.trim() ?? fallback;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private wordCount(content: string): number {
|
|
204
|
+
return content.split(/\s+/).filter(Boolean).length;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private generateId(title: string): string {
|
|
208
|
+
const slug = title
|
|
209
|
+
.toLowerCase()
|
|
210
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
211
|
+
.replace(/^-|-$/g, '')
|
|
212
|
+
.slice(0, 40);
|
|
213
|
+
const unique = crypto.randomBytes(3).toString('hex');
|
|
214
|
+
return `${slug}-${unique}`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private applyTemplate(template: string, title: string): string {
|
|
218
|
+
const date = new Date().toISOString().split('T')[0];
|
|
219
|
+
return template.replace(/\{title\}/g, title).replace(/\{date\}/g, date);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private scoreSearch(query: string, content: string, title: string, tags: string[]): number {
|
|
223
|
+
const q = query.toLowerCase();
|
|
224
|
+
const words = q.split(/\s+/).filter(Boolean);
|
|
225
|
+
let score = 0;
|
|
226
|
+
for (const word of words) {
|
|
227
|
+
if (title.toLowerCase().includes(word)) score += 10;
|
|
228
|
+
if (tags.some((t) => t.includes(word))) score += 5;
|
|
229
|
+
const contentMatches = (content.toLowerCase().match(new RegExp(word, 'g')) ?? []).length;
|
|
230
|
+
score += contentMatches;
|
|
231
|
+
}
|
|
232
|
+
return score;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Update backlinks across all notes when a note's links change. */
|
|
236
|
+
private async rebuildBacklinks(noteId: string, linkedTitles: string[]): Promise<void> {
|
|
237
|
+
// Find note IDs matching the linked titles
|
|
238
|
+
const linkedIds = new Set<string>();
|
|
239
|
+
for (const title of linkedTitles) {
|
|
240
|
+
for (const [id, meta] of this.index.entries()) {
|
|
241
|
+
if (meta.title.toLowerCase() === title.toLowerCase()) {
|
|
242
|
+
linkedIds.add(id);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Add this noteId as backlink to all linked notes
|
|
247
|
+
for (const [id, meta] of this.index.entries()) {
|
|
248
|
+
const shouldHaveBacklink = linkedIds.has(id);
|
|
249
|
+
const hasBacklink = meta.backlinks.includes(noteId);
|
|
250
|
+
if (shouldHaveBacklink && !hasBacklink) {
|
|
251
|
+
meta.backlinks = [...meta.backlinks, noteId];
|
|
252
|
+
} else if (!shouldHaveBacklink && hasBacklink) {
|
|
253
|
+
meta.backlinks = meta.backlinks.filter((b) => b !== noteId);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ── Tools ───────────────────────────────────────────────────────────────────
|
|
259
|
+
|
|
260
|
+
getTools(): PluginTool[] {
|
|
261
|
+
return [
|
|
262
|
+
// ── notes_create ────────────────────────────────────────────────────────
|
|
263
|
+
{
|
|
264
|
+
name: 'notes_create',
|
|
265
|
+
description: 'Create a new note. Supports templates: meeting, todo, idea, project, daily.',
|
|
266
|
+
inputSchema: {
|
|
267
|
+
type: 'object',
|
|
268
|
+
properties: {
|
|
269
|
+
title: { type: 'string', description: 'Note title' },
|
|
270
|
+
content: { type: 'string', description: 'Note content in markdown' },
|
|
271
|
+
template: {
|
|
272
|
+
type: 'string',
|
|
273
|
+
enum: ['meeting', 'todo', 'idea', 'project', 'daily'],
|
|
274
|
+
description: 'Use a template instead of blank content',
|
|
275
|
+
},
|
|
276
|
+
tags: {
|
|
277
|
+
type: 'array',
|
|
278
|
+
items: { type: 'string' },
|
|
279
|
+
description: 'Tags to apply (also auto-detected from #hashtags in content)',
|
|
280
|
+
},
|
|
281
|
+
pin: { type: 'boolean', description: 'Pin this note (default: false)' },
|
|
282
|
+
},
|
|
283
|
+
required: ['title'],
|
|
284
|
+
},
|
|
285
|
+
handler: async ({ title, content, template, tags = [], pin = false }: any) => {
|
|
286
|
+
await this.loadIndex();
|
|
287
|
+
|
|
288
|
+
let noteContent = content ?? '';
|
|
289
|
+
if (template && !content) {
|
|
290
|
+
const tmpl = TEMPLATES[template];
|
|
291
|
+
if (tmpl) noteContent = this.applyTemplate(tmpl, title);
|
|
292
|
+
} else if (!content) {
|
|
293
|
+
noteContent = `# ${title}\n\n`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const id = this.generateId(title);
|
|
297
|
+
const now = new Date().toISOString();
|
|
298
|
+
const extractedTags = [...new Set([...tags, ...this.extractTags(noteContent)])];
|
|
299
|
+
const links = this.extractLinks(noteContent);
|
|
300
|
+
|
|
301
|
+
const meta: NoteMetadata = {
|
|
302
|
+
id,
|
|
303
|
+
title: this.extractTitle(noteContent, title),
|
|
304
|
+
tags: extractedTags,
|
|
305
|
+
pinned: pin,
|
|
306
|
+
archived: false,
|
|
307
|
+
createdAt: now,
|
|
308
|
+
updatedAt: now,
|
|
309
|
+
wordCount: this.wordCount(noteContent),
|
|
310
|
+
backlinks: [],
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
await fs.writeFile(this.noteFilePath(id), noteContent, { encoding: 'utf-8' });
|
|
314
|
+
this.index.set(id, meta);
|
|
315
|
+
await this.rebuildBacklinks(id, links);
|
|
316
|
+
await this.saveIndex();
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
created: true,
|
|
320
|
+
id,
|
|
321
|
+
title: meta.title,
|
|
322
|
+
tags: meta.tags,
|
|
323
|
+
wordCount: meta.wordCount,
|
|
324
|
+
path: this.noteFilePath(id),
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
// ── notes_read ──────────────────────────────────────────────────────────
|
|
330
|
+
{
|
|
331
|
+
name: 'notes_read',
|
|
332
|
+
description: 'Read a note by ID or title',
|
|
333
|
+
inputSchema: {
|
|
334
|
+
type: 'object',
|
|
335
|
+
properties: {
|
|
336
|
+
id: { type: 'string', description: 'Note ID' },
|
|
337
|
+
title: { type: 'string', description: 'Note title (fuzzy match if ID not known)' },
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
handler: async ({ id, title }: any) => {
|
|
341
|
+
await this.loadIndex();
|
|
342
|
+
|
|
343
|
+
let noteId = id;
|
|
344
|
+
if (!noteId && title) {
|
|
345
|
+
// Find best match by title
|
|
346
|
+
let bestScore = 0;
|
|
347
|
+
for (const [nid, meta] of this.index.entries()) {
|
|
348
|
+
if (meta.archived) continue;
|
|
349
|
+
const score = this.scoreSearch(title, '', meta.title, meta.tags);
|
|
350
|
+
if (score > bestScore) {
|
|
351
|
+
bestScore = score;
|
|
352
|
+
noteId = nid;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!noteId) return { error: 'Note not found. Try notes_search.' };
|
|
358
|
+
const note = await this.readNote(noteId);
|
|
359
|
+
if (!note) return { error: `Note ${noteId} not found.` };
|
|
360
|
+
|
|
361
|
+
// Resolve backlink titles
|
|
362
|
+
const backlinkTitles = note.backlinks.map((bid) => this.index.get(bid)?.title ?? bid).filter(Boolean);
|
|
363
|
+
|
|
364
|
+
return {
|
|
365
|
+
...note,
|
|
366
|
+
backlinkTitles,
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
// ── notes_update ────────────────────────────────────────────────────────
|
|
372
|
+
{
|
|
373
|
+
name: 'notes_update',
|
|
374
|
+
description: 'Update the content or metadata of an existing note',
|
|
375
|
+
inputSchema: {
|
|
376
|
+
type: 'object',
|
|
377
|
+
properties: {
|
|
378
|
+
id: { type: 'string', description: 'Note ID' },
|
|
379
|
+
content: { type: 'string', description: 'New content (replaces existing)' },
|
|
380
|
+
append: {
|
|
381
|
+
type: 'string',
|
|
382
|
+
description: 'Text to append to the end of the note (use instead of content to add)',
|
|
383
|
+
},
|
|
384
|
+
title: { type: 'string', description: 'New title' },
|
|
385
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Replace tags' },
|
|
386
|
+
addTags: { type: 'array', items: { type: 'string' }, description: 'Add tags' },
|
|
387
|
+
pin: { type: 'boolean', description: 'Set pin state' },
|
|
388
|
+
archive: { type: 'boolean', description: 'Archive this note' },
|
|
389
|
+
},
|
|
390
|
+
required: ['id'],
|
|
391
|
+
},
|
|
392
|
+
handler: async ({ id, content, append, title, tags, addTags, pin, archive }: any) => {
|
|
393
|
+
await this.loadIndex();
|
|
394
|
+
const note = await this.readNote(id);
|
|
395
|
+
if (!note) return { error: `Note ${id} not found.` };
|
|
396
|
+
|
|
397
|
+
let newContent = note.content;
|
|
398
|
+
if (append !== undefined) newContent = newContent.trimEnd() + '\n\n' + append;
|
|
399
|
+
if (content !== undefined) newContent = content;
|
|
400
|
+
|
|
401
|
+
const meta = this.index.get(id)!;
|
|
402
|
+
if (title !== undefined) meta.title = title;
|
|
403
|
+
if (tags !== undefined) meta.tags = tags;
|
|
404
|
+
if (addTags !== undefined) meta.tags = [...new Set([...meta.tags, ...addTags])];
|
|
405
|
+
if (pin !== undefined) meta.pinned = pin;
|
|
406
|
+
if (archive !== undefined) meta.archived = archive;
|
|
407
|
+
|
|
408
|
+
// Re-detect tags from content
|
|
409
|
+
const contentTags = this.extractTags(newContent);
|
|
410
|
+
meta.tags = [...new Set([...meta.tags, ...contentTags])];
|
|
411
|
+
meta.updatedAt = new Date().toISOString();
|
|
412
|
+
meta.wordCount = this.wordCount(newContent);
|
|
413
|
+
if (!title && !note.title) meta.title = this.extractTitle(newContent, meta.title);
|
|
414
|
+
|
|
415
|
+
const links = this.extractLinks(newContent);
|
|
416
|
+
await fs.writeFile(this.noteFilePath(id), newContent);
|
|
417
|
+
this.index.set(id, meta);
|
|
418
|
+
await this.rebuildBacklinks(id, links);
|
|
419
|
+
await this.saveIndex();
|
|
420
|
+
|
|
421
|
+
return { updated: true, id, title: meta.title, tags: meta.tags, wordCount: meta.wordCount };
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
// ── notes_search ────────────────────────────────────────────────────────
|
|
426
|
+
{
|
|
427
|
+
name: 'notes_search',
|
|
428
|
+
description: 'Full-text search across all notes, with optional tag and date filters',
|
|
429
|
+
inputSchema: {
|
|
430
|
+
type: 'object',
|
|
431
|
+
properties: {
|
|
432
|
+
query: { type: 'string', description: 'Search text' },
|
|
433
|
+
tags: {
|
|
434
|
+
type: 'array',
|
|
435
|
+
items: { type: 'string' },
|
|
436
|
+
description: 'Filter to notes with these tags',
|
|
437
|
+
},
|
|
438
|
+
includeArchived: { type: 'boolean', description: 'Include archived notes (default: false)' },
|
|
439
|
+
limit: { type: 'number', description: 'Max results (default: 10)' },
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
handler: async ({ query = '', tags = [], includeArchived = false, limit = 10 }: any) => {
|
|
443
|
+
await this.loadIndex();
|
|
444
|
+
|
|
445
|
+
const results: Array<{ score: number; meta: NoteMetadata; preview: string }> = [];
|
|
446
|
+
|
|
447
|
+
for (const [id, meta] of this.index.entries()) {
|
|
448
|
+
if (!includeArchived && meta.archived) continue;
|
|
449
|
+
if (tags.length && !tags.every((t: string) => meta.tags.includes(t.toLowerCase()))) continue;
|
|
450
|
+
|
|
451
|
+
let score = 0;
|
|
452
|
+
let preview = '';
|
|
453
|
+
|
|
454
|
+
if (query) {
|
|
455
|
+
let content = '';
|
|
456
|
+
try {
|
|
457
|
+
content = await fs.readFile(this.noteFilePath(id), 'utf-8');
|
|
458
|
+
} catch {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
score = this.scoreSearch(query, content, meta.title, meta.tags);
|
|
462
|
+
if (score === 0) continue;
|
|
463
|
+
|
|
464
|
+
// Build a short preview around first match
|
|
465
|
+
const idx = content.toLowerCase().indexOf(query.toLowerCase().split(' ')[0]);
|
|
466
|
+
if (idx >= 0) {
|
|
467
|
+
const start = Math.max(0, idx - 60);
|
|
468
|
+
const end = Math.min(content.length, idx + 120);
|
|
469
|
+
preview =
|
|
470
|
+
(start > 0 ? '...' : '') + content.slice(start, end).trim() + (end < content.length ? '...' : '');
|
|
471
|
+
}
|
|
472
|
+
} else {
|
|
473
|
+
score = meta.pinned ? 100 : 1;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
results.push({ score, meta, preview });
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
results.sort((a, b) => {
|
|
480
|
+
if (a.meta.pinned !== b.meta.pinned) return a.meta.pinned ? -1 : 1;
|
|
481
|
+
return b.score - a.score;
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
return {
|
|
485
|
+
count: results.length,
|
|
486
|
+
results: results.slice(0, limit).map(({ meta, preview }) => ({
|
|
487
|
+
id: meta.id,
|
|
488
|
+
title: meta.title,
|
|
489
|
+
tags: meta.tags,
|
|
490
|
+
pinned: meta.pinned,
|
|
491
|
+
updatedAt: meta.updatedAt,
|
|
492
|
+
wordCount: meta.wordCount,
|
|
493
|
+
preview,
|
|
494
|
+
})),
|
|
495
|
+
};
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
|
|
499
|
+
// ── notes_list ──────────────────────────────────────────────────────────
|
|
500
|
+
{
|
|
501
|
+
name: 'notes_list',
|
|
502
|
+
description: 'List all notes, optionally filtered by tag or pinned status',
|
|
503
|
+
inputSchema: {
|
|
504
|
+
type: 'object',
|
|
505
|
+
properties: {
|
|
506
|
+
tag: { type: 'string', description: 'Filter by tag' },
|
|
507
|
+
pinnedOnly: { type: 'boolean', description: 'Only show pinned notes' },
|
|
508
|
+
includeArchived: { type: 'boolean', description: 'Include archived notes' },
|
|
509
|
+
sortBy: {
|
|
510
|
+
type: 'string',
|
|
511
|
+
enum: ['updated', 'created', 'title', 'wordCount'],
|
|
512
|
+
description: 'Sort field (default: updated)',
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
handler: async ({ tag, pinnedOnly = false, includeArchived = false, sortBy = 'updated' }: any) => {
|
|
517
|
+
await this.loadIndex();
|
|
518
|
+
|
|
519
|
+
let notes = Array.from(this.index.values());
|
|
520
|
+
if (!includeArchived) notes = notes.filter((n) => !n.archived);
|
|
521
|
+
if (pinnedOnly) notes = notes.filter((n) => n.pinned);
|
|
522
|
+
if (tag) notes = notes.filter((n) => n.tags.includes(tag.toLowerCase()));
|
|
523
|
+
|
|
524
|
+
notes.sort((a, b) => {
|
|
525
|
+
if (sortBy === 'title') return a.title.localeCompare(b.title);
|
|
526
|
+
if (sortBy === 'wordCount') return b.wordCount - a.wordCount;
|
|
527
|
+
if (sortBy === 'created') return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
528
|
+
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime();
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// Pinned always first
|
|
532
|
+
const pinned = notes.filter((n) => n.pinned);
|
|
533
|
+
const rest = notes.filter((n) => !n.pinned);
|
|
534
|
+
|
|
535
|
+
const allTags = new Set<string>();
|
|
536
|
+
notes.forEach((n) => n.tags.forEach((t) => allTags.add(t)));
|
|
537
|
+
|
|
538
|
+
return {
|
|
539
|
+
total: notes.length,
|
|
540
|
+
allTags: Array.from(allTags).sort(),
|
|
541
|
+
notes: [...pinned, ...rest].map((n) => ({
|
|
542
|
+
id: n.id,
|
|
543
|
+
title: n.title,
|
|
544
|
+
tags: n.tags,
|
|
545
|
+
pinned: n.pinned,
|
|
546
|
+
archived: n.archived,
|
|
547
|
+
wordCount: n.wordCount,
|
|
548
|
+
updatedAt: n.updatedAt,
|
|
549
|
+
createdAt: n.createdAt,
|
|
550
|
+
})),
|
|
551
|
+
};
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
|
|
555
|
+
// ── notes_delete ────────────────────────────────────────────────────────
|
|
556
|
+
{
|
|
557
|
+
name: 'notes_delete',
|
|
558
|
+
description: 'Delete a note permanently',
|
|
559
|
+
inputSchema: {
|
|
560
|
+
type: 'object',
|
|
561
|
+
properties: {
|
|
562
|
+
id: { type: 'string', description: 'Note ID to delete' },
|
|
563
|
+
},
|
|
564
|
+
required: ['id'],
|
|
565
|
+
},
|
|
566
|
+
handler: async ({ id }: any) => {
|
|
567
|
+
await this.loadIndex();
|
|
568
|
+
if (!this.index.has(id)) return { error: `Note ${id} not found.` };
|
|
569
|
+
|
|
570
|
+
// Remove backlinks to this note
|
|
571
|
+
for (const meta of this.index.values()) {
|
|
572
|
+
meta.backlinks = meta.backlinks.filter((b) => b !== id);
|
|
573
|
+
}
|
|
574
|
+
this.index.delete(id);
|
|
575
|
+
|
|
576
|
+
try {
|
|
577
|
+
await fs.unlink(this.noteFilePath(id));
|
|
578
|
+
} catch {}
|
|
579
|
+
await this.saveIndex();
|
|
580
|
+
return { deleted: true, id };
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
// ── notes_daily ─────────────────────────────────────────────────────────
|
|
585
|
+
{
|
|
586
|
+
name: 'notes_daily',
|
|
587
|
+
description: "Get or create today's daily note",
|
|
588
|
+
inputSchema: {
|
|
589
|
+
type: 'object',
|
|
590
|
+
properties: {
|
|
591
|
+
append: { type: 'string', description: "Text to append to today's note" },
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
handler: async ({ append }: any) => {
|
|
595
|
+
await this.loadIndex();
|
|
596
|
+
const today = new Date().toISOString().split('T')[0];
|
|
597
|
+
const dailyTitle = today;
|
|
598
|
+
|
|
599
|
+
// Find existing daily note for today
|
|
600
|
+
let existingId: string | null = null;
|
|
601
|
+
for (const [id, meta] of this.index.entries()) {
|
|
602
|
+
if (meta.title === dailyTitle && meta.tags.includes('daily')) {
|
|
603
|
+
existingId = id;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (existingId && append) {
|
|
609
|
+
// Delegate to update
|
|
610
|
+
const note = await this.readNote(existingId);
|
|
611
|
+
if (note) {
|
|
612
|
+
const newContent = note.content.trimEnd() + '\n\n' + append;
|
|
613
|
+
const meta = this.index.get(existingId)!;
|
|
614
|
+
meta.updatedAt = new Date().toISOString();
|
|
615
|
+
meta.wordCount = this.wordCount(newContent);
|
|
616
|
+
await fs.writeFile(this.noteFilePath(existingId), newContent);
|
|
617
|
+
this.index.set(existingId, meta);
|
|
618
|
+
await this.saveIndex();
|
|
619
|
+
return { id: existingId, title: dailyTitle, updated: true, content: newContent };
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
if (existingId) {
|
|
624
|
+
return (await this.readNote(existingId)) ?? { error: 'Could not read daily note.' };
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Create new daily note
|
|
628
|
+
const content = this.applyTemplate(TEMPLATES.daily, today);
|
|
629
|
+
const id = this.generateId(`daily-${today}`);
|
|
630
|
+
const now = new Date().toISOString();
|
|
631
|
+
const meta: NoteMetadata = {
|
|
632
|
+
id,
|
|
633
|
+
title: dailyTitle,
|
|
634
|
+
tags: ['daily'],
|
|
635
|
+
pinned: false,
|
|
636
|
+
archived: false,
|
|
637
|
+
createdAt: now,
|
|
638
|
+
updatedAt: now,
|
|
639
|
+
wordCount: this.wordCount(content),
|
|
640
|
+
backlinks: [],
|
|
641
|
+
};
|
|
642
|
+
await fs.writeFile(this.noteFilePath(id), content);
|
|
643
|
+
this.index.set(id, meta);
|
|
644
|
+
await this.saveIndex();
|
|
645
|
+
return { id, title: dailyTitle, created: true, content };
|
|
646
|
+
},
|
|
647
|
+
},
|
|
648
|
+
|
|
649
|
+
// ── notes_stats ─────────────────────────────────────────────────────────
|
|
650
|
+
{
|
|
651
|
+
name: 'notes_stats',
|
|
652
|
+
description: 'Get statistics about your notes collection',
|
|
653
|
+
inputSchema: { type: 'object', properties: {} },
|
|
654
|
+
handler: async () => {
|
|
655
|
+
await this.loadIndex();
|
|
656
|
+
const all = Array.from(this.index.values());
|
|
657
|
+
const active = all.filter((n) => !n.archived);
|
|
658
|
+
const totalWords = active.reduce((s, n) => s + n.wordCount, 0);
|
|
659
|
+
const tagCounts: Record<string, number> = {};
|
|
660
|
+
active.forEach((n) =>
|
|
661
|
+
n.tags.forEach((t) => {
|
|
662
|
+
tagCounts[t] = (tagCounts[t] ?? 0) + 1;
|
|
663
|
+
}),
|
|
664
|
+
);
|
|
665
|
+
const topTags = Object.entries(tagCounts)
|
|
666
|
+
.sort((a, b) => b[1] - a[1])
|
|
667
|
+
.slice(0, 10)
|
|
668
|
+
.map(([tag, count]) => ({ tag, count }));
|
|
669
|
+
|
|
670
|
+
const recentlyUpdated = [...active]
|
|
671
|
+
.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())
|
|
672
|
+
.slice(0, 5)
|
|
673
|
+
.map((n) => ({ id: n.id, title: n.title, updatedAt: n.updatedAt }));
|
|
674
|
+
|
|
675
|
+
return {
|
|
676
|
+
totalNotes: active.length,
|
|
677
|
+
archivedNotes: all.length - active.length,
|
|
678
|
+
pinnedNotes: active.filter((n) => n.pinned).length,
|
|
679
|
+
totalWords,
|
|
680
|
+
avgWordsPerNote: active.length ? Math.round(totalWords / active.length) : 0,
|
|
681
|
+
uniqueTags: Object.keys(tagCounts).length,
|
|
682
|
+
topTags,
|
|
683
|
+
recentlyUpdated,
|
|
684
|
+
};
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
];
|
|
688
|
+
}
|
|
689
|
+
}
|