Skip to content

feat: add context push command#139

Merged
vik-nullify merged 3 commits intomainfrom
feat/context-push
Mar 26, 2026
Merged

feat: add context push command#139
vik-nullify merged 3 commits intomainfrom
feat/context-push

Conversation

@vik-nullify
Copy link
Copy Markdown
Member

@vik-nullify vik-nullify commented Mar 25, 2026

Summary

  • New nullify api context push [files...] --type <type> --name <name> command
  • Calls POST /admin/context/credentials to get scoped STS credentials
  • Uploads files to S3 wrapped in a metadata envelope (latest.json + history/{timestamp}.json)
  • Auto-detects repo, branch, commit SHA from git (with GITHUB_REPOSITORY, GITHUB_REF_NAME, GITHUB_SHA overrides for CI)
  • SSE-KMS encryption using key ARN from API response

New files

  • internal/api/context_push.go — API client method
  • internal/upload/s3.go — S3 upload with envelope wrapping
  • internal/lib/git_context.go — git context auto-detection
  • internal/commands/context_push.go — cobra command registration

Test plan

  • go build ./... compiles
  • nullify api context push --type terraform --name networking --dry-run plan.json — verify dry run output
  • Integration test against dev API — verify S3 upload succeeds
  • Verify auto-detection in GitHub Actions environment

🤖 Generated with Claude Code

@vik-nullify vik-nullify added the patch Patch version updates (fixes) label Mar 25, 2026
@vik-nullify vik-nullify requested a review from fyxme March 25, 2026 05:10
@vik-nullify vik-nullify marked this pull request as ready for review March 25, 2026 05:12
vik-nullify and others added 3 commits March 26, 2026 03:47
New hand-written command: nullify api context push [files...]

- Calls POST /admin/context/credentials to get scoped STS creds
- Uploads files to S3 wrapped in a metadata envelope (latest.json + history)
- Auto-detects repo, branch, commit SHA from git (with CI env var overrides)
- Supports --type, --name, --environment, --branch, --pr-number, --dry-run
- SSE-KMS encryption using the key ARN from the API response

New files:
- internal/api/context_push.go — API client method
- internal/upload/s3.go — S3 upload with envelope wrapping
- internal/lib/git_context.go — git context auto-detection
- internal/commands/context_push.go — cobra command registration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Single file per invocation (prevents silent latest.json overwrites)
- File size limit (50 MB) to prevent OOM
- JSON validation before upload
- Repo detection: check GITHUB_REPOSITORY env var before git
- Auto-derive name from file path if --name not provided
- Add --from-pr flag for deployment tracing
- Remove --name as required (auto-detected from path)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolution order: --repository flag > GITHUB_REPOSITORY env > git auto-detect.
Allows CLI usage outside git repos and CI environments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vik-nullify vik-nullify enabled auto-merge March 26, 2026 05:04
@vik-nullify vik-nullify disabled auto-merge March 26, 2026 05:18
@vik-nullify vik-nullify enabled auto-merge March 26, 2026 05:18
@vik-nullify vik-nullify added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 0f556f2 Mar 26, 2026
2 checks passed
@vik-nullify vik-nullify deleted the feat/context-push branch March 26, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Patch version updates (fixes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants