@thxgg/steward 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DOvbLsAq.js → BFv4l3hn.js} +1 -1
- package/.output/public/_nuxt/{DbloiS5Y.js → BZ1iIOYp.js} +1 -1
- package/.output/public/_nuxt/{Cs5ptsBk.js → Bq6edYSd.js} +1 -1
- package/.output/public/_nuxt/BuQdImno.js +1 -0
- package/.output/public/_nuxt/{DcRwFvvS.js → C897Egk9.js} +1 -1
- package/.output/public/_nuxt/{C8LtDyY4.js → CMUOpExW.js} +1 -1
- package/.output/public/_nuxt/{CQgu_W_k.js → DE885CbX.js} +1 -1
- package/.output/public/_nuxt/{vr7VLA9A.js → DoNqd8jQ.js} +1 -1
- package/.output/public/_nuxt/{BPaqwWyl.js → DomrzX-T.js} +1 -1
- package/.output/public/_nuxt/{CZKCADv6.js → R2cvz8mH.js} +2 -2
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/2ad99048-24f9-4cf6-8622-6c088fe0a244.json +1 -0
- package/.output/public/_nuxt/{CeO4HNxC.js → dOaEkD-3.js} +1 -1
- package/.output/public/_nuxt/{CshyynD6.js → kTT8NKtq.js} +1 -1
- package/.output/server/chunks/_/git.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{default-DGOIWqjD.mjs → default-B5nw9_Xg.mjs} +22 -1
- package/.output/server/chunks/build/default-B5nw9_Xg.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +569 -567
- package/.output/server/chunks/routes/api/runtime.get.mjs +25 -0
- package/.output/server/chunks/routes/api/runtime.get.mjs.map +1 -0
- package/.output/server/package.json +1 -1
- package/dist/host/src/api/git.js +71 -1
- package/dist/host/src/help.js +12 -0
- package/dist/server/utils/git.js +104 -1
- package/docs/MCP.md +21 -0
- package/package.json +1 -1
- package/.output/public/_nuxt/CzKPXRws.js +0 -1
- package/.output/public/_nuxt/builds/meta/e2995e80-736c-47cd-8041-a131bab2f136.json +0 -1
- package/.output/server/chunks/build/default-DGOIWqjD.mjs.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { d as defineEventHandler, u as useRuntimeConfig, k as setHeader } from '../../nitro/nitro.mjs';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import 'node:http';
|
|
4
|
+
import 'node:https';
|
|
5
|
+
import 'node:events';
|
|
6
|
+
import 'node:buffer';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'node:path';
|
|
9
|
+
import 'node:os';
|
|
10
|
+
import 'node:url';
|
|
11
|
+
|
|
12
|
+
const SERVER_INSTANCE_ID = randomUUID();
|
|
13
|
+
const SERVER_STARTED_AT = (/* @__PURE__ */ new Date()).toISOString();
|
|
14
|
+
const runtime_get = defineEventHandler((event) => {
|
|
15
|
+
const runtimeConfig = useRuntimeConfig(event);
|
|
16
|
+
setHeader(event, "Cache-Control", "no-store, no-cache, must-revalidate");
|
|
17
|
+
return {
|
|
18
|
+
buildId: runtimeConfig.app.buildId,
|
|
19
|
+
instanceId: SERVER_INSTANCE_ID,
|
|
20
|
+
startedAt: SERVER_STARTED_AT
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { runtime_get as default };
|
|
25
|
+
//# sourceMappingURL=runtime.get.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.get.mjs","sources":["../../../../../server/api/runtime.get.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAA,qBAAA,UAAA,EAAA;AACA,MAAA,iBAAA,GAAA,iBAAA,IAAA,IAAA,EAAA,EAAA,WAAA,EAAA;AAEA,oBAAA,kBAAA,CAAA,CAAA,KAAA,KAAA;AACA,EAAA,MAAA,aAAA,GAAA,iBAAA,KAAA,CAAA;AAEA,EAAA,SAAA,CAAA,KAAA,EAAA,iBAAA,qCAAA,CAAA;AAEA,EAAA,OAAA;AAAA,IACA,OAAA,EAAA,cAAA,GAAA,CAAA,OAAA;AAAA,IACA,UAAA,EAAA,kBAAA;AAAA,IACA,SAAA,EAAA;AAAA,GACA;AACA,CAAA,CAAA;;;;"}
|
package/dist/host/src/api/git.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { getCommitDiff, getCommitInfo, getFileContent, getFileDiff, isGitRepo, validatePathInRepo } from '../../../server/utils/git.js';
|
|
1
|
+
import { commitStagedChanges, getCommitDiff, getCommitInfo, getFileContent, getFileDiff, getWorkingTreeStatus, isGitRepo, stagePaths, validatePathInRepo } from '../../../server/utils/git.js';
|
|
2
2
|
import { requireRepo } from './repo-context.js';
|
|
3
|
+
function toGitStatus(status) {
|
|
4
|
+
const hasStagedChanges = status.staged.length > 0;
|
|
5
|
+
const hasChanges = hasStagedChanges || status.unstaged.length > 0 || status.untracked.length > 0;
|
|
6
|
+
return {
|
|
7
|
+
...status,
|
|
8
|
+
hasChanges,
|
|
9
|
+
hasStagedChanges
|
|
10
|
+
};
|
|
11
|
+
}
|
|
3
12
|
function resolveGitRepoPath(repo, repoPath) {
|
|
4
13
|
if (!repoPath) {
|
|
5
14
|
return repo.path;
|
|
@@ -15,6 +24,15 @@ function resolveGitRepoPath(repo, repoPath) {
|
|
|
15
24
|
return matchedRepo.absolutePath;
|
|
16
25
|
}
|
|
17
26
|
export const git = {
|
|
27
|
+
async getStatus(repoId, repoPath) {
|
|
28
|
+
const repo = await requireRepo(repoId);
|
|
29
|
+
const gitRepoPath = resolveGitRepoPath(repo, repoPath);
|
|
30
|
+
if (!await isGitRepo(gitRepoPath)) {
|
|
31
|
+
throw new Error('Resolved path is not a git repository');
|
|
32
|
+
}
|
|
33
|
+
const status = await getWorkingTreeStatus(gitRepoPath);
|
|
34
|
+
return toGitStatus(status);
|
|
35
|
+
},
|
|
18
36
|
async getCommits(repoId, shas, repoPath) {
|
|
19
37
|
if (!Array.isArray(shas) || shas.length === 0) {
|
|
20
38
|
throw new Error('At least one SHA is required');
|
|
@@ -85,5 +103,57 @@ export const git = {
|
|
|
85
103
|
throw new Error('Resolved path is not a git repository');
|
|
86
104
|
}
|
|
87
105
|
return await getFileContent(gitRepoPath, commit, file);
|
|
106
|
+
},
|
|
107
|
+
async commitIfChanged(repoId, message, options) {
|
|
108
|
+
if (!message || !message.trim()) {
|
|
109
|
+
throw new Error('message is required');
|
|
110
|
+
}
|
|
111
|
+
const repo = await requireRepo(repoId);
|
|
112
|
+
const relativeRepoPath = options?.repoPath || '';
|
|
113
|
+
const gitRepoPath = resolveGitRepoPath(repo, relativeRepoPath);
|
|
114
|
+
if (!await isGitRepo(gitRepoPath)) {
|
|
115
|
+
throw new Error('Resolved path is not a git repository');
|
|
116
|
+
}
|
|
117
|
+
const paths = Array.isArray(options?.paths)
|
|
118
|
+
? options.paths.filter((path) => typeof path === 'string' && path.trim().length > 0)
|
|
119
|
+
: [];
|
|
120
|
+
if (paths.length > 0) {
|
|
121
|
+
await stagePaths(gitRepoPath, paths);
|
|
122
|
+
}
|
|
123
|
+
const statusBefore = await getWorkingTreeStatus(gitRepoPath);
|
|
124
|
+
if (statusBefore.staged.length === 0) {
|
|
125
|
+
const noChanges = statusBefore.unstaged.length === 0 && statusBefore.untracked.length === 0;
|
|
126
|
+
return {
|
|
127
|
+
committed: false,
|
|
128
|
+
repoPath: relativeRepoPath,
|
|
129
|
+
staged: statusBefore.staged,
|
|
130
|
+
unstaged: statusBefore.unstaged,
|
|
131
|
+
untracked: statusBefore.untracked,
|
|
132
|
+
reason: noChanges ? 'no_changes' : 'no_staged_changes'
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const commit = await commitStagedChanges(gitRepoPath, message);
|
|
136
|
+
if (!commit) {
|
|
137
|
+
return {
|
|
138
|
+
committed: false,
|
|
139
|
+
repoPath: relativeRepoPath,
|
|
140
|
+
staged: statusBefore.staged,
|
|
141
|
+
unstaged: statusBefore.unstaged,
|
|
142
|
+
untracked: statusBefore.untracked,
|
|
143
|
+
reason: 'no_staged_changes'
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const statusAfter = await getWorkingTreeStatus(gitRepoPath);
|
|
147
|
+
return {
|
|
148
|
+
committed: true,
|
|
149
|
+
repoPath: relativeRepoPath,
|
|
150
|
+
staged: statusAfter.staged,
|
|
151
|
+
unstaged: statusAfter.unstaged,
|
|
152
|
+
untracked: statusAfter.untracked,
|
|
153
|
+
sha: commit.sha,
|
|
154
|
+
shortSha: commit.shortSha,
|
|
155
|
+
message: commit.message,
|
|
156
|
+
committedFiles: commit.files
|
|
157
|
+
};
|
|
88
158
|
}
|
|
89
159
|
};
|
package/dist/host/src/help.js
CHANGED
|
@@ -39,6 +39,10 @@ const HELP = {
|
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
git: [
|
|
42
|
+
{
|
|
43
|
+
signature: 'git.getStatus(repoId, repoPath?)',
|
|
44
|
+
description: 'Load working tree status (staged/unstaged/untracked)'
|
|
45
|
+
},
|
|
42
46
|
{ signature: 'git.getCommits(repoId, shas, repoPath?)', description: 'Load commit metadata' },
|
|
43
47
|
{ signature: 'git.getDiff(repoId, commit, repoPath?)', description: 'Load full commit diff' },
|
|
44
48
|
{
|
|
@@ -48,6 +52,10 @@ const HELP = {
|
|
|
48
52
|
{
|
|
49
53
|
signature: 'git.getFileContent(repoId, commit, file, repoPath?)',
|
|
50
54
|
description: 'Load file content at commit'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
signature: 'git.commitIfChanged(repoId, message, options?)',
|
|
58
|
+
description: 'Stage optional paths and commit when staged changes exist'
|
|
51
59
|
}
|
|
52
60
|
],
|
|
53
61
|
state: [
|
|
@@ -86,6 +94,10 @@ const HELP = {
|
|
|
86
94
|
{
|
|
87
95
|
title: 'Upsert without repoId',
|
|
88
96
|
code: `await state.upsertCurrent('prd-viewer', {\n notes: '# Updated from MCP'\n})\n\nreturn { saved: true }`
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: 'Commit task-related changes when present',
|
|
100
|
+
code: `const repo = await repos.current()\n\nconst result = await git.commitIfChanged(repo.id, 'docs: update task notes', {\n paths: ['docs/prd/prd-viewer.md']\n})\n\nreturn result`
|
|
89
101
|
}
|
|
90
102
|
]
|
|
91
103
|
};
|
package/dist/server/utils/git.js
CHANGED
|
@@ -55,6 +55,109 @@ export function validatePathInRepo(repoPath, filePath) {
|
|
|
55
55
|
const relativePath = relative(resolvedRepo, resolvedFile);
|
|
56
56
|
return !relativePath.startsWith('..') && !isAbsolute(relativePath);
|
|
57
57
|
}
|
|
58
|
+
function dedupeAndSort(values) {
|
|
59
|
+
return Array.from(new Set(values)).sort((a, b) => a.localeCompare(b));
|
|
60
|
+
}
|
|
61
|
+
function normalizeStatusPath(rawPath) {
|
|
62
|
+
const trimmed = rawPath.trim();
|
|
63
|
+
if (!trimmed.includes(' -> ')) {
|
|
64
|
+
return trimmed;
|
|
65
|
+
}
|
|
66
|
+
const segments = trimmed.split(' -> ');
|
|
67
|
+
return segments[segments.length - 1]?.trim() || trimmed;
|
|
68
|
+
}
|
|
69
|
+
function normalizePathForGit(repoPath, path) {
|
|
70
|
+
if (!validatePathInRepo(repoPath, path)) {
|
|
71
|
+
throw new Error(`Invalid file path: ${path}`);
|
|
72
|
+
}
|
|
73
|
+
const absolutePath = isAbsolute(path)
|
|
74
|
+
? resolve(path)
|
|
75
|
+
: resolve(repoPath, path);
|
|
76
|
+
const relativePath = relative(resolve(repoPath), absolutePath);
|
|
77
|
+
if (!relativePath || relativePath === '.') {
|
|
78
|
+
throw new Error('Path must point to a file or subdirectory inside the repository');
|
|
79
|
+
}
|
|
80
|
+
return relativePath;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get working tree changes split by staged/unstaged/untracked buckets.
|
|
84
|
+
*/
|
|
85
|
+
export async function getWorkingTreeStatus(repoPath) {
|
|
86
|
+
const output = await execGit(repoPath, ['status', '--porcelain']);
|
|
87
|
+
const staged = new Set();
|
|
88
|
+
const unstaged = new Set();
|
|
89
|
+
const untracked = new Set();
|
|
90
|
+
const lines = output
|
|
91
|
+
.split('\n')
|
|
92
|
+
.map(line => line.trimEnd())
|
|
93
|
+
.filter(line => line.length >= 3);
|
|
94
|
+
for (const line of lines) {
|
|
95
|
+
const indexStatus = line.charAt(0);
|
|
96
|
+
const worktreeStatus = line.charAt(1);
|
|
97
|
+
const path = normalizeStatusPath(line.slice(3));
|
|
98
|
+
if (!path) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (indexStatus === '?' && worktreeStatus === '?') {
|
|
102
|
+
untracked.add(path);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (indexStatus !== ' ' && indexStatus !== '?') {
|
|
106
|
+
staged.add(path);
|
|
107
|
+
}
|
|
108
|
+
if (worktreeStatus !== ' ') {
|
|
109
|
+
unstaged.add(path);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
staged: dedupeAndSort(staged),
|
|
114
|
+
unstaged: dedupeAndSort(unstaged),
|
|
115
|
+
untracked: dedupeAndSort(untracked)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Stage explicit paths in a repository.
|
|
120
|
+
*/
|
|
121
|
+
export async function stagePaths(repoPath, paths) {
|
|
122
|
+
if (!Array.isArray(paths) || paths.length === 0) {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
const normalizedPaths = dedupeAndSort(paths
|
|
126
|
+
.map(path => path.trim())
|
|
127
|
+
.filter(path => path.length > 0)
|
|
128
|
+
.map(path => normalizePathForGit(repoPath, path)));
|
|
129
|
+
if (normalizedPaths.length === 0) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
await execGit(repoPath, ['add', '--', ...normalizedPaths]);
|
|
133
|
+
return normalizedPaths;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Commit currently staged changes. Returns null when nothing is staged.
|
|
137
|
+
*/
|
|
138
|
+
export async function commitStagedChanges(repoPath, message) {
|
|
139
|
+
const trimmedMessage = message.trim();
|
|
140
|
+
if (!trimmedMessage) {
|
|
141
|
+
throw new Error('Commit message is required');
|
|
142
|
+
}
|
|
143
|
+
const stagedOutput = await execGit(repoPath, ['diff', '--cached', '--name-only']);
|
|
144
|
+
const stagedFiles = stagedOutput
|
|
145
|
+
.split('\n')
|
|
146
|
+
.map(line => line.trim())
|
|
147
|
+
.filter(line => line.length > 0);
|
|
148
|
+
if (stagedFiles.length === 0) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
await execGit(repoPath, ['commit', '-m', trimmedMessage]);
|
|
152
|
+
const sha = (await execGit(repoPath, ['rev-parse', 'HEAD'])).trim();
|
|
153
|
+
const shortSha = (await execGit(repoPath, ['rev-parse', '--short', 'HEAD'])).trim();
|
|
154
|
+
return {
|
|
155
|
+
sha,
|
|
156
|
+
shortSha,
|
|
157
|
+
message: trimmedMessage,
|
|
158
|
+
files: stagedFiles
|
|
159
|
+
};
|
|
160
|
+
}
|
|
58
161
|
/**
|
|
59
162
|
* Get commit information by SHA
|
|
60
163
|
*/
|
|
@@ -333,7 +436,7 @@ async function commitExistsInRepo(repoPath, sha) {
|
|
|
333
436
|
*
|
|
334
437
|
* @param repoConfig - The repository configuration with optional gitRepos
|
|
335
438
|
* @param sha - The commit SHA to find
|
|
336
|
-
* @returns
|
|
439
|
+
* @returns Resolved commit data for the matching repo, or throws if not found
|
|
337
440
|
*/
|
|
338
441
|
export async function findRepoForCommit(repoConfig, sha) {
|
|
339
442
|
// Validate SHA format
|
package/docs/MCP.md
CHANGED
|
@@ -119,10 +119,12 @@ In-sandbox discovery helper:
|
|
|
119
119
|
|
|
120
120
|
### `git`
|
|
121
121
|
|
|
122
|
+
- `git.getStatus(repoId, repoPath?)`
|
|
122
123
|
- `git.getCommits(repoId, shas, repoPath?)`
|
|
123
124
|
- `git.getDiff(repoId, commit, repoPath?)`
|
|
124
125
|
- `git.getFileDiff(repoId, commit, file, repoPath?)`
|
|
125
126
|
- `git.getFileContent(repoId, commit, file, repoPath?)`
|
|
127
|
+
- `git.commitIfChanged(repoId, message, options?)`
|
|
126
128
|
|
|
127
129
|
### `state`
|
|
128
130
|
|
|
@@ -181,6 +183,24 @@ return await Promise.all(commits.map(async (entry) => ({
|
|
|
181
183
|
})))
|
|
182
184
|
```
|
|
183
185
|
|
|
186
|
+
Commit task-related changes when present:
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
const repo = await repos.current()
|
|
190
|
+
|
|
191
|
+
const commit = await git.commitIfChanged(repo.id, 'test: add task graph coverage', {
|
|
192
|
+
paths: ['app/components/graph/Explorer.spec.ts']
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
return commit
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`git.commitIfChanged` behavior:
|
|
199
|
+
|
|
200
|
+
- stages only the explicit `options.paths` list when provided
|
|
201
|
+
- commits only when staged changes exist
|
|
202
|
+
- returns `committed: false` with `reason: "no_changes" | "no_staged_changes"` instead of creating empty commits
|
|
203
|
+
|
|
184
204
|
Inspect signatures at runtime:
|
|
185
205
|
|
|
186
206
|
```js
|
|
@@ -238,4 +258,5 @@ return { saved: true }
|
|
|
238
258
|
|
|
239
259
|
- This server is for trusted local development.
|
|
240
260
|
- APIs can read local filesystem and git history for registered repositories.
|
|
261
|
+
- `git.commitIfChanged` can create local commits when staged changes exist.
|
|
241
262
|
- Do not expose this server to untrusted environments.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as M,l as e,Y as _t,g as E,k as oe,o as u,z as g,E as T,c as k,n as H,F as Z,r as te,y as bt,C as ue,w as c,A as O,q as S,b as v,N as ge,p as ke,Z as xt,x as ce,B as ye,$ as Ct,j as Je,X as Te,a as d,t as L,a0 as kt,a1 as wt,m as ve,S as pe,d as G,a2 as St,O as Fe,P as Pe,V as Oe,a3 as Qe,W as $t,a4 as Et,a5 as Dt}from"./CZKCADv6.js";import{c as _e,l as Ie,e as Rt,r as Ye,f as Ze,P as ne,d as Be,u as we,o as Bt,B as de,b as et,a as ze,F as Le,k as J,j as W,m as At}from"./CQgu_W_k.js";import{x as Ft,V as Pt,y as Ve,a as je,u as Ot,g as It,c as be,d as Se,e as Lt,z as Mt,j as Tt,t as tt,k as zt,s as Vt,r as jt,m as qt,n as Kt,o as Ht,A as Ut,p as Nt,S as Gt,L as Wt,C as Xt,R as st,B as Jt,i as fe,F as Qt,G as qe,H as at,I as ot,J as nt,X as lt,h as $e,M as Yt,N as Zt,O as es,l as ts,v as ss,K as as}from"./C8LtDyY4.js";import{F as os,I as ns,a as Me}from"./CshyynD6.js";import{_ as ls}from"./vr7VLA9A.js";const rt=_e("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const it=_e("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const rs=_e("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const ut=_e("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const is=_e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);function us(a,t,s){const o=a.findIndex(l=>Ie(l,t)),r=a.findIndex(l=>Ie(l,s));if(o===-1||r===-1)return[];const[i,n]=[o,r].sort((l,f)=>l-f);return a.slice(i,n+1)}function ds(a){const t=M(()=>e(a)),s=M(()=>new Intl.Collator("en",{usage:"search",...t.value}));return{startsWith:(n,l)=>l.length===0?!0:(n=n.normalize("NFC"),l=l.normalize("NFC"),s.value.compare(n.slice(0,l.length),l)===0),endsWith:(n,l)=>l.length===0?!0:(n=n.normalize("NFC"),l=l.normalize("NFC"),s.value.compare(n.slice(-l.length),l)===0),contains:(n,l)=>{if(l.length===0)return!0;n=n.normalize("NFC"),l=l.normalize("NFC");let f=0;const p=l.length;for(;f+p<=n.length;f++){const y=n.slice(f,f+p);if(s.value.compare(l,y)===0)return!0}return!1}}}function cs(a){return M(()=>_t(a)?!!Rt(a)?.closest("form"):!0)}function ps(){return{ALT:"Alt",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",BACKSPACE:"Backspace",CAPS_LOCK:"CapsLock",CONTROL:"Control",DELETE:"Delete",END:"End",ENTER:"Enter",ESCAPE:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",HOME:"Home",META:"Meta",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp",SHIFT:"Shift",SPACE:" ",TAB:"Tab",CTRL:"Control",ASTERISK:"*",SPACE_CODE:"Space"}}function fs(a){const t=Ye("",1e3);return{search:t,handleTypeaheadSearch:(r,i)=>{t.value=t.value+r;{const n=Ft(),l=i.map(b=>({...b,textValue:b.value?.textValue??b.ref.textContent?.trim()??""})),f=l.find(b=>b.ref===n),p=l.map(b=>b.textValue),y=vs(p,t.value,f?.textValue),m=l.find(b=>b.textValue===y);return m&&m.ref.focus(),m?.ref}},resetTypeahead:()=>{t.value=""}}}function ms(a,t){return a.map((s,o)=>a[(t+o)%a.length])}function vs(a,t,s){const r=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,i=s?a.indexOf(s):-1;let n=ms(a,Math.max(i,0));r.length===1&&(n=n.filter(p=>p!==s));const f=n.find(p=>p.toLowerCase().startsWith(r.toLowerCase()));return f!==s?f:void 0}var hs=E({inheritAttrs:!1,__name:"VisuallyHiddenInputBubble",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(a){const t=a,{primitiveElement:s,currentElement:o}=Ve(),r=M(()=>t.checked??t.value);return oe(r,(i,n)=>{if(!o.value)return;const l=o.value,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"value").set;if(y&&i!==n){const m=new Event("input",{bubbles:!0}),b=new Event("change",{bubbles:!0});y.call(l,i),l.dispatchEvent(m),l.dispatchEvent(b)}}),(i,n)=>(u(),g(Pt,T({ref_key:"primitiveElement",ref:s},{...t,...i.$attrs},{as:"input"}),null,16))}}),Ne=hs,gs=E({inheritAttrs:!1,__name:"VisuallyHiddenInput",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(a){const t=a,s=M(()=>typeof t.value=="object"&&Array.isArray(t.value)&&t.value.length===0&&t.required),o=M(()=>typeof t.value=="string"||typeof t.value=="number"||typeof t.value=="boolean"||t.value===null||t.value===void 0?[{name:t.name,value:t.value}]:typeof t.value=="object"&&Array.isArray(t.value)?t.value.flatMap((r,i)=>typeof r=="object"?Object.entries(r).map(([n,l])=>({name:`${t.name}[${i}][${n}]`,value:l})):{name:`${t.name}[${i}]`,value:r}):t.value!==null&&typeof t.value=="object"&&!Array.isArray(t.value)?Object.entries(t.value).map(([r,i])=>({name:`${t.name}[${r}]`,value:i})):[]);return(r,i)=>(u(),k(Z,null,[H(" We render single input if it's required "),s.value?(u(),g(Ne,T({key:r.name},{...t,...r.$attrs},{name:r.name,value:r.value}),null,16,["name","value"])):(u(!0),k(Z,{key:1},te(o.value,n=>(u(),g(Ne,T({key:n.name},{ref_for:!0},{...t,...r.$attrs},{name:n.name,value:n.value}),null,16,["name","value"]))),128))],2112))}}),ys=gs;function _s(a,t,s){return a===void 0?!1:Array.isArray(a)?a.some(o=>he(o,t,s)):he(a,t,s)}function he(a,t,s){return a===void 0||t===void 0?!1:typeof a=="string"?a===t:typeof s=="function"?s(a,t):typeof s=="string"?a?.[s]===t?.[s]:Ie(a,t)}const[Ke,bs]=be("ListboxRoot");var xs=E({__name:"ListboxRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},multiple:{type:Boolean,required:!1},orientation:{type:String,required:!1,default:"vertical"},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},selectionBehavior:{type:String,required:!1,default:"toggle"},highlightOnHover:{type:Boolean,required:!1},by:{type:[String,Function],required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue","highlight","entryFocus","leave"],setup(a,{expose:t,emit:s}){const o=a,r=s,{multiple:i,highlightOnHover:n,orientation:l,disabled:f,selectionBehavior:p,dir:y}=bt(o),{getItems:m}=je({isProvider:!0}),{handleTypeaheadSearch:b}=fs(),{primitiveElement:z,currentElement:x}=Ve(),A=ps(),V=Ot(y),w=cs(x),K=S(),U=S(!1),X=S(!0),D=Ze(o,"modelValue",r,{defaultValue:o.defaultValue??(i.value?[]:void 0),passive:o.modelValue===void 0,deep:!0});function se(h){if(U.value=!0,o.multiple){const C=Array.isArray(D.value)?[...D.value]:[],$=C.findIndex(q=>he(q,h,o.by));o.selectionBehavior==="toggle"?($===-1?C.push(h):C.splice($,1),D.value=C):(D.value=[h],K.value=h)}else o.selectionBehavior==="toggle"&&he(D.value,h,o.by)?D.value=void 0:D.value=h;setTimeout(()=>{U.value=!1},1)}const j=S(null),ee=S(null),F=S(!1),P=S(!1),B=Be(),N=Be(),Y=Be();function ae(){return m().map(h=>h.ref).filter(h=>h.dataset.disabled!=="")}function Q(h,C=!0){if(!h)return;j.value=h,X.value&&j.value.focus(),C&&j.value.scrollIntoView({block:"nearest"});const $=m().find(q=>q.ref===h);r("highlight",$)}function De(h){if(F.value)Y.trigger(h);else{const C=m().find($=>he($.value,h,o.by));C&&(j.value=C.ref,Q(C.ref))}}function xe(h){j.value&&j.value.isConnected&&(h.preventDefault(),h.stopPropagation(),P.value||j.value.click())}function I(h){if(X.value){if(U.value=!0,F.value)N.trigger(h);else{const C=h.altKey||h.ctrlKey||h.metaKey;if(C&&h.key==="a"&&i.value){const $=m(),q=$.map(re=>re.value);D.value=[...q],h.preventDefault(),Q($[$.length-1].ref)}else if(!C){const $=b(h.key,m());$&&Q($)}}setTimeout(()=>{U.value=!1},1)}}function _(){P.value=!0}function R(){ue(()=>{P.value=!1})}function le(){ue(()=>{const h=new KeyboardEvent("keydown",{key:"PageUp"});He(h)})}function Re(h){const C=j.value;C?.isConnected&&(ee.value=C),j.value=null,r("leave",h)}function ht(h){const C=new CustomEvent("listbox.entryFocus",{bubbles:!1,cancelable:!0});if(h.currentTarget?.dispatchEvent(C),r("entryFocus",C),!C.defaultPrevented)if(ee.value)Q(ee.value);else{const $=ae()?.[0];Q($)}}function He(h){const C=It(h,l.value,V.value);if(!C)return;let $=ae();if(j.value){if(C==="last")$.reverse();else if(C==="prev"||C==="next"){C==="prev"&&$.reverse();const q=$.indexOf(j.value);$=$.slice(q+1)}gt(h,$[0])}if($.length){const q=!j.value&&C==="prev"?$.length-1:0;Q($[q])}if(F.value)return N.trigger(h)}function gt(h,C){if(!(F.value||o.selectionBehavior!=="replace"||!i.value||!Array.isArray(D.value)||(h.altKey||h.ctrlKey||h.metaKey)&&!h.shiftKey)&&h.shiftKey){const q=m().filter(me=>me.ref.dataset.disabled!=="");let re=q.find(me=>me.ref===C)?.value;if(h.key===A.END?re=q[q.length-1].value:h.key===A.HOME&&(re=q[0].value),!re||!K.value)return;const yt=us(q.map(me=>me.value),K.value,re);D.value=yt}}async function Ue(h){if(await ue(),F.value)B.trigger(h);else{const C=ae(),$=C.find(q=>q.dataset.state==="checked");$?Q($):C.length&&Q(C[0])}}return oe(D,()=>{U.value||ue(()=>{Ue()})},{immediate:!0,deep:!0}),t({highlightedElement:j,highlightItem:De,highlightFirstItem:le,highlightSelected:Ue,getItems:m}),bs({modelValue:D,onValueChange:se,multiple:i,orientation:l,dir:V,disabled:f,highlightOnHover:n,highlightedElement:j,isVirtual:F,virtualFocusHook:B,virtualKeydownHook:N,virtualHighlightHook:Y,by:o.by,firstValue:K,selectionBehavior:p,focusable:X,onLeave:Re,onEnter:ht,changeHighlight:Q,onKeydownEnter:xe,onKeydownNavigation:He,onKeydownTypeAhead:I,onCompositionStart:_,onCompositionEnd:R,highlightFirstItem:le}),(h,C)=>(u(),g(e(ne),{ref_key:"primitiveElement",ref:z,as:h.as,"as-child":h.asChild,dir:e(V),"data-disabled":e(f)?"":void 0,onPointerleave:Re,onFocusout:C[0]||(C[0]=async $=>{const q=$.relatedTarget||$.target;await ue(),j.value&&e(x)&&!e(x).contains(q)&&Re($)})},{default:c(()=>[O(h.$slots,"default",{modelValue:e(D)}),e(w)&&h.name?(u(),g(e(ys),{key:0,name:h.name,value:e(D),disabled:e(f),required:h.required},null,8,["name","value","disabled","required"])):H("v-if",!0)]),_:3},8,["as","as-child","dir","data-disabled"]))}}),Cs=xs,ks=E({__name:"ListboxContent",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(a){const{CollectionSlot:t}=je(),s=Ke(),o=Ye(!1,10);return(r,i)=>(u(),g(e(t),null,{default:c(()=>[v(e(ne),{role:"listbox",as:r.as,"as-child":r.asChild,tabindex:e(s).focusable.value?e(s).highlightedElement.value?"-1":"0":"-1","aria-orientation":e(s).orientation.value,"aria-multiselectable":!!e(s).multiple.value,"data-orientation":e(s).orientation.value,onMousedown:i[0]||(i[0]=ke(n=>o.value=!0,["left"])),onFocus:i[1]||(i[1]=n=>{e(o)||e(s).onEnter(n)}),onKeydown:[i[2]||(i[2]=ge(n=>{e(s).orientation.value==="vertical"&&(n.key==="ArrowLeft"||n.key==="ArrowRight")||e(s).orientation.value==="horizontal"&&(n.key==="ArrowUp"||n.key==="ArrowDown")||(n.preventDefault(),e(s).focusable.value&&e(s).onKeydownNavigation(n))},["down","up","left","right","home","end"])),ge(e(s).onKeydownEnter,["enter"]),e(s).onKeydownTypeAhead]},{default:c(()=>[O(r.$slots,"default")]),_:3},8,["as","as-child","tabindex","aria-orientation","aria-multiselectable","data-orientation","onKeydown"])]),_:3}))}}),ws=ks,Ss=E({__name:"ListboxFilter",props:{modelValue:{type:String,required:!1},autoFocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"input"}},emits:["update:modelValue"],setup(a,{emit:t}){const s=a,r=Ze(s,"modelValue",t,{defaultValue:"",passive:s.modelValue===void 0}),i=Ke(),{primitiveElement:n,currentElement:l}=Ve(),f=M(()=>s.disabled||i.disabled.value||!1),p=S();return xt(()=>p.value=i.highlightedElement.value?.id),ce(()=>{i.focusable.value=!1,setTimeout(()=>{s.autoFocus&&l.value?.focus()},1)}),ye(()=>{i.focusable.value=!0}),(y,m)=>(u(),g(e(ne),{ref_key:"primitiveElement",ref:n,as:y.as,"as-child":y.asChild,value:e(r),disabled:f.value?"":void 0,"data-disabled":f.value?"":void 0,"aria-disabled":f.value??void 0,"aria-activedescendant":p.value,type:"text",onKeydown:[ge(ke(e(i).onKeydownNavigation,["prevent"]),["down","up","home","end"]),ge(e(i).onKeydownEnter,["enter"])],onInput:m[0]||(m[0]=b=>{r.value=b.target.value,e(i).highlightFirstItem()}),onCompositionstart:e(i).onCompositionStart,onCompositionend:e(i).onCompositionEnd},{default:c(()=>[O(y.$slots,"default",{modelValue:e(r)})]),_:3},8,["as","as-child","value","disabled","data-disabled","aria-disabled","aria-activedescendant","onKeydown","onCompositionstart","onCompositionend"]))}}),$s=Ss;const[Es,Ds]=be("ListboxGroup");var Rs=E({__name:"ListboxGroup",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(a){const t=a,s=Se(void 0,"reka-listbox-group");return Ds({id:s}),(o,r)=>(u(),g(e(ne),T({role:"group"},t,{"aria-labelledby":e(s)}),{default:c(()=>[O(o.$slots,"default")]),_:3},16,["aria-labelledby"]))}}),Bs=Rs,As=E({__name:"ListboxGroupLabel",props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},setup(a){const t=a,s=Es({id:""});return(o,r)=>(u(),g(e(ne),T(t,{id:e(s).id}),{default:c(()=>[O(o.$slots,"default")]),_:3},16,["id"]))}}),Fs=As;const Ps="listbox.select",[Ao,Os]=be("ListboxItem");var Is=E({__name:"ListboxItem",props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},emits:["select"],setup(a,{emit:t}){const s=a,o=t,r=Se(void 0,"reka-listbox-item"),{CollectionItem:i}=je(),{forwardRef:n,currentElement:l}=Lt(),f=Ke(),p=M(()=>l.value===f.highlightedElement.value),y=M(()=>_s(f.modelValue.value,s.value,f.by)),m=M(()=>f.disabled.value||s.disabled);async function b(x){o("select",x),!x?.defaultPrevented&&!m.value&&x&&(f.onValueChange(s.value),f.changeHighlight(l.value))}function z(x){const A={originalEvent:x,value:s.value};Mt(Ps,b,A)}return Os({isSelected:y}),(x,A)=>(u(),g(e(i),{value:x.value},{default:c(()=>[Ct([p.value,y.value],()=>v(e(ne),T({id:e(r)},x.$attrs,{ref:e(n),role:"option",tabindex:e(f).focusable.value?p.value?"0":"-1":-1,"aria-selected":y.value,as:x.as,"as-child":x.asChild,disabled:m.value?"":void 0,"data-disabled":m.value?"":void 0,"data-highlighted":p.value?"":void 0,"data-state":y.value?"checked":"unchecked",onClick:z,onKeydown:ge(ke(z,["prevent"]),["space"]),onPointermove:A[0]||(A[0]=()=>{e(f).highlightedElement.value!==e(l)&&e(f).highlightOnHover.value&&!e(f).focusable.value&&e(f).changeHighlight(e(l),!1)})}),{default:c(()=>[O(x.$slots,"default")]),_:3},16,["id","tabindex","aria-selected","as","as-child","disabled","data-disabled","data-highlighted","data-state","onKeydown"]),A,1)]),_:3},8,["value"]))}}),Ls=Is;const Ms={class:"flex items-center gap-2 truncate"},Ts={class:"truncate"},zs={key:0,class:"absolute top-full right-0 z-[9999] mt-1 w-[280px] rounded-md border bg-popover p-1 text-popover-foreground shadow-md"},Vs={class:"max-h-[200px] overflow-y-auto"},js=["aria-selected","onClick"],qs={class:"flex flex-1 flex-col gap-0.5 overflow-hidden text-left"},Ks={class:"truncate font-medium"},Hs={class:"truncate text-xs text-muted-foreground"},Us=["onClick"],Ns={key:1,class:"px-2 py-1.5 text-sm text-muted-foreground"},Gs={key:2,class:"my-1 h-px bg-border"},Ws={class:"space-y-2"},Xs={class:"flex gap-2"},Js={key:0,class:"text-sm text-destructive"},Qs={key:0,class:"space-y-2 rounded-md border p-3"},Ys={class:"flex items-center gap-2 text-sm"},Zs=["disabled"],ea={class:"flex-1 truncate font-mono text-xs text-muted-foreground"},ta={class:"max-h-[200px] overflow-y-auto"},sa={key:0,class:"py-2 text-center text-sm text-muted-foreground"},aa={key:1,class:"py-2 text-center text-sm text-muted-foreground"},oa=["onClick"],na={class:"truncate"},la={key:0},ra={key:1},ia=E({__name:"RepoSelector",setup(a,{expose:t}){const s=Je(),o=Te(),{repos:r,currentRepo:i,currentRepoId:n,selectRepo:l,addRepo:f,removeRepo:p}=we(),{showSuccess:y}=et(),m=S(!1),b=S(""),z=S(null);Bt(z,()=>{m.value&&(m.value=!1,b.value="")}),oe(()=>o.fullPath,()=>{m.value=!1,b.value=""});async function x(I){l(I),m.value=!1,b.value="";try{const R=(await $fetch(`/api/repos/${I}/prds`))?.[0];R?s.push(`/${I}/${R.slug}`):s.push("/")}catch{s.push("/")}}function A(){m.value=!1,P.value=!0}const V=S(!1),w=S(""),K=S(""),U=S([]),X=S(!1),D=M(()=>!!K.value&&K.value!==w.value);async function se(I){X.value=!0;try{const _=await $fetch("/api/browse",{query:{path:I||w.value||void 0}});w.value=_.current,K.value=_.parent,U.value=_.directories}catch{}finally{X.value=!1}}function j(){V.value=!0,se(B.value||void 0)}function ee(I){B.value=I,V.value=!1,N.value=null}function F(){D.value&&se(K.value)}const P=S(!1),B=S(""),N=S(null),Y=S(!1),ae=M(()=>{if(!b.value)return r.value;const I=b.value.toLowerCase();return r.value?.filter(_=>_.name.toLowerCase().includes(I)||_.path.toLowerCase().includes(I))??[]});async function Q(){if(!B.value.trim()){N.value="Please enter a repository path";return}Y.value=!0,N.value=null;try{const I=await f(B.value.trim());if(P.value=!1,B.value="",y("Repository added",I?.name||"Successfully added repository"),I?.id)try{const R=(await $fetch(`/api/repos/${I.id}/prds`))?.[0];R&&s.push(`/${I.id}/${R.slug}`)}catch{}}catch(I){if(I instanceof Error){const _=I;N.value=_.data?.message||I.message}else N.value="Failed to add repository"}finally{Y.value=!1}}async function De(I,_){I.stopPropagation(),await p(_)}function xe(){P.value=!1,B.value="",N.value=null}return t({openAddDialog:()=>{P.value=!0}}),(I,_)=>(u(),k("div",{ref_key:"dropdownRef",ref:z,class:"relative"},[d("button",{type:"button",class:"inline-flex h-8 w-[200px] items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm font-normal ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:_[0]||(_[0]=R=>m.value=!e(m))},[d("span",Ms,[v(e(os),{class:"size-4 shrink-0 text-muted-foreground"}),d("span",Ts,L(e(i)?.name??"Select repository"),1)]),v(e(Tt),{class:"size-4 shrink-0 opacity-50"})]),e(m)?(u(),k("div",zs,[kt(d("input",{"onUpdate:modelValue":_[1]||(_[1]=R=>ve(b)?b.value=R:null),type:"text",placeholder:"Search repositories...",class:"mb-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"},null,512),[[wt,e(b)]]),d("div",Vs,[e(ae)?.length?(u(!0),k(Z,{key:0},te(e(ae),R=>(u(),k("div",{key:R.id,class:"group flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer",role:"option","aria-selected":e(n)===R.id,onClick:le=>x(R.id)},[v(e(tt),{class:pe(["size-4 shrink-0",e(n)===R.id?"opacity-100":"opacity-0"])},null,8,["class"]),d("div",qs,[d("span",Ks,L(R.name),1),d("span",Hs,L(R.path),1)]),d("button",{type:"button",class:"ml-auto opacity-0 group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove repository",onClick:le=>De(le,R.id)},[v(e(is),{class:"size-3.5 text-destructive"})],8,Us)],8,js))),128)):(u(),k("div",Ns," No repositories found. ")),e(ae)?.length?(u(),k("div",Gs)):H("",!0),d("button",{type:"button",class:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground",onClick:A},[v(e(zt),{class:"size-4"}),_[5]||(_[5]=d("span",null,"Add repository...",-1))])])])):H("",!0),v(e(Vt),{open:e(P),"onUpdate:open":_[4]||(_[4]=R=>P.value=R)},{default:c(()=>[v(e(jt),{side:"right",class:"flex h-full flex-col",onEscapeKeyDown:xe},{default:c(()=>[v(e(qt),{class:"px-6"},{default:c(()=>[v(e(Kt),null,{default:c(()=>[..._[6]||(_[6]=[G("Add Repository",-1)])]),_:1}),v(e(Ht),null,{default:c(()=>[..._[7]||(_[7]=[G(" Enter the absolute path to a repository containing PRD documents. ",-1)])]),_:1})]),_:1}),d("form",{id:"add-repo-form",class:"min-h-0 flex-1 space-y-4 overflow-y-auto px-6",onSubmit:ke(Q,["prevent"])},[d("div",Ws,[_[8]||(_[8]=d("label",{for:"repo-path",class:"text-sm font-medium"}," Repository Path ",-1)),d("div",Xs,[v(e(ns),{id:"repo-path",modelValue:e(B),"onUpdate:modelValue":_[2]||(_[2]=R=>ve(B)?B.value=R:null),placeholder:"/path/to/your/project","aria-invalid":!!e(N),disabled:e(Y),class:"flex-1"},null,8,["modelValue","aria-invalid","disabled"]),v(e(de),{type:"button",variant:"outline",size:"icon",disabled:e(Y),onClick:j},{default:c(()=>[v(e(Me),{class:"size-4"})]),_:1},8,["disabled"])]),e(N)?(u(),k("p",Js,L(e(N)),1)):H("",!0),_[9]||(_[9]=d("p",{class:"text-xs text-muted-foreground"},[G(" The repository should contain a "),d("code",{class:"rounded bg-muted px-1"},"docs/prd/"),G(" directory with markdown files. ")],-1))]),e(V)?(u(),k("div",Qs,[d("div",Ys,[d("button",{type:"button",class:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-50",disabled:!e(D),onClick:F},[v(e(Ut),{class:"size-3"}),_[10]||(_[10]=G(" Up ",-1))],8,Zs),d("span",ea,L(e(w)),1),v(e(de),{type:"button",variant:"ghost",size:"sm",class:"h-7 text-xs",onClick:_[3]||(_[3]=R=>ee(e(w)))},{default:c(()=>[..._[11]||(_[11]=[G(" Select ",-1)])]),_:1})]),d("div",ta,[e(X)?(u(),k("div",sa," Loading... ")):e(U).length?(u(!0),k(Z,{key:2},te(e(U),R=>(u(),k("button",{key:R.path,type:"button",class:"flex w-full items-center gap-2 rounded px-2 py-1 text-sm hover:bg-accent",onClick:le=>se(R.path)},[v(e(Me),{class:"size-4 text-muted-foreground"}),d("span",na,L(R.name),1)],8,oa))),128)):(u(),k("div",aa," No subdirectories "))])])):H("",!0)],32),v(e(Nt),{class:"px-6 pb-6"},{default:c(()=>[v(e(de),{type:"button",variant:"outline",disabled:e(Y),onClick:xe},{default:c(()=>[..._[12]||(_[12]=[G(" Cancel ",-1)])]),_:1},8,["disabled"]),v(e(de),{type:"submit",form:"add-repo-form",disabled:e(Y)},{default:c(()=>[e(Y)?(u(),k("span",la,"Adding...")):(u(),k("span",ra,"Add Repository"))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])],512))}}),ua=Object.assign(ia,{__name:"LayoutRepoSelector"}),da={class:"flex h-full w-64 flex-col border-r border-border bg-background"},ca={class:"p-2"},pa={key:0,class:"flex items-center justify-center py-8"},fa={key:1,class:"px-2 py-8 text-center"},ma={key:2,class:"px-2 py-8 text-center"},va={key:3,class:"px-2 py-8 text-center"},ha={key:4,class:"space-y-1"},ga={class:"flex-1 truncate"},ya=E({__name:"Sidebar",setup(a){const t=Te(),{prds:s,prdsStatus:o,refreshPrds:r}=ze(),{currentRepoId:i}=we(),n=M(()=>t.params.prd);function l(f){return n.value===f}return(f,p)=>{const y=ls;return u(),k("aside",da,[v(e(Gt),{class:"flex-1"},{default:c(()=>[d("div",ca,[p[5]||(p[5]=d("h2",{class:"flex h-10 items-center px-2 text-sm font-medium text-muted-foreground"},"Documents",-1)),e(o)==="pending"?(u(),k("div",pa,[v(e(Wt),{class:"size-5 animate-spin text-muted-foreground"})])):e(i)?e(o)==="error"?(u(),k("div",ma,[v(e(Xt),{class:"mx-auto size-8 text-destructive/50"}),p[2]||(p[2]=d("p",{class:"mt-2 text-sm text-muted-foreground"}," Failed to load PRDs ",-1)),v(e(de),{variant:"ghost",size:"sm",class:"mt-2",onClick:e(r)},{default:c(()=>[v(e(st),{class:"mr-1 size-3"}),p[1]||(p[1]=G(" Retry ",-1))]),_:1},8,["onClick"])])):e(s)?.length?(u(),k("nav",ha,[(u(!0),k(Z,null,te(e(s),m=>(u(),g(y,{key:m.slug,to:`/${e(i)}/${m.slug}`,class:pe(["group flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors",[l(m.slug)?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"]])},{default:c(()=>[v(e(Le),{class:"size-4 shrink-0"}),d("span",ga,L(m.name),1),m.hasState&&m.taskCount?(u(),g(e(Jt),{key:0,variant:"secondary",class:"shrink-0 text-xs"},{default:c(()=>[G(L(m.completedCount??0)+"/"+L(m.taskCount),1)]),_:2},1024)):H("",!0)]),_:2},1032,["to","class"]))),128))])):(u(),k("div",va,[v(e(Le),{class:"mx-auto size-8 text-muted-foreground/50"}),p[3]||(p[3]=d("p",{class:"mt-2 text-sm text-muted-foreground"}," No PRDs found ",-1)),p[4]||(p[4]=d("p",{class:"mt-1 text-xs text-muted-foreground/70"}," Add .md files to docs/prd/ ",-1))])):(u(),k("div",fa,[...p[0]||(p[0]=[d("p",{class:"text-sm text-muted-foreground"}," Select a repository to view PRDs ",-1)])]))])]),_:1})])}}}),_a=Object.assign(ya,{__name:"LayoutSidebar"}),ba=E({__name:"Command",props:{modelValue:{default:""},defaultValue:{},multiple:{type:Boolean},orientation:{},dir:{},disabled:{type:Boolean},selectionBehavior:{},highlightOnHover:{type:Boolean},by:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{},defaultSearch:{default:""}},emits:["update:modelValue","highlight","entryFocus","leave"],setup(a,{emit:t}){const s=a,o=t,r=J(s,"class"),i=fe(r,o),n=S(new Map),l=S(new Map),{contains:f}=ds({sensitivity:"base"}),p=St({search:s.defaultSearch||"",filtered:{count:0,items:new Map,groups:new Set}});oe(()=>s.defaultSearch,m=>{m!==void 0&&(p.search=m)});function y(){if(!p.search){p.filtered.count=n.value.size;return}p.filtered.groups=new Set;let m=0;for(const[b,z]of n.value){const x=f(z,p.search);p.filtered.items.set(b,x?1:0),x&&m++}for(const[b,z]of l.value)for(const x of z)if(p.filtered.items.get(x)>0){p.filtered.groups.add(b);break}p.filtered.count=m}return oe(()=>p.search,()=>{y()}),oe(()=>n.value.size,()=>{p.search&&y()}),Ga({allItems:n,allGroups:l,filterState:p}),(m,b)=>(u(),g(e(Cs),T({"data-slot":"command"},e(i),{class:e(W)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",s.class)}),{default:c(()=>[O(m.$slots,"default")]),_:3},16,["class"]))}}),xa=Object.assign(ba,{__name:"UiCommand"}),Ca=E({__name:"Dialog",props:{open:{type:Boolean},defaultOpen:{type:Boolean},modal:{type:Boolean}},emits:["update:open"],setup(a,{emit:t}){const r=fe(a,t);return(i,n)=>(u(),g(e(Qt),T({"data-slot":"dialog"},e(r)),{default:c(l=>[O(i.$slots,"default",Fe(Pe(l)))]),_:3},16))}}),dt=Object.assign(Ca,{__name:"UiDialog"}),ka=E({__name:"DialogClose",props:{asChild:{type:Boolean},as:{}},setup(a){const t=a;return(s,o)=>(u(),g(e(qe),T({"data-slot":"dialog-close"},t),{default:c(()=>[O(s.$slots,"default")]),_:3},16))}});Object.assign(ka,{__name:"UiDialogClose"});const wa=E({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class");return(o,r)=>(u(),g(e(at),T({"data-slot":"dialog-overlay"},e(s),{class:e(W)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",t.class)}),{default:c(()=>[O(o.$slots,"default")]),_:3},16,["class"]))}}),Sa=Object.assign(wa,{__name:"UiDialogOverlay"}),$a=E({inheritAttrs:!1,__name:"DialogContent",props:{forceMount:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{},class:{},showCloseButton:{type:Boolean,default:!0}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(a,{emit:t}){const s=a,o=t,r=J(s,"class"),i=fe(r,o);return(n,l)=>(u(),g(e(ot),null,{default:c(()=>[v(Sa),v(e(nt),T({"data-slot":"dialog-content"},{...n.$attrs,...e(i)},{class:e(W)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",s.class)}),{default:c(()=>[O(n.$slots,"default"),a.showCloseButton?(u(),g(e(qe),{key:0,"data-slot":"dialog-close",class:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"},{default:c(()=>[v(e(lt)),l[0]||(l[0]=d("span",{class:"sr-only"},"Close",-1))]),_:1})):H("",!0)]),_:3},16,["class"])]),_:3}))}}),ct=Object.assign($a,{__name:"UiDialogContent"}),Ea=E({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class"),o=$e(s);return(r,i)=>(u(),g(e(Yt),T({"data-slot":"dialog-description"},e(o),{class:e(W)("text-muted-foreground text-sm",t.class)}),{default:c(()=>[O(r.$slots,"default")]),_:3},16,["class"]))}}),pt=Object.assign(Ea,{__name:"UiDialogDescription"}),Da=E({__name:"DialogFooter",props:{class:{}},setup(a){const t=a;return(s,o)=>(u(),k("div",{"data-slot":"dialog-footer",class:pe(e(W)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t.class))},[O(s.$slots,"default")],2))}});Object.assign(Da,{__name:"UiDialogFooter"});const Ra=E({__name:"DialogHeader",props:{class:{}},setup(a){const t=a;return(s,o)=>(u(),k("div",{"data-slot":"dialog-header",class:pe(e(W)("flex flex-col gap-2 text-center sm:text-left",t.class))},[O(s.$slots,"default")],2))}}),ft=Object.assign(Ra,{__name:"UiDialogHeader"}),Ba=E({inheritAttrs:!1,__name:"DialogScrollContent",props:{forceMount:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(a,{emit:t}){const s=a,o=t,r=J(s,"class"),i=fe(r,o);return(n,l)=>(u(),g(e(ot),null,{default:c(()=>[v(e(at),{class:"fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"},{default:c(()=>[v(e(nt),T({class:e(W)("relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full",s.class)},{...n.$attrs,...e(i)},{onPointerDownOutside:l[0]||(l[0]=f=>{const p=f.detail.originalEvent,y=p.target;(p.offsetX>y.clientWidth||p.offsetY>y.clientHeight)&&f.preventDefault()})}),{default:c(()=>[O(n.$slots,"default"),v(e(qe),{class:"absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary"},{default:c(()=>[v(e(lt),{class:"w-4 h-4"}),l[1]||(l[1]=d("span",{class:"sr-only"},"Close",-1))]),_:1})]),_:3},16,["class"])]),_:3})]),_:3}))}});Object.assign(Ba,{__name:"UiDialogScrollContent"});const Aa=E({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class"),o=$e(s);return(r,i)=>(u(),g(e(Zt),T({"data-slot":"dialog-title"},e(o),{class:e(W)("text-lg leading-none font-semibold",t.class)}),{default:c(()=>[O(r.$slots,"default")]),_:3},16,["class"]))}}),mt=Object.assign(Aa,{__name:"UiDialogTitle"}),Fa=E({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(a){const t=a;return(s,o)=>(u(),g(e(es),T({"data-slot":"dialog-trigger"},t),{default:c(()=>[O(s.$slots,"default")]),_:3},16))}});Object.assign(Fa,{__name:"UiDialogTrigger"});const Pa=E({__name:"CommandDialog",props:{open:{type:Boolean},defaultOpen:{type:Boolean},modal:{type:Boolean},title:{default:"Command Palette"},description:{default:"Search for a command to run..."},defaultSearch:{default:""}},emits:["update:open"],setup(a,{emit:t}){const r=fe(a,t);return(i,n)=>(u(),g(e(dt),Fe(Pe(e(r))),{default:c(l=>[v(e(ct),{class:"overflow-hidden p-0","show-close-button":!1},{default:c(()=>[v(e(ft),{class:"sr-only"},{default:c(()=>[v(e(mt),null,{default:c(()=>[G(L(a.title),1)]),_:1}),v(e(pt),null,{default:c(()=>[G(L(a.description),1)]),_:1})]),_:1}),v(xa,{"default-search":a.defaultSearch},{default:c(()=>[O(i.$slots,"default",Fe(Pe(l)))]),_:2},1032,["default-search"])]),_:2},1024)]),_:3},16))}}),Oa=Object.assign(Pa,{__name:"UiCommandDialog"}),Ia=E({__name:"CommandEmpty",props:{asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class"),{filterState:o}=Ee(),r=M(()=>!!o.search&&o.filtered.count===0);return(i,n)=>r.value?(u(),g(e(ne),T({key:0,"data-slot":"command-empty"},e(s),{class:e(W)("py-6 text-center text-sm",t.class)}),{default:c(()=>[O(i.$slots,"default")]),_:3},16,["class"])):H("",!0)}}),La=Object.assign(Ia,{__name:"UiCommandEmpty"}),Ma=E({__name:"CommandGroup",props:{asChild:{type:Boolean},as:{},class:{},heading:{}},setup(a){const t=a,s=J(t,"class"),{allGroups:o,filterState:r}=Ee(),i=Se(),n=M(()=>r.search?r.filtered.groups.has(i):!0);return Xa({id:i}),ce(()=>{o.value.has(i)||o.value.set(i,new Set)}),ye(()=>{o.value.delete(i)}),(l,f)=>(u(),g(e(Bs),T(e(s),{id:e(i),"data-slot":"command-group",class:e(W)("text-foreground overflow-hidden p-1",t.class),hidden:n.value?void 0:!0}),{default:c(()=>[a.heading?(u(),g(e(Fs),{key:0,"data-slot":"command-group-heading",class:"px-2 py-1.5 text-xs font-medium text-muted-foreground"},{default:c(()=>[G(L(a.heading),1)]),_:1})):H("",!0),O(l.$slots,"default")]),_:3},16,["id","class","hidden"]))}}),Ae=Object.assign(Ma,{__name:"UiCommandGroup"}),Ta={"data-slot":"command-input-wrapper",class:"flex h-9 items-center gap-2 border-b px-3"},za=E({inheritAttrs:!1,__name:"CommandInput",props:{modelValue:{},autoFocus:{type:Boolean},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class"),o=$e(s),{filterState:r}=Ee(),i=S(null);return ce(()=>{ue(()=>{const n=i.value?.$el;if(n&&r.search){const l=r.search.length;n.setSelectionRange(l,l)}})}),(n,l)=>(u(),k("div",Ta,[v(e(rs),{class:"size-4 shrink-0 opacity-50"}),v(e($s),T({ref_key:"inputRef",ref:i},{...e(o),...n.$attrs},{modelValue:e(r).search,"onUpdate:modelValue":l[0]||(l[0]=f=>e(r).search=f),"data-slot":"command-input","auto-focus":"",class:e(W)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t.class)}),null,16,["modelValue","class"])]))}}),Va=Object.assign(za,{__name:"UiCommandInput"}),ja=E({__name:"CommandItem",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["select"],setup(a,{emit:t}){const s=a,o=t,r=J(s,"class"),i=fe(r,o),n=Se(),{filterState:l,allItems:f,allGroups:p}=Ee(),y=Wa(),m=M(()=>{if(l.search){const x=l.filtered.items.get(n);return x===void 0?!0:x>0}else return!0}),b=S(),z=At(b);return ce(()=>{if(!(z.value instanceof HTMLElement))return;f.value.set(n,z.value.textContent??s.value?.toString()??"");const x=y?.id;x&&(p.value.has(x)?p.value.get(x)?.add(n):p.value.set(x,new Set([n])))}),ye(()=>{f.value.delete(n)}),(x,A)=>m.value?(u(),g(e(Ls),T({key:0},e(i),{id:e(n),ref_key:"itemRef",ref:b,"data-slot":"command-item",class:e(W)("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s.class),onSelect:A[0]||(A[0]=()=>{e(l).search=""})}),{default:c(()=>[O(x.$slots,"default")]),_:3},16,["id","class"])):H("",!0)}}),ie=Object.assign(ja,{__name:"UiCommandItem"}),qa={role:"presentation"},Ka=E({__name:"CommandList",props:{asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class"),o=$e(s);return(r,i)=>(u(),g(e(ws),T({"data-slot":"command-list"},e(o),{class:e(W)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto scrollbar-none",t.class)}),{default:c(()=>[d("div",qa,[O(r.$slots,"default")])]),_:3},16,["class"]))}}),Ha=Object.assign(Ka,{__name:"UiCommandList"}),Ua=E({__name:"CommandSeparator",props:{orientation:{},decorative:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(a){const t=a,s=J(t,"class");return(o,r)=>(u(),g(e(ts),T({"data-slot":"command-separator"},e(s),{class:e(W)("bg-border -mx-1 h-px",t.class)}),{default:c(()=>[O(o.$slots,"default")]),_:3},16,["class"]))}}),Ge=Object.assign(Ua,{__name:"UiCommandSeparator"}),Na=E({__name:"CommandShortcut",props:{class:{}},setup(a){const t=a;return(s,o)=>(u(),k("span",{"data-slot":"command-shortcut",class:pe(e(W)("text-muted-foreground ml-auto text-xs tracking-widest",t.class))},[O(s.$slots,"default")],2))}});Object.assign(Na,{__name:"UiCommandShortcut"});const[Ee,Ga]=be("Command"),[Wa,Xa]=be("CommandGroup"),Ja={class:"flex-1"},Qa={class:"flex-1"},Ya={class:"ml-auto flex items-center gap-1"},Za={class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},eo={class:"flex-1"},to={class:"ml-auto flex items-center gap-1"},so={class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},ao={class:"ml-auto flex items-center gap-1"},oo={class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},no=E({__name:"CommandPalette",props:{open:{type:Boolean,default:!1},openModifiers:{},filter:{default:""},filterModifiers:{}},emits:$t(["openShortcutsHelp"],["update:open","update:filter"]),setup(a,{emit:t}){const s=Oe(a,"open"),o=Oe(a,"filter"),r=t,i=Je(),{themeMode:n,cycleThemeMode:l}=Qe(),{prds:f}=ze(),{repos:p,currentRepoId:y,selectRepo:m,refreshGitRepos:b}=we(),{showSuccess:z,showError:x}=et(),A=S("document");{const F=localStorage.getItem("prd-viewer-tab");(F==="document"||F==="board")&&(A.value=F)}function V(F){y.value&&(i.push(`/${y.value}/${F}`),s.value=!1)}function w(F){m(F),i.push("/"),s.value=!1}function K(){l(),s.value=!1}function U(){const F=A.value==="document"?"board":"document";A.value=F,localStorage.setItem("prd-viewer-tab",F),window.dispatchEvent(new StorageEvent("storage",{key:"prd-viewer-tab",newValue:F})),s.value=!1}function X(){s.value=!1,r("openShortcutsHelp")}const D=S(!1);async function se(){if(!(!y.value||D.value)){D.value=!0,s.value=!1;try{const F=await b(y.value);z(`Discovered ${F.discovered} git repositories`)}catch{x("Failed to refresh git repos")}finally{D.value=!1}}}oe(s,F=>{F||(o.value="")});const j=M(()=>navigator.platform.toUpperCase().indexOf("MAC")>=0),ee=M(()=>j.value?"⌘":"Ctrl");return(F,P)=>(u(),g(e(Oa),{open:s.value,"onUpdate:open":P[0]||(P[0]=B=>s.value=B),"default-search":o.value},{default:c(()=>[v(e(Va),{placeholder:"Type a command or search..."}),v(e(Ha),null,{default:c(()=>[v(e(La),null,{default:c(()=>[...P[1]||(P[1]=[G("No results found.",-1)])]),_:1}),e(f)?.length?(u(),g(e(Ae),{key:0,heading:"Documents"},{default:c(()=>[(u(!0),k(Z,null,te(e(f),B=>(u(),g(e(ie),{key:B.slug,value:`PRD: ${B.name}`,onSelect:N=>V(B.slug)},{default:c(()=>[v(e(Le),{class:"size-4"}),d("span",null,L(B.name),1)]),_:2},1032,["value","onSelect"]))),128))]),_:1})):H("",!0),e(f)?.length&&e(p)?.length?(u(),g(e(Ge),{key:1})):H("",!0),e(p)?.length?(u(),g(e(Ae),{key:2,heading:"Repositories"},{default:c(()=>[(u(!0),k(Z,null,te(e(p),B=>(u(),g(e(ie),{key:B.id,value:`repo-${B.id} ${B.name}`,onSelect:N=>w(B.id)},{default:c(()=>[v(e(Me),{class:"size-4"}),d("span",Ja,L(B.name),1),B.id===e(y)?(u(),g(e(tt),{key:0,class:"size-4 text-primary"})):H("",!0)]),_:2},1032,["value","onSelect"]))),128))]),_:1})):H("",!0),e(p)?.length?(u(),g(e(Ge),{key:3})):H("",!0),v(e(Ae),{heading:"Actions"},{default:c(()=>[v(e(ie),{value:"cycle-theme light dark system",onSelect:K},{default:c(()=>[e(n)==="system"?(u(),g(e(rt),{key:0,class:"size-4"})):e(n)==="light"?(u(),g(e(ut),{key:1,class:"size-4"})):(u(),g(e(it),{key:2,class:"size-4"})),d("span",Qa,"Cycle theme mode ("+L(e(n))+")",1),d("div",Ya,[d("kbd",Za,L(e(ee)),1),P[2]||(P[2]=d("kbd",{class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},".",-1))])]),_:1}),v(e(ie),{value:`switch-tab ${e(A)==="document"?"task board":"document"}`,onSelect:U},{default:c(()=>[v(e(ss),{class:"size-4"}),d("span",eo,"Switch to "+L(e(A)==="document"?"Task Board":"Document"),1),d("div",to,[d("kbd",so,L(e(ee)),1),P[3]||(P[3]=d("kbd",{class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},"\\",-1))])]),_:1},8,["value"]),v(e(ie),{value:"keyboard shortcuts help",onSelect:X},{default:c(()=>[v(e(as),{class:"size-4"}),P[5]||(P[5]=d("span",{class:"flex-1"},"Keyboard shortcuts",-1)),d("div",ao,[d("kbd",oo,L(e(ee)),1),P[4]||(P[4]=d("kbd",{class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground"},"/",-1))])]),_:1}),e(y)?(u(),g(e(ie),{key:0,value:"refresh git repos rescan discover",disabled:e(D),onSelect:se},{default:c(()=>[v(e(st),{class:pe(["size-4",{"animate-spin":e(D)}])},null,8,["class"]),P[6]||(P[6]=d("span",{class:"flex-1"},"Refresh git repos",-1))]),_:1},8,["disabled"])):H("",!0)]),_:1})]),_:1})]),_:1},8,["open","default-search"]))}}),lo=Object.assign(no,{__name:"CommandPalette"}),ro={class:"space-y-6"},io={class:"mb-3 text-sm font-medium text-muted-foreground"},uo={class:"space-y-2"},co={class:"text-sm"},po={class:"flex items-center gap-1"},fo=E({__name:"ShortcutsHelp",props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:["update:open"],setup(a){const t=Oe(a,"open"),s=M(()=>navigator.platform.toUpperCase().indexOf("MAC")>=0),o=M(()=>s.value?"⌘":"Ctrl"),r=M(()=>[{name:"Navigation",shortcuts:[{keys:[o.value,"K"],description:"Open command palette"},{keys:[o.value,"J"],description:"Quick jump to document"}]},{name:"Actions",shortcuts:[{keys:[o.value,"."],description:"Cycle theme mode (light/dark/system)"},{keys:[o.value,"\\"],description:"Switch between Document and Task Board"},{keys:[o.value,","],description:"Add repository"}]},{name:"Help",shortcuts:[{keys:[o.value,"/"],description:"Show this help"},{keys:["Esc"],description:"Close dialog or palette"}]}]);return(i,n)=>(u(),g(e(dt),{open:t.value,"onUpdate:open":n[0]||(n[0]=l=>t.value=l)},{default:c(()=>[v(e(ct),{class:"max-w-md"},{default:c(()=>[v(e(ft),null,{default:c(()=>[v(e(mt),null,{default:c(()=>[...n[1]||(n[1]=[G("Keyboard Shortcuts",-1)])]),_:1}),v(e(pt),null,{default:c(()=>[...n[2]||(n[2]=[G(" Quick reference for available keyboard shortcuts. ",-1)])]),_:1})]),_:1}),d("div",ro,[(u(!0),k(Z,null,te(e(r),l=>(u(),k("div",{key:l.name},[d("h3",io,L(l.name),1),d("div",uo,[(u(!0),k(Z,null,te(l.shortcuts,f=>(u(),k("div",{key:f.description,class:"flex items-center justify-between"},[d("span",co,L(f.description),1),d("div",po,[(u(!0),k(Z,null,te(f.keys,(p,y)=>(u(),k("kbd",{key:y,class:"inline-flex h-5 min-w-5 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-xs font-medium text-muted-foreground"},L(p),1))),128))])]))),128))])]))),128))])]),_:1})]),_:1},8,["open"]))}}),mo=Object.assign(fo,{__name:"ShortcutsHelp"});function vt(){const a=document.activeElement;if(!a)return!1;const t=a.tagName.toLowerCase();return t==="input"||t==="textarea"||a.getAttribute("contenteditable")==="true"||a.getAttribute("role")==="textbox"}function vo(a){const t=a.toLowerCase().split("+"),s=t.pop()||"";return{meta:t.includes("meta"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt"),key:s}}function ho(a,t){const s=a.key.toLowerCase();let o=s===t.key;return t.key==="\\"&&(o=s==="\\"||a.code==="Backslash"),t.key==="/"&&(o=s==="/"||a.code==="Slash"),t.key==="."&&(o=s==="."||a.code==="Period"),t.key===","&&(o=s===","||a.code==="Comma"),o&&a.metaKey===t.meta&&a.ctrlKey===t.ctrl&&a.shiftKey===t.shift&&a.altKey===t.alt}const Ce=[];let We=!1;function go(a){for(const t of Ce)if(ho(a,t.combo)){if(!t.allowInInput&&vt())continue;a.preventDefault(),a.stopPropagation(),t.handler();return}}function Xe(){We||(document.addEventListener("keydown",go,{capture:!0}),We=!0)}function yo(){ce(()=>{Xe()});function a(s,o,r){const n={combo:vo(s),handler:o,allowInInput:r?.allowInInput??!1};Ce.push(n),Xe(),ye(()=>{const l=Ce.indexOf(n);l>-1&&Ce.splice(l,1)})}function t(){return vt()}return{onShortcut:a,isInputFocused:t}}function _o(a){const t=S(null),s=S(!1),o=S(null);function r(){if(!t.value)try{const n=new EventSource("/api/watch");n.onopen=()=>{s.value=!0,o.value=null},n.onmessage=l=>{try{const f=JSON.parse(l.data);a(f)}catch{}},n.onerror=()=>{s.value=!1,o.value="Connection lost",setTimeout(()=>{t.value===n&&(t.value=null,r())},5e3)},t.value=n}catch{o.value="Failed to connect"}}function i(){t.value&&(t.value.close(),t.value=null,s.value=!1)}return ce(()=>{r()}),ye(()=>{i()}),{isConnected:s,error:o,connect:r,disconnect:i}}const bo={class:"min-h-screen bg-background text-foreground"},xo={class:"fixed top-0 left-0 right-0 z-50 h-14 border-b border-border bg-background/95 backdrop-blur-sm supports-[backdrop-filter]:bg-background/80"},Co={class:"flex h-full items-center justify-between px-4 md:px-6"},ko={class:"flex items-center gap-3"},wo={class:"flex h-screen pt-14"},So={class:"flex-1 overflow-auto"},Fo=E({__name:"default",setup(a){const{themeMode:t,cycleThemeMode:s}=Qe(),{refreshPrds:o}=ze(),{currentRepoId:r}=we(),i=Te(),n=S(null);Et("fileChangeEvent",n);const l=S(!1),f=S(""),p=S(!1),y=S(null),{onShortcut:m}=yo();m("Meta+k",()=>{l.value=!0}),m("Ctrl+k",()=>{l.value=!0}),m("Meta+j",()=>{f.value="PRD: ",l.value=!0}),m("Ctrl+j",()=>{f.value="PRD: ",l.value=!0});function b(){const w=(localStorage.getItem("prd-viewer-tab")||"document")==="document"?"board":"document";localStorage.setItem("prd-viewer-tab",w),window.dispatchEvent(new StorageEvent("storage",{key:"prd-viewer-tab",newValue:w}))}m("Meta+\\",b),m("Ctrl+\\",b);function z(){s()}m("Meta+.",z),m("Ctrl+.",z);function x(){y.value?.openAddDialog()}m("Meta+,",x),m("Ctrl+,",x);function A(){p.value=!0}return m("Meta+/",A),m("Ctrl+/",A),m("Meta+Shift+/",A),m("Ctrl+Shift+/",A),_o(V=>{if(V.type==="connected"||!V.category)return;const w=V.category;if(V.repoId!==r.value)return;(w==="prd"||w==="tasks")&&o();const K=i.params.prd;if(K){const U=w==="prd"&&V.path?.includes(`/${K}.`),X=(w==="tasks"||w==="progress")&&V.path?.includes(`/${K}/`);(U||X)&&(n.value={category:w,path:V.path,timestamp:Date.now()})}}),(V,w)=>{const K=ua,U=Dt,X=_a;return u(),k("div",bo,[v(lo,{open:e(l),"onUpdate:open":w[0]||(w[0]=D=>ve(l)?l.value=D:null),filter:e(f),"onUpdate:filter":w[1]||(w[1]=D=>ve(f)?f.value=D:null),onOpenShortcutsHelp:A},null,8,["open","filter"]),v(mo,{open:e(p),"onUpdate:open":w[2]||(w[2]=D=>ve(p)?p.value=D:null)},null,8,["open"]),d("header",xo,[d("div",Co,[w[5]||(w[5]=d("div",{class:"flex items-center gap-4"},[d("h1",{class:"text-lg font-semibold tracking-tight"}," PRD Viewer ")],-1)),v(U,null,{fallback:c(()=>[...w[4]||(w[4]=[d("div",{class:"flex items-center gap-3"},[d("div",{class:"h-8 w-[200px] animate-pulse rounded-md bg-muted"}),d("div",{class:"size-9 animate-pulse rounded-md bg-muted"})],-1)])]),default:c(()=>[d("div",ko,[v(K,{ref_key:"repoSelectorRef",ref:y},null,512),v(e(de),{variant:"ghost",size:"icon",class:"size-9",onClick:z},{default:c(()=>[e(t)==="system"?(u(),g(e(rt),{key:0,class:"size-4"})):e(t)==="light"?(u(),g(e(ut),{key:1,class:"size-4"})):(u(),g(e(it),{key:2,class:"size-4"})),w[3]||(w[3]=d("span",{class:"sr-only"},"Cycle theme mode",-1))]),_:1})])]),_:1})])]),d("div",wo,[v(U,null,{fallback:c(()=>[...w[6]||(w[6]=[d("aside",{class:"flex h-full w-64 flex-col border-r border-border bg-background"},[d("div",{class:"flex h-12 items-center border-b border-border px-4"},[d("div",{class:"h-4 w-20 animate-pulse rounded bg-muted"})]),d("div",{class:"flex-1 p-2 space-y-2"},[d("div",{class:"h-9 animate-pulse rounded-md bg-muted"}),d("div",{class:"h-9 animate-pulse rounded-md bg-muted"}),d("div",{class:"h-9 animate-pulse rounded-md bg-muted"})])],-1)])]),default:c(()=>[v(X)]),_:1}),d("main",So,[O(V.$slots,"default")])])])}}});export{Fo as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"e2995e80-736c-47cd-8041-a131bab2f136","timestamp":1771870545874,"prerendered":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-DGOIWqjD.mjs","sources":["../../../../node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/default-DGOIWqjD.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|