@linghun/tools 0.1.4 → 0.1.6

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,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Linghun contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -1,12 +1,12 @@
1
+ import {
2
+ WebFetchTool
3
+ } from "./chunk-LGZOG7IQ.js";
1
4
  import {
2
5
  WebSearchTool
3
6
  } from "./chunk-4EZHIDZ6.js";
4
7
  import {
5
8
  WriteTool
6
9
  } from "./chunk-I3Z4OKMS.js";
7
- import {
8
- WebFetchTool
9
- } from "./chunk-LGZOG7IQ.js";
10
10
  import {
11
11
  ReadTool
12
12
  } from "./chunk-TZ6QK52L.js";
@@ -22,18 +22,18 @@ import {
22
22
  import {
23
23
  GrepTool
24
24
  } from "./chunk-AZCQL24J.js";
25
+ import {
26
+ MultiEditTool
27
+ } from "./chunk-VJDLOFCF.js";
25
28
  import {
26
29
  EditTool
27
30
  } from "./chunk-WLQ7DGMG.js";
28
- import {
29
- DiffTool
30
- } from "./chunk-7ZOADACP.js";
31
31
  import {
32
32
  GlobTool
33
- } from "./chunk-DN3KJZRV.js";
33
+ } from "./chunk-Z3H6SZBS.js";
34
34
  import {
35
- MultiEditTool
36
- } from "./chunk-3NZ3IOPM.js";
35
+ DiffTool
36
+ } from "./chunk-7ZOADACP.js";
37
37
  import {
38
38
  BashTool
39
39
  } from "./chunk-2DIXRINW.js";
@@ -1,12 +1,12 @@
1
+ import {
2
+ WebFetchTool
3
+ } from "./chunk-LGZOG7IQ.js";
1
4
  import {
2
5
  WebSearchTool
3
6
  } from "./chunk-4EZHIDZ6.js";
4
7
  import {
5
8
  WriteTool
6
9
  } from "./chunk-I3Z4OKMS.js";
7
- import {
8
- WebFetchTool
9
- } from "./chunk-LGZOG7IQ.js";
10
10
  import {
11
11
  ReadTool
12
12
  } from "./chunk-TZ6QK52L.js";
@@ -22,18 +22,18 @@ import {
22
22
  import {
23
23
  GrepTool
24
24
  } from "./chunk-AZCQL24J.js";
25
+ import {
26
+ MultiEditTool
27
+ } from "./chunk-VJDLOFCF.js";
25
28
  import {
26
29
  EditTool
27
30
  } from "./chunk-WLQ7DGMG.js";
28
- import {
29
- DiffTool
30
- } from "./chunk-7ZOADACP.js";
31
31
  import {
32
32
  GlobTool
33
- } from "./chunk-DN3KJZRV.js";
33
+ } from "./chunk-Z3H6SZBS.js";
34
34
  import {
35
- MultiEditTool
36
- } from "./chunk-3NZ3IOPM.js";
35
+ DiffTool
36
+ } from "./chunk-7ZOADACP.js";
37
37
  import {
38
38
  BashTool
39
39
  } from "./chunk-2DIXRINW.js";
package/dist/index.d.ts CHANGED
@@ -99,6 +99,24 @@ export type DiffSummary = {
99
99
  summary: string;
100
100
  riskyFiles: string[];
101
101
  };
102
+ export type PatchHunk = {
103
+ oldStart: number;
104
+ newStart: number;
105
+ contextBefore?: string[];
106
+ oldLines: string[];
107
+ newLines: string[];
108
+ contextAfter?: string[];
109
+ oldLineCount: number;
110
+ newLineCount: number;
111
+ truncated?: boolean;
112
+ };
113
+ export type StructuredPatchFile = {
114
+ path: string;
115
+ hunks: PatchHunk[];
116
+ };
117
+ export type StructuredPatch = {
118
+ files: StructuredPatchFile[];
119
+ };
102
120
  export type ReadInput = {
103
121
  path: string;
104
122
  offset?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAS3B,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UA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AAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,iBAAe,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4K9E;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C;AA8HD,eAAO,MAAM,kBAAkB,qBAAe,CAAC;AAC/C,eAAO,MAAM,sBAAsB,yBAAmB,CAAC;AACvD,eAAO,MAAM,4BAA4B,+BAAyB,CAAC;AACnE,eAAO,MAAM,iCAAiC,oCAA8B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,eAAO,MAAM,uBAAuB,0BAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -7,24 +7,27 @@ import {
7
7
  bingSearch,
8
8
  formatSearchOutput
9
9
  } from "./chunk-EPIB4FSE.js";
10
+ import {
11
+ interpretCommandResult
12
+ } from "./chunk-FI4YPDFE.js";
10
13
  import {
11
14
  createTool
12
15
  } from "./chunk-MMJX44V6.js";
13
16
  import {
14
17
  toolPrompts
15
- } from "./chunk-ZGLZZKO6.js";
18
+ } from "./chunk-VVRFYPMG.js";
16
19
  import {
17
20
  toolUserFacingNames
18
- } from "./chunk-6BBM4UX3.js";
19
- import "./chunk-4EZHIDZ6.js";
20
- import "./chunk-I3Z4OKMS.js";
21
- import "./chunk-PS2ZOFZ6.js";
22
- import "./chunk-NPKLGVDQ.js";
21
+ } from "./chunk-24USSE7U.js";
23
22
  import "./chunk-LGZOG7IQ.js";
24
23
  import "./chunk-ZYAEUABC.js";
25
24
  import "./chunk-SWK6XRZQ.js";
25
+ import "./chunk-4EZHIDZ6.js";
26
26
  import "./chunk-YR4HWOR2.js";
27
27
  import "./chunk-VAFW24RN.js";
