{% for instance in instances %}{% include 'dashboard/widget_card.html' %}{% endfor %}
@@ -10,5 +10,5 @@
{% include 'dashboard/widgets/buienradar.html' %}
{{ catalogue|length|json_script:"widget-count" }}
-
+
{% endblock %}
diff --git a/dashboard/tests/companion_movement.html b/dashboard/tests/companion_movement.html
new file mode 100644
index 0000000..bb46967
--- /dev/null
+++ b/dashboard/tests/companion_movement.html
@@ -0,0 +1,305 @@
+
+Companion movement checks
+
Running…
+
+
diff --git a/docs/card-attachments.md b/docs/card-attachments.md
new file mode 100644
index 0000000..f9cb1fa
--- /dev/null
+++ b/docs/card-attachments.md
@@ -0,0 +1,23 @@
+# Card and progress-note attachments
+
+Attachments are stored as private files with metadata in `CardAttachment`. A file belongs to one card, and optionally one `CardComment` progress note on that card. Moving a card keeps its files. Deleting a note or card cascades to its attachment records and removes stored files. Explicit deletion also removes the bytes. Files are snapshots; `source_path` and `source_commit` record provenance but do not cause automatic refresh.
+
+## Configuration
+
+Set `PROJECTS_PRIVATE_MEDIA_ROOT` to a persistent directory outside any web server static or public media alias. The default is `private_media/` under the repository for local development. Back up this directory alongside the database. The application account needs read/write access. No `MEDIA_URL` or public media route is configured.
+
+Limits default to 10 MiB per file, 50 files and 100 MiB per card. Override with `PROJECTS_ATTACHMENT_MAX_BYTES`, `PROJECTS_ATTACHMENT_MAX_FILES` and `PROJECTS_ATTACHMENT_MAX_CARD_BYTES`. MCP base64 upload/fetch has a stricter 2 MiB limit to bound tool payloads. The accepted extensions are UTF-8 text/code (`txt`, `md`, `py`, `js`, `ts`, `tsx`, `jsx`, `json`, `css`, `html`, `xml`, `csv`, `yaml`, `yml`, `sh`, `diff`, `patch`) and PNG, JPEG, WebP, PDF. HTML is always served as plain text. SVG and archives are rejected. Files are not extracted or executed. Download responses use `Content-Disposition: attachment`, `nosniff`, and `no-store`.
+
+## Web use
+
+On a card page, upload multiple files in **Card files** or beneath a specific progress note. The form works without JavaScript; JavaScript adds drag and drop, progress and inline error feedback. The card and note sections share a simple list. Safe images up to 1 MiB have a thumbnail and preview link; UTF-8 text up to 1 MiB has a text preview. Other files download. Rename changes only the display title. Deleting requires confirmation.
+
+All reads require project access. Upload, rename and delete require editor or owner access. Django session forms use CSRF. An attachment ID alone does not grant access.
+
+## MCP transfer
+
+`attachments_list(card_id, comment_id?, limit?, offset?)` returns metadata for card and note files. `attachments_get(attachment_id)` returns metadata. `attachments_fetch(attachment_id)` returns exact `content_base64`, SHA-256, and decoded `text` for UTF-8 files. `attachments_upload(card_id, filename, content_base64, comment_id?, title?, description?, source_path?, source_commit?)` transfers bytes to the server. `attachments_update` changes display metadata; `attachments_delete` removes bytes and metadata. Read tools require `projects:read`; writes require `projects:write`. Each tool checks card access. A remote server never reads a caller's filesystem path.
+
+For a local repository snapshot, read the file locally, calculate its SHA-256, base64 encode the bytes, then call `attachments_upload` with the target card and progress-note IDs. Include a repository-relative `source_path` and a Git commit SHA when available. Compare the returned SHA-256; `attachments_fetch` lets another client verify exact bytes. If a working-tree file differs from the recorded commit, describe that in the progress note; `source_commit` alone cannot establish the working-tree state.
+
+The tool output uses standard base64 in structured JSON so clients can reconstruct binary files. Client support for passing generated image bytes into a tool, exposing large tool payloads, and rendering fetched images must be checked against a deployed MCP connection. The local tests exercise the actual MCP tool call path for text bytes and permission denial; they cannot establish compatibility with a remote ChatGPT client before deployment.
diff --git a/docs/companion-movement.md b/docs/companion-movement.md
new file mode 100644
index 0000000..8a8023b
--- /dev/null
+++ b/docs/companion-movement.md
@@ -0,0 +1,17 @@
+# Companion movement prototype
+
+`dashboard/static/dashboard/companion.js` is a browser-only, framework-independent movement core. A host creates `new BrowserCompanion({ surfaces, name, reducedMotion, config, debug, debugSpeed })`; `surfaces()` returns `{ element, edge: 'top' | 'bottom', card?, explicit? }` entries. The host owns DOM discovery, preferences, and lifecycle. The core owns geometry validation, the directed route graph, movement and the coloured-square renderer. A host may supply a renderer implementing `render(position, state, name)` and `destroy()`.
+
+`bodySize` is the collision-body height in CSS pixels, independent of future sprite padding. Distance settings ending in `S` are multiples of that size. Speed settings ending in `SPerSec` use those units per second. Durations are milliseconds. `configure()` clamps invalid numeric overrides and ignores unknown keys. The defaults are initial visual tuning values, not animal measurements.
+
+An ordinary nested ledge needs a visible computed top border of at least 1 CSS pixel. Climb edges need visible left or right borders. Outer widget top and bottom edges are explicit known surfaces. Interactive controls are excluded unless a host deliberately opts one in. Geometry reads are performed on host refresh events, not each animation frame. The Project Manager adapter refreshes after grid changes, scrolling, resizing and widget mount or removal.
+
+Directed routes include short jumps, steps, walks, side climbs and bounded drops. A short attach hop can bridge the normal grid gap to a visible climb edge if its rise stays within `maxJumpRiseS`; this allows a safe drop to a lower card to be followed by a climb back. Downward climbing is not enabled. If a destination cannot be reached through a complete safe route, the companion idles or patrols its current ledge. Page scroll keeps its position attached to the source element. A disappearing destination cancels the move and recovers only to a nearby valid ledge; otherwise the box is hidden until a safe anchor appears. Background tabs pause motion, and reduced motion stops autonomous movement.
+
+The activity scheduler has calm, active and resting modes. Normal calm idle lasts 12–20 seconds, sleep 20–45 seconds, and purring/batting 2.2–3.8 seconds. Active bursts plan 2–5 safe transitions before returning to calm; short movement pauses do not choose unrelated passive states. Emote and sleep cooldowns prevent rapid cycling. Rest becomes more likely after repeated bursts. These bounds and activity weights are host-overridable through `config`. For local debugging only, `?companionFast` scales dwell and cooldown time by 10 without changing movement safety or turning on the visual debug overlay.
+
+Append `?companionDebug` to the dashboard URL to show ledges, climb edges, graph transitions, rejected element marks, active route and movement limits. The overlay is disabled by default and never receives pointer events.
+
+The debug label also shows the current state reason, recent timestamped transitions, mode, remaining burst steps, next dwell timer, active motion phase, and the number of safe jump/drop edges available from the current platform. `landing` lasts 260 ms and is entered only after an airborne jump, drop, or climb hop. Walking, pull-ups, reflow, and completed routes settle to `idle` instead.
+
+The dependency-free browser checks live in `dashboard/tests/companion_movement.html`. Serve the repository root with a local static server and open that page; every line should report `PASS`. The Django dashboard suite remains runnable with `.venv/bin/python manage.py test dashboard`.
diff --git a/docs/research/project-documentation-wiki-evaluation.md b/docs/research/project-documentation-wiki-evaluation.md
new file mode 100644
index 0000000..a9d3576
--- /dev/null
+++ b/docs/research/project-documentation-wiki-evaluation.md
@@ -0,0 +1,81 @@
+# Project documentation and MCP evaluation
+
+Research snapshot: 20 October 2026. Repository inspected at `dd1ee39` with uncommitted local changes; this report makes no runtime changes.
+
+## Recommendation
+
+**Go for a small native Django documentation module; do not install or fork a wiki for the MVP.** Treat the repository's Markdown files as the source of truth. Import a versioned, project-scoped snapshot into the database for browsing and MCP retrieval, then show its source commit and freshness on every read. This gives agents a bounded, searchable map of project context without rescanning the repository each time. The database index is a cache of a declared Git snapshot, not an independent authority.
+
+The first milestone should be **read-only documentation**: upload a Markdown ZIP, review its preview, publish the imported snapshot, browse a tree, search, and use `docs_list`, `docs_search`, and `docs_read` over MCP. Do not accept MCP edits until there is a concrete export/reconciliation workflow. Later edits can be proposed revisions with an explicit base source commit and document hash, downloaded as Markdown ZIP or applied through a separately approved Git workflow. Never silently alter the published snapshot or repository.
+
+## Evidence in this project
+
+| Existing part | Reuse / gap |
+| --- | --- |
+| `projects/models.py`: `Project` has `git_repository_url`, owner, and `Membership`; `Card` and `CardRevision` store Markdown and revisions | Reuse project identity and access policy. The URL is metadata only; neither Django nor MCP clones repositories. Documents need their own path, source commit/hash, and version model, separate from Kanban cards. |
+| `projects/services.py`: `accessible()` and `project_for(..., write=True)` | Reuse for **every** document query and mutation. Owner/editor can import; viewer can read. Do not rely only on template visibility or Django's global model permissions. |
+| `projects/templatetags/project_markdown.py` | Python-Markdown plus `nh3` already sanitizes rendered HTML. Extract a shared renderer function and use it for docs; add a controlled link resolver for relative `.md` links. Current sanitizer allows only `http`, `https`, and `mailto` URLs, so ordinary relative links are stripped until resolved. |
+| `projects/views.py`, `projects/urls.py` | Authenticated project pages and CSRF-protected POST patterns already exist. Add project-scoped docs routes and a navigation link without changing the board data model. |
+| `mcp_server/server.py` | MCP uses `MCPServer`, `projects:read`/`projects:write`, `_project`, `_safe`, and bounded list patterns. Add document tools through the same service layer. Current `cards_search` and `search_global` return full Markdown per hit; docs search should return short snippets and metadata to stay useful at scale. |
+| `config/settings.py` | SQLite is the configured database. Design search to work with SQLite first; consider SQLite FTS5 after profiling. PostgreSQL search is not a current dependency. |
+| `projects/attachments.py`, `docs/card-attachments.md` | Useful reference for private storage, upload limits, and provenance, but card attachments do not provide a navigable documentation tree or searchable document text. |
+
+## Candidate comparison
+
+| Candidate | Current release / licence | Fit and integration cost | Verdict |
+| --- | --- | --- | --- |
+| [django-wakawaka](https://pypi.org/project/django-wakawaka/) | 1.7, 7 Feb 2026; MIT. Its published compatibility matrix ends at Django 5.2, with no declared Django 6.1 test. | Small dependency, but its [model](https://github.com/bartTC/django-wakawaka/blob/main/wakawaka/models.py) has a global `slug`, no project foreign key; [views](https://github.com/bartTC/django-wakawaka/blob/main/wakawaka/views.py) query all pages and use global Django permissions. Its [page template](https://github.com/bartTC/django-wakawaka/blob/main/wakawaka/templates/wakawaka/page.html) uses `urlize|wikify|linebreaks`, not Markdown. Replacing the template is easy, but adding project isolation, paths, imports, source snapshots, and MCP would replace much of its behavior. The inspected revision view also looks up a revision by ID without checking it belongs to the requested page, making a direct integration unsuitable for project-private docs. | No dependency or fork for MVP. Retest Django 6.1 only if considering it later. |
+| [django-wiki (`wiki`)](https://pypi.org/project/wiki/) | 0.13.0, 31 Jul 2026; GPL-3.0. [Package metadata](https://github.com/django-wiki/django-wiki/blob/main/pyproject.toml) requires `Django>=4.2,<6.1` and several app dependencies. | Mature, revisioned wiki with Markdown and tree features, but dependency constraint conflicts with this repo's `Django>=6.1,<6.2`. Its plugin and renderer stack would add a second content system. | No-go on current stack. |
+| [Waliki](https://pypi.org/project/waliki/) | 0.8.1, 26 Mar 2017; BSD. | Git-backed premise is attractive, but its published documentation targets Django 1.8/1.9-era Python. No evidence of current Django 6.1 compatibility. | No-go; major port/fork risk. |
+| [djiki](https://pypi.org/project/djiki/) | 0.9, 1 May 2022; BSD-3-Clause. | Its inspected models use globally unique page titles/language, not project-scoped file paths. Published classifiers stop at Python 3.10, with no current Django 6.1 evidence. | No-go for this use case. |
+| Native Django docs module | No new wiki dependency or third-party licence | Smallest domain fit: project/path uniqueness, Git provenance, import preview, permission checks, MCP output shape, and existing sanitizer can be designed together. | Recommended. |
+
+The Wakawaka renderer verdict is especially clear: there is no Markdown renderer to replace. A template override could call `safe_markdown`, but the default CamelCase substitution and global data model still conflict with normal repository Markdown. Forking it would create long-term maintenance without removing the custom work.
+
+## Proposed shape
+
+1. `ProjectDocument`: `project`, normalized case-preserving POSIX `path` (e.g. `README.md`, `docs/architecture/mcp.md`), raw Markdown, content SHA-256, title extracted from heading or filename, `revision`, source commit, imported time, and status. Unique `(project, path)`; index `(project, path)` and search fields. A separate `DocumentRevision` stores immutable previous content, actor, timestamp, and source/proposal type if editing is added.
+2. `DocumentSnapshot` or import batch records project, source commit supplied by uploader, ZIP hash, imported time, counts, and outcome. Record whether the commit was verified against a trusted repository checkout; an uploader-supplied SHA alone is **unverified provenance**. A published snapshot stays queryable until a complete replacement succeeds. Display freshness as "as of commit X / imported at Y"; do not claim current Git state unless verified.
+3. Navigation is generated from paths, with `README.md` as landing page when present and `AGENTS.md` visible as a first-class context file. Preserve exact Markdown text for MCP. Resolve relative links against the source document's parent path; rewrite only links to imported documents and anchors. External links retain the current sanitizer's URL restrictions. Report broken internal links on import.
+4. A project docs page offers tree, search, raw/view modes, source commit, stale/unverified badge, and import/export controls for editors. Missing docs state explains how to upload an archive. Use normal login, CSRF, and project authorization. Do not show a success state after a partial import failure.
+
+### MCP contract and agent context
+
+| Tool | Return shape / controls |
+| --- | --- |
+| `docs_list(project, prefix?, cursor?, limit?)` | Paths, titles, hashes, revision, snapshot/commit, modified time; stable path order, at most 100 items, cursor pagination. |
+| `docs_search(query, project?, cursor?, limit?)` | Search only accessible projects; path/title, bounded excerpt, project ID, commit/hash, and direct read locator. Limit query and excerpt size. Search metadata first, full text second. Do not return whole files per hit. |
+| `docs_read(project, path, revision?, start_line?, line_count?)` | Exact Markdown or a bounded line window, total line count, hash, source commit, verified/stale status, canonical path. Reject invalid paths and excessive output; permit explicit paging for large files. |
+
+For the user's memory goal, start each work session with `docs_list` or targeted `docs_search`, then `docs_read` for the few relevant files. A small curated `docs/PROJECT_CONTEXT.md` or existing `AGENTS.md` can point to architecture, conventions, deployment, and current decisions; the index should not auto-concatenate all documents into every response. Keep path/hash/commit in replies so the agent can tell when context is old and inspect live source before changing code. The docs index reduces repeated discovery, but it cannot guarantee that unimported code changes are reflected.
+
+Later `docs_create`/`docs_update` should require `projects:write`, project editor rights, normalized path, size cap, and `expected_revision` plus `base_source_commit`/content hash. Store proposals separately from published Git-backed content. Guard deletion as a proposal or tombstone, with explicit export and conflict handling. No direct Git fetch/push, credentials, or arbitrary filesystem paths in MVP.
+
+## ZIP workflow and controls
+
+Preview before commit: accept only UTF-8 `.md` files from declared roots (`README.md`, `AGENTS.md`, `docs/**` or a selected docs subtree); display additions, changes, removals, broken links, and conflict warnings. Reject duplicate normalized paths, absolute paths, `..`, backslashes or ambiguous separators, symlinks and other nonregular entries, hidden control files, and oversized archives. Bound compressed bytes, expanded bytes, file count, per-file bytes, compression ratio, and nesting depth; inspect ZIP metadata before reading and stream under limits. Normalize Unicode and define case-collision behavior. Require the expected previous snapshot ID/commit before a re-import; publish atomically. Export Markdown paths plus a manifest with source commit and hashes; exclude server-only metadata and secrets. Import must never extract directly into the repository or execute contents.
+
+## Work estimate and stages
+
+These are rough engineering estimates, not commitments; integration and review may change them.
+
+| Stage | Scope | Estimate |
+| --- | --- | --- |
+| 1 | Models/migrations, service authorization, path validation, snapshot provenance, tests | 2–3 days |
+| 2 | ZIP preview/import/export, limits, link checks, atomic replacement, tests | 2–4 days |
+| 3 | Browsing/search UI, renderer/link adapter, accessible states | 2–3 days |
+| 4 | Read-only MCP tools, pagination/output limits, permission tests | 1–2 days |
+| Later | Proposed edits/reconciliation/export, conflict handling | 2–4 days after workflow decision |
+
+An MVP is roughly **7–12 engineering days**. The main uncertainties are archive scale, exact desired Git provenance, and whether a read-only import meets the workflow. No implementation is blocked by a missing wiki library.
+
+## Decisions before implementation
+
+- Choose the ingestion boundary: manual ZIP upload first (recommended) or trusted server-side checkout. The current Git URL is metadata and must not become an arbitrary fetch target without host allowlisting, credential design, and SSRF controls.
+- Choose whether the initial import mirrors only tracked documentation files or allows uploaded notes not in Git. If Git is authoritative, label non-Git notes separately.
+- Decide when a snapshot is considered stale. An import timestamp alone cannot prove repository freshness; a trusted commit check or explicit manual refresh is needed.
+- Decide whether cross-project `docs_search` should be enabled for every authorized membership or opt-in for sensitive projects. The existing MCP `search_global` searches across all accessible projects, so the former is consistent with present behavior.
+
+## Sources and inspection method
+
+Local sources: `requirements.txt`, `config/settings.py`, `projects/models.py`, `projects/services.py`, `projects/views.py`, `projects/templatetags/project_markdown.py`, `mcp_server/server.py`, `projects/attachments.py`, and `README.md`. Upstream release metadata came from the linked PyPI pages; package source distributions were inspected directly for models, views, templates, and dependency declarations. These findings establish design fit, not runtime compatibility tests against Django 6.1.
diff --git a/mcp_server/server.py b/mcp_server/server.py
index daab669..12b9d8b 100644
--- a/mcp_server/server.py
+++ b/mcp_server/server.py
@@ -1,5 +1,7 @@
"""Streamable HTTP MCP server for project management. Run on port 8766."""
import os
+import base64
+import binascii
from datetime import date
from typing import Any, Literal
from urllib.parse import urlsplit
@@ -28,7 +30,8 @@ from mcp.server.transport_security import TransportSecuritySettings
from pydantic import AnyHttpUrl
from projects import services
-from projects.models import Activity, Card, CardComment, CardRevision, Column, Project, Tag
+from projects.models import Activity, Card, CardComment, CardRevision, CardAttachment, Column, Project, Tag
+from projects import attachments
def _verified(raw):
@@ -101,7 +104,7 @@ def _column_data(column):
def _safe(operation):
try:
return operation()
- except (Http404, Project.DoesNotExist, Card.DoesNotExist, Column.DoesNotExist, CardRevision.DoesNotExist, Tag.DoesNotExist, get_user_model().DoesNotExist):
+ except (Http404, Project.DoesNotExist, Card.DoesNotExist, Column.DoesNotExist, CardRevision.DoesNotExist, CardAttachment.DoesNotExist, Tag.DoesNotExist, get_user_model().DoesNotExist):
raise ToolError('not_found: project or card is unavailable')
except PermissionDenied:
raise ToolError('permission_denied: write access required')
@@ -261,6 +264,14 @@ def create_server():
return _card_data(services.update_card(user, card, expected_revision=expected_revision, origin='mcp', **values))
return await sync_to_async(lambda: _safe(run))()
+ @server.tool(structured_output=True, description='Preview or atomically update 1–100 cards in one project. Supply every card ID and current revision. Changes may contain column_id, priority, assignee_id (null clears), or tag_ids (empty list clears). Dry run has no writes. Retries require the same idempotency key and payload.')
+ async def cards_bulk_update(project: str, card_ids: list[str], expected_revisions: dict[str, int], changes: dict[str, Any], dry_run: bool = True, idempotency_key: str | None = None) -> dict[str, Any]:
+ def run():
+ user = _actor('projects:write')
+ p = _project(user, project, write=True)
+ return services.bulk_update_cards(user, p, card_ids, expected_revisions, changes, dry_run=dry_run, idempotency_key=idempotency_key, origin='mcp')
+ return await sync_to_async(lambda: _safe(run))()
+
@server.tool(structured_output=True, description='List cards in an accessible project; filter by priority, column, or archived state.')
async def cards_list(project: str, priority: Literal['low', 'medium', 'high'] | None = None, card_type: Literal['feature', 'bug', 'task', 'research', 'idea'] | None = None, column_id: str | None = None, tag_id: int | None = None, assignee_id: int | None = None, archived: bool = False, limit: int = 50, offset: int = 0) -> dict[str, Any]:
def run():
@@ -314,6 +325,72 @@ def create_server():
return {'items': [{'id': c.pk, 'body': c.body, 'author_id': c.author_id, 'created_at': c.created_at.isoformat()} for c in card.comments.order_by('-created_at')[:min(max(limit, 1), 100)]]}
return await sync_to_async(lambda: _safe(run))()
+ @server.tool(structured_output=True, description='List card and progress-note attachment metadata. Set comment_id to limit to one progress note; otherwise includes both kinds. Paginated, with a card UUID required.')
+ async def attachments_list(card_id: str, comment_id: int | None = None, limit: int = 50, offset: int = 0) -> dict[str, Any]:
+ def run():
+ card = _card(_actor(), card_id)
+ qs = CardAttachment.objects.filter(card=card).order_by('created_at', 'id')
+ if comment_id is not None:
+ if not card.comments.filter(pk=comment_id).exists(): raise ValidationError('Progress note does not belong to this card.')
+ qs = qs.filter(comment_id=comment_id)
+ return {'items': [attachments.attachment_data(a) for a in qs[max(offset, 0):max(offset, 0) + min(max(limit, 1), 100)]], 'total': qs.count()}
+ return await sync_to_async(lambda: _safe(run))()
+
+ @server.tool(structured_output=True, description='Get attachment metadata by stable UUID after checking access to its card.')
+ async def attachments_get(attachment_id: str) -> dict[str, Any]:
+ def run():
+ item = CardAttachment.objects.get(pk=UUID(attachment_id))
+ _card(_actor(), str(item.card_id))
+ return attachments.attachment_data(item)
+ return await sync_to_async(lambda: _safe(run))()
+
+ @server.tool(structured_output=True, description='Fetch exact attachment bytes as base64 (maximum 2 MiB), with SHA-256 and UTF-8 text for supported text files. Access to the card is required.')
+ async def attachments_fetch(attachment_id: str) -> dict[str, Any]:
+ def run():
+ item = CardAttachment.objects.get(pk=UUID(attachment_id))
+ _card(_actor(), str(item.card_id))
+ if item.byte_size > attachments.MAX_MCP_BYTES: raise ValidationError('Attachment exceeds MCP fetch limit; download via the authenticated web UI.')
+ with item.file.open('rb') as stream: data = stream.read(attachments.MAX_MCP_BYTES + 1)
+ if len(data) != item.byte_size: raise ValidationError('Stored file size differs from metadata.')
+ result = {**attachments.attachment_data(item), 'content_base64': base64.b64encode(data).decode('ascii')}
+ if item.mime_type == 'text/plain': result['text'] = data.decode('utf-8')
+ return result
+ return await sync_to_async(lambda: _safe(run))()
+
+ @server.tool(structured_output=True, description='Upload exact file bytes encoded as standard base64 to a card or specified progress note. Maximum 2 MiB. Optional source_path and source_commit record an immutable repository snapshot; server paths are never read.')
+ async def attachments_upload(card_id: str, filename: str, content_base64: str, comment_id: int | None = None, title: str = '', description: str = '', source_path: str = '', source_commit: str = '') -> dict[str, Any]:
+ def run():
+ user = _actor('projects:write'); card = _card(user, card_id, write=True)
+ if len(content_base64) > (attachments.MAX_MCP_BYTES * 4 // 3 + 8): raise ValidationError('MCP upload exceeds 2 MiB.')
+ try: data = base64.b64decode(content_base64, validate=True)
+ except (binascii.Error, ValueError): raise ValidationError('Invalid base64 content.')
+ if len(data) > attachments.MAX_MCP_BYTES: raise ValidationError('MCP upload exceeds 2 MiB.')
+ item = attachments.upload_attachment(user, card, filename=filename, data=data, comment_id=comment_id,
+ title=title, description=description, source='mcp', source_path=source_path, source_commit=source_commit)
+ return attachments.attachment_data(item)
+ return await sync_to_async(lambda: _safe(run))()
+
+ @server.tool(structured_output=True, description='Update an attachment display title or description. File bytes and provenance remain unchanged.')
+ async def attachments_update(attachment_id: str, title: str | None = None, description: str | None = None) -> dict[str, Any]:
+ def run():
+ item = CardAttachment.objects.get(pk=UUID(attachment_id))
+ _card(_actor('projects:write'), str(item.card_id), write=True)
+ if title is not None: item.title = title.strip()
+ if description is not None: item.description = description
+ item.full_clean(); item.save(update_fields=['title', 'description'])
+ return attachments.attachment_data(item)
+ return await sync_to_async(lambda: _safe(run))()
+
+ @server.tool(structured_output=True, description='Delete a card or progress-note attachment and its stored bytes after checking card write access.')
+ async def attachments_delete(attachment_id: str) -> dict[str, Any]:
+ def run():
+ item = CardAttachment.objects.select_related('card__project').get(pk=UUID(attachment_id))
+ user = _actor('projects:write'); _card(user, str(item.card_id), write=True)
+ identifier = str(item.pk)
+ attachments.delete_attachment(user, item, source='mcp')
+ return {'id': identifier, 'deleted': True}
+ return await sync_to_async(lambda: _safe(run))()
+
@server.tool(structured_output=True, description='List card activity and revision numbers.')
async def cards_history(card_id: str, limit: int = 50) -> dict[str, Any]:
def run():
diff --git a/projects/apps.py b/projects/apps.py
index afae498..a94b2ce 100644
--- a/projects/apps.py
+++ b/projects/apps.py
@@ -4,3 +4,13 @@ from django.apps import AppConfig
class ProjectsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'projects'
+
+ def ready(self):
+ from django.db.models.signals import post_delete
+ from .models import CardAttachment
+
+ def remove_stored_file(sender, instance, **kwargs):
+ if instance.file:
+ instance.file.delete(save=False)
+
+ post_delete.connect(remove_stored_file, sender=CardAttachment, weak=False, dispatch_uid='projects.remove_attachment_file')
diff --git a/projects/attachments.py b/projects/attachments.py
new file mode 100644
index 0000000..bddc596
--- /dev/null
+++ b/projects/attachments.py
@@ -0,0 +1,102 @@
+"""Private, card-scoped attachment validation and storage."""
+import hashlib
+from pathlib import PurePath
+from uuid import uuid4
+
+from django.conf import settings
+from django.core.exceptions import ValidationError
+from django.core.files.base import ContentFile
+from django.db import transaction
+from django.db.models import Sum
+from django.utils.text import get_valid_filename
+
+from .models import Activity, Card, CardAttachment, CardComment
+
+
+TEXT_EXTENSIONS = {'.txt', '.md', '.py', '.js', '.ts', '.tsx', '.jsx', '.json', '.css', '.html', '.xml', '.csv', '.yaml', '.yml', '.sh', '.diff', '.patch'}
+SIGNATURES = {'.png': (b'\x89PNG\r\n\x1a\n', 'image/png'), '.jpg': (b'\xff\xd8\xff', 'image/jpeg'), '.jpeg': (b'\xff\xd8\xff', 'image/jpeg'), '.webp': (b'RIFF', 'image/webp'), '.pdf': (b'%PDF-', 'application/pdf')}
+MAX_MCP_BYTES = 2 * 1024 * 1024
+
+
+def attachment_data(item):
+ return {'id': str(item.pk), 'card_id': str(item.card_id), 'comment_id': item.comment_id,
+ 'title': item.title, 'original_filename': item.original_filename,
+ 'mime_type': item.mime_type, 'byte_size': item.byte_size, 'sha256': item.sha256,
+ 'description': item.description, 'uploaded_by_id': item.uploaded_by_id,
+ 'source': item.source, 'source_path': item.source_path, 'source_commit': item.source_commit,
+ 'created_at': item.created_at.isoformat()}
+
+
+def _validated_name(name):
+ # Reject path components rather than silently changing their meaning.
+ if not name or len(name) > 255 or '\\' in name or '/' in name or name in {'.', '..'}:
+ raise ValidationError('Use a filename without a path.')
+ clean = get_valid_filename(name)
+ if not clean or clean.startswith('.'):
+ raise ValidationError('Invalid filename.')
+ return clean
+
+
+def _detected_type(name, data):
+ suffix = PurePath(name).suffix.lower()
+ if suffix in TEXT_EXTENSIONS:
+ if b'\x00' in data:
+ raise ValidationError('Text files must not contain binary data.')
+ try:
+ data.decode('utf-8')
+ except UnicodeDecodeError:
+ raise ValidationError('Text files must use UTF-8.')
+ return 'text/plain'
+ if suffix in SIGNATURES:
+ signature, mime = SIGNATURES[suffix]
+ if not data.startswith(signature):
+ raise ValidationError('File contents do not match the extension.')
+ if suffix == '.webp' and data[8:12] != b'WEBP':
+ raise ValidationError('Invalid WebP file.')
+ return mime
+ raise ValidationError('Unsupported file type.')
+
+
+@transaction.atomic
+def upload_attachment(user, card, *, filename, data, comment_id=None, title='', description='', source='web', source_path='', source_commit=''):
+ if len(data) > settings.PROJECTS_ATTACHMENT_MAX_BYTES:
+ raise ValidationError('File exceeds the per-file size limit.')
+ if not data:
+ raise ValidationError('File is empty.')
+ filename = _validated_name(filename)
+ mime = _detected_type(filename, data)
+ if len(title) > 255 or len(description) > 2000 or len(source_path) > 500:
+ raise ValidationError('Attachment metadata is too long.')
+ if source_commit and (len(source_commit) not in (40, 64) or any(c not in '0123456789abcdefABCDEF' for c in source_commit)):
+ raise ValidationError('Source commit must be a Git SHA.')
+ Card.objects.select_for_update().get(pk=card.pk)
+ qs = CardAttachment.objects.filter(card=card)
+ if qs.count() >= settings.PROJECTS_ATTACHMENT_MAX_FILES:
+ raise ValidationError('Card attachment count limit reached.')
+ if (qs.aggregate(total=Sum('byte_size'))['total'] or 0) + len(data) > settings.PROJECTS_ATTACHMENT_MAX_CARD_BYTES:
+ raise ValidationError('Card attachment storage limit reached.')
+ comment = None
+ if comment_id is not None:
+ comment = CardComment.objects.filter(card=card, pk=comment_id).first()
+ if comment is None:
+ raise ValidationError('Progress note does not belong to this card.')
+ item = CardAttachment(card=card, comment=comment, original_filename=filename, title=title.strip() or filename,
+ mime_type=mime, byte_size=len(data), sha256=hashlib.sha256(data).hexdigest(),
+ description=description, uploaded_by=user, source=source,
+ source_path=source_path, source_commit=source_commit)
+ item.file.save(f'{uuid4().hex}{PurePath(filename).suffix.lower()}', ContentFile(data), save=False)
+ try:
+ item.full_clean()
+ item.save()
+ except Exception:
+ item.file.delete(save=False)
+ raise
+ Activity.objects.create(project=card.project, card=card, actor=user, action='attachment.added',
+ detail={'attachment_id': str(item.pk), 'comment_id': comment_id}, origin=source)
+ return item
+
+
+def delete_attachment(user, item, *, source='web'):
+ Activity.objects.create(project=item.card.project, card=item.card, actor=user, action='attachment.deleted',
+ detail={'attachment_id': str(item.pk), 'comment_id': item.comment_id}, origin=source)
+ item.delete()
diff --git a/projects/migrations/0004_bulkupdatekey.py b/projects/migrations/0004_bulkupdatekey.py
new file mode 100644
index 0000000..1d8ff4f
--- /dev/null
+++ b/projects/migrations/0004_bulkupdatekey.py
@@ -0,0 +1,30 @@
+# Generated by Django 6.1.2 on 2026-10-16 13:59
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('projects', '0003_oauthidentity'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='BulkUpdateKey',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('key', models.CharField(max_length=128)),
+ ('payload_hash', models.CharField(max_length=64)),
+ ('result', models.JSONField()),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'constraints': [models.UniqueConstraint(fields=('user', 'key'), name='unique_bulk_update_key')],
+ },
+ ),
+ ]
diff --git a/projects/migrations/0005_cardattachment.py b/projects/migrations/0005_cardattachment.py
new file mode 100644
index 0000000..e509d46
--- /dev/null
+++ b/projects/migrations/0005_cardattachment.py
@@ -0,0 +1,41 @@
+# Generated by Django 6.1.2 on 2026-10-16 20:15
+
+import django.db.models.deletion
+import uuid
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('projects', '0004_bulkupdatekey'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='CardAttachment',
+ fields=[
+ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
+ ('file', models.FileField(upload_to='card-attachments/%Y/%m/')),
+ ('original_filename', models.CharField(max_length=255)),
+ ('title', models.CharField(max_length=255)),
+ ('mime_type', models.CharField(max_length=100)),
+ ('byte_size', models.PositiveIntegerField()),
+ ('sha256', models.CharField(max_length=64)),
+ ('description', models.TextField(blank=True)),
+ ('source', models.CharField(default='web', max_length=16)),
+ ('source_path', models.CharField(blank=True, max_length=500)),
+ ('source_commit', models.CharField(blank=True, max_length=64)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('card', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='projects.card')),
+ ('comment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='projects.cardcomment')),
+ ('uploaded_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'ordering': ['created_at', 'id'],
+ 'indexes': [models.Index(fields=['card', 'comment', 'created_at'], name='projects_ca_card_id_90f14b_idx')],
+ },
+ ),
+ ]
diff --git a/projects/models.py b/projects/models.py
index 42f7750..3b0856b 100644
--- a/projects/models.py
+++ b/projects/models.py
@@ -1,6 +1,7 @@
import uuid
from django.conf import settings
from django.core.validators import RegexValidator
+from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
@@ -122,6 +123,32 @@ class CardComment(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
+class CardAttachment(models.Model):
+ id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
+ card = models.ForeignKey(Card, on_delete=models.CASCADE, related_name='attachments')
+ comment = models.ForeignKey(CardComment, null=True, blank=True, on_delete=models.CASCADE, related_name='attachments')
+ file = models.FileField(upload_to='card-attachments/%Y/%m/')
+ original_filename = models.CharField(max_length=255)
+ title = models.CharField(max_length=255)
+ mime_type = models.CharField(max_length=100)
+ byte_size = models.PositiveIntegerField()
+ sha256 = models.CharField(max_length=64)
+ description = models.TextField(blank=True)
+ uploaded_by = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)
+ source = models.CharField(max_length=16, default='web')
+ source_path = models.CharField(max_length=500, blank=True)
+ source_commit = models.CharField(max_length=64, blank=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ ordering = ['created_at', 'id']
+ indexes = [models.Index(fields=['card', 'comment', 'created_at'])]
+
+ def clean(self):
+ if self.comment_id and not CardComment.objects.filter(pk=self.comment_id, card_id=self.card_id).exists():
+ raise ValidationError({'comment': 'Progress note must belong to this card.'})
+
+
class CreationKey(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
key = models.CharField(max_length=128)
@@ -133,6 +160,17 @@ class CreationKey(models.Model):
constraints = [models.UniqueConstraint(fields=['user', 'key'], name='unique_card_creation_key')]
+class BulkUpdateKey(models.Model):
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
+ key = models.CharField(max_length=128)
+ payload_hash = models.CharField(max_length=64)
+ result = models.JSONField()
+ created_at = models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ constraints = [models.UniqueConstraint(fields=['user', 'key'], name='unique_bulk_update_key')]
+
+
class Activity(models.Model):
project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='activity')
card = models.ForeignKey(Card, null=True, blank=True, on_delete=models.CASCADE, related_name='activity')
diff --git a/projects/services.py b/projects/services.py
index 047d66f..df71155 100644
--- a/projects/services.py
+++ b/projects/services.py
@@ -1,5 +1,6 @@
import hashlib
import json
+from uuid import UUID
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import transaction
from django.db.models import Q, Max
@@ -7,7 +8,7 @@ from django.core.validators import URLValidator
from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.utils.text import slugify
-from .models import Activity, Board, Card, CardRevision, Column, CreationKey, Membership, Project, Tag
+from .models import Activity, Board, BulkUpdateKey, Card, CardRevision, Column, CreationKey, Membership, Project, Tag
class RevisionConflict(Exception):
@@ -119,12 +120,13 @@ def update_card(user, card, *, expected_revision=None, origin='web', **changes):
@transaction.atomic
-def move_card(user, card, column, position=None, origin='web'):
+def move_card(user, card, column, position=None, origin='web', record_revision=True):
card = Card.objects.select_for_update().get(pk=card.pk)
project_for(user, card.project_id, write=True)
if column.board.project_id != card.project_id or column.archived:
raise ValidationError('Column is not available in this project.')
old_column = card.column_id
+ old_position = card.position
card.column = column
card.completed_at = timezone.now() if column.is_done and not card.completed_at else (None if not column.is_done else card.completed_at)
siblings = list(Card.objects.filter(column=column, archived=False).exclude(pk=card.pk).order_by('position', 'created_at'))
@@ -133,7 +135,12 @@ def move_card(user, card, column, position=None, origin='web'):
for i, item in enumerate(siblings):
item.position = i
item.save(update_fields=['position'])
+ moved = old_column != column.pk or old_position != card.position
+ if moved and record_revision:
+ card.revision += 1
card.save()
+ if moved and record_revision:
+ CardRevision.objects.create(card=card, revision=card.revision, markdown=card.description_markdown, actor=user)
Activity.objects.create(project=card.project, card=card, actor=user, action='card.moved', detail={'from': str(old_column), 'to': str(column.pk)}, origin=origin)
return card
@@ -219,3 +226,96 @@ def set_tags(user, card, tags, origin='web'):
card.tags.set(tags)
Activity.objects.create(project=card.project, card=card, actor=user, action='card.tags_changed', origin=origin)
return card
+
+
+@transaction.atomic
+def bulk_update_cards(user, project, card_ids, expected_revisions, changes, *, dry_run=False, idempotency_key=None, origin='web'):
+ """Validate the entire batch before writing; every mutation shares one transaction."""
+ project_for(user, project.pk, write=True)
+ if not isinstance(card_ids, list) or not 1 <= len(card_ids) <= 100:
+ raise ValidationError('Select between 1 and 100 cards.')
+ try:
+ ids = [str(UUID(str(value))) for value in card_ids]
+ except (ValueError, TypeError, AttributeError):
+ raise ValidationError('Invalid card ID.')
+ if len(set(ids)) != len(ids):
+ raise ValidationError('Duplicate card IDs are not allowed.')
+ if not isinstance(changes, dict) or not changes or set(changes) - {'column_id', 'priority', 'assignee_id', 'tag_ids'}:
+ raise ValidationError('Supply supported changes: column_id, priority, assignee_id or tag_ids.')
+ if 'priority' in changes and changes['priority'] not in dict(Card.PRIORITY):
+ raise ValidationError('Invalid priority.')
+ payload_hash = hashlib.sha256(json.dumps({'project': str(project.pk), 'ids': ids, 'revisions': expected_revisions, 'changes': changes}, sort_keys=True).encode()).hexdigest()
+ if idempotency_key and not dry_run:
+ if len(idempotency_key) > 128:
+ raise ValidationError('Idempotency key is too long.')
+ user.__class__.objects.select_for_update().get(pk=user.pk)
+ existing = BulkUpdateKey.objects.select_for_update().filter(user=user, key=idempotency_key).first()
+ if existing:
+ if existing.payload_hash != payload_hash:
+ raise ValidationError('Idempotency key was already used with different changes.')
+ return existing.result
+ cards = {str(card.pk): card for card in Card.objects.select_for_update().filter(pk__in=ids, project=project, archived=False).select_related('column')}
+ if len(cards) != len(ids):
+ raise ValidationError('One or more cards are unavailable in this project.')
+ if not isinstance(expected_revisions, dict):
+ raise ValidationError('Expected revisions are required for every card.')
+ conflicts = [{'id': identifier, 'expected': expected_revisions.get(identifier), 'current': cards[identifier].revision}
+ for identifier in ids if expected_revisions.get(identifier) != cards[identifier].revision]
+ if conflicts:
+ raise ValidationError({'revision_conflicts': conflicts})
+ column = None
+ if 'column_id' in changes:
+ try:
+ column = Column.objects.get(pk=UUID(str(changes['column_id'])), board=project.board, archived=False)
+ except (Column.DoesNotExist, ValueError, TypeError):
+ raise ValidationError('Column is not available in this project.')
+ assignee = None
+ if 'assignee_id' in changes and changes['assignee_id'] is not None:
+ try:
+ assignee = user.__class__.objects.get(pk=changes['assignee_id'])
+ except (user.__class__.DoesNotExist, ValueError, TypeError):
+ raise ValidationError('Invalid assignee.')
+ if assignee.pk != project.owner_id and not Membership.objects.filter(project=project, user=assignee).exists():
+ raise ValidationError('Assignee must have access to this project.')
+ tags = None
+ if 'tag_ids' in changes:
+ tag_ids = changes['tag_ids']
+ if not isinstance(tag_ids, list) or any(type(value) is not int for value in tag_ids) or len(tag_ids) != len(set(tag_ids)):
+ raise ValidationError('Tag IDs must be a unique list.')
+ tags = list(Tag.objects.filter(project=project, pk__in=tag_ids))
+ if len(tags) != len(tag_ids):
+ raise ValidationError('Tags must belong to this project.')
+ results = []
+ for identifier in ids:
+ card = cards[identifier]
+ before = {'column_id': str(card.column_id), 'priority': card.priority, 'assignee_id': card.assignee_id,
+ 'tag_ids': sorted(card.tags.values_list('pk', flat=True))}
+ after = dict(before)
+ if column is not None: after['column_id'] = str(column.pk)
+ if 'priority' in changes: after['priority'] = changes['priority']
+ if 'assignee_id' in changes: after['assignee_id'] = assignee.pk if assignee else None
+ if tags is not None: after['tag_ids'] = sorted(tag.pk for tag in tags)
+ delta = {field: {'from': before[field], 'to': after[field]} for field in changes if field in before and before[field] != after[field]}
+ results.append({'id': identifier, 'title': card.title, 'revision': card.revision + bool(delta), 'changes': delta, 'changed': bool(delta)})
+ if not dry_run:
+ for result in results:
+ if not result['changed']:
+ continue
+ card = cards[result['id']]
+ delta = result['changes']
+ if 'column_id' in delta:
+ move_card(user, card, column, origin=origin, record_revision=False)
+ card.refresh_from_db()
+ if 'priority' in delta: card.priority = changes['priority']
+ if 'assignee_id' in delta: card.assignee = assignee
+ if 'tag_ids' in delta: card.tags.set(tags)
+ card.revision += 1
+ card.full_clean()
+ card.save()
+ CardRevision.objects.create(card=card, revision=card.revision, markdown=card.description_markdown, actor=user)
+ Activity.objects.create(project=project, card=card, actor=user, action='card.bulk_updated', detail={'changes': delta}, origin=origin)
+ response = {'dry_run': dry_run, 'total': len(ids), 'changed_count': sum(item['changed'] for item in results),
+ 'unchanged_count': sum(not item['changed'] for item in results), 'items': results}
+ if idempotency_key and not dry_run:
+ BulkUpdateKey.objects.create(user=user, key=idempotency_key, payload_hash=payload_hash, result=response)
+ return response
diff --git a/projects/static/projects/attachments.js b/projects/static/projects/attachments.js
new file mode 100644
index 0000000..21ce7f0
--- /dev/null
+++ b/projects/static/projects/attachments.js
@@ -0,0 +1,44 @@
+(() => {
+ for (const form of document.querySelectorAll('[data-attachment-upload]')) {
+ if (form.dataset.ready) continue;
+ form.dataset.ready = '1';
+ const input = form.querySelector('input[type="file"]');
+ const progress = form.querySelector('progress');
+ const status = form.querySelector('[role="status"]');
+ const button = form.querySelector('button[type="submit"], button:not([type])');
+ form.addEventListener('dragover', event => { event.preventDefault(); form.classList.add('border', 'border-primary'); });
+ form.addEventListener('dragleave', () => form.classList.remove('border', 'border-primary'));
+ form.addEventListener('drop', event => {
+ event.preventDefault();
+ form.classList.remove('border', 'border-primary');
+ if (event.dataTransfer?.files?.length) {
+ input.files = event.dataTransfer.files;
+ status.textContent = `${input.files.length} file(s) selected.`;
+ }
+ });
+ form.addEventListener('submit', event => {
+ if (!input.files.length) return;
+ event.preventDefault();
+ const request = new XMLHttpRequest();
+ button.disabled = true;
+ progress.hidden = false;
+ progress.value = 0;
+ status.textContent = 'Uploading…';
+ request.open('POST', form.action);
+ request.upload.onprogress = update => {
+ if (update.lengthComputable) progress.value = Math.round(update.loaded / update.total * 100);
+ };
+ request.onload = () => {
+ button.disabled = false;
+ if (request.status >= 200 && request.status < 400) {
+ status.textContent = 'Upload complete.';
+ window.location.reload();
+ } else {
+ status.textContent = request.responseText || 'Upload failed. Please try again.';
+ }
+ };
+ request.onerror = () => { button.disabled = false; status.textContent = 'Connection lost. Please retry.'; };
+ request.send(new FormData(form));
+ });
+ }
+})();
diff --git a/projects/templates/projects/_attachment_list.html b/projects/templates/projects/_attachment_list.html
new file mode 100644
index 0000000..e52a906
--- /dev/null
+++ b/projects/templates/projects/_attachment_list.html
@@ -0,0 +1,8 @@
+{% if files %}
+{% for file in files %}
+ {{ file.title }}
+ {% if file.byte_size <= 1048576 and file.mime_type == 'image/png' or file.byte_size <= 1048576 and file.mime_type == 'image/jpeg' or file.byte_size <= 1048576 and file.mime_type == 'image/webp' %}{% elif file.mime_type == 'text/plain' and file.byte_size <= 1048576 %}Preview text{% endif %}
+ {{ file.byte_size|filesizeformat }} · {{ file.created_at|date:'SHORT_DATETIME_FORMAT' }}{% if file.uploaded_by %} · {{ file.uploaded_by }}{% endif %}
+ {% if file.source_path %}Snapshot: {{ file.source_path }}{% if file.source_commit %} @ {{ file.source_commit|slice:':12' }}{% endif %}{% endif %}
+ {% if can_edit %}Rename{% endif %}
+
{% endfor %}
{% else %}
No files attached.
{% endif %}
diff --git a/projects/templates/projects/_board.html b/projects/templates/projects/_board.html
index 1dab2bd..4e51de3 100644
--- a/projects/templates/projects/_board.html
+++ b/projects/templates/projects/_board.html
@@ -15,6 +15,7 @@
{% for card in column.visible_cards %}
+ {% if can_edit and not show_archived %}{% endif %}
{{ card.title }}