@mesh-tech/mesh-cli 0.12.6 → 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 +332 -90
- 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 });
|
|
@@ -3398,7 +3398,7 @@ var init_hub_roles = __esm({
|
|
|
3398
3398
|
|
|
3399
3399
|
// libs/api-registry/src/index.ts
|
|
3400
3400
|
import { z as z2 } from "zod";
|
|
3401
|
-
var rateLimitSpecSchema, rateLimitDefaultsSchema, apiSurfaceSchema, apiRegistryEntrySchema, integrationStatusSchema;
|
|
3401
|
+
var rateLimitSpecSchema, rateLimitDefaultsSchema, integrationHealthSchema, apiSurfaceSchema, apiRegistryEntrySchema, integrationStatusSchema;
|
|
3402
3402
|
var init_src2 = __esm({
|
|
3403
3403
|
"libs/api-registry/src/index.ts"() {
|
|
3404
3404
|
"use strict";
|
|
@@ -3408,6 +3408,10 @@ var init_src2 = __esm({
|
|
|
3408
3408
|
burst: z2.number().int().min(1)
|
|
3409
3409
|
});
|
|
3410
3410
|
rateLimitDefaultsSchema = z2.record(z2.string().min(1), rateLimitSpecSchema);
|
|
3411
|
+
integrationHealthSchema = z2.union([
|
|
3412
|
+
z2.object({ op: z2.string().trim().min(1) }),
|
|
3413
|
+
z2.object({ unavailable: z2.string().trim().min(1) })
|
|
3414
|
+
]);
|
|
3411
3415
|
apiSurfaceSchema = z2.object({
|
|
3412
3416
|
http: z2.object({ url: z2.string().min(1) }).optional(),
|
|
3413
3417
|
nexus: z2.object({ endpoint: z2.string().min(1), taskQueue: z2.string().min(1) }).optional()
|
|
@@ -3428,6 +3432,7 @@ var init_src2 = __esm({
|
|
|
3428
3432
|
status: z2.object({ url: z2.string().min(1) }).optional(),
|
|
3429
3433
|
appVersion: z2.string().min(1).optional(),
|
|
3430
3434
|
rateLimits: rateLimitDefaultsSchema.optional(),
|
|
3435
|
+
health: integrationHealthSchema.optional(),
|
|
3431
3436
|
producedRateClasses: z2.array(z2.string().min(1)).optional()
|
|
3432
3437
|
});
|
|
3433
3438
|
integrationStatusSchema = z2.object({
|
|
@@ -3446,6 +3451,7 @@ var init_src2 = __esm({
|
|
|
3446
3451
|
enabledOps: z2.array(z2.string()),
|
|
3447
3452
|
credentialsWired: z2.boolean(),
|
|
3448
3453
|
rateLimits: rateLimitDefaultsSchema.optional(),
|
|
3454
|
+
health: integrationHealthSchema.optional(),
|
|
3449
3455
|
startedAt: z2.string().min(1)
|
|
3450
3456
|
});
|
|
3451
3457
|
}
|
|
@@ -11409,6 +11415,63 @@ ${raw}`;
|
|
|
11409
11415
|
${MANAGED_MARKER}
|
|
11410
11416
|
${raw.slice(frontmatter.length)}`;
|
|
11411
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
|
+
}
|
|
11412
11475
|
function planSync(root) {
|
|
11413
11476
|
const items = [];
|
|
11414
11477
|
for (const skill of listBaseSkills()) {
|
|
@@ -11435,6 +11498,43 @@ function planSync(root) {
|
|
|
11435
11498
|
}
|
|
11436
11499
|
}
|
|
11437
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
|
+
}
|
|
11438
11538
|
const hookSource = cliAsset("assets", "intent", "intent-claude-gate.mjs");
|
|
11439
11539
|
const hookTarget = path23.join(root, HOOK_RELATIVE);
|
|
11440
11540
|
const hookDesired = fs21.readFileSync(hookSource, "utf-8");
|
|
@@ -11449,6 +11549,38 @@ function planSync(root) {
|
|
|
11449
11549
|
}
|
|
11450
11550
|
}
|
|
11451
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
|
+
}
|
|
11452
11584
|
const settingsPath = path23.join(root, ".claude", "settings.json");
|
|
11453
11585
|
let settings = {};
|
|
11454
11586
|
try {
|
|
@@ -11517,6 +11649,7 @@ function syncSkills(root, opts = {}) {
|
|
|
11517
11649
|
} else {
|
|
11518
11650
|
item.apply?.();
|
|
11519
11651
|
logSuccess(`synced: ${item.label}`);
|
|
11652
|
+
if (item.remediation) logInfo(item.remediation);
|
|
11520
11653
|
}
|
|
11521
11654
|
}
|
|
11522
11655
|
if (!dirty) {
|
|
@@ -11527,7 +11660,7 @@ function syncSkills(root, opts = {}) {
|
|
|
11527
11660
|
function registerSkillsCommands(program2) {
|
|
11528
11661
|
const skills = program2.command("skills").description("Agent-skill distribution (base skills + Intent discovery)");
|
|
11529
11662
|
skills.command("sync").description(
|
|
11530
|
-
"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)"
|
|
11531
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) => {
|
|
11532
11665
|
const root = path23.resolve(opts.root ?? resolveTargetRoot());
|
|
11533
11666
|
const ok = syncSkills(root, { check: opts.check });
|
|
@@ -11538,7 +11671,7 @@ function registerSkillsCommands(program2) {
|
|
|
11538
11671
|
}
|
|
11539
11672
|
});
|
|
11540
11673
|
}
|
|
11541
|
-
var MANAGED_MARKER, FENCE_START, HOOK_RELATIVE;
|
|
11674
|
+
var MANAGED_MARKER, FENCE_START, HOOK_RELATIVE, INTENT_RANGE, BASE_SKILL_PACKAGE;
|
|
11542
11675
|
var init_skills = __esm({
|
|
11543
11676
|
"libs/mesh-cli/src/commands/skills.ts"() {
|
|
11544
11677
|
"use strict";
|
|
@@ -11548,26 +11681,78 @@ var init_skills = __esm({
|
|
|
11548
11681
|
MANAGED_MARKER = "<!-- managed-by: mesh skills sync \u2014 edits are overwritten; copy content elsewhere to customize -->";
|
|
11549
11682
|
FENCE_START = "<!-- intent-skills:start -->";
|
|
11550
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
|
+
};
|
|
11551
11725
|
}
|
|
11552
11726
|
});
|
|
11553
11727
|
|
|
11554
11728
|
// libs/mesh-cli/src/commands/create-app.ts
|
|
11555
11729
|
var create_app_exports = {};
|
|
11556
11730
|
__export(create_app_exports, {
|
|
11731
|
+
PLATFORM_MONOREPO_NAME: () => PLATFORM_MONOREPO_NAME,
|
|
11557
11732
|
bootstrapAppsRepo: () => bootstrapAppsRepo,
|
|
11558
11733
|
copyTemplate: () => copyTemplate,
|
|
11734
|
+
ensureWorkspaceGlobs: () => ensureWorkspaceGlobs,
|
|
11735
|
+
isInsidePlatformMonorepo: () => isInsidePlatformMonorepo,
|
|
11559
11736
|
registerCreateAppCommand: () => registerCreateAppCommand,
|
|
11560
|
-
shouldBootstrapAppsRepo: () => shouldBootstrapAppsRepo
|
|
11737
|
+
shouldBootstrapAppsRepo: () => shouldBootstrapAppsRepo,
|
|
11738
|
+
workspaceGlobForApp: () => workspaceGlobForApp
|
|
11561
11739
|
});
|
|
11562
11740
|
import * as fs22 from "fs";
|
|
11563
11741
|
import * as os8 from "os";
|
|
11564
11742
|
import * as path24 from "path";
|
|
11565
11743
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11566
11744
|
import Handlebars from "handlebars";
|
|
11567
|
-
|
|
11745
|
+
import { parse as parseYaml2 } from "yaml";
|
|
11746
|
+
function isInsidePlatformMonorepo(dir) {
|
|
11568
11747
|
let cur = path24.resolve(dir);
|
|
11569
11748
|
while (cur !== path24.dirname(cur)) {
|
|
11570
|
-
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
|
+
}
|
|
11571
11756
|
cur = path24.dirname(cur);
|
|
11572
11757
|
}
|
|
11573
11758
|
return false;
|
|
@@ -11577,7 +11762,7 @@ function resolveDeployerRoleArn(tenant, platformName, env) {
|
|
|
11577
11762
|
return `arn:aws:iam::${account}:role/${tenant}-${env}-apps-deployer`;
|
|
11578
11763
|
}
|
|
11579
11764
|
function shouldBootstrapAppsRepo(cwd) {
|
|
11580
|
-
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"));
|
|
11581
11766
|
}
|
|
11582
11767
|
function bootstrapAppsRepo(cwd, tenant) {
|
|
11583
11768
|
const templateDir = path24.join(packageRoot, "templates", "apps-repo");
|
|
@@ -11586,7 +11771,8 @@ function bootstrapAppsRepo(cwd, tenant) {
|
|
|
11586
11771
|
repoName: path24.basename(cwd),
|
|
11587
11772
|
tenant,
|
|
11588
11773
|
tenantTitle: tenant.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" "),
|
|
11589
|
-
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
|
|
11590
11776
|
};
|
|
11591
11777
|
const staging = fs22.mkdtempSync(path24.join(os8.tmpdir(), "mesh-apps-repo-"));
|
|
11592
11778
|
try {
|
|
@@ -11612,6 +11798,41 @@ function bootstrapAppsRepo(cwd, tenant) {
|
|
|
11612
11798
|
fs22.rmSync(staging, { recursive: true, force: true });
|
|
11613
11799
|
}
|
|
11614
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
|
+
}
|
|
11615
11836
|
function maybeBootstrapAppsRepo(cwd, tenant, test) {
|
|
11616
11837
|
if (test || !shouldBootstrapAppsRepo(cwd)) return;
|
|
11617
11838
|
const created = bootstrapAppsRepo(cwd, tenant);
|
|
@@ -11852,15 +12073,22 @@ async function runLegacyTemplate(tenant, name, template, test) {
|
|
|
11852
12073
|
fs22.rmSync(appDir, { recursive: true, force: true });
|
|
11853
12074
|
process.exit(1);
|
|
11854
12075
|
}
|
|
11855
|
-
autoSyncSkills(appDir);
|
|
12076
|
+
autoSyncSkills(appDir, name);
|
|
11856
12077
|
printLegacyNextSteps(appDir, template);
|
|
11857
12078
|
}
|
|
11858
|
-
function autoSyncSkills(appDir) {
|
|
12079
|
+
function autoSyncSkills(appDir, appName) {
|
|
12080
|
+
const root = resolveTargetRoot(appDir);
|
|
11859
12081
|
try {
|
|
11860
|
-
syncSkills(
|
|
12082
|
+
syncSkills(root);
|
|
11861
12083
|
} catch (err) {
|
|
11862
12084
|
logWarn(`Agent-skill sync skipped: ${err instanceof Error ? err.message : err} \u2014 run: mesh skills sync`);
|
|
11863
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
|
+
}
|
|
11864
12092
|
}
|
|
11865
12093
|
async function runComposable(tenant, name, primitives, test) {
|
|
11866
12094
|
logInfo(`Creating app '${name}' for tenant '${tenant}'...`);
|
|
@@ -11877,6 +12105,15 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11877
12105
|
const region = "us-east-2";
|
|
11878
12106
|
const platformName = "mesh";
|
|
11879
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
|
+
}
|
|
11880
12117
|
const context = {
|
|
11881
12118
|
name,
|
|
11882
12119
|
tenant,
|
|
@@ -11885,9 +12122,12 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11885
12122
|
temporal: primitives.includes("temporal"),
|
|
11886
12123
|
bucket: primitives.includes("bucket"),
|
|
11887
12124
|
region,
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
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,
|
|
11891
12131
|
deployerRoleArn: resolveDeployerRoleArn(tenant, platformName, platformEnv)
|
|
11892
12132
|
};
|
|
11893
12133
|
fs22.mkdirSync(appDir, { recursive: true });
|
|
@@ -11899,20 +12139,18 @@ async function runComposable(tenant, name, primitives, test) {
|
|
|
11899
12139
|
fs22.rmSync(appDir, { recursive: true, force: true });
|
|
11900
12140
|
process.exit(1);
|
|
11901
12141
|
}
|
|
11902
|
-
const
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
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
|
+
}
|
|
11906
12149
|
}
|
|
11907
|
-
autoSyncSkills(appDir);
|
|
12150
|
+
autoSyncSkills(appDir, name);
|
|
11908
12151
|
printComposableNextSteps(appDir, context);
|
|
11909
12152
|
}
|
|
11910
12153
|
function printLegacyNextSteps(appDir, _template) {
|
|
11911
|
-
const configPath = path24.join(path24.dirname(appDir), "config.ts");
|
|
11912
|
-
if (!fs22.existsSync(configPath)) {
|
|
11913
|
-
logWarn(`No config.ts found at ${configPath}`);
|
|
11914
|
-
logInfo("You may need to create a shared config.ts for tenant apps.");
|
|
11915
|
-
}
|
|
11916
12154
|
console.log("");
|
|
11917
12155
|
logSuccess("App created successfully!");
|
|
11918
12156
|
console.log("");
|
|
@@ -11949,18 +12187,21 @@ function printComposableNextSteps(appDir, context) {
|
|
|
11949
12187
|
console.log("Next steps:");
|
|
11950
12188
|
console.log(` cd ${appDir}`);
|
|
11951
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");
|
|
11952
12192
|
console.log(" mesh stack init # personal dev stack (deploy: false)");
|
|
11953
12193
|
console.log(" mesh deploy up --yes # deploy via the stack's deployer role");
|
|
11954
12194
|
console.log(" mesh dev # run locally");
|
|
11955
12195
|
console.log("");
|
|
11956
12196
|
}
|
|
11957
|
-
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;
|
|
11958
12198
|
var init_create_app = __esm({
|
|
11959
12199
|
"libs/mesh-cli/src/commands/create-app.ts"() {
|
|
11960
12200
|
"use strict";
|
|
11961
12201
|
init_utils();
|
|
11962
12202
|
init_skills();
|
|
11963
12203
|
init_stack();
|
|
12204
|
+
init_scaffold_versions();
|
|
11964
12205
|
__filename = fileURLToPath2(import.meta.url);
|
|
11965
12206
|
__dirname = path24.dirname(__filename);
|
|
11966
12207
|
packageRoot = findPackageRoot(__dirname);
|
|
@@ -11983,6 +12224,7 @@ var init_create_app = __esm({
|
|
|
11983
12224
|
HUB_ACCOUNTS = {
|
|
11984
12225
|
mesh: "159923586610"
|
|
11985
12226
|
};
|
|
12227
|
+
PLATFORM_MONOREPO_NAME = "mesh-platform";
|
|
11986
12228
|
VALID_PRIMITIVES = Object.keys(PRIMITIVES);
|
|
11987
12229
|
Handlebars.registerHelper("titleCase", (str) => {
|
|
11988
12230
|
return str.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -12594,8 +12836,8 @@ var init_db = __esm({
|
|
|
12594
12836
|
|
|
12595
12837
|
// libs/mesh-cli/src/utils/deploy-preflight.ts
|
|
12596
12838
|
import { existsSync as existsSync20, readFileSync as readFileSync21 } from "node:fs";
|
|
12597
|
-
import { dirname as dirname22, join as join25, relative as
|
|
12598
|
-
import { parse as
|
|
12839
|
+
import { dirname as dirname22, join as join25, relative as relative5 } from "node:path";
|
|
12840
|
+
import { parse as parseYaml3 } from "yaml";
|
|
12599
12841
|
function isGated(name) {
|
|
12600
12842
|
return GATED_PREFIXES.some((p) => name.startsWith(p));
|
|
12601
12843
|
}
|
|
@@ -12653,14 +12895,14 @@ function checkDeployDepsFresh(appRoot) {
|
|
|
12653
12895
|
if (!lockPath) return null;
|
|
12654
12896
|
let lockDoc;
|
|
12655
12897
|
try {
|
|
12656
|
-
lockDoc =
|
|
12898
|
+
lockDoc = parseYaml3(readFileSync21(lockPath, "utf8"));
|
|
12657
12899
|
} catch {
|
|
12658
12900
|
logWarn(
|
|
12659
12901
|
`deploy preflight: could not parse ${lockPath} \u2014 skipping the stale-node_modules check.`
|
|
12660
12902
|
);
|
|
12661
12903
|
return null;
|
|
12662
12904
|
}
|
|
12663
|
-
const importerRel =
|
|
12905
|
+
const importerRel = relative5(dirname22(lockPath), appRoot) || ".";
|
|
12664
12906
|
const expected = extractImporterMeshVersions(lockDoc, importerRel);
|
|
12665
12907
|
const names = Object.keys(expected);
|
|
12666
12908
|
if (names.length === 0) return [];
|
|
@@ -12709,7 +12951,7 @@ var init_deploy_preflight = __esm({
|
|
|
12709
12951
|
});
|
|
12710
12952
|
|
|
12711
12953
|
// libs/mesh-cli/src/commands/deploy.ts
|
|
12712
|
-
import { execFileSync as
|
|
12954
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
12713
12955
|
function buildPulumiArgs(pulumiArgs, stack) {
|
|
12714
12956
|
const base = pulumiArgs.length === 0 || pulumiArgs[0]?.startsWith("-") ? ["up", ...pulumiArgs] : [...pulumiArgs];
|
|
12715
12957
|
const op = base[0];
|
|
@@ -12772,7 +13014,7 @@ function registerDeployCommand(program2) {
|
|
|
12772
13014
|
delete env.AWS_PROFILE;
|
|
12773
13015
|
const finalArgs = buildPulumiArgs(pulumiArgs, stack);
|
|
12774
13016
|
try {
|
|
12775
|
-
|
|
13017
|
+
execFileSync19("pulumi", finalArgs, {
|
|
12776
13018
|
cwd: appRoot,
|
|
12777
13019
|
env,
|
|
12778
13020
|
stdio: "inherit"
|
|
@@ -13065,10 +13307,10 @@ var init_discover = __esm({
|
|
|
13065
13307
|
});
|
|
13066
13308
|
|
|
13067
13309
|
// libs/mesh-cli/src/docs/assemble.ts
|
|
13068
|
-
import { execFileSync as
|
|
13310
|
+
import { execFileSync as execFileSync20 } from "node:child_process";
|
|
13069
13311
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync23, rmSync as rmSync5, writeFileSync as writeFileSync15 } from "node:fs";
|
|
13070
13312
|
import path27 from "node:path";
|
|
13071
|
-
import { parse as
|
|
13313
|
+
import { parse as parseYaml4 } from "yaml";
|
|
13072
13314
|
function splitFrontMatter(markdown) {
|
|
13073
13315
|
const normalized = markdown.replace(/^\uFEFF/, "");
|
|
13074
13316
|
if (!normalized.startsWith("---\n") && !normalized.startsWith("---\r\n")) {
|
|
@@ -13080,7 +13322,7 @@ function splitFrontMatter(markdown) {
|
|
|
13080
13322
|
const bodyStart = normalized.indexOf("\n", end + 1);
|
|
13081
13323
|
const body = (bodyStart === -1 ? "" : normalized.slice(bodyStart + 1)).replace(/^\r?\n/, "");
|
|
13082
13324
|
try {
|
|
13083
|
-
const data =
|
|
13325
|
+
const data = parseYaml4(rawBlock);
|
|
13084
13326
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
13085
13327
|
return {
|
|
13086
13328
|
data,
|
|
@@ -13556,7 +13798,7 @@ function renderVersionJson(args) {
|
|
|
13556
13798
|
}
|
|
13557
13799
|
function currentCommit(repoRoot2) {
|
|
13558
13800
|
try {
|
|
13559
|
-
return
|
|
13801
|
+
return execFileSync20("git", ["rev-parse", "--short", "HEAD"], {
|
|
13560
13802
|
cwd: repoRoot2,
|
|
13561
13803
|
encoding: "utf-8"
|
|
13562
13804
|
}).trim();
|
|
@@ -13575,7 +13817,7 @@ function currentBaseline(repoRoot2) {
|
|
|
13575
13817
|
}
|
|
13576
13818
|
}
|
|
13577
13819
|
function publishSetAtRef(repoRoot2, ref) {
|
|
13578
|
-
const git = (gitArgs) =>
|
|
13820
|
+
const git = (gitArgs) => execFileSync20("git", gitArgs, {
|
|
13579
13821
|
cwd: repoRoot2,
|
|
13580
13822
|
encoding: "utf-8",
|
|
13581
13823
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -14063,7 +14305,7 @@ var init_portal = __esm({
|
|
|
14063
14305
|
});
|
|
14064
14306
|
|
|
14065
14307
|
// libs/mesh-cli/src/utils/build-info.ts
|
|
14066
|
-
import { execFileSync as
|
|
14308
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
14067
14309
|
import * as fs24 from "fs";
|
|
14068
14310
|
import * as path29 from "path";
|
|
14069
14311
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -14121,7 +14363,7 @@ function resolveCliRuntime(opts) {
|
|
|
14121
14363
|
}
|
|
14122
14364
|
if (!vcs) return info;
|
|
14123
14365
|
try {
|
|
14124
|
-
const git = (args) =>
|
|
14366
|
+
const git = (args) => execFileSync21("git", args, {
|
|
14125
14367
|
cwd: root,
|
|
14126
14368
|
encoding: "utf-8",
|
|
14127
14369
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -14141,10 +14383,10 @@ var init_build_info = __esm({
|
|
|
14141
14383
|
// libs/mesh-cli/src/docs/serve.ts
|
|
14142
14384
|
import { createServer as createServer8 } from "node:http";
|
|
14143
14385
|
import { readFile } from "node:fs/promises";
|
|
14144
|
-
import { extname, join as join27, normalize, sep as
|
|
14386
|
+
import { extname, join as join27, normalize, sep as sep4 } from "node:path";
|
|
14145
14387
|
async function serveDocsSite(args) {
|
|
14146
14388
|
const root = normalize(args.root);
|
|
14147
|
-
const rootPrefix = root.endsWith(
|
|
14389
|
+
const rootPrefix = root.endsWith(sep4) ? root : root + sep4;
|
|
14148
14390
|
const server = createServer8((req, res) => {
|
|
14149
14391
|
void (async () => {
|
|
14150
14392
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
@@ -14218,7 +14460,7 @@ var init_serve = __esm({
|
|
|
14218
14460
|
});
|
|
14219
14461
|
|
|
14220
14462
|
// libs/mesh-cli/src/docs/registry-docs.ts
|
|
14221
|
-
import { execFileSync as
|
|
14463
|
+
import { execFileSync as execFileSync22 } from "node:child_process";
|
|
14222
14464
|
import { existsSync as existsSync23, mkdirSync as mkdirSync17, readFileSync as readFileSync26, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync17 } from "node:fs";
|
|
14223
14465
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
14224
14466
|
import path30 from "node:path";
|
|
@@ -14310,7 +14552,7 @@ async function fetchDocsArtifact(auth, version, cacheRoot = docsCacheRoot(), fet
|
|
|
14310
14552
|
rmSync6(staging, { recursive: true, force: true });
|
|
14311
14553
|
mkdirSync17(staging, { recursive: true });
|
|
14312
14554
|
try {
|
|
14313
|
-
|
|
14555
|
+
execFileSync22("tar", ["-xzf", tgzPath, "-C", staging, "--strip-components", "1"], {
|
|
14314
14556
|
stdio: ["pipe", "pipe", "pipe"]
|
|
14315
14557
|
});
|
|
14316
14558
|
} finally {
|
|
@@ -14348,7 +14590,7 @@ __export(start_exports, {
|
|
|
14348
14590
|
tmuxInstallHint: () => tmuxInstallHint,
|
|
14349
14591
|
tmuxServeArgs: () => tmuxServeArgs
|
|
14350
14592
|
});
|
|
14351
|
-
import { execFileSync as
|
|
14593
|
+
import { execFileSync as execFileSync23 } from "node:child_process";
|
|
14352
14594
|
import { appendFileSync as appendFileSync2, existsSync as existsSync24, writeFileSync as writeFileSync18 } from "node:fs";
|
|
14353
14595
|
import path31 from "node:path";
|
|
14354
14596
|
function registryAuthOrThrow() {
|
|
@@ -14381,7 +14623,7 @@ function tmuxInstallHint(platform = process.platform) {
|
|
|
14381
14623
|
}
|
|
14382
14624
|
function tmuxAvailable() {
|
|
14383
14625
|
try {
|
|
14384
|
-
|
|
14626
|
+
execFileSync23("tmux", ["-V"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14385
14627
|
return true;
|
|
14386
14628
|
} catch {
|
|
14387
14629
|
return false;
|
|
@@ -14392,7 +14634,7 @@ function shouldDetach(args) {
|
|
|
14392
14634
|
}
|
|
14393
14635
|
function docsSessionExists() {
|
|
14394
14636
|
try {
|
|
14395
|
-
|
|
14637
|
+
execFileSync23("tmux", ["has-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14396
14638
|
return true;
|
|
14397
14639
|
} catch {
|
|
14398
14640
|
return false;
|
|
@@ -14416,12 +14658,12 @@ Or run in the foreground instead: mesh docs start --foreground`
|
|
|
14416
14658
|
if (docsSessionExists()) {
|
|
14417
14659
|
logInfo(`Replacing the docs server already running in tmux session "${DOCS_TMUX_SESSION}".`);
|
|
14418
14660
|
try {
|
|
14419
|
-
|
|
14661
|
+
execFileSync23("tmux", ["kill-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14420
14662
|
} catch {
|
|
14421
14663
|
}
|
|
14422
14664
|
}
|
|
14423
14665
|
const { command, cwd } = tmuxServeArgs(args);
|
|
14424
|
-
|
|
14666
|
+
execFileSync23(
|
|
14425
14667
|
"tmux",
|
|
14426
14668
|
["new-session", "-d", "-s", DOCS_TMUX_SESSION, "-c", cwd, "--", ...command],
|
|
14427
14669
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -14459,7 +14701,7 @@ function printReady(url, label) {
|
|
|
14459
14701
|
}
|
|
14460
14702
|
function runDocsStop() {
|
|
14461
14703
|
try {
|
|
14462
|
-
|
|
14704
|
+
execFileSync23("tmux", ["kill-session", "-t", DOCS_TMUX_SESSION], { stdio: ["pipe", "pipe", "pipe"] });
|
|
14463
14705
|
logSuccess(`Stopped the docs server (tmux session "${DOCS_TMUX_SESSION}").`);
|
|
14464
14706
|
} catch {
|
|
14465
14707
|
logInfo(`No docs server is running (no tmux session named "${DOCS_TMUX_SESSION}").`);
|
|
@@ -14832,7 +15074,7 @@ var init_docs = __esm({
|
|
|
14832
15074
|
});
|
|
14833
15075
|
|
|
14834
15076
|
// libs/mesh-cli/src/commands/hub/index.ts
|
|
14835
|
-
import { execFileSync as
|
|
15077
|
+
import { execFileSync as execFileSync24 } from "node:child_process";
|
|
14836
15078
|
import * as fs26 from "node:fs";
|
|
14837
15079
|
import * as net12 from "node:net";
|
|
14838
15080
|
import * as os10 from "node:os";
|
|
@@ -14898,7 +15140,7 @@ function parseTmuxEnv(output) {
|
|
|
14898
15140
|
}
|
|
14899
15141
|
function readTmuxSessionEnv(sessionName) {
|
|
14900
15142
|
try {
|
|
14901
|
-
const out =
|
|
15143
|
+
const out = execFileSync24("tmux", ["show-environment", "-t", sessionName], {
|
|
14902
15144
|
encoding: "utf-8",
|
|
14903
15145
|
stdio: ["ignore", "pipe", "ignore"]
|
|
14904
15146
|
});
|
|
@@ -14909,7 +15151,7 @@ function readTmuxSessionEnv(sessionName) {
|
|
|
14909
15151
|
}
|
|
14910
15152
|
function tmuxSessionExists(sessionName) {
|
|
14911
15153
|
try {
|
|
14912
|
-
|
|
15154
|
+
execFileSync24("tmux", ["has-session", "-t", sessionName], { stdio: "ignore" });
|
|
14913
15155
|
return true;
|
|
14914
15156
|
} catch {
|
|
14915
15157
|
return false;
|
|
@@ -15073,7 +15315,7 @@ function redactEnv(env) {
|
|
|
15073
15315
|
async function hubDevAction(opts) {
|
|
15074
15316
|
if (opts.kill) {
|
|
15075
15317
|
if (tmuxSessionExists(HUB_SESSION)) {
|
|
15076
|
-
|
|
15318
|
+
execFileSync24("tmux", ["kill-session", "-t", HUB_SESSION], { stdio: "ignore" });
|
|
15077
15319
|
fs26.rmSync(hubEnvDir(), { recursive: true, force: true });
|
|
15078
15320
|
logSuccess(`Killed Hub session '${HUB_SESSION}'.`);
|
|
15079
15321
|
} else {
|
|
@@ -15127,17 +15369,17 @@ async function hubDevAction(opts) {
|
|
|
15127
15369
|
for (const warning of assembled.warnings) logWarn(warning);
|
|
15128
15370
|
const apiDir = path33.join(platformDir, "apps", "hub", "api");
|
|
15129
15371
|
const uiDir = path33.join(platformDir, "apps", "hub", "ui");
|
|
15130
|
-
|
|
15372
|
+
execFileSync24("tmux", ["new-session", "-d", "-s", HUB_SESSION, "-n", "api", "-c", apiDir]);
|
|
15131
15373
|
if (!assembled.apiEnv.DEV_USER_TOKEN_URL && assembled.apiEnv.DEV_USER_ID_TOKEN) {
|
|
15132
15374
|
const platform = session.state.devOutput.platform;
|
|
15133
15375
|
const credContext = `mesh.${platform.env}`;
|
|
15134
15376
|
const tokenPort = await findFreePort4();
|
|
15135
15377
|
const tokenUrl = `http://127.0.0.1:${tokenPort}`;
|
|
15136
|
-
|
|
15137
|
-
|
|
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"], {
|
|
15138
15380
|
stdio: "ignore"
|
|
15139
15381
|
});
|
|
15140
|
-
|
|
15382
|
+
execFileSync24("tmux", [
|
|
15141
15383
|
"send-keys",
|
|
15142
15384
|
"-t",
|
|
15143
15385
|
`${HUB_SESSION}:token-server`,
|
|
@@ -15155,12 +15397,12 @@ async function hubDevAction(opts) {
|
|
|
15155
15397
|
const envFile = path33.join(hubEnvDir(), `${window}.env.sh`);
|
|
15156
15398
|
writeEnvFile(envFile, env);
|
|
15157
15399
|
if (createWindow) {
|
|
15158
|
-
|
|
15400
|
+
execFileSync24("tmux", ["new-window", "-t", HUB_SESSION, "-n", window, "-c", dir]);
|
|
15159
15401
|
}
|
|
15160
|
-
|
|
15402
|
+
execFileSync24("tmux", ["set-option", "-t", `${HUB_SESSION}:${window}`, "remain-on-exit", "on"], {
|
|
15161
15403
|
stdio: "ignore"
|
|
15162
15404
|
});
|
|
15163
|
-
|
|
15405
|
+
execFileSync24("tmux", ["send-keys", "-t", `${HUB_SESSION}:${window}`, buildLaunchCommand(envFile, dir, cmd), "Enter"]);
|
|
15164
15406
|
};
|
|
15165
15407
|
launch("api", apiDir, assembled.apiEnv, "pnpm dev", false);
|
|
15166
15408
|
launch("ui", uiDir, assembled.uiEnv, `pnpm dev -- --port ${uiPort} --strictPort`, true);
|
|
@@ -15486,7 +15728,7 @@ var init_init = __esm({
|
|
|
15486
15728
|
});
|
|
15487
15729
|
|
|
15488
15730
|
// libs/mesh-cli/src/commands/install-shim.ts
|
|
15489
|
-
import { execFileSync as
|
|
15731
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
15490
15732
|
import * as fs28 from "fs";
|
|
15491
15733
|
import * as os11 from "os";
|
|
15492
15734
|
import * as path35 from "path";
|
|
@@ -15599,7 +15841,7 @@ function registerInstallShimCommand(program2) {
|
|
|
15599
15841
|
let status = 0;
|
|
15600
15842
|
let ok = true;
|
|
15601
15843
|
try {
|
|
15602
|
-
stdout =
|
|
15844
|
+
stdout = execFileSync25(target, ["--help"], {
|
|
15603
15845
|
cwd: process.cwd(),
|
|
15604
15846
|
encoding: "utf8",
|
|
15605
15847
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -15646,7 +15888,7 @@ var init_install_shim = __esm({
|
|
|
15646
15888
|
});
|
|
15647
15889
|
|
|
15648
15890
|
// libs/mesh-cli/src/commands/local/hub-local.ts
|
|
15649
|
-
import { execFile as execFile3, execFileSync as
|
|
15891
|
+
import { execFile as execFile3, execFileSync as execFileSync26 } from "child_process";
|
|
15650
15892
|
import * as fs29 from "fs";
|
|
15651
15893
|
import * as os12 from "os";
|
|
15652
15894
|
import * as path36 from "path";
|
|
@@ -15668,7 +15910,7 @@ function npmrcPath() {
|
|
|
15668
15910
|
}
|
|
15669
15911
|
function imageExists(tag) {
|
|
15670
15912
|
try {
|
|
15671
|
-
|
|
15913
|
+
execFileSync26("docker", ["image", "inspect", tag], { stdio: ["ignore", "pipe", "pipe"] });
|
|
15672
15914
|
return true;
|
|
15673
15915
|
} catch {
|
|
15674
15916
|
return false;
|
|
@@ -15678,7 +15920,7 @@ function ensureHubAuthImage() {
|
|
|
15678
15920
|
if (imageExists(HUB_AUTH_IMAGE)) return;
|
|
15679
15921
|
logInfo(`Building ${HUB_AUTH_IMAGE} (Hub auth proxy)\u2026`);
|
|
15680
15922
|
const hubStackDir = path36.join(findPackageRoot(), "stack", "hub");
|
|
15681
|
-
|
|
15923
|
+
execFileSync26(
|
|
15682
15924
|
"docker",
|
|
15683
15925
|
["build", "-f", path36.join(hubStackDir, "Dockerfile.auth"), "-t", HUB_AUTH_IMAGE, hubStackDir],
|
|
15684
15926
|
{ stdio: ["ignore", "inherit", "inherit"], env: { ...process.env, DOCKER_BUILDKIT: "1" } }
|
|
@@ -15692,7 +15934,7 @@ function hasRegistryAuth() {
|
|
|
15692
15934
|
function localHubVersion() {
|
|
15693
15935
|
const versions = HUB_IMAGES.map((name) => {
|
|
15694
15936
|
try {
|
|
15695
|
-
const out =
|
|
15937
|
+
const out = execFileSync26("docker", ["images", name, "--format", "{{.Tag}}"], {
|
|
15696
15938
|
encoding: "utf-8",
|
|
15697
15939
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15698
15940
|
});
|
|
@@ -15771,7 +16013,7 @@ async function ensureHubImages() {
|
|
|
15771
16013
|
const context = path36.join(cacheDir(), `context-${version}`);
|
|
15772
16014
|
fs29.rmSync(context, { recursive: true, force: true });
|
|
15773
16015
|
fs29.mkdirSync(context, { recursive: true });
|
|
15774
|
-
|
|
16016
|
+
execFileSync26("tar", ["-xzf", tarball, "-C", context, "--strip-components", "1"], {
|
|
15775
16017
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15776
16018
|
});
|
|
15777
16019
|
const hubStackDir = path36.join(findPackageRoot(), "stack", "hub");
|
|
@@ -15782,7 +16024,7 @@ async function ensureHubImages() {
|
|
|
15782
16024
|
const tag = `${name}:${version}`;
|
|
15783
16025
|
if (imageExists(tag)) continue;
|
|
15784
16026
|
logInfo(`Building ${tag} from the published tarball\u2026`);
|
|
15785
|
-
|
|
16027
|
+
execFileSync26(
|
|
15786
16028
|
"docker",
|
|
15787
16029
|
[
|
|
15788
16030
|
"build",
|
|
@@ -16877,10 +17119,10 @@ var init_secrets = __esm({
|
|
|
16877
17119
|
});
|
|
16878
17120
|
|
|
16879
17121
|
// libs/mesh-cli/src/commands/stack.ts
|
|
16880
|
-
import { execFileSync as
|
|
17122
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
16881
17123
|
import * as path37 from "path";
|
|
16882
17124
|
import * as fs30 from "fs";
|
|
16883
|
-
import { parse as
|
|
17125
|
+
import { parse as parseYaml5 } from "yaml";
|
|
16884
17126
|
function readTopLevelYamlKey(appRoot, stack, key) {
|
|
16885
17127
|
const configFile = path37.join(appRoot, `Pulumi.${stack}.yaml`);
|
|
16886
17128
|
if (!fs30.existsSync(configFile)) return null;
|
|
@@ -16957,7 +17199,7 @@ function readBaseConfigFromYaml(appRoot, stack) {
|
|
|
16957
17199
|
if (!fs30.existsSync(file)) return {};
|
|
16958
17200
|
let doc;
|
|
16959
17201
|
try {
|
|
16960
|
-
doc =
|
|
17202
|
+
doc = parseYaml5(fs30.readFileSync(file, "utf-8"));
|
|
16961
17203
|
} catch {
|
|
16962
17204
|
return {};
|
|
16963
17205
|
}
|
|
@@ -16970,7 +17212,7 @@ function readBaseConfigFromYaml(appRoot, stack) {
|
|
|
16970
17212
|
}
|
|
16971
17213
|
function getGitHubUsername() {
|
|
16972
17214
|
try {
|
|
16973
|
-
const result =
|
|
17215
|
+
const result = execFileSync27("gh", ["api", "user", "--jq", ".login"], {
|
|
16974
17216
|
encoding: "utf-8",
|
|
16975
17217
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16976
17218
|
});
|
|
@@ -16979,7 +17221,7 @@ function getGitHubUsername() {
|
|
|
16979
17221
|
} catch {
|
|
16980
17222
|
}
|
|
16981
17223
|
try {
|
|
16982
|
-
const result =
|
|
17224
|
+
const result = execFileSync27("git", ["config", "user.email"], {
|
|
16983
17225
|
encoding: "utf-8",
|
|
16984
17226
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16985
17227
|
});
|
|
@@ -17065,7 +17307,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17065
17307
|
if (!opts.adopt) {
|
|
17066
17308
|
let existing = [];
|
|
17067
17309
|
try {
|
|
17068
|
-
const raw =
|
|
17310
|
+
const raw = execFileSync27("pulumi", ["stack", "ls", "--json"], {
|
|
17069
17311
|
cwd: appRoot,
|
|
17070
17312
|
encoding: "utf-8",
|
|
17071
17313
|
env: pulumiEnv,
|
|
@@ -17089,7 +17331,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17089
17331
|
logInfo(`Using KMS secrets provider: ${secretsProvider}`);
|
|
17090
17332
|
}
|
|
17091
17333
|
try {
|
|
17092
|
-
|
|
17334
|
+
execFileSync27("pulumi", initArgs, {
|
|
17093
17335
|
cwd: appRoot,
|
|
17094
17336
|
env: pulumiEnv,
|
|
17095
17337
|
stdio: "inherit"
|
|
@@ -17106,7 +17348,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17106
17348
|
}
|
|
17107
17349
|
}
|
|
17108
17350
|
try {
|
|
17109
|
-
|
|
17351
|
+
execFileSync27("pulumi", ["stack", "select", newStack], {
|
|
17110
17352
|
cwd: appRoot,
|
|
17111
17353
|
env: pulumiEnv,
|
|
17112
17354
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17116,7 +17358,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17116
17358
|
if (!configExists) {
|
|
17117
17359
|
let baseConfig = {};
|
|
17118
17360
|
try {
|
|
17119
|
-
const raw =
|
|
17361
|
+
const raw = execFileSync27(
|
|
17120
17362
|
"pulumi",
|
|
17121
17363
|
["config", "--json", "--stack", baseStack],
|
|
17122
17364
|
{ cwd: appRoot, env: pulumiEnv, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -17134,19 +17376,19 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17134
17376
|
if (key === "mesh:deploy") continue;
|
|
17135
17377
|
try {
|
|
17136
17378
|
if (entry.objectValue !== void 0) {
|
|
17137
|
-
|
|
17379
|
+
execFileSync27(
|
|
17138
17380
|
"pulumi",
|
|
17139
17381
|
["config", "set", key, JSON.stringify(entry.objectValue)],
|
|
17140
17382
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
17141
17383
|
);
|
|
17142
17384
|
} else if (entry.value === "true" || entry.value === "false") {
|
|
17143
|
-
|
|
17385
|
+
execFileSync27(
|
|
17144
17386
|
"pulumi",
|
|
17145
17387
|
["config", "set", "--type", "bool", key, entry.value],
|
|
17146
17388
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
17147
17389
|
);
|
|
17148
17390
|
} else {
|
|
17149
|
-
|
|
17391
|
+
execFileSync27(
|
|
17150
17392
|
"pulumi",
|
|
17151
17393
|
["config", "set", key, entry.value],
|
|
17152
17394
|
{ cwd: appRoot, env: pulumiEnv, stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -17159,7 +17401,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17159
17401
|
const baseEnv = readConfigBlockKey(appRoot, baseStack, "mesh:coreEnv") ?? (baseTenant && baseStack.startsWith(`${baseTenant}-`) ? baseStack.slice(baseTenant.length + 1) : baseStack);
|
|
17160
17402
|
const setCfg = (args) => {
|
|
17161
17403
|
try {
|
|
17162
|
-
|
|
17404
|
+
execFileSync27("pulumi", ["config", "set", ...args], {
|
|
17163
17405
|
cwd: appRoot,
|
|
17164
17406
|
env: pulumiEnv,
|
|
17165
17407
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17208,7 +17450,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17208
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}` : ""})`
|
|
17209
17451
|
);
|
|
17210
17452
|
} else {
|
|
17211
|
-
|
|
17453
|
+
execFileSync27("pulumi", ["config", "set", "--type", "bool", "mesh:deploy", "false"], {
|
|
17212
17454
|
cwd: appRoot,
|
|
17213
17455
|
env: pulumiEnv,
|
|
17214
17456
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -17238,7 +17480,7 @@ Specify which to base on: mesh stack init --from <stack>`
|
|
|
17238
17480
|
const args = ["stack", "rm", name];
|
|
17239
17481
|
if (opts.yes) args.push("--yes");
|
|
17240
17482
|
try {
|
|
17241
|
-
|
|
17483
|
+
execFileSync27("pulumi", args, { cwd: appRoot, env: pulumiEnv, stdio: "inherit" });
|
|
17242
17484
|
logSuccess(`Removed stack ${name}`);
|
|
17243
17485
|
} catch (err) {
|
|
17244
17486
|
process.exit(err.status ?? 1);
|
|
@@ -17450,12 +17692,12 @@ var init_recover_conversation = __esm({
|
|
|
17450
17692
|
});
|
|
17451
17693
|
|
|
17452
17694
|
// libs/mesh-cli/src/utils/temporal-codec.ts
|
|
17453
|
-
import { execFileSync as
|
|
17695
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
17454
17696
|
import { webcrypto as crypto4 } from "node:crypto";
|
|
17455
17697
|
function resolveTemporalEncodingKeyFromK8s(namespace) {
|
|
17456
17698
|
const secretName = `${namespace}-temporal-encoding-key`;
|
|
17457
17699
|
try {
|
|
17458
|
-
const b64 =
|
|
17700
|
+
const b64 = execFileSync28(
|
|
17459
17701
|
"kubectl",
|
|
17460
17702
|
[
|
|
17461
17703
|
"get",
|
|
@@ -20333,7 +20575,7 @@ var init_src3 = __esm({
|
|
|
20333
20575
|
import * as fs33 from "fs";
|
|
20334
20576
|
import * as path40 from "path";
|
|
20335
20577
|
import { createRequire as createRequire2 } from "module";
|
|
20336
|
-
import { execFileSync as
|
|
20578
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
20337
20579
|
function resolveExtractorPath() {
|
|
20338
20580
|
try {
|
|
20339
20581
|
const require2 = createRequire2(import.meta.url);
|
|
@@ -20388,7 +20630,7 @@ for (const file of files) {
|
|
|
20388
20630
|
process.stdout.write(JSON.stringify(results));
|
|
20389
20631
|
`;
|
|
20390
20632
|
try {
|
|
20391
|
-
const result =
|
|
20633
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20392
20634
|
encoding: "utf-8",
|
|
20393
20635
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20394
20636
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -20430,7 +20672,7 @@ for (const file of files) {
|
|
|
20430
20672
|
process.stdout.write(JSON.stringify(results));
|
|
20431
20673
|
`;
|
|
20432
20674
|
try {
|
|
20433
|
-
const result =
|
|
20675
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20434
20676
|
encoding: "utf-8",
|
|
20435
20677
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20436
20678
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -20485,7 +20727,7 @@ for (const file of files) {
|
|
|
20485
20727
|
process.stdout.write(JSON.stringify(results));
|
|
20486
20728
|
`;
|
|
20487
20729
|
try {
|
|
20488
|
-
const result =
|
|
20730
|
+
const result = execFileSync29("npx", ["tsx", "--eval", script], {
|
|
20489
20731
|
encoding: "utf-8",
|
|
20490
20732
|
stdio: ["pipe", "pipe", "inherit"],
|
|
20491
20733
|
maxBuffer: 10 * 1024 * 1024
|