28
+ import "./chunk-I3Z4OKMS.js";
29
+ import "./chunk-PS2ZOFZ6.js";
30
+ import "./chunk-NPKLGVDQ.js";
28
31
  import "./chunk-TZ6QK52L.js";
29
32
  import "./chunk-K3YDFDLP.js";
30
33
  import "./chunk-GI5XI4HN.js";
@@ -37,23 +40,20 @@ import "./chunk-SZFZPQGL.js";
37
40
  import "./chunk-AZCQL24J.js";
38
41
  import "./chunk-HUIZOB4A.js";
39
42
  import "./chunk-MK3YP2VR.js";
43
+ import "./chunk-VJDLOFCF.js";
44
+ import "./chunk-3RP665TH.js";
45
+ import "./chunk-IOC3BSPT.js";
46
+ import "./chunk-HNIVNZIS.js";
40
47
  import "./chunk-WLQ7DGMG.js";
41
48
  import "./chunk-SQP6SJRP.js";
42
49
  import "./chunk-BRG64AEC.js";
43
- import "./chunk-HNIVNZIS.js";
50
+ import "./chunk-Z3H6SZBS.js";
51
+ import "./chunk-ITBZHMZQ.js";
52
+ import "./chunk-2U4BZXAI.js";
44
53
  import "./chunk-7ZOADACP.js";
45
54
  import "./chunk-H5OOD2OS.js";
46
55
  import "./chunk-IQP3XE32.js";
47
- import "./chunk-DN3KJZRV.js";
48
- import "./chunk-2U4BZXAI.js";
49
- import "./chunk-ITBZHMZQ.js";
50
- import "./chunk-3NZ3IOPM.js";
51
- import "./chunk-IOC3BSPT.js";
52
- import "./chunk-3RP665TH.js";
53
56
  import "./chunk-2DIXRINW.js";
54
- import {
55
- interpretCommandResult
56
- } from "./chunk-FI4YPDFE.js";
57
57
  import "./chunk-PKMIDA5A.js";
58
58
  import "./chunk-GAWMEMXB.js";
59
59
 
@@ -61,7 +61,7 @@ import "./chunk-GAWMEMXB.js";
61
61
  import { spawn } from "child_process";
62
62
  import { createHash, randomUUID } from "crypto";
63
63
  import { closeSync, createWriteStream, openSync } from "fs";
64
- import { mkdir, readFile, readdir, stat, writeFile } from "fs/promises";
64
+ import { mkdir, appendFile, readFile, readdir, stat, writeFile } from "fs/promises";
65
65
  import { basename, dirname, isAbsolute, join, relative, resolve } from "path";
66
66
  var toolRegistryStatus = "ready";
67
67
  var DEFAULT_LIMIT = 200;
@@ -75,6 +75,8 @@ var SOURCE_PACK_MAX_LIMIT = 12;
75
75
  var SOURCE_PACK_CONTEXT_LINES = 8;
76
76
  var SOURCE_PACK_MAX_TERMS = 6;
77
77
  var BASH_PREVIEW_LIMIT = 3e4;
78
+ var BASH_OUTPUT_TRUNCATION_NOTICE = "\n...\uFF08\u8F93\u51FA\u5DF2\u622A\u65AD\uFF0C\u5B8C\u6574\u65E5\u5FD7\u89C1 fullOutputPath\uFF09";
79
+ var BASH_DETAILS_TAIL_LINES = 80;
78
80
  var BASH_TIMEOUT_MS = 12e4;
79
81
  var MAX_TODO_ITEMS = 100;
80
82
  var SEARCH_EXCLUDED_DIR_NAMES = ["node_modules", "dist", ".git", ".codebase-memory"];
@@ -430,11 +432,12 @@ function normalizeToolOutput(output, tool) {
430
432
  }
431
433
  const preview = `${output.text.slice(0, tool.lifecycle.maxResultSizeChars)}
432
434
  ...\uFF08\u8F93\u51FA\u5DF2\u622A\u65AD\uFF0C\u5B8C\u6574\u5185\u5BB9\u89C1 details/fullOutputPath \u6216 transcript\uFF09`;
435
+ const details = output.truncated ? output.details : output.details ?? output.text;
433
436
  return {
434
437
  ...output,
435
438
  text: preview,
436
439
  preview: output.preview ?? preview,
437
- details: output.details ?? output.text,
440
+ details,
438
441
  truncated: true
439
442
  };
440
443
  }
