tarsk 0.4.4 → 0.4.6
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/dist/index.js +447375 -37
- package/package.json +2 -2
- package/dist/agent/agent.error-utils.d.ts +0 -14
- package/dist/agent/agent.error-utils.js +0 -52
- package/dist/agent/agent.event-transformer.d.ts +0 -55
- package/dist/agent/agent.event-transformer.js +0 -175
- package/dist/agent/agent.executor.d.ts +0 -26
- package/dist/agent/agent.executor.js +0 -286
- package/dist/agent/agent.model-resolver.d.ts +0 -22
- package/dist/agent/agent.model-resolver.js +0 -67
- package/dist/agent/agent.process-manager.d.ts +0 -57
- package/dist/agent/agent.process-manager.js +0 -262
- package/dist/agent/agent.processing-state-manager.d.ts +0 -74
- package/dist/agent/agent.processing-state-manager.js +0 -87
- package/dist/agent/agent.prompt-loader.d.ts +0 -16
- package/dist/agent/agent.prompt-loader.js +0 -227
- package/dist/agent/agent.subagent-executor.d.ts +0 -35
- package/dist/agent/agent.subagent-executor.js +0 -135
- package/dist/bun/index.d.ts +0 -2
- package/dist/bun/index.js +0 -165
- package/dist/cli.d.ts +0 -3
- package/dist/cli.js +0 -22
- package/dist/core/crypto.d.ts +0 -29
- package/dist/core/crypto.js +0 -166
- package/dist/core/dev-server-cache.d.ts +0 -46
- package/dist/core/dev-server-cache.js +0 -59
- package/dist/core/env-manager.d.ts +0 -3
- package/dist/core/env-manager.js +0 -60
- package/dist/core/error-responses.d.ts +0 -61
- package/dist/core/error-responses.js +0 -64
- package/dist/core/logger.d.ts +0 -10
- package/dist/core/logger.js +0 -47
- package/dist/core/paths.d.ts +0 -22
- package/dist/core/paths.js +0 -26
- package/dist/core/random-words.d.ts +0 -18
- package/dist/core/random-words.js +0 -135
- package/dist/core/response-builder.d.ts +0 -50
- package/dist/core/response-builder.js +0 -56
- package/dist/core/route-helpers.d.ts +0 -47
- package/dist/core/route-helpers.js +0 -54
- package/dist/core/run-command-detector.d.ts +0 -26
- package/dist/core/run-command-detector.js +0 -98
- package/dist/core/stream-helper.d.ts +0 -44
- package/dist/core/stream-helper.js +0 -50
- package/dist/core/utils.d.ts +0 -43
- package/dist/core/utils.js +0 -113
- package/dist/core/validation.d.ts +0 -10
- package/dist/core/validation.js +0 -20
- package/dist/database/database.d.ts +0 -40
- package/dist/database/database.encryption.d.ts +0 -33
- package/dist/database/database.encryption.js +0 -62
- package/dist/database/database.js +0 -480
- package/dist/database/database.state.d.ts +0 -52
- package/dist/database/database.state.js +0 -119
- package/dist/database/database.test-utils.d.ts +0 -22
- package/dist/database/database.test-utils.js +0 -39
- package/dist/database/database.types.d.ts +0 -3
- package/dist/database/database.types.js +0 -2
- package/dist/features/agents/agents.manager.d.ts +0 -24
- package/dist/features/agents/agents.manager.js +0 -200
- package/dist/features/ask-user/ask-user.routes.d.ts +0 -9
- package/dist/features/ask-user/ask-user.routes.js +0 -35
- package/dist/features/chat/chat-delete.route.d.ts +0 -15
- package/dist/features/chat/chat-delete.route.js +0 -36
- package/dist/features/chat/chat-post.route.d.ts +0 -11
- package/dist/features/chat/chat-post.route.js +0 -270
- package/dist/features/chat/chat-stop.route.d.ts +0 -21
- package/dist/features/chat/chat-stop.route.js +0 -22
- package/dist/features/chat/chat-subscribe.route.d.ts +0 -9
- package/dist/features/chat/chat-subscribe.route.js +0 -71
- package/dist/features/chat/chat.routes.d.ts +0 -22
- package/dist/features/chat/chat.routes.js +0 -29
- package/dist/features/conversations/conversations-delete.route.d.ts +0 -16
- package/dist/features/conversations/conversations-delete.route.js +0 -34
- package/dist/features/conversations/conversations-get-all.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-all.route.js +0 -39
- package/dist/features/conversations/conversations-get-by-id.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-by-id.route.js +0 -38
- package/dist/features/conversations/conversations-get-deleted.route.d.ts +0 -15
- package/dist/features/conversations/conversations-get-deleted.route.js +0 -34
- package/dist/features/conversations/conversations-get-messages.route.d.ts +0 -16
- package/dist/features/conversations/conversations-get-messages.route.js +0 -49
- package/dist/features/conversations/conversations.content.d.ts +0 -28
- package/dist/features/conversations/conversations.content.js +0 -142
- package/dist/features/conversations/conversations.database.d.ts +0 -108
- package/dist/features/conversations/conversations.database.js +0 -373
- package/dist/features/conversations/conversations.manager.d.ts +0 -130
- package/dist/features/conversations/conversations.manager.js +0 -162
- package/dist/features/conversations/conversations.routes.d.ts +0 -21
- package/dist/features/conversations/conversations.routes.js +0 -38
- package/dist/features/conversations/token-usage.route.d.ts +0 -41
- package/dist/features/conversations/token-usage.route.js +0 -419
- package/dist/features/git/git-commit.route.d.ts +0 -12
- package/dist/features/git/git-commit.route.js +0 -39
- package/dist/features/git/git-create-branch.route.d.ts +0 -28
- package/dist/features/git/git-create-branch.route.js +0 -119
- package/dist/features/git/git-create-pr.route.d.ts +0 -13
- package/dist/features/git/git-create-pr.route.js +0 -50
- package/dist/features/git/git-create-repo.route.d.ts +0 -14
- package/dist/features/git/git-create-repo.route.js +0 -108
- package/dist/features/git/git-diff.route.d.ts +0 -30
- package/dist/features/git/git-diff.route.js +0 -189
- package/dist/features/git/git-fetch.route.d.ts +0 -12
- package/dist/features/git/git-fetch.route.js +0 -31
- package/dist/features/git/git-generate-commit-message.route.d.ts +0 -12
- package/dist/features/git/git-generate-commit-message.route.js +0 -76
- package/dist/features/git/git-generate-pr-info.route.d.ts +0 -13
- package/dist/features/git/git-generate-pr-info.route.js +0 -147
- package/dist/features/git/git-github-status.route.d.ts +0 -16
- package/dist/features/git/git-github-status.route.js +0 -68
- package/dist/features/git/git-log.route.d.ts +0 -17
- package/dist/features/git/git-log.route.js +0 -33
- package/dist/features/git/git-pr-status.route.d.ts +0 -15
- package/dist/features/git/git-pr-status.route.js +0 -33
- package/dist/features/git/git-pull.route.d.ts +0 -12
- package/dist/features/git/git-pull.route.js +0 -35
- package/dist/features/git/git-push.route.d.ts +0 -12
- package/dist/features/git/git-push.route.js +0 -46
- package/dist/features/git/git-status-cache.database.d.ts +0 -7
- package/dist/features/git/git-status-cache.database.js +0 -53
- package/dist/features/git/git-status.route.d.ts +0 -15
- package/dist/features/git/git-status.route.js +0 -62
- package/dist/features/git/git-sync-branch.route.d.ts +0 -4
- package/dist/features/git/git-sync-branch.route.js +0 -208
- package/dist/features/git/git-unified-status.route.d.ts +0 -30
- package/dist/features/git/git-unified-status.route.js +0 -165
- package/dist/features/git/git-username.route.d.ts +0 -3
- package/dist/features/git/git-username.route.js +0 -24
- package/dist/features/git/git.manager.d.ts +0 -139
- package/dist/features/git/git.manager.js +0 -352
- package/dist/features/git/git.routes.d.ts +0 -4
- package/dist/features/git/git.routes.js +0 -116
- package/dist/features/git/git.utils.d.ts +0 -82
- package/dist/features/git/git.utils.js +0 -1040
- package/dist/features/mcp/mcp.config.d.ts +0 -27
- package/dist/features/mcp/mcp.config.js +0 -148
- package/dist/features/mcp/mcp.manager.d.ts +0 -61
- package/dist/features/mcp/mcp.manager.js +0 -254
- package/dist/features/mcp/mcp.popular.json +0 -103
- package/dist/features/mcp/mcp.routes.d.ts +0 -13
- package/dist/features/mcp/mcp.routes.js +0 -159
- package/dist/features/mcp/mcp.types.d.ts +0 -80
- package/dist/features/mcp/mcp.types.js +0 -8
- package/dist/features/metadata/metadata.manager.d.ts +0 -126
- package/dist/features/metadata/metadata.manager.js +0 -423
- package/dist/features/models/model-info-aihubmix.d.ts +0 -25
- package/dist/features/models/model-info-aihubmix.js +0 -117
- package/dist/features/models/model-info-openrouter.d.ts +0 -25
- package/dist/features/models/model-info-openrouter.js +0 -104
- package/dist/features/models/model-info.d.ts +0 -37
- package/dist/features/models/model-info.js +0 -39
- package/dist/features/models/models-catalog.d.ts +0 -49
- package/dist/features/models/models-catalog.js +0 -80
- package/dist/features/models/models-catalog.route.d.ts +0 -43
- package/dist/features/models/models-catalog.route.js +0 -15
- package/dist/features/models/models-get-available.route.d.ts +0 -36
- package/dist/features/models/models-get-available.route.js +0 -66
- package/dist/features/models/models-get-enabled.route.d.ts +0 -33
- package/dist/features/models/models-get-enabled.route.js +0 -45
- package/dist/features/models/models-get-model-info.route.d.ts +0 -31
- package/dist/features/models/models-get-model-info.route.js +0 -84
- package/dist/features/models/models-model-disable.route.d.ts +0 -15
- package/dist/features/models/models-model-disable.route.js +0 -20
- package/dist/features/models/models-model-enable.route.d.ts +0 -13
- package/dist/features/models/models-model-enable.route.js +0 -20
- package/dist/features/models/models-provider-refresh.route.d.ts +0 -17
- package/dist/features/models/models-provider-refresh.route.js +0 -20
- package/dist/features/models/models.manager.d.ts +0 -58
- package/dist/features/models/models.manager.js +0 -138
- package/dist/features/models/models.routes.d.ts +0 -18
- package/dist/features/models/models.routes.js +0 -83
- package/dist/features/models/open-router-models.d.ts +0 -38
- package/dist/features/models/open-router-models.js +0 -73
- package/dist/features/models/openai-models.d.ts +0 -63
- package/dist/features/models/openai-models.js +0 -150
- package/dist/features/onboarding/onboarding-get-git-check.route.d.ts +0 -11
- package/dist/features/onboarding/onboarding-get-git-check.route.js +0 -28
- package/dist/features/onboarding/onboarding-get-status.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-get-status.route.js +0 -15
- package/dist/features/onboarding/onboarding-post-complete.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-post-complete.route.js +0 -15
- package/dist/features/onboarding/onboarding-post-reset.route.d.ts +0 -12
- package/dist/features/onboarding/onboarding-post-reset.route.js +0 -15
- package/dist/features/onboarding/onboarding.routes.d.ts +0 -18
- package/dist/features/onboarding/onboarding.routes.js +0 -28
- package/dist/features/project-todos/project-todos.database.d.ts +0 -38
- package/dist/features/project-todos/project-todos.database.js +0 -91
- package/dist/features/project-todos/project-todos.routes.d.ts +0 -4
- package/dist/features/project-todos/project-todos.routes.js +0 -94
- package/dist/features/projects/projects-ai-files.route.d.ts +0 -148
- package/dist/features/projects/projects-ai-files.route.js +0 -425
- package/dist/features/projects/projects-commands.route.d.ts +0 -27
- package/dist/features/projects/projects-commands.route.js +0 -39
- package/dist/features/projects/projects-create.route.d.ts +0 -19
- package/dist/features/projects/projects-create.route.js +0 -37
- package/dist/features/projects/projects-delete.route.d.ts +0 -24
- package/dist/features/projects/projects-delete.route.js +0 -34
- package/dist/features/projects/projects-get.route.d.ts +0 -47
- package/dist/features/projects/projects-get.route.js +0 -36
- package/dist/features/projects/projects-list.route.d.ts +0 -58
- package/dist/features/projects/projects-list.route.js +0 -59
- package/dist/features/projects/projects-open-folder.route.d.ts +0 -10
- package/dist/features/projects/projects-open-folder.route.js +0 -11
- package/dist/features/projects/projects-open.route.d.ts +0 -26
- package/dist/features/projects/projects-open.route.js +0 -49
- package/dist/features/projects/projects-package-scripts.route.d.ts +0 -15
- package/dist/features/projects/projects-package-scripts.route.js +0 -96
- package/dist/features/projects/projects-run-command.route.d.ts +0 -8
- package/dist/features/projects/projects-run-command.route.js +0 -21
- package/dist/features/projects/projects-run.route.d.ts +0 -51
- package/dist/features/projects/projects-run.route.js +0 -74
- package/dist/features/projects/projects-update.route.d.ts +0 -24
- package/dist/features/projects/projects-update.route.js +0 -81
- package/dist/features/projects/projects.creator.d.ts +0 -33
- package/dist/features/projects/projects.creator.js +0 -555
- package/dist/features/projects/projects.database.d.ts +0 -61
- package/dist/features/projects/projects.database.js +0 -212
- package/dist/features/projects/projects.manager.d.ts +0 -291
- package/dist/features/projects/projects.manager.js +0 -426
- package/dist/features/projects/projects.open-with.d.ts +0 -27
- package/dist/features/projects/projects.open-with.js +0 -156
- package/dist/features/projects/projects.routes.d.ts +0 -20
- package/dist/features/projects/projects.routes.js +0 -255
- package/dist/features/projects/terminal-session-manager.d.ts +0 -55
- package/dist/features/projects/terminal-session-manager.js +0 -90
- package/dist/features/providers/provider-resolver.d.ts +0 -13
- package/dist/features/providers/provider-resolver.js +0 -22
- package/dist/features/providers/providers-get-credits.route.d.ts +0 -15
- package/dist/features/providers/providers-get-credits.route.js +0 -51
- package/dist/features/providers/providers-get.route.d.ts +0 -16
- package/dist/features/providers/providers-get.route.js +0 -32
- package/dist/features/providers/providers-open-external.route.d.ts +0 -15
- package/dist/features/providers/providers-open-external.route.js +0 -49
- package/dist/features/providers/providers-post-bulk-keys.route.d.ts +0 -14
- package/dist/features/providers/providers-post-bulk-keys.route.js +0 -31
- package/dist/features/providers/providers-post-keys.route.d.ts +0 -14
- package/dist/features/providers/providers-post-keys.route.js +0 -25
- package/dist/features/providers/providers.routes.d.ts +0 -19
- package/dist/features/providers/providers.routes.js +0 -31
- package/dist/features/rules/rules-post.route.d.ts +0 -43
- package/dist/features/rules/rules-post.route.js +0 -89
- package/dist/features/rules/rules.manager.d.ts +0 -36
- package/dist/features/rules/rules.manager.js +0 -203
- package/dist/features/rules/rules.routes.d.ts +0 -12
- package/dist/features/rules/rules.routes.js +0 -13
- package/dist/features/run/run-get-running.route.d.ts +0 -15
- package/dist/features/run/run-get-running.route.js +0 -21
- package/dist/features/run/run-post-start.route.d.ts +0 -8
- package/dist/features/run/run-post-start.route.js +0 -21
- package/dist/features/run/run-post-stop.route.d.ts +0 -15
- package/dist/features/run/run-post-stop.route.js +0 -24
- package/dist/features/run/run-post-suggest.route.d.ts +0 -15
- package/dist/features/run/run-post-suggest.route.js +0 -21
- package/dist/features/run/run-put-command.route.d.ts +0 -15
- package/dist/features/run/run-put-command.route.js +0 -24
- package/dist/features/run/run.routes.d.ts +0 -19
- package/dist/features/run/run.routes.js +0 -31
- package/dist/features/scaffold/index.d.ts +0 -7
- package/dist/features/scaffold/index.js +0 -5
- package/dist/features/scaffold/scaffold-get-templates.route.d.ts +0 -27
- package/dist/features/scaffold/scaffold-get-templates.route.js +0 -17
- package/dist/features/scaffold/scaffold-post.route.d.ts +0 -8
- package/dist/features/scaffold/scaffold-post.route.js +0 -30
- package/dist/features/scaffold/scaffold.routes.d.ts +0 -10
- package/dist/features/scaffold/scaffold.routes.js +0 -16
- package/dist/features/scaffold/scaffold.runner.d.ts +0 -48
- package/dist/features/scaffold/scaffold.runner.js +0 -475
- package/dist/features/scaffold/scaffold.types.d.ts +0 -26
- package/dist/features/scaffold/scaffold.types.js +0 -5
- package/dist/features/skills/skills.activation.d.ts +0 -31
- package/dist/features/skills/skills.activation.js +0 -155
- package/dist/features/skills/skills.manager.d.ts +0 -35
- package/dist/features/skills/skills.manager.js +0 -251
- package/dist/features/slash-commands/slash-commands-delete.route.d.ts +0 -23
- package/dist/features/slash-commands/slash-commands-delete.route.js +0 -36
- package/dist/features/slash-commands/slash-commands-get.route.d.ts +0 -53
- package/dist/features/slash-commands/slash-commands-get.route.js +0 -54
- package/dist/features/slash-commands/slash-commands-post.route.d.ts +0 -39
- package/dist/features/slash-commands/slash-commands-post.route.js +0 -70
- package/dist/features/slash-commands/slash-commands-put.route.d.ts +0 -23
- package/dist/features/slash-commands/slash-commands-put.route.js +0 -36
- package/dist/features/slash-commands/slash-commands.manager.d.ts +0 -46
- package/dist/features/slash-commands/slash-commands.manager.js +0 -265
- package/dist/features/slash-commands/slash-commands.routes.d.ts +0 -13
- package/dist/features/slash-commands/slash-commands.routes.js +0 -20
- package/dist/features/threads/threads-ai-files.route.d.ts +0 -153
- package/dist/features/threads/threads-ai-files.route.js +0 -287
- package/dist/features/threads/threads-conversation-folder-path.route.d.ts +0 -14
- package/dist/features/threads/threads-conversation-folder-path.route.js +0 -23
- package/dist/features/threads/threads-create.route.d.ts +0 -22
- package/dist/features/threads/threads-create.route.js +0 -60
- package/dist/features/threads/threads-delete.route.d.ts +0 -25
- package/dist/features/threads/threads-delete.route.js +0 -35
- package/dist/features/threads/threads-files.route.d.ts +0 -15
- package/dist/features/threads/threads-files.route.js +0 -20
- package/dist/features/threads/threads-fix-comments.route.d.ts +0 -26
- package/dist/features/threads/threads-fix-comments.route.js +0 -45
- package/dist/features/threads/threads-get.route.d.ts +0 -30
- package/dist/features/threads/threads-get.route.js +0 -38
- package/dist/features/threads/threads-list.route.d.ts +0 -56
- package/dist/features/threads/threads-list.route.js +0 -58
- package/dist/features/threads/threads-messages.route.d.ts +0 -28
- package/dist/features/threads/threads-messages.route.js +0 -110
- package/dist/features/threads/threads-open.route.d.ts +0 -26
- package/dist/features/threads/threads-open.route.js +0 -62
- package/dist/features/threads/threads-select.route.d.ts +0 -25
- package/dist/features/threads/threads-select.route.js +0 -35
- package/dist/features/threads/threads-update.route.d.ts +0 -15
- package/dist/features/threads/threads-update.route.js +0 -30
- package/dist/features/threads/threads.database.d.ts +0 -68
- package/dist/features/threads/threads.database.js +0 -215
- package/dist/features/threads/threads.manager.d.ts +0 -204
- package/dist/features/threads/threads.manager.js +0 -505
- package/dist/features/threads/threads.routes.d.ts +0 -20
- package/dist/features/threads/threads.routes.js +0 -230
- package/dist/features/todos/todos.database.d.ts +0 -14
- package/dist/features/todos/todos.database.js +0 -31
- package/dist/features/updates/updates.routes.d.ts +0 -13
- package/dist/features/updates/updates.routes.js +0 -40
- package/dist/index.d.ts +0 -3
- package/dist/project-analyzer.d.ts +0 -26
- package/dist/project-analyzer.js +0 -307
- package/dist/server.d.ts +0 -12
- package/dist/server.js +0 -142
- package/dist/tools/agent-tool.d.ts +0 -49
- package/dist/tools/agent-tool.js +0 -131
- package/dist/tools/ask-user.d.ts +0 -25
- package/dist/tools/ask-user.js +0 -74
- package/dist/tools/ast-grep.d.ts +0 -28
- package/dist/tools/ast-grep.js +0 -273
- package/dist/tools/bash.d.ts +0 -33
- package/dist/tools/bash.js +0 -186
- package/dist/tools/edit-diff.d.ts +0 -24
- package/dist/tools/edit-diff.js +0 -136
- package/dist/tools/edit.d.ts +0 -28
- package/dist/tools/edit.js +0 -78
- package/dist/tools/find.d.ts +0 -31
- package/dist/tools/find.js +0 -117
- package/dist/tools/grep.d.ts +0 -37
- package/dist/tools/grep.js +0 -231
- package/dist/tools/index.d.ts +0 -93
- package/dist/tools/index.js +0 -110
- package/dist/tools/ls.d.ts +0 -31
- package/dist/tools/ls.js +0 -108
- package/dist/tools/mcp-tools.d.ts +0 -31
- package/dist/tools/mcp-tools.js +0 -59
- package/dist/tools/path-utils.d.ts +0 -14
- package/dist/tools/path-utils.js +0 -87
- package/dist/tools/read.d.ts +0 -27
- package/dist/tools/read.js +0 -86
- package/dist/tools/resolve-bin.d.ts +0 -5
- package/dist/tools/resolve-bin.js +0 -28
- package/dist/tools/shell.d.ts +0 -7
- package/dist/tools/shell.js +0 -143
- package/dist/tools/skill-reference-tool.d.ts +0 -30
- package/dist/tools/skill-reference-tool.js +0 -171
- package/dist/tools/skill-tool.d.ts +0 -33
- package/dist/tools/skill-tool.js +0 -213
- package/dist/tools/todo.d.ts +0 -20
- package/dist/tools/todo.js +0 -168
- package/dist/tools/tool-helpers.d.ts +0 -78
- package/dist/tools/tool-helpers.js +0 -109
- package/dist/tools/truncate.d.ts +0 -31
- package/dist/tools/truncate.js +0 -164
- package/dist/tools/write.d.ts +0 -21
- package/dist/tools/write.js +0 -65
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitManager handles git operations including URL validation and repository cloning
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Validating git URLs in various formats
|
|
6
|
-
* - Cloning repositories with streaming output
|
|
7
|
-
* - Handling git operation errors
|
|
8
|
-
*/
|
|
9
|
-
import { spawnProcess, spawnSyncProcess } from "../../core/utils.js";
|
|
10
|
-
import { mkdir } from "fs/promises";
|
|
11
|
-
import { dirname } from "path";
|
|
12
|
-
/**
|
|
13
|
-
* GitManagerImpl provides the implementation for git operations
|
|
14
|
-
*/
|
|
15
|
-
export class GitManagerImpl {
|
|
16
|
-
/**
|
|
17
|
-
* Regular expressions for validating different git URL formats
|
|
18
|
-
*/
|
|
19
|
-
gitUrlPatterns = [
|
|
20
|
-
// HTTPS URLs: https://github.com/user/repo.git or https://github.com/user/repo
|
|
21
|
-
/^https:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:[0-9]+)?\/[a-zA-Z0-9._/-]+(\.git)?$/,
|
|
22
|
-
// Git protocol URLs: git://github.com/user/repo.git or git://github.com/user/repo
|
|
23
|
-
/^git:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:[0-9]+)?\/[a-zA-Z0-9._/-]+(\.git)?$/,
|
|
24
|
-
// SSH URLs with git@ prefix: git@github.com:user/repo.git or git@github.com:user/repo
|
|
25
|
-
/^git@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}:[a-zA-Z0-9._/-]+(\.git)?$/,
|
|
26
|
-
// SSH URLs with ssh:// prefix: ssh://git@github.com/user/repo.git
|
|
27
|
-
/^ssh:\/\/(git@)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:[0-9]+)?\/[a-zA-Z0-9._/-]+(\.git)?$/,
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Validates a git URL against common git URL formats
|
|
31
|
-
*
|
|
32
|
-
* Supports the following formats:
|
|
33
|
-
* - HTTPS: https://github.com/user/repo.git
|
|
34
|
-
* - Git protocol: git://github.com/user/repo.git
|
|
35
|
-
* - SSH (git@): git@github.com:user/repo.git
|
|
36
|
-
* - SSH (ssh://): ssh://git@github.com/user/repo.git
|
|
37
|
-
*
|
|
38
|
-
* @param url - The URL to validate
|
|
39
|
-
* @returns true if the URL matches a valid git URL format, false otherwise
|
|
40
|
-
*
|
|
41
|
-
* Requirements: 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
|
|
42
|
-
*/
|
|
43
|
-
validateGitUrl(url) {
|
|
44
|
-
// Check if URL is empty or not a string
|
|
45
|
-
if (!url || typeof url !== "string") {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
// Trim whitespace
|
|
49
|
-
const trimmedUrl = url.trim();
|
|
50
|
-
// Check if URL is empty after trimming
|
|
51
|
-
if (trimmedUrl.length === 0) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
// Test against all supported patterns
|
|
55
|
-
return this.gitUrlPatterns.some((pattern) => pattern.test(trimmedUrl));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Clones a git repository to the specified target path with streaming output
|
|
59
|
-
*
|
|
60
|
-
* This method:
|
|
61
|
-
* 1. Validates the git URL
|
|
62
|
-
* 2. Creates the target directory if needed
|
|
63
|
-
* 3. Spawns a git clone process
|
|
64
|
-
* 4. Streams stdout and stderr output
|
|
65
|
-
* 5. Handles completion and errors
|
|
66
|
-
*
|
|
67
|
-
* @param gitUrl - The git repository URL to clone
|
|
68
|
-
* @param targetPath - The local path where the repository should be cloned
|
|
69
|
-
* @yields GitEvent objects during the clone operation
|
|
70
|
-
*
|
|
71
|
-
* Requirements:
|
|
72
|
-
* - 1.1 - WHEN a user provides a git URL to create a new Project, THE CLI SHALL clone the repository
|
|
73
|
-
* - 1.3 - WHEN the clone operation executes, THE CLI SHALL stream the git clone output back to the App
|
|
74
|
-
* - 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
|
|
75
|
-
* - 7.2 - IF a git clone operation fails, THEN THE CLI SHALL return a descriptive error message
|
|
76
|
-
* - 7.3 - WHEN a clone operation is in progress, THE CLI SHALL stream git output to provide progress feedback
|
|
77
|
-
*/
|
|
78
|
-
async *cloneRepository(gitUrl, targetPath) {
|
|
79
|
-
// Validate the git URL first
|
|
80
|
-
if (!this.validateGitUrl(gitUrl)) {
|
|
81
|
-
yield {
|
|
82
|
-
type: "error",
|
|
83
|
-
message: `Invalid git URL format: ${gitUrl}`,
|
|
84
|
-
error: new Error(`Invalid git URL format: ${gitUrl}`),
|
|
85
|
-
};
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
// Create the parent directory if it doesn't exist
|
|
90
|
-
const parentDir = dirname(targetPath);
|
|
91
|
-
await mkdir(parentDir, { recursive: true });
|
|
92
|
-
// Spawn git clone process
|
|
93
|
-
// Use --progress to get progress output on stderr
|
|
94
|
-
const gitProcess = spawnProcess("git", ["clone", "--progress", gitUrl, targetPath]);
|
|
95
|
-
// Create a queue for events
|
|
96
|
-
const eventQueue = [];
|
|
97
|
-
let processExited = false;
|
|
98
|
-
let exitCode = null;
|
|
99
|
-
let processError = null;
|
|
100
|
-
// Handle stdout data
|
|
101
|
-
if (gitProcess.stdout) {
|
|
102
|
-
gitProcess.stdout.on("data", (data) => {
|
|
103
|
-
const output = data.toString();
|
|
104
|
-
eventQueue.push({
|
|
105
|
-
type: "stdout",
|
|
106
|
-
data: output,
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
// Handle stderr data (git clone progress goes to stderr)
|
|
111
|
-
if (gitProcess.stderr) {
|
|
112
|
-
gitProcess.stderr.on("data", (data) => {
|
|
113
|
-
const output = data.toString();
|
|
114
|
-
eventQueue.push({
|
|
115
|
-
type: "stderr",
|
|
116
|
-
data: output,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
// Handle process exit
|
|
121
|
-
gitProcess.on("close", (code) => {
|
|
122
|
-
exitCode = code;
|
|
123
|
-
processExited = true;
|
|
124
|
-
});
|
|
125
|
-
// Handle process errors
|
|
126
|
-
gitProcess.on("error", (err) => {
|
|
127
|
-
processError = err;
|
|
128
|
-
processExited = true;
|
|
129
|
-
});
|
|
130
|
-
// Yield events as they come in
|
|
131
|
-
while (!processExited || eventQueue.length > 0) {
|
|
132
|
-
if (eventQueue.length > 0) {
|
|
133
|
-
const event = eventQueue.shift();
|
|
134
|
-
if (event) {
|
|
135
|
-
yield event;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
// Wait a bit before checking again
|
|
140
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// Check for process errors
|
|
144
|
-
if (processError) {
|
|
145
|
-
const errorMessage = processError instanceof Error ? processError.message : JSON.stringify(processError);
|
|
146
|
-
yield {
|
|
147
|
-
type: "error",
|
|
148
|
-
message: errorMessage,
|
|
149
|
-
error: processError,
|
|
150
|
-
};
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
// Check exit code
|
|
154
|
-
if (exitCode !== 0) {
|
|
155
|
-
const errorMsg = `Git clone failed with exit code ${exitCode}`;
|
|
156
|
-
yield {
|
|
157
|
-
type: "error",
|
|
158
|
-
message: errorMsg,
|
|
159
|
-
error: new Error(errorMsg),
|
|
160
|
-
};
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
// Yield complete event
|
|
164
|
-
yield {
|
|
165
|
-
type: "complete",
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
// Handle any errors during the process
|
|
170
|
-
yield {
|
|
171
|
-
type: "error",
|
|
172
|
-
message: error instanceof Error ? error.message : String(error),
|
|
173
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Sanitizes a branch name to ensure it only contains valid git branch characters
|
|
179
|
-
*
|
|
180
|
-
* This method:
|
|
181
|
-
* 1. Trims whitespace
|
|
182
|
-
* 2. Converts to lowercase
|
|
183
|
-
* 3. Replaces spaces with dashes
|
|
184
|
-
* 4. Removes invalid characters (only allows alphanumeric, dash, underscore, slash, dot)
|
|
185
|
-
* 5. Removes leading/trailing slashes and dots
|
|
186
|
-
* 6. Collapses multiple consecutive dashes into one
|
|
187
|
-
*
|
|
188
|
-
* @param name - The branch name to sanitize
|
|
189
|
-
* @returns The sanitized branch name (all lowercase)
|
|
190
|
-
*/
|
|
191
|
-
sanitizeBranchName(name) {
|
|
192
|
-
if (!name || typeof name !== "string") {
|
|
193
|
-
return "branch";
|
|
194
|
-
}
|
|
195
|
-
return (name
|
|
196
|
-
.trim()
|
|
197
|
-
// Convert to lowercase
|
|
198
|
-
.toLowerCase()
|
|
199
|
-
// Replace spaces with dashes
|
|
200
|
-
.replace(/\s+/g, "-")
|
|
201
|
-
// Remove invalid characters (keep alphanumeric, dash, underscore, slash, dot)
|
|
202
|
-
.replace(/[^a-zA-Z0-9\-_/.]/g, "")
|
|
203
|
-
// Remove leading/trailing slashes and dots
|
|
204
|
-
.replace(/^[/.]+|[/.]+$/g, "")
|
|
205
|
-
// Collapse multiple consecutive dashes
|
|
206
|
-
.replace(/-+/g, "-") ||
|
|
207
|
-
// Ensure we have something left
|
|
208
|
-
"branch");
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Checks if a branch exists in a git repository
|
|
212
|
-
*
|
|
213
|
-
* Uses `git show-ref` to check for the branch without checking out
|
|
214
|
-
*
|
|
215
|
-
* @param repoPath - The path to the git repository
|
|
216
|
-
* @param branchName - The branch name to check
|
|
217
|
-
* @returns true if the branch exists, false otherwise
|
|
218
|
-
*/
|
|
219
|
-
async checkBranchExists(repoPath, branchName) {
|
|
220
|
-
return new Promise((resolve) => {
|
|
221
|
-
const gitProcess = spawnProcess("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branchName}`], {
|
|
222
|
-
cwd: repoPath,
|
|
223
|
-
});
|
|
224
|
-
gitProcess.on("close", (code) => {
|
|
225
|
-
// Exit code 0 means the branch exists
|
|
226
|
-
resolve(code === 0);
|
|
227
|
-
});
|
|
228
|
-
gitProcess.on("error", () => {
|
|
229
|
-
// If there's an error running git, assume branch doesn't exist
|
|
230
|
-
resolve(false);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Creates and checks out a new branch in a git repository with streaming output
|
|
236
|
-
*
|
|
237
|
-
* This method:
|
|
238
|
-
* 1. Creates a new branch from the current HEAD
|
|
239
|
-
* 2. Checks out the new branch
|
|
240
|
-
* 3. Streams output during the operation
|
|
241
|
-
*
|
|
242
|
-
* @param repoPath - The path to the git repository
|
|
243
|
-
* @param branchName - The branch name to create
|
|
244
|
-
* @yields GitEvent objects during the branch creation
|
|
245
|
-
*/
|
|
246
|
-
async *createAndCheckoutBranch(repoPath, branchName) {
|
|
247
|
-
try {
|
|
248
|
-
// Spawn git checkout process with -b flag to create new branch
|
|
249
|
-
const gitProcess = spawnProcess("git", ["checkout", "-b", branchName], {
|
|
250
|
-
cwd: repoPath,
|
|
251
|
-
});
|
|
252
|
-
// Create a queue for events
|
|
253
|
-
const eventQueue = [];
|
|
254
|
-
let processExited = false;
|
|
255
|
-
let exitCode = null;
|
|
256
|
-
let processError = null;
|
|
257
|
-
// Handle stdout data
|
|
258
|
-
if (gitProcess.stdout) {
|
|
259
|
-
gitProcess.stdout.on("data", (data) => {
|
|
260
|
-
const output = data.toString();
|
|
261
|
-
eventQueue.push({
|
|
262
|
-
type: "stdout",
|
|
263
|
-
data: output,
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
// Handle stderr data
|
|
268
|
-
if (gitProcess.stderr) {
|
|
269
|
-
gitProcess.stderr.on("data", (data) => {
|
|
270
|
-
const output = data.toString();
|
|
271
|
-
eventQueue.push({
|
|
272
|
-
type: "stderr",
|
|
273
|
-
data: output,
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
// Handle process exit
|
|
278
|
-
gitProcess.on("close", (code) => {
|
|
279
|
-
exitCode = code;
|
|
280
|
-
processExited = true;
|
|
281
|
-
});
|
|
282
|
-
// Handle process errors
|
|
283
|
-
gitProcess.on("error", (err) => {
|
|
284
|
-
processError = err;
|
|
285
|
-
processExited = true;
|
|
286
|
-
});
|
|
287
|
-
// Yield events as they come in
|
|
288
|
-
while (!processExited || eventQueue.length > 0) {
|
|
289
|
-
if (eventQueue.length > 0) {
|
|
290
|
-
const event = eventQueue.shift();
|
|
291
|
-
if (event) {
|
|
292
|
-
yield event;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
// Wait a bit before checking again
|
|
297
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// Check for process errors
|
|
301
|
-
if (processError) {
|
|
302
|
-
const errorMessage = processError instanceof Error ? processError.message : JSON.stringify(processError);
|
|
303
|
-
yield {
|
|
304
|
-
type: "error",
|
|
305
|
-
message: errorMessage,
|
|
306
|
-
error: processError,
|
|
307
|
-
};
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
// Check exit code
|
|
311
|
-
if (exitCode !== 0) {
|
|
312
|
-
const errorMsg = `Failed to create and checkout branch '${branchName}' with exit code ${exitCode}`;
|
|
313
|
-
yield {
|
|
314
|
-
type: "error",
|
|
315
|
-
message: errorMsg,
|
|
316
|
-
error: new Error(errorMsg),
|
|
317
|
-
};
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
// Yield complete event
|
|
321
|
-
yield {
|
|
322
|
-
type: "complete",
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
yield {
|
|
327
|
-
type: "error",
|
|
328
|
-
message: error instanceof Error ? error.message : String(error),
|
|
329
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
async initRepository(repoPath) {
|
|
334
|
-
// Ensure the directory exists
|
|
335
|
-
try {
|
|
336
|
-
await mkdir(repoPath, { recursive: true });
|
|
337
|
-
}
|
|
338
|
-
catch (error) {
|
|
339
|
-
// Directory might already exist, which is fine
|
|
340
|
-
if (error.code !== "EEXIST") {
|
|
341
|
-
throw error;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
const result = spawnSyncProcess("git", ["init"], { cwd: repoPath, encoding: "utf-8" });
|
|
345
|
-
if (result.status !== 0) {
|
|
346
|
-
const stderrStr = (typeof result.stderr === "string" ? result.stderr : (result.stderr?.toString() ?? "")).trim();
|
|
347
|
-
const stderr = stderrStr !== "" ? stderrStr : (result.error?.message ?? "Unknown error");
|
|
348
|
-
throw new Error(`git init failed: ${stderr}`);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
//# sourceMappingURL=git.manager.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
3
|
-
export declare function createGitRoutes(metadataManager: MetadataManager): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
4
|
-
//# sourceMappingURL=git.routes.d.ts.map
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import { getDatabase } from "../../database/database.js";
|
|
3
|
-
import { invalidateGitStatusCache } from "./git-status-cache.database.js";
|
|
4
|
-
import { gitUsernameHandler } from "./git-username.route.js";
|
|
5
|
-
import { gitStatusHandler } from "./git-status.route.js";
|
|
6
|
-
import { gitDiffHandler } from "./git-diff.route.js";
|
|
7
|
-
import { gitGenerateCommitMessageHandler } from "./git-generate-commit-message.route.js";
|
|
8
|
-
import { gitCommitHandler } from "./git-commit.route.js";
|
|
9
|
-
import { gitPushHandler } from "./git-push.route.js";
|
|
10
|
-
import { gitPullHandler } from "./git-pull.route.js";
|
|
11
|
-
import { gitFetchHandler } from "./git-fetch.route.js";
|
|
12
|
-
import { gitGeneratePrInfoHandler } from "./git-generate-pr-info.route.js";
|
|
13
|
-
import { gitLogHandler } from "./git-log.route.js";
|
|
14
|
-
import { gitCreatePrHandler } from "./git-create-pr.route.js";
|
|
15
|
-
import { gitGithubStatusHandler } from "./git-github-status.route.js";
|
|
16
|
-
import { gitUnifiedStatusHandler } from "./git-unified-status.route.js";
|
|
17
|
-
import { gitCreateRepoHandler } from "./git-create-repo.route.js";
|
|
18
|
-
import { gitPrStatusHandler } from "./git-pr-status.route.js";
|
|
19
|
-
import { gitCreateBranchHandler } from "./git-create-branch.route.js";
|
|
20
|
-
import { gitSyncBranchHandler } from "./git-sync-branch.route.js";
|
|
21
|
-
export function createGitRoutes(metadataManager) {
|
|
22
|
-
const router = new Hono();
|
|
23
|
-
// GET /api/git/username - returns the git user.name from local git config
|
|
24
|
-
router.get("/username", async (c) => {
|
|
25
|
-
return gitUsernameHandler(c);
|
|
26
|
-
});
|
|
27
|
-
// GET /api/git/unified-status/:threadId - returns combined git and GitHub status for a thread
|
|
28
|
-
// Add ?fresh=true to bypass cache and recompute
|
|
29
|
-
router.get("/unified-status/:threadId", async (c) => {
|
|
30
|
-
const db = await getDatabase();
|
|
31
|
-
return gitUnifiedStatusHandler(c, metadataManager, db);
|
|
32
|
-
});
|
|
33
|
-
// DELETE /api/git/unified-status/:threadId/cache - invalidates the cached status for a thread
|
|
34
|
-
router.delete("/unified-status/:threadId/cache", async (c) => {
|
|
35
|
-
const threadId = c.req.param("threadId");
|
|
36
|
-
const db = await getDatabase();
|
|
37
|
-
await invalidateGitStatusCache(db, threadId);
|
|
38
|
-
return c.json({ success: true });
|
|
39
|
-
});
|
|
40
|
-
// GET /api/git/status/:threadId - returns git status for a thread
|
|
41
|
-
router.get("/status/:threadId", async (c) => {
|
|
42
|
-
return gitStatusHandler(c, metadataManager);
|
|
43
|
-
});
|
|
44
|
-
// GET /api/git/diff/:threadId - returns git diff for a thread
|
|
45
|
-
router.get("/diff/:threadId", async (c) => {
|
|
46
|
-
return gitDiffHandler(c, metadataManager);
|
|
47
|
-
});
|
|
48
|
-
// POST /api/git/generate-commit-message/:threadId - generates AI commit message
|
|
49
|
-
router.post("/generate-commit-message/:threadId", async (c) => {
|
|
50
|
-
return gitGenerateCommitMessageHandler(c, metadataManager);
|
|
51
|
-
});
|
|
52
|
-
// POST /api/git/commit/:threadId - commits changes
|
|
53
|
-
router.post("/commit/:threadId", async (c) => {
|
|
54
|
-
const db = await getDatabase();
|
|
55
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
56
|
-
return gitCommitHandler(c, metadataManager);
|
|
57
|
-
});
|
|
58
|
-
// POST /api/git/push/:threadId - pushes commits
|
|
59
|
-
router.post("/push/:threadId", async (c) => {
|
|
60
|
-
const db = await getDatabase();
|
|
61
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
62
|
-
return gitPushHandler(c, metadataManager);
|
|
63
|
-
});
|
|
64
|
-
// POST /api/git/pull/:threadId - pulls from origin
|
|
65
|
-
router.post("/pull/:threadId", async (c) => {
|
|
66
|
-
const db = await getDatabase();
|
|
67
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
68
|
-
return gitPullHandler(c, metadataManager);
|
|
69
|
-
});
|
|
70
|
-
// POST /api/git/fetch/:threadId - fetches from origin
|
|
71
|
-
router.post("/fetch/:threadId", async (c) => {
|
|
72
|
-
const db = await getDatabase();
|
|
73
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
74
|
-
return gitFetchHandler(c, metadataManager);
|
|
75
|
-
});
|
|
76
|
-
// POST /api/git/generate-pr-info/:threadId - generates AI PR title and description
|
|
77
|
-
router.post("/generate-pr-info/:threadId", async (c) => {
|
|
78
|
-
return gitGeneratePrInfoHandler(c, metadataManager);
|
|
79
|
-
});
|
|
80
|
-
// GET /api/git/log/:threadId - fetches git commit history
|
|
81
|
-
router.get("/log/:threadId", async (c) => {
|
|
82
|
-
return gitLogHandler(c, metadataManager);
|
|
83
|
-
});
|
|
84
|
-
// POST /api/git/create-pr/:threadId - creates a pull request
|
|
85
|
-
router.post("/create-pr/:threadId", async (c) => {
|
|
86
|
-
return gitCreatePrHandler(c, metadataManager);
|
|
87
|
-
});
|
|
88
|
-
// GET /api/git/github-status/:threadId - checks if repo is on GitHub
|
|
89
|
-
router.get("/github-status/:threadId", async (c) => {
|
|
90
|
-
return gitGithubStatusHandler(c, metadataManager);
|
|
91
|
-
});
|
|
92
|
-
// POST /api/git/create-repo/:threadId - creates a GitHub repository
|
|
93
|
-
router.post("/create-repo/:threadId", async (c) => {
|
|
94
|
-
const db = await getDatabase();
|
|
95
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
96
|
-
return gitCreateRepoHandler(c, metadataManager);
|
|
97
|
-
});
|
|
98
|
-
// GET /api/git/pr-status/:threadId - checks PR status for current branch
|
|
99
|
-
router.get("/pr-status/:threadId", async (c) => {
|
|
100
|
-
return gitPrStatusHandler(c, metadataManager);
|
|
101
|
-
});
|
|
102
|
-
// POST /api/git/create-branch/:threadId - creates a new branch on current thread
|
|
103
|
-
router.post("/create-branch/:threadId", async (c) => {
|
|
104
|
-
const db = await getDatabase();
|
|
105
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
106
|
-
return gitCreateBranchHandler(c, metadataManager);
|
|
107
|
-
});
|
|
108
|
-
// POST /api/git/sync-branch/:threadId - syncs current branch with default branch using rebase
|
|
109
|
-
router.post("/sync-branch/:threadId", async (c) => {
|
|
110
|
-
const db = await getDatabase();
|
|
111
|
-
await invalidateGitStatusCache(db, c.req.param("threadId"));
|
|
112
|
-
return gitSyncBranchHandler(c, metadataManager);
|
|
113
|
-
});
|
|
114
|
-
return router;
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=git.routes.js.map
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { MetadataManager } from "../metadata/metadata.manager.js";
|
|
2
|
-
import { type CatalogProvider } from "../models/models-catalog.js";
|
|
3
|
-
import { type Model, type Api } from "@mariozechner/pi-ai";
|
|
4
|
-
export declare const DEFAULT_MODEL_MAP: Record<string, string>;
|
|
5
|
-
export declare function resolveModelForGit(providerName: string, modelId: string, apiUrl?: string): Model<Api>;
|
|
6
|
-
export declare function resolveProviderAndKey(metadataProviderKeys: Record<string, string>, preferredProvider?: string): Promise<{
|
|
7
|
-
provider: CatalogProvider;
|
|
8
|
-
apiKey: string;
|
|
9
|
-
} | null>;
|
|
10
|
-
export declare function generatePRInfoWithAI(commitLog: string, detailedCommits: string, diff: string, currentBranch: string, baseBranch: string, metadataManager: MetadataManager, model?: string, provider?: string): Promise<{
|
|
11
|
-
title: string;
|
|
12
|
-
description: string;
|
|
13
|
-
}>;
|
|
14
|
-
export declare function generateCommitMessageWithAI(diff: string, metadataManager: MetadataManager, model?: string, provider?: string): Promise<string>;
|
|
15
|
-
/** Resolve thread path: if absolute use as-is (normalized), else resolve against data dir. */
|
|
16
|
-
export declare function resolveThreadPath(repoPath: string): string;
|
|
17
|
-
/** Get git repo root for a path (directory or subdir of repo). Throws if not a git repo. */
|
|
18
|
-
export declare function getGitRoot(cwd: string): Promise<string>;
|
|
19
|
-
/** Get current git branch */
|
|
20
|
-
export declare function getCurrentBranch(gitRoot: string): Promise<string>;
|
|
21
|
-
/** Get git diff for staged and unstaged changes */
|
|
22
|
-
export declare function getGitDiff(gitRoot: string): Promise<string>;
|
|
23
|
-
/** Get diff for untracked files */
|
|
24
|
-
export declare function getUntrackedFilesDiff(gitRoot: string): Promise<string>;
|
|
25
|
-
/** Get git status output */
|
|
26
|
-
export declare function getGitStatus(gitRoot: string): Promise<string>;
|
|
27
|
-
/** Check if there are unpushed commits */
|
|
28
|
-
export declare function hasUnpushedCommits(gitRoot: string, currentBranch: string): Promise<boolean>;
|
|
29
|
-
/** Check if current branch has commits not yet in the default branch (pushed or not) */
|
|
30
|
-
export declare function hasCommitsAheadOfDefault(gitRoot: string, defaultBranch: string): Promise<boolean>;
|
|
31
|
-
/** Get remote origin URL */
|
|
32
|
-
export declare function getRemoteOrigin(gitRoot: string): Promise<string>;
|
|
33
|
-
/** Get the hash of the origin branch head */
|
|
34
|
-
export declare function getOriginBranchHash(gitRoot: string, branch: string): Promise<string | null>;
|
|
35
|
-
/** Get the merge-base hash between origin branch and current branch */
|
|
36
|
-
export declare function getMergeBaseHash(gitRoot: string, originBranch: string, currentBranch: string): Promise<string | null>;
|
|
37
|
-
/** Check if current branch is behind origin branch */
|
|
38
|
-
export declare function isBranchBehind(gitRoot: string, branch: string): Promise<boolean>;
|
|
39
|
-
/** Get detailed git sync status (Behind, Ahead, Diverged, Up to date) */
|
|
40
|
-
export declare function getGitSyncStatus(gitRoot: string, branch: string): Promise<"Behind" | "Ahead" | "Diverged" | "Up to date">;
|
|
41
|
-
/** Check if remote branch exists */
|
|
42
|
-
export declare function hasRemoteBranch(gitRoot: string, branch: string): Promise<boolean>;
|
|
43
|
-
/** Get default branch from origin/HEAD */
|
|
44
|
-
export declare function getDefaultBranch(gitRoot: string): Promise<string | null>;
|
|
45
|
-
/** Find default branch by checking common candidates */
|
|
46
|
-
export declare function findDefaultBranch(gitRoot: string): Promise<string | null>;
|
|
47
|
-
/** Get commit log between branches */
|
|
48
|
-
export declare function getCommitLog(gitRoot: string, baseBranch: string, currentBranch: string): Promise<string>;
|
|
49
|
-
/** Get detailed commit information */
|
|
50
|
-
export declare function getDetailedCommits(gitRoot: string, baseBranch: string, currentBranch: string): Promise<string>;
|
|
51
|
-
/** Get git log with limit */
|
|
52
|
-
export declare function getGitLog(gitRoot: string, limit: number): Promise<Array<{
|
|
53
|
-
hash: string;
|
|
54
|
-
message: string;
|
|
55
|
-
author: string;
|
|
56
|
-
date: string;
|
|
57
|
-
}>>;
|
|
58
|
-
/** Stage all changes */
|
|
59
|
-
export declare function stageAllChanges(gitRoot: string): Promise<void>;
|
|
60
|
-
/** Commit changes */
|
|
61
|
-
export declare function commitChanges(gitRoot: string, message: string): Promise<void>;
|
|
62
|
-
/** Push changes to origin */
|
|
63
|
-
export declare function pushToOrigin(gitRoot: string, currentBranch: string): Promise<void>;
|
|
64
|
-
/** Fetch from origin */
|
|
65
|
-
export declare function fetchFromOrigin(gitRoot: string): Promise<void>;
|
|
66
|
-
/** Pull from origin */
|
|
67
|
-
export declare function pullFromOrigin(gitRoot: string): Promise<void>;
|
|
68
|
-
/** Stash changes */
|
|
69
|
-
export declare function stashChanges(gitRoot: string): Promise<void>;
|
|
70
|
-
/** Pop stashed changes */
|
|
71
|
-
export declare function popStashedChanges(gitRoot: string): Promise<void>;
|
|
72
|
-
/** Create GitHub repository using gh CLI */
|
|
73
|
-
export declare function createGitHubRepo(gitRoot: string, repoName?: string, description?: string, isPrivate?: boolean): Promise<string>;
|
|
74
|
-
/** Create pull request using gh CLI */
|
|
75
|
-
export declare function createPullRequest(gitRoot: string, title?: string, description?: string): Promise<string>;
|
|
76
|
-
/** Check if there's an existing PR for the current branch */
|
|
77
|
-
export declare function getPullRequestStatus(gitRoot: string): Promise<{
|
|
78
|
-
exists: boolean;
|
|
79
|
-
url?: string;
|
|
80
|
-
state?: string;
|
|
81
|
-
}>;
|
|
82
|
-
//# sourceMappingURL=git.utils.d.ts.map
|