@dxtmisha/scripts 1.0.0 → 1.1.1
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/CHANGELOG.md +32 -0
- package/bin/build-packages.ts +24 -3
- package/bin/design-prompt.ts +7 -2
- package/dist/{AiZAi-x3CInynJ.js → AiZAi-P-St-CZL.js} +1 -1
- package/dist/{PropertiesConfig-ChizwW5y.js → PropertiesConfig-BBsuNndv.js} +67 -52
- package/dist/config.d.ts +6 -0
- package/dist/config.js +5 -5
- package/dist/library-ai.js +1 -1
- package/dist/library-figma.js +1 -1
- package/dist/library-ui.js +648 -637
- package/dist/library.d.ts +262 -21
- package/dist/library.js +317 -185
- package/dist/{propertyTypes-DflziKuR.js → propertyTypes-CstobYcc.js} +2 -2
- package/package.json +18 -18
package/dist/library.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./AiZAi-
|
|
2
|
-
import { n as u, t as d } from "./PropertiesConfig-
|
|
3
|
-
import { UI_DIRS_FILE_EXPORT as ee, UI_DIRS_LIST_EXPORT as te, UI_DIR_AI_PROMPT_SCREENSHOT as f,
|
|
4
|
-
import { a as
|
|
5
|
-
import { n as
|
|
6
|
-
import { Datetime as
|
|
7
|
-
import { execFile as
|
|
8
|
-
import { promisify as
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./AiZAi-P-St-CZL.js";
|
|
2
|
+
import { n as u, t as d } from "./PropertiesConfig-BBsuNndv.js";
|
|
3
|
+
import { UI_DIRS_FILE_EXPORT as ee, UI_DIRS_LIST_EXPORT as te, UI_DIR_AI_PROMPT_SCREENSHOT as f, UI_DIR_AI_TYPES as p, UI_DIR_AI_TYPES_LIST as m, UI_DIR_PACKAGES as h, UI_DIR_RESOURCES as ne, UI_FILE_AI_DESCRIPTION as g, UI_FILE_AI_MCP as _, UI_FILE_AI_MCP_ALL as v, UI_FILE_AI_MCP_ALL_TS as y, UI_FILE_AI_PROMPT_DESCRIPTION as b, UI_FILE_AI_PROMPT_DEVELOPER as x, UI_FILE_AI_PROMPT_INFO as S, UI_FILE_AI_PROMPT_INSTRUCTION as re, UI_FILE_AI_PROMPT_PROMPT as C, UI_FILE_AI_PROMPT_TYPES as w, UI_FILE_AI_TYPES as T, UI_FILE_GITIGNORE as ie, UI_FILE_PACKAGE as ae, UI_FLAG_NOT_EXPORT as oe, UI_MODULES as E } from "./config.js";
|
|
4
|
+
import { a as D, i as se, n as ce, r as le, t as ue } from "./propertyTypes-CstobYcc.js";
|
|
5
|
+
import { n as de, t as fe } from "./figmaApiTypes-CArSsNW8.js";
|
|
6
|
+
import { Datetime as pe, ServerStorage as O, forEach as k, isArray as A, isFilled as j, isObject as me, isString as M, removeCommonPrefix as he, sleep as ge, toArray as N, toCamelCaseFirst as P, uniqueArray as _e } from "@dxtmisha/functional-basic";
|
|
7
|
+
import { execFile as F, execSync as I, spawn as ve } from "node:child_process";
|
|
8
|
+
import { promisify as L } from "node:util";
|
|
9
9
|
import { createHash as ye } from "node:crypto";
|
|
10
|
-
import
|
|
10
|
+
import R from "typescript";
|
|
11
11
|
//#region src/classes/Ai/AiClaudeAgentLite.ts
|
|
12
|
-
var
|
|
12
|
+
var z = class extends l {
|
|
13
13
|
async init() {
|
|
14
14
|
this.ai = {};
|
|
15
15
|
}
|
|
@@ -41,11 +41,11 @@ var I = class extends l {
|
|
|
41
41
|
return console.error("[AiClaudeAgent] Error:", e), "";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, B = class extends z {
|
|
45
45
|
constructor() {
|
|
46
46
|
super(...r());
|
|
47
47
|
}
|
|
48
|
-
}, be = "./ai-tmp",
|
|
48
|
+
}, be = "./ai-tmp", V = class e {
|
|
49
49
|
static idFileGlobal = 0;
|
|
50
50
|
createdFiles = [];
|
|
51
51
|
getFileName() {
|
|
@@ -59,8 +59,8 @@ var I = class extends l {
|
|
|
59
59
|
for (let e of this.createdFiles) u.removeFile(e);
|
|
60
60
|
this.createdFiles.length = 0;
|
|
61
61
|
}
|
|
62
|
-
},
|
|
63
|
-
tmp = new
|
|
62
|
+
}, H = class extends l {
|
|
63
|
+
tmp = new V();
|
|
64
64
|
async init() {
|
|
65
65
|
this.ai = {};
|
|
66
66
|
}
|
|
@@ -68,13 +68,13 @@ var I = class extends l {
|
|
|
68
68
|
return [];
|
|
69
69
|
}
|
|
70
70
|
toContents() {
|
|
71
|
-
return
|
|
71
|
+
return k(this.contents, (e) => this.tmp.createFile(e));
|
|
72
72
|
}
|
|
73
73
|
async response(e, t) {
|
|
74
74
|
return new Promise((n) => {
|
|
75
75
|
let r = [`${[...this.toContents(), this.tmp.createFile(t)].join("\n\n##################\n\n")} -- Output strictly the code/answer. No preamble, no chatter, no reasoning`, ...e ? ["--model", e] : []];
|
|
76
76
|
try {
|
|
77
|
-
|
|
77
|
+
F("claude", r, {
|
|
78
78
|
encoding: "utf8",
|
|
79
79
|
env: { ...process.env }
|
|
80
80
|
}, (e, t, r) => {
|
|
@@ -85,12 +85,12 @@ var I = class extends l {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, U = class extends H {
|
|
89
89
|
constructor() {
|
|
90
90
|
super(...r());
|
|
91
91
|
}
|
|
92
|
-
},
|
|
93
|
-
tmp = new
|
|
92
|
+
}, W = class extends l {
|
|
93
|
+
tmp = new V();
|
|
94
94
|
async init() {
|
|
95
95
|
this.ai = {};
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@ var I = class extends l {
|
|
|
98
98
|
return [];
|
|
99
99
|
}
|
|
100
100
|
toContents() {
|
|
101
|
-
return
|
|
101
|
+
return k(this.contents, (e) => this.tmp.createFile(e));
|
|
102
102
|
}
|
|
103
103
|
async response(e, t) {
|
|
104
104
|
return new Promise((n) => {
|
|
@@ -108,7 +108,7 @@ var I = class extends l {
|
|
|
108
108
|
"--yolo"
|
|
109
109
|
];
|
|
110
110
|
try {
|
|
111
|
-
|
|
111
|
+
F("gemini", r, {
|
|
112
112
|
encoding: "utf8",
|
|
113
113
|
env: { ...process.env }
|
|
114
114
|
}, (e, t, r) => {
|
|
@@ -119,15 +119,15 @@ var I = class extends l {
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, G = class extends W {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...r());
|
|
125
125
|
}
|
|
126
|
-
},
|
|
126
|
+
}, K = [
|
|
127
127
|
"--no-sandbox",
|
|
128
128
|
"--disable-setuid-sandbox",
|
|
129
129
|
"--disable-dev-shm-usage"
|
|
130
|
-
],
|
|
130
|
+
], xe = "webp", Se = 1080, Ce = 80, we = 32e4, Te = ["networkidle0", "domcontentloaded"], Ee = 1920, q = class {
|
|
131
131
|
url;
|
|
132
132
|
options;
|
|
133
133
|
browser;
|
|
@@ -139,10 +139,10 @@ var I = class extends l {
|
|
|
139
139
|
this.url = e, this.options = t;
|
|
140
140
|
}
|
|
141
141
|
get args() {
|
|
142
|
-
return this.options.args ??
|
|
142
|
+
return this.options.args ?? K;
|
|
143
143
|
}
|
|
144
144
|
get waitUntil() {
|
|
145
|
-
return this.options.waitUntil ??
|
|
145
|
+
return this.options.waitUntil ?? Te;
|
|
146
146
|
}
|
|
147
147
|
get timeout() {
|
|
148
148
|
return this.options.timeout ?? 32e4;
|
|
@@ -246,7 +246,7 @@ var I = class extends l {
|
|
|
246
246
|
this.toConsole(`Page height: ${t}px, viewport height: ${n}px, total pages: ${r}`);
|
|
247
247
|
for (let t = 0; t < r; t++) {
|
|
248
248
|
let i = t * n, a = this.getOutputPath(e, t + 1, r);
|
|
249
|
-
await this.evaluate((e) => window.scrollTo(0, e), i), await
|
|
249
|
+
await this.evaluate((e) => window.scrollTo(0, e), i), await ge(320), await this.saveScreenshot(a), this.toConsole(`Saved screenshot page ${t + 1}/${r} to ${a}`);
|
|
250
250
|
}
|
|
251
251
|
return this;
|
|
252
252
|
}
|
|
@@ -257,7 +257,7 @@ var I = class extends l {
|
|
|
257
257
|
toConsole(e) {
|
|
258
258
|
console.log("Browser", e);
|
|
259
259
|
}
|
|
260
|
-
},
|
|
260
|
+
}, J = class {
|
|
261
261
|
path;
|
|
262
262
|
data;
|
|
263
263
|
constructor(e) {
|
|
@@ -289,10 +289,10 @@ var I = class extends l {
|
|
|
289
289
|
return this.get()?.scripts ?? {};
|
|
290
290
|
}
|
|
291
291
|
getDir() {
|
|
292
|
-
return
|
|
292
|
+
return N(this.path);
|
|
293
293
|
}
|
|
294
294
|
getPath() {
|
|
295
|
-
return [...this.getDir(),
|
|
295
|
+
return [...this.getDir(), ae];
|
|
296
296
|
}
|
|
297
297
|
getCodeBuildOrRecovery() {
|
|
298
298
|
let e = this.getScripts();
|
|
@@ -303,8 +303,8 @@ var I = class extends l {
|
|
|
303
303
|
getCodePublish() {
|
|
304
304
|
return "publish-to-npm" in this.getScripts() ? "npm run publish-to-npm" : "npm publish --access public";
|
|
305
305
|
}
|
|
306
|
-
}, De =
|
|
307
|
-
async function
|
|
306
|
+
}, De = L(F);
|
|
307
|
+
async function Y(e, t, n = !1, r = !1) {
|
|
308
308
|
let i = e.getName(), [a, ...o] = t.split(" ");
|
|
309
309
|
try {
|
|
310
310
|
let { stdout: s, stderr: c } = await De(a, o, { cwd: u.joinPath(e.getDir()) });
|
|
@@ -314,37 +314,105 @@ async function K(e, t, n = !1, r = !1) {
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
//#endregion
|
|
317
|
-
//#region src/classes/
|
|
318
|
-
var
|
|
317
|
+
//#region src/classes/Git/GitIgnore.ts
|
|
318
|
+
var X = /^\/+|\/+$/g, Z = class {
|
|
319
|
+
comment;
|
|
320
|
+
content;
|
|
321
|
+
gitignorePath = ie;
|
|
322
|
+
paths = [];
|
|
323
|
+
constructor(e, t, n = ie) {
|
|
324
|
+
e && this.addPaths(e), this.comment = t, this.gitignorePath = n;
|
|
325
|
+
}
|
|
326
|
+
getComment() {
|
|
327
|
+
return this.comment;
|
|
328
|
+
}
|
|
329
|
+
setComment(e) {
|
|
330
|
+
return this.comment = e, this;
|
|
331
|
+
}
|
|
332
|
+
getContent() {
|
|
333
|
+
return this.content === void 0 && (this.content = String(u.readFileOnly(this.gitignorePath) ?? "").trim()), this.content;
|
|
334
|
+
}
|
|
335
|
+
getGitignorePath() {
|
|
336
|
+
return this.gitignorePath;
|
|
337
|
+
}
|
|
338
|
+
setGitignorePath(e) {
|
|
339
|
+
return this.gitignorePath = e, this.content = void 0, this;
|
|
340
|
+
}
|
|
341
|
+
getPaths() {
|
|
342
|
+
return this.paths;
|
|
343
|
+
}
|
|
344
|
+
setPaths(e) {
|
|
345
|
+
return this.paths = N(e), this;
|
|
346
|
+
}
|
|
347
|
+
addPaths(e) {
|
|
348
|
+
return this.paths.push(...N(e)), this;
|
|
349
|
+
}
|
|
350
|
+
resetContent() {
|
|
351
|
+
return this.content = void 0, this;
|
|
352
|
+
}
|
|
353
|
+
make() {
|
|
354
|
+
let e = this.toPaths();
|
|
355
|
+
if (e.length === 0) return !1;
|
|
356
|
+
let t = this.toLines(), n = this.getCommentLines(), r = t.length > 0 && n.length > 0 ? [""] : [], i = `${[
|
|
357
|
+
...t,
|
|
358
|
+
...r,
|
|
359
|
+
...n,
|
|
360
|
+
...e
|
|
361
|
+
].join("\n")}\n`;
|
|
362
|
+
return u.writeByPath(this.gitignorePath, i, !1), this.content = void 0, !0;
|
|
363
|
+
}
|
|
364
|
+
getCommentLines() {
|
|
365
|
+
if (j(this.comment)) {
|
|
366
|
+
let e = this.comment.trim(), t = e.startsWith("#") ? e : `# ${e}`;
|
|
367
|
+
if (!this.getContent().includes(t)) return [t];
|
|
368
|
+
}
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
toLines() {
|
|
372
|
+
let e = this.getContent();
|
|
373
|
+
return e ? e.split(/\r?\n/).map((e) => e.trim()) : [];
|
|
374
|
+
}
|
|
375
|
+
toPaths() {
|
|
376
|
+
let e = _e(this.paths.map((e) => e.trim()).filter((e) => j(e))), t = this.toLines();
|
|
377
|
+
return e.filter((e) => {
|
|
378
|
+
let n = e.replace(X, "");
|
|
379
|
+
return !t.some((e) => e.replace(X, "") === n);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}, Oe = [
|
|
319
383
|
".",
|
|
320
384
|
"logs",
|
|
321
385
|
"ui-build.log.json"
|
|
322
|
-
],
|
|
386
|
+
], ke = class {
|
|
323
387
|
path;
|
|
388
|
+
code;
|
|
389
|
+
logFile;
|
|
324
390
|
log;
|
|
325
|
-
constructor(e =
|
|
326
|
-
this.path = e, this.log = u.readFile(
|
|
391
|
+
constructor(e = h, t, n) {
|
|
392
|
+
this.path = e, this.code = t, this.logFile = n, this.log = u.readFile(this.getLogPath()) ?? {};
|
|
327
393
|
}
|
|
328
394
|
async make() {
|
|
329
395
|
let e = this.getList(), t = 0;
|
|
330
396
|
console.info(`Build packages(${e.length})...`);
|
|
331
397
|
for (let n of e) this.isUpdate(n) && await this.build(n) && (this.updateLog(n), t++);
|
|
332
|
-
this.saveLog(), console.info(t > 0 ? `Build packages changed: ${t}` : "Build packages - no changes");
|
|
333
|
-
}
|
|
334
|
-
async build(e) {
|
|
335
|
-
let t = e.getCodeBuildOrRecovery();
|
|
336
|
-
return t ? await K(e, t) : !1;
|
|
398
|
+
this.saveLog(), this.initGitIgnore(), console.info(t > 0 ? `Build packages changed: ${t}` : "Build packages - no changes");
|
|
337
399
|
}
|
|
338
400
|
isUpdate(e) {
|
|
339
401
|
return !e.isVersionConsistency(this.getVersionLog(e.getName()));
|
|
340
402
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
403
|
+
getCode(e) {
|
|
404
|
+
return this.code ? !this.code.includes(" ") && this.code in e.getScripts() ? `npm run ${this.code}` : void 0 : e.getCodeBuildOrRecovery();
|
|
405
|
+
}
|
|
406
|
+
getLogPath() {
|
|
407
|
+
if (this.logFile) {
|
|
408
|
+
let e = this.logFile.endsWith(".json") ? this.logFile : `${this.logFile}.log.json`;
|
|
409
|
+
return e.includes("/") || e.includes("\\") ? [e] : [
|
|
410
|
+
".",
|
|
411
|
+
"logs",
|
|
412
|
+
e
|
|
413
|
+
];
|
|
346
414
|
}
|
|
347
|
-
return
|
|
415
|
+
return Oe;
|
|
348
416
|
}
|
|
349
417
|
getVersionLog(e) {
|
|
350
418
|
return this.log?.[e] ?? "0.0.0";
|
|
@@ -352,20 +420,35 @@ var q = [
|
|
|
352
420
|
updateLog(e) {
|
|
353
421
|
this.log[e.getName()] = e.getVersion();
|
|
354
422
|
}
|
|
423
|
+
async build(e) {
|
|
424
|
+
let t = this.getCode(e);
|
|
425
|
+
return t ? await Y(e, t) : !1;
|
|
426
|
+
}
|
|
427
|
+
initGitIgnore() {
|
|
428
|
+
new Z(u.joinPath(this.getLogPath()), "Logs").make();
|
|
429
|
+
}
|
|
355
430
|
saveLog() {
|
|
356
|
-
u.writeByPath(
|
|
431
|
+
u.writeByPath(this.getLogPath(), this.log);
|
|
357
432
|
}
|
|
358
|
-
|
|
433
|
+
getList() {
|
|
434
|
+
let e = u.readDir(this.path), t = [];
|
|
435
|
+
for (let n of e) {
|
|
436
|
+
let e = new J([this.path, n]);
|
|
437
|
+
e.is() && !e.isTest() && t.push(e);
|
|
438
|
+
}
|
|
439
|
+
return t.sort((e, t) => (e.get()?.["ui-priority"] ?? 500) - (t.get()?.["ui-priority"] ?? 500));
|
|
440
|
+
}
|
|
441
|
+
}, Ae = L(F), je = class {
|
|
359
442
|
path;
|
|
360
|
-
constructor(e =
|
|
443
|
+
constructor(e = h) {
|
|
361
444
|
this.path = e;
|
|
362
445
|
}
|
|
363
446
|
async make() {
|
|
364
447
|
let e = u.readDir(this.path), t = 0;
|
|
365
448
|
console.info(`Publish packages(${e.length})...`);
|
|
366
449
|
for (let n of e) {
|
|
367
|
-
let e = new
|
|
368
|
-
e.is() && !e.isNoPublish() && await this.isUpdate(e) && await
|
|
450
|
+
let e = new J([this.path, n]);
|
|
451
|
+
e.is() && !e.isNoPublish() && await this.isUpdate(e) && await Y(e, e.getCodePublish(), !0, !0) && t++;
|
|
369
452
|
}
|
|
370
453
|
console.info(t > 0 ? `Publish packages changed: ${t}` : "Publish packages - no changes");
|
|
371
454
|
}
|
|
@@ -375,7 +458,7 @@ var q = [
|
|
|
375
458
|
}
|
|
376
459
|
async getNpmVersion(e) {
|
|
377
460
|
try {
|
|
378
|
-
let { stdout: t } = await
|
|
461
|
+
let { stdout: t } = await Ae("npm", [
|
|
379
462
|
"view",
|
|
380
463
|
e,
|
|
381
464
|
"version"
|
|
@@ -385,12 +468,12 @@ var q = [
|
|
|
385
468
|
return;
|
|
386
469
|
}
|
|
387
470
|
}
|
|
388
|
-
},
|
|
471
|
+
}, Me = class {
|
|
389
472
|
file;
|
|
390
473
|
isReading = !1;
|
|
391
474
|
url;
|
|
392
475
|
constructor(e = "./ai-screenshot/screenshot") {
|
|
393
|
-
this.file = e,
|
|
476
|
+
this.file = e, O.setErrorStatus(!0);
|
|
394
477
|
}
|
|
395
478
|
async make() {
|
|
396
479
|
console.info("Screenshot");
|
|
@@ -400,7 +483,7 @@ var q = [
|
|
|
400
483
|
listener = async () => {
|
|
401
484
|
if (this.url && !this.isReading) {
|
|
402
485
|
this.isReading = !0, console.info("URL", this.url);
|
|
403
|
-
let e = new
|
|
486
|
+
let e = new q(this.url, { height: 12288 });
|
|
404
487
|
return await e.screenshot(this.file), u.writeByPath(`${this.file}-code.html`, await e.getBody()), u.writeByPath(`${this.file}-styles.css`, await e.getStyles()), !0;
|
|
405
488
|
}
|
|
406
489
|
return !1;
|
|
@@ -424,27 +507,27 @@ var q = [
|
|
|
424
507
|
let t = e.match(/(https?:\/\/localhost\S+)/);
|
|
425
508
|
return t && (this.url = t[1]), this;
|
|
426
509
|
}
|
|
427
|
-
},
|
|
510
|
+
}, Ne = /* @__PURE__ */ new Map([
|
|
428
511
|
["claude", () => new s()],
|
|
429
|
-
["claude-agent", () => new
|
|
430
|
-
["claude-cli", () => new
|
|
512
|
+
["claude-agent", () => new B()],
|
|
513
|
+
["claude-cli", () => new U()],
|
|
431
514
|
["gemini", () => new e()],
|
|
432
|
-
["gemini-cli", () => new
|
|
515
|
+
["gemini-cli", () => new G()],
|
|
433
516
|
["openai", () => new o()],
|
|
434
517
|
["zai", () => new c()]
|
|
435
518
|
]);
|
|
436
|
-
function
|
|
519
|
+
function Pe() {
|
|
437
520
|
let e = d.getAiType();
|
|
438
|
-
return
|
|
521
|
+
return Ne.get(e)?.();
|
|
439
522
|
}
|
|
440
523
|
//#endregion
|
|
441
524
|
//#region src/classes/Design/DesignTypesAi.ts
|
|
442
|
-
var
|
|
525
|
+
var Fe = class {
|
|
443
526
|
dir;
|
|
444
527
|
projectName;
|
|
445
528
|
dirArray;
|
|
446
529
|
constructor(e = d.getTypesTemporaryDirectory()) {
|
|
447
|
-
this.dir = e, this.dirArray = this.dir.split("/"), this.projectName =
|
|
530
|
+
this.dir = e, this.dirArray = this.dir.split("/"), this.projectName = D()?.name ?? "none";
|
|
448
531
|
}
|
|
449
532
|
isFile(e) {
|
|
450
533
|
return e.endsWith(".d.ts");
|
|
@@ -462,7 +545,7 @@ var Y = class {
|
|
|
462
545
|
return this.projectName;
|
|
463
546
|
}
|
|
464
547
|
async toAi(e, t, n) {
|
|
465
|
-
let r =
|
|
548
|
+
let r = Pe();
|
|
466
549
|
if (r) {
|
|
467
550
|
n && r.addPrompt(`File JS Code (SUPPLEMENTARY REFERENCE & CONTEXT ONLY):
|
|
468
551
|
The following JavaScript code is provided STRICTLY as supplementary background context to give a full picture of implementation details and logic.
|
|
@@ -489,12 +572,12 @@ ${e}\n\`\`\``);
|
|
|
489
572
|
return;
|
|
490
573
|
}
|
|
491
574
|
}
|
|
492
|
-
},
|
|
575
|
+
}, Ie = class {
|
|
493
576
|
temporaryDirectory;
|
|
494
577
|
constructor(e = d.getTypesTemporaryDirectory()) {
|
|
495
578
|
this.temporaryDirectory = e;
|
|
496
579
|
}
|
|
497
|
-
},
|
|
580
|
+
}, Le = class extends Ie {
|
|
498
581
|
configuration;
|
|
499
582
|
constructor(e = d.getTypesTemporaryDirectory()) {
|
|
500
583
|
super(e);
|
|
@@ -504,7 +587,7 @@ ${e}\n\`\`\``);
|
|
|
504
587
|
}
|
|
505
588
|
isVue() {
|
|
506
589
|
if (d.isTypesWithoutVue()) return !1;
|
|
507
|
-
let e = d.getTypesPaths(), t =
|
|
590
|
+
let e = d.getTypesPaths(), t = j(e) ? e : ["src"];
|
|
508
591
|
for (let e of t) {
|
|
509
592
|
let t = this.resolveDirectory(e);
|
|
510
593
|
if (u.is(t)) {
|
|
@@ -544,17 +627,17 @@ ${e}\n\`\`\``);
|
|
|
544
627
|
}
|
|
545
628
|
isMatch(e) {
|
|
546
629
|
let t = d.getTypesMatch();
|
|
547
|
-
return !
|
|
630
|
+
return !j(t) || this.isPattern(e, t);
|
|
548
631
|
}
|
|
549
632
|
isPath(e) {
|
|
550
633
|
let t = d.getTypesPaths();
|
|
551
|
-
return !
|
|
634
|
+
return !j(t) || t.some((t) => {
|
|
552
635
|
let n = t.replace(/^[./\\]+/, "").replace(/[/\\]+$/, ""), r = n.replace(/^src[/\\]/, "");
|
|
553
636
|
return e.startsWith(n) || e.startsWith(`./${n}`) || e.startsWith(r) || e.startsWith(`./${r}`) || e.includes(`/${n}/`) || e.includes(`\\${n}\\`) || e.includes(`/${r}/`) || e.includes(`\\${r}\\`);
|
|
554
637
|
});
|
|
555
638
|
}
|
|
556
639
|
isPattern(e, t) {
|
|
557
|
-
return
|
|
640
|
+
return j(t) ? N(t).some((t) => {
|
|
558
641
|
try {
|
|
559
642
|
return new RegExp(t).test(e);
|
|
560
643
|
} catch {
|
|
@@ -573,13 +656,13 @@ ${e}\n\`\`\``);
|
|
|
573
656
|
if (this.configuration) return this.configuration;
|
|
574
657
|
let e = u.getRoot(), t = this.getTsConfigName();
|
|
575
658
|
if (t) {
|
|
576
|
-
let n =
|
|
659
|
+
let n = R.findConfigFile(e, R.sys.fileExists, t);
|
|
577
660
|
if (n) {
|
|
578
|
-
let e =
|
|
579
|
-
if (!e.error) return this.configuration =
|
|
661
|
+
let e = R.readConfigFile(n, R.sys.readFile);
|
|
662
|
+
if (!e.error) return this.configuration = R.parseJsonConfigFileContent(e.config, R.sys, u.getPathDir(n), void 0, n, void 0, [{
|
|
580
663
|
extension: ".vue",
|
|
581
664
|
isMixedContent: !0,
|
|
582
|
-
scriptKind:
|
|
665
|
+
scriptKind: R.ScriptKind.Deferred
|
|
583
666
|
}]), this.configuration;
|
|
584
667
|
}
|
|
585
668
|
}
|
|
@@ -587,7 +670,7 @@ ${e}\n\`\`\``);
|
|
|
587
670
|
getTsSourceFiles() {
|
|
588
671
|
let e = this.getTsConfiguration();
|
|
589
672
|
if (e && e.fileNames.length > 0) return e.fileNames.filter((e) => this.isAllowed(e));
|
|
590
|
-
let t = d.getTypesPaths(), n =
|
|
673
|
+
let t = d.getTypesPaths(), n = j(t) ? t : ["src"], r = [];
|
|
591
674
|
for (let e of n) {
|
|
592
675
|
let t = this.resolveDirectory(e);
|
|
593
676
|
if (u.is(t)) {
|
|
@@ -610,8 +693,8 @@ ${e}\n\`\`\``);
|
|
|
610
693
|
noEmit: !1,
|
|
611
694
|
outDir: e,
|
|
612
695
|
...r ? { rootDir: r } : {}
|
|
613
|
-
}, a =
|
|
614
|
-
|
|
696
|
+
}, a = R.createCompilerHost(i);
|
|
697
|
+
R.createProgram(n, i, a).emit(), this.cleanExcess();
|
|
615
698
|
}
|
|
616
699
|
return this;
|
|
617
700
|
}
|
|
@@ -620,7 +703,7 @@ ${e}\n\`\`\``);
|
|
|
620
703
|
if (e) {
|
|
621
704
|
let t = `npx vue-tsc -p ${e} --declaration --emitDeclarationOnly --outDir ${this.getTemporaryDirectory()} --noEmit false --rootDir src --noEmitOnError false`;
|
|
622
705
|
try {
|
|
623
|
-
|
|
706
|
+
I(t, {
|
|
624
707
|
cwd: u.getRoot(),
|
|
625
708
|
stdio: "pipe"
|
|
626
709
|
});
|
|
@@ -645,7 +728,7 @@ ${e}\n\`\`\``);
|
|
|
645
728
|
let n = u.joinPath(["src", t]);
|
|
646
729
|
return u.is(n) ? n : u.joinPath(t);
|
|
647
730
|
}
|
|
648
|
-
},
|
|
731
|
+
}, Re = class {
|
|
649
732
|
ai;
|
|
650
733
|
makeTypes;
|
|
651
734
|
prompts;
|
|
@@ -654,7 +737,7 @@ ${e}\n\`\`\``);
|
|
|
654
737
|
this.ai = e, this.makeTypes = t, this.prompts = n;
|
|
655
738
|
}
|
|
656
739
|
is() {
|
|
657
|
-
return u.is(
|
|
740
|
+
return u.is(g);
|
|
658
741
|
}
|
|
659
742
|
getFullDescription() {
|
|
660
743
|
return this.fullDescription ?? "";
|
|
@@ -664,19 +747,19 @@ ${e}\n\`\`\``);
|
|
|
664
747
|
return this.fullDescription = r, this.saveDescription(r), this;
|
|
665
748
|
}
|
|
666
749
|
saveDescription(e) {
|
|
667
|
-
u.writeByPath(
|
|
750
|
+
u.writeByPath(g, e);
|
|
668
751
|
}
|
|
669
752
|
async toAiDescription(e, t) {
|
|
670
|
-
return !
|
|
753
|
+
return !j(e) && !j(t) ? "" : await this.ai.toAi(e, "Goal: Generate a concise package overview for an AI coding assistant detailing what this package is, why to study it, and listing its key capabilities.\n\nSTRUCTURE & CONTENT REQUIREMENTS:\n1. Package Description: 2-3 concise sentences explaining in clear language what this package contains and what it is intended for (e.g., \"This package contains all UI components...\" or \"This package provides everything needed to work with...\"), as well as the practical tasks for which an AI assistant must study \"ai-types.md\" (without abstract keyword lists).\n2. Key Capabilities: A single comma-separated list of key functional capabilities (e.g., \"Key Capabilities: Form Controls, API Integration, Storage State\") formulated as search markers to enable an AI agent to quickly and accurately find the required package for a specific task via text search. Each item must be a concrete, searchable functional term strictly 1 to 3 words long.\n\nCRITICAL RESTRICTIONS:\n- Package Description MUST be a coherent text describing the actual contents and purpose of the package, NOT a collection of keywords.\n- Items in Key Capabilities MUST be concrete search markers of the package capabilities, optimized for AI text search rather than generic abstract phrases.\n- Key Capabilities MUST be formatted strictly as a single comma-separated list, NOT as bullet points or separate lines.\n- Each item in the Key Capabilities list MUST be strictly 1 to 3 words.\n- Do NOT list individual method, function, or class names.\n- Analyze ONLY the provided type definitions and JS code.\n- Do NOT wrap output in markdown code blocks (```).\n\nOUTPUT REQUIREMENTS:\nReturn ONLY the final description text. No explanations, no code blocks, and no conversational fluff.\n", t) ?? "";
|
|
671
754
|
}
|
|
672
|
-
},
|
|
755
|
+
}, Q = class {
|
|
673
756
|
ai;
|
|
674
757
|
dir;
|
|
675
758
|
dirDist;
|
|
676
759
|
constructor(e, t = d.getTypesTemporaryDirectory(), n = d.getDistDir()) {
|
|
677
760
|
this.ai = e, this.dir = t, this.dirDist = n;
|
|
678
761
|
}
|
|
679
|
-
},
|
|
762
|
+
}, ze = class {
|
|
680
763
|
ai;
|
|
681
764
|
dir;
|
|
682
765
|
dirDist;
|
|
@@ -693,11 +776,11 @@ ${e}\n\`\`\``);
|
|
|
693
776
|
return this.listByFilterJs === void 0 && (this.listByFilterJs = this.getListBy((e) => this.ai.isFileJs(e), this.getDistDirectory())), this.listByFilterJs;
|
|
694
777
|
}
|
|
695
778
|
getListCache() {
|
|
696
|
-
return this.listCache === void 0 && (this.listCache = this.getListBy((e) => this.ai.isFile(e),
|
|
779
|
+
return this.listCache === void 0 && (this.listCache = this.getListBy((e) => this.ai.isFile(e), m)), this.listCache;
|
|
697
780
|
}
|
|
698
781
|
getListAi(e) {
|
|
699
|
-
return
|
|
700
|
-
let t = u.readFileOnly([
|
|
782
|
+
return k(e, (e) => {
|
|
783
|
+
let t = u.readFileOnly([m, e.path]), n = t ? t.replace(/^\/\/ md5:[^\n]*\n?/, "") : e.content;
|
|
701
784
|
return {
|
|
702
785
|
...e,
|
|
703
786
|
content: n.trim()
|
|
@@ -705,29 +788,29 @@ ${e}\n\`\`\``);
|
|
|
705
788
|
});
|
|
706
789
|
}
|
|
707
790
|
toOneFile(e) {
|
|
708
|
-
return
|
|
791
|
+
return k(e, (e) => e.content).join("\n\n");
|
|
709
792
|
}
|
|
710
793
|
readFile(e, t = this.getTemporaryDirectory()) {
|
|
711
794
|
return u.readFileOnly(this.getPath(e, t));
|
|
712
795
|
}
|
|
713
796
|
save(e) {
|
|
714
|
-
let t =
|
|
797
|
+
let t = D();
|
|
715
798
|
if (t) {
|
|
716
|
-
let n = t.version ? ` (v${t.version})` : ""
|
|
717
|
-
u.writeByPath(
|
|
799
|
+
let n = t.version ? ` (v${t.version})` : "", r = e.trim(), i = r.startsWith("```") ? r : `\`\`\`typescript\n${r}\n\`\`\``;
|
|
800
|
+
u.writeByPath(T, [
|
|
718
801
|
`All these methods are in the ${t.name}${n} library.`,
|
|
719
802
|
"",
|
|
720
|
-
|
|
803
|
+
i
|
|
721
804
|
].join("\n"));
|
|
722
805
|
}
|
|
723
806
|
}
|
|
724
807
|
saveFile(e, t = !1) {
|
|
725
|
-
u.writeByPath([
|
|
808
|
+
u.writeByPath([m, e.path], `${this.getMd5Header(e.md5, t)}\n${e.content}`);
|
|
726
809
|
}
|
|
727
810
|
saveList(e) {
|
|
728
|
-
return
|
|
729
|
-
let t = [
|
|
730
|
-
if (!
|
|
811
|
+
return k(e, (e) => {
|
|
812
|
+
let t = [m, e.path], n = u.readFileOnly(t);
|
|
813
|
+
if (!j(n) || !n.startsWith(this.getMd5Header(e.md5))) return this.saveFile(e), e;
|
|
731
814
|
if (!n.startsWith(this.getMd5Header(e.md5, !0))) return e;
|
|
732
815
|
});
|
|
733
816
|
}
|
|
@@ -738,7 +821,7 @@ ${e}\n\`\`\``);
|
|
|
738
821
|
return u.is(e) ? u.readDirRecursive(e) : [];
|
|
739
822
|
}
|
|
740
823
|
getListBy(e, t = this.getTemporaryDirectory()) {
|
|
741
|
-
return
|
|
824
|
+
return k(this.getList(t), (n) => {
|
|
742
825
|
if (e(n)) {
|
|
743
826
|
let e = this.readFile(n, t);
|
|
744
827
|
if (this.isContent(e)) return {
|
|
@@ -761,36 +844,36 @@ ${e}\n\`\`\``);
|
|
|
761
844
|
getDistDirectory() {
|
|
762
845
|
return this.dirDist;
|
|
763
846
|
}
|
|
764
|
-
},
|
|
847
|
+
}, Be = class {
|
|
765
848
|
cleanContent(e) {
|
|
766
|
-
let t =
|
|
849
|
+
let t = R.createSourceFile("clean.d.ts", e, R.ScriptTarget.Latest, !0, R.ScriptKind.TS), n = R.transform(t, [this.getCleanTransformer()]), r = R.createPrinter({ newLine: R.NewLineKind.LineFeed }).printNode(R.EmitHint.Unspecified, n.transformed[0], t);
|
|
767
850
|
return n.dispose(), r.replace(/^\s*\/\/.*$/gm, "").replace(/^\s*[\r\n]/gm, "").trim();
|
|
768
851
|
}
|
|
769
852
|
getCleanTransformer() {
|
|
770
853
|
return (e) => (t) => {
|
|
771
854
|
let n = (t) => {
|
|
772
|
-
if (!(this.isRelativeImport(t) || this.isRelativeExport(t) || this.isNonPublicMember(t))) return
|
|
855
|
+
if (!(this.isRelativeImport(t) || this.isRelativeExport(t) || this.isNonPublicMember(t))) return R.visitEachChild(t, n, e);
|
|
773
856
|
};
|
|
774
|
-
return
|
|
857
|
+
return R.visitNode(t, n);
|
|
775
858
|
};
|
|
776
859
|
}
|
|
777
860
|
isNonPublicMember(e) {
|
|
778
|
-
return !!(
|
|
861
|
+
return !!(R.canHaveModifiers(e) ? R.getModifiers(e) : void 0)?.some((e) => e.kind === R.SyntaxKind.PrivateKeyword || e.kind === R.SyntaxKind.ProtectedKeyword);
|
|
779
862
|
}
|
|
780
863
|
isRelativeImport(e) {
|
|
781
|
-
return
|
|
864
|
+
return R.isImportDeclaration(e) && R.isStringLiteral(e.moduleSpecifier) && e.moduleSpecifier.text.startsWith(".");
|
|
782
865
|
}
|
|
783
866
|
isRelativeExport(e) {
|
|
784
|
-
return
|
|
867
|
+
return R.isExportDeclaration(e) && e.moduleSpecifier !== void 0 && R.isStringLiteral(e.moduleSpecifier) && e.moduleSpecifier.text.startsWith(".");
|
|
785
868
|
}
|
|
786
|
-
},
|
|
869
|
+
}, Ve = "Goal: Optimize TypeScript type definitions for declarations in `File Content`.\n\nSCOPE & CONTEXT:\n- Process STRICTLY entities in `File Content`. Do NOT add unexported entities or code from `File JS Code`.\n- Use `File JS Code` ONLY as reference to understand implementation logic for writing JSDoc descriptions.\n- AI coding agents will rely EXCLUSIVELY on this output. Ensure complete type contracts and clear JSDoc descriptions.\n- Do NOT include file paths, links, or internal imports in the output.\n\nJSDOC RULES:\n- MANDATORY FOR ALL CLASSES, METHODS, FUNCTIONS & ACCESSORS: Every `class`, `declare class`, `abstract class`, `function`, `declare function`, method (public/static/abstract), `constructor`, and `get`/`set` accessor MUST ALWAYS have a JSDoc description.\n * Style: Descriptions MUST be maximally clear and informative, yet maximally short and concise. Avoid fluff.\n * Single-Line Preference: Prefer single-line JSDoc format (`/** Description @keywords search_terms */`) to conserve vertical space and reduce file size.\n * Remove `@param` and `@return` / `@returns`: STRICTLY REMOVE `@param`, `@return`, and `@returns` tags from all JSDoc comments.\n * AI Search Keywords: Include relevant search tags/keywords (e.g. `@keywords` tag or search terms) to help AI code search easily discover functionality.\n * Allowed tags: PRESERVE ONLY `@example`, `@remarks`, `@note`, `@warning`, and `@keywords`. Remove `@param`, `@return`/`@returns`, and all other tags.\n * If JSDoc is missing: Generate a clear, concise, search-optimized English JSDoc derived from inspecting `File JS Code`.\n * If JSDoc exists: Optimize, condense, translate to English, and apply tag rules.\n- TYPES, INTERFACES & ENUMS: Delete JSDoc for simple/obvious types; add or keep concise JSDoc for complex types.\n- Place JSDoc directly above declarations. Remove regular inline comments (`//` or `/* */`).\n\nCLEANING & STRUCTURING:\n- Remove internal `import` statements and internal re-exports. Keep external package exports.\n- Delete non-public content (private/protected members, unexported elements). Keep all public API surfaces.\n- Do NOT delete any `type` definitions. Preserve abstract classes.\n- Format output tightly without unnecessary blank lines.\n\nOUTPUT FORMAT:\nReturn ONLY raw TypeScript code corresponding to `File Content`. No markdown, no code blocks (```), no text explanations.\n", He = class extends Q {
|
|
787
870
|
fullContent;
|
|
788
871
|
fullJsContent;
|
|
789
872
|
AI_TYPES_CONCURRENCY = d.getAiTypesConcurrency();
|
|
790
|
-
tsTransformer = new
|
|
873
|
+
tsTransformer = new Be();
|
|
791
874
|
files;
|
|
792
875
|
constructor(e, t = d.getTypesTemporaryDirectory(), n = d.getDistDir()) {
|
|
793
|
-
super(e, t, n), this.files = new
|
|
876
|
+
super(e, t, n), this.files = new ze(this.ai, this.dir, this.dirDist);
|
|
794
877
|
}
|
|
795
878
|
getFullContent() {
|
|
796
879
|
if (this.fullContent === void 0) {
|
|
@@ -823,41 +906,41 @@ ${e}\n\`\`\``);
|
|
|
823
906
|
let e;
|
|
824
907
|
for (; (e = r.shift()) !== void 0;) {
|
|
825
908
|
let r = this.cleanContent(e.content);
|
|
826
|
-
|
|
909
|
+
j(r) && (i += 1, console.log(`-- processing AI types [${i}/${n}] for ${e.path}...`), r = await this.toAiEdit(r, this.hasJSDoc(r) ? "" : t)), r ? this.files.saveFile({
|
|
827
910
|
...e,
|
|
828
911
|
content: r
|
|
829
|
-
}, !0);
|
|
912
|
+
}, !0) : console.warn(`[Warning] Failed to generate AI types for: ${e.path}`);
|
|
830
913
|
}
|
|
831
914
|
};
|
|
832
915
|
await Promise.all(Array.from({ length: Math.min(this.AI_TYPES_CONCURRENCY, n) }, () => a()));
|
|
833
916
|
}
|
|
834
917
|
async toAiEdit(e, t) {
|
|
835
|
-
return await this.ai.toAi(e,
|
|
918
|
+
return await this.ai.toAi(e, Ve, t);
|
|
836
919
|
}
|
|
837
|
-
},
|
|
920
|
+
}, Ue = class {
|
|
838
921
|
ai;
|
|
839
922
|
prompts;
|
|
840
923
|
constructor(e, t) {
|
|
841
924
|
this.ai = e, this.prompts = t;
|
|
842
925
|
}
|
|
843
926
|
is() {
|
|
844
|
-
return u.is(
|
|
927
|
+
return u.is(_);
|
|
845
928
|
}
|
|
846
929
|
async make() {
|
|
847
930
|
let e = this.ai.getProjectName(), t = [];
|
|
848
931
|
t.push({
|
|
849
|
-
uri: `${e}/${
|
|
932
|
+
uri: `${e}/${T}`,
|
|
850
933
|
name: `Type Definitions (${e})`,
|
|
851
934
|
mimeType: "text/markdown",
|
|
852
935
|
description: "TypeScript type definitions and signatures for AI coding assistant."
|
|
853
936
|
}), t.push({
|
|
854
|
-
uri: `${e}/${
|
|
937
|
+
uri: `${e}/${g}`,
|
|
855
938
|
name: `Project Overview (${e})`,
|
|
856
939
|
mimeType: "text/markdown",
|
|
857
940
|
description: "Project overview, usage guidelines, and mandatory prompt rules for AI coding assistant."
|
|
858
941
|
}), t.push(...this.getScreenshotList(e));
|
|
859
942
|
let n = this.prompts.getCacheList();
|
|
860
|
-
for (let r of n)
|
|
943
|
+
for (let r of n) j(r.name) && j(r.description) && t.push({
|
|
861
944
|
uri: `${e}/${r.path}`,
|
|
862
945
|
name: `${r.name} (${e})`,
|
|
863
946
|
mimeType: "text/markdown",
|
|
@@ -882,15 +965,15 @@ ${e}\n\`\`\``);
|
|
|
882
965
|
return t;
|
|
883
966
|
}
|
|
884
967
|
saveMcp(e) {
|
|
885
|
-
u.writeByPath(
|
|
968
|
+
u.writeByPath(_, JSON.stringify(e, null, 2));
|
|
886
969
|
}
|
|
887
|
-
},
|
|
970
|
+
}, We = class {
|
|
888
971
|
promptsDir;
|
|
889
972
|
ai;
|
|
890
973
|
constructor(e = d.getAiResourcesDir(), t) {
|
|
891
974
|
this.promptsDir = e, this.ai = t;
|
|
892
975
|
}
|
|
893
|
-
},
|
|
976
|
+
}, Ge = "Goal: Generate a document metadata object in valid JSON format for an AI coding assistant.\n\nCRITICAL RESTRICTIONS:\n- The output MUST be a valid JSON object with keys: \"name\" and \"description\".\n- Field \"name\": Short and concise document title (maximum 4-5 words).\n- Field \"description\": Short and concise description for an AI agent explaining what exact standards, rules, or tools this file contains and what commercial or technical task it solves (must be short, maximum 15-20 words).\n- Do NOT include markdown code block wrappers (```json). Return ONLY the raw JSON string.\n\nEXAMPLES OF GOOD OUTPUT:\n{\n \"name\": \"Coding Standards\",\n \"description\": \"Строгие архитектурные конвенции и стандарты написания кода для продукта\"\n}\n\nOUTPUT REQUIREMENTS:\nReturn ONLY the JSON object. No explanations, no markdown formatting, no conversational text.\n", Ke = class extends We {
|
|
894
977
|
listPrompts;
|
|
895
978
|
cacheList;
|
|
896
979
|
getCacheList() {
|
|
@@ -898,7 +981,7 @@ ${e}\n\`\`\``);
|
|
|
898
981
|
let e = this.getCacheDir(), t = u.readDirRecursive(e), n = [];
|
|
899
982
|
for (let r of t) if (r.endsWith(".json")) {
|
|
900
983
|
let t = u.readFile([e, r]);
|
|
901
|
-
t &&
|
|
984
|
+
t && j(t.path) && j(t.name) && j(t.description) && n.push(t);
|
|
902
985
|
}
|
|
903
986
|
this.cacheList = n;
|
|
904
987
|
}
|
|
@@ -907,7 +990,7 @@ ${e}\n\`\`\``);
|
|
|
907
990
|
getListPrompts() {
|
|
908
991
|
if (this.listPrompts === void 0) {
|
|
909
992
|
let e = u.readDirRecursive(this.promptsDir);
|
|
910
|
-
this.listPrompts =
|
|
993
|
+
this.listPrompts = k(e, (e) => {
|
|
911
994
|
if (e.endsWith(".json")) return;
|
|
912
995
|
let t = `${this.promptsDir}/${e}`, n = u.readFileOnly(t);
|
|
913
996
|
if (n) return {
|
|
@@ -924,7 +1007,7 @@ ${e}\n\`\`\``);
|
|
|
924
1007
|
let e = this.getListPrompts(), t = this.getCacheList(), n = [];
|
|
925
1008
|
for (let r of e) {
|
|
926
1009
|
let e = t.find((e) => e.path === r.path);
|
|
927
|
-
e &&
|
|
1010
|
+
e && j(e.description) && n.push(this.getPromptLine(r.path, e.description));
|
|
928
1011
|
}
|
|
929
1012
|
return n;
|
|
930
1013
|
}
|
|
@@ -940,7 +1023,7 @@ You MUST evaluate whether your task relates to any of the following topics (even
|
|
|
940
1023
|
${e.join("\n")}` : "";
|
|
941
1024
|
}
|
|
942
1025
|
getCacheDir() {
|
|
943
|
-
return u.joinPath([
|
|
1026
|
+
return u.joinPath([m, ne]);
|
|
944
1027
|
}
|
|
945
1028
|
getCachePath(e) {
|
|
946
1029
|
let t = e.replace(RegExp(`^${this.promptsDir}/`), "").replace(/\.[^/.]+$/, ".json");
|
|
@@ -950,7 +1033,7 @@ ${e.join("\n")}` : "";
|
|
|
950
1033
|
return this.ai.getMd5(e);
|
|
951
1034
|
}
|
|
952
1035
|
getPromptLine(e, t) {
|
|
953
|
-
return `- '${
|
|
1036
|
+
return `- '${E}/${this.ai.getProjectName()}/${e}': ${t}`;
|
|
954
1037
|
}
|
|
955
1038
|
saveCacheItem(e) {
|
|
956
1039
|
u.writeByPath(this.getCachePath(e.path), e);
|
|
@@ -960,17 +1043,17 @@ ${e.join("\n")}` : "";
|
|
|
960
1043
|
for (let t of e) this.saveCacheItem(t);
|
|
961
1044
|
}
|
|
962
1045
|
async toAiPromptData(e) {
|
|
963
|
-
return this.ai.toAiJson(e,
|
|
1046
|
+
return this.ai.toAiJson(e, Ge);
|
|
964
1047
|
}
|
|
965
1048
|
async toAiPromptItem(e) {
|
|
966
1049
|
let t = e.md5 ?? this.getMd5(e.content), n = this.getCacheList(), r = n.findIndex((t) => t.path === e.path), i = r >= 0 ? n[r] : void 0;
|
|
967
|
-
if (i && i.md5 === t &&
|
|
1050
|
+
if (i && i.md5 === t && j(i.name) && j(i.description)) return {
|
|
968
1051
|
prompt: this.getPromptLine(e.path, i.description),
|
|
969
1052
|
isChanged: !1
|
|
970
1053
|
};
|
|
971
1054
|
console.log(`-- processing prompt metadata for ${e.path}...`);
|
|
972
1055
|
let a = await this.toAiPromptData(e.content);
|
|
973
|
-
if (a &&
|
|
1056
|
+
if (a && j(a.name) && j(a.description)) {
|
|
974
1057
|
let i = {
|
|
975
1058
|
path: e.path,
|
|
976
1059
|
md5: t,
|
|
@@ -984,7 +1067,7 @@ ${e.join("\n")}` : "";
|
|
|
984
1067
|
}
|
|
985
1068
|
return { isChanged: !1 };
|
|
986
1069
|
}
|
|
987
|
-
},
|
|
1070
|
+
}, qe = class {
|
|
988
1071
|
promptsDir;
|
|
989
1072
|
dir;
|
|
990
1073
|
dirDist;
|
|
@@ -996,8 +1079,8 @@ ${e.join("\n")}` : "";
|
|
|
996
1079
|
prompts;
|
|
997
1080
|
constructor(e = d.getAiResourcesDir(), t = d.getTypesTemporaryDirectory(), n = d.getDistDir(), r = {}) {
|
|
998
1081
|
this.promptsDir = e, this.dir = t, this.dirDist = n;
|
|
999
|
-
let { DesignTypesBuildConstructor: i =
|
|
1000
|
-
|
|
1082
|
+
let { DesignTypesBuildConstructor: i = Le, DesignTypesMakeConstructor: a = He, DesignTypesPromptsConstructor: o = Ke } = r;
|
|
1083
|
+
O.setErrorStatus(!0), this.ai = new Fe(this.dir), this.buildTypes = new i(this.dir), this.makeTypes = new a(this.ai, this.dir, this.dirDist), this.prompts = new o(this.promptsDir, this.ai), this.description = new Re(this.ai, this.makeTypes, this.prompts), this.mcp = new Ue(this.ai, this.prompts);
|
|
1001
1084
|
}
|
|
1002
1085
|
async make() {
|
|
1003
1086
|
console.log("DesignTypes: making AI types...");
|
|
@@ -1006,17 +1089,24 @@ ${e.join("\n")}` : "";
|
|
|
1006
1089
|
} finally {
|
|
1007
1090
|
this.buildTypes.clean();
|
|
1008
1091
|
}
|
|
1009
|
-
return console.log("DesignTypes: AI types saved."), this;
|
|
1092
|
+
return this.initGitIgnore(), console.log("DesignTypes: AI types saved."), this;
|
|
1010
1093
|
}
|
|
1011
1094
|
async makeSave() {
|
|
1012
|
-
return console.log("DesignTypes: saving AI types from list..."), this.makeTypes.makeSave(), this.description.is() || await this.description.make(), this.mcp.is() || await this.mcp.make(), console.log("DesignTypes: AI types saved."), this;
|
|
1095
|
+
return console.log("DesignTypes: saving AI types from list..."), this.makeTypes.makeSave(), this.description.is() || await this.description.make(), this.mcp.is() || await this.mcp.make(), this.initGitIgnore(), console.log("DesignTypes: AI types saved."), this;
|
|
1096
|
+
}
|
|
1097
|
+
initGitIgnore() {
|
|
1098
|
+
new Z([
|
|
1099
|
+
T,
|
|
1100
|
+
g,
|
|
1101
|
+
_
|
|
1102
|
+
], "AI Resources").make();
|
|
1013
1103
|
}
|
|
1014
|
-
},
|
|
1104
|
+
}, Je = /* @__PURE__ */ function(e) {
|
|
1015
1105
|
return e.MODIFIED = "M", e.ADDED = "A", e.DELETED = "D", e.RENAMED = "R", e.COPIED = "C", e.UPDATED = "U", e.UNTRACKED = "??", e.IGNORED = "!!", e.BOTH_MODIFIED = "UU", e.ADDED_BY_US = "AU", e.DELETED_BY_US = "DU", e.ADDED_BY_THEM = "UA", e.DELETED_BY_THEM = "UD", e.BOTH_ADDED = "AA", e.BOTH_DELETED = "DD", e.MODIFIED_IN_INDEX = "MM", e.ADDED_IN_INDEX = "AM", e.DELETED_IN_INDEX = "DM", e.RENAMED_IN_INDEX = "RM", e.COPIED_IN_INDEX = "CM", e;
|
|
1016
|
-
}({}),
|
|
1106
|
+
}({}), Ye = class {
|
|
1017
1107
|
static getList(e) {
|
|
1018
1108
|
let t = this.getDirPrefix();
|
|
1019
|
-
return
|
|
1109
|
+
return k(this.getFilesPath(), (n) => {
|
|
1020
1110
|
if (e && !e(n)) return;
|
|
1021
1111
|
let r = this.getDate(this.getFileDate(n));
|
|
1022
1112
|
return {
|
|
@@ -1030,10 +1120,10 @@ ${e.join("\n")}` : "";
|
|
|
1030
1120
|
}
|
|
1031
1121
|
static getListPorcelain(e) {
|
|
1032
1122
|
let t = this.getDate(), n = this.getDirPrefix();
|
|
1033
|
-
return
|
|
1123
|
+
return k(this.getFilesPorcelain(), (r) => {
|
|
1034
1124
|
let i = r.replace(/ {2,}/, " ").split(" ", 2), a = i[0], o = i[1] ?? "";
|
|
1035
1125
|
if (e && !e(o)) return;
|
|
1036
|
-
let s =
|
|
1126
|
+
let s = he(o, n), c = this.splitPath(s);
|
|
1037
1127
|
return {
|
|
1038
1128
|
path: s,
|
|
1039
1129
|
pathByOS: c,
|
|
@@ -1056,10 +1146,10 @@ ${e.join("\n")}` : "";
|
|
|
1056
1146
|
return this.getListByDirectory("/functions/");
|
|
1057
1147
|
}
|
|
1058
1148
|
static getFilesPath() {
|
|
1059
|
-
return
|
|
1149
|
+
return k(this.exec("git ls-tree -r --name-only HEAD").split("\n"), (e) => e.trim());
|
|
1060
1150
|
}
|
|
1061
1151
|
static getFilesPorcelain() {
|
|
1062
|
-
return
|
|
1152
|
+
return k(this.exec("git status --porcelain").split("\n"), (e) => e.trim());
|
|
1063
1153
|
}
|
|
1064
1154
|
static getFileDate(e) {
|
|
1065
1155
|
return this.exec(`git log -1 --format="%ci" -- "${e}"`);
|
|
@@ -1068,7 +1158,7 @@ ${e.join("\n")}` : "";
|
|
|
1068
1158
|
return this.exec("git rev-parse --show-prefix");
|
|
1069
1159
|
}
|
|
1070
1160
|
static getDate(e) {
|
|
1071
|
-
return new
|
|
1161
|
+
return new pe(e).setType("full").standard();
|
|
1072
1162
|
}
|
|
1073
1163
|
static filterByDirectory(e) {
|
|
1074
1164
|
let t = this.getDirPrefix();
|
|
@@ -1076,7 +1166,7 @@ ${e.join("\n")}` : "";
|
|
|
1076
1166
|
}
|
|
1077
1167
|
static mergeUnique(e, t) {
|
|
1078
1168
|
let n = [...e];
|
|
1079
|
-
return
|
|
1169
|
+
return k(t, (e) => {
|
|
1080
1170
|
n.find((t) => t.pathFull === e.pathFull) || n.push(e);
|
|
1081
1171
|
}), n;
|
|
1082
1172
|
}
|
|
@@ -1084,24 +1174,24 @@ ${e.join("\n")}` : "";
|
|
|
1084
1174
|
return e.split("/").filter((e) => e.length > 0);
|
|
1085
1175
|
}
|
|
1086
1176
|
static exec(e) {
|
|
1087
|
-
return
|
|
1177
|
+
return I(e, { encoding: "utf8" }).trim();
|
|
1088
1178
|
}
|
|
1089
|
-
},
|
|
1179
|
+
}, Xe = class {
|
|
1090
1180
|
source;
|
|
1091
1181
|
fileTs;
|
|
1092
|
-
constructor(e =
|
|
1182
|
+
constructor(e = v, t = y) {
|
|
1093
1183
|
this.source = e, this.fileTs = t;
|
|
1094
1184
|
}
|
|
1095
1185
|
isPrompt() {
|
|
1096
|
-
return u.is(
|
|
1186
|
+
return u.is(C);
|
|
1097
1187
|
}
|
|
1098
1188
|
getResources() {
|
|
1099
1189
|
let e = [];
|
|
1100
|
-
if (this.isPrompt() && e.push(this.getPromptResource()),
|
|
1190
|
+
if (this.isPrompt() && e.push(this.getPromptResource()), A(this.source) && this.source.length > 0 && me(this.source[0])) return e.push(...this.source), e;
|
|
1101
1191
|
let t = this.source;
|
|
1102
1192
|
if (u.is(t)) {
|
|
1103
1193
|
let n = u.readFile(t);
|
|
1104
|
-
|
|
1194
|
+
A(n) && n.length > 0 && e.push(...n);
|
|
1105
1195
|
}
|
|
1106
1196
|
return e;
|
|
1107
1197
|
}
|
|
@@ -1127,23 +1217,23 @@ ${e.join("\n")}` : "";
|
|
|
1127
1217
|
].some((e) => t.endsWith(e)) ? `${t}?raw` : t;
|
|
1128
1218
|
}
|
|
1129
1219
|
getPackageConstName(e, t) {
|
|
1130
|
-
let n = e.replace(/^@[^/]+\//, ""), r = `mcp${
|
|
1220
|
+
let n = e.replace(/^@[^/]+\//, ""), r = `mcp${P(n)}Resources`;
|
|
1131
1221
|
if (t.has(r)) {
|
|
1132
1222
|
let t = e.replace(/^@/, "").replace("/", "-");
|
|
1133
|
-
r = `mcp${
|
|
1223
|
+
r = `mcp${P(t)}Resources`;
|
|
1134
1224
|
}
|
|
1135
1225
|
return t.add(r), r;
|
|
1136
1226
|
}
|
|
1137
1227
|
getPackages(e) {
|
|
1138
1228
|
let t = /* @__PURE__ */ new Map();
|
|
1139
1229
|
return e.forEach((e) => {
|
|
1140
|
-
let n =
|
|
1230
|
+
let n = M(e.uri) ? e.uri : "", r = this.extractPackageName(n);
|
|
1141
1231
|
t.has(r) || t.set(r, []), t.get(r)?.push(e);
|
|
1142
1232
|
}), t;
|
|
1143
1233
|
}
|
|
1144
1234
|
getPromptResource() {
|
|
1145
1235
|
return {
|
|
1146
|
-
uri:
|
|
1236
|
+
uri: C,
|
|
1147
1237
|
name: "System Prompt (dxt-ui)",
|
|
1148
1238
|
mimeType: "text/markdown",
|
|
1149
1239
|
description: "Consolidated system instructions, coding guidelines, and prompt rules for AI coding assistant."
|
|
@@ -1162,7 +1252,7 @@ ${e.join("\n")}` : "";
|
|
|
1162
1252
|
}
|
|
1163
1253
|
formatItem(e) {
|
|
1164
1254
|
let t = [];
|
|
1165
|
-
if (
|
|
1255
|
+
if (M(e.uri) && t.push(` uri: ${this.escapeString(e.uri)}`), M(e.name) && t.push(` name: ${this.escapeString(e.name)}`), M(e.description) && j(e.description) && t.push(` description: ${this.escapeString(e.description)}`), M(e.mimeType) && j(e.mimeType) && t.push(` mimeType: ${this.escapeString(e.mimeType)}`), M(e.text) && j(e.text) && t.push(` text: ${this.escapeString(e.text)}`), M(e.blob) && j(e.blob) && t.push(` blob: ${this.escapeString(e.blob)}`), M(e.uri) && j(e.uri) && !e.text && !e.blob) {
|
|
1166
1256
|
let n = this.getImportPath(e.uri);
|
|
1167
1257
|
t.push(` handler: async () => (await import('${n}'))?.default`);
|
|
1168
1258
|
}
|
|
@@ -1184,17 +1274,17 @@ ${e.join("\n")}` : "";
|
|
|
1184
1274
|
write(e) {
|
|
1185
1275
|
return u.writeByPath(this.fileTs, e, !1), this;
|
|
1186
1276
|
}
|
|
1187
|
-
},
|
|
1277
|
+
}, Ze = class {
|
|
1188
1278
|
dir;
|
|
1189
1279
|
constructor(e = []) {
|
|
1190
1280
|
this.dir = e;
|
|
1191
1281
|
}
|
|
1192
1282
|
isMcp() {
|
|
1193
|
-
return u.is(this.getPath(
|
|
1283
|
+
return u.is(this.getPath(_));
|
|
1194
1284
|
}
|
|
1195
1285
|
make() {
|
|
1196
1286
|
if (this.isMcp()) {
|
|
1197
|
-
let e = u.readFile(this.getPath(
|
|
1287
|
+
let e = u.readFile(this.getPath(_));
|
|
1198
1288
|
if (Array.isArray(e) && e.length > 0) return e;
|
|
1199
1289
|
}
|
|
1200
1290
|
}
|
|
@@ -1205,7 +1295,7 @@ ${e.join("\n")}` : "";
|
|
|
1205
1295
|
dir;
|
|
1206
1296
|
itemMcp;
|
|
1207
1297
|
constructor(e = []) {
|
|
1208
|
-
this.dir = e, this.itemMcp = new
|
|
1298
|
+
this.dir = e, this.itemMcp = new Ze(this.dir);
|
|
1209
1299
|
}
|
|
1210
1300
|
getDir() {
|
|
1211
1301
|
return this.dir;
|
|
@@ -1214,19 +1304,19 @@ ${e.join("\n")}` : "";
|
|
|
1214
1304
|
return this.itemMcp.make();
|
|
1215
1305
|
}
|
|
1216
1306
|
getProjectName() {
|
|
1217
|
-
return
|
|
1307
|
+
return D(this.dir)?.name ?? "none";
|
|
1218
1308
|
}
|
|
1219
1309
|
isPrompt() {
|
|
1220
1310
|
return this.isDescription() || this.isInfo() || this.isTypes() || this.isScreenshot() || this.isDeveloper() || this.isMcp();
|
|
1221
1311
|
}
|
|
1222
1312
|
isDescription() {
|
|
1223
|
-
return u.is(this.getPath(
|
|
1313
|
+
return u.is(this.getPath(b));
|
|
1224
1314
|
}
|
|
1225
1315
|
isDeveloper() {
|
|
1226
|
-
return u.is(this.getPath(
|
|
1316
|
+
return u.is(this.getPath(x));
|
|
1227
1317
|
}
|
|
1228
1318
|
isInfo() {
|
|
1229
|
-
return u.is(this.getPath(
|
|
1319
|
+
return u.is(this.getPath(S));
|
|
1230
1320
|
}
|
|
1231
1321
|
isMcp() {
|
|
1232
1322
|
return this.itemMcp.isMcp();
|
|
@@ -1235,7 +1325,7 @@ ${e.join("\n")}` : "";
|
|
|
1235
1325
|
return u.is(this.getPath(f));
|
|
1236
1326
|
}
|
|
1237
1327
|
isTypes() {
|
|
1238
|
-
return u.is(this.getPath(
|
|
1328
|
+
return u.is(this.getPath(w));
|
|
1239
1329
|
}
|
|
1240
1330
|
make() {
|
|
1241
1331
|
console.log(this.getProjectName());
|
|
@@ -1260,19 +1350,19 @@ ${e.join("\n\n")}
|
|
|
1260
1350
|
getDescription() {
|
|
1261
1351
|
if (this.isDescription()) return console.log("-- Description"), `
|
|
1262
1352
|
## Package Description & Module Overview
|
|
1263
|
-
${this.readFile(
|
|
1353
|
+
${this.readFile(b)}
|
|
1264
1354
|
`.trim();
|
|
1265
1355
|
}
|
|
1266
1356
|
getDeveloper() {
|
|
1267
1357
|
if (this.isDeveloper()) return console.log("-- Developer"), `
|
|
1268
1358
|
## Developer Rules (Must Read Before Modifying Code)
|
|
1269
|
-
'${this.getPathString(
|
|
1359
|
+
'${this.getPathString(x)}'
|
|
1270
1360
|
`.trim();
|
|
1271
1361
|
}
|
|
1272
1362
|
getInfo() {
|
|
1273
1363
|
if (this.isInfo()) return console.log("-- Info"), `
|
|
1274
1364
|
## Package Core Information
|
|
1275
|
-
${this.readFile(
|
|
1365
|
+
${this.readFile(S)}
|
|
1276
1366
|
`.trim();
|
|
1277
1367
|
}
|
|
1278
1368
|
getPath(e) {
|
|
@@ -1296,29 +1386,49 @@ ${e.map((e) => `- '${t}/${e}'`).join("\n")}
|
|
|
1296
1386
|
if (this.isScreenshot()) return u.readDir(this.getPath(f));
|
|
1297
1387
|
}
|
|
1298
1388
|
getTypes() {
|
|
1299
|
-
if (this.isTypes())
|
|
1300
|
-
|
|
1301
|
-
|
|
1389
|
+
if (this.isTypes()) {
|
|
1390
|
+
console.log("-- Types");
|
|
1391
|
+
let e = this.getTypesPath();
|
|
1392
|
+
return this.copyTypes(e), `
|
|
1393
|
+
## Package Type Definitions
|
|
1394
|
+
'${e.join("/")}'
|
|
1302
1395
|
`.trim();
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
getTypesFileName() {
|
|
1399
|
+
let e = this.getProjectName();
|
|
1400
|
+
return `${(e === "none" ? this.dir[this.dir.length - 1] ?? "types" : e).replace(/^@/, "").replace(/[/\\:]+/g, "-")}.md`;
|
|
1401
|
+
}
|
|
1402
|
+
getTypesPath() {
|
|
1403
|
+
return [p, this.getTypesFileName()];
|
|
1404
|
+
}
|
|
1405
|
+
copyTypes(e) {
|
|
1406
|
+
try {
|
|
1407
|
+
u.copy(e, this.getPath(w));
|
|
1408
|
+
} catch (t) {
|
|
1409
|
+
console.warn(`LibraryAiPromptItem: failed to copy types to ${e.join("/")}`, t);
|
|
1410
|
+
}
|
|
1303
1411
|
}
|
|
1304
1412
|
readFile(e) {
|
|
1305
1413
|
let t = u.readFileOnly(this.getPath(e));
|
|
1306
1414
|
return t ? this.dir.length > 0 ? t.replace(/([ '"`]|^)\.\//g, `$1${this.getPathString()}/`) : t : "";
|
|
1307
1415
|
}
|
|
1308
|
-
},
|
|
1416
|
+
}, Qe = "### Vue Component Implementation Rules (Vue.js Style Guide)\n\n- **Script Setup**: Use strictly `<script setup lang=\"ts\">`.\n- **Naming**: Component names must be multi-word, match their project path, and use PascalCase.\n- **CSS**: The root CSS class name of the component must match its name (in kebab-case).\n- **Typing**: Mandatory interfaces for Props (`defineProps<{...}>()`) and Emits (`defineEmits<{...}>()`).\n- **Lists (v-for)**: Always use a unique `:key`. Avoid using the array index as a key.\n- **Directives**: Never use `v-if` on the same element as `v-for`.\n- **Reactivity**: Use `ref` for data. Calculate complex logic via `computed`.\n- **Logic**: Extract only complex logic into Composables. Simple logic or calling existing hooks (even multiple) does not need to be extracted into a separate composable.\n- **Templates**: Cleanest possible HTML. No function calls, calculations, or inline styles. If complex logic is needed, split into sub-components.\n- **Props**: One-way data flow. Never mutate incoming props.\n- **Events**: Event names must be strictly in kebab-case.\n- **A11y**: Use semantic HTML and ARIA attributes.\n- **Atomicity**: Components should be minimal and perform only one function. Avoid universal \"Swiss army knife\" components.\n- **UI Styles**: Modifying the styles of ready-made UI components in the library is strictly forbidden. This is a taboo.\n- **Purity**: Write declaratively, avoid \"fluff,\" and save tokens.\n", $e = "### Global Development Principles (AI Code Promise)\n\nStrictly follow these rules for flawless code:\n\n0. **Mandatory Deep Study (CHRONOLOGICAL GUARD)**:\n - **Step 1**: Read root `ai-prompt.md` and study descriptions of all mentioned libraries.\n - **Step 2**: Read/create local `ai-memory.md` strictly in the current package root (e.g., `packages/constructor/`). Using repository root `ai-memory.md` for package files is FORBIDDEN.\n - **Step 3**: Study `ai-types.md` via text search BEFORE proposing plans, inspecting directory structures, or writing code, ONLY if you think that library may be relevant/useful for the current task. Reading the entire file is allowed only if text search yields no results and you are certain that the desired functionality exists there. If a package is in `node_modules/` but exists locally (e.g., `packages/`), resolve and study the local source instead.\n - **Step 4**: Study `ai-developer.md` of the package if you directly begin modifying or developing the package itself (contains rules and architectural standards for editing and extending the project code).\n - Always check existing infrastructure before writing custom logic.\n\n1. **\"Copy-Paste Ready\"**: Generate complete, runnable files with correct imports. No placeholders (e.g., `// rest of code`).\n2. **Zero Hallucinations**: Strictly use dependencies declared in `package.json`. Rely solely on genuine, verified APIs, classes, methods, functions, properties, slots, and events from type definitions (`ai-types.md`) and source code — inventing non-existent interfaces, parameters, or imports is strictly forbidden. If an API signature or requirement is uncertain, ask the developer rather than guessing.\n3. **Uncompromising TS**: No `any` (use `unknown` or generics). Interfaces for all I/O. `as const`, `readonly`, enums. Use `@ts-expect-error` with comments, never `@ts-ignore`.\n4. **Architectural Consistency**: Respect project structure. Reuse existing infrastructure (always re-study this file before writing custom code). Do not modify global/base UI styles unless explicitly requested.\n5. **Strict Adherence & Optimization (STRICT PROHIBITION OF UNSOLICITED ACTIONS)**: Do STRICTLY and ONLY what is requested in the prompt. Making unsolicited changes, arbitrary refactoring, or modifying unrelated files without explicit instructions is STRICTLY FORBIDDEN. Follow instructions precisely without guessing, proposing technical optimizations only within the approved scope.\n6. **AI Workspace Memory (`ai-memory.md`)**: Apply its rules with highest priority. Update local `ai-memory.md` **ONLY** upon explicit command (e.g., \"remember\") or confirmed architectural rules. When adding rules, only resolve duplicates and direct conflicts — existing rules **MUST NOT be modified, condensed, or deleted**. Changelogs and absolute paths are forbidden (relative only). Store strictly key architectural constraints.\n7. **Package Type Reference (`ai-types.md`)**:\n - **Purpose & Content**: An AI-optimized complete technical reference of a package containing all public TypeScript declarations (classes, methods, functions, types, interfaces, enums, constants) with concise JSDoc and search tags (`@keywords`).\n - **How to Work (Search Before Full Scan)**: Due to the large size of `ai-types.md` files (thousands of lines), do **NOT** read or scan the entire file line-by-line upfront. **First, use text search** (by keywords, `@keywords`, function/class names) to locate required helpers, types, and signatures quickly to save context tokens. Reading the entire file is allowed only if text search yields no results and you are certain the required functionality exists in this package, or when performing deep architectural analysis of the whole package.\n - **Code Reuse**: Before writing custom utility logic or types, ALWAYS check `ai-types.md` of relevant packages to discover and reuse existing infrastructure, classes, and helper functions (DRY).\n8. **Build & Test Execution Guard**: Do **NOT** run project builds (`npm run build`, `storybook build`, etc.) or test suites (`npm run test`, `vitest`, etc.) proactively or on your own initiative during code authoring or intermediate steps. Executing builds and test suites is permitted **STRICTLY and ONLY** upon explicit request or direct instruction from the developer.\n\n", et = [E], tt = class {
|
|
1309
1417
|
isMcp;
|
|
1418
|
+
isVue;
|
|
1310
1419
|
dirs;
|
|
1420
|
+
packageNames;
|
|
1311
1421
|
exFileOnDirs = /^.+\.[^.]{2,4}$/;
|
|
1312
1422
|
exNotRead = /^\./;
|
|
1313
|
-
constructor(e = [], t = !1) {
|
|
1314
|
-
this.isMcp = t, this.dirs = [...
|
|
1423
|
+
constructor(e = [], t = !1, n = !1) {
|
|
1424
|
+
this.isMcp = t, this.isVue = n, this.dirs = [...et, ...e];
|
|
1315
1425
|
}
|
|
1316
1426
|
make() {
|
|
1317
1427
|
console.log("Generating AI prompt...");
|
|
1318
1428
|
let e = this.getList(), t = [
|
|
1319
1429
|
"# System Role: AI Coding Assistant & Project Analyzer\nConsolidated documentation, architectural guidelines, and mandatory rules for the project.",
|
|
1320
1430
|
this.getGlobalPrompt(),
|
|
1321
|
-
this.getVuePrompt()
|
|
1431
|
+
...this.getVuePrompt()
|
|
1322
1432
|
], n = [];
|
|
1323
1433
|
e.length > 0 && e.forEach((e) => {
|
|
1324
1434
|
let r = e.make();
|
|
@@ -1328,30 +1438,41 @@ ${e.map((e) => `- '${t}/${e}'`).join("\n")}
|
|
|
1328
1438
|
}
|
|
1329
1439
|
});
|
|
1330
1440
|
let r = this.getInstruction();
|
|
1331
|
-
r && t.push(r), t.push(this.getAuditPrompt()), this.write(t), this.isMcp && (this.writeMcp(n), new
|
|
1441
|
+
r && t.push(r), t.push(this.getAuditPrompt()), this.write(t), this.isMcp && (this.writeMcp(n), new Xe().make()), this.initGitIgnore(), console.log("end");
|
|
1442
|
+
}
|
|
1443
|
+
isExclude(e) {
|
|
1444
|
+
let t = e.getProjectName(), n = d.getPromptInclude();
|
|
1445
|
+
if (n.length > 0) return !n.includes(t);
|
|
1446
|
+
let r = d.getPromptExclude();
|
|
1447
|
+
return r.length > 0 && r.includes(t) ? !0 : d.isPromptPackageOnly() ? !this.isInPackage(e) : !1;
|
|
1332
1448
|
}
|
|
1333
1449
|
isFileOnDirs(e) {
|
|
1334
1450
|
return e.some((e) => this.exFileOnDirs.test(e));
|
|
1335
1451
|
}
|
|
1452
|
+
isInPackage(e) {
|
|
1453
|
+
if (e.getDir().length === 0) return !0;
|
|
1454
|
+
let t = e.getProjectName();
|
|
1455
|
+
return t !== "none" && this.getPackageNames().has(t);
|
|
1456
|
+
}
|
|
1336
1457
|
getAuditPrompt() {
|
|
1337
1458
|
return "## Mandatory Final Self-Audit (CRITICAL GUARD & STRICT COMPLIANCE)\n\n🔴 **STOP! BEFORE DECLARING WORK COMPLETE OR ENDING YOUR TURN, YOU MUST AUDIT ALL CODE!** 🔴\n\n1. **Mandatory Full Re-Study**: Inspect EVERY single line of code created or modified in this task.\n2. **Rule-by-Rule Compliance Check**: Cross-reference all code changes against ALL architectural conventions, coding standards, JSDoc/TSDoc guidelines, and package rules defined in `ai-prompt.md`.\n3. **Zero Ignored Rules**: Ensure NO project rule, typing constraint, or code structure guideline was bypassed, forgotten, or ignored.\n4. **Self-Correction**: If any discrepancy, missing typing, bad JSDoc formatting, or rule violation is found during this audit, fix it IMMEDIATELY before concluding your turn.";
|
|
1338
1459
|
}
|
|
1339
1460
|
getInstruction() {
|
|
1340
1461
|
if (u.is("ai-instruction.md")) return `
|
|
1341
1462
|
## High-Priority Directives (Overrides Base Rules)
|
|
1342
|
-
${u.readFileOnly(
|
|
1463
|
+
${u.readFileOnly(re)}
|
|
1343
1464
|
`.trim();
|
|
1344
1465
|
}
|
|
1345
1466
|
getVuePrompt() {
|
|
1346
|
-
return `
|
|
1467
|
+
return this.isVue ? [`
|
|
1347
1468
|
## Vue Component Implementation Rules
|
|
1348
|
-
${
|
|
1349
|
-
|
|
1469
|
+
${Qe}
|
|
1470
|
+
`.trim()] : [];
|
|
1350
1471
|
}
|
|
1351
1472
|
getGlobalPrompt() {
|
|
1352
1473
|
return `
|
|
1353
1474
|
## Global Code Implementation Rules
|
|
1354
|
-
${
|
|
1475
|
+
${$e}
|
|
1355
1476
|
`.trim();
|
|
1356
1477
|
}
|
|
1357
1478
|
getList(e = this.dirs, t = [], n = d.getPromptScanDepth()) {
|
|
@@ -1359,7 +1480,7 @@ ${qe}
|
|
|
1359
1480
|
let r = [];
|
|
1360
1481
|
if (t.length === 0) {
|
|
1361
1482
|
let e = this.getRootItem();
|
|
1362
|
-
e && r.push(e);
|
|
1483
|
+
e && !this.isExclude(e) && r.push(e);
|
|
1363
1484
|
}
|
|
1364
1485
|
for (let i of e) {
|
|
1365
1486
|
if (this.exNotRead.test(i)) continue;
|
|
@@ -1367,22 +1488,33 @@ ${qe}
|
|
|
1367
1488
|
if (!this.isFileOnDirs(a) || i === "node_modules") r.push(...this.getList(a, e, n - 1));
|
|
1368
1489
|
else {
|
|
1369
1490
|
let t = new $(e);
|
|
1370
|
-
t.isPrompt() && r.push(t);
|
|
1491
|
+
!this.isExclude(t) && t.isPrompt() && r.push(t);
|
|
1371
1492
|
}
|
|
1372
1493
|
}
|
|
1373
1494
|
return r;
|
|
1374
1495
|
}
|
|
1496
|
+
getPackageNames() {
|
|
1497
|
+
if (!this.packageNames) {
|
|
1498
|
+
let e = D(), t = /* @__PURE__ */ new Set();
|
|
1499
|
+
e && (e.name && t.add(e.name), e.dependencies && Object.keys(e.dependencies).forEach((e) => t.add(e)), e.devDependencies && Object.keys(e.devDependencies).forEach((e) => t.add(e)), e.peerDependencies && Object.keys(e.peerDependencies).forEach((e) => t.add(e)), e.optionalDependencies && Object.keys(e.optionalDependencies).forEach((e) => t.add(e))), this.packageNames = t;
|
|
1500
|
+
}
|
|
1501
|
+
return this.packageNames;
|
|
1502
|
+
}
|
|
1375
1503
|
getRootItem() {
|
|
1376
1504
|
let e = new $([]);
|
|
1377
1505
|
if (e.isPrompt()) return e;
|
|
1378
1506
|
}
|
|
1507
|
+
initGitIgnore() {
|
|
1508
|
+
let e = [C, p];
|
|
1509
|
+
this.isMcp && e.push(v, y), new Z(e, "AI Resources").make();
|
|
1510
|
+
}
|
|
1379
1511
|
write(e) {
|
|
1380
|
-
return u.writeByPath(
|
|
1512
|
+
return u.writeByPath(C, e.join("\n\n---\n\n")), this;
|
|
1381
1513
|
}
|
|
1382
1514
|
writeMcp(e) {
|
|
1383
|
-
return u.writeByPath(
|
|
1515
|
+
return u.writeByPath(v, e), this;
|
|
1384
1516
|
}
|
|
1385
|
-
},
|
|
1517
|
+
}, nt = class {
|
|
1386
1518
|
make() {
|
|
1387
1519
|
console.log("Library export"), u.writeByPath(ee, `${this.initFile().trim()}\r\n`), console.log("\r\nfinish");
|
|
1388
1520
|
}
|
|
@@ -1390,7 +1522,7 @@ ${qe}
|
|
|
1390
1522
|
return ["src", e];
|
|
1391
1523
|
}
|
|
1392
1524
|
isExport(e) {
|
|
1393
|
-
return !u.joinPath(e).match(".test.") && !this.getFile(e).match(
|
|
1525
|
+
return !u.joinPath(e).match(".test.") && !this.getFile(e).match(oe);
|
|
1394
1526
|
}
|
|
1395
1527
|
getDirectory() {
|
|
1396
1528
|
let e = [];
|
|
@@ -1433,4 +1565,4 @@ ${qe}
|
|
|
1433
1565
|
}
|
|
1434
1566
|
};
|
|
1435
1567
|
//#endregion
|
|
1436
|
-
export { l as AiAbstract, s as AiClaude,
|
|
1568
|
+
export { l as AiAbstract, s as AiClaude, B as AiClaudeAgent, z as AiClaudeAgentLite, U as AiClaudeCli, H as AiClaudeCliLite, t as AiClaudeLite, e as AiGoogle, G as AiGoogleCli, W as AiGoogleCliLite, a as AiGoogleLite, o as AiOpenAi, n as AiOpenAiLite, c as AiZAi, i as AiZAiLite, V as ApiTmp, q as BrowserItem, ke as BuildPackages, je as BuildPublishPackages, Me as DesignScreenshot, qe as DesignTypes, Fe as DesignTypesAi, Le as DesignTypesBuild, Ie as DesignTypesBuildAbstract, Re as DesignTypesDescription, He as DesignTypesMake, Q as DesignTypesMakeAbstract, ze as DesignTypesMakeFile, Be as DesignTypesMakeTsTransformer, Ue as DesignTypesMcp, Ke as DesignTypesPrompts, We as DesignTypesPromptsAbstract, fe as FIGMA_API_URL, de as FigmaApiEndpoint, Z as GitIgnore, Ye as GitRead, Je as GitStatus, Xe as LibraryAiMcp, Ze as LibraryAiMcpItem, tt as LibraryAiPrompt, $ as LibraryAiPromptItem, nt as LibraryExport, J as PackageFile, se as PackageInit, u as PropertiesFile, ue as PropertyCategory, ce as PropertyKey, le as PropertyType, K as SCREENSHOT_ARGS, xe as SCREENSHOT_FORMAT, Se as SCREENSHOT_HEIGHTS, Ce as SCREENSHOT_QUALITY, we as SCREENSHOT_TIMEOUT, Te as SCREENSHOT_WAIT_UNTIL, Ee as SCREENSHOT_WIDTHS, D as getPackageJson, Y as run, Pe as useAi };
|