blocks-cli 0.1.40__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.40 → blocks-cli-0.1.41}/PKG-INFO +1 -1
  2. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/bundles.py +5 -1
  3. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/push.py +43 -3
  4. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/setup.py +1 -1
  5. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/LICENSE +0 -0
  6. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/MANIFEST.in +0 -0
  7. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/README.md +0 -0
  8. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/__init__.py +0 -0
  9. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/api.py +0 -0
  10. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/builds.py +0 -0
  11. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/__base__.py +0 -0
  12. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/__init__.py +0 -0
  13. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/configure.py +0 -0
  14. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/create.py +0 -0
  15. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/init.py +0 -0
  16. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/commands/test.py +0 -0
  17. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/config/__init__.py +0 -0
  18. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/config/auth.py +0 -0
  19. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/config/config.py +0 -0
  20. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/console.py +0 -0
  21. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/fs.py +0 -0
  22. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/package.py +0 -0
  23. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli/registration.py +0 -0
  24. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/blocks_cli.egg-info/SOURCES.txt +0 -0
  25. {blocks-cli-0.1.40 → blocks-cli-0.1.41}/requirements.txt +0 -0
  26. {blocks-cli-0.1.40 → 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.40
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
@@ -87,7 +87,31 @@ def push(
87
87
  except Exception as e:
88
88
  pass
89
89
 
90
- 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
91
115
  bundle_upload = get_bundle_upload_url()
92
116
 
93
117
  bundle_id = bundle_upload.get("bundle_id")
@@ -103,10 +127,24 @@ def push(
103
127
 
104
128
  # get pip dependencies
105
129
  pip_dependencies = []
130
+ npm_dependencies: Dict[str, Any] = {}
106
131
  if Path(requirements_path).exists():
107
132
  with open(requirements_path, "r") as f:
108
133
  pip_dependencies = f.read().splitlines()
109
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
+
110
148
  init_progress.update(
111
149
  init_task, total=1, description="Collecting automations..."
112
150
  )
@@ -129,6 +167,8 @@ def push(
129
167
  "force_build": force_build,
130
168
  "build_args": build_args,
131
169
  }
170
+ if npm_dependencies:
171
+ registration_payload["npm_dependencies"] = npm_dependencies
132
172
  if bump_type is not None:
133
173
  registration_payload["bump_type"] = bump_type
134
174
 
@@ -260,4 +300,4 @@ def push(
260
300
  raise typer.Exit(1)
261
301
  except Exception as e:
262
302
  console.print(f"[red]{str(e)}[/red]")
263
- 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.40",
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