diff --git a/AGENTS.md b/AGENTS.md index 40e8009..29c09b8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,15 +40,16 @@ Use `.env.local` for local secrets. Keep `.env.local` and any real token-bearing - `scripts/generate-local-context.mjs` generates `public/local-context.json` from `/Users/Tabitha/.openclaw/workspace_Father` before builds. - `public/local-context.json` is a committed fallback snapshot so CI builds can still produce a self-contained `dist/` if the local workspace root is unavailable. - `npm run build` runs `scripts/verify-dist.mjs` after Vite to ensure the generated output has the required extension files. -- Host permissions are derived from `VITE_GITEA_BASE_URL`. Rebuild after changing the base URL. +- Host permissions include ordinary `http`/`https` pages for screenshot capture plus the Gitea host derived from `VITE_GITEA_BASE_URL`. Rebuild after changing the base URL. - Runtime API calls are centralized in `src/api.ts`. - Side panel state is centralized in the vanilla Zustand store at `src/store.ts`. - The extension opens as a Chrome side panel. It is not a draggable in-page window. - The side panel has icon menu sections for Add URL, URLs, Gitea repos, Workspaces, 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. - 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, capture visible-tab screenshots, accept Gitea-friendly file attachments, and include `Chrome profile: Silma` in created issue bodies. - If the Ready checkbox is checked, create the issue first, upload screenshots/files as issue assets second, and apply the `ready` label last. -- The extension requests `activeTab` so screenshots can be captured from the current Chrome tab. +- The extension requests `activeTab` and `http`/`https` host permissions so screenshots can be captured from the current Chrome tab even after the side panel has stayed open across tab changes. ## Chrome Extension Management diff --git a/README.md b/README.md index 2b8fad7..66f69d8 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, and Add Issue. Add URL is enabled only for an active tab base URL that is not already in the URLs list. Add Issue is enabled when the active tab base URL is already linked to a Gitea repo; it creates an issue, uploads screenshots and files as issue assets, and can apply the `ready` label after uploads. +The app opens in the Chrome side panel. The top icon menu includes Add URL, URLs, Gitea repos, Workspaces, 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. Add Issue is enabled when the active tab base URL is already linked to a Gitea repo; it creates an issue, uploads screenshots and files as issue assets, and can apply the `ready` label after uploads. 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 4eae71b..b506b78 100644 --- a/docs/extension-management.md +++ b/docs/extension-management.md @@ -39,10 +39,17 @@ Required variables: - 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. -- Screenshot capture uses Chrome's visible-tab capture API and requires the extension's `activeTab` permission. +- Screenshot capture uses Chrome's visible-tab capture API and requires the extension's `activeTab` permission plus ordinary `http`/`https` host permissions so capture still works after the side panel remains open across tab changes. +- Captured screenshots should appear immediately in Add Issue as thumbnail rows. - Created issue bodies must include `Chrome profile: Silma`. - When Ready is checked, create the issue, upload screenshots/files as Gitea issue assets, then apply the `ready` label last. +## URL Management + +- URLs can be deleted from the URLs list. +- 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 Checklist 1. Run `npm run build`. diff --git a/llm.txt b/llm.txt index f2a4d7a..fabff1f 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, 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. 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, accepts file attachments, creates the Gitea issue, uploads assets, then applies the `ready` label if requested. Created issue bodies include `Chrome profile: Silma`. 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, 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. 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 file attachments, creates the Gitea issue, uploads assets, then applies the `ready` label if requested. Created issue bodies include `Chrome profile: Silma`. 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 dab5940..c57e910 100644 --- a/manifest.llm.json +++ b/manifest.llm.json @@ -49,7 +49,8 @@ ], "repo_ordering": "Gitea repos are ordered by latest default-branch commit timestamp.", "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.", - "add_issue_behavior": "The form shows the target repo for the active known URL, captures visible-tab screenshots, accepts file attachments, creates a Gitea issue, uploads screenshots/files as issue assets, then applies the ready label after uploads when requested. Issue bodies include Chrome profile: Silma.", + "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, captures visible-tab screenshots with thumbnails, accepts file attachments, creates a Gitea issue, uploads screenshots/files as issue assets, then applies the ready label after uploads when requested. Issue bodies include Chrome profile: Silma.", "known_urls": [ { "url": "http://100.66.226.22:23030/", @@ -77,6 +78,11 @@ "storage", "tabs" ], + "extension_host_permissions": [ + "http://*/*", + "https://*/*", + "Gitea host derived from VITE_GITEA_BASE_URL" + ], "commands": { "install": "npm ci", "codex_setup": "npm run codex:setup", diff --git a/src/main.ts b/src/main.ts index 9e24ce5..7dbf612 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,8 @@ import { CHROME_PROFILE_NAME, findKnownUrlForBase, type AddUrlMode, - type AppView + type AppView, + type ScreenshotAttachment } from "./store"; import type { GiteaRepoSummary } from "./api"; import type { KnownUrl, LocalContext, LocalWorkspace } from "./localContext"; @@ -61,7 +62,26 @@ function formatSha(value: string): string { function allUrls(): KnownUrl[] { const state = appStore.getState(); - return [...(state.localContext?.knownUrls ?? []), ...state.userUrls]; + const deletedBases = new Set(state.deletedUrlBases); + const urls = [...(state.localContext?.knownUrls ?? []), ...state.userUrls].filter( + (knownUrl) => !deletedBases.has(baseUrlFor(knownUrl.url)) + ); + + return urls.filter( + (knownUrl, index) => urls.findIndex((item) => baseUrlFor(item.url) === baseUrlFor(knownUrl.url)) === index + ); +} + +function baseUrlFor(value: string): string { + try { + const url = new URL(value); + if (url.protocol !== "http:" && url.protocol !== "https:") { + return ""; + } + return `${url.origin}/`; + } catch { + return ""; + } } function isActiveBaseUrlKnown(): boolean { @@ -167,7 +187,10 @@ function renderUrls(urls: KnownUrl[]): string { : `No Gitea repo link established` } - +
+ + +
` ) @@ -271,6 +294,27 @@ function renderAttachmentList(items: string[], emptyText: string): string { `; } +function renderScreenshotList(screenshots: ScreenshotAttachment[]): string { + if (!screenshots.length) { + return `No screenshots captured.`; + } + + return ` +
+ ${screenshots + .map( + (screenshot) => ` +
+ ${escapeHtml(screenshot.name)} +
${escapeHtml(screenshot.name)}
+
+ ` + ) + .join("")} +
+ `; +} + function renderAddIssue(): string { const state = appStore.getState(); const knownUrl = getActiveKnownUrl(); @@ -308,12 +352,11 @@ function renderAddIssue(): string {
Screenshots - +
- ${renderAttachmentList( - draft.screenshots.map((screenshot) => screenshot.name), - "No screenshots captured." - )} + ${renderScreenshotList(draft.screenshots)}