Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mqlaunch/lib/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ run_network_quality() {
pause_enter
}

# Shows network info.
show_network_info() {
local report

Expand Down
4 changes: 4 additions & 0 deletions release-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ done
: "$DRY_RUN"

BLOCKERS=()
# Coordinates say behavior.
say() { [[ "$JSON" -eq 1 ]] || echo "$1"; }
# Coordinates ok behavior.
ok() { [[ "$JSON" -eq 1 ]] || echo " ok: $1"; }
# Marks a failing check.
fail() { BLOCKERS+=("$1"); [[ "$JSON" -eq 1 ]] || echo "FAIL: $1" >&2; }

# Coordinates run behavior.
run() {
local label="$1"; shift
local out
Expand Down
1 change: 1 addition & 0 deletions terminal/launchers/gitlaunch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ start_dev_mode() {
sleep 1
}

# Renders the menu view for terminal output.
function render_menu() {
local git_state host_name
local repo_label branch_label
Expand Down
1 change: 1 addition & 0 deletions terminal/launchers/mqlaunch-command-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ nearest_cli_command() {
'
}

# Prints unknown command error.
print_unknown_command_error() {
local command_name="${1:-}"
local nearest
Expand Down
68 changes: 46 additions & 22 deletions terminal/menus/mq-obsidian-menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -345,31 +345,55 @@ mq_obsidian_triage_learning_inbox() {
printf " mq-agent\n"
}

# Regenerates memory views when a supported script exists.
# mqobsidian's view renderers, repo-relative. Each reads local memory data and
# rewrites markdown under its own views/ directory. They sit next to their data
# rather than in mqobsidian/scripts/ on purpose: scripts/ is the export surface
# other repos consume, and these render nothing anyone else reads. Rendering is
# not curation — promotion, scoring and aging stay manual passes in mqobsidian.
MQ_OBSIDIAN_VIEW_RENDERERS=(
"memory/commands/build_views.py"
"memory/workflows/build_workflow_views.py"
)

# Regenerates memory views by running every renderer the vault actually ships.
# Returns the first nonzero status so a broken renderer is not reported as a
# successful regeneration.
mq_obsidian_regenerate_views() {
local python
# `rc`, not `status`: menus run under zsh, where $status is read-only.
local python renderer rc=0 ran=0

if [[ -x "$MQ_OBSIDIAN_DIR/scripts/regenerate-memory-views.py" || -f "$MQ_OBSIDIAN_DIR/scripts/regenerate-memory-views.py" ]]; then
python="$(mq_obsidian_python)" || return
mq_obsidian_run "$python" scripts/regenerate-memory-views.py
else
printf "────────────────────────────────────────────────────────────\n"
printf " mqlaunch · Option 13 · Regenerate memory views\n"
printf "────────────────────────────────────────────────────────────\n\n"
printf "Status\n"
printf " not implemented yet\n\n"
printf "Current state\n"
printf " No regenerate-memory-views script is registered.\n\n"
printf "Expected owner\n"
printf " mq-agent orchestration\n\n"
printf "Local producer\n"
printf " mqobsidian regenerate-memory-views script\n\n"
printf "mqlaunch role\n"
printf " menu entry and read-only status only\n\n"
printf "Available here\n"
printf " Enter return to menu\n"
printf " x exit mqlaunch\n"
for renderer in "${MQ_OBSIDIAN_VIEW_RENDERERS[@]}"; do
[[ -f "$MQ_OBSIDIAN_DIR/$renderer" ]] || continue
if [[ "$ran" -eq 0 ]]; then
python="$(mq_obsidian_python)" || return 1
fi
ran=1
printf "── %s\n" "$renderer"
if ! mq_obsidian_run "$python" "$renderer"; then
rc=1
fi
done

if [[ "$ran" -eq 1 ]]; then
return "$rc"
fi

printf "────────────────────────────────────────────────────────────\n"
printf " mqlaunch · Option 13 · Regenerate memory views\n"
printf "────────────────────────────────────────────────────────────\n\n"
printf "Status\n"
printf " not implemented yet\n\n"
printf "Current state\n"
printf " This vault ships no view renderer.\n\n"
printf "Local producers\n"
for renderer in "${MQ_OBSIDIAN_VIEW_RENDERERS[@]}"; do
printf " %s\n" "$renderer"
done
printf "\nmqlaunch role\n"
printf " runs the renderers; mqobsidian owns curation\n\n"
printf "Available here\n"
printf " Enter return to menu\n"
printf " x exit mqlaunch\n"
}

# Runs the MQ Obsidian menu loop.
Expand Down
1 change: 1 addition & 0 deletions terminal/release/mq-release-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ else
fi

section "MQOBSIDIAN MANIFEST CONTRACT"
# Coordinates check mqobsidian manifest contract behavior.
check_mqobsidian_manifest_contract() {
local manifest="$BASE_DIR/mqlaunch/config/mqobsidian/views.json"

Expand Down
1 change: 1 addition & 0 deletions tests/apps-menu-surface-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ echo "SMOKE: apps menu surface"
echo "[1/4] syntax check"
bash -n "$MENU"

# Coordinates check loop behavior.
check_loop() {
local label="$1" panel="$2" loop="$3" limit="$4"

Expand Down
2 changes: 2 additions & 0 deletions tests/command-discovery-inventory-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ cat >"$probe_dir/collide.sh" <<'PROBE'
#!/usr/bin/env bash
# Same handler names the real menus use, wired to the dispatcher instead.
open_system_menu() { "$BASE_DIR/bin/mqlaunch" system; }
# Runs network ghost.
run_network_ghost() { "$BASE_DIR/bin/mqlaunch" ghost; }
PROBE
with_untracked="$("$TOOL" --json)"
Expand Down Expand Up @@ -170,6 +171,7 @@ echo "[10/10] the inventory still notices a bypass and a duplication"
PLANT_MENU="$ROOT/terminal/menus/mq-net-menu.sh"
PLANT_BACKUP="$(mktemp)"
cp "$PLANT_MENU" "$PLANT_BACKUP"
# Restores plant from saved script state.
restore_plant() { cp "$PLANT_BACKUP" "$PLANT_MENU"; rm -f "$PLANT_BACKUP"; }
trap restore_plant EXIT

Expand Down
1 change: 1 addition & 0 deletions tests/command-registry-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ json.dump(doc, open(sys.argv[2], "w"))
PY
}

# Coordinates expect reject behavior.
expect_reject() {
# expect_reject <fixture> <what> <expected stderr substring>
local fixture="$1" what="$2" reason="$3" out
Expand Down
5 changes: 5 additions & 0 deletions tests/command-word-normalization-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ trap 'rm -rf "$TMPDIR_TEST"' EXIT

echo "SMOKE: command word normalization"

# Runs launcher.
run_launcher() {
set +e
MACOS_SCRIPTS_HOME="$ROOT" MQ_NO_TUI=1 MQLAUNCH_HEADLESS=1 \
Expand Down Expand Up @@ -60,7 +61,9 @@ echo "[3/4] srm routes its agent verbs case-insensitively"
export MACOS_SCRIPTS_HOME="$ROOT"
# shellcheck source=/dev/null
source "$COMMAND_MODE"
# Pauses until Enter is pressed.
pause_enter() { return 0; }
# Runs agent command.
run_agent_command() {
printf '%s\n' "$1" > "$TMPDIR_TEST/verb"
return 0
Expand All @@ -83,7 +86,9 @@ echo "[4/4] normalization does not reach past the command word"
export MACOS_SCRIPTS_HOME="$ROOT"
# shellcheck source=/dev/null
source "$COMMAND_MODE"
# Pauses until Enter is pressed.
pause_enter() { return 0; }
# Runs agent command.
run_agent_command() {
printf '%s\n' "$*" > "$TMPDIR_TEST/args"
}
Expand Down
1 change: 1 addition & 0 deletions tests/delegate-missing-message-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ run_agent_missing() {
MQ_AGENT_BIN="/nonexistent-delegate-for-this-test"
# Stubs for the UI helpers the menu expects from mq-ui.sh.
ui_err() { echo "$*" >&2; }
# Pauses until Enter is pressed.
pause_enter() { :; }
source "'"$AGENT_MENU"'" >/dev/null 2>&1 || true
_run_agent doctor
Expand Down
8 changes: 8 additions & 0 deletions tests/delegated-exit-code-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ export MACOS_SCRIPTS_HOME="$ROOT"
# shellcheck source=/dev/null
source "$COMMAND_MODE"

# Pauses until Enter is pressed.
pause_enter() {
printf 'pause-called\n' >> "$TMPDIR_TEST/pause.log"
return 0
}

# Coordinates assert status behavior.
assert_status() {
local expected="$1"
shift
Expand All @@ -38,17 +40,20 @@ assert_status 1 dispatch_cli_command review
grep -q 'bridge not loaded' "$TMPDIR_TEST/stderr"

echo "[2/12] usage and runtime failures propagate"
# Runs agent command.
run_agent_command() { return "${MQ_TEST_BACKEND_STATUS:-0}"; }
MQ_TEST_BACKEND_STATUS=2 assert_status 2 dispatch_cli_command review
MQ_TEST_BACKEND_STATUS=42 assert_status 42 dispatch_cli_command stack status

echo "[3/12] HAL pause does not overwrite backend status"
# Coordinates mq hal run behavior.
mq_hal_run() { return "${MQ_TEST_BACKEND_STATUS:-0}"; }
rm -f "$TMPDIR_TEST/pause.log"
MQ_TEST_BACKEND_STATUS=42 assert_status 42 dispatch_cli_command hal brief
[[ -s "$TMPDIR_TEST/pause.log" ]]

echo "[4/12] JSON stdout stays clean"
# Coordinates mq hal run behavior.
mq_hal_run() {
printf '{"schema":"hal.test.v1"}\n'
return 42
Expand Down Expand Up @@ -210,6 +215,7 @@ echo "[8/12] the brain bridge's exit status reaches the caller"
brain_status() {
local code="$1" verb="$2"
(
# Coordinates mq brain run behavior.
mq_brain_run() { return "$code"; }
dispatch_cli_command "$verb" note-arg >/dev/null 2>&1
)
Expand Down Expand Up @@ -257,6 +263,7 @@ fn_status() {
)
}

# Coordinates expect status behavior.
expect_status() {
local want="$1" fn="$2"
shift 2
Expand Down Expand Up @@ -325,6 +332,7 @@ exit 7
STUB
chmod +x "$apps_fake/tools/scripts/hal-terminal-guide.sh"

# Coordinates apps status behavior.
apps_status() {
local got=0
(
Expand Down
4 changes: 4 additions & 0 deletions tests/dev-menu-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ echo "[6/6] each grouped row actually opens its submenu"
routes="$(timeout 60 bash -c '
export MACOS_SCRIPTS_HOME="'"$ROOT"'" BASE_DIR="'"$ROOT"'" MQ_NO_TUI=1
source "'"$ROOT"'/terminal/launchers/mqlaunch.sh" >/dev/null 2>&1 || true
# Reads menu choice from user input or stdin.
read_menu_choice() { IFS= read -r REPLY || return 1; return 0; }
# Reads main choice from user input or stdin.
read_main_choice() { IFS= read -r choice || return 1; return 0; }
# Prints header.
print_header() { :; }
# Pauses until Enter is pressed.
pause_enter() { :; }
for choice in 1 4 10; do
printf "%s\nb\nb\n" "$choice" \
Expand Down
1 change: 1 addition & 0 deletions tests/doctor-status-contract-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ build_world "$eza_and_launcher" git gh uv python3 node fzf jq gitleaks pbcopy
doctor_run "$only_eza" key next-eza >/dev/null
doctor_run "$eza_and_launcher" key next-launcher >/dev/null

# Coordinates next step behavior.
next_step() {
# next_step <json-file>
python3 - "$1" <<'PY'
Expand Down
2 changes: 2 additions & 0 deletions tests/git-restore-to-base-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ GIT_MENU="$ROOT/terminal/menus/mq-git-menu.sh"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT

# Coordinates git behavior.
_git() { git -C "$1" "${@:2}"; }

# Coordinates assert restored behavior.
assert_restored() {
local repo="$1"

Expand Down
1 change: 1 addition & 0 deletions tests/hal-args-no-eval-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

# Marks a failing check.
fail() { printf '[FAIL] %s\n' "$1" >&2; exit 1; }

for f in terminal/launchers/mqlaunch-repl.sh terminal/menus/mq-main-menu.sh; do
Expand Down
1 change: 1 addition & 0 deletions tests/install-contract-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ done)
echo "[2/6] a dry run changes nothing"
tmp_bin="$(mktemp -d)"
tmp_state="$(mktemp -d)"
# Coordinates cleanup behavior.
cleanup() { rm -rf "$tmp_bin" "$tmp_state"; }
trap cleanup EXIT

Expand Down
1 change: 1 addition & 0 deletions tests/manifest.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ mq-flow-routing-smoke.sh active -
mq-obsidian-menu-no-promotion-smoke.sh active -
mq-obsidian-python-smoke.sh active -
mq-obsidian-regenerate-placeholder-ui-smoke.sh active -
mq-obsidian-regenerate-views-smoke.sh active -
mq-obsidian-triage-ui-smoke.sh active -
brain-bridge-smoke.sh active -
mq-agent-routing-smoke.sh active -
Expand Down
1 change: 1 addition & 0 deletions tests/monolith-delayer-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set -uo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LAUNCHER="$ROOT/terminal/launchers/mqlaunch.sh"

# Marks a failing check.
fail() { printf '[FAIL] %s\n' "$1" >&2; exit 1; }

# Each concern: "lib_relpath : space-separated function names"
Expand Down
7 changes: 7 additions & 0 deletions tests/mq-agent-routing-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ translate() {
(
# shellcheck source=/dev/null
source "$AGENT_MENU" >/dev/null 2>&1
# Coordinates run agent behavior.
_run_agent() {
printf 'mq-agent'
printf ' %s' "$@"
Expand All @@ -68,6 +69,7 @@ translate() {
)
}

# Coordinates expect translation behavior.
expect_translation() {
local want="$1"
shift
Expand Down Expand Up @@ -105,6 +107,7 @@ dispatch() {
(
# shellcheck source=/dev/null
source "$AGENT_MENU" >/dev/null 2>&1
# Coordinates run agent behavior.
_run_agent() {
printf 'mq-agent'
printf ' %s' "$@"
Expand All @@ -115,6 +118,7 @@ dispatch() {
)
}

# Coordinates expect dispatch behavior.
expect_dispatch() {
local want="$1"
shift
Expand Down Expand Up @@ -172,17 +176,20 @@ cli() {
export MACOS_SCRIPTS_HOME="$ROOT"
# shellcheck source=/dev/null
source "$COMMAND_MODE" >/dev/null 2>&1
# Runs agent command.
run_agent_command() {
printf 'mq-agent'
printf ' %s' "$@"
printf '\n'
return "${STUB_EXIT:-0}"
}
# Pauses until Enter is pressed.
pause_enter() { :; }
dispatch_cli_command "$@"
)
}

# Coordinates expect cli behavior.
expect_cli() {
local want="$1"
shift
Expand Down
1 change: 1 addition & 0 deletions tests/mq-debug-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -uo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

# Marks a failing check.
fail() { printf '[FAIL] %s\n' "$1" >&2; exit 1; }

# shellcheck source=/dev/null
Expand Down
2 changes: 2 additions & 0 deletions tests/mq-memory-cochange-routing-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ echo "[3/7] command mode intercepts 'memory cochange' and routes to the agent br
# shellcheck source=/dev/null
source "$COMMAND_MODE"

# Pauses until Enter is pressed.
pause_enter() { return 0; }
# Runs agent command.
run_agent_command() { printf '%s\n' "$*" >"$DELEGATE_DIR/call"; return 0; }

dispatch_cli_command memory cochange >/dev/null 2>&1
Expand Down
Loading
Loading