Files
home-information/init-env-dev.sh
cassandra-ai-agent b4aced5dfb Fix controller dialog action to stay in modal context (Issue #31) (#67)
* Improve workflow documentation to include staging branch sync step

* Fix controller dialog action to stay in modal context

- Add data-stay-in-modal attribute to controller forms in modal context
- Modify antinode.js to skip modal dismissal when data-stay-in-modal is present
- Update ControllerView to detect modal context via response_context parameter
- Pass in_modal_context to controller templates when rendered in entity dialogs
- Preserves existing behavior for non-modal controller usage

Fixes #31

* Improve workflow documentation to include mandatory environment setup

- Add environment initialization as step 4 in main workflow
- Update Testing Workflow to include init-env-dev.sh setup step
- Fix command paths to consistently use 'cd src &&' prefix
- Correct flake8 target path from 'src/' to 'hi/' throughout
- Ensure all testing commands reference proper working directory

This addresses the gap where workflow step 9 (testing) would fail
without proper environment initialization from step 4.

* Make init-env-dev.sh idempotent to prevent shell prompt nesting

- Add check for VIRTUAL_ENV before sourcing venv/bin/activate
- Prevents annoying prompt nesting like (venv) (venv) $ when run multiple times
- Improves performance by avoiding unnecessary re-activation
- Makes script truly safe to run multiple times in workflow
- Maintains all existing functionality while improving developer UX

* Add branch naming conventions directly to CLAUDE.md workflow

- Include the most common branch naming patterns in step 5
- Use bugfix/31-controller-modal-fix as example (showing correct naming)
- Prevents need to context-switch to docs/dev/Workflow.md
- Still references full conventions in Workflow.md for completeness
- Makes it clear that current branch should have been bugfix/31-*

* Improve init-env-dev.sh with error checking and user feedback

- Add existence check for venv/bin/activate with helpful error message
- Add existence check for .private/env/development.sh with creation guidance
- Show success messages for virtual environment activation and env vars
- Display informative message when venv already active with deactivate hint
- Use clear visual indicators (✓ and ERROR:) for better UX
- Script now exits with error code when prerequisites are missing
- Eliminates silent failures and provides actionable guidance

* Address PR review feedback and add boolean coding convention

- Refactor ControllerView.post() to eliminate code duplication per reviewer suggestion
- Use single call to controller_data_response() with computed in_modal_context parameter
- Add bool() coding convention to Development Guidelines for explicit boolean intent
- Apply bool() wrapper to response_context comparison for consistency

This makes the logic more readable and explicit while following project conventions.

* Clean up unused imports in control views

Remove unused typing.List, HttpRequest, and HttpResponse imports
that became unnecessary after refactoring the controller_data_response calls.

All mandatory testing checks now pass:
-  Unit tests: 1475 tests passed
-  Code quality: flake8 clean
-  Django check: no issues

* Standardize CLAUDE.md workflow commands to use project root directory

- Replace all 'cd src &&' patterns with src/ prefixes
- Update Testing Workflow commands to run from consistent directory
- Update Pull Request Requirements command examples
- Update Development Commands Quick Reference
- Update Generated Code Standards compliance check
- Add explicit note about PROJECT ROOT consistency

This eliminates directory confusion and failed commands from wrong working directory.
All Django and flake8 commands now use src/ prefix for clear, consistent execution.

* Add comprehensive post-PR cleanup workflow with safety checks

- Add step 10 for post-merge cleanup and preparation for next work
- Include mandatory safety verification before any destructive actions:
  * Verify current branch is feature branch (not staging/master)
  * Verify clean working directory (no uncommitted changes)
  * Verify PR is actually merged via gh CLI
- Add cleanup actions: switch to staging, sync, delete branch, verify state
- Include explicit STOP conditions and failure handling
- Reference cleanup workflow from step 2 for proper sequencing
- Emphasize human-initiated process to prevent accidental execution

Prevents catastrophic mistakes like deleting wrong branches or losing work.
2025-08-18 20:12:32 +00:00

26 lines
926 B
Bash

# Only activate virtual environment if not already active
# This prevents shell prompt nesting and makes the script idempotent
if [ -z "$VIRTUAL_ENV" ]; then
if [ -f "venv/bin/activate" ]; then
. venv/bin/activate
echo "✓ Virtual environment activated"
else
echo "ERROR: Virtual environment not found at venv/bin/activate"
echo "Please create it first: python3.11 -m venv venv"
return 1
fi
else
echo "✓ Virtual environment already active: $VIRTUAL_ENV"
echo " (Hint: run 'deactivate' first if you need to switch environments)"
fi
# Source development environment variables
if [ -f ".private/env/development.sh" ]; then
. .private/env/development.sh
echo "✓ Development environment variables loaded"
else
echo "ERROR: Environment file not found at .private/env/development.sh"
echo "Please create it first: make env-build-dev"
return 1
fi