@@ -654,15 +657,22 @@ async function readTool(input, context) {
654
657
  const offset = Math.max(input.offset ?? 0, 0);
655
658
  const limit = Math.max(input.limit ?? DEFAULT_LIMIT, 1);
656
659
  const selected = lines.slice(offset, offset + limit);
657
- const truncated = offset > 0 || offset + limit < lines.length;
660
+ const windowTruncated = offset > 0 || offset + limit < lines.length;
658
661
  const textLines = selected.map((line, index) => `${offset + index + 1} ${line}`);
659
- if (truncated) {
660
- textLines.push(
661
- `...\uFF08\u53EA\u663E\u793A\u8BFB\u53D6\u7A97\u53E3\uFF1A\u9009\u4E2D ${selected.length} \u884C / \u5168\u6587 ${lines.length} \u884C\uFF1B\u4E0D\u662F\u5B8C\u6574\u6587\u4EF6\uFF09`
662
- );
662
+ let text = textLines.join("\n");
663
+ const budgetTruncated = text.length > DEFAULT_TOOL_TEXT_LIMIT;
664
+ if (windowTruncated || budgetTruncated) {
665
+ const marker = `...\uFF08\u53EA\u663E\u793A\u8BFB\u53D6\u7A97\u53E3\uFF1A\u9009\u4E2D ${selected.length} \u884C / \u5168\u6587 ${lines.length} \u884C\uFF1B\u4E0D\u662F\u5B8C\u6574\u6587\u4EF6\uFF09`;
666
+ if (budgetTruncated) {
667
+ text = `${text.slice(0, DEFAULT_TOOL_TEXT_LIMIT - marker.length - 1)}
668
+ ${marker}`;
669
+ } else {
670
+ text = `${text}
671
+ ${marker}`;
672
+ }
663
673
  }
664
674
  return {
665
- text: textLines.join("\n"),
675
+ text,
666
676
  data: {
667
677
  path: relativePath(context.workspaceRoot, filePath),
668
678
  lines: selected.length,
@@ -673,7 +683,7 @@ async function readTool(input, context) {
673
683
  hash: hashText(content),
674
684
  newline: detectNewlineStyle(content)
675
685
  },
676
- truncated
686
+ truncated: windowTruncated || budgetTruncated
677
687
  };
678
688
  }
679
689
  async function readSnippetsTool(input, context) {
@@ -1056,37 +1066,35 @@ outputPath: ${fullOutputPath}`,
1056
1066
  }
1057
1067
  };
1058
1068
  }
1069
+ const commandForLog = adapted.logCommand ?? adapted.command;
1070
+ const adapterLines = adapted.command === input.command && adapted.adapter === "native" ? [] : [
1071
+ `adapter ${adapted.adapter}`,
1072
+ `original command ${summarizeOriginalShellCommand(input.command)}`
1073
+ ];
1059
1074
  const result = await runShell(
1060
1075
  adapted.command,
1061
1076
  context.workspaceRoot,
1062
1077
  timeoutMs,
1078
+ fullOutputPath,
1079
+ [`$ ${sanitizeSecrets(commandForLog)}`, ...adapterLines],
1063
1080
  context.abortSignal,
1064
1081
  (stream, text) => void context.onProgress?.({ toolName: "Bash", stream, text }),
1065
1082
  context.trackChildProcess
1066
1083
  );
1067
- const adapterLines = adapted.command === input.command && adapted.adapter === "native" ? [] : [
1068
- `adapter ${adapted.adapter}`,
1069
- `original command ${summarizeOriginalShellCommand(input.command)}`
1070
- ];
1071
- const commandForLog = adapted.logCommand ?? adapted.command;
1072
- const sanitizedShellOutput = sanitizeSecrets(result.output);
1073
1084
  const cmdInterpretation = interpretCommandResult(input.command, result.exitCode);
1074
- const rawFullText = [
1075
- `$ ${sanitizeSecrets(commandForLog)}`,
1076
- ...adapterLines,
1085
+ const diagnostics = createBashOutcomeDiagnostics(result.outcome);
1086
+ const trailerLines = [
1087
+ "",
1077
1088
  `exit code ${result.exitCode}`,
1078
1089
  `outcome ${result.outcome}`,
1079
- ...cmdInterpretation.message ? [`returnCodeInterpretation: ${cmdInterpretation.message}`] : [],
1080
- "",
1081
- sanitizedShellOutput
1082
- ].join("\n");
1083
- const diagnostics = createBashOutcomeDiagnostics(result.outcome);
1084
- const fullText = rawFullText;
1085
- await writeFile(fullOutputPath, fullText, "utf8");
1086
- const truncated = fullText.length > BASH_PREVIEW_LIMIT;
1087
- const preview = truncated ? `${fullText.slice(0, BASH_PREVIEW_LIMIT)}
1088
- ...\uFF08\u8F93\u51FA\u5DF2\u622A\u65AD\uFF0C\u5B8C\u6574\u65E5\u5FD7\u89C1 fullOutputPath\uFF09` : fullText;
1089
- const details = createBashDetails(fullOutputPath, fullText);
1090
+ ...cmdInterpretation.message ? [`returnCodeInterpretation: ${cmdInterpretation.message}`] : []
1091
+ ];
1092
+ await appendFileToPath(fullOutputPath, `${trailerLines.join("\n")}
1093
+ `);
1094
+ result.capture.appendLogOnly(`${trailerLines.join("\n")}
1095
+ `);
1096
+ const preview = result.capture.getPreview(BASH_OUTPUT_TRUNCATION_NOTICE);
1097
+ const details = createBashDetails(fullOutputPath, result.capture);
1090
1098
  const data = adapted.adapter === "native" ? { exitCode: result.exitCode, outcome: result.outcome } : { exitCode: result.exitCode, outcome: result.outcome, adapter: adapted.adapter };
1091
1099
  const outputData = {
1092
1100
  ...data,
@@ -1094,6 +1102,7 @@ outputPath: ${fullOutputPath}`,
1094
1102
  ...cmdInterpretation.isError === false && result.exitCode !== 0 ? { isError: false } : {},
1095
1103
  ...diagnostics.length > 0 ? { diagnostics } : {}
1096
1104
  };
1105
+ const truncated = result.capture.isTruncated();
1097
1106
  return {
1098
1107
  text: preview,
1099
1108
  details,
@@ -1102,15 +1111,53 @@ outputPath: ${fullOutputPath}`,
1102
1111
  fullOutputPath
1103
1112
  };
1104
1113
  }
1105
- function createBashDetails(fullOutputPath, fullText) {
1114
+ function createBashDetails(fullOutputPath, capture) {
1106
1115
  return [
1107
1116
  `fullOutputPath: ${fullOutputPath}`,
1108
1117
  "--- summary",
1109
- ...fullText.split(/\r?\n/u).slice(0, 8),
1118
+ ...capture.getSummaryLines(8),
1110
1119
  "--- tail",
1111
- ...tailLines(fullText, 80)
1120
+ ...capture.getTailLines(BASH_DETAILS_TAIL_LINES)
1112
1121
  ].join("\n");
1113
1122
  }
1123
+ function createBashOutputCapture() {
1124
+ let outputPreview = "";
1125
+ let outputChars = 0;
1126
+ let summaryText = "";
1127
+ let tailText = "";
1128
+ const summaryCharLimit = 8e3;
1129
+ const tailCharLimit = 64e3;
1130
+ const appendLogText = (text) => {
1131
+ if (!text) return;
1132
+ if (summaryText.length < summaryCharLimit) {
1133
+ summaryText += text.slice(0, summaryCharLimit - summaryText.length);
1134
+ }
1135
+ tailText = `${tailText}${text}`;
1136
+ if (tailText.length > tailCharLimit) {
1137
+ tailText = tailText.slice(tailText.length - tailCharLimit);
1138
+ }
1139
+ };
1140
+ const appendOutputText = (text) => {
1141
+ if (!text) return;
1142
+ outputChars += text.length;
1143
+ if (outputPreview.length < BASH_PREVIEW_LIMIT) {
1144
+ outputPreview += text.slice(0, BASH_PREVIEW_LIMIT - outputPreview.length);
1145
+ }
1146
+ appendLogText(text);
1147
+ };
1148
+ return {
1149
+ appendOutput: appendOutputText,
1150
+ appendSystem: appendOutputText,
1151
+ appendLogOnly: appendLogText,
1152
+ getPreview: (truncationNotice) => outputChars > BASH_PREVIEW_LIMIT ? `${outputPreview.slice(0, Math.max(0, BASH_PREVIEW_LIMIT - truncationNotice.length))}${truncationNotice}` : outputPreview,
1153
+ getSummaryLines: (limit) => summaryText.split(/\r?\n/u).slice(0, limit),
1154
+ getTailLines: (limit) => tailLines(tailText, limit),
1155
+ isTruncated: () => outputChars > BASH_PREVIEW_LIMIT
1156
+ };
1157
+ }
1158
+ async function appendFileToPath(path, text) {
1159
+ await appendFile(path, text, "utf8");
1160
+ }
1114
1161
  var BINARY_HINT_EXTENSIONS = [
1115
1162
  ".bin",
1116
1163
  ".elf",
@@ -1619,15 +1666,20 @@ function adaptShellCommand(command) {
1619
1666
  }
1620
1667
  function adaptShellCommandForPlatform(command, platform) {
1621
1668
  if (platform !== "win32") return { command, adapter: "native" };
1669
+ if (isExplicitPowerShellCommand(command)) return { command, adapter: "native" };
1670
+ const fileWriteBlock = blockWindowsShellFileWriteCommand(command);
1671
+ if (fileWriteBlock) return fileWriteBlock;
1622
1672
  const heredoc = convertNodeHereDocForPowerShell(command);
1623
1673
  if (heredoc) return heredoc;
1674
+ const nativePowerShell = convertNativePowerShellCommand(command);
1675
+ if (nativePowerShell) return nativePowerShell;
1624
1676
  if (looksLikeUnsupportedUnixMultiline(command)) {
1625
1677
  return createBlockedPowerShellAdapter(
1626
1678
  "Unsupported multi-line Unix shell syntax on Windows PowerShell; use PowerShell-safe commands or Node one-liners."
1627
1679
  );
1628
1680
  }
1629
- const nativePowerShell = convertNativePowerShellCommand(command);
1630
- if (nativePowerShell) return nativePowerShell;
1681
+ const unsupportedPosix = blockUnsupportedPosixShellSyntax(command);
1682
+ if (unsupportedPosix) return unsupportedPosix;
1631
1683
  const converted = convertUnixPipelineForPowerShell(command);
1632
1684
  if (converted) return { command: converted, adapter: "powershell-adapted" };
1633
1685
  const readOnlyCommand = convertUnixReadOnlyCommandForPowerShell(command);
@@ -1640,11 +1692,26 @@ function adaptShellCommandForPlatform(command, platform) {
1640
1692
  if (unsupportedReadOnlyCommand) return unsupportedReadOnlyCommand;
1641
1693
  return { command, adapter: "native" };
1642
1694
  }
1695
+ function isExplicitPowerShellCommand(command) {
1696
+ return /^(?:powershell(?:\.exe)?|pwsh(?:\.exe)?)\b/iu.test(command.trim());
1697
+ }
1698
+ var WINDOWS_SHELL_WRITE_BLOCK_MESSAGE = "Linghun Bash does not support shell apply_patch or heredoc file writes on Windows; use Edit/MultiEdit/Write structured tools instead.";
1699
+ function blockWindowsShellFileWriteCommand(command) {
1700
+ const normalized = command.replace(/\r\n/gu, "\n").trim();
1701
+ if (!normalized) return void 0;
1702
+ if (/\bapply_patch\b/iu.test(normalized) && (/(?:^|\n|;)\s*apply_patch\s*<</iu.test(normalized) || /@['"][\s\S]*?['"]@\s*\|\s*apply_patch\b/iu.test(normalized) || /\$[A-Za-z_][\w]*\s*=\s*@['"][\s\S]*?['"]@/u.test(normalized) || /\$[A-Za-z_][\w]*\s*\|\s*apply_patch\b/u.test(normalized))) {
1703
+ return createBlockedPowerShellAdapter(WINDOWS_SHELL_WRITE_BLOCK_MESSAGE);
1704
+ }
1705
+ if (/(?:^|\n|;)\s*cat\b[^\n;]*>\s*\S+/iu.test(normalized) || /(?:^|\n|;)\s*cat\b[^\n;]*<<[^\n]*>\s*\S+/iu.test(normalized) || /(?:^|\n|;)\s*tee\b\s+\S+/iu.test(normalized)) {
1706
+ return createBlockedPowerShellAdapter(WINDOWS_SHELL_WRITE_BLOCK_MESSAGE);
1707
+ }
1708
+ return void 0;
1709
+ }
1643
1710
  function convertNativePowerShellCommand(command) {
1644
1711
  const normalized = command.trim();
1645
1712
  if (!normalized) return void 0;
1646
- if (/^(?:powershell(?:\.exe)?|pwsh(?:\.exe)?)\b/iu.test(normalized)) return void 0;
1647
- if (!/^(?:Get|Set|New|Remove|Select|ForEach|Where|Test|Resolve|Join|Split|Copy|Move|Write|Out|Measure|Compare|Sort|Format)-[A-Za-z]+\b/u.test(normalized)) {
1713
+ if (isExplicitPowerShellCommand(normalized)) return void 0;
1714
+ if (!looksLikePowerShellScript(normalized)) {
1648
1715
  return void 0;
1649
1716
  }
1650
1717
  return {
@@ -1653,9 +1720,45 @@ function convertNativePowerShellCommand(command) {
1653
1720
  quoteCmdArg(`$ErrorActionPreference='Stop'; ${normalized}`)
1654
1721
  ].join(" "),
1655
1722
  adapter: "powershell-adapted",
1656
- logCommand: `powershell.exe -NoProfile -NonInteractive -Command <powershell cmdlet>`
1723
+ logCommand: `powershell.exe -NoProfile -NonInteractive -Command <powershell script>`
1657
1724
  };
1658
1725
  }
1726
+ function looksLikePowerShellScript(command) {
1727
+ const normalized = command.trim();
1728
+ if (/^\$[A-Za-z_][\w]*\s*=/u.test(normalized)) return true;
1729
+ if (/^\$PWD\.Path\b/iu.test(normalized)) return true;
1730
+ if (/@['"][\s\S]*?['"]@/u.test(normalized)) return true;
1731
+ if (/^\$[A-Za-z_][\w]*\s*\|/u.test(normalized) || /;\s*\$[A-Za-z_][\w]*\s*\|/u.test(normalized)) {
1732
+ return true;
1733
+ }
1734
+ const cmdlet = /\b(?:Get|Set|New|Remove|Select|ForEach|Where|Test|Resolve|Join|Split|Copy|Move|Write|Out|Measure|Compare|Sort|Format)-[A-Za-z]+\b/u;
1735
+ if (!cmdlet.test(normalized)) return false;
1736
+ if (/^(?:Get|Set|New|Remove|Select|ForEach|Where|Test|Resolve|Join|Split|Copy|Move|Write|Out|Measure|Compare|Sort|Format)-[A-Za-z]+\b/u.test(normalized)) {
1737
+ return true;
1738
+ }
1739
+ return /[;|]/u.test(normalized) || /\$[A-Za-z_][\w]*(?:\.|\s*\|)/u.test(normalized);
1740
+ }
1741
+ function blockUnsupportedPosixShellSyntax(command) {
1742
+ const normalized = command.replace(/\r\n/gu, "\n").trim();
1743
+ if (!normalized) return void 0;
1744
+ const message = "Unsupported POSIX shell syntax on Windows; use PowerShell-safe commands, Node one-liners, or structured tools.";
1745
+ if (/<<\s*['"]?[A-Za-z_][\w.-]*['"]?/u.test(normalized)) {
1746
+ return createBlockedPowerShellAdapter(message);
1747
+ }
1748
+ if (/(?:^|\n|;)\s*export\s+[A-Za-z_][\w]*=/u.test(normalized)) {
1749
+ return createBlockedPowerShellAdapter(message);
1750
+ }
1751
+ if (/^(?:[A-Za-z_][\w]*=[^\s]+\s+)+\S+/u.test(normalized)) {
1752
+ return createBlockedPowerShellAdapter(message);
1753
+ }
1754
+ if (/\$\([^)]*\)/u.test(normalized)) {
1755
+ return createBlockedPowerShellAdapter(message);
1756
+ }
1757
+ if (/\n/u.test(normalized)) {
1758
+ return createBlockedPowerShellAdapter(message);
1759
+ }
1760
+ return void 0;
1761
+ }
1659
1762
  function convertNodeHereDocForPowerShell(command) {
1660
1763
  const normalized = command.replace(/\r\n/gu, "\n");
1661
1764
  const match = normalized.match(
@@ -2068,6 +2171,8 @@ function rememberReadSnapshot(context, filePath, content, info) {
2068
2171
  function createEditOutput(context, operation, filePath, before, after, readGuard, editCount = 1) {
2069
2172
  const rel = relativePath(context.workspaceRoot, filePath);
2070
2173
  const summary = createPatchSummary([rel], before, after);
2174
+ const structuredPatch = createStructuredPatch(rel, before, after);
2175
+ const patchHunks = structuredPatch.files.flatMap((file) => file.hunks);
2071
2176
  context.patchSummaries = { ...context.patchSummaries ?? {}, [rel]: summary };
2072
2177
  const newlineBefore = detectNewlineStyle(before);
2073
2178
  const newlineAfter = detectNewlineStyle(after);
@@ -2093,11 +2198,57 @@ function createEditOutput(context, operation, filePath, before, after, readGuard
2093
2198
  afterHash: hashText(after),
2094
2199
  newlineBefore,
2095
2200
  newlineAfter,
2096
- encoding: "utf8"
2201
+ encoding: "utf8",
2202
+ structuredPatch,
2203
+ patchHunks
2097
2204
  },
2098
2205
  changedFiles: [rel]
2099
2206
  };
2100
2207
  }
2208
+ var STRUCTURED_PATCH_LINE_LIMIT = 120;
2209
+ var STRUCTURED_PATCH_CONTEXT_LINES = 3;
2210
+ function createStructuredPatch(path, before, after) {
2211
+ const beforeLines = splitPatchLines(before);
2212
+ const afterLines = splitPatchLines(after);
2213
+ const hunk = createPatchHunk(beforeLines, afterLines);
2214
+ return { files: [{ path, hunks: hunk ? [hunk] : [] }] };
2215
+ }
2216
+ function splitPatchLines(content) {
2217
+ if (content.length === 0) return [];
2218
+ return content.replace(/\r\n/gu, "\n").replace(/\n$/u, "").split("\n");
2219
+ }
2220
+ function createPatchHunk(beforeLines, afterLines) {
2221
+ let prefix = 0;
2222
+ while (prefix < beforeLines.length && prefix < afterLines.length && beforeLines[prefix] === afterLines[prefix]) {
2223
+ prefix += 1;
2224
+ }
2225
+ let suffix = 0;
2226
+ while (suffix < beforeLines.length - prefix && suffix < afterLines.length - prefix && beforeLines[beforeLines.length - 1 - suffix] === afterLines[afterLines.length - 1 - suffix]) {
2227
+ suffix += 1;
2228
+ }
2229
+ const oldLines = beforeLines.slice(prefix, beforeLines.length - suffix);
2230
+ const newLines = afterLines.slice(prefix, afterLines.length - suffix);
2231
+ if (oldLines.length === 0 && newLines.length === 0) return void 0;
2232
+ const contextBefore = beforeLines.slice(
2233
+ Math.max(0, prefix - STRUCTURED_PATCH_CONTEXT_LINES),
2234
+ prefix
2235
+ );
2236
+ const contextAfter = beforeLines.slice(
2237
+ beforeLines.length - suffix,
2238
+ Math.min(beforeLines.length - suffix + STRUCTURED_PATCH_CONTEXT_LINES, beforeLines.length)
2239
+ );
2240
+ return {
2241
+ oldStart: oldLines.length > 0 ? prefix + 1 : prefix,
2242
+ newStart: newLines.length > 0 ? prefix + 1 : prefix,
2243
+ contextBefore,
2244
+ oldLines: oldLines.slice(0, STRUCTURED_PATCH_LINE_LIMIT),
2245
+ newLines: newLines.slice(0, STRUCTURED_PATCH_LINE_LIMIT),
2246
+ contextAfter,
2247
+ oldLineCount: oldLines.length,
2248
+ newLineCount: newLines.length,
2249
+ truncated: oldLines.length > STRUCTURED_PATCH_LINE_LIMIT || newLines.length > STRUCTURED_PATCH_LINE_LIMIT
2250
+ };
2251
+ }
2101
2252
  function createPatchSummary(changedFiles, before, after) {
2102
2253
  const beforeLines = before.length > 0 ? before.split(/\r?\n/u) : [];
2103
2254
  const afterLines = after.length > 0 ? after.split(/\r?\n/u) : [];
@@ -2517,7 +2668,7 @@ function globToRegExp(pattern) {
2517
2668
  }
2518
2669
  return new RegExp(result);
2519
2670
  }
2520
- function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess) {
2671
+ function runShell(command, cwd, timeoutMs, fullOutputPath, headerLines, signal, onProgress, trackChildProcess) {
2521
2672
  return new Promise((resolvePromise) => {
2522
2673
  const detached = process.platform !== "win32";
2523
2674
  const child = spawn(command, { cwd, shell: true, windowsHide: true, detached });
@@ -2527,12 +2678,27 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2527
2678
  label: `Bash:${command.slice(0, 80)}`,
2528
2679
  retainAfterExit: detached
2529
2680
  });
2530
- let output = "";
2681
+ const capture = createBashOutputCapture();
2682
+ let logWrite = writeFile(fullOutputPath, `${headerLines.join("\n")}
2683
+
2684
+ `, "utf8");
2685
+ capture.appendLogOnly(`${headerLines.join("\n")}
2686
+
2687
+ `);
2688
+ const appendSanitizedChunk = (text, countAsOutput) => {
2689
+ const sanitized = sanitizeSecrets(text);
2690
+ if (countAsOutput) {
2691
+ capture.appendOutput(sanitized);
2692
+ } else {
2693
+ capture.appendLogOnly(sanitized);
2694
+ }
2695
+ logWrite = logWrite.then(() => appendFileToPath(fullOutputPath, sanitized));
2696
+ };
2531
2697
  let settled = false;
2532
2698
  let forcedKillTimer;
2533
2699
  let stoppingOutcome;
2534
2700
  let childClosed = false;
2535
- const finish = (exitCode, nextOutput = output, outcome = "completed") => {
2701
+ const finish = (exitCode, outcome = "completed") => {
2536
2702
  if (settled) {
2537
2703
  return;
2538
2704
  }
@@ -2542,7 +2708,7 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2542
2708
  clearTimeout(forcedKillTimer);
2543
2709
  }
2544
2710
  signal?.removeEventListener("abort", onAbort);
2545
- resolvePromise({ exitCode, output: nextOutput, outcome });
2711
+ void logWrite.finally(() => resolvePromise({ exitCode, capture, outcome }));
2546
2712
  };
2547
2713
  const waitForChildClose = () => new Promise((resolveClose) => {
2548
2714
  if (childClosed || child.exitCode !== null || child.signalCode !== null) {
@@ -2576,10 +2742,9 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2576
2742
  }, 1e3);
2577
2743
  };
2578
2744
  const onAbort = async () => {
2579
- const message = "\n\u5DE5\u5177\u8C03\u7528\u5DF2\u53D6\u6D88\uFF0C\u6B63\u5728\u7EC8\u6B62\u5B50\u8FDB\u7A0B\u3002";
2580
- output += message;
2581
- onProgress?.("system", `${message}
2582
- `);
2745
+ const message = "\n\u5DE5\u5177\u8C03\u7528\u5DF2\u53D6\u6D88\uFF0C\u6B63\u5728\u7EC8\u6B62\u5B50\u8FDB\u7A0B\u3002\n";
2746
+ appendSanitizedChunk(message, true);
2747
+ onProgress?.("system", message);
2583
2748
  stoppingOutcome = "cancelled";
2584
2749
  if (process.platform === "win32") {
2585
2750
  await requestStop(true);
@@ -2587,17 +2752,17 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2587
2752
  void requestStop(false);
2588
2753
  scheduleForceStop();
2589
2754
  }
2590
- finish(1, output, "cancelled");
2755
+ finish(1, "cancelled");
2591
2756
  };
2592
2757
  const timer = setTimeout(() => {
2593
2758
  void handleTimeout();
2594
2759
  }, timeoutMs);
2595
2760
  const handleTimeout = async () => {
2596
2761
  const message = `
2597
- \u547D\u4EE4\u8D85\u65F6\uFF1A\u8D85\u8FC7 ${timeoutMs}ms\uFF0C\u5DF2\u5C1D\u8BD5\u7EC8\u6B62\u5B50\u8FDB\u7A0B\u3002`;
2598
- output += message;
2599
- onProgress?.("system", `${message}
2600
- `);
2762
+ \u547D\u4EE4\u8D85\u65F6\uFF1A\u8D85\u8FC7 ${timeoutMs}ms\uFF0C\u5DF2\u5C1D\u8BD5\u7EC8\u6B62\u5B50\u8FDB\u7A0B\u3002
2763
+ `;
2764
+ appendSanitizedChunk(message, true);
2765
+ onProgress?.("system", message);
2601
2766
  stoppingOutcome = "timeout";
2602
2767
  if (process.platform === "win32") {
2603
2768
  await requestStop(true);
@@ -2605,21 +2770,21 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2605
2770
  void requestStop(false);
2606
2771
  scheduleForceStop();
2607
2772
  }
2608
- finish(1, output, "timeout");
2773
+ finish(1, "timeout");
2609
2774
  };
2610
2775
  if (signal?.aborted) {
2611
- onAbort();
2776
+ void onAbort();
2612
2777
  return;
2613
2778
  }
2614
2779
  signal?.addEventListener("abort", onAbort, { once: true });
2615
2780
  child.stdout.on("data", (chunk) => {
2616
2781
  const text = decodeShellChunk(chunk);
2617
- output += text;
2782
+ appendSanitizedChunk(text, true);
2618
2783
  onProgress?.("stdout", text);
2619
2784
  });
2620
2785
  child.stderr.on("data", (chunk) => {
2621
2786
  const text = decodeShellChunk(chunk);
2622
- output += text;
2787
+ appendSanitizedChunk(text, true);
2623
2788
  onProgress?.("stderr", text);
2624
2789
  });
2625
2790
  child.on("close", (code) => {
@@ -2630,7 +2795,9 @@ function runShell(command, cwd, timeoutMs, signal, onProgress, trackChildProcess
2630
2795
  finish(code ?? 1);
2631
2796
  });
2632
2797
  child.on("error", (error) => {
2633
- finish(1, `\u547D\u4EE4\u6267\u884C\u5931\u8D25\uFF1A${error.message}`);
2798
+ appendSanitizedChunk(`\u547D\u4EE4\u6267\u884C\u5931\u8D25\uFF1A${error.message}
2799
+ `, true);
2800
+ finish(1);
2634
2801
  });
2635
2802
  });
2636
2803
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  GlobTool
3
- } from "../../chunk-DN3KJZRV.js";
4
- import "../../chunk-2U4BZXAI.js";
3
+ } from "../../chunk-Z3H6SZBS.js";
5
4
  import "../../chunk-ITBZHMZQ.js";
