aiox-core 5.0.7 → 5.0.8

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.
Files changed (191) hide show
  1. package/.aiox-core/cli/commands/pro/buyer.js +379 -0
  2. package/.aiox-core/cli/commands/pro/index.js +191 -52
  3. package/.aiox-core/cli/commands/validate/index.js +2 -0
  4. package/.aiox-core/core/code-intel/helpers/dev-helper.js +1 -1
  5. package/.aiox-core/core/code-intel/helpers/devops-helper.js +0 -1
  6. package/.aiox-core/core/code-intel/helpers/planning-helper.js +1 -1
  7. package/.aiox-core/core/code-intel/helpers/qa-helper.js +2 -2
  8. package/.aiox-core/core/config/schemas/framework-config.schema.json +1 -0
  9. package/.aiox-core/core/config/template-overrides.js +1 -1
  10. package/.aiox-core/core/doctor/checks/ide-sync.js +81 -25
  11. package/.aiox-core/core/doctor/checks/rules-files.js +0 -1
  12. package/.aiox-core/core/doctor/checks/skills-count.js +83 -15
  13. package/.aiox-core/core/graph-dashboard/cli.js +1 -2
  14. package/.aiox-core/core/graph-dashboard/data-sources/code-intel-source.js +1 -1
  15. package/.aiox-core/core/ids/layer-classifier.js +1 -1
  16. package/.aiox-core/core/pro/pro-updater.js +578 -0
  17. package/.aiox-core/core/synapse/context/context-tracker.js +107 -9
  18. package/.aiox-core/core/synapse/layers/layer-processor.js +1 -1
  19. package/.aiox-core/core-config.yaml +15 -1
  20. package/.aiox-core/data/capability-detection.js +15 -15
  21. package/.aiox-core/data/entity-registry.yaml +18 -2
  22. package/.aiox-core/data/registry-update-log.jsonl +5 -0
  23. package/.aiox-core/data/tok3-token-comparison.js +0 -4
  24. package/.aiox-core/data/tool-search-validation.js +1 -1
  25. package/.aiox-core/development/agents/aiox-master.md +44 -6
  26. package/.aiox-core/development/agents/data-engineer.md +4 -4
  27. package/.aiox-core/development/agents/devops.md +52 -2
  28. package/.aiox-core/development/agents/po.md +1 -1
  29. package/.aiox-core/development/agents/qa.md +5 -11
  30. package/.aiox-core/development/agents/sm.md +3 -3
  31. package/.aiox-core/development/agents/ux-design-expert.md +1 -1
  32. package/.aiox-core/development/scripts/unified-activation-pipeline.js +29 -3
  33. package/.aiox-core/development/tasks/dev-develop-story.md +46 -7
  34. package/.aiox-core/development/tasks/devops-pro-access-grant.md +93 -0
  35. package/.aiox-core/development/tasks/devops-pro-activate.md +42 -0
  36. package/.aiox-core/development/tasks/devops-pro-check-access.md +34 -0
  37. package/.aiox-core/development/tasks/devops-pro-request-reset.md +34 -0
  38. package/.aiox-core/development/tasks/devops-pro-resend-verification.md +32 -0
  39. package/.aiox-core/development/tasks/devops-pro-reset-password.md +36 -0
  40. package/.aiox-core/development/tasks/devops-pro-validate-login.md +36 -0
  41. package/.aiox-core/development/tasks/devops-pro-verify-status.md +33 -0
  42. package/.aiox-core/development/tasks/qa-gate.md +54 -4
  43. package/.aiox-core/development/tasks/validate-next-story.md +39 -2
  44. package/.aiox-core/framework-config.yaml +1 -0
  45. package/.aiox-core/infrastructure/scripts/codex-skills-sync/README.md +69 -0
  46. package/.aiox-core/infrastructure/scripts/codex-skills-sync/bootstrap.js +727 -0
  47. package/.aiox-core/infrastructure/scripts/codex-skills-sync/index.js +10 -0
  48. package/.aiox-core/infrastructure/scripts/codex-skills-sync/validate.js +65 -4
  49. package/.aiox-core/infrastructure/scripts/generate-settings-json.js +29 -4
  50. package/.aiox-core/infrastructure/scripts/ide-sync/agent-parser.js +4 -0
  51. package/.aiox-core/infrastructure/scripts/ide-sync/index.js +67 -7
  52. package/.aiox-core/infrastructure/scripts/ide-sync/transformers/claude-code.js +145 -3
  53. package/.aiox-core/infrastructure/scripts/repair-agent-references.js +263 -0
  54. package/.aiox-core/infrastructure/scripts/validate-claude-integration.js +60 -8
  55. package/.aiox-core/infrastructure/scripts/validate-paths.js +13 -0
  56. package/.aiox-core/install-manifest.yaml +134 -82
  57. package/.aiox-core/utils/filters/index.js +2 -1
  58. package/.claude/commands/AIOX/agents/aiox-master.md +21 -0
  59. package/.claude/commands/AIOX/agents/analyst.md +21 -0
  60. package/.claude/commands/AIOX/agents/architect.md +21 -0
  61. package/.claude/commands/AIOX/agents/data-engineer.md +21 -0
  62. package/.claude/commands/AIOX/agents/dev.md +21 -0
  63. package/.claude/commands/AIOX/agents/devops.md +21 -0
  64. package/.claude/commands/AIOX/agents/pm.md +21 -0
  65. package/.claude/commands/AIOX/agents/po.md +21 -0
  66. package/.claude/commands/AIOX/agents/qa.md +21 -0
  67. package/.claude/commands/AIOX/agents/sm.md +21 -0
  68. package/.claude/commands/AIOX/agents/squad-creator.md +21 -0
  69. package/.claude/commands/AIOX/agents/ux-design-expert.md +21 -0
  70. package/.claude/commands/AIOX/scripts/agent-config-loader.js +624 -0
  71. package/.claude/commands/AIOX/scripts/generate-greeting.js +160 -0
  72. package/.claude/commands/AIOX/scripts/greeting-builder.js +866 -0
  73. package/.claude/commands/AIOX/scripts/session-context-loader.js +286 -0
  74. package/.claude/commands/AIOX/stories/story-6.1.4.md +1404 -0
  75. package/.claude/commands/cohort-squad/agents/cohort-manager.md +156 -0
  76. package/.claude/commands/design-system/agents/brad-frost.md +1097 -0
  77. package/.claude/commands/design-system/agents/dan-mall.md +857 -0
  78. package/.claude/commands/design-system/agents/dave-malouf.md +2272 -0
  79. package/.claude/commands/design-system/agents/design-chief.md +102 -0
  80. package/.claude/commands/design-system/agents/nano-banana-generator.md +162 -0
  81. package/.claude/commands/greet.md +101 -0
  82. package/.claude/commands/synapse/manager.md +75 -0
  83. package/.claude/commands/synapse/tasks/add-rule.md +94 -0
  84. package/.claude/commands/synapse/tasks/create-command.md +109 -0
  85. package/.claude/commands/synapse/tasks/create-domain.md +127 -0
  86. package/.claude/commands/synapse/tasks/diagnose-synapse.md +245 -0
  87. package/.claude/commands/synapse/tasks/edit-rule.md +109 -0
  88. package/.claude/commands/synapse/tasks/suggest-domain.md +116 -0
  89. package/.claude/commands/synapse/tasks/toggle-domain.md +83 -0
  90. package/.claude/commands/synapse/templates/domain-template +8 -0
  91. package/.claude/commands/synapse/templates/manifest-entry-template +4 -0
  92. package/.claude/commands/synapse/utils/manifest-parser-reference.md +134 -0
  93. package/.claude/hooks/precompact-session-digest.cjs +2 -2
  94. package/.claude/skills/AIOX/agents/aiox-master/SKILL.md +511 -0
  95. package/.claude/skills/AIOX/agents/analyst/SKILL.md +281 -0
  96. package/.claude/skills/AIOX/agents/architect/SKILL.md +482 -0
  97. package/.claude/skills/AIOX/agents/data-engineer/SKILL.md +503 -0
  98. package/.claude/skills/AIOX/agents/dev/SKILL.md +568 -0
  99. package/.claude/skills/AIOX/agents/devops/SKILL.md +597 -0
  100. package/.claude/skills/AIOX/agents/pm/SKILL.md +385 -0
  101. package/.claude/skills/AIOX/agents/po/SKILL.md +343 -0
  102. package/.claude/skills/AIOX/agents/qa/SKILL.md +451 -0
  103. package/.claude/skills/AIOX/agents/sm/SKILL.md +295 -0
  104. package/.claude/skills/AIOX/agents/squad-creator/SKILL.md +352 -0
  105. package/.claude/skills/AIOX/agents/ux-design-expert/SKILL.md +503 -0
  106. package/.claude/skills/architect-first/SKILL.md +275 -0
  107. package/.claude/skills/architect-first/assets/architecture-template.md +505 -0
  108. package/.claude/skills/architect-first/assets/config-template.yaml +351 -0
  109. package/.claude/skills/architect-first/references/architecture-checklist.md +216 -0
  110. package/.claude/skills/architect-first/references/pre-implementation-checklist.md +119 -0
  111. package/.claude/skills/architect-first/references/stop-rules-guide.md +291 -0
  112. package/.claude/skills/architect-first/references/testing-strategy-guide.md +477 -0
  113. package/.claude/skills/architect-first/scripts/architecture_validator.py +490 -0
  114. package/.claude/skills/architect-first/scripts/check_coupling.py +306 -0
  115. package/.claude/skills/architect-first/scripts/validate_risk_mitigation.py +382 -0
  116. package/.claude/skills/checklist-runner/SKILL.md +113 -0
  117. package/.claude/skills/clone-mind.md +329 -0
  118. package/.claude/skills/coderabbit-review/SKILL.md +106 -0
  119. package/.claude/skills/course-generation-workflow.md +76 -0
  120. package/.claude/skills/enhance-workflow.md +466 -0
  121. package/.claude/skills/mcp-builder/LICENSE.txt +202 -0
  122. package/.claude/skills/mcp-builder/SKILL.md +328 -0
  123. package/.claude/skills/mcp-builder/reference/evaluation.md +602 -0
  124. package/.claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
  125. package/.claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
  126. package/.claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
  127. package/.claude/skills/mcp-builder/scripts/connections.py +151 -0
  128. package/.claude/skills/mcp-builder/scripts/evaluation.py +373 -0
  129. package/.claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  130. package/.claude/skills/mcp-builder/scripts/requirements.txt +2 -0
  131. package/.claude/skills/ralph.md +181 -0
  132. package/.claude/skills/skill-creator/LICENSE.txt +202 -0
  133. package/.claude/skills/skill-creator/SKILL.md +209 -0
  134. package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  135. package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  136. package/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  137. package/.claude/skills/squad.md +301 -0
  138. package/.claude/skills/synapse/SKILL.md +132 -0
  139. package/.claude/skills/synapse/assets/README.md +50 -0
  140. package/.claude/skills/synapse/references/brackets.md +100 -0
  141. package/.claude/skills/synapse/references/commands.md +118 -0
  142. package/.claude/skills/synapse/references/domains.md +126 -0
  143. package/.claude/skills/synapse/references/layers.md +186 -0
  144. package/.claude/skills/synapse/references/manifest.md +142 -0
  145. package/.claude/skills/tech-search/SKILL.md +431 -0
  146. package/.claude/skills/tech-search/prompts/page-extract.md +133 -0
  147. package/README.en.md +2 -2
  148. package/README.md +8 -2
  149. package/bin/aiox.js +55 -4
  150. package/bin/utils/framework-guard.js +4 -2
  151. package/bin/utils/pro-detector.js +119 -28
  152. package/bin/utils/validate-publish.js +6 -6
  153. package/docs/aiox-agent-flows/devops-system.md +18 -0
  154. package/docs/aiox-workflows/README.md +1 -0
  155. package/docs/aiox-workflows/pro-access-grant-workflow.md +218 -0
  156. package/docs/guides/pro/access-grant-ops-playbook.md +370 -0
  157. package/docs/guides/pro/install-gate-setup.md +12 -6
  158. package/docs/guides/pro/squad-creator-handoff-pro-access-ops.md +134 -0
  159. package/docs/guides/supabase-ops-handoff.md +768 -0
  160. package/package.json +12 -1
  161. package/packages/aiox-pro-cli/bin/aiox-pro.js +33 -12
  162. package/packages/installer/src/config/configure-environment.js +118 -50
  163. package/packages/installer/src/installer/aiox-core-installer.js +124 -27
  164. package/packages/installer/src/installer/brownfield-upgrader.js +66 -9
  165. package/packages/installer/src/installer/dependency-installer.js +4 -0
  166. package/packages/installer/src/pro/pro-scaffolder.js +5 -5
  167. package/packages/installer/src/updater/index.js +151 -10
  168. package/packages/installer/src/wizard/ide-config-generator.js +73 -7
  169. package/packages/installer/src/wizard/index.js +119 -31
  170. package/packages/installer/src/wizard/pro-setup.js +118 -47
  171. package/packages/installer/src/wizard/validation/validators/dependency-validator.js +32 -25
  172. package/packages/installer/src/wizard/validation/validators/file-structure-validator.js +26 -0
  173. package/packages/installer/tests/unit/artifact-copy-pipeline/artifact-copy-pipeline.test.js +84 -1
  174. package/packages/installer/tests/unit/claude-md-template-v5/claude-md-template-v5.test.js +1 -1
  175. package/packages/installer/tests/unit/doctor/doctor-checks.test.js +85 -19
  176. package/packages/installer/tests/unit/entity-registry-bootstrap.test.js +4 -4
  177. package/packages/installer/tests/unit/generate-settings-json/generate-settings-json.test.js +5 -5
  178. package/packages/installer/tests/unit/ide-sync-integration/ide-sync-integration.test.js +4 -4
  179. package/packages/installer/tests/unit/merger/yaml-merger.test.js +11 -11
  180. package/pro/README.md +12 -1
  181. package/pro/license/index.js +3 -11
  182. package/pro/license/license-api.js +25 -0
  183. package/pro/license/license-cache.js +135 -31
  184. package/pro/license/license-crypto.js +59 -3
  185. package/pro/package.json +5 -4
  186. package/pro/squads/README.md +16 -16
  187. package/pro/squads/index.js +1 -1
  188. package/scripts/e2e/installed-skills-smoke.js +264 -0
  189. package/scripts/package-synapse.js +3 -3
  190. package/scripts/validate-package-completeness.js +8 -11
  191. package/.aiox-core/lib/build.json +0 -1
