@wairon/cli 5.1.1-dev.73 → 5.1.1-dev.74
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 +67 -49
- 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.74";
|
|
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();
|
|
@@ -48069,55 +48131,11 @@ ${lines}`);
|
|
|
48069
48131
|
}
|
|
48070
48132
|
return new WaironError(e instanceof Error ? e.message : String(e));
|
|
48071
48133
|
}
|
|
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
48134
|
function seedIdentityProviderFromEnv(cfg) {
|
|
48080
|
-
|
|
48081
|
-
if (!issuer) return;
|
|
48082
|
-
if (!process.env["WAIRON_DATA_DIR"]) {
|
|
48135
|
+
if (process.env["WAIRON_OIDC_ISSUER"]?.trim() && !process.env["WAIRON_DATA_DIR"]) {
|
|
48083
48136
|
process.env["WAIRON_DATA_DIR"] = cfg.dataDir;
|
|
48084
48137
|
}
|
|
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");
|
|
48138
|
+
if (seedDefaultProvider(cfg)) logger.info("seeded identity provider 'default' from env");
|
|
48121
48139
|
}
|
|
48122
48140
|
async function runServe(options = {}) {
|
|
48123
48141
|
const cfg = resolveHostConfig(options);
|
|
@@ -48172,7 +48190,6 @@ async function runDev(options = {}) {
|
|
|
48172
48190
|
const hash = crypto23.createHash("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
48173
48191
|
const dataDir = path68.join(os11.tmpdir(), "wairon-dev", hash);
|
|
48174
48192
|
fs55.mkdirSync(dataDir, { recursive: true });
|
|
48175
|
-
registerLocalDevProject(dataDir, "local", cwd);
|
|
48176
48193
|
const port = options.port ? Number(options.port) : 8080;
|
|
48177
48194
|
const exposurePolicy = {
|
|
48178
48195
|
adminApiMode: "local_only",
|
|
@@ -48195,6 +48212,7 @@ async function runDev(options = {}) {
|
|
|
48195
48212
|
devMode: true,
|
|
48196
48213
|
exposurePolicy
|
|
48197
48214
|
};
|
|
48215
|
+
registerLocalDevProject(cfg, "local", cwd);
|
|
48198
48216
|
let handle;
|
|
48199
48217
|
try {
|
|
48200
48218
|
handle = startHostServer(cfg);
|