Skip to content

Phase 1: Repository setup and CI infrastructure - #2

Merged
jwbron merged 2 commits into
mainfrom
jib/phase-1-setup
Feb 2, 2026
Merged

jwbron merged 2 commits into
mainfrom
jib/phase-1-setup

Conversation

@james-in-a-box

@james-in-a-box james-in-a-box Bot commented Feb 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 1 of the egg extraction: establish repository with quality infrastructure.

Changes

  • Create repository structure (gateway/, sandbox/, cli/, shared/, tests/)
  • Add pyproject.toml with uv for dependency management
  • Add GitHub Actions workflows (lint.yml, test.yml)
  • Add ./dev wrapper script for CI parity (runs act locally)
  • Add pre-commit, Dependabot configurations
  • Create module structure with init.py files
  • Add initial unit tests for module imports

Validation Plan

# 1. Clone fresh and setup
git clone https://github.com/jwbron/egg.git /tmp/egg-test
cd /tmp/egg-test
git checkout jib/phase-1-setup

# 2. Verify directory structure exists
ls -la gateway/ sandbox/ cli/ shared/ tests/

# 3. Run setup (installs uv if needed)
./dev setup

# 4. Run linting
./dev native lint
# Expected: All checks passed

# 5. Run tests
./dev native test
# Expected: 4 tests pass (test_cli_imports, test_gateway_imports, 
#           test_shared_imports, test_cli_help)

# 6. Verify package installs
uv pip install -e .
uv run python -c "import cli; import gateway; import shared; print('OK')"
# Expected: prints "OK"

# 7. Cleanup
rm -rf /tmp/egg-test

Authored-by: jib

jwbron and others added 2 commits February 2, 2026 21:30
Implement Phase 1 of the egg extraction plan:

- Create repository structure with gateway/, sandbox/, cli/, shared/, tests/
- Add pyproject.toml with uv for dependency management
- Add GitHub Actions workflows (lint.yml, test.yml)
- Add ./dev wrapper script for CI parity (runs act locally)
- Add pre-commit configuration
- Add Dependabot configuration
- Write README.md with architecture overview
- Write CONTRIBUTING.md with development guidelines
- Add egg.yaml.example and secrets.yaml.example
- Create module structure with __init__.py files
- Add initial unit tests for module imports
- Add docs/testing.md and docs/architecture.md

This establishes the infrastructure before extracting gateway code in Phase 2.

Authored-by: jib
- Remove sudo requirement from act installation by installing to
  $HOME/.local/bin instead of system-wide
- Add hatchling build config specifying packages to include
- Add uv.lock for reproducible builds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@jwbron jwbron left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Phase 1 - Repository Setup and CI Infrastructure

Validation Results

All validation steps pass locally:

Check Status
Directory structure ✅ gateway/, sandbox/, cli/, shared/, tests/
./dev setup ✅ (after fixes)
./dev native lint ✅ All checks passed
./dev native test ✅ 4/4 tests pass
Package imports ✅ cli, gateway, shared all import

