Skip to content

Commit 8b6dee0

Browse files
antosubashclaude
andauthored
fix(cli): strip .github/workflows/ from workspace-bundled sample module (#149)
* fix(cli): strip .github/workflows/ from workspace-bundled sample module `smpy create-module` ships .github/workflows/{ci.yml, publish.yml} so authors who publish a module as its own repo get CI + PyPI trusted publishing out of the box. But `smpy new` calls create_module() to drop a sample `hello` module under modules/hello/ in a workspace — GitHub only reads workflows from the repo root, so the bundled copies were dead files masquerading as active CI. Strip the sample's .github/ tree after scaffolding, mirroring how _strip_workspace_owned_files drops host files the workspace root owns. https://claude.ai/code/session_01LfX6sdezX5NFAH3v1eixUq * test(cli): fold .github strip assertion into existing workspace-layout test The dedicated test pushed test_cli_new.py past the 300-line cap. Move the regression assertion next to the other "files we don't ship at host/" assertions in test_sm_new_default_lays_down_workspace_layout — both check the same workspace-mode trimming behavior. https://claude.ai/code/session_01LfX6sdezX5NFAH3v1eixUq * refactor(cli): tighten the workspace-mode .github strip - Trim the 4-line comment to one line covering only the non-obvious WHY (workflows under a sub-path don't run). - Drop ignore_errors=True — the template guarantees .github/ exists immediately after create_module(), so silent error-swallowing only hides real OS-level failures. https://claude.ai/code/session_01LfX6sdezX5NFAH3v1eixUq --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6c0a620 commit 8b6dee0

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

framework/cli/simple_module_cli/app_project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import json as _json
1717
import secrets as _secrets
18+
import shutil as _shutil
1819
from collections.abc import Sequence
1920
from importlib.metadata import PackageNotFoundError
2021
from importlib.metadata import version as _pkg_version
@@ -181,6 +182,9 @@ def _scaffold_sample_module(target: Path) -> None:
181182
if sample_dest.exists():
182183
return
183184
create_module(sample_dest, name=_SAMPLE_MODULE_NAME)
185+
# GitHub only reads workflows from the repo root, so the template's
186+
# .github/ is dead inside a workspace.
187+
_shutil.rmtree(sample_dest / ".github")
184188
_pin_sample_module_deps(sample_dest)
185189
_seed_static_dist_placeholder(sample_dest / _SAMPLE_MODULE_NAME / "static" / "dist")
186190

framework/cli/tests/test_cli_new.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def test_sm_new_default_lays_down_workspace_layout(tmp_path: Path) -> None:
236236
assert (target / "host" / relpath).is_file(), f"missing host file: {relpath}"
237237
for relpath in (".env.example", "README.md", ".gitignore", "Makefile"):
238238
assert not (target / "host" / relpath).exists()
239+
assert not (target / "modules" / "hello" / ".github").exists()
239240

240241

241242
def test_sm_new_default_wires_workspace_in_pyproject(tmp_path: Path) -> None:

0 commit comments

Comments
 (0)