Thank you for your interest in contributing to IT Glue CLI! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
- Node.js >= 20.0.0
- npm or yarn
- Git
- IT Glue API key for testing
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/itglue-cli.git cd itglue-cli - Install dependencies:
npm install
- Create a
.envfile with your IT Glue credentials:ITGLUE_API_KEY=ITG.your-api-key-here ITGLUE_REGION=us
- Build the project:
npm run build
- Link the CLI for local testing:
npm link
- Feature branches:
feature/description - Bug fixes:
fix/description - Documentation:
docs/description - Refactoring:
refactor/description
-
Create a new branch:
git checkout -b feature/my-new-feature
-
Make your changes following our coding standards
-
Build and test:
npm run build npm run typecheck npm run lint npm test -
Commit your changes:
git add . git commit -m "feat: add new feature"
Follow Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesrefactor:Code refactoringtest:Test changeschore:Build process or tooling changes
-
Push to your fork:
git push origin feature/my-new-feature
-
Create a Pull Request on GitHub
- Use TypeScript for all source code
- Maintain strict type checking
- Avoid
anytypes when possible - Use meaningful variable and function names
- Follow the existing code style
- Use ESLint for linting:
npm run lint - Format code consistently
- Add comments for complex logic
- Write tests for new features
- Ensure existing tests pass
- Aim for good test coverage
- Test both success and error cases
- Code builds without errors
- All tests pass
- Linting passes
- Type checking passes
- Documentation updated (if needed)
- CHANGELOG.md updated
Include in your PR description:
- Summary of changes
- Motivation and context
- Related issue numbers
- Testing performed
- Breaking changes (if any)
- Maintainers will review your PR
- Address any requested changes
- Once approved, a maintainer will merge
When adding a new command:
- Create a new file in
src/commands/ - Follow the existing command structure
- Support both JSON and table output formats
- Add error handling
- Update README.md with usage examples
- Add tests for the new command
import { Command } from 'commander';
import { createClient } from '../utils/client.js';
import { output, outputError, OutputFormat } from '../utils/output.js';
export const myCommand = new Command('my-resource')
.description('Manage my resources');
myCommand
.command('search')
.description('Search for resources')
.option('--format <format>', 'Output format (json|table)', 'json')
.action(async (options) => {
try {
const client = createClient();
const result = await client.request('/my-resources', {});
if (options.format === 'table') {
output(result.data, 'table', {
head: ['ID', 'Name'],
mapper: (item: any) => [item.id, item.name],
});
} else {
output(result, options.format as OutputFormat);
}
} catch (error) {
outputError(error instanceof Error ? error.message : String(error));
process.exit(1);
}
});- Update README.md for user-facing changes
- Update CHANGELOG.md following Keep a Changelog
- Add JSDoc comments for public APIs
- Include usage examples
Test your changes with real IT Glue API:
npm run build
npm link
itglue <your-command> --format tableWrite unit tests using Vitest:
npm test
npm run test:watchIf you have questions:
- Open a GitHub issue
- Check existing issues and PRs
- Review the documentation
By contributing, you agree that your contributions will be licensed under the MIT License.
Contributors will be recognized in our README and release notes. Thank you for helping improve IT Glue CLI!