@minidoll/agentkit-dsh-plugin 0.1.2 → 0.1.3
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/dist/index.js +24 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -188,19 +188,35 @@ function injectEnabled(root) {
|
|
|
188
188
|
}
|
|
189
189
|
var injected = /* @__PURE__ */ new Set();
|
|
190
190
|
var PATH_RULES = [
|
|
191
|
-
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{
|
|
191
|
+
{
|
|
192
|
+
pattern: /^contracts\//,
|
|
193
|
+
hint: "\u5951\u7EA6\u53D8\u66F4\uFF1A\u5B9E\u73B0\u5FC5\u987B\u540C\u6B65\uFF08AGENTS \u94C1\u5F8B\uFF09\uFF0C\u5E76\u5728\u4EA4\u63A5\u5355\u58F0\u660E\u5951\u7EA6\u5F71\u54CD\u4E0E\u8BC1\u636E\u7EA7\u522B L1-L4"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
pattern: /^docs\/rules\//,
|
|
197
|
+
hint: "\u89C4\u5219\u6587\u6863\uFF1A\u6539\u5B83\u7B49\u4E8E\u6539\u6240\u6709\u4EBA\u7684\u884C\u4E3A\u7EA6\u675F \u2014\u2014 \u5148\u786E\u8BA4\u4E0E protocol.yml / AGENTS.md \u4E0D\u51B2\u7A81"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
pattern: /^docs\/design\//,
|
|
201
|
+
hint: '\u8BBE\u8BA1\u6587\u6863\uFF1A\u9700\u4E0E codemap \u91CC\u7684\u6A21\u5757\u5BF9\u5E94\uFF08M4 \u4F1A\u6821\u9A8C"\u6587\u6863\u63D0\u5230\u8BE5\u6A21\u5757"\uFF09'
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
pattern: /^\.agent\/decisions\/\d{4}-/,
|
|
205
|
+
hint: "ADR\uFF1Aaccepted \u7684\u6709\u7EA6\u675F\u529B \u2014\u2014 \u8981\u63A8\u7FFB\u5148\u5199\u65B0 ADR \u6807 superseded\uFF0C\u4E0D\u8981\u76F4\u63A5\u6539\u65E7\u7ED3\u8BBA"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
pattern: /^AGENTS\.md$/,
|
|
209
|
+
hint: "AGENTS.md \u662F\u6D3E\u751F\u6587\u4EF6\uFF08\u7531 protocol.yml \u751F\u6210\uFF09\u2014\u2014 \u6539\u5B83\u8BF7\u6539 protocol.yml \u518D akit sync"
|
|
210
|
+
}
|
|
196
211
|
];
|
|
197
212
|
function buildInjectText(input) {
|
|
198
213
|
const lines = [];
|
|
199
214
|
const rels = [];
|
|
200
215
|
if (input.filePath !== void 0 && input.filePath !== "") rels.push(input.filePath);
|
|
201
216
|
for (const p of input.extraPaths ?? []) if (p !== "") rels.push(p);
|
|
217
|
+
const norm = (p) => String(p).replace(/\\/g, "/").replace(/^\.\//, "");
|
|
202
218
|
for (const raw of rels) {
|
|
203
|
-
const rel =
|
|
219
|
+
const rel = norm(raw);
|
|
204
220
|
for (const rule of PATH_RULES) {
|
|
205
221
|
if (rule.pattern.test(rel)) {
|
|
206
222
|
lines.push(`- \u7EAA\u5F8B\uFF1A${rule.hint}`);
|
|
@@ -210,12 +226,12 @@ function buildInjectText(input) {
|
|
|
210
226
|
if (lines.length > 0) break;
|
|
211
227
|
}
|
|
212
228
|
for (const raw of rels) {
|
|
213
|
-
const rel =
|
|
229
|
+
const rel = norm(raw);
|
|
214
230
|
try {
|
|
215
231
|
const cm = join4(input.root, ".agent", "codemap.json");
|
|
216
232
|
if (!existsSync4(cm)) break;
|
|
217
233
|
const map = JSON.parse(readFileSync3(cm, "utf8"));
|
|
218
|
-
const mod = (map.modules ?? []).find((m) =>
|
|
234
|
+
const mod = (map.modules ?? []).find((m) => norm(m.path ?? "") === rel);
|
|
219
235
|
if (mod !== void 0) {
|
|
220
236
|
if (mod.purpose !== void 0 && mod.purpose !== "") lines.push(`- \u6A21\u5757\u804C\u8D23\uFF08codemap\uFF09\uFF1A${mod.purpose}`);
|
|
221
237
|
if (mod.doc !== void 0 && mod.doc !== "") lines.push(`- \u8BBE\u8BA1\u6587\u6863\uFF1A${mod.doc}`);
|