Skip to content

Commit 7ee4821

Browse files
feat: add release wf and doc (#3)
1 parent 372f463 commit 7ee4821

8 files changed

Lines changed: 318 additions & 73 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Validate tag matches version
18+
run: |
19+
TAG="${GITHUB_REF#refs/tags/v}"
20+
PKG_VERSION=$(python3 -c "
21+
import tomllib, pathlib
22+
d = tomllib.loads(pathlib.Path('pyproject.toml').read_text())
23+
print(d['project']['version'])
24+
")
25+
if [ "$TAG" != "$PKG_VERSION" ]; then
26+
echo "::error::Tag v$TAG does not match pyproject.toml version $PKG_VERSION"
27+
exit 1
28+
fi
29+
30+
- name: Create GitHub Release
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
generate_release_notes: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ __pycache__/
44
dist/
55
build/
66
*.pyc
7+
.claude/settings.local.json
8+
.DS_Store

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# AGENTS.md — team-cli
2+
3+
## Project
4+
5+
CLI for AWS TEAM (Temporary Elevated Access Management). Python 3.11+, distributed via Homebrew.
6+
7+
## Open-source readiness
8+
9+
This repo will be open-sourced. All contributions must follow these rules:
10+
11+
### Never include in code, comments, commits, or docs
12+
13+
- AWS account IDs, ARNs, or resource identifiers
14+
- Cognito domain URLs, client IDs, user pool IDs
15+
- AppSync endpoint URLs
16+
- Internal domain names (*.docplanner.*, *.awsapps.com, etc.)
17+
- Employee names, emails, or usernames
18+
- Internal ticket IDs, Slack channels, or Jira project keys
19+
- IP addresses, VPN endpoints, or internal URLs
20+
- SSO start URLs or session names
21+
- Any value from `config.example.toml` that contains real deployment data
22+
23+
### Safe to include
24+
25+
- Generic examples using placeholder values (`example.com`, `123456789012`, `my-org`)
26+
- Architecture descriptions that don't reference specific infrastructure
27+
28+
## Contributing
29+
30+
### Structure
31+
32+
```
33+
team_cli/
34+
cli.py — argparse entry point, command handlers
35+
api.py — GraphQL AppSync client
36+
auth.py — OAuth2 + PKCE authentication
37+
config.py — config and token management
38+
audit.py — audit query and CloudTrail correlation
39+
interactive.py — InquirerPy prompts (fuzzy search)
40+
queries.py — GraphQL query definitions
41+
sync.py — AWS config profile sync
42+
Formula/
43+
team-cli.rb — Homebrew formula
44+
completions/
45+
team.bash — bash completions
46+
```
47+
48+
### Commands
49+
50+
All commands follow the pattern `cmd_<name>(args)` in `cli.py`, dispatched via a `COMMANDS` dict.
51+
52+
Interactive prompts use `inquirer.fuzzy` for searchable selection. All pickers fall back to numbered menus when InquirerPy is unavailable.
53+
54+
### Releasing
55+
56+
1. Bump version in `pyproject.toml`, `team_cli/__init__.py`, and `Formula/team-cli.rb` (tag + version lines)
57+
2. Update `charset-normalizer` or other resources in the Formula if dependencies changed
58+
3. Commit to main
59+
4. Tag: `git tag v0.3.0 && git push --tags`
60+
5. The GitHub Actions workflow creates a release automatically
61+
6. Users update via `brew update && brew upgrade team-cli`
62+
63+
### Formula resources
64+
65+
When updating Python dependencies in the Formula, use sdist tarballs from PyPI. Pin `charset-normalizer` to 3.3.2 (3.4.x requires `mypy` as a build dependency which fails in Homebrew's `--no-binary :all:` environment).
66+
67+
### Testing
68+
69+
Run `team --help` after changes to verify the CLI loads. All commands should work both interactively (prompts) and non-interactively (flags).

Formula/team-cli.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class TeamCli < Formula
33

44
desc "CLI for AWS TEAM (Temporary Elevated Access Management)"
55
homepage "https://github.com/DocPlanner/team-cli"
6-
url "https://github.com/DocPlanner/team-cli.git", branch: "main"
6+
url "https://github.com/DocPlanner/team-cli.git", tag: "v0.2.0"
77
version "0.2.0"
88

99

@@ -15,8 +15,8 @@ class TeamCli < Formula
1515
end
1616

1717
resource "charset-normalizer" do
18-
url "https://files.pythonhosted.org/packages/e4/33/89c2ced2b67d1c2a61c19c6751aa8902d46ce3dacb23600a283619f5a12d/charset_normalizer-3.4.2.tar.gz"
19-
sha256 "5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63"
18+
url "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz"
19+
sha256 "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
2020
end
2121

2222
resource "idna" do
@@ -56,6 +56,7 @@ class TeamCli < Formula
5656

5757
def install
5858
virtualenv_install_with_resources
59+
bash_completion.install "completions/team.bash" => "team"
5960
end
6061

6162
test do

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ Accounts already present in `~/.aws/config` (matched by `sso_account_id`) are sk
192192

193193
3. **Sync**`team sync` reads your TEAM-eligible accounts and permissions, then writes matching SSO profiles into `~/.aws/config`. It creates an `sso-session` block if missing and only adds profiles for permission sets listed in your `profile_map`.
194194

195+
## Bash completions
196+
197+
Installed automatically via Homebrew. For non-Homebrew installs:
198+
199+
```bash
200+
source /path/to/completions/team.bash
201+
```
202+
195203
## License
196204

197205
MIT

completions/team.bash

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
_team() {
2+
local cur="${COMP_WORDS[COMP_CWORD]}"
3+
local commands="login logout accounts roles request requests status approve reject revoke cancel pending sync audit configure"
4+
5+
case "${COMP_WORDS[1]}" in
6+
request)
7+
[[ "$cur" == -* ]] && COMPREPLY=($(compgen -W "--account -a --role -r --duration -d --justification -j --ticket -t --start -s --wait -w --wait-timeout" -- "$cur"))
8+
return ;;
9+
accounts)
10+
[[ "$cur" == -* ]] && COMPREPLY=($(compgen -W "--json" -- "$cur"))
11+
return ;;
12+
status|approve|reject|revoke|cancel)
13+
[[ "$cur" == -* ]] && COMPREPLY=($(compgen -W "--comment -c" -- "$cur"))
14+
return ;;
15+
audit)
16+
[[ "$cur" == -* ]] && COMPREPLY=($(compgen -W "--actor --account --role --from --to --status --json --no-logs --limit" -- "$cur"))
17+
return ;;
18+
configure)
19+
[[ "$cur" == -* ]] && COMPREPLY=($(compgen -W "--show --edit" -- "$cur"))
20+
return ;;
21+
esac
22+
23+
[[ $COMP_CWORD -eq 1 ]] && COMPREPLY=($(compgen -W "$commands" -- "$cur"))
24+
}
25+
26+
complete -F _team team

0 commit comments

Comments
 (0)