synapseForge 0.1.24.dev2__tar.gz → 0.1.24.dev3__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 (38) hide show
  1. {synapseforge-0.1.24.dev2/synapseForge.egg-info → synapseforge-0.1.24.dev3}/PKG-INFO +1 -1
  2. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/config_handler.py +49 -35
  3. synapseforge-0.1.24.dev3/pipeline/init/template_handler.py +62 -0
  4. synapseforge-0.1.24.dev3/pipeline/template.zip +0 -0
  5. synapseforge-0.1.24.dev3/pipeline/update/main.py +44 -0
  6. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pyproject.toml +2 -2
  7. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3/synapseForge.egg-info}/PKG-INFO +1 -1
  8. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseForge.egg-info/SOURCES.txt +1 -0
  9. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/__init__.py +1 -1
  10. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/cli/main.py +25 -0
  11. synapseforge-0.1.24.dev2/pipeline/init/template_handler.py +0 -89
  12. synapseforge-0.1.24.dev2/pipeline/template.zip +0 -0
  13. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/LICENSE +0 -0
  14. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/README.md +0 -0
  15. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/README_PYPI.md +0 -0
  16. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/__init__.py +0 -0
  17. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/__init__.py +0 -0
  18. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/__main__.py +0 -0
  19. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/input_handler.py +0 -0
  20. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/logo_handler.py +0 -0
  21. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/main.py +0 -0
  22. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/placeholder_handler.py +0 -0
  23. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/init/venv_handler.py +0 -0
  24. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/launch/__init__.py +0 -0
  25. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/launch/forge.py +0 -0
  26. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/pipeline/launch/templates/launcher.py +0 -0
  27. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/setup.cfg +0 -0
  28. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseForge.egg-info/dependency_links.txt +0 -0
  29. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseForge.egg-info/entry_points.txt +0 -0
  30. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseForge.egg-info/requires.txt +0 -0
  31. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseForge.egg-info/top_level.txt +0 -0
  32. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/__main__.py +0 -0
  33. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/cli/__init__.py +0 -0
  34. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/tk/__init__.py +0 -0
  35. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/tk/colors_app.py +0 -0
  36. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/tk/init_app.py +0 -0
  37. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/tk/logo.ico +0 -0
  38. {synapseforge-0.1.24.dev2 → synapseforge-0.1.24.dev3}/synapseforge/tk/logo.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapseForge
3
- Version: 0.1.24.dev2
3
+ Version: 0.1.24.dev3
4
4
  Summary: AI agent project scaffolding & distribution CLI
5
5
  Author-email: "synapse.ai" <developer@synapseaihub.com.ar>
6
6
  Maintainer-email: "synapse.ai" <developer@synapseaihub.com.ar>
