draftify-cli 1.0.10 → 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.
@@ -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-sable.vercel.app";
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
@@ -82,6 +82,8 @@ new lines
82
82
 
83
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
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
+
85
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.`;
86
88
  const responseStream = await ai.models.generateContentStream({
87
89
  model: geminiModel,
@@ -121,21 +123,7 @@ IMPORTANT: Do NOT include your own properties, name ('Draftify'), or AI identity
121
123
  signal: abortSignal
122
124
  });
123
125
  if (!response.ok) {
124
- const errorText = await response.text();
125
- let errorMsg = errorText;
126
- try {
127
- const errorJson = JSON.parse(errorText);
128
- errorMsg = errorJson.error || errorText;
129
- }
130
- catch { }
131
- const status = response.status;
132
- if (status === 401)
133
- throw new Error("Unauthorized: Invalid or expired CLI token. Please login again.");
134
- if (status === 403)
135
- throw new Error(`Forbidden: ${errorMsg}`);
136
- if (status === 429)
137
- throw new Error(`Rate Limit Exceeded: ${errorMsg}`);
138
- throw new Error(`Server Error (${status}): ${errorMsg}`);
126
+ throw new Error(`${response.status}`);
139
127
  }
140
128
  const reader = response.body?.getReader();
141
129
  if (!reader)
@@ -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-sable.vercel.app/api/cli";
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draftify-cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Draftify AI CLI tool",
5
5
  "main": "dist/index.js",
6
6
  "bin": {