Skip to content

feat(projects): adopt external Template Instances as Brain Projects - #299

Draft
norberia wants to merge 1 commit into
mainfrom
feat/adopt-template-instance
Draft

feat(projects): adopt external Template Instances as Brain Projects#299
norberia wants to merge 1 commit into
mainfrom
feat/adopt-template-instance

Conversation

@norberia

Copy link
Copy Markdown
Contributor

Summary

  • Adds POST /api/projects/adopt-template-instance so a Sealos Skills Template apply can be claimed as a Brain Project (Postgres row + brain.io/* ownership labels) without changing the GitHub extraLabels-at-create path.
  • Namespace comes only from the kubeconfig; identity is Instance UID. Same UID is idempotent; a reused name with a new UID is a new Project. Explorer does not gain an adopting/failed product status.
  • Skills follow-up (post-apply POST, skip when SEALAI_DEPLOY_TASK_ID is set, keep cloud.sealos.io/deploy-on-sealos) is documented in skills-template-instance-adoption.md.

Closes nothing in this repo. Spec: labring/sealos-private#116. ADR 0067.

Test plan

  • bun test src/lib/project-persistence/adopt-template-instance.test.ts src/app/api/projects/adopt-template-instance/route.test.ts from apps/ui
  • First adopt: one Project, Instance + children labeled, counts in the response
  • Repeat same UID: same project.id; new UID with the same name: new Project
  • Foreign brain.io/project-id → 409; PATCH failure → 502 then retry resumes the same Project
  • Body namespace is ignored; missing kubeconfig is 401
  • Managed GitHub deploy (SEALAI_DEPLOY_TASK_ID) is unchanged and must not call this API

Made with Cursor

Skills apply Template YAML without a Brain Project. Claim-after-apply
creates the Project row and stamps ownership labels so Explorer and
cleanup keep working.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant