Add artifact delete endpoint and API test suite; drop internal-only docs from tracking

Adds DELETE /api/artifacts/{id}, exposes supported HTTP methods via
/api/capabilities, and adds a tests/api/ suite covering create/list/detail/
patch/delete lifecycle. Also stops tracking _archive_/, planning/, and
opencode.json, which carry home-infrastructure details and local-machine-only
config not meant to ship in this repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
peter 2026-09-01 21:54:46 +01:00
parent bf8d1fe244
commit f92f34dfae
16 changed files with 298 additions and 1728 deletions

View file

@ -243,6 +243,16 @@ class ArtifactDetailView(APIView):
)
return Response(serialize_artifact(artifact, request))
def delete(self, request, artifact_id):
user = resolve_token_user(request)
if user is None:
return HttpResponseForbidden("Invalid or missing API token")
artifact = get_object_or_404(Artifact, pk=artifact_id, owner=user)
delete_artifact_files(artifact)
artifact.delete()
return Response(status=204)
class CapabilitiesView(APIView):
"""Static capability info. Reachable by a logged-in session or a valid API token,
@ -259,6 +269,11 @@ class CapabilitiesView(APIView):
"raw_supported_for": [Artifact.MARKDOWN, Artifact.HTML_FULL],
"source_types": [choice[0] for choice in Artifact.SOURCE_TYPE_CHOICES],
"auth": "bearer_token",
"methods": {
"/api/artifacts": ["GET", "POST"],
"/api/artifacts/{id}": ["GET", "PATCH", "DELETE"],
"/api/assets": ["POST"],
},
}
)