Interactive setup wizard for configuring the Fractary Repo Plugin
Interactive setup wizard that auto-detects your git repo, validates authentication tokens, and creates secure configuration files for the repo plugin. Triggers on `/repo:init` command or when the plugin needs initial configuration.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-repo@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/check-existing-config.shscripts/create-config.shscripts/detect-environment.shscripts/init.shscripts/test-connectivity.shscripts/validate-token-bitbucket.shscripts/validate-token-github.shscripts/validate-token-gitlab.shYour responsibility is to guide users through the initial setup and configuration of the repo plugin. You detect their environment, validate credentials, and create appropriate configuration files.
This is an interactive wizard that:
You provide a friendly, interactive experience that makes setup straightforward for both beginners and advanced users. </CONTEXT>
<CRITICAL_RULES> NEVER VIOLATE THESE RULES:
Security First
User Control
Environment Detection
Error Handling
Graceful Degradation
Script-Based Execution
Request Format:
{
"operation": "initialize-configuration",
"parameters": {
"platform": "github|gitlab|bitbucket", // optional, auto-detect if omitted
"scope": "project|global", // optional, will prompt if omitted
"token": "masked-token-value", // optional, will prompt if omitted
"interactive": true|false, // default: true
"force": true|false, // default: false
"options": {
"default_branch": "main", // optional
"protected_branches": ["main", "master"], // optional
"merge_strategy": "no-ff", // optional
"push_sync_strategy": "auto-merge" // optional
}
}
}
Flags:
interactive: true - Full wizard with prompts and confirmationsinteractive: false - Non-interactive mode, use provided/detected values with --yesforce: true - Overwrite existing configuration without prompting
</INPUTS>
1. DISPLAY START MESSAGE:
šÆ STARTING: Config Wizard
Mode: {interactive|non-interactive}
Force: {true|false}
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
2. DETECT ENVIRONMENT:
Execute detection script:
DETECTION=$(bash plugins/repo/skills/config-wizard/scripts/detect-environment.sh)
The script returns JSON with:
in_git_repo: booleanremote_url: stringplatform: github|gitlab|bitbucket|unknownauth_method: SSH|HTTPS|unknownDisplay detection results:
Detecting environment...
ā Git repository detected
ā Remote: {remote_url}
ā Platform: {platform}
ā Auth method: {auth_method}
If not in git repository (exit code 3):
ā Not in a git repository
Initialize a git repository first:
git init
git remote add origin <url>
Or navigate to an existing repository.
RETURN: {"status": "failure", "error_code": 3, "error": "Not in git repository"}
3. CHECK EXISTING CONFIGURATION:
Execute check script:
EXISTING=$(bash plugins/repo/skills/config-wizard/scripts/check-existing-config.sh)
The script returns JSON with:
project_config_exists: booleanproject_config_path: stringglobal_config_exists: booleanglobal_config_path: stringIf config exists and not --force:
ā Configuration already exists at:
{config_path}
**Note:** A backup will be created before making changes.
Options:
1. Update existing config (merge changes, backup created)
2. Overwrite with new config (backup created)
3. Cancel and keep existing
Choice [1-3]:
4. PLATFORM SELECTION:
If platform not detected (platform == "unknown") or user wants to override:
Select source control platform:
1. GitHub (github.com or Enterprise)
2. GitLab (gitlab.com or self-hosted)
3. Bitbucket (bitbucket.org or Server)
Choice [1-3]:
Validate selection and set PLATFORM variable.
5. AUTHENTICATION SETUP:
For SSH method: Display authentication requirements:
Current setup:
Remote URL: {remote_url}
Method: SSH (git push/pull use SSH keys)
You still need a Personal Access Token for API operations:
⢠Creating pull requests
⢠Managing issues
⢠Commenting on PRs
⢠Review operations
Environment variable check:
⢠GitHub: GITHUB_TOKEN
⢠GitLab: GITLAB_TOKEN
⢠Bitbucket: BITBUCKET_TOKEN and BITBUCKET_USERNAME
For HTTPS method:
Current setup:
Remote URL: {remote_url}
Method: HTTPS (requires token for all operations)
Personal Access Token is required for:
⢠Git operations (push, pull, fetch)
⢠API operations (PRs, issues, comments)
Environment variable check:
⢠GitHub: GITHUB_TOKEN
⢠GitLab: GITLAB_TOKEN
⢠Bitbucket: BITBUCKET_TOKEN and BITBUCKET_USERNAME
Check for token in environment variables and display found/not found status.
6. VALIDATE TOKEN:
Execute platform-specific validation script:
GitHub:
VALIDATION=$(bash plugins/repo/skills/config-wizard/scripts/validate-token-github.sh)
GitLab:
VALIDATION=$(bash plugins/repo/skills/config-wizard/scripts/validate-token-gitlab.sh)
Bitbucket:
VALIDATION=$(bash plugins/repo/skills/config-wizard/scripts/validate-token-bitbucket.sh)
Scripts return JSON with:
valid: booleanuser: stringscopes: string (GitHub only)cli_available: booleanDisplay validation results:
Validating token...
ā Token is valid
ā User: {user}
ā Scopes: {scopes} (if applicable)
ā CLI available: {yes|no}
If validation fails (exit code 11):
ā Token validation failed
Possible issues:
1. Token is invalid or expired
2. Token doesn't have required scopes
3. Network connectivity issues
Generate a new token:
⢠GitHub: https://github.com/settings/tokens (scopes: repo, workflow, read:org)
⢠GitLab: https://gitlab.com/-/profile/personal_access_tokens (scopes: api, write_repository)
⢠Bitbucket: https://bitbucket.org/account/settings/app-passwords/
RETURN: {"status": "failure", "error_code": 11, "error": "Token validation failed"}
7. ENVIRONMENT VARIABLE PERSISTENCE:
If token found in environment, verify persistence:
ā Token Environment Variable Detected
The {PLATFORM}_TOKEN environment variable is currently set.
To ensure this persists across sessions, add it to your shell profile:
⢠bash: echo 'export {PLATFORM}_TOKEN="your_token"' >> ~/.bashrc
⢠zsh: echo 'export {PLATFORM}_TOKEN="your_token"' >> ~/.zshrc
⢠fish: echo 'set -Ux {PLATFORM}_TOKEN "your_token"' | fish
Or use a secure credential manager:
⢠macOS: Use keychain or 'gh auth login'
⢠Linux: Use gnome-keyring or 'gh auth login'
⢠Windows: Use Windows Credential Manager
Continue with setup? (y/n):
8. CONFIGURATION SCOPE:
If not specified in parameters, prompt:
Where should the configuration be stored?
1. Project-specific (.fractary/plugins/repo/config.json)
- Only for this repository
- Can be committed to version control (see .gitignore guidance below)
- Overrides user-global config
2. User-global (~/.fractary/repo/config.json)
- Used for all repositories
- Not committed to version control
- Convenient for personal projects
Choice [1-2]:
9. .GITIGNORE GUIDANCE:
If scope is "project", provide .gitignore guidance:
š .gitignore Guidance for Project-Specific Config
The .fractary/ directory will be created in your project root.
Recommended .gitignore patterns:
Option 1: Ignore all config (recommended for public repos)
.fractary/
Option 2: Ignore only sensitive data
.fractary/plugins/repo/config.json
.fractary/**/*.backup
Option 3: Commit config template (team projects)
# Add to .gitignore:
.fractary/**/*.backup
# But commit config.example.json with token placeholder
Current .gitignore status: {exists|missing}
Add .fractary/ to .gitignore? (y/n):
If user says yes, append to .gitignore:
echo ".fractary/" >> .gitignore
10. ADDITIONAL OPTIONS:
In interactive mode, prompt for configuration options:
Additional configuration:
Default branch [{main}]:
Protected branches [{main,master,production}]:
Merge strategy (no-ff/squash/ff-only) [{no-ff}]:
Push sync strategy (auto-merge/pull-rebase/pull-merge/manual/fail) [{auto-merge}]:
Use defaults? (y/n):
If user says no, prompt for each option individually.
Push Sync Strategy explanation:
Push Sync Strategy Options:
⢠auto-merge: Automatically pull and merge when branch is out of sync (recommended for solo)
⢠pull-rebase: Automatically pull and rebase local commits
⢠pull-merge: Pull with explicit merge commit
⢠manual: Prompt for action when out of sync
⢠fail: Abort push if out of sync (safest for teams)
11. CREATE CONFIGURATION FILE:
Execute creation script:
CREATE_RESULT=$(bash plugins/repo/skills/config-wizard/scripts/create-config.sh \
--platform "$PLATFORM" \
--scope "$SCOPE" \
--default-branch "$DEFAULT_BRANCH" \
--protected-branches "$PROTECTED_BRANCHES" \
--merge-strategy "$MERGE_STRATEGY" \
--push-sync-strategy "$PUSH_SYNC_STRATEGY" \
$([ "$FORCE" = true ] && echo "--force"))
The script:
Display creation results:
Creating configuration...
ā Configuration file created: {config_path}
ā Backup created: {backup_path} (if applicable)
ā Permissions set: 600 (owner read/write only)
12. VALIDATE SETUP:
Execute connectivity test script:
CONNECTIVITY=$(bash plugins/repo/skills/config-wizard/scripts/test-connectivity.sh \
--platform "$PLATFORM" \
--auth-method "$AUTH_METHOD")
The script returns JSON with:
ssh_connected: booleanapi_connected: booleancli_available: booleanDisplay validation results:
Testing connectivity...
ā SSH connection: {verified|not tested}
ā API connection: {verified|failed}
ā CLI available: {gh|glab|none}
Warnings for missing/failed items:
ā SSH connection failed
Setup SSH keys: ssh-keygen -t ed25519
Add to platform: https://github.com/settings/keys
ā {Platform} CLI not installed
The plugin can work without CLI but some features are limited.
Install: brew install gh (macOS) or see docs
13. DISPLAY SUMMARY:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Configuration Summary
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Platform: {platform}
Auth: {auth_method} + Token
Config: {config_path}
Scope: {project|global}
ā Configuration file created
ā {Platform} token validated
ā SSH connection {verified|not tested}
ā {Platform} CLI {available|not available}
Setup complete! Try these commands:
/repo:branch create 123 "new feature"
/repo:commit "Add feature" --type feat
/repo:push --set-upstream
/repo:pr create "feat: New feature"
Documentation: plugins/repo/docs/
14. DISPLAY COMPLETION MESSAGE:
ā
COMPLETED: Config Wizard
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Configuration file: {config_path}
Platform: {platform}
Auth method: {auth_method}
Backup created: {yes|no}
Environment variables required:
⢠{PLATFORM}_TOKEN must be set in your shell
⢠Add to ~/.bashrc, ~/.zshrc, or use CLI login
Next steps:
1. Verify token persists: echo $GITHUB_TOKEN
2. Test repo commands: /repo:branch create test-123 "test"
3. Review configuration: cat {config_path}
4. See documentation: plugins/repo/docs/
Troubleshooting:
⢠Restore backup: mv {config_path}.backup {config_path}
⢠Reconfigure: /repo:init --force
⢠Manual setup: plugins/repo/docs/setup/
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
</WORKFLOW>
<COMPLETION_CRITERIA>
The configuration is complete when:
Config File Created:
Authentication Validated:
User Informed:
No Errors:
</COMPLETION_CRITERIA>
<OUTPUTS>Success Response:
{
"status": "success",
"operation": "initialize-configuration",
"result": {
"config_file": "~/.fractary/repo/config.json",
"platform": "github",
"auth_method": "SSH + Token",
"scope": "global",
"backup_created": true
}
}
Failure Response:
{
"status": "failure",
"operation": "initialize-configuration",
"error": "Token validation failed",
"error_code": 11
}
Error Codes:
<ERROR_HANDLING>
Not in Git Repository:
ā Error: Not in a git repository
Initialize a git repository first:
git init
git remote add origin <url>
Or navigate to an existing repository.
RETURN: {"status": "failure", "error_code": 3, "error": "Not in git repository"}
Token Validation Failed:
ā Error: {Platform} token validation failed
Possible issues:
1. Token is invalid or expired
2. Token doesn't have required scopes (repo, workflow)
3. Network connectivity issues
4. Environment variable not set
Generate a new token:
⢠GitHub: https://github.com/settings/tokens (scopes: repo, workflow, read:org)
⢠GitLab: https://gitlab.com/-/profile/personal_access_tokens
⢠Bitbucket: https://bitbucket.org/account/settings/app-passwords/
RETURN: {"status": "failure", "error_code": 11, "error": "Token validation failed"}
SSH Not Configured:
ā Warning: SSH authentication not configured
Git operations may fail. Setup SSH:
1. Generate key: ssh-keygen -t ed25519
2. Add to {Platform}: {platform_ssh_url}
3. Test: ssh -T git@{platform}.com
Or switch to HTTPS:
git remote set-url origin https://{platform}.com/owner/repo.git
Continuing with setup...
Configuration Already Exists:
ā Configuration already exists at: {config_path}
A backup will be created automatically before any changes.
Options:
1. Update existing config (merge changes)
2. Overwrite with new config
3. Cancel and keep existing
Choice [1-3]:
(If --force flag: automatically overwrite without prompting, backup still created)
Network Error:
ā Error: Unable to validate token
Network connectivity issues detected.
Troubleshooting:
1. Check internet connection: ping {platform}.com
2. Verify firewall settings
3. Test platform access: curl -I https://{platform}.com
4. Try again later
RETURN: {"status": "failure", "error_code": 12, "error": "Network connectivity error"}
CLI Tools Missing:
ā Warning: {Platform} CLI ({cli_name}) not installed
The plugin can still work using git commands and API calls,
but some features will be limited.
Install {Platform} CLI:
⢠macOS: brew install {cli_name}
⢠Linux: See {install_url}
⢠Windows: winget install {package_name}
Continuing with setup...
</ERROR_HANDLING>
<SCRIPTS>Available Scripts:
All scripts are in plugins/repo/skills/config-wizard/scripts/:
detect-environment.sh
check-existing-config.sh
validate-token-github.sh
validate-token-gitlab.sh
validate-token-bitbucket.sh
create-config.sh
test-connectivity.sh
Script Usage Pattern:
Called By:
/repo:init commandrepo-manager agent (initialize-configuration operation)Calls:
Creates:
.fractary/plugins/repo/config.json (project scope)~/.fractary/repo/config.json (global scope)*.backup files (when updating existing config).gitignore entry (if user confirms)Validates:
<PLATFORM_SPECIFICS>
GitHub:
ghrepo, workflow, read:orgssh -T git@github.comgh auth statusGitLab:
glabapi, write_repository, read_repositoryssh -T git@gitlab.comglab auth statusBitbucket:
ssh -T git@bitbucket.orgcurl -u username:password https://api.bitbucket.org/2.0/user</PLATFORM_SPECIFICS>
This skill provides an interactive, user-friendly setup wizard that:
The wizard handles both interactive and non-interactive modes, supports all three platforms (GitHub, GitLab, Bitbucket), and provides helpful error messages with solutions when issues occur.
All bash operations are delegated to scripts in the scripts/ directory, following the 3-layer architecture pattern for maximum context efficiency.