* chore: initialise BEACON framework with all bootstrap artefacts - Problem statement, constitution, architecture doc, roadmap populated - CHANGELOG.md created (Keep a Changelog); README expanded with What-is-this, Install, and Quickstart sections - pyproject.toml gains [project.urls] (repository + documentation) - beacon doctor: 32 pass, 2 pre-commit warns, 0 failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: Phase 1 — add NullHandler to package root, remove hardcoded setLevel T001: logging.getLogger("comfydv").addHandler(NullHandler()) in __init__.py T002: remove logger.setLevel(logging.DEBUG) from format_string.py Also fix pyproject.toml TOML structure (project.urls was inside [project] block) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: failing tests for logging modernisation (T010-T through T030-T) RED phase — 5 tests fail for the correct reasons before implementation: T010-T: format_string produces stdout (print block) T011-T: update_widget emits INFO records on hot path T012-T: random_choice produces stdout (colorama/rich prints) T020-T: load_node_state uses print() on error instead of logger.error T021-T: circuit_breaker uses print() instead of logger T001/T002/T030-T already green: NullHandler registered, setLevel removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: standardise logging across all nodes (T010-I through T044) GREEN phase — all 11 logging tests pass: T010-I: Remove 8-line diagnostic print block from format_string() T011-I: Downgrade all hot-path logger.info() calls to logger.debug(); switch all logger calls to %-style formatting; remove rich import T012-I: Replace colorama/termcolor/rich print calls in random_choice with logger.debug(); add logger = logging.getLogger(__name__) T020-I: Convert print() on load_node_state error to logger.error() T021-I: Add logger to circuit_breaker; replace print() with logger.debug(); fix logic so status=False triggers the interrupt (per BDD spec) T040: Remove colorama, rich, termcolor from pyproject.toml dependencies T042: ruff check + format clean T044: beacon doctor --strict passes (34/34) Also adds ADR-001 and ADR-002 capturing the stdlib logging and NullHandler decisions, linked from the logging-modernisation epic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: mark all 001-standardise-logging tasks complete in tasks.md All [x] checkboxes flipped after 11/11 tests pass and beacon doctor --strict reports 0 failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: mark logging-modernisation epic success criteria complete All success criteria verified: NullHandler added, setLevel removed, print() calls converted, colorama/rich/termcolor removed from deps, zero stdout in normal operation, errors surface at ERROR level, all tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: commit spec artefacts and dependency lock for 001-standardise-logging Includes spec.md, plan.md, research.md, BDD feature files, contracts, .beacon.toml backlink, and uv.lock after removing colorama/rich/termcolor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: James Veitch <darthveitcher@office-mac-mini.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
193 lines
6.0 KiB
Bash
Executable File
193 lines
6.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Consolidated prerequisite checking script
|
|
#
|
|
# This script provides unified prerequisite checking for Spec-Driven Development workflow.
|
|
# It replaces the functionality previously spread across multiple scripts.
|
|
#
|
|
# Usage: ./check-prerequisites.sh [OPTIONS]
|
|
#
|
|
# OPTIONS:
|
|
# --json Output in JSON format
|
|
# --require-tasks Require tasks.md to exist (for implementation phase)
|
|
# --include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
# --paths-only Only output path variables (no validation)
|
|
# --help, -h Show help message
|
|
#
|
|
# OUTPUTS:
|
|
# JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
|
|
# Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
|
|
# Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
|
|
|
|
set -e
|
|
|
|
# Parse command line arguments
|
|
JSON_MODE=false
|
|
REQUIRE_TASKS=false
|
|
INCLUDE_TASKS=false
|
|
PATHS_ONLY=false
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--json)
|
|
JSON_MODE=true
|
|
;;
|
|
--require-tasks)
|
|
REQUIRE_TASKS=true
|
|
;;
|
|
--include-tasks)
|
|
INCLUDE_TASKS=true
|
|
;;
|
|
--paths-only)
|
|
PATHS_ONLY=true
|
|
;;
|
|
--help|-h)
|
|
cat << 'EOF'
|
|
Usage: check-prerequisites.sh [OPTIONS]
|
|
|
|
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
|
|
|
OPTIONS:
|
|
--json Output in JSON format
|
|
--require-tasks Require tasks.md to exist (for implementation phase)
|
|
--include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
--paths-only Only output path variables (no prerequisite validation)
|
|
--help, -h Show this help message
|
|
|
|
EXAMPLES:
|
|
# Check task prerequisites (plan.md required)
|
|
./check-prerequisites.sh --json
|
|
|
|
# Check implementation prerequisites (plan.md + tasks.md required)
|
|
./check-prerequisites.sh --json --require-tasks --include-tasks
|
|
|
|
# Get feature paths only (no validation)
|
|
./check-prerequisites.sh --paths-only
|
|
|
|
EOF
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Source common functions
|
|
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/common.sh"
|
|
|
|
# Get feature paths
|
|
_paths_output=$(get_feature_paths) || { echo "ERROR: Failed to resolve feature paths" >&2; exit 1; }
|
|
eval "$_paths_output"
|
|
unset _paths_output
|
|
|
|
# If paths-only mode, output paths and exit (no validation)
|
|
if $PATHS_ONLY; then
|
|
if $JSON_MODE; then
|
|
# Minimal JSON paths payload (no validation performed)
|
|
if has_jq; then
|
|
jq -cn \
|
|
--arg repo_root "$REPO_ROOT" \
|
|
--arg branch "$CURRENT_BRANCH" \
|
|
--arg feature_dir "$FEATURE_DIR" \
|
|
--arg feature_spec "$FEATURE_SPEC" \
|
|
--arg impl_plan "$IMPL_PLAN" \
|
|
--arg tasks "$TASKS" \
|
|
'{REPO_ROOT:$repo_root,BRANCH:$branch,FEATURE_DIR:$feature_dir,FEATURE_SPEC:$feature_spec,IMPL_PLAN:$impl_plan,TASKS:$tasks}'
|
|
else
|
|
printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
|
|
"$(json_escape "$REPO_ROOT")" "$(json_escape "$CURRENT_BRANCH")" "$(json_escape "$FEATURE_DIR")" "$(json_escape "$FEATURE_SPEC")" "$(json_escape "$IMPL_PLAN")" "$(json_escape "$TASKS")"
|
|
fi
|
|
else
|
|
echo "REPO_ROOT: $REPO_ROOT"
|
|
echo "BRANCH: $CURRENT_BRANCH"
|
|
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
|
echo "IMPL_PLAN: $IMPL_PLAN"
|
|
echo "TASKS: $TASKS"
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
# Validate branch name
|
|
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
|
|
|
|
# Validate required directories and files
|
|
if [[ ! -d "$FEATURE_DIR" ]]; then
|
|
echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
|
|
echo "Run /speckit-specify first to create the feature structure." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$IMPL_PLAN" ]]; then
|
|
echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
|
|
echo "Run /speckit-plan first to create the implementation plan." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Check for tasks.md if required
|
|
if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
|
|
echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
|
|
echo "Run /speckit-tasks first to create the task list." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Build list of available documents
|
|
docs=()
|
|
|
|
# Always check these optional docs
|
|
[[ -f "$RESEARCH" ]] && docs+=("research.md")
|
|
[[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
|
|
|
|
# Check contracts directory (only if it exists and has files)
|
|
if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
|
|
docs+=("contracts/")
|
|
fi
|
|
|
|
[[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
|
|
|
|
# Include tasks.md if requested and it exists
|
|
if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
|
|
docs+=("tasks.md")
|
|
fi
|
|
|
|
# Output results
|
|
if $JSON_MODE; then
|
|
# Build JSON array of documents
|
|
if has_jq; then
|
|
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
json_docs="[]"
|
|
else
|
|
json_docs=$(printf '%s\n' "${docs[@]}" | jq -R . | jq -s .)
|
|
fi
|
|
jq -cn \
|
|
--arg feature_dir "$FEATURE_DIR" \
|
|
--argjson docs "$json_docs" \
|
|
'{FEATURE_DIR:$feature_dir,AVAILABLE_DOCS:$docs}'
|
|
else
|
|
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
json_docs="[]"
|
|
else
|
|
json_docs=$(for d in "${docs[@]}"; do printf '"%s",' "$(json_escape "$d")"; done)
|
|
json_docs="[${json_docs%,}]"
|
|
fi
|
|
printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$(json_escape "$FEATURE_DIR")" "$json_docs"
|
|
fi
|
|
else
|
|
# Text output
|
|
echo "FEATURE_DIR:$FEATURE_DIR"
|
|
echo "AVAILABLE_DOCS:"
|
|
|
|
# Show status of each potential document
|
|
check_file "$RESEARCH" "research.md"
|
|
check_file "$DATA_MODEL" "data-model.md"
|
|
check_dir "$CONTRACTS_DIR" "contracts/"
|
|
check_file "$QUICKSTART" "quickstart.md"
|
|
|
|
if $INCLUDE_TASKS; then
|
|
check_file "$TASKS" "tasks.md"
|
|
fi
|
|
fi
|