@loicngr/kobo 1.6.4 → 1.6.5
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/dist/server/routes/workspaces.js +88 -0
- package/dist/server/services/workspace-service.js +10 -2
- package/dist/server/utils/git-ops.js +41 -0
- package/package.json +1 -1
- package/src/client/dist/spa/assets/{ActivityFeed-Bsm5QUA9.js → ActivityFeed-DETQbE-a.js} +1 -1
- package/src/client/dist/spa/assets/{CreatePage-CyHlqcZv.js → CreatePage-B7e487jg.js} +1 -1
- package/src/client/dist/spa/assets/{DiffViewer-BDOGx54T.js → DiffViewer-4-z5gGzs.js} +2 -2
- package/src/client/dist/spa/assets/{HealthPage-CwaLsB_m.js → HealthPage-Pof_7jsi.js} +1 -1
- package/src/client/dist/spa/assets/{MainLayout-CYMzO0e8.js → MainLayout-CJJ8RX8d.js} +4 -4
- package/src/client/dist/spa/assets/{MainLayout-CKGnqXNp.css → MainLayout-Cb6_QXbV.css} +1 -1
- package/src/client/dist/spa/assets/{SearchPage-D5C4I5SC.js → SearchPage-Do9kkaR_.js} +1 -1
- package/src/client/dist/spa/assets/{SettingsPage-DIDwr-uq.js → SettingsPage-CpvnCfxM.js} +1 -1
- package/src/client/dist/spa/assets/{WorkspacePage-Bx_w4QNi.js → WorkspacePage-De-8vIz8.js} +3 -3
- package/src/client/dist/spa/assets/{build-path-tree-TBMtG2me.js → build-path-tree-DBKR9p4C.js} +1 -1
- package/src/client/dist/spa/assets/{cssMode-noDDoaIu.js → cssMode-D7H4G9u2.js} +1 -1
- package/src/client/dist/spa/assets/{documents-C8qHepC2.js → documents-CByb0FJM.js} +1 -1
- package/src/client/dist/spa/assets/{editor.api-CtzJLjGf.js → editor.api--wqcZBpd.js} +1 -1
- package/src/client/dist/spa/assets/{editor.main-DPd-buqm.js → editor.main-BNIb69JB.js} +3 -3
- package/src/client/dist/spa/assets/{freemarker2-BbnROwW1.js → freemarker2-D-thr4Nz.js} +1 -1
- package/src/client/dist/spa/assets/{handlebars-Ksvxefhe.js → handlebars-uz-Lnmlq.js} +1 -1
- package/src/client/dist/spa/assets/{html-C-hmwqXO.js → html-BrD38Itg.js} +1 -1
- package/src/client/dist/spa/assets/{htmlMode-DrAVxVod.js → htmlMode-DhJl0i4i.js} +1 -1
- package/src/client/dist/spa/assets/i18n-DBt4wD57.js +1 -0
- package/src/client/dist/spa/assets/index-B0Jj-w-E.js +2 -0
- package/src/client/dist/spa/assets/{javascript-CPLPvA_S.js → javascript-PJBbOo9I.js} +1 -1
- package/src/client/dist/spa/assets/{jsonMode-DOTbDLvn.js → jsonMode-D4akRBRs.js} +1 -1
- package/src/client/dist/spa/assets/{liquid-CdSz2rzX.js → liquid-EUlazot7.js} +1 -1
- package/src/client/dist/spa/assets/{mdx-D9jK81Jo.js → mdx-BGyD5-MK.js} +1 -1
- package/src/client/dist/spa/assets/{models-DVnzXKOh.js → models-GweeyU2r.js} +1 -1
- package/src/client/dist/spa/assets/{monaco.contribution-BuL3dvHW.js → monaco.contribution-Ci35AF1I.js} +2 -2
- package/src/client/dist/spa/assets/{python-Dge5WJA8.js → python-BG_aaGdU.js} +1 -1
- package/src/client/dist/spa/assets/{razor-CuTUK6Ln.js → razor-BWRO_-vh.js} +1 -1
- package/src/client/dist/spa/assets/{tsMode-CV1esWeE.js → tsMode-CfJ3FSRi.js} +1 -1
- package/src/client/dist/spa/assets/{typescript-CG_BbDRI.js → typescript-BD5IT0Pn.js} +1 -1
- package/src/client/dist/spa/assets/{xml-GLWDavVQ.js → xml-DBx8yQFe.js} +1 -1
- package/src/client/dist/spa/assets/{yaml-BFBo2noB.js → yaml-DdHKmdlx.js} +1 -1
- package/src/client/dist/spa/index.html +1 -1
- package/src/client/dist/spa/assets/i18n-Dah5k8f2.js +0 -1
- package/src/client/dist/spa/assets/index-Y9eYNsHp.js +0 -2
|
@@ -1244,6 +1244,94 @@ app.get('/:id/commits', (c) => {
|
|
|
1244
1244
|
return c.json({ error: message }, 500);
|
|
1245
1245
|
}
|
|
1246
1246
|
});
|
|
1247
|
+
// POST /api/workspaces/:id/rename-branch { newName }
|
|
1248
|
+
// Rename the working branch in git, move the worktree dir to match, and
|
|
1249
|
+
// update the DB. Run as one atomic operation from the UI "Rename branch"
|
|
1250
|
+
// action. If the worktree move fails (dirty tree, etc.) the branch rename
|
|
1251
|
+
// is kept — the DB is still updated so Kōbō tracks the current name.
|
|
1252
|
+
app.post('/:id/rename-branch', async (c) => {
|
|
1253
|
+
try {
|
|
1254
|
+
const id = c.req.param('id');
|
|
1255
|
+
const body = (await c.req.json().catch(() => ({})));
|
|
1256
|
+
const newName = typeof body.newName === 'string' ? body.newName.trim() : '';
|
|
1257
|
+
if (!newName) {
|
|
1258
|
+
return c.json({ error: 'newName is required' }, 400);
|
|
1259
|
+
}
|
|
1260
|
+
if (!/^[A-Za-z0-9/_\-.]+$/.test(newName)) {
|
|
1261
|
+
return c.json({ error: 'Invalid branch name (only letters, digits, /, _, -, . allowed)' }, 400);
|
|
1262
|
+
}
|
|
1263
|
+
const workspace = workspaceService.getWorkspace(id);
|
|
1264
|
+
if (!workspace) {
|
|
1265
|
+
return c.json({ error: `Workspace '${id}' not found` }, 404);
|
|
1266
|
+
}
|
|
1267
|
+
if (newName === workspace.workingBranch) {
|
|
1268
|
+
return c.json(workspace); // no-op
|
|
1269
|
+
}
|
|
1270
|
+
const oldWorktreePath = path.join(workspace.projectPath, '.worktrees', workspace.workingBranch);
|
|
1271
|
+
const newWorktreePath = path.join(workspace.projectPath, '.worktrees', newName);
|
|
1272
|
+
// Reject early if the target name is already in use — either as a local
|
|
1273
|
+
// branch or on origin. Avoids git's generic "already exists" error and
|
|
1274
|
+
// protects against the same silent-fallback trap the create flow has.
|
|
1275
|
+
if (gitOps.branchExists(oldWorktreePath, newName)) {
|
|
1276
|
+
return c.json({ error: `Branch '${newName}' already exists (locally or on origin)`, code: 'branch_exists' }, 409);
|
|
1277
|
+
}
|
|
1278
|
+
try {
|
|
1279
|
+
gitOps.renameBranch(oldWorktreePath, workspace.workingBranch, newName);
|
|
1280
|
+
}
|
|
1281
|
+
catch (err) {
|
|
1282
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1283
|
+
return c.json({ error: `Failed to rename git branch: ${message}` }, 500);
|
|
1284
|
+
}
|
|
1285
|
+
// Best-effort: align the worktree dir with the new branch name. If the
|
|
1286
|
+
// tree is dirty or another process holds a lock, skip silently — the
|
|
1287
|
+
// worktree keeps working under its old path, and Kōbō uses the ref name,
|
|
1288
|
+
// not the dir, for git operations.
|
|
1289
|
+
try {
|
|
1290
|
+
gitOps.moveWorktree(workspace.projectPath, oldWorktreePath, newWorktreePath);
|
|
1291
|
+
}
|
|
1292
|
+
catch (err) {
|
|
1293
|
+
console.error('[workspaces] Failed to move worktree dir (branch renamed anyway):', err);
|
|
1294
|
+
}
|
|
1295
|
+
const updated = workspaceService.updateWorkingBranch(id, newName);
|
|
1296
|
+
return c.json(updated);
|
|
1297
|
+
}
|
|
1298
|
+
catch (err) {
|
|
1299
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1300
|
+
return c.json({ error: message }, 500);
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
// POST /api/workspaces/:id/resync-branch
|
|
1304
|
+
// Read the real current branch name inside the worktree (via
|
|
1305
|
+
// `git rev-parse --abbrev-ref HEAD`) and update the DB if it drifted. Used
|
|
1306
|
+
// after the agent renames the branch from the chat (`git branch -m …`).
|
|
1307
|
+
app.post('/:id/resync-branch', (c) => {
|
|
1308
|
+
try {
|
|
1309
|
+
const id = c.req.param('id');
|
|
1310
|
+
const workspace = workspaceService.getWorkspace(id);
|
|
1311
|
+
if (!workspace) {
|
|
1312
|
+
return c.json({ error: `Workspace '${id}' not found` }, 404);
|
|
1313
|
+
}
|
|
1314
|
+
const worktreePath = path.join(workspace.projectPath, '.worktrees', workspace.workingBranch);
|
|
1315
|
+
let actual;
|
|
1316
|
+
try {
|
|
1317
|
+
actual = gitOps.getCurrentBranch(worktreePath).trim();
|
|
1318
|
+
}
|
|
1319
|
+
catch (err) {
|
|
1320
|
+
// Could mean the dir was moved too — try scanning worktrees.
|
|
1321
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1322
|
+
return c.json({ error: `Could not read HEAD: ${message}` }, 500);
|
|
1323
|
+
}
|
|
1324
|
+
if (!actual || actual === workspace.workingBranch) {
|
|
1325
|
+
return c.json({ ok: true, changed: false, workingBranch: workspace.workingBranch });
|
|
1326
|
+
}
|
|
1327
|
+
const updated = workspaceService.updateWorkingBranch(id, actual);
|
|
1328
|
+
return c.json({ ok: true, changed: true, workingBranch: updated.workingBranch });
|
|
1329
|
+
}
|
|
1330
|
+
catch (err) {
|
|
1331
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1332
|
+
return c.json({ error: message }, 500);
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1247
1335
|
// POST /api/workspaces/:id/push — push working branch to origin
|
|
1248
1336
|
app.post('/:id/push', async (c) => {
|
|
1249
1337
|
try {
|
|
@@ -159,13 +159,21 @@ export function updateWorkspaceReasoningEffort(id, reasoningEffort) {
|
|
|
159
159
|
}
|
|
160
160
|
return getWorkspace(id);
|
|
161
161
|
}
|
|
162
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Update the working branch for a workspace. Used both after ticket-ID
|
|
164
|
+
* injection at creation time and after the rename-branch / resync-branch
|
|
165
|
+
* endpoints. Rejects empty / whitespace-only names.
|
|
166
|
+
*/
|
|
163
167
|
export function updateWorkingBranch(id, workingBranch) {
|
|
168
|
+
const sanitized = workingBranch.trim();
|
|
169
|
+
if (!sanitized) {
|
|
170
|
+
throw new Error('Branch name cannot be empty');
|
|
171
|
+
}
|
|
164
172
|
const db = getDb();
|
|
165
173
|
const now = new Date().toISOString();
|
|
166
174
|
const result = db
|
|
167
175
|
.prepare('UPDATE workspaces SET working_branch = ?, updated_at = ? WHERE id = ?')
|
|
168
|
-
.run(
|
|
176
|
+
.run(sanitized, now, id);
|
|
169
177
|
if (result.changes === 0) {
|
|
170
178
|
throw new Error(`Workspace '${id}' not found`);
|
|
171
179
|
}
|
|
@@ -353,6 +353,47 @@ export function getPrStatus(repoPath, branchName) {
|
|
|
353
353
|
return null;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Rename a branch in-place (`git branch -m <old> <new>`). Must be run inside
|
|
358
|
+
* the worktree (or any directory tracking the repo) — the new name replaces
|
|
359
|
+
* the old one locally. The remote still has the old name; the caller is
|
|
360
|
+
* responsible for pushing the renamed branch if needed.
|
|
361
|
+
*/
|
|
362
|
+
export function renameBranch(repoPath, oldName, newName) {
|
|
363
|
+
git(repoPath, ['branch', '-m', oldName, newName]);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Check whether a branch name is already in use — either as a local branch
|
|
367
|
+
* or a remote tracking branch on the given remote. Used before renaming a
|
|
368
|
+
* branch to fail early with a clear error instead of letting git throw a
|
|
369
|
+
* generic "already exists" message.
|
|
370
|
+
*/
|
|
371
|
+
export function branchExists(repoPath, name, remote = 'origin') {
|
|
372
|
+
try {
|
|
373
|
+
git(repoPath, ['rev-parse', '--verify', '--quiet', `refs/heads/${name}`]);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
// not a local branch
|
|
378
|
+
}
|
|
379
|
+
try {
|
|
380
|
+
git(repoPath, ['rev-parse', '--verify', '--quiet', `refs/remotes/${remote}/${name}`]);
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
// not a remote branch either
|
|
385
|
+
}
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Move a worktree directory on disk via `git worktree move`. Both the
|
|
390
|
+
* filesystem layout and the `worktrees` metadata file are updated atomically.
|
|
391
|
+
* Throws if the destination exists, the worktree is dirty, or the source
|
|
392
|
+
* is the main working tree.
|
|
393
|
+
*/
|
|
394
|
+
export function moveWorktree(projectPath, oldPath, newPath) {
|
|
395
|
+
git(projectPath, ['worktree', 'move', oldPath, newPath]);
|
|
396
|
+
}
|
|
356
397
|
/** List files changed between base and HEAD (committed), plus working tree changes. */
|
|
357
398
|
export function getChangedFiles(repoPath, base) {
|
|
358
399
|
const ref = resolveBase(repoPath, base);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loicngr/kobo",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "Kōbō — multi-workspace agent manager for Claude Code. Orchestrates isolated git worktrees with dev servers, Notion integration, and MCP tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as e,F as t,H as n,L as r,M as i,Q as a,U as o,_t as s,bt as c,d as l,f as u,g as d,h as f,l as p,p as m,r as h,rt as g,u as _,v,yt as y}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{L as b,l as x,t as S}from"./QIcon-B0-pH3Qs.js";import{t as C}from"./QBtn-CyzfM9-_.js";import{n as w}from"./vue-i18n-eUDnMrPl.js";import{S as T,v as E,x as D}from"./index-
|
|
1
|
+
import{E as e,F as t,H as n,L as r,M as i,Q as a,U as o,_t as s,bt as c,d as l,f as u,g as d,h as f,l as p,p as m,r as h,rt as g,u as _,v,yt as y}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{L as b,l as x,t as S}from"./QIcon-B0-pH3Qs.js";import{t as C}from"./QBtn-CyzfM9-_.js";import{n as w}from"./vue-i18n-eUDnMrPl.js";import{S as T,v as E,x as D}from"./index-B0Jj-w-E.js";import{t as O}from"./QSpinnerDots-By20ptst.js";import{t as k}from"./QExpansionItem-HLBjHx-0.js";import{t as A}from"./QScrollArea-CBW6shMb.js";import{t as j}from"./QTooltip-DbEBexRN.js";import{n as M,r as N,t as P}from"./documents-CByb0FJM.js";import{t as F}from"./_plugin-vue_export-helper-Cj6tcsj6.js";function ee(e,t,n=!0){let r=[],i=new Map,a=new Map;for(let n=0;n<e.length;n++){let o=e[n],s=t?.[n];switch(o.kind){case`message:text`:{let e=i.get(o.messageId);if(e)e.text+=o.text,e.streaming=o.streaming;else{let e={type:`text`,messageId:o.messageId,text:o.text,streaming:o.streaming,ts:s};i.set(o.messageId,e),r.push(e)}break}case`message:end`:{let e=i.get(o.messageId);e&&(e.streaming=!1);break}case`message:thinking`:r.push({type:`thinking`,messageId:o.messageId,text:o.text,ts:s});break;case`tool:call`:{let e={type:`tool`,toolCallId:o.toolCallId,name:o.name,input:o.input,ts:s};a.set(o.toolCallId,e),r.push(e);break}case`tool:result`:{let e=a.get(o.toolCallId);e&&(e.result={output:o.output,isError:o.isError});break}case`session:started`:r.push({type:`session`,kind:`started`,detail:{engineSessionId:o.engineSessionId,model:o.model},ts:s});break;case`session:ended`:r.push({type:`session`,kind:`ended`,detail:{reason:o.reason,exitCode:o.exitCode},ts:s});break;case`session:compacted`:r.push({type:`session`,kind:`compacted`,ts:s});break;case`session:brainstorm-complete`:case`message:raw`:case`skills:discovered`:case`usage`:case`rate_limit`:case`subagent:progress`:case`error`:break;default:}}let o=null;for(let e of r)e.type===`text`&&e.streaming&&(o&&(o.streaming=!1),o=e);return o&&!n&&(o.streaming=!1),r}function te(e,t){if(t.length===0)return e;let n=t.map(e=>({type:`user`,content:e.content,sender:e.sender,ts:e.ts})),r=[...e,...n];r.sort((e,t)=>{let n=e.ts??``,r=t.ts??``;return n===r?0:n?r?n<r?-1:1:-1:1});let i;for(let e of r)e.type===`user`&&e.sender!==`system-prompt`&&e.ts&&(!i||e.ts>i)&&(i=e.ts);if(i)for(let e of r)e.type===`text`&&e.streaming&&(!e.ts||e.ts<i)&&(e.streaming=!1);return r}function I(e){switch(e.type){case`user`:return e.sender===`system-prompt`?`system-prompt`:`user`;case`session`:return`session`;default:return`agent`}}function ne(e){let t=[],n=null;for(let r of e){let e=I(r),i=e===`session`||e===`system-prompt`;!n||n.speaker!==e||i?(n={speaker:e,ts:r.ts,items:[r]},t.push(n),i&&(n=null)):n.items.push(r)}return t}var L={class:`text-caption text-grey-6`},R=v({__name:`SessionEventItem`,props:{item:{}},setup(e){let n=e,r=p(()=>{switch(n.item.kind){case`started`:return`session.started`;case`ended`:return`session.ended`;case`compacted`:return`session.compacted`;default:return`session.started`}});return(e,n)=>(t(),m(`span`,L,c(e.$t(r.value)),1))}});function z(e,t){if(t.length===0||e.length===0)return e;let n=[...t].sort((e,t)=>t.length-e.length),r=new DOMParser().parseFromString(`<div>${e}</div>`,`text/html`),i=r.body.firstChild;if(!i)return e;function a(e){if(e.nodeType===Node.TEXT_NODE){B(e,n,r);return}if(e.nodeName===`A`)return;let t=Array.from(e.childNodes);for(let e of t)a(e)}return a(i),i.innerHTML}function B(e,t,n){let r=e.textContent??``;if(!t.some(e=>r.includes(e)))return;let i=n.createDocumentFragment(),a=0;for(;a<r.length;){let e=V(r,a,t);if(!e){i.appendChild(n.createTextNode(r.slice(a)));break}e.index>a&&i.appendChild(n.createTextNode(r.slice(a,e.index)));let o=n.createElement(`a`);o.className=`document-link`,o.setAttribute(`data-document-path`,e.path),o.setAttribute(`href`,`#`),o.textContent=e.path,i.appendChild(o),a=e.index+e.path.length}e.parentNode?.replaceChild(i,e)}function V(e,t,n){let r=null;for(let i of n){let n=e.indexOf(i,t);n<0||(!r||n<r.index||n===r.index&&i.length>r.path.length)&&(r={index:n,path:i})}return r}var H=[`innerHTML`],U=F(v({__name:`TextMessageItem`,props:{item:{}},setup(e){let n=e,r=P(),i=E(),a=p(()=>{let e=i.selectedWorkspaceId;return e?r.documentsFor(e).map(e=>e.path):[]}),o=p(()=>{let e=z(M.parse(n.item.text,{async:!1,breaks:!0,gfm:!0}),a.value);return N.sanitize(e,{ADD_ATTR:[`data-document-path`]})});function s(e){let t=e.target?.closest(`.document-link`);if(!t)return;e.preventDefault();let n=t.getAttribute(`data-document-path`),a=i.selectedWorkspaceId;!n||!a||r.openDocumentByPath(a,n)}return(n,r)=>(t(),m(`div`,{class:`markdown-message`,onClick:s},[_(`div`,{innerHTML:o.value},null,8,H),e.item.streaming?(t(),l(x,{key:0,size:`xs`,class:`q-ml-xs`})):u(``,!0)]))}}),[[`__scopeId`,`data-v-0ac5a3e4`]]),W={key:0,class:`text-caption text-grey-5`,style:{"font-style":`italic`}},G=[`innerHTML`],K={key:1,style:{"white-space":`pre-wrap`}},q=F(v({__name:`ThinkingItem`,props:{item:{}},setup(e){let n=e,r=p(()=>n.item.text.trim().slice(0,100)),i=p(()=>n.item.text.trim().length>0),a=p(()=>n.item.text.trim().length>100),s=p(()=>{let e=M.parse(n.item.text,{async:!1,breaks:!0,gfm:!0});return N.sanitize(e)});return(n,d)=>i.value?(t(),m(`div`,W,[a.value?(t(),l(k,{key:0,dense:``,"dense-toggle":``,label:r.value,"header-class":`text-grey-5 text-caption`,style:{"font-style":`italic`}},{default:o(()=>[_(`div`,{class:`q-py-xs markdown-thinking`,innerHTML:s.value},null,8,G)]),_:1},8,[`label`])):(t(),m(`span`,K,c(e.item.text),1))])):u(``,!0)}}),[[`__scopeId`,`data-v-e9fb9f90`]]);function J(e,t){let n=e.split(`
|
|
2
2
|
`),r=t.split(`
|
|
3
3
|
`),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)n[e]===r[t]?o[e][t]=o[e+1][t+1]+1:o[e][t]=Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i&&l<a;)n[c]===r[l]?(s.push({type:`context`,content:n[c]}),c++,l++):o[c+1][l]>=o[c][l+1]?(s.push({type:`del`,content:n[c]}),c++):(s.push({type:`add`,content:r[l]}),l++);for(;c<i;)s.push({type:`del`,content:n[c++]});for(;l<a;)s.push({type:`add`,content:r[l++]});return s}function Y(e,t){if(!t||typeof t!=`object`)return null;let n=t;if(e===`Edit`){let e=n.file_path;if(!e)return null;let t=n.old_string??``,r=n.new_string??``;return{toolName:`Edit`,filePath:e,oldString:t,newString:r,replaceAll:n.replace_all??!1,additions:r?r.split(`
|
|
4
4
|
`).length:0,deletions:t?t.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as e,H as t,L as n,M as r,N as i,Q as a,T as ee,U as o,bt as s,d as c,f as l,g as u,h as d,l as f,p,r as m,rt as te,u as h,v as ne,vt as re,x as ie}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{I as g,L as _,M as ae,t as v}from"./QIcon-B0-pH3Qs.js";import{t as y}from"./QSeparator-DNSiXYrN.js";import{t as b}from"./QBtn-CyzfM9-_.js";import{n as oe}from"./vue-i18n-eUDnMrPl.js";import{g as se,i as x,m as ce,v as le,x as ue}from"./index-
|
|
1
|
+
import{F as e,H as t,L as n,M as r,N as i,Q as a,T as ee,U as o,bt as s,d as c,f as l,g as u,h as d,l as f,p,r as m,rt as te,u as h,v as ne,vt as re,x as ie}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{I as g,L as _,M as ae,t as v}from"./QIcon-B0-pH3Qs.js";import{t as y}from"./QSeparator-DNSiXYrN.js";import{t as b}from"./QBtn-CyzfM9-_.js";import{n as oe}from"./vue-i18n-eUDnMrPl.js";import{g as se,i as x,m as ce,v as le,x as ue}from"./index-B0Jj-w-E.js";import{n as S,t as C}from"./QItemSection-BzWLL-V-.js";import{t as w}from"./QItemLabel-Czw5g0px.js";import{t as de}from"./QExpansionItem-HLBjHx-0.js";import{t as T}from"./QTooltip-DbEBexRN.js";import{t as fe}from"./_plugin-vue_export-helper-Cj6tcsj6.js";import{t as pe}from"./QSpace-0zdF1m5x.js";import{t as me}from"./use-quasar-BBrzedjR.js";import{n as E,t as he}from"./models-GweeyU2r.js";import{t as ge}from"./QPage-BTzNQlb1.js";var _e={class:`create-inner`},ve={class:`create-title text-center text-weight-bold q-mb-lg text-grey-3`},ye={class:`create-card rounded-borders`},be={class:`card-top-bar row items-center q-px-md q-py-xs`},xe={class:`model-badge cursor-default row items-center q-gutter-xs`},Se={class:`text-indigo-3 text-weight-medium text-caption`},Ce={key:0,class:`notion-url-wrap`},we={key:0,class:`notion-error text-caption q-px-md q-pb-xs text-red-5`},Te={key:1,class:`notion-valid text-caption q-px-md q-pb-xs text-green-4`},Ee={key:0,class:`sentry-url-wrap`},De={key:0,class:`sentry-error text-caption q-px-md q-pb-xs text-red-5`},Oe={key:1,class:`sentry-valid text-caption q-px-md q-pb-xs text-red-4`},ke={class:`card-name-wrap`},Ae={class:`card-textarea-wrap`},je={class:`manual-hint q-px-md q-py-sm text-caption text-grey-6`},Me={class:`q-pa-sm manual-section-body`},Ne={class:`row items-center q-gutter-sm q-mb-sm`},Pe={class:`col text-caption text-grey-4`},Fe={class:`q-pa-sm manual-section-body`},Ie={class:`row items-center q-gutter-sm q-mb-sm`},Le={class:`col text-caption text-grey-4`},Re={class:`card-bottom-bar`},ze={class:`bottom-row bottom-row-agent row items-center q-gutter-xs q-px-sm q-py-xs`},Be={class:`bottom-select-label row items-center no-wrap`},Ve={class:`bottom-select-label row items-center no-wrap`},He={class:`bottom-select-label row items-center no-wrap`},Ue={class:`bottom-select-label row items-center no-wrap`},We={class:`bottom-row bottom-row-git row items-center q-gutter-xs q-px-sm q-py-xs`},Ge={class:`bottom-select-label row items-center no-wrap`},Ke={class:`bottom-select-label row items-center no-wrap`},qe={class:`row justify-center q-px-sm q-py-sm`},Je={class:`create-hint text-center text-body2 q-mt-md text-grey-8`},Ye=fe(ne({__name:`CreatePage`,setup(ne){let fe=ce(),Ye=me(),Xe=le(),D=ue(),{t:O}=oe(),Ze=a([]),k=a(``),A=a(``),j=a(``),M=a(!1),N=a(`claude-opus-4-7`),P=a(`auto`),F=a(``),I=a(null),L=a(`feature`),R=a(!1),Qe=a([]),z=a(`claude-code`),$e=f(()=>Qe.value.find(e=>e.id===z.value)),et=f(()=>Qe.value.map(e=>({value:e.id,label:e.displayName}))),tt=f(()=>($e.value?.capabilities.permissionModes??[`auto-accept`,`plan`]).map(e=>({value:e,label:O(`engine.permission.${e}`)}))),nt=[{label:`feature/`,value:`feature`},{label:`fix/`,value:`fix`},{label:`hotfix/`,value:`hotfix`},{label:`chore/`,value:`chore`},{label:`refactor/`,value:`refactor`},{label:`docs/`,value:`docs`},{label:`test/`,value:`test`}],B=a(D.global.defaultPermissionMode||`plan`),V=a([]),H=a(!1),U=a(!1),rt=f(()=>he.map(e=>({label:O(e.i18nLabelKey),value:e.value,description:O(e.i18nDescriptionKey)})));function W(e){let t=e.indexOf(`:`);return t>=0?e.slice(t+1).trim():e}let it=f(()=>[{label:W(O(`reasoning.auto`)),value:`auto`,description:O(`reasoning.autoDescription`)},{label:W(O(`reasoning.low`)),value:`low`,description:O(`reasoning.lowDescription`)},{label:W(O(`reasoning.medium`)),value:`medium`,description:O(`reasoning.mediumDescription`)},{label:W(O(`reasoning.high`)),value:`high`,description:O(`reasoning.highDescription`)},{label:W(O(`reasoning.xhigh`)),value:`xhigh`,description:O(`reasoning.xhighDescription`)},{label:W(O(`reasoning.max`)),value:`max`,description:O(`reasoning.maxDescription`)}]),G=f(()=>j.value.trim().startsWith(`https://www.notion.so/`)),K=a([]),q=a([]),J=a(``),Y=a(``),at=f(()=>!M.value||!G.value);function ot(){let e=J.value.trim();e&&(K.value.push(e),J.value=``)}function st(e){K.value.splice(e,1)}function ct(){let e=Y.value.trim();e&&(q.value.push(e),Y.value=``)}function lt(e){q.value.splice(e,1)}function ut(){M.value=!M.value,M.value||(j.value=``)}let X=a(!1),Z=a(``),Q=f(()=>/\/issues\/\d+/.test(Z.value.trim()));function dt(){X.value=!X.value,X.value||(Z.value=``)}async function ft(e){if(!e.trim()){V.value=[],I.value=null;return}H.value=!0;try{let t=await fetch(`/api/git/branches?path=${encodeURIComponent(e.trim())}`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();V.value=n.local??n.branches??[],V.value.length>0&&!I.value&&(I.value=V.value[0]??null)}catch{V.value=[],I.value=null}finally{H.value=!1}}function pt(e){let t=D.getProjectByPath(e);t&&(t.defaultSourceBranch&&(I.value=t.defaultSourceBranch),t.defaultModel?N.value=t.defaultModel:D.global.defaultModel&&(N.value=D.global.defaultModel))}let $=null;t(F,e=>{$&&clearTimeout($),$=setTimeout(()=>{I.value=null,ft(e),pt(e)},500)});function mt(e,t){t(()=>{Ze.value=D.projectPaths.filter(t=>t.toLowerCase().includes(e.toLowerCase()))})}r(async()=>{D.fetchSettings();try{let e=await fetch(`/api/engines`);e.ok&&(Qe.value=await e.json())}catch{}}),i(()=>{$&&clearTimeout($)});function ht(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9\s-]/g,``).trim().replace(/\s+/g,`-`).replace(/-+/g,`-`).substring(0,50)}function gt(){return k.value.trim()?k.value.trim().substring(0,80):!M.value&&A.value.trim()&&(A.value.trim().split(`
|
|
2
2
|
`)[0]??``).substring(0,80)||`workspace`}function _t(e){let t=(e.split(`/`).pop()??``).split(`-`);t.length>1&&/^[0-9a-f]{12,}$/i.test(t[t.length-1])&&t.pop();let n=t.join(`-`).toLowerCase(),r=n.match(/tk-(\d+)/);if(r){let e=`TK-${r[1]}`,t=n.replace(/tk-\d+/i,``).replace(/-+/g,`-`).replace(/^-|-$/g,``).substring(0,40);return t?`${e}--${t}`:e}return n.substring(0,50)||`task-${Date.now()}`}function vt(){return M.value&&!G.value?O(`createPage.validationNotionUrl`):X.value&&!Q.value?O(`createPage.sentryValidation`):!M.value&&!X.value&&!A.value.trim()?O(`createPage.validationDescription`):!M.value&&!X.value&&(!gt()||gt()===`workspace`)&&!k.value.trim()&&!A.value.trim()?O(`createPage.validationName`):F.value.trim()?I.value?null:O(`createPage.validationBranch`):O(`createPage.validationPath`)}async function yt(){let e=vt();if(e){Ye.notify({type:`negative`,message:e,position:`top`});return}U.value=!0;try{let e=gt(),t;t=M.value&&G.value?_t(j.value.trim()):e===`workspace`?`task-${Date.now()}`:ht(e);let n=`${L.value}/${t}`,r={name:e,projectPath:F.value.trim(),sourceBranch:I.value,workingBranch:n,engine:z.value,model:N.value,reasoningEffort:P.value,...M.value&&G.value?{notionUrl:j.value.trim()}:{},...X.value&&Q.value?{sentryUrl:Z.value.trim()}:{},...at.value&&K.value.length>0?{tasks:K.value}:{},...at.value&&q.value.length>0?{acceptanceCriteria:q.value}:{},...R.value?{skipSetupScript:!0}:{},...A.value.trim()?{description:A.value.trim()}:{},permissionMode:B.value},i=await Xe.createWorkspace(r);se().subscribe(i.id),Xe.selectWorkspace(i.id),fe.push({name:`workspace`,params:{id:i.id}})}catch{Ye.notify({type:`negative`,message:O(`createPage.errorCreating`),position:`top`})}finally{U.value=!1}}return(t,r)=>(e(),c(ge,{class:`create-page flex flex-center column`},{default:o(()=>[h(`div`,_e,[h(`div`,ve,s(t.$t(`createPage.title`)),1),h(`div`,ye,[h(`div`,be,[h(`span`,xe,[u(v,{name:`auto_awesome`,size:`14px`,color:`indigo-4`}),h(`span`,Se,s($e.value?.displayName??t.$t(`createPage.claudeCode`)),1)]),u(pe),u(b,{flat:``,dense:``,"no-caps":``,size:`sm`,color:M.value?`green-4`:`grey-5`,class:`notion-toggle-btn text-caption rounded-borders`,onClick:ut},{default:o(()=>[u(v,{name:`description`,size:`14px`,class:`q-mr-xs`}),d(` `+s(M.value?t.$t(`createPage.notionEnabled`):t.$t(`createPage.importNotion`)),1)]),_:1},8,[`color`]),u(b,{flat:``,dense:``,"no-caps":``,size:`sm`,color:X.value?`red-4`:`grey-5`,class:`sentry-toggle-btn text-caption rounded-borders q-ml-sm`,onClick:dt},{default:o(()=>[u(v,{name:`bug_report`,size:`14px`,class:`q-mr-xs`}),d(` `+s(X.value?t.$t(`createPage.sentryEnabled`):t.$t(`createPage.importSentry`)),1)]),_:1},8,[`color`])]),u(y,{color:`grey-9`}),u(ae,{name:`slide`},{default:o(()=>[M.value?(e(),p(`div`,Ce,[u(x,{modelValue:j.value,"onUpdate:modelValue":r[0]||=e=>j.value=e,borderless:``,dense:``,placeholder:t.$t(`createPage.notionPlaceholder`),class:`notion-url-input`,"input-class":`notion-url-input-inner`},{prepend:o(()=>[u(v,{name:`link`,size:`16px`,color:G.value?`green-4`:`grey-6`},null,8,[`color`])]),_:1},8,[`modelValue`,`placeholder`]),j.value.trim()&&!G.value?(e(),p(`div`,we,s(t.$t(`createPage.notionValidation`)),1)):l(``,!0),G.value?(e(),p(`div`,Te,s(t.$t(`createPage.notionAutoExtract`)),1)):l(``,!0)])):l(``,!0)]),_:1}),M.value?(e(),c(y,{key:0,color:`grey-9`})):l(``,!0),u(ae,{name:`slide`},{default:o(()=>[X.value?(e(),p(`div`,Ee,[u(x,{modelValue:Z.value,"onUpdate:modelValue":r[1]||=e=>Z.value=e,borderless:``,dense:``,placeholder:t.$t(`createPage.sentryPlaceholder`),class:`sentry-url-input`,"input-class":`sentry-url-input-inner`},{prepend:o(()=>[u(v,{name:`link`,size:`16px`,color:Q.value?`red-4`:`grey-6`},null,8,[`color`])]),_:1},8,[`modelValue`,`placeholder`]),Z.value.trim()&&!Q.value?(e(),p(`div`,De,s(t.$t(`createPage.sentryValidation`)),1)):l(``,!0),Q.value?(e(),p(`div`,Oe,s(t.$t(`createPage.sentryAutoExtract`)),1)):l(``,!0)])):l(``,!0)]),_:1}),X.value?(e(),c(y,{key:1,color:`grey-9`})):l(``,!0),h(`div`,ke,[u(x,{modelValue:k.value,"onUpdate:modelValue":r[2]||=e=>k.value=e,borderless:``,dense:``,placeholder:M.value&&G.value?t.$t(`createPage.workspaceName`):t.$t(`createPage.workspaceNamePlaceholder`),class:`name-input`,"input-class":`name-input-inner`},null,8,[`modelValue`,`placeholder`])]),u(y,{color:`grey-9`}),h(`div`,Ae,[u(x,{modelValue:A.value,"onUpdate:modelValue":r[3]||=e=>A.value=e,type:`textarea`,borderless:``,autogrow:``,rows:3,placeholder:M.value?t.$t(`createPage.instructions`):t.$t(`createPage.instructionsPlaceholder`),class:`create-textarea`,"input-class":`create-textarea-input`,onKeydown:[g(_(yt,[`ctrl`]),[`enter`]),g(_(yt,[`meta`]),[`enter`])]},null,8,[`modelValue`,`placeholder`,`onKeydown`])]),u(y,{color:`grey-9`}),at.value?(e(),p(m,{key:2},[h(`div`,je,s(t.$t(`createPage.manualHint`)),1),u(de,{dark:``,dense:``,label:t.$t(`createPage.tasks`,{count:K.value.length}),"header-class":`text-grey-4 manual-expansion-header`,class:`manual-expansion q-mx-sm`},{default:o(()=>[h(`div`,Me,[h(`div`,Ne,[u(x,{modelValue:J.value,"onUpdate:modelValue":r[4]||=e=>J.value=e,dark:``,dense:``,borderless:``,placeholder:t.$t(`createPage.addTask`),class:`col manual-input`,"input-class":`manual-input-inner`,onKeydown:g(_(ot,[`prevent`]),[`enter`])},null,8,[`modelValue`,`placeholder`,`onKeydown`]),u(b,{flat:``,dense:``,round:``,icon:`add`,color:`indigo-4`,disable:!J.value.trim(),onClick:ot},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.addTask`)),1)]),_:1})]),_:1},8,[`disable`])]),(e(!0),p(m,null,n(K.value,(n,r)=>(e(),p(`div`,{key:`task-${r}`,class:`row items-center q-py-xs manual-item`},[h(`span`,Pe,s(n),1),u(b,{flat:``,dense:``,round:``,icon:`close`,size:`xs`,color:`grey-6`,onClick:e=>st(r)},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.removeTask`)),1)]),_:1})]),_:1},8,[`onClick`])]))),128))])]),_:1},8,[`label`]),u(de,{dark:``,dense:``,label:t.$t(`createPage.acceptanceCriteria`,{count:q.value.length}),"header-class":`text-grey-4 manual-expansion-header`,class:`manual-expansion q-mx-sm q-mb-sm`},{default:o(()=>[h(`div`,Fe,[h(`div`,Ie,[u(x,{modelValue:Y.value,"onUpdate:modelValue":r[5]||=e=>Y.value=e,dark:``,dense:``,borderless:``,placeholder:t.$t(`createPage.addCriterion`),class:`col manual-input`,"input-class":`manual-input-inner`,onKeydown:g(_(ct,[`prevent`]),[`enter`])},null,8,[`modelValue`,`placeholder`,`onKeydown`]),u(b,{flat:``,dense:``,round:``,icon:`add`,color:`indigo-4`,disable:!Y.value.trim(),onClick:ct},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.addCriterion`)),1)]),_:1})]),_:1},8,[`disable`])]),(e(!0),p(m,null,n(q.value,(n,r)=>(e(),p(`div`,{key:`crit-${r}`,class:`row items-center q-py-xs manual-item`},[h(`span`,Le,s(n),1),u(b,{flat:``,dense:``,round:``,icon:`close`,size:`xs`,color:`grey-6`,onClick:e=>lt(r)},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.removeCriterion`)),1)]),_:1})]),_:1},8,[`onClick`])]))),128))])]),_:1},8,[`label`]),u(y,{color:`grey-9`})],64)):l(``,!0),h(`div`,Re,[h(`div`,ze,[et.value.length>0?(e(),c(E,{key:0,modelValue:z.value,"onUpdate:modelValue":r[6]||=e=>z.value=e,options:et.value,dense:``,borderless:``,class:`bottom-select rounded-borders`,"hide-dropdown-icon":``,"emit-value":``,"map-options":``,"option-value":`value`,"option-label":`label`},{selected:o(()=>[h(`span`,Be,[u(v,{name:`hub`,size:`12px`,color:`grey-5`,class:`q-mr-xs`}),d(` `+s(et.value.find(e=>e.value===z.value)?.label??z.value)+` `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`engine.select`)),1)]),_:1})]),_:1},8,[`modelValue`,`options`])):l(``,!0),u(E,{modelValue:N.value,"onUpdate:modelValue":r[7]||=e=>N.value=e,options:rt.value,dense:``,borderless:``,class:`bottom-select rounded-borders model-select`,"hide-dropdown-icon":``,"emit-value":``,"map-options":``,"option-value":`value`,"option-label":`label`},{selected:o(()=>[h(`span`,Ve,[d(s(rt.value.find(e=>e.value===N.value)?.label??N.value)+` `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),option:o(({opt:e,itemProps:t})=>[u(S,ee(t,{class:`model-option`}),{default:o(()=>[u(C,null,{default:o(()=>[u(w,{class:`text-white`},{default:o(()=>[d(s(e.label),1)]),_:2},1024),u(w,{caption:``,class:`text-grey-5`},{default:o(()=>[d(s(e.description),1)]),_:2},1024)]),_:2},1024)]),_:2},1040)]),_:1},8,[`modelValue`,`options`]),u(E,{modelValue:P.value,"onUpdate:modelValue":r[8]||=e=>P.value=e,options:it.value,dense:``,borderless:``,class:`bottom-select rounded-borders`,"hide-dropdown-icon":``,"emit-value":``,"map-options":``,"option-value":`value`,"option-label":`label`},{selected:o(()=>[h(`span`,He,[u(v,{name:`psychology`,size:`12px`,color:`grey-5`,class:`q-mr-xs`}),d(` `+s(it.value.find(e=>e.value===P.value)?.label??P.value)+` `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),option:o(({opt:e,itemProps:t})=>[u(S,re(ie(t)),{default:o(()=>[u(C,null,{default:o(()=>[u(w,{class:`text-white`},{default:o(()=>[d(s(e.label),1)]),_:2},1024),u(w,{caption:``,class:`text-grey-5`},{default:o(()=>[d(s(e.description),1)]),_:2},1024)]),_:2},1024)]),_:2},1040)]),_:1},8,[`modelValue`,`options`]),u(E,{modelValue:B.value,"onUpdate:modelValue":r[9]||=e=>B.value=e,options:tt.value,dense:``,borderless:``,class:`bottom-select rounded-borders`,"hide-dropdown-icon":``,"emit-value":``,"map-options":``,"option-value":`value`,"option-label":`label`},{selected:o(()=>[h(`span`,Ue,[u(v,{name:B.value===`plan`?`visibility`:`flash_on`,size:`12px`,color:`amber-6`,class:`q-mr-xs`},null,8,[`name`]),d(` `+s(tt.value.find(e=>e.value===B.value)?.label??B.value)+` `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`engine.permission`)),1)]),_:1})]),_:1},8,[`modelValue`,`options`]),u(pe),u(b,{flat:``,dense:``,size:`sm`,"no-caps":``,icon:R.value?`play_disabled`:`play_circle`,color:R.value?`orange-4`:`grey-5`,label:t.$t(`createPage.skipSetupScript`),class:`skip-setup-btn`,onClick:r[10]||=e=>R.value=!R.value},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`createPage.skipSetupScript`)),1)]),_:1})]),_:1},8,[`icon`,`color`,`label`])]),h(`div`,We,[u(E,{modelValue:F.value,"onUpdate:modelValue":r[11]||=e=>F.value=e,options:Ze.value,dense:``,borderless:``,"use-input":``,"fill-input":``,"hide-selected":``,"input-debounce":`0`,"new-value-mode":`add`,class:`bottom-select rounded-borders repo-select`,"hide-dropdown-icon":``,"input-class":F.value?``:`repo-input-empty`,placeholder:t.$t(`createPage.projectPath`),behavior:te(D).projectPaths.length>0?`menu`:`dialog`,onFilter:mt,onInputValue:r[12]||=e=>{F.value=e}},{prepend:o(()=>[u(v,{name:`folder`,size:`14px`,color:`grey-5`})]),"no-option":o(()=>[u(S,null,{default:o(()=>[u(C,{class:`text-grey-6 text-caption`},{default:o(()=>[d(s(t.$t(`createPage.enterPath`)),1)]),_:1})]),_:1})]),_:1},8,[`modelValue`,`options`,`input-class`,`placeholder`,`behavior`]),u(E,{modelValue:L.value,"onUpdate:modelValue":r[13]||=e=>L.value=e,options:nt,"emit-value":``,"map-options":``,dense:``,borderless:``,class:`bottom-select rounded-borders branch-type-select`,"hide-dropdown-icon":``},{selected:o(()=>[h(`span`,Ge,[u(v,{name:`account_tree`,size:`12px`,color:`grey-5`,class:`q-mr-xs`}),d(` `+s(L.value)+`/ `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`createPage.branchType`)),1)]),_:1})]),_:1},8,[`modelValue`]),u(E,{modelValue:I.value,"onUpdate:modelValue":r[14]||=e=>I.value=e,options:V.value,dense:``,borderless:``,class:`bottom-select rounded-borders branch-select`,"hide-dropdown-icon":``,loading:H.value,disable:!F.value.trim()||H.value},{selected:o(()=>[h(`span`,Ke,[u(v,{name:`call_split`,size:`12px`,color:`grey-5`,class:`q-mr-xs`}),d(` `+s(I.value??t.$t(`createPage.branch`))+` `,1),u(v,{name:`expand_more`,size:`12px`,color:`grey-5`})])]),"no-option":o(()=>[u(S,null,{default:o(()=>[u(C,{class:`text-grey-6 text-caption`},{default:o(()=>[d(s(F.value.trim()?t.$t(`createPage.noBranches`):t.$t(`createPage.enterPath`)),1)]),_:1})]),_:1})]),_:1},8,[`modelValue`,`options`,`loading`,`disable`])])]),h(`div`,qe,[u(b,{label:t.$t(`createPage.create`),"no-caps":``,unelevated:``,class:`create-btn text-weight-bold rounded-borders`,loading:U.value,onClick:yt},null,8,[`label`,`loading`])])]),h(`div`,Je,s(M.value?t.$t(`createPage.notionExtractHint`):t.$t(`createPage.notionImportHint`)),1)])]),_:1}))}}),[[`__scopeId`,`data-v-4f4da343`]]);export{Ye as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-
|
|
2
|
-
import{F as e,H as t,M as n,N as r,Q as i,S as a,U as o,bt as s,d as c,f as l,g as u,h as d,l as f,p,r as m,rt as ee,u as h,v as g,yt as _}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{O as v,a as y,t as b}from"./QIcon-B0-pH3Qs.js";import{t as te}from"./QSeparator-DNSiXYrN.js";import{n as ne,t as x}from"./QBtn-CyzfM9-_.js";import{n as re}from"./vue-i18n-eUDnMrPl.js";import{r as S,t as C}from"./private.use-form-C5G_3nU5.js";import{f as ie}from"./index-Y9eYNsHp.js";import{t as w}from"./QSpinnerDots-By20ptst.js";import{t as ae}from"./QScrollArea-CBW6shMb.js";import{t as T}from"./QTooltip-DbEBexRN.js";import{t as E}from"./_plugin-vue_export-helper-Cj6tcsj6.js";import{t as D}from"./QBadge-Di02fu2H.js";import{t as oe}from"./QSpace-0zdF1m5x.js";import{i as O,n as se,r as ce,t as le}from"./build-path-tree-TBMtG2me.js";var k=v({name:`QBtnToggle`,props:{...S,modelValue:{required:!0},options:{type:Array,required:!0,validator:e=>e.every(e=>(`label`in e||`icon`in e||`slot`in e)&&`value`in e)},color:String,textColor:String,toggleColor:{type:String,default:`primary`},toggleTextColor:String,outline:Boolean,flat:Boolean,unelevated:Boolean,rounded:Boolean,push:Boolean,glossy:Boolean,size:String,padding:String,noCaps:Boolean,noWrap:Boolean,dense:Boolean,readonly:Boolean,disable:Boolean,stack:Boolean,stretch:Boolean,spread:Boolean,clearable:Boolean,ripple:{type:[Boolean,Object],default:!0}},emits:[`update:modelValue`,`clear`,`click`],setup(e,{slots:t,emit:n}){let r=f(()=>e.options.find(t=>t.value===e.modelValue)!==void 0),i=C(f(()=>({type:`hidden`,name:e.name,value:e.modelValue}))),o=f(()=>ne(e)),s=f(()=>({rounded:e.rounded,dense:e.dense,...o.value})),c=f(()=>e.options.map((t,n)=>{let{attrs:r,value:i,slot:a,...o}=t;return{slot:a,props:{key:n,"aria-pressed":i===e.modelValue?`true`:`false`,...r,...o,...s.value,disable:e.disable===!0||o.disable===!0,color:i===e.modelValue?u(o,`toggleColor`):u(o,`color`),textColor:i===e.modelValue?u(o,`toggleTextColor`):u(o,`textColor`),noCaps:u(o,`noCaps`)===!0,noWrap:u(o,`noWrap`)===!0,size:u(o,`size`),padding:u(o,`padding`),ripple:u(o,`ripple`),stack:u(o,`stack`)===!0,stretch:u(o,`stretch`)===!0,onClick(e){l(i,t,e)}}}}));function l(t,r,i){e.readonly!==!0&&(e.modelValue===t?e.clearable===!0&&(n(`update:modelValue`,null,null),n(`clear`)):n(`update:modelValue`,t,r),n(`click`,i))}function u(t,n){return t[n]===void 0?e[n]:t[n]}function d(){let n=c.value.map(e=>a(x,e.props,e.slot===void 0?void 0:t[e.slot]));return e.name!==void 0&&e.disable!==!0&&r.value===!0&&i(n,`push`),y(t.default,n)}return()=>a(O,{class:`q-btn-toggle`,...o.value,rounded:e.rounded,stretch:e.stretch,glossy:e.glossy,spread:e.spread},d)}}),ue={class:`diff-viewer column full-height`},de={class:`diff-header row items-center q-px-md q-py-sm no-wrap`},fe={class:`text-body1 text-weight-medium text-grey-3`},pe={key:0,class:`text-caption text-grey-6 q-ml-md`,style:{"font-size":`11px`}},me={class:`text-grey-7`},he={class:`text-green-4`},A={class:`text-grey-7`},j={key:1,class:`text-caption text-grey-5 q-ml-md ellipsis`,style:{"font-size":`11px`,"font-family":`'Roboto Mono', monospace`,"max-width":`400px`}},M={class:`row col no-wrap`,style:{"min-height":`0`}},N={key:1,class:`text-caption text-grey-8 q-pa-sm`},P={class:`text-grey-4`,style:{"font-family":`'Roboto Mono', monospace`,"font-size":`11px`}},F={class:`text-grey-3 ellipsis`,style:{"font-family":`'Roboto Mono', monospace`,"font-size":`11px`}},I={class:`col column`,style:{"min-width":`0`,position:`relative`}},L={key:0,class:`col column items-center justify-center`},ge={key:1,class:`col column items-center justify-center text-grey-8 text-caption`},R=`kobo:diffViewerFileListWidth`,z=180,B=600,V=E(g({__name:`DiffViewer`,props:{workspaceId:{}},emits:[`close`,`sendToChat`],setup(a,{emit:g}){let v=a,y=g,{t:ne}=re(),S=i([]),C=i(``),E=i(``),O=i(null),V=i(!1),H=i(!1),U=i(null),W=i(`side`),G=i(`branch`),_e=parseInt(localStorage.getItem(R)??`280`,10),K=i(Math.min(B,Math.max(z,_e)));function ve(e){e.preventDefault();let t=e.target.closest(`.diff-viewer`);if(!t)return;let n=t.getBoundingClientRect().left,r=e=>{K.value=Math.min(B,Math.max(z,e.clientX-n))},i=()=>{localStorage.setItem(R,String(K.value)),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}let q=null,J=null,Y=[],ye=f(()=>le(S.value)),X=f(()=>O.value?`file:${O.value}`:``);async function Z(){V.value=!0;try{let e=await fetch(`/api/workspaces/${v.workspaceId}/diff?mode=${G.value}`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();S.value=t.files,C.value=t.sourceBranch??``,E.value=t.workingBranch??``}catch(e){console.error(`Failed to load diff files:`,e)}finally{V.value=!1}}async function Q(e){if(U.value){H.value=!0;try{q||(self.MonacoEnvironment={getWorker(e,t){return t===`json`?new Worker(new URL(`/assets/json.worker-C9p7xCYk.js`,``+import.meta.url),{type:`module`}):t===`css`||t===`scss`||t===`less`?new Worker(new URL(`/assets/css.worker-D1piIYC4.js`,``+import.meta.url),{type:`module`}):t===`html`||t===`handlebars`||t===`razor`?new Worker(new URL(`/assets/html.worker-C4q4XMPn.js`,``+import.meta.url),{type:`module`}):t===`typescript`||t===`javascript`?new Worker(new URL(`/assets/ts.worker-Cj3zTgVE.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/editor.worker-CJ9iTmkr.js`,``+import.meta.url),{type:`module`})}},q=await ie(()=>import(`./editor.main-DPd-buqm.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])),q.editor.defineTheme(`kobo-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#1a1a2e`,"diffEditor.insertedTextBackground":`#22c55e20`,"diffEditor.removedTextBackground":`#ef444420`}}));let t=await fetch(`/api/workspaces/${v.workspaceId}/diff-file?path=${encodeURIComponent(e)}&mode=${G.value}`,{cache:`no-store`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json(),r={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,sql:`sql`,py:`python`,rs:`rust`,go:`go`}[e.split(`.`).pop()??``]??`plaintext`;if(J){for(let e of Y)e.dispose();Y=[];let e=J.getModel();J.dispose(),J=null,e?.original?.dispose(),e?.modified?.dispose()}let i=q.editor.createModel(n.original??``,r),a=q.editor.createModel(n.modified??``,r);J=q.editor.createDiffEditor(U.value,{theme:`kobo-dark`,readOnly:!0,renderSideBySide:W.value===`side`,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineHeight:18}),J.setModel({original:i,modified:a}),be()}catch(e){console.error(`Failed to load file diff:`,e)}finally{H.value=!1}}}let $=i(!1);function be(){if(!J)return;for(let e of Y)e.dispose();Y=[];let e=J.getModifiedEditor(),t=J.getOriginalEditor();for(let n of[e,t]){let e=n.onDidChangeCursorSelection(()=>{let e=n.getSelection();$.value=!!(e&&!e.isEmpty())});Y.push(e)}}function xe(){if(!(!J||!O.value))for(let e of[J.getModifiedEditor(),J.getOriginalEditor()]){let t=e.getSelection();if(t&&!t.isEmpty()){let n=e.getModel();if(!n)continue;let r=n.getValueInRange(t),i=e===J.getModifiedEditor()?`modified`:`original`;y(`sendToChat`,`\`\`\`\n// ${O.value} (${i}) L${t.startLineNumber}-L${t.endLineNumber}\n${r}\n\`\`\``);return}}}t(O,e=>{e&&Q(e)}),t(W,()=>{J&&J.updateOptions({renderSideBySide:W.value===`side`})}),t(G,async()=>{let e=O.value;await Z(),e&&S.value.some(t=>t.path===e)?Q(e):O.value=null});function Se(e){switch(e){case`added`:return`#4ade80`;case`deleted`:return`#f87171`;case`renamed`:return`#60a5fa`;default:return`#f59e0b`}}return n(Z),r(()=>{for(let e of Y)e.dispose();if(Y=[],J){let e=J.getModel();J.dispose(),J=null,e?.original?.dispose(),e?.modified?.dispose()}}),(t,n)=>(e(),p(`div`,ue,[h(`div`,de,[u(b,{name:`difference`,size:`18px`,color:`indigo-4`,class:`q-mr-xs`}),h(`span`,fe,s(t.$t(`diff.title`)),1),u(D,{label:`${S.value.length}`,color:`grey-8`,"text-color":`grey-4`,class:`q-ml-sm`,style:{"font-size":`10px`}},null,8,[`label`]),C.value?(e(),p(`span`,pe,[G.value===`branch`?(e(),p(m,{key:0},[h(`span`,me,s(C.value),1),u(b,{name:`arrow_forward`,size:`11px`,color:`grey-8`,class:`q-mx-xs`}),h(`span`,he,s(E.value),1)],64)):(e(),p(m,{key:1},[h(`span`,A,`origin/`+s(E.value),1),u(b,{name:`arrow_forward`,size:`11px`,color:`grey-8`,class:`q-mx-xs`}),n[4]||=h(`span`,{class:`text-green-4`},`HEAD`,-1)],64))])):l(``,!0),O.value?(e(),p(`span`,j,s(O.value),1)):l(``,!0),u(oe),u(k,{modelValue:G.value,"onUpdate:modelValue":n[0]||=e=>G.value=e,dense:``,"no-caps":``,size:`sm`,"toggle-color":`indigo-8`,color:`grey-9`,"text-color":`grey-5`,options:[{label:t.$t(`diff.scopeBranch`),value:`branch`},{label:t.$t(`diff.scopeUnpushed`),value:`unpushed`}],class:`q-mr-sm`},null,8,[`modelValue`,`options`]),u(k,{modelValue:W.value,"onUpdate:modelValue":n[1]||=e=>W.value=e,dense:``,"no-caps":``,size:`sm`,"toggle-color":`indigo-8`,color:`grey-9`,"text-color":`grey-5`,options:[{label:t.$t(`diff.side`),value:`side`},{label:t.$t(`diff.inline`),value:`inline`}],class:`q-mr-sm`},null,8,[`modelValue`,`options`]),u(x,{flat:``,round:``,dense:``,icon:`close`,color:`grey-5`,size:`sm`,onClick:n[2]||=e=>y(`close`)},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.closeDiffViewer`)),1)]),_:1})]),_:1})]),u(te,{dark:``}),h(`div`,M,[h(`div`,{class:`diff-file-list-wrapper`,style:_({width:`${K.value}px`,minWidth:`${z}px`})},[u(ae,{class:`diff-file-list q-pa-xs`,style:{width:`100%`,height:`100%`,"border-right":`1px solid #2a2a4a`}},{default:o(()=>[V.value?(e(),c(w,{key:0,size:`24px`,color:`grey-6`,class:`q-ma-md`})):S.value.length===0?(e(),p(`div`,N,s(t.$t(`diff.noChanges`)),1)):(e(),c(ce,{key:2,nodes:ye.value,"node-key":`nodeKey`,"label-key":`label`,"children-key":`children`,dark:``,dense:``,"default-expand-all":``,"no-selection-unset":``,selected:X.value,class:`diff-tree`,"onUpdate:selected":n[3]||=e=>{typeof e!=`string`||!e.startsWith(`file:`)||(O.value=e.slice(5))}},{"default-header":o(({node:t})=>[t.isFolder?(e(),p(m,{key:0},[u(b,{name:`folder`,size:`14px`,color:`indigo-4`,class:`q-mr-xs`}),h(`span`,P,s(t.label),1),u(D,{label:t.children?ee(se)(t.children):0,color:`grey-9`,"text-color":`grey-5`,class:`q-ml-xs`,style:{"font-size":`9px`}},null,8,[`label`])],64)):(e(),p(m,{key:1},[u(b,{name:`description`,size:`14px`,style:_({color:Se(t.file.status)}),class:`q-mr-xs`},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.file.status),1)]),_:2},1024)]),_:2},1032,[`style`]),h(`span`,F,s(t.label),1)],64))]),_:1},8,[`nodes`,`selected`]))]),_:1}),h(`div`,{class:`diff-file-list-resize-handle`,onMousedown:ve},null,32)],4),h(`div`,I,[H.value?(e(),p(`div`,L,[u(w,{size:`32px`,color:`indigo-4`})])):O.value?l(``,!0):(e(),p(`div`,ge,s(t.$t(`diff.selectFile`)),1)),h(`div`,{ref_key:`editorContainer`,ref:U,class:`col`,style:{"min-height":`0`}},null,512),$.value?(e(),c(x,{key:2,"no-caps":``,dense:``,size:`sm`,color:`primary`,icon:`chat`,label:t.$t(`diff.addToChat`),class:`send-to-chat-btn`,onClick:xe},null,8,[`label`])):l(``,!0)])])]))}}),[[`__scopeId`,`data-v-23217be2`]]);export{V as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-BNIb69JB.js","assets/index-B0Jj-w-E.js","assets/vue-i18n-eUDnMrPl.js","assets/runtime-core.esm-bundler-C3IgBgY5.js","assets/QIcon-B0-pH3Qs.js","assets/use-id-BmXMngYX.js","assets/QSeparator-DNSiXYrN.js","assets/QBtn-CyzfM9-_.js","assets/use-checkbox-BduGd8xg.js","assets/private.use-form-C5G_3nU5.js","assets/QDialog-G448EJG4.js","assets/scroll-C-Vz5BD9.js","assets/symbols-DCYodwb2.js","assets/index-eX_lKHSg.css","assets/editor.api--wqcZBpd.js","assets/editor-COGk2gAX.css","assets/monaco.contribution-Ci35AF1I.js","assets/editor-CS3NEPi9.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{F as e,H as t,M as n,N as r,Q as i,S as a,U as o,bt as s,d as c,f as l,g as u,h as d,l as f,p,r as m,rt as ee,u as h,v as g,yt as _}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{O as v,a as y,t as b}from"./QIcon-B0-pH3Qs.js";import{t as te}from"./QSeparator-DNSiXYrN.js";import{n as ne,t as x}from"./QBtn-CyzfM9-_.js";import{n as re}from"./vue-i18n-eUDnMrPl.js";import{r as S,t as C}from"./private.use-form-C5G_3nU5.js";import{f as ie}from"./index-B0Jj-w-E.js";import{t as w}from"./QSpinnerDots-By20ptst.js";import{t as ae}from"./QScrollArea-CBW6shMb.js";import{t as T}from"./QTooltip-DbEBexRN.js";import{t as E}from"./_plugin-vue_export-helper-Cj6tcsj6.js";import{t as D}from"./QBadge-Di02fu2H.js";import{t as oe}from"./QSpace-0zdF1m5x.js";import{i as O,n as se,r as ce,t as le}from"./build-path-tree-DBKR9p4C.js";var k=v({name:`QBtnToggle`,props:{...S,modelValue:{required:!0},options:{type:Array,required:!0,validator:e=>e.every(e=>(`label`in e||`icon`in e||`slot`in e)&&`value`in e)},color:String,textColor:String,toggleColor:{type:String,default:`primary`},toggleTextColor:String,outline:Boolean,flat:Boolean,unelevated:Boolean,rounded:Boolean,push:Boolean,glossy:Boolean,size:String,padding:String,noCaps:Boolean,noWrap:Boolean,dense:Boolean,readonly:Boolean,disable:Boolean,stack:Boolean,stretch:Boolean,spread:Boolean,clearable:Boolean,ripple:{type:[Boolean,Object],default:!0}},emits:[`update:modelValue`,`clear`,`click`],setup(e,{slots:t,emit:n}){let r=f(()=>e.options.find(t=>t.value===e.modelValue)!==void 0),i=C(f(()=>({type:`hidden`,name:e.name,value:e.modelValue}))),o=f(()=>ne(e)),s=f(()=>({rounded:e.rounded,dense:e.dense,...o.value})),c=f(()=>e.options.map((t,n)=>{let{attrs:r,value:i,slot:a,...o}=t;return{slot:a,props:{key:n,"aria-pressed":i===e.modelValue?`true`:`false`,...r,...o,...s.value,disable:e.disable===!0||o.disable===!0,color:i===e.modelValue?u(o,`toggleColor`):u(o,`color`),textColor:i===e.modelValue?u(o,`toggleTextColor`):u(o,`textColor`),noCaps:u(o,`noCaps`)===!0,noWrap:u(o,`noWrap`)===!0,size:u(o,`size`),padding:u(o,`padding`),ripple:u(o,`ripple`),stack:u(o,`stack`)===!0,stretch:u(o,`stretch`)===!0,onClick(e){l(i,t,e)}}}}));function l(t,r,i){e.readonly!==!0&&(e.modelValue===t?e.clearable===!0&&(n(`update:modelValue`,null,null),n(`clear`)):n(`update:modelValue`,t,r),n(`click`,i))}function u(t,n){return t[n]===void 0?e[n]:t[n]}function d(){let n=c.value.map(e=>a(x,e.props,e.slot===void 0?void 0:t[e.slot]));return e.name!==void 0&&e.disable!==!0&&r.value===!0&&i(n,`push`),y(t.default,n)}return()=>a(O,{class:`q-btn-toggle`,...o.value,rounded:e.rounded,stretch:e.stretch,glossy:e.glossy,spread:e.spread},d)}}),ue={class:`diff-viewer column full-height`},de={class:`diff-header row items-center q-px-md q-py-sm no-wrap`},fe={class:`text-body1 text-weight-medium text-grey-3`},pe={key:0,class:`text-caption text-grey-6 q-ml-md`,style:{"font-size":`11px`}},me={class:`text-grey-7`},he={class:`text-green-4`},A={class:`text-grey-7`},j={key:1,class:`text-caption text-grey-5 q-ml-md ellipsis`,style:{"font-size":`11px`,"font-family":`'Roboto Mono', monospace`,"max-width":`400px`}},M={class:`row col no-wrap`,style:{"min-height":`0`}},N={key:1,class:`text-caption text-grey-8 q-pa-sm`},P={class:`text-grey-4`,style:{"font-family":`'Roboto Mono', monospace`,"font-size":`11px`}},F={class:`text-grey-3 ellipsis`,style:{"font-family":`'Roboto Mono', monospace`,"font-size":`11px`}},I={class:`col column`,style:{"min-width":`0`,position:`relative`}},L={key:0,class:`col column items-center justify-center`},ge={key:1,class:`col column items-center justify-center text-grey-8 text-caption`},R=`kobo:diffViewerFileListWidth`,z=180,B=600,V=E(g({__name:`DiffViewer`,props:{workspaceId:{}},emits:[`close`,`sendToChat`],setup(a,{emit:g}){let v=a,y=g,{t:ne}=re(),S=i([]),C=i(``),E=i(``),O=i(null),V=i(!1),H=i(!1),U=i(null),W=i(`side`),G=i(`branch`),_e=parseInt(localStorage.getItem(R)??`280`,10),K=i(Math.min(B,Math.max(z,_e)));function ve(e){e.preventDefault();let t=e.target.closest(`.diff-viewer`);if(!t)return;let n=t.getBoundingClientRect().left,r=e=>{K.value=Math.min(B,Math.max(z,e.clientX-n))},i=()=>{localStorage.setItem(R,String(K.value)),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}let q=null,J=null,Y=[],ye=f(()=>le(S.value)),X=f(()=>O.value?`file:${O.value}`:``);async function Z(){V.value=!0;try{let e=await fetch(`/api/workspaces/${v.workspaceId}/diff?mode=${G.value}`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();S.value=t.files,C.value=t.sourceBranch??``,E.value=t.workingBranch??``}catch(e){console.error(`Failed to load diff files:`,e)}finally{V.value=!1}}async function Q(e){if(U.value){H.value=!0;try{q||(self.MonacoEnvironment={getWorker(e,t){return t===`json`?new Worker(new URL(`/assets/json.worker-C9p7xCYk.js`,``+import.meta.url),{type:`module`}):t===`css`||t===`scss`||t===`less`?new Worker(new URL(`/assets/css.worker-D1piIYC4.js`,``+import.meta.url),{type:`module`}):t===`html`||t===`handlebars`||t===`razor`?new Worker(new URL(`/assets/html.worker-C4q4XMPn.js`,``+import.meta.url),{type:`module`}):t===`typescript`||t===`javascript`?new Worker(new URL(`/assets/ts.worker-Cj3zTgVE.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/editor.worker-CJ9iTmkr.js`,``+import.meta.url),{type:`module`})}},q=await ie(()=>import(`./editor.main-BNIb69JB.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])),q.editor.defineTheme(`kobo-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#1a1a2e`,"diffEditor.insertedTextBackground":`#22c55e20`,"diffEditor.removedTextBackground":`#ef444420`}}));let t=await fetch(`/api/workspaces/${v.workspaceId}/diff-file?path=${encodeURIComponent(e)}&mode=${G.value}`,{cache:`no-store`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json(),r={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,sql:`sql`,py:`python`,rs:`rust`,go:`go`}[e.split(`.`).pop()??``]??`plaintext`;if(J){for(let e of Y)e.dispose();Y=[];let e=J.getModel();J.dispose(),J=null,e?.original?.dispose(),e?.modified?.dispose()}let i=q.editor.createModel(n.original??``,r),a=q.editor.createModel(n.modified??``,r);J=q.editor.createDiffEditor(U.value,{theme:`kobo-dark`,readOnly:!0,renderSideBySide:W.value===`side`,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineHeight:18}),J.setModel({original:i,modified:a}),be()}catch(e){console.error(`Failed to load file diff:`,e)}finally{H.value=!1}}}let $=i(!1);function be(){if(!J)return;for(let e of Y)e.dispose();Y=[];let e=J.getModifiedEditor(),t=J.getOriginalEditor();for(let n of[e,t]){let e=n.onDidChangeCursorSelection(()=>{let e=n.getSelection();$.value=!!(e&&!e.isEmpty())});Y.push(e)}}function xe(){if(!(!J||!O.value))for(let e of[J.getModifiedEditor(),J.getOriginalEditor()]){let t=e.getSelection();if(t&&!t.isEmpty()){let n=e.getModel();if(!n)continue;let r=n.getValueInRange(t),i=e===J.getModifiedEditor()?`modified`:`original`;y(`sendToChat`,`\`\`\`\n// ${O.value} (${i}) L${t.startLineNumber}-L${t.endLineNumber}\n${r}\n\`\`\``);return}}}t(O,e=>{e&&Q(e)}),t(W,()=>{J&&J.updateOptions({renderSideBySide:W.value===`side`})}),t(G,async()=>{let e=O.value;await Z(),e&&S.value.some(t=>t.path===e)?Q(e):O.value=null});function Se(e){switch(e){case`added`:return`#4ade80`;case`deleted`:return`#f87171`;case`renamed`:return`#60a5fa`;default:return`#f59e0b`}}return n(Z),r(()=>{for(let e of Y)e.dispose();if(Y=[],J){let e=J.getModel();J.dispose(),J=null,e?.original?.dispose(),e?.modified?.dispose()}}),(t,n)=>(e(),p(`div`,ue,[h(`div`,de,[u(b,{name:`difference`,size:`18px`,color:`indigo-4`,class:`q-mr-xs`}),h(`span`,fe,s(t.$t(`diff.title`)),1),u(D,{label:`${S.value.length}`,color:`grey-8`,"text-color":`grey-4`,class:`q-ml-sm`,style:{"font-size":`10px`}},null,8,[`label`]),C.value?(e(),p(`span`,pe,[G.value===`branch`?(e(),p(m,{key:0},[h(`span`,me,s(C.value),1),u(b,{name:`arrow_forward`,size:`11px`,color:`grey-8`,class:`q-mx-xs`}),h(`span`,he,s(E.value),1)],64)):(e(),p(m,{key:1},[h(`span`,A,`origin/`+s(E.value),1),u(b,{name:`arrow_forward`,size:`11px`,color:`grey-8`,class:`q-mx-xs`}),n[4]||=h(`span`,{class:`text-green-4`},`HEAD`,-1)],64))])):l(``,!0),O.value?(e(),p(`span`,j,s(O.value),1)):l(``,!0),u(oe),u(k,{modelValue:G.value,"onUpdate:modelValue":n[0]||=e=>G.value=e,dense:``,"no-caps":``,size:`sm`,"toggle-color":`indigo-8`,color:`grey-9`,"text-color":`grey-5`,options:[{label:t.$t(`diff.scopeBranch`),value:`branch`},{label:t.$t(`diff.scopeUnpushed`),value:`unpushed`}],class:`q-mr-sm`},null,8,[`modelValue`,`options`]),u(k,{modelValue:W.value,"onUpdate:modelValue":n[1]||=e=>W.value=e,dense:``,"no-caps":``,size:`sm`,"toggle-color":`indigo-8`,color:`grey-9`,"text-color":`grey-5`,options:[{label:t.$t(`diff.side`),value:`side`},{label:t.$t(`diff.inline`),value:`inline`}],class:`q-mr-sm`},null,8,[`modelValue`,`options`]),u(x,{flat:``,round:``,dense:``,icon:`close`,color:`grey-5`,size:`sm`,onClick:n[2]||=e=>y(`close`)},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.$t(`tooltip.closeDiffViewer`)),1)]),_:1})]),_:1})]),u(te,{dark:``}),h(`div`,M,[h(`div`,{class:`diff-file-list-wrapper`,style:_({width:`${K.value}px`,minWidth:`${z}px`})},[u(ae,{class:`diff-file-list q-pa-xs`,style:{width:`100%`,height:`100%`,"border-right":`1px solid #2a2a4a`}},{default:o(()=>[V.value?(e(),c(w,{key:0,size:`24px`,color:`grey-6`,class:`q-ma-md`})):S.value.length===0?(e(),p(`div`,N,s(t.$t(`diff.noChanges`)),1)):(e(),c(ce,{key:2,nodes:ye.value,"node-key":`nodeKey`,"label-key":`label`,"children-key":`children`,dark:``,dense:``,"default-expand-all":``,"no-selection-unset":``,selected:X.value,class:`diff-tree`,"onUpdate:selected":n[3]||=e=>{typeof e!=`string`||!e.startsWith(`file:`)||(O.value=e.slice(5))}},{"default-header":o(({node:t})=>[t.isFolder?(e(),p(m,{key:0},[u(b,{name:`folder`,size:`14px`,color:`indigo-4`,class:`q-mr-xs`}),h(`span`,P,s(t.label),1),u(D,{label:t.children?ee(se)(t.children):0,color:`grey-9`,"text-color":`grey-5`,class:`q-ml-xs`,style:{"font-size":`9px`}},null,8,[`label`])],64)):(e(),p(m,{key:1},[u(b,{name:`description`,size:`14px`,style:_({color:Se(t.file.status)}),class:`q-mr-xs`},{default:o(()=>[u(T,null,{default:o(()=>[d(s(t.file.status),1)]),_:2},1024)]),_:2},1032,[`style`]),h(`span`,F,s(t.label),1)],64))]),_:1},8,[`nodes`,`selected`]))]),_:1}),h(`div`,{class:`diff-file-list-resize-handle`,onMousedown:ve},null,32)],4),h(`div`,I,[H.value?(e(),p(`div`,L,[u(w,{size:`32px`,color:`indigo-4`})])):O.value?l(``,!0):(e(),p(`div`,ge,s(t.$t(`diff.selectFile`)),1)),h(`div`,{ref_key:`editorContainer`,ref:U,class:`col`,style:{"min-height":`0`}},null,512),$.value?(e(),c(x,{key:2,"no-caps":``,dense:``,size:`sm`,color:`primary`,icon:`chat`,label:t.$t(`diff.addToChat`),class:`send-to-chat-btn`,onClick:xe},null,8,[`label`])):l(``,!0)])])]))}}),[[`__scopeId`,`data-v-23217be2`]]);export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,L as t,M as n,Q as r,U as i,_t as ee,bt as a,d as o,f as s,g as c,l,p as u,r as te,rt as d,u as f,v as ne}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{t as p}from"./QIcon-B0-pH3Qs.js";import{t as m}from"./QBtn-CyzfM9-_.js";import{D as h,T as g,m as re}from"./index-
|
|
1
|
+
import{F as e,L as t,M as n,Q as r,U as i,_t as ee,bt as a,d as o,f as s,g as c,l,p as u,r as te,rt as d,u as f,v as ne}from"./runtime-core.esm-bundler-C3IgBgY5.js";import{t as p}from"./QIcon-B0-pH3Qs.js";import{t as m}from"./QBtn-CyzfM9-_.js";import{D as h,T as g,m as re}from"./index-B0Jj-w-E.js";import{n as ie,t as ae}from"./QItemSection-BzWLL-V-.js";import{t as _}from"./QSpace-0zdF1m5x.js";import{t as oe}from"./use-quasar-BBrzedjR.js";import{t as v}from"./QList-D2GuTeLl.js";import{t as y}from"./QPage-BTzNQlb1.js";var b={class:`row items-center q-mb-md`},x={class:`text-h6 q-ml-sm`},S={key:0,class:`text-grey-6 text-center q-pa-lg`},C={key:1,class:`column q-gutter-md`},w={class:`text-subtitle2 q-mb-sm`},T={class:`text-caption text-grey-6`},E={class:`text-body2`},D={class:`row items-center`},O={class:`text-subtitle2`},k={class:`row q-col-gutter-md q-mt-xs`},A={class:`col`},j={class:`text-caption text-grey-6`},M={class:`text-body2`},N={class:`col-auto`},P={class:`text-caption text-grey-6`},F={class:`text-body2`},I={class:`col-auto`},L={class:`text-caption text-grey-6`},R={class:`text-body2`},z={class:`row items-center`},B={class:`text-subtitle2`},V={key:0,class:`text-caption text-grey-5 q-mt-xs`},se={key:1,class:`text-caption text-negative q-mt-xs`},H={class:`row items-center`},U={class:`text-subtitle2`},W={class:`text-caption text-grey-6 q-mt-xs`},G={key:0,class:`q-mt-sm`},K={class:`text-caption text-negative q-mb-xs`},ce={class:`text-body2`},le={class:`text-caption text-grey-6`},ue={class:`row items-center`},de={class:`text-subtitle2`},fe={class:`text-subtitle2 q-mb-sm`},pe={class:`column q-gutter-xs`},me={class:`row items-center`},he={class:`q-ml-sm text-caption text-grey-6`},ge={class:`row items-center`},_e={class:`q-ml-sm text-caption text-grey-6`},ve={class:`row items-center`},ye={class:`q-ml-sm text-caption text-grey-6`},q=ne({__name:`HealthPage`,setup(ne){let q=oe(),be=re(),J=r(null),Y=r(!1);async function X(){Y.value=!0;try{let e=await fetch(`/api/health/report`);if(!e.ok)throw Error(`HTTP ${e.status}`);J.value=await e.json()}catch(e){q.notify({type:`negative`,message:String(e),position:`top`,timeout:4e3})}finally{Y.value=!1}}n(X);let xe=l(()=>{let e=J.value?.db.sizeBytes;return e==null?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}),Z=l(()=>{let e=J.value;return e?e.db.schemaVersion===e.db.currentSchemaVersion:!1});function Q(e){return e?`check_circle`:`error`}function $(e){return e?`positive`:`negative`}return(n,r)=>(e(),o(y,{class:`q-pa-md`,style:{"max-width":`900px`,margin:`0 auto`}},{default:i(()=>[f(`div`,b,[c(m,{flat:``,dense:``,round:``,icon:`arrow_back`,onClick:r[0]||=e=>d(be).back()}),f(`div`,x,a(n.$t(`health.title`)),1),c(_),c(m,{flat:``,dense:``,icon:`refresh`,loading:Y.value,label:n.$t(`common.refresh`),onClick:X},null,8,[`loading`,`label`])]),!J.value&&Y.value?(e(),u(`div`,S,a(n.$t(`common.loading`)),1)):J.value?(e(),u(`div`,C,[c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,w,a(n.$t(`health.envTitle`)),1),f(`div`,T,a(n.$t(`health.koboHome`)),1),f(`div`,E,a(J.value.koboHome),1)]),_:1})]),_:1}),c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,D,[f(`div`,O,a(n.$t(`health.dbTitle`)),1),c(_),c(p,{name:Q(Z.value),color:$(Z.value)},null,8,[`name`,`color`])]),f(`div`,k,[f(`div`,A,[f(`div`,j,a(n.$t(`health.dbPath`)),1),f(`div`,M,a(J.value.db.path),1)]),f(`div`,N,[f(`div`,P,a(n.$t(`health.dbSize`)),1),f(`div`,F,a(xe.value),1)]),f(`div`,I,[f(`div`,L,a(n.$t(`health.schemaVersion`)),1),f(`div`,R,a(J.value.db.schemaVersion)+` / `+a(J.value.db.currentSchemaVersion),1)])])]),_:1})]),_:1}),c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,z,[f(`div`,B,a(n.$t(`health.cliTitle`)),1),c(_),c(p,{name:Q(J.value.claudeCli.available),color:$(J.value.claudeCli.available)},null,8,[`name`,`color`])]),J.value.claudeCli.available?(e(),u(`div`,V,a(J.value.claudeCli.version),1)):(e(),u(`div`,se,a(n.$t(`health.cliMissing`)),1))]),_:1})]),_:1}),c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,H,[f(`div`,U,a(n.$t(`health.workspacesTitle`)),1),c(_),c(p,{name:Q(J.value.workspaces.worktreesMissing.length===0),color:$(J.value.workspaces.worktreesMissing.length===0)},null,8,[`name`,`color`])]),f(`div`,W,a(n.$t(`health.workspacesCount`,{total:J.value.workspaces.total,archived:J.value.workspaces.archived})),1),J.value.workspaces.worktreesMissing.length>0?(e(),u(`div`,G,[f(`div`,K,a(n.$t(`health.worktreesMissing`,{count:J.value.workspaces.worktreesMissing.length})),1),c(v,{dense:``,dark:``},{default:i(()=>[(e(!0),u(te,null,t(J.value.workspaces.worktreesMissing,t=>(e(),o(ie,{key:t.workspaceId},{default:i(()=>[c(ae,null,{default:i(()=>[f(`div`,ce,a(t.name),1),f(`div`,le,a(t.path),1)]),_:2},1024)]),_:2},1024))),128))]),_:1})])):s(``,!0)]),_:1})]),_:1}),c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,ue,[f(`div`,de,a(n.$t(`health.sessionsTitle`)),1),c(_),c(p,{name:Q(J.value.agentSessions.orphaned===0),color:$(J.value.agentSessions.orphaned===0)},null,8,[`name`,`color`])]),f(`div`,{class:ee([`text-caption q-mt-xs`,J.value.agentSessions.orphaned>0?`text-negative`:`text-grey-6`])},a(n.$t(`health.sessionsOrphaned`,{n:J.value.agentSessions.orphaned})),3)]),_:1})]),_:1}),c(g,{dark:``,flat:``,bordered:``},{default:i(()=>[c(h,null,{default:i(()=>[f(`div`,fe,a(n.$t(`health.integrationsTitle`)),1),f(`div`,pe,[f(`div`,me,[c(p,{name:Q(J.value.integrations.notion.configured),color:$(J.value.integrations.notion.configured),size:`sm`},null,8,[`name`,`color`]),r[1]||=f(`span`,{class:`q-ml-sm text-body2`},`Notion`,-1),f(`span`,he,a(J.value.integrations.notion.configured?n.$t(`health.integrationConfigured`):n.$t(`health.integrationMissing`)),1)]),f(`div`,ge,[c(p,{name:Q(J.value.integrations.sentry.configured),color:$(J.value.integrations.sentry.configured),size:`sm`},null,8,[`name`,`color`]),r[2]||=f(`span`,{class:`q-ml-sm text-body2`},`Sentry`,-1),f(`span`,_e,a(J.value.integrations.sentry.configured?n.$t(`health.integrationConfigured`):n.$t(`health.integrationMissing`)),1)]),f(`div`,ve,[c(p,{name:Q(J.value.integrations.editor.configured),color:$(J.value.integrations.editor.configured),size:`sm`},null,8,[`name`,`color`]),r[3]||=f(`span`,{class:`q-ml-sm text-body2`},`Editor`,-1),f(`span`,ye,a(J.value.integrations.editor.configured?n.$t(`health.integrationConfigured`):n.$t(`health.integrationMissing`)),1)])])]),_:1})]),_:1})])):s(``,!0)]),_:1}))}});export{q as default};
|