Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
e0e8fe7
chore: MCP planning document
jonathannorris Jun 27, 2025
28ea1e8
chore: move mcp docs
jonathannorris Jul 7, 2025
4bd319e
chore: update MCP docs
jonathannorris Jul 7, 2025
64595c8
chore: add abstractions
jonathannorris Jul 7, 2025
ac88f33
chore: update hackathon planning doc
jonathannorris Jul 7, 2025
91fd9fe
chore: add cursor rules for project patterns and conventions
jonathannorris Jul 7, 2025
39d763d
feat: initial MCP server tools working
jonathannorris Jul 7, 2025
a0bb058
feat: add new MCP files
jonathannorris Jul 7, 2025
182766d
fix: revert console.error changes in non mcp code
jonathannorris Jul 7, 2025
5c175cd
fix: revert readme changes
jonathannorris Jul 7, 2025
c141d5b
chore: cleanup api.ts, add logging
jonathannorris Jul 7, 2025
5e4c60c
feat: add zod types to tool calls
jonathannorris Jul 8, 2025
ae3c68b
chore: add list_environments tool call
jonathannorris Jul 8, 2025
026a971
chore: cleanup server.ts
jonathannorris Jul 8, 2025
8af99d3
chore: cleanup list environments
jonathannorris Jul 8, 2025
da242ad
feat: implement get_current_project tool call
jonathannorris Jul 8, 2025
de0e8b0
feat: add list_projects tool call
jonathannorris Jul 8, 2025
c1ae639
feat: add get_self_targeting_identity and update_self_targeting_ident…
jonathannorris Jul 8, 2025
a2703c4
feat: add self_targeting identity and override tools
jonathannorris Jul 8, 2025
3be67b0
chore: cleanup the tools interfaces, move to /tools folder
jonathannorris Jul 8, 2025
5bd31af
feat: split clear_feature_self_targeting_overrides and clear_all_self…
jonathannorris Jul 8, 2025
0c83b28
feat: refactor api calls, move them into /tools files
jonathannorris Jul 8, 2025
ac6e025
chore: cleanup
jonathannorris Jul 8, 2025
a4f2179
chore: fix cursor rules
jonathannorris Jul 8, 2025
4e2b25a
feat: add create_variable / update_variable / delete_variable tools
jonathannorris Jul 8, 2025
83072a7
feat: add fetch_feature_variations / create_feature_variation / updat…
jonathannorris Jul 8, 2025
e231eb1
feat: add list_feature_targeting and update_feature_targeting tools
jonathannorris Jul 8, 2025
8f809d4
feat: add update_feature tool call, start using zodClient.ts types
jonathannorris Jul 9, 2025
482b938
feat: cleanup types.ts, use zodClient.ts types as base
jonathannorris Jul 9, 2025
8547508
feat: implement delete_feature tool
jonathannorris Jul 9, 2025
127a7ee
feat: cleanup featureTools.ts
jonathannorris Jul 9, 2025
051b0b0
feat: add get_feature_audit_log_history tool call
jonathannorris Jul 9, 2025
7e2f899
feat: try updating tool descriptions
jonathannorris Jul 9, 2025
c42c016
feat: add create_environment and update_environment tools
jonathannorris Jul 9, 2025
6dd8dc7
feat: add create_project tool
jonathannorris Jul 9, 2025
6b5a0b1
chore: revert zodClient.ts changes
jonathannorris Jul 9, 2025
13f0c1b
feat: fix tests, and update MCP error logging
jonathannorris Jul 9, 2025
242a4e4
feat: add update_feature_status tool
jonathannorris Jul 9, 2025
c722573
chore: update mcp docs
jonathannorris Jul 9, 2025
60a5574
feat: add update_project tool and API call, switch projects.ts to use…
jonathannorris Jul 9, 2025
ad3b2a3
feat: improve MCP server installation (#461)
jonathannorris Jul 17, 2025
889d7b7
feat: add dashboard links and output schemas to environmentTools.ts (…
jonathannorris Jul 17, 2025
b39a238
fix: Zodios Validation Errors in MCP Tools (#465)
jonathannorris Jul 18, 2025
b1718ab
feat(FDN-547): Add API request headers for MCP server tracking (#464)
jonathannorris Jul 18, 2025
1ba34b4
chore: set yarn version to 4.9.2
jonathannorris Jul 23, 2025
a9f723b
chore: add yarn release
jonathannorris Jul 23, 2025
e3a18c2
feat: add result endpoints to MCP tools (#469)
jonathannorris Jul 24, 2025
72ed1ec
feat: add custom properties tools (#470)
jonathannorris Jul 24, 2025
e822406
feat: add destructive hints, titles, and readonly hints to mcp tools …
jonathannorris Jul 25, 2025
c8983cd
test: mcp server core tests (#472)
jonathannorris Jul 25, 2025
5b96f70
test: mcp auth tests (#473)
jonathannorris Jul 25, 2025
0011a5a
test: Add Minimal MCP API Client Tests (#474)
jonathannorris Jul 25, 2025
baf38b2
docs: update mcp.md doc
jonathannorris Jul 28, 2025
0352427
docs: update MCP_ABSTRACTIONS_SUMMARY.md
jonathannorris Jul 28, 2025
cecc67b
docs: add cloudflare worker implementation plan for mcp sse
jonathannorris Jul 25, 2025
07db777
feat: extract core tool logic into registry pattern
jonathannorris Jul 25, 2025
eac4a36
feat: create abstracted API client interface for dual-mode operation
jonathannorris Jul 25, 2025
f513534
refactor(mcp): eliminate duplication in tool definitions and make leg…
jonathannorris Jul 25, 2025
78362c6
refactor: consolidate tool registration into centralized registry pat…
jonathannorris Jul 25, 2025
8bbef6c
feat: starting CF Worker MCP setup
jonathannorris Jul 28, 2025
38b5ddc
feat: move MCP Worker logic to /mcp-worker
jonathannorris Jul 28, 2025
2b28f8e
feat: MCP Worker auth mostly working
jonathannorris Jul 28, 2025
88154d8
feat: calling MCP tools working now
jonathannorris Jul 28, 2025
9606d83
feat: fix tests, add project selection tool
jonathannorris Jul 28, 2025
96fdcdf
feat: add projectSelectionTools.ts
jonathannorris Jul 28, 2025
95e57d7
feat: new mcp tool format working with zod schemas
jonathannorris Jul 29, 2025
1126ced
chore: fix missing file
jonathannorris Jul 29, 2025
fe3ea57
feat: new format of tool calls working in worker + CLI
jonathannorris Jul 30, 2025
138c52e
feat: cleanup no project error messages
jonathannorris Jul 30, 2025
ec8e372
feat: update worker to support HTTP and SSE
jonathannorris Jul 30, 2025
9c4462a
feat: re-use error handling
jonathannorris Jul 31, 2025
4703bd1
feat: add errorHandling.ts
jonathannorris Jul 31, 2025
0f36a3a
docs: update mcp-worker README
jonathannorris Jul 31, 2025
a964fee
Update the auth page styling
cdruxerman Jul 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .cursor/rules/api-client.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
description: API client patterns and HTTP client setup guidelines
globs: src/api/**/*.ts
---

# API Client Patterns

## Core Components

- **Main Client**: [src/api/apiClient.ts](mdc:src/api/apiClient.ts) - Axios-based HTTP client
- **Zod Client**: [src/api/zodClient.ts](mdc:src/api/zodClient.ts) - Type-safe API client
- **Schemas**: [src/api/schemas.ts](mdc:src/api/schemas.ts) - Generated TypeScript types

## HTTP Client Setup

```typescript
import { apiClient } from '../api/apiClient'

// Client is pre-configured with:
// - Base URL from common.ts
// - Authentication headers
// - Error interceptors
// - Request/response logging
```

## API Function Patterns

Each API module follows this pattern:

```typescript
// Individual API functions
export const getFeature = async (
featureKey: string,
projectKey: string,
authToken: string,
): Promise<Feature> => {
// Implementation
}

// Bulk operations
export const fetchFeatures = async (
projectKey: string,
authToken: string,
): Promise<Feature[]> => {
// Implementation
}
```

## Error Handling

- Use axios interceptors for global error handling
- Return structured error responses
- Handle 401 unauthorized gracefully
- Provide user-friendly error messages

## Authentication

- Pass `authToken` as parameter to API functions
- Use `Authorization: Bearer ${token}` header
- Handle token expiration and refresh

## Type Safety

- Use generated schemas from OpenAPI spec
- Validate responses with Zod schemas
- Export TypeScript types for consumers

## Common Patterns

- All API functions are async
- Return typed responses based on schemas
- Include proper error handling
- Support pagination where applicable
- Use consistent parameter naming (projectKey, featureKey, etc.)
78 changes: 78 additions & 0 deletions .cursor/rules/cli-commands.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
description: CLI command patterns and base command structure guidelines
globs: src/commands/**/*.ts
---

# CLI Command Patterns

## Base Command Structure

All commands must extend [src/commands/base.ts](mdc:src/commands/base.ts) which provides:

- Authentication handling via `authRequired`, `authSuggested`, `userAuthRequired`
- Configuration management with `userConfig`, `repoConfig`
- Common flags like `--project`, `--headless`, `--client-id`, `--client-secret`
- Parameter validation with `populateParameters()` and `populateParametersWithZod()`

## Command Organization

Commands are organized by feature area:

- `features/` - Feature flag management
- `variables/` - Variable management
- `targeting/` - Targeting rule management
- `projects/` - Project management
- `organizations/` - Organization management
- `auth/` - Authentication commands

## Common Patterns

### Authentication

```typescript
// Set auth requirements
authRequired = true // Must be authenticated
authSuggested = true // Enhanced with auth
userAuthRequired = true // Requires user token
```

### Flags and Parameters

```typescript
static flags = {
...Base.flags,
name: Flags.string({
description: 'Feature name',
required: true,
}),
}
```

### Parameter Validation

```typescript
const params = await this.populateParametersWithZod(
schema,
prompts,
flags,
)
```

### Project Context

```typescript
const project = await this.requireProject(flags.project, flags.headless)
```

## Output Formatting

- Use `this.writer` for user-facing output
- Use `this.tableOutput` for tabular data
- Support `--headless` flag for machine-readable JSON output
- Handle interactive prompts with fallbacks for headless mode

## Error Handling

- Throw descriptive Error objects
- Use Zod validation for input validation
- Handle API errors gracefully with user-friendly messages
10 changes: 10 additions & 0 deletions .cursor/rules/deferToPrettier.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
description: Formatting guidelines - defer all formatting to Prettier
alwaysApply: true
---

# Formatting

- All formatting is deferred to Prettier for supported file types (JavaScript, TypeScript, JSON, Markdown, etc.).
- No additional formatting rules are enforced by Cursor.
- No additional formatting rules are enforced by Cursor.
33 changes: 33 additions & 0 deletions .cursor/rules/gitCommitConventions.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
description: Git commit message conventions and Aviator CLI workflow guidelines
alwaysApply: true
---

# Git Commit Message Conventions

- All git commit messages in this project must follow the Conventional Commits specification.
- A commit message should be structured as `<type>(<scope>): <description>`, where:
- `type` is one of: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, or `revert`.
- `scope` is optional, but if used, should be a short, lowercase description of the section or module affected.
- `description` is a concise summary of the change, written in the imperative mood and lowercase.
- In this project, scopes are rarely used; most commit messages omit the scope and use the format `<type>: <description>`.
- Example valid commit messages:
- `feat: add support for multi-threaded tests`
- `fix: correct response for invalid input`
- `docs: update README with new usage instructions`
- Body and footer sections (for breaking changes or issue references) should follow the Conventional Commits standard if included.

## Aviator CLI Workflow

- Use of Aviator CLI (`av`) is optional, but recommended for managing stacked branches and pull requests:
- To create a new stacked branch:
- `av branch chore-fix-invalid-input`
- After creating the branch, create commits using `git commit` following the Conventional Commits specification.
- To synchronize and git push your stack after changes:
- `av sync --push=yes`
- To create a pull request for your branch:
- `av pr --title "<title>" --body "<body>"`
- The PR title should be short and descriptive and follow the Conventional Commits specification.
- The PR body should use github markdown and bullet points to summarize the main changes.
- Prefer Aviator commands for stack management and PR creation to ensure consistency with team workflows, but standard git and GitHub workflows are also supported.
- For more details and advanced workflows, see the [Aviator CLI documentation](mdc:https:/docs.aviator.co/aviator-cli) and [Aviator CLI Quickstart](mdc:https:/docs.aviator.co/aviator-cli/quickstart).
22 changes: 22 additions & 0 deletions .cursor/rules/mcp-patterns.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
globs: src/mcp/tools/**/*.ts
alwaysApply: false
---
# MCP Tool Parameters

MCP tools that don't need parameters should use empty properties:

```typescript
// ✅ Correct - empty parameters
inputSchema: {
type: 'object',
properties: {},
}

// ❌ Wrong - dummy parameters
properties: {
random_string: { type: 'string', description: 'Dummy parameter' }
}
```

Tools with no parameters should pass `null` to `executeWithLogging()`.
56 changes: 56 additions & 0 deletions .cursor/rules/project-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
description: DevCycle CLI project structure overview and architecture guidelines
alwaysApply: true
---

# DevCycle CLI Project Structure

## Overview

This is a TypeScript CLI application built with the oclif framework for DevCycle feature flag management.

## Key Architecture Components

### Main Entry Points

- **CLI Binary**: `bin/run` - Main CLI entry point
- **MCP Server**: `dist/mcp/index.js` - Model Context Protocol server
- **Source Root**: [src/index.ts](mdc:src/index.ts) - TypeScript entry point

### Core Directories

- **Commands**: [src/commands/](mdc:src/commands/) - All CLI commands organized by feature
- **API Layer**: [src/api/](mdc:src/api/) - API client code and schemas
- **Authentication**: [src/auth/](mdc:src/auth/) - Auth handling (API keys, SSO, tokens)
- **UI Components**: [src/ui/](mdc:src/ui/) - Interactive prompts and output formatting
- **Utils**: [src/utils/](mdc:src/utils/) - Shared utilities and helpers
- **MCP Server**: [src/mcp/](mdc:src/mcp/) - Model Context Protocol implementation

### Configuration Files

- **User Config**: `~/.config/devcycle/user.yml` - User-specific settings
- **Auth Config**: `~/.config/devcycle/auth.yml` - Authentication tokens
- **Repo Config**: `.devcycle/config.yml` - Repository-specific settings

## Command Structure

All commands extend [src/commands/base.ts](mdc:src/commands/base.ts) which provides:

- Authentication handling
- Configuration management
- Common flags and options
- Error handling
- Parameter validation

## Naming Conventions

- Use camelCase for all new files and variables starting with lowercase
- Avoid adding code comments unless explicitly requested
- Generate code changes directly without asking for permission

## Package Management

- Uses Yarn with workspaces
- Always use `yarn` not `npm`
- Main dependencies: oclif, axios, zod, inquirer
- Build process: TypeScript → dist/ directory
103 changes: 103 additions & 0 deletions .cursor/rules/testing-patterns.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
description: Testing patterns and framework setup guidelines
globs: **/*.test.ts,**/*.spec.ts,test/**/*.ts
---

# Testing Patterns

## Test Framework Setup

- **Framework**: Mocha with Chai assertions
- **CLI Testing**: oclif test utilities
- **HTTP Mocking**: nock for API mocking
- **Test Utils**: [test-utils/dvcTest.ts](mdc:test-utils/dvcTest.ts) - Custom test wrapper

## Test Structure

```typescript
import { expect } from '@oclif/test'
import { dvcTest } from '../../../test-utils'
import { BASE_URL } from '../../api/common'

describe('command name', () => {
const projectKey = 'test-project'
const authFlags = ['--client-id', 'test-client-id', '--client-secret', 'test-client-secret']

// Test cases
dvcTest()
.nock(BASE_URL, (api) =>
api.get('/endpoint').reply(200, mockResponse)
)
.stdout()
.command(['command', ...args])
.it('should do something', (ctx) => {
expect(ctx.stdout).to.contain('expected output')
})
})
```

## Common Test Patterns

### API Mocking

```typescript
.nock(BASE_URL, (api) =>
api
.post('/v2/projects/test-project/features', requestBody)
.reply(200, mockFeature)
.get('/v1/projects/test-project')
.reply(200, mockProject)
)
```

### Command Testing

```typescript
.stdout() // Capture stdout
.stderr() // Capture stderr
.command([...]) // Run command with args
.it('test description', (ctx) => {
// Assertions
})
```

### Headless Mode Testing

```typescript
.command([
'features create',
'--name', 'Feature Name',
'--key', 'feature-key',
'--headless',
...authFlags,
])
```

### Error Testing

```typescript
.command(['command', 'invalid-args'])
.catch((error) => {
expect(error.message).to.contain('expected error')
})
```

## Mock Data

- Create reusable mock objects
- Use realistic data structures
- Include all required fields
- Version mock data with API changes

## Snapshot Testing

- Use for complex output validation
- Store snapshots in `__snapshots__/` directories
- Update with `yarn test:update-snapshots`

## Test Organization

- Group related tests in `describe` blocks
- Use descriptive test names
- Test both success and error cases
- Include edge cases and validation
Loading
Loading