tuneprompt 1.0.3 → 1.0.4

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.
@@ -46,28 +46,9 @@ async function activateCommand(subscriptionId) {
46
46
  }]);
47
47
  subscriptionId = answers.subscriptionId;
48
48
  }
49
- const { email } = await inquirer_1.default.prompt([{
50
- type: 'input',
51
- name: 'email',
52
- message: 'Enter your email address:',
53
- validate: (input) => {
54
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
55
- return emailRegex.test(input) || 'Please enter a valid email address';
56
- }
57
- }]);
58
- const { plan } = await inquirer_1.default.prompt([{
59
- type: 'list',
60
- name: 'plan',
61
- message: 'Select your plan:',
62
- choices: [
63
- { name: 'Pro Monthly (₹999/month)', value: 'pro-monthly' },
64
- { name: 'Pro Yearly (₹9,999/year)', value: 'pro-yearly' },
65
- { name: 'Lifetime (₹24,999 one-time)', value: 'lifetime' }
66
- ]
67
- }]);
68
49
  // Activate the license
69
50
  const spinner = (0, ora_1.default)('Verifying subscription...').start();
70
- const success = await (0, license_1.activateLicense)(subscriptionId, email, plan);
51
+ const success = await (0, license_1.activateLicense)(subscriptionId);
71
52
  if (success) {
72
53
  spinner.succeed('License activated successfully!');
73
54
  console.log(chalk_1.default.green('\n✅ TunePrompt Premium is now active!\n'));
@@ -220,9 +220,11 @@ class PromptOptimizer {
220
220
  */
221
221
  createFallbackPrompt(test) {
222
222
  // Extract the core intent from the original prompt
223
- // Remove any existing "You must provide..." prefixes to avoid duplication
223
+ // Remove any existing "fix" instructions we might have added previously
224
224
  let corePrompt = test.prompt
225
- .replace(/You must provide a response that includes the following key information:\n[^\n]*\n\n/g, '')
225
+ .replace(/\n\nYour response must match this exactly: "[\s\S]*?$/g, '')
226
+ .replace(/\n\nIMPORTANT: You must respond with valid JSON only[\s\S]*?$/g, '')
227
+ .replace(/\n\nBe concise and match the expected output format exactly[\s\S]*?$/g, '')
226
228
  .trim();
227
229
  // For JSON errors, create a structured prompt
228
230
  if (test.errorType === 'json') {
@@ -26,7 +26,7 @@ export declare function checkLicense(): Promise<boolean>;
26
26
  /**
27
27
  * Activate a new license
28
28
  */
29
- export declare function activateLicense(subscriptionId: string, email: string, plan: 'pro-monthly' | 'pro-yearly' | 'lifetime'): Promise<boolean>;
29
+ export declare function activateLicense(subscriptionId: string): Promise<boolean>;
30
30
  /**
31
31
  * Get current license info
32
32
  */
@@ -118,18 +118,17 @@ function needsVerification(license) {
118
118
  */
119
119
  async function verifyWithBackend(subscriptionId) {
120
120
  try {
121
- // Call your backend API (we'll create this in Week 3)
122
- const response = await axios_1.default.post(`${process.env.TUNEPROMPT_API_URL || 'https://api.tuneprompt.com'}/api/verify-license`, {
123
- subscriptionId
124
- }, {
125
- timeout: 5000
126
- });
127
- return response.data.valid === true;
121
+ const response = await axios_1.default.post(`${process.env.TUNEPROMPT_API_URL || 'https://api.tuneprompt.com'}/api/verify-license`, { subscriptionId }, { timeout: 5000 });
122
+ return {
123
+ valid: response.data.valid === true,
124
+ email: response.data.email, // Assuming backend returns email
125
+ plan: response.data.plan // Assuming backend returns plan
126
+ };
128
127
  }
129
128
  catch (error) {
130
- // Fail open: if API is down, allow access for paid users
129
+ // Fail open: if API is down, allow access for paid users but without updating meta
131
130
  console.warn('License verification failed (network issue), allowing access');
132
- return true;
131
+ return { valid: true };
133
132
  }
134
133
  }
135
134
  /**
@@ -146,8 +145,8 @@ async function checkLicense() {
146
145
  return true;
147
146
  }
148
147
  // Always verify with backend to get real-time status
149
- const isValid = await verifyWithBackend(license.subscriptionId);
150
- if (isValid) {
148
+ const { valid } = await verifyWithBackend(license.subscriptionId);
149
+ if (valid) {
151
150
  // Update last verified timestamp
152
151
  license.lastVerified = new Date().toISOString();
153
152
  saveLicense(license);
@@ -162,17 +161,17 @@ async function checkLicense() {
162
161
  /**
163
162
  * Activate a new license
164
163
  */
165
- async function activateLicense(subscriptionId, email, plan) {
164
+ async function activateLicense(subscriptionId) {
166
165
  try {
167
- // Verify the subscription is valid
168
- const isValid = await verifyWithBackend(subscriptionId);
169
- if (!isValid) {
166
+ // Verify the subscription is valid and get details
167
+ const { valid, email, plan } = await verifyWithBackend(subscriptionId);
168
+ if (!valid) {
170
169
  return false;
171
170
  }
172
171
  const licenseData = {
173
172
  subscriptionId,
174
- email,
175
- plan,
173
+ email: email || 'unknown@user.com', // Fallback if backend doesn't return
174
+ plan: plan || 'pro-monthly', // Fallback
176
175
  activatedAt: new Date().toISOString(),
177
176
  lastVerified: new Date().toISOString(),
178
177
  instanceId: generateInstanceId()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuneprompt",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Industrial-grade testing framework for LLM prompts",
5
5
  "repository": {
6
6
  "type": "git",