MemberJunction / MemberJunction/MJ
Installer findings from the 6.1.0 gate 4 fresh install (preflight pnpm false negative, relative --dir, no shipped metadata, ai-cli needs dbDatabase)
- Dominant language
- TSQL
- Stars
- 29
- Forks
- 6
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 323
Description
Non-blocking installer findings from the 6.1.0 LTS certification gate 4 macOS run on 2026-09-14 (tracking #4475). Each reproduced at least once against `@memberjunction/cli@6.1.0`; logs are in the gate 4 report linked from #4475. The blocking finding from the same run is filed separately.
1. **Preflight false negative "pnpm not found on PATH" when `--dir` does not exist yet.** `PreflightPhase.gatherEnvironment` spawns `pnpm --version` with `cwd = targetDir`; on a first run the directory does not exist, the spawn throws ENOENT, the catch returns `not found`, and preflight hard-fails with a fix hint about corepack. The failed run creates the directory (state file plus diagnostic report), so the second run passes, which makes it look like a flake. The diagnostic report from the failed run itself shows `pnpm 11.21.0 pass`. Fix: probe from `process.cwd()` or create the target directory before probing.
2. **Relative `--dir` breaks the migrate phase.** `flags.dir` is passed through unresolved; `MigratePhase` spawns node with `Cwd: context.Dir` and a script path built with `path.join(dir, 'node_modules', ...)`, also relative, which node resolves against the cwd and produces `mj/mj/node_modules/...` MODULE_NOT_FOUND. Fix: `path.resolve(flags.dir)` once at the top of the command.
3. **The distribution install ships no `metadata/` folder and never runs `mj sync push`.** `DistributionAssembler.BASE_MAPPINGS` copies SQL Scripts, MJAPI, MJExplorer, GeneratedEntities and GeneratedActions only; the migration sparse checkout fetches `migrations/` into a temp dir that is deleted. Certification's "sync push is a clean no-op on a fresh install" assertion had to be run from the v6.1.0 source archive instead (it passed: 89 of 89 directories, no changes). Related: `metadata/prompts/templates/system/*.md` `@include` six files from `packages/AI/CorePlus/generated-for-prompt/`, so `metadata/` alone is not self-contained. Decide whether the distribution should ship metadata, and if not, document that the tag's metadata is the seed.
4. **`mj ai ...` is unusable on a distribution install as configured.** `@memberjunction/ai-cli` requires `dbDatabase` on the cosmiconfig object from `mj.config.cjs`; the distribution's `mj.config.cjs` ships every DB field commented out in favour of environment defaults, and ai-cli applies no env fallback even though it loads `.env`. `mj migrate`, `mj codegen` and `mj sync push` work from the same directory because they fall back to `process.env.DB_*`. Fix: same fallback in ai-cli, or uncomment the DB fields in the shipped config.
5. **Minor.** The "Config files were created with default/empty values" warning fires although `.env` is fully populated. The distribution `mj.config.cjs` AFTER-commands invoke `npm` even when `PackageManager` is `pnpm`. `mj install --diagnose` does not exist although the docs mention diagnosis; the CLI offers `mj doctor --report`.
None of these blocks certification on its own; they are recorded on the 6.1.0 scorecard. Items 1, 2 and 4 are code-only and backport-eligible if fixed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Research direction
Start with PreflightPhase.gatherEnvironment and MigratePhase, reproducing the missing-directory and relative --dir cases described in the gate 4 report. Then inspect DistributionAssembler.BASE_MAPPINGS, the shipped mj.config.cjs, and @memberjunction/ai-cli to compare distribution behavior with mj migrate, mj codegen, and mj sync push. Done means the reported installer paths behave consistently and the metadata, database configuration, warning, command, and package-manager behavior are resolved or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- build-system, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100