@jaimevalasek/aioson 1.3.0
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/CHANGELOG.md +456 -0
- package/CODE_OF_CONDUCT.md +12 -0
- package/CONTRIBUTING.md +13 -0
- package/LICENSE +21 -0
- package/README.md +254 -0
- package/bin/aioson.js +4 -0
- package/docs/en/cli-reference.md +398 -0
- package/docs/en/i18n.md +52 -0
- package/docs/en/json-schemas.md +41 -0
- package/docs/en/mcp.md +56 -0
- package/docs/en/parallel.md +82 -0
- package/docs/en/qa-browser.md +339 -0
- package/docs/en/release-flow.md +22 -0
- package/docs/en/release-notes-template.md +41 -0
- package/docs/en/release.md +28 -0
- package/docs/en/schemas/agent-prompt.schema.json +17 -0
- package/docs/en/schemas/agents.schema.json +32 -0
- package/docs/en/schemas/context-validate.schema.json +36 -0
- package/docs/en/schemas/doctor.schema.json +89 -0
- package/docs/en/schemas/error.schema.json +24 -0
- package/docs/en/schemas/i18n-add.schema.json +15 -0
- package/docs/en/schemas/index.json +116 -0
- package/docs/en/schemas/info.schema.json +39 -0
- package/docs/en/schemas/init.schema.json +48 -0
- package/docs/en/schemas/install.schema.json +60 -0
- package/docs/en/schemas/locale-apply.schema.json +30 -0
- package/docs/en/schemas/mcp-doctor.schema.json +95 -0
- package/docs/en/schemas/mcp-init.schema.json +122 -0
- package/docs/en/schemas/package-test.schema.json +24 -0
- package/docs/en/schemas/parallel-assign.schema.json +57 -0
- package/docs/en/schemas/parallel-doctor.schema.json +86 -0
- package/docs/en/schemas/parallel-init.schema.json +53 -0
- package/docs/en/schemas/parallel-status.schema.json +94 -0
- package/docs/en/schemas/setup-context.schema.json +39 -0
- package/docs/en/schemas/smoke.schema.json +23 -0
- package/docs/en/schemas/update.schema.json +48 -0
- package/docs/en/schemas/workflow-plan.schema.json +30 -0
- package/docs/en/web3.md +54 -0
- package/docs/pt/README.md +46 -0
- package/docs/pt/advisor-spec.md +335 -0
- package/docs/pt/agentes.md +453 -0
- package/docs/pt/cenarios.md +1230 -0
- package/docs/pt/clientes-ai.md +224 -0
- package/docs/pt/comandos-cli.md +511 -0
- package/docs/pt/genome-3.0-spec.md +296 -0
- package/docs/pt/guia-engineer.md +226 -0
- package/docs/pt/inicio-rapido.md +138 -0
- package/docs/pt/profiler-system.md +214 -0
- package/docs/pt/runtime-observability.md +72 -0
- package/docs/pt/squad-genoma.md +777 -0
- package/docs/pt/web3.md +797 -0
- package/docs/testing/genome-2.0-manual-regression.md +23 -0
- package/docs/testing/genome-2.0-matrix.md +36 -0
- package/docs/testing/genome-2.0-rollout.md +184 -0
- package/package.json +50 -0
- package/src/agents.js +56 -0
- package/src/cli.js +497 -0
- package/src/commands/agents.js +142 -0
- package/src/commands/cloud.js +1767 -0
- package/src/commands/config.js +90 -0
- package/src/commands/context-validate.js +91 -0
- package/src/commands/doctor.js +123 -0
- package/src/commands/genome-doctor.js +41 -0
- package/src/commands/genome-migrate.js +49 -0
- package/src/commands/i18n-add.js +56 -0
- package/src/commands/info.js +41 -0
- package/src/commands/init.js +75 -0
- package/src/commands/install.js +68 -0
- package/src/commands/locale-apply.js +51 -0
- package/src/commands/locale-diff.js +126 -0
- package/src/commands/mcp-doctor.js +406 -0
- package/src/commands/mcp-init.js +379 -0
- package/src/commands/package-e2e.js +273 -0
- package/src/commands/parallel-assign.js +403 -0
- package/src/commands/parallel-doctor.js +437 -0
- package/src/commands/parallel-init.js +249 -0
- package/src/commands/parallel-status.js +290 -0
- package/src/commands/qa-doctor.js +185 -0
- package/src/commands/qa-init.js +161 -0
- package/src/commands/qa-report.js +58 -0
- package/src/commands/qa-run.js +873 -0
- package/src/commands/qa-scan.js +337 -0
- package/src/commands/runtime.js +948 -0
- package/src/commands/scan-project.js +1107 -0
- package/src/commands/setup-context.js +650 -0
- package/src/commands/smoke.js +426 -0
- package/src/commands/squad-doctor.js +358 -0
- package/src/commands/squad-export.js +46 -0
- package/src/commands/squad-pipeline.js +97 -0
- package/src/commands/squad-repair-genomes.js +39 -0
- package/src/commands/squad-status.js +424 -0
- package/src/commands/squad-validate.js +230 -0
- package/src/commands/test-agents.js +194 -0
- package/src/commands/update.js +55 -0
- package/src/commands/workflow-next.js +594 -0
- package/src/commands/workflow-plan.js +108 -0
- package/src/constants.js +314 -0
- package/src/context-parse-reason.js +22 -0
- package/src/context-writer.js +150 -0
- package/src/context.js +217 -0
- package/src/detector.js +261 -0
- package/src/doctor.js +289 -0
- package/src/execution-gateway.js +461 -0
- package/src/genome-files.js +198 -0
- package/src/genome-format.js +442 -0
- package/src/genome-schema.js +215 -0
- package/src/genomes/bindings.js +281 -0
- package/src/genomes.js +467 -0
- package/src/i18n/index.js +103 -0
- package/src/i18n/messages/en.js +784 -0
- package/src/i18n/messages/es.js +718 -0
- package/src/i18n/messages/fr.js +725 -0
- package/src/i18n/messages/pt-BR.js +818 -0
- package/src/i18n/scaffold.js +64 -0
- package/src/installer.js +232 -0
- package/src/lib/genomes/compat.js +206 -0
- package/src/lib/genomes/migrate.js +90 -0
- package/src/lib/squads/genome-repair.js +49 -0
- package/src/locales.js +84 -0
- package/src/onboarding.js +305 -0
- package/src/parser.js +53 -0
- package/src/prompt-tool.js +20 -0
- package/src/qa-html-report.js +472 -0
- package/src/runtime-store.js +1527 -0
- package/src/squads/apply-genome.js +21 -0
- package/src/squads/genome-binding-service.js +154 -0
- package/src/updater.js +32 -0
- package/src/utils.js +46 -0
- package/src/version.js +50 -0
- package/template/.aioson/advisors/.gitkeep +1 -0
- package/template/.aioson/agents/analyst.md +225 -0
- package/template/.aioson/agents/architect.md +221 -0
- package/template/.aioson/agents/dev.md +201 -0
- package/template/.aioson/agents/discovery-design-doc.md +196 -0
- package/template/.aioson/agents/genoma.md +300 -0
- package/template/.aioson/agents/orchestrator.md +107 -0
- package/template/.aioson/agents/pm.md +89 -0
- package/template/.aioson/agents/product.md +361 -0
- package/template/.aioson/agents/profiler-enricher.md +266 -0
- package/template/.aioson/agents/profiler-forge.md +188 -0
- package/template/.aioson/agents/profiler-researcher.md +245 -0
- package/template/.aioson/agents/qa.md +344 -0
- package/template/.aioson/agents/setup.md +381 -0
- package/template/.aioson/agents/squad.md +837 -0
- package/template/.aioson/agents/ux-ui.md +416 -0
- package/template/.aioson/config.md +56 -0
- package/template/.aioson/context/.gitkeep +0 -0
- package/template/.aioson/context/parallel/.gitkeep +0 -0
- package/template/.aioson/context/spec.md.template +37 -0
- package/template/.aioson/genomas/.gitkeep +0 -0
- package/template/.aioson/locales/en/agents/analyst.md +214 -0
- package/template/.aioson/locales/en/agents/architect.md +210 -0
- package/template/.aioson/locales/en/agents/dev.md +187 -0
- package/template/.aioson/locales/en/agents/discovery-design-doc.md +27 -0
- package/template/.aioson/locales/en/agents/genoma.md +212 -0
- package/template/.aioson/locales/en/agents/orchestrator.md +105 -0
- package/template/.aioson/locales/en/agents/pm.md +77 -0
- package/template/.aioson/locales/en/agents/product.md +310 -0
- package/template/.aioson/locales/en/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/en/agents/qa.md +214 -0
- package/template/.aioson/locales/en/agents/setup.md +342 -0
- package/template/.aioson/locales/en/agents/squad.md +247 -0
- package/template/.aioson/locales/en/agents/ux-ui.md +320 -0
- package/template/.aioson/locales/es/agents/analyst.md +203 -0
- package/template/.aioson/locales/es/agents/architect.md +208 -0
- package/template/.aioson/locales/es/agents/dev.md +183 -0
- package/template/.aioson/locales/es/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/es/agents/genoma.md +102 -0
- package/template/.aioson/locales/es/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/es/agents/pm.md +81 -0
- package/template/.aioson/locales/es/agents/product.md +310 -0
- package/template/.aioson/locales/es/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/es/agents/qa.md +163 -0
- package/template/.aioson/locales/es/agents/setup.md +347 -0
- package/template/.aioson/locales/es/agents/squad.md +247 -0
- package/template/.aioson/locales/es/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/fr/agents/analyst.md +203 -0
- package/template/.aioson/locales/fr/agents/architect.md +208 -0
- package/template/.aioson/locales/fr/agents/dev.md +183 -0
- package/template/.aioson/locales/fr/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/fr/agents/genoma.md +102 -0
- package/template/.aioson/locales/fr/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/fr/agents/pm.md +81 -0
- package/template/.aioson/locales/fr/agents/product.md +310 -0
- package/template/.aioson/locales/fr/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/fr/agents/qa.md +163 -0
- package/template/.aioson/locales/fr/agents/setup.md +347 -0
- package/template/.aioson/locales/fr/agents/squad.md +247 -0
- package/template/.aioson/locales/fr/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/pt-BR/agents/analyst.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/architect.md +213 -0
- package/template/.aioson/locales/pt-BR/agents/dev.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/discovery-design-doc.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/genoma.md +297 -0
- package/template/.aioson/locales/pt-BR/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/pt-BR/agents/pm.md +81 -0
- package/template/.aioson/locales/pt-BR/agents/product.md +316 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/qa.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/setup.md +371 -0
- package/template/.aioson/locales/pt-BR/agents/squad.md +772 -0
- package/template/.aioson/locales/pt-BR/agents/ux-ui.md +322 -0
- package/template/.aioson/mcp/servers.md +24 -0
- package/template/.aioson/profiler-reports/.gitkeep +1 -0
- package/template/.aioson/schemas/content-blueprint.schema.json +30 -0
- package/template/.aioson/schemas/genome-meta.schema.json +150 -0
- package/template/.aioson/schemas/genome.schema.json +115 -0
- package/template/.aioson/schemas/readiness.schema.json +27 -0
- package/template/.aioson/schemas/squad-blueprint.schema.json +172 -0
- package/template/.aioson/schemas/squad-manifest.schema.json +276 -0
- package/template/.aioson/skills/dynamic/README.md +30 -0
- package/template/.aioson/skills/dynamic/cardano-docs.md +16 -0
- package/template/.aioson/skills/dynamic/ethereum-docs.md +17 -0
- package/template/.aioson/skills/dynamic/flux-ui-docs.md +13 -0
- package/template/.aioson/skills/dynamic/laravel-docs.md +41 -0
- package/template/.aioson/skills/dynamic/npm-packages.md +16 -0
- package/template/.aioson/skills/dynamic/solana-docs.md +16 -0
- package/template/.aioson/skills/references/premium-command-center-ui/master-application-prompt.md +79 -0
- package/template/.aioson/skills/references/premium-command-center-ui/operational-ux-playbook.md +253 -0
- package/template/.aioson/skills/references/premium-command-center-ui/quality-validation-checklist.md +82 -0
- package/template/.aioson/skills/references/premium-command-center-ui/visual-system-and-component-patterns.md +270 -0
- package/template/.aioson/skills/static/django-patterns.md +342 -0
- package/template/.aioson/skills/static/fastapi-patterns.md +344 -0
- package/template/.aioson/skills/static/filament-patterns.md +267 -0
- package/template/.aioson/skills/static/flux-ui-components.md +262 -0
- package/template/.aioson/skills/static/git-conventions.md +227 -0
- package/template/.aioson/skills/static/interface-design.md +372 -0
- package/template/.aioson/skills/static/jetstream-setup.md +200 -0
- package/template/.aioson/skills/static/laravel-conventions.md +491 -0
- package/template/.aioson/skills/static/nextjs-patterns.md +321 -0
- package/template/.aioson/skills/static/node-express-patterns.md +317 -0
- package/template/.aioson/skills/static/node-typescript-patterns.md +282 -0
- package/template/.aioson/skills/static/premium-command-center-ui.md +190 -0
- package/template/.aioson/skills/static/rails-conventions.md +307 -0
- package/template/.aioson/skills/static/react-motion-patterns.md +577 -0
- package/template/.aioson/skills/static/static-html-patterns.md +1935 -0
- package/template/.aioson/skills/static/tall-stack-patterns.md +286 -0
- package/template/.aioson/skills/static/ui-ux-modern.md +75 -0
- package/template/.aioson/skills/static/web3-cardano-patterns.md +337 -0
- package/template/.aioson/skills/static/web3-ethereum-patterns.md +310 -0
- package/template/.aioson/skills/static/web3-security-checklist.md +284 -0
- package/template/.aioson/skills/static/web3-solana-patterns.md +324 -0
- package/template/.aioson/squads/.artisan/.gitkeep +0 -0
- package/template/.aioson/squads/.gitkeep +0 -0
- package/template/.aioson/squads/memory.md +5 -0
- package/template/.aioson/tasks/squad-analyze.md +83 -0
- package/template/.aioson/tasks/squad-create.md +99 -0
- package/template/.aioson/tasks/squad-design.md +100 -0
- package/template/.aioson/tasks/squad-export.md +20 -0
- package/template/.aioson/tasks/squad-extend.md +68 -0
- package/template/.aioson/tasks/squad-pipeline.md +122 -0
- package/template/.aioson/tasks/squad-repair.md +85 -0
- package/template/.aioson/tasks/squad-validate.md +58 -0
- package/template/.aioson/templates/squads/content-basic/template.json +21 -0
- package/template/.aioson/templates/squads/media-channel/template.json +24 -0
- package/template/.aioson/templates/squads/research-analysis/template.json +22 -0
- package/template/.aioson/templates/squads/software-delivery/template.json +21 -0
- package/template/.claude/commands/aioson/analyst.md +5 -0
- package/template/.claude/commands/aioson/architect.md +5 -0
- package/template/.claude/commands/aioson/dev.md +5 -0
- package/template/.claude/commands/aioson/orchestrator.md +5 -0
- package/template/.claude/commands/aioson/pm.md +5 -0
- package/template/.claude/commands/aioson/qa.md +5 -0
- package/template/.claude/commands/aioson/setup.md +5 -0
- package/template/.claude/commands/aioson/ux-ui.md +5 -0
- package/template/.gemini/GEMINI.md +10 -0
- package/template/.gemini/commands/aios-analyst.toml +4 -0
- package/template/.gemini/commands/aios-architect.toml +7 -0
- package/template/.gemini/commands/aios-dev.toml +8 -0
- package/template/.gemini/commands/aios-discovery-design-doc.toml +4 -0
- package/template/.gemini/commands/aios-orchestrator.toml +8 -0
- package/template/.gemini/commands/aios-pm.toml +8 -0
- package/template/.gemini/commands/aios-product.toml +4 -0
- package/template/.gemini/commands/aios-qa.toml +6 -0
- package/template/.gemini/commands/aios-setup.toml +3 -0
- package/template/.gemini/commands/aios-ux-ui.toml +8 -0
- package/template/AGENTS.md +67 -0
- package/template/CLAUDE.md +31 -0
- package/template/OPENCODE.md +24 -0
- package/template/aioson-models.json +40 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const readline = require('node:readline/promises');
|
|
5
|
+
const { detectFramework, isMonorepoDetection } = require('../detector');
|
|
6
|
+
const { getCliVersionSync } = require('../version');
|
|
7
|
+
const {
|
|
8
|
+
calculateClassification,
|
|
9
|
+
normalizeBoolean,
|
|
10
|
+
renderProjectContext,
|
|
11
|
+
writeProjectContext
|
|
12
|
+
} = require('../context-writer');
|
|
13
|
+
const { applyAgentLocale } = require('../locales');
|
|
14
|
+
const {
|
|
15
|
+
BACKEND_CHOICES,
|
|
16
|
+
FRONTEND_CHOICES,
|
|
17
|
+
AUTH_CHOICES,
|
|
18
|
+
normalizeChoice,
|
|
19
|
+
normalizeProfile,
|
|
20
|
+
inferProjectTypeFromFramework,
|
|
21
|
+
inferWeb3NetworkFromFramework,
|
|
22
|
+
buildDeveloperProfile,
|
|
23
|
+
recommendBeginnerProfile,
|
|
24
|
+
buildTeamProfile
|
|
25
|
+
} = require('../onboarding');
|
|
26
|
+
|
|
27
|
+
const JETSTREAM_ACTION_CHOICES = {
|
|
28
|
+
'1': 'continue_without_jetstream',
|
|
29
|
+
'2': 'recreate_with_jetstream',
|
|
30
|
+
'3': 'manual_install_risk'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const SERVICE_PATTERNS = [
|
|
34
|
+
{ pattern: /queue|horizon/i, field: 'queues', value: 'Redis/Horizon' },
|
|
35
|
+
{ pattern: /storage|s3|r2/i, field: 'storage', value: 'S3-compatible' },
|
|
36
|
+
{ pattern: /websocket|reverb|pusher/i, field: 'websockets', value: 'Reverb/Pusher' },
|
|
37
|
+
{ pattern: /payment|stripe|mercadopago|pagseguro/i, field: 'payments', value: 'Payments provider' },
|
|
38
|
+
{ pattern: /email|mailgun|resend|ses/i, field: 'email', value: 'Transactional provider' },
|
|
39
|
+
{ pattern: /cache|redis/i, field: 'cache', value: 'Redis' },
|
|
40
|
+
{ pattern: /search|meilisearch|algolia/i, field: 'search', value: 'Meilisearch/Algolia' }
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
function hasOption(options, name) {
|
|
44
|
+
return Object.prototype.hasOwnProperty.call(options, name);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function resolveOption(options, name, fallback = '') {
|
|
48
|
+
return hasOption(options, name) ? String(options[name]) : fallback;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isWeb3Framework(framework) {
|
|
52
|
+
return inferProjectTypeFromFramework(framework) === 'dapp';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function inferWeb3Network(framework) {
|
|
56
|
+
return inferWeb3NetworkFromFramework(framework) || 'ethereum';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function uniqueStrings(values) {
|
|
60
|
+
return values.filter((value, index, arr) => value && arr.indexOf(value) === index);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function localizeSetupNote(note, t) {
|
|
64
|
+
const raw = String(note || '').trim();
|
|
65
|
+
if (!raw) return '';
|
|
66
|
+
|
|
67
|
+
const jetstreamTeams = raw.match(/^Jetstream teams:\s*(enabled|disabled)$/i);
|
|
68
|
+
if (jetstreamTeams) {
|
|
69
|
+
return t('setup_context.note_jetstream_teams', {
|
|
70
|
+
status:
|
|
71
|
+
jetstreamTeams[1].toLowerCase() === 'enabled'
|
|
72
|
+
? t('setup_context.note_status_enabled')
|
|
73
|
+
: t('setup_context.note_status_disabled')
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const selectedServices = raw.match(/^Selected services:\s*(.+)$/i);
|
|
78
|
+
if (selectedServices) {
|
|
79
|
+
return t('setup_context.note_selected_services', {
|
|
80
|
+
services: selectedServices[1]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const railsFlags = raw.match(/^Rails setup flags:\s*(.+)$/i);
|
|
85
|
+
if (railsFlags) {
|
|
86
|
+
return t('setup_context.note_rails_setup_flags', {
|
|
87
|
+
flags: railsFlags[1]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const nextSetupFlags = raw.match(/^Next\.js setup flags:\s*(.+)$/i);
|
|
92
|
+
if (nextSetupFlags) {
|
|
93
|
+
return t('setup_context.note_next_setup_flags', {
|
|
94
|
+
flags: nextSetupFlags[1]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const nextCreateFlags = raw.match(/^Next\.js create flags:\s*(.+)$/i);
|
|
99
|
+
if (nextCreateFlags) {
|
|
100
|
+
return t('setup_context.note_next_create_flags', {
|
|
101
|
+
flags: nextCreateFlags[1]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const jetstreamAction = raw.match(/^Jetstream existing-project action:\s*(.+)$/i);
|
|
106
|
+
if (jetstreamAction) {
|
|
107
|
+
return t('setup_context.note_jetstream_existing_action', {
|
|
108
|
+
action: jetstreamAction[1]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (raw === 'Mobile-first requirement detected; consider React Native/Expo as follow-up.') {
|
|
113
|
+
return t('setup_context.note_mobile_first');
|
|
114
|
+
}
|
|
115
|
+
if (raw === 'VPS preference detected; keep deployment scripts simple and reproducible.') {
|
|
116
|
+
return t('setup_context.note_vps_preference');
|
|
117
|
+
}
|
|
118
|
+
if (raw === 'Cloud profile detected; use managed DB and object storage from day one.') {
|
|
119
|
+
return t('setup_context.note_cloud_profile');
|
|
120
|
+
}
|
|
121
|
+
if (raw === 'Web3 terms detected; dApp starter recommendation applied.') {
|
|
122
|
+
return t('setup_context.note_web3_terms');
|
|
123
|
+
}
|
|
124
|
+
if (raw === 'This recommendation is a starter profile; adjust once requirements are clearer.') {
|
|
125
|
+
return t('setup_context.note_starter_profile');
|
|
126
|
+
}
|
|
127
|
+
if (raw === 'Team profile selected; preserve explicit team conventions and CI rules.') {
|
|
128
|
+
return t('setup_context.note_team_profile');
|
|
129
|
+
}
|
|
130
|
+
if (raw === 'Starter recommendation declined; using custom stack from onboarding.') {
|
|
131
|
+
return t('setup_context.note_beginner_declined');
|
|
132
|
+
}
|
|
133
|
+
if (raw.startsWith('Monorepo detected:')) {
|
|
134
|
+
return t('setup_context.note_monorepo');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return raw;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function localizeProfileNotes(profileData, t) {
|
|
141
|
+
if (!profileData || !Array.isArray(profileData.notes)) return profileData;
|
|
142
|
+
return {
|
|
143
|
+
...profileData,
|
|
144
|
+
notes: uniqueStrings(profileData.notes.map((note) => localizeSetupNote(note, t)))
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function servicesToContextFields(services, fallback = {}) {
|
|
149
|
+
const output = {
|
|
150
|
+
queues: fallback.queues || '',
|
|
151
|
+
storage: fallback.storage || '',
|
|
152
|
+
websockets: fallback.websockets || '',
|
|
153
|
+
payments: fallback.payments || '',
|
|
154
|
+
email: fallback.email || '',
|
|
155
|
+
cache: fallback.cache || '',
|
|
156
|
+
search: fallback.search || ''
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
for (const raw of services || []) {
|
|
160
|
+
const item = String(raw || '').trim();
|
|
161
|
+
if (!item) continue;
|
|
162
|
+
for (const rule of SERVICE_PATTERNS) {
|
|
163
|
+
if (rule.pattern.test(item)) {
|
|
164
|
+
output[rule.field] = output[rule.field] || rule.value;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return output;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function mergeProfileData(data, profileData) {
|
|
173
|
+
if (!profileData) return data;
|
|
174
|
+
|
|
175
|
+
const merged = {
|
|
176
|
+
...data,
|
|
177
|
+
profile: profileData.profile || data.profile,
|
|
178
|
+
projectType: profileData.projectType || data.projectType,
|
|
179
|
+
framework: profileData.framework || data.framework,
|
|
180
|
+
backend: profileData.backend || data.backend,
|
|
181
|
+
frontend: profileData.frontend || data.frontend,
|
|
182
|
+
database: profileData.database || data.database,
|
|
183
|
+
auth: profileData.auth || data.auth,
|
|
184
|
+
uiux: profileData.uiux || data.uiux,
|
|
185
|
+
web3Enabled: profileData.web3Enabled !== undefined ? Boolean(profileData.web3Enabled) : data.web3Enabled,
|
|
186
|
+
web3Networks: profileData.web3Networks || data.web3Networks,
|
|
187
|
+
contractFramework: profileData.contractFramework || data.contractFramework,
|
|
188
|
+
notes: uniqueStrings([...(data.notes || []), ...(profileData.notes || [])])
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
...merged,
|
|
193
|
+
...servicesToContextFields(profileData.services, merged)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function applyExplicitOverrides(data, options, detectedInstalled) {
|
|
198
|
+
const output = { ...data };
|
|
199
|
+
|
|
200
|
+
if (hasOption(options, 'project-name')) output.projectName = String(options['project-name']);
|
|
201
|
+
if (hasOption(options, 'project-type')) output.projectType = String(options['project-type']);
|
|
202
|
+
if (hasOption(options, 'profile')) output.profile = normalizeProfile(options.profile, output.profile);
|
|
203
|
+
if (hasOption(options, 'framework')) output.framework = String(options.framework);
|
|
204
|
+
if (hasOption(options, 'framework-installed')) {
|
|
205
|
+
output.frameworkInstalled = normalizeBoolean(options['framework-installed'], detectedInstalled);
|
|
206
|
+
}
|
|
207
|
+
const langValue = options.language ?? options.lang;
|
|
208
|
+
if (langValue !== undefined) output.conversationLanguage = String(langValue);
|
|
209
|
+
if (hasOption(options, 'web3-enabled')) {
|
|
210
|
+
output.web3Enabled = normalizeBoolean(options['web3-enabled'], output.web3Enabled);
|
|
211
|
+
}
|
|
212
|
+
if (hasOption(options, 'web3-networks')) output.web3Networks = String(options['web3-networks']);
|
|
213
|
+
if (hasOption(options, 'contract-framework')) output.contractFramework = String(options['contract-framework']);
|
|
214
|
+
if (hasOption(options, 'wallet-provider')) output.walletProvider = String(options['wallet-provider']);
|
|
215
|
+
if (hasOption(options, 'indexer')) output.indexer = String(options.indexer);
|
|
216
|
+
if (hasOption(options, 'rpc-provider')) output.rpcProvider = String(options['rpc-provider']);
|
|
217
|
+
if (hasOption(options, 'backend')) output.backend = String(options.backend);
|
|
218
|
+
if (hasOption(options, 'frontend')) output.frontend = String(options.frontend);
|
|
219
|
+
if (hasOption(options, 'database')) output.database = String(options.database);
|
|
220
|
+
if (hasOption(options, 'auth')) output.auth = String(options.auth);
|
|
221
|
+
if (hasOption(options, 'uiux')) output.uiux = String(options.uiux);
|
|
222
|
+
if (hasOption(options, 'queues')) output.queues = String(options.queues);
|
|
223
|
+
if (hasOption(options, 'storage')) output.storage = String(options.storage);
|
|
224
|
+
if (hasOption(options, 'websockets')) output.websockets = String(options.websockets);
|
|
225
|
+
if (hasOption(options, 'payments')) output.payments = String(options.payments);
|
|
226
|
+
if (hasOption(options, 'email')) output.email = String(options.email);
|
|
227
|
+
if (hasOption(options, 'cache')) output.cache = String(options.cache);
|
|
228
|
+
if (hasOption(options, 'search')) output.search = String(options.search);
|
|
229
|
+
if (hasOption(options, 'install-commands')) output.installCommands = String(options['install-commands']);
|
|
230
|
+
if (hasOption(options, 'aioson-version')) output.aiosonVersion = String(options['aioson-version']);
|
|
231
|
+
|
|
232
|
+
return output;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function buildDeveloperProfileFromOptions(options, defaults, t) {
|
|
236
|
+
const output = buildDeveloperProfile({
|
|
237
|
+
backendChoice: resolveOption(options, 'backend-choice', defaults.framework),
|
|
238
|
+
backend: resolveOption(options, 'backend', defaults.backend),
|
|
239
|
+
framework: resolveOption(options, 'framework', defaults.framework),
|
|
240
|
+
frontendChoice: resolveOption(options, 'frontend-choice', defaults.frontend),
|
|
241
|
+
authChoice: resolveOption(options, 'auth-choice', defaults.auth),
|
|
242
|
+
uiuxChoice: resolveOption(options, 'uiux-choice', defaults.uiux),
|
|
243
|
+
databaseChoice: resolveOption(options, 'database-choice', defaults.database),
|
|
244
|
+
servicesChoice: resolveOption(options, 'services', ''),
|
|
245
|
+
laravelVersion: resolveOption(options, 'laravel-version', ''),
|
|
246
|
+
teamsEnabled: normalizeBoolean(options['teams-enabled'], false)
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
const railsFlags = resolveOption(options, 'rails-options', '');
|
|
250
|
+
if (railsFlags) {
|
|
251
|
+
output.notes.push(
|
|
252
|
+
t('setup_context.note_rails_setup_flags', {
|
|
253
|
+
flags: railsFlags
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const nextFlags = resolveOption(options, 'next-options', '');
|
|
258
|
+
if (nextFlags) {
|
|
259
|
+
output.notes.push(
|
|
260
|
+
t('setup_context.note_next_setup_flags', {
|
|
261
|
+
flags: nextFlags
|
|
262
|
+
})
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
return output;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function buildBeginnerProfileFromOptions(options, t) {
|
|
269
|
+
const profile = recommendBeginnerProfile({
|
|
270
|
+
projectSummary: resolveOption(options, 'project-summary', ''),
|
|
271
|
+
expectedUsers: resolveOption(options, 'expected-users', ''),
|
|
272
|
+
mobileRequirement: resolveOption(options, 'mobile-requirement', ''),
|
|
273
|
+
hostingPreference: resolveOption(options, 'hosting-preference', '')
|
|
274
|
+
});
|
|
275
|
+
return localizeProfileNotes(profile, t);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function buildTeamProfileFromOptions(options, defaults) {
|
|
279
|
+
return buildTeamProfile({
|
|
280
|
+
projectType: resolveOption(options, 'project-type', defaults.projectType),
|
|
281
|
+
framework: resolveOption(options, 'framework', defaults.framework),
|
|
282
|
+
backend: resolveOption(options, 'backend', defaults.backend),
|
|
283
|
+
frontend: resolveOption(options, 'frontend', defaults.frontend),
|
|
284
|
+
database: resolveOption(options, 'database', defaults.database),
|
|
285
|
+
auth: resolveOption(options, 'auth', defaults.auth),
|
|
286
|
+
uiux: resolveOption(options, 'uiux', defaults.uiux),
|
|
287
|
+
services: resolveOption(options, 'services', ''),
|
|
288
|
+
web3Enabled: resolveOption(options, 'web3-enabled', String(defaults.web3Enabled)),
|
|
289
|
+
web3Networks: resolveOption(options, 'web3-networks', defaults.web3Networks),
|
|
290
|
+
contractFramework: resolveOption(options, 'contract-framework', defaults.contractFramework)
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async function ask(rl, question, fallback = '') {
|
|
295
|
+
const suffix = fallback ? ` (${fallback})` : '';
|
|
296
|
+
const value = await rl.question(`${question}${suffix}: `);
|
|
297
|
+
const cleaned = String(value || '').trim();
|
|
298
|
+
if (!cleaned) return fallback;
|
|
299
|
+
return cleaned;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async function askDeveloperProfile(rl, data, t) {
|
|
303
|
+
const developerInput = {
|
|
304
|
+
framework: data.framework,
|
|
305
|
+
backendChoice: await ask(rl, t('setup_context.q_backend_menu'), data.framework)
|
|
306
|
+
};
|
|
307
|
+
const backend = normalizeChoice(developerInput.backendChoice, BACKEND_CHOICES, data.framework);
|
|
308
|
+
if (backend === 'Other') {
|
|
309
|
+
developerInput.backend = await ask(
|
|
310
|
+
rl,
|
|
311
|
+
t('setup_context.q_backend_text'),
|
|
312
|
+
data.backend || data.framework
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (String(backend).toLowerCase() === 'laravel') {
|
|
317
|
+
developerInput.laravelVersion = await ask(rl, t('setup_context.q_laravel_version'), '11');
|
|
318
|
+
developerInput.frontendChoice = await ask(rl, t('setup_context.q_frontend_menu'), '1');
|
|
319
|
+
developerInput.authChoice = await ask(rl, t('setup_context.q_auth_menu'), '2');
|
|
320
|
+
developerInput.uiuxChoice = await ask(rl, t('setup_context.q_uiux_menu'), '2');
|
|
321
|
+
const auth = normalizeChoice(developerInput.authChoice, AUTH_CHOICES, '');
|
|
322
|
+
if (auth === 'Jetstream + Livewire') {
|
|
323
|
+
developerInput.teamsEnabled = normalizeBoolean(
|
|
324
|
+
await ask(rl, t('setup_context.q_jetstream_teams'), 'true'),
|
|
325
|
+
true
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
developerInput.frontendChoice = await ask(rl, t('setup_context.q_frontend_menu'), data.frontend || '6');
|
|
330
|
+
const frontend = normalizeChoice(
|
|
331
|
+
developerInput.frontendChoice,
|
|
332
|
+
FRONTEND_CHOICES,
|
|
333
|
+
data.frontend || ''
|
|
334
|
+
);
|
|
335
|
+
if (frontend === 'Other') {
|
|
336
|
+
developerInput.frontendText = await ask(
|
|
337
|
+
rl,
|
|
338
|
+
t('setup_context.q_frontend_text'),
|
|
339
|
+
data.frontend || ''
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
developerInput.auth = await ask(rl, t('setup_context.q_auth_text'), data.auth || 'Custom');
|
|
343
|
+
developerInput.uiuxChoice = await ask(rl, t('setup_context.q_uiux_menu'), data.uiux || '1');
|
|
344
|
+
|
|
345
|
+
if (backend === 'Rails') {
|
|
346
|
+
developerInput.railsOptions = await ask(rl, t('setup_context.q_rails_options'), '');
|
|
347
|
+
}
|
|
348
|
+
if (backend === 'Next.js') {
|
|
349
|
+
developerInput.nextOptions = await ask(rl, t('setup_context.q_next_options'), '');
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
developerInput.databaseChoice = await ask(rl, t('setup_context.q_database_menu'), data.database || '3');
|
|
354
|
+
developerInput.servicesChoice = await ask(rl, t('setup_context.q_services_list'), '');
|
|
355
|
+
|
|
356
|
+
const profileData = buildDeveloperProfile(developerInput);
|
|
357
|
+
|
|
358
|
+
if (backend === 'Laravel' && profileData.auth === 'Jetstream + Livewire' && data.frameworkInstalled) {
|
|
359
|
+
const action = await ask(rl, t('setup_context.q_jetstream_existing_action'), '2');
|
|
360
|
+
const resolvedAction = normalizeChoice(action, JETSTREAM_ACTION_CHOICES, 'recreate_with_jetstream');
|
|
361
|
+
profileData.notes.push(
|
|
362
|
+
t('setup_context.note_jetstream_existing_action', {
|
|
363
|
+
action: resolvedAction
|
|
364
|
+
})
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
if (developerInput.railsOptions) {
|
|
368
|
+
profileData.notes.push(
|
|
369
|
+
t('setup_context.note_rails_setup_flags', {
|
|
370
|
+
flags: developerInput.railsOptions
|
|
371
|
+
})
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
if (developerInput.nextOptions) {
|
|
375
|
+
profileData.notes.push(
|
|
376
|
+
t('setup_context.note_next_create_flags', {
|
|
377
|
+
flags: developerInput.nextOptions
|
|
378
|
+
})
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return localizeProfileNotes(profileData, t);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
async function askBeginnerProfile(rl, data, logger, t) {
|
|
386
|
+
const projectSummary = await ask(rl, t('setup_context.q_beginner_summary'), '');
|
|
387
|
+
const expectedUsers = await ask(rl, t('setup_context.q_beginner_users'), '1');
|
|
388
|
+
const mobileRequirement = await ask(rl, t('setup_context.q_beginner_mobile'), '2');
|
|
389
|
+
const hostingPreference = await ask(rl, t('setup_context.q_beginner_hosting'), '1');
|
|
390
|
+
|
|
391
|
+
const recommendation = recommendBeginnerProfile({
|
|
392
|
+
projectSummary,
|
|
393
|
+
expectedUsers,
|
|
394
|
+
mobileRequirement,
|
|
395
|
+
hostingPreference
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
logger.log(
|
|
399
|
+
t('setup_context.beginner_recommendation', {
|
|
400
|
+
framework: recommendation.framework,
|
|
401
|
+
frontend: recommendation.frontend || 'n/a',
|
|
402
|
+
database: recommendation.database || 'n/a',
|
|
403
|
+
auth: recommendation.auth || 'n/a'
|
|
404
|
+
})
|
|
405
|
+
);
|
|
406
|
+
|
|
407
|
+
const useRecommendation = normalizeBoolean(
|
|
408
|
+
await ask(rl, t('setup_context.q_beginner_accept_recommendation'), 'true'),
|
|
409
|
+
true
|
|
410
|
+
);
|
|
411
|
+
if (useRecommendation) return localizeProfileNotes(recommendation, t);
|
|
412
|
+
|
|
413
|
+
const custom = buildTeamProfile({
|
|
414
|
+
projectType: await ask(rl, t('setup_context.q_project_type'), data.projectType),
|
|
415
|
+
framework: await ask(rl, t('setup_context.q_framework'), recommendation.framework),
|
|
416
|
+
backend: await ask(rl, t('setup_context.q_backend_text'), recommendation.backend),
|
|
417
|
+
frontend: await ask(rl, t('setup_context.q_frontend_text'), recommendation.frontend),
|
|
418
|
+
database: await ask(rl, t('setup_context.q_database_text'), recommendation.database),
|
|
419
|
+
auth: await ask(rl, t('setup_context.q_auth_text'), recommendation.auth),
|
|
420
|
+
uiux: await ask(rl, t('setup_context.q_uiux_text'), recommendation.uiux),
|
|
421
|
+
services: await ask(rl, t('setup_context.q_services_list'), '')
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
...custom,
|
|
426
|
+
profile: 'beginner',
|
|
427
|
+
notes: uniqueStrings([
|
|
428
|
+
...localizeProfileNotes(recommendation, t).notes,
|
|
429
|
+
t('setup_context.note_beginner_declined')
|
|
430
|
+
])
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
async function askTeamProfile(rl, data, t) {
|
|
435
|
+
return localizeProfileNotes(
|
|
436
|
+
buildTeamProfile({
|
|
437
|
+
projectType: await ask(rl, t('setup_context.q_project_type'), data.projectType),
|
|
438
|
+
framework: await ask(rl, t('setup_context.q_framework'), data.framework),
|
|
439
|
+
backend: await ask(rl, t('setup_context.q_backend_text'), data.backend || data.framework),
|
|
440
|
+
frontend: await ask(rl, t('setup_context.q_frontend_text'), data.frontend),
|
|
441
|
+
database: await ask(rl, t('setup_context.q_database_text'), data.database),
|
|
442
|
+
auth: await ask(rl, t('setup_context.q_auth_text'), data.auth),
|
|
443
|
+
uiux: await ask(rl, t('setup_context.q_uiux_text'), data.uiux),
|
|
444
|
+
services: await ask(rl, t('setup_context.q_services_list'), '')
|
|
445
|
+
}),
|
|
446
|
+
t
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
async function runSetupContext({ args, options, logger, t }) {
|
|
451
|
+
const targetDir = path.resolve(process.cwd(), args[0] || '.');
|
|
452
|
+
const defaultsMode = Boolean(options.defaults);
|
|
453
|
+
|
|
454
|
+
const detection = await detectFramework(targetDir);
|
|
455
|
+
const detectedFramework = detection.framework || 'Node';
|
|
456
|
+
const detectedInstalled = detection.installed;
|
|
457
|
+
const inferredProjectType = inferProjectTypeFromFramework(detectedFramework);
|
|
458
|
+
const inferredWeb3Enabled = inferredProjectType === 'dapp';
|
|
459
|
+
const baseName = path.basename(targetDir) || 'my-project';
|
|
460
|
+
const monorepoDetected = isMonorepoDetection(detection);
|
|
461
|
+
|
|
462
|
+
let data = {
|
|
463
|
+
projectName: baseName,
|
|
464
|
+
projectType: inferredProjectType,
|
|
465
|
+
profile: 'developer',
|
|
466
|
+
framework: detectedFramework,
|
|
467
|
+
frameworkInstalled: detectedInstalled,
|
|
468
|
+
conversationLanguage: 'en',
|
|
469
|
+
web3Enabled: inferredWeb3Enabled,
|
|
470
|
+
web3Networks: inferredWeb3Enabled ? inferWeb3Network(detectedFramework) : '',
|
|
471
|
+
contractFramework: inferredWeb3Enabled ? detectedFramework : '',
|
|
472
|
+
walletProvider: '',
|
|
473
|
+
indexer: '',
|
|
474
|
+
rpcProvider: '',
|
|
475
|
+
backend: '',
|
|
476
|
+
frontend: '',
|
|
477
|
+
database: '',
|
|
478
|
+
auth: '',
|
|
479
|
+
uiux: '',
|
|
480
|
+
queues: '',
|
|
481
|
+
storage: '',
|
|
482
|
+
websockets: '',
|
|
483
|
+
payments: '',
|
|
484
|
+
email: '',
|
|
485
|
+
cache: '',
|
|
486
|
+
search: '',
|
|
487
|
+
installCommands: '',
|
|
488
|
+
notes: [],
|
|
489
|
+
aiosonVersion: getCliVersionSync()
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
if (monorepoDetected) {
|
|
493
|
+
data.notes.push(t('setup_context.note_monorepo'));
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
let userTypesCount = Number(options['user-types'] || 1);
|
|
497
|
+
let integrationsCount = Number(options.integrations || 0);
|
|
498
|
+
let rulesComplexity = resolveOption(options, 'rules-complexity', 'none');
|
|
499
|
+
|
|
500
|
+
if (!defaultsMode) {
|
|
501
|
+
const rl = readline.createInterface({
|
|
502
|
+
input: process.stdin,
|
|
503
|
+
output: process.stdout
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
try {
|
|
507
|
+
logger.log(
|
|
508
|
+
t('setup_context.detected', { framework: detectedFramework, installed: String(detectedInstalled) })
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
data.projectName = await ask(rl, t('setup_context.q_project_name'), data.projectName);
|
|
512
|
+
|
|
513
|
+
if (detection.framework) {
|
|
514
|
+
const useDetection = normalizeBoolean(
|
|
515
|
+
await ask(rl, t('setup_context.q_use_detected_framework'), 'true'),
|
|
516
|
+
true
|
|
517
|
+
);
|
|
518
|
+
if (!useDetection) {
|
|
519
|
+
data.framework = await ask(rl, t('setup_context.q_framework'), data.framework);
|
|
520
|
+
data.frameworkInstalled = normalizeBoolean(
|
|
521
|
+
await ask(rl, t('setup_context.q_framework_installed'), String(data.frameworkInstalled)),
|
|
522
|
+
data.frameworkInstalled
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
} else {
|
|
526
|
+
data.framework = await ask(rl, t('setup_context.q_framework'), data.framework);
|
|
527
|
+
data.frameworkInstalled = normalizeBoolean(
|
|
528
|
+
await ask(rl, t('setup_context.q_framework_installed'), String(data.frameworkInstalled)),
|
|
529
|
+
data.frameworkInstalled
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
data.profile = normalizeProfile(await ask(rl, t('setup_context.q_profile'), data.profile), data.profile);
|
|
534
|
+
data.conversationLanguage = await ask(rl, t('setup_context.q_language'), data.conversationLanguage);
|
|
535
|
+
|
|
536
|
+
let profileData = null;
|
|
537
|
+
if (data.profile === 'developer') {
|
|
538
|
+
profileData = await askDeveloperProfile(rl, data, t);
|
|
539
|
+
} else if (data.profile === 'beginner') {
|
|
540
|
+
profileData = await askBeginnerProfile(rl, data, logger, t);
|
|
541
|
+
} else {
|
|
542
|
+
profileData = await askTeamProfile(rl, data, t);
|
|
543
|
+
}
|
|
544
|
+
data = mergeProfileData(data, profileData);
|
|
545
|
+
|
|
546
|
+
data.projectType = await ask(rl, t('setup_context.q_project_type'), data.projectType);
|
|
547
|
+
data.web3Enabled = normalizeBoolean(
|
|
548
|
+
await ask(rl, t('setup_context.q_web3_enabled'), String(data.web3Enabled)),
|
|
549
|
+
data.web3Enabled
|
|
550
|
+
);
|
|
551
|
+
if (data.web3Enabled) {
|
|
552
|
+
data.web3Networks = await ask(rl, t('setup_context.q_web3_networks'), data.web3Networks);
|
|
553
|
+
data.contractFramework = await ask(
|
|
554
|
+
rl,
|
|
555
|
+
t('setup_context.q_contract_framework'),
|
|
556
|
+
data.contractFramework || data.framework
|
|
557
|
+
);
|
|
558
|
+
data.walletProvider = await ask(rl, t('setup_context.q_wallet_provider'), data.walletProvider);
|
|
559
|
+
data.indexer = await ask(rl, t('setup_context.q_indexer'), data.indexer);
|
|
560
|
+
data.rpcProvider = await ask(rl, t('setup_context.q_rpc_provider'), data.rpcProvider);
|
|
561
|
+
} else {
|
|
562
|
+
data.web3Networks = '';
|
|
563
|
+
data.contractFramework = '';
|
|
564
|
+
data.walletProvider = '';
|
|
565
|
+
data.indexer = '';
|
|
566
|
+
data.rpcProvider = '';
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
userTypesCount = Number(await ask(rl, t('setup_context.q_user_types'), String(userTypesCount)));
|
|
570
|
+
integrationsCount = Number(await ask(rl, t('setup_context.q_integrations'), String(integrationsCount)));
|
|
571
|
+
rulesComplexity = await ask(rl, t('setup_context.q_rules_complexity'), rulesComplexity);
|
|
572
|
+
} finally {
|
|
573
|
+
rl.close();
|
|
574
|
+
}
|
|
575
|
+
} else {
|
|
576
|
+
const profile = normalizeProfile(resolveOption(options, 'profile', data.profile), data.profile);
|
|
577
|
+
let profileData = null;
|
|
578
|
+
if (profile === 'developer') {
|
|
579
|
+
profileData = buildDeveloperProfileFromOptions(options, data, t);
|
|
580
|
+
} else if (profile === 'beginner') {
|
|
581
|
+
profileData = buildBeginnerProfileFromOptions(options, t);
|
|
582
|
+
} else {
|
|
583
|
+
profileData = localizeProfileNotes(buildTeamProfileFromOptions(options, data), t);
|
|
584
|
+
}
|
|
585
|
+
profileData = localizeProfileNotes(profileData, t);
|
|
586
|
+
data = mergeProfileData(data, profileData);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
data = applyExplicitOverrides(data, options, detectedInstalled);
|
|
590
|
+
|
|
591
|
+
const classificationResult = calculateClassification({
|
|
592
|
+
userTypesCount,
|
|
593
|
+
integrationsCount,
|
|
594
|
+
rulesComplexity
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
data.classification = resolveOption(options, 'classification', classificationResult.classification);
|
|
598
|
+
if (data.projectType === 'dapp') {
|
|
599
|
+
data.web3Enabled = true;
|
|
600
|
+
}
|
|
601
|
+
if (data.web3Enabled && !data.web3Networks) {
|
|
602
|
+
data.web3Networks = inferWeb3Network(data.framework);
|
|
603
|
+
}
|
|
604
|
+
if (data.web3Enabled && !data.contractFramework && isWeb3Framework(data.framework)) {
|
|
605
|
+
data.contractFramework = data.framework;
|
|
606
|
+
}
|
|
607
|
+
if (!data.web3Enabled) {
|
|
608
|
+
data.web3Networks = '';
|
|
609
|
+
data.contractFramework = '';
|
|
610
|
+
data.walletProvider = '';
|
|
611
|
+
data.indexer = '';
|
|
612
|
+
data.rpcProvider = '';
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const content = renderProjectContext(data);
|
|
616
|
+
const filePath = await writeProjectContext(targetDir, content);
|
|
617
|
+
const localeApplyResult = await applyAgentLocale(targetDir, data.conversationLanguage, {
|
|
618
|
+
dryRun: false
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
logger.log(t('setup_context.written', { path: filePath }));
|
|
622
|
+
logger.log(
|
|
623
|
+
t('setup_context.classification_result', {
|
|
624
|
+
classification: data.classification,
|
|
625
|
+
score: classificationResult.score
|
|
626
|
+
})
|
|
627
|
+
);
|
|
628
|
+
logger.log(
|
|
629
|
+
t('setup_context.locale_applied', {
|
|
630
|
+
locale: localeApplyResult.locale,
|
|
631
|
+
count: localeApplyResult.copied.length
|
|
632
|
+
})
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
return {
|
|
636
|
+
ok: true,
|
|
637
|
+
targetDir,
|
|
638
|
+
filePath,
|
|
639
|
+
data,
|
|
640
|
+
classificationScore: classificationResult.score,
|
|
641
|
+
localeApplyResult
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
module.exports = {
|
|
646
|
+
runSetupContext,
|
|
647
|
+
servicesToContextFields,
|
|
648
|
+
mergeProfileData,
|
|
649
|
+
applyExplicitOverrides
|
|
650
|
+
};
|