5
+ import "../../chunk-2U4BZXAI.js";
6
6
  export {
7
7
  GlobTool
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MultiEditTool
3
- } from "../../chunk-3NZ3IOPM.js";
4
- import "../../chunk-IOC3BSPT.js";
3
+ } from "../../chunk-VJDLOFCF.js";
5
4
  import "../../chunk-3RP665TH.js";
5
+ import "../../chunk-IOC3BSPT.js";
6
6
  export {
7
7
  MultiEditTool
8
8
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toolPrompts
3
- } from "../chunk-ZGLZZKO6.js";
4
- import "../chunk-4EZHIDZ6.js";
5
- import "../chunk-I3Z4OKMS.js";
6
- import "../chunk-PS2ZOFZ6.js";
7
- import "../chunk-NPKLGVDQ.js";
3
+ } from "../chunk-VVRFYPMG.js";
8
4
  import "../chunk-LGZOG7IQ.js";
9
5
  import "../chunk-ZYAEUABC.js";
10
6
  import "../chunk-SWK6XRZQ.js";
7
+ import "../chunk-4EZHIDZ6.js";
11
8
  import "../chunk-YR4HWOR2.js";
12
9
  import "../chunk-VAFW24RN.js";
10
+ import "../chunk-I3Z4OKMS.js";
11
+ import "../chunk-PS2ZOFZ6.js";
12
+ import "../chunk-NPKLGVDQ.js";
13
13
  import "../chunk-TZ6QK52L.js";
