@dxtmisha/scripts 0.10.8 → 0.10.9

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 CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.10.9] - 2026-08-03
6
+
7
+ ### Changed
8
+ - **DesignTypes**: Updated AI prompt instructions in `DesignTypes.toAiEdit` and `DesignTypes.toAiDescription`:
9
+ - Enforced strict prompt boundaries forbidding AI agents from analyzing unprovided external files, links, paths, or environment data.
10
+ - Enhanced JSDoc generation rules to generate English JSDocs for non-obvious entities directly from JS implementation code.
11
+ - Expanded project description structure in `toAiDescription` to detail all exposed capabilities and triggers for `ai-types.md` analysis, and added optional `code` parameter support.
12
+
5
13
  ## [0.10.8] - 2026-07-28
6
14
 
7
15
  ### Added / Updated
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "0.10.8",
4
+ "version": "0.10.9",
5
5
  "type": "module",
6
6
  "description": "Development scripts and CLI tools for DXT UI projects - automated component generation, library building and project management tools",
7
7
  "keywords": [
@@ -53,7 +53,7 @@ export class DesignTypes {
53
53
  const aiContent = await this.toAiEdit(fullContent, fullJsContent)
54
54
  this.save(aiContent)
55
55
 
56
- const aiDescription = await this.toAiDescription(fullContent)
56
+ const aiDescription = await this.toAiDescription(fullContent, fullJsContent)
57
57
  this.saveDescription(aiDescription)
58
58
 
59
59
  console.log('DesignTypes: AI types saved.')
@@ -270,25 +270,31 @@ export class DesignTypes {
270
270
  protected async toAiEdit(content: string, code: string): Promise<string> {
271
271
  const generate = await this.toAi(
272
272
  content,
273
- 'TRANSLATE all non-English comments (including JSDocs and inline comments) to English. '
274
- + 'Optimize the provided type definitions, improve and supplement them if necessary. '
275
- + 'Carefully study the provided JS code to understand its logic and what the code does. '
276
- + 'Remove redundant or self-explanatory JSDoc comments for any entity (types, properties, variables, functions, methods, etc.) if their meaning is obvious from their name or signature and does not require documentation. '
277
- + 'Keep or add clear English JSDoc comments for entities that are complex, non-obvious, or require explanation. '
278
- + 'CRITICAL: Always keep all JSDoc "@example", "@remarks", "@note", and any other notes or warnings. Their contents must NOT be modified, altered, or rewritten—keep them exactly as written, only translating them to English if they are not in English. '
279
- + 'CRITICAL: Remove all imports. Remove all local internal re-exports (e.g., `export * from "./..."`), but strictly KEEP any exports from external libraries or packages. '
280
- + 'Remove all non-public content: delete all private and protected class methods and properties, and any non-exported elements. The final output must contain only the members and entities that are accessible from outside. '
281
- + 'Remove any code segments or data that do not provide useful information for an AI assistant. '
282
- + 'You may remove abstract classes or other structures that provide no practical value for code generation, but do so with extreme caution. Maintain a strict balance: if there is even a 5% chance the item might be relevant for understanding the API or generating code, keep it. Think carefully before every deletion. '
283
- + 'Remove any large Enums that add excessive length without providing critical context. '
284
- + 'Your goal is to create a compact, context-rich file that enables any AI coding assistant to generate high-quality code for a developer. '
285
- + 'Ensure that no public API surface, essential data types, or required logic is lost. '
286
- + 'Do not delete any "type" definitions; they are strictly required. '
287
- + 'Remove all regular comments and inline comments (lines starting with "//" or "/* ... */"). '
288
- + 'Do not include empty lines; keep the output compact and tight without blank lines. '
289
- + 'CRITICAL: Do NOT return the provided JS code in your response. '
290
- + 'All instructions are mandatory and must be executed perfectly. '
291
- + 'Return ONLY the resulting optimized type definitions code. No markdown code blocks, no tags, no explanations, and no additional comments from the AI. NOTHING but the pure code.',
273
+ 'Goal: Optimize and generate clean, highly informative TypeScript type definitions based ONLY on the provided code and types.\n\n'
274
+ + 'CRITICAL CONTEXT & SCOPE RESTRICTIONS:\n'
275
+ + '- IMPORTANT: The AI coding agent that will write code for developers using this library will NEVER see or have access to the underlying JS implementation code or external files. It will rely EXCLUSIVELY on the output document generated by you in this session. You MUST ensure that your output provides complete, flawless context, clear JSDoc explanations, and precise type contracts so that the reading AI agent can write accurate code without making assumptions.\n'
276
+ + '- Analyze ONLY the code, type definitions, and text explicitly provided in this prompt. Do NOT attempt to read, search, infer, or assume any external files, imports, project structure, or unprovided environment data.\n'
277
+ + '- Do NOT include any references, links, file paths, or pointers to external files or local directories in the final output, as AI agents will have no environment file access.\n'
278
+ + '- Do NOT return the provided JS code in your response.\n\n'
279
+ + 'JSDOC & COMMENT RULES:\n'
280
+ + '- STUDY THE PROVIDED JS CODE: You are explicitly provided with the JS implementation code (`File JS Code`). You MUST study the JS code for every function/method/property to understand its exact logic, behavior, and purpose.\n'
281
+ + '- GENERATE MISSING JSDOCS FROM JS CODE: If an entity lacks a JSDoc comment in the input declarations, but its provided JS code implementation reveals its behavior or purpose, you MUST generate and add a clear, fluff-free English JSDoc description directly above its declaration.\n'
282
+ + '- DEFINITION OF OBVIOUS (NO JSDOC): An entity is "obvious" ONLY IF its name uses clear, standard English naming conventions (e.g., `isString`, `capitalize`, `copyObject`) AND its functionality is 100% self-evident from its signature alone. Obvious entities MUST NOT have a JSDoc.\n'
283
+ + '- MANDATORY JSDOC FOR NON-OBVIOUS ENTITIES: Any entity with an obscure, non-standard, custom, abbreviated, or ambiguous name (e.g., `abutaSudatoho`, `transformation`), or complex logic, MUST have a clear English JSDoc description generated by inspecting its JS implementation code.\n'
284
+ + '- Write JSDoc comments WITHOUT fluff or filler text, focusing strictly on operational logic and behavior.\n'
285
+ + '- Place all JSDoc comments STRICTLY directly above the target declaration.\n'
286
+ + '- Translate all non-English comments and JSDocs to English.\n'
287
+ + '- Remove regular inline comments (`//` or `/* ... */`).\n'
288
+ + '- STRICTLY PRESERVE all JSDoc tags like `@example`, `@remarks`, `@note`, and warnings—keep them intact, translating only to English if needed.\n\n'
289
+ + 'CLEANING & OPTIMIZATION:\n'
290
+ + '- Remove all `import` statements and local internal re-exports (e.g., `export * from "./..."`). Strictly KEEP exports from external packages.\n'
291
+ + '- Delete all non-public content (private/protected class members, unexported elements). Keep all public API surfaces.\n'
292
+ + '- Do NOT delete any `type` definitions; they are strictly required.\n'
293
+ + '- Remove large Enums or structures that add length without critical context.\n'
294
+ + '- Exercise extreme caution when removing abstract classes: if there is even a 5% chance it helps understand the API or generate code, keep it.\n'
295
+ + '- Format output tightly with no blank lines.\n\n'
296
+ + 'OUTPUT REQUIREMENTS:\n'
297
+ + 'Return ONLY the resulting optimized TypeScript type definitions code. No markdown formatting, no code blocks (```), no explanations, and no additional AI text. NOTHING but pure code.',
292
298
  code
293
299
  )
294
300
 
@@ -300,20 +306,24 @@ export class DesignTypes {
300
306
  *
301
307
  * Генерирует описание проекта и рекомендации по использованию с помощью ИИ.
302
308
  * @param content cleaned type definitions / очищенные определения типов
309
+ * @param code JS code for analysis / JS код для анализа
303
310
  */
304
- protected async toAiDescription(content: string): Promise<string> {
311
+ protected async toAiDescription(content: string, code?: string): Promise<string> {
305
312
  const generate = await this.toAi(
306
313
  content,
307
- 'Analyze the provided code and generate a highly technical, structured, and concise project overview specifically designed for another AI coding assistant. '
308
- + 'The description must enable the reading AI to immediately evaluate whether this library contains code, components, classes, or utilities useful for its current task, and when it is mandatory to read and analyze "ai-types.md". '
309
- + 'The description must be objective, factual, precise, and free of marketing fluff. '
310
- + 'Include: '
311
- + '1. Core Purpose: What is the primary technical function of this library? '
312
- + '2. Key Expositions: What are the main classes, hooks, utilities, or components exposed by this project, and what specific tasks do they perform? '
313
- + '3. Triggers for Studying ai-types.md: Under what specific conditions, keywords, or coding requirements is this library indispensable, making it mandatory for the AI to study its "ai-types.md" file? '
314
- + '4. Integration Context: How does it connect with other technologies in the system stack? '
315
- + 'Ensure the structure is clean and enables immediate context retrieval. '
316
- + 'Return ONLY the resulting description text. No markdown, no labels like "Description:", no explanations. NOTHING but the pure content.'
314
+ 'Goal: Generate a comprehensive, highly technical, and fluff-free project overview designed for an AI coding assistant to evaluate this library\'s exact contents and capabilities.\n\n'
315
+ + 'CRITICAL RESTRICTIONS:\n'
316
+ + '- Analyze ONLY the code, type definitions, and text explicitly provided in this prompt. Do NOT attempt to read, search, infer, or assume any external files, dependencies, or unprovided data.\n'
317
+ + '- Do NOT include any file paths, relative links, or external URLs, as reading AI agents will not have environment file access.\n\n'
318
+ + 'STRUCTURE & CONTENT REQUIREMENTS:\n'
319
+ + 'Provide an objective, dense, and complete technical summary including:\n'
320
+ + '1. Core Purpose: What is the primary technical function, responsibility, and role of this library?\n'
321
+ + '2. Key Expositions & Capabilities: Detail ALL main classes, composables/hooks, utilities, components, services, or data structures exposed by this library. Specify the exact functionality and specific tasks each exposed entity or module performs so reading AI agents clearly understand the full capability set.\n'
322
+ + '3. Triggers for Studying ai-types.md: Under what specific coding requirements, keywords, tasks, or architectural needs is this library indispensable, making it mandatory for the AI to study "ai-types.md"?\n'
323
+ + '4. Integration Context: How does this library connect with other technologies, frameworks, or packages in the system stack?\n\n'
324
+ + 'OUTPUT REQUIREMENTS:\n'
325
+ + 'Return ONLY the resulting description text. No markdown formatting, no code blocks, no labels (like "Description:"), and no conversational explanations. NOTHING but pure, dense content.',
326
+ code
317
327
  )
318
328
 
319
329
  return generate ?? ''