mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Merge pull request #432 from chriswritescode-dev/feat/repo-secrets
feat(secrets): repository secrets and variables for agent shells and terminals
This commit is contained in:
77 files changed
+4289
-206
No files matched your search
@@ -50,6 +50,9 @@ vi.mock('@/components/schedules/RepoSchedulesContent', () => ({
|
||||
vi.mock('@/components/repo/RepoMcpDialog', () => ({ RepoMcpContent: () => <div>mcp-tool</div> }))
|
||||
vi.mock('@/components/repo/RepoActionsDialog', () => ({ RepoActionsContent: () => <div>actions-tool</div> }))
|
||||
vi.mock('@/components/repo/RepoSkillsDialog', () => ({ RepoSkillsContent: () => <div>skills-tool</div> }))
|
||||
vi.mock('@/components/secrets/RepoSecretsDialog', () => ({
|
||||
RepoSecretsContent: () => <div>secrets-tool</div>,
|
||||
}))
|
||||
vi.mock('@/components/session/ChangesWalkthroughSheet', () => ({
|
||||
ChangesWalkthroughProvider: ({ children }: { children: ReactNode }) => <>{children}</>,
|
||||
ChangesWalkthroughRegenerate: () => null,
|
||||
@@ -187,6 +190,23 @@ function RemoteHarness() {
|
||||
)
|
||||
}
|
||||
|
||||
function RepoHarness() {
|
||||
const panel = useToolPanel(true)
|
||||
return (
|
||||
<>
|
||||
<ToolSidePanel
|
||||
panel={panel}
|
||||
repoId={1}
|
||||
directory="/repo"
|
||||
repoDirectory="/repo"
|
||||
filesBasePath="repo"
|
||||
currentBranch="main"
|
||||
/>
|
||||
<LocationProbe />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
activityMocks.useActiveWorkCounts.mockReturnValue({ needsInput: 0, running: 0 })
|
||||
@@ -418,6 +438,21 @@ describe('ToolSidePanel', () => {
|
||||
expect(panel).toHaveStyle({ width: '320px' })
|
||||
})
|
||||
|
||||
it('opens Secrets inside the docked repo panel', async () => {
|
||||
const user = userEvent.setup()
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/repos/1']}>
|
||||
<RepoHarness />
|
||||
</MemoryRouter>,
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Secrets' }))
|
||||
|
||||
expect(await screen.findByText('secrets-tool')).toBeInTheDocument()
|
||||
expect(screen.getByRole('heading', { name: 'Secrets' })).toBeInTheDocument()
|
||||
expect(search().has('dialog')).toBe(false)
|
||||
})
|
||||
|
||||
it('opens non-panel session items from the rail as dialogs', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderAt('?panel=files')
|
||||
|
||||
@@ -19,6 +19,7 @@ import { PreviewWorkspace } from '@/components/preview/PreviewPanel'
|
||||
import { RepoMcpContent } from '@/components/repo/RepoMcpDialog'
|
||||
import { RepoActionsContent } from '@/components/repo/RepoActionsDialog'
|
||||
import { RepoSkillsContent } from '@/components/repo/RepoSkillsDialog'
|
||||
import { RepoSecretsContent } from '@/components/secrets/RepoSecretsDialog'
|
||||
import { RepoSchedulesContent } from '@/components/schedules/RepoSchedulesContent'
|
||||
import type { SkillFileInfo } from '@opencode-manager/shared'
|
||||
import type { ModelRef } from '@opencode-manager/shared/opencode'
|
||||
@@ -384,6 +385,8 @@ export function ToolSidePanel({
|
||||
return <RepoActionsContent repoId={repoId} directory={directory} open />
|
||||
case 'schedules':
|
||||
return <RepoSchedulesContent repoId={repoId} embedded />
|
||||
case 'secrets':
|
||||
return <RepoSecretsContent repoId={repoId} />
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('buildMoreItems', () => {
|
||||
|
||||
it('returns repo-specific items for /repos/:id', () => {
|
||||
const items = buildMoreItems('/repos/42')
|
||||
expect(items).toHaveLength(12)
|
||||
expect(items).toHaveLength(13)
|
||||
expect(items[0].key).toBe('home')
|
||||
expect(items[1].key).toBe('files')
|
||||
expect(items[1].dialog).toBe('files')
|
||||
@@ -22,21 +22,23 @@ describe('buildMoreItems', () => {
|
||||
expect(items[2].dialog).toBe('mcp')
|
||||
expect(items[3].key).toBe('skills')
|
||||
expect(items[3].dialog).toBe('skills')
|
||||
expect(items[4].key).toBe('reset-permissions')
|
||||
expect(items[4].dialog).toBe('resetPermissions')
|
||||
expect(items[4].danger).toBe(true)
|
||||
expect(items[5].key).toBe('schedules')
|
||||
expect(items[5].to).toBe('/repos/42/schedules')
|
||||
expect(items[6].key).toBe('source-control')
|
||||
expect(items[6].dialog).toBe('sourceControl')
|
||||
expect(items[7].key).toBe('terminal')
|
||||
expect(items[7].dialog).toBe('terminal')
|
||||
expect(items[8].key).toBe('actions')
|
||||
expect(items[8].dialog).toBe('actions')
|
||||
expect(items[9].key).toBe('preview')
|
||||
expect(items[9].dialog).toBe('preview')
|
||||
expect(items[10].key).toBe('settings')
|
||||
expect(items[11].key).toBe('logout')
|
||||
expect(items[4].key).toBe('secrets')
|
||||
expect(items[4].dialog).toBe('secrets')
|
||||
expect(items[5].key).toBe('reset-permissions')
|
||||
expect(items[5].dialog).toBe('resetPermissions')
|
||||
expect(items[5].danger).toBe(true)
|
||||
expect(items[6].key).toBe('schedules')
|
||||
expect(items[6].to).toBe('/repos/42/schedules')
|
||||
expect(items[7].key).toBe('source-control')
|
||||
expect(items[7].dialog).toBe('sourceControl')
|
||||
expect(items[8].key).toBe('terminal')
|
||||
expect(items[8].dialog).toBe('terminal')
|
||||
expect(items[9].key).toBe('actions')
|
||||
expect(items[9].dialog).toBe('actions')
|
||||
expect(items[10].key).toBe('preview')
|
||||
expect(items[10].dialog).toBe('preview')
|
||||
expect(items[11].key).toBe('settings')
|
||||
expect(items[12].key).toBe('logout')
|
||||
})
|
||||
|
||||
it('returns session-specific items for /repos/:id/sessions/:sid', () => {
|
||||
@@ -219,6 +221,12 @@ describe('buildToolItems', () => {
|
||||
expect(buildToolItems(path).find((item) => item.key === 'schedules')?.panelTool).toBe('schedules')
|
||||
})
|
||||
|
||||
it('exposes the repo Secrets tool through the shared dialog param', () => {
|
||||
const secrets = buildToolItems('/repos/42').find((item) => item.key === 'secrets')
|
||||
expect(secrets?.dialog).toBe('secrets')
|
||||
expect(secrets?.panelTool).toBeUndefined()
|
||||
})
|
||||
|
||||
it.each(['/schedules', '/repos/42/schedules'])('returns only the Activity tool on %s', (path) => {
|
||||
expect(buildToolItems(path).map((item) => item.key)).toEqual(['activity'])
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import { Activity, BookOpen, Plug, Sparkles, ShieldOff, CalendarClock, GitCommitHorizontal, SquareTerminal, Settings, LogOut, Bot, Folder, Home, Play, Globe } from 'lucide-react'
|
||||
import { Activity, BookOpen, Plug, Sparkles, ShieldOff, CalendarClock, GitCommitHorizontal, SquareTerminal, Settings, LogOut, Bot, Folder, Home, Play, Globe, KeyRound } from 'lucide-react'
|
||||
import { ASSISTANT_REPO_ID } from '@opencode-manager/shared/utils'
|
||||
import { getAssistantPath, isAssistantPath } from '@/lib/navigation'
|
||||
|
||||
@@ -106,6 +106,7 @@ function buildRouteNavModel(pathname: string): NavModel {
|
||||
{ key: 'files', label: 'Files', icon: Folder, dialog: 'files' },
|
||||
{ key: 'mcp', label: 'MCP', icon: Plug, dialog: 'mcp' },
|
||||
{ key: 'skills', label: 'Skills', icon: Sparkles, dialog: 'skills' },
|
||||
{ key: 'secrets', label: 'Secrets', icon: KeyRound, dialog: 'secrets' },
|
||||
{ key: 'reset-permissions', label: 'Reset Permissions', icon: ShieldOff, dialog: 'resetPermissions', danger: true },
|
||||
{ key: 'schedules', label: 'Schedules', icon: CalendarClock, to: `/repos/${id}/schedules`, panelTool: 'schedules' },
|
||||
{ key: 'source-control', label: 'Source Control', icon: GitCommitHorizontal, dialog: 'sourceControl' },
|
||||
|
||||
Reference in new issue
Block a user