@mesh-tech/mesh-cli 0.27.0 → 0.28.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/dist/bin/mesh.js +27 -4
- package/dist/bin/mesh.js.map +1 -1
- package/dist/build-info.json +2 -2
- package/dist/src/commands/app-check.js +2 -1
- package/dist/src/commands/hub/index.d.ts +2 -0
- package/dist/src/commands/hub/index.js +16 -1
- package/fragments/base/index.ts.hbs +13 -1
- package/package.json +2 -2
- package/templates/api-auth/index.ts.hbs +5 -1
- package/templates/api-role-gating/index.ts.hbs +5 -1
- package/templates/external-service/index.ts.hbs +5 -1
- package/templates/platform-repo/AGENTS.md.hbs +20 -4
- package/templates/workflow/index.ts.hbs +5 -1
package/dist/bin/mesh.js
CHANGED
|
@@ -11830,7 +11830,11 @@ var init_app_check = __esm({
|
|
|
11830
11830
|
gate: "0.2",
|
|
11831
11831
|
title: "App registers with the Hub",
|
|
11832
11832
|
severity: "block",
|
|
11833
|
-
|
|
11833
|
+
// The registration's prose is read by the CLIENT's operators, so the
|
|
11834
|
+
// remediation names the split rather than one field: `description` is one
|
|
11835
|
+
// sentence for them, `operatorNote` is where the engineering material goes
|
|
11836
|
+
// (a tenant-audience Hub drops that key from the response entirely).
|
|
11837
|
+
remediation: "end index.ts with `export const app = env.register({ displayName, description })` \u2014 one sentence a non-technical operator can act on; put the caveats in `operatorNote`",
|
|
11834
11838
|
scope: "app"
|
|
11835
11839
|
},
|
|
11836
11840
|
CUSTOM_SESSION_AUTH: {
|
|
@@ -16700,6 +16704,10 @@ function forwardedSessionVars(sessionEnv) {
|
|
|
16700
16704
|
}
|
|
16701
16705
|
return out;
|
|
16702
16706
|
}
|
|
16707
|
+
function resolveHubAudience(raw) {
|
|
16708
|
+
if (raw === void 0 || raw === "") return "operator";
|
|
16709
|
+
return raw.trim().toLowerCase() === "operator" ? "operator" : "tenant";
|
|
16710
|
+
}
|
|
16703
16711
|
function assembleHubEnv(session, sessionEnv, opts) {
|
|
16704
16712
|
const warnings = [];
|
|
16705
16713
|
const notes = [];
|
|
@@ -16752,6 +16760,7 @@ function assembleHubEnv(session, sessionEnv, opts) {
|
|
|
16752
16760
|
{ remediation: { command: "mesh dev # relaunch; the session records tunnels.temporal in its state" } }
|
|
16753
16761
|
);
|
|
16754
16762
|
}
|
|
16763
|
+
const audienceEnv = { HUB_AUDIENCE: resolveHubAudience(opts.audience) };
|
|
16755
16764
|
const apiEnv = {
|
|
16756
16765
|
...forwarded,
|
|
16757
16766
|
PORT: String(opts.apiPort),
|
|
@@ -16759,6 +16768,7 @@ function assembleHubEnv(session, sessionEnv, opts) {
|
|
|
16759
16768
|
HUB_TENANT: hubTenant,
|
|
16760
16769
|
HUB_SCOPE_ENV: scopeEnv,
|
|
16761
16770
|
HUB_SCOPE_TENANTS: scopeTenants.join(","),
|
|
16771
|
+
...audienceEnv,
|
|
16762
16772
|
...isLocalPlatform ? localPlatformEnv2(sessionEnv) : {}
|
|
16763
16773
|
};
|
|
16764
16774
|
const uiEnv = {
|
|
@@ -16768,7 +16778,8 @@ function assembleHubEnv(session, sessionEnv, opts) {
|
|
|
16768
16778
|
HUB_TENANT: hubTenant,
|
|
16769
16779
|
// UI namespace parsing + session defaults land on the scoped tenant.
|
|
16770
16780
|
DEFAULT_ORG: scopeTenants[0],
|
|
16771
|
-
DEFAULT_ENV: scopeEnv
|
|
16781
|
+
DEFAULT_ENV: scopeEnv,
|
|
16782
|
+
...audienceEnv
|
|
16772
16783
|
};
|
|
16773
16784
|
return { apiEnv, uiEnv, scope: { hubTenant, scopeEnv, scopeTenants }, temporalAddress, warnings, notes };
|
|
16774
16785
|
}
|
|
@@ -16876,7 +16887,15 @@ async function hubDevAction(opts) {
|
|
|
16876
16887
|
);
|
|
16877
16888
|
}
|
|
16878
16889
|
const sessionEnv = readTmuxSessionEnv(session.name);
|
|
16879
|
-
const assembled = assembleHubEnv(session, sessionEnv, {
|
|
16890
|
+
const assembled = assembleHubEnv(session, sessionEnv, {
|
|
16891
|
+
tenants: opts.tenants,
|
|
16892
|
+
uiPort,
|
|
16893
|
+
apiPort,
|
|
16894
|
+
// The flag wins; the ambient variable is the fallback, so an exported
|
|
16895
|
+
// HUB_AUDIENCE reaches a Hub this command spawns rather than being
|
|
16896
|
+
// dropped on the way.
|
|
16897
|
+
audience: opts.audience ?? process.env.HUB_AUDIENCE
|
|
16898
|
+
});
|
|
16880
16899
|
if (opts.printEnv) {
|
|
16881
16900
|
console.log(chalk3.bold("\nhub-api env:"));
|
|
16882
16901
|
for (const [k, v] of Object.entries(redactEnv(assembled.apiEnv))) console.log(` ${k}=${v}`);
|
|
@@ -16905,6 +16924,7 @@ async function hubDevAction(opts) {
|
|
|
16905
16924
|
logInfo(
|
|
16906
16925
|
`Scope : HUB_TENANT=${assembled.scope.hubTenant} HUB_SCOPE_ENV=${assembled.scope.scopeEnv} HUB_SCOPE_TENANTS=${assembled.scope.scopeTenants.join(",")}`
|
|
16907
16926
|
);
|
|
16927
|
+
logInfo(`Audience : ${assembled.apiEnv.HUB_AUDIENCE} (--audience tenant for a client's view)`);
|
|
16908
16928
|
logInfo(`Temporal : ${assembled.temporalAddress}`);
|
|
16909
16929
|
for (const note of assembled.notes) logInfo(note);
|
|
16910
16930
|
for (const warning of assembled.warnings) logWarn(warning);
|
|
@@ -16967,7 +16987,10 @@ function registerHubCommands(program2) {
|
|
|
16967
16987
|
const hub = program2.command("hub").description("Local Hub over dev-local stacks");
|
|
16968
16988
|
hub.command("dev").description(
|
|
16969
16989
|
"Launch the current-code Hub (api + ui) against a running `mesh dev` session \u2014 env auto-assembled, zero hand-set vars"
|
|
16970
|
-
).option("--session <name>", "dev session to observe (default: auto-detect from cwd)").option("--tenants <list>", "comma-separated HUB_SCOPE_TENANTS override (default: the session's tenant)").option(
|
|
16990
|
+
).option("--session <name>", "dev session to observe (default: auto-detect from cwd)").option("--tenants <list>", "comma-separated HUB_SCOPE_TENANTS override (default: the session's tenant)").option(
|
|
16991
|
+
"--audience <who>",
|
|
16992
|
+
"who the Hub renders for: `operator` (platform staff \u2014 the default here) or `tenant` (a client's operators). Anything else reads as `tenant`"
|
|
16993
|
+
).option("--port <port>", `Hub UI host port (default: $MESH_HUB_DEV_PORT or ${DEFAULT_HUB_UI_PORT})`).option("--api-port <port>", `Hub API port (default: ${DEFAULT_HUB_API_PORT})`).option("--platform-dir <dir>", "mesh-platform checkout to run the Hub from (default: $MESH_PLATFORM_DIR or walk up from cwd)").option("--print-env", "print the assembled env (secrets redacted) and exit without launching").option("--kill", "tear down the running Hub session").action(hubDevAction);
|
|
16971
16994
|
}
|
|
16972
16995
|
var HUB_SESSION, DEFAULT_HUB_UI_PORT, DEFAULT_HUB_API_PORT, FORWARD_PREFIXES, localPlatformEnv2, SENSITIVE_RE;
|
|
16973
16996
|
var init_hub = __esm({
|