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.
Files changed (26) hide show
  1. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/PKG-INFO +1 -1
  2. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/create.py +45 -7
  3. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/push.py +3 -1
  4. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/setup.py +1 -1
  5. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/LICENSE +0 -0
  6. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/MANIFEST.in +0 -0
  7. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/README.md +0 -0
  8. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/__init__.py +0 -0
  9. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/api.py +0 -0
  10. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/builds.py +0 -0
  11. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/bundles.py +0 -0
  12. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/__base__.py +0 -0
  13. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/__init__.py +0 -0
  14. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/configure.py +0 -0
  15. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/init.py +0 -0
  16. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/commands/test.py +0 -0
  17. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/__init__.py +0 -0
  18. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/auth.py +0 -0
  19. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/config/config.py +0 -0
  20. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/console.py +0 -0
  21. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/fs.py +0 -0
  22. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/package.py +0 -0
  23. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli/registration.py +0 -0
  24. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/blocks_cli.egg-info/SOURCES.txt +0 -0
  25. {blocks-cli-0.1.38 → blocks-cli-0.1.40}/requirements.txt +0 -0
  26. {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.38
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('''from blocks import task, on
54
-
55
- @task(name="{name}")
56
- @on("", repos=[])
57
- def {function_name}(input):
58
- print(input)
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}'''.format(version=latest_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
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.38",
9
+ version="0.1.40",
10
10
  packages=find_packages(),
11
11
  include_package_data=True,
12
12
  install_requires=requirements,
File without changes
File without changes
File without changes
File without changes