juspay / juspay/shelly

[FEATURE] BitBucket and Jenkins Support

Open
#70 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Feature Area

Which Shelly feature area would this enhancement target? (check one)

- [ ] 🔍 Error Analysis (command analysis, shell integration, AI suggestions)
- [x] 🏗️ Repository Organization (project scaffolding, GitHub integration, file organization)
- [ ] 🧠 Memory Bank (AI context management, documentation generation)
- [x] 🔧 CLI Interface (command parsing, user experience, new commands)
- [ ] 🤖 AI Integration (new AI providers, improved analysis)
- [ ] 📱 Platform Support (new shells, operating systems)
- [x] 🔌 Extensibility (plugins, integrations, APIs)

## Problem Statement

**Is your feature request related to a problem? Please describe.**
Currently, Shelly only supports GitHub for repository configuration and CI/CD automation. At Juspay, we use **BitBucket** as our primary VCS and **Jenkins** for CI/CD pipelines. Additionally, certain package.json dependencies (like Tara OR yama and other internal tools) need to be added manually when setting up new repositories, which is error-prone and time-consuming.

**Current Workflow:**
1. Manually configure BitBucket repository settings (branch protection, PR rules)
2. Manually create Jenkinsfile and pipeline configurations
3. Manually add Juspay-specific packages to package.json (Tarayama, internal linters, etc.)
4. No automated scaffolding exists for BitBucket + Jenkins workflows

## Proposed Solution

**Describe the solution you'd like**
Extend Shelly's repository management to support:
1. **BitBucket Service** - Similar to existing `GitHubService`, add `BitBucketService` for BitBucket API integration
2. **Jenkins Scaffolding** - Generate Jenkinsfile templates and pipeline configurations
3. **Package Auto-Detection** - Automatically detect repository context and add relevant packages (Tarayama, linters, formatters)
4. **Juspay Preset** - Pre-configured settings for Juspay repositories

**Ideal User Experience:**

```bash
# Setup BitBucket repo with best practices (similar to shelly github)
shelly bitbucket

# Scaffold Jenkins pipeline
shelly organize --ci jenkins

# Auto-add Juspay packages to existing project
shelly packages --preset juspay

# Full Juspay repo setup
shelly organize --preset juspay --ci jenkins --vcs bitbucket
```

## Feature Details

### For Repository Organization Features

- **Project types**: Node.js/TypeScript (primary), React, Python, Rust
- **BitBucket integration**:
- Repository settings configuration via BitBucket API
- Branch permissions and PR rules
- Pipeline configurations (bitbucket-pipelines.yml)
- **Jenkins integration**:
- Jenkinsfile templates (declarative pipeline)
- Multi-branch pipeline support
- Stage templates (build, test, deploy)
- **File operations**:
- Generate Jenkinsfile
- Generate bitbucket-pipelines.yml
- Auto-update package.json with required dependencies

### Package Automation

Packages to auto-add based on context:
- **Tarayama** - Code quality tooling
- **Juspay linters** - Internal ESLint configs
- **Smoke testing** - Test utilities
- **Rust tooling** - For Rust projects

## Use Cases

**Target Users:**

- [x] Individual developers
- [x] Development teams
- [ ] Open source maintainers
- [x] Enterprise development
- [ ] Educational use
- [x] AI-assisted development

**Specific Scenarios:**

1. **Scenario 1**: Developer creates new Juspay service → runs `shelly organize --preset juspay` → gets BitBucket-ready repo with Jenkins pipeline and all required packages
2. **Scenario 2**: Team migrates existing project → runs `shelly bitbucket` → configures branch protection, PR rules, and pipeline
3. **Scenario 3**: Adding new dependencies → runs `shelly packages --detect` → auto-detects missing Juspay packages and adds them

## Alternatives Considered

**Describe alternatives you've considered**
- Manual setup scripts per project (current approach) - not scalable
- Cookiecutter templates - lacks live API integration
- Yeoman generators - not AI-powered, separate tooling

**Existing Tools:**
BitBucket has limited CLI tooling. Shelly's approach provides:
- Unified CLI for both GitHub and BitBucket
- AI-powered content generation
- Memory Bank integration for context

