augint-org 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. augint_org-0.1.0/.claude/settings.json +204 -0
  2. augint_org-0.1.0/.claude/skills/ai-create-cmd/SKILL.md +157 -0
  3. augint_org-0.1.0/.claude/skills/ai-monitor-pipeline/SKILL.md +318 -0
  4. augint_org-0.1.0/.claude/skills/ai-pick-issue/SKILL.md +230 -0
  5. augint_org-0.1.0/.claude/skills/ai-prepare-branch/SKILL.md +206 -0
  6. augint_org-0.1.0/.claude/skills/ai-promote/SKILL.md +190 -0
  7. augint_org-0.1.0/.claude/skills/ai-repo-health/SKILL.md +273 -0
  8. augint_org-0.1.0/.claude/skills/ai-rollback/SKILL.md +178 -0
  9. augint_org-0.1.0/.claude/skills/ai-setup-oidc/SKILL.md +255 -0
  10. augint_org-0.1.0/.claude/skills/ai-standardize-dotfiles/SKILL.md +97 -0
  11. augint_org-0.1.0/.claude/skills/ai-standardize-pipeline/SKILL.md +255 -0
  12. augint_org-0.1.0/.claude/skills/ai-standardize-precommit/SKILL.md +111 -0
  13. augint_org-0.1.0/.claude/skills/ai-standardize-release/SKILL.md +98 -0
  14. augint_org-0.1.0/.claude/skills/ai-standardize-renovate/SKILL.md +120 -0
  15. augint_org-0.1.0/.claude/skills/ai-standardize-repo/SKILL.md +253 -0
  16. augint_org-0.1.0/.claude/skills/ai-status/SKILL.md +89 -0
  17. augint_org-0.1.0/.claude/skills/ai-submit-work/SKILL.md +361 -0
  18. augint_org-0.1.0/.claude/skills/ai-web-dev/SKILL.md +190 -0
  19. augint_org-0.1.0/.env.example +11 -0
  20. augint_org-0.1.0/.github/CODEOWNERS +3 -0
  21. augint_org-0.1.0/.github/FUNDING.yaml +1 -0
  22. augint_org-0.1.0/.github/SECURITY.md +7 -0
  23. augint_org-0.1.0/.github/workflows/infrastructure.yaml +198 -0
  24. augint_org-0.1.0/.github/workflows/publish.yaml +499 -0
  25. augint_org-0.1.0/.gitignore +227 -0
  26. augint_org-0.1.0/.pre-commit-config.yaml +38 -0
  27. augint_org-0.1.0/BILLING_ARCHITECTURE.md +196 -0
  28. augint_org-0.1.0/CHANGELOG.md +242 -0
  29. augint_org-0.1.0/CLAUDE.md +152 -0
  30. augint_org-0.1.0/LICENSE +679 -0
  31. augint_org-0.1.0/Makefile +89 -0
  32. augint_org-0.1.0/NOTES.md +79 -0
  33. augint_org-0.1.0/PKG-INFO +1025 -0
  34. augint_org-0.1.0/README.md +322 -0
  35. augint_org-0.1.0/STACKSET_ARCHITECTURE.md +107 -0
  36. augint_org-0.1.0/docs/README.md +52 -0
  37. augint_org-0.1.0/docs/architecture.md +242 -0
  38. augint_org-0.1.0/docs/configuration.md +336 -0
  39. augint_org-0.1.0/docs/development.md +567 -0
  40. augint_org-0.1.0/docs/getting-started.md +246 -0
  41. augint_org-0.1.0/planning/AGENTS.md +6 -0
  42. augint_org-0.1.0/planning/CLI_SPEC.md +343 -0
  43. augint_org-0.1.0/planning/EXAMPLES/pipeline.yaml +1083 -0
  44. augint_org-0.1.0/planning/EXAMPLES/pyproject.toml +295 -0
  45. augint_org-0.1.0/planning/MIGRATION_PLAN.md +380 -0
  46. augint_org-0.1.0/planning/PLAN.md +0 -0
  47. augint_org-0.1.0/planning/README.md +44 -0
  48. augint_org-0.1.0/planning/SPEC.md +540 -0
  49. augint_org-0.1.0/pyproject.toml +192 -0
  50. augint_org-0.1.0/renovate.json5 +121 -0
  51. augint_org-0.1.0/resources/pdoc-templates/custom.css +86 -0
  52. augint_org-0.1.0/resources/pdoc-templates/index.html.jinja2 +8 -0
  53. augint_org-0.1.0/resources/pytest-html.css +149 -0
  54. augint_org-0.1.0/scripts/bootstrap.py +390 -0
  55. augint_org-0.1.0/scripts/deploy.py +778 -0
  56. augint_org-0.1.0/scripts/drift.py +378 -0
  57. augint_org-0.1.0/scripts/fix_manual_stacksets.py +106 -0
  58. augint_org-0.1.0/scripts/list_sso_users.py +68 -0
  59. augint_org-0.1.0/scripts/org_setup.py +265 -0
  60. augint_org-0.1.0/scripts/stackset_registry.py +215 -0
  61. augint_org-0.1.0/scripts/status.py +281 -0
  62. augint_org-0.1.0/src/ai_org/__init__.py +32 -0
  63. augint_org-0.1.0/src/ai_org/__version__.py +10 -0
  64. augint_org-0.1.0/src/ai_org/cli.py +132 -0
  65. augint_org-0.1.0/src/ai_org/commands/__init__.py +1 -0
  66. augint_org-0.1.0/src/ai_org/commands/account.py +191 -0
  67. augint_org-0.1.0/src/ai_org/commands/billing.py +238 -0
  68. augint_org-0.1.0/src/ai_org/commands/config.py +209 -0
  69. augint_org-0.1.0/src/ai_org/commands/dns.py +463 -0
  70. augint_org-0.1.0/src/ai_org/commands/ou.py +163 -0
  71. augint_org-0.1.0/src/ai_org/commands/sso.py +212 -0
  72. augint_org-0.1.0/src/ai_org/commands/stackset.py +531 -0
  73. augint_org-0.1.0/src/ai_org/core/__init__.py +1 -0
  74. augint_org-0.1.0/src/ai_org/core/account_factory.py +295 -0
  75. augint_org-0.1.0/src/ai_org/core/account_manager.py +327 -0
  76. augint_org-0.1.0/src/ai_org/core/aws_client.py +129 -0
  77. augint_org-0.1.0/src/ai_org/core/billing_manager.py +245 -0
  78. augint_org-0.1.0/src/ai_org/core/config_manager.py +199 -0
  79. augint_org-0.1.0/src/ai_org/core/ou_manager.py +210 -0
  80. augint_org-0.1.0/src/ai_org/core/sso_manager.py +466 -0
  81. augint_org-0.1.0/src/ai_org/core/stackset_manager.py +587 -0
  82. augint_org-0.1.0/src/ai_org/utils/__init__.py +1 -0
  83. augint_org-0.1.0/src/ai_org/utils/cache.py +161 -0
  84. augint_org-0.1.0/src/ai_org/utils/config_loader.py +81 -0
  85. augint_org-0.1.0/src/ai_org/utils/output.py +159 -0
  86. augint_org-0.1.0/src/ai_org/utils/validators.py +146 -0
  87. augint_org-0.1.0/stacksets/01-pipeline-bootstrap/template.yaml +66 -0
  88. augint_org-0.1.0/stacksets/02-github-oidc/template.yaml +370 -0
  89. augint_org-0.1.0/stacksets/03-monitoring/MANUAL_DEPLOY.md +26 -0
  90. augint_org-0.1.0/stacksets/03-monitoring/template.yaml +330 -0
  91. augint_org-0.1.0/stacksets/04-cost-management/template.yaml +221 -0
  92. augint_org-0.1.0/stacksets/05-dns-delegation/template.yaml +47 -0
  93. augint_org-0.1.0/stacksets/06-log-aggregation/MANUAL_DEPLOY.md +26 -0
  94. augint_org-0.1.0/stacksets/06-log-aggregation/template.yaml +341 -0
  95. augint_org-0.1.0/stacksets/07-acm-certificates/template.yaml +160 -0
  96. augint_org-0.1.0/stacksets/08-apigateway-logging/template.yaml +34 -0
  97. augint_org-0.1.0/stacksets/pipeline-role.yaml +229 -0
  98. augint_org-0.1.0/stacksets/scps/attach.sh +119 -0
  99. augint_org-0.1.0/stacksets/scps/workloads-baseline.json +64 -0
  100. augint_org-0.1.0/template.yaml +315 -0
  101. augint_org-0.1.0/tests/__init__.py +0 -0
  102. augint_org-0.1.0/tests/conftest.py +15 -0
  103. augint_org-0.1.0/tests/unit/__init__.py +0 -0
  104. augint_org-0.1.0/tests/unit/test_account_factory.py +58 -0
  105. augint_org-0.1.0/tests/unit/test_account_manager.py +67 -0
  106. augint_org-0.1.0/tests/unit/test_aws_client.py +127 -0
  107. augint_org-0.1.0/tests/unit/test_billing_manager.py +68 -0
  108. augint_org-0.1.0/tests/unit/test_cache.py +82 -0
  109. augint_org-0.1.0/tests/unit/test_cli.py +97 -0
  110. augint_org-0.1.0/tests/unit/test_commands.py +120 -0
  111. augint_org-0.1.0/tests/unit/test_config_loader.py +68 -0
  112. augint_org-0.1.0/tests/unit/test_config_manager.py +184 -0
  113. augint_org-0.1.0/tests/unit/test_ou_manager.py +123 -0
  114. augint_org-0.1.0/tests/unit/test_output.py +112 -0
  115. augint_org-0.1.0/tests/unit/test_sso_manager.py +95 -0
  116. augint_org-0.1.0/tests/unit/test_stackset_manager.py +89 -0
  117. augint_org-0.1.0/tests/unit/test_validators.py +155 -0
  118. augint_org-0.1.0/tests/unit/test_version.py +14 -0
  119. augint_org-0.1.0/uv.lock +2172 -0
