dsh-git-desk 0.23.0 → 0.24.0

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.
@@ -234,6 +234,7 @@ export async function writeCommitMessage(ctx, request) {
234
234
  messages: [{ role: 'user', content: [{ type: 'text', text: promptFor(request.recent, request.patch) }] }],
235
235
  temperature: 0.2,
236
236
  maxTokens: 200,
237
+ ...(request.sessionId === undefined ? {} : { sessionId: request.sessionId }),
237
238
  signal: request.signal,
238
239
  });
239
240
  for await (const chunk of chunks) {
@@ -1597,15 +1597,35 @@ export async function stashList(runtime, root) {
1597
1597
  */
1598
1598
  export async function stashPush(runtime, root, options) {
1599
1599
  const message = typeof options.message === 'string' && options.message.trim() !== '' ? options.message.trim() : 'WIP';
1600
- const paths = Array.isArray(options.paths) ? options.paths.map((value) => repoPath(root, value).path) : [];
1600
+ if (!Array.isArray(options.paths) || options.paths.length === 0) {
1601
+ throw new GitError('git/invalid-path', 'Select at least one file to stash.');
1602
+ }
1603
+ const paths = [...new Set(options.paths.map((value) => repoPath(root, value).path))];
1604
+ const snapshot = await readStatus(runtime, root);
1605
+ if (snapshot.merging || snapshot.rebasing || snapshot.reverting || snapshot.cherryPicking) {
1606
+ throw new GitError('git/operation', 'Finish the current operation before stashing changes.');
1607
+ }
1608
+ const entries = paths.map((path) => snapshot.entries.find((entry) => entry.path === path));
1609
+ if (entries.some((entry) => entry === undefined)) {
1610
+ throw new GitError('git/stale', 'A selected file changed after the list was read. Refresh and try again.');
1611
+ }
1612
+ if (entries.some((entry) => entry?.conflicted)) {
1613
+ throw new GitError('git/conflict', 'Resolve conflicts before stashing changes.');
1614
+ }
1615
+ if (entries.some((entry) => entry?.kind === 'renamed') ||
1616
+ snapshot.entries.some((entry) => entry.kind === 'renamed' && entry.from != null && paths.includes(entry.from))) {
1617
+ throw new GitError('git/unsupported', 'Stashing renamed files or their old paths is not supported. Commit or unstage the rename first.');
1618
+ }
1601
1619
  const args = ['stash', 'push', '-m', message];
1602
- if (options.includeUntracked === true)
1620
+ if (entries.some((entry) => entry?.untracked))
1603
1621
  args.push('-u');
1604
- if (paths.length > 0)
1605
- args.push('--', ...paths);
1622
+ args.push('--', ...paths.map((value) => `:(literal)${value}`));
1606
1623
  const result = await runtime.run(root, args);
1607
1624
  if (result.code !== 0)
1608
1625
  throw failure(result, 'Git could not stash the selected files.');
1626
+ if (result.stdout.includes('No local changes to save')) {
1627
+ throw new GitError('git/stale', 'The selected files no longer have changes. Refresh and try again.');
1628
+ }
1609
1629
  return {
1610
1630
  output: `${result.stdout}${result.stderr}`.trim(),
1611
1631
  status: await readStatus(runtime, root),
@@ -283,6 +283,7 @@ async function dispatch(ctx, runtime, endpoint, payload) {
283
283
  signal: AbortSignal.timeout(60_000),
284
284
  model: valueOf(payload, 'model'),
285
285
  instruction: valueOf(payload, 'instruction'),
286
+ sessionId: optionalString(payload, 'sessionId'),
286
287
  });
287
288
  }
288
289
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-git-desk",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "description": "Git desk for DeepSeek Harness: a right-sidebar Git workbench with full-file side-by-side diffs, block staging, commits, history, branches, stash, and sync.",
6
6
  "keywords": [
@@ -34,6 +34,7 @@
34
34
  "files": [
35
35
  "dist",
36
36
  "client.js",
37
+ "client.highlight.js",
37
38
  "cordis.patch.yml",
38
39
  "locale/*.json",
39
40
  "icon.png",
@@ -65,6 +66,23 @@
65
66
  "test": "node --test tests/*.test.mjs"
66
67
  },
67
68
  "devDependencies": {
69
+ "@codemirror/lang-cpp": "^6.0.3",
70
+ "@codemirror/lang-css": "^6.3.1",
71
+ "@codemirror/lang-go": "^6.0.1",
72
+ "@codemirror/lang-html": "^6.4.12",
73
+ "@codemirror/lang-java": "^6.0.2",
74
+ "@codemirror/lang-javascript": "^6.2.5",
75
+ "@codemirror/lang-json": "^6.0.2",
76
+ "@codemirror/lang-markdown": "^6.5.2",
77
+ "@codemirror/lang-php": "^6.0.2",
78
+ "@codemirror/lang-python": "^6.2.1",
79
+ "@codemirror/lang-rust": "^6.0.2",
80
+ "@codemirror/lang-sql": "^6.10.0",
81
+ "@codemirror/lang-xml": "^6.1.0",
82
+ "@codemirror/lang-yaml": "^6.1.3",
83
+ "@codemirror/language": "^6.13.1",
84
+ "@codemirror/state": "^6.7.6",
85
+ "@lezer/highlight": "^1.2.5",
68
86
  "@types/node": "^22.20.5",
69
87
  "@types/react": "^18.3.31",
70
88
  "@types/react-dom": "^18.3.7",