Create a new GitHub Project from template (or blank) and link it to the current repository
/plugin marketplace add el-feo/ai-context/plugin install ghpm@jebs-dev-toolsproject titleOptional environment variables:
GHPM_TEMPLATE_PROJECT - Project number to use as template (e.g., "7")GHPM_TEMPLATE_OWNER - Owner of the template project (defaults to current repo owner)
</arguments>
<usage_examples>
With title argument:
/ghpm:create-project Q1 Roadmap
→ Creates project titled "Q1 Roadmap", links to current repo
Without title (prompts):
/ghpm:create-project
→ Prompts: "What should the project be called?" → Creates and links project
With template pre-configured:
export GHPM_TEMPLATE_PROJECT="7"
/ghpm:create-project Feature Development
→ Copies from template project #7, links to current repo
</usage_examples>
<operating_rules>
GHPM_PROJECT to the new project title for use in subsequent commands</operating_rules>
<input_validation>
Before proceeding, verify:
# 1. Verify gh CLI authentication
gh auth status || { echo "ERROR: Not authenticated. Run 'gh auth login'"; exit 1; }
# 2. Verify project scope
gh auth status 2>&1 | grep -q "project" || echo "WARNING: Token may not have 'project' scope. Run 'gh auth refresh -s project' if project creation fails."
# 3. Verify in git repository
git rev-parse --git-dir > /dev/null 2>&1 || { echo "ERROR: Not in a git repository"; exit 1; }
# 4. Verify GitHub remote exists
gh repo view --json nameWithOwner -q .nameWithOwner || { echo "ERROR: No GitHub remote found"; exit 1; }
</input_validation>
<workflow>Run input validation checks from previous section.
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
OWNER=$(gh repo view --json owner -q .owner.login)
If $ARGUMENTS contains a title: Use it directly.
TITLE="$ARGUMENTS"
If $ARGUMENTS is empty: Use AskUserQuestion to prompt for the title.
{
"question": "What should the new GitHub Project be called?",
"header": "Title",
"multiSelect": false,
"options": [
{"label": "Roadmap", "description": "General product roadmap"},
{"label": "Sprint Board", "description": "Agile sprint tracking"},
{"label": "Feature Development", "description": "Feature work tracking"}
]
}
TITLETITLEIf GHPM_TEMPLATE_PROJECT is set:
TEMPLATE_OWNER="${GHPM_TEMPLATE_OWNER:-$OWNER}"
TEMPLATE_NUMBER="$GHPM_TEMPLATE_PROJECT"
# Verify template exists
gh project view "$TEMPLATE_NUMBER" --owner "$TEMPLATE_OWNER" --format json > /dev/null 2>&1
If not set: Check if owner has any template projects available:
# Query for template projects
TEMPLATES=$(gh api graphql -f query="
{
user(login: \"$OWNER\") {
projectsV2(first: 10) {
nodes {
number
title
template
}
}
}
}" --jq '.data.user.projectsV2.nodes | map(select(.template == true))')
# For organizations, use:
# gh api graphql -f query="{ organization(login: \"$OWNER\") { ... } }"
If templates found: Use AskUserQuestion to let user choose:
{
"question": "Would you like to create from a template project?",
"header": "Template",
"multiSelect": false,
"options": [
{"label": "<Template Name 1>", "description": "Project #<number> - includes pre-configured views"},
{"label": "<Template Name 2>", "description": "Project #<number> - includes pre-configured views"},
{"label": "Blank project", "description": "Start fresh with default Table view only"}
]
}
Option A: Copy from template
PROJECT_DATA=$(gh project copy "$TEMPLATE_NUMBER" \
--source-owner "$TEMPLATE_OWNER" \
--target-owner "$OWNER" \
--title "$TITLE" \
--format json)
PROJECT_NUMBER=$(echo "$PROJECT_DATA" | jq -r '.number')
PROJECT_URL=$(echo "$PROJECT_DATA" | jq -r '.url')
Option B: Create blank project
PROJECT_DATA=$(gh project create \
--owner "$OWNER" \
--title "$TITLE" \
--format json)
PROJECT_NUMBER=$(echo "$PROJECT_DATA" | jq -r '.number')
PROJECT_URL=$(echo "$PROJECT_DATA" | jq -r '.url')
gh project link "$PROJECT_NUMBER" --owner "$OWNER" --repo "$REPO"
Report the command to set the environment variable:
export GHPM_PROJECT="$TITLE"
</workflow>
<error_handling>
If gh CLI not authenticated:
gh auth statusgh auth loginIf missing project scope:
gh auth status (look for "project" in scopes)gh auth refresh -s projectIf template project not found:
gh project view <number> --owner <owner>If project creation fails:
gh api rate_limitIf linking fails:
gh repo view</error_handling>
<success_criteria>
Command completes successfully when:
GHPM_PROJECTVerification:
# View the created project
gh project view <project_number> --owner <owner>
# Verify link to repository
gh api graphql -f query='
{
repository(owner: "<owner>", name: "<repo>") {
projectsV2(first: 5) {
nodes { title number }
}
}
}'
</success_criteria>
<output>After completion, report:
Example Output:
Project Created Successfully
Project: "Q1 Roadmap" (#8)
URL: https://github.com/users/el-feo/projects/8
Repository: el-feo/ai-context
Created From: Template "GHPM Template" (#7)
Linked: Yes
To use this project with GHPM commands, run:
export GHPM_PROJECT="Q1 Roadmap"
Or add to your shell profile for persistence.
Next Steps:
- Configure views in the project UI if needed: <project_url>
- Run `/ghpm:create-prd <description>` to create your first PRD
If created from blank project, add:
Note: This project was created without a template.
Visit the project URL to add custom views (Board, Roadmap, etc.)
</output>
<template_setup>
To enable the "copy from template" feature, create a template project:
Create a project manually with your desired configuration:
Mark it as a template:
gh project mark-template <project_number> --owner <owner>
Optionally set as default template:
export GHPM_TEMPLATE_PROJECT="<project_number>"
export GHPM_TEMPLATE_OWNER="<owner>"
Recommended Template Configuration:
Views:
Fields:
</template_setup>
<related_commands>
GHPM Workflow:
/ghpm:create-project - Create and link a GitHub Project/ghpm:create-prd <description> - Create PRD in the project/ghpm:create-epics prd=#N - Break PRD into Epics/ghpm:create-tasks epic=#N - Break Epics into Tasks/ghpm:tdd-task task=#N - Implement Tasks with TDD</related_commands>
Now proceed: