diff --git a/AGENTS.md b/AGENTS.md index 5ae7c7f..5aaae03 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,11 +47,13 @@ Use `.env.local` for local secrets. Keep `.env.local` and any real token-bearing - The side panel has icon menu sections for Add URL, URLs, Gitea repos, Workspaces, Agents, and Add Issue. - Add URL is enabled only when the active tab's base URL is not already in the URLs list. The user must pick either a workspace or a Gitea repo; the app infers the linked counterpart from local context. - URLs can be deleted from the URLs list. User-added URLs are removed from storage; generated known URLs are hidden through the stored deleted-base list. -- The Agents view lists available agent files. It currently contains one entry: `GLOBAL AGENT` backed by `AGENTS.md`. -- Add Issue is enabled only when the active tab's base URL is already in the URLs list and has a linked Gitea repo. The issue form must show the target repo, let the user select an agent file, capture visible-tab screenshots, accept multiple accumulated Gitea-friendly file attachments, and include `Chrome profile: Silma` plus the selected agent in created issue bodies. -- Clicking a captured screenshot must open an expanded preview with Close, Remove, and Crop controls. +- The Agents view lists available agent files and must allow adding, editing, and deleting persisted agents from `chrome.storage.local`. At least one agent must remain available. +- The default `GLOBAL AGENT` is backed by `AGENTS.md` and contains agnostic handoff rules with template variables such as `{{git}}`, `{{workspace}}`, `{{url}}`, `{{baseUrl}}`, `{{profile}}`, and `{{issue}}`. +- Add Issue is enabled only when the active tab's base URL is already in the URLs list and has a linked Gitea repo. The issue form must show the target repo, the active URL the extension believes it is attached to, let the user select an agent file, capture visible-tab screenshots, accept multiple accumulated Gitea-friendly file attachments, and include `Chrome profile: Silma` plus the selected agent in created issue bodies. +- Clicking a captured screenshot must open an expanded preview with Close, Remove, and Crop controls. The crop area should be a simple draggable/resizable box without a shaded crop fill. - Newly created issues must be created with the `Change Request` label. -- If the Ready checkbox is checked, create the issue first, upload screenshots/files as issue assets second, and apply the `ready` label last. +- When creating an issue, upload the selected rendered agent file as an issue asset along with screenshots and files. +- If the Ready checkbox is checked, create the issue first, upload the rendered agent file plus screenshots/files as issue assets second, and apply the `ready` label last. - The Add Issue view also lists existing issues for the linked Gitea repo. Selecting an issue must show the original description, issue attachments, and comment chain, followed by a comment form that can add text, take additional screenshots, attach files, upload those files as issue assets, and submit a Gitea comment with attachment links. - Existing issue rows must allow applying the `ready` label and deleting the issue. Deletion must require user confirmation. - Keep the Add Issue view dense; do not show the redundant view header title/description inside this view, and keep the Ready checkbox label short. diff --git a/README.md b/README.md index 4792788..4c83fef 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The deployable extension output is `dist/`. Load `dist/` in Chrome as an unpacke Static assets, including the extension icon assets, live in `public/` and are copied into `dist/` during the build. -The app opens in the Chrome side panel. The top icon menu includes Add URL, URLs, Gitea repos, Workspaces, Agents, and Add Issue. Add URL is enabled only for an active tab base URL that is not already in the URLs list. URLs can be deleted from the list. The Agents view currently lists `GLOBAL AGENT` from `AGENTS.md`. Add Issue is enabled when the active tab base URL is already linked to a Gitea repo; it creates an issue with the selected agent file and `Change Request` label, uploads accumulated screenshots and files as issue assets, and can apply the `ready` label after uploads. Captured screenshots can be expanded, removed, or cropped. The same view lists existing repo issues; selecting one shows the original description, attachments, comment chain, and a comment form with screenshots and file attachments. Rows can be marked Ready or deleted. +The app opens in the Chrome side panel. The top icon menu includes Add URL, URLs, Gitea repos, Workspaces, Agents, and Add Issue. Add URL is enabled only for an active tab base URL that is not already in the URLs list. URLs can be deleted from the list. The Agents view manages persisted agent files, starting with `GLOBAL AGENT` from `AGENTS.md`; agents can use variables such as `{{git}}`, `{{workspace}}`, and `{{url}}` in their markdown content. Add Issue is enabled when the active tab base URL is already linked to a Gitea repo; it shows the active URL being attached, creates an issue with the selected agent and `Change Request` label, uploads the rendered agent file plus accumulated screenshots and files as issue assets, and can apply the `ready` label after uploads. Captured screenshots can be expanded, removed, or cropped with a plain draggable/resizable crop box. The same view lists existing repo issues; selecting one shows the original description, attachments, comment chain, and a comment form with screenshots and file attachments. Rows can be marked Ready or deleted. Builds generate `public/local-context.json` from `/Users/Tabitha/.openclaw/workspace_Father`. That snapshot links known workspaces to local Gitea repos and is copied into `dist/` so the built extension is self-contained. diff --git a/docs/extension-management.md b/docs/extension-management.md index 73edd82..16ecdc8 100644 --- a/docs/extension-management.md +++ b/docs/extension-management.md @@ -38,16 +38,17 @@ Required variables: ## Issue Creation - Add Issue is enabled only when the active tab's base URL is already in the URLs list and that URL is linked to a Gitea repo. -- The Add Issue view must show the Gitea repo that will receive the issue. -- The Add Issue form must let the user select the agent file for handoff. The initial agent is `GLOBAL AGENT` backed by `AGENTS.md`. +- The Add Issue view must show the Gitea repo that will receive the issue and the active URL the extension believes it is attached to. +- The Add Issue form must let the user select the agent file for handoff. Agents are managed in the Agents view, persisted in `chrome.storage.local`, and the initial agent is `GLOBAL AGENT` backed by `AGENTS.md`. - The Add Issue view intentionally omits the redundant view header title/description and keeps the Ready checkbox label short. - Screenshot capture uses Chrome's visible-tab capture API and requires the extension's `activeTab` permission plus `` host permission so capture still works after the side panel remains open across tab changes. - Captured screenshots should appear immediately in Add Issue as thumbnail rows. -- Captured screenshots can be expanded, closed, removed, or cropped before upload. +- Captured screenshots can be expanded, closed, removed, or cropped before upload. The crop UI should use a plain draggable/resizable crop box instead of shaded slider-based controls. - File attachments are accumulated across picker selections and all selected files must be uploaded to Gitea. - Created issue bodies must include `Chrome profile: Silma` and the selected agent. +- Created issues must upload the selected rendered agent file as a Gitea issue asset. Supported template variables in agent content are `{{git}}`, `{{repo}}`, `{{workspace}}`, `{{url}}`, `{{baseUrl}}`, `{{profile}}`, and `{{issue}}`. - Newly created issues must include the `Change Request` label. -- When Ready is checked, create the issue, upload screenshots/files as Gitea issue assets, then apply the `ready` label last. +- When Ready is checked, create the issue, upload the rendered agent file plus screenshots/files as Gitea issue assets, then apply the `ready` label last. - The Add Issue view lists existing issues for the linked Gitea repo. Selecting an issue shows the original description, issue attachments, comment chain, and a comment form for text, additional screenshots, and file attachments. - Issue comments should upload screenshots/files as issue assets first, then create a comment containing links to those attachments. - Existing issue rows can apply the `ready` label or delete the issue. Deletion must require confirmation. @@ -58,6 +59,13 @@ Required variables: - Deleting a user-added URL removes it from `silmaAide.userUrls` in `chrome.storage.local`. - Deleting a generated known URL stores its base URL in `silmaAide.deletedUrlBases` so it is hidden without editing generated local context. +## Agent Management + +- The Agents view must allow adding, editing, and deleting agent files. +- At least one agent must remain available so Add Issue always has a handoff file. +- Agent records are persisted in `silmaAide.agents`. +- The default `GLOBAL AGENT` should remain agnostic and use template variables instead of hard-coded project paths where possible. + ## Agent Checklist 1. Run `npm run build`. diff --git a/llm.txt b/llm.txt index f16525d..d2cf6cd 100644 --- a/llm.txt +++ b/llm.txt @@ -19,7 +19,7 @@ Important files: Build with `npm run build`. The deployable output directory is `dist/`; load that folder in Chrome as an unpacked extension or point deployment tooling at it. Do not edit `dist/` directly. -UI behavior: the app renders as a Chrome side panel, not a draggable window. The menu items are Add URL, URLs, Gitea Repos, Workspaces, Agents, and Add Issue. Add URL is enabled only when the active tab base URL is not already known; the user must choose either a workspace or a Gitea repo, and the app infers the linked counterpart. URLs can be deleted from the list; user-added URLs are removed from storage, while generated known URLs are hidden through stored deleted bases. The Agents view currently lists `GLOBAL AGENT` backed by `AGENTS.md`. Add Issue is enabled only when the active tab base URL is known and linked to a Gitea repo. It shows the target repo, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, lets the user select an agent file, creates the Gitea issue with the `Change Request` label, uploads all screenshots/files, then applies the `ready` label if requested. Captured screenshots can be expanded, removed, or cropped. Created issue bodies include `Chrome profile: Silma` and the selected agent. The Add Issue view also lists existing issues for the linked repo; selecting an issue shows the original description, issue attachments, comment chain, and a comment form with text, screenshots, and file attachments. Existing issue rows can be marked Ready or deleted after confirmation. Gitea repos are ordered by latest default-branch commit. Workspace and URL views show established links between local workspaces, known URLs, and Gitea repos. +UI behavior: the app renders as a Chrome side panel, not a draggable window. The menu items are Add URL, URLs, Gitea Repos, Workspaces, Agents, and Add Issue. Add URL is enabled only when the active tab base URL is not already known; the user must choose either a workspace or a Gitea repo, and the app infers the linked counterpart. URLs can be deleted from the list; user-added URLs are removed from storage, while generated known URLs are hidden through stored deleted bases. The Agents view manages persisted agent files and starts with `GLOBAL AGENT` backed by `AGENTS.md`; agent markdown can use `{{git}}`, `{{repo}}`, `{{workspace}}`, `{{url}}`, `{{baseUrl}}`, `{{profile}}`, and `{{issue}}` template variables. Add Issue is enabled only when the active tab base URL is known and linked to a Gitea repo. It shows the target repo and active URL, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, lets the user select an agent file, creates the Gitea issue with the `Change Request` label, uploads the rendered agent file plus all screenshots/files, then applies the `ready` label if requested. Captured screenshots can be expanded, removed, or cropped with a plain draggable/resizable crop box. Created issue bodies include `Chrome profile: Silma` and the selected agent. The Add Issue view also lists existing issues for the linked repo; selecting an issue shows the original description, issue attachments, comment chain, and a comment form with text, screenshots, and file attachments. Existing issue rows can be marked Ready or deleted after confirmation. Gitea repos are ordered by latest default-branch commit. Workspace and URL views show established links between local workspaces, known URLs, and Gitea repos. Extension management rule: use the Codex Chrome extension with the Chrome profile named `Silma`. Do not use `Profile 1`. diff --git a/manifest.llm.json b/manifest.llm.json index 732b707..37c99fe 100644 --- a/manifest.llm.json +++ b/manifest.llm.json @@ -52,10 +52,10 @@ } ], "repo_ordering": "Gitea repos are ordered by latest default-branch commit timestamp.", - "agents_behavior": "The Agents view lists available agent files. The initial singular agent is GLOBAL AGENT backed by AGENTS.md.", + "agents_behavior": "The Agents view manages persisted agent files. The initial agent is GLOBAL AGENT backed by AGENTS.md, and agent markdown supports {{git}}, {{repo}}, {{workspace}}, {{url}}, {{baseUrl}}, {{profile}}, and {{issue}} template variables.", "add_url_behavior": "The user must pick either a workspace or a Gitea repo. The app infers the linked counterpart from local context and stores the URL link in chrome.storage.local.", "delete_url_behavior": "URLs can be deleted from the list. User-added URLs are removed from chrome.storage.local; generated known URLs are hidden by storing their base URL in silmaAide.deletedUrlBases.", - "add_issue_behavior": "The form shows the target repo for the active known URL, lets the user select an agent file, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, creates a Gitea issue with the Change Request label, uploads all screenshots/files as issue assets, then applies the ready label after uploads when requested. Captured screenshots can be expanded, removed, or cropped. Issue bodies include Chrome profile: Silma and the selected agent. The view intentionally omits the redundant Add Issue header copy and keeps the Ready checkbox label short.", + "add_issue_behavior": "The form shows the target repo and active URL for the active known URL, lets the user select an agent file, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, creates a Gitea issue with the Change Request label, uploads the rendered agent file plus all screenshots/files as issue assets, then applies the ready label after uploads when requested. Captured screenshots can be expanded, removed, or cropped with a plain draggable/resizable crop box. Issue bodies include Chrome profile: Silma and the selected agent. The view intentionally omits the redundant Add Issue header copy and keeps the Ready checkbox label short.", "issue_comment_behavior": "The Add Issue view lists existing issues for the active URL's linked Gitea repo. Selecting an issue shows the original description, issue attachments, comment chain, and a comment form that accepts text, screenshots, and file attachments, uploads attachments as issue assets, and submits a Gitea issue comment with attachment links. Issue rows can apply the ready label or delete the issue after confirmation.", "known_urls": [ { diff --git a/src/main.ts b/src/main.ts index 8fd4bb0..5e7956e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,6 +12,8 @@ import { import type { GiteaIssueAttachment, GiteaIssueComment, GiteaIssueSummary, GiteaRepoSummary } from "./api"; import type { KnownUrl, LocalContext, LocalWorkspace } from "./localContext"; +type CropHandle = "n" | "e" | "s" | "w" | "nw" | "ne" | "sw" | "se"; + const status = document.querySelector("#status"); const refreshData = document.querySelector("#refresh-data"); const addUrlButton = document.querySelector("#add-url"); @@ -185,6 +187,9 @@ function renderWorkspaces(workspaces: LocalWorkspace[]): string { } function renderAgents(agents: AgentProfile[]): string { + const state = appStore.getState(); + const draft = state.agentDraft; + return `
${agents @@ -196,11 +201,39 @@ function renderAgents(agents: AgentProfile[]): string { ${escapeHtml(agent.file)} ${escapeHtml(agent.description)}
+
+ + +
` ) .join("")} +
+
+ + + + +
+ + +
+
+
`; } @@ -466,20 +499,11 @@ function renderScreenshotPreview(): string {
${escapeHtml(screenshot.name)} -
-
-
- ${(["left", "top", "width", "height"] as const) - .map( - (field) => ` - - ` - ) - .join("")} +