@@ -1,35 +1,49 @@
1
- """Step 5 — Save the user-provided config as ``config/replace.json`` and ``frontend/public/colors.json``."""
2
-
3
- import json
4
- from pathlib import Path
5
-
6
-
7
- CONFIGURABLE_COLOR_KEYS = ("primary", "secondary", "primary_text", "gradient_secondary", "usar_gradiente")
8
-
9
-
10
- def save_config(target: Path, config: dict) -> None:
11
- """Write the user config to ``{target}/config/replace.json`` and colors to ``frontend/public/colors.json``.
12
-
13
- Args:
14
- target: Project root directory.
15
- config: Validated user config dictionary.
16
- """
17
- config_dir = target / "config"
18
- config_dir.mkdir(parents=True, exist_ok=True)
19
-
20
- dest = config_dir / "replace.json"
21
- with open(dest, "w", encoding="utf-8") as f:
22
- json.dump(config, f, indent=2, ensure_ascii=False)
23
-
24
- print(f" Saved: {dest}")
25
-
26
- # Also generate colors.json for runtime in frontend/public/
27
- colors = config.get("colors", {})
28
- runtime_colors = {k: colors.get(k) for k in CONFIGURABLE_COLOR_KEYS if colors.get(k)}
29
- if runtime_colors:
30
- public_dir = target / "frontend" / "public"
31
- public_dir.mkdir(parents=True, exist_ok=True)
32
- colors_dest = public_dir / "colors.json"
33
- with open(colors_dest, "w", encoding="utf-8") as f:
34
- json.dump(runtime_colors, f, indent=2, ensure_ascii=False)
35
- print(f" Saved: {colors_dest}")
1
+ """Step 5 — Save the user-provided config as ``config/replace.json`` and ``frontend/public/colors.json``."""
2
+
3
+ import json
4
+ from pathlib import Path
5
+
6
+
7
+ CONFIGURABLE_COLOR_KEYS = ("primary", "secondary", "primary_text", "gradient_secondary", "usar_gradiente")
8
+
9
+
10
+ def save_config(target: Path, config: dict) -> None:
11
+ """Write the user config to ``{target}/config/replace.json`` and colors to ``frontend/public/colors.json``.
12
+
13
+ Args:
14
+ target: Project root directory.
15
+ config: Validated user config dictionary.
16
+ """
17
+ config_dir = target / "config"
18
+ config_dir.mkdir(parents=True, exist_ok=True)
19
+
20
+ dest = config_dir / "replace.json"
21
+ with open(dest, "w", encoding="utf-8") as f:
22
+ json.dump(config, f, indent=2, ensure_ascii=False)
23
+
24
+ print(f" Saved: {dest}")
25
+
26
+ # Also generate colors.json for runtime in frontend/public/
27
+ save_colors(target, config)
28
+
29
+
30
+ def save_colors(target: Path, config: dict) -> None:
31
+ """Generate ``colors.json`` for runtime in ``frontend/public/``."""
32
+ colors = config.get("colors", {})
33
+ runtime_colors = {k: colors.get(k) for k in CONFIGURABLE_COLOR_KEYS if colors.get(k)}
34
+ if runtime_colors:
35
+ public_dir = target / "frontend" / "public"
36
+ public_dir.mkdir(parents=True, exist_ok=True)
37
+ colors_dest = public_dir / "colors.json"
38
+ with open(colors_dest, "w", encoding="utf-8") as f:
39
+ json.dump(runtime_colors, f, indent=2, ensure_ascii=False)
40
+ print(f" Saved: {colors_dest}")
41
+
42
+
43
+ def load_config(target: Path) -> dict:
44
+ """Load the user config from ``{target}/config/replace.json``."""
45
+ dest = target / "config" / "replace.json"
46
+ if not dest.is_file():
47
+ raise FileNotFoundError(f"Configuration file not found: {dest}")
48
+ with open(dest, "r", encoding="utf-8") as f:
49
+ return json.load(f)
@@ -0,0 +1,62 @@
1
+ """Step 2 — Download template.zip from GitHub and extract into target."""
2
+
3
+ import sys
4
+ import urllib.request
5
+ import zipfile
6
+ from pathlib import Path
7
+
8
+ # ---------------------------------------------------------------------------
9
+ # URL used to download the template.
10
+ # ---------------------------------------------------------------------------
11
+ TEMPLATE_URL = (
12
+ "https://github.com/synapse-ai-hub/synapseForge/raw/main/pipeline/template.zip"
13
+ )
14
+
15
+
16
+ def extract_template(target: Path) -> None:
17
+ """Download the template zip from GitHub and extract into *target*.
18
+
19
+ If the download fails, the process exits with an error.
20
+ """
21
+ zip_path = _download_template(target)
22
+ if zip_path is None:
23
+ print(" ERROR: could not obtain template.zip")
24
+ sys.exit(1)
25
+
26
+ _safe_extract(zip_path, target)
27
+
28
+ # Delete the downloaded zip.
29
+ zip_path.unlink(missing_ok=True)
30
+
31
+ print(f" Extracted to: {target}")
32
+
33
+
34
+ # ---------------------------------------------------------------------------
35
+ # Internal helpers
36
+ # ---------------------------------------------------------------------------
37
+
38
+
39
+ def _download_template(target: Path) -> Path | None:
40
+ """Download template.zip from GitHub into *target*."""
41
+ try:
42
+ dest = target / "template.zip"
43
+ print(" Downloading template from GitHub …")
44
+ urllib.request.urlretrieve(TEMPLATE_URL, dest)
45
+ print(f" Downloaded: {dest}")
46
+ return dest
47
+ except Exception as exc:
48
+ print(f" Download failed: {exc}")
49
+ return None
50
+
51
+
52
+ def _safe_extract(zip_path: Path, target: Path) -> None:
53
+ """Extract zip, overwriting existing files silently."""
54
+ try:
55
+ with zipfile.ZipFile(zip_path, "r") as zf:
56
+ zf.extractall(path=target)
57
+ except zipfile.BadZipFile:
58
+ print(f" ERROR: corrupted zip file: {zip_path}")
59
+ sys.exit(1)
60
+ except Exception as exc:
61
+ print(f" ERROR extracting zip: {exc}")
62
+ sys.exit(1)
@@ -0,0 +1,44 @@
1
+ """Orchestrates the update pipeline."""
2
+
3
+ import shutil
4
+ import json
5
+ from pathlib import Path
6
+ from ..init.template_handler import extract_template
7
+ from ..init.config_handler import load_config, save_colors
8
+ from ..init.placeholder_handler import replace_all_placeholders
9
+
10
+ def run_update(target_dir: str) -> None:
11
+ """Update the project with the latest template, preserving user config."""
12
+ target = Path(target_dir).resolve()
13
+ config_path = target / "config" / "replace.json"
14
+
15
+ if not config_path.is_file():
16
+ print(f"ERROR: Configuration file not found at {config_path}. Cannot update.")
17
+ return
18
+
19
+ print("=" * 60)
20
+ print(" synapseForge — Update Pipeline")
21
+ print("=" * 60)
22
+
23
+ # 1. Load existing config
24
+ print("\n[1/4] Loading existing configuration ...")
25
+ config = load_config(target)
26
+
27
+ # 2. Extract new template (overwriting base files)
28
+ # Note: extract_template needs to be careful not to delete config/replace.json
29
+ # The current extract_template implementation might need review.
30
+ # Assuming it extracts to a temp dir and then copies/merges.
31
+ print("\n[2/4] Extracting new template ...")
32
+ extract_template(target)
33
+
34
+ # 3. Re-apply placeholders
35
+ print("\n[3/4] Re-applying placeholders ...")
36
+ replace_all_placeholders(target, config)
37
+
38
+ # 4. Regenerate derived files (colors.json)
39
+ print("\n[4/4] Regenerating derived files ...")
40
+ save_colors(target, config)
41
+
42
+ print("\n" + "=" * 60)
43
+ print(" Update completed successfully!")
44
+ print("=" * 60)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "synapseForge"
7
- version = "0.1.24.dev2"
7
+ version = "0.1.24.dev3"
8
8
  description = "AI agent project scaffolding & distribution CLI"
