j-mauro-r/SAT-Dengue-V2 / .agents/skills/deepworkplan
deepworkplan
VerifiedDeepWorkPlan — turn any repo AI-first and run Deep Work Plans. Routes to create, execute, refine, resume, status, verify, upgrade, and repo-onboarding sub-skills based on intent. Use when the developer wants to plan, execute, manage, or verify structured multi-task work, or make a repository AI-agent-ready.
shared/context.sh
View on GitHub#!/usr/bin/env bash
# context.sh — shared context detection for all DeepWorkPlan sub-skills.
#
# Detects the current repository context and resolves where Deep Work Plan
# outputs live (.dwp/). Emits a single-line JSON object that sub-skills can read.
# Compatible with: Claude Code, Codex CLI, Cursor, Gemini CLI, OpenClaw,
# Windsurf, bare shell.
#
# Usage: bash context.sh
# Output: {"repo":"...","repo_root":"...","branch":"...","agent_tool":"...","dwp_dir":"..."}
#
# Contract:
# - repo_root : the repository root (git toplevel if available, else $PWD).
# - repo : the repo name (from `git remote get-url origin`, else the
# basename of repo_root).
# - branch : current git branch, or "unknown" outside a git work tree.
# - agent_tool: the AI coding agent in use, detected from vendor env vars
# (DWP_AGENT_TOOL override > harness env vars > "unknown").
# - dwp_dir : the .dwp/ output location. Default "<repo_root>/.dwp".
# Overridable via the DWP_DIR env var. See shared/dwp-paths.md.
#
# Bash 3.2 compatibility (macOS default): NO mapfile/readarray, NO `declare -A`
# associative arrays, NO `${var^^}`/`${var,,}` case conversion.
set -euo pipefail
# ── Repo root ────────────────────────────────────────────────────────────────
REPO_ROOT=""
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
fi
if [ -z "$REPO_ROOT" ]; then
REPO_ROOT="$PWD"
fi
# ── Repo name ────────────────────────────────────────────────────────────────
REPO=""
REMOTE=$(git remote get-url origin 2>/dev/null || echo "")
if [ -n "$REMOTE" ]; then
REPO="${REMOTE##*/}"
REPO="${REPO%.git}"
fi
if [ -z "$REPO" ]; then
REPO=$(basename "$REPO_ROOT")
fi
# ── Branch ───────────────────────────────────────────────────────────────────
BRANCH=$(git branch --show-current 2>/dev/null || echo "")
if [ -z "$BRANCH" ]; then
BRANCH="unknown"
fi
# ── Agent detection ──────────────────────────────────────────────────────────
# Priority: explicit override > vendor env vars > "unknown".
AGENT_TOOL="unknown"
if [ -n "${DWP_AGENT_TOOL:-}" ]; then
AGENT_TOOL="$DWP_AGENT_TOOL"
elif [ -n "${CLAUDE_PLUGIN_ROOT:-}${CLAUDECODE:-}" ]; then
AGENT_TOOL="claude-code"
elif [ -n "${CODEX_SESSION_ID:-}${CODEX_HOME:-}" ]; then
AGENT_TOOL="codex-cli"
elif [ -n "${CURSOR_SESSION_ID:-}${CURSOR_TRACE_ID:-}" ]; then
AGENT_TOOL="cursor"
elif [ -n "${OPENCLAW_SESSION:-}" ]; then
AGENT_TOOL="openclaw"
elif [ -n "${GEMINI_SESSION_ID:-}" ]; then
AGENT_TOOL="gemini-cli"
elif [ -n "${WINDSURF_SESSION_ID:-}" ]; then
AGENT_TOOL="windsurf"
fi
# ── .dwp/ location ───────────────────────────────────────────────────────────
# Default to <repo_root>/.dwp; override via DWP_DIR. See shared/dwp-paths.md.
DWP_DIR="${DWP_DIR:-$REPO_ROOT/.dwp}"
# ── Output (single-line JSON) ────────────────────────────────────────────────
# Emits compact JSON. Paths are hostile-but-valid in the wild — spaces, shell
# metacharacters, and even embedded quotes or backslashes escapes — so every
# field is escaped for a JSON string literal before printing. Bash 3.2
# compatible: sed is POSIX, no mapfile/associative arrays/case conversion.
json_escape() {
printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'
}
printf '{"repo":"%s","repo_root":"%s","branch":"%s","agent_tool":"%s","dwp_dir":"%s"}\n' \
"$(json_escape "$REPO")" "$(json_escape "$REPO_ROOT")" "$(json_escape "$BRANCH")" \
"$(json_escape "$AGENT_TOOL")" "$(json_escape "$DWP_DIR")"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |