@tomingtoming/kioq 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +386 -0
- package/dist/config.js +174 -0
- package/dist/index.js +2 -0
- package/dist/normalizers.js +20 -0
- package/dist/noteStore.js +1115 -0
- package/dist/src/auditResponseSummary.js +160 -0
- package/dist/src/changeTriggerSummary.js +116 -0
- package/dist/src/config.js +192 -0
- package/dist/src/conflictSummary.js +7 -0
- package/dist/src/contractResponseSummary.js +43 -0
- package/dist/src/index.js +1305 -0
- package/dist/src/normalizers.js +20 -0
- package/dist/src/noteStore.js +3270 -0
- package/dist/src/operationImpact.js +68 -0
- package/dist/src/readResponseSummary.js +252 -0
- package/dist/src/responseMode.js +12 -0
- package/dist/src/storage/githubStorage.js +447 -0
- package/dist/src/storage/index.js +3 -0
- package/dist/src/storage/localFsStorage.js +125 -0
- package/dist/src/storage/types.js +4 -0
- package/dist/src/toolScope.js +20 -0
- package/dist/src/types.js +1 -0
- package/dist/src/writeResponseSummary.js +122 -0
- package/dist/types.js +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function summarizeDeleteImpact(args) {
|
|
2
|
+
const reasons = [];
|
|
3
|
+
if (args.projectUnresolvedDelta > 0) {
|
|
4
|
+
reasons.push("broken_links_after_delete");
|
|
5
|
+
}
|
|
6
|
+
if (args.backlinksToDeleted >= 10) {
|
|
7
|
+
reasons.push("heavily_referenced_note");
|
|
8
|
+
}
|
|
9
|
+
else if (args.backlinksToDeleted > 0) {
|
|
10
|
+
reasons.push("referenced_by_other_notes");
|
|
11
|
+
}
|
|
12
|
+
if (args.projectUnresolvedDelta > 0 || args.backlinksToDeleted >= 10) {
|
|
13
|
+
return {
|
|
14
|
+
impactScore: "high",
|
|
15
|
+
requiresBackup: true,
|
|
16
|
+
reasons,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (args.backlinksToDeleted > 0) {
|
|
20
|
+
return {
|
|
21
|
+
impactScore: "medium",
|
|
22
|
+
requiresBackup: true,
|
|
23
|
+
reasons,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
impactScore: "low",
|
|
28
|
+
requiresBackup: false,
|
|
29
|
+
reasons: ["isolated_note"],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function summarizeRenameImpact(args) {
|
|
33
|
+
const reasons = [];
|
|
34
|
+
if (args.projectUnresolvedDelta > 0) {
|
|
35
|
+
reasons.push("broken_links_after_rename");
|
|
36
|
+
}
|
|
37
|
+
if (args.updatedLinks >= 25 || args.updatedFiles >= 10) {
|
|
38
|
+
reasons.push("wide_link_propagation");
|
|
39
|
+
}
|
|
40
|
+
else if (args.updatedLinks > 0 || args.updatedFiles > 0) {
|
|
41
|
+
reasons.push("link_propagation");
|
|
42
|
+
}
|
|
43
|
+
if (args.backlinkCount >= 10) {
|
|
44
|
+
reasons.push("heavily_referenced_note");
|
|
45
|
+
}
|
|
46
|
+
else if (args.backlinkCount > 0) {
|
|
47
|
+
reasons.push("referenced_note");
|
|
48
|
+
}
|
|
49
|
+
if (args.projectUnresolvedDelta > 0 || args.updatedLinks >= 25 || args.updatedFiles >= 10) {
|
|
50
|
+
return {
|
|
51
|
+
impactScore: "high",
|
|
52
|
+
requiresBackup: true,
|
|
53
|
+
reasons,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (args.updatedLinks > 0 || args.updatedFiles > 0 || args.backlinkCount > 0) {
|
|
57
|
+
return {
|
|
58
|
+
impactScore: "medium",
|
|
59
|
+
requiresBackup: args.updatedLinks >= 15 || args.updatedFiles >= 5 || args.backlinkCount >= 10,
|
|
60
|
+
reasons,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
impactScore: "low",
|
|
65
|
+
requiresBackup: false,
|
|
66
|
+
reasons: ["local_rename_only"],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
function summarizeListResponse(args) {
|
|
2
|
+
if (args.resultCount === 0) {
|
|
3
|
+
return {
|
|
4
|
+
primaryNavigationSignal: "no_results",
|
|
5
|
+
primaryQualitySignal: "no_results",
|
|
6
|
+
nextRecommendedAction: args.emptyAction,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (args.indexCandidateCount > 0) {
|
|
10
|
+
return {
|
|
11
|
+
primaryNavigationSignal: "index_candidates_available",
|
|
12
|
+
primaryQualitySignal: "results_available",
|
|
13
|
+
nextRecommendedAction: "open_index_candidate",
|
|
14
|
+
nextRecommendedTarget: args.firstIndexCandidateTitle,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (args.hasIndexLikeResult) {
|
|
18
|
+
return {
|
|
19
|
+
primaryNavigationSignal: "index_result_in_list",
|
|
20
|
+
primaryQualitySignal: "results_available",
|
|
21
|
+
nextRecommendedAction: "open_index_result",
|
|
22
|
+
nextRecommendedTarget: args.firstIndexLikeTitle,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
primaryNavigationSignal: "direct_results_available",
|
|
27
|
+
primaryQualitySignal: "results_available",
|
|
28
|
+
nextRecommendedAction: "open_note",
|
|
29
|
+
nextRecommendedTarget: args.firstResultTitle,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function summarizeRecentResponse(args) {
|
|
33
|
+
return summarizeListResponse({
|
|
34
|
+
...args,
|
|
35
|
+
emptyAction: "adjust_directory_or_write_note",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function summarizeSearchResponse(args) {
|
|
39
|
+
return summarizeListResponse({
|
|
40
|
+
...args,
|
|
41
|
+
emptyAction: "refine_query",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function summarizeReadNoteResponse(args) {
|
|
45
|
+
const qualitySignal = args.unresolvedWikiLinkCount > 0
|
|
46
|
+
? "unresolved_wikilinks_present"
|
|
47
|
+
: args.boundaryWarningCount > 0
|
|
48
|
+
? "boundary_warning_present"
|
|
49
|
+
: args.orphanWarning
|
|
50
|
+
? "orphan_warning"
|
|
51
|
+
: args.clarityAttention
|
|
52
|
+
? "clarity_attention_present"
|
|
53
|
+
: args.backlinkCount === 0
|
|
54
|
+
? "low_backlink_support"
|
|
55
|
+
: "note_health_ok";
|
|
56
|
+
if (args.unresolvedWikiLinkCount > 0) {
|
|
57
|
+
return {
|
|
58
|
+
primaryNavigationSignal: args.indexLike
|
|
59
|
+
? "current_note_is_index"
|
|
60
|
+
: args.indexCandidateTitle
|
|
61
|
+
? "index_candidate_available"
|
|
62
|
+
: "direct_note_read",
|
|
63
|
+
primaryQualitySignal: qualitySignal,
|
|
64
|
+
nextRecommendedAction: "resolve_unresolved_links",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (args.boundaryWarningCount > 0) {
|
|
68
|
+
return {
|
|
69
|
+
primaryNavigationSignal: args.indexLike
|
|
70
|
+
? "current_note_is_index"
|
|
71
|
+
: args.indexCandidateTitle
|
|
72
|
+
? "index_candidate_available"
|
|
73
|
+
: "direct_note_read",
|
|
74
|
+
primaryQualitySignal: qualitySignal,
|
|
75
|
+
nextRecommendedAction: "review_boundary_warnings",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (args.clarityAttention) {
|
|
79
|
+
return {
|
|
80
|
+
primaryNavigationSignal: args.indexLike
|
|
81
|
+
? "current_note_is_index"
|
|
82
|
+
: args.indexCandidateTitle
|
|
83
|
+
? "index_candidate_available"
|
|
84
|
+
: "direct_note_read",
|
|
85
|
+
primaryQualitySignal: qualitySignal,
|
|
86
|
+
nextRecommendedAction: "review_document_clarity",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (args.indexLike) {
|
|
90
|
+
return {
|
|
91
|
+
primaryNavigationSignal: "current_note_is_index",
|
|
92
|
+
primaryQualitySignal: qualitySignal,
|
|
93
|
+
nextRecommendedAction: "continue_from_index",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (args.indexCandidateTitle) {
|
|
97
|
+
return {
|
|
98
|
+
primaryNavigationSignal: "index_candidate_available",
|
|
99
|
+
primaryQualitySignal: qualitySignal,
|
|
100
|
+
nextRecommendedAction: "open_index_candidate",
|
|
101
|
+
nextRecommendedTarget: args.indexCandidateTitle,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
primaryNavigationSignal: "direct_note_read",
|
|
106
|
+
primaryQualitySignal: qualitySignal,
|
|
107
|
+
nextRecommendedAction: "continue_reading_note",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export function summarizeResolveLinksResponse(args) {
|
|
111
|
+
const qualitySignal = args.unresolvedLinkCount > 0
|
|
112
|
+
? "unresolved_links_present"
|
|
113
|
+
: args.boundaryWarningCount > 0
|
|
114
|
+
? "boundary_warning_present"
|
|
115
|
+
: "all_links_resolved";
|
|
116
|
+
if (args.unresolvedLinkCount > 0) {
|
|
117
|
+
return {
|
|
118
|
+
primaryNavigationSignal: args.indexLike
|
|
119
|
+
? "current_note_is_index"
|
|
120
|
+
: args.indexCandidateTitle
|
|
121
|
+
? "index_candidate_available"
|
|
122
|
+
: "direct_link_audit",
|
|
123
|
+
primaryQualitySignal: qualitySignal,
|
|
124
|
+
nextRecommendedAction: "resolve_unresolved_links",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (args.boundaryWarningCount > 0) {
|
|
128
|
+
return {
|
|
129
|
+
primaryNavigationSignal: args.indexLike
|
|
130
|
+
? "current_note_is_index"
|
|
131
|
+
: args.indexCandidateTitle
|
|
132
|
+
? "index_candidate_available"
|
|
133
|
+
: "direct_link_audit",
|
|
134
|
+
primaryQualitySignal: qualitySignal,
|
|
135
|
+
nextRecommendedAction: "review_boundary_warnings",
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (args.indexLike) {
|
|
139
|
+
return {
|
|
140
|
+
primaryNavigationSignal: "current_note_is_index",
|
|
141
|
+
primaryQualitySignal: qualitySignal,
|
|
142
|
+
nextRecommendedAction: "continue_from_index",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (args.indexCandidateTitle) {
|
|
146
|
+
return {
|
|
147
|
+
primaryNavigationSignal: "index_candidate_available",
|
|
148
|
+
primaryQualitySignal: qualitySignal,
|
|
149
|
+
nextRecommendedAction: "open_index_candidate",
|
|
150
|
+
nextRecommendedTarget: args.indexCandidateTitle,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
primaryNavigationSignal: "direct_link_audit",
|
|
155
|
+
primaryQualitySignal: qualitySignal,
|
|
156
|
+
nextRecommendedAction: "review_link_targets",
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export function summarizeBacklinksResponse(args) {
|
|
160
|
+
const qualitySignal = args.boundaryWarningCount > 0
|
|
161
|
+
? "boundary_warning_present"
|
|
162
|
+
: args.backlinkCount > 0
|
|
163
|
+
? "backlinks_available"
|
|
164
|
+
: "no_backlinks";
|
|
165
|
+
if (args.boundaryWarningCount > 0) {
|
|
166
|
+
return {
|
|
167
|
+
primaryNavigationSignal: args.indexLike
|
|
168
|
+
? "current_note_is_index"
|
|
169
|
+
: args.indexCandidateTitle
|
|
170
|
+
? "index_candidate_available"
|
|
171
|
+
: "backlink_view",
|
|
172
|
+
primaryQualitySignal: qualitySignal,
|
|
173
|
+
nextRecommendedAction: "review_boundary_warnings",
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (args.indexLike) {
|
|
177
|
+
return {
|
|
178
|
+
primaryNavigationSignal: "current_note_is_index",
|
|
179
|
+
primaryQualitySignal: qualitySignal,
|
|
180
|
+
nextRecommendedAction: args.backlinkCount > 0 ? "open_backlink" : "continue_from_index",
|
|
181
|
+
nextRecommendedTarget: args.backlinkCount > 0 ? args.firstBacklinkTitle : undefined,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (args.backlinkCount > 0) {
|
|
185
|
+
return {
|
|
186
|
+
primaryNavigationSignal: args.indexCandidateTitle ? "index_candidate_available" : "backlink_view",
|
|
187
|
+
primaryQualitySignal: qualitySignal,
|
|
188
|
+
nextRecommendedAction: "open_backlink",
|
|
189
|
+
nextRecommendedTarget: args.firstBacklinkTitle,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (args.indexCandidateTitle) {
|
|
193
|
+
return {
|
|
194
|
+
primaryNavigationSignal: "index_candidate_available",
|
|
195
|
+
primaryQualitySignal: qualitySignal,
|
|
196
|
+
nextRecommendedAction: "open_index_candidate",
|
|
197
|
+
nextRecommendedTarget: args.indexCandidateTitle,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
primaryNavigationSignal: "backlink_view",
|
|
202
|
+
primaryQualitySignal: qualitySignal,
|
|
203
|
+
nextRecommendedAction: "add_or_check_references",
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
export function summarizeContextBundleResponse(args) {
|
|
207
|
+
const qualitySignal = args.boundaryWarningCount > 0
|
|
208
|
+
? "boundary_warning_present"
|
|
209
|
+
: args.bundleItemCount > 0
|
|
210
|
+
? "related_context_available"
|
|
211
|
+
: "no_related_context";
|
|
212
|
+
if (args.boundaryWarningCount > 0) {
|
|
213
|
+
return {
|
|
214
|
+
primaryNavigationSignal: args.sourceIndexLike
|
|
215
|
+
? "source_note_is_index"
|
|
216
|
+
: args.indexCandidateTitle
|
|
217
|
+
? "index_candidate_available"
|
|
218
|
+
: "bundle_context_ready",
|
|
219
|
+
primaryQualitySignal: qualitySignal,
|
|
220
|
+
nextRecommendedAction: "review_boundary_warnings",
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (args.sourceIndexLike) {
|
|
224
|
+
return {
|
|
225
|
+
primaryNavigationSignal: "source_note_is_index",
|
|
226
|
+
primaryQualitySignal: qualitySignal,
|
|
227
|
+
nextRecommendedAction: args.bundleItemCount > 0 ? "open_bundle_item" : "continue_from_index",
|
|
228
|
+
nextRecommendedTarget: args.bundleItemCount > 0 ? args.firstBundleItemTitle : undefined,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
if (args.bundleItemCount > 0) {
|
|
232
|
+
return {
|
|
233
|
+
primaryNavigationSignal: args.indexCandidateTitle ? "index_candidate_available" : "bundle_context_ready",
|
|
234
|
+
primaryQualitySignal: qualitySignal,
|
|
235
|
+
nextRecommendedAction: "open_bundle_item",
|
|
236
|
+
nextRecommendedTarget: args.firstBundleItemTitle,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
if (args.indexCandidateTitle) {
|
|
240
|
+
return {
|
|
241
|
+
primaryNavigationSignal: "index_candidate_available",
|
|
242
|
+
primaryQualitySignal: qualitySignal,
|
|
243
|
+
nextRecommendedAction: "open_index_candidate",
|
|
244
|
+
nextRecommendedTarget: args.indexCandidateTitle,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
primaryNavigationSignal: "bundle_context_ready",
|
|
249
|
+
primaryQualitySignal: qualitySignal,
|
|
250
|
+
nextRecommendedAction: "broaden_context",
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const RESPONSE_MODE_VALUES = ["minimal", "standard", "verbose"];
|
|
2
|
+
const RESPONSE_MODE_RANK = {
|
|
3
|
+
minimal: 0,
|
|
4
|
+
standard: 1,
|
|
5
|
+
verbose: 2,
|
|
6
|
+
};
|
|
7
|
+
export function normalizeResponseMode(mode) {
|
|
8
|
+
return mode ?? "standard";
|
|
9
|
+
}
|
|
10
|
+
export function responseModeAtLeast(mode, threshold) {
|
|
11
|
+
return RESPONSE_MODE_RANK[mode] >= RESPONSE_MODE_RANK[threshold];
|
|
12
|
+
}
|