Skip to content

feat: nan notifications (Slack, Teams, Discord, HTTPS channels) (0.1.34) - #56

Merged
sre-helmcode merged 6 commits into
mainfrom
feat/notifications
Oct 14, 2026
Merged

sre-helmcode merged 6 commits into
mainfrom
feat/notifications

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

What

nan notifications: manage notification channels (Slack, Microsoft Teams, Discord, HTTPS) from the CLI, against /v1/notification-channels (helmcode/nan-cloud-api#349, spec helmcode/nan-devops AGENT-AUTOMATIONS-PHASE3-NOTIFICATIONS.md §4 and §5).

  • ls, show <NAME|id>, add NAME --kind ... (--url-file PATH | --url-stdin) [--event E]... [--no-events] [--automation REF], edit [--name] [--enable|--disable] [--url-file|--url-stdin], rm [--yes], test (exit 1 when not delivered, with the reason and what to do), rotate (https only), deliveries [--limit 1..100], subscriptions [--set|--add|--remove EVENT[=AUTOMATION]]... [--clear]; --json on all but rm.
  • A webhook URL is a credential: only --url-file or --url-stdin (never a terminal). A URL as an argument or --url is refused before anything is sent, without echoing it. Request types redact the URL in %v/%+v/%#v.
  • An https channel's signing secret is printed once on stdout, with a "store it now" note on stderr; with --json it is in the JSON (signing_secret) and the note stays on stderr.
  • Feature off: a session reads features.notifications / features.write_api from /api/auth/me; a token gets the mount's 404. Both exit 64 pointing at the portal (Settings > Notifications) and https://nan.builders/docs/notifications.
  • Error mapping for invalid_url (with a per-kind URL hint), name_taken, too_many_channels, automation_not_found, channel_disabled, signing_not_supported, rate_limited (write bucket vs test limit), notifications_unavailable, token_scope_denied, credential_not_allowed, workspace_key_not_allowed.
  • A token with notifications:write only can act on a channel by id (it cannot list to resolve names).
  • Version 0.1.34 (also ships the already-merged test: every --json command prints exactly one JSON document on stdout #54, test only).

Tests

  • internal/api: golden channel, create (with signing_secret), deliveries, test and rotate objects shaped exactly as cloud-api's handler serialises them; every route/method/body; URL redaction; both error envelopes.
  • cmd/notifications_test.go: httptest fake for every subcommand, human output golden files (cmd/testdata/notifications/), URL never leaks (stdout, stderr, message, other requests, files in HOME), every refusal, feature off for session and token, write-only token.
  • cmd/json_output_test.go: every new --json command is covered by the generic one-JSON-document-on-stdout test (and asserts the URL never prints).
  • Test helper fix: resetCommandFlags reset slice flags with Set("[]"), which appends a literal []; it now uses Replace(nil).

go build ./... && go vet ./... && gofmt -l . && go test -count=1 ./...: all green.

Deploy

Merging publishes 0.1.34. Needs NOTIFICATIONS_ENABLED and the write API on for the member to be useful; otherwise the commands exit 64 with the portal hint.

🤖 Generated with Claude Code

barckcode and others added 6 commits October 14, 2026 19:41
…with golden responses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rotate, deliveries and subscriptions

Webhook URLs only from --url-file or --url-stdin (never an argument), the
https signing secret printed once, exit 64 with a portal hint when the
account has no notifications, httptest tests with cloud-api's golden
objects, and every new --json command held to the stdout contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he wire, no dead code, automation ids compared in lower case, subscriptions --json documented)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… default events only in tests, generic invalid_request pinned)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sre-helmcode
sre-helmcode merged commit 9180387 into main Oct 14, 2026
5 checks passed
sre-helmcode pushed a commit that referenced this pull request Oct 20, 2026
Brings #50, #51, #52, #53, #54, #56 and #57 onto the new structure:

- mimo-v2.6-flash, qwen3.8-flash at 1M, and the Codex model catalogue:
  the writer changes go to internal/tools, the catalogue and its
  embedded prompt to internal/tools/codexprompt.
- BYOK runs, secrets and automation writes, and notifications: the
  commands go to internal/cli and hang off NewRootCmd; their goldens
  to internal/cli/testdata.
- The --json contract test counts the commands with a --json of their
  own, not the one every command inherits from the root.
- The embedded Codex prompt is Apache-2.0: its NOTICE and licence are
  now in THIRD-PARTY-NOTICES.txt.
- Messages without em dashes, and the new code lint-clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants