From 4aa46f0998de4f46571722d81943ec5d070b31b0 Mon Sep 17 00:00:00 2001 From: Micael Malta Date: Mon, 2 Feb 2026 11:17:19 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20Cursor=20IDE=20setup=20=E2=80=93=20comm?= =?UTF-8?q?ands,=20rules,=20and=20curl=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add cursor/commands/ with para-* slash commands (para-init, para-plan, etc.) - Add cursor/rules/para-workflow.mdc for context-aware PARA guidance - Add scripts/setup-cursor.sh with --from-github for install without git clone - Add docs/cursor-setup.md with install options and verification - Update INSTALL.md and README.md with Cursor quick setup and curl one-liner Install from GitHub (no git clone): curl -fsSL https://raw.githubusercontent.com/brian-lai/para-programming-plugin/main/scripts/setup-cursor.sh | bash -s -- --from-github Co-authored-by: Cursor --- INSTALL.md | 50 ++++++++++--- README.md | 21 +++++- cursor/commands/para-archive.md | 23 ++++++ cursor/commands/para-check.md | 18 +++++ cursor/commands/para-execute.md | 22 ++++++ cursor/commands/para-help.md | 29 ++++++++ cursor/commands/para-init.md | 29 ++++++++ cursor/commands/para-plan.md | 29 ++++++++ cursor/commands/para-status.md | 18 +++++ cursor/commands/para-summarize.md | 25 +++++++ cursor/rules/para-workflow.mdc | 29 ++++++++ docs/cursor-setup.md | 119 ++++++++++++++++++++++++++++++ scripts/setup-cursor.sh | 91 +++++++++++++++++++++++ 13 files changed, 492 insertions(+), 11 deletions(-) create mode 100644 cursor/commands/para-archive.md create mode 100644 cursor/commands/para-check.md create mode 100644 cursor/commands/para-execute.md create mode 100644 cursor/commands/para-help.md create mode 100644 cursor/commands/para-init.md create mode 100644 cursor/commands/para-plan.md create mode 100644 cursor/commands/para-status.md create mode 100644 cursor/commands/para-summarize.md create mode 100644 cursor/rules/para-workflow.mdc create mode 100644 docs/cursor-setup.md create mode 100755 scripts/setup-cursor.sh diff --git a/INSTALL.md b/INSTALL.md index 37acd80..a32d9d5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,12 +1,36 @@ # Installation Guide -Complete installation instructions for the PARA-Programming Claude Code plugin. +Complete installation instructions for the PARA-Programming plugin (Claude Code and Cursor). --- -## Prerequisites +## Cursor IDE (Quick Setup) -Before installing, ensure you have: +To use PARA in [Cursor](https://cursor.com): + +1. **Install from GitHub (no git clone)** – from your project root: + ```bash + curl -fsSL https://raw.githubusercontent.com/brian-lai/para-programming-plugin/main/scripts/setup-cursor.sh | bash -s -- --from-github + ``` +2. **Or from this repo**, run (replace with your project path): + ```bash + ./scripts/setup-cursor.sh /path/to/your/project + ``` +3. **Or copy manually** into your project: + ```bash + mkdir -p .cursor + cp -r /path/to/para-programming-plugin/cursor/commands .cursor/ + cp -r /path/to/para-programming-plugin/cursor/rules .cursor/ + ``` +4. In Cursor, open the project, type **/** in chat, and choose a **para-\*** command (e.g. **para-init**, **para-plan**). + +See **[docs/cursor-setup.md](docs/cursor-setup.md)** for install from GitHub (no git clone), global install, verification, and uninstall. + +--- + +## Claude Code – Prerequisites + +Before installing the Claude Code plugin, ensure you have: - ✅ **Claude Code CLI** installed ([Get it here](https://claude.ai/claude-code)) - ✅ **Git** installed (for project version control) @@ -14,7 +38,7 @@ Before installing, ensure you have: --- -## Plugin Installation (Recommended) +## Claude Code – Plugin Installation (Recommended) ### Quick Install @@ -40,6 +64,7 @@ claude ``` You should see commands prefixed with `/para:`: + - `/para:init` - `/para:plan` - `/para:execute` @@ -59,6 +84,7 @@ claude ``` This command automatically: + - **Creates `~/.claude/CLAUDE.md`** (if it doesn't exist) - the global workflow methodology file - Creates the `context/` directory structure in your project - Creates a project-level `CLAUDE.md` for project-specific context @@ -111,10 +137,10 @@ The plugin includes a **global workflow methodology file** that gets installed t ### How It's Installed -| Method | When Global File Is Created | -|--------|----------------------------| -| Plugin + `/para:init` | Automatically on first init (if missing) | -| Manual Installation | Via `cp resources/CLAUDE.md ~/.claude/CLAUDE.md` | +| Method | When Global File Is Created | +| --------------------- | ------------------------------------------------ | +| Plugin + `/para:init` | Automatically on first init (if missing) | +| Manual Installation | Via `cp resources/CLAUDE.md ~/.claude/CLAUDE.md` | ### Important Notes @@ -195,6 +221,7 @@ claude **Problem:** `/plugin install` shows "plugin not found" **Solution:** + 1. Verify marketplace is added: ```bash /plugin marketplace list @@ -209,6 +236,7 @@ claude **Problem:** PARA commands don't show up in `/help` **Solution:** + 1. Check plugin is installed: ```bash /plugin list @@ -224,6 +252,7 @@ claude **Problem:** "Permission denied" when installing **Solution:** + ```bash # Ensure proper permissions on Claude directory chmod -R u+rw ~/.claude @@ -251,10 +280,11 @@ chmod -R u+rw ~/.claude After successful installation: -1. **Initialize your project:** `/para:init` +1. **Initialize your project:** `/para:init` (Claude Code) or `/para-init` (Cursor) 2. **Try the example workflow:** See [examples/example-workflow.md](examples/example-workflow.md) 3. **Read the documentation:** [Main PARA Guide](https://github.com/brian-lai/para-programming) -4. **Start your first task:** `/para:plan "your task description"` +4. **Start your first task:** `/para:plan "your task description"` (Claude Code) or `/para-plan "your task description"` (Cursor) +5. **Using Cursor?** See [docs/cursor-setup.md](docs/cursor-setup.md) for setup and commands --- diff --git a/README.md b/README.md index d24122c..0c1da96 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,12 @@ claude - Example workflows - Documentation +### Cursor IDE + +- **Slash commands** – Use PARA in [Cursor](https://cursor.com) via `/para-init`, `/para-plan`, etc. Type `/` in Cursor chat to see them. +- **Easy setup** – Copy `cursor/commands` and `cursor/rules` into your project’s `.cursor/` directory, or run `./scripts/setup-cursor.sh /path/to/your/project` from this repo. +- **Docs** – See [docs/cursor-setup.md](docs/cursor-setup.md) for step-by-step Cursor setup. + --- ## 🔁 The PARA Workflow @@ -89,12 +95,14 @@ claude ### When to Use **✅ ALWAYS for:** + - Code changes (features, bugs, refactoring) - Architecture decisions - Configuration changes - Database modifications **❌ SKIP for:** + - Informational queries - Code explanations - Navigation @@ -182,7 +190,7 @@ claude para-programming-plugin/ ├── .claude-plugin/ │ └── plugin.json # Plugin manifest -├── commands/ # Slash commands +├── commands/ # Claude Code slash commands │ ├── init.md │ ├── plan.md │ ├── execute.md @@ -191,6 +199,9 @@ para-programming-plugin/ │ ├── status.md │ ├── check.md │ └── help.md +├── cursor/ # Cursor IDE setup +│ ├── commands/ # Cursor slash commands (para-init.md, etc.) +│ └── rules/ # Cursor rules (para-workflow.mdc) ├── hooks/ # Event handlers │ ├── hooks.json │ └── para-session-start.sh @@ -212,26 +223,34 @@ para-programming-plugin/ ## 🎯 Key Features ### Structured Planning + Every task starts with a plan that includes: + - Clear objective - Step-by-step approach - Risk analysis - Success criteria ### Persistent Context + Context persists across sessions: + - Active plans tracked in `context/context.md` - Summaries document what was done - Archives preserve historical state ### Git Integration + PARA workflow integrates with git: + - Creates feature branches automatically - Tracks to-dos as commits - Generates summaries from diffs ### Token Efficiency + Minimizes token usage through: + - Structured context files - MCP preprocessing (optional) - Selective loading of relevant context diff --git a/cursor/commands/para-archive.md b/cursor/commands/para-archive.md new file mode 100644 index 0000000..c390d40 --- /dev/null +++ b/cursor/commands/para-archive.md @@ -0,0 +1,23 @@ +# PARA Archive – Archive context and reset for the next task + +Archive the current context so you can start the next task with a clean slate. + +## What to do + +1. **Check** – Ensure `context/context.md` exists. + +2. **Timestamp** – Use current time in `YYYY-MM-DD-HHMM` format. + +3. **Move** – Move `context/context.md` to `context/archives/YYYY-MM-DD-HHMM-context.md`. + +4. **New context** – Create a fresh `context/context.md` with: + - A short "Current Work Summary" (e.g. "Ready for next task.") + - JSON: `active_context: []`, `completed_summaries: []` (or carry forward recent summary paths if useful), `last_updated` (current ISO timestamp). + +5. **Confirm** – Tell the user the previous context was archived and where. Remind them to run `/para-plan` for the next task and `/para-status` or `/para-help` as needed. + +## When to use + +- Work is done and summarized. +- Starting a new, unrelated task. + Do not archive if work is still in progress or you need the current context for the next message. diff --git a/cursor/commands/para-check.md b/cursor/commands/para-check.md new file mode 100644 index 0000000..608f954 --- /dev/null +++ b/cursor/commands/para-check.md @@ -0,0 +1,18 @@ +# PARA Check – Should we use the PARA workflow? + +Decide whether the user’s request should go through the full PARA workflow or be answered directly. + +## What to do + +1. **Request** – Use the user’s last message or the request they pasted (e.g. "Add auth to the API" or "Where is the login handler?"). + +2. **Apply this decision tree** + - **Asking for code or file changes?** (features, bugs, refactors, config, DB, tests, docs that affect code) → **Use PARA**: create a plan, then execute, summarize, archive. + - **Otherwise, asking about this project’s code?** (where is X, how does Y work) → **Skip PARA**: answer directly with file references. + - **Otherwise** (general or off-topic) → **Skip PARA**: answer normally. + +3. **Respond** – State clearly: "Use PARA workflow" or "Skip PARA; answer directly." Briefly say why (e.g. "This involves code changes" or "This is a read-only question"). If USE PARA, suggest running `/para-plan` with a short task description. + +## Rule of thumb + +If it would result in git changes to project files, use PARA. If it’s read-only or informational, skip PARA. diff --git a/cursor/commands/para-execute.md b/cursor/commands/para-execute.md new file mode 100644 index 0000000..03fb85d --- /dev/null +++ b/cursor/commands/para-execute.md @@ -0,0 +1,22 @@ +# PARA Execute – Start execution with branch and to-dos + +Execute the active plan: create a branch and turn the plan into a trackable to-do list in `context/context.md`. + +## What to do + +1. **Read context** – Open `context/context.md` and find the active plan(s). If there is a `phased_execution` block, treat this as a phased plan. + +2. **Phased plan** – If phased, ask which phase to execute (or use the user’s choice). Create branch `para/{task-name}-phase-N`. Set that phase’s status to "in_progress" in context. + +3. **Simple plan** – Create branch `para/{task-name}` (from the plan filename). + +4. **Branch** – Create the git branch (e.g. `git checkout -b para/{task-name}`). If user said no branch or continue on current branch, skip branch creation. + +5. **To-dos** – From the plan file(s), extract implementation steps into a clear to-do list. Update `context/context.md` with: + - Human-readable “Current Work Summary” describing the task. + - A to-do list (e.g. `- [ ] Step 1`, `- [ ] Step 2`). + - Ensure the JSON block has the active plan in `active_context` and updated `last_updated`. + +6. **First commit** – Commit the updated `context/context.md` with a message like "chore: Initialize execution context". + +7. **Remind** – Tell the user to work through the to-dos, mark items `[x]` as done, and **commit after each completed to-do** with the to-do text as the commit message. When done, run `/para-summarize`. diff --git a/cursor/commands/para-help.md b/cursor/commands/para-help.md new file mode 100644 index 0000000..a6d7dbd --- /dev/null +++ b/cursor/commands/para-help.md @@ -0,0 +1,29 @@ +# PARA Help – Full PARA-Programming guide + +Give a concise but complete overview of PARA-Programming and how to use it in Cursor. + +## What to include + +1. **What is PARA** – Structured workflow for AI-assisted development: plan before coding, capture outcomes. Goals: accuracy, token efficiency, auditability. + +2. **The workflow** – Plan → Review → Execute → Summarize → Archive. Briefly say what each step is for. + +3. **When to use PARA** + - Use for: code changes, features, bugs, refactors, config, DB changes, tests, architecture decisions. + - Skip for: "Where is X?", "How does Y work?", explanations, navigation, simple questions. + +4. **Cursor commands** – List these and one-line descriptions: + - `/para-init` – Initialize PARA in this project + - `/para-plan` – Create a plan (add task description) + - `/para-execute` – Start execution (branch + to-dos) + - `/para-summarize` – Write summary from current work + - `/para-archive` – Archive context for next task + - `/para-status` – Show current state + - `/para-check` – Decide: use PARA or answer directly + - `/para-help` – This guide + +5. **Quick start** – If no `context/` yet: run `/para-init`. Then `/para-plan "your task"`, review the plan, `/para-execute`, work through to-dos (commit each), then `/para-summarize` and `/para-archive`. + +6. **Rule of thumb** – If it results in git changes, use PARA. If it’s read-only, skip it. + +Keep the reply scannable (short paragraphs, bullets, maybe a small table). Offer to run a specific command if the user wants to try one next. diff --git a/cursor/commands/para-init.md b/cursor/commands/para-init.md new file mode 100644 index 0000000..4520a73 --- /dev/null +++ b/cursor/commands/para-init.md @@ -0,0 +1,29 @@ +# PARA Init – Initialize PARA structure + +Set up the complete PARA-Programming environment in this project. + +## What to do + +1. **Global methodology** – If `~/.claude/CLAUDE.md` does not exist, create `~/.claude` and copy or create the global PARA workflow file there (never overwrite if it exists). + +2. **Project directories** – Create: + + ``` + context/data + context/plans + context/summaries + context/archives + context/servers + ``` + +3. **context/context.md** – Create with: + - A short "Current Work Summary" (e.g. "Ready to start first task.") + - A JSON block: `active_context: []`, `completed_summaries: []`, `last_updated` (current ISO timestamp). + +4. **Project CLAUDE.md** – If the project root has no `CLAUDE.md`, create one that references the global workflow at `~/.claude/CLAUDE.md` and adds project-specific context (or leave placeholders). + +5. **Confirm** – List what was created and suggest next steps: run `/para-plan` with a task description, then `/para-status` and `/para-help` as needed. + +## After setup + +Tell the user the PARA workflow is ready and remind them: **Plan → Review → Execute → Summarize → Archive**. Use PARA for code changes and file modifications; skip it for simple questions and navigation. diff --git a/cursor/commands/para-plan.md b/cursor/commands/para-plan.md new file mode 100644 index 0000000..bf74586 --- /dev/null +++ b/cursor/commands/para-plan.md @@ -0,0 +1,29 @@ +# PARA Plan – Create a plan for the current task + +Create a planning document for the task the user describes (or ask for a task description if none was given). + +## What to do + +1. **Task** – Use the user’s task description from this chat, or ask for one. + +2. **Scope** – Decide if this is a simple plan (one file) or a phased plan (master + sub-plans). Prefer a phased plan when: + - Many files or layers (e.g. DB → API → frontend) + - Multiple services or clear phases + - Work benefits from incremental review/merge + +3. **Simple plan** + - Create `context/plans/YYYY-MM-DD-{task-name}.md` (sanitize task name: lowercase, hyphens). + - Sections: Objective, Approach, Risks, Data Sources, MCP Tools (if any), Success Criteria. + - Update `context/context.md`: add the plan path to `active_context`, set `last_updated`. + +4. **Phased plan** (if you offered and user agreed) + - Create master: `context/plans/YYYY-MM-DD-{task-name}.md` with overall objective and phase list. + - Create one file per phase: `context/plans/YYYY-MM-DD-{task-name}-phase-1.md`, etc., with phase objective, steps, risks, success criteria. + - Update `context/context.md`: add all plan paths to `active_context` and add a `phased_execution` block (master_plan, phases array with phase number, plan path, status "pending", current_phase null). + +5. **Review** – Tell the user where the plan(s) live and ask them to review before running `/para-execute`. + +## Notes + +- Always use a `YYYY-MM-DD` date prefix for plan filenames. +- If the project has no `context/` yet, run the PARA init steps first (create directories and `context/context.md`). diff --git a/cursor/commands/para-status.md b/cursor/commands/para-status.md new file mode 100644 index 0000000..dfb481e --- /dev/null +++ b/cursor/commands/para-status.md @@ -0,0 +1,18 @@ +# PARA Status – Show current workflow state + +Show where we are in the PARA workflow. + +## What to do + +1. **Read** – Open `context/context.md`. If it or the `context/` directory does not exist, say "PARA not initialized" and suggest running `/para-init`. + +2. **Report** – Summarize in a clear, scannable format: + - **Current work** – The human-readable summary at the top of context.md. + - **Active plans** – List paths in `active_context` that are plans (in `context/plans/`). + - **Completed summaries** – List paths in `completed_summaries` (and any in the JSON). + - **Last updated** – The `last_updated` value from the JSON. + - **Phased execution** – If `phased_execution` exists, show current phase and phase statuses. + +3. **Next action** – Suggest the next step (e.g. "Continue executing the plan and run /para-summarize when done" or "Run /para-plan to create a plan" if there are no active plans). + +Use a simple layout (e.g. short headings and bullet lists) so the user can scan quickly. diff --git a/cursor/commands/para-summarize.md b/cursor/commands/para-summarize.md new file mode 100644 index 0000000..d05e4f9 --- /dev/null +++ b/cursor/commands/para-summarize.md @@ -0,0 +1,25 @@ +# PARA Summarize – Generate a summary from completed work + +Generate a summary document from the current work and update context. + +## What to do + +1. **Context** – Read `context/context.md` to get the active plan path and (if present) phased_execution. + +2. **Changes** – Run `git diff` and `git status` to see what changed since the plan started (or since the phase started for phased plans). + +3. **Task name** – Derive the task name from the active plan filename (e.g. `2025-12-22-add-auth.md` → "add-auth"). + +4. **Summary file** – Create `context/summaries/YYYY-MM-DD-{task-name}-summary.md` (or `-phase-N-summary.md` for a phase). Include: + - Date and status (e.g. completed) + - What changed (files, brief description) + - Why (from the plan) + - Key learnings and follow-ups + - Test/verification notes if relevant + +5. **Update context** – In `context/context.md`: + - Move the completed plan from `active_context` to `completed_summaries` (add the new summary path). + - If phased, set the phase status to "completed". + - Update `last_updated`. + +6. **Confirm** – Show where the summary was written and suggest running `/para-archive` when ready for the next task. diff --git a/cursor/rules/para-workflow.mdc b/cursor/rules/para-workflow.mdc new file mode 100644 index 0000000..247f1ec --- /dev/null +++ b/cursor/rules/para-workflow.mdc @@ -0,0 +1,29 @@ +--- +description: PARA-Programming workflow – when to use plans and slash commands +globs: context/**/* +alwaysApply: false +--- + +# PARA-Programming in Cursor + +This project uses the PARA workflow. When the user asks for **code or file changes** (features, bugs, refactors, config, DB, tests), use the PARA flow: Plan → Review → Execute → Summarize → Archive. + +## When to use PARA + +- **Use PARA:** Code changes, features, bug fixes, refactors, architecture decisions, file modifications, DB changes, tests. +- **Skip PARA:** "Where is X?", "How does Y work?", explanations, navigation, simple lookups. + +**Rule of thumb:** If it would result in git changes, use PARA. If it's read-only, answer directly. + +## Slash commands (type `/` in chat) + +- `/para-init` – Initialize PARA in this project (first time) +- `/para-plan` – Create a plan (add task description) +- `/para-execute` – Start execution (branch + to-dos) +- `/para-summarize` – Write summary from completed work +- `/para-archive` – Archive context for next task +- `/para-status` – Show current workflow state +- `/para-check` – Decide: use PARA or answer directly +- `/para-help` – Full guide + +When the user requests work that changes code or files, suggest running `/para-plan "task description"` or run the plan step yourself and then proceed with execute/summarize/archive as appropriate. diff --git a/docs/cursor-setup.md b/docs/cursor-setup.md new file mode 100644 index 0000000..26f164f --- /dev/null +++ b/docs/cursor-setup.md @@ -0,0 +1,119 @@ +# Cursor Setup for PARA-Programming + +Use PARA-Programming in [Cursor](https://cursor.com) by adding the PARA slash commands and optional rules to your project or your user config. + +--- + +## Quick setup (project) + +Copy the Cursor commands and rules into your project so they appear when you type `/` in Cursor chat. + +### Option A: Install from GitHub (no git clone) + +From your **project root**, run: + +```bash +curl -fsSL https://raw.githubusercontent.com/brian-lai/para-programming-plugin/main/scripts/setup-cursor.sh | bash -s -- --from-github +``` + +This downloads the script and the Cursor command/rule files from GitHub and installs them into `.cursor/` in the current directory. No git clone required. + +To install into a specific directory: + +```bash +curl -fsSL https://raw.githubusercontent.com/brian-lai/para-programming-plugin/main/scripts/setup-cursor.sh | bash -s -- --from-github /path/to/your/project +``` + +### Option B: Copy from this repo (if you have it) + +```bash +# From your project root (not inside the plugin repo) +mkdir -p .cursor +cp -r /path/to/para-programming-plugin/cursor/commands .cursor/ +cp -r /path/to/para-programming-plugin/cursor/rules .cursor/ +``` + +Replace `/path/to/para-programming-plugin` with the actual path to your clone of the para-programming-plugin repo. + +### Option C: Run the setup script (from plugin repo) + +From inside the para-programming-plugin repo: + +```bash +./scripts/setup-cursor.sh /path/to/your/project +``` + +This creates `.cursor/commands` and `.cursor/rules` in the target project and copies the PARA command and rule files. + +### Option D: Global commands (all projects) + +To have PARA commands available in every project: + +```bash +mkdir -p ~/.cursor/commands +cp cursor/commands/*.md ~/.cursor/commands/ +``` + +You can do this from a clone of the plugin repo. Global commands are merged with project commands when you type `/` in Cursor. + +--- + +## What gets installed + +### Commands (`.cursor/commands/`) + +| Command | Purpose | +| ---------------- | --------------------------------------------- | +| `para-init` | Initialize PARA structure in the project | +| `para-plan` | Create a plan for the current task | +| `para-execute` | Start execution (branch + to-dos) | +| `para-summarize` | Generate summary from completed work | +| `para-archive` | Archive context and reset for next task | +| `para-status` | Show current workflow state | +| `para-check` | Decide whether to use PARA or answer directly | +| `para-help` | Full PARA guide | + +In Cursor chat, type `/` and choose one of these (e.g. **para-init**, **para-plan**). + +### Rules (`.cursor/rules/`) + +- **para-workflow.mdc** – Applies when files under `context/` are in scope. Reminds the AI to use the PARA workflow for code changes and lists the slash commands. + +Rules are optional; commands alone are enough to run the workflow. + +--- + +## Verify + +1. Open your project in Cursor. +2. Open the AI chat (e.g. Cmd+L or Ctrl+L). +3. Type `/`. +4. You should see the `para-*` commands in the list (and any other project or global commands). + +--- + +## Updating + +After pulling new versions of the plugin, re-run the copy or setup script to refresh `.cursor/commands` and `.cursor/rules` in your project (or in `~/.cursor/commands` for global). + +--- + +## Uninstall + +Remove the PARA command and rule files: + +```bash +# Project only +rm -rf .cursor/commands/para-*.md .cursor/rules/para-workflow.mdc + +# Global only +rm -f ~/.cursor/commands/para-*.md +``` + +--- + +## See also + +- [INSTALL.md](../INSTALL.md) – Claude Code plugin installation +- [README.md](../README.md) – PARA workflow overview +- [Main PARA guide](https://github.com/brian-lai/para-programming) diff --git a/scripts/setup-cursor.sh b/scripts/setup-cursor.sh new file mode 100755 index 0000000..78cd793 --- /dev/null +++ b/scripts/setup-cursor.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# PARA-Programming Cursor Setup Script +# Copies Cursor commands and rules into a project's .cursor/ directory +# +# Install from GitHub (no git clone): +# curl -fsSL https://raw.githubusercontent.com/brian-lai/para-programming-plugin/main/scripts/setup-cursor.sh | bash -s -- --from-github +# Or into a specific directory: +# curl -fsSL ... | bash -s -- --from-github /path/to/project +# + +set -e + +REPO="brian-lai/para-programming-plugin" +BRANCH="main" +FROM_GITHUB=false +TARGET="." +TMP_DIR="" + +# Parse args: --from-github [target-dir] or [target-dir] +if [ "$1" = "--from-github" ]; then + FROM_GITHUB=true + shift + TARGET="${1:-.}" +else + TARGET="${1:-.}" +fi + +if [ -n "$TARGET" ] && [ "$TARGET" != "." ]; then + TARGET="$(cd "$TARGET" && pwd)" +else + TARGET="$(pwd)" +fi + +if [ "$FROM_GITHUB" = true ]; then + BASE_URL="https://raw.githubusercontent.com/${REPO}/${BRANCH}" + TMP_DIR="$(mktemp -d)" + trap 'rm -rf "$TMP_DIR"' EXIT + PLUGIN_ROOT="$TMP_DIR" + mkdir -p "$PLUGIN_ROOT/cursor/commands" "$PLUGIN_ROOT/cursor/rules" + + echo "📥 Downloading from GitHub (${REPO} ${BRANCH})..." + for name in para-init para-plan para-execute para-summarize para-archive para-status para-check para-help; do + curl -fsSL "${BASE_URL}/cursor/commands/${name}.md" -o "$PLUGIN_ROOT/cursor/commands/${name}.md" + done + curl -fsSL "${BASE_URL}/cursor/rules/para-workflow.mdc" -o "$PLUGIN_ROOT/cursor/rules/para-workflow.mdc" + echo "" +else + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + PLUGIN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + if [ ! -d "$PLUGIN_ROOT/cursor/commands" ]; then + echo "❌ cursor/commands not found at $PLUGIN_ROOT" + echo " Install from GitHub without cloning:" + echo " curl -fsSL https://raw.githubusercontent.com/${REPO}/main/scripts/setup-cursor.sh | bash -s -- --from-github" + exit 1 + fi +fi + +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo " PARA-Programming Cursor Setup" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo " Target: $TARGET/.cursor/" +echo "" + +mkdir -p "$TARGET/.cursor/commands" +mkdir -p "$TARGET/.cursor/rules" + +echo "📋 Copying commands..." +for f in "$PLUGIN_ROOT/cursor/commands/"*.md; do + [ -f "$f" ] || continue + cp "$f" "$TARGET/.cursor/commands/" + echo " ✅ $(basename "$f")" +done + +echo "" +echo "📐 Copying rules..." +for f in "$PLUGIN_ROOT/cursor/rules/"*.mdc; do + [ -f "$f" ] || continue + cp "$f" "$TARGET/.cursor/rules/" + echo " ✅ $(basename "$f")" +done + +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo " ✨ Cursor setup complete!" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo " In Cursor: type / in chat to see para-* commands." +echo " First time? Run /para-init in your project, then /para-plan \"task\"" +echo ""