blocks-cli 0.1.39__tar.gz → 0.1.41__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.39 → blocks-cli-0.1.41}/PKG-INFO +1 -1
  2. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/bundles.py +5 -1
  3. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/push.py +46 -4
  4. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/setup.py +1 -1
  5. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/LICENSE +0 -0
  6. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/MANIFEST.in +0 -0
  7. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/README.md +0 -0
  8. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/__init__.py +0 -0
  9. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/api.py +0 -0
  10. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/builds.py +0 -0
  11. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/__base__.py +0 -0
  12. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/__init__.py +0 -0
  13. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/configure.py +0 -0
  14. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/create.py +0 -0
  15. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/init.py +0 -0
  16. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/commands/test.py +0 -0
  17. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/config/__init__.py +0 -0
  18. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/config/auth.py +0 -0
  19. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/config/config.py +0 -0
  20. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/console.py +0 -0
  21. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/fs.py +0 -0
  22. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/package.py +0 -0
  23. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli/registration.py +0 -0
  24. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/blocks_cli.egg-info/SOURCES.txt +0 -0
  25. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/requirements.txt +0 -0
  26. {blocks-cli-0.1.39 → blocks-cli-0.1.41}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blocks-cli
3
- Version: 0.1.39
3
+ Version: 0.1.41
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
@@ -10,7 +10,11 @@ from blocks_cli.builds import api_client
10
10
 
11
11
  def get_bundle_upload_url():
12
12
  response = api_client.put(f"{config.clients.client_url}/v1/bundles/upload")
13
- response.raise_for_status()
13
+ try:
14
+ response.raise_for_status()
15
+ except Exception as e:
16
+ raise Exception(f"Failed to get bundle upload URL: {response.text}")
17
+
14
18
  return response.json()
15
19
 
16
20
 
@@ -1,4 +1,4 @@
1
- from typing import Optional
1
+ from typing import Optional, Dict, Any
2
2
  import git
3
3
  import typer
4
4
  import re
@@ -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()
@@ -86,7 +87,31 @@ def push(
86
87
  except Exception as e:
87
88
  pass
88
89
 
89
- requirements_path = str((cwd / "requirements.txt").resolve())
90
+ # Detect requirements.txt either near the automation or at repo root
91
+ requirements_path = None
92
+ try:
93
+ repo = git.Repo(search_parent_directories=True)
94
+ repo_root = Path(repo.working_tree_dir)
95
+ except Exception:
96
+ repo_root = None
97
+
98
+ candidate_paths = [cwd / "requirements.txt"]
99
+ if repo_root:
100
+ candidate_paths.append(repo_root / "requirements.txt")
101
+ for p in candidate_paths:
102
+ if p.exists():
103
+ requirements_path = str(p.resolve())
104
+ break
105
+
106
+ # Detect package.json either near the automation or at repo root
107
+ package_json_path = None
108
+ candidate_paths = [cwd / "package.json"]
109
+ if repo_root:
110
+ candidate_paths.append(repo_root / "package.json")
111
+ for p in candidate_paths:
112
+ if p.exists():
113
+ package_json_path = str(p.resolve())
114
+ break
90
115
  bundle_upload = get_bundle_upload_url()
91
116
 
92
117
  bundle_id = bundle_upload.get("bundle_id")
@@ -102,10 +127,24 @@ def push(
102
127
 
103
128
  # get pip dependencies
104
129
  pip_dependencies = []
130
+ npm_dependencies: Dict[str, Any] = {}
105
131
  if Path(requirements_path).exists():
106
132
  with open(requirements_path, "r") as f:
107
133
  pip_dependencies = f.read().splitlines()
108
134
 
135
+ # Read npm dependencies from package.json if present
136
+ if package_json_path:
137
+ try:
138
+ import json
139
+ with open(package_json_path, "r") as f:
140
+ pkg = json.load(f)
141
+ deps = pkg.get("dependencies", {}) or {}
142
+ if isinstance(deps, dict) and len(deps.keys()) > 0:
143
+ npm_dependencies = {"dependencies": deps}
144
+ except Exception:
145
+ # Best-effort: ignore malformed package.json
146
+ npm_dependencies = {}
147
+
109
148
  init_progress.update(
110
149
  init_task, total=1, description="Collecting automations..."
111
150
  )
@@ -126,7 +165,10 @@ def push(
126
165
  "bundle_id": bundle_id,
127
166
  "automations": [],
128
167
  "force_build": force_build,
168
+ "build_args": build_args,
129
169
  }
170
+ if npm_dependencies:
171
+ registration_payload["npm_dependencies"] = npm_dependencies
130
172
  if bump_type is not None:
131
173
  registration_payload["bump_type"] = bump_type
132
174
 
@@ -258,4 +300,4 @@ def push(
258
300
  raise typer.Exit(1)
259
301
  except Exception as e:
260
302
  console.print(f"[red]{str(e)}[/red]")
261
- raise typer.Exit(1)
303
+ raise typer.Exit(1)
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.39",
9
+ version="0.1.41",
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