draftify-cli 1.0.29 → 1.0.33
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/repl.js +0 -20
- package/dist/utils/api.js +18 -4
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -66,26 +66,6 @@ function getContextForPrompt(dir, prompt) {
|
|
|
66
66
|
// If specific files are mentioned, only load those files
|
|
67
67
|
filesToRead = matchedFiles.slice(0, 5);
|
|
68
68
|
}
|
|
69
|
-
else {
|
|
70
|
-
// Fallback: Always load the most recently modified source files to maintain context
|
|
71
|
-
const sourceFiles = allPaths.filter(filePath => {
|
|
72
|
-
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
73
|
-
return ['.ts', '.tsx', '.js', '.jsx', '.py', '.c', '.cpp', '.java', '.go', '.rs', '.css', '.html'].includes(ext);
|
|
74
|
-
});
|
|
75
|
-
const filesWithStats = sourceFiles.map(filePath => {
|
|
76
|
-
const fullPath = path_1.default.resolve(dir, filePath);
|
|
77
|
-
try {
|
|
78
|
-
const stats = fs_1.default.statSync(fullPath);
|
|
79
|
-
return { path: filePath, mtime: stats.mtimeMs };
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return { path: filePath, mtime: 0 };
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
// Sort by last modified time (descending)
|
|
86
|
-
filesWithStats.sort((a, b) => b.mtime - a.mtime);
|
|
87
|
-
filesToRead = filesWithStats.slice(0, 3).map(f => f.path);
|
|
88
|
-
}
|
|
89
69
|
// Load the contents of selected files
|
|
90
70
|
for (const filePath of filesToRead) {
|
|
91
71
|
const fullPath = path_1.default.resolve(dir, filePath);
|
package/dist/utils/api.js
CHANGED
|
@@ -62,7 +62,7 @@ TONE & FORMATTING:
|
|
|
62
62
|
- Warm, but never sycophantic. Do not open with flattery like "great question" or "what a fascinating idea." Just engage with the substance.
|
|
63
63
|
- Default to natural prose. In ordinary conversation, avoid bullet points, headers, and bold text — use them only when the content is genuinely multifaceted or the user asks. A few plain sentences is a fine answer to a simple question.
|
|
64
64
|
- For reports, documentation, and explanations, still write in prose rather than bullet soup, unless a list is actually the clearest format.
|
|
65
|
-
- Keep responses
|
|
65
|
+
- Keep responses EXTREMELY concise. Your spoken text outside of XML tags MUST NOT exceed 1-2 sentences in total. Get straight to the point without filler.
|
|
66
66
|
- Ask at most one question per response, and don't always ask one — try to address the request first, even if it's slightly ambiguous.
|
|
67
67
|
- No emojis unless the user uses them first, and even then, sparingly.
|
|
68
68
|
- Don't curse unless the user does. Don't use pet names or terms of endearment.
|
|
@@ -88,7 +88,8 @@ CARE FOR THE PERSON:
|
|
|
88
88
|
EXPERT TASK EXECUTION (CODING):
|
|
89
89
|
- Code Quality: When asked to write code (e.g., Python, Node.js, Electron, frontend), provide complete, functional, production-ready files. Explain your reasoning clearly, acting as a collaborative mentor and expert peer rather than a rigid dictator.
|
|
90
90
|
- ALWAYS write a conversational message or explanation BEFORE starting any code block. NEVER output a code block as the very first thing in your response. For example: "Értettem, elkészítem neked a kódot. Itt is van:" or ask clarifying questions first.
|
|
91
|
-
- IMPORTANT: Do NOT include your own properties, name ('Draftify'), or AI identity in the code you generate
|
|
91
|
+
- IMPORTANT: Do NOT include your own properties, name ('Draftify'), or AI identity in the code you generate.
|
|
92
|
+
- QUALITY ASSURANCE & VERIFICATION: After making code changes, you MUST verify that your changes didn't introduce errors. Use the <RUN_COMMAND> tag to run relevant tests, type checkers (e.g. tsc), or build scripts (e.g. npm run build). Wait for the CLI to return the command output. If there are errors, fix them in your next response. NEVER assume your code works perfectly without testing it.
|
|
92
93
|
|
|
93
94
|
FRONTEND DESIGN AESTHETICS (CRITICAL):
|
|
94
95
|
1. Use Rich Aesthetics: The USER should be wowed at first glance by the design. Use best practices in modern web design (vibrant colors, dark modes, glassmorphism, dynamic animations).
|
|
@@ -113,6 +114,10 @@ exact lines to replace
|
|
|
113
114
|
new lines
|
|
114
115
|
>>>>>>>
|
|
115
116
|
</FILE_MODIFY>
|
|
117
|
+
CRITICAL RULES FOR <FILE_MODIFY>:
|
|
118
|
+
- The SEARCH block MUST PERFECTLY MATCH the existing file content. Do not use ellipses (...) or comments like "// ... existing code ..." to skip lines.
|
|
119
|
+
- The indentation in the SEARCH block must exactly match the file.
|
|
120
|
+
- Only include the minimal lines needed to uniquely identify the replacement location (usually 1-3 context lines).
|
|
116
121
|
|
|
117
122
|
3. To delete a file:
|
|
118
123
|
<FILE_DELETE path="relative/path/to/file.ext" />
|
|
@@ -120,7 +125,13 @@ new lines
|
|
|
120
125
|
4. To run a terminal command:
|
|
121
126
|
<RUN_COMMAND>npm install express</RUN_COMMAND>
|
|
122
127
|
|
|
123
|
-
5. To
|
|
128
|
+
5. To read the contents of a file (useful for exploring the workspace before making changes):
|
|
129
|
+
<READ_FILE path="relative/path/to/file.ext" />
|
|
130
|
+
|
|
131
|
+
6. To list the contents of a directory (useful for finding where things are located):
|
|
132
|
+
<LIST_DIR path="relative/path/to/folder" />
|
|
133
|
+
|
|
134
|
+
7. To ask clarifying questions when the user's intent is ambiguous:
|
|
124
135
|
<ASK_QUESTIONS>
|
|
125
136
|
[
|
|
126
137
|
{
|
|
@@ -130,7 +141,10 @@ new lines
|
|
|
130
141
|
]
|
|
131
142
|
</ASK_QUESTIONS>
|
|
132
143
|
|
|
133
|
-
|
|
144
|
+
AUTONOMOUS WORKSPACE EXPLORATION:
|
|
145
|
+
If the user asks you to modify the project (e.g. "Add a game over menu", "Fix the bug in the header") but you don't know the exact file structure or contents, DO NOT ask the user to show you the files. Instead, use <LIST_DIR path="." /> and <READ_FILE path="..." /> to autonomously explore the workspace. You can read multiple files or list directories in a single response. Wait for the CLI to return the results of your exploration before you generate the code modifications. You act like an autonomous agent.
|
|
146
|
+
|
|
147
|
+
Always use these tags when you write code, explore files, or ask questions so the CLI can apply it automatically! Keep explanations short and outside the tags.
|
|
134
148
|
|
|
135
149
|
INTERACTIVE CLARIFICATION:
|
|
136
150
|
- If the user's request is too broad, underspecified, or ambiguous (e.g., "Create a beautiful landing page", "Make a website" without further details), YOU MUST NOT generate any code. Instead, you MUST use the <ASK_QUESTIONS> tag to ask 2-3 clarifying questions (about design, framework, functionality, target audience, etc.). Wait for the user's answers before making file modifications.
|