@mearl/setup 3.0.0-beta.1 → 3.0.0-beta.10

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/dist/skills.js CHANGED
@@ -4,11 +4,11 @@ import { homedir } from 'node:os';
4
4
  import { NodeCapabilityRegistry } from '@mearl/daemon-core/capabilities';
5
5
  import { inspectGlobalSkill, readTrackedSkillSources } from './skillSources.js';
6
6
  import { PresetInstallationStore } from './presetStore.js';
7
- import { findExecutable, isExecutable, prependCommandPath, prependNodePath, runCommand, } from '@mearl/daemon-core';
7
+ import { findExecutable, isExecutable, npmExecEnvironment, prependCommandPath, prependNodePath, runCommand, } from '@mearl/daemon-core';
8
8
  export const SKILLS_CLI_PACKAGE = 'skills@1.5.0';
9
9
  export const MEARL_SKILL_SOURCE = SETUP_VERSION.includes('-beta.')
10
- ? `https://github.com/F-loat/mearl/tree/v${SETUP_VERSION}`
11
- : 'https://github.com/F-loat/mearl';
10
+ ? `https://github.com/mearlhq/mearl/tree/v${SETUP_VERSION}`
11
+ : 'https://github.com/mearlhq/mearl';
12
12
  const COMMAND_TIMEOUT_MS = 120_000;
13
13
  const ANSI_ESCAPE_PATTERN = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, 'g');
