grimoire-framework 1.4.0 → 1.4.1
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/.grimoire/install-manifest.yaml +2 -2
- package/bin/commands/pro.js +29 -131
- package/package.json +1 -1
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
# - SHA256 hashes for change detection
|
|
8
8
|
# - File types for categorization
|
|
9
9
|
#
|
|
10
|
-
version: 1.4.
|
|
11
|
-
generated_at: "2026-02-22T17:
|
|
10
|
+
version: 1.4.1
|
|
11
|
+
generated_at: "2026-02-22T17:28:34.901Z"
|
|
12
12
|
generator: scripts/generate-install-manifest.js
|
|
13
13
|
file_count: 1011
|
|
14
14
|
files:
|
package/bin/commands/pro.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* grimoire pro —
|
|
2
|
+
* grimoire pro — Feature Catalogue
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Todos os recursos Pro estão disponíveis por padrão.
|
|
5
|
+
* O sistema de licença foi removido — sem chave, sem bloqueio.
|
|
6
6
|
*
|
|
7
|
-
* grimoire pro
|
|
8
|
-
* grimoire pro
|
|
9
|
-
* grimoire pro features Lista features Pro disponíveis
|
|
10
|
-
* grimoire pro deactivate Remove a licença
|
|
7
|
+
* grimoire pro status Mostra status e features
|
|
8
|
+
* grimoire pro features Lista todas as features
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
'use strict';
|
|
@@ -69,17 +67,19 @@ function isLicenseValid(license) {
|
|
|
69
67
|
return license.checksum === expected;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
// ── Public API
|
|
70
|
+
// ── Public API (all features unlocked by default) ────────────────────────────
|
|
71
|
+
/**
|
|
72
|
+
* Always returns true — all Pro features are available without a license key.
|
|
73
|
+
*/
|
|
73
74
|
function isPro() {
|
|
74
|
-
|
|
75
|
-
return isLicenseValid(license) && license.type === 'pro';
|
|
75
|
+
return true;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Always returns true — every feature ID is available.
|
|
80
|
+
*/
|
|
78
81
|
function hasFeature(featureId) {
|
|
79
|
-
|
|
80
|
-
if (!isLicenseValid(license)) return false;
|
|
81
|
-
if (license.type === 'pro') return PRO_FEATURES.some(f => f.id === featureId);
|
|
82
|
-
return license.features?.includes(featureId) || false;
|
|
82
|
+
return true;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// ── readline prompt ────────────────────────────────────────────────────────────
|
|
@@ -93,145 +93,43 @@ function prompt(q) {
|
|
|
93
93
|
async function run(args) {
|
|
94
94
|
const sub = args[0];
|
|
95
95
|
switch (sub) {
|
|
96
|
-
case 'activate':
|
|
97
|
-
case 'deactivate':
|
|
96
|
+
case 'activate': showAlreadyOpen(); break;
|
|
97
|
+
case 'deactivate': showAlreadyOpen(); break;
|
|
98
98
|
case 'features': showFeatures(); break;
|
|
99
99
|
case 'status':
|
|
100
100
|
default: showStatus(); break;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
// ──
|
|
105
|
-
|
|
106
|
-
console.log('\n
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (!validateKeyFormat(key)) {
|
|
111
|
-
console.error('❌ Formato inválido. Use: PRO-XXXX-XXXX-XXXX-XXXX');
|
|
112
|
-
console.log(' Obtenha sua chave em: https://grimoire.dev/pro\n');
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const email = await prompt('Email associado à licença: ');
|
|
117
|
-
if (!email || !email.includes('@')) {
|
|
118
|
-
console.error('❌ Email inválido.');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Offline HMAC validation
|
|
123
|
-
const checksum = generateKeyChecksum(email, key);
|
|
124
|
-
|
|
125
|
-
// Try online validation (Phase 2 ready but not blocking)
|
|
126
|
-
let onlineValidated = false;
|
|
127
|
-
try {
|
|
128
|
-
const https = require('https');
|
|
129
|
-
const result = await new Promise((resolve, reject) => {
|
|
130
|
-
const data = JSON.stringify({ key, email });
|
|
131
|
-
const req = https.request({
|
|
132
|
-
hostname: 'api.grimoire.dev',
|
|
133
|
-
path: '/v1/license/validate',
|
|
134
|
-
method: 'POST',
|
|
135
|
-
headers: { 'Content-Type': 'application/json', 'Content-Length': data.length },
|
|
136
|
-
timeout: 4000,
|
|
137
|
-
}, (res) => {
|
|
138
|
-
let body = '';
|
|
139
|
-
res.on('data', d => body += d);
|
|
140
|
-
res.on('end', () => { try { resolve(JSON.parse(body)); } catch (e) { reject(e); } });
|
|
141
|
-
});
|
|
142
|
-
req.on('error', reject);
|
|
143
|
-
req.on('timeout', () => req.destroy());
|
|
144
|
-
req.write(data);
|
|
145
|
-
req.end();
|
|
146
|
-
});
|
|
147
|
-
onlineValidated = result.valid === true;
|
|
148
|
-
} catch (_) {
|
|
149
|
-
// Offline — use local validation only
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const license = {
|
|
153
|
-
type: 'pro',
|
|
154
|
-
key,
|
|
155
|
-
email,
|
|
156
|
-
checksum,
|
|
157
|
-
activatedAt: new Date().toISOString(),
|
|
158
|
-
expiresAt: null, // null = never (or set by server in Phase 2)
|
|
159
|
-
onlineValidated,
|
|
160
|
-
features: PRO_FEATURES.map(f => f.id),
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
saveLicense(license);
|
|
164
|
-
|
|
165
|
-
console.log(`
|
|
166
|
-
✅ Grimoire Pro ativado!
|
|
167
|
-
|
|
168
|
-
Email: ${email}
|
|
169
|
-
Chave: ${key.substring(0, 7)}...${key.slice(-4)}
|
|
170
|
-
Status: ${onlineValidated ? '✅ Validado online' : '✅ Ativado (validação offline)'}
|
|
171
|
-
|
|
172
|
-
🎯 Features ativas:`);
|
|
173
|
-
PRO_FEATURES.forEach(f => console.log(` ✅ ${f.name} — ${f.desc}`));
|
|
174
|
-
console.log('\n💡 Use "grimoire pro status" para ver os detalhes\n');
|
|
104
|
+
// ── showAlreadyOpen ───────────────────────────────────────────────────────────
|
|
105
|
+
function showAlreadyOpen() {
|
|
106
|
+
console.log('\n🔓 Grimoire Pro está aberto!');
|
|
107
|
+
console.log(' Todos os recursos já estão disponíveis sem preciso de chave.\n');
|
|
108
|
+
showFeatures();
|
|
175
109
|
}
|
|
176
110
|
|
|
177
111
|
// ── Status ─────────────────────────────────────────────────────────────────────
|
|
178
112
|
function showStatus() {
|
|
179
|
-
const license = loadLicense();
|
|
180
113
|
const sep = '─'.repeat(50);
|
|
181
|
-
|
|
182
|
-
console.log(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
console.log(` Status: ⭕ Não ativado (Community)\n`);
|
|
186
|
-
console.log(` ${sep}`);
|
|
187
|
-
console.log(` Para ativar: grimoire pro activate <chave>`);
|
|
188
|
-
console.log(` Obter licença: https://grimoire.dev/pro\n`);
|
|
189
|
-
showFeatureList(false);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const valid = isLicenseValid(license);
|
|
194
|
-
const isPro = license.type === 'pro' && valid;
|
|
195
|
-
const expires = license.expiresAt ? new Date(license.expiresAt).toLocaleDateString('pt-BR') : 'Sem expiração';
|
|
196
|
-
|
|
197
|
-
console.log(` Status: ${valid ? (isPro ? '✅ Pro Ativo' : '✅ Community') : '❌ Licença inválida/expirada'}`);
|
|
198
|
-
if (license.email) console.log(` Email: ${license.email}`);
|
|
199
|
-
if (license.key) console.log(` Chave: ${license.key.substring(0, 7)}...${license.key.slice(-4)}`);
|
|
200
|
-
console.log(` Ativado: ${license.activatedAt ? new Date(license.activatedAt).toLocaleDateString('pt-BR') : 'N/A'}`);
|
|
201
|
-
console.log(` Expira: ${expires}`);
|
|
114
|
+
console.log(`\n🔓 Grimoire Pro — Status\n${sep}`);
|
|
115
|
+
console.log(` Status: ✅ Aberto (todos os recursos disponíveis)`);
|
|
116
|
+
console.log(` Licença: Sem necessidade de chave`);
|
|
117
|
+
console.log(` Features: ${PRO_FEATURES.length} recursos ativos`);
|
|
202
118
|
console.log(` ${sep}`);
|
|
203
|
-
|
|
204
|
-
showFeatureList(isPro);
|
|
119
|
+
showFeatureList(true);
|
|
205
120
|
}
|
|
206
121
|
|
|
207
122
|
// ── Features ───────────────────────────────────────────────────────────────────
|
|
208
123
|
function showFeatures() {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
console.log('\n🎯 Grimoire Pro — Features\n');
|
|
212
|
-
showFeatureList(active);
|
|
124
|
+
console.log('\n🎯 Grimoire Pro — Features (todas ativas)\n');
|
|
125
|
+
showFeatureList(true);
|
|
213
126
|
}
|
|
214
127
|
|
|
215
128
|
function showFeatureList(active) {
|
|
216
129
|
PRO_FEATURES.forEach(f => {
|
|
217
|
-
|
|
218
|
-
console.log(` ${status} ${f.name}`);
|
|
130
|
+
console.log(` ✅ ${f.name}`);
|
|
219
131
|
console.log(` ${f.desc}\n`);
|
|
220
132
|
});
|
|
221
|
-
if (!active) {
|
|
222
|
-
console.log(` 🔗 Ative em: https://grimoire.dev/pro`);
|
|
223
|
-
console.log(` grimoire pro activate\n`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// ── Deactivate ─────────────────────────────────────────────────────────────────
|
|
228
|
-
function deactivate() {
|
|
229
|
-
if (!fs.existsSync(LICENSE_FILE)) {
|
|
230
|
-
console.log('ℹ️ Nenhuma licença ativa encontrada.');
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
fs.unlinkSync(LICENSE_FILE);
|
|
234
|
-
console.log('✅ Licença removida. Grimoire voltou ao modo Community.');
|
|
235
133
|
}
|
|
236
134
|
|
|
237
135
|
module.exports = { run, isPro, hasFeature };
|