14
14
  import "../chunk-K3YDFDLP.js";
15
15
  import "../chunk-GI5XI4HN.js";
@@ -22,19 +22,19 @@ import "../chunk-SZFZPQGL.js";
22
22
  import "../chunk-AZCQL24J.js";
23
23
  import "../chunk-HUIZOB4A.js";
24
24
  import "../chunk-MK3YP2VR.js";
25
+ import "../chunk-VJDLOFCF.js";
26
+ import "../chunk-3RP665TH.js";
27
+ import "../chunk-IOC3BSPT.js";
28
+ import "../chunk-HNIVNZIS.js";
25
29
  import "../chunk-WLQ7DGMG.js";
26
30
  import "../chunk-SQP6SJRP.js";
27
31
  import "../chunk-BRG64AEC.js";
28
- import "../chunk-HNIVNZIS.js";
32
+ import "../chunk-Z3H6SZBS.js";
33
+ import "../chunk-ITBZHMZQ.js";
34
+ import "../chunk-2U4BZXAI.js";
29
35
  import "../chunk-7ZOADACP.js";
30
36
  import "../chunk-H5OOD2OS.js";
31
37
  import "../chunk-IQP3XE32.js";
32
- import "../chunk-DN3KJZRV.js";
33
- import "../chunk-2U4BZXAI.js";
34
- import "../chunk-ITBZHMZQ.js";
35
- import "../chunk-3NZ3IOPM.js";
36
- import "../chunk-IOC3BSPT.js";
37
- import "../chunk-3RP665TH.js";
38
38
  import "../chunk-2DIXRINW.js";
