@wairon/cli 5.1.1-dev.73 → 5.1.1-dev.75
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/cli/index.js +75 -51
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -65,7 +65,7 @@ var init_defaults = __esm({
|
|
|
65
65
|
copilot: ".github/prompts",
|
|
66
66
|
codex: ".codex/agents"
|
|
67
67
|
};
|
|
68
|
-
WAIRON_VERSION = "5.1.1-dev.
|
|
68
|
+
WAIRON_VERSION = "5.1.1-dev.75";
|
|
69
69
|
GITHUB_REPO = "SYW-Apps/Waffle-AIron";
|
|
70
70
|
SUPPORTED_ALIASES = ["wai"];
|
|
71
71
|
SCAN_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
@@ -36722,7 +36722,7 @@ function createProjectRecord(dataDir, id) {
|
|
|
36722
36722
|
save2(dataDir, records);
|
|
36723
36723
|
return record2;
|
|
36724
36724
|
}
|
|
36725
|
-
function
|
|
36725
|
+
function registerProjectRecord(dataDir, id, rootPath) {
|
|
36726
36726
|
if (!isValidProjectId(id)) {
|
|
36727
36727
|
throw new Error(`Invalid project id "${id}" (allowed: lowercase letters, digits, hyphen).`);
|
|
36728
36728
|
}
|
|
@@ -37433,6 +37433,12 @@ function destroyProject(cfg, credential, id) {
|
|
|
37433
37433
|
}
|
|
37434
37434
|
removeProjectRecord(cfg.dataDir, id);
|
|
37435
37435
|
}
|
|
37436
|
+
function registerLocalDevProject(cfg, id, rootPath) {
|
|
37437
|
+
if (!cfg.devMode) {
|
|
37438
|
+
throw new Error("Registering a project at a working directory is reserved for the local development server.");
|
|
37439
|
+
}
|
|
37440
|
+
return registerProjectRecord(cfg.dataDir, id, rootPath);
|
|
37441
|
+
}
|
|
37436
37442
|
function listProjects(cfg, credential) {
|
|
37437
37443
|
requireAdmin(credential);
|
|
37438
37444
|
return listProjectRecords(cfg.dataDir);
|
|
@@ -39963,6 +39969,62 @@ async function handleIdentityRequest(cfg, credential, req, res, body, url) {
|
|
|
39963
39969
|
}
|
|
39964
39970
|
}
|
|
39965
39971
|
|
|
39972
|
+
// src/server/identity-provider-bootstrap.ts
|
|
39973
|
+
var DEFAULT_PROVIDER_ID = "default";
|
|
39974
|
+
var DEFAULT_PROVIDER_SECRET_REF = "oidc-default";
|
|
39975
|
+
function envTrim(name) {
|
|
39976
|
+
const value = process.env[name]?.trim();
|
|
39977
|
+
return value ? value : void 0;
|
|
39978
|
+
}
|
|
39979
|
+
function envCsv(name) {
|
|
39980
|
+
return (process.env[name] ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
39981
|
+
}
|
|
39982
|
+
function seedDefaultProvider(cfg) {
|
|
39983
|
+
const issuer = envTrim("WAIRON_OIDC_ISSUER");
|
|
39984
|
+
if (!issuer) return null;
|
|
39985
|
+
let clientSecretRef = envTrim("WAIRON_OIDC_CLIENT_SECRET_REF");
|
|
39986
|
+
const rawSecret = process.env["WAIRON_OIDC_CLIENT_SECRET"];
|
|
39987
|
+
if (rawSecret) {
|
|
39988
|
+
setSecret(DEFAULT_PROVIDER_SECRET_REF, rawSecret);
|
|
39989
|
+
clientSecretRef = DEFAULT_PROVIDER_SECRET_REF;
|
|
39990
|
+
}
|
|
39991
|
+
const config = defaultProviderFromEnv(issuer, clientSecretRef);
|
|
39992
|
+
return upsertIdentityProviderRecord(cfg.dataDir, config);
|
|
39993
|
+
}
|
|
39994
|
+
function defaultProviderFromEnv(issuer, clientSecretRef) {
|
|
39995
|
+
const config = {
|
|
39996
|
+
id: DEFAULT_PROVIDER_ID,
|
|
39997
|
+
providerType: envTrim("WAIRON_OIDC_PROVIDER_TYPE") ?? "oidc",
|
|
39998
|
+
issuerUrl: issuer,
|
|
39999
|
+
enabled: true,
|
|
40000
|
+
updatedAt: ""
|
|
40001
|
+
// stamped server-side by the policy registry
|
|
40002
|
+
};
|
|
40003
|
+
const displayName = envTrim("WAIRON_OIDC_DISPLAY_NAME");
|
|
40004
|
+
if (displayName) config.displayName = displayName;
|
|
40005
|
+
const clientId = envTrim("WAIRON_OIDC_CLIENT_ID");
|
|
40006
|
+
if (clientId) config.clientId = clientId;
|
|
40007
|
+
if (clientSecretRef) config.clientSecretRef = clientSecretRef;
|
|
40008
|
+
const adminGroups = envCsv("WAIRON_OIDC_ADMIN_GROUPS");
|
|
40009
|
+
if (adminGroups.length) config.adminGroupClaims = adminGroups;
|
|
40010
|
+
const redirectUris = envCsv("WAIRON_OIDC_ALLOWED_REDIRECT_URIS");
|
|
40011
|
+
if (redirectUris.length) config.allowedRedirectUris = redirectUris;
|
|
40012
|
+
const domains = envCsv("WAIRON_OIDC_ALLOWED_DOMAINS");
|
|
40013
|
+
if (domains.length) config.allowedDomains = domains;
|
|
40014
|
+
applyEndpointOverrides(config);
|
|
40015
|
+
return config;
|
|
40016
|
+
}
|
|
40017
|
+
function applyEndpointOverrides(config) {
|
|
40018
|
+
const authorizationEndpoint = envTrim("WAIRON_OIDC_AUTHORIZATION_ENDPOINT");
|
|
40019
|
+
if (authorizationEndpoint) config.authorizationEndpoint = authorizationEndpoint;
|
|
40020
|
+
const tokenEndpoint = envTrim("WAIRON_OIDC_TOKEN_ENDPOINT");
|
|
40021
|
+
if (tokenEndpoint) config.tokenEndpoint = tokenEndpoint;
|
|
40022
|
+
const jwksUri = envTrim("WAIRON_OIDC_JWKS_URI");
|
|
40023
|
+
if (jwksUri) config.jwksUri = jwksUri;
|
|
40024
|
+
const userinfoEndpoint = envTrim("WAIRON_OIDC_USERINFO_ENDPOINT");
|
|
40025
|
+
if (userinfoEndpoint) config.userinfoEndpoint = userinfoEndpoint;
|
|
40026
|
+
}
|
|
40027
|
+
|
|
39966
40028
|
// src/server/landscape.ts
|
|
39967
40029
|
init_fs();
|
|
39968
40030
|
init_yaml();
|
|
@@ -43552,6 +43614,12 @@ function getGraph(cfg, sessionId, tier, projectId, level) {
|
|
|
43552
43614
|
function getProjectCanvas(cfg, sessionId, projectId) {
|
|
43553
43615
|
return getWebProjectCanvas(cfg, sessionId, projectId);
|
|
43554
43616
|
}
|
|
43617
|
+
function getProjectCanvasModel(cfg, sessionId, projectId) {
|
|
43618
|
+
return getWebProjectCanvasModel(cfg, sessionId, projectId);
|
|
43619
|
+
}
|
|
43620
|
+
function getProjectOpenApi(cfg, sessionId, projectId, portalId) {
|
|
43621
|
+
return getWebProjectOpenApi(cfg, sessionId, projectId, portalId);
|
|
43622
|
+
}
|
|
43555
43623
|
function signOutEverywhere(cfg, sessionId) {
|
|
43556
43624
|
const principal = authenticateSession(cfg.dataDir, sessionId);
|
|
43557
43625
|
if (!principal.authenticated) {
|
|
@@ -45973,12 +46041,12 @@ async function handleWebRequest(cfg, req, res, body, url, ctx) {
|
|
|
45973
46041
|
}
|
|
45974
46042
|
if (req.method === "GET" && parts.length === 2 && parts[1] === "canvas-model") {
|
|
45975
46043
|
const projectId = url.searchParams.get("projectId") ?? "";
|
|
45976
|
-
return sendJson(res, 200,
|
|
46044
|
+
return sendJson(res, 200, getProjectCanvasModel(cfg, sessionId, projectId));
|
|
45977
46045
|
}
|
|
45978
46046
|
if (req.method === "GET" && parts.length === 2 && parts[1] === "openapi") {
|
|
45979
46047
|
const projectId = url.searchParams.get("projectId") ?? "";
|
|
45980
46048
|
const spec = url.searchParams.get("spec") ?? void 0;
|
|
45981
|
-
const html =
|
|
46049
|
+
const html = getProjectOpenApi(cfg, sessionId, projectId, spec);
|
|
45982
46050
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
45983
46051
|
res.end(html);
|
|
45984
46052
|
return;
|
|
@@ -48069,55 +48137,11 @@ ${lines}`);
|
|
|
48069
48137
|
}
|
|
48070
48138
|
return new WaironError(e instanceof Error ? e.message : String(e));
|
|
48071
48139
|
}
|
|
48072
|
-
function envTrim(name) {
|
|
48073
|
-
const value = process.env[name]?.trim();
|
|
48074
|
-
return value ? value : void 0;
|
|
48075
|
-
}
|
|
48076
|
-
function envCsv(name) {
|
|
48077
|
-
return (process.env[name] ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
48078
|
-
}
|
|
48079
48140
|
function seedIdentityProviderFromEnv(cfg) {
|
|
48080
|
-
|
|
48081
|
-
if (!issuer) return;
|
|
48082
|
-
if (!process.env["WAIRON_DATA_DIR"]) {
|
|
48141
|
+
if (process.env["WAIRON_OIDC_ISSUER"]?.trim() && !process.env["WAIRON_DATA_DIR"]) {
|
|
48083
48142
|
process.env["WAIRON_DATA_DIR"] = cfg.dataDir;
|
|
48084
48143
|
}
|
|
48085
|
-
|
|
48086
|
-
const rawSecret = process.env["WAIRON_OIDC_CLIENT_SECRET"];
|
|
48087
|
-
if (rawSecret) {
|
|
48088
|
-
setSecret("oidc-default", rawSecret);
|
|
48089
|
-
clientSecretRef = "oidc-default";
|
|
48090
|
-
}
|
|
48091
|
-
const config = {
|
|
48092
|
-
id: "default",
|
|
48093
|
-
// matches the sign-in screen's default provider id
|
|
48094
|
-
providerType: envTrim("WAIRON_OIDC_PROVIDER_TYPE") ?? "oidc",
|
|
48095
|
-
issuerUrl: issuer,
|
|
48096
|
-
enabled: true,
|
|
48097
|
-
updatedAt: ""
|
|
48098
|
-
// stamped server-side by the policy registry
|
|
48099
|
-
};
|
|
48100
|
-
const displayName = envTrim("WAIRON_OIDC_DISPLAY_NAME");
|
|
48101
|
-
if (displayName) config.displayName = displayName;
|
|
48102
|
-
const clientId = envTrim("WAIRON_OIDC_CLIENT_ID");
|
|
48103
|
-
if (clientId) config.clientId = clientId;
|
|
48104
|
-
if (clientSecretRef) config.clientSecretRef = clientSecretRef;
|
|
48105
|
-
const adminGroups = envCsv("WAIRON_OIDC_ADMIN_GROUPS");
|
|
48106
|
-
if (adminGroups.length) config.adminGroupClaims = adminGroups;
|
|
48107
|
-
const redirectUris = envCsv("WAIRON_OIDC_ALLOWED_REDIRECT_URIS");
|
|
48108
|
-
if (redirectUris.length) config.allowedRedirectUris = redirectUris;
|
|
48109
|
-
const domains = envCsv("WAIRON_OIDC_ALLOWED_DOMAINS");
|
|
48110
|
-
if (domains.length) config.allowedDomains = domains;
|
|
48111
|
-
const authorizationEndpoint = envTrim("WAIRON_OIDC_AUTHORIZATION_ENDPOINT");
|
|
48112
|
-
if (authorizationEndpoint) config.authorizationEndpoint = authorizationEndpoint;
|
|
48113
|
-
const tokenEndpoint = envTrim("WAIRON_OIDC_TOKEN_ENDPOINT");
|
|
48114
|
-
if (tokenEndpoint) config.tokenEndpoint = tokenEndpoint;
|
|
48115
|
-
const jwksUri = envTrim("WAIRON_OIDC_JWKS_URI");
|
|
48116
|
-
if (jwksUri) config.jwksUri = jwksUri;
|
|
48117
|
-
const userinfoEndpoint = envTrim("WAIRON_OIDC_USERINFO_ENDPOINT");
|
|
48118
|
-
if (userinfoEndpoint) config.userinfoEndpoint = userinfoEndpoint;
|
|
48119
|
-
upsertIdentityProviderRecord(cfg.dataDir, config);
|
|
48120
|
-
logger.info("seeded identity provider 'default' from env");
|
|
48144
|
+
if (seedDefaultProvider(cfg)) logger.info("seeded identity provider 'default' from env");
|
|
48121
48145
|
}
|
|
48122
48146
|
async function runServe(options = {}) {
|
|
48123
48147
|
const cfg = resolveHostConfig(options);
|
|
@@ -48172,7 +48196,6 @@ async function runDev(options = {}) {
|
|
|
48172
48196
|
const hash = crypto23.createHash("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
48173
48197
|
const dataDir = path68.join(os11.tmpdir(), "wairon-dev", hash);
|
|
48174
48198
|
fs55.mkdirSync(dataDir, { recursive: true });
|
|
48175
|
-
registerLocalDevProject(dataDir, "local", cwd);
|
|
48176
48199
|
const port = options.port ? Number(options.port) : 8080;
|
|
48177
48200
|
const exposurePolicy = {
|
|
48178
48201
|
adminApiMode: "local_only",
|
|
@@ -48195,6 +48218,7 @@ async function runDev(options = {}) {
|
|
|
48195
48218
|
devMode: true,
|
|
48196
48219
|
exposurePolicy
|
|
48197
48220
|
};
|
|
48221
|
+
registerLocalDevProject(cfg, "local", cwd);
|
|
48198
48222
|
let handle;
|
|
48199
48223
|
try {
|
|
48200
48224
|
handle = startHostServer(cfg);
|