mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-30 13:20:54 +01:00
## Thinking Path > - Paperclip manages AI agents and their work. > - Pipelines was an unused experiment with its own UI, API, CLI, and automation. > - Keeping it leaves unsupported product surfaces and extra task-detail queries. > - Removing the experiment must preserve data that users already saved. > - This pull request removes the feature and keeps its database schema and migration history. > - Cases and Routines remain available as separate features. ## Linked Issues or Issue Description **What existing behavior does this improve?** Remove the unused Pipelines experiment across the application. **Current behavior** The experiment includes pipeline boards, stage settings, case automation, review queues, learnings, permissions, and CLI commands. Task detail also queries pipeline links. **Proposed behavior** Remove all these product surfaces and their implementation. Preserve existing tables, records, and documents. Ignore the retired boolean in older managed configurations so upgrades still start. **Breaking changes** Pipeline URLs, API endpoints, CLI commands, and `pipelines:write` are removed. Task detail no longer includes the old `linkedCases` field. The independent Cases API remains available. No database migration or cleanup is included. Related feature work: #7907, #9110, #10905, #11375, #13004, #14671, #16133. Related issues: #9663, #10310, #10312. This removal supersedes the feature; it does not implement those pending enhancements or delete their saved data. ## What Changed - Remove Pipeline UI pages, navigation, gates, clients, query keys, helpers, and unused design tokens. - Remove Pipeline REST routes, services, automation dispatch, task-detail queries, and OpenAPI discovery. - Remove the CLI commands, shared contracts, experimental flag, catalog entry, and permission defaults. - Remove feature-specific tests, tutorials, smoke scripts, maps, and Storybook examples. - Preserve database schema, migration history, and the reserved document key used by old records. - Keep Cases routes independent and cover obsolete stored and managed settings. ## Verification - Passed: `pnpm build` and `pnpm -r typecheck`. - Passed: targeted settings, managed configuration, sidebar, settings UI, routing, and feature-catalog tests. A first sidebar run caught a shared Workspaces icon import; the import was restored and the sidebar rerun passed. - Passed: 40 tests covering Cases routes, OpenAPI discovery, retained Pipeline table constraints, and schema snapshot drift. - Passed: token gates, map validation, generated API metadata check, Storybook catalog validation, and 28 map/catalog tests. - Passed: isolated local browser verification of navigation and Experimental settings with Pipelines absent; Cases and Routines still open normally. Live GET/POST requests to retired Pipeline endpoints return 404, and the retired setting is absent. CLI help has no Pipeline commands. - Passed: 22 access-service and agent-default-grant tests after restoring unrelated permission assertions flagged in review. - Local full run: `pnpm test:run` reported one failure in the unchanged workspace-runtime port-allocation test. That test passed in an isolated rerun. The long local run was stopped after full CI passed; it is not reported as a complete local pass. - Passed: all 56 checks on `def9181f3a4491d95fca1d38e9739f5b821aae3e` (2 conditional checks skipped), including build, typecheck, test shards, and browser suites. Eleven interrupted CI jobs reported “The operation was canceled”; their one-time retry passed. [CI run](https://github.com/paperclipai/paperclip/actions/runs/39255211006). - Greptile: 5/5 on the final commit, with the only review finding fixed and resolved. - Sandbox socket restrictions affected the first build/API test attempts. The same commands ran with local sockets available. ## Risks - Existing Pipeline clients must stop using the removed endpoints and commands. - Existing data remains in the database and backups, but the removed UI no longer displays it. - Historical boolean `enablePipelines` values are ignored. They cannot restore the feature. - Cases and Routines must retain their separate behavior. Targeted route tests cover this boundary. ## Model Used OpenAI Codex, GPT-6, with repository inspection, editing, shell execution, and browser verification. The exact deployed model ID and context-window size are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
273 lines
7.9 KiB
TypeScript
273 lines
7.9 KiB
TypeScript
export const PROJECT_MENTION_SCHEME = "project://";
|
|
export const AGENT_MENTION_SCHEME = "agent://";
|
|
export const USER_MENTION_SCHEME = "user://";
|
|
export const SKILL_MENTION_SCHEME = "skill://";
|
|
export const ROUTINE_MENTION_SCHEME = "routine://";
|
|
|
|
const HEX_COLOR_RE = /^[0-9a-f]{6}$/i;
|
|
const HEX_COLOR_SHORT_RE = /^[0-9a-f]{3}$/i;
|
|
const HEX_COLOR_WITH_HASH_RE = /^#[0-9a-f]{6}$/i;
|
|
const HEX_COLOR_SHORT_WITH_HASH_RE = /^#[0-9a-f]{3}$/i;
|
|
const PROJECT_MENTION_LINK_RE = /\[[^\]]*]\((project:\/\/[^)\s]+)\)/gi;
|
|
const AGENT_MENTION_LINK_RE = /\[[^\]]*]\((agent:\/\/[^)\s]+)\)/gi;
|
|
const USER_MENTION_LINK_RE = /\[[^\]]*]\((user:\/\/[^)\s]+)\)/gi;
|
|
const SKILL_MENTION_LINK_RE = /\[[^\]]*]\((skill:\/\/[^)\s]+)\)/gi;
|
|
const ROUTINE_MENTION_LINK_RE = /\[[^\]]*]\((routine:\/\/[^)\s]+)\)/gi;
|
|
const AGENT_ICON_NAME_RE = /^[a-z0-9-]+$/i;
|
|
const SKILL_SLUG_RE = /^[a-z0-9][a-z0-9-]*$/i;
|
|
|
|
export interface ParsedProjectMention {
|
|
projectId: string;
|
|
color: string | null;
|
|
}
|
|
|
|
export interface ParsedAgentMention {
|
|
agentId: string;
|
|
icon: string | null;
|
|
}
|
|
|
|
export interface ParsedUserMention {
|
|
userId: string;
|
|
}
|
|
|
|
export interface ParsedSkillMention {
|
|
skillId: string;
|
|
slug: string | null;
|
|
}
|
|
|
|
export interface ParsedRoutineMention {
|
|
routineId: string;
|
|
}
|
|
|
|
function normalizeHexColor(input: string | null | undefined): string | null {
|
|
if (!input) return null;
|
|
const trimmed = input.trim();
|
|
if (!trimmed) return null;
|
|
|
|
if (HEX_COLOR_WITH_HASH_RE.test(trimmed)) {
|
|
return trimmed.toLowerCase();
|
|
}
|
|
if (HEX_COLOR_RE.test(trimmed)) {
|
|
return `#${trimmed.toLowerCase()}`;
|
|
}
|
|
if (HEX_COLOR_SHORT_WITH_HASH_RE.test(trimmed)) {
|
|
const raw = trimmed.slice(1).toLowerCase();
|
|
return `#${raw[0]}${raw[0]}${raw[1]}${raw[1]}${raw[2]}${raw[2]}`;
|
|
}
|
|
if (HEX_COLOR_SHORT_RE.test(trimmed)) {
|
|
const raw = trimmed.toLowerCase();
|
|
return `#${raw[0]}${raw[0]}${raw[1]}${raw[1]}${raw[2]}${raw[2]}`;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function buildProjectMentionHref(projectId: string, color?: string | null): string {
|
|
const trimmedProjectId = projectId.trim();
|
|
const normalizedColor = normalizeHexColor(color ?? null);
|
|
if (!normalizedColor) {
|
|
return `${PROJECT_MENTION_SCHEME}${trimmedProjectId}`;
|
|
}
|
|
return `${PROJECT_MENTION_SCHEME}${trimmedProjectId}?c=${encodeURIComponent(normalizedColor.slice(1))}`;
|
|
}
|
|
|
|
export function parseProjectMentionHref(href: string): ParsedProjectMention | null {
|
|
if (!href.startsWith(PROJECT_MENTION_SCHEME)) return null;
|
|
|
|
let url: URL;
|
|
try {
|
|
url = new URL(href);
|
|
} catch {
|
|
return null;
|
|
}
|
|
|
|
if (url.protocol !== "project:") return null;
|
|
|
|
const projectId = `${url.hostname}${url.pathname}`.replace(/^\/+/, "").trim();
|
|
if (!projectId) return null;
|
|
|
|
const color = normalizeHexColor(url.searchParams.get("c") ?? url.searchParams.get("color"));
|
|
|
|
return {
|
|
projectId,
|
|
color,
|
|
};
|
|
}
|
|
|
|
export function buildAgentMentionHref(agentId: string, icon?: string | null): string {
|
|
const trimmedAgentId = agentId.trim();
|
|
const normalizedIcon = normalizeAgentIcon(icon ?? null);
|
|
if (!normalizedIcon) {
|
|
return `${AGENT_MENTION_SCHEME}${trimmedAgentId}`;
|
|
}
|
|
return `${AGENT_MENTION_SCHEME}${trimmedAgentId}?i=${encodeURIComponent(normalizedIcon)}`;
|
|
}
|
|
|
|
export function parseAgentMentionHref(href: string): ParsedAgentMention | null {
|
|
if (!href.startsWith(AGENT_MENTION_SCHEME)) return null;
|
|
|
|
let url: URL;
|
|
try {
|
|
url = new URL(href);
|
|
} catch {
|
|
return null;
|
|
}
|
|
|
|
if (url.protocol !== "agent:") return null;
|
|
|
|
const agentId = `${url.hostname}${url.pathname}`.replace(/^\/+/, "").trim();
|
|
if (!agentId) return null;
|
|
|
|
return {
|
|
agentId,
|
|
icon: normalizeAgentIcon(url.searchParams.get("i") ?? url.searchParams.get("icon")),
|
|
};
|
|
}
|
|
|
|
export function buildUserMentionHref(userId: string): string {
|
|
return `${USER_MENTION_SCHEME}${userId.trim()}`;
|
|
}
|
|
|
|
export function parseUserMentionHref(href: string): ParsedUserMention | null {
|
|
if (!href.startsWith(USER_MENTION_SCHEME)) return null;
|
|
|
|
let url: URL;
|
|
try {
|
|
url = new URL(href);
|
|
} catch {
|
|
return null;
|
|
}
|
|
|
|
if (url.protocol !== "user:") return null;
|
|
|
|
const userId = `${url.hostname}${url.pathname}`.replace(/^\/+/, "").trim();
|
|
if (!userId) return null;
|
|
|
|
return { userId };
|
|
}
|
|
|
|
export function buildSkillMentionHref(skillId: string, slug?: string | null): string {
|
|
const trimmedSkillId = skillId.trim();
|
|
const normalizedSlug = normalizeSkillSlug(slug ?? null);
|
|
if (!normalizedSlug) {
|
|
return `${SKILL_MENTION_SCHEME}${trimmedSkillId}`;
|
|
}
|
|
return `${SKILL_MENTION_SCHEME}${trimmedSkillId}?s=${encodeURIComponent(normalizedSlug)}`;
|
|
}
|
|
|
|
export function parseSkillMentionHref(href: string): ParsedSkillMention | null {
|
|
if (!href.startsWith(SKILL_MENTION_SCHEME)) return null;
|
|
|
|
let url: URL;
|
|
try {
|
|
url = new URL(href);
|
|
} catch {
|
|
return null;
|
|
}
|
|
|
|
if (url.protocol !== "skill:") return null;
|
|
|
|
const skillId = `${url.hostname}${url.pathname}`.replace(/^\/+/, "").trim();
|
|
if (!skillId) return null;
|
|
|
|
return {
|
|
skillId,
|
|
slug: normalizeSkillSlug(url.searchParams.get("s") ?? url.searchParams.get("slug")),
|
|
};
|
|
}
|
|
|
|
export function buildRoutineMentionHref(routineId: string): string {
|
|
return `${ROUTINE_MENTION_SCHEME}${routineId.trim()}`;
|
|
}
|
|
|
|
export function parseRoutineMentionHref(href: string): ParsedRoutineMention | null {
|
|
if (!href.startsWith(ROUTINE_MENTION_SCHEME)) return null;
|
|
|
|
let url: URL;
|
|
try {
|
|
url = new URL(href);
|
|
} catch {
|
|
return null;
|
|
}
|
|
|
|
if (url.protocol !== "routine:") return null;
|
|
|
|
const routineId = `${url.hostname}${url.pathname}`.replace(/^\/+/, "").trim();
|
|
if (!routineId) return null;
|
|
|
|
return { routineId };
|
|
}
|
|
|
|
export function extractProjectMentionIds(markdown: string): string[] {
|
|
if (!markdown) return [];
|
|
const ids = new Set<string>();
|
|
const re = new RegExp(PROJECT_MENTION_LINK_RE);
|
|
let match: RegExpExecArray | null;
|
|
while ((match = re.exec(markdown)) !== null) {
|
|
const parsed = parseProjectMentionHref(match[1]);
|
|
if (parsed) ids.add(parsed.projectId);
|
|
}
|
|
return [...ids];
|
|
}
|
|
|
|
export function extractAgentMentionIds(markdown: string): string[] {
|
|
if (!markdown) return [];
|
|
const ids = new Set<string>();
|
|
const re = new RegExp(AGENT_MENTION_LINK_RE);
|
|
let match: RegExpExecArray | null;
|
|
while ((match = re.exec(markdown)) !== null) {
|
|
const parsed = parseAgentMentionHref(match[1]);
|
|
if (parsed) ids.add(parsed.agentId);
|
|
}
|
|
return [...ids];
|
|
}
|
|
|
|
export function extractUserMentionIds(markdown: string): string[] {
|
|
if (!markdown) return [];
|
|
const ids = new Set<string>();
|
|
const re = new RegExp(USER_MENTION_LINK_RE);
|
|
let match: RegExpExecArray | null;
|
|
while ((match = re.exec(markdown)) !== null) {
|
|
const parsed = parseUserMentionHref(match[1]);
|
|
if (parsed) ids.add(parsed.userId);
|
|
}
|
|
return [...ids];
|
|
}
|
|
|
|
export function extractSkillMentionIds(markdown: string): string[] {
|
|
if (!markdown) return [];
|
|
const ids = new Set<string>();
|
|
const re = new RegExp(SKILL_MENTION_LINK_RE);
|
|
let match: RegExpExecArray | null;
|
|
while ((match = re.exec(markdown)) !== null) {
|
|
const parsed = parseSkillMentionHref(match[1]);
|
|
if (parsed) ids.add(parsed.skillId);
|
|
}
|
|
return [...ids];
|
|
}
|
|
|
|
export function extractRoutineMentionIds(markdown: string): string[] {
|
|
if (!markdown) return [];
|
|
const ids = new Set<string>();
|
|
const re = new RegExp(ROUTINE_MENTION_LINK_RE);
|
|
let match: RegExpExecArray | null;
|
|
while ((match = re.exec(markdown)) !== null) {
|
|
const parsed = parseRoutineMentionHref(match[1]);
|
|
if (parsed) ids.add(parsed.routineId);
|
|
}
|
|
return [...ids];
|
|
}
|
|
|
|
function normalizeAgentIcon(input: string | null | undefined): string | null {
|
|
if (!input) return null;
|
|
const trimmed = input.trim().toLowerCase();
|
|
if (!trimmed || !AGENT_ICON_NAME_RE.test(trimmed)) return null;
|
|
return trimmed;
|
|
}
|
|
|
|
function normalizeSkillSlug(input: string | null | undefined): string | null {
|
|
if (!input) return null;
|
|
const trimmed = input.trim().toLowerCase();
|
|
if (!trimmed || !SKILL_SLUG_RE.test(trimmed)) return null;
|
|
return trimmed;
|
|
}
|