Skip to content

Commit bfb9e23

Browse files
authored
chore(release): prepare @aiox-squads/core publish (#649)
* chore(release): prepare @aiox-squads/core publish [Story 124.3] * fix(review): address publish prep feedback [Story 124.3] * fix(review): address smoke and path feedback [Story 124.3] * fix(review): update scoped updater paths [Story 124.3] * fix(review): harden installed cli smoke [Story 124.3] * fix(review): address updater count and npx dispatch [Story 124.3] * fix(review): avoid updater shell install [Story 124.3] * chore(registry): sync activation pipeline metadata [Story 124.3] * chore(monorepo): rename packages to @aiox-squads scope [Story 124.5] (#650) * chore(monorepo): rename packages to @aiox-squads scope [Story 124.5] * refactor(pro): drop tri-scope debt [Story 124.6] (#651) * refactor(pro): drop tri-scope debt — single @aiox-squads/pro [Story 124.6] * ci: update workflows for @aiox-squads scope [Story 124.7] (#653) * ci: update workflows for @aiox-squads scope [Story 124.7] * docs: record workflow validation [Story 124.7] * docs: remove duplicate npm badge [Story 124.7] * chore(submodule): update aiox-pro pointer to @aiox-squads/pro@0.4.0 [Story 124.4] (#655) * chore(submodule): update aiox-pro pointer to @aiox-squads/pro@0.4.0 [Story 124.4] * docs: record pro submodule validation [Story 124.4]
1 parent d6197fb commit bfb9e23

67 files changed

Lines changed: 2697 additions & 1231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.aiox-core/cli/commands/pro/buyer.js

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,32 @@ const path = require('path');
2828
//
2929
// Resolution order (matches pro/index.js and pro-setup.js):
3030
// 1. Bundled pro/ (framework-dev / npx context with submodule)
31-
// 2. npm canonical scope (@aiox-squads/pro)
32-
// 3. npm legacy scopes (@aiox-fullstack/pro, @aios-fullstack/pro)
33-
// 4. cwd node_modules under either scope
34-
const PRO_PACKAGE_CANONICAL = '@aiox-squads/pro';
35-
const PRO_PACKAGE_FALLBACK = '@aiox-fullstack/pro';
36-
const PRO_PACKAGE_LEGACY = '@aios-fullstack/pro';
37-
const PRO_PACKAGES = [PRO_PACKAGE_CANONICAL, PRO_PACKAGE_FALLBACK, PRO_PACKAGE_LEGACY];
31+
// 2. npm package (@aiox-squads/pro)
32+
// 3. cwd node_modules under @aiox-squads/pro
33+
const PRO_PACKAGE = '@aiox-squads/pro';
3834

3935
function resolveLicensePath() {
4036
const relativePath = path.resolve(__dirname, '..', '..', '..', '..', 'pro', 'license');
4137
if (fs.existsSync(relativePath)) {
4238
return relativePath;
4339
}
4440

45-
// Try canonical first, then fallback scope via require.resolve
46-
for (const pkgName of PRO_PACKAGES) {
47-
try {
48-
const proPkg = require.resolve(`${pkgName}/package.json`);
49-
const proDir = path.dirname(proPkg);
50-
const npmPath = path.join(proDir, 'license');
51-
if (fs.existsSync(npmPath)) {
52-
return npmPath;
53-
}
54-
} catch {
55-
// package not installed under this scope — try next
41+
// Try package via require.resolve
42+
try {
43+
const proPkg = require.resolve(`${PRO_PACKAGE}/package.json`);
44+
const proDir = path.dirname(proPkg);
45+
const npmPath = path.join(proDir, 'license');
46+
if (fs.existsSync(npmPath)) {
47+
return npmPath;
5648
}
49+
} catch {
50+
// package not installed under this scope
5751
}
5852

5953
// cwd fallback (when require.resolve doesn't see the package, e.g., npx context)
60-
for (const pkgName of PRO_PACKAGES) {
61-
const [scope, pkg] = pkgName.split('/');
62-
const cwdPath = path.join(process.cwd(), 'node_modules', scope, pkg, 'license');
63-
if (fs.existsSync(cwdPath)) {
64-
return cwdPath;
65-
}
54+
const cwdPath = path.join(process.cwd(), 'node_modules', '@aiox-squads', 'pro', 'license');
55+
if (fs.existsSync(cwdPath)) {
56+
return cwdPath;
6657
}
6758

6859
return relativePath;
@@ -76,8 +67,7 @@ function loadClient() {
7667
return licenseApi;
7768
} catch (error) {
7869
console.error('Erro: módulo AIOX Pro license não disponível.');
79-
console.error(`Instale: npm install ${PRO_PACKAGE_CANONICAL}`);
80-
console.error(`(ou fallback: npm install ${PRO_PACKAGE_FALLBACK} / ${PRO_PACKAGE_LEGACY})`);
70+
console.error(`Instale: npm install ${PRO_PACKAGE}`);
8171
console.error(`Detalhe: ${error.message}`);
8272
process.exit(2);
8373
}
@@ -112,7 +102,8 @@ function classifyError(err) {
112102
};
113103
}
114104
if (code === 'AUTH_RATE_LIMITED' || code === 'RATE_LIMITED') {
115-
const retry = err.details && err.details.retryAfter ? ` (retry em ${err.details.retryAfter}s)` : '';
105+
const retry =
106+
err.details && err.details.retryAfter ? ` (retry em ${err.details.retryAfter}s)` : '';
116107
return {
117108
exitCode: 2,
118109
message: `Rate limit atingido${retry}.`,
@@ -143,8 +134,8 @@ function emitValidateResult(payload, asJson) {
143134
const accountLabel = payload.hasAccount ? 'Sim' : 'Não';
144135
process.stdout.write(
145136
`\n${statusIcon} ${payload.email}\n` +
146-
` Buyer: ${buyerLabel}\n` +
147-
` Account: ${accountLabel}\n\n`,
137+
` Buyer: ${buyerLabel}\n` +
138+
` Account: ${accountLabel}\n\n`
148139
);
149140
}
150141

@@ -174,11 +165,13 @@ async function validateAction(options) {
174165
} catch (err) {
175166
const classified = classifyError(err);
176167
if (asJson) {
177-
process.stdout.write(`${JSON.stringify({
178-
error: err && err.code ? err.code : 'UNKNOWN',
179-
message: classified.message,
180-
email,
181-
})}\n`);
168+
process.stdout.write(
169+
`${JSON.stringify({
170+
error: err && err.code ? err.code : 'UNKNOWN',
171+
message: classified.message,
172+
email,
173+
})}\n`
174+
);
182175
} else {
183176
process.stderr.write(`\nFalha: ${classified.message}\n`);
184177
if (classified.hint) {
@@ -230,7 +223,10 @@ async function validateBatchAction(options) {
230223
const filePath = options && options.file;
231224
const asJson = Boolean(options && options.json);
232225
const concurrencyRaw = options && options.concurrency ? Number(options.concurrency) : 5;
233-
const concurrency = Math.max(1, Math.min(10, Number.isFinite(concurrencyRaw) ? concurrencyRaw : 5));
226+
const concurrency = Math.max(
227+
1,
228+
Math.min(10, Number.isFinite(concurrencyRaw) ? concurrencyRaw : 5)
229+
);
234230

235231
if (!filePath || !fs.existsSync(filePath)) {
236232
const msg = filePath ? `Arquivo não encontrado: ${filePath}` : 'Erro: --file é obrigatório.';
@@ -247,7 +243,9 @@ async function validateBatchAction(options) {
247243
emails = parseEmailsFile(filePath);
248244
} catch (err) {
249245
if (asJson) {
250-
process.stdout.write(`${JSON.stringify({ error: 'FILE_READ_ERROR', message: err.message })}\n`);
246+
process.stdout.write(
247+
`${JSON.stringify({ error: 'FILE_READ_ERROR', message: err.message })}\n`
248+
);
251249
} else {
252250
process.stderr.write(`Falha ao ler arquivo: ${err.message}\n`);
253251
}
@@ -311,16 +309,17 @@ async function registerAction(options = {}) {
311309
JSON.stringify({
312310
status: 'pending_wave_2',
313311
message: '`register` pendente (Wave 2 da Story 123.8).',
314-
reason: 'Endpoint POST /api/v1/admin/buyers/register em aiox-license-server ainda não foi implementado.',
312+
reason:
313+
'Endpoint POST /api/v1/admin/buyers/register em aiox-license-server ainda não foi implementado.',
315314
story: 'docs/stories/epic-123/STORY-123.8-cohort-buyer-cli-migration.md',
316-
}) + '\n',
315+
}) + '\n'
317316
);
318317
} else {
319318
process.stderr.write(
320319
'\nOperação `register` pendente (Wave 2 da Story 123.8).\n' +
321-
'Depende do endpoint POST /api/v1/admin/buyers/register no repo aiox-license-server,\n' +
322-
'que ainda não foi implementado.\n\n' +
323-
'Acompanhe em docs/stories/epic-123/STORY-123.8-cohort-buyer-cli-migration.md\n',
320+
'Depende do endpoint POST /api/v1/admin/buyers/register no repo aiox-license-server,\n' +
321+
'que ainda não foi implementado.\n\n' +
322+
'Acompanhe em docs/stories/epic-123/STORY-123.8-cohort-buyer-cli-migration.md\n'
324323
);
325324
}
326325
process.exit(2);
@@ -335,8 +334,9 @@ async function registerAction(options = {}) {
335334
* @returns {Command}
336335
*/
337336
function createBuyerCommand() {
338-
const cmd = new Command('buyer')
339-
.description('Validar e gerenciar buyers AIOX Pro (Cohort admin)');
337+
const cmd = new Command('buyer').description(
338+
'Validar e gerenciar buyers AIOX Pro (Cohort admin)'
339+
);
340340

341341
cmd
342342
.command('validate')

0 commit comments

Comments
 (0)