@@ -0,0 +1,204 @@
1
+ {
2
+ "env": {
3
+ "PYTHONDONTWRITEBYTECODE": "1",
4
+ "PIP_REQUIRE_VIRTUALENV": "true",
5
+ "DISABLE_TELEMETRY": "1",
6
+ "CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": "1",
7
+ "BASH_MAX_TIMEOUT_MS": "600000"
8
+ },
9
+ "permissions": {
10
+ "allow": [
11
+ "Bash(npm ci:*)",
12
+ "Bash(npm install:*)",
13
+ "Bash(npm run:*)",
14
+ "Bash(npm test:*)",
15
+ "Bash(pytest:*)",
16
+ "Bash(python -m pytest:*)",
17
+ "Bash(ruff:*)",
18
+ "Bash(mypy:*)",
19
+ "Bash(black:*)",
20
+ "Bash(isort:*)",
21
+ "Bash(flake8:*)",
22
+ "Bash(bandit:*)",
23
+ "Bash(safety:*)",
24
+ "Bash(pre-commit:*)",
25
+ "Bash(uv run pre-commit:*)",
26
+ "Bash(uv run bandit:*)",
27
+ "Bash(uv run pip-audit:*)",
28
+ "Bash(uv run pip-licenses:*)",
29
+ "Bash(uv export:*)",
30
+ "Bash(uv run:*)",
31
+ "Bash(uv sync:*)",
32
+ "Bash(uv build:*)",
33
+ "Bash(uv add:*)",
34
+ "Bash(uv remove:*)",
35
+ "Bash(uv lock:*)",
36
+ "Bash(uv tree:*)",
37
+ "Bash(uv --version:*)",
38
+ "Bash(uv pip list:*)",
39
+ "Bash(uv pip show:*)",
40
+ "Bash(git status:*)",
41
+ "Bash(git diff:*)",
42
+ "Bash(git log:*)",
43
+ "Bash(git branch:*)",
44
+ "Bash(git checkout:*)",
45
+ "Bash(git fetch:*)",
46
+ "Bash(git pull:*)",
47
+ "Bash(git add:*)",
48
+ "Bash(git commit:*)",
49
+ "Bash(git stash:*)",
50
+ "Bash(git rebase:*)",
51
+ "Bash(git merge:*)",
52
+ "Bash(git remote:*)",
53
+ "Bash(git show:*)",
54
+ "Bash(git tag:*)",
55
+ "Bash(git describe:*)",
56
+ "Bash(git rev-parse:*)",
57
+ "Bash(git rev-list:*)",
58
+ "Bash(git for-each-ref:*)",
59
+ "Bash(git merge-base:*)",
60
+ "Bash(git symbolic-ref:*)",
61
+ "Bash(git ls-remote:*)",
62
+ "Bash(git fsck:*)",
63
+ "Bash(git bundle:*)",
64
+ "Bash(git reflog:*)",
65
+ "Bash(git gc:*)",
66
+ "Bash(git repack:*)",
67
+ "Bash(git config --get:*)",
68
+ "Bash(git config --list:*)",
69
+ "Bash(git config --get-regexp:*)",
70
+ "Bash(git config --show-origin:*)",
71
+ "Bash(git show-ref:*)",
72
+ "Bash(git push origin feat/*)",
73
+ "Bash(git push origin fix/*)",
74
+ "Bash(git push origin docs/*)",
75
+ "Bash(git push origin test/*)",
76
+ "Bash(git push origin refactor/*)",
77
+ "Bash(git push origin perf/*)",
78
+ "Bash(git push origin chore/*)",
79
+ "Bash(git push origin ci/*)",
80
+ "Bash(git push origin build/*)",
81
+ "Bash(git push origin style/*)",
82
+ "Bash(git push origin revert/*)",
83
+ "Bash(git push origin dev:*)",
84
+ "Bash(git push origin develop:*)",
85
+ "Bash(git push origin staging:*)",
86
+ "Bash(git push --force-with-lease:*)",
87
+ "Bash(git push origin --delete:*)",
88
+ "Bash(git push --set-upstream:*)",
89
+ "Bash(git push -u:*)",
90
+ "Bash(python:*)",
91
+ "Bash(python3:*)",
92
+ "Bash(aws s3 ls:*)",
93
+ "Bash(aws logs tail:*)",
94
+ "Bash(aws logs describe:*)",
95
+ "Bash(aws lambda list:*)",
96
+ "Bash(aws lambda get:*)",
97
+ "Bash(aws apigateway get:*)",
98
+ "Bash(aws cloudformation describe:*)",
99
+ "Bash(aws sts get-caller-identity:*)",
100
+ "Bash(aws iam list-open-id-connect-providers:*)",
101
+ "Bash(aws iam get-open-id-connect-provider:*)",
102
+ "Bash(aws iam list-roles:*)",
103
+ "Bash(aws iam get-role:*)",
104
+ "Bash(docker ps:*)",
105
+ "Bash(docker images:*)",
106
+ "Bash(docker logs:*)",
107
+ "Bash(docker compose ps:*)",
108
+ "Bash(docker compose logs:*)",
109
+ "Bash(ls:*)",
110
+ "Bash(pwd:*)",
111
+ "Bash(which:*)",
112
+ "Bash(whereis:*)",
113
+ "Bash(find:*)",
114
+ "Bash(grep:*)",
115
+ "Bash(rg:*)",
116
+ "Bash(cat:*)",
117
+ "Bash(head:*)",
118
+ "Bash(tail:*)",
119
+ "Bash(wc:*)",
120
+ "Bash(echo:*)",
121
+ "Bash(printf:*)",
122
+ "Bash(mkdir:*)",
123
+ "Bash(touch:*)",
124
+ "Bash(cp:*)",
125
+ "Bash(mv:*)",
126
+ "Bash(gh pr list:*)",
127
+ "Bash(gh pr view:*)",
128
+ "Bash(gh pr checks:*)",
129
+ "Bash(gh pr create:*)",
130
+ "Bash(gh pr merge:*)",
131
+ "Bash(gh issue list:*)",
132
+ "Bash(gh issue view:*)",
133
+ "Bash(gh issue comment:*)",
134
+ "Bash(gh workflow list:*)",
135
+ "Bash(gh workflow view:*)",
136
+ "Bash(gh run list:*)",
137
+ "Bash(gh run view:*)",
138
+ "Bash(gh run watch:*)",
139
+ "Bash(terraform fmt:*)",
140
+ "Bash(terraform validate:*)",
141
+ "Bash(terraform plan:*)",
142
+ "Bash(terraform show:*)",
143
+ "Bash(terraform output:*)",
144
+ "Bash(jq:*)",
145
+ "Bash(yq:*)",
146
+ "Bash(sed:*)",
147
+ "Bash(awk:*)",
148
+ "Bash(node --version:*)",
149
+ "Bash(npm --version:*)",
150
+ "Bash(python --version:*)",
151
+ "Bash(aws --version:*)",
152
+ "Bash(sam --version:*)",
153
+ "Bash(terraform --version:*)",
154
+ "Bash(tree:*)",
155
+ "Bash(diff:*)",
156
+ "Bash(sort:*)",
157
+ "Bash(uniq:*)",
158
+ "Bash(cut:*)",
159
+ "Bash(tr:*)",
160
+ "Bash(basename:*)",
161
+ "Bash(dirname:*)",
162
+ "Bash(realpath:*)",
163
+ "Bash(npm outdated:*)",
164
+ "Bash(eslint:*)",
165
+ "Bash(prettier:*)",
166
+ "Bash(tsc:*)",
167
+ "Bash(jest:*)",
168
+ "Bash(vitest:*)"
169
+ ],
170
+ "deny": [
171
+ "Write(poetry.lock)",
172
+ "Edit(poetry.lock)",
173
+ "Write(package-lock.json)",
174
+ "Edit(package-lock.json)",
175
+ "Write(yarn.lock)",
176
+ "Edit(yarn.lock)",
177
+ "Bash(pip install:*)",
178
+ "Bash(pip uninstall:*)",
179
+ "Bash(git push:main)",
180
+ "Bash(git push origin main:*)",
181
+ "Bash(git push --force origin:*)",
182
+ "Bash(git push --force -:*)",
183
+ "Bash(git rebase main:*)",
184
+ "Bash(git rebase origin/main:*)",
185
+ "Bash(git pull --rebase:*)",
186
+ "Bash(rm -rf /*)",
187
+ "Bash(rm -rf /)",
188
+ "Bash(terraform apply:*)",
189
+ "Bash(terraform destroy:*)",
190
+ "Bash(aws s3 rm:*)",
191
+ "Bash(aws s3 rb:*)",
192
+ "Bash(docker rm:*)",
193
+ "Bash(docker rmi:*)",
194
+ "Bash(docker system prune:*)",
195
+ "Bash(npm run dev:*)",
196
+ "Bash(cat .env:*)",
197
+ "Read(.env)",
198
+ "Read(.env.*)",
199
+ "Bash(sed -i:*)"
200
+ ]
201
+ },
202
+ "enableAllProjectMcpServers": false,
203
+ "skipDangerousModePermissionPrompt": true
204
+ }
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: ai-create-cmd
3
+ description: Create a new Claude skill for augint-shell repositories. Use when building new automation commands or skills.
4
+ argument-hint: "[skill-name and description]"
5
+ ---
6
+
7
+ Create a new Claude skill for trinity repositories: $ARGUMENTS
8
+
9
+ Follow these steps to create a well-structured skill:
10
+
11
+ 1. **Parse the skill request**:
12
+ ```
13
+ Extract from user input:
14
+ - Skill name (kebab-case)
15
+ - Skill purpose
16
+ - Key functionality needed
17
+ - Target repos (default: all trinity)
18
+ ```
19
+
20
+ 2. **Determine skill scope**:
21
+ - **Trinity skill**: For augint-library, augint-api, augint-web
22
+ - **Meta skill**: Only if it makes sense for augint-project management
23
+
24
+ Ask: "Should this skill also have a meta version for the augint-project repo?"
25
+ (Only if the skill relates to project management, vision docs, or cross-repo operations)
26
+
27
+ 3. **Create the skill directory and file**:
28
+ ```bash
29
+ # Create in templates first
30
+ mkdir -p src/ai_shell/templates/claude/skills/{skill-name}
31
+ touch src/ai_shell/templates/claude/skills/{skill-name}/SKILL.md
32
+ ```
33
+
34
+ 4. **Generate SKILL.md** with this structure:
35
+ ```markdown
36
+ ---
37
+ name: {skill-name}
38
+ description: {One-line description of what it does and when to use it. Max 250 chars.}
39
+ argument-hint: "[expected arguments]"
40
+ ---
41
+
42
+ {Command description in active voice}: $ARGUMENTS
43
+
44
+ {Brief overview of what this skill does.}
45
+
46
+ ## Usage Examples
47
+ - `/{skill-name}` - Default behavior
48
+ - `/{skill-name} specific args` - With arguments
49
+
50
+ ## 1. {First Major Step}
51
+ - {Specific action}
52
+ - {Validation check}
53
+ ```bash
54
+ # Example command
55
+ ```
56
+
57
+ ## 2. {Second Major Step}
58
+ - {Specific action}
59
+ - {Error handling}
60
+
61
+ ## 3. {Output/Report}
62
+ ```
63
+ === {Skill Name} Results ===
64
+
65
+ {Structured output format}
66
+
67
+ Status: {success/warnings/failures}
68
+ ```
69
+
70
+ ## Error Handling
71
+ - {Error condition}: {Recovery action}
72
+ ```
73
+
74
+ 5. **Choose appropriate frontmatter options**:
75
+ - `argument-hint` to show expected arguments in the skill menu
76
+ - Keep description under 250 characters, front-load key use case
77
+
78
+ 6. **Validate the skill**:
79
+ ```bash
80
+ # Check SKILL.md exists and has frontmatter
81
+ head -10 src/ai_shell/templates/claude/skills/{skill-name}/SKILL.md
82
+
83
+ # Verify frontmatter has required fields
84
+ grep -E "^(name|description):" src/ai_shell/templates/claude/skills/{skill-name}/SKILL.md
85
+ ```
86
+
87
+ 7. **Register in scaffold.py**:
88
+ Add the skill name to `CLAUDE_SKILL_DIRS` in `src/ai_shell/scaffold.py`:
89
+ ```python
90
+ CLAUDE_SKILL_DIRS = [
91
+ # ... existing skills ...
92
+ "{skill-name}",
93
+ ]
94
+ ```
95
+
96
+ 8. **Best practices**:
97
+ - Keep skills focused on one primary task
98
+ - Use active voice ("Create PR" not "PR should be created")
99
+ - Include usage examples
100
+ - Make steps explicit and numbered
101
+ - Include error handling section
102
+ - Reference related skills (e.g., "Next: `/ai-submit-work`")
103
+ - Keep SKILL.md under 500 lines
104
+ - Be directive, not conversational
105
+
106
+ 9. **Copy to trinity repositories**:
107
+ ```bash
108
+ # Deploy via scaffold
109
+ for repo in augint-library augint-api augint-web; do
110
+ python -c "
111
+ from ai_shell.scaffold import scaffold_claude
112
+ from pathlib import Path
113
+ scaffold_claude(Path('../$repo'), overwrite=True)
114
+ "
115
+ done
116
+ ```
117
+
118
+ 10. **Verify deployment**:
119
+ ```bash
120
+ # Check all trinity repos have the skill
121
+ ls -la ../augint-*/.claude/skills/{skill-name}/SKILL.md
122
+ ```
123
+
124
+ ## Skill Patterns
125
+
126
+ ### For Git Workflow Skills:
127
+ ```markdown
128
+ {Action} for {purpose}: $ARGUMENTS
129
+
130
+ ## 1. Check current state
131
+ ## 2. Perform action
132
+ ## 3. Verify success
133
+ ## 4. Report results with next step
134
+ ```
135
+
136
+ ### For Analysis Skills:
137
+ ```markdown
138
+ Analyze {target} for {criteria}: $ARGUMENTS
139
+
140
+ ## 1. Gather data
141
+ ## 2. Process and categorize
142
+ ## 3. Generate insights
143
+ ## 4. Provide recommendations
144
+ ```
145
+
146
+ ### For Automation Skills:
147
+ ```markdown
148
+ Automate {task} across {scope}: $ARGUMENTS
149
+
150
+ ## 1. Validate prerequisites
151
+ ## 2. Execute automation
152
+ ## 3. Handle errors
153
+ ## 4. Confirm completion
154
+ ```
155
+
156
+ ## Why This Matters
157
+ Consistent skill creation ensures all repositories have access to the same automation capabilities with predictable behavior and quality.
@@ -0,0 +1,318 @@
1
+ ---
2
+ name: ai-monitor-pipeline
3
+ description: Monitor CI pipeline after push, diagnose failures, auto-fix and re-push. Use after submitting work, or asking 'check the build' or 'how's the pipeline'.
4
+ argument-hint: "[run-id or branch-name]"
5
+ ---
6
+
7
+ Monitor CI pipeline, diagnose failures, and auto-fix when possible: $ARGUMENTS
8
+
9
+ > **Workflow automation:** This skill is part of an automated workflow. Auto-push trivial formatting/whitespace fixes without asking. Only ask for approval when fixes involve substantive code changes. Report what was fixed but do not gate on user confirmation for mechanical fixes.
10
+
11
+ Watches the pipeline run, parses failures, attempts auto-fixes for common issues, and re-pushes automatically for trivial fixes.
12
+
13
+ ## Usage Examples
14
+ - `/ai-monitor-pipeline` - Monitor latest run on current branch
15
+ - `/ai-monitor-pipeline feat/issue-42-auth` - Monitor specific branch
16
+ - `/ai-monitor-pipeline 12345678` - Monitor specific run ID
17
+
18
+ ## 1. Find the Pipeline Run
19
+
20
+ ```bash
21
+ # Determine target
22
+ if [ -n "$ARGUMENTS" ]; then
23
+ # If numeric, treat as run ID
24
+ if echo "$ARGUMENTS" | grep -qP '^\d+$'; then
25
+ RUN_ID=$ARGUMENTS
26
+ else
27
+ # Treat as branch name
28
+ BRANCH=$ARGUMENTS
29
+ fi
30
+ else
31
+ BRANCH=$(git branch --show-current)
32
+ fi
33
+
34
+ # If we have a branch, find the latest run
35
+ if [ -n "$BRANCH" ]; then
36
+ gh run list --branch "$BRANCH" --limit 5 \
37
+ --json databaseId,status,conclusion,event,headSha,name,createdAt
38
+ # Pick the most recent run
39
+ RUN_ID=$(gh run list --branch "$BRANCH" --limit 1 --json databaseId -q '.[0].databaseId')
40
+ fi
41
+
42
+ if [ -z "$RUN_ID" ]; then
43
+ echo "No pipeline runs found. Push your changes first."
44
+ exit 1
45
+ fi
46
+ ```
47
+
48
+ Show the run details:
49
+ ```
50
+ Pipeline: CI/CD Pipeline
51
+ Run: #12345678
52
+ Branch: feat/issue-42-auth
53
+ Status: in_progress
54
+ Started: 2 minutes ago
55
+ ```
56
+
57
+ ## 2. Wait for Completion
58
+
59
+ ```bash
60
+ # Watch the run in real-time
61
+ gh run watch $RUN_ID --exit-status
62
+ ```
63
+
64
+ If `gh run watch` is not available, poll:
65
+ ```bash
66
+ while true; do
67
+ STATUS=$(gh run view $RUN_ID --json status,conclusion -q '.status')
68
+ if [ "$STATUS" = "completed" ]; then
69
+ CONCLUSION=$(gh run view $RUN_ID --json conclusion -q '.conclusion')
70
+ break
71
+ fi
72
+ sleep 30
73
+ done
74
+ ```
75
+
76
+ ## 3. On Success
77
+
78
+ ```
79
+ Pipeline PASSED
80
+
81
+ Jobs:
82
+ - Pre-commit checks: passed
83
+ - Security scanning: passed
84
+ - License compliance: passed
85
+ - Unit tests: passed
86
+
87
+ PR status: ready to merge (automerge enabled)
88
+ ```
89
+
90
+ ### Post-Merge Cleanup
91
+
92
+ After pipeline passes, check if the PR has been merged (automerge may complete quickly):
93
+
94
+ ```bash
95
+ PR_STATE=$(gh pr view --json state -q .state 2>/dev/null)
96
+ ```
97
+
98
+ If `PR_STATE` is `MERGED`:
99
+
100
+ 1. **Check for dirty working directory:**
101
+ ```bash
102
+ if [ -n "$(git status --porcelain)" ]; then
103
+ echo "You have uncommitted changes. Skipping cleanup."
104
+ # Report success but do NOT switch branches
105
+ fi
106
+ ```
107
+
108
+ 2. **If clean, auto-cleanup:**
109
+ ```bash
110
+ BASE=$TARGET # detected via branch detection algorithm from CLAUDE.md
111
+ CURRENT=$(git branch --show-current)
112
+ git checkout $BASE && git pull origin $BASE && git branch -d $CURRENT
113
+ ```
114
+
115
+ 3. **Report:**
116
+ ```
117
+ Pipeline PASSED. PR merged.
118
+ Cleaned up: deleted local branch feat/issue-42-auth
119
+ Now on: main (up to date)
120
+
121
+ Suggested next step: /ai-pick-issue
122
+ ```
123
+
124
+ If PR has NOT merged yet (waiting for automerge or review): just report pipeline success and stop.
125
+
126
+ Skip cleanup if `--no-cleanup` was passed as an argument.
127
+
128
+ ## 4. On Failure - Diagnose
129
+
130
+ ```bash
131
+ # Get job details
132
+ gh run view $RUN_ID --json jobs
133
+
134
+ # Identify failed job(s)
135
+ FAILED_JOBS=$(gh run view $RUN_ID --json jobs -q '.jobs[] | select(.conclusion == "failure") | .name')
136
+
137
+ # Get failed logs
138
+ gh run view $RUN_ID --log-failed
139
+ ```
140
+
141
+ ### Categorize the Failure
142
+
143
+ **Auto-fixable failures** (skill will attempt to fix):
144
+ - **Pre-commit failures**: formatting (ruff-format), whitespace (trailing-whitespace, end-of-file-fixer), import ordering (ruff check --fix)
145
+ - **Lint errors with auto-fix**: ruff, eslint with --fix
146
+ - **MyPy errors**: fix actual types (NEVER use `# type: ignore` or `Any` as escape hatches). If only escape-hatch fix is available, reclassify as NOT auto-fixable.
147
+ - **uv-lock-check failures**: run `uv lock` to regenerate
148
+
149
+ **NOT auto-fixable** (skill reports and stops):
150
+ - **Test failures**: require understanding business logic
151
+ - **Security vulnerabilities**: bandit findings, pip-audit CVEs require judgment
152
+ - **License compliance**: dependency decisions needed
153
+ - **Build/compilation errors**: syntax errors, broken imports in non-trivial code
154
+ - **Release job failures**: should never be triggered from feature branches
155
+
156
+ ### Failure Report
157
+
158
+ ```
159
+ Pipeline FAILED
160
+
161
+ Failed jobs:
162
+ 1. Pre-commit checks (auto-fixable)
163
+ - ruff-format: 3 files need formatting
164
+ - trailing-whitespace: 1 file
165
+
166
+ 2. Unit tests (manual fix required)
167
+ - test_auth.py::test_login_timeout FAILED
168
+ - AssertionError: expected 200, got 401
169
+ ```
170
+
171
+ ## 5. Auto-fix Attempt
172
+
173
+ **Circuit breakers (checked before every fix attempt):**
174
+ - Maximum 2 fix attempts total
175
+ - If same failure type repeats after a fix: stop immediately
176
+ - Never modify the same file more than twice across all attempts
177
+ - Auto-push trivial fixes (formatting/whitespace); require approval only for substantive changes
178
+
179
+ **Track state:**
180
+ ```python
181
+ attempt_count = 0
182
+ max_attempts = 2
183
+ previous_failures = set()
184
+ modified_files = {} # file -> modification count
185
+ ```
186
+
187
+ ### Fix Process
188
+
189
+ For each auto-fixable failure:
190
+
191
+ 1. **Apply the fix locally:**
192
+ ```bash
193
+ # For pre-commit failures
194
+ uv run pre-commit run --all-files
195
+ # This auto-fixes formatting, whitespace, imports
196
+
197
+ # For specific ruff issues
198
+ uv run ruff check --fix src/ tests/
199
+ uv run ruff format src/ tests/
200
+ ```
201
+
202
+ 2. **Verify the fix locally:**
203
+ ```bash
204
+ # Re-run the failing check
205
+ uv run pre-commit run --all-files
206
+ # Must pass now
207
+ ```
208
+
209
+ 3. **Categorize the fix and decide whether to auto-push:**
210
+
211
+ **Trivial fixes (auto-push without asking):** formatting (ruff-format, black, prettier), whitespace (trailing-whitespace, end-of-file-fixer), import sorting (isort, ruff I-rules). These are mechanical and deterministic.
212
+
213
+ ```
214
+ Fix attempt #1 (auto-pushed):
215
+ Files modified:
216
+ - src/auth.py (formatting)
217
+ - src/utils.py (trailing whitespace)
218
+ ```
219
+
220
+ For trivial fixes: commit and push immediately. Do NOT show the diff or ask for approval.
221
+
222
+ **Substantive fixes (ask before pushing):** any fix that changes logic, adds/removes code beyond whitespace, or modifies behavior. Show the diff and ask:
223
+ ```
224
+ Fix attempt #1 (requires approval):
225
+ Files modified:
226
+ - src/auth.py (logic change)
227
+
228
+ Diff:
229
+ [show git diff]
230
+
231
+ Push these fixes? [y/n]
232
+ ```
233
+
234
+ 4. **Local smoke test before pushing:**
235
+
236
+ - **Trivial fixes** (formatting/whitespace only): run pre-commit locally as a smoke test (fast, 5-30 seconds):
237
+ ```bash
238
+ uv run pre-commit run --all-files
239
+ ```
240
+ - **Substantive fixes** (mypy, logic changes): run pre-commit + tests:
241
+ ```bash
242
+ uv run pre-commit run --all-files && uv run pytest --cov=src --cov-fail-under=80 -q
243
+ ```
244
+
245
+ If the local smoke test fails, report the issue to the user instead of pushing a known-broken state. This counts as one of the 2 fix attempts.
246
+
247
+ 5. **Commit and push:**
248
+ ```bash
249
+ git add -u
250
+ git commit -m "fix: resolve pre-commit formatting issues"
251
+ git push origin $(git branch --show-current)
252
+ ```
253
+
254
+ 6. **Watch the new run:**
255
+ ```bash
256
+ # Wait a moment for the new run to start
257
+ sleep 5
258
+ NEW_RUN_ID=$(gh run list --branch "$(git branch --show-current)" --limit 1 --json databaseId -q '.[0].databaseId')
259
+ gh run watch $NEW_RUN_ID --exit-status
260
+ ```
261
+
262
+ 7. **Check result:**
263
+ - If passed: report success
264
+ - If same failure: stop immediately ("Same failure after fix. Manual intervention needed.")
265
+ - If different failure: attempt one more fix (if under max attempts)
266
+
267
+ ### When NOT to Auto-fix
268
+
269
+ If ALL failed jobs are non-auto-fixable:
270
+ ```
271
+ Pipeline FAILED - Manual fixes needed
272
+
273
+ Failed: Unit tests
274
+ - test_auth.py::test_login_timeout FAILED
275
+ - test_api.py::test_rate_limiting FAILED
276
+
277
+ These failures require manual intervention.
278
+ Logs: gh run view 12345678 --log-failed
279
+
280
+ Suggested actions:
281
+ 1. Fix the failing tests
282
+ 2. Run locally: uv run pytest tests/test_auth.py -v
283
+ 3. Push fixes and re-run: /ai-monitor-pipeline
284
+ ```
285
+
286
+ ## 6. Final Output
287
+
288
+ ### After successful fix:
289
+ ```
290
+ Pipeline PASSED (after 1 fix attempt)
291
+
292
+ Fix applied:
293
+ - Commit: abc1234 "fix: resolve pre-commit formatting issues"
294
+ - Files: src/auth.py, src/utils.py
295
+
296
+ All jobs green. PR ready to merge.
297
+ ```
298
+
299
+ ### After giving up:
300
+ ```
301
+ Pipeline FAILED (2 fix attempts exhausted)
302
+
303
+ Attempt 1: Fixed formatting -> new failure in tests
304
+ Attempt 2: Cannot auto-fix test failures
305
+
306
+ Remaining failures:
307
+ - Unit tests: test_auth.py::test_login_timeout
308
+
309
+ Manual fix required. Run locally:
310
+ uv run pytest tests/test_auth.py::test_login_timeout -v
311
+ ```
312
+
313
+ ## Error Handling
314
+ - **No runs found**: Suggest pushing changes first
315
+ - **gh CLI not authenticated**: Remind to run `gh auth login`
316
+ - **Run cancelled**: Report cancellation, suggest re-triggering
317
+ - **Network timeout during watch**: Resume polling with last known run ID
318
+ - **Fix creates new issues**: Circuit breaker stops after 2 attempts