@mesh-tech/mesh-cli 0.12.7 → 0.13.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/README.md +227 -0
- package/assets/app-skill/SKILL.md +59 -0
- package/dist/bin/mesh.js +325 -89
- package/dist/bin/mesh.js.map +4 -4
- package/dist/build-info.json +2 -2
- package/dist/src/commands/create-app.d.ts +37 -0
- package/dist/src/commands/create-app.d.ts.map +1 -1
- package/dist/src/commands/create-app.js +141 -26
- package/dist/src/commands/create-app.js.map +1 -1
- package/dist/src/commands/skills.d.ts +48 -8
- package/dist/src/commands/skills.d.ts.map +1 -1
- package/dist/src/commands/skills.js +204 -12
- package/dist/src/commands/skills.js.map +1 -1
- package/dist/src/utils/scaffold-versions.d.ts +57 -0
- package/dist/src/utils/scaffold-versions.d.ts.map +1 -0
- package/dist/src/utils/scaffold-versions.js +75 -0
- package/dist/src/utils/scaffold-versions.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +4 -3
- package/fragments/base/package.json.hbs +4 -5
- package/fragments/service/api/package.json.hbs +5 -5
- package/fragments/temporal/worker/package.json.hbs +5 -5
- package/package.json +2 -2
- package/skills/core/SKILL.md +12 -2
- package/templates/apps-repo/package.json.hbs +2 -1
- package/templates/apps-repo/pnpm-workspace.yaml +9 -1
package/dist/bin/mesh.js
CHANGED
|
@@ -890,8 +890,8 @@ ${body}${MANAGED_END}
|
|
|
890
890
|
return existing.slice(0, startIdx) + section + existing.slice(tail);
|
|
891
891
|
}
|
|
892
892
|
if (existing.length === 0) return section;
|
|
893
|
-
const
|
|
894
|
-
return existing +
|
|
893
|
+
const sep5 = existing.endsWith("\n\n") ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
|
|
894
|
+
return existing + sep5 + section;
|
|
895
895
|
}
|
|
896
896
|
function newStsClient() {
|
|
897
897
|
return new STSClient({ region: DEFAULT_REGION });
|
|
@@ -11415,6 +11415,63 @@ ${raw}`;
|
|
|
11415
11415
|
${MANAGED_MARKER}
|
|
11416
11416
|
${raw.slice(frontmatter.length)}`;
|
|
11417
11417
|
}
|
|
11418
|
+
function meshTechScopeDirs(root, maxDepth = 6) {
|
|
11419
|
+
const scopes = [];
|
|
11420
|
+
const walk = (dir, depth) => {
|
|
11421
|
+
if (depth > maxDepth) return;
|
|
11422
|
+
let entries;
|
|
11423
|
+
try {
|
|
11424
|
+
entries = fs21.readdirSync(dir, { withFileTypes: true });
|
|
11425
|
+
} catch {
|
|
11426
|
+
return;
|
|
11427
|
+
}
|
|
11428
|
+
for (const entry of entries) {
|
|
11429
|
+
if (!entry.isDirectory()) continue;
|
|
11430
|
+
if (entry.name === "node_modules") {
|
|
11431
|
+
const scope = path23.join(dir, entry.name, "@mesh-tech");
|
|
11432
|
+
if (fs21.existsSync(scope)) scopes.push(scope);
|
|
11433
|
+
continue;
|
|
11434
|
+
}
|
|
11435
|
+
if (entry.name.startsWith(".")) continue;
|
|
11436
|
+
walk(path23.join(dir, entry.name), depth + 1);
|
|
11437
|
+
}
|
|
11438
|
+
};
|
|
11439
|
+
walk(root, 0);
|
|
11440
|
+
return scopes;
|
|
11441
|
+
}
|
|
11442
|
+
function listPackageSkills(root) {
|
|
11443
|
+
const byName = /* @__PURE__ */ new Map();
|
|
11444
|
+
for (const scopeDir of meshTechScopeDirs(root)) {
|
|
11445
|
+
for (const pkg of fs21.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
11446
|
+
if (!pkg.isDirectory() && !pkg.isSymbolicLink()) continue;
|
|
11447
|
+
if (pkg.name === BASE_SKILL_PACKAGE) continue;
|
|
11448
|
+
const skillsDir = path23.join(scopeDir, pkg.name, "skills");
|
|
11449
|
+
if (!fs21.existsSync(skillsDir)) continue;
|
|
11450
|
+
for (const domain of fs21.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
11451
|
+
const source = path23.join(skillsDir, domain.name, "SKILL.md");
|
|
11452
|
+
if (!fs21.existsSync(source)) continue;
|
|
11453
|
+
const name = `mesh-${pkg.name}-${domain.name}`;
|
|
11454
|
+
if (!byName.has(name)) byName.set(name, { name, dir: path23.join(skillsDir, domain.name), source });
|
|
11455
|
+
}
|
|
11456
|
+
}
|
|
11457
|
+
}
|
|
11458
|
+
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
11459
|
+
}
|
|
11460
|
+
function copySkillExtras(sourceDir, targetDir) {
|
|
11461
|
+
for (const entry of fs21.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
11462
|
+
if (entry.name === "SKILL.md") continue;
|
|
11463
|
+
fs21.cpSync(path23.join(sourceDir, entry.name), path23.join(targetDir, entry.name), { recursive: true });
|
|
11464
|
+
}
|
|
11465
|
+
}
|
|
11466
|
+
function seedAppSkill(root, appName, appRelPath) {
|
|
11467
|
+
const target = path23.join(root, ".claude", "skills", appName, "SKILL.md");
|
|
11468
|
+
if (fs21.existsSync(target)) return null;
|
|
11469
|
+
const template = fs21.readFileSync(cliAsset("assets", "app-skill", "SKILL.md"), "utf-8");
|
|
11470
|
+
const body = template.replaceAll("__APP_NAME__", appName).replaceAll("__APP_PATH__", appRelPath || ".");
|
|
11471
|
+
fs21.mkdirSync(path23.dirname(target), { recursive: true });
|
|
11472
|
+
fs21.writeFileSync(target, body);
|
|
11473
|
+
return path23.relative(root, target);
|
|
11474
|
+
}
|
|
11418
11475
|
function planSync(root) {
|
|
11419
11476
|
const items = [];
|
|
11420
11477
|
for (const skill of listBaseSkills()) {
|
|
@@ -11441,6 +11498,43 @@ function planSync(root) {
|
|
|
11441
11498
|
}
|
|
11442
11499
|
}
|
|
11443
11500
|
}
|
|
11501
|
+
const packageSkills = listPackageSkills(root);
|
|
11502
|
+
for (const skill of packageSkills) {
|
|
11503
|
+
const targetDir = path23.join(root, ".claude", "skills", skill.name);
|
|
11504
|
+
const target = path23.join(targetDir, "SKILL.md");
|
|
11505
|
+
const desired = renderManagedSkill(skill.source);
|
|
11506
|
+
const label = `.claude/skills/${skill.name}/SKILL.md (platform skill)`;
|
|
11507
|
+
if (!fs21.existsSync(target)) {
|
|
11508
|
+
items.push({
|
|
11509
|
+
label,
|
|
11510
|
+
state: "write",
|
|
11511
|
+
apply: () => {
|
|
11512
|
+
fs21.mkdirSync(targetDir, { recursive: true });
|
|
11513
|
+
fs21.writeFileSync(target, desired);
|
|
11514
|
+
copySkillExtras(skill.dir, targetDir);
|
|
11515
|
+
}
|
|
11516
|
+
});
|
|
11517
|
+
} else {
|
|
11518
|
+
const current = fs21.readFileSync(target, "utf-8");
|
|
11519
|
+
if (current === desired) {
|
|
11520
|
+
items.push({ label, state: "ok" });
|
|
11521
|
+
} else if (current.includes(MANAGED_MARKER)) {
|
|
11522
|
+
items.push({
|
|
11523
|
+
label,
|
|
11524
|
+
state: "write",
|
|
11525
|
+
apply: () => {
|
|
11526
|
+
fs21.writeFileSync(target, desired);
|
|
11527
|
+
copySkillExtras(skill.dir, targetDir);
|
|
11528
|
+
}
|
|
11529
|
+
});
|
|
11530
|
+
} else {
|
|
11531
|
+
items.push({ label: `${label} \u2014 exists without the managed marker, leaving as-is`, state: "skip" });
|
|
11532
|
+
}
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
if (packageSkills.length === 0 && meshTechScopeDirs(root).length === 0) {
|
|
11536
|
+
logInfo("No @mesh-tech packages installed yet \u2014 run `pnpm install`, then `mesh skills sync` again for the platform skills.");
|
|
11537
|
+
}
|
|
11444
11538
|
const hookSource = cliAsset("assets", "intent", "intent-claude-gate.mjs");
|
|
11445
11539
|
const hookTarget = path23.join(root, HOOK_RELATIVE);
|
|
11446
11540
|
const hookDesired = fs21.readFileSync(hookSource, "utf-8");
|
|
@@ -11455,6 +11549,38 @@ function planSync(root) {
|
|
|
11455
11549
|
}
|
|
11456
11550
|
}
|
|
11457
11551
|
);
|
|
11552
|
+
const rootPkgPath = path23.join(root, "package.json");
|
|
11553
|
+
if (fs21.existsSync(rootPkgPath)) {
|
|
11554
|
+
let rootPkg = null;
|
|
11555
|
+
try {
|
|
11556
|
+
rootPkg = JSON.parse(fs21.readFileSync(rootPkgPath, "utf-8"));
|
|
11557
|
+
} catch {
|
|
11558
|
+
rootPkg = null;
|
|
11559
|
+
}
|
|
11560
|
+
const label = "package.json (@tanstack/intent devDependency)";
|
|
11561
|
+
if (!rootPkg) {
|
|
11562
|
+
items.push({ label: `${label} \u2014 package.json is unparseable, leaving as-is`, state: "skip" });
|
|
11563
|
+
} else if (rootPkg.devDependencies?.["@tanstack/intent"] || rootPkg.dependencies?.["@tanstack/intent"]) {
|
|
11564
|
+
items.push({ label, state: "ok" });
|
|
11565
|
+
} else {
|
|
11566
|
+
items.push({
|
|
11567
|
+
label,
|
|
11568
|
+
// Writing the dependency does not install it. Bare `mesh skills sync`
|
|
11569
|
+
// in an already-installed repo leaves `pnpm exec intent` unresolvable
|
|
11570
|
+
// until the next install, so say so rather than reporting success.
|
|
11571
|
+
remediation: "Added @tanstack/intent \u2014 run `pnpm install` so `pnpm exec intent` resolves.",
|
|
11572
|
+
state: "write",
|
|
11573
|
+
apply: () => {
|
|
11574
|
+
rootPkg.devDependencies = rootPkg.devDependencies ?? {};
|
|
11575
|
+
rootPkg.devDependencies["@tanstack/intent"] = INTENT_RANGE;
|
|
11576
|
+
rootPkg.devDependencies = Object.fromEntries(
|
|
11577
|
+
Object.entries(rootPkg.devDependencies).sort(([a], [b]) => a.localeCompare(b))
|
|
11578
|
+
);
|
|
11579
|
+
fs21.writeFileSync(rootPkgPath, JSON.stringify(rootPkg, null, 2) + "\n");
|
|
11580
|
+
}
|
|
11581
|
+
});
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11458
11584
|
const settingsPath = path23.join(root, ".claude", "settings.json");
|
|
11459
11585
|
let settings = {};
|
|
11460
11586
|
try {
|
|
@@ -11523,6 +11649,7 @@ function syncSkills(root, opts = {}) {
|
|
|
11523
11649
|
} else {
|
|
11524
11650
|
item.apply?.();
|
|
11525
11651
|
logSuccess(`synced: ${item.label}`);
|
|
11652
|
+
if (item.remediation) logInfo(item.remediation);
|
|
11526
11653
|
}
|
|
11527
11654
|
}
|
|
11528
11655
|
if (!dirty) {
|
|
@@ -11533,7 +11660,7 @@ function syncSkills(root, opts = {}) {
|
|
|
11533
11660
|
function registerSkillsCommands(program2) {
|
|
11534
11661
|
const skills = program2.command("skills").description("Agent-skill distribution (base skills + Intent discovery)");
|
|
11535
11662
|
skills.command("sync").description(
|
|
11536
|
-
"Install the base building-with-Mesh skills into .claude/skills
|
|
11663
|
+
"Install the base building-with-Mesh skills into .claude/skills/, fetch the platform skills shipped by the repo's installed @mesh-tech/* packages, and wire TanStack-Intent discovery (intent devDependency + hook + settings + AGENTS.md fence)"
|
|
11537
11664
|
).option("--check", "verify only (CI/doctor): exit 1 when anything is missing or stale", false).option("--root <path>", "target repo root (default: enclosing git root)").action((opts) => {
|
|
11538
11665
|
const root = path23.resolve(opts.root ?? resolveTargetRoot());
|
|
11539
11666
|
const ok = syncSkills(root, { check: opts.check });
|
|
@@ -11544,7 +11671,7 @@ function registerSkillsCommands(program2) {
|
|
|
11544
11671
|
}
|
|
11545
11672
|
});
|
|
11546
11673
|
}
|
|
11547
|
-
var MANAGED_MARKER, FENCE_START, HOOK_RELATIVE;
|
|
11674
|
+
var MANAGED_MARKER, FENCE_START, HOOK_RELATIVE, INTENT_RANGE, BASE_SKILL_PACKAGE;
|
|
11548
11675
|
var init_skills = __esm({
|
|
11549
11676
|
"libs/mesh-cli/src/commands/skills.ts"() {
|
|
11550
11677
|
"use strict";
|
|
@@ -11554,26 +11681,78 @@ var init_skills = __esm({
|
|
|
11554
11681
|
MANAGED_MARKER = "<!-- managed-by: mesh skills sync \u2014 edits are overwritten; copy content elsewhere to customize -->";
|
|
11555
11682
|
FENCE_START = "<!-- intent-skills:start -->";
|
|
11556
11683
|
HOOK_RELATIVE = path23.join(".intent", "hooks", "intent-claude-gate.mjs");
|
|
11684
|
+
INTENT_RANGE = "^0.3.6";
|
|
11685
|
+
BASE_SKILL_PACKAGE = "mesh-cli";
|
|
11686
|
+
}
|
|
11687
|
+
});
|
|
11688
|
+
|
|
11689
|
+
// libs/mesh-cli/src/utils/scaffold-versions.ts
|
|
11690
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
11691
|
+
function isPrerelease(range) {
|
|
11692
|
+
return /[-+]/.test(range.replace(/^\^/, ""));
|
|
11693
|
+
}
|
|
11694
|
+
function toCaretRange(version) {
|
|
11695
|
+
const trimmed = version.trim();
|
|
11696
|
+
return /^\d+\.\d+\.\d+(?:[-+].*)?$/.test(trimmed) ? `^${trimmed}` : null;
|
|
11697
|
+
}
|
|
11698
|
+
function resolvePublishedRange(pkg, cwd) {
|
|
11699
|
+
try {
|
|
11700
|
+
const out = execFileSync18("npm", ["view", pkg, "version"], {
|
|
11701
|
+
cwd,
|
|
11702
|
+
encoding: "utf-8",
|
|
11703
|
+
timeout: 15e3,
|
|
11704
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
11705
|
+
});
|
|
11706
|
+
const range = toCaretRange(out);
|
|
11707
|
+
if (range && !isPrerelease(range)) return { range, resolved: true };
|
|
11708
|
+
} catch {
|
|
11709
|
+
}
|
|
11710
|
+
return { range: SCAFFOLD_PACKAGE_LINES[pkg], resolved: false };
|
|
11711
|
+
}
|
|
11712
|
+
var SCAFFOLD_PACKAGE_LINES, SCAFFOLD_TOOLCHAIN;
|
|
11713
|
+
var init_scaffold_versions = __esm({
|
|
11714
|
+
"libs/mesh-cli/src/utils/scaffold-versions.ts"() {
|
|
11715
|
+
"use strict";
|
|
11716
|
+
SCAFFOLD_PACKAGE_LINES = {
|
|
11717
|
+
"@mesh-tech/app-kit": "^1.45.0",
|
|
11718
|
+
"@mesh-tech/esm-bundle": "^0.1.1"
|
|
11719
|
+
};
|
|
11720
|
+
SCAFFOLD_TOOLCHAIN = {
|
|
11721
|
+
"@types/node": "^24.2.1",
|
|
11722
|
+
tsx: "^4.20.4",
|
|
11723
|
+
typescript: "^5.9.2"
|
|
11724
|
+
};
|
|
11557
11725
|
}
|
|
11558
11726
|
});
|
|
11559
11727
|
|
|
11560
11728
|
// libs/mesh-cli/src/commands/create-app.ts
|
|
11561
11729
|
var create_app_exports = {};
|
|
11562
11730
|
__export(create_app_exports, {
|
|
11731
|
+
PLATFORM_MONOREPO_NAME: () => PLATFORM_MONOREPO_NAME,
|
|
11563
11732
|
bootstrapAppsRepo: () => bootstrapAppsRepo,
|
|
11564
11733
|
copyTemplate: () => copyTemplate,
|
|
11734
|
+
ensureWorkspaceGlobs: () => ensureWorkspaceGlobs,
|
|
11735
|
+
isInsidePlatformMonorepo: () => isInsidePlatformMonorepo,
|
|
11565
11736
|
registerCreateAppCommand: () => registerCreateAppCommand,
|
|
11566
|
-
shouldBootstrapAppsRepo: () => shouldBootstrapAppsRepo
|
|
11737
|
+
shouldBootstrapAppsRepo: () => shouldBootstrapAppsRepo,
|
|
11738
|
+
workspaceGlobForApp: () => workspaceGlobForApp
|
|
11567
11739
|
});
|
|
11568
11740
|
import * as fs22 from "fs";
|
|
11569
11741
|
import * as os8 from "os";
|
|
11570
11742
|
import * as path24 from "path";
|
|
11571
11743
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11572
11744
|
import Handlebars from "handlebars";
|
|
11573
|
-
|
|
11745
|
+
import { parse as parseYaml2 } from "yaml";
|
|
11746
|
+
function isInsidePlatformMonorepo(dir) {
|
|
11574
11747
|
let cur = path24.resolve(dir);
|
|
11575
11748
|
while (cur !== path24.dirname(cur)) {
|
|
11576
|
-
if (fs22.existsSync(path24.join(cur, "pnpm-workspace.yaml")))
|
|
11749
|
+
if (fs22.existsSync(path24.join(cur, "pnpm-workspace.yaml"))) {
|
|
11750
|
+
try {
|
|
11751
|
+
const pkg = JSON.parse(fs22.readFileSync(path24.join(cur, "package.json"), "utf-8"));
|
|
11752
|
+
if (pkg?.name === PLATFORM_MONOREPO_NAME) return true;
|
|
11753
|
+
} catch {
|
|
11754
|
+
}
|
|
11755
|
+
}
|
|
11577
11756
|
cur = path24.dirname(cur);
|
|
11578
11757
|
}
|
|
11579
11758
|
return false;
|
|
@@ -11583,7 +11762,7 @@ function resolveDeployerRoleArn(tenant, platformName, env) {
|
|
|
11583
11762
|
return `arn:aws:iam::${account}:role/${tenant}-${env}-apps-deployer`;
|
|
11584
11763
|
}
|
|
11585
11764
|
function shouldBootstrapAppsRepo(cwd) {
|
|
11586
|
-
return fs22.existsSync(path24.join(cwd, ".git")) && !
|
|
11765
|
+
return fs22.existsSync(path24.join(cwd, ".git")) && !isInsidePlatformMonorepo(cwd) && !fs22.existsSync(path24.join(cwd, "package.json")) && !fs22.existsSync(path24.join(cwd, "tenants")) && !fs22.existsSync(path24.join(cwd, "apps"));
|
|
11587
11766
|
}
|
|
11588
11767
|
function bootstrapAppsRepo(cwd, tenant) {
|
|
11589
11768
|
const templateDir = path24.join(packageRoot, "templates", "apps-repo");
|
|
@@ -11592,7 +11771,8 @@ function bootstrapAppsRepo(cwd, tenant) {
|
|
|
11592
11771
|
repoName: path24.basename(cwd),
|
|
11593
11772
|
tenant,
|
|
11594
11773
|
tenantTitle: tenant.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" "),
|
|
11595
|
-
registryUrl: `https://mesh-platform-${registryAccount}.d.codeartifact.us-east-2.amazonaws.com/npm/mesh-packages
|
|
11774
|
+
registryUrl: `https://mesh-platform-${registryAccount}.d.codeartifact.us-east-2.amazonaws.com/npm/mesh-packages/`,
|
|
11775
|
+
intentRange: INTENT_RANGE
|
|
11596
11776
|
};
|
|
11597
11777
|
const staging = fs22.mkdtempSync(path24.join(os8.tmpdir(), "mesh-apps-repo-"));
|
|
11598
11778
|
try {
|
|
@@ -11618,6 +11798,41 @@ function bootstrapAppsRepo(cwd, tenant) {
|
|
|
11618
11798
|
fs22.rmSync(staging, { recursive: true, force: true });
|
|
11619
11799
|
}
|
|
11620
11800
|
}
|
|
11801
|
+
function ensureWorkspaceGlobs(root, required) {
|
|
11802
|
+
const file = path24.join(root, "pnpm-workspace.yaml");
|
|
11803
|
+
if (!fs22.existsSync(file)) return [];
|
|
11804
|
+
const text = fs22.readFileSync(file, "utf-8");
|
|
11805
|
+
let declared;
|
|
11806
|
+
try {
|
|
11807
|
+
declared = parseYaml2(text)?.packages ?? [];
|
|
11808
|
+
} catch {
|
|
11809
|
+
return [];
|
|
11810
|
+
}
|
|
11811
|
+
const missing = required.filter((glob) => !declared.includes(glob));
|
|
11812
|
+
if (missing.length === 0) return [];
|
|
11813
|
+
const lines = text.split("\n");
|
|
11814
|
+
const start = lines.findIndex((line) => /^packages:\s*$/.test(line));
|
|
11815
|
+
if (start === -1) return [];
|
|
11816
|
+
let end = start;
|
|
11817
|
+
for (let i = start + 1; i < lines.length; i++) {
|
|
11818
|
+
const line = lines[i] ?? "";
|
|
11819
|
+
const isEntry = /^\s+-\s/.test(line);
|
|
11820
|
+
if (isEntry || /^\s*#/.test(line) || line.trim() === "") {
|
|
11821
|
+
if (isEntry) end = i;
|
|
11822
|
+
continue;
|
|
11823
|
+
}
|
|
11824
|
+
break;
|
|
11825
|
+
}
|
|
11826
|
+
const indent = (lines[end] ?? "").match(/^(\s*)-/)?.[1] ?? " ";
|
|
11827
|
+
lines.splice(end + 1, 0, ...missing.map((glob) => `${indent}- ${glob}`));
|
|
11828
|
+
fs22.writeFileSync(file, lines.join("\n"));
|
|
11829
|
+
return missing;
|
|
11830
|
+
}
|
|
11831
|
+
function workspaceGlobForApp(root, appDir) {
|
|
11832
|
+
const rel = path24.relative(root, appDir).split(path24.sep).join("/");
|
|
11833
|
+
if (rel === "" || rel.split("/")[0] === "..") return null;
|
|
11834
|
+
return `${path24.posix.dirname(rel)}/*/*`;
|
|
11835
|
+
}
|
|
11621
11836
|
function maybeBootstrapAppsRepo(cwd, tenant, test) {
|
|
11622
11837
|
if (test || !shouldBootstrapAppsRepo(cwd)) return;
|
|
11623
11838
|
const created = bootstrapAppsRepo(cwd, tenant);
|
|
@@ -11858,15 +12073,22 @@ async function runLegacyTemplate(tenant, name, template, test) {
|
|
|
11858
12073
|
fs22.rmSync(appDir, { recursive: true, force: true });
|
|
11859
12074
|
process.exit(1);
|
|
11860
12075
|
}
|
|
11861
|
-
autoSyncSkills(appDir);
|
|
12076
|
+
autoSyncSkills(appDir, name);
|
|
11862
12077
|
printLegacyNextSteps(appDir, template);
|
|
11863
12078
|
}
|
|
11864
|
-
function autoSyncSkills(appDir) {
|
|
12079
|
+
function autoSyncSkills(appDir, appName) {
|
|
12080
|
+
const root = resolveTargetRoot(appDir);
|
|
11865
12081
|
try {
|
|
11866
|
-
syncSkills(
|
|
12082
|
+
syncSkills(root);
|
|
11867
12083
|
} catch (err) {
|
|
11868
12084
|
logWarn(`Agent-skill sync skipped: ${err instanceof Error ? err.message : err} \u2014 run: mesh skills sync`);
|
|
11869
12085
|
}
|
|
12086
|
+
try {
|
|
12087
|
+
const seeded = seedAppSkill(root, appName, path24.relative(root, appDir));
|
|
12088
|
+
if (seeded) logSuccess(`seeded: ${seeded} (yours to grow \u2014 not managed by mesh skills sync)`);
|
|
12089
|
+
} catch (err) {
|
|
12090
|
+
logWarn(`App skill stub skipped: ${err instanceof Error ? err.message : err}`);
|
|
12091
|
+
}
|
|
11870
12092
|
}
|
|
11871
12093
|
async function runComposable(tenant, name, primitives, test) {
|
|
11872
12094
|
logInfo(`Creating app '${name}' for tenant '${tenant}'...`);
|
|
@@ -11883,6 +12105,15 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11883
12105
|
const region = "us-east-2";
|
|
11884
12106
|
const platformName = "mesh";
|
|
11885
12107
|
const platformEnv = "dev";
|
|
12108
|
+
const workspaceDeps = isInsidePlatformMonorepo(appDir);
|
|
12109
|
+
const repoRoot2 = resolveTargetRoot(process.cwd());
|
|
12110
|
+
const mesh = workspaceDeps ? { range: "", resolved: true } : resolvePublishedRange("@mesh-tech/app-kit", repoRoot2);
|
|
12111
|
+
const esmBundle = workspaceDeps ? { range: "", resolved: true } : resolvePublishedRange("@mesh-tech/esm-bundle", repoRoot2);
|
|
12112
|
+
if (!workspaceDeps) {
|
|
12113
|
+
logInfo(
|
|
12114
|
+
mesh.resolved ? `@mesh-tech/* pinned to ${mesh.range} (current published line)` : `Registry lookup unavailable \u2014 pinning @mesh-tech/* to ${mesh.range}; run \`pnpm up @mesh-tech/*\` once you have registry auth`
|
|
12115
|
+
);
|
|
12116
|
+
}
|
|
11886
12117
|
const context = {
|
|
11887
12118
|
name,
|
|
11888
12119
|
tenant,
|
|
@@ -11891,9 +12122,12 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11891
12122
|
temporal: primitives.includes("temporal"),
|
|
11892
12123
|
bucket: primitives.includes("bucket"),
|
|
11893
12124
|
region,
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
12125
|
+
workspaceDeps,
|
|
12126
|
+
meshRange: mesh.range,
|
|
12127
|
+
esmBundleRange: esmBundle.range,
|
|
12128
|
+
typesNodeRange: SCAFFOLD_TOOLCHAIN["@types/node"],
|
|
12129
|
+
tsxRange: SCAFFOLD_TOOLCHAIN.tsx,
|
|
12130
|
+
typescriptRange: SCAFFOLD_TOOLCHAIN.typescript,
|
|
11897
12131
|
deployerRoleArn: resolveDeployerRoleArn(tenant, platformName, platformEnv)
|
|
11898
12132
|
};
|
|
11899
12133
|
fs22.mkdirSync(appDir, { recursive: true });
|
|
@@ -11905,20 +12139,18 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11905
12139
|
fs22.rmSync(appDir, { recursive: true, force: true });
|
|
11906
12140
|
process.exit(1);
|
|
11907
12141
|
}
|
|
11908
|
-
const
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
12142
|
+
const nested = fs22.readdirSync(appDir, { withFileTypes: true }).some((entry) => entry.isDirectory() && fs22.existsSync(path24.join(appDir, entry.name, "package.json")));
|
|
12143
|
+
const glob = workspaceGlobForApp(repoRoot2, appDir);
|
|
12144
|
+
if (nested && glob) {
|
|
12145
|
+
const added = ensureWorkspaceGlobs(repoRoot2, [glob]);
|
|
12146
|
+
if (added.length > 0) {
|
|
12147
|
+
logInfo(`pnpm-workspace.yaml: added ${added.join(", ")} so the app's api/worker packages install`);
|
|
12148
|
+
}
|
|
11912
12149
|
}
|
|
11913
|
-
autoSyncSkills(appDir);
|
|
12150
|
+
autoSyncSkills(appDir, name);
|
|
11914
12151
|
printComposableNextSteps(appDir, context);
|
|
11915
12152
|
}
|
|
11916
12153
|
function printLegacyNextSteps(appDir, _template) {
|
|
11917
|
-
const configPath = path24.join(path24.dirname(appDir), "config.ts");
|
|
11918
|
-
if (!fs22.existsSync(configPath)) {
|
|
11919
|
-
logWarn(`No config.ts found at ${configPath}`);
|
|
11920
|
-
logInfo("You may need to create a shared config.ts for tenant apps.");
|
|
11921
|
-
}
|
|
11922
12154
|
console.log("");
|
|
11923
12155
|
logSuccess("App created successfully!");
|
|
11924
12156
|
console.log("");
|
|
@@ -11955,18 +12187,21 @@ function printComposableNextSteps(appDir, context) {
|
|
|
11955
12187
|
console.log("Next steps:");
|
|
11956
12188
|
console.log(` cd ${appDir}`);
|
|
11957
12189
|
console.log(" pnpm install");
|
|
12190
|
+
console.log(" mesh skills sync # re-run once deps are installed: picks up package skills + Intent");
|
|
12191
|
+
console.log(" pnpm install # again only if skills sync reports it added @tanstack/intent");
|
|
11958
12192
|
console.log(" mesh stack init # personal dev stack (deploy: false)");
|
|
11959
12193
|
console.log(" mesh deploy up --yes # deploy via the stack's deployer role");
|
|
11960
12194
|
console.log(" mesh dev # run locally");
|
|
11961
12195
|
console.log("");
|
|
11962
12196
|
}
|
|
11963
|
-
var __filename, __dirname, packageRoot, TEMPLATES, REMOVED_TEMPLATES, PRIMITIVES, HUB_ACCOUNTS, VALID_PRIMITIVES;
|
|
12197
|
+
var __filename, __dirname, packageRoot, TEMPLATES, REMOVED_TEMPLATES, PRIMITIVES, HUB_ACCOUNTS, PLATFORM_MONOREPO_NAME, VALID_PRIMITIVES;
|
|
11964
12198
|
var init_create_app = __esm({
|
|
11965
12199
|
"libs/mesh-cli/src/commands/create-app.ts"() {
|
|
11966
12200
|
"use strict";
|
|
11967
12201
|
init_utils();
|
|
11968
12202
|
init_skills();
|
|
11969
12203
|
init_stack();
|
|
12204
|
+
init_scaffold_versions();
|
|
11970
12205
|
__filename = fileURLToPath2(import.meta.url);
|
|
11971
12206
|
__dirname = path24.dirname(__filename);
|
|
11972
12207
|
packageRoot = findPackageRoot(__dirname);
|
|
@@ -11989,6 +12224,7 @@ var init_create_app = __esm({
|
|
|
11989
12224
|
HUB_ACCOUNTS = {
|
|
11990
12225
|
mesh: "159923586610"
|
|
11991
12226
|
};
|
|
12227
|
+
PLATFORM_MONOREPO_NAME = "mesh-platform";
|
|
11992
12228
|
VALID_PRIMITIVES = Object.keys(PRIMITIVES);
|
|
11993
12229
|
Handlebars.registerHelper("titleCase", (str) => {
|
|
11994
12230
|
return str.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -12600,8 +12836,8 @@ var init_db = __esm({
|
|
|
12600
12836
|
|
|
12601
12837
|
// libs/mesh-cli/src/utils/deploy-preflight.ts
|
|
12602
12838
|
import { existsSync as existsSync20, readFileSync as readFileSync21 } from "node:fs";
|
|
12603
|
-
import { dirname as dirname22, join as join25, relative as
|
|
12604
|
-
import { parse as
|
|
12839
|
+
import { dirname as dirname22, join as join25, relative as relative5 } from "node:path";
|
|
12840
|
+
import { parse as parseYaml3 } from "yaml";
|
|
12605
12841
|
function isGated(name) {
|
|
12606
12842
|
return GATED_PREFIXES.some((p) => name.startsWith(p));
|
|
12607
12843
|
}
|
|
@@ -12659,14 +12895,14 @@ function checkDeployDepsFresh(appRoot) {
|
|
|
12659
12895
|
if (!lockPath) return null;
|
|
12660
12896
|
let lockDoc;
|
|
12661
12897
|
try {
|
|
12662
|
-
lockDoc =
|
|
12898
|
+
lockDoc = parseYaml3(readFileSync21(lockPath, "utf8"));
|
|
12663
12899
|
} catch {
|
|
12664
12900
|
logWarn(
|
|
12665
12901
|
`deploy preflight: could not parse ${lockPath} \u2014 skipping the stale-node_modules check.`
|
|
12666
12902
|
);
|
|
12667
12903
|
return null;
|
|
12668
12904
|
}
|
|
12669
|
-
const importerRel =
|
|
12905
|
+
const importerRel = relative5(dirname22(lockPath), appRoot) || ".";
|
|
12670
12906
|
const expected = extractImporterMeshVersions(lockDoc, importerRel);
|
|
12671
12907
|
const names = Object.keys(expected);
|
|
12672
12908
|
if (names.length === 0) return [];
|
|
@@ -12715,7 +12951,7 @@ var init_deploy_preflight = __esm({
|
|
|
12715
12951
|
});
|
|
12716
12952
|
|
|
12717
12953
|
// libs/mesh-cli/src/commands/deploy.ts
|
|
12718
|
-
import { execFileSync as
|
|
12954
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
12719
12955
|
function buildPulumiArgs(pulumiArgs, stack) {
|
|
12720
12956
|
const base = pulumiArgs.length === 0 || pulumiArgs[0]?.startsWith("-") ? ["up", ...pulumiArgs] : [...pulumiArgs];
|
|
12721
12957
|
const op = base[0];
|
|
@@ -12778,7 +13014,7 @@ function registerDeployCommand(program2) {
|
|
|
12778
13014
|
delete env.AWS_PROFILE;
|
|
12779
13015
|
const finalArgs = buildPulumiArgs(pulumiArgs, stack);
|
|
12780
13016
|
try {
|
|
12781
|
-
|
|
13017
|
+
execFileSync19("pulumi", finalArgs, {
|
|
12782
13018
|
cwd: appRoot,
|
|
12783
13019
|
env,
|
|
12784
13020
|
stdio: "inherit"
|
|
@@ -13071,10 +13307,10 @@ var init_discover = __esm({
|
|
|
13071
13307
|
});
|
|
13072
13308
|
|
|
13073
13309
|
// libs/mesh-cli/src/docs/assemble.ts
|
|
13074
|
-
import { execFileSync as
|
|
13310
|
+
import { execFileSync as execFileSync20 } from "node:child_process";
|
|
13075
13311
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync23, rmSync as rmSync5, writeFileSync as writeFileSync15 } from "node:fs";
|
|
13076
13312
|
import path27 from "node:path";
|
|
13077
|
-
import { parse as
|
|
13313
|
+
import { parse as parseYaml4 } from "yaml";
|
|
13078
13314
|
function splitFrontMatter(markdown) {
|
|
13079
13315
|
const normalized = markdown.replace(/^\uFEFF/, "");
|
|
13080
13316
|
if (!normalized.startsWith("---\n") && !normalized.startsWith("---\r\n")) {
|
|
@@ -13086,7 +13322,7 @@ function splitFrontMatter(markdown) {
|
|
|
13086
13322
|
const bodyStart = normalized.indexOf("\n", end + 1);
|
|
13087
13323
|
const body = (bodyStart === -1 ? "" : normalized.slice(bodyStart + 1)).replace(/^\r?\n/, "");
|
|
13088
13324
|
try {
|
|
13089
|
-
const data =
|
|
13325
|
+
const data = parseYaml4(rawBlock);
|
|
13090
13326
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
13091
13327
|
return {
|
|
13092
13328
|
data,
|
|
@@ -13562,7 +13798,7 @@ function renderVersionJson(args) {
|
|
|
13562
13798
|
}
|
|
13563
13799
|
function currentCommit(repoRoot2) {
|
|
13564
13800
|
try {
|
|
13565
|
-
return
|
|
13801
|
+
return execFileSync20("git", ["rev-parse", "--short", "HEAD"], {
|
|
13566
13802
|
cwd: repoRoot2,
|
|
13567
13803
|
encoding: "utf-8"
|
|
13568
13804
|
}).trim();
|
|
@@ -13581,7 +13817,7 @@ function currentBaseline(repoRoot2) {
|
|
|
13581
13817
|
}
|
|
13582
13818
|
}
|
|
13583
13819
|
function publishSetAtRef(repoRoot2, ref) {
|
|
13584
|
-
const git = (gitArgs) =>
|
|
13820
|
+
const git = (gitArgs) => execFileSync20("git", gitArgs, {
|
|
13585
13821
|
cwd: repoRoot2,
|
|
13586
13822
|
encoding: "utf-8",
|
|
13587
13823
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -14069,7 +14305,7 @@ var init_portal = __esm({
|
|
|
14069
14305
|
});
|
|
14070
14306
|
|
|
14071
14307
|
// libs/mesh-cli/src/utils/build-info.ts
|
|
14072
|
-
import { execFileSync as
|
|
14308
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
14073
14309
|
import * as fs24 from "fs";
|
|
14074
14310
|
import * as path29 from "path";
|
|
14075
14311
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -14127,7 +14363,7 @@ function resolveCliRuntime(opts) {
|
|
|
14127
14363
|
}
|
|
14128
14364
|
if (!vcs) return info;
|
|
14129
14365
|
try {
|
|
14130
|
-
const git = (args) =>
|
|
14366
|
+
const git = (args) => execFileSync21("git", args, {
|
|
14131
14367
|
cwd: root,
|
|
14132
14368
|
encoding: "utf-8",
|
|
14133
14369
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -14147,10 +14383,10 @@ var init_build_info = __esm({
|
|
|
14147
14383
|
// libs/mesh-cli/src/docs/serve.ts
|
|
14148
14384
|
import { createServer as createServer8 } from "node:http";
|
|
14149
14385
|
import { readFile } from "node:fs/promises";
|
|
14150
|
-
import { extname, join as join27, normalize, sep as
|
|
14386
|
+
import { extname, join as join27, normalize, sep as sep4 } from "node:path";
|
|
14151
14387
|
async function serveDocsSite(args) {
|
|
14152
14388
|
const root = normalize(args.root);
|
|
14153
|
-
const rootPrefix = root.endsWith(
|
|
14389
|
+
const rootPrefix = root.endsWith(sep4) ? root : root + sep4;
|
|
14154
14390
|
const server = createServer8((req, res) => {
|
|
14155
14391
|
void (async () => {
|
|
14156
14392
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
@@ -14224,7 +14460,7 @@ var init_serve = __esm({
|
|
|
14224
14460
|
});
|
|
14225
14461
|
|
|
14226
14462
|
// libs/mesh-cli/src/docs/registry-docs.ts
|
|
14227
|
-
import { execFileSync as
|
|
14463
|
+
import { execFileSync as execFileSync22 } from "node:child_process";
|
|
14228
14464
|
import { existsSync as existsSync23, mkdirSync as mkdirSync17, readFileSync as readFileSync26, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync17 } from "node:fs";
|
|
14229
14465
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
14230
14466
|
import path30 from "node:path";
|
|
@@ -14316,7 +14552,7 @@ async function fetchDocsArtifact(auth, version, cacheRoot = docsCacheRoot(), fet
|
|
|
14316
14552
|
rmSync6(staging, { recursive: true, force: true });
|
|
14317
14553
|
mkdirSync17(staging, { recursive: true });
|
|
14318
14554
|
try {
|
|
14319
|
-
|
|
14555
|
+
execFileSync22("tar", ["-xzf", tgzPath, "-C", staging, "--strip-components", "1"], {
|
|
14320
14556
|
stdio: ["pipe", "pipe", "pipe"]
|
|
14321
14557
|
});
|
|
14322
14558
|
} finally {
|
|
@@ -14354,7 +14590,7 @@ __export(start_exports, {
|
|
|
14354
14590
|
tmuxInstallHint: () => tmuxInstallHint,
|
|
14355
14591
|
tmuxServeArgs: () => tmuxServeArgs
|
|
14356
14592
|
});
|
|
14357
|
-
import { execFileSync as
|
|
14593
|
+
import { execFileSync as execFileSync23 } from "node:child_process";
|
|
14358
14594
|
import { appendFileSync as appendFileSync2, existsSync as existsSync24, writeFileSync as writeFileSync18 } from "node:fs";
|
|
14359
14595
|
import path31 from "node:path";
|
|
14360
14596
|
function registryAuthOrThrow() {
|
|
@@ -14387,7 +14623,7 @@ function tmuxInstallHint(platform = process.platform) {
|
|
|
14387
14623
|
}
|
|
14388
14624
|
function tmuxAvailable() {
|
|
14389
14625
|
try {
|
|
14390
|
-
|
|
14626
|
+
execFileSync23("tmux", ["-V"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14391
14627
|
return true;
|
|
14392
14628
|
} catch {
|
|
14393
14629
|
return false;
|
|
@@ -14398,7 +14634,7 @@ function shouldDetach(args) {
|
|
|
14398
14634
|
}
|
|
14399
14635
|
function docsSessionExists() {
|
|
14400
14636
|
try {
|
|
14401
|
-
|
|
14637
|
+
execFileSync23("tmux", ["has-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14402
14638
|
return true;
|
|
14403
14639
|
} catch {
|
|
14404
14640
|
return false;
|
|
@@ -14422,12 +14658,12 @@ Or run in the foreground instead: mesh docs start --foreground`
|
|
|
14422
14658
|
if (docsSessionExists()) {
|
|
14423
14659
|
logInfo(`Replacing the docs server already running in tmux session "${DOCS_TMUX_SESSION}".`);
|
|
14424
14660
|
try {
|
|
14425
|
-
|
|
14661
|
+
execFileSync23("tmux", ["kill-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14426
14662
|
} catch {
|
|
14427
14663
|
}
|
|
14428
14664
|
}
|
|
14429
14665
|
const { command, cwd } = tmuxServeArgs(args);
|
|
14430
|
-
|
|
14666
|
+
execFileSync23(
|
|
14431
14667
|
"tmux",
|
|
14432
14668
|
["new-session", "-d", "-s", DOCS_TMUX_SESSION, "-c", cwd, "--", ...command],
|
|
14433
14669
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -14465,7 +14701,7 @@ function printReady(url, label) {
|
|
|
14465
14701
|
}
|
|
14466
14702
|
function runDocsStop() {
|
|
14467
14703
|
try {
|
|
14468
|
-
|
|
14704
|
+
execFileSync23("tmux", ["kill-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14469
14705
|
logSuccess(`Stopped the docs server (tmux session "${DOCS_TMUX_SESSION}").`);
|
|
14470
14706
|
} catch {
|
|
14471
14707
|
logInfo(`No docs server is running (no tmux session named "${DOCS_TMUX_SESSION}").`);
|
|
@@ -14838,7 +15074,7 @@ var init_docs = __esm({
|
|
|
14838
15074
|
});
|
|
14839
15075
|
|
|
14840
15076
|
// libs/mesh-cli/src/commands/hub/index.ts
|
|
14841
|
-
import { execFileSync as
|
|
15077
|
+
import { execFileSync as execFileSync24 } from "node:child_process";
|
|
14842
15078
|
import * as fs26 from "node:fs";
|
|
14843
15079
|
import * as net12 from "node:net";
|
|
14844
15080
|
import * as os10 from "node:os";
|
|
@@ -14904,7 +15140,7 @@ function parseTmuxEnv(output) {
|
|
|
14904
15140
|
}
|
|
14905
15141
|
function readTmuxSessionEnv(sessionName) {
|
|
14906
15142
|
try {
|
|
14907
|
-
const out =
|
|
15143
|
+
const out = execFileSync24("tmux", ["show-environment", "-t", sessionName], {
|
|
14908
15144
|
encoding: "utf-8",
|
|
14909
15145
|
stdio: ["ignore", "pipe", "ignore"]
|
|
14910
15146
|
});
|
|
@@ -14915,7 +15151,7 @@ function readTmuxSessionEnv(sessionName) {
|
|
|
14915
15151
|
}
|
|
14916
15152
|
function tmuxSessionExists(sessionName) {
|
|
14917
15153
|
try {
|
|
14918
|
-
|
|
15154
|
+
execFileSync24("tmux", ["has-session", "-t", sessionName], { stdio: "ignore" });
|
|
14919
15155
|
return true;
|
|
14920
15156
|
} catch {
|
|
14921
15157
|
return false;
|
|
@@ -15079,7 +15315,7 @@ function redactEnv(env) {
|
|
|
15079
15315
|
async function hubDevAction(opts) {
|
|
15080
15316
|
if (opts.kill) {
|
|
15081
15317
|
if (tmuxSessionExists(HUB_SESSION)) {
|
|
15082
|
-
|
|
15318
|
+
execFileSync24("tmux", ["kill-session", "-t", HUB_SESSION], { stdio: "ignore" });
|
|
15083
15319
|
fs26.rmSync(hubEnvDir(), { recursive: true, force: true });
|
|
15084
15320
|
logSuccess(`Killed Hub session '${HUB_SESSION}'.`);
|
|
15085
15321
|
} else {
|
|
@@ -15133,17 +15369,17 @@ async function hubDevAction(opts) {
|
|
|
15133
15369
|
for (const warning of assembled.warnings) logWarn(warning);
|
|
15134
15370
|
const apiDir = path33.join(platformDir, "apps", "hub", "api");
|
|
15135
15371
|
const uiDir = path33.join(platformDir, "apps", "hub", "ui");
|
|
15136
|
-
|
|
15372
|
+
execFileSync24("tmux", ["new-session", "-d", "-s", HUB_SESSION, "-n", "api", "-c", apiDir]);
|
|
15137
15373
|
if (!assembled.apiEnv.DEV_USER_TOKEN_URL && assembled.apiEnv.DEV_USER_ID_TOKEN) {
|
|
15138
15374
|
const platform = session.state.devOutput.platform;
|
|
15139
15375
|
const credContext = `mesh.${platform.env}`;
|
|
15140
15376
|
const tokenPort = await findFreePort4();
|
|
15141
15377
|
const tokenUrl = `http://127.0.0.1:${tokenPort}`;
|
|
15142
|
-
|
|
15143
|
-
|
|
15378
|
+
execFileSync24("tmux", ["new-window", "-t", HUB_SESSION, "-n", "token-server", "-c", platformDir]);
|
|
15379
|
+
execFileSync24("tmux", ["set-option", "-t", `${HUB_SESSION}:token-server`, "remain-on-exit", "on"], {
|
|
15144
15380
|
stdio: "ignore"
|
|
15145
15381
|
});
|
|
15146
|
-
|
|
15382
|
+
execFileSync24("tmux", [
|
|
15147
15383
|
"send-keys",
|
|
15148
15384
|
"-t",
|
|
15149
15385
|
`${HUB_SESSION}:token-server`,
|
|
@@ -15161,12 +15397,12 @@ async function hubDevAction(opts) {
|
|
|
15161
15397
|
const envFile = path33.join(hubEnvDir(), `${window}.env.sh`);
|
|
15162
15398
|
writeEnvFile(envFile, env);
|
|
15163
15399
|
if (createWindow) {
|
|
15164
|
-
|
|
15400
|
+
execFileSync24("tmux", ["new-window", "-t", HUB_SESSION, "-n", window, "-c", dir]);
|
|
15165
15401
|
}
|
|
15166
|
-
|
|
15402
|
+
execFileSync24("tmux", ["set-option", "-t", `${HUB_SESSION}:${window}`, "remain-on-exit", "on"], {
|
|
15167
15403
|
stdio: "ignore"
|
|
15168
15404
|
});
|
|
15169
|
-
|
|
15405
|
+
execFileSync24("tmux", ["send-keys", "-t", `${HUB_SESSION}:${window}`, buildLaunchCommand(envFile, dir, cmd), "Enter"]);
|
|
15170
15406
|
};
|
|
15171
15407
|
launch("api", apiDir, assembled.apiEnv, "pnpm dev", false);
|
|
15172
15408
|
launch("ui", uiDir, assembled.uiEnv, `pnpm dev -- --port ${uiPort} --strictPort`, true);
|
|
@@ -15492,7 +15728,7 @@ var init_init = __esm({
|
|
|
15492
15728
|
});
|
|
15493
15729
|
|
|
15494
15730
|
// libs/mesh-cli/src/commands/install-shim.ts
|
|
15495
|
-
import { execFileSync as
|
|
15731
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
15496
15732
|
import * as fs28 from "fs";
|
|
15497
15733
|
import * as os11 from "os";
|
|
15498
15734
|
import * as path35 from "path";
|
|
@@ -15605,7 +15841,7 @@ function registerInstallShimCommand(program2) {
|
|
|
15605
15841
|
let status = 0;
|
|
15606
15842
|
let ok = true;
|
|
15607
15843
|
try {
|
|
15608
|
-
stdout =
|
|
15844
|
+
stdout = execFileSync25(target, ["--help"], {
|
|
15609
15845
|
cwd: process.cwd(),
|
|
15610
15846
|
encoding: "utf8",
|
|
15611
15847
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -15652,7 +15888,7 @@ var init_install_shim = __esm({
|
|
|
15652
15888
|
});
|
|
15653
15889
|
|
|
15654
15890
|
// libs/mesh-cli/src/commands/local/hub-local.ts
|
|
15655
|
-
import { execFile as execFile3, execFileSync as
|
|
15891
|
+
import { execFile as execFile3, execFileSync as execFileSync26 } from "child_process";
|
|
15656
15892
|
import * as fs29 from "fs";
|
|
15657
15893
|
import * as os12 from "os";
|
|
15658
15894
|
import * as path36 from "path";
|
|
@@ -15674,7 +15910,7 @@ function npmrcPath() {
|
|
|
15674
15910
|
}
|
|
15675
15911
|
function imageExists(tag) {
|
|
15676
15912
|
try {
|
|
15677
|
-
|
|
15913
|
+
execFileSync26("docker", ["image", "inspect", tag], { stdio: ["ignore", "pipe", "pipe"] });
|
|
15678
15914
|
return true;
|
|
15679
15915
|
} catch {
|
|
15680
15916
|
return false;
|
|
@@ -15684,7 +15920,7 @@ function ensureHubAuthImage() {
|
|
|
15684
15920
|
if (imageExists(HUB_AUTH_IMAGE)) return;
|
|
15685
15921
|
logInfo(`Building ${HUB_AUTH_IMAGE} (Hub auth proxy)\u2026`);
|
|
15686
15922
|
const hubStackDir = path36.join(findPackageRoot(), "stack", "hub");
|
|
15687
|
-
|
|
15923
|
+
execFileSync26(
|
|
15688
15924
|
"docker",
|
|
15689
15925
|
["build", "-f", path36.join(hubStackDir, "Dockerfile.auth"), "-t", HUB_AUTH_IMAGE, hubStackDir],
|
|
15690
15926
|
{ stdio: ["ignore", "inherit", "inherit"], env: { ...process.env, DOCKER_BUILDKIT: "1" } }
|
|
@@ -15698,7 +15934,7 @@ function hasRegistryAuth() {
|
|
|
15698
15934
|
function localHubVersion() {
|
|
15699
15935
|
const versions = HUB_IMAGES.map((name) => {
|
|
15700
15936
|
try {
|
|
15701
|
-
const out =
|
|
15937
|
+
const out = execFileSync26("docker", ["images", name, "--format", "{{.Tag}}"], {
|
|
15702
15938
|
encoding: "utf-8",
|
|
15703
15939
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15704
15940
|
});
|
|
@@ -15777,7 +16013,7 @@ async function ensureHubImages() {
|
|
|
15777
16013
|
const context = path36.join(cacheDir(), `context-${version}`);
|
|
15778
16014
|
fs29.rmSync(context, { recursive: true, force: true });
|
|
15779
16015
|
fs29.mkdirSync(context, { recursive: true });
|
|
15780
|
-
|
|
16016
|
+
execFileSync26("tar", ["-xzf", tarball, "-C", context, "--strip-components", "1"], {
|
|
15781
16017
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15782
16018
|
});
|
|
15783
16019
|
const hubStackDir = path36.join(findPackageRoot(), "stack", "hub");
|
|
@@ -15788,7 +16024,7 @@ async function ensureHubImages() {
|
|
|
15788
16024
|
const tag = `${name}:${version}`;
|
|
15789
16025
|
if (imageExists(tag)) continue;
|
|
15790
16026
|
logInfo(`Building ${tag} from the published tarball\u2026`);
|
|
15791
|
-
|
|
16027
|
+
execFileSync26(
|
|
15792
16028
|
"docker",
|
|
15793
16029
|
[
|
|
15794
16030
|
"build",
|
|
@@ -16883,10 +17119,10 @@ var init_secrets = __esm({
|
|
|
16883
17119
|
});
|
|
16884
17120
|
|
|
16885
17121
|
// libs/mesh-cli/src/commands/stack.ts
|
|
16886
|
-
import { execFileSync as
|
|
17122
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
16887
17123
|
import * as path37 from "path";
|
|
16888
17124
|
import * as fs30 from "fs";
|
|
16889
|
-
import { parse as
|
|
17125
|
+
import { parse as parseYaml5 } from "yaml";
|
|
16890
17126
|
function readTopLevelYamlKey(appRoot, stack, key) {
|
|
16891
17127
|
const configFile = path37.join(appRoot, `Pulumi.${stack}.yaml`);
|
|
16892
17128
|
if (!fs30.existsSync(configFile)) return null;
|
|
@@ -16963,7 +17199,7 @@ function readBaseConfigFromYaml(appRoot, stack) {
|
|
|
16963
17199
|
if (!fs30.existsSync(file)) return {};
|
|
16964
17200
|
let doc;
|
|
16965
17201
|
try {
|
|
16966
|
-
doc =
|
|
17202
|
+
doc = parseYaml5(fs30.readFileSync(file, "utf-8"));
|
|
16967
17203
|
} catch {
|
|
16968
17204
|
return {};
|
|
16969
17205
|
}
|
|
@@ -16976,7 +17212,7 @@ function readBaseConfigFromYaml(appRoot, stack) {
|
|
|
16976
17212
|
}
|
|
16977
17213
|
function getGitHubUsername() {
|
|
16978
17214
|
try {
|
|
16979
|
-
const result =
|
|
17215
|
+
const result = execFileSync27("gh", ["api", "user", "--jq", ".login"], {
|
|
16980
17216
|
encoding: "utf-8",
|
|
16981
17217
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16982
17218
|
});
|
|
@@ -16985,7 +17221,7 @@ function getGitHubUsername() {
|
|
|
16985
17221
|
} catch {
|
|
16986
17222
|
}
|
|
16987
17223
|
try {
|
|
16988
|
-
const result =
|
|
17224
|
+
const result = execFileSync27("git", ["config", "user.email"], {
|
|
16989
17225
|
encoding: "utf-8",
|
|
16990
17226
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16991
17227
|
});
|
|
@@ -17071,7 +17307,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17071
17307
|
if (!opts.adopt) {
|
|
17072
17308
|
let existing = [];
|
|
17073
17309
|
try {
|
|
17074
|
-
const raw =
|
|
17310
|
+
const raw = execFileSync27("pulumi", ["stack", "ls", "--json"], {
|
|
17075
17311
|
cwd: appRoot,
|
|
17076
17312
|
encoding: "utf-8",
|
|
17077
17313
|
env: pulumiEnv,
|
|
@@ -17095,7 +17331,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17095
17331
|
logInfo(`Using KMS secrets provider: ${secretsProvider}`);
|
|
17096
17332
|
}
|
|
17097
17333
|
try {
|
|
17098
|
-
|
|
17334
|
+
execFileSync27("pulumi", initArgs, {
|
|
17099
17335
|
cwd: appRoot,
|
|
17100
17336
|
env: pulumiEnv,
|
|
17101
17337
|
stdio: "inherit"
|
|
@@ -17112,7 +17348,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17112
17348
|
}
|
|
17113
17349
|
}
|
|
17114
17350
|
try {
|
|
17115
|
-
|
|
17351
|
+
execFileSync27("pulumi", ["stack", "select", newStack], {
|
|
17116
17352
|
cwd: appRoot,
|
|
17117
17353
|
env: pulumiEnv,
|
|
17118
17354
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17122,7 +17358,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17122
17358
|
if (!configExists) {
|
|
17123
17359
|
let baseConfig = {};
|
|
17124
17360
|
try {
|
|
17125
|
-
const raw =
|
|
17361
|
+
const raw = execFileSync27(
|
|
17126
17362
|
"pulumi",
|
|
17127
17363
|
["config", "--json", "--stack", baseStack],
|
|
17128
17364
|
{ cwd: appRoot, env: pulumiEnv, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -17140,19 +17376,19 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17140
17376
|
if (key === "mesh:deploy") continue;
|
|
17141
17377
|
try {
|
|
17142
17378
|
if (entry.objectValue !== void 0) {
|
|
17143
|
-
|
|
17379
|
+
execFileSync27(
|
|
17144
17380
|
"pulumi",
|
|
17145
17381
|
["config", "set", key, JSON.stringify(entry.objectValue)],
|
|
17146
17382
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
17147
17383
|
);
|
|
17148
17384
|
} else if (entry.value === "true" || entry.value === "false") {
|
|
17149
|
-
|
|
17385
|
+
execFileSync27(
|
|
17150
17386
|
"pulumi",
|
|
17151
17387
|
["config", "set", "--type", "bool", key, entry.value],
|
|
17152
17388
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
17153
17389
|
);
|
|
17154
17390
|
} else {
|
|
17155
|
-
|
|
17391
|
+
execFileSync27(
|
|
17156
17392
|
"pulumi",
|
|
17157
17393
|
["config", "set", key, entry.value],
|
|
17158
17394
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -17165,7 +17401,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17165
17401
|
const baseEnv = readConfigBlockKey(appRoot, baseStack, "mesh:coreEnv") ?? (baseTenant && baseStack.startsWith(`${baseTenant}-`) ? baseStack.slice(baseTenant.length + 1) : baseStack);
|
|
17166
17402
|
const setCfg = (args) => {
|
|
17167
17403
|
try {
|
|
17168
|
-
|
|
17404
|
+
execFileSync27("pulumi", ["config", "set", ...args], {
|
|
17169
17405
|
cwd: appRoot,
|
|
17170
17406
|
env: pulumiEnv,
|
|
17171
17407
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17214,7 +17450,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17214
17450
|
`Configured Pulumi.${newStack}.yaml (personal platform env on core '${baseEnv}'${opts.parentZone ? `, DNS zone ${newStack.startsWith(`${baseTenant}-`) ? newStack.slice(baseTenant.length + 1) : newStack}.${opts.parentZone}` : ""})`
|
|
17215
17451
|
);
|
|
17216
17452
|
} else {
|
|
17217
|
-
|
|
17453
|
+
execFileSync27("pulumi", ["config", "set", "--type", "bool", "mesh:deploy", "false"], {
|
|
17218
17454
|
cwd: appRoot,
|
|
17219
17455
|
env: pulumiEnv,
|
|
17220
17456
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17244,7 +17480,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17244
17480
|
const args = ["stack", "rm", name];
|
|
17245
17481
|
if (opts.yes) args.push("--yes");
|
|
17246
17482
|
try {
|
|
17247
|
-
|
|
17483
|
+
execFileSync27("pulumi", args, { cwd: appRoot, env: pulumiEnv, stdio: "inherit" });
|
|
17248
17484
|
logSuccess(`Removed stack ${name}`);
|
|
17249
17485
|
} catch (err) {
|
|
17250
17486
|
process.exit(err.status ?? 1);
|
|
@@ -17456,12 +17692,12 @@ var init_recover_conversation = __esm({
|
|
|
17456
17692
|
});
|
|
17457
17693
|
|
|
17458
17694
|
// libs/mesh-cli/src/utils/temporal-codec.ts
|
|
17459
|
-
import { execFileSync as
|
|
17695
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
17460
17696
|
import { webcrypto as crypto4 } from "node:crypto";
|
|
17461
17697
|
function resolveTemporalEncodingKeyFromK8s(namespace) {
|
|
17462
17698
|
const secretName = `${namespace}-temporal-encoding-key`;
|
|
17463
17699
|
try {
|
|
17464
|
-
const b64 =
|
|
17700
|
+
const b64 = execFileSync28(
|
|
17465
17701
|
"kubectl",
|
|
17466
17702
|
[
|
|
17467
17703
|
"get",
|
|
@@ -20339,7 +20575,7 @@ var init_src3 = __esm({
|
|
|
20339
20575
|
import * as fs33 from "fs";
|
|
20340
20576
|
import * as path40 from "path";
|
|
20341
20577
|
import { createRequire as createRequire2 } from "module";
|
|
20342
|
-
import { execFileSync as
|
|
20578
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
20343
20579
|
function resolveExtractorPath() {
|
|
20344
20580
|
try {
|
|
20345
20581
|
const require2 = createRequire2(import.meta.url);
|
|
@@ -20394,7 +20630,7 @@ for (const file of files) {
|
|
|
20394
20630
|
process.stdout.write(JSON.stringify(results));
|
|
20395
20631
|
`;
|
|
20396
20632
|
try {
|
|
20397
|
-
const result =
|
|
20633
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20398
20634
|
encoding: "utf-8",
|
|
20399
20635
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20400
20636
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -20436,7 +20672,7 @@ for (const file of files) {
|
|
|
20436
20672
|
process.stdout.write(JSON.stringify(results));
|
|
20437
20673
|
`;
|
|
20438
20674
|
try {
|
|
20439
|
-
const result =
|
|
20675
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20440
20676
|
encoding: "utf-8",
|
|
20441
20677
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20442
20678
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -20491,7 +20727,7 @@ for (const file of files) {
|
|
|
20491
20727
|
process.stdout.write(JSON.stringify(results));
|
|
20492
20728
|
`;
|
|
20493
20729
|
try {
|
|
20494
|
-
const result =
|
|
20730
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20495
20731
|
encoding: "utf-8",
|
|
20496
20732
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20497
20733
|
maxBuffer: 10 * 1024 * 1024
|