datasecops-cli 0.7.0b13__tar.gz → 0.7.0b14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/CHANGELOG.md +6 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/PKG-INFO +1 -1
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/pyproject.toml +1 -1
- datasecops_cli-0.7.0b14/src/datasecops_cli/__init__.py +1 -0
- datasecops_cli-0.7.0b14/src/datasecops_cli/menus/development.py +443 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/menus/downloads.py +30 -27
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/menus/git_operations.py +64 -58
- datasecops_cli-0.7.0b13/src/datasecops_cli/__init__.py +0 -1
- datasecops_cli-0.7.0b13/src/datasecops_cli/menus/development.py +0 -424
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/.github/workflows/auto-tag.yml +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/.github/workflows/publish-cli.yml +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/.github/workflows/test.yml +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/.gitignore +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/AGENTS.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/DEVELOPMENT.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/LICENSE +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/README.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/dcm.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/getting-started.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/git-operations.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/legacy.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/legacy_plan_of_action.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/mcp-server.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/docs/squash-merge-into-test-review.md +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/mcp-servers.json +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/scripts/vendor_model.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/setup.ps1 +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/setup.sh +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/config.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/main.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/menus/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/menus/configuration.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/menus/dcm_operations.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/models/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/models/git_helpers.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/models/project_config.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/bootstrap_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dbt_project_generator.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dbt_runner.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dcm_orchestrator.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dcm_pipelines.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dcm_registry.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/dcm_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/directory_scaffolder.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/download_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/git_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/linting_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/model_commands.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/pipeline_env.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/skill_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/snowflake_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/services/upstream_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/utilities/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/utilities/display.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/utilities/file_utils.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/utilities/mcp.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_cli/utilities/yaml_utils.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_mcp/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_mcp/__main__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_mcp/connection.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_mcp/server.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/convert.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/diagram.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/expand.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/extract.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/render.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/schema.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/scope.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/scripts.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/starter.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/templates/macros/role.sql +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/templates/macros/role_guard.sql +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/templates/macros/warehouse.sql +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/src/datasecops_model/validate.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/__init__.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_config.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_dbt_project_generator_profiles.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_dbt_runner.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_dcm_model.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_dcm_orchestrator.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_dcm_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_download_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_file_utils.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_git_operations_menu.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_git_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_linting_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_main.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_mcp_branching_rules.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_mcp_lint_tools.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_model_commands.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_models.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_pipeline_env.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_upstream_service.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_version.py +0 -0
- {datasecops_cli-0.7.0b13 → datasecops_cli-0.7.0b14}/tests/test_yaml_utils.py +0 -0
|
@@ -4,6 +4,12 @@ All notable changes to the DataSecOps CLI are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.7.0b14] - 2026-11-04
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Interactive submenus (run, build, test, lint, compile, autofix, branching, rebase, skills) bounced back to their parent menu after a single action** — e.g. choosing "run" → "specific" to run one model dropped you back on the Development menu instead of staying on "dbt Run Options" to run another. These submenus now loop and redisplay themselves after each action, like the top-level menus already do. Choosing "back" (`0`) from any of these submenus also now returns immediately without the "Press Enter to continue..." pause, matching the rest of the menus.
|
|
12
|
+
|
|
7
13
|
## [0.7.0b13] - 2026-11-02
|
|
8
14
|
|
|
9
15
|
### Fixed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.0b14"
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
from datasecops_cli.services.dbt_runner import DbtRunner
|
|
6
|
+
from datasecops_cli.services.linting_service import LintingService
|
|
7
|
+
from datasecops_cli.services.download_service import DownloadService
|
|
8
|
+
from datasecops_cli.services.git_service import GitService
|
|
9
|
+
from datasecops_cli.utilities.display import (
|
|
10
|
+
clear, section_header, display_action_header, menu_option,
|
|
11
|
+
get_input_number, get_input_string, get_input_true_false, complete_action,
|
|
12
|
+
info_line, error_line, success_line, warning_line
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DevelopmentMenu:
|
|
17
|
+
def __init__(self, dbt_runner: DbtRunner, linting_service: LintingService,
|
|
18
|
+
git_service: GitService, profile_name: str,
|
|
19
|
+
download_service: DownloadService = None,
|
|
20
|
+
profiles_dir: str = None):
|
|
21
|
+
self.dbt = dbt_runner
|
|
22
|
+
self.linting = linting_service
|
|
23
|
+
self.git = git_service
|
|
24
|
+
self.profile_name = profile_name
|
|
25
|
+
self.downloads = download_service
|
|
26
|
+
self.profiles_dir = profiles_dir
|
|
27
|
+
|
|
28
|
+
def show(self) -> None:
|
|
29
|
+
self._menu()
|
|
30
|
+
option = get_input_number("Choose an option: ")
|
|
31
|
+
while option != 0:
|
|
32
|
+
if option == 1:
|
|
33
|
+
self._run_menu()
|
|
34
|
+
elif option == 2:
|
|
35
|
+
self._build_menu()
|
|
36
|
+
elif option == 3:
|
|
37
|
+
self._test_menu()
|
|
38
|
+
elif option == 4:
|
|
39
|
+
self._lint_menu()
|
|
40
|
+
elif option == 5:
|
|
41
|
+
display_action_header("dbt docs")
|
|
42
|
+
self.dbt.docs_generate()
|
|
43
|
+
if get_input_true_false("Serve docs?"):
|
|
44
|
+
self.dbt.docs_serve()
|
|
45
|
+
complete_action()
|
|
46
|
+
elif option == 6:
|
|
47
|
+
display_action_header("dbt seed")
|
|
48
|
+
self.dbt.seed()
|
|
49
|
+
complete_action()
|
|
50
|
+
elif option == 7:
|
|
51
|
+
display_action_header("dbt deps")
|
|
52
|
+
self.dbt.deps()
|
|
53
|
+
complete_action()
|
|
54
|
+
elif option == 8:
|
|
55
|
+
self._parse_menu()
|
|
56
|
+
elif option == 9:
|
|
57
|
+
self._compile_menu()
|
|
58
|
+
elif option == 10:
|
|
59
|
+
display_action_header("dbt snapshot")
|
|
60
|
+
self.dbt.snapshot()
|
|
61
|
+
complete_action()
|
|
62
|
+
elif option == 11:
|
|
63
|
+
display_action_header("dbt source freshness")
|
|
64
|
+
self.dbt.source_freshness()
|
|
65
|
+
complete_action()
|
|
66
|
+
elif option == 12:
|
|
67
|
+
display_action_header("dbt clean")
|
|
68
|
+
self.dbt.clean()
|
|
69
|
+
complete_action()
|
|
70
|
+
elif option == 13:
|
|
71
|
+
display_action_header("dbt debug")
|
|
72
|
+
self.dbt.debug()
|
|
73
|
+
complete_action()
|
|
74
|
+
elif option == 14:
|
|
75
|
+
display_action_header("dbt list")
|
|
76
|
+
self.dbt.list_models()
|
|
77
|
+
complete_action()
|
|
78
|
+
elif option == 15:
|
|
79
|
+
self._autofix_menu()
|
|
80
|
+
self._menu()
|
|
81
|
+
option = get_input_number("Choose an option: ")
|
|
82
|
+
|
|
83
|
+
def _menu(self) -> None:
|
|
84
|
+
clear()
|
|
85
|
+
section_header("Development Menu", self.profile_name, self.git.get_current_branch() if self.git else None)
|
|
86
|
+
menu_option(1, "run - Run dbt models")
|
|
87
|
+
menu_option(2, "build - Run models, test, snapshot & seed together (DAG order)")
|
|
88
|
+
menu_option(3, "test - Run dbt tests")
|
|
89
|
+
menu_option(4, "lint - Lint SQL files")
|
|
90
|
+
menu_option(5, "docs - Generate & serve dbt docs")
|
|
91
|
+
menu_option(6, "seed - Load seed data")
|
|
92
|
+
menu_option(7, "deps - Install dbt packages")
|
|
93
|
+
menu_option(8, "parse - Parse dbt project")
|
|
94
|
+
menu_option(9, "compile - Compile dbt models")
|
|
95
|
+
menu_option(10, "snapshot - Run dbt snapshots")
|
|
96
|
+
menu_option(11, "freshness - Check source freshness")
|
|
97
|
+
menu_option(12, "clean - Clean dbt target")
|
|
98
|
+
menu_option(13, "debug - Debug dbt connection")
|
|
99
|
+
menu_option(14, "list - List dbt resources")
|
|
100
|
+
menu_option(15, "autofix - dbt autofix (deprecations, packages, jobs)")
|
|
101
|
+
menu_option(0, "back - Return to main menu")
|
|
102
|
+
|
|
103
|
+
def _prompt_run_build_flags(self) -> dict:
|
|
104
|
+
"""Shared y/n prompts for the extra run/build flags (--empty, --generate-info-schema,
|
|
105
|
+
--static-analysis strict). The latter two require the dbt2 engine."""
|
|
106
|
+
empty = get_input_true_false(
|
|
107
|
+
"Run with zero-row refs/sources (--empty)? This still executes against the "
|
|
108
|
+
"warehouse and materializes table models with empty/reduced data, replacing "
|
|
109
|
+
"their current contents — it validates dependencies cheaply, it is NOT a "
|
|
110
|
+
"no-write dry run.", "n")
|
|
111
|
+
generate_info_schema = False
|
|
112
|
+
static_analysis_strict = False
|
|
113
|
+
if self.dbt.engine == "dbt2":
|
|
114
|
+
generate_info_schema = get_input_true_false(
|
|
115
|
+
"Write the dbt Information Schema for querying project metadata "
|
|
116
|
+
"(--generate-info-schema, dbt2 only)?", "n")
|
|
117
|
+
static_analysis_strict = get_input_true_false(
|
|
118
|
+
"Infer column types & column-level lineage (--static-analysis strict, dbt2 only)?",
|
|
119
|
+
"n")
|
|
120
|
+
return {
|
|
121
|
+
"empty": empty,
|
|
122
|
+
"generate_info_schema": generate_info_schema,
|
|
123
|
+
"static_analysis_strict": static_analysis_strict,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
def _run_menu(self) -> None:
|
|
127
|
+
while True:
|
|
128
|
+
clear()
|
|
129
|
+
display_action_header("dbt Run Options")
|
|
130
|
+
menu_option(1, "full run - Run all models")
|
|
131
|
+
menu_option(2, "modified - Run modified models only (state:modified+)")
|
|
132
|
+
menu_option(3, "specific - Run specific model(s)")
|
|
133
|
+
menu_option(4, "macro - Run a dbt macro")
|
|
134
|
+
menu_option(5, "retry - Retry failed run")
|
|
135
|
+
menu_option(0, "back - Return to development menu")
|
|
136
|
+
option = get_input_number("Choose an option: ")
|
|
137
|
+
if option == 0:
|
|
138
|
+
return
|
|
139
|
+
if option == 1:
|
|
140
|
+
full_refresh = get_input_true_false("Full refresh?", "n")
|
|
141
|
+
flags = self._prompt_run_build_flags()
|
|
142
|
+
self.dbt.run(full_refresh=full_refresh, **flags)
|
|
143
|
+
elif option == 2:
|
|
144
|
+
full_refresh = get_input_true_false("Full refresh?", "n")
|
|
145
|
+
flags = self._prompt_run_build_flags()
|
|
146
|
+
self.dbt.run(modified_only=True, full_refresh=full_refresh, **flags)
|
|
147
|
+
elif option == 3:
|
|
148
|
+
select = get_input_string("Enter model selector (e.g. my_model, my_model+, tag:nightly, path:models/...): ")
|
|
149
|
+
if select != "0":
|
|
150
|
+
flags = self._prompt_run_build_flags()
|
|
151
|
+
self.dbt.run(select=select, **flags)
|
|
152
|
+
elif option == 4:
|
|
153
|
+
macro = get_input_string("Enter macro name: ")
|
|
154
|
+
if macro != "0":
|
|
155
|
+
args_str = get_input_string("Enter args (JSON or empty): ", allow_empty=True)
|
|
156
|
+
self.dbt.run_operation(macro, args_str if args_str else None)
|
|
157
|
+
elif option == 5:
|
|
158
|
+
self.dbt.retry()
|
|
159
|
+
complete_action()
|
|
160
|
+
|
|
161
|
+
def _build_menu(self) -> None:
|
|
162
|
+
while True:
|
|
163
|
+
clear()
|
|
164
|
+
display_action_header("dbt Build Options")
|
|
165
|
+
info_line("dbt build runs models, tests, snapshots & seeds together, in DAG order.")
|
|
166
|
+
menu_option(1, "full build - Build all resources")
|
|
167
|
+
menu_option(2, "modified - Build modified models only (state:modified+)")
|
|
168
|
+
menu_option(3, "specific - Build specific resource(s)")
|
|
169
|
+
menu_option(0, "back - Return to development menu")
|
|
170
|
+
option = get_input_number("Choose an option: ")
|
|
171
|
+
if option == 0:
|
|
172
|
+
return
|
|
173
|
+
if option == 1:
|
|
174
|
+
full_refresh = get_input_true_false("Full refresh?", "n")
|
|
175
|
+
flags = self._prompt_run_build_flags()
|
|
176
|
+
self.dbt.build(full_refresh=full_refresh, **flags)
|
|
177
|
+
elif option == 2:
|
|
178
|
+
full_refresh = get_input_true_false("Full refresh?", "n")
|
|
179
|
+
flags = self._prompt_run_build_flags()
|
|
180
|
+
self.dbt.build(modified_only=True, full_refresh=full_refresh, **flags)
|
|
181
|
+
elif option == 3:
|
|
182
|
+
select = get_input_string("Enter resource selector (e.g. my_model, tag:nightly, resource_type:function): ")
|
|
183
|
+
if select != "0":
|
|
184
|
+
flags = self._prompt_run_build_flags()
|
|
185
|
+
self.dbt.build(select=select, **flags)
|
|
186
|
+
complete_action()
|
|
187
|
+
|
|
188
|
+
def _test_menu(self) -> None:
|
|
189
|
+
while True:
|
|
190
|
+
clear()
|
|
191
|
+
display_action_header("dbt Test Options")
|
|
192
|
+
menu_option(1, "all tests - Run all tests")
|
|
193
|
+
menu_option(2, "unit tests - Run unit tests only")
|
|
194
|
+
menu_option(3, "data tests - Run data tests only")
|
|
195
|
+
menu_option(4, "failed - Retry failed tests")
|
|
196
|
+
menu_option(5, "specific - Run specific test(s)")
|
|
197
|
+
menu_option(0, "back - Return to development menu")
|
|
198
|
+
option = get_input_number("Choose an option: ")
|
|
199
|
+
if option == 0:
|
|
200
|
+
return
|
|
201
|
+
if option == 1:
|
|
202
|
+
self.dbt.test()
|
|
203
|
+
elif option == 2:
|
|
204
|
+
self.dbt.test(select="test_type:unit")
|
|
205
|
+
elif option == 3:
|
|
206
|
+
self.dbt.test(select="test_type:data")
|
|
207
|
+
elif option == 4:
|
|
208
|
+
self.dbt.retry()
|
|
209
|
+
elif option == 5:
|
|
210
|
+
select = get_input_string("Enter test selector (e.g. test_name, model_name, tag:nightly): ")
|
|
211
|
+
if select != "0":
|
|
212
|
+
self.dbt.test(select=select)
|
|
213
|
+
complete_action()
|
|
214
|
+
|
|
215
|
+
def _parse_menu(self) -> None:
|
|
216
|
+
while True:
|
|
217
|
+
clear()
|
|
218
|
+
display_action_header("dbt Parse Options")
|
|
219
|
+
menu_option(1, "standard - Parse & validate the project (fast, no warehouse connection)")
|
|
220
|
+
menu_option(0, "back - Return to development menu")
|
|
221
|
+
option = get_input_number("Choose an option: ")
|
|
222
|
+
if option == 0:
|
|
223
|
+
return
|
|
224
|
+
if option == 1:
|
|
225
|
+
no_partial_parse = get_input_true_false(
|
|
226
|
+
"Force a full re-parse instead of only recently changed files (--no-partial-parse)?", "n")
|
|
227
|
+
generate_info_schema = False
|
|
228
|
+
if self.dbt.engine == "dbt2":
|
|
229
|
+
generate_info_schema = get_input_true_false(
|
|
230
|
+
"Write the dbt Information Schema for querying project metadata "
|
|
231
|
+
"(--generate-info-schema, dbt2 only)?", "n")
|
|
232
|
+
self.dbt.parse(no_partial_parse=no_partial_parse, generate_info_schema=generate_info_schema)
|
|
233
|
+
complete_action()
|
|
234
|
+
|
|
235
|
+
def _compile_menu(self) -> None:
|
|
236
|
+
while True:
|
|
237
|
+
clear()
|
|
238
|
+
display_action_header("dbt Compile Options")
|
|
239
|
+
menu_option(1, "full - Compile all models")
|
|
240
|
+
menu_option(2, "specific - Compile specific model(s) (--select)")
|
|
241
|
+
menu_option(3, "inline - Compile an ad-hoc dbt-SQL query (--inline)")
|
|
242
|
+
menu_option(0, "back - Return to development menu")
|
|
243
|
+
option = get_input_number("Choose an option: ")
|
|
244
|
+
if option == 0:
|
|
245
|
+
return
|
|
246
|
+
select = None
|
|
247
|
+
inline = None
|
|
248
|
+
if option == 2:
|
|
249
|
+
select = get_input_string("Enter model selector (e.g. my_model, resource_type:test): ")
|
|
250
|
+
if select == "0":
|
|
251
|
+
complete_action()
|
|
252
|
+
continue
|
|
253
|
+
elif option == 3:
|
|
254
|
+
inline = get_input_string("Enter an ad-hoc dbt-SQL query (e.g. select * from {{ ref('my_model') }}): ")
|
|
255
|
+
if inline == "0":
|
|
256
|
+
complete_action()
|
|
257
|
+
continue
|
|
258
|
+
elif option not in (1,):
|
|
259
|
+
complete_action()
|
|
260
|
+
continue
|
|
261
|
+
no_introspect = get_input_true_false(
|
|
262
|
+
"Disable introspective warehouse queries — error instead of running one (--no-introspect)?", "n")
|
|
263
|
+
generate_info_schema = False
|
|
264
|
+
if self.dbt.engine == "dbt2":
|
|
265
|
+
generate_info_schema = get_input_true_false(
|
|
266
|
+
"Write the dbt Information Schema for querying project metadata "
|
|
267
|
+
"(--generate-info-schema, dbt2 only)?", "n")
|
|
268
|
+
self.dbt.compile(select=select, inline=inline, no_introspect=no_introspect,
|
|
269
|
+
generate_info_schema=generate_info_schema)
|
|
270
|
+
complete_action()
|
|
271
|
+
|
|
272
|
+
def _ensure_sqlfluff_config(self) -> bool:
|
|
273
|
+
"""Download .sqlfluff from the framework if it doesn't exist locally, and ensure correct
|
|
274
|
+
linting packages are installed (SQLFluff for dbt Core; none needed for dbt 2.0 — `dbt lint`
|
|
275
|
+
is built into the `dbt` binary)."""
|
|
276
|
+
config_path = self.linting.project_dir / ".sqlfluff"
|
|
277
|
+
if not config_path.exists():
|
|
278
|
+
if not self.downloads:
|
|
279
|
+
error_line("No .sqlfluff config found and download service not available")
|
|
280
|
+
return False
|
|
281
|
+
info_line("No .sqlfluff config found — downloading from framework...")
|
|
282
|
+
if not self.downloads.download_sqlfluff_config(profiles_dir=self.profiles_dir, dbt_project_dir=self.linting.project_dir):
|
|
283
|
+
return False
|
|
284
|
+
if self.linting.dbt_engine == "dbt2":
|
|
285
|
+
return True
|
|
286
|
+
# Fetch pinned versions from the native app (sqlfluff + dbt) and ensure they're installed
|
|
287
|
+
required = []
|
|
288
|
+
if self.downloads:
|
|
289
|
+
sqlfluff_pkgs = self.downloads.get_sqlfluff_requirements() or []
|
|
290
|
+
dbt_pkgs = self.downloads.get_dbt_requirements() or []
|
|
291
|
+
required = sqlfluff_pkgs + dbt_pkgs
|
|
292
|
+
if not self.linting.ensure_templater_installed(required_packages=required or None):
|
|
293
|
+
return False
|
|
294
|
+
# Ensure dbt project packages are installed (required by sqlfluff dbt templater)
|
|
295
|
+
self._ensure_dbt_packages()
|
|
296
|
+
return True
|
|
297
|
+
|
|
298
|
+
def _ensure_dbt_packages(self) -> None:
|
|
299
|
+
"""Ensure dbt packages are installed for the sqlfluff dbt templater."""
|
|
300
|
+
packages_dir = self.linting.project_dir / "dbt_packages"
|
|
301
|
+
if packages_dir.exists() and any(packages_dir.iterdir()):
|
|
302
|
+
return
|
|
303
|
+
|
|
304
|
+
packages_yml = self.linting.project_dir / "packages.yml"
|
|
305
|
+
if not packages_yml.exists():
|
|
306
|
+
return
|
|
307
|
+
|
|
308
|
+
info_line("Installing dbt packages (required for linting)...")
|
|
309
|
+
self.dbt.deps()
|
|
310
|
+
|
|
311
|
+
def _lint_menu(self) -> None:
|
|
312
|
+
while True:
|
|
313
|
+
clear()
|
|
314
|
+
is_dbt2 = self.linting.dbt_engine == "dbt2"
|
|
315
|
+
display_action_header("Linting Options")
|
|
316
|
+
if is_dbt2:
|
|
317
|
+
menu_option(1, "changed - Lint only git-changed files (dbt lint --changed)")
|
|
318
|
+
else:
|
|
319
|
+
menu_option(1, "modified - Lint modified SQL files")
|
|
320
|
+
menu_option(2, "all - Lint all SQL files")
|
|
321
|
+
menu_option(3, "specific - Lint specific file")
|
|
322
|
+
menu_option(4, "refresh config- Re-download .sqlfluff from framework")
|
|
323
|
+
if is_dbt2:
|
|
324
|
+
menu_option(5, "format - Auto-format SQL files (dbt format/fmt)")
|
|
325
|
+
menu_option(0, "back - Return to development menu")
|
|
326
|
+
option = get_input_number("Choose an option: ")
|
|
327
|
+
if option == 0:
|
|
328
|
+
return
|
|
329
|
+
if option in (1, 2, 3, 5) and not self._ensure_sqlfluff_config():
|
|
330
|
+
complete_action()
|
|
331
|
+
continue
|
|
332
|
+
if option == 1:
|
|
333
|
+
fix = get_input_true_false("Also auto-fix the issues found?", "n")
|
|
334
|
+
if is_dbt2:
|
|
335
|
+
self.linting.lint_changed(fix=fix)
|
|
336
|
+
else:
|
|
337
|
+
changed = self.git.get_all_modified_files() if self.git else []
|
|
338
|
+
self.linting.lint_modified(fix=fix, changed_files=changed)
|
|
339
|
+
elif option == 2:
|
|
340
|
+
fix = get_input_true_false("Also auto-fix the issues found?", "n")
|
|
341
|
+
self.linting.lint_file(fix=fix)
|
|
342
|
+
elif option == 3:
|
|
343
|
+
name = get_input_string("Enter model name or file path (e.g. stg_orders): ")
|
|
344
|
+
if name != "0":
|
|
345
|
+
path = name if name.endswith(".sql") else self.linting.resolve_model_path(name)
|
|
346
|
+
if path:
|
|
347
|
+
rules = exclude_rules = jinja_render_mode = None
|
|
348
|
+
if is_dbt2:
|
|
349
|
+
rules = get_input_string(
|
|
350
|
+
"Rule codes to enable, comma-separated (--rules, blank for config default): ",
|
|
351
|
+
allow_empty=True) or None
|
|
352
|
+
exclude_rules = get_input_string(
|
|
353
|
+
"Rule codes to disable, comma-separated (--exclude-rules, blank to skip): ",
|
|
354
|
+
allow_empty=True) or None
|
|
355
|
+
jinja_render_mode = get_input_string(
|
|
356
|
+
"Jinja render mode — symbolic/rendered/turbo (--jinja-render-mode, blank for default): ",
|
|
357
|
+
allow_empty=True) or None
|
|
358
|
+
self.linting.lint_file(file_path=path, fix=False, rules=rules,
|
|
359
|
+
exclude_rules=exclude_rules,
|
|
360
|
+
jinja_render_mode=jinja_render_mode)
|
|
361
|
+
else:
|
|
362
|
+
error_line(f"Could not find model '{name}' in models/ directory")
|
|
363
|
+
elif option == 4:
|
|
364
|
+
if not self.downloads:
|
|
365
|
+
error_line("Download service not available")
|
|
366
|
+
else:
|
|
367
|
+
self.downloads.download_sqlfluff_config(profiles_dir=self.profiles_dir, dbt_project_dir=self.linting.project_dir)
|
|
368
|
+
elif option == 5 and is_dbt2:
|
|
369
|
+
name = get_input_string(
|
|
370
|
+
"Enter model name or file path to format, or leave blank for the whole project "
|
|
371
|
+
"('0' to cancel): ",
|
|
372
|
+
allow_empty=True)
|
|
373
|
+
if name == "0":
|
|
374
|
+
complete_action()
|
|
375
|
+
continue
|
|
376
|
+
path = None
|
|
377
|
+
if name:
|
|
378
|
+
path = name if name.endswith(".sql") else self.linting.resolve_model_path(name)
|
|
379
|
+
if not path:
|
|
380
|
+
error_line(f"Could not find model '{name}' in models/ directory")
|
|
381
|
+
complete_action()
|
|
382
|
+
continue
|
|
383
|
+
check = get_input_true_false(
|
|
384
|
+
"Dry run only — report formatting issues without writing changes (--check)?", "n")
|
|
385
|
+
self.linting.format_file(file_path=path, check=check)
|
|
386
|
+
complete_action()
|
|
387
|
+
|
|
388
|
+
def _autofix_menu(self) -> None:
|
|
389
|
+
while True:
|
|
390
|
+
clear()
|
|
391
|
+
display_action_header("dbt Autofix")
|
|
392
|
+
menu_option(1, "deprecations - Fix deprecated configs for dbt 2.0")
|
|
393
|
+
menu_option(2, "packages - Upgrade packages for dbt 2.0 compatibility")
|
|
394
|
+
menu_option(3, "dry run - Preview deprecation fixes without writing")
|
|
395
|
+
menu_option(0, "back - Return to development menu")
|
|
396
|
+
option = get_input_number("Choose an option: ")
|
|
397
|
+
|
|
398
|
+
if option == 0:
|
|
399
|
+
return
|
|
400
|
+
|
|
401
|
+
# Ensure dbt-autofix is available
|
|
402
|
+
if not shutil.which("dbt-autofix"):
|
|
403
|
+
if not shutil.which("uv"):
|
|
404
|
+
error_line("uv not found — install uv first: https://astral.sh/uv")
|
|
405
|
+
complete_action()
|
|
406
|
+
continue
|
|
407
|
+
info_line("dbt-autofix not found. Installing via uv...")
|
|
408
|
+
try:
|
|
409
|
+
result = subprocess.run(["uv", "tool", "install", "dbt-autofix"],
|
|
410
|
+
capture_output=True, text=True)
|
|
411
|
+
if result.returncode != 0:
|
|
412
|
+
error_line(f"Failed to install dbt-autofix: {result.stderr.strip()}")
|
|
413
|
+
error_line("Install manually: uv tool install dbt-autofix")
|
|
414
|
+
complete_action()
|
|
415
|
+
continue
|
|
416
|
+
success_line("dbt-autofix installed")
|
|
417
|
+
except FileNotFoundError:
|
|
418
|
+
error_line("uv appears in PATH but is not runnable — reinstall uv")
|
|
419
|
+
complete_action()
|
|
420
|
+
continue
|
|
421
|
+
|
|
422
|
+
project_path = str(self.dbt.project_dir)
|
|
423
|
+
|
|
424
|
+
if option == 1:
|
|
425
|
+
info_line("Running dbt-autofix deprecations...")
|
|
426
|
+
result = subprocess.run(["dbt-autofix", "deprecations", "--path", project_path])
|
|
427
|
+
if result.returncode != 0:
|
|
428
|
+
error_line(f"dbt-autofix deprecations failed (exit code {result.returncode})")
|
|
429
|
+
elif option == 2:
|
|
430
|
+
info_line("Running dbt-autofix packages...")
|
|
431
|
+
result = subprocess.run(["dbt-autofix", "packages", "--path", project_path])
|
|
432
|
+
if result.returncode != 0:
|
|
433
|
+
error_line("dbt-autofix packages failed — skipping dbt deps")
|
|
434
|
+
else:
|
|
435
|
+
if get_input_true_false("Run dbt deps now?"):
|
|
436
|
+
self.dbt.deps()
|
|
437
|
+
elif option == 3:
|
|
438
|
+
info_line("Running dbt-autofix deprecations (dry run)...")
|
|
439
|
+
result = subprocess.run(["dbt-autofix", "deprecations", "--path", project_path, "--dry-run"])
|
|
440
|
+
if result.returncode != 0:
|
|
441
|
+
error_line(f"dbt-autofix dry run failed (exit code {result.returncode})")
|
|
442
|
+
|
|
443
|
+
complete_action()
|
|
@@ -74,33 +74,36 @@ class DownloadsMenu:
|
|
|
74
74
|
menu_option(0, "back - Return to main menu")
|
|
75
75
|
|
|
76
76
|
def _skills_menu(self) -> None:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
77
|
+
while True:
|
|
78
|
+
clear()
|
|
79
|
+
display_action_header("AI Coding Skills")
|
|
80
|
+
menu_option(1, "list - List available skills")
|
|
81
|
+
menu_option(2, "install - Install a specific skill")
|
|
82
|
+
menu_option(3, "install all - Install all available skills")
|
|
83
|
+
menu_option(4, "update - Update installed skills")
|
|
84
|
+
menu_option(0, "back - Return to downloads menu")
|
|
85
|
+
option = get_input_number("Choose an option: ")
|
|
86
|
+
if option == 0:
|
|
87
|
+
return
|
|
88
|
+
if option == 1:
|
|
89
|
+
self.skills.list_skills()
|
|
90
|
+
elif option == 2:
|
|
91
|
+
available = self.skills.get_available_skills()
|
|
92
|
+
if available:
|
|
93
|
+
names = {s.name: s for s in available}
|
|
94
|
+
selected = select_from_list(list(names.keys()), "skill")
|
|
95
|
+
if selected != "back" and selected in names:
|
|
96
|
+
targets = self._select_skill_targets()
|
|
97
|
+
self.skills.install_skill(names[selected], targets=targets)
|
|
98
|
+
else:
|
|
99
|
+
info_line("No skills available")
|
|
100
|
+
elif option == 3:
|
|
101
|
+
targets = self._select_skill_targets()
|
|
102
|
+
self.skills.install_all(targets=targets)
|
|
103
|
+
elif option == 4:
|
|
104
|
+
targets = self._select_skill_targets()
|
|
105
|
+
self.skills.update_skills(targets=targets)
|
|
106
|
+
complete_action()
|
|
104
107
|
|
|
105
108
|
def _select_skill_targets(self) -> list[str]:
|
|
106
109
|
"""Prompt user to select which IDE(s) to install skills for."""
|