refactor: scripts/ into the installable smith package (src layout, uv)#10
Merged
Conversation
Remove code unreachable from the smith CLI and unreferenced by any skill guide/example, ahead of repackaging scripts/ into the smith package: - kubectl/mcpgateway/beeai cluster (extract_commands/parse_commands/io/ extract_case, red_feedback/tests, integration test_commands/test_pipeline, unit test_parser) — coupled to packages not in requirements. - duplicate entry points (policy_agent/pipeline.py, tests/policy_testing.py). - dead visualization/ package and the broken test_visualize_policy unit test. - misc orphans (regal_update, extract_extensions, policy_diff tooling, reduce_improve/redundancy.sh). - stray upstream ARES repo scaffolding under test_generation/ares/ (.github, .pre-commit-config.yaml, .readthedocs.yaml, .secrets.baseline, .gitignore) — ARES is the external ares-redteamer tool, not vendored here. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
- Move cli.py + pipeline packages from scripts/ to a src/smith/ package (src layout); add smith.__init__ with __version__. - Rewrite all internal imports to the smith.* root; drop the sys.path.insert(__file__/../../..) hacks (now a real installable package). - Move the OPA scorecard harness into src/smith/policy_testing/. - Move pyproject.toml to the repo root: src-layout discovery, entry point smith = smith.cli:main, declared [project.dependencies] (from requirements.txt) + [dev] extra, and package-data for the harness + ares_config inputs. Bump version to 0.2.0.dev0. - tests/ is now a placeholder (README) pending proper tests. Verified: uv pip install -e . succeeds; smith --help and bare smith exit 0. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
- policy_testing harness: route all generated outputs to a BASE_URL-relative dir (references/scorecard/, via TEST_OUTPUT_DIR) instead of the old scripts/tests/integration/ and the package dir. score_card.sh + convert_test_coverage.py + analyze_coverage.sh + coverage_analyzer.py are now parametrized on ROOT (skill root) and OUT_DIR; package scripts stay read-only. - cli.py / run_policy_evaluation.py: drop base_url + "scripts/" coupling; run 'make test' from BASE_URL; read scorecard from references/scorecard/. - Root Makefile reworked for uv: install (uv venv + .[dev]), lint/format via pinned uvx ruff/black over src/, folded-in OPA-server + test targets driving the packaged harness, and package/dist/wheel/sdist/verify/publish[-test]/clean. Retire scripts/Makefile. - Rename mcp_servers/ -> examples/; update .env_template, license_headers EXCLUDE_DIRS, extract_tools docstring, RagChatbot rag_*.py paths, and example READMEs. Fix license_headers REPO_ROOT depth for the src layout. Verified live: make test runs OPA in Docker over 234 cases and writes the scorecard + coverage to references/scorecard/ (package dir untouched); make ci green; uv build produces a wheel that ships the harness + ares_config and excludes the ARES scaffolding and tests/. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
…ayout + uv - attack.py: locate ARES via ARES_HOME (fallback in-tree), run with cwd=ares_home. - .env_template: TEST_GENERATION_PATH -> src/smith/test_generation/; .gitignore ARES artifact path updated. - README/CONTRIBUTING/CLAUDE.md: src layout + uv install, package/publish targets, packaged policy_testing harness, references/scorecard outputs, examples/ paths, updated repo-structure tree. requirements.txt is now a thin '-e .' pointer. - Skill guides (opa_policy/*, test_generation/cross_validate): scorecard paths -> references/scorecard/. - CI (ci.yml): uv-based (astral-sh/setup-uv); make lint/build/audit. - CHANGELOG: add [Unreleased] entry for the refactor. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Update module-docstring invocation examples in license_headers.py, validate_policy.py, and extract_tools.py to the src/smith/ layout. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
- Build the RAG pipeline (HF embeddings + ChatOpenAI + PDF index) lazily on first query instead of at import time, so rag_salary/rag_pipeline/mcp_server import cleanly without RITS_*/BASE_URL set (previously crashed at import). - Wire RITS_API_KEY/RITS_BASE_URL into ChatOpenAI (they were read but never passed through). - requirements.txt: add the missing langchain-openai (and langchain-text-splitters). Verified: the three modules import with no env configured. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Member
README.md
Examples' README.md
RagChatbot example
Makefile
SKILL.md
opa/output folder
|
…use existing venv when running smith CLI Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
…licated cd commands, add clean setups when switching examples Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
…ath in README.md etc Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
c858a32 to
efc2ff8
Compare
dhl123
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repackages Smith's Python code from
scripts/(an ad-hoc import root held together bysys.pathhacks) into a proper, publishablesmithpackage using asrc/layout, withpyproject.tomlat the repo root. Skills + CLI behavior are preserved.What changed
src/smith/package: movedcli.py+ pipeline packages undersrc/smith/; all internal imports now use thesmith.*root; removed thesys.path.insert(__file__/../../..)hacks. Entry point:smith = smith.cli:main.pyproject.toml: src-layout discovery, declared[project.dependencies](from the oldrequirements.txt) + a[dev]extra,package-datashipping the policy-testing harness andares_config.requirements.txtis now a thin-e .pointer. Version →0.2.0.dev0.make install(uv venv +.[dev]), lint via pinneduvx ruff@0.15.20/black@26.5.1, andmake package/publish→uv build/uv publish. CI reworked ontoastral-sh/setup-uv.smith.policy_testing) and writes all generated output to aBASE_URL-relative dir (references/scorecard/, viaTEST_OUTPUT_DIR) instead ofscripts/tests/integration/and the package dir.score_card.sh/coverage tooling are parametrized onROOT+OUT_DIR. OPA-server lifecycle targets folded into the root Makefile;scripts/Makefileretired.pipeline.py,tests/policy_testing.py), deadvisualization/package, the previous (non-functional) pytest suite, and stray upstream ARES repo scaffolding (incl. the.secrets.baselinethat caused earlier gitleaks noise). ARES is the externalares-redteamertool, located viaARES_HOME.mcp_servers/→examples/, with all references updated (.env_template, README, CLAUDE.md, guides, license-tool excludes, RagChatbot runtime paths, example READMEs).Verification
make cigreen (ruff/black oversrc/, OPA policy lint, SPDX headers).make testlive: OPA in Docker over 234 cases → scorecard + coverage written toreferences/scorecard/; the package dir is not written into.uv build→ wheel + sdist;twine checkPASSED; wheel ships the harness +ares_configand excludes the ARES scaffolding andtests/.uv pip install -e .→smith --helpand baresmithexit 0.call-for-papers-mcpandcar-price-mcp-mainimport cleanly;RagChatbot_MCPServerimports cleanly with no env (see fix below).Also fixed (RagChatbot example)
rag_salary.py,rag_pipeline.py) now build the pipeline lazily on first query instead of at import, sorag_*/mcp_serverimport cleanly withoutRITS_*/BASE_URLset (previously crashed at import).RITS_API_KEY/RITS_BASE_URLintoChatOpenAI(they were read but never passed through).langchain-openai(andlangchain-text-splitters) to itsrequirements.txt.Follow-ups
tests/is a placeholder; a real test suite is TODO.