tinybird 0.0.1.dev225__tar.gz → 0.0.1.dev227__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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/prompts.py +87 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/create.py +32 -4
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datasource.py +2 -1
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/feedback_manager.py +1 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/llm.py +17 -4
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/mock.py +4 -2
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/test.py +1 -1
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/setup.cfg +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -974,6 +974,93 @@ Follow these instructions when evolving a datasource schema:
|
|
|
974
974
|
)
|
|
975
975
|
|
|
976
976
|
|
|
977
|
+
def claude_rules_prompt(source: Optional[str] = None) -> str:
|
|
978
|
+
base_command = source or "tb"
|
|
979
|
+
return """
|
|
980
|
+
# Tinybird CLI rules
|
|
981
|
+
|
|
982
|
+
## Commands
|
|
983
|
+
You have commands at your disposal to develop a tinybird project:
|
|
984
|
+
- {base_command} build: to build the project locally and check it works.
|
|
985
|
+
- {base_command} deployment create --wait --auto: to create a deployment and promote it automatically
|
|
986
|
+
- {base_command} test run: to run existing tests
|
|
987
|
+
- {base_command} endpoint url <pipe_name>: to get the url of an endpoint, token included.
|
|
988
|
+
- {base_command} endpoint data <pipe_name>: to get the data of an endpoint. You can pass parameters to the endpoint like this: {base_command} endpoint data <pipe_name> --param1 value1 --param2 value2
|
|
989
|
+
- {base_command} token ls: to list all the tokens
|
|
990
|
+
There are other commands that you can use, but these are the most common ones. Run `{base_command} -h` to see all the commands if needed.
|
|
991
|
+
When you need to work with resources or data in cloud, add always the --cloud flag before the command. Example: {base_command} --cloud datasource ls
|
|
992
|
+
|
|
993
|
+
## Development instructions
|
|
994
|
+
- When asking to create a tinybird data project, if the needed folders are not already created, use the following structure:
|
|
995
|
+
├── connections
|
|
996
|
+
├── copies
|
|
997
|
+
├── sinks
|
|
998
|
+
├── datasources
|
|
999
|
+
├── endpoints
|
|
1000
|
+
├── fixtures
|
|
1001
|
+
├── materializations
|
|
1002
|
+
├── pipes
|
|
1003
|
+
└── tests
|
|
1004
|
+
- The local development server will be available at http://localhost:7181. Even if some response uses another base url, use always http://localhost:7181.
|
|
1005
|
+
- After every change in your .datasource, .pipe or .ndjson files, run `{base_command} build` to build the project locally.
|
|
1006
|
+
- When you need to ingest data locally in a datasource, create a .ndjson file with the same name of the datasource and the data you want and run `{base_command} build` so the data is ingested.
|
|
1007
|
+
- The format of the generated api endpoint urls is: http://localhost:7181/v0/pipe/<pipe_name>.json?token=<token>
|
|
1008
|
+
- Before running the tests, remember to have the project built with `{base_command} build` with the latest changes.
|
|
1009
|
+
</development_instructions>
|
|
1010
|
+
When asking for ingesting data, adding data or appending data do the following depending on the environment you want to work with:
|
|
1011
|
+
|
|
1012
|
+
## Ingestion instructions
|
|
1013
|
+
- When building locally, create a .ndjson file with the data you want to ingest and do `{base_command} build` to ingest the data in the build env.
|
|
1014
|
+
- We call `cloud` the production environment.
|
|
1015
|
+
- When appending data in cloud, use `{base_command} --cloud datasource append <datasource_name> <file_name>`
|
|
1016
|
+
- When you have a response that says “there are rows in quarantine”, do `{base_command} [--cloud] datasource data <datasource_name>_quarantine` to understand what is the problem.
|
|
1017
|
+
|
|
1018
|
+
## .datasource file instructions
|
|
1019
|
+
Follow these instructions when creating or updating .datasource files:
|
|
1020
|
+
{datasource_instructions}
|
|
1021
|
+
|
|
1022
|
+
## .pipe file instructions
|
|
1023
|
+
Follow these instructions when creating or updating .pipe files:
|
|
1024
|
+
{pipe_instructions}
|
|
1025
|
+
{sql_instructions}
|
|
1026
|
+
{datasource_example}
|
|
1027
|
+
{pipe_example}
|
|
1028
|
+
{copy_pipe_instructions}
|
|
1029
|
+
{materialized_pipe_instructions}
|
|
1030
|
+
{sink_pipe_instructions}
|
|
1031
|
+
{connection_instructions}
|
|
1032
|
+
{kafka_connection_example}
|
|
1033
|
+
{gcs_connection_example}
|
|
1034
|
+
{gcs_hmac_connection_example}
|
|
1035
|
+
{s3_connection_example}
|
|
1036
|
+
|
|
1037
|
+
## .test file instructions
|
|
1038
|
+
Follow these instructions when creating or updating .yaml files for tests:
|
|
1039
|
+
{test_instructions}
|
|
1040
|
+
|
|
1041
|
+
## Deployment instructions
|
|
1042
|
+
Follow these instructions when evolving a datasource schema:
|
|
1043
|
+
{deployment_instructions}
|
|
1044
|
+
""".format(
|
|
1045
|
+
base_command=base_command,
|
|
1046
|
+
datasource_instructions=datasource_instructions,
|
|
1047
|
+
pipe_instructions=pipe_instructions,
|
|
1048
|
+
sql_instructions=sql_instructions,
|
|
1049
|
+
datasource_example=datasource_example,
|
|
1050
|
+
pipe_example=pipe_example,
|
|
1051
|
+
copy_pipe_instructions=copy_pipe_instructions,
|
|
1052
|
+
materialized_pipe_instructions=materialized_pipe_instructions,
|
|
1053
|
+
sink_pipe_instructions=sink_pipe_instructions,
|
|
1054
|
+
test_instructions=test_instructions,
|
|
1055
|
+
deployment_instructions=deployment_instructions,
|
|
1056
|
+
connection_instructions=connection_instructions,
|
|
1057
|
+
kafka_connection_example=kafka_connection_example,
|
|
1058
|
+
gcs_connection_example=gcs_connection_example,
|
|
1059
|
+
gcs_hmac_connection_example=gcs_hmac_connection_example,
|
|
1060
|
+
s3_connection_example=s3_connection_example,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
|
|
977
1064
|
test_instructions = """
|
|
978
1065
|
- The test file name must match the name of the pipe it is testing.
|
|
979
1066
|
- Every scenario name must be unique inside the test file.
|
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/forward/commands'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev227'
|
|
8
|
+
__revision__ = 'fb681ea'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import glob
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
|
+
import shutil
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Any, Dict, List, Optional
|
|
6
7
|
from urllib.parse import urlparse
|
|
@@ -8,7 +9,7 @@ from urllib.parse import urlparse
|
|
|
8
9
|
import click
|
|
9
10
|
import requests
|
|
10
11
|
|
|
11
|
-
from tinybird.prompts import create_prompt, readme_prompt, rules_prompt
|
|
12
|
+
from tinybird.prompts import claude_rules_prompt, create_prompt, readme_prompt, rules_prompt
|
|
12
13
|
from tinybird.tb.client import TinyB
|
|
13
14
|
from tinybird.tb.modules.cicd import init_cicd
|
|
14
15
|
from tinybird.tb.modules.cli import cli
|
|
@@ -115,6 +116,7 @@ async def create(
|
|
|
115
116
|
readme_path.read_text(), tb_client.host, "$TB_ADMIN_TOKEN", all_resources_xml
|
|
116
117
|
),
|
|
117
118
|
prompt=readme_user_prompt,
|
|
119
|
+
feature="tb_create_readme",
|
|
118
120
|
)
|
|
119
121
|
readme_result = extract_xml(readme_response, "readme")
|
|
120
122
|
readme_path.write_text(readme_result)
|
|
@@ -144,6 +146,13 @@ async def create(
|
|
|
144
146
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
145
147
|
created_something = True
|
|
146
148
|
|
|
149
|
+
if not already_has_claude_rules(root_folder):
|
|
150
|
+
click.echo(FeedbackManager.highlight(message="\n» Creating Claude Code rules..."))
|
|
151
|
+
create_claude_rules(root_folder, "tb")
|
|
152
|
+
click.echo(FeedbackManager.info(message="CLAUDE.md"))
|
|
153
|
+
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
154
|
+
created_something = True
|
|
155
|
+
|
|
147
156
|
if should_generate_fixtures(result):
|
|
148
157
|
click.echo(FeedbackManager.highlight(message="\n» Generating fixtures..."))
|
|
149
158
|
|
|
@@ -246,6 +255,11 @@ def already_has_cursor_rules(folder: str) -> bool:
|
|
|
246
255
|
return any((Path(folder) / path).exists() for path in cursor_rules_paths)
|
|
247
256
|
|
|
248
257
|
|
|
258
|
+
def already_has_claude_rules(folder: str) -> bool:
|
|
259
|
+
claude_rules_path = "CLAUDE.md"
|
|
260
|
+
return (Path(folder) / claude_rules_path).exists()
|
|
261
|
+
|
|
262
|
+
|
|
249
263
|
def already_has_env_file(folder: str) -> bool:
|
|
250
264
|
env_file_pattern = ".env.*"
|
|
251
265
|
return any((Path(folder) / path).exists() for path in glob.glob(env_file_pattern))
|
|
@@ -282,6 +296,7 @@ async def create_resources_from_prompt(
|
|
|
282
296
|
user_token: str,
|
|
283
297
|
prompt: str,
|
|
284
298
|
project: Project,
|
|
299
|
+
feature: str = "tb_create_resources",
|
|
285
300
|
) -> List[Path]:
|
|
286
301
|
result: List[Path] = []
|
|
287
302
|
datasource_paths = [Path(ds_file) for ds_file in project.get_datasource_files()]
|
|
@@ -312,7 +327,7 @@ async def create_resources_from_prompt(
|
|
|
312
327
|
]
|
|
313
328
|
)
|
|
314
329
|
llm = LLM(user_token=user_token, host=tb_client.host)
|
|
315
|
-
prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt)
|
|
330
|
+
prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt, feature=feature)
|
|
316
331
|
prompt_result = extract_xml(prompt_result, "response")
|
|
317
332
|
resources = parse_xml(prompt_result, "resource")
|
|
318
333
|
datasources = []
|
|
@@ -466,9 +481,22 @@ def create_rules(folder: str, source: str, agent: str):
|
|
|
466
481
|
elif agent == "windsurf":
|
|
467
482
|
extension = ".windsurfrules"
|
|
468
483
|
else:
|
|
469
|
-
extension = ".
|
|
484
|
+
extension = ".md"
|
|
485
|
+
|
|
470
486
|
rules_file = Path(folder) / extension
|
|
471
|
-
|
|
487
|
+
rules_content = rules_prompt(source)
|
|
488
|
+
rules_file.write_text(rules_content)
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def create_claude_rules(folder: str, source: str):
|
|
492
|
+
try:
|
|
493
|
+
is_claude_code_installed = shutil.which("claude") is not None
|
|
494
|
+
if is_claude_code_installed:
|
|
495
|
+
rules_content = claude_rules_prompt(source)
|
|
496
|
+
claude_file = Path(folder) / "CLAUDE.md"
|
|
497
|
+
claude_file.write_text(rules_content)
|
|
498
|
+
except Exception:
|
|
499
|
+
pass
|
|
472
500
|
|
|
473
501
|
|
|
474
502
|
def get_context_file() -> Path:
|
|
@@ -781,7 +781,7 @@ async def datasource_create(
|
|
|
781
781
|
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
782
782
|
project_config = CLIConfig.get_project_config()
|
|
783
783
|
tb_client: TinyB = project_config.get_client(token=config.get("token"), host=config.get("host"))
|
|
784
|
-
await create_resources_from_prompt(tb_client, user_token, prompt, project)
|
|
784
|
+
await create_resources_from_prompt(tb_client, user_token, prompt, project, feature="tb_datasource_create")
|
|
785
785
|
click.echo(FeedbackManager.success(message="✓ .datasource created!"))
|
|
786
786
|
return
|
|
787
787
|
|
|
@@ -1023,6 +1023,7 @@ async def analyze_quarantine(datasource_name: str, project: Project, client: Tin
|
|
|
1023
1023
|
response_llm = llm.ask(
|
|
1024
1024
|
system_prompt=quarantine_prompt(datasource_definition),
|
|
1025
1025
|
prompt=f"The quarantine errors are:\n{json.dumps(quarantine_data)}",
|
|
1026
|
+
feature="tb_datasource_append_analyze_quarantine",
|
|
1026
1027
|
)
|
|
1027
1028
|
response = extract_xml(response_llm, "quarantine_errors")
|
|
1028
1029
|
error_message += "\n" + response
|
|
@@ -636,6 +636,7 @@ STEP 2: CREATE GCP SERVICE ACCOUNT
|
|
|
636
636
|
- For GCS Sink (writing to GCS), select all three roles:
|
|
637
637
|
• "Storage Object Creator" - Allows users to create objects
|
|
638
638
|
• "Storage Object Viewer" - Grants access to view objects and their metadata
|
|
639
|
+
• "Storage Bucket Viewer" - Grants access to view buckets and their metadata
|
|
639
640
|
(You can add IAM condition to provide access to selected buckets. More info in IAM Conditions: https://cloud.google.com/iam/docs/conditions-overview)
|
|
640
641
|
5. Click "Done"
|
|
641
642
|
"""
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
1
4
|
import requests
|
|
2
5
|
|
|
6
|
+
from tinybird.tb.modules.cli import CLIConfig
|
|
3
7
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
4
8
|
|
|
5
9
|
|
|
@@ -16,7 +20,7 @@ class LLM:
|
|
|
16
20
|
self.host = host
|
|
17
21
|
self.user_token = user_token
|
|
18
22
|
|
|
19
|
-
def ask(self, system_prompt: str, prompt: str) -> str:
|
|
23
|
+
def ask(self, system_prompt: str, prompt: str, feature: Optional[str] = None) -> str:
|
|
20
24
|
"""
|
|
21
25
|
Calls the model with the given prompt and returns the response.
|
|
22
26
|
|
|
@@ -29,14 +33,23 @@ class LLM:
|
|
|
29
33
|
"""
|
|
30
34
|
|
|
31
35
|
data = {"system": system_prompt, "prompt": prompt}
|
|
32
|
-
|
|
36
|
+
params = {"origin": "cli"}
|
|
37
|
+
if feature:
|
|
38
|
+
params["feature"] = feature
|
|
39
|
+
cli_config = CLIConfig.get_project_config()
|
|
40
|
+
workspace_id = cli_config.get("id")
|
|
41
|
+
params_str = urllib.parse.urlencode(params)
|
|
42
|
+
if workspace_id:
|
|
43
|
+
llm_url = f"{self.host}/v0/llm/{workspace_id}?{params_str}"
|
|
44
|
+
else:
|
|
45
|
+
llm_url = f"{self.host}/v0/llm?{params_str}"
|
|
33
46
|
response = requests.post(
|
|
34
|
-
|
|
47
|
+
llm_url,
|
|
35
48
|
headers={"Authorization": f"Bearer {self.user_token}"},
|
|
36
49
|
data=data,
|
|
37
50
|
)
|
|
38
51
|
|
|
39
52
|
if not response.ok:
|
|
40
|
-
raise LLMException(FeedbackManager.
|
|
53
|
+
raise LLMException(FeedbackManager.error(message=response.text))
|
|
41
54
|
|
|
42
55
|
return response.json().get("result", "")
|
|
@@ -132,7 +132,7 @@ async def create_mock_data(
|
|
|
132
132
|
sql_path = None
|
|
133
133
|
while True:
|
|
134
134
|
try:
|
|
135
|
-
response = llm.ask(system_prompt=mock_prompt(rows, error), prompt=prompt)
|
|
135
|
+
response = llm.ask(system_prompt=mock_prompt(rows, error), prompt=prompt, feature="tb_mock")
|
|
136
136
|
sql = extract_xml(response, "sql")
|
|
137
137
|
sql_path = persist_fixture_sql(datasource_name, sql, folder)
|
|
138
138
|
sql_format = "JSON" if format_ == "ndjson" else "CSV"
|
|
@@ -149,7 +149,9 @@ async def create_mock_data(
|
|
|
149
149
|
error = str(e)
|
|
150
150
|
attempts += 1
|
|
151
151
|
if attempts > 5:
|
|
152
|
-
raise Exception(
|
|
152
|
+
raise Exception(
|
|
153
|
+
f"Failed to generate a valid solution. Check {str(sql_path or '.sql path')} and try again."
|
|
154
|
+
)
|
|
153
155
|
else:
|
|
154
156
|
continue
|
|
155
157
|
return data
|
|
@@ -102,7 +102,7 @@ def test_create(ctx: click.Context, name_or_filename: str, prompt: str) -> None:
|
|
|
102
102
|
raise Exception("No user token found")
|
|
103
103
|
|
|
104
104
|
llm = LLM(user_token=user_token, host=config.get_client().host)
|
|
105
|
-
response_llm = llm.ask(system_prompt=system_prompt, prompt=prompt)
|
|
105
|
+
response_llm = llm.ask(system_prompt=system_prompt, prompt=prompt, feature="tb_test_create")
|
|
106
106
|
response_xml = extract_xml(response_llm, "response")
|
|
107
107
|
tests_content = parse_xml(response_xml, "test")
|
|
108
108
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb/modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev225 → tinybird-0.0.1.dev227}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|