draftify-cli 1.0.8 → 1.0.11
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/commands/login.js +1 -1
- package/dist/utils/api.js +6 -16
- package/dist/utils/config.js +1 -1
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -11,7 +11,7 @@ const config_1 = require("../utils/config");
|
|
|
11
11
|
const ui_1 = require("../utils/ui");
|
|
12
12
|
const kleur_1 = require("kleur");
|
|
13
13
|
// Default Draftify URL, can be overridden by env
|
|
14
|
-
const DRAFTIFY_WEB_URL = process.env.DRAFTIFY_WEB_URL || "https://draftify
|
|
14
|
+
const DRAFTIFY_WEB_URL = process.env.DRAFTIFY_WEB_URL || "https://draftify.site";
|
|
15
15
|
async function loginCommand() {
|
|
16
16
|
const code = crypto_1.default.randomBytes(4).toString("hex");
|
|
17
17
|
const authUrl = `${DRAFTIFY_WEB_URL}/auth/cli?code=${code}`;
|
package/dist/utils/api.js
CHANGED
|
@@ -80,7 +80,11 @@ new lines
|
|
|
80
80
|
]
|
|
81
81
|
</ASK_QUESTIONS>
|
|
82
82
|
|
|
83
|
-
Always use these tags when you write code or ask questions so the CLI can apply it automatically! Keep explanations short and outside the tags
|
|
83
|
+
Always use these tags when you write code or ask questions so the CLI can apply it automatically! Keep explanations short and outside the tags.
|
|
84
|
+
|
|
85
|
+
CRITICAL RULE: 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.
|
|
86
|
+
|
|
87
|
+
IMPORTANT: Do NOT include your own properties, name ('Draftify'), or AI identity in the code you generate (e.g., when creating a discord bot, landing page, or admin panel). Do not use 'Draftify' as a brand name or prefix in generated projects. If a fictional brand or name is needed, invent a new, unique one instead.`;
|
|
84
88
|
const responseStream = await ai.models.generateContentStream({
|
|
85
89
|
model: geminiModel,
|
|
86
90
|
contents: contents,
|
|
@@ -119,21 +123,7 @@ Always use these tags when you write code or ask questions so the CLI can apply
|
|
|
119
123
|
signal: abortSignal
|
|
120
124
|
});
|
|
121
125
|
if (!response.ok) {
|
|
122
|
-
|
|
123
|
-
let errorMsg = errorText;
|
|
124
|
-
try {
|
|
125
|
-
const errorJson = JSON.parse(errorText);
|
|
126
|
-
errorMsg = errorJson.error || errorText;
|
|
127
|
-
}
|
|
128
|
-
catch { }
|
|
129
|
-
const status = response.status;
|
|
130
|
-
if (status === 401)
|
|
131
|
-
throw new Error("Unauthorized: Invalid or expired CLI token. Please login again.");
|
|
132
|
-
if (status === 403)
|
|
133
|
-
throw new Error(`Forbidden: ${errorMsg}`);
|
|
134
|
-
if (status === 429)
|
|
135
|
-
throw new Error(`Rate Limit Exceeded: ${errorMsg}`);
|
|
136
|
-
throw new Error(`Server Error (${status}): ${errorMsg}`);
|
|
126
|
+
throw new Error(`${response.status}`);
|
|
137
127
|
}
|
|
138
128
|
const reader = response.body?.getReader();
|
|
139
129
|
if (!reader)
|
package/dist/utils/config.js
CHANGED
|
@@ -51,7 +51,7 @@ function getToken() {
|
|
|
51
51
|
function getApiUrl() {
|
|
52
52
|
const config = getConfig();
|
|
53
53
|
// Fallback API URL, overrideable via config or DRAFTIFY_API_URL
|
|
54
|
-
return process.env.DRAFTIFY_API_URL || config.apiUrl || "https://draftify
|
|
54
|
+
return process.env.DRAFTIFY_API_URL || config.apiUrl || "https://draftify.site/api/cli";
|
|
55
55
|
}
|
|
56
56
|
function getModel() {
|
|
57
57
|
const config = getConfig();
|