## Implementation Suggestions

**Technical Approach:**

```
src/shelly/
services/
bitbucketService.ts # New - BitBucket API (similar to githubService.ts)
jenkinsService.ts # New - Jenkinsfile generation
packageDetector.ts # New - Auto-detect needed packages
commands/
bitbucketSetup.ts # New - BitBucket configuration command
templates/
Jenkinsfile.template # New - Jenkins pipeline templates
bitbucket-pipelines.yml.template # New
presets/
juspay/ # New - Juspay-specific templates
```

**Integration Points:**
- Extend CLI to accept `bitbucket` command (similar to `github`)
- Add `--ci` flag to `organize` command
- Add `--preset` flag for company-specific configurations

**Configuration:**

```json
// config/default.json additions
{
"vcs": {
"provider": "bitbucket",
"workspace": "juspay"
},
"ci": {
"provider": "jenkins",
"pipelineType": "declarative"
},
"presets": {
"juspay": {
"packages": ["@juspay/tarayama", "@juspay/eslint-config"],
"ci": "jenkins",
"vcs": "bitbucket"
}
}
}
```

## Compatibility & Requirements

**System Requirements:**
- Operating systems: macOS, Linux, Windows
- Shell requirements: bash, zsh (existing support)
- Node.js version: 18+ (existing requirement)
- Dependencies:
- `bitbucket` - BitBucket API client
- Existing `@octokit/rest` pattern as reference

**Backward Compatibility:**

- [ ] This is a breaking change
- [x] This maintains backward compatibility
- [x] This adds new optional functionality

## Priority & Impact

**Priority Level:**

- [ ] Low (nice to have, no urgency)
- [ ] Medium (would improve user experience)
- [x] High (addresses significant pain point)
- [ ] Critical (blocks important workflow)

**Expected Impact:**
- **User Experience**: Eliminates 30+ minutes of manual setup per new repository
- **Adoption**: Opens Shelly to BitBucket-using organizations (like Juspay)
- **Ecosystem**: Aligns with multi-cloud/multi-VCS enterprise reality

## Success Criteria

**Acceptance Criteria:**

- [ ] `shelly bitbucket` configures BitBucket repo settings via API
- [ ] `shelly organize --ci jenkins` generates valid Jenkinsfile
- [ ] Package auto-detection adds correct dependencies
- [ ] Existing GitHub functionality unaffected
- [ ] Configuration presets can be defined per organization

**Testing Requirements:**

- [ ] Unit tests for BitBucketService
- [ ] Integration tests with existing organize command
- [ ] Cross-platform testing (macOS, Linux)
- [ ] Mock API tests for BitBucket endpoints

**Documentation Requirements:**

- [ ] README.md updates with BitBucket commands
- [ ] API documentation for new services
- [ ] Quick start guide for Juspay preset
- [ ] Memory Bank updates

## Additional Context

### Current Shelly Capabilities (for reference)

| Feature | Current Support | Proposed Addition |
|---------|----------------|-------------------|
| VCS Integration | GitHub only | + BitBucket |
| CI/CD | GitHub Actions | + Jenkins |
| Package Management | Template-based | + Auto-detection |
| Organization Presets | None | + Juspay preset |

### Whiteboard Notes

From brainstorming session:
- BitBucket → Details → Linting
- Tarayama (CI/CD tools)
- Jenkins → Smoke testing → Rust
- Scaffolding support needed

---

*Feature request created: March 3, 2026*

**Related Issues:**
Link to any related issues or discussions.

**Community Interest:**
Has this been requested by multiple users or discussed in the community?

**Timeline:**
Is there a specific timeline or deadline for this feature?

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing GitHub integration, especially the proposed src/shelly/services/githubService.ts pattern, and inspect the organize command entry point. Review the suggested services, commands, templates, and preset paths before narrowing the scope. Done would require an agreed subset of the Bitbucket, Jenkins, package, preset, test, and documentation acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, python, rust, typescript
Domain
ci-cd, cli, devops, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.