@hy-sde-org/dsh-git 0.1.1-rc.2

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/LICENSE ADDED
@@ -0,0 +1,37 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hy-sde
4
+
5
+ This repository is a port of the oh-my-pi memory surface (retain / recall /
6
+ reflect / memory_edit / learn and the durable project-scoped local memory
7
+ backend) onto the DeepSeek Harness `ctx.memory` service contract — see
8
+ port_omp.md item 4 in the hy-sde fork. The ported portions are distributed
9
+ under the same MIT license with their original copyright held by their
10
+ respective authors:
11
+
12
+ Copyright (c) 2025 Mario Zechner
13
+ Copyright (c) 2025-2026 Can Bölük
14
+
15
+ See THIRD-PARTY-NOTICES.md for full provenance per module.
16
+
17
+ Parts of this repository are derived from DeepSeek Haarness
18
+ (https://github.com/deepseek-ai/deepseek-harness), MIT License,
19
+ Copyright (c) 2026 DeepSeek.
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @hy-sde-org/dsh-git
2
+
3
+ Host-plane `ctx.git` service for the DeepSeek Harness: a stateless, thin
4
+ wrapper around the `git` CLI through the `ctx.subprocess` seam, plus the
5
+ diff-parsing primitives and split-commit execution verbs the model-facing
6
+ tools need. Consumed by `@hy-sde-org/dsh-tool-git`; never called by the model
7
+ directly.
8
+
9
+ - `GitService` — `run` / `status` / `diffText` / `diffStat` /
10
+ `stagedFiles` / `resetIndex` / `stageHunks` / `commit` / `log` /
11
+ `currentBranch` / `isWorktree`.
12
+ - `parseFileDiffs` / `parseNumstat` / `computeDependencyOrder` /
13
+ `LOCK_FILES` — pure diff + topo-sort + lock-file primitives.
14
+ - `apply(ctx, config)` registers `ctx.git` (subprocess seam required).
15
+
16
+ Port of omp (oh-my-pi)'s git layer — see `port_omp.md` item: commit. The
17
+ service owns no durable state and shells out per call, so one host instance
18
+ serves every session; which repo the tools act on comes from the calling
19
+ agent's session cwd at call time.
20
+
21
+ ## Install & mount
22
+
23
+ See the repo `README.md` — as a plugin:
24
+
25
+ ```bash
26
+ dsh plugin --profile web add @hy-sde-org/dsh-git
27
+ ```
28
+
29
+ The bundle `cordis.patch.yml` inserts the `git` row into the profile's base
30
+ composition (stock INSERT patch form, safe on official releases). The tools
31
+ mount from any user preset that copies `examples/agent-preset/`.
32
+
33
+ ## Development
34
+
35
+ ```bash
36
+ pnpm install
37
+ pnpm run check # tsc --noEmit
38
+ pnpm run build # tsc -p tsconfig.build.json → dist/
39
+ pnpm run test # vitest (20 unit + 8 real-repo integration)
40
+ ```
@@ -0,0 +1,22 @@
1
+ # @hy-sde-org/dsh-git — install surface for agentic git plumbing.
2
+ #
3
+ # The `ctx.git` SERVICE is host-plane: it is a stateless git CLI wrapper
4
+ # (diff capture/parsing, hunk staging, commit/push/log over the subprocess
5
+ # seam) with no durable state, so one instance across sessions is correct —
6
+ # this bundle inserts one row into the profile's base composition. The
7
+ # model-facing commit/commit_apply/review tools live in
8
+ # @hy-sde-org/dsh-tool-git and mount at the AGENT plane from a user agent
9
+ # preset (they resolve this host instance) — see examples/agent-preset/ in
10
+ # the package for the ready-to-copy preset.
11
+ #
12
+ # `insert` is the stock harness patch form for rows that don't exist in the
13
+ # deployment's composition (a plain `id:`+`name:` entry is a modification of
14
+ # an existing row). This patch INSERTS a new row only — it touches no existing
15
+ # row, so `dsh plugin add @hy-sde-org/dsh-git` never breaks boot on a stock
16
+ # DeepSeek Harness (0.1.1-rc.2 and later). Without the preset row you get the
17
+ # service but no tools; without this row the preset tools fail loudly
18
+ # ("git: no git service") the first time they run.
19
+
20
+ - insert:
21
+ - id: git
22
+ name: '@hy-sde-org/dsh-git'
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Conventional-commit message formatting.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/message.ts`.
4
+ * @module @hy-sde-org/dsh-git/commit-message
5
+ */
6
+ import type { ConventionalAnalysis } from './types.ts';
7
+ /** Render a conventional-commit message from an analysis and summary line. */
8
+ export declare function formatCommitMessage(analysis: ConventionalAnalysis, summary: string): string;
9
+ //# sourceMappingURL=commit-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-message.d.ts","sourceRoot":"","sources":["../src/commit-message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ3F"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Conventional-commit message formatting.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/message.ts`.
4
+ * @module @hy-sde-org/dsh-git/commit-message
5
+ */
6
+ /** Render a conventional-commit message from an analysis and summary line. */
7
+ export function formatCommitMessage(analysis, summary) {
8
+ const scopePart = analysis.scope ? `(${analysis.scope})` : '';
9
+ const header = `${analysis.type}${scopePart}: ${summary}`;
10
+ const bodyLines = analysis.details.map(detail => `- ${detail.text.trim()}`);
11
+ if (bodyLines.length === 0) {
12
+ return header;
13
+ }
14
+ return `${header}\n\n${bodyLines.join('\n')}`;
15
+ }
16
+ //# sourceMappingURL=commit-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-message.js","sourceRoot":"","sources":["../src/commit-message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,8EAA8E;AAC9E,MAAM,UAAU,mBAAmB,CAAC,QAA8B,EAAE,OAAe;IACjF,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAC7D,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,GAAG,SAAS,KAAK,OAAO,EAAE,CAAA;IACzD,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC3E,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,GAAG,MAAM,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;AAC/C,CAAC"}
package/dist/diff.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Diff parsing for the git service.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/git/diff.ts` plus the
4
+ * `selectHunks` / `extractFileHeader` helpers from `utils/git.ts` — kept pure
5
+ * text-in / text-out so both the service and the tools can test them directly.
6
+ * @module @hy-sde-org/dsh-git/diff
7
+ */
8
+ import type { FileChange, FileDiff, FileHunks, HunkSelector, NumstatEntry } from './types.ts';
9
+ /** Parse `git diff --numstat` output into per-file counts. */
10
+ export declare function parseNumstat(output: string): NumstatEntry[];
11
+ /** Split a raw diff stream into one {@link FileDiff} per file section. */
12
+ export declare function parseFileDiffs(diff: string): FileDiff[];
13
+ /** Parse every file section of a diff into hunks. */
14
+ export declare function parseDiffHunks(diff: string): FileHunks[];
15
+ /** Parse one file section into hunks (empty hunks for binary files). */
16
+ export declare function parseFileHunks(fileDiff: FileDiff): FileHunks;
17
+ /** Extract the file header (everything before the first `@@` hunk). */
18
+ export declare function extractFileHeader(diffText: string): string;
19
+ /** Select the hunks of one file matched by a selector. */
20
+ export declare function selectHunks(file: FileHunks, selector: HunkSelector): FileHunks['hunks'];
21
+ /**
22
+ * Validate hunk selections against a raw (cached) diff. Returns a readable
23
+ * error per invalid selection; an empty array means the selections are sound.
24
+ */
25
+ export declare function validateHunkSelections(rawDiff: string, selections: readonly FileChange[]): string[];
26
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAY,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEvG,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAmB3D;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAuBvD;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAGxD;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CA8C5D;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,CAWvF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,EAAE,CAqBnG"}
package/dist/diff.js ADDED
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Diff parsing for the git service.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/git/diff.ts` plus the
4
+ * `selectHunks` / `extractFileHeader` helpers from `utils/git.ts` — kept pure
5
+ * text-in / text-out so both the service and the tools can test them directly.
6
+ * @module @hy-sde-org/dsh-git/diff
7
+ */
8
+ /** Parse `git diff --numstat` output into per-file counts. */
9
+ export function parseNumstat(output) {
10
+ const entries = [];
11
+ for (const line of output.split('\n')) {
12
+ if (!line.trim())
13
+ continue;
14
+ const parts = line.split('\t');
15
+ if (parts.length < 3)
16
+ continue;
17
+ const addedRaw = parts[0] ?? '';
18
+ const deletedRaw = parts[1] ?? '';
19
+ const pathRaw = parts[2] ?? '';
20
+ const additions = Number.parseInt(addedRaw, 10);
21
+ const deletions = Number.parseInt(deletedRaw, 10);
22
+ const path = extractPathFromRename(pathRaw);
23
+ entries.push({
24
+ path,
25
+ additions: Number.isNaN(additions) ? 0 : additions,
26
+ deletions: Number.isNaN(deletions) ? 0 : deletions,
27
+ });
28
+ }
29
+ return entries;
30
+ }
31
+ /** Split a raw diff stream into one {@link FileDiff} per file section. */
32
+ export function parseFileDiffs(diff) {
33
+ const sections = [];
34
+ const parts = diff.split('\ndiff --git ');
35
+ for (let index = 0; index < parts.length; index += 1) {
36
+ const part = index === 0 ? parts[index] ?? '' : `diff --git ${parts[index] ?? ''}`;
37
+ if (!part.trim())
38
+ continue;
39
+ const lines = part.split('\n');
40
+ const header = lines[0] ?? '';
41
+ const match = header.match(/diff --git a\/(.+?) b\/(.+)$/);
42
+ if (!match)
43
+ continue;
44
+ const filename = match[2] ?? '';
45
+ const content = part;
46
+ const isBinary = lines.some(line => line.startsWith('Binary files '));
47
+ let additions = 0;
48
+ let deletions = 0;
49
+ for (const line of lines) {
50
+ if (line.startsWith('+++') || line.startsWith('---'))
51
+ continue;
52
+ if (line.startsWith('+'))
53
+ additions += 1;
54
+ else if (line.startsWith('-'))
55
+ deletions += 1;
56
+ }
57
+ sections.push({ filename, content, additions, deletions, isBinary });
58
+ }
59
+ return sections;
60
+ }
61
+ /** Parse every file section of a diff into hunks. */
62
+ export function parseDiffHunks(diff) {
63
+ const files = parseFileDiffs(diff);
64
+ return files.map(file => parseFileHunks(file));
65
+ }
66
+ /** Parse one file section into hunks (empty hunks for binary files). */
67
+ export function parseFileHunks(fileDiff) {
68
+ if (fileDiff.isBinary) {
69
+ return { filename: fileDiff.filename, isBinary: true, hunks: [] };
70
+ }
71
+ const lines = fileDiff.content.split('\n');
72
+ const hunks = [];
73
+ let current = null;
74
+ let buffer = [];
75
+ let index = 0;
76
+ for (const line of lines) {
77
+ if (line.startsWith('@@')) {
78
+ if (current) {
79
+ current.content = buffer.join('\n');
80
+ hunks.push(current);
81
+ }
82
+ const headerData = parseHunkHeader(line);
83
+ current = {
84
+ index,
85
+ header: line,
86
+ oldStart: headerData.oldStart,
87
+ oldLines: headerData.oldLines,
88
+ newStart: headerData.newStart,
89
+ newLines: headerData.newLines,
90
+ content: '',
91
+ };
92
+ buffer = [line];
93
+ index += 1;
94
+ continue;
95
+ }
96
+ if (current) {
97
+ buffer.push(line);
98
+ }
99
+ }
100
+ if (current) {
101
+ current.content = buffer.join('\n');
102
+ hunks.push(current);
103
+ }
104
+ return {
105
+ filename: fileDiff.filename,
106
+ isBinary: fileDiff.isBinary,
107
+ hunks,
108
+ };
109
+ }
110
+ /** Extract the file header (everything before the first `@@` hunk). */
111
+ export function extractFileHeader(diffText) {
112
+ const lines = diffText.split('\n');
113
+ const headerLines = [];
114
+ for (const line of lines) {
115
+ if (line.startsWith('@@'))
116
+ break;
117
+ headerLines.push(line);
118
+ }
119
+ return headerLines.join('\n');
120
+ }
121
+ /** Select the hunks of one file matched by a selector. */
122
+ export function selectHunks(file, selector) {
123
+ if (selector.type === 'indices') {
124
+ const wanted = new Set(selector.indices.map(v => Math.max(1, Math.floor(v))));
125
+ return file.hunks.filter(hunk => wanted.has(hunk.index + 1));
126
+ }
127
+ if (selector.type === 'lines') {
128
+ const start = Math.floor(selector.start);
129
+ const end = Math.floor(selector.end);
130
+ return file.hunks.filter(hunk => hunk.newStart <= end && hunk.newStart + hunk.newLines - 1 >= start);
131
+ }
132
+ return file.hunks;
133
+ }
134
+ /**
135
+ * Validate hunk selections against a raw (cached) diff. Returns a readable
136
+ * error per invalid selection; an empty array means the selections are sound.
137
+ */
138
+ export function validateHunkSelections(rawDiff, selections) {
139
+ const fileDiffMap = new Map(parseFileDiffs(rawDiff).map(entry => [entry.filename, entry]));
140
+ const errors = [];
141
+ for (const selection of selections) {
142
+ const fileDiff = fileDiffMap.get(selection.path);
143
+ if (!fileDiff) {
144
+ // Unknown-to-the-diff files are validated separately against the staged
145
+ // file list; absent here just means no diff data (e.g. binary or empty).
146
+ continue;
147
+ }
148
+ if (selection.hunks.type === 'all')
149
+ continue;
150
+ if (fileDiff.isBinary) {
151
+ errors.push(`cannot select hunks for binary file ${selection.path}`);
152
+ continue;
153
+ }
154
+ const selected = selectHunks(parseFileHunks(fileDiff), selection.hunks);
155
+ if (selected.length === 0) {
156
+ errors.push(`no hunks selected for ${selection.path}`);
157
+ }
158
+ }
159
+ return errors;
160
+ }
161
+ function extractPathFromRename(pathPart) {
162
+ const braceStart = pathPart.indexOf('{');
163
+ if (braceStart !== -1) {
164
+ const arrowPos = pathPart.indexOf(' => ', braceStart);
165
+ if (arrowPos !== -1) {
166
+ const braceEnd = pathPart.indexOf('}', arrowPos);
167
+ if (braceEnd !== -1) {
168
+ const prefix = pathPart.slice(0, braceStart);
169
+ const newName = pathPart.slice(arrowPos + 4, braceEnd).trim();
170
+ const tail = pathPart.slice(braceEnd + 1);
171
+ return `${prefix}${newName}${tail}`;
172
+ }
173
+ }
174
+ }
175
+ if (pathPart.includes(' => ')) {
176
+ const parts = pathPart.split(' => ');
177
+ return parts[1]?.trim() ?? pathPart.trim();
178
+ }
179
+ return pathPart.trim();
180
+ }
181
+ function parseHunkHeader(line) {
182
+ const match = line.match(/@@\s-([0-9]+)(?:,([0-9]+))?\s\+([0-9]+)(?:,([0-9]+))?\s@@/);
183
+ if (!match) {
184
+ return { oldStart: 0, oldLines: 0, newStart: 0, newLines: 0 };
185
+ }
186
+ const oldStart = Number.parseInt(match[1] ?? '0', 10);
187
+ const oldLines = Number.parseInt(match[2] ?? '1', 10);
188
+ const newStart = Number.parseInt(match[3] ?? '0', 10);
189
+ const newLines = Number.parseInt(match[4] ?? '1', 10);
190
+ return {
191
+ oldStart: Number.isNaN(oldStart) ? 0 : oldStart,
192
+ oldLines: Number.isNaN(oldLines) ? 0 : oldLines,
193
+ newStart: Number.isNaN(newStart) ? 0 : newStart,
194
+ newLines: Number.isNaN(newLines) ? 0 : newLines,
195
+ };
196
+ }
197
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,OAAO,GAAmB,EAAE,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAQ;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,SAAQ;QAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC/B,MAAM,UAAU,G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AE,CAAC;QACX,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAA;IAC/D,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;IACrD,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC/C,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC/C,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC/C,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;KAChD,CAAA;AACH,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Agentic git plumbing for the DeepSeek Harness: `ctx.git`, a host-plane git
3
+ * CLI service (diff capture/parsing, status, hunk staging, commit/push/log)
4
+ * that the commit and review tools in `@hy-sde-org/dsh-tool-git` resolve.
5
+ *
6
+ * Port of omp (oh-my-pi)'s git layer — see port_omp.md item: commit. The
7
+ * service is stateless per call, so it lives in the base bundle like
8
+ * `ctx.memory` / `ctx.internalUrls`; session-scoped concerns (which repo the
9
+ * tools act on) come from the calling agent's session cwd at call time.
10
+ * @module @hy-sde-org/dsh-git
11
+ */
12
+ import { Context } from '@deepseek-ai/cordis';
13
+ import { GitService } from './service.ts';
14
+ import type { Config } from './service.ts';
15
+ export * from './types.ts';
16
+ export * from './service.ts';
17
+ export * from './diff.ts';
18
+ export * from './topo-sort.ts';
19
+ export * from './lock-files.ts';
20
+ export * from './trivial.ts';
21
+ export * from './commit-message.ts';
22
+ declare module '@deepseek-ai/cordis' {
23
+ interface Context {
24
+ /** The git service: read/write git primitives over the subprocess seam. */
25
+ git: GitService;
26
+ }
27
+ }
28
+ export { GitCommandError } from './service.ts';
29
+ /**
30
+ * Register `ctx.git`. Host-plane row: the service owns no durable state and
31
+ * shells out per call, so one instance across sessions is correct.
32
+ * @param ctx - the host or agent-plane context (needs the `subprocess` seam).
33
+ * @param config - service configuration (git path, timeouts, caps).
34
+ */
35
+ export declare function apply(ctx: Context, config?: Config): void;
36
+ /** Cordis plugin name for loader diagnostics. */
37
+ export declare const name = "git";
38
+ declare const _default: {
39
+ name: string;
40
+ apply: typeof apply;
41
+ };
42
+ export default _default;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AAEnC,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,2EAA2E;QAC3E,GAAG,EAAE,UAAU,CAAA;KAChB;CACF;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAE7D;AAED,iDAAiD;AACjD,eAAO,MAAM,IAAI,QAAQ,CAAA;;;;;AAEzB,wBAA8B"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Agentic git plumbing for the DeepSeek Harness: `ctx.git`, a host-plane git
3
+ * CLI service (diff capture/parsing, status, hunk staging, commit/push/log)
4
+ * that the commit and review tools in `@hy-sde-org/dsh-tool-git` resolve.
5
+ *
6
+ * Port of omp (oh-my-pi)'s git layer — see port_omp.md item: commit. The
7
+ * service is stateless per call, so it lives in the base bundle like
8
+ * `ctx.memory` / `ctx.internalUrls`; session-scoped concerns (which repo the
9
+ * tools act on) come from the calling agent's session cwd at call time.
10
+ * @module @hy-sde-org/dsh-git
11
+ */
12
+ import { GitService } from "./service.js";
13
+ export * from "./types.js";
14
+ export * from "./service.js";
15
+ export * from "./diff.js";
16
+ export * from "./topo-sort.js";
17
+ export * from "./lock-files.js";
18
+ export * from "./trivial.js";
19
+ export * from "./commit-message.js";
20
+ export { GitCommandError } from "./service.js";
21
+ /**
22
+ * Register `ctx.git`. Host-plane row: the service owns no durable state and
23
+ * shells out per call, so one instance across sessions is correct.
24
+ * @param ctx - the host or agent-plane context (needs the `subprocess` seam).
25
+ * @param config - service configuration (git path, timeouts, caps).
26
+ */
27
+ export function apply(ctx, config = {}) {
28
+ new GitService(ctx, config);
29
+ }
30
+ /** Cordis plugin name for loader diagnostics. */
31
+ export const name = 'git';
32
+ export default { name, apply };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AASnC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,SAAiB,EAAE;IACrD,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC7B,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAA;AAEzB,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@hy-sde-org/dsh-git`.
3
+ * @module @hy-sde-org/dsh-git/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "git-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,kBAAkB,CAAA;AACnC,2EAA2E;AAC3E,eAAO,MAAM,MAAM,UAAiB,CAAA;AAQpC;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,KAAG,OAAO,CAAC,MAAM,IAAI,CACU,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Package-owned invariant companion for `@hy-sde-org/dsh-git`.
3
+ * @module @hy-sde-org/dsh-git/invariant
4
+ */
5
+ const PACKAGE_NAME = '@hy-sde-org/dsh-git';
6
+ /** Cordis companion plugin name. */
7
+ export const name = 'git-invariant';
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export const inject = ['invariants'];
10
+ /**
11
+ * No runtime invariant: the service shells out per call and holds no durable
12
+ * state that outlives its fiber.
13
+ */
14
+ const install = () => { };
15
+ /**
16
+ * Register this package's invariant companion.
17
+ * @param ctx - Cordis context carrying the invariant service.
18
+ * @returns the installed registration's disposer after setup succeeds.
19
+ */
20
+ export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
21
+ /* jscpd:ignore-end */
22
+ //# sourceMappingURL=invariant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,YAAY,GAAG,qBAAqB,CAAA;AAE1C,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAA;AACnC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,YAAY,CAAC,CAAA;AAEpC;;;GAGG;AACH,MAAM,OAAO,GAAuB,GAAG,EAAE,GAAE,CAAC,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAY,EAAuB,EAAE,CACzD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAA;AACjE,sBAAsB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Lock-file handling for the split-commit workflow.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/agentic/lock-files.ts`.
4
+ *
5
+ * The commit analyzer hides machine-generated lock files from the model so it
6
+ * does not waste tokens on them and does not treat them as evidence for commit
7
+ * boundaries. That leaves them staged but unseen — without deterministic
8
+ * post-plan placement, a plan that omits them is rejected by the coverage
9
+ * validator and would silently drop the file if the validator were skipped.
10
+ * @module @hy-sde-org/dsh-git/lock-files
11
+ */
12
+ import type { SplitCommitPlan } from './types.ts';
13
+ /**
14
+ * Lock file basename -> ordered sibling manifests. Order matters: the first
15
+ * manifest present in a commit group's changes wins.
16
+ */
17
+ export declare const LOCK_FILE_MANIFESTS: Readonly<Record<string, readonly string[]>>;
18
+ /** Lock-file basenames hidden from analysis; derived so edits stay in sync. */
19
+ export declare const EXCLUDED_LOCK_FILES: ReadonlySet<string>;
20
+ /**
21
+ * Attach staged lock files the model never saw to the split plan.
22
+ * Placement precedence per lock file: a commit group touching a sibling
23
+ * manifest in the same directory, then any manifest, then the last commit
24
+ * group. Mutates {@link plan} in place. No-ops on an empty plan, on lock files
25
+ * already present, and on staged files that are not recognized lock files.
26
+ */
27
+ export declare function assignLockFilesToPlan(plan: SplitCommitPlan, stagedFiles: readonly string[]): void;
28
+ //# sourceMappingURL=lock-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock-files.d.ts","sourceRoot":"","sources":["../src/lock-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAkB3E,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAA6C,CAAA;AAEjG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAsBjG"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Lock-file handling for the split-commit workflow.
3
+ * Direct port of omp's `packages/coding-agent/src/commit/agentic/lock-files.ts`.
4
+ *
5
+ * The commit analyzer hides machine-generated lock files from the model so it
6
+ * does not waste tokens on them and does not treat them as evidence for commit
7
+ * boundaries. That leaves them staged but unseen — without deterministic
8
+ * post-plan placement, a plan that omits them is rejected by the coverage
9
+ * validator and would silently drop the file if the validator were skipped.
10
+ * @module @hy-sde-org/dsh-git/lock-files
11
+ */
12
+ /**
13
+ * Lock file basename -> ordered sibling manifests. Order matters: the first
14
+ * manifest present in a commit group's changes wins.
15
+ */
16
+ export const LOCK_FILE_MANIFESTS = {
17
+ 'Cargo.lock': ['Cargo.toml'],
18
+ 'package-lock.json': ['package.json'],
19
+ 'yarn.lock': ['package.json'],
20
+ 'pnpm-lock.yaml': ['package.json'],
21
+ 'bun.lock': ['package.json'],
22
+ 'bun.lockb': ['package.json'],
23
+ 'go.sum': ['go.mod'],
24
+ 'poetry.lock': ['pyproject.toml'],
25
+ 'Pipfile.lock': ['Pipfile'],
26
+ 'uv.lock': ['pyproject.toml'],
27
+ 'composer.lock': ['composer.json'],
28
+ 'Gemfile.lock': ['Gemfile'],
29
+ 'flake.lock': ['flake.nix'],
30
+ 'pubspec.lock': ['pubspec.yaml'],
31
+ 'Podfile.lock': ['Podfile'],
32
+ 'mix.lock': ['mix.exs'],
33
+ 'gradle.lockfile': ['build.gradle', 'build.gradle.kts', 'settings.gradle', 'settings.gradle.kts'],
34
+ };
35
+ /** Lock-file basenames hidden from analysis; derived so edits stay in sync. */
36
+ export const EXCLUDED_LOCK_FILES = new Set(Object.keys(LOCK_FILE_MANIFESTS));
37
+ /**
38
+ * Attach staged lock files the model never saw to the split plan.
39
+ * Placement precedence per lock file: a commit group touching a sibling
40
+ * manifest in the same directory, then any manifest, then the last commit
41
+ * group. Mutates {@link plan} in place. No-ops on an empty plan, on lock files
42
+ * already present, and on staged files that are not recognized lock files.
43
+ */
44
+ export function assignLockFilesToPlan(plan, stagedFiles) {
45
+ if (plan.commits.length === 0)
46
+ return;
47
+ const planned = new Set(plan.commits.flatMap(commit => commit.changes.map(change => change.path)));
48
+ const orphanedLockFiles = [];
49
+ for (const file of stagedFiles) {
50
+ if (planned.has(file))
51
+ continue;
52
+ const parts = file.split('/');
53
+ const basename = parts[parts.length - 1] ?? '';
54
+ if (EXCLUDED_LOCK_FILES.has(basename))
55
+ orphanedLockFiles.push(file);
56
+ }
57
+ if (orphanedLockFiles.length === 0)
58
+ return;
59
+ for (const lockFile of orphanedLockFiles) {
60
+ const parts = lockFile.split('/');
61
+ const basename = parts[parts.length - 1] ?? '';
62
+ const dir = parts.slice(0, -1).join('/');
63
+ const manifests = LOCK_FILE_MANIFESTS[basename] ?? [];
64
+ const targetIndex = findManifestCommitIndex(plan, dir, manifests);
65
+ plan.commits[targetIndex]?.changes.push({ path: lockFile, hunks: { type: 'all' } });
66
+ planned.add(lockFile);
67
+ }
68
+ }
69
+ function findManifestCommitIndex(plan, lockDir, manifests) {
70
+ // Prefer a manifest in the same directory as the lock file — the strongest
71
+ // semantic signal (e.g. workspace-crate `Cargo.toml` next to `Cargo.lock`).
72
+ for (const manifestName of manifests) {
73
+ for (let i = 0; i < plan.commits.length; i++) {
74
+ for (const change of plan.commits[i]?.changes ?? []) {
75
+ const parts = change.path.split('/');
76
+ const basename = parts[parts.length - 1] ?? '';
77
+ const dir = parts.slice(0, -1).join('/');
78
+ if (basename === manifestName && dir === lockDir)
79
+ return i;
80
+ }
81
+ }
82
+ }
83
+ // Fall back to any matching manifest — a monorepo may lock at repo root
84
+ // while the manifest sits under a subpath.
85
+ for (const manifestName of manifests) {
86
+ for (let i = 0; i < plan.commits.length; i++) {
87
+ for (const change of plan.commits[i]?.changes ?? []) {
88
+ const parts = change.path.split('/');
89
+ if ((parts[parts.length - 1] ?? '') === manifestName)
90
+ return i;
91
+ }
92
+ }
93
+ }
94
+ // Nothing matched: attach to the last commit so the file still ships.
95
+ return plan.commits.length - 1;
96
+ }
97
+ //# sourceMappingURL=lock-files.js.map