Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Report a problem with bcli
title: "[bug] "
labels: bug
---

## Description

What's the unexpected behavior?

## Reproduction

Minimal steps to reproduce:

1.
2.
3.

## Expected vs. Actual

**Expected:**

**Actual:**

## Environment

- bcli version: `bcli --version`
- Python version: `python --version`
- OS:
- BC environment: (Production / Sandbox / ...)

## Logs / Stack trace

```
paste relevant output here
```

## Additional context
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest a new capability for bcli
title: "[feat] "
labels: enhancement
---

## Problem

What are you trying to do, and why is it hard today?

## Proposed solution

What would make this easier? CLI command, SDK method, config option, etc.

## Alternatives considered

Any workarounds you've tried.

## Additional context
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Summary

What does this PR do, in one or two sentences?

## Changes

-
-

## Test plan

- [ ] `uv run pytest tests/ -v` passes
- [ ] `uv run ruff check src/ tests/` is clean
- [ ] Added / updated tests for new behavior
- [ ] Manual testing notes:

## Breaking changes

Any? If so, what's the migration path?

## Related issues

Closes #
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv pip install -e ".[dev,etl]"

- name: Lint with ruff
run: uv run ruff check src/ tests/

- name: Run tests
run: uv run pytest tests/ -v
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
uv pip install -e ".[dev]"

# Install globally (puts `bcli` on PATH)
uv tool install -e /Users/igor/Projects/bc-cli --force
uv tool install -e . --force

# Run tests
uv run pytest tests/ -v
Expand Down
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement by opening an
issue on the repository or contacting the maintainer directly.

All complaints will be reviewed and investigated promptly and fairly. All
community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
87 changes: 87 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Contributing

## Development Setup

```bash
git clone https://github.com/igor-ctrl/bcli.git
cd bcli
uv venv
uv pip install -e ".[dev]"
```

## Run Tests

```bash
uv run pytest tests/ -v
```

## Lint

```bash
uv run ruff check src/
```

## Project Structure

```
src/
├── bcli/ # Python SDK (importable library)
│ ├── auth/ # MSAL auth (client credentials, device code, token cache)
│ ├── client/ # HTTP client (async-first, sync wrapper, transport)
│ ├── config/ # TOML config (model, loader, defaults)
│ ├── odata/ # OData query builder, pagination, response wrapper
│ └── registry/ # Endpoint registry, importers, standard_v2.json
├── bcli_cli/ # CLI layer (Typer)
│ ├── commands/ # One file per command group
│ └── output/ # Formatters (table, json, csv, ndjson)
└── tests/
```

## Architecture Principles

**SDK/CLI split** — The SDK (`bcli`) is a standalone library with no CLI dependency. The CLI (`bcli_cli`) is a thin Typer layer that calls the SDK. This lets MCP servers, DAGs, and scripts import `bcli` directly.

**Async-first** — `AsyncBCClient` is the primary implementation. `BCClient` wraps it for sync contexts. New SDK features should be implemented in `_async.py` first.

**Registry-routed** — The `EndpointRegistry` maps entity names to API routes. Standard v2.0 entities ship in `standard_v2.json`. Custom endpoints are imported per-profile.

**Lazy auth** — Secrets are only resolved when a new token is needed. If a cached token exists, no secret is required.

**Config layering** — Global TOML → project TOML → env vars → CLI flags. The `CLIState` singleton in `_state.py` manages this.

## Adding a New Command

1. Create `src/bcli_cli/commands/mycommand_cmd.py`
2. Define a Typer `app` and commands
3. Register in `src/bcli_cli/app.py`

## Adding a New SDK Feature

1. Add the async method to `src/bcli/client/_async.py`
2. Add the sync wrapper to `src/bcli/client/_sync.py`
3. Export from `src/bcli/__init__.py` if it's part of the public API
4. Write tests in `tests/`

## Test Organization

```
tests/
├── test_config/ # Config model and loader
├── test_odata/ # Query builder
├── test_registry/ # Registry lookup and importers
├── test_url/ # URL builder
└── test_cli/ # CLI integration tests
```

## Commit Messages

Follow conventional commits:

```
feat: add new feature
fix: fix a bug
refactor: change structure without new behavior
docs: documentation only
test: add or update tests
chore: build, CI, tooling
```
Loading
Loading