Permalink Plugin
Adds Copy source-control permalink to Workspace Files. It copies a commit-pinned link only when a local tracking ref for the selected push destination establishes publication and the Git blob exactly matches the displayed file. Use Copy workspace link for local changes, unavailable publication evidence, or unsupported hosts or templates. Copying does not fetch, push, or grant access.
The plugin also supports a temporary legacy mode that turns file-path mentions in the agent's reply into external links. Enabling Workspace Files chat references suppresses the legacy rewrite; it does not disable the Files action.
Recognized automatically from the repo URL:
| Platform | URL pattern |
|---|---|
| GitHub | github.com |
| GitLab.com | gitlab.com |
| Gitea / Forgejo | hostname contains gitea. or forgejo. |
| Codeberg | codeberg.org |
| Bitbucket | bitbucket.org |
| Azure DevOps | dev.azure.com or *.visualstudio.com |
Self-hosted GitLab (or anything else that does not match those patterns) needs options.platform or options.permalink_template on the repo.
Only the main agent's replies are rewritten. Subagent output is left unchanged. Paths already inside Markdown links, and paths inside fenced code blocks, are left as-is. Unresolvable paths are left as-is.
If Branch Switching is active, links use the conversation's current branch instead of the repo's configured ref (unless the repo is pinned to a commit).
Configuration
plugins:
- module: codumentor.plugins.permalink
class: PermalinkPlugin
args:
enabled: true
legacy_rewrite: true # temporary, ignored when chat file references are enabled
link_format: markdown # legacy only; or 'plain' for bare URLs
Parameters
| Key | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Master switch. |
legacy_rewrite | bool | true | Enable the temporary reply rewrite unless Workspace Files chat references are enabled. |
link_format | "markdown" or "plain" | "markdown" | Legacy only: Markdown links (` path `) or bare URLs. |
Per-repository overrides
repos:
- url: https://git.example.com/org/repo.git
name: MyRepo
options:
# Force a built-in URL layout when auto-detect would miss
# (github, gitlab, gitea, bitbucket, azure_devops):
platform: gitlab
# Or a full custom template. Placeholders: {base_url}, {owner},
# {repo}, {org}, {project}, {commit}, {path}
permalink_template: "{base_url}/{owner}/{repo}/-/blob/{commit}/{path}"
permalink_template wins over platform. For the Files action, templates must pin the commit and stay on the selected remote's repository; custom range templates must match the platform's standard URL layout. A checkout with no supported Git destination or no matching remote-tracking evidence cannot produce a Files permalink. A local path without a configured url does not qualify for legacy rewriting.
What gets linked in legacy replies
In order, in each reply:
- Full repo paths —
MyRepo/src/utils.py - Relative paths —
src/utils.pyorsrc/utils/ - Bare filenames —
utils.py(common code/doc extensions only)
Any of them may carry a line or a range — utils.py:12, utils.py:12-20, utils.py:12–20, utils.py#L12-L20 — and the link then opens at those lines, in the platform's own anchor syntax:
| Platform | Line | Range |
|---|---|---|
| GitHub | #L12 | #L12-L20 |
| GitLab | #L12 | #L12-20 |
| Gitea / Forgejo / Codeberg | #L12 | #L12-L20 |
| Bitbucket | #lines-12 | #lines-12:20 |
| Azure DevOps | &line=12&lineEnd=13… | &line=12&lineEnd=21… |
Markdown, reStructuredText, AsciiDoc and Org files open in source view (?plain=1 on GitHub/GitLab, ?display=source on Gitea), since line anchors exist only there. With permalink_template, the anchor follows options.platform or the platform detected from the URL; when neither is known, the link points at the file.
Relative paths and bare names are resolved from files the agent already opened in this conversation when that is unambiguous, otherwise from a unique match across configured repos. Ambiguous names are left unchanged.
Only repositories the user's access profile holds are linked — or searched: a link names the repository and its hosting URL, and resolving a bare name against a repository answers whether the file exists there. For a chat-only user the reply is left as written.