9
9
  readme = "README_PYPI.md"
10
10
  license = {text = "Apache-2.0"}
@@ -63,7 +63,7 @@ where = ["."]
63
63
  include = ["synapseforge*", "pipeline*"]
64
64
 
65
65
  [tool.setuptools.package-data]
66
- pipeline = ["template.zip", "launch/templates/**/*"]
66
+ pipeline = ["launch/templates/**/*"]
67
67
  synapseforge = ["tk/logo.ico", "tk/logo.png"]
68
68
 
69
69
  [tool.ruff]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapseForge
3
- Version: 0.1.24.dev2
3
+ Version: 0.1.24.dev3
4
4
  Summary: AI agent project scaffolding & distribution CLI
5
5
  Author-email: "synapse.ai" <developer@synapseaihub.com.ar>
6
6
  Maintainer-email: "synapse.ai" <developer@synapseaihub.com.ar>
@@ -16,6 +16,7 @@ pipeline/init/venv_handler.py
16
16
  pipeline/launch/__init__.py
17
17
  pipeline/launch/forge.py
18
18
  pipeline/launch/templates/launcher.py
19
+ pipeline/update/main.py
19
20
  synapseForge.egg-info/PKG-INFO
20
21
  synapseForge.egg-info/SOURCES.txt
21
22
  synapseForge.egg-info/dependency_links.txt
@@ -1,3 +1,3 @@
1
1
  """synapseForge CLI — scaffold and distribute AI agent projects."""
2
2
 
3
- __version__ = "0.1.24.dev2"
3
+ __version__ = "0.1.24.dev3"
@@ -186,11 +186,26 @@ Requirements:
186
186
  help="Project root directory (default: current working directory)",
187
187
  )
188
188
 
189
+ # ── update ──────────────────────────────────────────────────────────
190
+ update_p = subparsers.add_parser(
191
+ "update",
192
+ help="Update project to latest template",
193
+ description="Update the project structure to the latest template version, preserving user configuration.",
194
+ )
195
+ update_p.add_argument(
196
+ "project_dir",
197
+ nargs="?",
198
+ default=".",
199
+ help="Project root directory (default: current working directory)",
200
+ )
201
+
189
202
  args = parser.parse_args()
