<main_goal> Rapid GitHub Repo Clone & Push Workflow Goal: Quickly clone a GitHub repository (without history) and push it to a new repository under one of your organizations, then open it in Cursor. Prerequisites Node.js (for running npx commands). GitHub CLI (gh) – installed and authenticated (run gh auth login once beforehand) stackoverflow.com . Git – installed for initializing and pushing the repo. Cursor – the cursor command is available in your PATH (for opening the project). Automated Shell Script Below is a bash script that automates the entire process. You can save this as fast-clone.sh and run it, or execute the commands step-by-step in a terminal. Comments explain each step: bash Copy #!/bin/bash
TARGET_DIR="${2:-$HOME/project}"
SOURCE_REPO="$1" if [ -z "$SOURCE_REPO" ]; then read -p "Enter GitHub repository (URL or owner/repo): " SOURCE_REPO fi echo "Cloning $SOURCE_REPO into $TARGET_DIR ..." npx --yes giget "$SOURCE_REPO" "$TARGET_DIR" --force || exit 1
cd "$TARGET_DIR" || exit 1 git init git add . git commit -m "Initial commit"
gh auth status &>/dev/null || gh auth login
echo "Fetching your organizations..."
mapfile -t ORGS < <(gh org list --limit 100 | tail -n +2 | awk '{print $1}')
if [ ${#ORGS[@]} -eq 0 ]; then mapfile -t ORGS < <(gh api /user/orgs --jq '.[].login') fi echo "Select an organization for the new repository:" select ORG in "${ORGS[@]}"; do if [[ -n "$ORG" ]]; then break; fi done
read -p "Enter a name for the new GitHub repository: " NEW_REPO
gh repo create "$ORG/$NEW_REPO" --private --source=. --remote=origin --push
cursor . Notes: The script uses npx giget to download the repository content quickly (without git history) github.com github.com . TARGET_DIR defaults to ~/project but can be changed by providing a second argument or editing the script. The GitHub CLI command with --source=. --push creates a new repo under the chosen organization and immediately pushes your initial commit to it (equivalent to gh repo create ORG/REPO followed by a push) stackoverflow.com . The cursor . command opens the current project directory in the Cursor editor – ensure you have Cursor installed and its CLI in your PATH. """ </main_goal>
above you can see our <main_goal>
- all our cli commands will be placed inside src/commands
commands: init.ts (to initialize a project) with options you can choose from
-
project name
-
project directory: where project should be stored (defaults to ~/projects//)
-
enter a name for new github rpeo (default is project-name plus a )
-
which ide you're using (sets the start command in a map code . -> visual studio code cursor . -> cursor windsurf . -> windsurf )
-
more needed?
-
also add commands without having an interactive mode - just with flags if we quickly want to scaffold something.
-
build the logic of the cli but use a different .ts file for it like so code is separated from the cli logic if we want to reuse it (probaby later in a model context protocol server)
there are some options which needs to be dynamic