39
39
  import "../chunk-PKMIDA5A.js";
40
40
  import "../chunk-GAWMEMXB.js";
package/dist/tools/ui.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  toolUserFacingNames
3
- } from "../chunk-6BBM4UX3.js";
4
- import "../chunk-4EZHIDZ6.js";
5
- import "../chunk-I3Z4OKMS.js";
6
- import "../chunk-PS2ZOFZ6.js";
7
- import "../chunk-NPKLGVDQ.js";
3
+ } from "../chunk-24USSE7U.js";
8
4
  import "../chunk-LGZOG7IQ.js";
9
5
  import "../chunk-ZYAEUABC.js";
10
6
  import "../chunk-SWK6XRZQ.js";
7
+ import "../chunk-4EZHIDZ6.js";
11
8
  import "../chunk-YR4HWOR2.js";
12
9
  import "../chunk-VAFW24RN.js";
10
+ import "../chunk-I3Z4OKMS.js";
11
+ import "../chunk-PS2ZOFZ6.js";
12
+ import "../chunk-NPKLGVDQ.js";
13
13
  import "../chunk-TZ6QK52L.js";
14
14
  import "../chunk-K3YDFDLP.js";
15
15
  import "../chunk-GI5XI4HN.js";
@@ -22,19 +22,19 @@ import "../chunk-SZFZPQGL.js";
22
22
  import "../chunk-AZCQL24J.js";