package/bin/aiox.js CHANGED
@@ -8,8 +8,6 @@
8
8
 
9
9
  const path = require('path');
10
10
  const fs = require('fs');
11
- const { execSync } = require('child_process');
12
-
13
11
  // Read package.json for version
14
12
  const packageJsonPath = path.join(__dirname, '..', 'package.json');
15
13
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
@@ -20,6 +18,16 @@ const command = args[0];
20
18
 
21
19
  // Helper: Run initialization wizard
22
20
  async function runWizard(options = {}) {
21
+ if (options.force || options.yes || options.ci) {
22
+ process.env.AIOX_INSTALL_FORCE = '1';
23
+ }
24
+ if (options.quiet || options.ci) {
25
+ process.env.AIOX_INSTALL_QUIET = '1';
26
+ }
27
+ if (options.dryRun) {
28
+ process.env.AIOX_INSTALL_DRY_RUN = '1';
29
+ }
30
+
23
31
  // Use the v4 wizard from packages/installer/src/wizard/index.js
24
32
  const wizardPath = path.join(__dirname, '..', 'packages', 'installer', 'src', 'wizard', 'index.js');
25
33
 
@@ -342,6 +350,37 @@ async function runUpdate() {
342
350
  process.exit(1);
343
351
  }
344
352
  }