14
14
  export function stripAnsi(value) {
@@ -41,7 +41,7 @@ export function resolveSkillsInvocation(options = {}) {
41
41
  return {
42
42
  command: npx,
43
43
  argsPrefix: ['-y', SKILLS_CLI_PACKAGE],
44
- env: prependNodePath(prependCommandPath(npx, env), processExecPath),
44
+ env: npmExecEnvironment(prependNodePath(prependCommandPath(npx, env), processExecPath)),
45
45
  };
46
46
  }
47
47
  /** Only the selected manager module is needed; browser and Provider factories stay in their hosts. */
@@ -59,9 +59,11 @@ export async function captureSkillsCli(options = {}) {
59
59
  const managedSkills = Object.fromEntries(Object.entries(current.preset?.skills ?? {}).filter(([, entry]) => entry.enabled !== false));
60
60
  const backend = registry.get('skills.manager')?.();
61
61
  if (backend !== undefined) {
62
+ if (backend?.readSources !== undefined && typeof backend.readSources !== 'function')
63
+ throw new Error('Invalid Skill source reader');
62
64
  if (!backend || typeof backend.id !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/.test(backend.id) || typeof backend.cli !== 'function')
63
65
  throw new Error('The selected Skill manager requires a preset update for CLI operations');
64
- return { id: backend.id, managedSkills, selection, inspectGlobal: (source, name, version) => inspectGlobalSkill(source, name, version, { externalManager: true, normalizeSource: backend.normalizeSource, readSources }), run: async (args, settings) => {
66
+ return { id: backend.id, managedSkills, selection, inspectGlobal: (source, name, version, inspection) => inspectGlobalSkill(source, name, version, { migrateFrom: inspection?.migrateFrom, externalManager: true, normalizeSource: backend.normalizeSource, readSources: backend.readSources ?? readSources }), run: async (args, settings) => {
65
67
  const result = await backend.cli([...args], settings);
66
68
  if (!result || !Number.isInteger(result.code) || typeof result.stdout !== 'string' || typeof result.stderr !== 'string')
67
69
  throw new Error('Invalid Skill manager CLI result');
@@ -71,7 +73,7 @@ export async function captureSkillsCli(options = {}) {
71
73
  const invocation = resolveSkillsInvocation(options);
72
74
  if (!invocation)
73
75
  return undefined;
74
- return { id: 'skills', managedSkills, selection, inspectGlobal: (source, name, version) => inspectGlobalSkill(source, name, version, { readSources }), run: (args, settings) => runner(invocation.command, [...invocation.argsPrefix, ...args], { ...settings, env: invocation.env }) };
76
+ return { id: 'skills', managedSkills, selection, inspectGlobal: (source, name, version, inspection) => inspectGlobalSkill(source, name, version, { migrateFrom: inspection?.migrateFrom, readSources }), run: (args, settings) => runner(invocation.command, [...invocation.argsPrefix, ...args], { ...settings, env: invocation.env }) };
75
77
  }
76
78
  export function parseInstalledSkills(output) {
77
79
  const value = JSON.parse(stripAnsi(output).trim());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/setup",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "One-shot environment setup and configuration for Mearl",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,6 +45,10 @@
45
45
  "./preset": {
46
46
  "types": "./dist/preset.d.ts",
47
47
  "import": "./dist/preset.js"
48
+ },
49
+ "./skill-source-receipts": {
50
+ "types": "./dist/skillSourceReceipts.d.ts",
51
+ "import": "./dist/skillSourceReceipts.js"
48
52
  }
49
53
  },
50
54
  "bin": {
@@ -64,31 +68,32 @@
64
68
  ],
65
69
  "license": "Apache-2.0",
66
70
  "engines": {
67
- "node": ">=22.12.0"
71
+ "node": ">=20.18.0"
68
72
  },
69
73
  "publishConfig": {
70
74
  "registry": "https://registry.npmjs.org"
71
75
  },
72
76
  "dependencies": {
73
- "commander": "^15.0.0",
74
- "extract-zip": "^2.0.1",
77
+ "commander": "^14.0.3",
75
78
  "ws": "^8.18.3",
76
79
  "semver": "^7.8.5",
77
- "@mearl/preset": "3.0.0-beta.1",
78
- "@mearl/daemon-core": "3.0.0-beta.1",
79
- "@mearl/client": "3.0.0-beta.1",
80
- "@mearl/provider": "3.0.0-beta.1",
81
- "@mearl/browser-core": "3.0.0-beta.1"
80
+ "adm-zip": "^0.6.1",
81
+ "@mearl/provider": "3.0.0-beta.10",
82
+ "@mearl/daemon-core": "3.0.0-beta.10",
83
+ "@mearl/client": "3.0.0-beta.10",
84
+ "@mearl/preset": "3.0.0-beta.10",
85
+ "@mearl/browser-core": "3.0.0-beta.10"
82
86
  },
83
87
  "devDependencies": {
84
88
  "@types/node": "^24.9.1",
85
89
  "@types/ws": "^8.18.1",
86
90
  "typescript": "^5.8.3",
87
- "@types/semver": "^7.7.1"
91
+ "@types/semver": "^7.7.1",
92
+ "@types/adm-zip": "^0.5.7"
88
93
  },
89
94
  "repository": {
90
95
  "type": "git",
91
- "url": "git+https://github.com/F-loat/mearl.git",
96
+ "url": "git+https://github.com/mearlhq/mearl.git",
92
97
  "directory": "packages/setup"
93
98
  },
94
99
  "scripts": {
@@ -1,13 +0,0 @@
1
- import { type InstallationConfig } from '@mearl/preset/installation';
2
- import { PresetInstaller, type StagedPresetInstallation } from './preset.js';
3
- import { type DetectedGlobalPackage } from './packageManager.js';
4
- export declare const MEARL_INSTALLATION_CONFIG_URL = "https://f-loat.github.io/mearl/installation.json";
5
- /** Reuse the installation receipt as the retry marker; organization defaults come from deployment data. */
6
- export declare function prepareSetupPreset(options: {
7
- source?: string;
8
- installed?: Array<Pick<DetectedGlobalPackage, 'packageName' | 'packageRoot'>>;
9
- env?: NodeJS.ProcessEnv;
10
- }, dependencies?: {
11
- installer?: PresetInstaller;
12
- configuration?: () => Promise<InstallationConfig>;
13
- }): Promise<StagedPresetInstallation | undefined>;
@@ -1,42 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { loadInstallationConfig } from '@mearl/preset/installation';
4
- import { PresetInstaller } from './preset.js';
5
- import { detectGlobalPackage } from './packageManager.js';
6
- import { detectMearlProfiles } from './profiles.js';
7
- export const MEARL_INSTALLATION_CONFIG_URL = 'https://f-loat.github.io/mearl/installation.json';
8
- function isLegacyPackage(installation) {
9
- try {
10
- const manifest = JSON.parse(readFileSync(join(installation.packageRoot, 'package.json'), 'utf8'));
11
- return manifest.name === installation.packageName && typeof manifest.version === 'string' && /^[0-2]\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(manifest.version);
12
- }
13
- catch {
14
- return false;
15
- }
16
- }
17
- /** Reuse the installation receipt as the retry marker; organization defaults come from deployment data. */
18
- export async function prepareSetupPreset(options, dependencies = {}) {
19
- const env = options.env ?? process.env;
20
- const installer = dependencies.installer ?? new PresetInstaller({ directory: env.MEARL_CAPABILITY_DIR });
21
- if (options.source)
22
- return installer.stage(options.source);
23
- const current = await installer.store.current();
24
- if (current.receipt)
25
- return { revision: current.receipt.revision, activate: () => installer.resume(current.receipt.revision) };
26
- if (current.activation)
27
- return;
28
- const client = options.installed === undefined ? detectGlobalPackage('@mearl/client', ['mearl'], { env }) : null;
29
- const installed = options.installed ?? [...detectMearlProfiles({ env }).values(), ...(client ? [client] : [])];
30
- if (!installed.some(isLegacyPackage))
31
- return;
32
- const configuration = dependencies.configuration ?? (() => {
33
- const url = new URL(env.MEARL_INSTALLATION_CONFIG_URL || MEARL_INSTALLATION_CONFIG_URL);
34
- if (url.protocol !== 'https:' && !(url.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname)))
35
- throw new Error('Installation configuration requires HTTPS or loopback HTTP');
36
- return loadInstallationConfig(url, url.origin, AbortSignal.timeout(5_000));
37
- });
38
- const config = await configuration();
39
- if (!config.legacyPreset)
40
- throw new Error('Legacy upgrade preset is unavailable. Retry when the installation catalog is available, or select a preset with --preset.');
41
- return installer.stage(config.presets[config.legacyPreset].source, { expectedRevision: null, expectedId: config.legacyPreset });
42
- }