23
23
  import "../chunk-HUIZOB4A.js";
24
24
  import "../chunk-MK3YP2VR.js";
25
+ import "../chunk-VJDLOFCF.js";
26
+ import "../chunk-3RP665TH.js";
27
+ import "../chunk-IOC3BSPT.js";
28
+ import "../chunk-HNIVNZIS.js";
25
29
  import "../chunk-WLQ7DGMG.js";
26
30
  import "../chunk-SQP6SJRP.js";
27
31
  import "../chunk-BRG64AEC.js";
28
- import "../chunk-HNIVNZIS.js";
32
+ import "../chunk-Z3H6SZBS.js";
33
+ import "../chunk-ITBZHMZQ.js";
34
+ import "../chunk-2U4BZXAI.js";
29
35
  import "../chunk-7ZOADACP.js";
30
36
  import "../chunk-H5OOD2OS.js";
31
37
  import "../chunk-IQP3XE32.js";
32
- import "../chunk-DN3KJZRV.js";
33
- import "../chunk-2U4BZXAI.js";
34
- import "../chunk-ITBZHMZQ.js";
35
- import "../chunk-3NZ3IOPM.js";
36
- import "../chunk-IOC3BSPT.js";
37
- import "../chunk-3RP665TH.js";
38
38
  import "../chunk-2DIXRINW.js";
