From d26364992bf960879cf9e72b1a61584cbc67391e Mon Sep 17 00:00:00 2001 From: Yago Azevedo Borba <140000816+YagoBorba@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:34:42 +0000 Subject: [PATCH 1/2] =?UTF-8?q?refactor(i18n):=20=F0=9F=8C=90=20refactor:?= =?UTF-8?q?=20replace=20hardcoded=20strings=20with=20i18n=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #47 --- .../results.json | 2 +- packages/i18n/src/locales/en.json | 161 ++++- packages/i18n/src/locales/pt.json | 185 +++++- .../out/commands/BaseCommand.js | 120 ++-- .../out/commands/CommitCommand.js | 32 +- .../out/commands/CommitCommand.js.map | 2 +- .../out/commands/ConfigCommand.js | 163 ++--- .../out/commands/ConfigCommand.js.map | 2 +- .../out/commands/GenerateCommand.js | 366 +++++------ .../out/commands/GenerateCommand.js.map | 2 +- .../out/commands/GitCommand.js | 311 ++++----- .../out/commands/GitCommand.js.map | 2 +- .../out/commands/InitCommand.js | 297 ++++----- .../out/commands/InitCommand.js.map | 2 +- .../out/commands/ReleaseCommand.js | 123 ++-- .../out/commands/ReleaseCommand.js.map | 2 +- .../out/commands/ValidateCommand.js | 120 ++-- .../out/commands/ValidateCommand.js.map | 2 +- .../out/config/ConfigurationManager.js | 129 ++-- packages/vscode-extension/out/extension.js | 277 +++----- .../out/monitors/FileMonitor.js | 278 ++++---- .../out/monitors/FileMonitor.js.map | 2 +- .../out/monitors/GitMonitor.js | 364 +++++------ .../ProactiveNotificationManager.js | 425 ++++++------- .../out/providers/DashboardProvider.backup.js | 376 +++++------ .../out/providers/DashboardProvider.js | 376 +++++------ .../out/providers/ProjectViewProvider.js | 600 +++++++++--------- .../out/test/__mocks__/vscode.js | 92 ++- packages/vscode-extension/out/types.js | 2 +- .../src/commands/CommitCommand.ts | 7 +- .../src/commands/ConfigCommand.ts | 29 +- .../src/commands/GenerateCommand.ts | 85 +-- .../src/commands/GitCommand.ts | 59 +- .../src/commands/InitCommand.ts | 59 +- .../src/commands/ReleaseCommand.ts | 19 +- .../src/commands/ValidateCommand.ts | 15 +- .../src/monitors/FileMonitor.ts | 21 +- 37 files changed, 2426 insertions(+), 2683 deletions(-) diff --git a/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json b/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json index 62d44269..74447fa5 100644 --- a/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +++ b/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json @@ -1 +1 @@ -{"version":"3.2.4","results":[[":test/release.test.ts",{"duration":5.687064999999961,"failed":false}],[":test/github.test.ts",{"duration":6.335995999999966,"failed":false}],[":test/validator.test.ts",{"duration":3.6110199999999963,"failed":false}]]} \ No newline at end of file +{"version":"3.2.4","results":[[":test/release.test.ts",{"duration":8.607225000000028,"failed":false}],[":test/github.test.ts",{"duration":5.436721000000034,"failed":false}],[":test/validator.test.ts",{"duration":3.516659000000004,"failed":false}]]} \ No newline at end of file diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index 3204ce50..efa3ac27 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -143,7 +143,9 @@ "info_github_token_instructions": "1. Create a token here: https://github.com/settings/tokens/new\n 2. Give it the 'repo' scope.\n 3. Copy the token (it starts with ghp_...) and paste it below.", "prompt_github_token": "Paste your GitHub PAT here:", "prompt_save_token": "Do you want to save this token securely for future use?", - "success_github_release_created": "✅ GitHub release created successfully!" + "success_github_release_created": "✅ GitHub release created successfully!", + "error_parse_github_url": "Could not parse GitHub owner/repo from remote URL.", + "error_invalid_token": "Your saved GitHub token was invalid and has been cleared." }, "validate": { "command_description": "Validates if a string is a conventional commit message.", @@ -159,5 +161,162 @@ "required": "required", "Show help": "Show help", "Show version number": "Show version number" + }, + "ui": { + "branch_name_required": "Branch name cannot be empty.", + "project_description_default": "A new project generated by StackCode.", + "short_description_required": "A short description is required." + }, + "vscode": { + "common": { + "no_workspace_folder": "No workspace folder found", + "unknown_error": "Unknown error", + "git_extension_error": "Git extension error:", + "failed_setup_git_monitoring": "Failed to setup git monitoring:", + "error_checking_current_branch": "Error checking current branch:", + "error_checking_project_structure": "Error checking project structure:", + "project_missing_files": "📁 Your project is missing some important files: {missingFiles}. Would you like to generate them?", + "generate_files": "Generate Files", + "not_now": "Not Now", + "dont_show_again": "Don't Show Again", + "file_generation_available_soon": "File generation will be available soon!" + }, + "config": { + "open_stackcode_settings": "Open StackCode Settings", + "open_stackcode_settings_description": "Configure StackCode extension settings", + "open_project_config": "Open Project Config", + "open_project_config_description": "Edit .stackcoderc.json file", + "create_project_config": "Create Project Config", + "create_project_config_description": "Create a new .stackcoderc.json file", + "what_would_you_like_configure": "What would you like to configure?", + "stackcoderc_not_found": ".stackcoderc.json file not found. Use \"Create Project Config\" to create one.", + "project_configuration_initialized": "Project configuration initialized!", + "failed_open_configuration": "Failed to open configuration:" + }, + "commit": { + "commit_dialog_opened": "Commit dialog opened in terminal!", + "failed_open_commit_dialog": "Failed to open commit dialog:" + }, + "release": { + "release_process_started": "Release process started! Check terminal for progress.", + "failed_create_release": "Failed to create release:", + "are_you_sure_create_release": "Are you sure you want to create a new release? This will tag the current commit and publish the release.", + "create_release": "Create Release", + "creating_release": "Creating release", + "preparing_release": "Preparing release...", + "creating_release_message": "Creating release...", + "release_created": "Release created!" + }, + "validate": { + "failed_validate_project": "Failed to validate project:", + "validating_project_structure": "Validating project structure", + "running_validation": "Running validation...", + "checking_project_structure": "Checking project structure...", + "validation_completed": "Validation completed!", + "project_validation_completed": "Project validation completed! Check terminal for results." + }, + "init": { + "enter_project_name": "Enter project name", + "enter_project_description": "Enter project description", + "enter_author_name": "Enter author name", + "project_initialized_successfully": "Project initialized successfully!", + "project_created_successfully": "Project {projectName} has been created successfully! Would you like to open it?", + "failed_initialize_project": "Failed to initialize project:", + "my_awesome_project": "my-awesome-project", + "project_name_required": "Project name is required", + "project_name_invalid": "Project name can only contain letters, numbers, hyphens and underscores", + "brief_description": "A brief description of your project", + "your_name": "Your Name", + "select_project_stack": "Select project stack", + "select_project_location": "Select Project Location", + "directory_exists_overwrite": "Directory {projectName} already exists. Do you want to overwrite it?", + "overwrite": "Overwrite", + "initializing_project": "Initializing project {projectName}", + "setting_up_structure": "Setting up project structure...", + "running_stackcode_cli": "Running StackCode CLI...", + "open_project": "Open Project", + "later": "Later", + "stacks": { + "node_ts": "Node.js with TypeScript", + "react": "React application", + "vue": "Vue.js application", + "angular": "Angular application", + "python": "Python project", + "java": "Java project", + "go": "Go project", + "php": "PHP project" + } + }, + "generate": { + "readme_generated_successfully": "README.md generated successfully!", + "readme_has_been_generated": "README.md has been generated successfully!", + "failed_generate_readme": "Failed to generate README.md:", + "gitignore_generated_successfully": ".gitignore generated successfully!", + "gitignore_has_been_generated": ".gitignore has been generated successfully!", + "failed_generate_gitignore": "Failed to generate .gitignore:", + "what_would_you_like_generate": "What would you like to generate?", + "readme_description": "Generate a comprehensive README file", + "gitignore_description": "Generate a .gitignore file based on project type", + "both_description": "Generate both README.md and .gitignore", + "readme_exists_overwrite": "README.md already exists. Do you want to overwrite it?", + "gitignore_exists_overwrite": ".gitignore already exists. Do you want to overwrite it?", + "overwrite": "Overwrite", + "generating_readme": "Generating README.md", + "setting_up_readme": "Setting up README structure...", + "running_generator": "Running generator...", + "readme_created": "README.md created!", + "generating_gitignore": "Generating .gitignore", + "setting_up_gitignore": "Setting up .gitignore structure...", + "gitignore_created": ".gitignore created!", + "both": "Both", + "would_you_like_open_readme": "Would you like to open the generated README.md?", + "would_you_like_open_gitignore": "Would you like to open the generated .gitignore?", + "open_file": "Open File", + "select_project_type_gitignore": "Select project type for .gitignore", + "stacks": { + "flutter": "Flutter project", + "swift": "Swift project", + "android": "Android project" + } + }, + "git": { + "enter_branch_name": "Enter the name for the new branch", + "branch_created_successfully": "Branch created successfully!", + "new_branch_created": "New branch '{branchName}' has been created and checked out!", + "failed_create_branch": "Failed to create branch:", + "branch_finished_successfully": "Branch finished successfully!", + "branch_has_been_finished": "Branch {currentBranch} has been finished and merged!", + "failed_finish_branch": "Failed to finish branch:", + "enter_scope_optional": "Enter scope (optional)", + "enter_commit_description": "Enter commit description", + "select_git_action": "Select Git action", + "start_description": "Start a new feature branch", + "finish_description": "Finish current branch", + "new_feature": "new-feature", + "branch_name_required": "Branch name is required", + "branch_name_invalid": "Branch name can only contain letters, numbers, hyphens, underscores and slashes", + "select_branch_type": "Select branch type", + "feature_description": "A new feature branch", + "hotfix_description": "A hotfix branch", + "bugfix_description": "A bug fix branch", + "chore_description": "A chore/maintenance branch", + "creating_branch": "Creating branch {branchName}", + "switching_to_develop": "Switching to develop...", + "pulling_latest_changes": "Pulling latest changes...", + "creating_new_branch": "Creating new branch...", + "finishing_branch": "Finishing branch {branchName}", + "pushing_branch": "Pushing branch...", + "opening_pr": "Opening pull request...", + "are_you_sure_finish_branch": "Are you sure you want to finish {currentBranch}? This will merge it back to the base branch.", + "finish_branch": "Finish Branch" + }, + "dashboard": { + "received_command_from_webview": "[StackCode] Received command from webview:", + "error_executing_command": "[StackCode] Error executing command", + "command_error": "commandError", + "no_view_available_stats_update": "[StackCode] No view available for stats update", + "workspace_name": "[StackCode] Workspace name:", + "workspace_folders": "[StackCode] Workspace folders:" + } } } diff --git a/packages/i18n/src/locales/pt.json b/packages/i18n/src/locales/pt.json index aca46412..c868776e 100644 --- a/packages/i18n/src/locales/pt.json +++ b/packages/i18n/src/locales/pt.json @@ -113,20 +113,20 @@ } }, "release": { - "command_description": "Ajuda com o versionamento e o lançamento do projeto.", + "command_description": "Auxilia com versionamento e release do projeto.", "start": "🚀 Iniciando processo de release...", "error_structure": "✖ Não foi possível determinar a estrutura do projeto. Você está na raiz de um monorepo com um diretório `packages`?", "detected_strategy": "ℹ️ Estratégia de versionamento detectada: {strategy}", - "prompt_confirm_release": "A versão atual é {currentVersion}. A próxima versão recomendada é {newVersion}. Confirma o release?", - "error_calculating_version": "✖ Erro ao calcular a próxima versão.", - "step_updating_versions": "-> Atualizando a versão em todos os arquivos package.json...", + "prompt_confirm_release": "A versão atual é {currentVersion}. A próxima versão recomendada é {newVersion}. Confirmar release?", + "error_calculating_version": "✖ Erro ao calcular próxima versão.", + "step_updating_versions": "-> Atualizando versão em todos os arquivos package.json...", "step_generating_changelog": "-> Gerando CHANGELOG.md...", "success_ready_to_commit": "✅ Sucesso! Versão atualizada e CHANGELOG.md gerado.", - "next_steps_commit": "Próximos passos: Revise as alterações, depois execute 'git commit' e 'git tag'.", - "independent_mode_start": "🚀 Iniciando análise para o modo independente...", + "next_steps_commit": "Próximos passos: Revise as mudanças, então execute 'git commit' e 'git tag'.", + "independent_mode_start": "🚀 Iniciando análise para modo independente...", "independent_mode_no_changes": "✅ Nenhum pacote alterado detectado. Tudo está atualizado!", "independent_mode_no_bumps": "ℹ️ Mudanças detectadas, mas nenhuma requer uma nova versão (ex: apenas chores ou refactors).", - "independent_prompt_confirm": "Confirma o release dos pacotes listados acima?", + "independent_prompt_confirm": "Confirmar o release dos pacotes listados acima?", "independent_success": "✅ Release independente concluído com sucesso!", "next_steps_push": "Próximos passos: Execute 'git push --follow-tags' para publicar.", "independent_mode_packages_to_update": "Os seguintes pacotes serão atualizados:", @@ -136,14 +136,16 @@ "table_header_new_version": "Nova Versão", "info_releasing_package": "Iniciando release para {pkgName}...", "step_updating_version": "-> Atualizando versão...", - "step_committing_and_tagging": "-> Criando commit e tag...", + "step_committing_and_tagging": "-> Commitando e tagueando...", "step_done": "✔", - "prompt_create_github_release": "Deseja criar um release no GitHub para esta versão?", - "info_github_token_needed": "Para criar um release no GitHub, o StackCode precisa de um Personal Access Token (PAT).", - "info_github_token_instructions": "1. Crie um token aqui: https://github.com/settings/tokens/new\n 2. Dê a ele a permissão (scope) de 'repo'.\n 3. Copie o token (ele começa com ghp_...) e cole-o abaixo.", + "prompt_create_github_release": "Deseja criar um GitHub release para esta versão?", + "info_github_token_needed": "Para criar um GitHub release, o StackCode precisa de um Personal Access Token (PAT).", + "info_github_token_instructions": "1. Crie um token aqui: https://github.com/settings/tokens/new\\n 2. Dê a ele o escopo 'repo'.\\n 3. Copie o token (começa com ghp_...) e cole abaixo.", "prompt_github_token": "Cole seu GitHub PAT aqui:", - "prompt_save_token": "Deseja salvar este token de forma segura para uso futuro?", - "success_github_release_created": "✅ Release criada com sucesso no GitHub!" + "prompt_save_token": "Deseja salvar este token com segurança para uso futuro?", + "success_github_release_created": "✅ GitHub release criado com sucesso!", + "error_parse_github_url": "Não foi possível analisar proprietário/repo GitHub da URL remota.", + "error_invalid_token": "Seu token GitHub salvo era inválido e foi limpo." }, "validate": { "command_description": "Valida se uma string é uma mensagem de commit convencional.", @@ -159,5 +161,162 @@ "required": "obrigatório", "Show help": "Exibir ajuda", "Show version number": "Exibir número da versão" + }, + "ui": { + "branch_name_required": "O nome da branch não pode ser vazio.", + "project_description_default": "Um novo projeto gerado pelo StackCode.", + "short_description_required": "Uma descrição curta é obrigatória." + }, + "vscode": { + "common": { + "no_workspace_folder": "Nenhuma pasta de workspace encontrada", + "unknown_error": "Erro desconhecido", + "git_extension_error": "Erro na extensão Git:", + "failed_setup_git_monitoring": "Falha ao configurar monitoramento do Git:", + "error_checking_current_branch": "Erro ao verificar branch atual:", + "error_checking_project_structure": "Erro ao verificar estrutura do projeto:", + "project_missing_files": "📁 Seu projeto está faltando alguns arquivos importantes: {missingFiles}. Gostaria de gerá-los?", + "generate_files": "Gerar Arquivos", + "not_now": "Agora Não", + "dont_show_again": "Não Mostrar Novamente", + "file_generation_available_soon": "Geração de arquivos estará disponível em breve!" + }, + "config": { + "open_stackcode_settings": "Abrir Configurações do StackCode", + "open_stackcode_settings_description": "Configurar as definições da extensão StackCode", + "open_project_config": "Abrir Configuração do Projeto", + "open_project_config_description": "Editar arquivo .stackcoderc.json", + "create_project_config": "Criar Configuração do Projeto", + "create_project_config_description": "Criar um novo arquivo .stackcoderc.json", + "what_would_you_like_configure": "O que você gostaria de configurar?", + "stackcoderc_not_found": "Arquivo .stackcoderc.json não encontrado. Use \"Criar Configuração do Projeto\" para criar um.", + "project_configuration_initialized": "Configuração do projeto inicializada!", + "failed_open_configuration": "Falha ao abrir configuração:" + }, + "commit": { + "commit_dialog_opened": "Diálogo de commit aberto no terminal!", + "failed_open_commit_dialog": "Falha ao abrir diálogo de commit:" + }, + "release": { + "release_process_started": "Processo de release iniciado! Verifique o terminal para progresso.", + "failed_create_release": "Falha ao criar release:", + "are_you_sure_create_release": "Tem certeza de que deseja criar um novo release? Isso irá marcar o commit atual e publicar o release.", + "create_release": "Criar Release", + "creating_release": "Criando release", + "preparing_release": "Preparando release...", + "creating_release_message": "Criando release...", + "release_created": "Release criado!" + }, + "validate": { + "failed_validate_project": "Falha ao validar projeto:", + "validating_project_structure": "Validando estrutura do projeto", + "running_validation": "Executando validação...", + "checking_project_structure": "Verificando estrutura do projeto...", + "validation_completed": "Validação concluída!", + "project_validation_completed": "Validação do projeto concluída! Verifique o terminal para resultados." + }, + "init": { + "enter_project_name": "Digite o nome do projeto", + "enter_project_description": "Digite a descrição do projeto", + "enter_author_name": "Digite o nome do autor", + "project_initialized_successfully": "Projeto inicializado com sucesso!", + "project_created_successfully": "Projeto {projectName} foi criado com sucesso! Gostaria de abri-lo?", + "failed_initialize_project": "Falha ao inicializar projeto:", + "my_awesome_project": "meu-projeto-incrivel", + "project_name_required": "Nome do projeto é obrigatório", + "project_name_invalid": "Nome do projeto pode conter apenas letras, números, hífens e sublinhados", + "brief_description": "Uma breve descrição do seu projeto", + "your_name": "Seu Nome", + "select_project_stack": "Selecione a stack do projeto", + "select_project_location": "Selecionar Local do Projeto", + "directory_exists_overwrite": "Diretório {projectName} já existe. Deseja sobrescrever?", + "overwrite": "Sobrescrever", + "initializing_project": "Inicializando projeto {projectName}", + "setting_up_structure": "Configurando estrutura do projeto...", + "running_stackcode_cli": "Executando StackCode CLI...", + "open_project": "Abrir Projeto", + "later": "Mais tarde", + "stacks": { + "node_ts": "Node.js com TypeScript", + "react": "Aplicação React", + "vue": "Aplicação Vue.js", + "angular": "Aplicação Angular", + "python": "Projeto Python", + "java": "Projeto Java", + "go": "Projeto Go", + "php": "Projeto PHP" + } + }, + "generate": { + "readme_generated_successfully": "README.md gerado com sucesso!", + "readme_has_been_generated": "README.md foi gerado com sucesso!", + "failed_generate_readme": "Falha ao gerar README.md:", + "gitignore_generated_successfully": ".gitignore gerado com sucesso!", + "gitignore_has_been_generated": ".gitignore foi gerado com sucesso!", + "failed_generate_gitignore": "Falha ao gerar .gitignore:", + "what_would_you_like_generate": "O que você gostaria de gerar?", + "readme_description": "Gerar um arquivo README abrangente", + "gitignore_description": "Gerar um arquivo .gitignore baseado no tipo de projeto", + "both_description": "Gerar tanto README.md quanto .gitignore", + "readme_exists_overwrite": "README.md já existe. Deseja sobrescrever?", + "gitignore_exists_overwrite": ".gitignore já existe. Deseja sobrescrever?", + "overwrite": "Sobrescrever", + "generating_readme": "Gerando README.md", + "setting_up_readme": "Configurando estrutura do README...", + "running_generator": "Executando gerador...", + "readme_created": "README.md criado!", + "generating_gitignore": "Gerando .gitignore", + "setting_up_gitignore": "Configurando estrutura do .gitignore...", + "gitignore_created": ".gitignore criado!", + "both": "Ambos", + "would_you_like_open_readme": "Gostaria de abrir o README.md gerado?", + "would_you_like_open_gitignore": "Gostaria de abrir o .gitignore gerado?", + "open_file": "Abrir Arquivo", + "select_project_type_gitignore": "Selecionar tipo de projeto para .gitignore", + "stacks": { + "flutter": "Projeto Flutter", + "swift": "Projeto Swift", + "android": "Projeto Android" + } + }, + "git": { + "enter_branch_name": "Digite o nome da nova branch", + "branch_created_successfully": "Branch criada com sucesso!", + "new_branch_created": "Nova branch '{branchName}' foi criada e selecionada!", + "failed_create_branch": "Falha ao criar branch:", + "branch_finished_successfully": "Branch finalizada com sucesso!", + "branch_has_been_finished": "Branch {currentBranch} foi finalizada e mesclada!", + "failed_finish_branch": "Falha ao finalizar branch:", + "enter_scope_optional": "Digite o escopo (opcional)", + "enter_commit_description": "Digite a descrição do commit", + "select_git_action": "Selecionar ação do Git", + "start_description": "Iniciar uma nova branch de feature", + "finish_description": "Finalizar branch atual", + "new_feature": "nova-feature", + "branch_name_required": "Nome da branch é obrigatório", + "branch_name_invalid": "Nome da branch pode conter apenas letras, números, hífens, sublinhados e barras", + "select_branch_type": "Selecionar tipo de branch", + "feature_description": "Uma nova branch de feature", + "hotfix_description": "Uma branch de hotfix", + "bugfix_description": "Uma branch de correção de bug", + "chore_description": "Uma branch de manutenção/chore", + "creating_branch": "Criando branch {branchName}", + "switching_to_develop": "Mudando para develop...", + "pulling_latest_changes": "Puxando últimas mudanças...", + "creating_new_branch": "Criando nova branch...", + "finishing_branch": "Finalizando branch {branchName}", + "pushing_branch": "Enviando branch...", + "opening_pr": "Abrindo pull request...", + "are_you_sure_finish_branch": "Tem certeza de que deseja finalizar {currentBranch}? Isso irá mesclá-la de volta para a branch base.", + "finish_branch": "Finalizar Branch" + }, + "dashboard": { + "received_command_from_webview": "[StackCode] Comando recebido do webview:", + "error_executing_command": "[StackCode] Erro ao executar comando", + "command_error": "erroComando", + "no_view_available_stats_update": "[StackCode] Nenhuma visualização disponível para atualização de estatísticas", + "workspace_name": "[StackCode] Nome do workspace:", + "workspace_folders": "[StackCode] Pastas do workspace:" + } } } diff --git a/packages/vscode-extension/out/commands/BaseCommand.js b/packages/vscode-extension/out/commands/BaseCommand.js index 26326af0..6cdfd572 100644 --- a/packages/vscode-extension/out/commands/BaseCommand.js +++ b/packages/vscode-extension/out/commands/BaseCommand.js @@ -1,84 +1,58 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const vscode = __importStar(require("vscode")); class BaseCommand { - async showError(message) { - vscode.window.showErrorMessage(`StackCode: ${message}`); - } - async showWarning(message) { - vscode.window.showWarningMessage(`StackCode: ${message}`); - } - async showInfo(message) { - vscode.window.showInformationMessage(`StackCode: ${message}`); - } - async showSuccess(message) { - vscode.window.showInformationMessage(`✅ ${message}`); - } - getCurrentWorkspaceFolder() { - return vscode.workspace.workspaceFolders?.[0]; - } - async runTerminalCommand(command, cwd) { - const terminal = vscode.window.createTerminal({ - name: "StackCode", - cwd: cwd || this.getCurrentWorkspaceFolder()?.uri.fsPath, - }); - terminal.sendText(command); - terminal.show(); - } - async confirmAction(message, confirmText = "Yes") { - const result = await vscode.window.showWarningMessage( - message, - { modal: true }, - confirmText, - "Cancel", - ); - return result === confirmText; - } + async showError(message) { + vscode.window.showErrorMessage(`StackCode: ${message}`); + } + async showWarning(message) { + vscode.window.showWarningMessage(`StackCode: ${message}`); + } + async showInfo(message) { + vscode.window.showInformationMessage(`StackCode: ${message}`); + } + async showSuccess(message) { + vscode.window.showInformationMessage(`✅ ${message}`); + } + getCurrentWorkspaceFolder() { + return vscode.workspace.workspaceFolders?.[0]; + } + async runTerminalCommand(command, cwd) { + const terminal = vscode.window.createTerminal({ + name: "StackCode", + cwd: cwd || this.getCurrentWorkspaceFolder()?.uri.fsPath, + }); + terminal.sendText(command); + terminal.show(); + } + async confirmAction(message, confirmText = "Yes") { + const result = await vscode.window.showWarningMessage(message, { modal: true }, confirmText, "Cancel"); + return result === confirmText; + } } exports.BaseCommand = BaseCommand; -//# sourceMappingURL=BaseCommand.js.map +//# sourceMappingURL=BaseCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/CommitCommand.js b/packages/vscode-extension/out/commands/CommitCommand.js index 48be7bb3..4e70f836 100644 --- a/packages/vscode-extension/out/commands/CommitCommand.js +++ b/packages/vscode-extension/out/commands/CommitCommand.js @@ -2,22 +2,24 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.CommitCommand = void 0; const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); class CommitCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - // Use StackCode CLI for commit - const command = `npx @stackcode/cli commit`; - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess("Commit dialog opened in terminal!"); - } catch (error) { - this.showError(`Failed to open commit dialog: ${error}`); + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + // Use StackCode CLI for commit + const command = `npx @stackcode/cli commit`; + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + this.showSuccess((0, i18n_1.t)("vscode.commit.commit_dialog_opened")); + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.commit.failed_open_commit_dialog", { error: String(error) })); + } } - } } exports.CommitCommand = CommitCommand; -//# sourceMappingURL=CommitCommand.js.map +//# sourceMappingURL=CommitCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/CommitCommand.js.map b/packages/vscode-extension/out/commands/CommitCommand.js.map index c1707cd4..b8428266 100644 --- a/packages/vscode-extension/out/commands/CommitCommand.js.map +++ b/packages/vscode-extension/out/commands/CommitCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"CommitCommand.js","sourceRoot":"","sources":["../../src/commands/CommitCommand.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAE5C,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;gBAC5C,OAAO;aACR;YAED,+BAA+B;YAC/B,MAAM,OAAO,GAAG,2BAA2B,CAAC;YAE5C,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAEnE,IAAI,CAAC,WAAW,CAAC,mCAAmC,CAAC,CAAC;SACvD;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,iCAAiC,KAAK,EAAE,CAAC,CAAC;SAC1D;IACH,CAAC;CACF;AAnBD,sCAmBC"} \ No newline at end of file +{"version":3,"file":"CommitCommand.js","sourceRoot":"","sources":["../../src/commands/CommitCommand.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,0CAAoC;AAEpC,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,mCAAmC,CAAC,CAAC,CAAC;gBACvD,OAAO;aACR;YAED,+BAA+B;YAC/B,MAAM,OAAO,GAAG,2BAA2B,CAAC;YAE5C,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAEnE,IAAI,CAAC,WAAW,CAAC,IAAA,QAAC,EAAC,oCAAoC,CAAC,CAAC,CAAC;SAC3D;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,yCAAyC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SACxF;IACH,CAAC;CACF;AAnBD,sCAmBC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/ConfigCommand.js b/packages/vscode-extension/out/commands/ConfigCommand.js index e7e74aab..b1728b27 100644 --- a/packages/vscode-extension/out/commands/ConfigCommand.js +++ b/packages/vscode-extension/out/commands/ConfigCommand.js @@ -1,110 +1,83 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); class ConfigCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - const action = await vscode.window.showQuickPick( - [ - { - label: "Open StackCode Settings", - description: "Configure StackCode extension settings", - }, - { - label: "Open Project Config", - description: "Edit .stackcoderc.json file", - }, - { - label: "Create Project Config", - description: "Create a new .stackcoderc.json file", - }, - ], - { - placeHolder: "What would you like to configure?", - }, - ); - if (!action) { - return; - } - if (action.label === "Open StackCode Settings") { - vscode.commands.executeCommand( - "workbench.action.openSettings", - "stackcode", - ); - } else if (action.label === "Open Project Config") { - const configPath = vscode.Uri.joinPath( - workspaceFolder.uri, - ".stackcoderc.json", - ); + async execute() { try { - const document = await vscode.workspace.openTextDocument(configPath); - await vscode.window.showTextDocument(document); - } catch { - this.showError( - '.stackcoderc.json file not found. Use "Create Project Config" to create one.', - ); + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const action = await vscode.window.showQuickPick([ + { + label: (0, i18n_1.t)("vscode.config.open_stackcode_settings"), + description: (0, i18n_1.t)("vscode.config.open_stackcode_settings_description"), + }, + { + label: (0, i18n_1.t)("vscode.config.open_project_config"), + description: (0, i18n_1.t)("vscode.config.open_project_config_description"), + }, + { + label: (0, i18n_1.t)("vscode.config.create_project_config"), + description: (0, i18n_1.t)("vscode.config.create_project_config_description"), + }, + ], { + placeHolder: (0, i18n_1.t)("vscode.config.what_would_you_like_configure"), + }); + if (!action) { + return; + } + if (action.label === (0, i18n_1.t)("vscode.config.open_stackcode_settings")) { + vscode.commands.executeCommand("workbench.action.openSettings", "stackcode"); + } + else if (action.label === (0, i18n_1.t)("vscode.config.open_project_config")) { + const configPath = vscode.Uri.joinPath(workspaceFolder.uri, ".stackcoderc.json"); + try { + const document = await vscode.workspace.openTextDocument(configPath); + await vscode.window.showTextDocument(document); + } + catch { + this.showError((0, i18n_1.t)("vscode.config.stackcoderc_not_found")); + } + } + else if (action.label === (0, i18n_1.t)("vscode.config.create_project_config")) { + // Use StackCode CLI for config creation + const command = `npx @stackcode/cli config init`; + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + this.showSuccess((0, i18n_1.t)("vscode.config.project_configuration_initialized")); + } + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.config.failed_open_configuration", { error: String(error) })); } - } else if (action.label === "Create Project Config") { - // Use StackCode CLI for config creation - const command = `npx @stackcode/cli config init`; - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess("Project configuration initialized!"); - } - } catch (error) { - this.showError(`Failed to open configuration: ${error}`); } - } } exports.ConfigCommand = ConfigCommand; -//# sourceMappingURL=ConfigCommand.js.map +//# sourceMappingURL=ConfigCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/ConfigCommand.js.map b/packages/vscode-extension/out/commands/ConfigCommand.js.map index 9dc1b121..038444ee 100644 --- a/packages/vscode-extension/out/commands/ConfigCommand.js.map +++ b/packages/vscode-extension/out/commands/ConfigCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"ConfigCommand.js","sourceRoot":"","sources":["../../src/commands/ConfigCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;gBAC5C,OAAO;aACR;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAC9C;gBACE;oBACE,KAAK,EAAE,yBAAyB;oBAChC,WAAW,EAAE,wCAAwC;iBACtD;gBACD;oBACE,KAAK,EAAE,qBAAqB;oBAC5B,WAAW,EAAE,6BAA6B;iBAC3C;gBACD;oBACE,KAAK,EAAE,uBAAuB;oBAC9B,WAAW,EAAE,qCAAqC;iBACnD;aACF,EACD;gBACE,WAAW,EAAE,mCAAmC;aACjD,CACF,CAAC;YAEF,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;aACR;YAED,IAAI,MAAM,CAAC,KAAK,KAAK,yBAAyB,EAAE;gBAC9C,MAAM,CAAC,QAAQ,CAAC,cAAc,CAC5B,+BAA+B,EAC/B,WAAW,CACZ,CAAC;aACH;iBAAM,IAAI,MAAM,CAAC,KAAK,KAAK,qBAAqB,EAAE;gBACjD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CACpC,eAAe,CAAC,GAAG,EACnB,mBAAmB,CACpB,CAAC;gBACF,IAAI;oBACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;oBACrE,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;iBAChD;gBAAC,MAAM;oBACN,IAAI,CAAC,SAAS,CACZ,8EAA8E,CAC/E,CAAC;iBACH;aACF;iBAAM,IAAI,MAAM,CAAC,KAAK,KAAK,uBAAuB,EAAE;gBACnD,wCAAwC;gBACxC,MAAM,OAAO,GAAG,gCAAgC,CAAC;gBACjD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACnE,IAAI,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;aACxD;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,iCAAiC,KAAK,EAAE,CAAC,CAAC;SAC1D;IACH,CAAC;CACF;AA7DD,sCA6DC"} \ No newline at end of file +{"version":3,"file":"ConfigCommand.js","sourceRoot":"","sources":["../../src/commands/ConfigCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAC5C,0CAAoC;AAEpC,MAAa,aAAc,SAAQ,yBAAW;IAC5C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,mCAAmC,CAAC,CAAC,CAAC;gBACvD,OAAO;aACR;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,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BACjD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACnE,IAAI,CAAC,WAAW,CAAC,IAAA,QAAC,EAAC,iDAAiD,CAAC,CAAC,CAAC;aACxE;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,yCAAyC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SACxF;IACH,CAAC;CACF;AA7DD,sCA6DC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/GenerateCommand.js b/packages/vscode-extension/out/commands/GenerateCommand.js index 48af3434..63a1424f 100644 --- a/packages/vscode-extension/out/commands/GenerateCommand.js +++ b/packages/vscode-extension/out/commands/GenerateCommand.js @@ -1,220 +1,182 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); const path = __importStar(require("path")); class GenerateCommand extends BaseCommand_1.BaseCommand { - async execute() { - const option = await vscode.window.showQuickPick( - [ - { - label: "README.md", - description: "Generate a comprehensive README file", - }, - { - label: ".gitignore", - description: "Generate a .gitignore file based on project type", - }, - { - label: "Both", - description: "Generate both README.md and .gitignore", - }, - ], - { - placeHolder: "What would you like to generate?", - }, - ); - if (!option) { - return; - } - if (option.label === "README.md") { - await this.generateReadme(); - } else if (option.label === ".gitignore") { - await this.generateGitignore(); - } else if (option.label === "Both") { - await this.generateReadme(); - await this.generateGitignore(); + async execute() { + const option = await vscode.window.showQuickPick([ + { + label: "README.md", + description: (0, i18n_1.t)("vscode.generate.readme_description"), + }, + { + label: ".gitignore", + description: (0, i18n_1.t)("vscode.generate.gitignore_description"), + }, + { + label: (0, i18n_1.t)("vscode.generate.both"), + description: (0, i18n_1.t)("vscode.generate.both_description"), + }, + ], { + placeHolder: (0, i18n_1.t)("vscode.generate.what_would_you_like_generate"), + }); + if (!option) { + return; + } + if (option.label === "README.md") { + await this.generateReadme(); + } + else if (option.label === ".gitignore") { + await this.generateGitignore(); + } + else if (option.label === (0, i18n_1.t)("vscode.generate.both")) { + await this.generateReadme(); + await this.generateGitignore(); + } } - } - async generateReadme() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - const readmePath = path.join(workspaceFolder.uri.fsPath, "README.md"); - // Check if README already exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(readmePath)); - const overwrite = await this.confirmAction( - "README.md already exists. Do you want to overwrite it?", - "Overwrite", - ); - if (!overwrite) { - return; + async generateReadme() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const readmePath = path.join(workspaceFolder.uri.fsPath, "README.md"); + // Check if README already exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(readmePath)); + const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.generate.readme_exists_overwrite"), (0, i18n_1.t)("vscode.generate.overwrite")); + if (!overwrite) { + return; + } + } + catch { + // File doesn't exist, which is fine + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.generate.generating_readme"), + cancellable: false, + }, async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.generate.setting_up_readme"), + }); + // Use StackCode CLI for generation + const command = `npx @stackcode/cli generate readme`; + progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.generate.running_generator") }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.generate.readme_created"), + }); + }); + this.showSuccess((0, i18n_1.t)("vscode.generate.readme_has_been_generated")); + // Ask if user wants to open the file + const openFile = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.generate.would_you_like_open_readme"), (0, i18n_1.t)("vscode.generate.open_file")); + if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { + const document = await vscode.workspace.openTextDocument(readmePath); + await vscode.window.showTextDocument(document); + } + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.generate.failed_generate_readme", { error: String(error) })); } - } catch { - // File doesn't exist, which is fine - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Generating README.md", - cancellable: false, - }, - async (progress) => { - progress.report({ - increment: 0, - message: "Analyzing project structure...", - }); - // Use StackCode CLI for generation - const command = `npx @stackcode/cli generate readme`; - progress.report({ increment: 50, message: "Generating content..." }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: "README.md generated successfully!", - }); - }, - ); - this.showSuccess("README.md has been generated successfully!"); - // Ask if user wants to open the file - const openFile = await vscode.window.showInformationMessage( - "Would you like to open the generated README.md?", - "Open File", - ); - if (openFile === "Open File") { - const document = await vscode.workspace.openTextDocument(readmePath); - await vscode.window.showTextDocument(document); - } - } catch (error) { - this.showError(`Failed to generate README.md: ${error}`); } - } - async generateGitignore() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - const gitignorePath = path.join(workspaceFolder.uri.fsPath, ".gitignore"); - // Check if .gitignore already exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(gitignorePath)); - const overwrite = await this.confirmAction( - ".gitignore already exists. Do you want to overwrite it?", - "Overwrite", - ); - if (!overwrite) { - return; + async generateGitignore() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const gitignorePath = path.join(workspaceFolder.uri.fsPath, ".gitignore"); + // Check if .gitignore already exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(gitignorePath)); + const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.generate.gitignore_exists_overwrite"), (0, i18n_1.t)("vscode.generate.overwrite")); + if (!overwrite) { + return; + } + } + catch { + // File doesn't exist, which is fine + } + // Ask for project type + const projectType = await vscode.window.showQuickPick([ + { label: "node-ts", description: (0, i18n_1.t)("vscode.init.stacks.node_ts") }, + { label: "react", description: (0, i18n_1.t)("vscode.init.stacks.react") }, + { label: "vue", description: (0, i18n_1.t)("vscode.init.stacks.vue") }, + { label: "angular", description: (0, i18n_1.t)("vscode.init.stacks.angular") }, + { label: "python", description: (0, i18n_1.t)("vscode.init.stacks.python") }, + { label: "java", description: (0, i18n_1.t)("vscode.init.stacks.java") }, + { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, + { label: "php", description: (0, i18n_1.t)("vscode.init.stacks.php") }, + { label: "flutter", description: (0, i18n_1.t)("vscode.generate.stacks.flutter") }, + { label: "swift", description: (0, i18n_1.t)("vscode.generate.stacks.swift") }, + { label: "android", description: (0, i18n_1.t)("vscode.generate.stacks.android") }, + ], { + placeHolder: (0, i18n_1.t)("vscode.generate.select_project_type_gitignore"), + }); + if (!projectType) { + return; + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.generate.generating_gitignore"), + cancellable: false, + }, async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.generate.setting_up_gitignore"), + }); + // Use StackCode CLI for generation + const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; + progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.generate.running_generator") }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.generate.gitignore_created"), + }); + }); + this.showSuccess((0, i18n_1.t)("vscode.generate.gitignore_has_been_generated")); + // Ask if user wants to open the file + const openFile = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.generate.would_you_like_open_gitignore"), (0, i18n_1.t)("vscode.generate.open_file")); + if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { + const document = await vscode.workspace.openTextDocument(gitignorePath); + await vscode.window.showTextDocument(document); + } + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.generate.failed_generate_gitignore", { error: String(error) })); } - } catch { - // File doesn't exist, which is fine - } - // Ask for project type - const projectType = await vscode.window.showQuickPick( - [ - { label: "node-ts", description: "Node.js with TypeScript" }, - { label: "react", description: "React application" }, - { label: "vue", description: "Vue.js application" }, - { label: "angular", description: "Angular application" }, - { label: "python", description: "Python project" }, - { label: "java", description: "Java project" }, - { label: "go", description: "Go project" }, - { label: "php", description: "PHP project" }, - { label: "flutter", description: "Flutter project" }, - { label: "swift", description: "Swift project" }, - { label: "android", description: "Android project" }, - ], - { - placeHolder: "Select project type for .gitignore", - }, - ); - if (!projectType) { - return; - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Generating .gitignore", - cancellable: false, - }, - async (progress) => { - progress.report({ - increment: 0, - message: "Generating .gitignore content...", - }); - // Use StackCode CLI for generation - const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; - progress.report({ increment: 50, message: "Creating file..." }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: ".gitignore generated successfully!", - }); - }, - ); - this.showSuccess(".gitignore has been generated successfully!"); - // Ask if user wants to open the file - const openFile = await vscode.window.showInformationMessage( - "Would you like to open the generated .gitignore?", - "Open File", - ); - if (openFile === "Open File") { - const document = await vscode.workspace.openTextDocument(gitignorePath); - await vscode.window.showTextDocument(document); - } - } catch (error) { - this.showError(`Failed to generate .gitignore: ${error}`); } - } } exports.GenerateCommand = GenerateCommand; -//# sourceMappingURL=GenerateCommand.js.map +//# sourceMappingURL=GenerateCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/GenerateCommand.js.map b/packages/vscode-extension/out/commands/GenerateCommand.js.map index 8ed223eb..8379b7bf 100644 --- a/packages/vscode-extension/out/commands/GenerateCommand.js.map +++ b/packages/vscode-extension/out/commands/GenerateCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"GenerateCommand.js","sourceRoot":"","sources":["../../src/commands/GenerateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,2CAA6B;AAE7B,MAAa,eAAgB,SAAQ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AM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBACxE,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;aAChD;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,kCAAkC,KAAK,EAAE,CAAC,CAAC;SAC3D;IACH,CAAC;CACF;AAjMD,0CAiMC"} \ No newline at end of file +{"version":3,"file":"GenerateCommand.js","sourceRoot":"","sources":["../../src/commands/GenerateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,0CAAoC;AACpC,2CAA6B;AAE7B,MAAa,eAAgB,SAAQ,yBAAW;IAC9C,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAC9C;YACE;gBACE,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,IAAA,QAAC,EAAC,oCAAoC,CAAC;aACrD;YACD;gBACE,KAAK,EAAE,YAAY;gBACnB,WAAW,EAAE,IAAA,QAAC,EAAC,uCAAuC,CAAC;aACxD;YACD;gBACE,KAAK,EAAE,IAAA,QAAC,EAAC,sBAAsB,CAAC;gBAChC,WAAW,EAAE,IAAA,QAAC,EAAC,kCAAkC,CAAC;aACnD;SACF,EACD;YACE,WAAW,EAAE,IAAA,QAAC,EAAC,8CAA8C,CAAC;SAC/D,CACF,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,EAAE;YAChC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;SAC7B;aAAM,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,EAAE;YACxC,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAChC;aAAM,IAAI,MAAM,CAAC,KAAK,KAAK,IAAA,QAAC,EAAC,sBA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AC,EAAC,8CAA8C,CAAC,CAAC,CAAC;YAEpE,qCAAqC;YACrC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CACzD,IAAA,QAAC,EAAC,+CAA+C,CAAC,EAClD,IAAA,QAAC,EAAC,2BAA2B,CAAC,CAC/B,CAAC;YAEF,IAAI,QAAQ,KAAK,IAAA,QAAC,EAAC,2BAA2B,CAAC,EAAE;gBAC/C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBACxE,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;aAChD;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,2CAA2C,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1F;IACH,CAAC;CACF;AAjMD,0CAiMC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/GitCommand.js b/packages/vscode-extension/out/commands/GitCommand.js index 235dfc58..f16acd2c 100644 --- a/packages/vscode-extension/out/commands/GitCommand.js +++ b/packages/vscode-extension/out/commands/GitCommand.js @@ -1,189 +1,156 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.GitCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); class GitCommand extends BaseCommand_1.BaseCommand { - async execute() { - const action = await vscode.window.showQuickPick( - [ - { label: "start", description: "Start a new feature branch" }, - { label: "finish", description: "Finish current branch" }, - ], - { - placeHolder: "Select Git action", - }, - ); - if (!action) { - return; - } - if (action.label === "start") { - await this.startBranch(); - } else if (action.label === "finish") { - await this.finishBranch(); + async execute() { + const action = await vscode.window.showQuickPick([ + { label: "start", description: (0, i18n_1.t)("vscode.git.start_description") }, + { label: "finish", description: (0, i18n_1.t)("vscode.git.finish_description") }, + ], { + placeHolder: (0, i18n_1.t)("vscode.git.select_git_action"), + }); + if (!action) { + return; + } + if (action.label === "start") { + await this.startBranch(); + } + else if (action.label === "finish") { + await this.finishBranch(); + } } - } - async startBranch() { - try { - const branchName = await vscode.window.showInputBox({ - prompt: "Enter the name for the new branch", - placeHolder: "new-feature", - validateInput: (value) => { - if (!value) { - return "Branch name is required"; - } - if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { - return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; - } - return null; - }, - }); - if (!branchName) { - return; - } - const branchType = await vscode.window.showQuickPick( - [ - { label: "feature", description: "A new feature branch" }, - { label: "bugfix", description: "A bug fix branch" }, - { label: "hotfix", description: "A hotfix branch" }, - { label: "release", description: "A release branch" }, - ], - { - placeHolder: "Select branch type", - }, - ); - if (!branchType) { - return; - } - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: `Creating ${branchType.label} branch: ${branchName}`, - cancellable: false, - }, - async (progress) => { - progress.report({ increment: 0, message: "Creating branch..." }); - // Use StackCode CLI for git operations - const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; - progress.report({ - increment: 50, - message: "Switching to new branch...", - }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: "Branch created successfully!", - }); - }, - ); - this.showSuccess( - `Branch ${branchType.label}/${branchName} has been created and checked out!`, - ); - } catch (error) { - this.showError(`Failed to create branch: ${error}`); + async startBranch() { + try { + const branchName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.git.enter_branch_name"), + placeHolder: (0, i18n_1.t)("vscode.git.new_feature"), + validateInput: (value) => { + if (!value) { + return (0, i18n_1.t)("vscode.git.branch_name_required"); + } + if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { + return (0, i18n_1.t)("vscode.git.branch_name_invalid"); + } + return null; + }, + }); + if (!branchName) { + return; + } + const branchType = await vscode.window.showQuickPick([ + { label: "feature", description: (0, i18n_1.t)("vscode.git.feature_description") }, + { label: "bugfix", description: (0, i18n_1.t)("vscode.git.bugfix_description") }, + { label: "hotfix", description: (0, i18n_1.t)("vscode.git.hotfix_description") }, + { label: "chore", description: (0, i18n_1.t)("vscode.git.chore_description") }, + ], { + placeHolder: (0, i18n_1.t)("vscode.git.select_branch_type"), + }); + if (!branchType) { + return; + } + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.git.creating_branch", { branchName: `${branchType.label}/${branchName}` }), + cancellable: false, + }, async (progress) => { + progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.git.switching_to_develop") }); + // Use StackCode CLI for git operations + const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.git.creating_new_branch"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.git.branch_created_successfully"), + }); + }); + this.showSuccess((0, i18n_1.t)("vscode.git.new_branch_created", { branchName: `${branchType.label}/${branchName}` })); + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.git.failed_create_branch", { error: String(error) })); + } } - } - async finishBranch() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - // Get current branch name - const gitExtension = vscode.extensions.getExtension("vscode.git"); - let currentBranch = "current branch"; - if (gitExtension && gitExtension.isActive) { + async finishBranch() { try { - const git = gitExtension.exports; - const api = git.getAPI(1); - const repo = api.repositories[0]; - if (repo && repo.state.HEAD) { - currentBranch = repo.state.HEAD.name || "current branch"; - } - } catch { - // Fallback to generic message + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + // Get current branch name + const gitExtension = vscode.extensions.getExtension("vscode.git"); + let currentBranch = "current branch"; + if (gitExtension && gitExtension.isActive) { + try { + const git = gitExtension.exports; + const api = git.getAPI(1); + const repo = api.repositories[0]; + if (repo && repo.state.HEAD) { + currentBranch = repo.state.HEAD.name || "current branch"; + } + } + catch { + // Fallback to generic message + } + } + const confirm = await this.confirmAction((0, i18n_1.t)("vscode.git.are_you_sure_finish_branch", { currentBranch }), (0, i18n_1.t)("vscode.git.finish_branch")); + if (!confirm) { + return; + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.git.finishing_branch", { branchName: currentBranch }), + cancellable: false, + }, async (progress) => { + progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.git.pushing_branch") }); + // Use StackCode CLI for git operations + const command = `npx @stackcode/cli git finish`; + progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.git.opening_pr") }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.git.branch_finished_successfully"), + }); + }); + this.showSuccess((0, i18n_1.t)("vscode.git.branch_has_been_finished", { currentBranch })); + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.git.failed_finish_branch", { error: String(error) })); } - } - const confirm = await this.confirmAction( - `Are you sure you want to finish ${currentBranch}? This will merge it back to the base branch.`, - "Finish Branch", - ); - if (!confirm) { - return; - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: `Finishing branch: ${currentBranch}`, - cancellable: false, - }, - async (progress) => { - progress.report({ increment: 0, message: "Merging branch..." }); - // Use StackCode CLI for git operations - const command = `npx @stackcode/cli git finish`; - progress.report({ increment: 50, message: "Cleaning up..." }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: "Branch finished successfully!", - }); - }, - ); - this.showSuccess(`Branch ${currentBranch} has been finished and merged!`); - } catch (error) { - this.showError(`Failed to finish branch: ${error}`); } - } } exports.GitCommand = GitCommand; -//# sourceMappingURL=GitCommand.js.map +//# sourceMappingURL=GitCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/GitCommand.js.map b/packages/vscode-extension/out/commands/GitCommand.js.map index 18b4912f..105a0616 100644 --- a/packages/vscode-extension/out/commands/GitCommand.js.map +++ b/packages/vscode-extension/out/commands/GitCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"GitCommand.js","sourceRoot":"","sources":["../../src/commands/GitCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAG5C,MAAa,UAAW,SAAQ,yBAAW;IACzC,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAC9C;YACE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE;YAC7D,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE;SAC1D,EACD;YACE,WAAW,EAAE,mBAAmB;SACjC,CACF,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,IAAI,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE;YAC5B,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;SAC1B;aAAM,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;YACpC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;SAC3B;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI;YACF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;gBAClD,MAAM,EAAE,mCAAmC;gBAC3C,WAAW,EAAE,aAAa;gBAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;oBACvB,IAAI,CAAC,KAAK,EAAE;wBACV,OAAO,yBAAyB,CAAC;qBAClC;oBACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;wBACpC,OAAO,iFAAiF,CAAC;qBAC1F;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;aACF,CA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AK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SAChF;IACH,CAAC;CACF;AAjKD,gCAiKC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/InitCommand.js b/packages/vscode-extension/out/commands/InitCommand.js index 1e0020ae..8339fda9 100644 --- a/packages/vscode-extension/out/commands/InitCommand.js +++ b/packages/vscode-extension/out/commands/InitCommand.js @@ -1,180 +1,151 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.InitCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); const path = __importStar(require("path")); class InitCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - // Prompt for project details - const projectName = await vscode.window.showInputBox({ - prompt: "Enter project name", - placeHolder: "my-awesome-project", - validateInput: (value) => { - if (!value) { - return "Project name is required"; - } - if (!/^[a-zA-Z0-9-_]+$/.test(value)) { - return "Project name can only contain letters, numbers, hyphens and underscores"; - } - return null; - }, - }); - if (!projectName) { - return; - } - const description = await vscode.window.showInputBox({ - prompt: "Enter project description", - placeHolder: "A brief description of your project", - }); - const authorName = await vscode.window.showInputBox({ - prompt: "Enter author name", - placeHolder: "Your Name", - value: await this.getGitUserName(), - }); - const stack = await vscode.window.showQuickPick( - [ - { label: "node-ts", description: "Node.js with TypeScript" }, - { label: "react", description: "React application" }, - { label: "vue", description: "Vue.js application" }, - { label: "angular", description: "Angular application" }, - { label: "python", description: "Python project" }, - { label: "java", description: "Java project" }, - { label: "go", description: "Go project" }, - { label: "php", description: "PHP project" }, - ], - { - placeHolder: "Select project stack", - }, - ); - if (!stack) { - return; - } - // Get workspace folder or ask for project location - const workspaceFolder = this.getCurrentWorkspaceFolder(); - let projectPath; - if (workspaceFolder) { - projectPath = path.join(workspaceFolder.uri.fsPath, projectName); - } else { - const folderUris = await vscode.window.showOpenDialog({ - canSelectFolders: true, - canSelectFiles: false, - canSelectMany: false, - openLabel: "Select Project Location", - }); - if (!folderUris || folderUris.length === 0) { - return; + async execute() { + try { + // Prompt for project details + const projectName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_project_name"), + placeHolder: (0, i18n_1.t)("vscode.init.my_awesome_project"), + validateInput: (value) => { + if (!value) { + return (0, i18n_1.t)("vscode.init.project_name_required"); + } + if (!/^[a-zA-Z0-9-_]+$/.test(value)) { + return (0, i18n_1.t)("vscode.init.project_name_invalid"); + } + return null; + }, + }); + if (!projectName) { + return; + } + const description = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_project_description"), + placeHolder: (0, i18n_1.t)("vscode.init.brief_description"), + }); + const authorName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_author_name"), + placeHolder: (0, i18n_1.t)("vscode.init.your_name"), + value: await this.getGitUserName(), + }); + const stack = await vscode.window.showQuickPick([ + { label: "node-ts", description: (0, i18n_1.t)("vscode.init.stacks.node_ts") }, + { label: "react", description: (0, i18n_1.t)("vscode.init.stacks.react") }, + { label: "vue", description: (0, i18n_1.t)("vscode.init.stacks.vue") }, + { label: "angular", description: (0, i18n_1.t)("vscode.init.stacks.angular") }, + { label: "python", description: (0, i18n_1.t)("vscode.init.stacks.python") }, + { label: "java", description: (0, i18n_1.t)("vscode.init.stacks.java") }, + { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, + { label: "php", description: (0, i18n_1.t)("vscode.init.stacks.php") }, + ], { + placeHolder: (0, i18n_1.t)("vscode.init.select_project_stack"), + }); + if (!stack) { + return; + } + // Get workspace folder or ask for project location + const workspaceFolder = this.getCurrentWorkspaceFolder(); + let projectPath; + if (workspaceFolder) { + projectPath = path.join(workspaceFolder.uri.fsPath, projectName); + } + else { + const folderUris = await vscode.window.showOpenDialog({ + canSelectFolders: true, + canSelectFiles: false, + canSelectMany: false, + openLabel: (0, i18n_1.t)("vscode.init.select_project_location"), + }); + if (!folderUris || folderUris.length === 0) { + return; + } + projectPath = path.join(folderUris[0].fsPath, projectName); + } + // Check if directory exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(projectPath)); + const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.init.directory_exists_overwrite", { projectName }), (0, i18n_1.t)("vscode.init.overwrite")); + if (!overwrite) { + return; + } + } + catch { + // Directory doesn't exist, which is fine + } + // Show progress + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.init.initializing_project", { projectName }), + cancellable: false, + }, async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.init.setting_up_structure"), + }); + // Use StackCode CLI for initialization + const command = `npx @stackcode/cli init --name="${projectName}" --description="${description}" --author="${authorName}" --stack="${stack.label}" --path="${projectPath}"`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.init.running_stackcode_cli"), + }); + await this.runTerminalCommand(command); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.init.project_initialized_successfully"), + }); + }); + // Ask if user wants to open the new project + const openProject = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.init.project_created_successfully", { projectName }), (0, i18n_1.t)("vscode.init.open_project"), (0, i18n_1.t)("vscode.init.later")); + if (openProject === (0, i18n_1.t)("vscode.init.open_project")) { + const uri = vscode.Uri.file(projectPath); + await vscode.commands.executeCommand("vscode.openFolder", uri, true); + } } - projectPath = path.join(folderUris[0].fsPath, projectName); - } - // Check if directory exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(projectPath)); - const overwrite = await this.confirmAction( - `Directory ${projectName} already exists. Do you want to overwrite it?`, - "Overwrite", - ); - if (!overwrite) { - return; + catch (error) { + this.showError((0, i18n_1.t)("vscode.init.failed_initialize_project", { error: String(error) })); } - } catch { - // Directory doesn't exist, which is fine - } - // Show progress - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: `Initializing project ${projectName}`, - cancellable: false, - }, - async (progress) => { - progress.report({ - increment: 0, - message: "Setting up project structure...", - }); - // Use StackCode CLI for initialization - const command = `npx @stackcode/cli init --name="${projectName}" --description="${description}" --author="${authorName}" --stack="${stack.label}" --path="${projectPath}"`; - progress.report({ - increment: 50, - message: "Running StackCode CLI...", - }); - await this.runTerminalCommand(command); - progress.report({ - increment: 100, - message: "Project initialized successfully!", - }); - }, - ); - // Ask if user wants to open the new project - const openProject = await vscode.window.showInformationMessage( - `Project ${projectName} has been created successfully! Would you like to open it?`, - "Open Project", - "Later", - ); - if (openProject === "Open Project") { - const uri = vscode.Uri.file(projectPath); - await vscode.commands.executeCommand("vscode.openFolder", uri, true); - } - } catch (error) { - this.showError(`Failed to initialize project: ${error}`); } - } - async getGitUserName() { - try { - // Try to get git user name from workspace - const terminal = vscode.window.createTerminal({ name: "temp" }); - terminal.sendText("git config user.name"); - terminal.dispose(); - return ""; - } catch { - return ""; + async getGitUserName() { + try { + // Try to get git user name from workspace + const terminal = vscode.window.createTerminal({ name: "temp" }); + terminal.sendText("git config user.name"); + terminal.dispose(); + return ""; + } + catch { + return ""; + } } - } } exports.InitCommand = InitCommand; -//# sourceMappingURL=InitCommand.js.map +//# sourceMappingURL=InitCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/InitCommand.js.map b/packages/vscode-extension/out/commands/InitCommand.js.map index 889e1cee..d9f00a79 100644 --- a/packages/vscode-extension/out/commands/InitCommand.js.map +++ b/packages/vscode-extension/out/commands/InitCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"InitCommand.js","sourceRoot":"","sources":["../../src/commands/InitCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,2CAA6B;AAE7B,MAAa,WAAY,SAAQ,yBAAW;IAC1C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,6BAA6B;YAC7B,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;gBACnD,MAAM,EAAE,oBAAoB;gBAC5B,WAAW,EAAE,oBAAoB;gBACjC,aAAa,EAAE,CAAC,KAAa,EAAE,EAAE;oBAC/B,IAAI,CAAC,KAAK,EAAE;wBACV,OAAO,0BAA0B,CAAC;qBACnC;oBACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;wBACnC,OAAO,yEAAy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line at end of file diff --git a/packages/vscode-extension/out/commands/ReleaseCommand.js b/packages/vscode-extension/out/commands/ReleaseCommand.js index c7db3a43..63c3babe 100644 --- a/packages/vscode-extension/out/commands/ReleaseCommand.js +++ b/packages/vscode-extension/out/commands/ReleaseCommand.js @@ -1,87 +1,62 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReleaseCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); class ReleaseCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - const confirm = await this.confirmAction( - "Are you sure you want to create a new release? This will tag the current commit and publish the release.", - "Create Release", - ); - if (!confirm) { - return; - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Creating release", - cancellable: false, - }, - async (progress) => { - progress.report({ increment: 0, message: "Preparing release..." }); - // Use StackCode CLI for release - const command = `npx @stackcode/cli release`; - progress.report({ increment: 50, message: "Creating release..." }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: "Release created!" }); - }, - ); - this.showSuccess("Release process started! Check terminal for progress."); - } catch (error) { - this.showError(`Failed to create release: ${error}`); + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const confirm = await this.confirmAction((0, i18n_1.t)("vscode.release.are_you_sure_create_release"), (0, i18n_1.t)("vscode.release.create_release")); + if (!confirm) { + return; + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.release.creating_release"), + cancellable: false, + }, async (progress) => { + progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.release.preparing_release") }); + // Use StackCode CLI for release + const command = `npx @stackcode/cli release`; + progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.release.creating_release_message") }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ increment: 100, message: (0, i18n_1.t)("vscode.release.release_created") }); + }); + this.showSuccess((0, i18n_1.t)("vscode.release.release_process_started")); + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.release.failed_create_release", { error: String(error) })); + } } - } } exports.ReleaseCommand = ReleaseCommand; -//# sourceMappingURL=ReleaseCommand.js.map +//# sourceMappingURL=ReleaseCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/ReleaseCommand.js.map b/packages/vscode-extension/out/commands/ReleaseCommand.js.map index 26882c51..60877588 100644 --- a/packages/vscode-extension/out/commands/ReleaseCommand.js.map +++ b/packages/vscode-extension/out/commands/ReleaseCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"ReleaseCommand.js","sourceRoot":"","sources":["../../src/commands/ReleaseCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAG5C,MAAa,cAAe,SAAQ,yBAAW;IAC7C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;gBAC5C,OAAO;aACR;YAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CACtC,0GAA0G,EAC1G,gBAAgB,CACjB,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO;aACR;YAED,MAAM,CAAC,MAAM,CAAC,YAAY,CACxB;gBACE,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY;gBAC9C,KAAK,EAAE,kBAAkB;gBACzB,WAAW,EAAE,KAAK;aACnB,EACD,KAAK,EAAE,QAA0B,EAAE,EAAE;gBACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC,CAAC;gBAEnE,gCAAgC;gBAChC,MAAM,OAAO,GAAG,4BAA4B,CAAC;gBAE7C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;gBAEnE,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEnE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACnE,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,WAAW,CAAC,uDAAuD,CAAC,CAAC;SAC3E;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;SACtD;IACH,CAAC;CACF;AA3CD,wCA2CC"} \ No newline at end of file +{"version":3,"file":"ReleaseCommand.js","sourceRoot":"","sources":["../../src/commands/ReleaseCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,0CAAoC;AAEpC,MAAa,cAAe,SAAQ,yBAAW;IAC7C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,mCAAmC,CAAC,CAAC,CAAC;gBACvD,OAAO;aACR;YAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CACtC,IAAA,QAAC,EAAC,4CAA4C,CAAC,EAC/C,IAAA,QAAC,EAAC,+BAA+B,CAAC,CACnC,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO;aACR;YAED,MAAM,CAAC,MAAM,CAAC,YAAY,CACxB;gBACE,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY;gBAC9C,KAAK,EAAE,IAAA,QAAC,EAAC,iCAAiC,CAAC;gBAC3C,WAAW,EAAE,KAAK;aACnB,EACD,KAAK,EAAE,QAA0B,EAAE,EAAE;gBACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;gBAElF,gCAAgC;gBAChC,MAAM,OAAO,GAAG,4BAA4B,CAAC;gBAE7C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,yCAAyC,CAAC,EAAE,CAAC,CAAC;gBAE1F,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEnE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,gCAAgC,CAAC,EAAE,CAAC,CAAC;YACpF,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,WAAW,CAAC,IAAA,QAAC,EAAC,wCAAwC,CAAC,CAAC,CAAC;SAC/D;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,sCAAsC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SACrF;IACH,CAAC;CACF;AA3CD,wCA2CC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/ValidateCommand.js b/packages/vscode-extension/out/commands/ValidateCommand.js index d43f5098..e609680d 100644 --- a/packages/vscode-extension/out/commands/ValidateCommand.js +++ b/packages/vscode-extension/out/commands/ValidateCommand.js @@ -1,85 +1,61 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ValidateCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); +const i18n_1 = require("@stackcode/i18n"); class ValidateCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError("No workspace folder found"); - return; - } - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Validating project structure", - cancellable: false, - }, - async (progress) => { - progress.report({ increment: 0, message: "Running validation..." }); - // Use StackCode CLI for validation - const command = `npx @stackcode/cli validate`; - progress.report({ - increment: 50, - message: "Checking project structure...", - }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: "Validation completed!" }); - }, - ); - this.showSuccess( - "Project validation completed! Check terminal for results.", - ); - } catch (error) { - this.showError(`Failed to validate project: ${error}`); + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.validate.validating_project_structure"), + cancellable: false, + }, async (progress) => { + progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.validate.running_validation") }); + // Use StackCode CLI for validation + const command = `npx @stackcode/cli validate`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.validate.checking_project_structure"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ increment: 100, message: (0, i18n_1.t)("vscode.validate.validation_completed") }); + }); + this.showSuccess((0, i18n_1.t)("vscode.validate.project_validation_completed")); + } + catch (error) { + this.showError((0, i18n_1.t)("vscode.validate.failed_validate_project", { error: String(error) })); + } } - } } exports.ValidateCommand = ValidateCommand; -//# sourceMappingURL=ValidateCommand.js.map +//# sourceMappingURL=ValidateCommand.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/commands/ValidateCommand.js.map b/packages/vscode-extension/out/commands/ValidateCommand.js.map index b6ca6789..ebdbd33f 100644 --- a/packages/vscode-extension/out/commands/ValidateCommand.js.map +++ b/packages/vscode-extension/out/commands/ValidateCommand.js.map @@ -1 +1 @@ -{"version":3,"file":"ValidateCommand.js","sourceRoot":"","sources":["../../src/commands/ValidateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAG5C,MAAa,eAAgB,SAAQ,yBAAW;IAC9C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;gBAC5C,OAAO;aACR;YAED,MAAM,CAAC,MAAM,CAAC,YAAY,CACxB;gBACE,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY;gBAC9C,KAAK,EAAE,8BAA8B;gBACrC,WAAW,EAAE,KAAK;aACnB,EACD,KAAK,EAAE,QAA0B,EAAE,EAAE;gBACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC,CAAC;gBAEpE,mCAAmC;gBACnC,MAAM,OAAO,GAAG,6BAA6B,CAAC;gBAE9C,QAAQ,CAAC,MAAM,CAAC;oBACd,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,+BAA+B;iBACzC,CAAC,CAAC;gBAEH,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEnE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC,CAAC;YACxE,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,WAAW,CACd,2DAA2D,CAC5D,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;SACxD;IACH,CAAC;CACF;AAvCD,0CAuCC"} \ No newline at end of file +{"version":3,"file":"ValidateCommand.js","sourceRoot":"","sources":["../../src/commands/ValidateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CAA4C;AAE5C,0CAAoC;AAEpC,MAAa,eAAgB,SAAQ,yBAAW;IAC9C,KAAK,CAAC,OAAO;QACX,IAAI;YACF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,eAAe,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,mCAAmC,CAAC,CAAC,CAAC;gBACvD,OAAO;aACR;YAED,MAAM,CAAC,MAAM,CAAC,YAAY,CACxB;gBACE,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY;gBAC9C,KAAK,EAAE,IAAA,QAAC,EAAC,8CAA8C,CAAC;gBACxD,WAAW,EAAE,KAAK;aACnB,EACD,KAAK,EAAE,QAA0B,EAAE,EAAE;gBACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,oCAAoC,CAAC,EAAE,CAAC,CAAC;gBAEpF,mCAAmC;gBACnC,MAAM,OAAO,GAAG,6BAA6B,CAAC;gBAE9C,QAAQ,CAAC,MAAM,CAAC;oBACd,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,IAAA,QAAC,EAAC,4CAA4C,CAAC;iBACzD,CAAC,CAAC;gBAEH,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEnE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;YAC1F,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,WAAW,CACd,IAAA,QAAC,EAAC,8CAA8C,CAAC,CAClD,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAA,QAAC,EAAC,yCAAyC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;SACxF;IACH,CAAC;CACF;AAvCD,0CAuCC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/config/ConfigurationManager.js b/packages/vscode-extension/out/config/ConfigurationManager.js index d7144191..51c03700 100644 --- a/packages/vscode-extension/out/config/ConfigurationManager.js +++ b/packages/vscode-extension/out/config/ConfigurationManager.js @@ -1,89 +1,64 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationManager = void 0; const vscode = __importStar(require("vscode")); class ConfigurationManager { - constructor() { - this.configuration = vscode.workspace.getConfiguration("stackcode"); - // Listen for configuration changes - vscode.workspace.onDidChangeConfiguration((event) => { - if (event.affectsConfiguration("stackcode")) { + constructor() { this.configuration = vscode.workspace.getConfiguration("stackcode"); - } - }); - } - get notificationsEnabled() { - return this.configuration.get("notifications.enabled", true); - } - get branchCheckEnabled() { - return this.configuration.get("notifications.branchCheck", true); - } - get commitCheckEnabled() { - return this.configuration.get("notifications.commitCheck", true); - } - get autoGenerateReadme() { - return this.configuration.get("autoGenerate.readme", false); - } - get autoGenerateGitignore() { - return this.configuration.get("autoGenerate.gitignore", true); - } - get defaultBranchType() { - return this.configuration.get("git.defaultBranchType", "feature"); - } - get dashboardAutoOpen() { - return this.configuration.get("dashboard.autoOpen", false); - } - async updateConfiguration(key, value) { - await this.configuration.update( - key, - value, - vscode.ConfigurationTarget.Workspace, - ); - } + // Listen for configuration changes + vscode.workspace.onDidChangeConfiguration((event) => { + if (event.affectsConfiguration("stackcode")) { + this.configuration = vscode.workspace.getConfiguration("stackcode"); + } + }); + } + get notificationsEnabled() { + return this.configuration.get("notifications.enabled", true); + } + get branchCheckEnabled() { + return this.configuration.get("notifications.branchCheck", true); + } + get commitCheckEnabled() { + return this.configuration.get("notifications.commitCheck", true); + } + get autoGenerateReadme() { + return this.configuration.get("autoGenerate.readme", false); + } + get autoGenerateGitignore() { + return this.configuration.get("autoGenerate.gitignore", true); + } + get defaultBranchType() { + return this.configuration.get("git.defaultBranchType", "feature"); + } + get dashboardAutoOpen() { + return this.configuration.get("dashboard.autoOpen", false); + } + async updateConfiguration(key, value) { + await this.configuration.update(key, value, vscode.ConfigurationTarget.Workspace); + } } exports.ConfigurationManager = ConfigurationManager; -//# sourceMappingURL=ConfigurationManager.js.map +//# sourceMappingURL=ConfigurationManager.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/extension.js b/packages/vscode-extension/out/extension.js index 13fc77b4..b6b21ab3 100644 --- a/packages/vscode-extension/out/extension.js +++ b/packages/vscode-extension/out/extension.js @@ -1,48 +1,27 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.deactivate = exports.activate = void 0; const vscode = __importStar(require("vscode")); @@ -74,149 +53,85 @@ let validateCommand; let releaseCommand; let configCommand; function activate(context) { - console.log("[StackCode] Extension is now active!"); - console.log( - "[StackCode] Workspace folders:", - vscode.workspace.workspaceFolders?.length || 0, - ); - console.log("[StackCode] Extension path:", context.extensionPath); - // Initialize configuration manager - configManager = new ConfigurationManager_1.ConfigurationManager(); - // Initialize notification manager - proactiveManager = - new ProactiveNotificationManager_1.ProactiveNotificationManager( - configManager, - ); - // Initialize monitors - gitMonitor = new GitMonitor_1.GitMonitor(proactiveManager, configManager); - fileMonitor = new FileMonitor_1.FileMonitor(proactiveManager, configManager); - // Initialize providers - dashboardProvider = new DashboardProvider_1.DashboardProvider(context); - projectViewProvider = new ProjectViewProvider_1.ProjectViewProvider( - context.workspaceState, - ); - // Initialize commands - initCommand = new InitCommand_1.InitCommand(); - generateCommand = new GenerateCommand_1.GenerateCommand(); - gitCommand = new GitCommand_1.GitCommand(); - commitCommand = new CommitCommand_1.CommitCommand(); - validateCommand = new ValidateCommand_1.ValidateCommand(); - releaseCommand = new ReleaseCommand_1.ReleaseCommand(); - configCommand = new ConfigCommand_1.ConfigCommand(); - // Register webview providers - context.subscriptions.push( - vscode.window.registerWebviewViewProvider( - "stackcode.dashboard", - dashboardProvider, - ), - vscode.window.registerTreeDataProvider( - "stackcode.projectView", - projectViewProvider, - ), - ); - // Register all commands - const commands = [ - // Core functionality commands - vscode.commands.registerCommand("stackcode.init", () => - initCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.generate.readme", () => - generateCommand.generateReadme(), - ), - vscode.commands.registerCommand("stackcode.generate.gitignore", () => - generateCommand.generateGitignore(), - ), - vscode.commands.registerCommand("stackcode.git.start", () => - gitCommand.startBranch(), - ), - vscode.commands.registerCommand("stackcode.git.finish", () => - gitCommand.finishBranch(), - ), - vscode.commands.registerCommand("stackcode.commit", () => - commitCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.validate", () => - validateCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.release", () => - releaseCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.config", () => - configCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.dashboard", () => - dashboardProvider.show(), - ), - // Legacy commands for backward compatibility - vscode.commands.registerCommand("stackcode.createBranch", () => - gitCommand.startBranch(), - ), - vscode.commands.registerCommand("stackcode.formatCommitMessage", () => - commitCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.checkBestPractices", () => - validateCommand.execute(), - ), - // Project view commands - vscode.commands.registerCommand("stackcode.projectView.refresh", () => - projectViewProvider.refresh(), - ), - // Webview commands - vscode.commands.registerCommand("webviewReady", () => { - console.log("[StackCode] Webview is ready!"); - // Pode enviar dados iniciais aqui se necessário - }), - vscode.commands.registerCommand("stackcode.webview.init", () => - initCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.webview.generate.readme", () => - generateCommand.generateReadme(), - ), - vscode.commands.registerCommand( - "stackcode.webview.generate.gitignore", - () => generateCommand.generateGitignore(), - ), - vscode.commands.registerCommand("stackcode.webview.git.start", () => - gitCommand.startBranch(), - ), - vscode.commands.registerCommand("stackcode.webview.commit", () => - commitCommand.execute(), - ), - vscode.commands.registerCommand("stackcode.webview.validate", () => - validateCommand.execute(), - ), - ]; - // Add all to context subscriptions for cleanup - context.subscriptions.push( - ...commands, - gitMonitor, - fileMonitor, - proactiveManager, - dashboardProvider, - ); - // Start monitoring - gitMonitor.startMonitoring(); - fileMonitor.startMonitoring(); - // Auto-open dashboard if configured - if (configManager.dashboardAutoOpen) { - setTimeout(() => { - dashboardProvider.show(); - }, 1000); - } - // Show welcome message - proactiveManager.showWelcomeMessage(); + console.log("[StackCode] Extension is now active!"); + console.log("[StackCode] Workspace folders:", vscode.workspace.workspaceFolders?.length || 0); + console.log("[StackCode] Extension path:", context.extensionPath); + // Initialize configuration manager + configManager = new ConfigurationManager_1.ConfigurationManager(); + // Initialize notification manager + proactiveManager = new ProactiveNotificationManager_1.ProactiveNotificationManager(configManager); + // Initialize monitors + gitMonitor = new GitMonitor_1.GitMonitor(proactiveManager, configManager); + fileMonitor = new FileMonitor_1.FileMonitor(proactiveManager, configManager); + // Initialize providers + dashboardProvider = new DashboardProvider_1.DashboardProvider(context); + projectViewProvider = new ProjectViewProvider_1.ProjectViewProvider(context.workspaceState); + // Initialize commands + initCommand = new InitCommand_1.InitCommand(); + generateCommand = new GenerateCommand_1.GenerateCommand(); + gitCommand = new GitCommand_1.GitCommand(); + commitCommand = new CommitCommand_1.CommitCommand(); + validateCommand = new ValidateCommand_1.ValidateCommand(); + releaseCommand = new ReleaseCommand_1.ReleaseCommand(); + configCommand = new ConfigCommand_1.ConfigCommand(); + // Register webview providers + context.subscriptions.push(vscode.window.registerWebviewViewProvider("stackcode.dashboard", dashboardProvider), vscode.window.registerTreeDataProvider("stackcode.projectView", projectViewProvider)); + // Register all commands + const commands = [ + // Core functionality commands + vscode.commands.registerCommand("stackcode.init", () => initCommand.execute()), + vscode.commands.registerCommand("stackcode.generate.readme", () => generateCommand.generateReadme()), + vscode.commands.registerCommand("stackcode.generate.gitignore", () => generateCommand.generateGitignore()), + vscode.commands.registerCommand("stackcode.git.start", () => gitCommand.startBranch()), + vscode.commands.registerCommand("stackcode.git.finish", () => gitCommand.finishBranch()), + vscode.commands.registerCommand("stackcode.commit", () => commitCommand.execute()), + vscode.commands.registerCommand("stackcode.validate", () => validateCommand.execute()), + vscode.commands.registerCommand("stackcode.release", () => releaseCommand.execute()), + vscode.commands.registerCommand("stackcode.config", () => configCommand.execute()), + vscode.commands.registerCommand("stackcode.dashboard", () => dashboardProvider.show()), + // Legacy commands for backward compatibility + vscode.commands.registerCommand("stackcode.createBranch", () => gitCommand.startBranch()), + vscode.commands.registerCommand("stackcode.formatCommitMessage", () => commitCommand.execute()), + vscode.commands.registerCommand("stackcode.checkBestPractices", () => validateCommand.execute()), + // Project view commands + vscode.commands.registerCommand("stackcode.projectView.refresh", () => projectViewProvider.refresh()), + // Webview commands + vscode.commands.registerCommand("webviewReady", () => { + console.log("[StackCode] Webview is ready!"); + // Pode enviar dados iniciais aqui se necessário + }), + vscode.commands.registerCommand("stackcode.webview.init", () => initCommand.execute()), + vscode.commands.registerCommand("stackcode.webview.generate.readme", () => generateCommand.generateReadme()), + vscode.commands.registerCommand("stackcode.webview.generate.gitignore", () => generateCommand.generateGitignore()), + vscode.commands.registerCommand("stackcode.webview.git.start", () => gitCommand.startBranch()), + vscode.commands.registerCommand("stackcode.webview.commit", () => commitCommand.execute()), + vscode.commands.registerCommand("stackcode.webview.validate", () => validateCommand.execute()), + ]; + // Add all to context subscriptions for cleanup + context.subscriptions.push(...commands, gitMonitor, fileMonitor, proactiveManager, dashboardProvider); + // Start monitoring + gitMonitor.startMonitoring(); + fileMonitor.startMonitoring(); + // Auto-open dashboard if configured + if (configManager.dashboardAutoOpen) { + setTimeout(() => { + dashboardProvider.show(); + }, 1000); + } + // Show welcome message + proactiveManager.showWelcomeMessage(); } exports.activate = activate; function deactivate() { - if (gitMonitor) { - gitMonitor.dispose(); - } - if (fileMonitor) { - fileMonitor.dispose(); - } - if (proactiveManager) { - proactiveManager.dispose(); - } + if (gitMonitor) { + gitMonitor.dispose(); + } + if (fileMonitor) { + fileMonitor.dispose(); + } + if (proactiveManager) { + proactiveManager.dispose(); + } } exports.deactivate = deactivate; -//# sourceMappingURL=extension.js.map +//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/monitors/FileMonitor.js b/packages/vscode-extension/out/monitors/FileMonitor.js index 755dc0ba..e99ffed3 100644 --- a/packages/vscode-extension/out/monitors/FileMonitor.js +++ b/packages/vscode-extension/out/monitors/FileMonitor.js @@ -1,176 +1,138 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileMonitor = void 0; const vscode = __importStar(require("vscode")); +const i18n_1 = require("@stackcode/i18n"); class FileMonitor { - constructor(proactiveManager, configManager) { - this.disposables = []; - this.processedFiles = new Set(); - this.proactiveManager = proactiveManager; - this.configManager = configManager; - } - startMonitoring() { - // Monitor file creation - this.disposables.push( - vscode.workspace.onDidCreateFiles((event) => { - for (const file of event.files) { - this.handleFileCreation(file); - } - }), - ); - // Monitor file changes - this.disposables.push( - vscode.workspace.onDidChangeTextDocument((event) => { - this.handleFileChange(event); - }), - ); - // Monitor when files are opened - this.disposables.push( - vscode.window.onDidChangeActiveTextEditor((editor) => { - if (editor) { - this.handleFileOpen(editor.document.uri); - } - }), - ); - } - async handleFileCreation(fileUri) { - if (!this.configManager.notificationsEnabled) { - return; - } - const fileName = fileUri.path.split("/").pop() || ""; - const fileKey = `${fileUri.toString()}-created`; - if (this.processedFiles.has(fileKey)) { - return; + constructor(proactiveManager, configManager) { + this.disposables = []; + this.processedFiles = new Set(); + this.proactiveManager = proactiveManager; + this.configManager = configManager; } - this.processedFiles.add(fileKey); - // Suggest generating comprehensive files - if (["README.md", ".gitignore"].includes(fileName)) { - await this.proactiveManager.showFileCreationSuggestion(fileName); + startMonitoring() { + // Monitor file creation + this.disposables.push(vscode.workspace.onDidCreateFiles((event) => { + for (const file of event.files) { + this.handleFileCreation(file); + } + })); + // Monitor file changes + this.disposables.push(vscode.workspace.onDidChangeTextDocument((event) => { + this.handleFileChange(event); + })); + // Monitor when files are opened + this.disposables.push(vscode.window.onDidChangeActiveTextEditor((editor) => { + if (editor) { + this.handleFileOpen(editor.document.uri); + } + })); } - } - async handleFileChange(event) { - const document = event.document; - // Skip if not a git commit message - if (!document.fileName.includes("COMMIT_EDITMSG")) { - return; - } - const content = document.getText(); - if (content.trim()) { - await this.proactiveManager.showCommitMessageWarning(content); - } - } - async handleFileOpen(fileUri) { - const fileName = fileUri.path.split("/").pop() || ""; - const fileKey = `${fileUri.toString()}-opened`; - if (this.processedFiles.has(fileKey)) { - return; - } - this.processedFiles.add(fileKey); - // Check for missing important files when opening project files - if ( - fileName.endsWith(".js") || - fileName.endsWith(".ts") || - fileName.endsWith(".json") - ) { - await this.checkProjectStructure(); + async handleFileCreation(fileUri) { + if (!this.configManager.notificationsEnabled) { + return; + } + const fileName = fileUri.path.split("/").pop() || ""; + const fileKey = `${fileUri.toString()}-created`; + if (this.processedFiles.has(fileKey)) { + return; + } + this.processedFiles.add(fileKey); + // Suggest generating comprehensive files + if (["README.md", ".gitignore"].includes(fileName)) { + await this.proactiveManager.showFileCreationSuggestion(fileName); + } } - } - async checkProjectStructure() { - if (!this.configManager.notificationsEnabled) { - return; + async handleFileChange(event) { + const document = event.document; + // Skip if not a git commit message + if (!document.fileName.includes("COMMIT_EDITMSG")) { + return; + } + const content = document.getText(); + if (content.trim()) { + await this.proactiveManager.showCommitMessageWarning(content); + } } - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (!workspaceFolder) { - return; + async handleFileOpen(fileUri) { + const fileName = fileUri.path.split("/").pop() || ""; + const fileKey = `${fileUri.toString()}-opened`; + if (this.processedFiles.has(fileKey)) { + return; + } + this.processedFiles.add(fileKey); + // Check for missing important files when opening project files + if (fileName.endsWith(".js") || + fileName.endsWith(".ts") || + fileName.endsWith(".json")) { + await this.checkProjectStructure(); + } } - try { - const files = await vscode.workspace.fs.readDirectory( - workspaceFolder.uri, - ); - const fileNames = files.map(([name]) => name); - const missingFiles = []; - if (!fileNames.includes("README.md")) { - missingFiles.push("README.md"); - } - if (!fileNames.includes(".gitignore")) { - missingFiles.push(".gitignore"); - } - if (missingFiles.length > 0 && Math.random() < 0.3) { - // Show suggestion 30% of the time - const message = `📁 Your project is missing some important files: ${missingFiles.join(", ")}. Would you like to generate them?`; - const action = await vscode.window.showInformationMessage( - message, - "Generate Files", - "Not Now", - "Don't Show Again", - ); - if (action === "Generate Files") { - // TODO: Implement file generation - vscode.window.showInformationMessage( - "File generation will be available soon!", - ); - } else if (action === "Don't Show Again") { - await this.configManager.updateConfiguration( - "notifications.enabled", - false, - ); + async checkProjectStructure() { + if (!this.configManager.notificationsEnabled) { + return; } - } - } catch (error) { - // Use proper VS Code logging instead of console.log - const outputChannel = vscode.window.createOutputChannel("StackCode"); - outputChannel.appendLine(`Error checking project structure: ${error}`); + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (!workspaceFolder) { + return; + } + try { + const files = await vscode.workspace.fs.readDirectory(workspaceFolder.uri); + const fileNames = files.map(([name]) => name); + const missingFiles = []; + if (!fileNames.includes("README.md")) { + missingFiles.push("README.md"); + } + if (!fileNames.includes(".gitignore")) { + missingFiles.push(".gitignore"); + } + if (missingFiles.length > 0 && Math.random() < 0.3) { + // Show suggestion 30% of the time + const message = (0, i18n_1.t)("vscode.common.project_missing_files", { missingFiles: missingFiles.join(", ") }); + const action = await vscode.window.showInformationMessage(message, (0, i18n_1.t)("vscode.common.generate_files"), (0, i18n_1.t)("vscode.common.not_now"), (0, i18n_1.t)("vscode.common.dont_show_again")); + if (action === (0, i18n_1.t)("vscode.common.generate_files")) { + // TODO: Implement file generation + vscode.window.showInformationMessage((0, i18n_1.t)("vscode.common.file_generation_available_soon")); + } + else if (action === (0, i18n_1.t)("vscode.common.dont_show_again")) { + await this.configManager.updateConfiguration("notifications.enabled", false); + } + } + } + catch (error) { + // Use proper VS Code logging instead of console.log + const outputChannel = vscode.window.createOutputChannel("StackCode"); + outputChannel.appendLine((0, i18n_1.t)("vscode.common.error_checking_project_structure", { error: String(error) })); + } + } + dispose() { + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + this.processedFiles.clear(); } - } - dispose() { - this.disposables.forEach((d) => d.dispose()); - this.disposables = []; - this.processedFiles.clear(); - } } exports.FileMonitor = FileMonitor; -//# sourceMappingURL=FileMonitor.js.map +//# sourceMappingURL=FileMonitor.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/monitors/FileMonitor.js.map b/packages/vscode-extension/out/monitors/FileMonitor.js.map index acfb96c2..69bcb2f4 100644 --- a/packages/vscode-extension/out/monitors/FileMonitor.js.map +++ b/packages/vscode-extension/out/monitors/FileMonitor.js.map @@ -1 +1 @@ -{"version":3,"file":"FileMonitor.js","sourceRoot":"","sources":["../../src/monitors/FileMonitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAIjC,MAAa,WAAW;IAMtB,YACE,gBAA8C,EAC9C,aAAmC;QAL7B,gBAAW,GAAwB,EAAE,CAAC;QACtC,mBAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;QAM9C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,eAAe;QACb,wBAAwB;QACxB,IAAI,CAAC,WAAW,C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AAC,CAAC;YACrE,aAAa,CAAC,UAAU,CAAC,qCAAqC,KAAK,EAAE,CAAC,CAAC;SACxE;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF;AAlKD,kCAkKC"} \ No newline at end of file +{"version":3,"file":"FileMonitor.js","sourceRoot":"","sources":["../../src/monitors/FileMonitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAGjC,0CAAoC;AAEpC,MAAa,WAAW;IAMtB,YACE,gBAA8C,EAC9C,aAAmC;QAL7B,gBAAW,GAAwB,EAAE,CAAC;QACtC,mBAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;QAM9C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,eAAe;QACb,wBAAwB;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CACnB,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,KAA6B,EAAE,EAAE;YAClE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;gBAC9B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CACH,CAAC;QAEF,uBAAuB;QACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CACnB,MAAM,CAAC,SAAS,CAAC,uBAAuB,CACtC,CAAC,KAAqC,EAAE,EAAE;YACxC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CACF,CACF,CAAC;QAEF,gCAAgC;QAChC,IAAI,CAAC,WAAW,CAAC,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C;QAChE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF;AAlKD,kCAkKC"} \ No newline at end of file diff --git a/packages/vscode-extension/out/monitors/GitMonitor.js b/packages/vscode-extension/out/monitors/GitMonitor.js index 4cd5cbbe..078f0430 100644 --- a/packages/vscode-extension/out/monitors/GitMonitor.js +++ b/packages/vscode-extension/out/monitors/GitMonitor.js @@ -1,224 +1,190 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.GitMonitor = void 0; const vscode = __importStar(require("vscode")); class GitMonitor { - constructor(proactiveManager, configManager) { - this.disposables = []; - this.proactiveManager = proactiveManager; - this.configManager = configManager; - } - startMonitoring() { - // Monitor git extension state changes - const gitExtension = vscode.extensions.getExtension("vscode.git"); - if (gitExtension) { - if (gitExtension.isActive) { - this.setupGitMonitoring(); - } else { - gitExtension.activate().then(() => { - this.setupGitMonitoring(); - }); - } + constructor(proactiveManager, configManager) { + this.disposables = []; + this.proactiveManager = proactiveManager; + this.configManager = configManager; } - // Monitor workspace folder changes - this.disposables.push( - vscode.workspace.onDidChangeWorkspaceFolders(() => { - this.checkCurrentBranch(); - }), - ); - // Initial check - setTimeout(() => { - this.checkCurrentBranch(); - }, 2000); - } - setupGitMonitoring() { - try { - const git = vscode.extensions.getExtension("vscode.git")?.exports; - if (git) { - const gitAPI = git.getAPI(1); - this.disposables.push( - gitAPI.onDidChangeState(() => { + startMonitoring() { + // Monitor git extension state changes + const gitExtension = vscode.extensions.getExtension("vscode.git"); + if (gitExtension) { + if (gitExtension.isActive) { + this.setupGitMonitoring(); + } + else { + gitExtension.activate().then(() => { + this.setupGitMonitoring(); + }); + } + } + // Monitor workspace folder changes + this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(() => { this.checkCurrentBranch(); - }), - ); - this.disposables.push( - gitAPI.onDidOpenRepository(() => { + })); + // Initial check + setTimeout(() => { this.checkCurrentBranch(); - }), - ); - } - } catch (error) { - console.log("Failed to setup git monitoring:", error); + }, 2000); } - } - async checkCurrentBranch() { - try { - const git = vscode.extensions.getExtension("vscode.git")?.exports; - if (git) { - const gitAPI = git.getAPI(1); - const repo = gitAPI.repositories[0]; - if (repo && repo.state.HEAD) { - const currentBranch = repo.state.HEAD.name; - if (currentBranch && currentBranch !== this.lastBranch) { - this.lastBranch = currentBranch; - await this.proactiveManager.showBranchWarning(currentBranch); - } - } - } - } catch (error) { - console.log("Error checking current branch:", error); - } - } - async showCreateBranchDialog() { - const branchName = await vscode.window.showInputBox({ - prompt: "Enter the name for the new branch", - placeHolder: "feature/new-feature", - validateInput: (value) => { - if (!value) { - return "Branch name is required"; + setupGitMonitoring() { + try { + const git = vscode.extensions.getExtension("vscode.git")?.exports; + if (git) { + const gitAPI = git.getAPI(1); + this.disposables.push(gitAPI.onDidChangeState(() => { + this.checkCurrentBranch(); + })); + this.disposables.push(gitAPI.onDidOpenRepository(() => { + this.checkCurrentBranch(); + })); + } } - if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { - return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; + catch (error) { + console.log("Failed to setup git monitoring:", error); } - return null; - }, - }); - if (branchName) { - const branchType = await vscode.window.showQuickPick( - [ - { label: "feature", description: "A new feature branch" }, - { label: "bugfix", description: "A bug fix branch" }, - { label: "hotfix", description: "A hotfix branch" }, - { label: "release", description: "A release branch" }, - ], - { - placeHolder: "Select branch type", - }, - ); - if (branchType) { - const fullBranchName = branchName.includes("/") - ? branchName - : `${branchType.label}/${branchName}`; + } + async checkCurrentBranch() { try { - const terminal = vscode.window.createTerminal("StackCode Git"); - terminal.sendText(`git checkout -b ${fullBranchName}`); - terminal.show(); - vscode.window.showInformationMessage( - `✅ Created and switched to branch: ${fullBranchName}`, - ); - } catch (error) { - vscode.window.showErrorMessage(`Failed to create branch: ${error}`); + const git = vscode.extensions.getExtension("vscode.git")?.exports; + if (git) { + const gitAPI = git.getAPI(1); + const repo = gitAPI.repositories[0]; + if (repo && repo.state.HEAD) { + const currentBranch = repo.state.HEAD.name; + if (currentBranch && currentBranch !== this.lastBranch) { + this.lastBranch = currentBranch; + await this.proactiveManager.showBranchWarning(currentBranch); + } + } + } + } + catch (error) { + console.log("Error checking current branch:", error); } - } } - } - async showCommitMessageDialog() { - const commitType = await vscode.window.showQuickPick( - [ - { label: "feat", description: "A new feature" }, - { label: "fix", description: "A bug fix" }, - { label: "docs", description: "Documentation changes" }, - { label: "style", description: "Code style changes (formatting, etc)" }, - { label: "refactor", description: "Code refactoring" }, - { label: "perf", description: "Performance improvements" }, - { label: "test", description: "Adding or updating tests" }, - { label: "chore", description: "Maintenance tasks" }, - { label: "build", description: "Build system changes" }, - { label: "ci", description: "CI/CD changes" }, - ], - { - placeHolder: "Select commit type", - }, - ); - if (!commitType) { - return; + async showCreateBranchDialog() { + const branchName = await vscode.window.showInputBox({ + prompt: "Enter the name for the new branch", + placeHolder: "feature/new-feature", + validateInput: (value) => { + if (!value) { + return "Branch name is required"; + } + if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { + return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; + } + return null; + }, + }); + if (branchName) { + const branchType = await vscode.window.showQuickPick([ + { label: "feature", description: "A new feature branch" }, + { label: "bugfix", description: "A bug fix branch" }, + { label: "hotfix", description: "A hotfix branch" }, + { label: "release", description: "A release branch" }, + ], { + placeHolder: "Select branch type", + }); + if (branchType) { + const fullBranchName = branchName.includes("/") + ? branchName + : `${branchType.label}/${branchName}`; + try { + const terminal = vscode.window.createTerminal("StackCode Git"); + terminal.sendText(`git checkout -b ${fullBranchName}`); + terminal.show(); + vscode.window.showInformationMessage(`✅ Created and switched to branch: ${fullBranchName}`); + } + catch (error) { + vscode.window.showErrorMessage(`Failed to create branch: ${error}`); + } + } + } } - const scope = await vscode.window.showInputBox({ - prompt: "Enter scope (optional)", - placeHolder: "auth, api, ui, etc.", - }); - const description = await vscode.window.showInputBox({ - prompt: "Enter commit description", - placeHolder: "add user authentication", - validateInput: (value) => { - if (!value) { - return "Description is required"; + async showCommitMessageDialog() { + const commitType = await vscode.window.showQuickPick([ + { label: "feat", description: "A new feature" }, + { label: "fix", description: "A bug fix" }, + { label: "docs", description: "Documentation changes" }, + { label: "style", description: "Code style changes (formatting, etc)" }, + { label: "refactor", description: "Code refactoring" }, + { label: "perf", description: "Performance improvements" }, + { label: "test", description: "Adding or updating tests" }, + { label: "chore", description: "Maintenance tasks" }, + { label: "build", description: "Build system changes" }, + { label: "ci", description: "CI/CD changes" }, + ], { + placeHolder: "Select commit type", + }); + if (!commitType) { + return; + } + const scope = await vscode.window.showInputBox({ + prompt: "Enter scope (optional)", + placeHolder: "auth, api, ui, etc.", + }); + const description = await vscode.window.showInputBox({ + prompt: "Enter commit description", + placeHolder: "add user authentication", + validateInput: (value) => { + if (!value) { + return "Description is required"; + } + if (value.length > 50) { + return "Description should be 50 characters or less"; + } + return null; + }, + }); + if (!description) { + return; } - if (value.length > 50) { - return "Description should be 50 characters or less"; + let commitMessage = commitType.label; + if (scope) { + commitMessage += `(${scope})`; } - return null; - }, - }); - if (!description) { - return; + commitMessage += `: ${description}`; + // Copy to clipboard + await vscode.env.clipboard.writeText(commitMessage); + vscode.window + .showInformationMessage(`📋 Commit message copied to clipboard: ${commitMessage}`, "Open Git Panel") + .then((action) => { + if (action === "Open Git Panel") { + vscode.commands.executeCommand("workbench.view.scm"); + } + }); } - let commitMessage = commitType.label; - if (scope) { - commitMessage += `(${scope})`; + dispose() { + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; } - commitMessage += `: ${description}`; - // Copy to clipboard - await vscode.env.clipboard.writeText(commitMessage); - vscode.window - .showInformationMessage( - `📋 Commit message copied to clipboard: ${commitMessage}`, - "Open Git Panel", - ) - .then((action) => { - if (action === "Open Git Panel") { - vscode.commands.executeCommand("workbench.view.scm"); - } - }); - } - dispose() { - this.disposables.forEach((d) => d.dispose()); - this.disposables = []; - } } exports.GitMonitor = GitMonitor; -//# sourceMappingURL=GitMonitor.js.map +//# sourceMappingURL=GitMonitor.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js b/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js index 4a6d94f3..ee37fa34 100644 --- a/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js +++ b/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js @@ -1,268 +1,207 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProactiveNotificationManager = void 0; const vscode = __importStar(require("vscode")); class ProactiveNotificationManager { - constructor(configManager) { - this.notificationQueue = []; - this.configManager = configManager; - } - async showWelcomeMessage() { - if (!this.configManager.notificationsEnabled) { - return; + constructor(configManager) { + this.notificationQueue = []; + this.configManager = configManager; } - const action = await vscode.window.showInformationMessage( - "🚀 StackCode is now active! Get proactive suggestions to improve your development workflow.", - "Learn More", - "Settings", - ); - if (action === "Learn More") { - vscode.env.openExternal( - vscode.Uri.parse("https://github.com/YagoBorba/StackCode"), - ); - } else if (action === "Settings") { - vscode.commands.executeCommand( - "workbench.action.openSettings", - "stackcode", - ); - } - } - async showBranchWarning(currentBranch) { - if (!this.configManager.branchCheckEnabled) { - return; + async showWelcomeMessage() { + if (!this.configManager.notificationsEnabled) { + return; + } + const action = await vscode.window.showInformationMessage("🚀 StackCode is now active! Get proactive suggestions to improve your development workflow.", "Learn More", "Settings"); + if (action === "Learn More") { + vscode.env.openExternal(vscode.Uri.parse("https://github.com/YagoBorba/StackCode")); + } + else if (action === "Settings") { + vscode.commands.executeCommand("workbench.action.openSettings", "stackcode"); + } } - const isMainBranch = ["main", "master", "develop"].includes(currentBranch); - if (isMainBranch) { - const action = await vscode.window.showWarningMessage( - `⚠️ You are working on the ${currentBranch} branch. Would you like to create a new feature branch?`, - "Create Branch", - "Continue", - "Don't Show Again", - ); - if (action === "Create Branch") { - vscode.commands.executeCommand("stackcode.createBranch"); - } else if (action === "Don't Show Again") { - await this.configManager.updateConfiguration( - "notifications.branchCheck", - false, - ); - } + async showBranchWarning(currentBranch) { + if (!this.configManager.branchCheckEnabled) { + return; + } + const isMainBranch = ["main", "master", "develop"].includes(currentBranch); + if (isMainBranch) { + const action = await vscode.window.showWarningMessage(`⚠️ You are working on the ${currentBranch} branch. Would you like to create a new feature branch?`, "Create Branch", "Continue", "Don't Show Again"); + if (action === "Create Branch") { + vscode.commands.executeCommand("stackcode.createBranch"); + } + else if (action === "Don't Show Again") { + await this.configManager.updateConfiguration("notifications.branchCheck", false); + } + } } - } - async showCommitMessageWarning(message) { - if (!this.configManager.commitCheckEnabled) { - return; + async showCommitMessageWarning(message) { + if (!this.configManager.commitCheckEnabled) { + return; + } + const isConventional = this.isConventionalCommit(message); + if (!isConventional) { + const action = await vscode.window.showWarningMessage("💬 We detected you are trying to commit without a conventional message. Would you like help formatting it?", "Format Message", "Continue", "Learn More"); + if (action === "Format Message") { + vscode.commands.executeCommand("stackcode.formatCommitMessage"); + } + else if (action === "Learn More") { + vscode.env.openExternal(vscode.Uri.parse("https://conventionalcommits.org/")); + } + } } - const isConventional = this.isConventionalCommit(message); - if (!isConventional) { - const action = await vscode.window.showWarningMessage( - "💬 We detected you are trying to commit without a conventional message. Would you like help formatting it?", - "Format Message", - "Continue", - "Learn More", - ); - if (action === "Format Message") { - vscode.commands.executeCommand("stackcode.formatCommitMessage"); - } else if (action === "Learn More") { - vscode.env.openExternal( - vscode.Uri.parse("https://conventionalcommits.org/"), - ); - } + async showFileCreationSuggestion(fileName) { + if (!this.configManager.notificationsEnabled) { + return; + } + if (fileName === "README.md") { + const action = await vscode.window.showInformationMessage("📝 Would you like to generate a comprehensive README.md using StackCode templates?", "Generate README", "Not Now"); + if (action === "Generate README") { + // TODO: Implement README generation + vscode.window.showInformationMessage("README generation will be available soon!"); + } + } + else if (fileName === ".gitignore") { + const action = await vscode.window.showInformationMessage("🚫 Would you like to generate a .gitignore file based on your project type?", "Generate .gitignore", "Not Now"); + if (action === "Generate .gitignore") { + // TODO: Implement .gitignore generation + vscode.window.showInformationMessage(".gitignore generation will be available soon!"); + } + } } - } - async showFileCreationSuggestion(fileName) { - if (!this.configManager.notificationsEnabled) { - return; + async runFullBestPracticesCheck() { + const issues = []; + // Check if working on main branch + try { + const gitExtension = vscode.extensions.getExtension("vscode.git")?.exports; + if (gitExtension) { + const repo = gitExtension.getAPI(1).repositories[0]; + if (repo && + ["main", "master", "develop"].includes(repo.state.HEAD?.name || "")) { + issues.push("Working on main/develop branch"); + } + } + } + catch (error) { + // Git extension not available or error accessing it + console.log("Git extension error:", error); + } + // Check for missing files + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (workspaceFolder) { + const files = await vscode.workspace.fs.readDirectory(workspaceFolder.uri); + const fileNames = files.map(([name]) => name); + if (!fileNames.includes("README.md")) { + issues.push("Missing README.md file"); + } + if (!fileNames.includes(".gitignore")) { + issues.push("Missing .gitignore file"); + } + } + if (issues.length === 0) { + vscode.window.showInformationMessage("✅ All best practices checks passed!"); + } + else { + const message = `Found ${issues.length} potential improvements:\n${issues.map((issue) => `• ${issue}`).join("\n")}`; + vscode.window.showWarningMessage(message, "Fix Issues"); + } } - if (fileName === "README.md") { - const action = await vscode.window.showInformationMessage( - "📝 Would you like to generate a comprehensive README.md using StackCode templates?", - "Generate README", - "Not Now", - ); - if (action === "Generate README") { - // TODO: Implement README generation - vscode.window.showInformationMessage( - "README generation will be available soon!", - ); - } - } else if (fileName === ".gitignore") { - const action = await vscode.window.showInformationMessage( - "🚫 Would you like to generate a .gitignore file based on your project type?", - "Generate .gitignore", - "Not Now", - ); - if (action === "Generate .gitignore") { - // TODO: Implement .gitignore generation - vscode.window.showInformationMessage( - ".gitignore generation will be available soon!", - ); - } + isConventionalCommit(message) { + const conventionalPattern = /^(feat|fix|docs|style|refactor|perf|test|chore|build|ci)(\(.+\))?: .+/; + return conventionalPattern.test(message); } - } - async runFullBestPracticesCheck() { - const issues = []; - // Check if working on main branch - try { - const gitExtension = - vscode.extensions.getExtension("vscode.git")?.exports; - if (gitExtension) { - const repo = gitExtension.getAPI(1).repositories[0]; - if ( - repo && - ["main", "master", "develop"].includes(repo.state.HEAD?.name || "") - ) { - issues.push("Working on main/develop branch"); + async handleApplyFix(message) { + // Enhanced fix handling with specific actions + if (message.includes("README")) { + await vscode.commands.executeCommand("stackcode.generate.readme"); + } + else if (message.includes("gitignore")) { + await vscode.commands.executeCommand("stackcode.generate.gitignore"); + } + else if (message.includes("commit")) { + await vscode.commands.executeCommand("stackcode.commit"); } - } - } catch (error) { - // Git extension not available or error accessing it - console.log("Git extension error:", error); + else { + await vscode.commands.executeCommand("stackcode.validate"); + } + } + async handleLearnMore(message) { + const learnMoreUrls = { + "conventional commits": "https://conventionalcommits.org/", + gitflow: "https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow", + readme: "https://www.makeareadme.com/", + "git best practices": "https://sethrobertson.github.io/GitBestPractices/", + }; + const topic = Object.keys(learnMoreUrls).find((key) => message.toLowerCase().includes(key)) || "git best practices"; + await vscode.env.openExternal(vscode.Uri.parse(learnMoreUrls[topic])); } - // Check for missing files - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (workspaceFolder) { - const files = await vscode.workspace.fs.readDirectory( - workspaceFolder.uri, - ); - const fileNames = files.map(([name]) => name); - if (!fileNames.includes("README.md")) { - issues.push("Missing README.md file"); - } - if (!fileNames.includes(".gitignore")) { - issues.push("Missing .gitignore file"); - } + async handleStartWorkflow(workflowType) { + switch (workflowType) { + case "feature": + await vscode.commands.executeCommand("stackcode.git.feature.start"); + break; + case "hotfix": + await vscode.commands.executeCommand("stackcode.git.hotfix.start"); + break; + case "release": + await vscode.commands.executeCommand("stackcode.release"); + break; + default: + await vscode.commands.executeCommand("stackcode.git.feature.start"); + } } - if (issues.length === 0) { - vscode.window.showInformationMessage( - "✅ All best practices checks passed!", - ); - } else { - const message = `Found ${issues.length} potential improvements:\n${issues.map((issue) => `• ${issue}`).join("\n")}`; - vscode.window.showWarningMessage(message, "Fix Issues"); + async handleConfigureWorkflow() { + await vscode.commands.executeCommand("stackcode.config"); } - } - isConventionalCommit(message) { - const conventionalPattern = - /^(feat|fix|docs|style|refactor|perf|test|chore|build|ci)(\(.+\))?: .+/; - return conventionalPattern.test(message); - } - async handleApplyFix(message) { - // Enhanced fix handling with specific actions - if (message.includes("README")) { - await vscode.commands.executeCommand("stackcode.generate.readme"); - } else if (message.includes("gitignore")) { - await vscode.commands.executeCommand("stackcode.generate.gitignore"); - } else if (message.includes("commit")) { - await vscode.commands.executeCommand("stackcode.commit"); - } else { - await vscode.commands.executeCommand("stackcode.validate"); + async handleFixProjectIssue(issue) { + if (issue.includes("README")) { + await vscode.commands.executeCommand("stackcode.generate.readme"); + } + else if (issue.includes("gitignore")) { + await vscode.commands.executeCommand("stackcode.generate.gitignore"); + } + else { + await vscode.commands.executeCommand("stackcode.validate"); + } } - } - async handleLearnMore(message) { - const learnMoreUrls = { - "conventional commits": "https://conventionalcommits.org/", - gitflow: - "https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow", - readme: "https://www.makeareadme.com/", - "git best practices": "https://sethrobertson.github.io/GitBestPractices/", - }; - const topic = - Object.keys(learnMoreUrls).find((key) => - message.toLowerCase().includes(key), - ) || "git best practices"; - await vscode.env.openExternal(vscode.Uri.parse(learnMoreUrls[topic])); - } - async handleStartWorkflow(workflowType) { - switch (workflowType) { - case "feature": - await vscode.commands.executeCommand("stackcode.git.feature.start"); - break; - case "hotfix": - await vscode.commands.executeCommand("stackcode.git.hotfix.start"); - break; - case "release": - await vscode.commands.executeCommand("stackcode.release"); - break; - default: - await vscode.commands.executeCommand("stackcode.git.feature.start"); + async handleShowDetails(issue) { + const outputChannel = vscode.window.createOutputChannel("StackCode Details"); + outputChannel.appendLine(`=== Project Issue Details ===`); + outputChannel.appendLine(`Issue: ${issue}`); + outputChannel.appendLine(`Timestamp: ${new Date().toISOString()}`); + outputChannel.appendLine(`Workspace: ${vscode.workspace.name || "Unknown"}`); + outputChannel.appendLine(""); + outputChannel.appendLine("Suggested Actions:"); + outputChannel.appendLine("1. Run project validation"); + outputChannel.appendLine("2. Check project structure"); + outputChannel.appendLine("3. Review best practices"); + outputChannel.show(); } - } - async handleConfigureWorkflow() { - await vscode.commands.executeCommand("stackcode.config"); - } - async handleFixProjectIssue(issue) { - if (issue.includes("README")) { - await vscode.commands.executeCommand("stackcode.generate.readme"); - } else if (issue.includes("gitignore")) { - await vscode.commands.executeCommand("stackcode.generate.gitignore"); - } else { - await vscode.commands.executeCommand("stackcode.validate"); + dispose() { + // Cleanup if needed } - } - async handleShowDetails(issue) { - const outputChannel = - vscode.window.createOutputChannel("StackCode Details"); - outputChannel.appendLine(`=== Project Issue Details ===`); - outputChannel.appendLine(`Issue: ${issue}`); - outputChannel.appendLine(`Timestamp: ${new Date().toISOString()}`); - outputChannel.appendLine( - `Workspace: ${vscode.workspace.name || "Unknown"}`, - ); - outputChannel.appendLine(""); - outputChannel.appendLine("Suggested Actions:"); - outputChannel.appendLine("1. Run project validation"); - outputChannel.appendLine("2. Check project structure"); - outputChannel.appendLine("3. Review best practices"); - outputChannel.show(); - } - dispose() { - // Cleanup if needed - } } exports.ProactiveNotificationManager = ProactiveNotificationManager; -//# sourceMappingURL=ProactiveNotificationManager.js.map +//# sourceMappingURL=ProactiveNotificationManager.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/providers/DashboardProvider.backup.js b/packages/vscode-extension/out/providers/DashboardProvider.backup.js index ebf17cfa..077b3a06 100644 --- a/packages/vscode-extension/out/providers/DashboardProvider.backup.js +++ b/packages/vscode-extension/out/providers/DashboardProvider.backup.js @@ -1,214 +1,160 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.DashboardProvider = void 0; const vscode = __importStar(require("vscode")); const path = __importStar(require("path")); const fs = __importStar(require("fs")); class DashboardProvider { - constructor(context) { - this._disposables = []; - this._extensionUri = context.extensionUri; - } - resolveWebviewView( - webviewView, + constructor(context) { + this._disposables = []; + this._extensionUri = context.extensionUri; + } + resolveWebviewView(webviewView, // eslint-disable-next-line @typescript-eslint/no-unused-vars - context, + context, // eslint-disable-next-line @typescript-eslint/no-unused-vars - token, - ) { - this._view = webviewView; - webviewView.webview.options = { - enableScripts: true, - localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], - }; - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - webviewView.webview.onDidReceiveMessage( - async (data) => { - console.log(`[StackCode] Received command from webview: ${data.type}`); - try { - // Tratar comandos específicos do webview - switch (data.type) { - case "webviewReady": - console.log( - "[StackCode] Webview reported ready, sending initial data", - ); - this.updateProjectStats(); - return; - case "refreshStats": - this.updateProjectStats(); - return; - default: - // Executar comando normal do VS Code - await vscode.commands.executeCommand(data.type, data.payload); - } - } catch (error) { - console.error( - `[StackCode] Error executing command ${data.type}:`, - error, - ); - this.sendMessage({ - type: "commandError", - payload: { - command: data.type, - error: error instanceof Error ? error.message : "Unknown error", - }, - }); - } - }, - undefined, - this._disposables, - ); - // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately - this.updateProjectStats(); - } - sendMessage(message) { - if (this._view) { - this._view.webview.postMessage(message); - } - } - show() { - if (this._view) { - this._view.show?.(true); - } else { - // If view is not created yet, trigger the creation by executing the show command - vscode.commands.executeCommand("workbench.view.extension.stackcode"); + token) { + this._view = webviewView; + webviewView.webview.options = { + enableScripts: true, + localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], + }; + webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); + webviewView.webview.onDidReceiveMessage(async (data) => { + console.log(`[StackCode] Received command from webview: ${data.type}`); + try { + // Tratar comandos específicos do webview + switch (data.type) { + case "webviewReady": + console.log("[StackCode] Webview reported ready, sending initial data"); + this.updateProjectStats(); + return; + case "refreshStats": + this.updateProjectStats(); + return; + default: + // Executar comando normal do VS Code + await vscode.commands.executeCommand(data.type, data.payload); + } + } + catch (error) { + console.error(`[StackCode] Error executing command ${data.type}:`, error); + this.sendMessage({ + type: "commandError", + payload: { + command: data.type, + error: error instanceof Error ? error.message : "Unknown error", + }, + }); + } + }, undefined, this._disposables); + // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately + this.updateProjectStats(); } - } - async updateProjectStats() { - if (!this._view) { - console.log("[StackCode] No view available for stats update"); - return; + sendMessage(message) { + if (this._view) { + this._view.webview.postMessage(message); + } } - const workspaceFolders = vscode.workspace.workspaceFolders; - console.log( - "[StackCode] Workspace folders:", - workspaceFolders?.length || 0, - ); - console.log("[StackCode] Workspace name:", vscode.workspace.name); - console.log( - "[StackCode] Workspace file:", - vscode.workspace.workspaceFile?.toString(), - ); - if (!workspaceFolders || workspaceFolders.length === 0) { - console.log( - "[StackCode] No workspace folders found, using alternative detection", - ); - // Fallback: usar informações do contexto da extensão - const extensionWorkspace = path.dirname( - path.dirname(path.dirname(this._extensionUri.fsPath)), - ); - console.log("[StackCode] Extension workspace path:", extensionWorkspace); - this.sendMessage({ - type: "updateStats", - payload: { - files: 0, - workspaceName: "StackCode (Debug)", - workspacePath: extensionWorkspace, - mode: "development", - }, - }); - return; + show() { + if (this._view) { + this._view.show?.(true); + } + else { + // If view is not created yet, trigger the creation by executing the show command + vscode.commands.executeCommand("workbench.view.extension.stackcode"); + } } - try { - const files = await vscode.workspace.findFiles( - "**/*", - "**/node_modules/**", - 1000, - ); - console.log("[StackCode] Found files:", files.length); - this.sendMessage({ - type: "updateStats", - payload: { - files: files.length, - workspaceName: workspaceFolders[0].name, - workspacePath: workspaceFolders[0].uri.fsPath, - mode: "production", - }, - }); - } catch (e) { - console.error("[StackCode] Error fetching project stats:", e); - this.sendMessage({ - type: "updateStats", - payload: { files: 0, error: "Failed to scan files" }, - }); + async updateProjectStats() { + if (!this._view) { + console.log("[StackCode] No view available for stats update"); + return; + } + const workspaceFolders = vscode.workspace.workspaceFolders; + console.log("[StackCode] Workspace folders:", workspaceFolders?.length || 0); + console.log("[StackCode] Workspace name:", vscode.workspace.name); + console.log("[StackCode] Workspace file:", vscode.workspace.workspaceFile?.toString()); + if (!workspaceFolders || workspaceFolders.length === 0) { + console.log("[StackCode] No workspace folders found, using alternative detection"); + // Fallback: usar informações do contexto da extensão + const extensionWorkspace = path.dirname(path.dirname(path.dirname(this._extensionUri.fsPath))); + console.log("[StackCode] Extension workspace path:", extensionWorkspace); + this.sendMessage({ + type: "updateStats", + payload: { + files: 0, + workspaceName: "StackCode (Debug)", + workspacePath: extensionWorkspace, + mode: "development", + }, + }); + return; + } + try { + const files = await vscode.workspace.findFiles("**/*", "**/node_modules/**", 1000); + console.log("[StackCode] Found files:", files.length); + this.sendMessage({ + type: "updateStats", + payload: { + files: files.length, + workspaceName: workspaceFolders[0].name, + workspacePath: workspaceFolders[0].uri.fsPath, + mode: "production", + }, + }); + } + catch (e) { + console.error("[StackCode] Error fetching project stats:", e); + this.sendMessage({ + type: "updateStats", + payload: { files: 0, error: "Failed to scan files" }, + }); + } } - } - _getHtmlForWebview(webview) { - const nonce = getNonce(); - const buildPath = vscode.Uri.joinPath( - this._extensionUri, - "dist", - "webview-ui", - ); - // Lê o manifest.json do Vite - const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); - console.log("[StackCode] Build path:", buildPath.fsPath); - console.log("[StackCode] Manifest path:", manifestPath); - console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); - try { - const manifestContent = fs.readFileSync(manifestPath, "utf-8"); - const manifest = JSON.parse(manifestContent); - console.log("[StackCode] Manifest content:", manifest); - // Pega os arquivos do manifest do Vite - const indexEntry = manifest["index.html"]; - const scriptFile = indexEntry.file; - const cssFiles = indexEntry.css || []; - const scriptUri = webview.asWebviewUri( - vscode.Uri.joinPath(buildPath, scriptFile), - ); - const cssUris = cssFiles.map((cssFile) => - webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile)), - ); - console.log("[StackCode] Script URI:", scriptUri.toString()); - console.log( - "[StackCode] CSS URIs:", - cssUris.map((uri) => uri.toString()), - ); - return ` + _getHtmlForWebview(webview) { + const nonce = getNonce(); + const buildPath = vscode.Uri.joinPath(this._extensionUri, "dist", "webview-ui"); + // Lê o manifest.json do Vite + const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); + console.log("[StackCode] Build path:", buildPath.fsPath); + console.log("[StackCode] Manifest path:", manifestPath); + console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); + try { + const manifestContent = fs.readFileSync(manifestPath, "utf-8"); + const manifest = JSON.parse(manifestContent); + console.log("[StackCode] Manifest content:", manifest); + // Pega os arquivos do manifest do Vite + const indexEntry = manifest["index.html"]; + const scriptFile = indexEntry.file; + const cssFiles = indexEntry.css || []; + const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(buildPath, scriptFile)); + const cssUris = cssFiles.map((cssFile) => webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile))); + console.log("[StackCode] Script URI:", scriptUri.toString()); + console.log("[StackCode] CSS URIs:", cssUris.map((uri) => uri.toString())); + return ` @@ -247,10 +193,11 @@ class DashboardProvider { `; - } catch (error) { - console.error("[StackCode] Error reading manifest:", error); - // Fallback melhorado para desenvolvimento - return ` + } + catch (error) { + console.error("[StackCode] Error reading manifest:", error); + // Fallback melhorado para desenvolvimento + return ` @@ -303,27 +250,26 @@ class DashboardProvider { `; + } } - } - // CORREÇÃO: Adicionando o método dispose para conformidade. - dispose() { - while (this._disposables.length) { - const x = this._disposables.pop(); - if (x) { - x.dispose(); - } + // CORREÇÃO: Adicionando o método dispose para conformidade. + dispose() { + while (this._disposables.length) { + const x = this._disposables.pop(); + if (x) { + x.dispose(); + } + } } - } } exports.DashboardProvider = DashboardProvider; DashboardProvider.viewType = "stackcode.dashboard"; function getNonce() { - let text = ""; - const possible = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 32; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; + let text = ""; + const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (let i = 0; i < 32; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; } -//# sourceMappingURL=DashboardProvider.backup.js.map +//# sourceMappingURL=DashboardProvider.backup.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/providers/DashboardProvider.js b/packages/vscode-extension/out/providers/DashboardProvider.js index b44af57c..a3ea15de 100644 --- a/packages/vscode-extension/out/providers/DashboardProvider.js +++ b/packages/vscode-extension/out/providers/DashboardProvider.js @@ -1,214 +1,160 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.DashboardProvider = void 0; const vscode = __importStar(require("vscode")); const path = __importStar(require("path")); const fs = __importStar(require("fs")); class DashboardProvider { - constructor(context) { - this._disposables = []; - this._extensionUri = context.extensionUri; - } - resolveWebviewView( - webviewView, + constructor(context) { + this._disposables = []; + this._extensionUri = context.extensionUri; + } + resolveWebviewView(webviewView, // eslint-disable-next-line @typescript-eslint/no-unused-vars - context, + context, // eslint-disable-next-line @typescript-eslint/no-unused-vars - token, - ) { - this._view = webviewView; - webviewView.webview.options = { - enableScripts: true, - localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], - }; - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - webviewView.webview.onDidReceiveMessage( - async (data) => { - console.log(`[StackCode] Received command from webview: ${data.type}`); - try { - // Tratar comandos específicos do webview - switch (data.type) { - case "webviewReady": - console.log( - "[StackCode] Webview reported ready, sending initial data", - ); - this.updateProjectStats(); - return; - case "refreshStats": - this.updateProjectStats(); - return; - default: - // Executar comando normal do VS Code - await vscode.commands.executeCommand(data.type, data.payload); - } - } catch (error) { - console.error( - `[StackCode] Error executing command ${data.type}:`, - error, - ); - this.sendMessage({ - type: "commandError", - payload: { - command: data.type, - error: error instanceof Error ? error.message : "Unknown error", - }, - }); - } - }, - undefined, - this._disposables, - ); - // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately - this.updateProjectStats(); - } - sendMessage(message) { - if (this._view) { - this._view.webview.postMessage(message); - } - } - show() { - if (this._view) { - this._view.show?.(true); - } else { - // If view is not created yet, trigger the creation by executing the show command - vscode.commands.executeCommand("workbench.view.extension.stackcode"); + token) { + this._view = webviewView; + webviewView.webview.options = { + enableScripts: true, + localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], + }; + webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); + webviewView.webview.onDidReceiveMessage(async (data) => { + console.log(`[StackCode] Received command from webview: ${data.type}`); + try { + // Tratar comandos específicos do webview + switch (data.type) { + case "webviewReady": + console.log("[StackCode] Webview reported ready, sending initial data"); + this.updateProjectStats(); + return; + case "refreshStats": + this.updateProjectStats(); + return; + default: + // Executar comando normal do VS Code + await vscode.commands.executeCommand(data.type, data.payload); + } + } + catch (error) { + console.error(`[StackCode] Error executing command ${data.type}:`, error); + this.sendMessage({ + type: "commandError", + payload: { + command: data.type, + error: error instanceof Error ? error.message : "Unknown error", + }, + }); + } + }, undefined, this._disposables); + // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately + this.updateProjectStats(); } - } - async updateProjectStats() { - if (!this._view) { - console.log("[StackCode] No view available for stats update"); - return; + sendMessage(message) { + if (this._view) { + this._view.webview.postMessage(message); + } } - const workspaceFolders = vscode.workspace.workspaceFolders; - console.log( - "[StackCode] Workspace folders:", - workspaceFolders?.length || 0, - ); - console.log("[StackCode] Workspace name:", vscode.workspace.name); - console.log( - "[StackCode] Workspace file:", - vscode.workspace.workspaceFile?.toString(), - ); - if (!workspaceFolders || workspaceFolders.length === 0) { - console.log( - "[StackCode] No workspace folders found, using alternative detection", - ); - // Fallback: usar informações do contexto da extensão - const extensionWorkspace = path.dirname( - path.dirname(path.dirname(this._extensionUri.fsPath)), - ); - console.log("[StackCode] Extension workspace path:", extensionWorkspace); - this.sendMessage({ - type: "updateStats", - payload: { - files: 0, - workspaceName: "StackCode (Debug)", - workspacePath: extensionWorkspace, - mode: "development", - }, - }); - return; + show() { + if (this._view) { + this._view.show?.(true); + } + else { + // If view is not created yet, trigger the creation by executing the show command + vscode.commands.executeCommand("workbench.view.extension.stackcode"); + } } - try { - const files = await vscode.workspace.findFiles( - "**/*", - "**/node_modules/**", - 1000, - ); - console.log("[StackCode] Found files:", files.length); - this.sendMessage({ - type: "updateStats", - payload: { - files: files.length, - workspaceName: workspaceFolders[0].name, - workspacePath: workspaceFolders[0].uri.fsPath, - mode: "production", - }, - }); - } catch (e) { - console.error("[StackCode] Error fetching project stats:", e); - this.sendMessage({ - type: "updateStats", - payload: { files: 0, error: "Failed to scan files" }, - }); + async updateProjectStats() { + if (!this._view) { + console.log("[StackCode] No view available for stats update"); + return; + } + const workspaceFolders = vscode.workspace.workspaceFolders; + console.log("[StackCode] Workspace folders:", workspaceFolders?.length || 0); + console.log("[StackCode] Workspace name:", vscode.workspace.name); + console.log("[StackCode] Workspace file:", vscode.workspace.workspaceFile?.toString()); + if (!workspaceFolders || workspaceFolders.length === 0) { + console.log("[StackCode] No workspace folders found, using alternative detection"); + // Fallback: usar informações do contexto da extensão + const extensionWorkspace = path.dirname(path.dirname(path.dirname(this._extensionUri.fsPath))); + console.log("[StackCode] Extension workspace path:", extensionWorkspace); + this.sendMessage({ + type: "updateStats", + payload: { + files: 0, + workspaceName: "StackCode (Debug)", + workspacePath: extensionWorkspace, + mode: "development", + }, + }); + return; + } + try { + const files = await vscode.workspace.findFiles("**/*", "**/node_modules/**", 1000); + console.log("[StackCode] Found files:", files.length); + this.sendMessage({ + type: "updateStats", + payload: { + files: files.length, + workspaceName: workspaceFolders[0].name, + workspacePath: workspaceFolders[0].uri.fsPath, + mode: "production", + }, + }); + } + catch (e) { + console.error("[StackCode] Error fetching project stats:", e); + this.sendMessage({ + type: "updateStats", + payload: { files: 0, error: "Failed to scan files" }, + }); + } } - } - _getHtmlForWebview(webview) { - const nonce = getNonce(); - const buildPath = vscode.Uri.joinPath( - this._extensionUri, - "dist", - "webview-ui", - ); - // Lê o manifest.json do Vite - const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); - console.log("[StackCode] Build path:", buildPath.fsPath); - console.log("[StackCode] Manifest path:", manifestPath); - console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); - try { - const manifestContent = fs.readFileSync(manifestPath, "utf-8"); - const manifest = JSON.parse(manifestContent); - console.log("[StackCode] Manifest content:", manifest); - // Pega os arquivos do manifest do Vite - const indexEntry = manifest["index.html"]; - const scriptFile = indexEntry.file; - const cssFiles = indexEntry.css || []; - const scriptUri = webview.asWebviewUri( - vscode.Uri.joinPath(buildPath, scriptFile), - ); - const cssUris = cssFiles.map((cssFile) => - webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile)), - ); - console.log("[StackCode] Script URI:", scriptUri.toString()); - console.log( - "[StackCode] CSS URIs:", - cssUris.map((uri) => uri.toString()), - ); - return ` + _getHtmlForWebview(webview) { + const nonce = getNonce(); + const buildPath = vscode.Uri.joinPath(this._extensionUri, "dist", "webview-ui"); + // Lê o manifest.json do Vite + const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); + console.log("[StackCode] Build path:", buildPath.fsPath); + console.log("[StackCode] Manifest path:", manifestPath); + console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); + try { + const manifestContent = fs.readFileSync(manifestPath, "utf-8"); + const manifest = JSON.parse(manifestContent); + console.log("[StackCode] Manifest content:", manifest); + // Pega os arquivos do manifest do Vite + const indexEntry = manifest["index.html"]; + const scriptFile = indexEntry.file; + const cssFiles = indexEntry.css || []; + const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(buildPath, scriptFile)); + const cssUris = cssFiles.map((cssFile) => webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile))); + console.log("[StackCode] Script URI:", scriptUri.toString()); + console.log("[StackCode] CSS URIs:", cssUris.map((uri) => uri.toString())); + return ` @@ -247,10 +193,11 @@ class DashboardProvider { `; - } catch (error) { - console.error("[StackCode] Error reading manifest:", error); - // Fallback melhorado para desenvolvimento - return ` + } + catch (error) { + console.error("[StackCode] Error reading manifest:", error); + // Fallback melhorado para desenvolvimento + return ` @@ -303,27 +250,26 @@ class DashboardProvider { `; + } } - } - // CORREÇÃO: Adicionando o método dispose para conformidade. - dispose() { - while (this._disposables.length) { - const x = this._disposables.pop(); - if (x) { - x.dispose(); - } + // CORREÇÃO: Adicionando o método dispose para conformidade. + dispose() { + while (this._disposables.length) { + const x = this._disposables.pop(); + if (x) { + x.dispose(); + } + } } - } } exports.DashboardProvider = DashboardProvider; DashboardProvider.viewType = "stackcode.dashboard"; function getNonce() { - let text = ""; - const possible = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 32; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; + let text = ""; + const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (let i = 0; i < 32; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; } -//# sourceMappingURL=DashboardProvider.js.map +//# sourceMappingURL=DashboardProvider.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/providers/ProjectViewProvider.js b/packages/vscode-extension/out/providers/ProjectViewProvider.js index 73617dff..da64a272 100644 --- a/packages/vscode-extension/out/providers/ProjectViewProvider.js +++ b/packages/vscode-extension/out/providers/ProjectViewProvider.js @@ -1,331 +1,307 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if ( - !desc || - ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) - ) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; - }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectViewProvider = void 0; const vscode = __importStar(require("vscode")); class ProjectViewProvider { - constructor(workspaceState) { - this.workspaceState = workspaceState; - this._onDidChangeTreeData = new vscode.EventEmitter(); - this.onDidChangeTreeData = this._onDidChangeTreeData.event; - } - refresh() { - this._onDidChangeTreeData.fire(); - } - getTreeItem(element) { - const item = new vscode.TreeItem(element.label, element.collapsibleState); - // Enhanced icons and styling - const iconMap = { - "StackCode Project": "rocket", - "Quick Actions": "zap", - "Initialize Project": "folder-opened", - "Generate README": "book", - "Generate .gitignore": "git-branch", - "Validate Project": "check", - "Git Workflow": "git-commit", - "Start Feature": "git-branch", - "Create Hotfix": "flame", - "Make Release": "package", - "Commit Changes": "git-commit", - "Project Tools": "tools", - Configuration: "gear", - "Show Dashboard": "dashboard", - "View Project Stats": "graph", - "Help & Documentation": "question", - }; - // Set icons with theme support - item.iconPath = new vscode.ThemeIcon( - iconMap[element.label] || "circle-filled", - ); - // Add commands for interactive items - if (element.command) { - // Handle both string and Command object types - if (typeof element.command === "string") { - item.command = { - command: element.command, - title: element.label, - }; - } else { - item.command = element.command; - } - // Add hover descriptions - const tooltips = { - "Initialize Project": "Create a new project with StackCode scaffolding", - "Generate README": "Generate a comprehensive README.md file", - "Generate .gitignore": "Generate .gitignore based on project type", - "Validate Project": "Check project structure and best practices", - "Start Feature": "Begin a new feature using GitFlow", - "Create Hotfix": "Create a hotfix branch for urgent fixes", - "Make Release": "Create a new release with automated versioning", - "Commit Changes": "Make a conventional commit with validation", - Configuration: "Configure StackCode settings", - "Show Dashboard": "Open the interactive StackCode dashboard", - "View Project Stats": "See detailed project statistics", - "Help & Documentation": "Access StackCode documentation", - }; - item.tooltip = tooltips[element.label] || element.label; + constructor(workspaceState) { + this.workspaceState = workspaceState; + this._onDidChangeTreeData = new vscode.EventEmitter(); + this.onDidChangeTreeData = this._onDidChangeTreeData.event; } - // Style for different types - if (element.children && element.children.length > 0) { - item.contextValue = "stackcode-category"; - } else if (element.command) { - item.contextValue = "stackcode-action"; + refresh() { + this._onDidChangeTreeData.fire(); } - return item; - } - getChildren(element) { - if (!element) { - // Root level - show main categories with enhanced structure - return Promise.resolve([ - { - label: "StackCode Project", - icon: "rocket", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Quick Actions", - icon: "zap", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Initialize Project", - icon: "folder-opened", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.init", - title: "Initialize Project", - }, - }, - { - label: "Generate README", - icon: "book", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.generate.readme", - title: "Generate README", - }, - }, - { - label: "Generate .gitignore", - icon: "git-branch", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.generate.gitignore", - title: "Generate .gitignore", - }, - }, - { - label: "Validate Project", - icon: "check", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.validate", - title: "Validate Project", - }, - }, - ], - }, - { - label: "Git Workflow", - icon: "git-commit", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Start Feature", - icon: "git-branch", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.git.feature.start", - title: "Start Feature", - }, - }, - { - label: "Create Hotfix", - icon: "flame", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.git.hotfix.start", - title: "Create Hotfix", - }, - }, - { - label: "Make Release", - icon: "package", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.release", - title: "Make Release", - }, - }, - { - label: "Commit Changes", - icon: "git-commit", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.commit", - title: "Commit Changes", - }, - }, - ], - }, - { - label: "Project Tools", - icon: "tools", - collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, - children: [ - { - label: "Configuration", - icon: "gear", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.config", - title: "Configuration", - }, - }, - { - label: "Show Dashboard", - icon: "dashboard", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.dashboard.show", - title: "Show Dashboard", - }, - }, + getTreeItem(element) { + const item = new vscode.TreeItem(element.label, element.collapsibleState); + // Enhanced icons and styling + const iconMap = { + "StackCode Project": "rocket", + "Quick Actions": "zap", + "Initialize Project": "folder-opened", + "Generate README": "book", + "Generate .gitignore": "git-branch", + "Validate Project": "check", + "Git Workflow": "git-commit", + "Start Feature": "git-branch", + "Create Hotfix": "flame", + "Make Release": "package", + "Commit Changes": "git-commit", + "Project Tools": "tools", + Configuration: "gear", + "Show Dashboard": "dashboard", + "View Project Stats": "graph", + "Help & Documentation": "question", + }; + // Set icons with theme support + item.iconPath = new vscode.ThemeIcon(iconMap[element.label] || "circle-filled"); + // Add commands for interactive items + if (element.command) { + // Handle both string and Command object types + if (typeof element.command === "string") { + item.command = { + command: element.command, + title: element.label, + }; + } + else { + item.command = element.command; + } + // Add hover descriptions + const tooltips = { + "Initialize Project": "Create a new project with StackCode scaffolding", + "Generate README": "Generate a comprehensive README.md file", + "Generate .gitignore": "Generate .gitignore based on project type", + "Validate Project": "Check project structure and best practices", + "Start Feature": "Begin a new feature using GitFlow", + "Create Hotfix": "Create a hotfix branch for urgent fixes", + "Make Release": "Create a new release with automated versioning", + "Commit Changes": "Make a conventional commit with validation", + Configuration: "Configure StackCode settings", + "Show Dashboard": "Open the interactive StackCode dashboard", + "View Project Stats": "See detailed project statistics", + "Help & Documentation": "Access StackCode documentation", + }; + item.tooltip = tooltips[element.label] || element.label; + } + // Style for different types + if (element.children && element.children.length > 0) { + item.contextValue = "stackcode-category"; + } + else if (element.command) { + item.contextValue = "stackcode-action"; + } + return item; + } + getChildren(element) { + if (!element) { + // Root level - show main categories with enhanced structure + return Promise.resolve([ { - label: "View Project Stats", - icon: "graph", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.stats.show", - title: "View Project Stats", - }, + label: "StackCode Project", + icon: "rocket", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ + { + label: "Quick Actions", + icon: "zap", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ + { + label: "Initialize Project", + icon: "folder-opened", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.init", + title: "Initialize Project", + }, + }, + { + label: "Generate README", + icon: "book", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.generate.readme", + title: "Generate README", + }, + }, + { + label: "Generate .gitignore", + icon: "git-branch", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.generate.gitignore", + title: "Generate .gitignore", + }, + }, + { + label: "Validate Project", + icon: "check", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.validate", + title: "Validate Project", + }, + }, + ], + }, + { + label: "Git Workflow", + icon: "git-commit", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ + { + label: "Start Feature", + icon: "git-branch", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.git.feature.start", + title: "Start Feature", + }, + }, + { + label: "Create Hotfix", + icon: "flame", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.git.hotfix.start", + title: "Create Hotfix", + }, + }, + { + label: "Make Release", + icon: "package", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.release", + title: "Make Release", + }, + }, + { + label: "Commit Changes", + icon: "git-commit", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.commit", + title: "Commit Changes", + }, + }, + ], + }, + { + label: "Project Tools", + icon: "tools", + collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, + children: [ + { + label: "Configuration", + icon: "gear", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.config", + title: "Configuration", + }, + }, + { + label: "Show Dashboard", + icon: "dashboard", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.dashboard.show", + title: "Show Dashboard", + }, + }, + { + label: "View Project Stats", + icon: "graph", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.stats.show", + title: "View Project Stats", + }, + }, + { + label: "Help & Documentation", + icon: "question", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.help", + title: "Help & Documentation", + }, + }, + ], + }, + ], }, + ]); + } + else { + return Promise.resolve(element.children || []); + } + } + async getProjectInfo() { + const items = []; + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (!workspaceFolder) { + return [ { - label: "Help & Documentation", - icon: "question", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.help", - title: "Help & Documentation", - }, + label: "No workspace", + description: "Open a folder to see project info", + icon: "folder-opened", }, - ], - }, - ], - }, - ]); - } else { - return Promise.resolve(element.children || []); - } - } - async getProjectInfo() { - const items = []; - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (!workspaceFolder) { - return [ - { - label: "No workspace", - description: "Open a folder to see project info", - icon: "folder-opened", - }, - ]; - } - // Project name - items.push({ - label: workspaceFolder.name, - description: "Project root", - icon: "folder", - }); - // Git status - try { - const gitExtension = vscode.extensions.getExtension("vscode.git"); - if (gitExtension && gitExtension.isActive) { - const git = gitExtension.exports; - const api = git.getAPI(1); - const repo = api.repositories[0]; - if (repo && repo.state.HEAD) { - items.push({ - label: `Branch: ${repo.state.HEAD.name}`, - description: `${repo.state.workingTreeChanges.length} changes`, - icon: "git-branch", - }); + ]; + } + // Project name + items.push({ + label: workspaceFolder.name, + description: "Project root", + icon: "folder", + }); + // Git status + try { + const gitExtension = vscode.extensions.getExtension("vscode.git"); + if (gitExtension && gitExtension.isActive) { + const git = gitExtension.exports; + const api = git.getAPI(1); + const repo = api.repositories[0]; + if (repo && repo.state.HEAD) { + items.push({ + label: `Branch: ${repo.state.HEAD.name}`, + description: `${repo.state.workingTreeChanges.length} changes`, + icon: "git-branch", + }); + } + } } - } - } catch { - // Git not available + catch { + // Git not available + } + // Quick actions + items.push({ + label: "Initialize Project", + description: "Set up StackCode project", + icon: "play", + command: "stackcode.init", + }, { + label: "Generate Files", + description: "Create README, .gitignore, etc.", + icon: "file-add", + command: "stackcode.generate.readme", + }, { + label: "Start Branch", + description: "Create new feature branch", + icon: "git-branch", + command: "stackcode.git.start", + }, { + label: "Create Commit", + description: "Make conventional commit", + icon: "git-commit", + command: "stackcode.commit", + }); + return items; } - // Quick actions - items.push( - { - label: "Initialize Project", - description: "Set up StackCode project", - icon: "play", - command: "stackcode.init", - }, - { - label: "Generate Files", - description: "Create README, .gitignore, etc.", - icon: "file-add", - command: "stackcode.generate.readme", - }, - { - label: "Start Branch", - description: "Create new feature branch", - icon: "git-branch", - command: "stackcode.git.start", - }, - { - label: "Create Commit", - description: "Make conventional commit", - icon: "git-commit", - command: "stackcode.commit", - }, - ); - return items; - } } exports.ProjectViewProvider = ProjectViewProvider; -//# sourceMappingURL=ProjectViewProvider.js.map +//# sourceMappingURL=ProjectViewProvider.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/test/__mocks__/vscode.js b/packages/vscode-extension/out/test/__mocks__/vscode.js index d666f80f..90a9daef 100644 --- a/packages/vscode-extension/out/test/__mocks__/vscode.js +++ b/packages/vscode-extension/out/test/__mocks__/vscode.js @@ -1,66 +1,58 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigurationTarget = - exports.StatusBarAlignment = - exports.extensions = - exports.commands = - exports.workspace = - exports.window = - void 0; +exports.ConfigurationTarget = exports.StatusBarAlignment = exports.extensions = exports.commands = exports.workspace = exports.window = void 0; const mockConfiguration = { - get: jest.fn((key, defaultValue) => { - const configs = { - "notifications.enabled": true, - "notifications.branchCheck": true, - "notifications.commitCheck": true, - "autoGenerate.readme": false, - "autoGenerate.gitignore": true, - "git.defaultBranchType": "feature", - "dashboard.autoOpen": false, - }; - return configs[key] !== undefined ? configs[key] : defaultValue; - }), - update: jest.fn(), + get: jest.fn((key, defaultValue) => { + const configs = { + "notifications.enabled": true, + "notifications.branchCheck": true, + "notifications.commitCheck": true, + "autoGenerate.readme": false, + "autoGenerate.gitignore": true, + "git.defaultBranchType": "feature", + "dashboard.autoOpen": false, + }; + return configs[key] !== undefined ? configs[key] : defaultValue; + }), + update: jest.fn(), }; exports.window = { - showInformationMessage: jest.fn(), - showWarningMessage: jest.fn(), - showErrorMessage: jest.fn(), - createStatusBarItem: jest.fn(() => ({ - show: jest.fn(), - hide: jest.fn(), - dispose: jest.fn(), - })), + showInformationMessage: jest.fn(), + showWarningMessage: jest.fn(), + showErrorMessage: jest.fn(), + createStatusBarItem: jest.fn(() => ({ + show: jest.fn(), + hide: jest.fn(), + dispose: jest.fn(), + })), }; exports.workspace = { - getConfiguration: jest.fn(() => mockConfiguration), - workspaceFolders: [], - onDidChangeConfiguration: jest.fn(), + getConfiguration: jest.fn(() => mockConfiguration), + workspaceFolders: [], + onDidChangeConfiguration: jest.fn(), }; exports.commands = { - registerCommand: jest.fn(), - executeCommand: jest.fn(), - getCommands: jest.fn(() => - Promise.resolve([ - "stackcode.init", - "stackcode.generate.readme", - "stackcode.git.start", - ]), - ), + registerCommand: jest.fn(), + executeCommand: jest.fn(), + getCommands: jest.fn(() => Promise.resolve([ + "stackcode.init", + "stackcode.generate.readme", + "stackcode.git.start", + ])), }; exports.extensions = { - getExtension: jest.fn(() => ({ - activate: jest.fn(() => Promise.resolve()), - isActive: true, - })), + getExtension: jest.fn(() => ({ + activate: jest.fn(() => Promise.resolve()), + isActive: true, + })), }; exports.StatusBarAlignment = { - Left: 1, - Right: 2, + Left: 1, + Right: 2, }; exports.ConfigurationTarget = { - Global: 1, - Workspace: 2, - WorkspaceFolder: 3, + Global: 1, + Workspace: 2, + WorkspaceFolder: 3, }; -//# sourceMappingURL=vscode.js.map +//# sourceMappingURL=vscode.js.map \ No newline at end of file diff --git a/packages/vscode-extension/out/types.js b/packages/vscode-extension/out/types.js index 270a1e8f..11e638d1 100644 --- a/packages/vscode-extension/out/types.js +++ b/packages/vscode-extension/out/types.js @@ -1,3 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/vscode-extension/src/commands/CommitCommand.ts b/packages/vscode-extension/src/commands/CommitCommand.ts index 63c01540..d63033d9 100644 --- a/packages/vscode-extension/src/commands/CommitCommand.ts +++ b/packages/vscode-extension/src/commands/CommitCommand.ts @@ -1,11 +1,12 @@ import { BaseCommand } from "./BaseCommand"; +import { t } from "@stackcode/i18n"; export class CommitCommand extends BaseCommand { async execute(): Promise { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } @@ -14,9 +15,9 @@ export class CommitCommand extends BaseCommand { await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess("Commit dialog opened in terminal!"); + this.showSuccess(t("vscode.commit.commit_dialog_opened")); } catch (error) { - this.showError(`Failed to open commit dialog: ${error}`); + this.showError(t("vscode.commit.failed_open_commit_dialog", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/commands/ConfigCommand.ts b/packages/vscode-extension/src/commands/ConfigCommand.ts index ba1a10ef..badd0a91 100644 --- a/packages/vscode-extension/src/commands/ConfigCommand.ts +++ b/packages/vscode-extension/src/commands/ConfigCommand.ts @@ -1,32 +1,33 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; +import { t } from "@stackcode/i18n"; export class ConfigCommand extends BaseCommand { async execute(): Promise { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } const action = await vscode.window.showQuickPick( [ { - label: "Open StackCode Settings", - description: "Configure StackCode extension settings", + label: t("vscode.config.open_stackcode_settings"), + description: t("vscode.config.open_stackcode_settings_description"), }, { - label: "Open Project Config", - description: "Edit .stackcoderc.json file", + label: t("vscode.config.open_project_config"), + description: t("vscode.config.open_project_config_description"), }, { - label: "Create Project Config", - description: "Create a new .stackcoderc.json file", + label: t("vscode.config.create_project_config"), + description: t("vscode.config.create_project_config_description"), }, ], { - placeHolder: "What would you like to configure?", + placeHolder: t("vscode.config.what_would_you_like_configure"), }, ); @@ -34,12 +35,12 @@ export class ConfigCommand extends BaseCommand { return; } - if (action.label === "Open StackCode Settings") { + if (action.label === t("vscode.config.open_stackcode_settings")) { vscode.commands.executeCommand( "workbench.action.openSettings", "stackcode", ); - } else if (action.label === "Open Project Config") { + } else if (action.label === t("vscode.config.open_project_config")) { const configPath = vscode.Uri.joinPath( workspaceFolder.uri, ".stackcoderc.json", @@ -49,17 +50,17 @@ export class ConfigCommand extends BaseCommand { await vscode.window.showTextDocument(document); } catch { this.showError( - '.stackcoderc.json file not found. Use "Create Project Config" to create one.', + t("vscode.config.stackcoderc_not_found"), ); } - } else if (action.label === "Create Project Config") { + } else if (action.label === t("vscode.config.create_project_config")) { // Use StackCode CLI for config creation const command = `npx @stackcode/cli config init`; await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess("Project configuration initialized!"); + this.showSuccess(t("vscode.config.project_configuration_initialized")); } } catch (error) { - this.showError(`Failed to open configuration: ${error}`); + this.showError(t("vscode.config.failed_open_configuration", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/commands/GenerateCommand.ts b/packages/vscode-extension/src/commands/GenerateCommand.ts index fa074e8d..b69b1ac9 100644 --- a/packages/vscode-extension/src/commands/GenerateCommand.ts +++ b/packages/vscode-extension/src/commands/GenerateCommand.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; import { ProgressCallback } from "../types"; +import { t } from "@stackcode/i18n"; import * as path from "path"; export class GenerateCommand extends BaseCommand { @@ -9,19 +10,19 @@ export class GenerateCommand extends BaseCommand { [ { label: "README.md", - description: "Generate a comprehensive README file", + description: t("vscode.generate.readme_description"), }, { label: ".gitignore", - description: "Generate a .gitignore file based on project type", + description: t("vscode.generate.gitignore_description"), }, { - label: "Both", - description: "Generate both README.md and .gitignore", + label: t("vscode.generate.both"), + description: t("vscode.generate.both_description"), }, ], { - placeHolder: "What would you like to generate?", + placeHolder: t("vscode.generate.what_would_you_like_generate"), }, ); @@ -33,7 +34,7 @@ export class GenerateCommand extends BaseCommand { await this.generateReadme(); } else if (option.label === ".gitignore") { await this.generateGitignore(); - } else if (option.label === "Both") { + } else if (option.label === t("vscode.generate.both")) { await this.generateReadme(); await this.generateGitignore(); } @@ -43,7 +44,7 @@ export class GenerateCommand extends BaseCommand { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } @@ -53,8 +54,8 @@ export class GenerateCommand extends BaseCommand { try { await vscode.workspace.fs.stat(vscode.Uri.file(readmePath)); const overwrite = await this.confirmAction( - "README.md already exists. Do you want to overwrite it?", - "Overwrite", + t("vscode.generate.readme_exists_overwrite"), + t("vscode.generate.overwrite"), ); if (!overwrite) { return; @@ -66,43 +67,43 @@ export class GenerateCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Generating README.md", + title: t("vscode.generate.generating_readme"), cancellable: false, }, async (progress: ProgressCallback) => { progress.report({ increment: 0, - message: "Analyzing project structure...", + message: t("vscode.generate.setting_up_readme"), }); // Use StackCode CLI for generation const command = `npx @stackcode/cli generate readme`; - progress.report({ increment: 50, message: "Generating content..." }); + progress.report({ increment: 50, message: t("vscode.generate.running_generator") }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); progress.report({ increment: 100, - message: "README.md generated successfully!", + message: t("vscode.generate.readme_created"), }); }, ); - this.showSuccess("README.md has been generated successfully!"); + this.showSuccess(t("vscode.generate.readme_has_been_generated")); // Ask if user wants to open the file const openFile = await vscode.window.showInformationMessage( - "Would you like to open the generated README.md?", - "Open File", + t("vscode.generate.would_you_like_open_readme"), + t("vscode.generate.open_file"), ); - if (openFile === "Open File") { + if (openFile === t("vscode.generate.open_file")) { const document = await vscode.workspace.openTextDocument(readmePath); await vscode.window.showTextDocument(document); } } catch (error) { - this.showError(`Failed to generate README.md: ${error}`); + this.showError(t("vscode.generate.failed_generate_readme", { error: String(error) })); } } @@ -110,7 +111,7 @@ export class GenerateCommand extends BaseCommand { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } @@ -120,8 +121,8 @@ export class GenerateCommand extends BaseCommand { try { await vscode.workspace.fs.stat(vscode.Uri.file(gitignorePath)); const overwrite = await this.confirmAction( - ".gitignore already exists. Do you want to overwrite it?", - "Overwrite", + t("vscode.generate.gitignore_exists_overwrite"), + t("vscode.generate.overwrite"), ); if (!overwrite) { return; @@ -133,20 +134,20 @@ export class GenerateCommand extends BaseCommand { // Ask for project type const projectType = await vscode.window.showQuickPick( [ - { label: "node-ts", description: "Node.js with TypeScript" }, - { label: "react", description: "React application" }, - { label: "vue", description: "Vue.js application" }, - { label: "angular", description: "Angular application" }, - { label: "python", description: "Python project" }, - { label: "java", description: "Java project" }, - { label: "go", description: "Go project" }, - { label: "php", description: "PHP project" }, - { label: "flutter", description: "Flutter project" }, - { label: "swift", description: "Swift project" }, - { label: "android", description: "Android project" }, + { label: "node-ts", description: t("vscode.init.stacks.node_ts") }, + { label: "react", description: t("vscode.init.stacks.react") }, + { label: "vue", description: t("vscode.init.stacks.vue") }, + { label: "angular", description: t("vscode.init.stacks.angular") }, + { label: "python", description: t("vscode.init.stacks.python") }, + { label: "java", description: t("vscode.init.stacks.java") }, + { label: "go", description: t("vscode.init.stacks.go") }, + { label: "php", description: t("vscode.init.stacks.php") }, + { label: "flutter", description: t("vscode.generate.stacks.flutter") }, + { label: "swift", description: t("vscode.generate.stacks.swift") }, + { label: "android", description: t("vscode.generate.stacks.android") }, ], { - placeHolder: "Select project type for .gitignore", + placeHolder: t("vscode.generate.select_project_type_gitignore"), }, ); @@ -157,43 +158,43 @@ export class GenerateCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Generating .gitignore", + title: t("vscode.generate.generating_gitignore"), cancellable: false, }, async (progress: ProgressCallback) => { progress.report({ increment: 0, - message: "Generating .gitignore content...", + message: t("vscode.generate.setting_up_gitignore"), }); // Use StackCode CLI for generation const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; - progress.report({ increment: 50, message: "Creating file..." }); + progress.report({ increment: 50, message: t("vscode.generate.running_generator") }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); progress.report({ increment: 100, - message: ".gitignore generated successfully!", + message: t("vscode.generate.gitignore_created"), }); }, ); - this.showSuccess(".gitignore has been generated successfully!"); + this.showSuccess(t("vscode.generate.gitignore_has_been_generated")); // Ask if user wants to open the file const openFile = await vscode.window.showInformationMessage( - "Would you like to open the generated .gitignore?", - "Open File", + t("vscode.generate.would_you_like_open_gitignore"), + t("vscode.generate.open_file"), ); - if (openFile === "Open File") { + if (openFile === t("vscode.generate.open_file")) { const document = await vscode.workspace.openTextDocument(gitignorePath); await vscode.window.showTextDocument(document); } } catch (error) { - this.showError(`Failed to generate .gitignore: ${error}`); + this.showError(t("vscode.generate.failed_generate_gitignore", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/commands/GitCommand.ts b/packages/vscode-extension/src/commands/GitCommand.ts index ce8ceccc..9404212f 100644 --- a/packages/vscode-extension/src/commands/GitCommand.ts +++ b/packages/vscode-extension/src/commands/GitCommand.ts @@ -1,16 +1,17 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; import { ProgressCallback } from "../types"; +import { t } from "@stackcode/i18n"; export class GitCommand extends BaseCommand { async execute(): Promise { const action = await vscode.window.showQuickPick( [ - { label: "start", description: "Start a new feature branch" }, - { label: "finish", description: "Finish current branch" }, + { label: "start", description: t("vscode.git.start_description") }, + { label: "finish", description: t("vscode.git.finish_description") }, ], { - placeHolder: "Select Git action", + placeHolder: t("vscode.git.select_git_action"), }, ); @@ -28,14 +29,14 @@ export class GitCommand extends BaseCommand { async startBranch(): Promise { try { const branchName = await vscode.window.showInputBox({ - prompt: "Enter the name for the new branch", - placeHolder: "new-feature", - validateInput: (value) => { + prompt: t("vscode.git.enter_branch_name"), + placeHolder: t("vscode.git.new_feature"), + validateInput: (value: string) => { if (!value) { - return "Branch name is required"; + return t("vscode.git.branch_name_required"); } if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { - return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; + return t("vscode.git.branch_name_invalid"); } return null; }, @@ -47,13 +48,13 @@ export class GitCommand extends BaseCommand { const branchType = await vscode.window.showQuickPick( [ - { label: "feature", description: "A new feature branch" }, - { label: "bugfix", description: "A bug fix branch" }, - { label: "hotfix", description: "A hotfix branch" }, - { label: "release", description: "A release branch" }, + { label: "feature", description: t("vscode.git.feature_description") }, + { label: "bugfix", description: t("vscode.git.bugfix_description") }, + { label: "hotfix", description: t("vscode.git.hotfix_description") }, + { label: "chore", description: t("vscode.git.chore_description") }, ], { - placeHolder: "Select branch type", + placeHolder: t("vscode.git.select_branch_type"), }, ); @@ -63,41 +64,41 @@ export class GitCommand extends BaseCommand { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: `Creating ${branchType.label} branch: ${branchName}`, + title: t("vscode.git.creating_branch", { branchName: `${branchType.label}/${branchName}` }), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: "Creating branch..." }); + progress.report({ increment: 0, message: t("vscode.git.switching_to_develop") }); // Use StackCode CLI for git operations const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; progress.report({ increment: 50, - message: "Switching to new branch...", + message: t("vscode.git.creating_new_branch"), }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); progress.report({ increment: 100, - message: "Branch created successfully!", + message: t("vscode.git.branch_created_successfully"), }); }, ); this.showSuccess( - `Branch ${branchType.label}/${branchName} has been created and checked out!`, + t("vscode.git.new_branch_created", { branchName: `${branchType.label}/${branchName}` }), ); } catch (error) { - this.showError(`Failed to create branch: ${error}`); + this.showError(t("vscode.git.failed_create_branch", { error: String(error) })); } } @@ -105,7 +106,7 @@ export class GitCommand extends BaseCommand { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } @@ -127,8 +128,8 @@ export class GitCommand extends BaseCommand { } const confirm = await this.confirmAction( - `Are you sure you want to finish ${currentBranch}? This will merge it back to the base branch.`, - "Finish Branch", + t("vscode.git.are_you_sure_finish_branch", { currentBranch }), + t("vscode.git.finish_branch"), ); if (!confirm) { @@ -138,29 +139,29 @@ export class GitCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: `Finishing branch: ${currentBranch}`, + title: t("vscode.git.finishing_branch", { branchName: currentBranch }), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: "Merging branch..." }); + progress.report({ increment: 0, message: t("vscode.git.pushing_branch") }); // Use StackCode CLI for git operations const command = `npx @stackcode/cli git finish`; - progress.report({ increment: 50, message: "Cleaning up..." }); + progress.report({ increment: 50, message: t("vscode.git.opening_pr") }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); progress.report({ increment: 100, - message: "Branch finished successfully!", + message: t("vscode.git.branch_finished_successfully"), }); }, ); - this.showSuccess(`Branch ${currentBranch} has been finished and merged!`); + this.showSuccess(t("vscode.git.branch_has_been_finished", { currentBranch })); } catch (error) { - this.showError(`Failed to finish branch: ${error}`); + this.showError(t("vscode.git.failed_finish_branch", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/commands/InitCommand.ts b/packages/vscode-extension/src/commands/InitCommand.ts index 9eef63af..13916d92 100644 --- a/packages/vscode-extension/src/commands/InitCommand.ts +++ b/packages/vscode-extension/src/commands/InitCommand.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; import { ProgressCallback } from "../types"; +import { t } from "@stackcode/i18n"; import * as path from "path"; export class InitCommand extends BaseCommand { @@ -8,14 +9,14 @@ export class InitCommand extends BaseCommand { try { // Prompt for project details const projectName = await vscode.window.showInputBox({ - prompt: "Enter project name", - placeHolder: "my-awesome-project", + prompt: t("vscode.init.enter_project_name"), + placeHolder: t("vscode.init.my_awesome_project"), validateInput: (value: string) => { if (!value) { - return "Project name is required"; + return t("vscode.init.project_name_required"); } if (!/^[a-zA-Z0-9-_]+$/.test(value)) { - return "Project name can only contain letters, numbers, hyphens and underscores"; + return t("vscode.init.project_name_invalid"); } return null; }, @@ -26,29 +27,29 @@ export class InitCommand extends BaseCommand { } const description = await vscode.window.showInputBox({ - prompt: "Enter project description", - placeHolder: "A brief description of your project", + prompt: t("vscode.init.enter_project_description"), + placeHolder: t("vscode.init.brief_description"), }); const authorName = await vscode.window.showInputBox({ - prompt: "Enter author name", - placeHolder: "Your Name", + prompt: t("vscode.init.enter_author_name"), + placeHolder: t("vscode.init.your_name"), value: await this.getGitUserName(), }); const stack = await vscode.window.showQuickPick( [ - { label: "node-ts", description: "Node.js with TypeScript" }, - { label: "react", description: "React application" }, - { label: "vue", description: "Vue.js application" }, - { label: "angular", description: "Angular application" }, - { label: "python", description: "Python project" }, - { label: "java", description: "Java project" }, - { label: "go", description: "Go project" }, - { label: "php", description: "PHP project" }, + { label: "node-ts", description: t("vscode.init.stacks.node_ts") }, + { label: "react", description: t("vscode.init.stacks.react") }, + { label: "vue", description: t("vscode.init.stacks.vue") }, + { label: "angular", description: t("vscode.init.stacks.angular") }, + { label: "python", description: t("vscode.init.stacks.python") }, + { label: "java", description: t("vscode.init.stacks.java") }, + { label: "go", description: t("vscode.init.stacks.go") }, + { label: "php", description: t("vscode.init.stacks.php") }, ], { - placeHolder: "Select project stack", + placeHolder: t("vscode.init.select_project_stack"), }, ); @@ -67,7 +68,7 @@ export class InitCommand extends BaseCommand { canSelectFolders: true, canSelectFiles: false, canSelectMany: false, - openLabel: "Select Project Location", + openLabel: t("vscode.init.select_project_location"), }); if (!folderUris || folderUris.length === 0) { @@ -81,8 +82,8 @@ export class InitCommand extends BaseCommand { try { await vscode.workspace.fs.stat(vscode.Uri.file(projectPath)); const overwrite = await this.confirmAction( - `Directory ${projectName} already exists. Do you want to overwrite it?`, - "Overwrite", + t("vscode.init.directory_exists_overwrite", { projectName }), + t("vscode.init.overwrite"), ); if (!overwrite) { return; @@ -95,13 +96,13 @@ export class InitCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: `Initializing project ${projectName}`, + title: t("vscode.init.initializing_project", { projectName }), cancellable: false, }, async (progress: ProgressCallback) => { progress.report({ increment: 0, - message: "Setting up project structure...", + message: t("vscode.init.setting_up_structure"), }); // Use StackCode CLI for initialization @@ -109,31 +110,31 @@ export class InitCommand extends BaseCommand { progress.report({ increment: 50, - message: "Running StackCode CLI...", + message: t("vscode.init.running_stackcode_cli"), }); await this.runTerminalCommand(command); progress.report({ increment: 100, - message: "Project initialized successfully!", + message: t("vscode.init.project_initialized_successfully"), }); }, ); // Ask if user wants to open the new project const openProject = await vscode.window.showInformationMessage( - `Project ${projectName} has been created successfully! Would you like to open it?`, - "Open Project", - "Later", + t("vscode.init.project_created_successfully", { projectName }), + t("vscode.init.open_project"), + t("vscode.init.later"), ); - if (openProject === "Open Project") { + if (openProject === t("vscode.init.open_project")) { const uri = vscode.Uri.file(projectPath); await vscode.commands.executeCommand("vscode.openFolder", uri, true); } } catch (error) { - this.showError(`Failed to initialize project: ${error}`); + this.showError(t("vscode.init.failed_initialize_project", { error: String(error) })); } } diff --git a/packages/vscode-extension/src/commands/ReleaseCommand.ts b/packages/vscode-extension/src/commands/ReleaseCommand.ts index a0a106c1..6278b1a3 100644 --- a/packages/vscode-extension/src/commands/ReleaseCommand.ts +++ b/packages/vscode-extension/src/commands/ReleaseCommand.ts @@ -1,19 +1,20 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; import { ProgressCallback } from "../types"; +import { t } from "@stackcode/i18n"; export class ReleaseCommand extends BaseCommand { async execute(): Promise { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } const confirm = await this.confirmAction( - "Are you sure you want to create a new release? This will tag the current commit and publish the release.", - "Create Release", + t("vscode.release.are_you_sure_create_release"), + t("vscode.release.create_release"), ); if (!confirm) { @@ -23,26 +24,26 @@ export class ReleaseCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Creating release", + title: t("vscode.release.creating_release"), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: "Preparing release..." }); + progress.report({ increment: 0, message: t("vscode.release.preparing_release") }); // Use StackCode CLI for release const command = `npx @stackcode/cli release`; - progress.report({ increment: 50, message: "Creating release..." }); + progress.report({ increment: 50, message: t("vscode.release.creating_release_message") }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: "Release created!" }); + progress.report({ increment: 100, message: t("vscode.release.release_created") }); }, ); - this.showSuccess("Release process started! Check terminal for progress."); + this.showSuccess(t("vscode.release.release_process_started")); } catch (error) { - this.showError(`Failed to create release: ${error}`); + this.showError(t("vscode.release.failed_create_release", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/commands/ValidateCommand.ts b/packages/vscode-extension/src/commands/ValidateCommand.ts index 512a2dc3..3363f8ad 100644 --- a/packages/vscode-extension/src/commands/ValidateCommand.ts +++ b/packages/vscode-extension/src/commands/ValidateCommand.ts @@ -1,44 +1,45 @@ import * as vscode from "vscode"; import { BaseCommand } from "./BaseCommand"; import { ProgressCallback } from "../types"; +import { t } from "@stackcode/i18n"; export class ValidateCommand extends BaseCommand { async execute(): Promise { try { const workspaceFolder = this.getCurrentWorkspaceFolder(); if (!workspaceFolder) { - this.showError("No workspace folder found"); + this.showError(t("vscode.common.no_workspace_folder")); return; } vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Validating project structure", + title: t("vscode.validate.validating_project_structure"), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: "Running validation..." }); + progress.report({ increment: 0, message: t("vscode.validate.running_validation") }); // Use StackCode CLI for validation const command = `npx @stackcode/cli validate`; progress.report({ increment: 50, - message: "Checking project structure...", + message: t("vscode.validate.checking_project_structure"), }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: "Validation completed!" }); + progress.report({ increment: 100, message: t("vscode.validate.validation_completed") }); }, ); this.showSuccess( - "Project validation completed! Check terminal for results.", + t("vscode.validate.project_validation_completed"), ); } catch (error) { - this.showError(`Failed to validate project: ${error}`); + this.showError(t("vscode.validate.failed_validate_project", { error: String(error) })); } } } diff --git a/packages/vscode-extension/src/monitors/FileMonitor.ts b/packages/vscode-extension/src/monitors/FileMonitor.ts index cfcbd602..e316f98d 100644 --- a/packages/vscode-extension/src/monitors/FileMonitor.ts +++ b/packages/vscode-extension/src/monitors/FileMonitor.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import { ProactiveNotificationManager } from "../notifications/ProactiveNotificationManager"; import { ConfigurationManager } from "../config/ConfigurationManager"; +import { t } from "@stackcode/i18n"; export class FileMonitor implements vscode.Disposable { private proactiveManager: ProactiveNotificationManager; @@ -131,36 +132,36 @@ export class FileMonitor implements vscode.Disposable { if (missingFiles.length > 0 && Math.random() < 0.3) { // Show suggestion 30% of the time - const message = `📁 Your project is missing some important files: ${missingFiles.join(", ")}. Would you like to generate them?`; + const message = t("vscode.common.project_missing_files", { missingFiles: missingFiles.join(", ") }); const action = await vscode.window.showInformationMessage( message, - "Generate Files", - "Not Now", - "Don't Show Again", + t("vscode.common.generate_files"), + t("vscode.common.not_now"), + t("vscode.common.dont_show_again"), ); - if (action === "Generate Files") { + if (action === t("vscode.common.generate_files")) { // TODO: Implement file generation vscode.window.showInformationMessage( - "File generation will be available soon!", + t("vscode.common.file_generation_available_soon"), ); - } else if (action === "Don't Show Again") { + } else if (action === t("vscode.common.dont_show_again")) { await this.configManager.updateConfiguration( "notifications.enabled", false, ); } } - } catch (error) { + } catch (error: any) { // Use proper VS Code logging instead of console.log const outputChannel = vscode.window.createOutputChannel("StackCode"); - outputChannel.appendLine(`Error checking project structure: ${error}`); + outputChannel.appendLine(t("vscode.common.error_checking_project_structure", { error: String(error) })); } } dispose(): void { - this.disposables.forEach((d) => d.dispose()); + this.disposables.forEach((d: vscode.Disposable) => d.dispose()); this.disposables = []; this.processedFiles.clear(); } From 518dc8eb4d63036878a323f4d354592bdb0739c8 Mon Sep 17 00:00:00 2001 From: Yago Azevedo Borba <140000816+YagoBorba@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:46:04 +0000 Subject: [PATCH 2/2] =?UTF-8?q?style(style):=20=F0=9F=A7=B9=20fix=20code?= =?UTF-8?q?=20formatting=20and=20lint=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #47 --- .../results.json | 2 +- packages/i18n/src/locales/en.json | 4 +- packages/i18n/src/locales/pt.json | 4 +- .../out/commands/BaseCommand.js | 120 ++-- .../out/commands/CommitCommand.js | 35 +- .../out/commands/ConfigCommand.js | 180 ++++-- .../out/commands/GenerateCommand.js | 417 +++++++----- .../out/commands/GitCommand.js | 355 +++++++---- .../out/commands/InitCommand.js | 329 ++++++---- .../out/commands/ReleaseCommand.js | 135 ++-- .../out/commands/ValidateCommand.js | 131 ++-- .../out/config/ConfigurationManager.js | 129 ++-- packages/vscode-extension/out/extension.js | 277 +++++--- .../out/monitors/FileMonitor.js | 283 +++++---- .../out/monitors/GitMonitor.js | 364 ++++++----- .../ProactiveNotificationManager.js | 425 +++++++------ .../out/providers/DashboardProvider.backup.js | 376 ++++++----- .../out/providers/DashboardProvider.js | 376 ++++++----- .../out/providers/ProjectViewProvider.js | 600 +++++++++--------- .../out/test/__mocks__/vscode.js | 92 +-- packages/vscode-extension/out/types.js | 2 +- .../src/commands/CommitCommand.ts | 4 +- .../src/commands/ConfigCommand.ts | 8 +- .../src/commands/GenerateCommand.ts | 30 +- .../src/commands/GitCommand.ts | 44 +- .../src/commands/InitCommand.ts | 4 +- .../src/commands/ReleaseCommand.ts | 19 +- .../src/commands/ValidateCommand.ts | 18 +- .../src/monitors/FileMonitor.ts | 12 +- 29 files changed, 2809 insertions(+), 1966 deletions(-) diff --git a/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json b/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json index 74447fa5..04062301 100644 --- a/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +++ b/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json @@ -1 +1 @@ -{"version":"3.2.4","results":[[":test/release.test.ts",{"duration":8.607225000000028,"failed":false}],[":test/github.test.ts",{"duration":5.436721000000034,"failed":false}],[":test/validator.test.ts",{"duration":3.516659000000004,"failed":false}]]} \ No newline at end of file +{"version":"3.2.4","results":[[":test/release.test.ts",{"duration":6.6153189999999995,"failed":false}],[":test/github.test.ts",{"duration":7.541957000000025,"failed":false}],[":test/validator.test.ts",{"duration":3.747600000000034,"failed":false}]]} \ No newline at end of file diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index efa3ac27..ec4bba22 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -239,7 +239,7 @@ "stacks": { "node_ts": "Node.js with TypeScript", "react": "React application", - "vue": "Vue.js application", + "vue": "Vue.js application", "angular": "Angular application", "python": "Python project", "java": "Java project", @@ -263,7 +263,7 @@ "overwrite": "Overwrite", "generating_readme": "Generating README.md", "setting_up_readme": "Setting up README structure...", - "running_generator": "Running generator...", + "running_generator": "Running generator...", "readme_created": "README.md created!", "generating_gitignore": "Generating .gitignore", "setting_up_gitignore": "Setting up .gitignore structure...", diff --git a/packages/i18n/src/locales/pt.json b/packages/i18n/src/locales/pt.json index c868776e..8941361a 100644 --- a/packages/i18n/src/locales/pt.json +++ b/packages/i18n/src/locales/pt.json @@ -217,7 +217,7 @@ }, "init": { "enter_project_name": "Digite o nome do projeto", - "enter_project_description": "Digite a descrição do projeto", + "enter_project_description": "Digite a descrição do projeto", "enter_author_name": "Digite o nome do autor", "project_initialized_successfully": "Projeto inicializado com sucesso!", "project_created_successfully": "Projeto {projectName} foi criado com sucesso! Gostaria de abri-lo?", @@ -240,7 +240,7 @@ "node_ts": "Node.js com TypeScript", "react": "Aplicação React", "vue": "Aplicação Vue.js", - "angular": "Aplicação Angular", + "angular": "Aplicação Angular", "python": "Projeto Python", "java": "Projeto Java", "go": "Projeto Go", diff --git a/packages/vscode-extension/out/commands/BaseCommand.js b/packages/vscode-extension/out/commands/BaseCommand.js index 6cdfd572..26326af0 100644 --- a/packages/vscode-extension/out/commands/BaseCommand.js +++ b/packages/vscode-extension/out/commands/BaseCommand.js @@ -1,58 +1,84 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const vscode = __importStar(require("vscode")); class BaseCommand { - async showError(message) { - vscode.window.showErrorMessage(`StackCode: ${message}`); - } - async showWarning(message) { - vscode.window.showWarningMessage(`StackCode: ${message}`); - } - async showInfo(message) { - vscode.window.showInformationMessage(`StackCode: ${message}`); - } - async showSuccess(message) { - vscode.window.showInformationMessage(`✅ ${message}`); - } - getCurrentWorkspaceFolder() { - return vscode.workspace.workspaceFolders?.[0]; - } - async runTerminalCommand(command, cwd) { - const terminal = vscode.window.createTerminal({ - name: "StackCode", - cwd: cwd || this.getCurrentWorkspaceFolder()?.uri.fsPath, - }); - terminal.sendText(command); - terminal.show(); - } - async confirmAction(message, confirmText = "Yes") { - const result = await vscode.window.showWarningMessage(message, { modal: true }, confirmText, "Cancel"); - return result === confirmText; - } + async showError(message) { + vscode.window.showErrorMessage(`StackCode: ${message}`); + } + async showWarning(message) { + vscode.window.showWarningMessage(`StackCode: ${message}`); + } + async showInfo(message) { + vscode.window.showInformationMessage(`StackCode: ${message}`); + } + async showSuccess(message) { + vscode.window.showInformationMessage(`✅ ${message}`); + } + getCurrentWorkspaceFolder() { + return vscode.workspace.workspaceFolders?.[0]; + } + async runTerminalCommand(command, cwd) { + const terminal = vscode.window.createTerminal({ + name: "StackCode", + cwd: cwd || this.getCurrentWorkspaceFolder()?.uri.fsPath, + }); + terminal.sendText(command); + terminal.show(); + } + async confirmAction(message, confirmText = "Yes") { + const result = await vscode.window.showWarningMessage( + message, + { modal: true }, + confirmText, + "Cancel", + ); + return result === confirmText; + } } exports.BaseCommand = BaseCommand; -//# sourceMappingURL=BaseCommand.js.map \ No newline at end of file +//# sourceMappingURL=BaseCommand.js.map diff --git a/packages/vscode-extension/out/commands/CommitCommand.js b/packages/vscode-extension/out/commands/CommitCommand.js index 4e70f836..10c35633 100644 --- a/packages/vscode-extension/out/commands/CommitCommand.js +++ b/packages/vscode-extension/out/commands/CommitCommand.js @@ -4,22 +4,25 @@ exports.CommitCommand = void 0; const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); class CommitCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - // Use StackCode CLI for commit - const command = `npx @stackcode/cli commit`; - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess((0, i18n_1.t)("vscode.commit.commit_dialog_opened")); - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.commit.failed_open_commit_dialog", { error: String(error) })); - } + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + // Use StackCode CLI for commit + const command = `npx @stackcode/cli commit`; + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + this.showSuccess((0, i18n_1.t)("vscode.commit.commit_dialog_opened")); + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.commit.failed_open_commit_dialog", { + error: String(error), + }), + ); } + } } exports.CommitCommand = CommitCommand; -//# sourceMappingURL=CommitCommand.js.map \ No newline at end of file +//# sourceMappingURL=CommitCommand.js.map diff --git a/packages/vscode-extension/out/commands/ConfigCommand.js b/packages/vscode-extension/out/commands/ConfigCommand.js index b1728b27..3f2e5a2d 100644 --- a/packages/vscode-extension/out/commands/ConfigCommand.js +++ b/packages/vscode-extension/out/commands/ConfigCommand.js @@ -1,83 +1,129 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); class ConfigCommand extends BaseCommand_1.BaseCommand { - async execute() { + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const action = await vscode.window.showQuickPick( + [ + { + label: (0, i18n_1.t)("vscode.config.open_stackcode_settings"), + description: (0, i18n_1.t)( + "vscode.config.open_stackcode_settings_description", + ), + }, + { + label: (0, i18n_1.t)("vscode.config.open_project_config"), + description: (0, i18n_1.t)( + "vscode.config.open_project_config_description", + ), + }, + { + label: (0, i18n_1.t)("vscode.config.create_project_config"), + description: (0, i18n_1.t)( + "vscode.config.create_project_config_description", + ), + }, + ], + { + placeHolder: (0, i18n_1.t)( + "vscode.config.what_would_you_like_configure", + ), + }, + ); + if (!action) { + return; + } + if ( + action.label === (0, i18n_1.t)("vscode.config.open_stackcode_settings") + ) { + vscode.commands.executeCommand( + "workbench.action.openSettings", + "stackcode", + ); + } else if ( + action.label === (0, i18n_1.t)("vscode.config.open_project_config") + ) { + const configPath = vscode.Uri.joinPath( + workspaceFolder.uri, + ".stackcoderc.json", + ); try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - const action = await vscode.window.showQuickPick([ - { - label: (0, i18n_1.t)("vscode.config.open_stackcode_settings"), - description: (0, i18n_1.t)("vscode.config.open_stackcode_settings_description"), - }, - { - label: (0, i18n_1.t)("vscode.config.open_project_config"), - description: (0, i18n_1.t)("vscode.config.open_project_config_description"), - }, - { - label: (0, i18n_1.t)("vscode.config.create_project_config"), - description: (0, i18n_1.t)("vscode.config.create_project_config_description"), - }, - ], { - placeHolder: (0, i18n_1.t)("vscode.config.what_would_you_like_configure"), - }); - if (!action) { - return; - } - if (action.label === (0, i18n_1.t)("vscode.config.open_stackcode_settings")) { - vscode.commands.executeCommand("workbench.action.openSettings", "stackcode"); - } - else if (action.label === (0, i18n_1.t)("vscode.config.open_project_config")) { - const configPath = vscode.Uri.joinPath(workspaceFolder.uri, ".stackcoderc.json"); - try { - const document = await vscode.workspace.openTextDocument(configPath); - await vscode.window.showTextDocument(document); - } - catch { - this.showError((0, i18n_1.t)("vscode.config.stackcoderc_not_found")); - } - } - else if (action.label === (0, i18n_1.t)("vscode.config.create_project_config")) { - // Use StackCode CLI for config creation - const command = `npx @stackcode/cli config init`; - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - this.showSuccess((0, i18n_1.t)("vscode.config.project_configuration_initialized")); - } - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.config.failed_open_configuration", { error: String(error) })); + const document = await vscode.workspace.openTextDocument(configPath); + await vscode.window.showTextDocument(document); + } catch { + this.showError((0, i18n_1.t)("vscode.config.stackcoderc_not_found")); } + } else if ( + action.label === (0, i18n_1.t)("vscode.config.create_project_config") + ) { + // Use StackCode CLI for config creation + const command = `npx @stackcode/cli config init`; + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + this.showSuccess( + (0, i18n_1.t)("vscode.config.project_configuration_initialized"), + ); + } + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.config.failed_open_configuration", { + error: String(error), + }), + ); } + } } exports.ConfigCommand = ConfigCommand; -//# sourceMappingURL=ConfigCommand.js.map \ No newline at end of file +//# sourceMappingURL=ConfigCommand.js.map diff --git a/packages/vscode-extension/out/commands/GenerateCommand.js b/packages/vscode-extension/out/commands/GenerateCommand.js index 63a1424f..1c19a50e 100644 --- a/packages/vscode-extension/out/commands/GenerateCommand.js +++ b/packages/vscode-extension/out/commands/GenerateCommand.js @@ -1,27 +1,48 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateCommand = void 0; const vscode = __importStar(require("vscode")); @@ -29,154 +50,224 @@ const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); const path = __importStar(require("path")); class GenerateCommand extends BaseCommand_1.BaseCommand { - async execute() { - const option = await vscode.window.showQuickPick([ - { - label: "README.md", - description: (0, i18n_1.t)("vscode.generate.readme_description"), - }, - { - label: ".gitignore", - description: (0, i18n_1.t)("vscode.generate.gitignore_description"), - }, - { - label: (0, i18n_1.t)("vscode.generate.both"), - description: (0, i18n_1.t)("vscode.generate.both_description"), - }, - ], { - placeHolder: (0, i18n_1.t)("vscode.generate.what_would_you_like_generate"), - }); - if (!option) { - return; - } - if (option.label === "README.md") { - await this.generateReadme(); - } - else if (option.label === ".gitignore") { - await this.generateGitignore(); - } - else if (option.label === (0, i18n_1.t)("vscode.generate.both")) { - await this.generateReadme(); - await this.generateGitignore(); - } + async execute() { + const option = await vscode.window.showQuickPick( + [ + { + label: "README.md", + description: (0, i18n_1.t)("vscode.generate.readme_description"), + }, + { + label: ".gitignore", + description: (0, i18n_1.t)("vscode.generate.gitignore_description"), + }, + { + label: (0, i18n_1.t)("vscode.generate.both"), + description: (0, i18n_1.t)("vscode.generate.both_description"), + }, + ], + { + placeHolder: (0, i18n_1.t)( + "vscode.generate.what_would_you_like_generate", + ), + }, + ); + if (!option) { + return; } - async generateReadme() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - const readmePath = path.join(workspaceFolder.uri.fsPath, "README.md"); - // Check if README already exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(readmePath)); - const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.generate.readme_exists_overwrite"), (0, i18n_1.t)("vscode.generate.overwrite")); - if (!overwrite) { - return; - } - } - catch { - // File doesn't exist, which is fine - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.generate.generating_readme"), - cancellable: false, - }, async (progress) => { - progress.report({ - increment: 0, - message: (0, i18n_1.t)("vscode.generate.setting_up_readme"), - }); - // Use StackCode CLI for generation - const command = `npx @stackcode/cli generate readme`; - progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.generate.running_generator") }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: (0, i18n_1.t)("vscode.generate.readme_created"), - }); - }); - this.showSuccess((0, i18n_1.t)("vscode.generate.readme_has_been_generated")); - // Ask if user wants to open the file - const openFile = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.generate.would_you_like_open_readme"), (0, i18n_1.t)("vscode.generate.open_file")); - if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { - const document = await vscode.workspace.openTextDocument(readmePath); - await vscode.window.showTextDocument(document); - } - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.generate.failed_generate_readme", { error: String(error) })); - } + if (option.label === "README.md") { + await this.generateReadme(); + } else if (option.label === ".gitignore") { + await this.generateGitignore(); + } else if (option.label === (0, i18n_1.t)("vscode.generate.both")) { + await this.generateReadme(); + await this.generateGitignore(); } - async generateGitignore() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - const gitignorePath = path.join(workspaceFolder.uri.fsPath, ".gitignore"); - // Check if .gitignore already exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(gitignorePath)); - const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.generate.gitignore_exists_overwrite"), (0, i18n_1.t)("vscode.generate.overwrite")); - if (!overwrite) { - return; - } - } - catch { - // File doesn't exist, which is fine - } - // Ask for project type - const projectType = await vscode.window.showQuickPick([ - { label: "node-ts", description: (0, i18n_1.t)("vscode.init.stacks.node_ts") }, - { label: "react", description: (0, i18n_1.t)("vscode.init.stacks.react") }, - { label: "vue", description: (0, i18n_1.t)("vscode.init.stacks.vue") }, - { label: "angular", description: (0, i18n_1.t)("vscode.init.stacks.angular") }, - { label: "python", description: (0, i18n_1.t)("vscode.init.stacks.python") }, - { label: "java", description: (0, i18n_1.t)("vscode.init.stacks.java") }, - { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, - { label: "php", description: (0, i18n_1.t)("vscode.init.stacks.php") }, - { label: "flutter", description: (0, i18n_1.t)("vscode.generate.stacks.flutter") }, - { label: "swift", description: (0, i18n_1.t)("vscode.generate.stacks.swift") }, - { label: "android", description: (0, i18n_1.t)("vscode.generate.stacks.android") }, - ], { - placeHolder: (0, i18n_1.t)("vscode.generate.select_project_type_gitignore"), - }); - if (!projectType) { - return; - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.generate.generating_gitignore"), - cancellable: false, - }, async (progress) => { - progress.report({ - increment: 0, - message: (0, i18n_1.t)("vscode.generate.setting_up_gitignore"), - }); - // Use StackCode CLI for generation - const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; - progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.generate.running_generator") }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: (0, i18n_1.t)("vscode.generate.gitignore_created"), - }); - }); - this.showSuccess((0, i18n_1.t)("vscode.generate.gitignore_has_been_generated")); - // Ask if user wants to open the file - const openFile = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.generate.would_you_like_open_gitignore"), (0, i18n_1.t)("vscode.generate.open_file")); - if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { - const document = await vscode.workspace.openTextDocument(gitignorePath); - await vscode.window.showTextDocument(document); - } + } + async generateReadme() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const readmePath = path.join(workspaceFolder.uri.fsPath, "README.md"); + // Check if README already exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(readmePath)); + const overwrite = await this.confirmAction( + (0, i18n_1.t)("vscode.generate.readme_exists_overwrite"), + (0, i18n_1.t)("vscode.generate.overwrite"), + ); + if (!overwrite) { + return; } - catch (error) { - this.showError((0, i18n_1.t)("vscode.generate.failed_generate_gitignore", { error: String(error) })); + } catch { + // File doesn't exist, which is fine + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.generate.generating_readme"), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.generate.setting_up_readme"), + }); + // Use StackCode CLI for generation + const command = `npx @stackcode/cli generate readme`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.generate.running_generator"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.generate.readme_created"), + }); + }, + ); + this.showSuccess( + (0, i18n_1.t)("vscode.generate.readme_has_been_generated"), + ); + // Ask if user wants to open the file + const openFile = await vscode.window.showInformationMessage( + (0, i18n_1.t)("vscode.generate.would_you_like_open_readme"), + (0, i18n_1.t)("vscode.generate.open_file"), + ); + if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { + const document = await vscode.workspace.openTextDocument(readmePath); + await vscode.window.showTextDocument(document); + } + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.generate.failed_generate_readme", { + error: String(error), + }), + ); + } + } + async generateGitignore() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const gitignorePath = path.join(workspaceFolder.uri.fsPath, ".gitignore"); + // Check if .gitignore already exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(gitignorePath)); + const overwrite = await this.confirmAction( + (0, i18n_1.t)("vscode.generate.gitignore_exists_overwrite"), + (0, i18n_1.t)("vscode.generate.overwrite"), + ); + if (!overwrite) { + return; } + } catch { + // File doesn't exist, which is fine + } + // Ask for project type + const projectType = await vscode.window.showQuickPick( + [ + { + label: "node-ts", + description: (0, i18n_1.t)("vscode.init.stacks.node_ts"), + }, + { + label: "react", + description: (0, i18n_1.t)("vscode.init.stacks.react"), + }, + { + label: "vue", + description: (0, i18n_1.t)("vscode.init.stacks.vue"), + }, + { + label: "angular", + description: (0, i18n_1.t)("vscode.init.stacks.angular"), + }, + { + label: "python", + description: (0, i18n_1.t)("vscode.init.stacks.python"), + }, + { + label: "java", + description: (0, i18n_1.t)("vscode.init.stacks.java"), + }, + { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, + { + label: "php", + description: (0, i18n_1.t)("vscode.init.stacks.php"), + }, + { + label: "flutter", + description: (0, i18n_1.t)("vscode.generate.stacks.flutter"), + }, + { + label: "swift", + description: (0, i18n_1.t)("vscode.generate.stacks.swift"), + }, + { + label: "android", + description: (0, i18n_1.t)("vscode.generate.stacks.android"), + }, + ], + { + placeHolder: (0, i18n_1.t)( + "vscode.generate.select_project_type_gitignore", + ), + }, + ); + if (!projectType) { + return; + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.generate.generating_gitignore"), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.generate.setting_up_gitignore"), + }); + // Use StackCode CLI for generation + const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.generate.running_generator"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.generate.gitignore_created"), + }); + }, + ); + this.showSuccess( + (0, i18n_1.t)("vscode.generate.gitignore_has_been_generated"), + ); + // Ask if user wants to open the file + const openFile = await vscode.window.showInformationMessage( + (0, i18n_1.t)("vscode.generate.would_you_like_open_gitignore"), + (0, i18n_1.t)("vscode.generate.open_file"), + ); + if (openFile === (0, i18n_1.t)("vscode.generate.open_file")) { + const document = await vscode.workspace.openTextDocument(gitignorePath); + await vscode.window.showTextDocument(document); + } + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.generate.failed_generate_gitignore", { + error: String(error), + }), + ); } + } } exports.GenerateCommand = GenerateCommand; -//# sourceMappingURL=GenerateCommand.js.map \ No newline at end of file +//# sourceMappingURL=GenerateCommand.js.map diff --git a/packages/vscode-extension/out/commands/GitCommand.js b/packages/vscode-extension/out/commands/GitCommand.js index f16acd2c..a55e707f 100644 --- a/packages/vscode-extension/out/commands/GitCommand.js +++ b/packages/vscode-extension/out/commands/GitCommand.js @@ -1,156 +1,235 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GitCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); class GitCommand extends BaseCommand_1.BaseCommand { - async execute() { - const action = await vscode.window.showQuickPick([ - { label: "start", description: (0, i18n_1.t)("vscode.git.start_description") }, - { label: "finish", description: (0, i18n_1.t)("vscode.git.finish_description") }, - ], { - placeHolder: (0, i18n_1.t)("vscode.git.select_git_action"), - }); - if (!action) { - return; - } - if (action.label === "start") { - await this.startBranch(); - } - else if (action.label === "finish") { - await this.finishBranch(); - } + async execute() { + const action = await vscode.window.showQuickPick( + [ + { + label: "start", + description: (0, i18n_1.t)("vscode.git.start_description"), + }, + { + label: "finish", + description: (0, i18n_1.t)("vscode.git.finish_description"), + }, + ], + { + placeHolder: (0, i18n_1.t)("vscode.git.select_git_action"), + }, + ); + if (!action) { + return; } - async startBranch() { - try { - const branchName = await vscode.window.showInputBox({ - prompt: (0, i18n_1.t)("vscode.git.enter_branch_name"), - placeHolder: (0, i18n_1.t)("vscode.git.new_feature"), - validateInput: (value) => { - if (!value) { - return (0, i18n_1.t)("vscode.git.branch_name_required"); - } - if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { - return (0, i18n_1.t)("vscode.git.branch_name_invalid"); - } - return null; - }, - }); - if (!branchName) { - return; - } - const branchType = await vscode.window.showQuickPick([ - { label: "feature", description: (0, i18n_1.t)("vscode.git.feature_description") }, - { label: "bugfix", description: (0, i18n_1.t)("vscode.git.bugfix_description") }, - { label: "hotfix", description: (0, i18n_1.t)("vscode.git.hotfix_description") }, - { label: "chore", description: (0, i18n_1.t)("vscode.git.chore_description") }, - ], { - placeHolder: (0, i18n_1.t)("vscode.git.select_branch_type"), - }); - if (!branchType) { - return; - } - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.git.creating_branch", { branchName: `${branchType.label}/${branchName}` }), - cancellable: false, - }, async (progress) => { - progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.git.switching_to_develop") }); - // Use StackCode CLI for git operations - const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; - progress.report({ - increment: 50, - message: (0, i18n_1.t)("vscode.git.creating_new_branch"), - }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: (0, i18n_1.t)("vscode.git.branch_created_successfully"), - }); - }); - this.showSuccess((0, i18n_1.t)("vscode.git.new_branch_created", { branchName: `${branchType.label}/${branchName}` })); - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.git.failed_create_branch", { error: String(error) })); - } + if (action.label === "start") { + await this.startBranch(); + } else if (action.label === "finish") { + await this.finishBranch(); } - async finishBranch() { + } + async startBranch() { + try { + const branchName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.git.enter_branch_name"), + placeHolder: (0, i18n_1.t)("vscode.git.new_feature"), + validateInput: (value) => { + if (!value) { + return (0, i18n_1.t)("vscode.git.branch_name_required"); + } + if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { + return (0, i18n_1.t)("vscode.git.branch_name_invalid"); + } + return null; + }, + }); + if (!branchName) { + return; + } + const branchType = await vscode.window.showQuickPick( + [ + { + label: "feature", + description: (0, i18n_1.t)("vscode.git.feature_description"), + }, + { + label: "bugfix", + description: (0, i18n_1.t)("vscode.git.bugfix_description"), + }, + { + label: "hotfix", + description: (0, i18n_1.t)("vscode.git.hotfix_description"), + }, + { + label: "chore", + description: (0, i18n_1.t)("vscode.git.chore_description"), + }, + ], + { + placeHolder: (0, i18n_1.t)("vscode.git.select_branch_type"), + }, + ); + if (!branchType) { + return; + } + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.git.creating_branch", { + branchName: `${branchType.label}/${branchName}`, + }), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.git.switching_to_develop"), + }); + // Use StackCode CLI for git operations + const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.git.creating_new_branch"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.git.branch_created_successfully"), + }); + }, + ); + this.showSuccess( + (0, i18n_1.t)("vscode.git.new_branch_created", { + branchName: `${branchType.label}/${branchName}`, + }), + ); + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.git.failed_create_branch", { + error: String(error), + }), + ); + } + } + async finishBranch() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + // Get current branch name + const gitExtension = vscode.extensions.getExtension("vscode.git"); + let currentBranch = "current branch"; + if (gitExtension && gitExtension.isActive) { try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - // Get current branch name - const gitExtension = vscode.extensions.getExtension("vscode.git"); - let currentBranch = "current branch"; - if (gitExtension && gitExtension.isActive) { - try { - const git = gitExtension.exports; - const api = git.getAPI(1); - const repo = api.repositories[0]; - if (repo && repo.state.HEAD) { - currentBranch = repo.state.HEAD.name || "current branch"; - } - } - catch { - // Fallback to generic message - } - } - const confirm = await this.confirmAction((0, i18n_1.t)("vscode.git.are_you_sure_finish_branch", { currentBranch }), (0, i18n_1.t)("vscode.git.finish_branch")); - if (!confirm) { - return; - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.git.finishing_branch", { branchName: currentBranch }), - cancellable: false, - }, async (progress) => { - progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.git.pushing_branch") }); - // Use StackCode CLI for git operations - const command = `npx @stackcode/cli git finish`; - progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.git.opening_pr") }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ - increment: 100, - message: (0, i18n_1.t)("vscode.git.branch_finished_successfully"), - }); - }); - this.showSuccess((0, i18n_1.t)("vscode.git.branch_has_been_finished", { currentBranch })); - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.git.failed_finish_branch", { error: String(error) })); + const git = gitExtension.exports; + const api = git.getAPI(1); + const repo = api.repositories[0]; + if (repo && repo.state.HEAD) { + currentBranch = repo.state.HEAD.name || "current branch"; + } + } catch { + // Fallback to generic message } + } + const confirm = await this.confirmAction( + (0, i18n_1.t)("vscode.git.are_you_sure_finish_branch", { + currentBranch, + }), + (0, i18n_1.t)("vscode.git.finish_branch"), + ); + if (!confirm) { + return; + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.git.finishing_branch", { + branchName: currentBranch, + }), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.git.pushing_branch"), + }); + // Use StackCode CLI for git operations + const command = `npx @stackcode/cli git finish`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.git.opening_pr"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.git.branch_finished_successfully"), + }); + }, + ); + this.showSuccess( + (0, i18n_1.t)("vscode.git.branch_has_been_finished", { currentBranch }), + ); + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.git.failed_finish_branch", { + error: String(error), + }), + ); } + } } exports.GitCommand = GitCommand; -//# sourceMappingURL=GitCommand.js.map \ No newline at end of file +//# sourceMappingURL=GitCommand.js.map diff --git a/packages/vscode-extension/out/commands/InitCommand.js b/packages/vscode-extension/out/commands/InitCommand.js index 8339fda9..5cb9362f 100644 --- a/packages/vscode-extension/out/commands/InitCommand.js +++ b/packages/vscode-extension/out/commands/InitCommand.js @@ -1,27 +1,48 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InitCommand = void 0; const vscode = __importStar(require("vscode")); @@ -29,123 +50,165 @@ const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); const path = __importStar(require("path")); class InitCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - // Prompt for project details - const projectName = await vscode.window.showInputBox({ - prompt: (0, i18n_1.t)("vscode.init.enter_project_name"), - placeHolder: (0, i18n_1.t)("vscode.init.my_awesome_project"), - validateInput: (value) => { - if (!value) { - return (0, i18n_1.t)("vscode.init.project_name_required"); - } - if (!/^[a-zA-Z0-9-_]+$/.test(value)) { - return (0, i18n_1.t)("vscode.init.project_name_invalid"); - } - return null; - }, - }); - if (!projectName) { - return; - } - const description = await vscode.window.showInputBox({ - prompt: (0, i18n_1.t)("vscode.init.enter_project_description"), - placeHolder: (0, i18n_1.t)("vscode.init.brief_description"), - }); - const authorName = await vscode.window.showInputBox({ - prompt: (0, i18n_1.t)("vscode.init.enter_author_name"), - placeHolder: (0, i18n_1.t)("vscode.init.your_name"), - value: await this.getGitUserName(), - }); - const stack = await vscode.window.showQuickPick([ - { label: "node-ts", description: (0, i18n_1.t)("vscode.init.stacks.node_ts") }, - { label: "react", description: (0, i18n_1.t)("vscode.init.stacks.react") }, - { label: "vue", description: (0, i18n_1.t)("vscode.init.stacks.vue") }, - { label: "angular", description: (0, i18n_1.t)("vscode.init.stacks.angular") }, - { label: "python", description: (0, i18n_1.t)("vscode.init.stacks.python") }, - { label: "java", description: (0, i18n_1.t)("vscode.init.stacks.java") }, - { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, - { label: "php", description: (0, i18n_1.t)("vscode.init.stacks.php") }, - ], { - placeHolder: (0, i18n_1.t)("vscode.init.select_project_stack"), - }); - if (!stack) { - return; - } - // Get workspace folder or ask for project location - const workspaceFolder = this.getCurrentWorkspaceFolder(); - let projectPath; - if (workspaceFolder) { - projectPath = path.join(workspaceFolder.uri.fsPath, projectName); - } - else { - const folderUris = await vscode.window.showOpenDialog({ - canSelectFolders: true, - canSelectFiles: false, - canSelectMany: false, - openLabel: (0, i18n_1.t)("vscode.init.select_project_location"), - }); - if (!folderUris || folderUris.length === 0) { - return; - } - projectPath = path.join(folderUris[0].fsPath, projectName); - } - // Check if directory exists - try { - await vscode.workspace.fs.stat(vscode.Uri.file(projectPath)); - const overwrite = await this.confirmAction((0, i18n_1.t)("vscode.init.directory_exists_overwrite", { projectName }), (0, i18n_1.t)("vscode.init.overwrite")); - if (!overwrite) { - return; - } - } - catch { - // Directory doesn't exist, which is fine - } - // Show progress - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.init.initializing_project", { projectName }), - cancellable: false, - }, async (progress) => { - progress.report({ - increment: 0, - message: (0, i18n_1.t)("vscode.init.setting_up_structure"), - }); - // Use StackCode CLI for initialization - const command = `npx @stackcode/cli init --name="${projectName}" --description="${description}" --author="${authorName}" --stack="${stack.label}" --path="${projectPath}"`; - progress.report({ - increment: 50, - message: (0, i18n_1.t)("vscode.init.running_stackcode_cli"), - }); - await this.runTerminalCommand(command); - progress.report({ - increment: 100, - message: (0, i18n_1.t)("vscode.init.project_initialized_successfully"), - }); - }); - // Ask if user wants to open the new project - const openProject = await vscode.window.showInformationMessage((0, i18n_1.t)("vscode.init.project_created_successfully", { projectName }), (0, i18n_1.t)("vscode.init.open_project"), (0, i18n_1.t)("vscode.init.later")); - if (openProject === (0, i18n_1.t)("vscode.init.open_project")) { - const uri = vscode.Uri.file(projectPath); - await vscode.commands.executeCommand("vscode.openFolder", uri, true); - } + async execute() { + try { + // Prompt for project details + const projectName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_project_name"), + placeHolder: (0, i18n_1.t)("vscode.init.my_awesome_project"), + validateInput: (value) => { + if (!value) { + return (0, i18n_1.t)("vscode.init.project_name_required"); + } + if (!/^[a-zA-Z0-9-_]+$/.test(value)) { + return (0, i18n_1.t)("vscode.init.project_name_invalid"); + } + return null; + }, + }); + if (!projectName) { + return; + } + const description = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_project_description"), + placeHolder: (0, i18n_1.t)("vscode.init.brief_description"), + }); + const authorName = await vscode.window.showInputBox({ + prompt: (0, i18n_1.t)("vscode.init.enter_author_name"), + placeHolder: (0, i18n_1.t)("vscode.init.your_name"), + value: await this.getGitUserName(), + }); + const stack = await vscode.window.showQuickPick( + [ + { + label: "node-ts", + description: (0, i18n_1.t)("vscode.init.stacks.node_ts"), + }, + { + label: "react", + description: (0, i18n_1.t)("vscode.init.stacks.react"), + }, + { + label: "vue", + description: (0, i18n_1.t)("vscode.init.stacks.vue"), + }, + { + label: "angular", + description: (0, i18n_1.t)("vscode.init.stacks.angular"), + }, + { + label: "python", + description: (0, i18n_1.t)("vscode.init.stacks.python"), + }, + { + label: "java", + description: (0, i18n_1.t)("vscode.init.stacks.java"), + }, + { label: "go", description: (0, i18n_1.t)("vscode.init.stacks.go") }, + { + label: "php", + description: (0, i18n_1.t)("vscode.init.stacks.php"), + }, + ], + { + placeHolder: (0, i18n_1.t)("vscode.init.select_project_stack"), + }, + ); + if (!stack) { + return; + } + // Get workspace folder or ask for project location + const workspaceFolder = this.getCurrentWorkspaceFolder(); + let projectPath; + if (workspaceFolder) { + projectPath = path.join(workspaceFolder.uri.fsPath, projectName); + } else { + const folderUris = await vscode.window.showOpenDialog({ + canSelectFolders: true, + canSelectFiles: false, + canSelectMany: false, + openLabel: (0, i18n_1.t)("vscode.init.select_project_location"), + }); + if (!folderUris || folderUris.length === 0) { + return; } - catch (error) { - this.showError((0, i18n_1.t)("vscode.init.failed_initialize_project", { error: String(error) })); + projectPath = path.join(folderUris[0].fsPath, projectName); + } + // Check if directory exists + try { + await vscode.workspace.fs.stat(vscode.Uri.file(projectPath)); + const overwrite = await this.confirmAction( + (0, i18n_1.t)("vscode.init.directory_exists_overwrite", { + projectName, + }), + (0, i18n_1.t)("vscode.init.overwrite"), + ); + if (!overwrite) { + return; } + } catch { + // Directory doesn't exist, which is fine + } + // Show progress + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.init.initializing_project", { + projectName, + }), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.init.setting_up_structure"), + }); + // Use StackCode CLI for initialization + const command = `npx @stackcode/cli init --name="${projectName}" --description="${description}" --author="${authorName}" --stack="${stack.label}" --path="${projectPath}"`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.init.running_stackcode_cli"), + }); + await this.runTerminalCommand(command); + progress.report({ + increment: 100, + message: (0, i18n_1.t)( + "vscode.init.project_initialized_successfully", + ), + }); + }, + ); + // Ask if user wants to open the new project + const openProject = await vscode.window.showInformationMessage( + (0, i18n_1.t)("vscode.init.project_created_successfully", { + projectName, + }), + (0, i18n_1.t)("vscode.init.open_project"), + (0, i18n_1.t)("vscode.init.later"), + ); + if (openProject === (0, i18n_1.t)("vscode.init.open_project")) { + const uri = vscode.Uri.file(projectPath); + await vscode.commands.executeCommand("vscode.openFolder", uri, true); + } + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.init.failed_initialize_project", { + error: String(error), + }), + ); } - async getGitUserName() { - try { - // Try to get git user name from workspace - const terminal = vscode.window.createTerminal({ name: "temp" }); - terminal.sendText("git config user.name"); - terminal.dispose(); - return ""; - } - catch { - return ""; - } + } + async getGitUserName() { + try { + // Try to get git user name from workspace + const terminal = vscode.window.createTerminal({ name: "temp" }); + terminal.sendText("git config user.name"); + terminal.dispose(); + return ""; + } catch { + return ""; } + } } exports.InitCommand = InitCommand; -//# sourceMappingURL=InitCommand.js.map \ No newline at end of file +//# sourceMappingURL=InitCommand.js.map diff --git a/packages/vscode-extension/out/commands/ReleaseCommand.js b/packages/vscode-extension/out/commands/ReleaseCommand.js index 63c3babe..44db95f3 100644 --- a/packages/vscode-extension/out/commands/ReleaseCommand.js +++ b/packages/vscode-extension/out/commands/ReleaseCommand.js @@ -1,62 +1,101 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReleaseCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); class ReleaseCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - const confirm = await this.confirmAction((0, i18n_1.t)("vscode.release.are_you_sure_create_release"), (0, i18n_1.t)("vscode.release.create_release")); - if (!confirm) { - return; - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.release.creating_release"), - cancellable: false, - }, async (progress) => { - progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.release.preparing_release") }); - // Use StackCode CLI for release - const command = `npx @stackcode/cli release`; - progress.report({ increment: 50, message: (0, i18n_1.t)("vscode.release.creating_release_message") }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: (0, i18n_1.t)("vscode.release.release_created") }); - }); - this.showSuccess((0, i18n_1.t)("vscode.release.release_process_started")); - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.release.failed_create_release", { error: String(error) })); - } + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + const confirm = await this.confirmAction( + (0, i18n_1.t)("vscode.release.are_you_sure_create_release"), + (0, i18n_1.t)("vscode.release.create_release"), + ); + if (!confirm) { + return; + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.release.creating_release"), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.release.preparing_release"), + }); + // Use StackCode CLI for release + const command = `npx @stackcode/cli release`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)("vscode.release.creating_release_message"), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.release.release_created"), + }); + }, + ); + this.showSuccess((0, i18n_1.t)("vscode.release.release_process_started")); + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.release.failed_create_release", { + error: String(error), + }), + ); } + } } exports.ReleaseCommand = ReleaseCommand; -//# sourceMappingURL=ReleaseCommand.js.map \ No newline at end of file +//# sourceMappingURL=ReleaseCommand.js.map diff --git a/packages/vscode-extension/out/commands/ValidateCommand.js b/packages/vscode-extension/out/commands/ValidateCommand.js index e609680d..34ff6500 100644 --- a/packages/vscode-extension/out/commands/ValidateCommand.js +++ b/packages/vscode-extension/out/commands/ValidateCommand.js @@ -1,61 +1,98 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ValidateCommand = void 0; const vscode = __importStar(require("vscode")); const BaseCommand_1 = require("./BaseCommand"); const i18n_1 = require("@stackcode/i18n"); class ValidateCommand extends BaseCommand_1.BaseCommand { - async execute() { - try { - const workspaceFolder = this.getCurrentWorkspaceFolder(); - if (!workspaceFolder) { - this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); - return; - } - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: (0, i18n_1.t)("vscode.validate.validating_project_structure"), - cancellable: false, - }, async (progress) => { - progress.report({ increment: 0, message: (0, i18n_1.t)("vscode.validate.running_validation") }); - // Use StackCode CLI for validation - const command = `npx @stackcode/cli validate`; - progress.report({ - increment: 50, - message: (0, i18n_1.t)("vscode.validate.checking_project_structure"), - }); - await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: (0, i18n_1.t)("vscode.validate.validation_completed") }); - }); - this.showSuccess((0, i18n_1.t)("vscode.validate.project_validation_completed")); - } - catch (error) { - this.showError((0, i18n_1.t)("vscode.validate.failed_validate_project", { error: String(error) })); - } + async execute() { + try { + const workspaceFolder = this.getCurrentWorkspaceFolder(); + if (!workspaceFolder) { + this.showError((0, i18n_1.t)("vscode.common.no_workspace_folder")); + return; + } + vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: (0, i18n_1.t)("vscode.validate.validating_project_structure"), + cancellable: false, + }, + async (progress) => { + progress.report({ + increment: 0, + message: (0, i18n_1.t)("vscode.validate.running_validation"), + }); + // Use StackCode CLI for validation + const command = `npx @stackcode/cli validate`; + progress.report({ + increment: 50, + message: (0, i18n_1.t)( + "vscode.validate.checking_project_structure", + ), + }); + await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); + progress.report({ + increment: 100, + message: (0, i18n_1.t)("vscode.validate.validation_completed"), + }); + }, + ); + this.showSuccess( + (0, i18n_1.t)("vscode.validate.project_validation_completed"), + ); + } catch (error) { + this.showError( + (0, i18n_1.t)("vscode.validate.failed_validate_project", { + error: String(error), + }), + ); } + } } exports.ValidateCommand = ValidateCommand; -//# sourceMappingURL=ValidateCommand.js.map \ No newline at end of file +//# sourceMappingURL=ValidateCommand.js.map diff --git a/packages/vscode-extension/out/config/ConfigurationManager.js b/packages/vscode-extension/out/config/ConfigurationManager.js index 51c03700..d7144191 100644 --- a/packages/vscode-extension/out/config/ConfigurationManager.js +++ b/packages/vscode-extension/out/config/ConfigurationManager.js @@ -1,64 +1,89 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationManager = void 0; const vscode = __importStar(require("vscode")); class ConfigurationManager { - constructor() { + constructor() { + this.configuration = vscode.workspace.getConfiguration("stackcode"); + // Listen for configuration changes + vscode.workspace.onDidChangeConfiguration((event) => { + if (event.affectsConfiguration("stackcode")) { this.configuration = vscode.workspace.getConfiguration("stackcode"); - // Listen for configuration changes - vscode.workspace.onDidChangeConfiguration((event) => { - if (event.affectsConfiguration("stackcode")) { - this.configuration = vscode.workspace.getConfiguration("stackcode"); - } - }); - } - get notificationsEnabled() { - return this.configuration.get("notifications.enabled", true); - } - get branchCheckEnabled() { - return this.configuration.get("notifications.branchCheck", true); - } - get commitCheckEnabled() { - return this.configuration.get("notifications.commitCheck", true); - } - get autoGenerateReadme() { - return this.configuration.get("autoGenerate.readme", false); - } - get autoGenerateGitignore() { - return this.configuration.get("autoGenerate.gitignore", true); - } - get defaultBranchType() { - return this.configuration.get("git.defaultBranchType", "feature"); - } - get dashboardAutoOpen() { - return this.configuration.get("dashboard.autoOpen", false); - } - async updateConfiguration(key, value) { - await this.configuration.update(key, value, vscode.ConfigurationTarget.Workspace); - } + } + }); + } + get notificationsEnabled() { + return this.configuration.get("notifications.enabled", true); + } + get branchCheckEnabled() { + return this.configuration.get("notifications.branchCheck", true); + } + get commitCheckEnabled() { + return this.configuration.get("notifications.commitCheck", true); + } + get autoGenerateReadme() { + return this.configuration.get("autoGenerate.readme", false); + } + get autoGenerateGitignore() { + return this.configuration.get("autoGenerate.gitignore", true); + } + get defaultBranchType() { + return this.configuration.get("git.defaultBranchType", "feature"); + } + get dashboardAutoOpen() { + return this.configuration.get("dashboard.autoOpen", false); + } + async updateConfiguration(key, value) { + await this.configuration.update( + key, + value, + vscode.ConfigurationTarget.Workspace, + ); + } } exports.ConfigurationManager = ConfigurationManager; -//# sourceMappingURL=ConfigurationManager.js.map \ No newline at end of file +//# sourceMappingURL=ConfigurationManager.js.map diff --git a/packages/vscode-extension/out/extension.js b/packages/vscode-extension/out/extension.js index b6b21ab3..13fc77b4 100644 --- a/packages/vscode-extension/out/extension.js +++ b/packages/vscode-extension/out/extension.js @@ -1,27 +1,48 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.deactivate = exports.activate = void 0; const vscode = __importStar(require("vscode")); @@ -53,85 +74,149 @@ let validateCommand; let releaseCommand; let configCommand; function activate(context) { - console.log("[StackCode] Extension is now active!"); - console.log("[StackCode] Workspace folders:", vscode.workspace.workspaceFolders?.length || 0); - console.log("[StackCode] Extension path:", context.extensionPath); - // Initialize configuration manager - configManager = new ConfigurationManager_1.ConfigurationManager(); - // Initialize notification manager - proactiveManager = new ProactiveNotificationManager_1.ProactiveNotificationManager(configManager); - // Initialize monitors - gitMonitor = new GitMonitor_1.GitMonitor(proactiveManager, configManager); - fileMonitor = new FileMonitor_1.FileMonitor(proactiveManager, configManager); - // Initialize providers - dashboardProvider = new DashboardProvider_1.DashboardProvider(context); - projectViewProvider = new ProjectViewProvider_1.ProjectViewProvider(context.workspaceState); - // Initialize commands - initCommand = new InitCommand_1.InitCommand(); - generateCommand = new GenerateCommand_1.GenerateCommand(); - gitCommand = new GitCommand_1.GitCommand(); - commitCommand = new CommitCommand_1.CommitCommand(); - validateCommand = new ValidateCommand_1.ValidateCommand(); - releaseCommand = new ReleaseCommand_1.ReleaseCommand(); - configCommand = new ConfigCommand_1.ConfigCommand(); - // Register webview providers - context.subscriptions.push(vscode.window.registerWebviewViewProvider("stackcode.dashboard", dashboardProvider), vscode.window.registerTreeDataProvider("stackcode.projectView", projectViewProvider)); - // Register all commands - const commands = [ - // Core functionality commands - vscode.commands.registerCommand("stackcode.init", () => initCommand.execute()), - vscode.commands.registerCommand("stackcode.generate.readme", () => generateCommand.generateReadme()), - vscode.commands.registerCommand("stackcode.generate.gitignore", () => generateCommand.generateGitignore()), - vscode.commands.registerCommand("stackcode.git.start", () => gitCommand.startBranch()), - vscode.commands.registerCommand("stackcode.git.finish", () => gitCommand.finishBranch()), - vscode.commands.registerCommand("stackcode.commit", () => commitCommand.execute()), - vscode.commands.registerCommand("stackcode.validate", () => validateCommand.execute()), - vscode.commands.registerCommand("stackcode.release", () => releaseCommand.execute()), - vscode.commands.registerCommand("stackcode.config", () => configCommand.execute()), - vscode.commands.registerCommand("stackcode.dashboard", () => dashboardProvider.show()), - // Legacy commands for backward compatibility - vscode.commands.registerCommand("stackcode.createBranch", () => gitCommand.startBranch()), - vscode.commands.registerCommand("stackcode.formatCommitMessage", () => commitCommand.execute()), - vscode.commands.registerCommand("stackcode.checkBestPractices", () => validateCommand.execute()), - // Project view commands - vscode.commands.registerCommand("stackcode.projectView.refresh", () => projectViewProvider.refresh()), - // Webview commands - vscode.commands.registerCommand("webviewReady", () => { - console.log("[StackCode] Webview is ready!"); - // Pode enviar dados iniciais aqui se necessário - }), - vscode.commands.registerCommand("stackcode.webview.init", () => initCommand.execute()), - vscode.commands.registerCommand("stackcode.webview.generate.readme", () => generateCommand.generateReadme()), - vscode.commands.registerCommand("stackcode.webview.generate.gitignore", () => generateCommand.generateGitignore()), - vscode.commands.registerCommand("stackcode.webview.git.start", () => gitCommand.startBranch()), - vscode.commands.registerCommand("stackcode.webview.commit", () => commitCommand.execute()), - vscode.commands.registerCommand("stackcode.webview.validate", () => validateCommand.execute()), - ]; - // Add all to context subscriptions for cleanup - context.subscriptions.push(...commands, gitMonitor, fileMonitor, proactiveManager, dashboardProvider); - // Start monitoring - gitMonitor.startMonitoring(); - fileMonitor.startMonitoring(); - // Auto-open dashboard if configured - if (configManager.dashboardAutoOpen) { - setTimeout(() => { - dashboardProvider.show(); - }, 1000); - } - // Show welcome message - proactiveManager.showWelcomeMessage(); + console.log("[StackCode] Extension is now active!"); + console.log( + "[StackCode] Workspace folders:", + vscode.workspace.workspaceFolders?.length || 0, + ); + console.log("[StackCode] Extension path:", context.extensionPath); + // Initialize configuration manager + configManager = new ConfigurationManager_1.ConfigurationManager(); + // Initialize notification manager + proactiveManager = + new ProactiveNotificationManager_1.ProactiveNotificationManager( + configManager, + ); + // Initialize monitors + gitMonitor = new GitMonitor_1.GitMonitor(proactiveManager, configManager); + fileMonitor = new FileMonitor_1.FileMonitor(proactiveManager, configManager); + // Initialize providers + dashboardProvider = new DashboardProvider_1.DashboardProvider(context); + projectViewProvider = new ProjectViewProvider_1.ProjectViewProvider( + context.workspaceState, + ); + // Initialize commands + initCommand = new InitCommand_1.InitCommand(); + generateCommand = new GenerateCommand_1.GenerateCommand(); + gitCommand = new GitCommand_1.GitCommand(); + commitCommand = new CommitCommand_1.CommitCommand(); + validateCommand = new ValidateCommand_1.ValidateCommand(); + releaseCommand = new ReleaseCommand_1.ReleaseCommand(); + configCommand = new ConfigCommand_1.ConfigCommand(); + // Register webview providers + context.subscriptions.push( + vscode.window.registerWebviewViewProvider( + "stackcode.dashboard", + dashboardProvider, + ), + vscode.window.registerTreeDataProvider( + "stackcode.projectView", + projectViewProvider, + ), + ); + // Register all commands + const commands = [ + // Core functionality commands + vscode.commands.registerCommand("stackcode.init", () => + initCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.generate.readme", () => + generateCommand.generateReadme(), + ), + vscode.commands.registerCommand("stackcode.generate.gitignore", () => + generateCommand.generateGitignore(), + ), + vscode.commands.registerCommand("stackcode.git.start", () => + gitCommand.startBranch(), + ), + vscode.commands.registerCommand("stackcode.git.finish", () => + gitCommand.finishBranch(), + ), + vscode.commands.registerCommand("stackcode.commit", () => + commitCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.validate", () => + validateCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.release", () => + releaseCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.config", () => + configCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.dashboard", () => + dashboardProvider.show(), + ), + // Legacy commands for backward compatibility + vscode.commands.registerCommand("stackcode.createBranch", () => + gitCommand.startBranch(), + ), + vscode.commands.registerCommand("stackcode.formatCommitMessage", () => + commitCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.checkBestPractices", () => + validateCommand.execute(), + ), + // Project view commands + vscode.commands.registerCommand("stackcode.projectView.refresh", () => + projectViewProvider.refresh(), + ), + // Webview commands + vscode.commands.registerCommand("webviewReady", () => { + console.log("[StackCode] Webview is ready!"); + // Pode enviar dados iniciais aqui se necessário + }), + vscode.commands.registerCommand("stackcode.webview.init", () => + initCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.webview.generate.readme", () => + generateCommand.generateReadme(), + ), + vscode.commands.registerCommand( + "stackcode.webview.generate.gitignore", + () => generateCommand.generateGitignore(), + ), + vscode.commands.registerCommand("stackcode.webview.git.start", () => + gitCommand.startBranch(), + ), + vscode.commands.registerCommand("stackcode.webview.commit", () => + commitCommand.execute(), + ), + vscode.commands.registerCommand("stackcode.webview.validate", () => + validateCommand.execute(), + ), + ]; + // Add all to context subscriptions for cleanup + context.subscriptions.push( + ...commands, + gitMonitor, + fileMonitor, + proactiveManager, + dashboardProvider, + ); + // Start monitoring + gitMonitor.startMonitoring(); + fileMonitor.startMonitoring(); + // Auto-open dashboard if configured + if (configManager.dashboardAutoOpen) { + setTimeout(() => { + dashboardProvider.show(); + }, 1000); + } + // Show welcome message + proactiveManager.showWelcomeMessage(); } exports.activate = activate; function deactivate() { - if (gitMonitor) { - gitMonitor.dispose(); - } - if (fileMonitor) { - fileMonitor.dispose(); - } - if (proactiveManager) { - proactiveManager.dispose(); - } + if (gitMonitor) { + gitMonitor.dispose(); + } + if (fileMonitor) { + fileMonitor.dispose(); + } + if (proactiveManager) { + proactiveManager.dispose(); + } } exports.deactivate = deactivate; -//# sourceMappingURL=extension.js.map \ No newline at end of file +//# sourceMappingURL=extension.js.map diff --git a/packages/vscode-extension/out/monitors/FileMonitor.js b/packages/vscode-extension/out/monitors/FileMonitor.js index e99ffed3..1d152b2f 100644 --- a/packages/vscode-extension/out/monitors/FileMonitor.js +++ b/packages/vscode-extension/out/monitors/FileMonitor.js @@ -1,138 +1,183 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileMonitor = void 0; const vscode = __importStar(require("vscode")); const i18n_1 = require("@stackcode/i18n"); class FileMonitor { - constructor(proactiveManager, configManager) { - this.disposables = []; - this.processedFiles = new Set(); - this.proactiveManager = proactiveManager; - this.configManager = configManager; - } - startMonitoring() { - // Monitor file creation - this.disposables.push(vscode.workspace.onDidCreateFiles((event) => { - for (const file of event.files) { - this.handleFileCreation(file); - } - })); - // Monitor file changes - this.disposables.push(vscode.workspace.onDidChangeTextDocument((event) => { - this.handleFileChange(event); - })); - // Monitor when files are opened - this.disposables.push(vscode.window.onDidChangeActiveTextEditor((editor) => { - if (editor) { - this.handleFileOpen(editor.document.uri); - } - })); - } - async handleFileCreation(fileUri) { - if (!this.configManager.notificationsEnabled) { - return; - } - const fileName = fileUri.path.split("/").pop() || ""; - const fileKey = `${fileUri.toString()}-created`; - if (this.processedFiles.has(fileKey)) { - return; + constructor(proactiveManager, configManager) { + this.disposables = []; + this.processedFiles = new Set(); + this.proactiveManager = proactiveManager; + this.configManager = configManager; + } + startMonitoring() { + // Monitor file creation + this.disposables.push( + vscode.workspace.onDidCreateFiles((event) => { + for (const file of event.files) { + this.handleFileCreation(file); } - this.processedFiles.add(fileKey); - // Suggest generating comprehensive files - if (["README.md", ".gitignore"].includes(fileName)) { - await this.proactiveManager.showFileCreationSuggestion(fileName); + }), + ); + // Monitor file changes + this.disposables.push( + vscode.workspace.onDidChangeTextDocument((event) => { + this.handleFileChange(event); + }), + ); + // Monitor when files are opened + this.disposables.push( + vscode.window.onDidChangeActiveTextEditor((editor) => { + if (editor) { + this.handleFileOpen(editor.document.uri); } + }), + ); + } + async handleFileCreation(fileUri) { + if (!this.configManager.notificationsEnabled) { + return; } - async handleFileChange(event) { - const document = event.document; - // Skip if not a git commit message - if (!document.fileName.includes("COMMIT_EDITMSG")) { - return; - } - const content = document.getText(); - if (content.trim()) { - await this.proactiveManager.showCommitMessageWarning(content); - } + const fileName = fileUri.path.split("/").pop() || ""; + const fileKey = `${fileUri.toString()}-created`; + if (this.processedFiles.has(fileKey)) { + return; } - async handleFileOpen(fileUri) { - const fileName = fileUri.path.split("/").pop() || ""; - const fileKey = `${fileUri.toString()}-opened`; - if (this.processedFiles.has(fileKey)) { - return; - } - this.processedFiles.add(fileKey); - // Check for missing important files when opening project files - if (fileName.endsWith(".js") || - fileName.endsWith(".ts") || - fileName.endsWith(".json")) { - await this.checkProjectStructure(); - } + this.processedFiles.add(fileKey); + // Suggest generating comprehensive files + if (["README.md", ".gitignore"].includes(fileName)) { + await this.proactiveManager.showFileCreationSuggestion(fileName); } - async checkProjectStructure() { - if (!this.configManager.notificationsEnabled) { - return; - } - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (!workspaceFolder) { - return; - } - try { - const files = await vscode.workspace.fs.readDirectory(workspaceFolder.uri); - const fileNames = files.map(([name]) => name); - const missingFiles = []; - if (!fileNames.includes("README.md")) { - missingFiles.push("README.md"); - } - if (!fileNames.includes(".gitignore")) { - missingFiles.push(".gitignore"); - } - if (missingFiles.length > 0 && Math.random() < 0.3) { - // Show suggestion 30% of the time - const message = (0, i18n_1.t)("vscode.common.project_missing_files", { missingFiles: missingFiles.join(", ") }); - const action = await vscode.window.showInformationMessage(message, (0, i18n_1.t)("vscode.common.generate_files"), (0, i18n_1.t)("vscode.common.not_now"), (0, i18n_1.t)("vscode.common.dont_show_again")); - if (action === (0, i18n_1.t)("vscode.common.generate_files")) { - // TODO: Implement file generation - vscode.window.showInformationMessage((0, i18n_1.t)("vscode.common.file_generation_available_soon")); - } - else if (action === (0, i18n_1.t)("vscode.common.dont_show_again")) { - await this.configManager.updateConfiguration("notifications.enabled", false); - } - } - } - catch (error) { - // Use proper VS Code logging instead of console.log - const outputChannel = vscode.window.createOutputChannel("StackCode"); - outputChannel.appendLine((0, i18n_1.t)("vscode.common.error_checking_project_structure", { error: String(error) })); - } + } + async handleFileChange(event) { + const document = event.document; + // Skip if not a git commit message + if (!document.fileName.includes("COMMIT_EDITMSG")) { + return; + } + const content = document.getText(); + if (content.trim()) { + await this.proactiveManager.showCommitMessageWarning(content); + } + } + async handleFileOpen(fileUri) { + const fileName = fileUri.path.split("/").pop() || ""; + const fileKey = `${fileUri.toString()}-opened`; + if (this.processedFiles.has(fileKey)) { + return; } - dispose() { - this.disposables.forEach((d) => d.dispose()); - this.disposables = []; - this.processedFiles.clear(); + this.processedFiles.add(fileKey); + // Check for missing important files when opening project files + if ( + fileName.endsWith(".js") || + fileName.endsWith(".ts") || + fileName.endsWith(".json") + ) { + await this.checkProjectStructure(); + } + } + async checkProjectStructure() { + if (!this.configManager.notificationsEnabled) { + return; + } + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (!workspaceFolder) { + return; + } + try { + const files = await vscode.workspace.fs.readDirectory( + workspaceFolder.uri, + ); + const fileNames = files.map(([name]) => name); + const missingFiles = []; + if (!fileNames.includes("README.md")) { + missingFiles.push("README.md"); + } + if (!fileNames.includes(".gitignore")) { + missingFiles.push(".gitignore"); + } + if (missingFiles.length > 0 && Math.random() < 0.3) { + // Show suggestion 30% of the time + const message = (0, i18n_1.t)("vscode.common.project_missing_files", { + missingFiles: missingFiles.join(", "), + }); + const action = await vscode.window.showInformationMessage( + message, + (0, i18n_1.t)("vscode.common.generate_files"), + (0, i18n_1.t)("vscode.common.not_now"), + (0, i18n_1.t)("vscode.common.dont_show_again"), + ); + if (action === (0, i18n_1.t)("vscode.common.generate_files")) { + // TODO: Implement file generation + vscode.window.showInformationMessage( + (0, i18n_1.t)("vscode.common.file_generation_available_soon"), + ); + } else if (action === (0, i18n_1.t)("vscode.common.dont_show_again")) { + await this.configManager.updateConfiguration( + "notifications.enabled", + false, + ); + } + } + } catch (error) { + // Use proper VS Code logging instead of console.log + const outputChannel = vscode.window.createOutputChannel("StackCode"); + outputChannel.appendLine( + (0, i18n_1.t)("vscode.common.error_checking_project_structure", { + error: String(error), + }), + ); } + } + dispose() { + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + this.processedFiles.clear(); + } } exports.FileMonitor = FileMonitor; -//# sourceMappingURL=FileMonitor.js.map \ No newline at end of file +//# sourceMappingURL=FileMonitor.js.map diff --git a/packages/vscode-extension/out/monitors/GitMonitor.js b/packages/vscode-extension/out/monitors/GitMonitor.js index 078f0430..4cd5cbbe 100644 --- a/packages/vscode-extension/out/monitors/GitMonitor.js +++ b/packages/vscode-extension/out/monitors/GitMonitor.js @@ -1,190 +1,224 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GitMonitor = void 0; const vscode = __importStar(require("vscode")); class GitMonitor { - constructor(proactiveManager, configManager) { - this.disposables = []; - this.proactiveManager = proactiveManager; - this.configManager = configManager; + constructor(proactiveManager, configManager) { + this.disposables = []; + this.proactiveManager = proactiveManager; + this.configManager = configManager; + } + startMonitoring() { + // Monitor git extension state changes + const gitExtension = vscode.extensions.getExtension("vscode.git"); + if (gitExtension) { + if (gitExtension.isActive) { + this.setupGitMonitoring(); + } else { + gitExtension.activate().then(() => { + this.setupGitMonitoring(); + }); + } } - startMonitoring() { - // Monitor git extension state changes - const gitExtension = vscode.extensions.getExtension("vscode.git"); - if (gitExtension) { - if (gitExtension.isActive) { - this.setupGitMonitoring(); - } - else { - gitExtension.activate().then(() => { - this.setupGitMonitoring(); - }); - } - } - // Monitor workspace folder changes - this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(() => { + // Monitor workspace folder changes + this.disposables.push( + vscode.workspace.onDidChangeWorkspaceFolders(() => { + this.checkCurrentBranch(); + }), + ); + // Initial check + setTimeout(() => { + this.checkCurrentBranch(); + }, 2000); + } + setupGitMonitoring() { + try { + const git = vscode.extensions.getExtension("vscode.git")?.exports; + if (git) { + const gitAPI = git.getAPI(1); + this.disposables.push( + gitAPI.onDidChangeState(() => { this.checkCurrentBranch(); - })); - // Initial check - setTimeout(() => { + }), + ); + this.disposables.push( + gitAPI.onDidOpenRepository(() => { this.checkCurrentBranch(); - }, 2000); + }), + ); + } + } catch (error) { + console.log("Failed to setup git monitoring:", error); } - setupGitMonitoring() { - try { - const git = vscode.extensions.getExtension("vscode.git")?.exports; - if (git) { - const gitAPI = git.getAPI(1); - this.disposables.push(gitAPI.onDidChangeState(() => { - this.checkCurrentBranch(); - })); - this.disposables.push(gitAPI.onDidOpenRepository(() => { - this.checkCurrentBranch(); - })); - } - } - catch (error) { - console.log("Failed to setup git monitoring:", error); + } + async checkCurrentBranch() { + try { + const git = vscode.extensions.getExtension("vscode.git")?.exports; + if (git) { + const gitAPI = git.getAPI(1); + const repo = gitAPI.repositories[0]; + if (repo && repo.state.HEAD) { + const currentBranch = repo.state.HEAD.name; + if (currentBranch && currentBranch !== this.lastBranch) { + this.lastBranch = currentBranch; + await this.proactiveManager.showBranchWarning(currentBranch); + } } + } + } catch (error) { + console.log("Error checking current branch:", error); } - async checkCurrentBranch() { - try { - const git = vscode.extensions.getExtension("vscode.git")?.exports; - if (git) { - const gitAPI = git.getAPI(1); - const repo = gitAPI.repositories[0]; - if (repo && repo.state.HEAD) { - const currentBranch = repo.state.HEAD.name; - if (currentBranch && currentBranch !== this.lastBranch) { - this.lastBranch = currentBranch; - await this.proactiveManager.showBranchWarning(currentBranch); - } - } - } + } + async showCreateBranchDialog() { + const branchName = await vscode.window.showInputBox({ + prompt: "Enter the name for the new branch", + placeHolder: "feature/new-feature", + validateInput: (value) => { + if (!value) { + return "Branch name is required"; } - catch (error) { - console.log("Error checking current branch:", error); + if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { + return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; } - } - async showCreateBranchDialog() { - const branchName = await vscode.window.showInputBox({ - prompt: "Enter the name for the new branch", - placeHolder: "feature/new-feature", - validateInput: (value) => { - if (!value) { - return "Branch name is required"; - } - if (!/^[a-zA-Z0-9/_-]+$/.test(value)) { - return "Branch name can only contain letters, numbers, hyphens, underscores and slashes"; - } - return null; - }, - }); - if (branchName) { - const branchType = await vscode.window.showQuickPick([ - { label: "feature", description: "A new feature branch" }, - { label: "bugfix", description: "A bug fix branch" }, - { label: "hotfix", description: "A hotfix branch" }, - { label: "release", description: "A release branch" }, - ], { - placeHolder: "Select branch type", - }); - if (branchType) { - const fullBranchName = branchName.includes("/") - ? branchName - : `${branchType.label}/${branchName}`; - try { - const terminal = vscode.window.createTerminal("StackCode Git"); - terminal.sendText(`git checkout -b ${fullBranchName}`); - terminal.show(); - vscode.window.showInformationMessage(`✅ Created and switched to branch: ${fullBranchName}`); - } - catch (error) { - vscode.window.showErrorMessage(`Failed to create branch: ${error}`); - } - } + return null; + }, + }); + if (branchName) { + const branchType = await vscode.window.showQuickPick( + [ + { label: "feature", description: "A new feature branch" }, + { label: "bugfix", description: "A bug fix branch" }, + { label: "hotfix", description: "A hotfix branch" }, + { label: "release", description: "A release branch" }, + ], + { + placeHolder: "Select branch type", + }, + ); + if (branchType) { + const fullBranchName = branchName.includes("/") + ? branchName + : `${branchType.label}/${branchName}`; + try { + const terminal = vscode.window.createTerminal("StackCode Git"); + terminal.sendText(`git checkout -b ${fullBranchName}`); + terminal.show(); + vscode.window.showInformationMessage( + `✅ Created and switched to branch: ${fullBranchName}`, + ); + } catch (error) { + vscode.window.showErrorMessage(`Failed to create branch: ${error}`); } + } } - async showCommitMessageDialog() { - const commitType = await vscode.window.showQuickPick([ - { label: "feat", description: "A new feature" }, - { label: "fix", description: "A bug fix" }, - { label: "docs", description: "Documentation changes" }, - { label: "style", description: "Code style changes (formatting, etc)" }, - { label: "refactor", description: "Code refactoring" }, - { label: "perf", description: "Performance improvements" }, - { label: "test", description: "Adding or updating tests" }, - { label: "chore", description: "Maintenance tasks" }, - { label: "build", description: "Build system changes" }, - { label: "ci", description: "CI/CD changes" }, - ], { - placeHolder: "Select commit type", - }); - if (!commitType) { - return; - } - const scope = await vscode.window.showInputBox({ - prompt: "Enter scope (optional)", - placeHolder: "auth, api, ui, etc.", - }); - const description = await vscode.window.showInputBox({ - prompt: "Enter commit description", - placeHolder: "add user authentication", - validateInput: (value) => { - if (!value) { - return "Description is required"; - } - if (value.length > 50) { - return "Description should be 50 characters or less"; - } - return null; - }, - }); - if (!description) { - return; + } + async showCommitMessageDialog() { + const commitType = await vscode.window.showQuickPick( + [ + { label: "feat", description: "A new feature" }, + { label: "fix", description: "A bug fix" }, + { label: "docs", description: "Documentation changes" }, + { label: "style", description: "Code style changes (formatting, etc)" }, + { label: "refactor", description: "Code refactoring" }, + { label: "perf", description: "Performance improvements" }, + { label: "test", description: "Adding or updating tests" }, + { label: "chore", description: "Maintenance tasks" }, + { label: "build", description: "Build system changes" }, + { label: "ci", description: "CI/CD changes" }, + ], + { + placeHolder: "Select commit type", + }, + ); + if (!commitType) { + return; + } + const scope = await vscode.window.showInputBox({ + prompt: "Enter scope (optional)", + placeHolder: "auth, api, ui, etc.", + }); + const description = await vscode.window.showInputBox({ + prompt: "Enter commit description", + placeHolder: "add user authentication", + validateInput: (value) => { + if (!value) { + return "Description is required"; } - let commitMessage = commitType.label; - if (scope) { - commitMessage += `(${scope})`; + if (value.length > 50) { + return "Description should be 50 characters or less"; } - commitMessage += `: ${description}`; - // Copy to clipboard - await vscode.env.clipboard.writeText(commitMessage); - vscode.window - .showInformationMessage(`📋 Commit message copied to clipboard: ${commitMessage}`, "Open Git Panel") - .then((action) => { - if (action === "Open Git Panel") { - vscode.commands.executeCommand("workbench.view.scm"); - } - }); + return null; + }, + }); + if (!description) { + return; } - dispose() { - this.disposables.forEach((d) => d.dispose()); - this.disposables = []; + let commitMessage = commitType.label; + if (scope) { + commitMessage += `(${scope})`; } + commitMessage += `: ${description}`; + // Copy to clipboard + await vscode.env.clipboard.writeText(commitMessage); + vscode.window + .showInformationMessage( + `📋 Commit message copied to clipboard: ${commitMessage}`, + "Open Git Panel", + ) + .then((action) => { + if (action === "Open Git Panel") { + vscode.commands.executeCommand("workbench.view.scm"); + } + }); + } + dispose() { + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + } } exports.GitMonitor = GitMonitor; -//# sourceMappingURL=GitMonitor.js.map \ No newline at end of file +//# sourceMappingURL=GitMonitor.js.map diff --git a/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js b/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js index ee37fa34..4a6d94f3 100644 --- a/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js +++ b/packages/vscode-extension/out/notifications/ProactiveNotificationManager.js @@ -1,207 +1,268 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProactiveNotificationManager = void 0; const vscode = __importStar(require("vscode")); class ProactiveNotificationManager { - constructor(configManager) { - this.notificationQueue = []; - this.configManager = configManager; + constructor(configManager) { + this.notificationQueue = []; + this.configManager = configManager; + } + async showWelcomeMessage() { + if (!this.configManager.notificationsEnabled) { + return; } - async showWelcomeMessage() { - if (!this.configManager.notificationsEnabled) { - return; - } - const action = await vscode.window.showInformationMessage("🚀 StackCode is now active! Get proactive suggestions to improve your development workflow.", "Learn More", "Settings"); - if (action === "Learn More") { - vscode.env.openExternal(vscode.Uri.parse("https://github.com/YagoBorba/StackCode")); - } - else if (action === "Settings") { - vscode.commands.executeCommand("workbench.action.openSettings", "stackcode"); - } + const action = await vscode.window.showInformationMessage( + "🚀 StackCode is now active! Get proactive suggestions to improve your development workflow.", + "Learn More", + "Settings", + ); + if (action === "Learn More") { + vscode.env.openExternal( + vscode.Uri.parse("https://github.com/YagoBorba/StackCode"), + ); + } else if (action === "Settings") { + vscode.commands.executeCommand( + "workbench.action.openSettings", + "stackcode", + ); } - async showBranchWarning(currentBranch) { - if (!this.configManager.branchCheckEnabled) { - return; - } - const isMainBranch = ["main", "master", "develop"].includes(currentBranch); - if (isMainBranch) { - const action = await vscode.window.showWarningMessage(`⚠️ You are working on the ${currentBranch} branch. Would you like to create a new feature branch?`, "Create Branch", "Continue", "Don't Show Again"); - if (action === "Create Branch") { - vscode.commands.executeCommand("stackcode.createBranch"); - } - else if (action === "Don't Show Again") { - await this.configManager.updateConfiguration("notifications.branchCheck", false); - } - } + } + async showBranchWarning(currentBranch) { + if (!this.configManager.branchCheckEnabled) { + return; } - async showCommitMessageWarning(message) { - if (!this.configManager.commitCheckEnabled) { - return; - } - const isConventional = this.isConventionalCommit(message); - if (!isConventional) { - const action = await vscode.window.showWarningMessage("💬 We detected you are trying to commit without a conventional message. Would you like help formatting it?", "Format Message", "Continue", "Learn More"); - if (action === "Format Message") { - vscode.commands.executeCommand("stackcode.formatCommitMessage"); - } - else if (action === "Learn More") { - vscode.env.openExternal(vscode.Uri.parse("https://conventionalcommits.org/")); - } - } - } - async showFileCreationSuggestion(fileName) { - if (!this.configManager.notificationsEnabled) { - return; - } - if (fileName === "README.md") { - const action = await vscode.window.showInformationMessage("📝 Would you like to generate a comprehensive README.md using StackCode templates?", "Generate README", "Not Now"); - if (action === "Generate README") { - // TODO: Implement README generation - vscode.window.showInformationMessage("README generation will be available soon!"); - } - } - else if (fileName === ".gitignore") { - const action = await vscode.window.showInformationMessage("🚫 Would you like to generate a .gitignore file based on your project type?", "Generate .gitignore", "Not Now"); - if (action === "Generate .gitignore") { - // TODO: Implement .gitignore generation - vscode.window.showInformationMessage(".gitignore generation will be available soon!"); - } - } + const isMainBranch = ["main", "master", "develop"].includes(currentBranch); + if (isMainBranch) { + const action = await vscode.window.showWarningMessage( + `⚠️ You are working on the ${currentBranch} branch. Would you like to create a new feature branch?`, + "Create Branch", + "Continue", + "Don't Show Again", + ); + if (action === "Create Branch") { + vscode.commands.executeCommand("stackcode.createBranch"); + } else if (action === "Don't Show Again") { + await this.configManager.updateConfiguration( + "notifications.branchCheck", + false, + ); + } } - async runFullBestPracticesCheck() { - const issues = []; - // Check if working on main branch - try { - const gitExtension = vscode.extensions.getExtension("vscode.git")?.exports; - if (gitExtension) { - const repo = gitExtension.getAPI(1).repositories[0]; - if (repo && - ["main", "master", "develop"].includes(repo.state.HEAD?.name || "")) { - issues.push("Working on main/develop branch"); - } - } - } - catch (error) { - // Git extension not available or error accessing it - console.log("Git extension error:", error); - } - // Check for missing files - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (workspaceFolder) { - const files = await vscode.workspace.fs.readDirectory(workspaceFolder.uri); - const fileNames = files.map(([name]) => name); - if (!fileNames.includes("README.md")) { - issues.push("Missing README.md file"); - } - if (!fileNames.includes(".gitignore")) { - issues.push("Missing .gitignore file"); - } - } - if (issues.length === 0) { - vscode.window.showInformationMessage("✅ All best practices checks passed!"); - } - else { - const message = `Found ${issues.length} potential improvements:\n${issues.map((issue) => `• ${issue}`).join("\n")}`; - vscode.window.showWarningMessage(message, "Fix Issues"); - } + } + async showCommitMessageWarning(message) { + if (!this.configManager.commitCheckEnabled) { + return; } - isConventionalCommit(message) { - const conventionalPattern = /^(feat|fix|docs|style|refactor|perf|test|chore|build|ci)(\(.+\))?: .+/; - return conventionalPattern.test(message); + const isConventional = this.isConventionalCommit(message); + if (!isConventional) { + const action = await vscode.window.showWarningMessage( + "💬 We detected you are trying to commit without a conventional message. Would you like help formatting it?", + "Format Message", + "Continue", + "Learn More", + ); + if (action === "Format Message") { + vscode.commands.executeCommand("stackcode.formatCommitMessage"); + } else if (action === "Learn More") { + vscode.env.openExternal( + vscode.Uri.parse("https://conventionalcommits.org/"), + ); + } } - async handleApplyFix(message) { - // Enhanced fix handling with specific actions - if (message.includes("README")) { - await vscode.commands.executeCommand("stackcode.generate.readme"); - } - else if (message.includes("gitignore")) { - await vscode.commands.executeCommand("stackcode.generate.gitignore"); - } - else if (message.includes("commit")) { - await vscode.commands.executeCommand("stackcode.commit"); - } - else { - await vscode.commands.executeCommand("stackcode.validate"); - } + } + async showFileCreationSuggestion(fileName) { + if (!this.configManager.notificationsEnabled) { + return; } - async handleLearnMore(message) { - const learnMoreUrls = { - "conventional commits": "https://conventionalcommits.org/", - gitflow: "https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow", - readme: "https://www.makeareadme.com/", - "git best practices": "https://sethrobertson.github.io/GitBestPractices/", - }; - const topic = Object.keys(learnMoreUrls).find((key) => message.toLowerCase().includes(key)) || "git best practices"; - await vscode.env.openExternal(vscode.Uri.parse(learnMoreUrls[topic])); + if (fileName === "README.md") { + const action = await vscode.window.showInformationMessage( + "📝 Would you like to generate a comprehensive README.md using StackCode templates?", + "Generate README", + "Not Now", + ); + if (action === "Generate README") { + // TODO: Implement README generation + vscode.window.showInformationMessage( + "README generation will be available soon!", + ); + } + } else if (fileName === ".gitignore") { + const action = await vscode.window.showInformationMessage( + "🚫 Would you like to generate a .gitignore file based on your project type?", + "Generate .gitignore", + "Not Now", + ); + if (action === "Generate .gitignore") { + // TODO: Implement .gitignore generation + vscode.window.showInformationMessage( + ".gitignore generation will be available soon!", + ); + } } - async handleStartWorkflow(workflowType) { - switch (workflowType) { - case "feature": - await vscode.commands.executeCommand("stackcode.git.feature.start"); - break; - case "hotfix": - await vscode.commands.executeCommand("stackcode.git.hotfix.start"); - break; - case "release": - await vscode.commands.executeCommand("stackcode.release"); - break; - default: - await vscode.commands.executeCommand("stackcode.git.feature.start"); + } + async runFullBestPracticesCheck() { + const issues = []; + // Check if working on main branch + try { + const gitExtension = + vscode.extensions.getExtension("vscode.git")?.exports; + if (gitExtension) { + const repo = gitExtension.getAPI(1).repositories[0]; + if ( + repo && + ["main", "master", "develop"].includes(repo.state.HEAD?.name || "") + ) { + issues.push("Working on main/develop branch"); } + } + } catch (error) { + // Git extension not available or error accessing it + console.log("Git extension error:", error); } - async handleConfigureWorkflow() { - await vscode.commands.executeCommand("stackcode.config"); + // Check for missing files + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (workspaceFolder) { + const files = await vscode.workspace.fs.readDirectory( + workspaceFolder.uri, + ); + const fileNames = files.map(([name]) => name); + if (!fileNames.includes("README.md")) { + issues.push("Missing README.md file"); + } + if (!fileNames.includes(".gitignore")) { + issues.push("Missing .gitignore file"); + } } - async handleFixProjectIssue(issue) { - if (issue.includes("README")) { - await vscode.commands.executeCommand("stackcode.generate.readme"); - } - else if (issue.includes("gitignore")) { - await vscode.commands.executeCommand("stackcode.generate.gitignore"); - } - else { - await vscode.commands.executeCommand("stackcode.validate"); - } + if (issues.length === 0) { + vscode.window.showInformationMessage( + "✅ All best practices checks passed!", + ); + } else { + const message = `Found ${issues.length} potential improvements:\n${issues.map((issue) => `• ${issue}`).join("\n")}`; + vscode.window.showWarningMessage(message, "Fix Issues"); + } + } + isConventionalCommit(message) { + const conventionalPattern = + /^(feat|fix|docs|style|refactor|perf|test|chore|build|ci)(\(.+\))?: .+/; + return conventionalPattern.test(message); + } + async handleApplyFix(message) { + // Enhanced fix handling with specific actions + if (message.includes("README")) { + await vscode.commands.executeCommand("stackcode.generate.readme"); + } else if (message.includes("gitignore")) { + await vscode.commands.executeCommand("stackcode.generate.gitignore"); + } else if (message.includes("commit")) { + await vscode.commands.executeCommand("stackcode.commit"); + } else { + await vscode.commands.executeCommand("stackcode.validate"); } - async handleShowDetails(issue) { - const outputChannel = vscode.window.createOutputChannel("StackCode Details"); - outputChannel.appendLine(`=== Project Issue Details ===`); - outputChannel.appendLine(`Issue: ${issue}`); - outputChannel.appendLine(`Timestamp: ${new Date().toISOString()}`); - outputChannel.appendLine(`Workspace: ${vscode.workspace.name || "Unknown"}`); - outputChannel.appendLine(""); - outputChannel.appendLine("Suggested Actions:"); - outputChannel.appendLine("1. Run project validation"); - outputChannel.appendLine("2. Check project structure"); - outputChannel.appendLine("3. Review best practices"); - outputChannel.show(); + } + async handleLearnMore(message) { + const learnMoreUrls = { + "conventional commits": "https://conventionalcommits.org/", + gitflow: + "https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow", + readme: "https://www.makeareadme.com/", + "git best practices": "https://sethrobertson.github.io/GitBestPractices/", + }; + const topic = + Object.keys(learnMoreUrls).find((key) => + message.toLowerCase().includes(key), + ) || "git best practices"; + await vscode.env.openExternal(vscode.Uri.parse(learnMoreUrls[topic])); + } + async handleStartWorkflow(workflowType) { + switch (workflowType) { + case "feature": + await vscode.commands.executeCommand("stackcode.git.feature.start"); + break; + case "hotfix": + await vscode.commands.executeCommand("stackcode.git.hotfix.start"); + break; + case "release": + await vscode.commands.executeCommand("stackcode.release"); + break; + default: + await vscode.commands.executeCommand("stackcode.git.feature.start"); } - dispose() { - // Cleanup if needed + } + async handleConfigureWorkflow() { + await vscode.commands.executeCommand("stackcode.config"); + } + async handleFixProjectIssue(issue) { + if (issue.includes("README")) { + await vscode.commands.executeCommand("stackcode.generate.readme"); + } else if (issue.includes("gitignore")) { + await vscode.commands.executeCommand("stackcode.generate.gitignore"); + } else { + await vscode.commands.executeCommand("stackcode.validate"); } + } + async handleShowDetails(issue) { + const outputChannel = + vscode.window.createOutputChannel("StackCode Details"); + outputChannel.appendLine(`=== Project Issue Details ===`); + outputChannel.appendLine(`Issue: ${issue}`); + outputChannel.appendLine(`Timestamp: ${new Date().toISOString()}`); + outputChannel.appendLine( + `Workspace: ${vscode.workspace.name || "Unknown"}`, + ); + outputChannel.appendLine(""); + outputChannel.appendLine("Suggested Actions:"); + outputChannel.appendLine("1. Run project validation"); + outputChannel.appendLine("2. Check project structure"); + outputChannel.appendLine("3. Review best practices"); + outputChannel.show(); + } + dispose() { + // Cleanup if needed + } } exports.ProactiveNotificationManager = ProactiveNotificationManager; -//# sourceMappingURL=ProactiveNotificationManager.js.map \ No newline at end of file +//# sourceMappingURL=ProactiveNotificationManager.js.map diff --git a/packages/vscode-extension/out/providers/DashboardProvider.backup.js b/packages/vscode-extension/out/providers/DashboardProvider.backup.js index 077b3a06..ebf17cfa 100644 --- a/packages/vscode-extension/out/providers/DashboardProvider.backup.js +++ b/packages/vscode-extension/out/providers/DashboardProvider.backup.js @@ -1,160 +1,214 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DashboardProvider = void 0; const vscode = __importStar(require("vscode")); const path = __importStar(require("path")); const fs = __importStar(require("fs")); class DashboardProvider { - constructor(context) { - this._disposables = []; - this._extensionUri = context.extensionUri; - } - resolveWebviewView(webviewView, + constructor(context) { + this._disposables = []; + this._extensionUri = context.extensionUri; + } + resolveWebviewView( + webviewView, // eslint-disable-next-line @typescript-eslint/no-unused-vars - context, + context, // eslint-disable-next-line @typescript-eslint/no-unused-vars - token) { - this._view = webviewView; - webviewView.webview.options = { - enableScripts: true, - localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], - }; - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - webviewView.webview.onDidReceiveMessage(async (data) => { - console.log(`[StackCode] Received command from webview: ${data.type}`); - try { - // Tratar comandos específicos do webview - switch (data.type) { - case "webviewReady": - console.log("[StackCode] Webview reported ready, sending initial data"); - this.updateProjectStats(); - return; - case "refreshStats": - this.updateProjectStats(); - return; - default: - // Executar comando normal do VS Code - await vscode.commands.executeCommand(data.type, data.payload); - } - } - catch (error) { - console.error(`[StackCode] Error executing command ${data.type}:`, error); - this.sendMessage({ - type: "commandError", - payload: { - command: data.type, - error: error instanceof Error ? error.message : "Unknown error", - }, - }); - } - }, undefined, this._disposables); - // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately - this.updateProjectStats(); - } - sendMessage(message) { - if (this._view) { - this._view.webview.postMessage(message); + token, + ) { + this._view = webviewView; + webviewView.webview.options = { + enableScripts: true, + localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], + }; + webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); + webviewView.webview.onDidReceiveMessage( + async (data) => { + console.log(`[StackCode] Received command from webview: ${data.type}`); + try { + // Tratar comandos específicos do webview + switch (data.type) { + case "webviewReady": + console.log( + "[StackCode] Webview reported ready, sending initial data", + ); + this.updateProjectStats(); + return; + case "refreshStats": + this.updateProjectStats(); + return; + default: + // Executar comando normal do VS Code + await vscode.commands.executeCommand(data.type, data.payload); + } + } catch (error) { + console.error( + `[StackCode] Error executing command ${data.type}:`, + error, + ); + this.sendMessage({ + type: "commandError", + payload: { + command: data.type, + error: error instanceof Error ? error.message : "Unknown error", + }, + }); } + }, + undefined, + this._disposables, + ); + // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately + this.updateProjectStats(); + } + sendMessage(message) { + if (this._view) { + this._view.webview.postMessage(message); } - show() { - if (this._view) { - this._view.show?.(true); - } - else { - // If view is not created yet, trigger the creation by executing the show command - vscode.commands.executeCommand("workbench.view.extension.stackcode"); - } + } + show() { + if (this._view) { + this._view.show?.(true); + } else { + // If view is not created yet, trigger the creation by executing the show command + vscode.commands.executeCommand("workbench.view.extension.stackcode"); } - async updateProjectStats() { - if (!this._view) { - console.log("[StackCode] No view available for stats update"); - return; - } - const workspaceFolders = vscode.workspace.workspaceFolders; - console.log("[StackCode] Workspace folders:", workspaceFolders?.length || 0); - console.log("[StackCode] Workspace name:", vscode.workspace.name); - console.log("[StackCode] Workspace file:", vscode.workspace.workspaceFile?.toString()); - if (!workspaceFolders || workspaceFolders.length === 0) { - console.log("[StackCode] No workspace folders found, using alternative detection"); - // Fallback: usar informações do contexto da extensão - const extensionWorkspace = path.dirname(path.dirname(path.dirname(this._extensionUri.fsPath))); - console.log("[StackCode] Extension workspace path:", extensionWorkspace); - this.sendMessage({ - type: "updateStats", - payload: { - files: 0, - workspaceName: "StackCode (Debug)", - workspacePath: extensionWorkspace, - mode: "development", - }, - }); - return; - } - try { - const files = await vscode.workspace.findFiles("**/*", "**/node_modules/**", 1000); - console.log("[StackCode] Found files:", files.length); - this.sendMessage({ - type: "updateStats", - payload: { - files: files.length, - workspaceName: workspaceFolders[0].name, - workspacePath: workspaceFolders[0].uri.fsPath, - mode: "production", - }, - }); - } - catch (e) { - console.error("[StackCode] Error fetching project stats:", e); - this.sendMessage({ - type: "updateStats", - payload: { files: 0, error: "Failed to scan files" }, - }); - } + } + async updateProjectStats() { + if (!this._view) { + console.log("[StackCode] No view available for stats update"); + return; } - _getHtmlForWebview(webview) { - const nonce = getNonce(); - const buildPath = vscode.Uri.joinPath(this._extensionUri, "dist", "webview-ui"); - // Lê o manifest.json do Vite - const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); - console.log("[StackCode] Build path:", buildPath.fsPath); - console.log("[StackCode] Manifest path:", manifestPath); - console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); - try { - const manifestContent = fs.readFileSync(manifestPath, "utf-8"); - const manifest = JSON.parse(manifestContent); - console.log("[StackCode] Manifest content:", manifest); - // Pega os arquivos do manifest do Vite - const indexEntry = manifest["index.html"]; - const scriptFile = indexEntry.file; - const cssFiles = indexEntry.css || []; - const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(buildPath, scriptFile)); - const cssUris = cssFiles.map((cssFile) => webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile))); - console.log("[StackCode] Script URI:", scriptUri.toString()); - console.log("[StackCode] CSS URIs:", cssUris.map((uri) => uri.toString())); - return ` + const workspaceFolders = vscode.workspace.workspaceFolders; + console.log( + "[StackCode] Workspace folders:", + workspaceFolders?.length || 0, + ); + console.log("[StackCode] Workspace name:", vscode.workspace.name); + console.log( + "[StackCode] Workspace file:", + vscode.workspace.workspaceFile?.toString(), + ); + if (!workspaceFolders || workspaceFolders.length === 0) { + console.log( + "[StackCode] No workspace folders found, using alternative detection", + ); + // Fallback: usar informações do contexto da extensão + const extensionWorkspace = path.dirname( + path.dirname(path.dirname(this._extensionUri.fsPath)), + ); + console.log("[StackCode] Extension workspace path:", extensionWorkspace); + this.sendMessage({ + type: "updateStats", + payload: { + files: 0, + workspaceName: "StackCode (Debug)", + workspacePath: extensionWorkspace, + mode: "development", + }, + }); + return; + } + try { + const files = await vscode.workspace.findFiles( + "**/*", + "**/node_modules/**", + 1000, + ); + console.log("[StackCode] Found files:", files.length); + this.sendMessage({ + type: "updateStats", + payload: { + files: files.length, + workspaceName: workspaceFolders[0].name, + workspacePath: workspaceFolders[0].uri.fsPath, + mode: "production", + }, + }); + } catch (e) { + console.error("[StackCode] Error fetching project stats:", e); + this.sendMessage({ + type: "updateStats", + payload: { files: 0, error: "Failed to scan files" }, + }); + } + } + _getHtmlForWebview(webview) { + const nonce = getNonce(); + const buildPath = vscode.Uri.joinPath( + this._extensionUri, + "dist", + "webview-ui", + ); + // Lê o manifest.json do Vite + const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); + console.log("[StackCode] Build path:", buildPath.fsPath); + console.log("[StackCode] Manifest path:", manifestPath); + console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); + try { + const manifestContent = fs.readFileSync(manifestPath, "utf-8"); + const manifest = JSON.parse(manifestContent); + console.log("[StackCode] Manifest content:", manifest); + // Pega os arquivos do manifest do Vite + const indexEntry = manifest["index.html"]; + const scriptFile = indexEntry.file; + const cssFiles = indexEntry.css || []; + const scriptUri = webview.asWebviewUri( + vscode.Uri.joinPath(buildPath, scriptFile), + ); + const cssUris = cssFiles.map((cssFile) => + webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile)), + ); + console.log("[StackCode] Script URI:", scriptUri.toString()); + console.log( + "[StackCode] CSS URIs:", + cssUris.map((uri) => uri.toString()), + ); + return ` @@ -193,11 +247,10 @@ class DashboardProvider { `; - } - catch (error) { - console.error("[StackCode] Error reading manifest:", error); - // Fallback melhorado para desenvolvimento - return ` + } catch (error) { + console.error("[StackCode] Error reading manifest:", error); + // Fallback melhorado para desenvolvimento + return ` @@ -250,26 +303,27 @@ class DashboardProvider { `; - } } - // CORREÇÃO: Adicionando o método dispose para conformidade. - dispose() { - while (this._disposables.length) { - const x = this._disposables.pop(); - if (x) { - x.dispose(); - } - } + } + // CORREÇÃO: Adicionando o método dispose para conformidade. + dispose() { + while (this._disposables.length) { + const x = this._disposables.pop(); + if (x) { + x.dispose(); + } } + } } exports.DashboardProvider = DashboardProvider; DashboardProvider.viewType = "stackcode.dashboard"; function getNonce() { - let text = ""; - const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 32; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; + let text = ""; + const possible = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (let i = 0; i < 32; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; } -//# sourceMappingURL=DashboardProvider.backup.js.map \ No newline at end of file +//# sourceMappingURL=DashboardProvider.backup.js.map diff --git a/packages/vscode-extension/out/providers/DashboardProvider.js b/packages/vscode-extension/out/providers/DashboardProvider.js index a3ea15de..b44af57c 100644 --- a/packages/vscode-extension/out/providers/DashboardProvider.js +++ b/packages/vscode-extension/out/providers/DashboardProvider.js @@ -1,160 +1,214 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DashboardProvider = void 0; const vscode = __importStar(require("vscode")); const path = __importStar(require("path")); const fs = __importStar(require("fs")); class DashboardProvider { - constructor(context) { - this._disposables = []; - this._extensionUri = context.extensionUri; - } - resolveWebviewView(webviewView, + constructor(context) { + this._disposables = []; + this._extensionUri = context.extensionUri; + } + resolveWebviewView( + webviewView, // eslint-disable-next-line @typescript-eslint/no-unused-vars - context, + context, // eslint-disable-next-line @typescript-eslint/no-unused-vars - token) { - this._view = webviewView; - webviewView.webview.options = { - enableScripts: true, - localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], - }; - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - webviewView.webview.onDidReceiveMessage(async (data) => { - console.log(`[StackCode] Received command from webview: ${data.type}`); - try { - // Tratar comandos específicos do webview - switch (data.type) { - case "webviewReady": - console.log("[StackCode] Webview reported ready, sending initial data"); - this.updateProjectStats(); - return; - case "refreshStats": - this.updateProjectStats(); - return; - default: - // Executar comando normal do VS Code - await vscode.commands.executeCommand(data.type, data.payload); - } - } - catch (error) { - console.error(`[StackCode] Error executing command ${data.type}:`, error); - this.sendMessage({ - type: "commandError", - payload: { - command: data.type, - error: error instanceof Error ? error.message : "Unknown error", - }, - }); - } - }, undefined, this._disposables); - // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately - this.updateProjectStats(); - } - sendMessage(message) { - if (this._view) { - this._view.webview.postMessage(message); + token, + ) { + this._view = webviewView; + webviewView.webview.options = { + enableScripts: true, + localResourceRoots: [vscode.Uri.joinPath(this._extensionUri, "dist")], + }; + webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); + webviewView.webview.onDidReceiveMessage( + async (data) => { + console.log(`[StackCode] Received command from webview: ${data.type}`); + try { + // Tratar comandos específicos do webview + switch (data.type) { + case "webviewReady": + console.log( + "[StackCode] Webview reported ready, sending initial data", + ); + this.updateProjectStats(); + return; + case "refreshStats": + this.updateProjectStats(); + return; + default: + // Executar comando normal do VS Code + await vscode.commands.executeCommand(data.type, data.payload); + } + } catch (error) { + console.error( + `[StackCode] Error executing command ${data.type}:`, + error, + ); + this.sendMessage({ + type: "commandError", + payload: { + command: data.type, + error: error instanceof Error ? error.message : "Unknown error", + }, + }); } + }, + undefined, + this._disposables, + ); + // WebviewView doesn't have onDidBecomeVisible, so we'll update stats immediately + this.updateProjectStats(); + } + sendMessage(message) { + if (this._view) { + this._view.webview.postMessage(message); } - show() { - if (this._view) { - this._view.show?.(true); - } - else { - // If view is not created yet, trigger the creation by executing the show command - vscode.commands.executeCommand("workbench.view.extension.stackcode"); - } + } + show() { + if (this._view) { + this._view.show?.(true); + } else { + // If view is not created yet, trigger the creation by executing the show command + vscode.commands.executeCommand("workbench.view.extension.stackcode"); } - async updateProjectStats() { - if (!this._view) { - console.log("[StackCode] No view available for stats update"); - return; - } - const workspaceFolders = vscode.workspace.workspaceFolders; - console.log("[StackCode] Workspace folders:", workspaceFolders?.length || 0); - console.log("[StackCode] Workspace name:", vscode.workspace.name); - console.log("[StackCode] Workspace file:", vscode.workspace.workspaceFile?.toString()); - if (!workspaceFolders || workspaceFolders.length === 0) { - console.log("[StackCode] No workspace folders found, using alternative detection"); - // Fallback: usar informações do contexto da extensão - const extensionWorkspace = path.dirname(path.dirname(path.dirname(this._extensionUri.fsPath))); - console.log("[StackCode] Extension workspace path:", extensionWorkspace); - this.sendMessage({ - type: "updateStats", - payload: { - files: 0, - workspaceName: "StackCode (Debug)", - workspacePath: extensionWorkspace, - mode: "development", - }, - }); - return; - } - try { - const files = await vscode.workspace.findFiles("**/*", "**/node_modules/**", 1000); - console.log("[StackCode] Found files:", files.length); - this.sendMessage({ - type: "updateStats", - payload: { - files: files.length, - workspaceName: workspaceFolders[0].name, - workspacePath: workspaceFolders[0].uri.fsPath, - mode: "production", - }, - }); - } - catch (e) { - console.error("[StackCode] Error fetching project stats:", e); - this.sendMessage({ - type: "updateStats", - payload: { files: 0, error: "Failed to scan files" }, - }); - } + } + async updateProjectStats() { + if (!this._view) { + console.log("[StackCode] No view available for stats update"); + return; } - _getHtmlForWebview(webview) { - const nonce = getNonce(); - const buildPath = vscode.Uri.joinPath(this._extensionUri, "dist", "webview-ui"); - // Lê o manifest.json do Vite - const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); - console.log("[StackCode] Build path:", buildPath.fsPath); - console.log("[StackCode] Manifest path:", manifestPath); - console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); - try { - const manifestContent = fs.readFileSync(manifestPath, "utf-8"); - const manifest = JSON.parse(manifestContent); - console.log("[StackCode] Manifest content:", manifest); - // Pega os arquivos do manifest do Vite - const indexEntry = manifest["index.html"]; - const scriptFile = indexEntry.file; - const cssFiles = indexEntry.css || []; - const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(buildPath, scriptFile)); - const cssUris = cssFiles.map((cssFile) => webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile))); - console.log("[StackCode] Script URI:", scriptUri.toString()); - console.log("[StackCode] CSS URIs:", cssUris.map((uri) => uri.toString())); - return ` + const workspaceFolders = vscode.workspace.workspaceFolders; + console.log( + "[StackCode] Workspace folders:", + workspaceFolders?.length || 0, + ); + console.log("[StackCode] Workspace name:", vscode.workspace.name); + console.log( + "[StackCode] Workspace file:", + vscode.workspace.workspaceFile?.toString(), + ); + if (!workspaceFolders || workspaceFolders.length === 0) { + console.log( + "[StackCode] No workspace folders found, using alternative detection", + ); + // Fallback: usar informações do contexto da extensão + const extensionWorkspace = path.dirname( + path.dirname(path.dirname(this._extensionUri.fsPath)), + ); + console.log("[StackCode] Extension workspace path:", extensionWorkspace); + this.sendMessage({ + type: "updateStats", + payload: { + files: 0, + workspaceName: "StackCode (Debug)", + workspacePath: extensionWorkspace, + mode: "development", + }, + }); + return; + } + try { + const files = await vscode.workspace.findFiles( + "**/*", + "**/node_modules/**", + 1000, + ); + console.log("[StackCode] Found files:", files.length); + this.sendMessage({ + type: "updateStats", + payload: { + files: files.length, + workspaceName: workspaceFolders[0].name, + workspacePath: workspaceFolders[0].uri.fsPath, + mode: "production", + }, + }); + } catch (e) { + console.error("[StackCode] Error fetching project stats:", e); + this.sendMessage({ + type: "updateStats", + payload: { files: 0, error: "Failed to scan files" }, + }); + } + } + _getHtmlForWebview(webview) { + const nonce = getNonce(); + const buildPath = vscode.Uri.joinPath( + this._extensionUri, + "dist", + "webview-ui", + ); + // Lê o manifest.json do Vite + const manifestPath = path.join(buildPath.fsPath, ".vite", "manifest.json"); + console.log("[StackCode] Build path:", buildPath.fsPath); + console.log("[StackCode] Manifest path:", manifestPath); + console.log("[StackCode] Manifest exists:", fs.existsSync(manifestPath)); + try { + const manifestContent = fs.readFileSync(manifestPath, "utf-8"); + const manifest = JSON.parse(manifestContent); + console.log("[StackCode] Manifest content:", manifest); + // Pega os arquivos do manifest do Vite + const indexEntry = manifest["index.html"]; + const scriptFile = indexEntry.file; + const cssFiles = indexEntry.css || []; + const scriptUri = webview.asWebviewUri( + vscode.Uri.joinPath(buildPath, scriptFile), + ); + const cssUris = cssFiles.map((cssFile) => + webview.asWebviewUri(vscode.Uri.joinPath(buildPath, cssFile)), + ); + console.log("[StackCode] Script URI:", scriptUri.toString()); + console.log( + "[StackCode] CSS URIs:", + cssUris.map((uri) => uri.toString()), + ); + return ` @@ -193,11 +247,10 @@ class DashboardProvider { `; - } - catch (error) { - console.error("[StackCode] Error reading manifest:", error); - // Fallback melhorado para desenvolvimento - return ` + } catch (error) { + console.error("[StackCode] Error reading manifest:", error); + // Fallback melhorado para desenvolvimento + return ` @@ -250,26 +303,27 @@ class DashboardProvider { `; - } } - // CORREÇÃO: Adicionando o método dispose para conformidade. - dispose() { - while (this._disposables.length) { - const x = this._disposables.pop(); - if (x) { - x.dispose(); - } - } + } + // CORREÇÃO: Adicionando o método dispose para conformidade. + dispose() { + while (this._disposables.length) { + const x = this._disposables.pop(); + if (x) { + x.dispose(); + } } + } } exports.DashboardProvider = DashboardProvider; DashboardProvider.viewType = "stackcode.dashboard"; function getNonce() { - let text = ""; - const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 32; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; + let text = ""; + const possible = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (let i = 0; i < 32; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; } -//# sourceMappingURL=DashboardProvider.js.map \ No newline at end of file +//# sourceMappingURL=DashboardProvider.js.map diff --git a/packages/vscode-extension/out/providers/ProjectViewProvider.js b/packages/vscode-extension/out/providers/ProjectViewProvider.js index da64a272..73617dff 100644 --- a/packages/vscode-extension/out/providers/ProjectViewProvider.js +++ b/packages/vscode-extension/out/providers/ProjectViewProvider.js @@ -1,307 +1,331 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { +var __createBinding = + (this && this.__createBinding) || + (Object.create + ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if ( + !desc || + ("get" in desc ? !m.__esModule : desc.writable || desc.configurable) + ) { + desc = { + enumerable: true, + get: function () { + return m[k]; + }, + }; + } + Object.defineProperty(o, k2, desc); + } + : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); +var __setModuleDefault = + (this && this.__setModuleDefault) || + (Object.create + ? function (o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } + : function (o, v) { + o["default"] = v; + }); +var __importStar = + (this && this.__importStar) || + function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; -}; + }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectViewProvider = void 0; const vscode = __importStar(require("vscode")); class ProjectViewProvider { - constructor(workspaceState) { - this.workspaceState = workspaceState; - this._onDidChangeTreeData = new vscode.EventEmitter(); - this.onDidChangeTreeData = this._onDidChangeTreeData.event; - } - refresh() { - this._onDidChangeTreeData.fire(); - } - getTreeItem(element) { - const item = new vscode.TreeItem(element.label, element.collapsibleState); - // Enhanced icons and styling - const iconMap = { - "StackCode Project": "rocket", - "Quick Actions": "zap", - "Initialize Project": "folder-opened", - "Generate README": "book", - "Generate .gitignore": "git-branch", - "Validate Project": "check", - "Git Workflow": "git-commit", - "Start Feature": "git-branch", - "Create Hotfix": "flame", - "Make Release": "package", - "Commit Changes": "git-commit", - "Project Tools": "tools", - Configuration: "gear", - "Show Dashboard": "dashboard", - "View Project Stats": "graph", - "Help & Documentation": "question", + constructor(workspaceState) { + this.workspaceState = workspaceState; + this._onDidChangeTreeData = new vscode.EventEmitter(); + this.onDidChangeTreeData = this._onDidChangeTreeData.event; + } + refresh() { + this._onDidChangeTreeData.fire(); + } + getTreeItem(element) { + const item = new vscode.TreeItem(element.label, element.collapsibleState); + // Enhanced icons and styling + const iconMap = { + "StackCode Project": "rocket", + "Quick Actions": "zap", + "Initialize Project": "folder-opened", + "Generate README": "book", + "Generate .gitignore": "git-branch", + "Validate Project": "check", + "Git Workflow": "git-commit", + "Start Feature": "git-branch", + "Create Hotfix": "flame", + "Make Release": "package", + "Commit Changes": "git-commit", + "Project Tools": "tools", + Configuration: "gear", + "Show Dashboard": "dashboard", + "View Project Stats": "graph", + "Help & Documentation": "question", + }; + // Set icons with theme support + item.iconPath = new vscode.ThemeIcon( + iconMap[element.label] || "circle-filled", + ); + // Add commands for interactive items + if (element.command) { + // Handle both string and Command object types + if (typeof element.command === "string") { + item.command = { + command: element.command, + title: element.label, }; - // Set icons with theme support - item.iconPath = new vscode.ThemeIcon(iconMap[element.label] || "circle-filled"); - // Add commands for interactive items - if (element.command) { - // Handle both string and Command object types - if (typeof element.command === "string") { - item.command = { - command: element.command, - title: element.label, - }; - } - else { - item.command = element.command; - } - // Add hover descriptions - const tooltips = { - "Initialize Project": "Create a new project with StackCode scaffolding", - "Generate README": "Generate a comprehensive README.md file", - "Generate .gitignore": "Generate .gitignore based on project type", - "Validate Project": "Check project structure and best practices", - "Start Feature": "Begin a new feature using GitFlow", - "Create Hotfix": "Create a hotfix branch for urgent fixes", - "Make Release": "Create a new release with automated versioning", - "Commit Changes": "Make a conventional commit with validation", - Configuration: "Configure StackCode settings", - "Show Dashboard": "Open the interactive StackCode dashboard", - "View Project Stats": "See detailed project statistics", - "Help & Documentation": "Access StackCode documentation", - }; - item.tooltip = tooltips[element.label] || element.label; - } - // Style for different types - if (element.children && element.children.length > 0) { - item.contextValue = "stackcode-category"; - } - else if (element.command) { - item.contextValue = "stackcode-action"; - } - return item; + } else { + item.command = element.command; + } + // Add hover descriptions + const tooltips = { + "Initialize Project": "Create a new project with StackCode scaffolding", + "Generate README": "Generate a comprehensive README.md file", + "Generate .gitignore": "Generate .gitignore based on project type", + "Validate Project": "Check project structure and best practices", + "Start Feature": "Begin a new feature using GitFlow", + "Create Hotfix": "Create a hotfix branch for urgent fixes", + "Make Release": "Create a new release with automated versioning", + "Commit Changes": "Make a conventional commit with validation", + Configuration: "Configure StackCode settings", + "Show Dashboard": "Open the interactive StackCode dashboard", + "View Project Stats": "See detailed project statistics", + "Help & Documentation": "Access StackCode documentation", + }; + item.tooltip = tooltips[element.label] || element.label; + } + // Style for different types + if (element.children && element.children.length > 0) { + item.contextValue = "stackcode-category"; + } else if (element.command) { + item.contextValue = "stackcode-action"; } - getChildren(element) { - if (!element) { - // Root level - show main categories with enhanced structure - return Promise.resolve([ + return item; + } + getChildren(element) { + if (!element) { + // Root level - show main categories with enhanced structure + return Promise.resolve([ + { + label: "StackCode Project", + icon: "rocket", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ + { + label: "Quick Actions", + icon: "zap", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ { - label: "StackCode Project", - icon: "rocket", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Quick Actions", - icon: "zap", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Initialize Project", - icon: "folder-opened", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.init", - title: "Initialize Project", - }, - }, - { - label: "Generate README", - icon: "book", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.generate.readme", - title: "Generate README", - }, - }, - { - label: "Generate .gitignore", - icon: "git-branch", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.generate.gitignore", - title: "Generate .gitignore", - }, - }, - { - label: "Validate Project", - icon: "check", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.validate", - title: "Validate Project", - }, - }, - ], - }, - { - label: "Git Workflow", - icon: "git-commit", - collapsibleState: vscode.TreeItemCollapsibleState.Expanded, - children: [ - { - label: "Start Feature", - icon: "git-branch", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.git.feature.start", - title: "Start Feature", - }, - }, - { - label: "Create Hotfix", - icon: "flame", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.git.hotfix.start", - title: "Create Hotfix", - }, - }, - { - label: "Make Release", - icon: "package", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.release", - title: "Make Release", - }, - }, - { - label: "Commit Changes", - icon: "git-commit", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.commit", - title: "Commit Changes", - }, - }, - ], - }, - { - label: "Project Tools", - icon: "tools", - collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, - children: [ - { - label: "Configuration", - icon: "gear", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.config", - title: "Configuration", - }, - }, - { - label: "Show Dashboard", - icon: "dashboard", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.dashboard.show", - title: "Show Dashboard", - }, - }, - { - label: "View Project Stats", - icon: "graph", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.stats.show", - title: "View Project Stats", - }, - }, - { - label: "Help & Documentation", - icon: "question", - collapsibleState: vscode.TreeItemCollapsibleState.None, - command: { - command: "stackcode.help", - title: "Help & Documentation", - }, - }, - ], - }, - ], + label: "Initialize Project", + icon: "folder-opened", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.init", + title: "Initialize Project", + }, }, - ]); - } - else { - return Promise.resolve(element.children || []); - } - } - async getProjectInfo() { - const items = []; - const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; - if (!workspaceFolder) { - return [ { - label: "No workspace", - description: "Open a folder to see project info", - icon: "folder-opened", + label: "Generate README", + icon: "book", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.generate.readme", + title: "Generate README", + }, }, - ]; - } - // Project name - items.push({ - label: workspaceFolder.name, - description: "Project root", - icon: "folder", - }); - // Git status - try { - const gitExtension = vscode.extensions.getExtension("vscode.git"); - if (gitExtension && gitExtension.isActive) { - const git = gitExtension.exports; - const api = git.getAPI(1); - const repo = api.repositories[0]; - if (repo && repo.state.HEAD) { - items.push({ - label: `Branch: ${repo.state.HEAD.name}`, - description: `${repo.state.workingTreeChanges.length} changes`, - icon: "git-branch", - }); - } - } - } - catch { - // Git not available - } - // Quick actions - items.push({ - label: "Initialize Project", - description: "Set up StackCode project", - icon: "play", - command: "stackcode.init", - }, { - label: "Generate Files", - description: "Create README, .gitignore, etc.", - icon: "file-add", - command: "stackcode.generate.readme", - }, { - label: "Start Branch", - description: "Create new feature branch", + { + label: "Generate .gitignore", + icon: "git-branch", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.generate.gitignore", + title: "Generate .gitignore", + }, + }, + { + label: "Validate Project", + icon: "check", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.validate", + title: "Validate Project", + }, + }, + ], + }, + { + label: "Git Workflow", + icon: "git-commit", + collapsibleState: vscode.TreeItemCollapsibleState.Expanded, + children: [ + { + label: "Start Feature", + icon: "git-branch", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.git.feature.start", + title: "Start Feature", + }, + }, + { + label: "Create Hotfix", + icon: "flame", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.git.hotfix.start", + title: "Create Hotfix", + }, + }, + { + label: "Make Release", + icon: "package", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.release", + title: "Make Release", + }, + }, + { + label: "Commit Changes", + icon: "git-commit", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.commit", + title: "Commit Changes", + }, + }, + ], + }, + { + label: "Project Tools", + icon: "tools", + collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, + children: [ + { + label: "Configuration", + icon: "gear", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.config", + title: "Configuration", + }, + }, + { + label: "Show Dashboard", + icon: "dashboard", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.dashboard.show", + title: "Show Dashboard", + }, + }, + { + label: "View Project Stats", + icon: "graph", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.stats.show", + title: "View Project Stats", + }, + }, + { + label: "Help & Documentation", + icon: "question", + collapsibleState: vscode.TreeItemCollapsibleState.None, + command: { + command: "stackcode.help", + title: "Help & Documentation", + }, + }, + ], + }, + ], + }, + ]); + } else { + return Promise.resolve(element.children || []); + } + } + async getProjectInfo() { + const items = []; + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (!workspaceFolder) { + return [ + { + label: "No workspace", + description: "Open a folder to see project info", + icon: "folder-opened", + }, + ]; + } + // Project name + items.push({ + label: workspaceFolder.name, + description: "Project root", + icon: "folder", + }); + // Git status + try { + const gitExtension = vscode.extensions.getExtension("vscode.git"); + if (gitExtension && gitExtension.isActive) { + const git = gitExtension.exports; + const api = git.getAPI(1); + const repo = api.repositories[0]; + if (repo && repo.state.HEAD) { + items.push({ + label: `Branch: ${repo.state.HEAD.name}`, + description: `${repo.state.workingTreeChanges.length} changes`, icon: "git-branch", - command: "stackcode.git.start", - }, { - label: "Create Commit", - description: "Make conventional commit", - icon: "git-commit", - command: "stackcode.commit", - }); - return items; + }); + } + } + } catch { + // Git not available } + // Quick actions + items.push( + { + label: "Initialize Project", + description: "Set up StackCode project", + icon: "play", + command: "stackcode.init", + }, + { + label: "Generate Files", + description: "Create README, .gitignore, etc.", + icon: "file-add", + command: "stackcode.generate.readme", + }, + { + label: "Start Branch", + description: "Create new feature branch", + icon: "git-branch", + command: "stackcode.git.start", + }, + { + label: "Create Commit", + description: "Make conventional commit", + icon: "git-commit", + command: "stackcode.commit", + }, + ); + return items; + } } exports.ProjectViewProvider = ProjectViewProvider; -//# sourceMappingURL=ProjectViewProvider.js.map \ No newline at end of file +//# sourceMappingURL=ProjectViewProvider.js.map diff --git a/packages/vscode-extension/out/test/__mocks__/vscode.js b/packages/vscode-extension/out/test/__mocks__/vscode.js index 90a9daef..d666f80f 100644 --- a/packages/vscode-extension/out/test/__mocks__/vscode.js +++ b/packages/vscode-extension/out/test/__mocks__/vscode.js @@ -1,58 +1,66 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigurationTarget = exports.StatusBarAlignment = exports.extensions = exports.commands = exports.workspace = exports.window = void 0; +exports.ConfigurationTarget = + exports.StatusBarAlignment = + exports.extensions = + exports.commands = + exports.workspace = + exports.window = + void 0; const mockConfiguration = { - get: jest.fn((key, defaultValue) => { - const configs = { - "notifications.enabled": true, - "notifications.branchCheck": true, - "notifications.commitCheck": true, - "autoGenerate.readme": false, - "autoGenerate.gitignore": true, - "git.defaultBranchType": "feature", - "dashboard.autoOpen": false, - }; - return configs[key] !== undefined ? configs[key] : defaultValue; - }), - update: jest.fn(), + get: jest.fn((key, defaultValue) => { + const configs = { + "notifications.enabled": true, + "notifications.branchCheck": true, + "notifications.commitCheck": true, + "autoGenerate.readme": false, + "autoGenerate.gitignore": true, + "git.defaultBranchType": "feature", + "dashboard.autoOpen": false, + }; + return configs[key] !== undefined ? configs[key] : defaultValue; + }), + update: jest.fn(), }; exports.window = { - showInformationMessage: jest.fn(), - showWarningMessage: jest.fn(), - showErrorMessage: jest.fn(), - createStatusBarItem: jest.fn(() => ({ - show: jest.fn(), - hide: jest.fn(), - dispose: jest.fn(), - })), + showInformationMessage: jest.fn(), + showWarningMessage: jest.fn(), + showErrorMessage: jest.fn(), + createStatusBarItem: jest.fn(() => ({ + show: jest.fn(), + hide: jest.fn(), + dispose: jest.fn(), + })), }; exports.workspace = { - getConfiguration: jest.fn(() => mockConfiguration), - workspaceFolders: [], - onDidChangeConfiguration: jest.fn(), + getConfiguration: jest.fn(() => mockConfiguration), + workspaceFolders: [], + onDidChangeConfiguration: jest.fn(), }; exports.commands = { - registerCommand: jest.fn(), - executeCommand: jest.fn(), - getCommands: jest.fn(() => Promise.resolve([ - "stackcode.init", - "stackcode.generate.readme", - "stackcode.git.start", - ])), + registerCommand: jest.fn(), + executeCommand: jest.fn(), + getCommands: jest.fn(() => + Promise.resolve([ + "stackcode.init", + "stackcode.generate.readme", + "stackcode.git.start", + ]), + ), }; exports.extensions = { - getExtension: jest.fn(() => ({ - activate: jest.fn(() => Promise.resolve()), - isActive: true, - })), + getExtension: jest.fn(() => ({ + activate: jest.fn(() => Promise.resolve()), + isActive: true, + })), }; exports.StatusBarAlignment = { - Left: 1, - Right: 2, + Left: 1, + Right: 2, }; exports.ConfigurationTarget = { - Global: 1, - Workspace: 2, - WorkspaceFolder: 3, + Global: 1, + Workspace: 2, + WorkspaceFolder: 3, }; -//# sourceMappingURL=vscode.js.map \ No newline at end of file +//# sourceMappingURL=vscode.js.map diff --git a/packages/vscode-extension/out/types.js b/packages/vscode-extension/out/types.js index 11e638d1..270a1e8f 100644 --- a/packages/vscode-extension/out/types.js +++ b/packages/vscode-extension/out/types.js @@ -1,3 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file +//# sourceMappingURL=types.js.map diff --git a/packages/vscode-extension/src/commands/CommitCommand.ts b/packages/vscode-extension/src/commands/CommitCommand.ts index d63033d9..f236a274 100644 --- a/packages/vscode-extension/src/commands/CommitCommand.ts +++ b/packages/vscode-extension/src/commands/CommitCommand.ts @@ -17,7 +17,9 @@ export class CommitCommand extends BaseCommand { this.showSuccess(t("vscode.commit.commit_dialog_opened")); } catch (error) { - this.showError(t("vscode.commit.failed_open_commit_dialog", { error: String(error) })); + this.showError( + t("vscode.commit.failed_open_commit_dialog", { error: String(error) }), + ); } } } diff --git a/packages/vscode-extension/src/commands/ConfigCommand.ts b/packages/vscode-extension/src/commands/ConfigCommand.ts index badd0a91..226ca674 100644 --- a/packages/vscode-extension/src/commands/ConfigCommand.ts +++ b/packages/vscode-extension/src/commands/ConfigCommand.ts @@ -49,9 +49,7 @@ export class ConfigCommand extends BaseCommand { const document = await vscode.workspace.openTextDocument(configPath); await vscode.window.showTextDocument(document); } catch { - this.showError( - t("vscode.config.stackcoderc_not_found"), - ); + this.showError(t("vscode.config.stackcoderc_not_found")); } } else if (action.label === t("vscode.config.create_project_config")) { // Use StackCode CLI for config creation @@ -60,7 +58,9 @@ export class ConfigCommand extends BaseCommand { this.showSuccess(t("vscode.config.project_configuration_initialized")); } } catch (error) { - this.showError(t("vscode.config.failed_open_configuration", { error: String(error) })); + this.showError( + t("vscode.config.failed_open_configuration", { error: String(error) }), + ); } } } diff --git a/packages/vscode-extension/src/commands/GenerateCommand.ts b/packages/vscode-extension/src/commands/GenerateCommand.ts index b69b1ac9..56ebc8d4 100644 --- a/packages/vscode-extension/src/commands/GenerateCommand.ts +++ b/packages/vscode-extension/src/commands/GenerateCommand.ts @@ -79,7 +79,10 @@ export class GenerateCommand extends BaseCommand { // Use StackCode CLI for generation const command = `npx @stackcode/cli generate readme`; - progress.report({ increment: 50, message: t("vscode.generate.running_generator") }); + progress.report({ + increment: 50, + message: t("vscode.generate.running_generator"), + }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); @@ -103,7 +106,9 @@ export class GenerateCommand extends BaseCommand { await vscode.window.showTextDocument(document); } } catch (error) { - this.showError(t("vscode.generate.failed_generate_readme", { error: String(error) })); + this.showError( + t("vscode.generate.failed_generate_readme", { error: String(error) }), + ); } } @@ -142,9 +147,15 @@ export class GenerateCommand extends BaseCommand { { label: "java", description: t("vscode.init.stacks.java") }, { label: "go", description: t("vscode.init.stacks.go") }, { label: "php", description: t("vscode.init.stacks.php") }, - { label: "flutter", description: t("vscode.generate.stacks.flutter") }, + { + label: "flutter", + description: t("vscode.generate.stacks.flutter"), + }, { label: "swift", description: t("vscode.generate.stacks.swift") }, - { label: "android", description: t("vscode.generate.stacks.android") }, + { + label: "android", + description: t("vscode.generate.stacks.android"), + }, ], { placeHolder: t("vscode.generate.select_project_type_gitignore"), @@ -170,7 +181,10 @@ export class GenerateCommand extends BaseCommand { // Use StackCode CLI for generation const command = `npx @stackcode/cli generate gitignore --type="${projectType.label}"`; - progress.report({ increment: 50, message: t("vscode.generate.running_generator") }); + progress.report({ + increment: 50, + message: t("vscode.generate.running_generator"), + }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); @@ -194,7 +208,11 @@ export class GenerateCommand extends BaseCommand { await vscode.window.showTextDocument(document); } } catch (error) { - this.showError(t("vscode.generate.failed_generate_gitignore", { error: String(error) })); + this.showError( + t("vscode.generate.failed_generate_gitignore", { + error: String(error), + }), + ); } } } diff --git a/packages/vscode-extension/src/commands/GitCommand.ts b/packages/vscode-extension/src/commands/GitCommand.ts index 9404212f..8b6eb183 100644 --- a/packages/vscode-extension/src/commands/GitCommand.ts +++ b/packages/vscode-extension/src/commands/GitCommand.ts @@ -48,7 +48,10 @@ export class GitCommand extends BaseCommand { const branchType = await vscode.window.showQuickPick( [ - { label: "feature", description: t("vscode.git.feature_description") }, + { + label: "feature", + description: t("vscode.git.feature_description"), + }, { label: "bugfix", description: t("vscode.git.bugfix_description") }, { label: "hotfix", description: t("vscode.git.hotfix_description") }, { label: "chore", description: t("vscode.git.chore_description") }, @@ -71,11 +74,16 @@ export class GitCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: t("vscode.git.creating_branch", { branchName: `${branchType.label}/${branchName}` }), + title: t("vscode.git.creating_branch", { + branchName: `${branchType.label}/${branchName}`, + }), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: t("vscode.git.switching_to_develop") }); + progress.report({ + increment: 0, + message: t("vscode.git.switching_to_develop"), + }); // Use StackCode CLI for git operations const command = `npx @stackcode/cli git start ${branchName} --type=${branchType.label}`; @@ -95,10 +103,14 @@ export class GitCommand extends BaseCommand { ); this.showSuccess( - t("vscode.git.new_branch_created", { branchName: `${branchType.label}/${branchName}` }), + t("vscode.git.new_branch_created", { + branchName: `${branchType.label}/${branchName}`, + }), ); } catch (error) { - this.showError(t("vscode.git.failed_create_branch", { error: String(error) })); + this.showError( + t("vscode.git.failed_create_branch", { error: String(error) }), + ); } } @@ -139,16 +151,24 @@ export class GitCommand extends BaseCommand { vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: t("vscode.git.finishing_branch", { branchName: currentBranch }), + title: t("vscode.git.finishing_branch", { + branchName: currentBranch, + }), cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: t("vscode.git.pushing_branch") }); + progress.report({ + increment: 0, + message: t("vscode.git.pushing_branch"), + }); // Use StackCode CLI for git operations const command = `npx @stackcode/cli git finish`; - progress.report({ increment: 50, message: t("vscode.git.opening_pr") }); + progress.report({ + increment: 50, + message: t("vscode.git.opening_pr"), + }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); @@ -159,9 +179,13 @@ export class GitCommand extends BaseCommand { }, ); - this.showSuccess(t("vscode.git.branch_has_been_finished", { currentBranch })); + this.showSuccess( + t("vscode.git.branch_has_been_finished", { currentBranch }), + ); } catch (error) { - this.showError(t("vscode.git.failed_finish_branch", { error: String(error) })); + this.showError( + t("vscode.git.failed_finish_branch", { error: String(error) }), + ); } } } diff --git a/packages/vscode-extension/src/commands/InitCommand.ts b/packages/vscode-extension/src/commands/InitCommand.ts index 13916d92..6af11868 100644 --- a/packages/vscode-extension/src/commands/InitCommand.ts +++ b/packages/vscode-extension/src/commands/InitCommand.ts @@ -134,7 +134,9 @@ export class InitCommand extends BaseCommand { await vscode.commands.executeCommand("vscode.openFolder", uri, true); } } catch (error) { - this.showError(t("vscode.init.failed_initialize_project", { error: String(error) })); + this.showError( + t("vscode.init.failed_initialize_project", { error: String(error) }), + ); } } diff --git a/packages/vscode-extension/src/commands/ReleaseCommand.ts b/packages/vscode-extension/src/commands/ReleaseCommand.ts index 6278b1a3..54e85f56 100644 --- a/packages/vscode-extension/src/commands/ReleaseCommand.ts +++ b/packages/vscode-extension/src/commands/ReleaseCommand.ts @@ -28,22 +28,33 @@ export class ReleaseCommand extends BaseCommand { cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: t("vscode.release.preparing_release") }); + progress.report({ + increment: 0, + message: t("vscode.release.preparing_release"), + }); // Use StackCode CLI for release const command = `npx @stackcode/cli release`; - progress.report({ increment: 50, message: t("vscode.release.creating_release_message") }); + progress.report({ + increment: 50, + message: t("vscode.release.creating_release_message"), + }); await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: t("vscode.release.release_created") }); + progress.report({ + increment: 100, + message: t("vscode.release.release_created"), + }); }, ); this.showSuccess(t("vscode.release.release_process_started")); } catch (error) { - this.showError(t("vscode.release.failed_create_release", { error: String(error) })); + this.showError( + t("vscode.release.failed_create_release", { error: String(error) }), + ); } } } diff --git a/packages/vscode-extension/src/commands/ValidateCommand.ts b/packages/vscode-extension/src/commands/ValidateCommand.ts index 3363f8ad..4e44b257 100644 --- a/packages/vscode-extension/src/commands/ValidateCommand.ts +++ b/packages/vscode-extension/src/commands/ValidateCommand.ts @@ -19,7 +19,10 @@ export class ValidateCommand extends BaseCommand { cancellable: false, }, async (progress: ProgressCallback) => { - progress.report({ increment: 0, message: t("vscode.validate.running_validation") }); + progress.report({ + increment: 0, + message: t("vscode.validate.running_validation"), + }); // Use StackCode CLI for validation const command = `npx @stackcode/cli validate`; @@ -31,15 +34,18 @@ export class ValidateCommand extends BaseCommand { await this.runTerminalCommand(command, workspaceFolder.uri.fsPath); - progress.report({ increment: 100, message: t("vscode.validate.validation_completed") }); + progress.report({ + increment: 100, + message: t("vscode.validate.validation_completed"), + }); }, ); - this.showSuccess( - t("vscode.validate.project_validation_completed"), - ); + this.showSuccess(t("vscode.validate.project_validation_completed")); } catch (error) { - this.showError(t("vscode.validate.failed_validate_project", { error: String(error) })); + this.showError( + t("vscode.validate.failed_validate_project", { error: String(error) }), + ); } } } diff --git a/packages/vscode-extension/src/monitors/FileMonitor.ts b/packages/vscode-extension/src/monitors/FileMonitor.ts index e316f98d..04f72f42 100644 --- a/packages/vscode-extension/src/monitors/FileMonitor.ts +++ b/packages/vscode-extension/src/monitors/FileMonitor.ts @@ -132,7 +132,9 @@ export class FileMonitor implements vscode.Disposable { if (missingFiles.length > 0 && Math.random() < 0.3) { // Show suggestion 30% of the time - const message = t("vscode.common.project_missing_files", { missingFiles: missingFiles.join(", ") }); + const message = t("vscode.common.project_missing_files", { + missingFiles: missingFiles.join(", "), + }); const action = await vscode.window.showInformationMessage( message, @@ -153,10 +155,14 @@ export class FileMonitor implements vscode.Disposable { ); } } - } catch (error: any) { + } catch (error: unknown) { // Use proper VS Code logging instead of console.log const outputChannel = vscode.window.createOutputChannel("StackCode"); - outputChannel.appendLine(t("vscode.common.error_checking_project_structure", { error: String(error) })); + outputChannel.appendLine( + t("vscode.common.error_checking_project_structure", { + error: String(error), + }), + ); } }