tarsk 0.3.43 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/agent.error-utils.d.ts +14 -0
- package/dist/agent/agent.error-utils.js +52 -0
- package/dist/agent/agent.event-transformer.d.ts +55 -0
- package/dist/agent/agent.event-transformer.js +175 -0
- package/dist/agent/agent.executor.d.ts +26 -0
- package/dist/agent/agent.executor.js +286 -0
- package/dist/agent/agent.model-resolver.d.ts +22 -0
- package/dist/agent/agent.model-resolver.js +67 -0
- package/dist/agent/agent.process-manager.d.ts +57 -0
- package/dist/agent/agent.process-manager.js +262 -0
- package/dist/agent/agent.processing-state-manager.d.ts +74 -0
- package/dist/agent/agent.processing-state-manager.js +87 -0
- package/dist/agent/agent.prompt-loader.d.ts +16 -0
- package/dist/agent/agent.prompt-loader.js +227 -0
- package/dist/agent/agent.subagent-executor.d.ts +35 -0
- package/dist/agent/agent.subagent-executor.js +135 -0
- package/dist/bun/index.d.ts +2 -0
- package/dist/bun/index.js +165 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +22 -0
- package/dist/core/crypto.d.ts +29 -0
- package/dist/core/crypto.js +166 -0
- package/dist/core/dev-server-cache.d.ts +46 -0
- package/dist/core/dev-server-cache.js +59 -0
- package/dist/core/env-manager.d.ts +3 -0
- package/dist/core/env-manager.js +60 -0
- package/dist/core/error-responses.d.ts +61 -0
- package/dist/core/error-responses.js +64 -0
- package/dist/core/logger.d.ts +10 -0
- package/dist/core/logger.js +47 -0
- package/dist/core/paths.d.ts +22 -0
- package/dist/core/paths.js +26 -0
- package/dist/core/random-words.d.ts +18 -0
- package/dist/core/random-words.js +135 -0
- package/dist/core/response-builder.d.ts +50 -0
- package/dist/core/response-builder.js +56 -0
- package/dist/core/route-helpers.d.ts +47 -0
- package/dist/core/route-helpers.js +54 -0
- package/dist/core/run-command-detector.d.ts +26 -0
- package/dist/core/run-command-detector.js +98 -0
- package/dist/core/stream-helper.d.ts +44 -0
- package/dist/core/stream-helper.js +50 -0
- package/dist/core/utils.d.ts +43 -0
- package/dist/core/utils.js +113 -0
- package/dist/core/validation.d.ts +10 -0
- package/dist/core/validation.js +20 -0
- package/dist/database/database.d.ts +40 -0
- package/dist/database/database.encryption.d.ts +33 -0
- package/dist/database/database.encryption.js +62 -0
- package/dist/database/database.js +480 -0
- package/dist/database/database.state.d.ts +52 -0
- package/dist/database/database.state.js +119 -0
- package/dist/database/database.test-utils.d.ts +22 -0
- package/dist/database/database.test-utils.js +39 -0
- package/dist/database/database.types.d.ts +3 -0
- package/dist/database/database.types.js +2 -0
- package/dist/features/agents/agents.manager.d.ts +24 -0
- package/dist/features/agents/agents.manager.js +200 -0
- package/dist/features/ask-user/ask-user.routes.d.ts +9 -0
- package/dist/features/ask-user/ask-user.routes.js +35 -0
- package/dist/features/chat/chat-delete.route.d.ts +15 -0
- package/dist/features/chat/chat-delete.route.js +36 -0
- package/dist/features/chat/chat-post.route.d.ts +11 -0
- package/dist/features/chat/chat-post.route.js +270 -0
- package/dist/features/chat/chat-stop.route.d.ts +21 -0
- package/dist/features/chat/chat-stop.route.js +22 -0
- package/dist/features/chat/chat-subscribe.route.d.ts +9 -0
- package/dist/features/chat/chat-subscribe.route.js +71 -0
- package/dist/features/chat/chat.routes.d.ts +22 -0
- package/dist/features/chat/chat.routes.js +29 -0
- package/dist/features/conversations/conversations-delete.route.d.ts +16 -0
- package/dist/features/conversations/conversations-delete.route.js +34 -0
- package/dist/features/conversations/conversations-get-all.route.d.ts +16 -0
- package/dist/features/conversations/conversations-get-all.route.js +39 -0
- package/dist/features/conversations/conversations-get-by-id.route.d.ts +16 -0
- package/dist/features/conversations/conversations-get-by-id.route.js +38 -0
- package/dist/features/conversations/conversations-get-deleted.route.d.ts +15 -0
- package/dist/features/conversations/conversations-get-deleted.route.js +34 -0
- package/dist/features/conversations/conversations-get-messages.route.d.ts +16 -0
- package/dist/features/conversations/conversations-get-messages.route.js +49 -0
- package/dist/features/conversations/conversations.content.d.ts +28 -0
- package/dist/features/conversations/conversations.content.js +142 -0
- package/dist/features/conversations/conversations.database.d.ts +108 -0
- package/dist/features/conversations/conversations.database.js +373 -0
- package/dist/features/conversations/conversations.manager.d.ts +130 -0
- package/dist/features/conversations/conversations.manager.js +162 -0
- package/dist/features/conversations/conversations.routes.d.ts +21 -0
- package/dist/features/conversations/conversations.routes.js +38 -0
- package/dist/features/conversations/token-usage.route.d.ts +41 -0
- package/dist/features/conversations/token-usage.route.js +419 -0
- package/dist/features/git/git-commit.route.d.ts +12 -0
- package/dist/features/git/git-commit.route.js +39 -0
- package/dist/features/git/git-create-branch.route.d.ts +28 -0
- package/dist/features/git/git-create-branch.route.js +119 -0
- package/dist/features/git/git-create-pr.route.d.ts +13 -0
- package/dist/features/git/git-create-pr.route.js +50 -0
- package/dist/features/git/git-create-repo.route.d.ts +14 -0
- package/dist/features/git/git-create-repo.route.js +108 -0
- package/dist/features/git/git-diff.route.d.ts +30 -0
- package/dist/features/git/git-diff.route.js +189 -0
- package/dist/features/git/git-fetch.route.d.ts +12 -0
- package/dist/features/git/git-fetch.route.js +31 -0
- package/dist/features/git/git-generate-commit-message.route.d.ts +12 -0
- package/dist/features/git/git-generate-commit-message.route.js +76 -0
- package/dist/features/git/git-generate-pr-info.route.d.ts +13 -0
- package/dist/features/git/git-generate-pr-info.route.js +147 -0
- package/dist/features/git/git-github-status.route.d.ts +16 -0
- package/dist/features/git/git-github-status.route.js +68 -0
- package/dist/features/git/git-log.route.d.ts +17 -0
- package/dist/features/git/git-log.route.js +33 -0
- package/dist/features/git/git-pr-status.route.d.ts +15 -0
- package/dist/features/git/git-pr-status.route.js +33 -0
- package/dist/features/git/git-pull.route.d.ts +12 -0
- package/dist/features/git/git-pull.route.js +35 -0
- package/dist/features/git/git-push.route.d.ts +12 -0
- package/dist/features/git/git-push.route.js +46 -0
- package/dist/features/git/git-status-cache.database.d.ts +7 -0
- package/dist/features/git/git-status-cache.database.js +53 -0
- package/dist/features/git/git-status.route.d.ts +15 -0
- package/dist/features/git/git-status.route.js +62 -0
- package/dist/features/git/git-sync-branch.route.d.ts +4 -0
- package/dist/features/git/git-sync-branch.route.js +208 -0
- package/dist/features/git/git-unified-status.route.d.ts +30 -0
- package/dist/features/git/git-unified-status.route.js +165 -0
- package/dist/features/git/git-username.route.d.ts +3 -0
- package/dist/features/git/git-username.route.js +24 -0
- package/dist/features/git/git.manager.d.ts +139 -0
- package/dist/features/git/git.manager.js +352 -0
- package/dist/features/git/git.routes.d.ts +4 -0
- package/dist/features/git/git.routes.js +116 -0
- package/dist/features/git/git.utils.d.ts +82 -0
- package/dist/features/git/git.utils.js +1040 -0
- package/dist/features/mcp/mcp.config.d.ts +27 -0
- package/dist/features/mcp/mcp.config.js +148 -0
- package/dist/features/mcp/mcp.manager.d.ts +61 -0
- package/dist/features/mcp/mcp.manager.js +254 -0
- package/dist/features/mcp/mcp.popular.json +103 -0
- package/dist/features/mcp/mcp.routes.d.ts +13 -0
- package/dist/features/mcp/mcp.routes.js +159 -0
- package/dist/features/mcp/mcp.types.d.ts +80 -0
- package/dist/features/mcp/mcp.types.js +8 -0
- package/dist/features/metadata/metadata.manager.d.ts +126 -0
- package/dist/features/metadata/metadata.manager.js +423 -0
- package/dist/features/models/model-info-aihubmix.d.ts +25 -0
- package/dist/features/models/model-info-aihubmix.js +117 -0
- package/dist/features/models/model-info-openrouter.d.ts +25 -0
- package/dist/features/models/model-info-openrouter.js +104 -0
- package/dist/features/models/model-info.d.ts +37 -0
- package/dist/features/models/model-info.js +39 -0
- package/dist/features/models/models-catalog.d.ts +49 -0
- package/dist/features/models/models-catalog.js +80 -0
- package/dist/features/models/models-catalog.route.d.ts +43 -0
- package/dist/features/models/models-catalog.route.js +15 -0
- package/dist/features/models/models-get-available.route.d.ts +36 -0
- package/dist/features/models/models-get-available.route.js +66 -0
- package/dist/features/models/models-get-enabled.route.d.ts +33 -0
- package/dist/features/models/models-get-enabled.route.js +45 -0
- package/dist/features/models/models-get-model-info.route.d.ts +31 -0
- package/dist/features/models/models-get-model-info.route.js +84 -0
- package/dist/features/models/models-model-disable.route.d.ts +15 -0
- package/dist/features/models/models-model-disable.route.js +20 -0
- package/dist/features/models/models-model-enable.route.d.ts +13 -0
- package/dist/features/models/models-model-enable.route.js +20 -0
- package/dist/features/models/models-provider-refresh.route.d.ts +17 -0
- package/dist/features/models/models-provider-refresh.route.js +20 -0
- package/dist/features/models/models.manager.d.ts +58 -0
- package/dist/features/models/models.manager.js +138 -0
- package/dist/features/models/models.routes.d.ts +18 -0
- package/dist/features/models/models.routes.js +83 -0
- package/dist/features/models/open-router-models.d.ts +38 -0
- package/dist/features/models/open-router-models.js +73 -0
- package/dist/features/models/openai-models.d.ts +63 -0
- package/dist/features/models/openai-models.js +150 -0
- package/dist/features/onboarding/onboarding-get-git-check.route.d.ts +11 -0
- package/dist/features/onboarding/onboarding-get-git-check.route.js +28 -0
- package/dist/features/onboarding/onboarding-get-status.route.d.ts +12 -0
- package/dist/features/onboarding/onboarding-get-status.route.js +15 -0
- package/dist/features/onboarding/onboarding-post-complete.route.d.ts +12 -0
- package/dist/features/onboarding/onboarding-post-complete.route.js +15 -0
- package/dist/features/onboarding/onboarding-post-reset.route.d.ts +12 -0
- package/dist/features/onboarding/onboarding-post-reset.route.js +15 -0
- package/dist/features/onboarding/onboarding.routes.d.ts +18 -0
- package/dist/features/onboarding/onboarding.routes.js +28 -0
- package/dist/features/project-todos/project-todos.database.d.ts +38 -0
- package/dist/features/project-todos/project-todos.database.js +91 -0
- package/dist/features/project-todos/project-todos.routes.d.ts +4 -0
- package/dist/features/project-todos/project-todos.routes.js +94 -0
- package/dist/features/projects/projects-ai-files.route.d.ts +148 -0
- package/dist/features/projects/projects-ai-files.route.js +425 -0
- package/dist/features/projects/projects-commands.route.d.ts +27 -0
- package/dist/features/projects/projects-commands.route.js +39 -0
- package/dist/features/projects/projects-create.route.d.ts +19 -0
- package/dist/features/projects/projects-create.route.js +37 -0
- package/dist/features/projects/projects-delete.route.d.ts +24 -0
- package/dist/features/projects/projects-delete.route.js +34 -0
- package/dist/features/projects/projects-get.route.d.ts +47 -0
- package/dist/features/projects/projects-get.route.js +36 -0
- package/dist/features/projects/projects-list.route.d.ts +58 -0
- package/dist/features/projects/projects-list.route.js +59 -0
- package/dist/features/projects/projects-open-folder.route.d.ts +10 -0
- package/dist/features/projects/projects-open-folder.route.js +11 -0
- package/dist/features/projects/projects-open.route.d.ts +26 -0
- package/dist/features/projects/projects-open.route.js +49 -0
- package/dist/features/projects/projects-package-scripts.route.d.ts +15 -0
- package/dist/features/projects/projects-package-scripts.route.js +96 -0
- package/dist/features/projects/projects-run-command.route.d.ts +8 -0
- package/dist/features/projects/projects-run-command.route.js +21 -0
- package/dist/features/projects/projects-run.route.d.ts +51 -0
- package/dist/features/projects/projects-run.route.js +74 -0
- package/dist/features/projects/projects-update.route.d.ts +24 -0
- package/dist/features/projects/projects-update.route.js +81 -0
- package/dist/features/projects/projects.creator.d.ts +33 -0
- package/dist/features/projects/projects.creator.js +555 -0
- package/dist/features/projects/projects.database.d.ts +61 -0
- package/dist/features/projects/projects.database.js +212 -0
- package/dist/features/projects/projects.manager.d.ts +291 -0
- package/dist/features/projects/projects.manager.js +426 -0
- package/dist/features/projects/projects.open-with.d.ts +27 -0
- package/dist/features/projects/projects.open-with.js +156 -0
- package/dist/features/projects/projects.routes.d.ts +20 -0
- package/dist/features/projects/projects.routes.js +255 -0
- package/dist/features/projects/terminal-session-manager.d.ts +55 -0
- package/dist/features/projects/terminal-session-manager.js +90 -0
- package/dist/features/providers/provider-resolver.d.ts +13 -0
- package/dist/features/providers/provider-resolver.js +22 -0
- package/dist/features/providers/providers-get-credits.route.d.ts +15 -0
- package/dist/features/providers/providers-get-credits.route.js +51 -0
- package/dist/features/providers/providers-get.route.d.ts +16 -0
- package/dist/features/providers/providers-get.route.js +32 -0
- package/dist/features/providers/providers-open-external.route.d.ts +15 -0
- package/dist/features/providers/providers-open-external.route.js +49 -0
- package/dist/features/providers/providers-post-bulk-keys.route.d.ts +14 -0
- package/dist/features/providers/providers-post-bulk-keys.route.js +31 -0
- package/dist/features/providers/providers-post-keys.route.d.ts +14 -0
- package/dist/features/providers/providers-post-keys.route.js +25 -0
- package/dist/features/providers/providers.routes.d.ts +19 -0
- package/dist/features/providers/providers.routes.js +31 -0
- package/dist/features/rules/rules-post.route.d.ts +43 -0
- package/dist/features/rules/rules-post.route.js +89 -0
- package/dist/features/rules/rules.manager.d.ts +36 -0
- package/dist/features/rules/rules.manager.js +203 -0
- package/dist/features/rules/rules.routes.d.ts +12 -0
- package/dist/features/rules/rules.routes.js +13 -0
- package/dist/features/run/run-get-running.route.d.ts +15 -0
- package/dist/features/run/run-get-running.route.js +21 -0
- package/dist/features/run/run-post-start.route.d.ts +8 -0
- package/dist/features/run/run-post-start.route.js +21 -0
- package/dist/features/run/run-post-stop.route.d.ts +15 -0
- package/dist/features/run/run-post-stop.route.js +24 -0
- package/dist/features/run/run-post-suggest.route.d.ts +15 -0
- package/dist/features/run/run-post-suggest.route.js +21 -0
- package/dist/features/run/run-put-command.route.d.ts +15 -0
- package/dist/features/run/run-put-command.route.js +24 -0
- package/dist/features/run/run.routes.d.ts +19 -0
- package/dist/features/run/run.routes.js +31 -0
- package/dist/features/scaffold/index.d.ts +7 -0
- package/dist/features/scaffold/index.js +5 -0
- package/dist/features/scaffold/scaffold-get-templates.route.d.ts +27 -0
- package/dist/features/scaffold/scaffold-get-templates.route.js +17 -0
- package/dist/features/scaffold/scaffold-post.route.d.ts +8 -0
- package/dist/features/scaffold/scaffold-post.route.js +30 -0
- package/dist/features/scaffold/scaffold.routes.d.ts +10 -0
- package/dist/features/scaffold/scaffold.routes.js +16 -0
- package/dist/features/scaffold/scaffold.runner.d.ts +48 -0
- package/dist/features/scaffold/scaffold.runner.js +475 -0
- package/dist/features/scaffold/scaffold.types.d.ts +26 -0
- package/dist/features/scaffold/scaffold.types.js +5 -0
- package/dist/features/skills/skills.activation.d.ts +31 -0
- package/dist/features/skills/skills.activation.js +155 -0
- package/dist/features/skills/skills.manager.d.ts +35 -0
- package/dist/features/skills/skills.manager.js +251 -0
- package/dist/features/slash-commands/slash-commands-delete.route.d.ts +23 -0
- package/dist/features/slash-commands/slash-commands-delete.route.js +36 -0
- package/dist/features/slash-commands/slash-commands-get.route.d.ts +53 -0
- package/dist/features/slash-commands/slash-commands-get.route.js +54 -0
- package/dist/features/slash-commands/slash-commands-post.route.d.ts +39 -0
- package/dist/features/slash-commands/slash-commands-post.route.js +70 -0
- package/dist/features/slash-commands/slash-commands-put.route.d.ts +23 -0
- package/dist/features/slash-commands/slash-commands-put.route.js +36 -0
- package/dist/features/slash-commands/slash-commands.manager.d.ts +46 -0
- package/dist/features/slash-commands/slash-commands.manager.js +265 -0
- package/dist/features/slash-commands/slash-commands.routes.d.ts +13 -0
- package/dist/features/slash-commands/slash-commands.routes.js +20 -0
- package/dist/features/threads/threads-ai-files.route.d.ts +153 -0
- package/dist/features/threads/threads-ai-files.route.js +287 -0
- package/dist/features/threads/threads-conversation-folder-path.route.d.ts +14 -0
- package/dist/features/threads/threads-conversation-folder-path.route.js +23 -0
- package/dist/features/threads/threads-create.route.d.ts +22 -0
- package/dist/features/threads/threads-create.route.js +60 -0
- package/dist/features/threads/threads-delete.route.d.ts +25 -0
- package/dist/features/threads/threads-delete.route.js +35 -0
- package/dist/features/threads/threads-files.route.d.ts +15 -0
- package/dist/features/threads/threads-files.route.js +20 -0
- package/dist/features/threads/threads-fix-comments.route.d.ts +26 -0
- package/dist/features/threads/threads-fix-comments.route.js +45 -0
- package/dist/features/threads/threads-get.route.d.ts +30 -0
- package/dist/features/threads/threads-get.route.js +38 -0
- package/dist/features/threads/threads-list.route.d.ts +56 -0
- package/dist/features/threads/threads-list.route.js +58 -0
- package/dist/features/threads/threads-messages.route.d.ts +28 -0
- package/dist/features/threads/threads-messages.route.js +110 -0
- package/dist/features/threads/threads-open.route.d.ts +26 -0
- package/dist/features/threads/threads-open.route.js +62 -0
- package/dist/features/threads/threads-select.route.d.ts +25 -0
- package/dist/features/threads/threads-select.route.js +35 -0
- package/dist/features/threads/threads-update.route.d.ts +15 -0
- package/dist/features/threads/threads-update.route.js +30 -0
- package/dist/features/threads/threads.database.d.ts +68 -0
- package/dist/features/threads/threads.database.js +215 -0
- package/dist/features/threads/threads.manager.d.ts +204 -0
- package/dist/features/threads/threads.manager.js +505 -0
- package/dist/features/threads/threads.routes.d.ts +20 -0
- package/dist/features/threads/threads.routes.js +230 -0
- package/dist/features/todos/todos.database.d.ts +14 -0
- package/dist/features/todos/todos.database.js +31 -0
- package/dist/features/updates/updates.routes.d.ts +13 -0
- package/dist/features/updates/updates.routes.js +40 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +37 -10022
- package/dist/project-analyzer.d.ts +26 -0
- package/dist/project-analyzer.js +307 -0
- package/dist/public/assets/add-agent-view-B9IQjAwU.js +1 -0
- package/dist/public/assets/add-rule-view-BdZHurB3.js +7 -0
- package/dist/public/assets/add-skill-view-Cuu6Z0fr.js +1 -0
- package/dist/public/assets/add-slash-command-view-uW75Jvbh.js +1 -0
- package/dist/public/assets/conversation-history-view-D0OBxJMC.js +1 -0
- package/dist/public/assets/dialogs-config-DiFQjCeA.js +46 -0
- package/dist/public/assets/diff-view-B5XBM5UZ.js +3 -0
- package/dist/public/assets/file-tree-sidebar-DMX7fHi7.js +1 -0
- package/dist/public/assets/files-view-CUZn7G0o.js +1 -0
- package/dist/public/assets/history-view-B8HM78Wa.js +1 -0
- package/dist/public/assets/index-C-p81QYw.js +17 -0
- package/dist/public/assets/index-DhVMb7D6.css +1 -0
- package/dist/public/assets/mcp-manager-CEm1L3dn.js +1 -0
- package/dist/public/assets/mcp-server-edit-view-BAwMNOAH.js +5 -0
- package/dist/public/assets/mcp-servers-sidebar-Ncxq9Oj5.js +1 -0
- package/dist/public/assets/mcp-view-Cz7nelGQ.js +1 -0
- package/dist/public/assets/monaco-DvsnxTfD.js +11 -0
- package/dist/public/assets/onboarding-CvpvkF3X.js +1 -0
- package/dist/public/assets/onboarding-dialog-CKJw0ULj.js +1 -0
- package/dist/public/assets/project-settings-view-DJ1uvrTL.js +1 -0
- package/dist/public/assets/provider-details-view-CkS6WbnK.js +1 -0
- package/dist/public/assets/providers-sidebar-C4MF6i9d.js +1 -0
- package/dist/public/assets/radio-group-BItFbSTw.js +1 -0
- package/dist/public/assets/react-vendor-DkKo9QGO.js +17 -0
- package/dist/public/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
- package/dist/public/assets/settings-view-C45kmAGH.js +2 -0
- package/dist/public/assets/store-BVVGurzl.js +2 -0
- package/dist/public/assets/use-toast-DEJkXPN4.js +1 -0
- package/dist/public/assets/utils-DY_quHB8.js +1 -0
- package/dist/public/fonts/google-sans.ttf +0 -0
- package/dist/public/fonts/zalando.ttf +0 -0
- package/dist/public/ide/android-studio.svg +1 -0
- package/dist/public/ide/cursor.svg +12 -0
- package/dist/public/ide/kiro.svg +11 -0
- package/dist/public/ide/terminal.svg +7 -0
- package/dist/public/ide/vscode.svg +2 -0
- package/dist/public/ide/windsurf.svg +3 -0
- package/dist/public/ide/xcode.svg +2 -0
- package/dist/public/index.html +13 -9
- package/dist/scaffold-templates.json +3 -12
- package/dist/server.d.ts +12 -0
- package/dist/server.js +142 -0
- package/dist/tools/agent-tool.d.ts +49 -0
- package/dist/tools/agent-tool.js +131 -0
- package/dist/tools/ask-user.d.ts +25 -0
- package/dist/tools/ask-user.js +74 -0
- package/dist/tools/ast-grep.d.ts +28 -0
- package/dist/tools/ast-grep.js +273 -0
- package/dist/tools/bash.d.ts +33 -0
- package/dist/tools/bash.js +186 -0
- package/dist/tools/edit-diff.d.ts +24 -0
- package/dist/tools/edit-diff.js +136 -0
- package/dist/tools/edit.d.ts +28 -0
- package/dist/tools/edit.js +78 -0
- package/dist/tools/find.d.ts +31 -0
- package/dist/tools/find.js +117 -0
- package/dist/tools/grep.d.ts +37 -0
- package/dist/tools/grep.js +231 -0
- package/dist/tools/index.d.ts +93 -0
- package/dist/tools/index.js +110 -0
- package/dist/tools/ls.d.ts +31 -0
- package/dist/tools/ls.js +108 -0
- package/dist/tools/mcp-tools.d.ts +31 -0
- package/dist/tools/mcp-tools.js +59 -0
- package/dist/tools/path-utils.d.ts +14 -0
- package/dist/tools/path-utils.js +87 -0
- package/dist/tools/read.d.ts +27 -0
- package/dist/tools/read.js +86 -0
- package/dist/tools/resolve-bin.d.ts +5 -0
- package/dist/tools/resolve-bin.js +28 -0
- package/dist/tools/shell.d.ts +7 -0
- package/dist/tools/shell.js +143 -0
- package/dist/tools/skill-reference-tool.d.ts +30 -0
- package/dist/tools/skill-reference-tool.js +171 -0
- package/dist/tools/skill-tool.d.ts +33 -0
- package/dist/tools/skill-tool.js +213 -0
- package/dist/tools/todo.d.ts +20 -0
- package/dist/tools/todo.js +168 -0
- package/dist/tools/tool-helpers.d.ts +78 -0
- package/dist/tools/tool-helpers.js +109 -0
- package/dist/tools/truncate.d.ts +31 -0
- package/dist/tools/truncate.js +164 -0
- package/dist/tools/write.d.ts +21 -0
- package/dist/tools/write.js +65 -0
- package/package.json +33 -27
- package/dist/public/assets/index-6jySngUQ.css +0 -1
- package/dist/public/assets/index-BjFpLTSj.js +0 -18
- package/dist/public/assets/monaco-w6PwaWGP.js +0 -11
- package/dist/public/assets/radix-ui-e1yigncZ.js +0 -1
- package/dist/public/assets/react-vendor-B6JfXZmN.js +0 -59
- package/dist/public/assets/ui-styling-CyCIFleB.js +0 -1
- package/dist/public/assets/utils-Dd_itR7L.js +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { spawnProcess } from "../../core/utils.js";
|
|
2
|
+
import { resolveThreadPath, getGitRoot, getCurrentBranch, getDefaultBranch, findDefaultBranch, getCommitLog, getDetailedCommits, generatePRInfoWithAI, } from "./git.utils.js";
|
|
3
|
+
export async function gitGeneratePrInfoHandler(c, metadataManager) {
|
|
4
|
+
try {
|
|
5
|
+
const threadId = c.req.param("threadId");
|
|
6
|
+
console.log(`[pr-generation] Starting PR info generation for thread: ${threadId}`);
|
|
7
|
+
const thread = await metadataManager
|
|
8
|
+
.loadThreads()
|
|
9
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
10
|
+
if (!thread) {
|
|
11
|
+
console.log(`[pr-generation] Thread not found: ${threadId}`);
|
|
12
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
13
|
+
}
|
|
14
|
+
console.log(`[pr-generation] ✓ Thread found: ${thread.title}, model: ${thread.model}, modelProvider: ${thread.modelProvider}`);
|
|
15
|
+
// Check path first
|
|
16
|
+
const repoPath = thread.path;
|
|
17
|
+
if (!repoPath) {
|
|
18
|
+
console.log(`[pr-generation] Thread path not found for threadId: ${threadId}`);
|
|
19
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
20
|
+
}
|
|
21
|
+
// Get provider from thread's modelProvider, like commit message generation
|
|
22
|
+
const provider = thread.modelProvider;
|
|
23
|
+
if (!provider) {
|
|
24
|
+
console.log(`[pr-generation] ✗ Provider not found in thread metadata`);
|
|
25
|
+
return c.json({
|
|
26
|
+
title: "Update",
|
|
27
|
+
description: "",
|
|
28
|
+
error: "Provider not found in thread metadata",
|
|
29
|
+
}, 400);
|
|
30
|
+
}
|
|
31
|
+
// Get model from thread
|
|
32
|
+
const model = thread.model;
|
|
33
|
+
console.log(`[pr-generation] Using provider: ${provider}, model: ${model}`);
|
|
34
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
35
|
+
console.log(`[pr-generation] Resolved path: ${absolutePath}`);
|
|
36
|
+
let gitRoot;
|
|
37
|
+
try {
|
|
38
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
39
|
+
console.log(`[pr-generation] ✓ Git root: ${gitRoot}`);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
console.log(`[pr-generation] ✗ Not a git repository: ${absolutePath}`);
|
|
43
|
+
return c.json({ error: `Path is not a git repository: ${absolutePath}` }, 400);
|
|
44
|
+
}
|
|
45
|
+
// Get current branch
|
|
46
|
+
const currentBranch = await getCurrentBranch(gitRoot);
|
|
47
|
+
console.log(`[pr-generation] Current branch: ${currentBranch}`);
|
|
48
|
+
// Get git diff (staged + unstaged). If no commits yet (HEAD missing), use git diff.
|
|
49
|
+
console.log(`[pr-generation] Collecting git diff...`);
|
|
50
|
+
const diff = await new Promise((resolveDiff, reject) => {
|
|
51
|
+
const runPlainDiff = () => {
|
|
52
|
+
console.log(`[pr-generation] No HEAD found, using plain git diff`);
|
|
53
|
+
const proc2 = spawnProcess("git", ["diff"], { cwd: gitRoot });
|
|
54
|
+
let out2 = "";
|
|
55
|
+
proc2.stdout?.on("data", (d) => {
|
|
56
|
+
out2 += d.toString();
|
|
57
|
+
});
|
|
58
|
+
proc2.on("close", () => {
|
|
59
|
+
console.log(`[pr-generation] ✓ Plain diff collected, length: ${out2.length}`);
|
|
60
|
+
resolveDiff(out2);
|
|
61
|
+
});
|
|
62
|
+
proc2.on("error", reject);
|
|
63
|
+
};
|
|
64
|
+
const proc = spawnProcess("git", ["diff", "HEAD"], { cwd: gitRoot });
|
|
65
|
+
let out = "";
|
|
66
|
+
let err = "";
|
|
67
|
+
proc.stdout?.on("data", (d) => {
|
|
68
|
+
out += d.toString();
|
|
69
|
+
});
|
|
70
|
+
proc.stderr?.on("data", (d) => {
|
|
71
|
+
err += d.toString();
|
|
72
|
+
});
|
|
73
|
+
proc.on("close", (code) => {
|
|
74
|
+
if (code === 0) {
|
|
75
|
+
console.log(`[pr-generation] ✓ HEAD diff collected, length: ${out.length}`);
|
|
76
|
+
resolveDiff(out);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const noHead = /HEAD|revision|unknown revision/i.test(err);
|
|
80
|
+
if (noHead)
|
|
81
|
+
runPlainDiff();
|
|
82
|
+
else {
|
|
83
|
+
console.log(`[pr-generation] ✗ Failed to get git diff: ${err}`);
|
|
84
|
+
reject(new Error(err || "Failed to get git diff"));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
proc.on("error", reject);
|
|
89
|
+
});
|
|
90
|
+
// Find the default/base branch (try origin/HEAD, then common defaults)
|
|
91
|
+
console.log(`[pr-generation] Finding base branch...`);
|
|
92
|
+
const baseBranch = await getDefaultBranch(gitRoot);
|
|
93
|
+
console.log(`[pr-generation] getDefaultBranch result: ${baseBranch}`);
|
|
94
|
+
// Fallback: try common default branch names
|
|
95
|
+
const effectiveBaseBranch = baseBranch ?? (await findDefaultBranch(gitRoot));
|
|
96
|
+
console.log(`[pr-generation] Effective base branch: ${effectiveBaseBranch}`);
|
|
97
|
+
// Get commits between base branch and current branch (if we have a base branch and aren't on it)
|
|
98
|
+
let commitLog = "";
|
|
99
|
+
if (effectiveBaseBranch && currentBranch !== effectiveBaseBranch) {
|
|
100
|
+
console.log(`[pr-generation] Getting commit log between ${effectiveBaseBranch} and ${currentBranch}...`);
|
|
101
|
+
commitLog = await getCommitLog(gitRoot, effectiveBaseBranch, currentBranch);
|
|
102
|
+
console.log(`[pr-generation] ✓ Commit log collected, length: ${commitLog.length}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
console.log(`[pr-generation] No commit log needed (same branch or no base branch)`);
|
|
106
|
+
}
|
|
107
|
+
// Get detailed commit info for better PR generation
|
|
108
|
+
let detailedCommits = "";
|
|
109
|
+
if (effectiveBaseBranch && currentBranch !== effectiveBaseBranch && commitLog) {
|
|
110
|
+
console.log(`[pr-generation] Getting detailed commits...`);
|
|
111
|
+
detailedCommits = await getDetailedCommits(gitRoot, effectiveBaseBranch, currentBranch);
|
|
112
|
+
console.log(`[pr-generation] ✓ Detailed commits collected, length: ${detailedCommits.length}`);
|
|
113
|
+
}
|
|
114
|
+
if (!diff.trim() && !commitLog.trim()) {
|
|
115
|
+
console.log(`[pr-generation] ✗ No changes found - diff length: ${diff.length}, commit log length: ${commitLog.length}`);
|
|
116
|
+
return c.json({
|
|
117
|
+
error: effectiveBaseBranch
|
|
118
|
+
? `No changes to generate PR info for. The current branch "${currentBranch}" has no uncommitted changes and no commits ahead of "${effectiveBaseBranch}".`
|
|
119
|
+
: "No changes to generate PR info for. Make sure you have uncommitted changes or commits ahead of the base branch.",
|
|
120
|
+
}, 400);
|
|
121
|
+
}
|
|
122
|
+
console.log(`[pr-generation] Calling generatePRInfoWithAI...`);
|
|
123
|
+
// Use AI to generate PR info
|
|
124
|
+
const prInfo = await generatePRInfoWithAI(commitLog, detailedCommits, diff, currentBranch, effectiveBaseBranch ?? "", metadataManager, model, provider);
|
|
125
|
+
console.log(`[pr-generation] ✓ PR info generated - title: "${prInfo.title}", description length: ${prInfo.description.length}`);
|
|
126
|
+
console.log(`[pr-generation] ✓ PR generation completed successfully`);
|
|
127
|
+
return c.json({
|
|
128
|
+
title: prInfo.title,
|
|
129
|
+
description: prInfo.description,
|
|
130
|
+
baseBranch: effectiveBaseBranch,
|
|
131
|
+
currentBranch,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.log(`[pr-generation] ✗ Error during PR generation: ${error instanceof Error ? error.message : String(error)}`);
|
|
136
|
+
console.log(`[pr-generation] Error stack: ${error instanceof Error ? error.stack : "No stack available"}`);
|
|
137
|
+
// Return default PR info on error
|
|
138
|
+
return c.json({
|
|
139
|
+
title: "Update",
|
|
140
|
+
description: "",
|
|
141
|
+
baseBranch: null,
|
|
142
|
+
currentBranch: "",
|
|
143
|
+
error: error instanceof Error ? error.message : "Failed to generate PR info",
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=git-generate-pr-info.route.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitGithubStatusHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
isOnGitHub: boolean;
|
|
9
|
+
remoteUrl: string;
|
|
10
|
+
canCreateRepo: boolean;
|
|
11
|
+
repoUrl: string;
|
|
12
|
+
status: "Behind" | "Diverged" | "Ahead" | "Up to date";
|
|
13
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
14
|
+
error: string;
|
|
15
|
+
}, 500, "json">)>;
|
|
16
|
+
//# sourceMappingURL=git-github-status.route.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { resolveThreadPath, getGitRoot, getRemoteOrigin, getCurrentBranch, getGitSyncStatus, } from "./git.utils.js";
|
|
2
|
+
export async function gitGithubStatusHandler(c, metadataManager) {
|
|
3
|
+
try {
|
|
4
|
+
const threadId = c.req.param("threadId");
|
|
5
|
+
const thread = await metadataManager
|
|
6
|
+
.loadThreads()
|
|
7
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
8
|
+
if (!thread) {
|
|
9
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
10
|
+
}
|
|
11
|
+
const repoPath = thread.path;
|
|
12
|
+
if (!repoPath) {
|
|
13
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
14
|
+
}
|
|
15
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
16
|
+
let gitRoot;
|
|
17
|
+
try {
|
|
18
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return c.json({ error: `Path is not a git repository: ${absolutePath}` }, 400);
|
|
22
|
+
}
|
|
23
|
+
// Check if origin remote is a GitHub URL
|
|
24
|
+
const remoteUrl = await getRemoteOrigin(gitRoot);
|
|
25
|
+
const isOnGitHub = remoteUrl.includes("github.com");
|
|
26
|
+
// Extract repo URL from remote URL (handle both https and ssh formats)
|
|
27
|
+
let repoUrl = "";
|
|
28
|
+
if (isOnGitHub) {
|
|
29
|
+
if (remoteUrl.startsWith("https://")) {
|
|
30
|
+
repoUrl = remoteUrl.replace(/\.git$/, "");
|
|
31
|
+
}
|
|
32
|
+
else if (remoteUrl.startsWith("git@")) {
|
|
33
|
+
// Convert git@github.com:user/repo.git to https://github.com/user/repo
|
|
34
|
+
const match = remoteUrl.match(/git@github\.com:(.+?)\.git$/);
|
|
35
|
+
if (match) {
|
|
36
|
+
repoUrl = `https://github.com/${match[1]}`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Check git sync status
|
|
41
|
+
let status = "Up to date";
|
|
42
|
+
if (isOnGitHub && remoteUrl) {
|
|
43
|
+
try {
|
|
44
|
+
const currentBranch = await getCurrentBranch(gitRoot);
|
|
45
|
+
if (currentBranch && currentBranch !== "HEAD") {
|
|
46
|
+
status = await getGitSyncStatus(gitRoot, currentBranch);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// If we can't determine the status, default to Up to date
|
|
51
|
+
console.warn(`Failed to check git sync status: ${error instanceof Error ? error.message : String(error)}`);
|
|
52
|
+
status = "Up to date";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return c.json({
|
|
56
|
+
isOnGitHub,
|
|
57
|
+
remoteUrl,
|
|
58
|
+
canCreateRepo: !isOnGitHub && remoteUrl.length === 0,
|
|
59
|
+
repoUrl,
|
|
60
|
+
status,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : "Failed to check GitHub status";
|
|
65
|
+
return c.json({ error: message }, 500);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=git-github-status.route.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitLogHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
commits: {
|
|
9
|
+
hash: string;
|
|
10
|
+
message: string;
|
|
11
|
+
author: string;
|
|
12
|
+
date: string;
|
|
13
|
+
}[];
|
|
14
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
15
|
+
error: string;
|
|
16
|
+
}, 500, "json">)>;
|
|
17
|
+
//# sourceMappingURL=git-log.route.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { resolveThreadPath, getGitRoot, getGitLog } from "./git.utils.js";
|
|
2
|
+
export async function gitLogHandler(c, metadataManager) {
|
|
3
|
+
try {
|
|
4
|
+
const threadId = c.req.param("threadId");
|
|
5
|
+
const limit = c.req.query("limit") ? parseInt(c.req.query("limit")) : 50;
|
|
6
|
+
const thread = await metadataManager
|
|
7
|
+
.loadThreads()
|
|
8
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
9
|
+
if (!thread) {
|
|
10
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
11
|
+
}
|
|
12
|
+
const repoPath = thread.path;
|
|
13
|
+
if (!repoPath) {
|
|
14
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
15
|
+
}
|
|
16
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
17
|
+
let gitRoot;
|
|
18
|
+
try {
|
|
19
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return c.json({ error: `Path is not a git repository: ${absolutePath}` }, 400);
|
|
23
|
+
}
|
|
24
|
+
// Get git log
|
|
25
|
+
const commits = await getGitLog(gitRoot, limit);
|
|
26
|
+
return c.json({ commits });
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : "Failed to fetch git log";
|
|
30
|
+
return c.json({ error: message }, 500);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=git-log.route.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitPrStatusHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
exists: boolean;
|
|
9
|
+
url?: string | undefined;
|
|
10
|
+
state?: string | undefined;
|
|
11
|
+
success: true;
|
|
12
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
13
|
+
error: string;
|
|
14
|
+
}, 500, "json">)>;
|
|
15
|
+
//# sourceMappingURL=git-pr-status.route.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { resolveThreadPath, getGitRoot, getPullRequestStatus } from "./git.utils.js";
|
|
2
|
+
export async function gitPrStatusHandler(c, metadataManager) {
|
|
3
|
+
try {
|
|
4
|
+
const threadId = c.req.param("threadId");
|
|
5
|
+
const thread = await metadataManager
|
|
6
|
+
.loadThreads()
|
|
7
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
8
|
+
if (!thread) {
|
|
9
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
10
|
+
}
|
|
11
|
+
const repoPath = thread.path;
|
|
12
|
+
if (!repoPath) {
|
|
13
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
14
|
+
}
|
|
15
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
16
|
+
let gitRoot;
|
|
17
|
+
try {
|
|
18
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return c.json({ error: `Path is not a git repository: ${absolutePath}` }, 400);
|
|
22
|
+
}
|
|
23
|
+
// Check PR status
|
|
24
|
+
const prStatus = await getPullRequestStatus(gitRoot);
|
|
25
|
+
return c.json({ success: true, ...prStatus });
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("Failed to check PR status:", error);
|
|
29
|
+
const message = error instanceof Error ? error.message : "Failed to check PR status";
|
|
30
|
+
return c.json({ error: message }, 500);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=git-pr-status.route.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitPullHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
success: true;
|
|
9
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}, 500, "json">)>;
|
|
12
|
+
//# sourceMappingURL=git-pull.route.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveThreadPath, getGitRoot, pullFromOrigin } from "./git.utils.js";
|
|
2
|
+
export async function gitPullHandler(c, metadataManager) {
|
|
3
|
+
try {
|
|
4
|
+
const threadId = c.req.param("threadId");
|
|
5
|
+
const thread = await metadataManager
|
|
6
|
+
.loadThreads()
|
|
7
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
8
|
+
if (!thread) {
|
|
9
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
10
|
+
}
|
|
11
|
+
const repoPath = thread.path;
|
|
12
|
+
if (!repoPath) {
|
|
13
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
14
|
+
}
|
|
15
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
16
|
+
let gitRoot;
|
|
17
|
+
try {
|
|
18
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
22
|
+
return c.json({
|
|
23
|
+
error: `Path is not a git repository: ${absolutePath}. ${msg}`,
|
|
24
|
+
}, 400);
|
|
25
|
+
}
|
|
26
|
+
// Pull from origin
|
|
27
|
+
await pullFromOrigin(gitRoot);
|
|
28
|
+
return c.json({ success: true });
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const message = error instanceof Error ? error.message : "Failed to pull from origin";
|
|
32
|
+
return c.json({ error: message }, 500);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=git-pull.route.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitPushHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
success: true;
|
|
9
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}, 500, "json">)>;
|
|
12
|
+
//# sourceMappingURL=git-push.route.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { resolveThreadPath, getGitRoot, getCurrentBranch, pushToOrigin } from "./git.utils.js";
|
|
2
|
+
export async function gitPushHandler(c, metadataManager) {
|
|
3
|
+
try {
|
|
4
|
+
const threadId = c.req.param("threadId");
|
|
5
|
+
console.log(`[git-push] Starting push for thread: ${threadId}`);
|
|
6
|
+
const thread = await metadataManager
|
|
7
|
+
.loadThreads()
|
|
8
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
9
|
+
if (!thread) {
|
|
10
|
+
console.log(`[git-push] Thread not found: ${threadId}`);
|
|
11
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
12
|
+
}
|
|
13
|
+
console.log(`[git-push] ✓ Thread found: ${thread.title}`);
|
|
14
|
+
const repoPath = thread.path;
|
|
15
|
+
if (!repoPath) {
|
|
16
|
+
console.log(`[git-push] Thread path not found for threadId: ${threadId}`);
|
|
17
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
18
|
+
}
|
|
19
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
20
|
+
console.log(`[git-push] Resolved path: ${absolutePath}`);
|
|
21
|
+
let gitRoot;
|
|
22
|
+
try {
|
|
23
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
24
|
+
console.log(`[git-push] ✓ Git root: ${gitRoot}`);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
console.log(`[git-push] ✗ Not a git repository: ${absolutePath}`);
|
|
28
|
+
return c.json({ error: `Path is not a git repository: ${absolutePath}` }, 400);
|
|
29
|
+
}
|
|
30
|
+
// Get current branch
|
|
31
|
+
const currentBranch = await getCurrentBranch(gitRoot);
|
|
32
|
+
console.log(`[git-push] Current branch: ${currentBranch}`);
|
|
33
|
+
// Push to origin
|
|
34
|
+
console.log(`[git-push] Starting push to origin for branch: ${currentBranch}`);
|
|
35
|
+
await pushToOrigin(gitRoot, currentBranch);
|
|
36
|
+
console.log(`[git-push] ✓ Successfully pushed ${currentBranch} to origin`);
|
|
37
|
+
return c.json({ success: true });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : "Failed to push changes";
|
|
41
|
+
console.log(`[git-push] ✗ Push failed: ${message}`);
|
|
42
|
+
console.log(`[git-push] Error stack: ${error instanceof Error ? error.stack : "No stack available"}`);
|
|
43
|
+
return c.json({ error: message }, 500);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=git-push.route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Database } from "../../database/database.types.js";
|
|
2
|
+
export declare function getGitStatusCache(db: Database, threadId: string): Promise<object | null>;
|
|
3
|
+
export declare function setGitStatusCache(db: Database, threadId: string, data: object): Promise<void>;
|
|
4
|
+
export declare function getGitStatusCacheAnyAge(db: Database, threadId: string): Promise<object | null>;
|
|
5
|
+
export declare function getGitStatusCacheBulk(db: Database, threadIds: string[]): Promise<Map<string, object>>;
|
|
6
|
+
export declare function invalidateGitStatusCache(db: Database, threadId: string): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=git-status-cache.database.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const CACHE_TTL_MS = 30_000;
|
|
2
|
+
export async function getGitStatusCache(db, threadId) {
|
|
3
|
+
const result = await db.execute("SELECT data, cachedAt FROM git_status_cache WHERE threadId = ?", [threadId]);
|
|
4
|
+
const row = result.rows[0];
|
|
5
|
+
if (!row)
|
|
6
|
+
return null;
|
|
7
|
+
if (Date.now() - new Date(row.cachedAt).getTime() > CACHE_TTL_MS)
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(row.data);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function setGitStatusCache(db, threadId, data) {
|
|
17
|
+
await db.execute("INSERT OR REPLACE INTO git_status_cache (threadId, data, cachedAt) VALUES (?, ?, ?)", [threadId, JSON.stringify(data), new Date().toISOString()]);
|
|
18
|
+
}
|
|
19
|
+
export async function getGitStatusCacheAnyAge(db, threadId) {
|
|
20
|
+
const result = await db.execute("SELECT data FROM git_status_cache WHERE threadId = ?", [
|
|
21
|
+
threadId,
|
|
22
|
+
]);
|
|
23
|
+
const row = result.rows[0];
|
|
24
|
+
if (!row)
|
|
25
|
+
return null;
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(row.data);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function getGitStatusCacheBulk(db, threadIds) {
|
|
34
|
+
if (threadIds.length === 0)
|
|
35
|
+
return new Map();
|
|
36
|
+
const placeholders = threadIds.map(() => "?").join(", ");
|
|
37
|
+
const result = await db.execute(`SELECT threadId, data FROM git_status_cache WHERE threadId IN (${placeholders})`, threadIds);
|
|
38
|
+
const map = new Map();
|
|
39
|
+
for (const row of result.rows) {
|
|
40
|
+
const r = row;
|
|
41
|
+
try {
|
|
42
|
+
map.set(r.threadId, JSON.parse(r.data));
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// skip malformed entries
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return map;
|
|
49
|
+
}
|
|
50
|
+
export async function invalidateGitStatusCache(db, threadId) {
|
|
51
|
+
await db.execute("DELETE FROM git_status_cache WHERE threadId = ?", [threadId]);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=git-status-cache.database.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
+
export declare function gitStatusHandler(c: Context, metadataManager: MetadataManager): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
6
|
+
error: string;
|
|
7
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
hasChanges: boolean;
|
|
9
|
+
changedFilesCount: number;
|
|
10
|
+
currentBranch: string;
|
|
11
|
+
hasUnpushedCommits: boolean;
|
|
12
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
13
|
+
error: string;
|
|
14
|
+
}, 500, "json">)>;
|
|
15
|
+
//# sourceMappingURL=git-status.route.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { resolveThreadPath, getGitRoot, getGitStatus, getCurrentBranch, hasUnpushedCommits, } from "./git.utils.js";
|
|
3
|
+
export async function gitStatusHandler(c, metadataManager) {
|
|
4
|
+
try {
|
|
5
|
+
const threadId = c.req.param("threadId");
|
|
6
|
+
const thread = await metadataManager
|
|
7
|
+
.loadThreads()
|
|
8
|
+
.then((threads) => threads.find((t) => t.id === threadId));
|
|
9
|
+
if (!thread) {
|
|
10
|
+
return c.json({ error: "Thread not found" }, 404);
|
|
11
|
+
}
|
|
12
|
+
const repoPath = thread.path;
|
|
13
|
+
if (!repoPath) {
|
|
14
|
+
return c.json({ error: "Thread path not found" }, 404);
|
|
15
|
+
}
|
|
16
|
+
const absolutePath = resolveThreadPath(repoPath);
|
|
17
|
+
if (!existsSync(absolutePath)) {
|
|
18
|
+
return c.json({
|
|
19
|
+
error: `Thread repo path does not exist: ${absolutePath}. Check that the project folder is present.`,
|
|
20
|
+
}, 400);
|
|
21
|
+
}
|
|
22
|
+
let gitRoot;
|
|
23
|
+
try {
|
|
24
|
+
gitRoot = await getGitRoot(absolutePath);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
28
|
+
return c.json({
|
|
29
|
+
error: `Path is not a git repository: ${absolutePath}. ${msg}`,
|
|
30
|
+
}, 400);
|
|
31
|
+
}
|
|
32
|
+
// Check for uncommitted changes and count files
|
|
33
|
+
const { hasChanges, changedFilesCount } = await new Promise((resolve) => {
|
|
34
|
+
getGitStatus(gitRoot)
|
|
35
|
+
.then((statusOutput) => {
|
|
36
|
+
const lines = statusOutput
|
|
37
|
+
.trim()
|
|
38
|
+
.split("\n")
|
|
39
|
+
.filter((line) => line.length > 0);
|
|
40
|
+
resolve({
|
|
41
|
+
hasChanges: lines.length > 0,
|
|
42
|
+
changedFilesCount: lines.length,
|
|
43
|
+
});
|
|
44
|
+
})
|
|
45
|
+
.catch(() => resolve({ hasChanges: false, changedFilesCount: 0 }));
|
|
46
|
+
});
|
|
47
|
+
// Get current branch
|
|
48
|
+
const currentBranch = await getCurrentBranch(gitRoot);
|
|
49
|
+
// Check if there are unpushed commits
|
|
50
|
+
const hasUnpushed = await hasUnpushedCommits(gitRoot, currentBranch);
|
|
51
|
+
return c.json({
|
|
52
|
+
hasChanges,
|
|
53
|
+
changedFilesCount,
|
|
54
|
+
currentBranch,
|
|
55
|
+
hasUnpushedCommits: hasUnpushed,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return c.json({ error: "Failed to get git status" }, 500);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=git-status.route.js.map
|