39
39
  import "../chunk-PKMIDA5A.js";
40
40
  import "../chunk-GAWMEMXB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linghun/tools",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,15 +11,19 @@
11
11
  "import": "./dist/index.js"
12
12
  }
13
13
  },
14
- "files": ["dist", "!dist/**/*.test.*", "!dist/**/tsconfig.tsbuildinfo"],
14
+ "files": [
15
+ "dist",
16
+ "!dist/**/*.test.*",
17
+ "!dist/**/tsconfig.tsbuildinfo"
18
+ ],
15
19
  "publishConfig": {
16
20
  "access": "public"
17
21
  },
22
+ "dependencies": {
23
+ "parse5": "^8.0.1"
24
+ },
18
25
  "scripts": {
19
26
  "build": "tsup \"src/**/*.ts\" \"!src/**/*.test.ts\" --format esm --clean && tsc -p tsconfig.json --emitDeclarationOnly --noEmit false --tsBuildInfoFile dist/tsconfig.tsbuildinfo",
20
27
  "typecheck": "tsc -p tsconfig.json --noEmit"
21
- },
22
- "dependencies": {
23
- "parse5": "^8.0.1"
24
28
  }
25
- }
29
+ }
@@ -1,9 +1,9 @@
1
- import {
2
- userFacingName
3
- } from "./chunk-IOC3BSPT.js";
4
1
  import {
5
2
  prompt
6
3
  } from "./chunk-3RP665TH.js";
4
+ import {
5
+ userFacingName
6
+ } from "./chunk-IOC3BSPT.js";
7
7
 
8
8
  // src/tools/MultiEdit/MultiEditTool.ts
9
9
  var MultiEditTool = { name: "MultiEdit", prompt, userFacingName };
@@ -1,9 +1,9 @@
1
- import {
2
- prompt
3
- } from "./chunk-2U4BZXAI.js";
4
1
  import {
5
2
  userFacingName
6
3
  } from "./chunk-ITBZHMZQ.js";
4
+ import {
5
+ prompt
6
+ } from "./chunk-2U4BZXAI.js";
7
7
 
8
8
  // src/tools/Glob/GlobTool.ts
9
9
  var GlobTool = { name: "Glob", prompt, userFacingName };