190
203
 
191
204
  try:
192
205
  if args.command == "init":
193
206
  _init(args.target_dir)
207
+ elif args.command == "update":
208
+ _update(args.project_dir)
194
209
  elif args.command == "launch":
195
210
  _launch(args.path, args.name, args.skip_frontend, args.no_embed, args.compile)
196
211
  elif args.command == "colors":
@@ -221,6 +236,16 @@ def _init(target_dir: str) -> None:
221
236
  print(" Proyecto creado correctamente.")
222
237
 
223
238
 
239
+ def _update(project_dir: str) -> None:
240
+ """Import and run pipeline.update.main.run_update()."""
241
+ try:
242
+ from pipeline.update.main import run_update
243
+ except ImportError as exc:
244
+ print(f"ERROR: could not load update module — {exc}", file=sys.stderr)
245
+ sys.exit(1)
246
+ run_update(project_dir)
247
+
248
+
224
249
  def _launch(
225
250
  repo_path: str,
226
251
  exe_name: str,
@@ -1,89 +0,0 @@
1
- """Step 2 — Locate bundled (or download) template.zip and extract into target."""
2
-
3
- import sys
4
- import urllib.request
5
- import zipfile
6
- from pathlib import Path
7
- from importlib.resources import files as resources_files
8
-
9
- # ---------------------------------------------------------------------------
10
- # URL used as fallback when the bundled zip is not available.
11
- # ---------------------------------------------------------------------------
12
- TEMPLATE_URL = (
13
- "https://github.com/synapse-ai-hub/synapseForge/raw/main/pipeline/template.zip"
14
- )
15
-
16
-
17
- def extract_template(target: Path) -> None:
18
- """Extract the template zip into *target*.
19
-
20
- Looks for a bundled copy first (from pip install or development mode),
21
- otherwise downloads from the GitHub raw URL.
22
-
23
- The bundled zip inside the installed package is **never** deleted so
24
- that every invocation stays offline-capable.
25
- """
26
- bundled = _get_bundled_zip()
27
- was_downloaded = False
28
-
29
- if bundled is not None and bundled.is_file():
30
- zip_path = bundled
31
- print(f" Using bundled template: {zip_path}")
32
- else:
33
- zip_path = _download_template(target)
34
- if zip_path is None:
35
- print(" ERROR: could not obtain template.zip")
36
- sys.exit(1)
37
- was_downloaded = True
38
-
39
- _safe_extract(zip_path, target)
40
-
41
- # Only delete the zip if it was the downloaded copy —
42
- # never touch the bundled copy inside site-packages.
43
- if was_downloaded:
44
- zip_path.unlink(missing_ok=True)
45
-
46
- print(f" Extracted to: {target}")
47
-
48
-
49
- # ---------------------------------------------------------------------------
50
- # Internal helpers
51
- # ---------------------------------------------------------------------------
52
-
53
-
54
- def _get_bundled_zip() -> Path | None:
55
- """Locate the ``template.zip`` shipped inside the ``pipeline`` package.
56
-
57
- Works both in development mode (``pip install -e .``) and when installed
58
- from PyPI — the file lives in the ``pipeline`` directory of the package.
59
- """
60
- try:
61
- return Path(resources_files("pipeline").joinpath("template.zip")) # type: ignore[arg-type]
62
- except (ModuleNotFoundError, TypeError):
63
- return None
64
-
65
-
66
- def _download_template(target: Path) -> Path | None:
67
- """Download template.zip from GitHub into *target*."""
68
- try:
69
- dest = target / "template.zip"
70
- print(" Downloading template from GitHub …")
71
- urllib.request.urlretrieve(TEMPLATE_URL, dest)
72
- print(f" Downloaded: {dest}")
73
- return dest
74
- except Exception as exc:
75
- print(f" Download failed: {exc}")
76
- return None
77
-
78
-
79
- def _safe_extract(zip_path: Path, target: Path) -> None:
80
- """Extract zip, overwriting existing files silently."""
81
- try:
82
- with zipfile.ZipFile(zip_path, "r") as zf:
83
- zf.extractall(path=target)
84
- except zipfile.BadZipFile:
85
- print(f" ERROR: corrupted zip file: {zip_path}")
86
- sys.exit(1)
87
- except Exception as exc:
88
- print(f" ERROR extracting zip: {exc}")
89
- sys.exit(1)