difit 5.0.6 → 5.0.8
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/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/cli/comment.js +56 -14
- package/dist/cli/comment.test.js +93 -1
- package/dist/cli/utils.js +1 -1
- package/dist/client/assets/{arc-jpxKSIAg.js → arc-Ce71GpYh.js} +1 -1
- package/dist/client/assets/architecture-7EHR7CIX-DJuaV-Fy.js +1 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-B92ZxjNC.js → architectureDiagram-3BPJPVTR-Co4nMikn.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-D3ySUhR3.js → blockDiagram-GPEHLZMM-BZ8XmnOe.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BUzdNEmx.js → c4Diagram-AAUBKEIU-Bifc6015.js} +1 -1
- package/dist/client/assets/channel-DCmC_NJ8.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-1DQ-4Bz3.js → chunk-2J33WTMH-BKZtrrMM.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-BQmtgKnq.js → chunk-3OPIFGDE-p1HDQKHx.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-DFX6Qy74.js → chunk-4BX2VUAB-B1JdC880.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DtWki8a-.js → chunk-55IACEB6-BfDdrInp.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-uSJ_ZgCu.js → chunk-5ZQYHXKU-B0UFDeNc.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-BB6xZgSD.js → chunk-727SXJPM-C1GLS2mt.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-B1Cm665s.js → chunk-AQP2D5EJ-CdhTjctN.js} +1 -1
- package/dist/client/assets/{chunk-BSJP7CBP-C15Vti01.js → chunk-BSJP7CBP-8ezJh_7H.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-CaTF_T3W.js → chunk-CSCIHK7Q-DNeLjTAX.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-D1irlAGU.js → chunk-FMBD7UC4-CwtitMT8.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-DGAjxObb.js → chunk-KSCS5N6A-DdLtmoYV.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-F5Tij0A9.js → chunk-L5ZTLDWV-DZrSg_8S.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-BkUKm4Z2.js → chunk-LZXEDZCA-CPsWjeej.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-C0rukZcz.js → chunk-ND2GUHAM-B3wT6dSk.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-DRm_z6tq.js → chunk-NZK2D7GU-DTCItxUJ.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-BAuwNGEL.js → chunk-O5CBEL6O-HSc7nkWp.js} +1 -1
- package/dist/client/assets/chunk-QZHKN3VN-Dl7i9TFZ.js +1 -0
- package/dist/client/assets/chunk-WU5MYG2G-H9-XOWa2.js +1 -0
- package/dist/client/assets/{chunk-XPW4576I-2r3neXxa.js → chunk-XPW4576I-DWA1L2SH.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CIis5MpW.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CIis5MpW.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BF8GqjYH.js → cose-bilkent-S5V4N54A-BA0dewjs.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-BcWO-l21.js → dagre-BM42HDAG-DQ6amw4B.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-ChdDM46l.js → diagram-2AECGRRQ-lt3q0PPx.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-DOPYGuMt.js → diagram-5GNKFQAL-RN_cFqeH.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-D6gmyyoA.js → diagram-KO2AKTUF-69-WWf-i.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-C93nmtac.js → diagram-LMA3HP47-CJp_AQpE.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-Cgm6DAM8.js → diagram-OG6HWLK6-ld8yVyEO.js} +1 -1
- package/dist/client/assets/{dist-C7Q1SrJ8.js → dist-MrZ1zwt-.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-WzvVTKP0.js → erDiagram-TEJ5UH35-C9-9-98D.js} +1 -1
- package/dist/client/assets/eventmodeling-FCH6USID-sUz5BqkA.js +1 -0
- package/dist/client/assets/{flowDiagram-I6XJVG4X-BRAzB7RU.js → flowDiagram-I6XJVG4X-BIWAxSyl.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-Bned6Md4.js → ganttDiagram-6RSMTGT7-DEekfrSb.js} +1 -1
- package/dist/client/assets/{gitGraph-WXDBUCRP-BsCF41a6.js → gitGraph-WXDBUCRP-iLmA5ZOg.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-sjN-t2iw.js → gitGraphDiagram-PVQCEYII-Cp9no67W.js} +1 -1
- package/dist/client/assets/index-D6ilk_N-.js +83 -0
- package/dist/client/assets/index-DJEQpFaQ.css +2 -0
- package/dist/client/assets/{info-J43DQDTF-BnH-OC8Z.js → info-J43DQDTF-WGiiYO2H.js} +1 -1
- package/dist/client/assets/{infoDiagram-5YYISTIA-s8VJEWX-.js → infoDiagram-5YYISTIA-DSq2paHS.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-Cr3iGWKj.js → ishikawaDiagram-YF4QCWOH-BRvjhcHO.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DsSeOYHM.js → journeyDiagram-JHISSGLW-BeojzJiQ.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU--hgCxMq5.js → kanban-definition-UN3LZRKU-Cxd2TSzC.js} +1 -1
- package/dist/client/assets/{line-BgzUTU3B.js → line-DfNX00iH.js} +1 -1
- package/dist/client/assets/{linear-Cj1FBal1.js → linear-BqTigxmw.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-oUly7wXy.js → mermaid-parser.core-B_EZyTa5.js} +2 -2
- package/dist/client/assets/{mermaid.core-QvJGj5O5.js → mermaid.core-Ssrtijme.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-Cwyk4Byp.js → mindmap-definition-RKZ34NQL-CFexQB41.js} +1 -1
- package/dist/client/assets/{packet-YPE3B663-C559rspA.js → packet-YPE3B663-DWRftxLl.js} +1 -1
- package/dist/client/assets/{pie-LRSECV5Y-DZyJ170B.js → pie-LRSECV5Y-FBJQi9YS.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-lGuBsE2s.js → pieDiagram-4H26LBE5-rWmojAfB.js} +1 -1
- package/dist/client/assets/prism-gdscript-C1gnCftx.js +1 -0
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-BCczJuw5.js → quadrantDiagram-W4KKPZXB-ClhgNDn7.js} +1 -1
- package/dist/client/assets/{radar-GUYGQ44K-Ckz6UanW.js → radar-GUYGQ44K-C948fgjI.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-C4-ojYg3.js → requirementDiagram-4Y6WPE33-BuMMQGw0.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CFpy-I_l.js → sankeyDiagram-5OEKKPKP-CEd3YUpA.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DmD28UaM.js → sequenceDiagram-3UESZ5HK-DgsZJ52B.js} +1 -1
- package/dist/client/assets/{src-BWoEPgyG.js → src-CAgFxagX.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-BNaiNMdT.js → stateDiagram-AJRCARHV-Cg0npyBC.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-CpV01lL-.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-DQyT9Hys.js → timeline-definition-PNZ67QCA-Be8CZnBb.js} +1 -1
- package/dist/client/assets/{treeView-BLDUP644-BDNxHT3u.js → treeView-BLDUP644-B4fII_xt.js} +1 -1
- package/dist/client/assets/{treemap-LRROVOQU-mnVB3buf.js → treemap-LRROVOQU-Dy2AIK2x.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-BaDh5wWt.js → vennDiagram-CIIHVFJN-DehXkI0n.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-CZ9sEBPa.js → wardley-L42UT6IY-AqOhXLdx.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B_afE6fY.js → wardleyDiagram-YWT4CUSO-BzK61bpB.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-6Na9BohO.js → xychartDiagram-2RQKCTM6-D0uYHNx6.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/file-watcher.js +4 -1
- package/dist/server/git-diff.d.ts +1 -0
- package/dist/server/git-diff.js +79 -21
- package/dist/server/git-diff.test.js +110 -0
- package/dist/server/server.js +16 -0
- package/dist/server/server.test.js +56 -4
- package/package.json +2 -1
- package/dist/client/assets/architecture-7EHR7CIX-CGrQkVgf.js +0 -1
- package/dist/client/assets/channel-DG8kr4eK.js +0 -1
- package/dist/client/assets/chunk-QZHKN3VN-M1-XSu5b.js +0 -1
- package/dist/client/assets/chunk-WU5MYG2G-BvFjxMiG.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BtF02SOc.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BtF02SOc.js +0 -1
- package/dist/client/assets/eventmodeling-FCH6USID-D2pfiIpz.js +0 -1
- package/dist/client/assets/index-BC8r72Kq.js +0 -82
- package/dist/client/assets/index-DxvaSOa7.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-CkEmqrGj.js +0 -1
package/README.ja.md
CHANGED
|
@@ -200,7 +200,7 @@ npx skills add yoshiko-pg/difit
|
|
|
200
200
|
- **システム言語**:C, C++, C#, Rust, Go
|
|
201
201
|
- **モバイル言語**:Swift, Kotlin, Dart
|
|
202
202
|
- **IaC**:Terraform (HCL), Nix
|
|
203
|
-
- **その他**:Python, Protobuf, YAML, Solidity, Vim Script
|
|
203
|
+
- **その他**:Python, Protobuf, YAML, Solidity, Vim Script, GDScript
|
|
204
204
|
|
|
205
205
|
## 🔍 自動折りたたみファイル
|
|
206
206
|
|
package/README.ko.md
CHANGED
|
@@ -200,7 +200,7 @@ npx skills add yoshiko-pg/difit
|
|
|
200
200
|
- **시스템 언어**: C, C++, C#, Rust, Go
|
|
201
201
|
- **모바일 언어**: Swift, Kotlin, Dart
|
|
202
202
|
- **인프라 코드**: Terraform (HCL), Nix
|
|
203
|
-
- **기타**: Python, Protobuf, YAML, Solidity, Vim
|
|
203
|
+
- **기타**: Python, Protobuf, YAML, Solidity, Vim 스크립트, GDScript
|
|
204
204
|
|
|
205
205
|
## 🔍 자동 접힘 파일
|
|
206
206
|
|
package/README.md
CHANGED
|
@@ -205,7 +205,7 @@ After code edits or automated review, the agent can start the difit server with
|
|
|
205
205
|
- **Systems Languages**: C, C++, C#, Rust, Go
|
|
206
206
|
- **Mobile Languages**: Swift, Kotlin, Dart
|
|
207
207
|
- **Infrastructure as Code**: Terraform (HCL), Nix
|
|
208
|
-
- **Others**: Python, Protobuf, YAML, Solidity, Vim script
|
|
208
|
+
- **Others**: Python, Protobuf, YAML, Solidity, Vim script, GDScript
|
|
209
209
|
|
|
210
210
|
## 🔍 Auto-collapsed Files
|
|
211
211
|
|
package/README.zh.md
CHANGED
|
@@ -200,7 +200,7 @@ npx skills add yoshiko-pg/difit
|
|
|
200
200
|
- **系统语言**:C, C++, C#, Rust, Go
|
|
201
201
|
- **移动语言**:Swift, Kotlin, Dart
|
|
202
202
|
- **基础设施即代码**:Terraform (HCL), Nix
|
|
203
|
-
- **其他**:Python, Protobuf, YAML, Solidity, Vim Script
|
|
203
|
+
- **其他**:Python, Protobuf, YAML, Solidity, Vim Script, GDScript
|
|
204
204
|
|
|
205
205
|
## 🔍 自动折叠文件
|
|
206
206
|
|
package/dist/cli/comment.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
2
|
import { parseCommentImportValue } from '../utils/commentImports.js';
|
|
3
3
|
import { detectStdinSource, readStdin } from './utils.js';
|
|
4
|
+
function handleCommandError(error, port) {
|
|
5
|
+
if (error instanceof TypeError && error.message.includes('fetch failed')) {
|
|
6
|
+
console.error(`Error: Cannot connect to difit server on port ${port}. Is the server running?`);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
10
|
+
}
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
4
13
|
async function parseCommentAddInput(json) {
|
|
5
14
|
if (typeof json === 'string') {
|
|
6
15
|
return json;
|
|
@@ -15,7 +24,7 @@ async function parseCommentAddInput(json) {
|
|
|
15
24
|
return stdin;
|
|
16
25
|
}
|
|
17
26
|
export function createCommentCommand() {
|
|
18
|
-
const comment = new Command('comment').description('Add or
|
|
27
|
+
const comment = new Command('comment').description('Add, retrieve, or resolve comments on a running difit server');
|
|
19
28
|
comment
|
|
20
29
|
.command('add')
|
|
21
30
|
.description('Add comments to a running difit server')
|
|
@@ -44,13 +53,7 @@ export function createCommentCommand() {
|
|
|
44
53
|
}));
|
|
45
54
|
}
|
|
46
55
|
catch (error) {
|
|
47
|
-
|
|
48
|
-
console.error(`Error: Cannot connect to difit server on port ${opts.port}. Is the server running?`);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
52
|
-
}
|
|
53
|
-
process.exit(1);
|
|
56
|
+
handleCommandError(error, opts.port);
|
|
54
57
|
}
|
|
55
58
|
});
|
|
56
59
|
comment
|
|
@@ -78,13 +81,52 @@ export function createCommentCommand() {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
catch (error) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
handleCommandError(error, opts.port);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
comment
|
|
88
|
+
.command('resolve')
|
|
89
|
+
.alias('remove')
|
|
90
|
+
.description('Resolve (remove) comment threads on a running difit server')
|
|
91
|
+
.argument('<threadIds...>', 'thread IDs to resolve')
|
|
92
|
+
.requiredOption('--port <port>', 'port of the running difit server', parseInt)
|
|
93
|
+
.action(async (threadIds, opts) => {
|
|
94
|
+
try {
|
|
95
|
+
const results = await Promise.all(threadIds.map(async (threadId) => {
|
|
96
|
+
const response = await fetch(`http://localhost:${opts.port}/api/comments/${encodeURIComponent(threadId)}`, { method: 'DELETE' });
|
|
97
|
+
if (response.ok) {
|
|
98
|
+
return { threadId, status: 'resolved' };
|
|
99
|
+
}
|
|
100
|
+
if (response.status === 404) {
|
|
101
|
+
return { threadId, status: 'notFound' };
|
|
102
|
+
}
|
|
103
|
+
const errorBody = (await response.json().catch(() => ({})));
|
|
104
|
+
return {
|
|
105
|
+
threadId,
|
|
106
|
+
status: 'error',
|
|
107
|
+
error: errorBody.error ?? `Failed to resolve thread ${threadId}`,
|
|
108
|
+
};
|
|
109
|
+
}));
|
|
110
|
+
const resolved = results.filter((r) => r.status === 'resolved').map((r) => r.threadId);
|
|
111
|
+
const notFound = results.filter((r) => r.status === 'notFound').map((r) => r.threadId);
|
|
112
|
+
const errors = results
|
|
113
|
+
.filter((r) => r.status === 'error')
|
|
114
|
+
.map((r) => ({
|
|
115
|
+
threadId: r.threadId,
|
|
116
|
+
error: r.error ?? `Failed to resolve thread ${r.threadId}`,
|
|
117
|
+
}));
|
|
118
|
+
console.log(JSON.stringify({
|
|
119
|
+
success: notFound.length === 0 && errors.length === 0,
|
|
120
|
+
resolved,
|
|
121
|
+
notFound,
|
|
122
|
+
errors,
|
|
123
|
+
}));
|
|
124
|
+
if (notFound.length > 0 || errors.length > 0) {
|
|
125
|
+
process.exit(1);
|
|
86
126
|
}
|
|
87
|
-
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
handleCommandError(error, opts.port);
|
|
88
130
|
}
|
|
89
131
|
});
|
|
90
132
|
return comment;
|
package/dist/cli/comment.test.js
CHANGED
|
@@ -5,10 +5,11 @@ describe('createCommentCommand', () => {
|
|
|
5
5
|
it('creates a command named "comment"', () => {
|
|
6
6
|
expect(command.name()).toBe('comment');
|
|
7
7
|
});
|
|
8
|
-
it('has "add" and "
|
|
8
|
+
it('has "add", "get", and "resolve" subcommands', () => {
|
|
9
9
|
const subcommandNames = command.commands.map((c) => c.name());
|
|
10
10
|
expect(subcommandNames).toContain('add');
|
|
11
11
|
expect(subcommandNames).toContain('get');
|
|
12
|
+
expect(subcommandNames).toContain('resolve');
|
|
12
13
|
});
|
|
13
14
|
describe('add subcommand', () => {
|
|
14
15
|
const addCommand = command.commands.find((c) => c.name() === 'add');
|
|
@@ -38,6 +39,24 @@ describe('createCommentCommand', () => {
|
|
|
38
39
|
expect(formatOption?.argChoices).toEqual(['text', 'json']);
|
|
39
40
|
});
|
|
40
41
|
});
|
|
42
|
+
describe('resolve subcommand', () => {
|
|
43
|
+
const resolveCommand = command.commands.find((c) => c.name() === 'resolve');
|
|
44
|
+
it('has "remove" alias', () => {
|
|
45
|
+
expect(resolveCommand.aliases()).toContain('remove');
|
|
46
|
+
});
|
|
47
|
+
it('requires --port option', () => {
|
|
48
|
+
const portOption = resolveCommand.options.find((o) => o.long === '--port');
|
|
49
|
+
expect(portOption).toBeDefined();
|
|
50
|
+
expect(portOption?.mandatory).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('accepts variadic threadIds argument', () => {
|
|
53
|
+
const args = resolveCommand.registeredArguments;
|
|
54
|
+
expect(args).toHaveLength(1);
|
|
55
|
+
expect(args[0].name()).toBe('threadIds');
|
|
56
|
+
expect(args[0].required).toBe(true);
|
|
57
|
+
expect(args[0].variadic).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
41
60
|
});
|
|
42
61
|
function jsonResponse(body, status = 200) {
|
|
43
62
|
return new Response(JSON.stringify(body), {
|
|
@@ -161,4 +180,77 @@ describe('comment subcommand integration', () => {
|
|
|
161
180
|
expect(consoleOutput).toHaveLength(0);
|
|
162
181
|
});
|
|
163
182
|
});
|
|
183
|
+
describe('resolve', () => {
|
|
184
|
+
it('sends DELETE requests for each thread ID', async () => {
|
|
185
|
+
mockFetch.mockResolvedValue(jsonResponse({ success: true, threadId: 'abc123', version: 2 }));
|
|
186
|
+
const command = createCommentCommand();
|
|
187
|
+
await command.parseAsync(['node', 'difit', 'resolve', '--port', '4966', 'abc123', 'def456']);
|
|
188
|
+
expect(mockFetch).toHaveBeenCalledWith('http://localhost:4966/api/comments/abc123', {
|
|
189
|
+
method: 'DELETE',
|
|
190
|
+
});
|
|
191
|
+
expect(mockFetch).toHaveBeenCalledWith('http://localhost:4966/api/comments/def456', {
|
|
192
|
+
method: 'DELETE',
|
|
193
|
+
});
|
|
194
|
+
expect(consoleOutput[0]).toBe(JSON.stringify({
|
|
195
|
+
success: true,
|
|
196
|
+
resolved: ['abc123', 'def456'],
|
|
197
|
+
notFound: [],
|
|
198
|
+
errors: [],
|
|
199
|
+
}));
|
|
200
|
+
expect(process.exit).not.toHaveBeenCalled();
|
|
201
|
+
});
|
|
202
|
+
it('works via the remove alias', async () => {
|
|
203
|
+
mockFetch.mockResolvedValue(jsonResponse({ success: true, threadId: 'abc123', version: 2 }));
|
|
204
|
+
const command = createCommentCommand();
|
|
205
|
+
await command.parseAsync(['node', 'difit', 'remove', '--port', '4966', 'abc123']);
|
|
206
|
+
expect(mockFetch).toHaveBeenCalledWith('http://localhost:4966/api/comments/abc123', {
|
|
207
|
+
method: 'DELETE',
|
|
208
|
+
});
|
|
209
|
+
expect(consoleOutput[0]).toContain('"success":true');
|
|
210
|
+
});
|
|
211
|
+
it('URL-encodes thread IDs', async () => {
|
|
212
|
+
mockFetch.mockResolvedValue(jsonResponse({ success: true }));
|
|
213
|
+
const command = createCommentCommand();
|
|
214
|
+
await command.parseAsync(['node', 'difit', 'resolve', '--port', '4966', 'a/b c']);
|
|
215
|
+
expect(mockFetch).toHaveBeenCalledWith('http://localhost:4966/api/comments/a%2Fb%20c', {
|
|
216
|
+
method: 'DELETE',
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
it('reports unknown thread IDs and exits with an error', async () => {
|
|
220
|
+
mockFetch
|
|
221
|
+
.mockResolvedValueOnce(jsonResponse({ success: true, threadId: 'abc123', version: 2 }))
|
|
222
|
+
.mockResolvedValueOnce(jsonResponse({ error: 'Thread not found: missing' }, 404));
|
|
223
|
+
const command = createCommentCommand();
|
|
224
|
+
await command.parseAsync(['node', 'difit', 'resolve', '--port', '4966', 'abc123', 'missing']);
|
|
225
|
+
expect(consoleOutput[0]).toBe(JSON.stringify({
|
|
226
|
+
success: false,
|
|
227
|
+
resolved: ['abc123'],
|
|
228
|
+
notFound: ['missing'],
|
|
229
|
+
errors: [],
|
|
230
|
+
}));
|
|
231
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
232
|
+
});
|
|
233
|
+
it('collects server errors without dropping remaining thread IDs', async () => {
|
|
234
|
+
mockFetch
|
|
235
|
+
.mockResolvedValueOnce(jsonResponse({ error: 'Internal error' }, 500))
|
|
236
|
+
.mockResolvedValueOnce(jsonResponse({ success: true, threadId: 'def456', version: 2 }));
|
|
237
|
+
const command = createCommentCommand();
|
|
238
|
+
await command.parseAsync(['node', 'difit', 'resolve', '--port', '4966', 'abc123', 'def456']);
|
|
239
|
+
expect(consoleOutput[0]).toBe(JSON.stringify({
|
|
240
|
+
success: false,
|
|
241
|
+
resolved: ['def456'],
|
|
242
|
+
notFound: [],
|
|
243
|
+
errors: [{ threadId: 'abc123', error: 'Internal error' }],
|
|
244
|
+
}));
|
|
245
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
246
|
+
});
|
|
247
|
+
it('handles connection error', async () => {
|
|
248
|
+
mockFetch.mockRejectedValue(new TypeError('fetch failed'));
|
|
249
|
+
const command = createCommentCommand();
|
|
250
|
+
await command.parseAsync(['node', 'difit', 'resolve', '--port', '9999', 'abc123']);
|
|
251
|
+
expect(consoleErrors[0]).toContain('Cannot connect');
|
|
252
|
+
expect(consoleErrors[0]).toContain('9999');
|
|
253
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
164
256
|
});
|
package/dist/cli/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import { fstatSync } from 'node:fs';
|
|
3
|
-
import { createInterface } from 'readline/promises';
|
|
3
|
+
import { createInterface } from 'node:readline/promises';
|
|
4
4
|
import { parseCommentImportValue } from '../utils/commentImports.js';
|
|
5
5
|
export function detectStdinSource(stdinStat = fstatSync(0)) {
|
|
6
6
|
if (stdinStat.isFIFO()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./path-BWPyau1x.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-
|
|
1
|
+
import{n as e,t}from"./path-BWPyau1x.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-MrZ1zwt-.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-B_EZyTa5.js";export{e as createArchitectureServices};
|