353
+
354
+ // --include-pro: also update Pro after core (Story 122.5)
355
+ if (updateArgs.includes('--include-pro')) {
356
+ try {
357
+ const proUpdaterPath = path.join(__dirname, '..', '.aiox-core', 'core', 'pro', 'pro-updater');
358
+ const { updatePro, formatUpdateResult: formatProResult } = require(proUpdaterPath);
359
+
360
+ console.log('\n🔄 Updating AIOX Pro...\n');
361
+
362
+ const proResult = await updatePro(process.cwd(), {
363
+ check: isCheck,
364
+ dryRun: isDryRun,
365
+ force: isForce,
366
+ onProgress: (phase, message) => {
367
+ if (isVerbose) console.log(`[pro:${phase}] ${message}`);
368
+ },
369
+ });
370
+
371
+ console.log(formatProResult(proResult));
372
+
373
+ if (!proResult.success) {
374
+ process.exit(1);
375
+ }
376
+ } catch (proError) {
377
+ console.error(`❌ Pro update failed: ${proError.message}`);
378
+ if (proError.stack) {
379
+ console.error(proError.stack);
380
+ }
381
+ process.exit(1);
382
+ }
383
+ }
345
384
  } catch (error) {
346
385
  console.error(`❌ Update error: ${error.message}`);
347
386
  if (args.includes('--verbose') || args.includes('-v')) {
@@ -640,8 +679,11 @@ Install AIOX in the current directory.
640
679
 
641
680
  Options:
642
681
  --force Overwrite existing AIOX installation
682
+ --yes, -y Accept safe defaults and overwrite existing AIOX installation
683
+ --ci Non-interactive CI mode (--quiet --force)
643
684
  --quiet Minimal output (no banner, no prompts) - ideal for CI/CD
644
685
  --dry-run Simulate installation without modifying files
686
+ --ide <ide> Configure a specific IDE during quiet/CI install
645
687
  --merge Auto-merge existing config files (brownfield mode)
646
688
  --no-merge Disable merge option, use legacy overwrite behavior
647
689
  -h, --help Show this help message
@@ -670,6 +712,9 @@ Examples:
670
712
  # Silent install for CI/CD
671
713
  npx aiox-core install --quiet --force
672
714
 
715
+ # Explicit CI install with Claude Code files materialized
716
+ npx aiox-core install --ci --yes --ide claude-code
717
+
673
718
  # Preview what would be installed
674
719
  npx aiox-core install --dry-run
675
720
  `);
@@ -841,12 +886,18 @@ async function main() {
841
886
  showInstallHelp();
842
887
  break;
843
888
  }
889
+ const isCi = installArgs.includes('--ci');
890
+ const isYes = installArgs.includes('--yes') || installArgs.includes('-y');
891
+ const ideIndex = installArgs.indexOf('--ide');
844
892
  const installOptions = {
845
- force: installArgs.includes('--force'),
846
- quiet: installArgs.includes('--quiet'),
893
+ force: installArgs.includes('--force') || isYes || isCi,
894
+ yes: isYes,
895
+ ci: isCi,
896
+ quiet: installArgs.includes('--quiet') || isCi,
847
897
  dryRun: installArgs.includes('--dry-run'),
848
898
  forceMerge: installArgs.includes('--merge'),
849
899
  noMerge: installArgs.includes('--no-merge'),
900
+ ide: ideIndex >= 0 ? installArgs[ideIndex + 1] : null,
850
901
  };
851
902
  if (!installOptions.quiet) {
852
903
  console.log('AIOX-FullStack Installation\n');
@@ -44,8 +44,10 @@ const FALLBACK_EXCEPTIONS = [
44
44
  * @returns {RegExp}
45
45
  */
46
46
  function globToRegex(glob) {
47
+ const placeholder = '\u0000';
48
+
47
49
  // 1. Replace ** with placeholder before processing
48
- let pattern = glob.replace(/\*\*/g, '\u0000');
50
+ let pattern = glob.replace(/\*\*/g, placeholder);
49
51
 
50
52
  // 2. Escape all regex-special chars (dots, plus, etc.) — but NOT * or placeholder
51
53
  pattern = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
@@ -54,7 +56,7 @@ function globToRegex(glob) {
54
56
  pattern = pattern.replace(/\*/g, '[^/]+');
55
57
 
56
58
  // 4. Restore ** placeholder to any-depth matcher
57
- pattern = pattern.replace(/\u0000/g, '.+');
59
+ pattern = pattern.split(placeholder).join('.+');
58
60
 
59
61
  // If pattern ends with .+ (was **), match prefix
60
62
  if (glob.endsWith('**')) {
@@ -31,15 +31,60 @@ const PRO_DIR = path.join(PROJECT_ROOT, 'pro');
31
31
  const PRO_PACKAGE_PATH = path.join(PRO_DIR, 'package.json');
32
32
 
33
33
  /**
34
- * Check if the AIOX Pro submodule is available.
34
+ * Canonical npm package name.
35
+ */
36
+ const PRO_PACKAGE_CANONICAL = '@aiox-squads/pro';
37
+
38
+ /**
39
+ * Legacy npm package name kept as a fallback for installs created during the
40
+ * unpublished @aiox-fullstack/pro transition.
41
+ */
42
+ const PRO_PACKAGE_FALLBACK = '@aiox-fullstack/pro';
43
+
44
+ /**
45
+ * Original AIOS npm package name, retained for backward compatibility.
46
+ */
47
+ const PRO_PACKAGE_LEGACY = '@aios-fullstack/pro';
48
+
49
+ const PRO_PACKAGES = [
50
+ PRO_PACKAGE_CANONICAL,
51
+ PRO_PACKAGE_FALLBACK,
52
+ PRO_PACKAGE_LEGACY,
53
+ ];
54
+
55
+ /**
56
+ * Resolve the installed npm Pro package path.
57
+ * Tries canonical name first, then legacy fallbacks.
35
58
  *
36
- * Detection is based on the existence of pro/package.json.
37
- * An empty pro/ directory (uninitialized submodule) returns false.
59
+ * @returns {{ packagePath: string, packageName: string } | null}
60
+ */
61
+ function resolveNpmProPackage() {
62
+ for (const packageName of PRO_PACKAGES) {
63
+ try {
64
+ const pkgJson = require.resolve(`${packageName}/package.json`, {
65
+ paths: [process.cwd()],
66
+ });
67
+ return { packagePath: path.dirname(pkgJson), packageName };
68
+ } catch {
69
+ // try next package
70
+ }
71
+ }
72
+
73
+ return null;
74
+ }
75
+
76
+ /**
77
+ * Check if the AIOX Pro is available via any source.
38
78
  *
39
- * @returns {boolean} true if pro/package.json exists
79
+ * Detection priority:
80
+ * 1. npm package (canonical @aiox-squads/pro or legacy fallbacks)
81
+ * 2. pro/ submodule directory
82
+ *
83
+ * @returns {boolean} true if Pro is available
40
84
  */
41
85
  function isProAvailable() {
42
86
  try {
87
+ if (resolveNpmProPackage()) return true;
43
88
  return fs.existsSync(PRO_PACKAGE_PATH);
44
89
  } catch {
45
90
  return false;
@@ -47,58 +92,99 @@ function isProAvailable() {
47
92
  }
48
93
 
49
94
  /**
50
- * Safely load a module from the pro/ directory.
95
+ * Safely load a module from the pro package.
51
96
  *
52
- * Returns null if:
53
- * - Pro submodule is not available
54
- * - The requested module does not exist
55
- * - The module throws during loading
97
+ * Resolution order:
98
+ * 1. npm package (canonical or fallback)
99
+ * 2. pro/ submodule directory
56
100
  *
57
101
  * @param {string} moduleName - Relative path within pro/ (e.g., 'squads/squad-creator-pro')
58
102
  * @returns {*|null} The loaded module or null
59
103
  */
60
104
  function loadProModule(moduleName) {
61
- if (!isProAvailable()) {
62
- return null;
105
+ // 1. Try npm package
106
+ const npmPro = resolveNpmProPackage();
107
+ if (npmPro) {
108
+ try {
109
+ return require(path.join(npmPro.packagePath, moduleName));
110
+ } catch { /* fall through */ }
63
111
  }
64
112
 
65
- try {
66
- const modulePath = path.join(PRO_DIR, moduleName);
67
- return require(modulePath);
68
- } catch {
69
- return null;
113
+ // 2. Try submodule
114
+ if (fs.existsSync(PRO_PACKAGE_PATH)) {
115
+ try {
116
+ return require(path.join(PRO_DIR, moduleName));
117
+ } catch { /* not available */ }
70
118
  }
119
+
120
+ return null;
71
121
  }
72
122
 
73
123
  /**
74
124
  * Get the version of the installed AIOX Pro package.
75
125
  *
76
- * @returns {string|null} The version string (e.g., '0.1.0') or null if not available
126
+ * @returns {string|null} The version string (e.g., '0.3.0') or null if not available
77
127
  */
78
128
  function getProVersion() {
79
- if (!isProAvailable()) {
80
- return null;
129
+ // 1. Try npm package
130
+ const npmPro = resolveNpmProPackage();
131
+ if (npmPro) {
132
+ try {
133
+ const packageData = JSON.parse(fs.readFileSync(path.join(npmPro.packagePath, 'package.json'), 'utf8'));
134
+ return packageData.version || null;
135
+ } catch { /* fall through */ }
81
136
  }
82
137
 
83
- try {
84
- const packageData = JSON.parse(fs.readFileSync(PRO_PACKAGE_PATH, 'utf8'));
85
- return packageData.version || null;
86
- } catch {
87
- return null;
138
+ // 2. Try submodule
139
+ if (fs.existsSync(PRO_PACKAGE_PATH)) {
140
+ try {
141
+ const packageData = JSON.parse(fs.readFileSync(PRO_PACKAGE_PATH, 'utf8'));
142
+ return packageData.version || null;
143
+ } catch { /* not available */ }
88
144
  }
145
+
146
+ return null;
89
147
  }
90
148
 
91
149
  /**
92
150
  * Get metadata about the AIOX Pro installation.
93
151
  *
94
- * @returns {{ available: boolean, version: string|null, path: string }} Pro status info
152
+ * @returns {{ available: boolean, version: string|null, path: string, source: string, packageName: string|null }} Pro status info
95
153
  */
96
154
  function getProInfo() {
97
- const available = isProAvailable();
155
+ const npmPro = resolveNpmProPackage();
156
+ if (npmPro) {
157
+ try {
158
+ const packageData = JSON.parse(fs.readFileSync(path.join(npmPro.packagePath, 'package.json'), 'utf8'));
159
+ return {
160
+ available: true,
161
+ version: packageData.version || null,
162
+ path: npmPro.packagePath,
163
+ source: 'npm',
164
+ packageName: npmPro.packageName,
165
+ };
166
+ } catch { /* fall through */ }
167
+ }
168
+
169
+ if (fs.existsSync(PRO_PACKAGE_PATH)) {
170
+ try {
171
+ const packageData = JSON.parse(fs.readFileSync(PRO_PACKAGE_PATH, 'utf8'));
172
+ return {
173
+ available: true,
174
+ version: packageData.version || null,
175
+ path: PRO_DIR,
176
+ source: 'submodule',
177
+ packageName: null,
178
+ };
179
+ } catch { /* fall through */ }
180
+ }
181
+
98
182
  return {
99
- available,
100
- version: available ? getProVersion() : null,
183
+ available: false,
184
+ version: null,
101
185
  path: PRO_DIR,
186
+ source: 'none',
187
+ packageName: null,
102
188
  };
103
189
  }
104
190
 
@@ -107,6 +193,11 @@ module.exports = {
107
193
  loadProModule,
108
194
  getProVersion,
109
195
  getProInfo,
196
+ resolveNpmProPackage,
197
+ PRO_PACKAGE_CANONICAL,
198
+ PRO_PACKAGE_FALLBACK,
199
+ PRO_PACKAGE_LEGACY,
200
+ PRO_PACKAGES,
110
201
  // Exported for testing
111
202
  _PRO_DIR: PRO_DIR,
112
203
  _PRO_PACKAGE_PATH: PRO_PACKAGE_PATH,
@@ -23,10 +23,10 @@ const PROJECT_ROOT = path.join(__dirname, '..', '..');
23
23
  const PRO_DIR = path.join(PROJECT_ROOT, 'pro');
24
24
  const CRITICAL_FILE = path.join(PRO_DIR, 'license', 'license-api.js');
25
25
  const MIN_FILE_COUNT = 50;
26
+ const PACK_DRY_RUN_TIMEOUT_MS = 120000;
26
27
 
27
- // CI environments may not have access to the private pro submodule unless explicitly enforced.
28
+ // CI environments may not have access to the private pro submodule
28
29
  const IS_CI = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
29
- const ENFORCE_SUBMODULES = process.env.AIOX_ENFORCE_PUBLISH_SUBMODULES === 'true';
30
30
 
31
31
  let passed = true;
32
32
  let fileCount = 0;
@@ -35,7 +35,7 @@ let fileCount = 0;
35
35
  console.log('--- Publish Safety Gate (INS-4.10) ---\n');
36
36
 
37
37
  if (!fs.existsSync(PRO_DIR)) {
38
- if (IS_CI && !ENFORCE_SUBMODULES) {
38
+ if (IS_CI) {
39
39
  console.log('SKIP: pro/ directory not available (CI — private submodule requires separate access token)');
40
40
  } else {
41
41
  console.error('FAIL: pro/ directory does not exist.');
@@ -45,7 +45,7 @@ if (!fs.existsSync(PRO_DIR)) {
45
45
  } else {
46
46
  const entries = fs.readdirSync(PRO_DIR).filter(e => e !== '.git');
47
47
  if (entries.length === 0) {
48
- if (IS_CI && !ENFORCE_SUBMODULES) {
48
+ if (IS_CI) {
49
49
  console.log('SKIP: pro/ submodule empty (CI — private submodule requires separate access token)');
50
50
  } else {
51
51
  console.error('FAIL: pro/ submodule not initialized (directory is empty).');
@@ -59,7 +59,7 @@ if (!fs.existsSync(PRO_DIR)) {
59
59
 
60
60
  // Check 2: Critical file exists
61
61
  if (!fs.existsSync(CRITICAL_FILE)) {
62
- if (IS_CI && !ENFORCE_SUBMODULES) {
62
+ if (IS_CI) {
63
63
  console.log('SKIP: pro/license/license-api.js not available (CI — private submodule)');
64
64
  } else {
65
65
  console.error('FAIL: pro/license/license-api.js not found.');
@@ -76,7 +76,7 @@ try {
76
76
  const packOutput = execSync('npm pack --dry-run 2>&1', {
77
77
  encoding: 'utf8',
78
78
  cwd: PROJECT_ROOT,
79
- timeout: 30000,
79
+ timeout: PACK_DRY_RUN_TIMEOUT_MS,
80
80
  });
81
81
  // npm pack --dry-run outputs lines starting with "npm notice" for each file
82
82
  const fileLines = packOutput.split('\n').filter(line =>
@@ -302,6 +302,14 @@ flowchart TD
302
302
  | Comando | Task | Descrição | Modo |
303
303
  |---------|------|-----------|------|
304
304
  | `*environment-bootstrap` | environment-bootstrap.md | Bootstrap de novo projeto | Interactive |
305
+ | `*pro-access-grant` | devops-pro-access-grant.md | Conceder/restaurar acesso AIOX Pro com validacao de API e installer | Interactive |
306
+ | `*pro-check-access` | devops-pro-check-access.md | Consultar entitlement e existencia de conta | Interactive |
307
+ | `*pro-request-reset` | devops-pro-request-reset.md | Disparar email de reset de senha | Interactive |
308
+ | `*pro-resend-verification` | devops-pro-resend-verification.md | Reenviar verificacao de email | Interactive |
309
+ | `*pro-reset-password` | devops-pro-reset-password.md | Trocar senha administrativamente e validar login | Interactive |
310
+ | `*pro-validate-login` | devops-pro-validate-login.md | Validar login e emissao de token | Interactive |
311
+ | `*pro-verify-status` | devops-pro-verify-status.md | Consultar estado de verificacao do email | Interactive |
312
+ | `*pro-activate` | devops-pro-activate.md | Validar/restaurar ativacao Pro diretamente | Interactive |
305
313
 
306
314
  ---
307
315
 
@@ -623,6 +631,16 @@ npm audit --ignore-advisories=ADVISORY_ID
623
631
  @devops *push
624
632
  @devops *cleanup
625
633
 
634
+ # AIOX Pro
635
+ @devops *pro-access-grant costa.wanderl@gmail.com AioxPro2026!
636
+ @devops *pro-check-access costa.wanderl@gmail.com
637
+ @devops *pro-request-reset costa.wanderl@gmail.com
638
+ @devops *pro-resend-verification costa.wanderl@gmail.com
639
+ @devops *pro-reset-password costa.wanderl@gmail.com NovaSenhaForte2026!
640
+ @devops *pro-validate-login costa.wanderl@gmail.com AioxPro2026!
641
+ @devops *pro-verify-status ACCESS_TOKEN
642
+ @devops *pro-activate ACCESS_TOKEN
643
+
626
644
  # CI/CD
627
645
  @devops *ci-cd github-actions
628
646
  @devops *release minor
@@ -46,6 +46,7 @@ Esta pasta contém a documentação detalhada de todos os workflows do AIOX, inc
46
46
  | **Spec** | Spec Pipeline | Pipeline de especificação | [spec-pipeline-workflow.md](./spec-pipeline-workflow.md) |
47
47
  | **Design** | Design System | Construção de design system | [design-system-build-quality-workflow.md](./design-system-build-quality-workflow.md) |
48
48
  | **Git** | Auto Worktree | Gestão automática de worktrees | [auto-worktree-workflow.md](./auto-worktree-workflow.md) |
49
+ | **Operations** | Pro Access Grant | Concessao e validacao de acesso AIOX Pro | [pro-access-grant-workflow.md](./pro-access-grant-workflow.md) |
49
50
 
50
51
  ---
51
52
 
@@ -0,0 +1,218 @@
1
+ # Workflow: Pro Access Grant
2
+
3
+ **Versao:** 1.0
4
+ **Tipo:** Operations
5
+ **Autor:** Dex + validated with live AIOX Pro flow
6
+ **Data de Criacao:** 2026-04-20
7
+ **Tags:** pro, support, devops, supabase, vercel, installer
8
+
9
+ ---
10
+
11
+ ## Visao Geral
12
+
13
+ O workflow **Pro Access Grant** padroniza a concessao ou restauracao de acesso ao AIOX Pro para um usuario final, cobrindo:
14
+
15
+ - preflight de entitlement e conta
16
+ - concessao de buyer
17
+ - criacao ou ajuste da conta no Supabase Auth
18
+ - validacao direta da API
19
+ - validacao final pelo instalador guiado
20
+
21
+ ### Objetivo
22
+
23
+ Permitir que `@devops` execute o suporte de acesso Pro sempre do mesmo jeito, com evidencias objetivas e sem rediscovering manual.
24
+
25
+ ### Quando usar
26
+
27
+ - usuario pediu criacao de acesso Pro
28
+ - usuario pediu reset de senha do Pro
29
+ - usuario reportou que comprou mas `check-email` nao reconhece
30
+ - usuario ja tem conta mas a ativacao nao conclui
31
+
32
+ ### Quando nao usar
33
+
34
+ - bug de produto fora do fluxo de licenciamento
35
+ - pedido de licenca key legada sem auth por email
36
+
37
+ ---
38
+
39
+ ## Fluxo Principal
40
+
41
+ ```mermaid
42
+ flowchart TD
43
+ START([Solicitacao de acesso Pro]) --> PREFLIGHT[1. Preflight check-email]
44
+ PREFLIGHT --> DECISION{isBuyer e hasAccount?}
45
+
46
+ DECISION -->|Nao buyer| BUYER[2. Grant buyer em public.buyers]
47
+ BUYER --> ACCOUNT
48
+
49
+ DECISION -->|Buyer sem conta| ACCOUNT[3. Criar ou ajustar auth user]
50
+ DECISION -->|Buyer com conta| VERIFY
51
+
52
+ ACCOUNT --> CACHE[4. Seed buyer_validations se necessario]
53
+ CACHE --> VERIFY[5. Validar login e verify-status]
54
+ VERIFY --> ACTIVATE[6. Validar activate-pro]
55
+ ACTIVATE --> INSTALL[7. Rodar instalacao guiada]
56
+ INSTALL --> DONE([Acesso pronto e validado])
57
+
58
+ ACTIVATE -->|Falha de contrato| FIXCLIENT[Atualizar caller para accessToken no body]
59
+ FIXCLIENT --> ACTIVATE
60
+
61
+ VERIFY -->|Email nao verificado| CONFIRM[Confirmar email no Supabase Auth]
62
+ CONFIRM --> VERIFY
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Steps Detalhados
68
+
69
+ ### Step 1: Preflight
70
+
71
+ | Campo | Valor |
72
+ |-------|-------|
73
+ | **ID** | `preflight` |
74
+ | **Agente** | `@devops` |
75
+ | **Acao** | Executar `POST /api/v1/auth/check-email` |
76
+
77
+ #### Saida esperada
78
+
79
+ - `isBuyer=true|false`
80
+ - `hasAccount=true|false`
81
+
82
+ #### Decisao
83
+
84
+ - se `isBuyer=false`: ir para `grant-buyer`
85
+ - se `hasAccount=false`: ir para `create-account`
86
+ - se ambos `true`: ir para `api-verify`
87
+
88
+ ### Step 2: Grant Buyer
89
+
90
+ | Campo | Valor |
91
+ |-------|-------|
92
+ | **ID** | `grant-buyer` |
93
+ | **Agente** | `@devops` |
94
+ | **Acao** | Upsert em `public.buyers` |
95
+
96
+ #### Regras
97
+
98
+ - email sempre em lowercase
99
+ - `is_active=true`
100
+ - `source='manual_support'`
101
+
102
+ ### Step 3: Create Account
103
+
104
+ | Campo | Valor |
105
+ |-------|-------|
106
+ | **ID** | `create-account` |
107
+ | **Agente** | `@devops` |
108
+ | **Acao** | Criar ou ajustar usuario no Supabase Auth |
109
+
110
+ #### Regras
111
+
112
+ - definir a senha solicitada pelo suporte
113
+ - marcar email como confirmado
114
+ - nao criar usuario duplicado
115
+
116
+ ### Step 4: Seed Local Fallback
117
+
118
+ | Campo | Valor |
119
+ |-------|-------|
120
+ | **ID** | `seed-local-fallback` |
121
+ | **Agente** | `@devops` |
122
+ | **Acao** | Upsert em `public.buyer_validations` |
123
+
124
+ #### Quando executar
125
+
126
+ - buyer RPC instavel
127
+ - grant muito recente ainda nao refletido no preflight
128
+
129
+ ### Step 5: API Verify
130
+
131
+ | Campo | Valor |
132
+ |-------|-------|
133
+ | **ID** | `api-verify` |
134
+ | **Agente** | `@devops` |
135
+ | **Acao** | Validar `login` e `verify-status` |
136
+
137
+ #### Pass criteria
138
+
139
+ - `login` retorna `accessToken`
140
+ - `verify-status` retorna `emailVerified=true`
141
+
142
+ ### Step 6: Activate Pro
143
+
144
+ | Campo | Valor |
145
+ |-------|-------|
146
+ | **ID** | `activate-pro` |
147
+ | **Agente** | `@devops` |
148
+ | **Acao** | Validar `POST /api/v1/auth/activate-pro` |
149
+
150
+ #### Pass criteria
151
+
152
+ - `201` com `licenseKey` no primeiro grant
153
+ - ou `200` com restauracao idempotente em reinstalacao
154
+
155
+ ### Step 7: Guided Install Validation
156
+
157
+ | Campo | Valor |
158
+ |-------|-------|
159
+ | **ID** | `guided-install-validation` |
160
+ | **Agente** | `@devops` |
161
+ | **Acao** | Rodar instalador guiado como usuario |
162
+
163
+ #### Validacao obrigatoria
164
+
165
+ - path source checkout
166
+ - path tarball empacotado
167
+
168
+ #### Pass criteria
169
+
170
+ - Pro instalado
171
+ - verificacao final do installer em verde
172
+ - `.claude/skills`, `.claude/commands` e `.codex/skills` presentes
173
+
174
+ ---
175
+
176
+ ## Entradas
177
+
178
+ - `target_email`
179
+ - `target_password`
180
+ - `reset_password` (boolean)
181
+ - `run_guided_validation` (boolean, default: `true` quando houve mudanca de codigo)
182
+
183
+ ---
184
+
185
+ ## Saidas
186
+
187
+ - entitlement confirmado
188
+ - conta criada ou atualizada
189
+ - email confirmado
190
+ - Pro ativado ou restaurado
191
+ - evidencias de API e installer
192
+
193
+ ---
194
+
195
+ ## Preconditions
196
+
197
+ - acesso ao projeto Supabase `evvvnarpwcdybxdvcwjh`
198
+ - acesso ao projeto Vercel `aiox-license-server`
199
+ - operador sabe se o pedido inclui criacao de senha ou apenas restauracao
200
+
201
+ ---
202
+
203
+ ## Acceptance Criteria
204
+
205
+ - `check-email` termina com `isBuyer=true` e `hasAccount=true`
206
+ - `login` retorna token valido
207
+ - `verify-status` retorna email verificado
208
+ - `activate-pro` retorna sucesso
209
+ - instalacao guiada passa no source path e no tarball path quando houver mudanca de codigo
210
+ - suporte fecha o caso com evidencias sem expor token ou license key completos
211
+
212
+ ---
213
+
214
+ ## Source Of Truth
215
+
216
+ - `docs/guides/pro/access-grant-ops-playbook.md`
217
+ - `.aiox-core/development/tasks/devops-pro-access-grant.md`
218
+ - `docs/stories/PRO-11.1-auth-contract-hardening-and-pro-access-ops.md`