Alignment with Plan (PR #693)

Phase 1 requirements from the implementation plan:

  • Task 1.1: Repository structure created
  • Task 1.2: pyproject.toml configured with uv
  • Task 1.3: GitHub Actions lint.yml
  • Task 1.4: GitHub Actions test.yml
  • Task 1.5: pre-commit configuration
  • Task 1.6: Dependabot configuration
  • Task 1.7: ./dev wrapper script

Fixes Applied

Two issues were found and fixed in this review:

  1. ./dev script required sudo - Changed act installation to use $HOME/.local/bin (no sudo needed)
  2. pyproject.toml missing hatchling config - Added [tool.hatch.build.targets.wheel] section

Code Quality

  • Clean module structure with proper __init__.py files
  • Type hints present where appropriate
  • Comprehensive documentation (README, CONTRIBUTING, architecture docs)
  • Appropriate test coverage for Phase 1 (import tests)

LGTM! Ready for merge once CI is back up.

@jwbron
jwbron merged commit 1875dd8 into main Feb 2, 2026
0 of 4 checks passed
james-in-a-box Bot pushed a commit that referenced this pull request Feb 7, 2026
Fix critical issues from review:
- Task ID convention mismatch: Parser now generates task-{phase}-{number}
  format matching CLI expectations (Issue #3)
- Integer parsing vulnerability: Added parse_task_id() and parse_phase_id()
  helpers with proper validation and error handling (Issue #1)
- URL parameter injection: Use urllib.parse.urlencode for query params (Issue #2)
- Placeholder task numbering: Use task_number=1 instead of 0 (Issue #5)
- Silent failure in shell script: gh_api_safe now sets GH_API_FAILED flag
  and returns empty JSON for graceful fallback (Issue #6)

Additional improvements:
- Updated Task model pattern to accept task-P-N format
- Added comprehensive test coverage for error paths
- Added edge case tests for plan parser
- All 73 tests pass, ruff linter clean

Authored-by: egg
jwbron added a commit that referenced this pull request Feb 7, 2026
* Implement Phase 3: Agent CLI and prompt integration

Add the agent-facing components for the SDLC pipeline:

- Contract CLI (egg-contract) for agents to interact with contract state:
  - show: Display current contract state
  - add-commit: Link commits to tasks
  - update-notes: Add implementation notes
  - mark-task/mark-phase: Update status (reviewer role)
  - add-decision: Create HITL decision points

- Agent rules file (contract.md) with CLI usage guidance

- Document templates for refine and plan phases:
  - analysis.md: Problem analysis template
  - plan.md: Implementation plan template with task ID format

- SDLC prompt builder that provides phase-specific context and
  instructions to the agent

- Plan parser for extracting tasks from plan documents:
  - Parses [TASK-X-Y] patterns from markdown
  - Supports YAML front matter for structured task definitions
  - Generates placeholder tasks for empty phases
  - Produces warnings for parse issues

- Unit tests for plan parser and contract CLI

Issue: #133

Authored-by: egg

* Fix bash syntax error in build-sdlc-prompt.sh

Change the inner heredoc delimiter in the PR format example from 'EOF'
to 'BODY' to avoid conflicting with the outer heredoc delimiter. The
'EOF' on line 363 was being interpreted as the end of the outer heredoc
(starting at line 322), causing a syntax error on the closing ')'.

Authored-by: egg

* Fix lint and type errors in Phase 3 contracts code

- Fix import sorting in shared/egg_contracts/__init__.py (I001)
- Fix import sorting in tests/sandbox/test_contract_cli.py (I001)
- Fix unused variable in tests/sandbox/test_contract_cli.py (F841)
- Fix import sorting and remove unused import in tests/shared/egg_contracts/test_plan_parser.py (I001, F401)
- Fix mypy type annotation in shared/egg_contracts/plan_parser.py
- Fix mypy no-any-return errors in sandbox/egg_lib/contract_cli.py
- Apply ruff formatting fixes

Authored-by: egg

* Address code review feedback for Phase 3 implementation

Fix critical issues from review:
- Task ID convention mismatch: Parser now generates task-{phase}-{number}
  format matching CLI expectations (Issue #3)
- Integer parsing vulnerability: Added parse_task_id() and parse_phase_id()
  helpers with proper validation and error handling (Issue #1)
- URL parameter injection: Use urllib.parse.urlencode for query params (Issue #2)
- Placeholder task numbering: Use task_number=1 instead of 0 (Issue #5)
- Silent failure in shell script: gh_api_safe now sets GH_API_FAILED flag
  and returns empty JSON for graceful fallback (Issue #6)

Additional improvements:
- Updated Task model pattern to accept task-P-N format
- Added comprehensive test coverage for error paths
- Added edge case tests for plan parser
- All 73 tests pass, ruff linter clean

Authored-by: egg

* Remove unused GH_API_FAILED variable from build-sdlc-prompt.sh

The GH_API_FAILED variable was declared and set but never read,
triggering shellcheck SC2034 warning. The variable has been removed
as the functionality was never implemented.

Authored-by: egg

* Address remaining PR review feedback

- Fix add-decision RBAC: Add decisions.* to FIELD_OWNERSHIP with
  IMPLEMENTER role, allowing implementers to create decisions while
  only humans can resolve them.

- Fix array append in validator: Handle appending to arrays when
  idx == len(array) by appending instead of raising IndexError.
  Also handle the case in apply_mutation where old_value doesn't
  exist yet for append operations.

- Document race condition in add-decision: Added comments explaining
  the TOCTOU race condition between reading decision count and
  submitting mutation. Gateway should handle conflicts.

- Fix mark-task/mark-phase role documentation: Updated docstrings
  and help text to clarify these operations require REVIEWER role.

- Add commit SHA validation: New validate_commit_sha() function
  validates 7-40 character hex strings for git SHAs.

- Fix short question ellipsis: Only append "..." if question is
  longer than 50 characters.

- Add comprehensive tests for new functionality including commit
  SHA validation and array append operations.

Authored-by: egg

* Fix ruff format issue in contract_cli.py

Collapse multi-line ValueError string to single line to satisfy
ruff format requirements.

Authored-by: egg

* Address low-severity review feedback

- Add integration tests verifying plan parser task IDs are compatible
  with the CLI's parse_task_id() function
- Add RETURN trap in gh_api_safe() to clean up temp files on interruption
- Refactor MockGatewayHandler to use a factory function that creates
  handler classes with isolated responses, ensuring thread safety when
  running tests in parallel
- Generate unique HEREDOC delimiter using random suffix to prevent
  injection if issue body contains the delimiter string

Authored-by: egg

---------

Co-authored-by: jwbron <8340608+jwbron@users.noreply.github.com>
Co-authored-by: james-in-a-box[bot] <246424927+james-in-a-box[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant