This commit is contained in:
@@ -44,14 +44,16 @@ Use `.env.local` for local secrets. Keep `.env.local` and any real token-bearing
|
|||||||
- Runtime API calls are centralized in `src/api.ts`.
|
- Runtime API calls are centralized in `src/api.ts`.
|
||||||
- Side panel state is centralized in the vanilla Zustand store at `src/store.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 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, Prompts, Issues, Add Issue, and Agents. Agents must stay as the far-right menu item.
|
- The side panel has icon menu sections for Add URL, URLs, Gitea repos, Issues, Add Issue, Agents, Prompts, and Workspaces. Prompts must stay to the right of Agents, and Workspaces must stay to the right of Prompts.
|
||||||
- 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.
|
- 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.
|
- 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 and must allow adding, editing, and deleting persisted agents from `chrome.storage.local`. At least one agent must remain available.
|
- 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}}`. It must tell downstream agents to close the Gitea issue after the implementation has been pushed, and to leave a Gitea issue comment when delivery is blocked, partial, or risky.
|
- 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}}`. It must tell downstream agents to close the Gitea issue after the implementation has been pushed, and to leave a Gitea issue comment when delivery is blocked, partial, or risky.
|
||||||
- The Prompts view manages workspace-scoped default prompts persisted in `chrome.storage.local` under `silmaAide.prompts`. Prompt records must include a name, workspace path, and content.
|
- The Workspaces view lists generated workspaces from `workspace_Father` plus user-added workspaces persisted in `chrome.storage.local` under `silmaAide.userWorkspaces`. User-added workspaces require an absolute local path and may be deleted from the side panel.
|
||||||
|
- The Prompts view manages workspace-scoped default prompts persisted in `chrome.storage.local` under `silmaAide.prompts`. Prompt records must include a name, workspace path, and content. When opening Prompts for a new prompt, the workspace selector should default to the active known URL's workspace/site when available.
|
||||||
- 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 a workspace prompt above Content, let the user select an agent file and issue labels, capture visible-tab screenshots, accept multiple accumulated Gitea-friendly file attachments, and include `Chrome profile: Silma` plus the selected agent in created issue bodies.
|
- 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 a workspace prompt above Content, let the user select an agent file and issue labels, capture visible-tab screenshots, accept multiple accumulated Gitea-friendly file attachments, and include `Chrome profile: Silma` plus the selected agent in created issue bodies.
|
||||||
- The Add Issue default prompt dropdown must only show prompts attached to the active URL's workspace path. Selecting a prompt copies its content into the editable Content field for human adjustment.
|
- The Add Issue default prompt dropdown must only show prompts attached to the active URL's workspace path. Selecting a prompt copies its content into the editable Content field for human adjustment.
|
||||||
|
- Created issue bodies must put the human-entered idea/change request under `# Requirements` and the generated source URL, base URL, workspace, repo, agent, and Chrome profile metadata under `# References`.
|
||||||
- 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, and the preview panel should use the available viewport without horizontal scrolling.
|
- 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, and the preview panel should use the available viewport without horizontal scrolling.
|
||||||
- Label options for issue creation and editing are `Change Request`, `Idea`, `Tabitha`, `Orson`, `Belisarius`, `Ozymandias`, and `Ready`.
|
- Label options for issue creation and editing are `Change Request`, `Idea`, `Tabitha`, `Orson`, `Belisarius`, `Ozymandias`, and `Ready`.
|
||||||
- Newly created issues must default to the `Change Request` label unless the user changes the selected labels.
|
- Newly created issues must default to the `Change Request` label unless the user changes the selected labels.
|
||||||
@@ -62,7 +64,7 @@ Use `.env.local` for local secrets. Keep `.env.local` and any real token-bearing
|
|||||||
- Clicking the selected Issues row again or clicking the detail close control must close the selected issue detail panel without deleting or changing the issue.
|
- Clicking the selected Issues row again or clicking the detail close control must close the selected issue detail panel without deleting or changing the issue.
|
||||||
- Saving selected issue edits must use the selected issue's repo identity from Issues, include Gitea's current issue content version when available, verify the saved subject/content with a readback before reporting success, and must never fall back to the active tab's repo.
|
- Saving selected issue edits must use the selected issue's repo identity from Issues, include Gitea's current issue content version when available, verify the saved subject/content with a readback before reporting success, and must never fall back to the active tab's repo.
|
||||||
- Existing issue rows must allow deleting the issue. Existing issue labels must be editable from the selected issue form and saved through the Gitea issue labels endpoint. Existing issue attachments must be removable, and additional screenshots/files must be uploadable directly to the issue without creating a comment. Deletion must require user confirmation.
|
- Existing issue rows must allow deleting the issue. Existing issue labels must be editable from the selected issue form and saved through the Gitea issue labels endpoint. Existing issue attachments must be removable, and additional screenshots/files must be uploadable directly to the issue without creating a comment. Deletion must require user confirmation.
|
||||||
- Text-entry updates in Add Issue, selected issue edits, Issues comments, and Agents must not re-render the focused form control or blur the user while they type.
|
- Text-entry updates in Add Issue, selected issue edits, Issues comments, Agents, Prompts, and Workspaces must not re-render the focused form control or blur the user while they type.
|
||||||
- Keep the Add Issue view dense; do not show the redundant view header title/description inside this view.
|
- Keep the Add Issue view dense; do not show the redundant view header title/description inside this view.
|
||||||
- The extension requests `activeTab` and `<all_urls>` host permission so screenshots can be captured from the current Chrome tab even after the side panel has stayed open across tab changes.
|
- The extension requests `activeTab` and `<all_urls>` host permission so screenshots can be captured from the current Chrome tab even after the side panel has stayed open across tab changes.
|
||||||
- Gitea API errors should include the failed operation and, for network-level failures, the configured Gitea API base URL plus actionable checks for env, extension host permissions, network/VPN access, token scope, and attachment size.
|
- Gitea API errors should include the failed operation and, for network-level failures, the configured Gitea API base URL plus actionable checks for env, extension host permissions, network/VPN access, token scope, and attachment size.
|
||||||
|
|||||||
@@ -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.
|
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, Prompts, Issues, Add Issue, and Agents, with Agents pinned to the far right. 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 Prompts view manages workspace-scoped default prompts in `chrome.storage.local`; Add Issue shows matching prompts above Content and copies the selected prompt into the editable content field. 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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to comment when delivery is blocked, partial, or risky. 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 selected labels, and uploads the rendered agent file plus accumulated screenshots and files as issue assets. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll crop panel. Issues lists recent issues by creation time, defaults to open issues for the current repo, can expand to all loaded repos, has Open/Closed status checkboxes plus an empty-by-default label filter, and lets a selected issue open directly in Gitea, log a placeholder Send to Codex payload, edit subject/content/labels against that issue's repo with content-version readback verification, view attachments and comments, upload more screenshots/files directly to the issue, and add a comment with screenshots and file attachments. Clicking the selected issue row again or the detail close control collapses the detail panel. Rows can be deleted, and existing issue attachments can be deleted. Gitea API errors include the failed operation and network-level failures identify the configured API base plus common checks.
|
The app opens in the Chrome side panel. The top icon menu includes Add URL, URLs, Gitea repos, Issues, Add Issue, Agents, Prompts, and Workspaces. 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. Workspaces includes generated `workspace_Father` entries plus user-added absolute local paths stored in `chrome.storage.local`. The Prompts view manages workspace-scoped default prompts in `chrome.storage.local`; new prompt workspace selection defaults to the active known URL's workspace when available, and Add Issue shows matching prompts above Content and copies the selected prompt into the editable content field. 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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to comment when delivery is blocked, partial, or risky. 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 selected labels, writes requirements under `# Requirements` and metadata under `# References`, and uploads the rendered agent file plus accumulated screenshots and files as issue assets. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll crop panel. Issues lists recent issues by creation time, defaults to open issues for the current repo, can expand to all loaded repos, has Open/Closed status checkboxes plus an empty-by-default label filter, and lets a selected issue open directly in Gitea, log a placeholder Send to Codex payload, edit subject/content/labels against that issue's repo with content-version readback verification, view attachments and comments, upload more screenshots/files directly to the issue, and add a comment with screenshots and file attachments. Clicking the selected issue row again or the detail close control collapses the detail panel. Rows can be deleted, and existing issue attachments can be deleted. Gitea API errors include the failed operation and network-level failures identify the configured API base plus common checks.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Required variables:
|
|||||||
- Captured screenshots should appear immediately in Add Issue as thumbnail rows.
|
- Captured screenshots should appear immediately in Add Issue as thumbnail rows.
|
||||||
- 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, and the preview panel should fit the available viewport without horizontal scrolling.
|
- 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, and the preview panel should fit the available viewport without horizontal scrolling.
|
||||||
- File attachments are accumulated across picker selections and all selected files must be uploaded to Gitea.
|
- 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 issue bodies must put the human-entered idea/change request under `# Requirements` and generated metadata under `# References`, including `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}}`.
|
- 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 use the selected labels.
|
- Newly created issues must use the selected labels.
|
||||||
|
|
||||||
@@ -75,7 +75,15 @@ Required variables:
|
|||||||
|
|
||||||
- The Prompts menu item is workspace-scoped and stores prompt records in `silmaAide.prompts`.
|
- The Prompts menu item is workspace-scoped and stores prompt records in `silmaAide.prompts`.
|
||||||
- The Prompts view must allow adding, editing, and deleting prompts with a name, workspace path, and content.
|
- The Prompts view must allow adding, editing, and deleting prompts with a name, workspace path, and content.
|
||||||
- Agents must remain the far-right toolbar item when new menu items are added.
|
- New prompt workspace selection should default to the active known URL's workspace/site when available.
|
||||||
|
- Prompts must remain to the right of Agents in the toolbar.
|
||||||
|
|
||||||
|
## Workspace Management
|
||||||
|
|
||||||
|
- Workspaces must remain to the right of Prompts in the toolbar.
|
||||||
|
- The Workspaces view shows generated workspaces from `workspace_Father` plus user-added workspaces from `silmaAide.userWorkspaces`.
|
||||||
|
- User-added workspaces require an absolute local path and can be deleted from the side panel.
|
||||||
|
- Add URL workspace selection should include both generated and user-added workspaces.
|
||||||
|
|
||||||
## Gitea Error Reporting
|
## Gitea Error Reporting
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -22,14 +22,6 @@
|
|||||||
<i data-lucide="git-branch"></i>
|
<i data-lucide="git-branch"></i>
|
||||||
<span>Gitea Repos</span>
|
<span>Gitea Repos</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="tool-button" type="button" data-view="workspaces" title="Workspaces">
|
|
||||||
<i data-lucide="folder-git-2"></i>
|
|
||||||
<span>Workspaces</span>
|
|
||||||
</button>
|
|
||||||
<button class="tool-button" type="button" data-view="prompts" title="Prompts">
|
|
||||||
<i data-lucide="file-text"></i>
|
|
||||||
<span>Prompts</span>
|
|
||||||
</button>
|
|
||||||
<button class="tool-button" type="button" data-view="open-issues" title="Issues">
|
<button class="tool-button" type="button" data-view="open-issues" title="Issues">
|
||||||
<i data-lucide="list-checks"></i>
|
<i data-lucide="list-checks"></i>
|
||||||
<span>Issues</span>
|
<span>Issues</span>
|
||||||
@@ -42,6 +34,14 @@
|
|||||||
<i data-lucide="bot"></i>
|
<i data-lucide="bot"></i>
|
||||||
<span>Agents</span>
|
<span>Agents</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="tool-button" type="button" data-view="prompts" title="Prompts">
|
||||||
|
<i data-lucide="file-text"></i>
|
||||||
|
<span>Prompts</span>
|
||||||
|
</button>
|
||||||
|
<button class="tool-button" type="button" data-view="workspaces" title="Workspaces">
|
||||||
|
<i data-lucide="folder-git-2"></i>
|
||||||
|
<span>Workspaces</span>
|
||||||
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<section class="content-panel">
|
<section class="content-panel">
|
||||||
|
|||||||
@@ -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.
|
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, Prompts, Issues, Add Issue, and Agents; Agents must stay at the far right. 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 Prompts view manages workspace-scoped default prompts in `chrome.storage.local` under `silmaAide.prompts`; Add Issue shows prompts matching the active URL workspace above Content and copies the selected prompt into the editable Content field for human adjustment. 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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to leave a Gitea issue comment when delivery is blocked, partial, or risky. 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 and issue labels, creates the Gitea issue with the selected labels, and uploads the rendered agent file plus all screenshots/files. The label options are Change Request, Idea, Tabitha, Orson, Belisarius, Ozymandias, and Ready; new issues default to Change Request. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll draggable/resizable crop panel. Created issue bodies include `Chrome profile: Silma` and the selected agent. Issues lists recent issues by creation time, defaults to open issues for the active URL's linked repo through an `Only current repo` checkbox, can load recent issues across all loaded repos, supports Open/Closed status multiselect filtering, has an empty-by-default label filter, and shows selected issue subject/content/label edit fields that save against the selected issue repo with Gitea content-version readback verification, a direct Open in Gitea link, a placeholder Send to Codex console log action, attachments, comment chains, direct selected-issue screenshot/file attachment uploads, and a comment form with text, screenshots, and file attachments. Clicking the selected issue row again or the detail close control collapses the detail panel. Existing issue rows can be deleted after confirmation, and existing issue attachments can be deleted. Text-entry state updates must not blur focused Add Issue, selected issue edit, Issues comment, Agents editor controls, or Prompts editor controls. Gitea API errors include the failed operation and network-level failures identify the configured API base with env, permissions, network/VPN, token scope, and attachment-size checks. 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, Issues, Add Issue, Agents, Prompts, and Workspaces; Prompts stay to the right of Agents, and Workspaces stays to the right of Prompts. 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. Workspaces combines generated `workspace_Father` entries with user-added absolute local paths stored under `silmaAide.userWorkspaces`. The Prompts view manages workspace-scoped default prompts in `chrome.storage.local` under `silmaAide.prompts`; new prompt workspace selection defaults to the active known URL's workspace/site when available, and Add Issue shows prompts matching the active URL workspace above Content and copies the selected prompt into the editable Content field for human adjustment. 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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to leave a Gitea issue comment when delivery is blocked, partial, or risky. 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 and issue labels, creates the Gitea issue with the selected labels, and uploads the rendered agent file plus all screenshots/files. The label options are Change Request, Idea, Tabitha, Orson, Belisarius, Ozymandias, and Ready; new issues default to Change Request. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll draggable/resizable crop panel. Created issue bodies put the human-entered idea/change request under `# Requirements` and generated metadata under `# References`, including `Chrome profile: Silma` and the selected agent. Issues lists recent issues by creation time, defaults to open issues for the active URL's linked repo through an `Only current repo` checkbox, can load recent issues across all loaded repos, supports Open/Closed status multiselect filtering, has an empty-by-default label filter, and shows selected issue subject/content/label edit fields that save against the selected issue repo with Gitea content-version readback verification, a direct Open in Gitea link, a placeholder Send to Codex console log action, attachments, comment chains, direct selected-issue screenshot/file attachment uploads, and a comment form with text, screenshots, and file attachments. Clicking the selected issue row again or the detail close control collapses the detail panel. Existing issue rows can be deleted after confirmation, and existing issue attachments can be deleted. Text-entry state updates must not blur focused Add Issue, selected issue edit, Issues comment, Agents editor controls, Prompts editor controls, or Workspaces editor controls. Gitea API errors include the failed operation and network-level failures identify the configured API base with env, permissions, network/VPN, token scope, and attachment-size checks. 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`.
|
Extension management rule: use the Codex Chrome extension with the Chrome profile named `Silma`. Do not use `Profile 1`.
|
||||||
|
|
||||||
|
|||||||
+15
-13
@@ -38,14 +38,6 @@
|
|||||||
"name": "Gitea Repos",
|
"name": "Gitea Repos",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "Workspaces",
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Prompts",
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Issues",
|
"name": "Issues",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
@@ -56,18 +48,28 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Agents",
|
"name": "Agents",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Prompts",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"position": "far right"
|
"position": "right of Agents"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Workspaces",
|
||||||
|
"enabled": true,
|
||||||
|
"position": "right of Prompts"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repo_ordering": "Gitea repos are ordered by latest default-branch commit timestamp.",
|
"repo_ordering": "Gitea repos are ordered by latest default-branch commit timestamp.",
|
||||||
"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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to leave a Gitea issue comment when delivery is blocked, partial, or risky; persisted built-in global agents should pick up these required completion rules without replacing unrelated custom text.",
|
"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. The default global agent tells downstream agents to close the Gitea issue after pushing the implementation and to leave a Gitea issue comment when delivery is blocked, partial, or risky; persisted built-in global agents should pick up these required completion rules without replacing unrelated custom text.",
|
||||||
"prompts_behavior": "The Prompts view manages workspace-scoped prompt records persisted in chrome.storage.local under silmaAide.prompts. Each prompt has a name, workspace path, and content. Add Issue shows prompts matching the active known URL's workspace path immediately above Content, and selecting one copies prompt content into the editable Content field for human adjustment.",
|
"prompts_behavior": "The Prompts view manages workspace-scoped prompt records persisted in chrome.storage.local under silmaAide.prompts. Each prompt has a name, workspace path, and content. New prompt workspace selection defaults to the active known URL's workspace/site when available. Add Issue shows prompts matching the active known URL's workspace path immediately above Content, and selecting one copies prompt content into the editable Content field for human adjustment.",
|
||||||
"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.",
|
"workspaces_behavior": "The Workspaces view combines generated workspace_Father entries with user-added absolute local paths persisted in chrome.storage.local under silmaAide.userWorkspaces. User-added workspaces can be deleted from the side panel.",
|
||||||
|
"add_url_behavior": "The user must pick either a workspace or a Gitea repo. The app infers the linked counterpart from generated and user-added workspace 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.",
|
"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 and active URL for the active known URL, lets the user select a workspace prompt, agent file, and issue labels, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, creates a Gitea issue with the selected labels, and uploads the rendered agent file plus all screenshots/files as issue assets. Label options are Change Request, Idea, Tabitha, Orson, Belisarius, Ozymandias, and Ready; new issues default to Change Request. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll draggable/resizable crop panel. Issue bodies include Chrome profile: Silma and the selected agent. The view intentionally omits the redundant Add Issue header copy.",
|
"add_issue_behavior": "The form shows the target repo and active URL for the active known URL, lets the user select a workspace prompt, agent file, and issue labels, captures visible-tab screenshots with thumbnails, accepts accumulated file attachments, creates a Gitea issue with the selected labels, and uploads the rendered agent file plus all screenshots/files as issue assets. Label options are Change Request, Idea, Tabitha, Orson, Belisarius, Ozymandias, and Ready; new issues default to Change Request. Captured screenshots can be expanded, removed, or cropped with a wider no-horizontal-scroll draggable/resizable crop panel. Issue bodies put human-entered idea/change request content under # Requirements and generated metadata under # References, including Chrome profile: Silma and the selected agent. The view intentionally omits the redundant Add Issue header copy.",
|
||||||
"open_issues_behavior": "Issues lists recent issues ordered by creation time. The Only current repo checkbox defaults to true and limits rows to the active URL's linked Gitea repo; disabling it loads recent issues from all repos already loaded by the extension. Status filtering uses Open and Closed checkboxes as a multiselect with Open checked by default. Label filtering defaults to empty and filters visible rows by a selected known label.",
|
"open_issues_behavior": "Issues lists recent issues ordered by creation time. The Only current repo checkbox defaults to true and limits rows to the active URL's linked Gitea repo; disabling it loads recent issues from all repos already loaded by the extension. Status filtering uses Open and Closed checkboxes as a multiselect with Open checked by default. Label filtering defaults to empty and filters visible rows by a selected known label.",
|
||||||
"issue_comment_behavior": "Issues owns existing issue follow-up. Selecting an issue shows a direct Open in Gitea link, a placeholder Send to Codex button that logs the selected issue payload, editable issue subject/content/label fields that save against the selected issue repo with Gitea content-version readback verification and through Gitea's issue labels endpoint, issue attachments, direct attachment upload controls, 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. Clicking the selected issue row again or the detail close control collapses the detail panel. Existing issue attachments can be deleted, and additional selected-issue screenshots/files can be uploaded directly as issue assets without creating a comment. Issue rows can delete the issue after confirmation. Draft text-entry updates must not blur focused Add Issue, selected issue edit, Issues comment, Agents editor controls, or Prompts editor controls.",
|
"issue_comment_behavior": "Issues owns existing issue follow-up. Selecting an issue shows a direct Open in Gitea link, a placeholder Send to Codex button that logs the selected issue payload, editable issue subject/content/label fields that save against the selected issue repo with Gitea content-version readback verification and through Gitea's issue labels endpoint, issue attachments, direct attachment upload controls, 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. Clicking the selected issue row again or the detail close control collapses the detail panel. Existing issue attachments can be deleted, and additional selected-issue screenshots/files can be uploaded directly as issue assets without creating a comment. Issue rows can delete the issue after confirmation. Draft text-entry updates must not blur focused Add Issue, selected issue edit, Issues comment, Agents editor controls, Prompts editor controls, or Workspaces editor controls.",
|
||||||
"gitea_error_behavior": "Gitea API failures should include the failed operation. Network-level failures identify the configured Gitea API base URL and point to checks for VITE_GITEA_BASE_URL, Chrome extension host permissions, network/VPN access, token scope, and attachment size.",
|
"gitea_error_behavior": "Gitea API failures should include the failed operation. Network-level failures identify the configured Gitea API base URL and point to checks for VITE_GITEA_BASE_URL, Chrome extension host permissions, network/VPN access, token scope, and attachment size.",
|
||||||
"known_urls": [
|
"known_urls": [
|
||||||
{
|
{
|
||||||
|
|||||||
+74
-11
@@ -17,6 +17,7 @@ import {
|
|||||||
appStore,
|
appStore,
|
||||||
CHROME_PROFILE_NAME,
|
CHROME_PROFILE_NAME,
|
||||||
findKnownUrlForBase,
|
findKnownUrlForBase,
|
||||||
|
getAllWorkspaces,
|
||||||
ISSUE_LABEL_OPTIONS,
|
ISSUE_LABEL_OPTIONS,
|
||||||
type AgentProfile,
|
type AgentProfile,
|
||||||
type AddUrlMode,
|
type AddUrlMode,
|
||||||
@@ -182,8 +183,15 @@ function renderRepos(repos: GiteaRepoSummary[]): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderWorkspaces(workspaces: LocalWorkspace[]): string {
|
function renderWorkspaces(workspaces: LocalWorkspace[]): string {
|
||||||
|
const state = appStore.getState();
|
||||||
|
const userWorkspacePaths = new Set(state.userWorkspaces.map((workspace) => workspace.path));
|
||||||
|
const draft = state.workspaceDraft;
|
||||||
|
|
||||||
if (!workspaces.length) {
|
if (!workspaces.length) {
|
||||||
return `<div class="empty-state">No workspaces found in workspace_Father.</div>`;
|
return `
|
||||||
|
<div class="empty-state">No workspaces found in workspace_Father.</div>
|
||||||
|
${renderWorkspaceEditor(draft)}
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `
|
return `
|
||||||
@@ -206,11 +214,37 @@ function renderWorkspaces(workspaces: LocalWorkspace[]): string {
|
|||||||
<p class="path-text">${escapeHtml(workspace.path)}</p>
|
<p class="path-text">${escapeHtml(workspace.path)}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="repo-link-list">${links}</div>
|
<div class="repo-link-list">${links}</div>
|
||||||
|
<div class="workspace-actions">
|
||||||
|
${
|
||||||
|
userWorkspacePaths.has(workspace.path)
|
||||||
|
? `<button class="danger-button compact-button" type="button" data-delete-user-workspace="${escapeHtml(workspace.path)}">Delete</button>`
|
||||||
|
: `<span class="muted">Generated</span>`
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
`;
|
`;
|
||||||
})
|
})
|
||||||
.join("")}
|
.join("")}
|
||||||
</div>
|
</div>
|
||||||
|
${renderWorkspaceEditor(draft)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderWorkspaceEditor(draft: { name: string; path: string }): string {
|
||||||
|
return `
|
||||||
|
<article class="item-card workspace-editor-card">
|
||||||
|
<div class="form-stack">
|
||||||
|
<label>
|
||||||
|
<span>Name</span>
|
||||||
|
<input id="workspace-name" type="text" value="${escapeHtml(draft.name)}" placeholder="workspace-name" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>Path</span>
|
||||||
|
<input id="workspace-path" type="text" value="${escapeHtml(draft.path)}" placeholder="/Users/Tabitha/path/to/workspace" />
|
||||||
|
</label>
|
||||||
|
<button id="save-workspace" class="primary-button" type="button" ${draft.path.trim() ? "" : "disabled"}>Add workspace</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,9 +299,7 @@ function renderAgents(agents: AgentProfile[]): string {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function workspacePathOptions(context: LocalContext | null, selectedPath: string): string {
|
function workspacePathOptions(workspaces: LocalWorkspace[], selectedPath: string): string {
|
||||||
const workspaces = context?.workspaces ?? [];
|
|
||||||
|
|
||||||
if (!workspaces.length) {
|
if (!workspaces.length) {
|
||||||
return selectedPath
|
return selectedPath
|
||||||
? `<option value="${escapeHtml(selectedPath)}" selected>${escapeHtml(selectedPath)}</option>`
|
? `<option value="${escapeHtml(selectedPath)}" selected>${escapeHtml(selectedPath)}</option>`
|
||||||
@@ -319,7 +351,7 @@ function renderPrompts(prompts: WorkspacePrompt[]): string {
|
|||||||
<span>Workspace</span>
|
<span>Workspace</span>
|
||||||
<select id="prompt-workspace">
|
<select id="prompt-workspace">
|
||||||
<option value="">Pick a workspace</option>
|
<option value="">Pick a workspace</option>
|
||||||
${workspacePathOptions(state.localContext, draft.workspacePath)}
|
${workspacePathOptions(getAllWorkspaces(state), draft.workspacePath)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
@@ -372,11 +404,11 @@ function selectedAttribute(value: string, selectedValue: string): string {
|
|||||||
return value === selectedValue ? " selected" : "";
|
return value === selectedValue ? " selected" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function workspaceOptions(context: LocalContext, selectedValue: string): string {
|
function workspaceOptions(workspaces: LocalWorkspace[], selectedValue: string): string {
|
||||||
return context.workspaces
|
return workspaces
|
||||||
.map(
|
.map(
|
||||||
(workspace) =>
|
(workspace) =>
|
||||||
`<option value="${escapeHtml(workspace.name)}"${selectedAttribute(workspace.name, selectedValue)}>${escapeHtml(workspace.name)}</option>`
|
`<option value="${escapeHtml(workspace.path)}"${workspace.path === selectedValue || workspace.name === selectedValue ? " selected" : ""}>${escapeHtml(workspace.name)}</option>`
|
||||||
)
|
)
|
||||||
.join("");
|
.join("");
|
||||||
}
|
}
|
||||||
@@ -414,6 +446,7 @@ function renderAddUrl(): string {
|
|||||||
|
|
||||||
const mode = state.addUrlDraft.mode;
|
const mode = state.addUrlDraft.mode;
|
||||||
const selectedValue = state.addUrlDraft.selectedValue;
|
const selectedValue = state.addUrlDraft.selectedValue;
|
||||||
|
const workspaces = getAllWorkspaces(state);
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<article class="item-card">
|
<article class="item-card">
|
||||||
@@ -439,7 +472,7 @@ function renderAddUrl(): string {
|
|||||||
<span>${mode === "repo" ? "Gitea repo" : "Workspace"}</span>
|
<span>${mode === "repo" ? "Gitea repo" : "Workspace"}</span>
|
||||||
<select id="add-url-selection" ${mode ? "" : "disabled"}>
|
<select id="add-url-selection" ${mode ? "" : "disabled"}>
|
||||||
<option value="">Pick ${mode === "repo" ? "a repo" : "a workspace"}</option>
|
<option value="">Pick ${mode === "repo" ? "a repo" : "a workspace"}</option>
|
||||||
${mode === "repo" ? repoOptions(context, selectedValue) : workspaceOptions(context, selectedValue)}
|
${mode === "repo" ? repoOptions(context, selectedValue) : workspaceOptions(workspaces, selectedValue)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -1043,6 +1076,31 @@ function bindViewActions(): void {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
viewContent?.querySelector<HTMLInputElement>("#workspace-name")?.addEventListener("input", (event) => {
|
||||||
|
appStore.getState().setWorkspaceDraft({
|
||||||
|
name: (event.target as HTMLInputElement).value
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
viewContent?.querySelector<HTMLInputElement>("#workspace-path")?.addEventListener("input", (event) => {
|
||||||
|
appStore.getState().setWorkspaceDraft({
|
||||||
|
path: (event.target as HTMLInputElement).value
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
viewContent?.querySelector<HTMLButtonElement>("#save-workspace")?.addEventListener("click", () => {
|
||||||
|
void appStore.getState().saveWorkspace();
|
||||||
|
});
|
||||||
|
|
||||||
|
viewContent?.querySelectorAll<HTMLButtonElement>("[data-delete-user-workspace]").forEach((button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
const path = button.dataset.deleteUserWorkspace;
|
||||||
|
if (path && window.confirm("Delete this user-added workspace?")) {
|
||||||
|
void appStore.getState().deleteUserWorkspace(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
viewContent?.querySelector<HTMLInputElement>("#prompt-name")?.addEventListener("input", (event) => {
|
viewContent?.querySelector<HTMLInputElement>("#prompt-name")?.addEventListener("input", (event) => {
|
||||||
appStore.getState().setPromptDraft({
|
appStore.getState().setPromptDraft({
|
||||||
name: (event.target as HTMLInputElement).value
|
name: (event.target as HTMLInputElement).value
|
||||||
@@ -1493,7 +1551,7 @@ function renderView(): void {
|
|||||||
if (state.activeView === "repos") {
|
if (state.activeView === "repos") {
|
||||||
viewContent.innerHTML = renderRepos(state.repos);
|
viewContent.innerHTML = renderRepos(state.repos);
|
||||||
} else if (state.activeView === "workspaces") {
|
} else if (state.activeView === "workspaces") {
|
||||||
viewContent.innerHTML = renderWorkspaces(context?.workspaces ?? []);
|
viewContent.innerHTML = renderWorkspaces(getAllWorkspaces(state));
|
||||||
} else if (state.activeView === "prompts") {
|
} else if (state.activeView === "prompts") {
|
||||||
viewContent.innerHTML = renderPrompts(state.prompts);
|
viewContent.innerHTML = renderPrompts(state.prompts);
|
||||||
} else if (state.activeView === "agents") {
|
} else if (state.activeView === "agents") {
|
||||||
@@ -1547,7 +1605,7 @@ function shouldRenderView(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return !activeElement.matches(
|
return !activeElement.matches(
|
||||||
"#issue-subject, #issue-content, #issue-agent, #selected-issue-subject, #selected-issue-content, #issue-comment-content, #agent-name, #agent-file, #agent-description, #agent-content, #prompt-name, #prompt-content, [data-label-target]"
|
"#issue-subject, #issue-content, #issue-agent, #selected-issue-subject, #selected-issue-content, #issue-comment-content, #agent-name, #agent-file, #agent-description, #agent-content, #prompt-name, #prompt-content, #workspace-name, #workspace-path, [data-label-target]"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1556,6 +1614,7 @@ function syncFocusedFormControls(): void {
|
|||||||
const createIssue = viewContent?.querySelector<HTMLButtonElement>("#create-issue");
|
const createIssue = viewContent?.querySelector<HTMLButtonElement>("#create-issue");
|
||||||
const saveSelectedIssue = viewContent?.querySelector<HTMLButtonElement>("#save-selected-issue");
|
const saveSelectedIssue = viewContent?.querySelector<HTMLButtonElement>("#save-selected-issue");
|
||||||
const submitComment = viewContent?.querySelector<HTMLButtonElement>("#submit-issue-comment");
|
const submitComment = viewContent?.querySelector<HTMLButtonElement>("#submit-issue-comment");
|
||||||
|
const saveWorkspace = viewContent?.querySelector<HTMLButtonElement>("#save-workspace");
|
||||||
|
|
||||||
if (createIssue) {
|
if (createIssue) {
|
||||||
createIssue.disabled = !state.issueDraft.subject.trim() || state.isCreatingIssue;
|
createIssue.disabled = !state.issueDraft.subject.trim() || state.isCreatingIssue;
|
||||||
@@ -1569,6 +1628,10 @@ function syncFocusedFormControls(): void {
|
|||||||
state.isCreatingIssueComment;
|
state.isCreatingIssueComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveWorkspace) {
|
||||||
|
saveWorkspace.disabled = !state.workspaceDraft.path.trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (saveSelectedIssue && state.selectedIssueDetail) {
|
if (saveSelectedIssue && state.selectedIssueDetail) {
|
||||||
const detailLabels = ISSUE_LABEL_OPTIONS.filter((label) =>
|
const detailLabels = ISSUE_LABEL_OPTIONS.filter((label) =>
|
||||||
state.selectedIssueDetail?.issue.labels.some((issueLabel) => issueLabel.toLowerCase() === label.toLowerCase())
|
state.selectedIssueDetail?.issue.labels.some((issueLabel) => issueLabel.toLowerCase() === label.toLowerCase())
|
||||||
|
|||||||
+156
-23
@@ -120,6 +120,11 @@ interface AddUrlDraft {
|
|||||||
selectedValue: string;
|
selectedValue: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface WorkspaceDraft {
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ScreenshotAttachment {
|
export interface ScreenshotAttachment {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -181,11 +186,13 @@ interface AppState {
|
|||||||
connectedUser: GiteaUser | null;
|
connectedUser: GiteaUser | null;
|
||||||
repos: GiteaRepoSummary[];
|
repos: GiteaRepoSummary[];
|
||||||
localContext: LocalContext | null;
|
localContext: LocalContext | null;
|
||||||
|
userWorkspaces: LocalWorkspace[];
|
||||||
userUrls: KnownUrl[];
|
userUrls: KnownUrl[];
|
||||||
deletedUrlBases: string[];
|
deletedUrlBases: string[];
|
||||||
activeTabUrl: string;
|
activeTabUrl: string;
|
||||||
activeBaseUrl: string;
|
activeBaseUrl: string;
|
||||||
addUrlDraft: AddUrlDraft;
|
addUrlDraft: AddUrlDraft;
|
||||||
|
workspaceDraft: WorkspaceDraft;
|
||||||
issueDraft: IssueDraft;
|
issueDraft: IssueDraft;
|
||||||
issueCommentDraft: IssueCommentDraft;
|
issueCommentDraft: IssueCommentDraft;
|
||||||
issueAttachmentDraft: IssueAttachmentDraft;
|
issueAttachmentDraft: IssueAttachmentDraft;
|
||||||
@@ -224,6 +231,9 @@ interface AppState {
|
|||||||
clearStatus: () => void;
|
clearStatus: () => void;
|
||||||
setActiveView: (view: AppView) => void;
|
setActiveView: (view: AppView) => void;
|
||||||
setAddUrlDraft: (draft: Partial<AddUrlDraft>) => void;
|
setAddUrlDraft: (draft: Partial<AddUrlDraft>) => void;
|
||||||
|
setWorkspaceDraft: (draft: Partial<WorkspaceDraft>) => void;
|
||||||
|
saveWorkspace: () => Promise<void>;
|
||||||
|
deleteUserWorkspace: (path: string) => Promise<void>;
|
||||||
setIssueDraft: (draft: Partial<Omit<IssueDraft, "screenshots" | "files">>) => void;
|
setIssueDraft: (draft: Partial<Omit<IssueDraft, "screenshots" | "files">>) => void;
|
||||||
setIssueFiles: (files: File[]) => void;
|
setIssueFiles: (files: File[]) => void;
|
||||||
deleteIssueFile: (index: number) => void;
|
deleteIssueFile: (index: number) => void;
|
||||||
@@ -277,6 +287,7 @@ interface AppState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const USER_URLS_STORAGE_KEY = "silmaAide.userUrls";
|
const USER_URLS_STORAGE_KEY = "silmaAide.userUrls";
|
||||||
|
const USER_WORKSPACES_STORAGE_KEY = "silmaAide.userWorkspaces";
|
||||||
const DELETED_URL_BASES_STORAGE_KEY = "silmaAide.deletedUrlBases";
|
const DELETED_URL_BASES_STORAGE_KEY = "silmaAide.deletedUrlBases";
|
||||||
const AGENTS_STORAGE_KEY = "silmaAide.agents";
|
const AGENTS_STORAGE_KEY = "silmaAide.agents";
|
||||||
const PROMPTS_STORAGE_KEY = "silmaAide.prompts";
|
const PROMPTS_STORAGE_KEY = "silmaAide.prompts";
|
||||||
@@ -358,8 +369,19 @@ function getActiveBrowserTab(): Promise<chrome.tabs.Tab> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function findWorkspaceByName(context: LocalContext, name: string): LocalWorkspace | undefined {
|
export function getAllWorkspaces(state: Pick<AppState, "localContext" | "userWorkspaces">): LocalWorkspace[] {
|
||||||
return context.workspaces.find((workspace) => workspace.name === name);
|
const workspaces = [...(state.localContext?.workspaces ?? []), ...state.userWorkspaces];
|
||||||
|
return workspaces.filter(
|
||||||
|
(workspace, index) => workspaces.findIndex((item) => item.path === workspace.path) === index
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function findWorkspaceByName(state: AppState, name: string): LocalWorkspace | undefined {
|
||||||
|
return getAllWorkspaces(state).find((workspace) => workspace.name === name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function findWorkspaceByPath(state: AppState, path: string): LocalWorkspace | undefined {
|
||||||
|
return getAllWorkspaces(state).find((workspace) => workspace.path === path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function findRepoByFullName(context: LocalContext, fullName: string): LocalGiteaRepoLink | null {
|
function findRepoByFullName(context: LocalContext, fullName: string): LocalGiteaRepoLink | null {
|
||||||
@@ -377,12 +399,16 @@ function allKnownUrls(state: AppState): KnownUrl[] {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findKnownUrlForBase(state: AppState): KnownUrl | null {
|
function findKnownUrlByBase(state: AppState, baseUrl: string): KnownUrl | null {
|
||||||
if (!state.activeBaseUrl) {
|
if (!baseUrl) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return allKnownUrls(state).find((knownUrl) => getBaseUrl(knownUrl.url) === state.activeBaseUrl) ?? null;
|
return allKnownUrls(state).find((knownUrl) => getBaseUrl(knownUrl.url) === baseUrl) ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findKnownUrlForBase(state: AppState): KnownUrl | null {
|
||||||
|
return findKnownUrlByBase(state, state.activeBaseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseRepoFullName(fullName: string): { owner: string; repo: string } | null {
|
function parseRepoFullName(fullName: string): { owner: string; repo: string } | null {
|
||||||
@@ -512,7 +538,8 @@ function inferUrlLink(context: LocalContext, baseUrl: string, draft: AddUrlDraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (draft.mode === "workspace") {
|
if (draft.mode === "workspace") {
|
||||||
const workspace = findWorkspaceByName(context, draft.selectedValue);
|
const state = appStore.getState();
|
||||||
|
const workspace = findWorkspaceByPath(state, draft.selectedValue) ?? findWorkspaceByName(state, draft.selectedValue);
|
||||||
if (!workspace) {
|
if (!workspace) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -530,7 +557,7 @@ function inferUrlLink(context: LocalContext, baseUrl: string, draft: AddUrlDraft
|
|||||||
|
|
||||||
const repo = findRepoByFullName(context, draft.selectedValue);
|
const repo = findRepoByFullName(context, draft.selectedValue);
|
||||||
const worktree = context.gitWorktrees.find((item) => item.giteaRepo?.fullName === draft.selectedValue);
|
const worktree = context.gitWorktrees.find((item) => item.giteaRepo?.fullName === draft.selectedValue);
|
||||||
const workspace = worktree ? findWorkspaceByName(context, worktree.topWorkspaceName) : undefined;
|
const workspace = worktree ? findWorkspaceByName(appStore.getState(), worktree.topWorkspaceName) : undefined;
|
||||||
|
|
||||||
if (!repo || !workspace) {
|
if (!repo || !workspace) {
|
||||||
return null;
|
return null;
|
||||||
@@ -656,7 +683,7 @@ function normalizeAgents(agents: AgentProfile[]): AgentProfile[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFallbackWorkspacePath(state: AppState): string {
|
function getFallbackWorkspacePath(state: AppState): string {
|
||||||
return findKnownUrlForBase(state)?.workspacePath ?? state.localContext?.workspaces[0]?.path ?? "";
|
return findKnownUrlForBase(state)?.workspacePath ?? getAllWorkspaces(state)[0]?.path ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePrompt(prompt: Partial<WorkspacePrompt>, fallbackWorkspacePath: string): WorkspacePrompt {
|
function normalizePrompt(prompt: Partial<WorkspacePrompt>, fallbackWorkspacePath: string): WorkspacePrompt {
|
||||||
@@ -772,18 +799,17 @@ async function cropScreenshot(screenshot: ScreenshotAttachment, crop: CropArea):
|
|||||||
|
|
||||||
function buildIssueBody(state: AppState, knownUrl: KnownUrl): string {
|
function buildIssueBody(state: AppState, knownUrl: KnownUrl): string {
|
||||||
const agent = getAgentById(state.issueDraft.agentId, state.agents);
|
const agent = getAgentById(state.issueDraft.agentId, state.agents);
|
||||||
const parts = [
|
const requirements = state.issueDraft.content.trim() || "No requirements provided.";
|
||||||
state.issueDraft.content.trim(),
|
const references = [
|
||||||
"---",
|
`- Source URL: ${state.activeTabUrl || knownUrl.url}`,
|
||||||
`Source URL: ${state.activeTabUrl || knownUrl.url}`,
|
`- Base URL: ${state.activeBaseUrl || getBaseUrl(knownUrl.url)}`,
|
||||||
`Base URL: ${state.activeBaseUrl || getBaseUrl(knownUrl.url)}`,
|
`- Workspace: ${knownUrl.workspaceName} (${knownUrl.workspacePath})`,
|
||||||
`Workspace: ${knownUrl.workspaceName} (${knownUrl.workspacePath})`,
|
`- Gitea repo: ${knownUrl.giteaRepo?.fullName ?? "Not linked"}`,
|
||||||
`Gitea repo: ${knownUrl.giteaRepo?.fullName ?? "Not linked"}`,
|
`- Assigned agent: ${agent.name} (${agent.file})`,
|
||||||
`Assigned agent: ${agent.name} (${agent.file})`,
|
`- Chrome profile: ${CHROME_PROFILE_NAME}`
|
||||||
`Chrome profile: ${CHROME_PROFILE_NAME}`
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return parts.filter(Boolean).join("\n\n");
|
return [`# Requirements`, requirements, `# References`, references.join("\n")].join("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAgentContent(agent: AgentProfile, state: AppState, knownUrl: KnownUrl, issueNumber: number): string {
|
function renderAgentContent(agent: AgentProfile, state: AppState, knownUrl: KnownUrl, issueNumber: number): string {
|
||||||
@@ -831,6 +857,7 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
connectedUser: null,
|
connectedUser: null,
|
||||||
repos: [],
|
repos: [],
|
||||||
localContext: null,
|
localContext: null,
|
||||||
|
userWorkspaces: [],
|
||||||
userUrls: [],
|
userUrls: [],
|
||||||
deletedUrlBases: [],
|
deletedUrlBases: [],
|
||||||
activeTabUrl: "",
|
activeTabUrl: "",
|
||||||
@@ -839,6 +866,10 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
mode: null,
|
mode: null,
|
||||||
selectedValue: ""
|
selectedValue: ""
|
||||||
},
|
},
|
||||||
|
workspaceDraft: {
|
||||||
|
name: "",
|
||||||
|
path: ""
|
||||||
|
},
|
||||||
issueDraft: {
|
issueDraft: {
|
||||||
subject: "",
|
subject: "",
|
||||||
content: "",
|
content: "",
|
||||||
@@ -900,7 +931,17 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
}
|
}
|
||||||
set({ statusMessage: "", statusTone: "neutral" });
|
set({ statusMessage: "", statusTone: "neutral" });
|
||||||
},
|
},
|
||||||
setActiveView: (view) => set({ activeView: view }),
|
setActiveView: (view) =>
|
||||||
|
set((state) => ({
|
||||||
|
activeView: view,
|
||||||
|
promptDraft:
|
||||||
|
view === "prompts" && !state.editingPromptId
|
||||||
|
? {
|
||||||
|
...state.promptDraft,
|
||||||
|
workspacePath: getFallbackWorkspacePath(state)
|
||||||
|
}
|
||||||
|
: state.promptDraft
|
||||||
|
})),
|
||||||
setAddUrlDraft: (draft) =>
|
setAddUrlDraft: (draft) =>
|
||||||
set((state) => ({
|
set((state) => ({
|
||||||
addUrlDraft: {
|
addUrlDraft: {
|
||||||
@@ -908,6 +949,70 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
...draft
|
...draft
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
|
setWorkspaceDraft: (draft) =>
|
||||||
|
set((state) => ({
|
||||||
|
workspaceDraft: {
|
||||||
|
...state.workspaceDraft,
|
||||||
|
...draft
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
saveWorkspace: async () => {
|
||||||
|
const state = appStore.getState();
|
||||||
|
const path = state.workspaceDraft.path.trim().replace(/\/+$/, "");
|
||||||
|
const pathParts = path.split("/").filter(Boolean);
|
||||||
|
const name = state.workspaceDraft.name.trim() || pathParts[pathParts.length - 1] || "workspace";
|
||||||
|
|
||||||
|
if (!path.startsWith("/")) {
|
||||||
|
setStatus(set, "Workspace path must be an absolute local path.", "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspace: LocalWorkspace = {
|
||||||
|
name,
|
||||||
|
path,
|
||||||
|
linkedRepos: []
|
||||||
|
};
|
||||||
|
const userWorkspaces = [
|
||||||
|
...state.userWorkspaces.filter((item) => item.path !== path),
|
||||||
|
workspace
|
||||||
|
].sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
|
await storageSet(USER_WORKSPACES_STORAGE_KEY, userWorkspaces);
|
||||||
|
set({
|
||||||
|
userWorkspaces,
|
||||||
|
workspaceDraft: {
|
||||||
|
name: "",
|
||||||
|
path: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setStatus(set, `Added workspace ${name}.`, "success");
|
||||||
|
},
|
||||||
|
deleteUserWorkspace: async (path) => {
|
||||||
|
const state = appStore.getState();
|
||||||
|
const workspace = state.userWorkspaces.find((item) => item.path === path);
|
||||||
|
|
||||||
|
if (!workspace) {
|
||||||
|
setStatus(set, "Could not find that user-added workspace.", "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const userWorkspaces = state.userWorkspaces.filter((item) => item.path !== path);
|
||||||
|
await storageSet(USER_WORKSPACES_STORAGE_KEY, userWorkspaces);
|
||||||
|
set((current) => ({
|
||||||
|
userWorkspaces,
|
||||||
|
promptDraft:
|
||||||
|
current.promptDraft.workspacePath === path
|
||||||
|
? {
|
||||||
|
...current.promptDraft,
|
||||||
|
workspacePath: getFallbackWorkspacePath({
|
||||||
|
...current,
|
||||||
|
userWorkspaces
|
||||||
|
})
|
||||||
|
}
|
||||||
|
: current.promptDraft
|
||||||
|
}));
|
||||||
|
setStatus(set, `Deleted workspace ${workspace.name}.`, "success");
|
||||||
|
},
|
||||||
setIssueDraft: (draft) =>
|
setIssueDraft: (draft) =>
|
||||||
set((state) => ({
|
set((state) => ({
|
||||||
issueDraft: {
|
issueDraft: {
|
||||||
@@ -2025,7 +2130,14 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
content: "",
|
content: "",
|
||||||
labels: []
|
labels: []
|
||||||
}
|
}
|
||||||
: get().selectedIssueEditDraft
|
: get().selectedIssueEditDraft,
|
||||||
|
promptDraft:
|
||||||
|
activeBaseUrl !== currentBaseUrl && !get().editingPromptId
|
||||||
|
? {
|
||||||
|
...get().promptDraft,
|
||||||
|
workspacePath: findKnownUrlByBase(get(), activeBaseUrl)?.workspacePath || get().promptDraft.workspacePath
|
||||||
|
}
|
||||||
|
: get().promptDraft
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadData: async () => {
|
loadData: async () => {
|
||||||
@@ -2035,10 +2147,11 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
setStatus(set, "Loading workspace and Gitea context...", "neutral", { autoClear: false });
|
setStatus(set, "Loading workspace and Gitea context...", "neutral", { autoClear: false });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [localContext, repos, userUrls, deletedUrlBases, agents, prompts, activeTabUrl] = await Promise.all([
|
const [localContext, repos, userUrls, userWorkspaces, deletedUrlBases, agents, prompts, activeTabUrl] = await Promise.all([
|
||||||
loadLocalContext(),
|
loadLocalContext(),
|
||||||
getReposOrderedByLastCommit(),
|
getReposOrderedByLastCommit(),
|
||||||
storageGet<KnownUrl[]>(USER_URLS_STORAGE_KEY, []),
|
storageGet<KnownUrl[]>(USER_URLS_STORAGE_KEY, []),
|
||||||
|
storageGet<LocalWorkspace[]>(USER_WORKSPACES_STORAGE_KEY, []),
|
||||||
storageGet<string[]>(DELETED_URL_BASES_STORAGE_KEY, []),
|
storageGet<string[]>(DELETED_URL_BASES_STORAGE_KEY, []),
|
||||||
storageGet<AgentProfile[]>(AGENTS_STORAGE_KEY, AVAILABLE_AGENTS),
|
storageGet<AgentProfile[]>(AGENTS_STORAGE_KEY, AVAILABLE_AGENTS),
|
||||||
storageGet<WorkspacePrompt[]>(PROMPTS_STORAGE_KEY, []),
|
storageGet<WorkspacePrompt[]>(PROMPTS_STORAGE_KEY, []),
|
||||||
@@ -2046,11 +2159,31 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
]);
|
]);
|
||||||
const activeBaseUrl = getBaseUrl(activeTabUrl);
|
const activeBaseUrl = getBaseUrl(activeTabUrl);
|
||||||
const normalizedAgents = normalizeAgents(agents);
|
const normalizedAgents = normalizeAgents(agents);
|
||||||
const normalizedPrompts = normalizePrompts(prompts, localContext.workspaces[0]?.path ?? "");
|
const normalizedUserWorkspaces = userWorkspaces
|
||||||
|
.map((workspace) => ({
|
||||||
|
name: workspace.name?.trim() || workspace.path.split("/").filter(Boolean).slice(-1)[0] || "workspace",
|
||||||
|
path: workspace.path?.trim().replace(/\/+$/, "") || "",
|
||||||
|
linkedRepos: workspace.linkedRepos ?? []
|
||||||
|
}))
|
||||||
|
.filter((workspace) => workspace.path);
|
||||||
|
const activeKnownUrl = findKnownUrlByBase(
|
||||||
|
{
|
||||||
|
...get(),
|
||||||
|
localContext,
|
||||||
|
userWorkspaces: normalizedUserWorkspaces,
|
||||||
|
userUrls,
|
||||||
|
deletedUrlBases,
|
||||||
|
activeBaseUrl
|
||||||
|
},
|
||||||
|
activeBaseUrl
|
||||||
|
);
|
||||||
|
const fallbackWorkspacePath = activeKnownUrl?.workspacePath ?? localContext.workspaces[0]?.path ?? normalizedUserWorkspaces[0]?.path ?? "";
|
||||||
|
const normalizedPrompts = normalizePrompts(prompts, fallbackWorkspacePath);
|
||||||
|
|
||||||
set({
|
set({
|
||||||
localContext,
|
localContext,
|
||||||
repos,
|
repos,
|
||||||
|
userWorkspaces: normalizedUserWorkspaces,
|
||||||
userUrls: userUrls.filter((url) => !deletedUrlBases.includes(getBaseUrl(url.url))),
|
userUrls: userUrls.filter((url) => !deletedUrlBases.includes(getBaseUrl(url.url))),
|
||||||
deletedUrlBases,
|
deletedUrlBases,
|
||||||
agents: normalizedAgents,
|
agents: normalizedAgents,
|
||||||
@@ -2069,7 +2202,7 @@ export const appStore = createStore<AppState>()((set, get) => ({
|
|||||||
normalizedAgents.find((agent) => agent.id === get().editingAgentId)?.id ?? normalizedAgents[0].id,
|
normalizedAgents.find((agent) => agent.id === get().editingAgentId)?.id ?? normalizedAgents[0].id,
|
||||||
promptDraft: normalizedPrompts.find((prompt) => prompt.id === get().editingPromptId) ?? {
|
promptDraft: normalizedPrompts.find((prompt) => prompt.id === get().editingPromptId) ?? {
|
||||||
...EMPTY_PROMPT_DRAFT,
|
...EMPTY_PROMPT_DRAFT,
|
||||||
workspacePath: localContext.workspaces[0]?.path ?? ""
|
workspacePath: fallbackWorkspacePath
|
||||||
},
|
},
|
||||||
editingPromptId: normalizedPrompts.find((prompt) => prompt.id === get().editingPromptId)?.id ?? null,
|
editingPromptId: normalizedPrompts.find((prompt) => prompt.id === get().editingPromptId)?.id ?? null,
|
||||||
activeTabUrl,
|
activeTabUrl,
|
||||||
|
|||||||
+3
-2
@@ -191,7 +191,7 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.workspace-row {
|
.workspace-row {
|
||||||
grid-template-columns: minmax(128px, 0.9fr) minmax(120px, 1fr);
|
grid-template-columns: minmax(120px, 0.9fr) minmax(110px, 1fr) auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.url-row {
|
.url-row {
|
||||||
@@ -355,7 +355,8 @@ a.item-title:hover,
|
|||||||
.agent-actions,
|
.agent-actions,
|
||||||
.agent-editor-actions,
|
.agent-editor-actions,
|
||||||
.prompt-actions,
|
.prompt-actions,
|
||||||
.prompt-editor-actions {
|
.prompt-editor-actions,
|
||||||
|
.workspace-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|||||||
Reference in New Issue
Block a user