feat: integrate framework files into monorepo under packages/mosaic/framework/
Moves all Mosaic framework runtime files from the separate bootstrap repo into the monorepo as canonical source. The @mosaic/mosaic npm package now ships the complete framework — bin scripts, runtime configs, tools, and templates — enabling standalone installation via npm install. Structure: packages/mosaic/framework/ ├── bin/ 28 CLI scripts (mosaic, mosaic-doctor, mosaic-sync-skills, etc.) ├── runtime/ Runtime adapters (claude, codex, opencode, pi, mcp) ├── tools/ Shell tooling (git, prdy, orchestrator, quality, etc.) ├── templates/ Agent and repo templates ├── defaults/ Default identity files (AGENTS.md, STANDARDS.md, SOUL.md, etc.) ├── install.sh Legacy bash installer └── remote-install.sh One-liner remote installer Key files with Pi support and recent fixes: - bin/mosaic: launch_pi() with skills-local loop - bin/mosaic-doctor: --fix auto-wiring for all 4 harnesses - bin/mosaic-sync-skills: Pi as 4th link target, symlink-aware find - bin/mosaic-link-runtime-assets: Pi settings.json patching - bin/mosaic-migrate-local-skills: Pi skill roots, symlink find - runtime/pi/RUNTIME.md + mosaic-extension.ts Package ships 251 framework files in the npm tarball (278KB compressed).
This commit is contained in:
106
packages/mosaic/framework/tools/prdy/prdy-init.sh
Executable file
106
packages/mosaic/framework/tools/prdy/prdy-init.sh
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
#
|
||||
# prdy-init.sh — Create a new PRD via guided runtime session
|
||||
#
|
||||
# Usage:
|
||||
# prdy-init.sh [--project <path>] [--name <feature>]
|
||||
#
|
||||
# Launches a dedicated runtime session in yolo mode with a specialized
|
||||
# system prompt that guides the user through PRD creation. The output is
|
||||
# written to docs/PRD.md.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/_lib.sh"
|
||||
|
||||
# ─── Parse arguments ─────────────────────────────────────────────────────────
|
||||
|
||||
PROJECT="."
|
||||
NAME=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--project) PROJECT="$2"; shift 2 ;;
|
||||
--name) NAME="$2"; shift 2 ;;
|
||||
-h|--help)
|
||||
cat <<'USAGE'
|
||||
prdy-init.sh — Create a new PRD via guided runtime session
|
||||
|
||||
Usage: prdy-init.sh [--project <path>] [--name <feature>]
|
||||
|
||||
Options:
|
||||
--project <path> Project directory (default: CWD)
|
||||
--name <feature> Feature or project name (optional, runtime will ask if omitted)
|
||||
|
||||
Launches the selected runtime in yolo mode with a PRD-focused prompt.
|
||||
The agent will ask clarifying questions, then write docs/PRD.md.
|
||||
|
||||
Examples:
|
||||
mosaic prdy init
|
||||
mosaic prdy init --name "User Authentication"
|
||||
mosaic prdy init --project ~/src/my-app --name "Dashboard Redesign"
|
||||
USAGE
|
||||
exit 0
|
||||
;;
|
||||
*) echo "Unknown option: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Expand tilde if passed literally (e.g., --project ~/src/foo)
|
||||
PROJECT="${PROJECT/#\~/$HOME}"
|
||||
|
||||
# ─── Preflight checks ───────────────────────────────────────────────────────
|
||||
|
||||
RUNTIME_CMD="$(prdy_runtime_command)"
|
||||
_require_cmd "$RUNTIME_CMD"
|
||||
|
||||
# Check for existing PRD
|
||||
EXISTING="$(find_prd "$PROJECT")"
|
||||
if [[ -n "$EXISTING" ]]; then
|
||||
fail "PRD already exists: $EXISTING"
|
||||
echo -e " Use ${C_CYAN}mosaic prdy update${C_RESET} to modify the existing PRD."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure docs/ directory exists
|
||||
mkdir -p "$PROJECT/docs"
|
||||
|
||||
# ─── Build system prompt ─────────────────────────────────────────────────────
|
||||
|
||||
step "Launching PRD creation session"
|
||||
|
||||
SYSTEM_PROMPT="$(build_prdy_system_prompt "init")"
|
||||
|
||||
# Build kickoff message
|
||||
if [[ -n "$NAME" ]]; then
|
||||
KICKOFF="Create docs/PRD.md for the feature: ${NAME}. Read the project context first, then ask clarifying questions before writing the PRD."
|
||||
else
|
||||
KICKOFF="Create docs/PRD.md for this project. Read the project context first, then ask the user what they want to build. Ask clarifying questions before writing the PRD."
|
||||
fi
|
||||
|
||||
# ─── Launch runtime ──────────────────────────────────────────────────────────
|
||||
|
||||
info "Output target: $PROJECT/$PRD_CANONICAL"
|
||||
info "Mode: PRD Creation (yolo, runtime: $RUNTIME_CMD)"
|
||||
echo ""
|
||||
|
||||
cd "$PROJECT"
|
||||
if [[ "$RUNTIME_CMD" == "claude" ]]; then
|
||||
exec claude --dangerously-skip-permissions --append-system-prompt "$SYSTEM_PROMPT" "$KICKOFF"
|
||||
fi
|
||||
|
||||
if [[ "$RUNTIME_CMD" == "codex" ]]; then
|
||||
CODEX_PROMPT="$(cat <<EOF
|
||||
Follow this PRD contract exactly.
|
||||
|
||||
$SYSTEM_PROMPT
|
||||
|
||||
Task:
|
||||
$KICKOFF
|
||||
EOF
|
||||
)"
|
||||
exec codex --dangerously-bypass-approvals-and-sandbox "$CODEX_PROMPT"
|
||||
fi
|
||||
|
||||
fail "Unsupported runtime: $RUNTIME_CMD"
|
||||
exit 1
|
||||
Reference in New Issue
Block a user