blocks-cli 0.1.38__tar.gz → 0.1.40__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.
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/PKG-INFO +1 -1
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/create.py +45 -7
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/push.py +3 -1
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/setup.py +1 -1
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/LICENSE +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/MANIFEST.in +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/README.md +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/__init__.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/api.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/builds.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/bundles.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/__base__.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/__init__.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/configure.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/init.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/test.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/__init__.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/auth.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/config.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/console.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/fs.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/package.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/registration.py +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli.egg-info/SOURCES.txt +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/requirements.txt +0 -0
- {blocks-cli-0.1.38 → blocks-cli-0.1.40}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: blocks-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.40
|
|
4
4
|
Summary: CLI tool for Blocks, a platform for writing custom AI-enabled codebase automations in Python. Leverage a full codebase-aware API. Automatically trigger automations from Github, Slack, and other providers.
|
|
5
5
|
Home-page: https://github.com/BlocksOrg/sdk
|
|
6
6
|
Author: BlocksOrg
|
|
@@ -50,19 +50,57 @@ def create(
|
|
|
50
50
|
|
|
51
51
|
# Create main.py with basic template
|
|
52
52
|
with open(automation_dir / 'main.py', 'w') as f:
|
|
53
|
-
f.write('''
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
f.write('''import os
|
|
54
|
+
import slack_sdk
|
|
55
|
+
from enum import Enum
|
|
56
|
+
from blocks import agent, on
|
|
57
|
+
from smolagents import CodeAgent, WebSearchTool, LiteLLMModel
|
|
58
|
+
from pydantic import BaseModel
|
|
59
|
+
|
|
60
|
+
SLACK_TOKEN = os.getenv("SLACK_TOKEN")
|
|
61
|
+
|
|
62
|
+
class Models(str, Enum):
|
|
63
|
+
gpt_5 = "gpt-5"
|
|
64
|
+
claude4sonnet = "claude-sonnet-4-20250514"
|
|
65
|
+
|
|
66
|
+
class SmolAgentConfig(BaseModel):
|
|
67
|
+
model: Models = Models.gpt_5
|
|
68
|
+
|
|
69
|
+
@agent(name="{name}")
|
|
70
|
+
@on("slack.mention")
|
|
71
|
+
def {function_name}(input, config: SmolAgentConfig):
|
|
72
|
+
event = input.get("event")
|
|
73
|
+
text = event.get("text", "")
|
|
74
|
+
channel = event.get("channel", "")
|
|
75
|
+
ts = event.get("ts", "")
|
|
76
|
+
|
|
77
|
+
model = LiteLLMModel(
|
|
78
|
+
model_id=config.model,
|
|
79
|
+
)
|
|
80
|
+
agent = CodeAgent(tools=[WebSearchTool()], model=model)
|
|
81
|
+
agent.run(text)
|
|
82
|
+
|
|
83
|
+
client = slack_sdk.WebClient(token=SLACK_TOKEN)
|
|
84
|
+
client.chat_postMessage(channel=channel, text="Agent is thinking...", thread_ts=ts)
|
|
85
|
+
|
|
86
|
+
for _, step in enumerate(agent.memory.steps):
|
|
87
|
+
messages = step.to_messages()
|
|
88
|
+
for message in messages:
|
|
89
|
+
for content_message in message.content:
|
|
90
|
+
final_message = content_message.get("text", "")
|
|
91
|
+
if final_message and content_message.get("role") != "user":
|
|
92
|
+
client.chat_postMessage(channel=channel, text=final_message, thread_ts=ts)
|
|
59
93
|
'''.format(name=name, function_name=function_name))
|
|
60
94
|
|
|
61
95
|
sdk_version = get_latest_sdk_version()
|
|
62
96
|
latest_version = sdk_version.get("latest_version")
|
|
63
97
|
|
|
64
98
|
with open(automation_dir / 'requirements.txt', 'w') as f:
|
|
65
|
-
f.write('''blocks-sdk>={version}
|
|
99
|
+
f.write('''blocks-sdk>={version}
|
|
100
|
+
smolagents[toolkit]
|
|
101
|
+
litellm>=1.61.16,<=1.74.8
|
|
102
|
+
slack-sdk>=3.19.2
|
|
103
|
+
'''.format(version=latest_version))
|
|
66
104
|
|
|
67
105
|
console.print(f"Successfully created automation [green]{name}[/green] in [green]{automation_dir.absolute()}[/green]")
|
|
68
106
|
console.print(f"[green]{name}/\n main.py\n requirements.txt[/green]")
|
|
@@ -24,7 +24,8 @@ def push(
|
|
|
24
24
|
flag_value="patch",
|
|
25
25
|
help="Bump version for public automations. Options: major, minor, patch. Defaults to patch if no value provided.",
|
|
26
26
|
),
|
|
27
|
-
force_build: bool = typer.Option(False, "--force-build", help="Force a new build even if a successful build already exists")
|
|
27
|
+
force_build: bool = typer.Option(False, "--force-build", help="Force a new build even if a successful build already exists"),
|
|
28
|
+
build_args: Optional[str] = typer.Option(None, "--build-args", help="Build arguments to pass to the build command")
|
|
28
29
|
):
|
|
29
30
|
try:
|
|
30
31
|
warn_current_package_version()
|
|
@@ -126,6 +127,7 @@ def push(
|
|
|
126
127
|
"bundle_id": bundle_id,
|
|
127
128
|
"automations": [],
|
|
128
129
|
"force_build": force_build,
|
|
130
|
+
"build_args": build_args,
|
|
129
131
|
}
|
|
130
132
|
if bump_type is not None:
|
|
131
133
|
registration_payload["bump_type"] = bump_type
|
|
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
|