Skip to content

feat(cli,deployments): --auto-attach flag and gram.deploy.json auto_attach#2852

Open
simplesagar wants to merge 1 commit into
sagar/age-1377-auto-sync-activityfrom
sagar/age-1377-cli-auto-attach
Open

feat(cli,deployments): --auto-attach flag and gram.deploy.json auto_attach#2852
simplesagar wants to merge 1 commit into
sagar/age-1377-auto-sync-activityfrom
sagar/age-1377-cli-auto-attach

Conversation

@simplesagar
Copy link
Copy Markdown
Member

Summary

Closes the customer-facing loop on AGE-1377. `gram push --auto-attach my-mcp` (or `auto_attach: ["my-mcp"]` in `gram.deploy.json`) sets up the toolset's subscription to this push's function sources before the workflow runs. New tool URNs from subsequent pushes flow automatically via the activity from #2850.

Stacks on #2850. Final rebase to `main` once #2834, #2848, and #2850 land.

Surface

Server

  • `CreateDeploymentForm.auto_attach_toolset_slugs` — set on the initial `replace` push.
  • `EvolveForm.auto_attach_toolset_slugs` — set on the default `merge` push.
  • New `AddAutoSyncSourcesBySlug` sqlc query — set-unions `"function:"` entries into the toolset's column, runs in the same transaction as the deployment write.
  • Unknown slug → 404. Missing function sources → 400 (auto-attach is a function-source concept today).

CLI

  • `--auto-attach ` — `StringSliceFlag`, repeatable.
  • `gram.deploy.json` gains optional `auto_attach: ["slug-a", "slug-b"]`.
  • Both layer via set-union (`mergeAutoAttach`): CI workflows that write the config still work; local pushes can layer extra slugs without editing the file.

Test plan

  • `mise build:server` clean
  • `go build ./...` in `cli/` clean
  • `go test ./internal/app/ -run TestMergeAutoAttach` — 6 cases pass
  • Server-side behavior covered indirectly by feat(background): auto-sync subscribed toolsets on deployment complete #2850's activity tests (which prove the column drives extension correctly)
  • Reviewer: confirm the 400-on-missing-functions semantics is right for the `auto_attach` case. Alternative is a silent no-op — I lean toward 400 because forgetting the function source in a `--auto-attach` push is almost always a mistake worth surfacing.
  • Manual smoke: `gram stage function ... && gram push --auto-attach my-mcp` against local dev should bump the toolset version with the new URNs (PR 5's dashboard card will make this visually obvious; today it's visible via `gettoolset`).

🤖 Generated with Claude Code

…ttach

Customer-facing entry point for AGE-1377. A `gram push --auto-attach
my-mcp` (or `auto_attach: ["my-mcp"]` in gram.deploy.json, or both --
they set-union) subscribes the named toolsets to every function source
in this push. On subsequent pushes, the AutoSyncToolsets activity from
the previous PR appends any new tool URNs automatically.

Server side:
- CreateDeploymentForm and EvolveForm gain auto_attach_toolset_slugs.
- toolsets.AddAutoSyncSourcesBySlug query set-unions
  "function:<slug>" entries into each toolset's auto_sync_sources,
  inside the same transaction that records the deployment, so the
  workflow's AutoSyncToolsets activity sees the updated subscription.
- Unknown slug returns 404.
- Missing functions in the deployment returns 400 (auto-attach is a
  function-source concept today).

CLI side:
- PushOptions.AutoAttach plumbs into workflow.CreateDeployment and
  workflow.EvolveDeployment.
- mergeAutoAttach() de-dups the union of flag + config; deterministic
  ordering for tests.
- StringSliceFlag is repeatable: `--auto-attach a --auto-attach b`.

Tests: 6 cases on mergeAutoAttach covering both-empty, single-source,
union ordering, dedup, and empty-string filtering. The server-side
behavior is exercised indirectly via PR 3's auto-sync activity test
(which proves the column drives extension correctly).

Stacks on #2850. Refs AGE-1377.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@simplesagar simplesagar requested a review from a team as a code owner May 15, 2026 04:30
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

AGE-1377

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment May 15, 2026 4:30am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: 9887a39

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant