Implement S7 operator connect helpers for SaaS and channels.
Add dry-run-default connect dispatcher and per-integration scripts with gitignored local capability state, docs, and unit tests. Mutations require --apply and use nemohermes/openshell only.
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/connect/connect-name.sh — S7: Name / profile connect helper
|
||||
#
|
||||
# Guides the operator through naming the assistant and setting the profile.
|
||||
# The assistant name becomes the NemoClaw sandbox display identity.
|
||||
#
|
||||
# Platform-first: uses nemohermes for sandbox operations.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/connect/connect-name.sh [--dry-run|--apply]
|
||||
# ./scripts/connect/connect-name.sh --help
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source shared helpers
|
||||
# shellcheck source=../lib/common.sh
|
||||
source "$SCRIPT_DIR/../lib/common.sh"
|
||||
# shellcheck source=../lib/env.sh
|
||||
source "$SCRIPT_DIR/../lib/env.sh"
|
||||
# shellcheck source=../lib/connect_state.sh
|
||||
source "$SCRIPT_DIR/../lib/connect_state.sh"
|
||||
|
||||
# ── Defaults ───────────────────────────────────────────────────────────────
|
||||
DRY_RUN=1
|
||||
APPLY=0
|
||||
|
||||
# ── Parse args ─────────────────────────────────────────────────────────────
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--help|-h)
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [OPTIONS]
|
||||
|
||||
Name / profile connect helper.
|
||||
|
||||
Sets the assistant name (sandbox display identity) and verifies the profile
|
||||
is configured. The assistant name is stored in LUMINA_SANDBOX in .env.
|
||||
|
||||
Options:
|
||||
--dry-run Preview only (default)
|
||||
--apply Execute mutations
|
||||
--help Show this help
|
||||
|
||||
Safety:
|
||||
--dry-run is the default. Use --apply to perform mutations.
|
||||
Renaming an existing sandbox may require a rebuild.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
APPLY=0
|
||||
shift
|
||||
;;
|
||||
--apply)
|
||||
DRY_RUN=0
|
||||
APPLY=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
log_error "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ── Load .env ──────────────────────────────────────────────────────────────
|
||||
load_env
|
||||
|
||||
SANDBOX_NAME="$(get_sandbox_name)"
|
||||
|
||||
log_section "Name / Profile Setup"
|
||||
|
||||
# ── Current state ──────────────────────────────────────────────────────────
|
||||
current_status="$(get_status "name")"
|
||||
|
||||
if [[ -n "$current_status" ]]; then
|
||||
log_info "Current name status: $current_status"
|
||||
fi
|
||||
|
||||
log_info "Current sandbox name: $SANDBOX_NAME"
|
||||
|
||||
# ── Check sandbox exists ───────────────────────────────────────────────────
|
||||
if nemohermes_available; then
|
||||
if nemohermes "$SANDBOX_NAME" status &>/dev/null 2>&1; then
|
||||
log_info "Sandbox '$SANDBOX_NAME' is reachable."
|
||||
else
|
||||
log_warn "Sandbox '$SANDBOX_NAME' not found. Run S4 (sandbox onboard) first."
|
||||
if [[ $APPLY -eq 1 ]]; then
|
||||
set_status "name" "error" "Sandbox not found — run S4 first"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log_warn "nemohermes not available — cannot verify sandbox"
|
||||
fi
|
||||
|
||||
# ── Name guidance ──────────────────────────────────────────────────────────
|
||||
log_info ""
|
||||
log_info "The assistant name is the display identity the owner sees."
|
||||
log_info "It is stored as LUMINA_SANDBOX in .env and used by nemohermes."
|
||||
log_info ""
|
||||
log_info "Platform naming rules:"
|
||||
log_info " - Lowercase letters, digits, hyphens, underscores"
|
||||
log_info " - 1-63 characters"
|
||||
log_info " - Must be unique within the NemoClaw registry"
|
||||
log_info ""
|
||||
|
||||
# ── Rename (if --apply and operator wants to change) ───────────────────────
|
||||
if [[ $APPLY -eq 1 ]]; then
|
||||
log_info "Current name: $SANDBOX_NAME"
|
||||
log_info ""
|
||||
log_info "To rename the assistant:"
|
||||
log_info " 1. Edit LUMINA_SANDBOX in .env"
|
||||
log_info " 2. Run: nemohermes <new-name> onboard (creates new sandbox)"
|
||||
log_info " 3. Re-run S5 (policy + skills) for the new sandbox"
|
||||
log_info ""
|
||||
log_warn "Renaming requires creating a new sandbox. The old sandbox is NOT"
|
||||
log_warn "automatically deleted. Delete it manually if no longer needed."
|
||||
log_info ""
|
||||
|
||||
# For now, we record the name as connected if sandbox exists
|
||||
set_status "name" "connected" "Sandbox '$SANDBOX_NAME' verified"
|
||||
log_info "Name status recorded as connected."
|
||||
else
|
||||
log_info "[DRY-RUN] Would verify sandbox name and record status."
|
||||
log_info "Use --apply to record the name status."
|
||||
fi
|
||||
|
||||
# ── Profile guidance ───────────────────────────────────────────────────────
|
||||
log_info ""
|
||||
log_info "Profile intake (business name, timezone, hours, priorities, hard rules)"
|
||||
log_info "is handled through the setup-education skill in the assistant chat."
|
||||
log_info "The operator does not need to configure this via scripts."
|
||||
|
||||
if [[ $APPLY -eq 1 ]]; then
|
||||
# Check if profile status is already set
|
||||
profile_status="$(get_status "profile")"
|
||||
if [[ -z "$profile_status" ]]; then
|
||||
# Default: profile is handled by owner in chat, not operator script
|
||||
set_status "profile" "later" "Profile intake via setup-education skill in chat"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "Name / profile connect complete."
|
||||
Reference in New Issue
Block a user