mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
The merged branch moved every role-local script out of files/ into a folder named for its language (files/python/, files/php/, files/shell/), but the moves lost their staging and never landed. HEAD still carried the old paths while the worktree had the new ones. Move the 24 remaining scripts and update the six places that resolve them: the mcp-adapter instance/isolation/probe tasks, the litellm key task, the adapter README and the endpoint-path lint. Every changed line in those files is a path. Also drop roles/sys-svc-compose/files/swarm/stack_ready.sh, a stale duplicate of the copy already tracked under files/shell/swarm/. The added comments are the branch's own `nocheck: mirrored-unit-test` directives, which state why a script whose measurement only exists inside its container cannot have a mirrored unit test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
# nocheck: mirrored-unit-test - imports baserow.core and django at module level and
|
|
# writes through the ORM inside `baserow-cli`; neither the framework nor a database is
|
|
# available outside the Baserow image
|
|
import os
|
|
|
|
from baserow.core.handler import CoreHandler
|
|
from baserow.core.mcp.models import MCPEndpoint
|
|
from baserow.core.models import UserProfile, WorkspaceUser
|
|
from django.contrib.auth import get_user_model
|
|
|
|
email = os.environ["MCP_OWNER_EMAIL"]
|
|
workspace_name = os.environ["MCP_WORKSPACE_NAME"]
|
|
endpoint_name = os.environ["MCP_ENDPOINT_NAME"]
|
|
key = os.environ["MCP_ENDPOINT_KEY"]
|
|
|
|
User = get_user_model()
|
|
|
|
owner, owner_created = User.objects.get_or_create(
|
|
username=email,
|
|
defaults={"email": email, "first_name": endpoint_name},
|
|
)
|
|
|
|
if owner_created:
|
|
owner.set_unusable_password()
|
|
owner.save()
|
|
|
|
UserProfile.objects.get_or_create(
|
|
user=owner,
|
|
defaults={"email_verified": True, "completed_onboarding": True},
|
|
)
|
|
|
|
membership = WorkspaceUser.objects.filter(
|
|
user=owner, workspace__name=workspace_name
|
|
).first()
|
|
|
|
if membership is None:
|
|
membership = CoreHandler().create_workspace(owner, name=workspace_name)
|
|
|
|
previous_key = (
|
|
MCPEndpoint.objects.filter(
|
|
user=owner, workspace=membership.workspace, name=endpoint_name
|
|
)
|
|
.values_list("key", flat=True)
|
|
.first()
|
|
)
|
|
|
|
MCPEndpoint.objects.update_or_create(
|
|
user=owner,
|
|
workspace=membership.workspace,
|
|
name=endpoint_name,
|
|
defaults={"key": key},
|
|
)
|
|
|
|
print("CHANGED" if owner_created or previous_key != key else "UNCHANGED")
|