@wairon/cli 5.0.2-dev.1 → 5.0.2-dev.3

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 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.0.2-dev.1";
68
+ WAIRON_VERSION = "5.0.2-dev.3";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  ARCHITECT_AGENT_ID = "agent-architect";
71
71
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -25456,6 +25456,7 @@ init_validation();
25456
25456
  init_diagram();
25457
25457
  init_loader();
25458
25458
  init_extensions();
25459
+ init_types();
25459
25460
  init_server();
25460
25461
 
25461
25462
  // src/git/config.ts
@@ -25976,7 +25977,11 @@ var hostCore = {
25976
25977
  checkDeclarativePack: (raw) => {
25977
25978
  const result = DeclarativePackSchema.safeParse(raw);
25978
25979
  return result.success ? null : result.error.issues[0]?.message ?? "shape mismatch";
25979
- }
25980
+ },
25981
+ /** The ids of wairon's built-in architectural profiles, read from the core rules
25982
+ * registry's built-in profile set (BUILTIN_PROFILES) — a pure, side-effect-free
25983
+ * read of a bundled constant. */
25984
+ builtinProfileIds: () => [...BUILTIN_PROFILES]
25980
25985
  };
25981
25986
  function validateProjectAsComplete() {
25982
25987
  const config = loadProjectConfig();
@@ -26385,7 +26390,12 @@ function probe(loadRef, baseRoot, scope, displayRef) {
26385
26390
  ref: displayRef,
26386
26391
  profiles: Object.keys(loaded.profiles).length,
26387
26392
  languages: Object.keys(loaded.languages).length,
26388
- rules: loaded.rules.length
26393
+ rules: loaded.rules.length,
26394
+ // Structured id lists paralleling the counts above — a UI can present a
26395
+ // pack's profiles/languages/rules as choices instead of a bare number.
26396
+ profileIds: Object.keys(loaded.profiles),
26397
+ languageIds: Object.keys(loaded.languages),
26398
+ ruleIds: loaded.rules.map((r) => r.name)
26389
26399
  };
26390
26400
  }
26391
26401
  function writeFileAtomic(file, content) {
@@ -26415,6 +26425,31 @@ function storeListGlobalPacks() {
26415
26425
  );
26416
26426
  return [...instance, ...image];
26417
26427
  }
26428
+ function storeListAvailableProfiles() {
26429
+ const out = [];
26430
+ const seen = /* @__PURE__ */ new Set();
26431
+ const emit = (id, source, family) => {
26432
+ const key = JSON.stringify([id, source]);
26433
+ if (seen.has(key)) return;
26434
+ seen.add(key);
26435
+ out.push(family ? { id, source, family } : { id, source });
26436
+ };
26437
+ for (const id of hostCore.builtinProfileIds()) emit(id, "builtin");
26438
+ const scanTier = (dir) => {
26439
+ for (const full of hostCore.discoverPacks(dir)) {
26440
+ try {
26441
+ const loaded = hostCore.loadExtensionPacks([{ ref: full, scope: "global" }], path45.dirname(full));
26442
+ if (loaded.errors.length) continue;
26443
+ const source = loaded.packNames[0] ?? path45.basename(full);
26444
+ for (const [id, def] of Object.entries(loaded.profiles)) emit(id, source, def.family);
26445
+ } catch {
26446
+ }
26447
+ }
26448
+ };
26449
+ scanTier(hostCore.globalPacksDir());
26450
+ scanTier(imagePacksDir());
26451
+ return out;
26452
+ }
26418
26453
  function readPackContent(full) {
26419
26454
  const st = fs36.statSync(full);
26420
26455
  if (st.isFile()) return fs36.readFileSync(full, "utf8");
@@ -26601,6 +26636,23 @@ function installProjectPack(cfg, credential, project2, name, content) {
26601
26636
  requireCap(cfg, credential, "project:admin", "project", project2, "Forbidden \u2014 installing a project pack requires project:admin over the project");
26602
26637
  return executeApprovedInstallProjectPack(cfg, project2, name, content);
26603
26638
  }
26639
+ function listAvailableProfiles(cfg, credential) {
26640
+ requirePrincipal2(cfg, credential);
26641
+ return storeListAvailableProfiles();
26642
+ }
26643
+ function listAdoptableProjectPacks(cfg, credential, project2) {
26644
+ requireCap(cfg, credential, "project:read", "project", project2, "Forbidden \u2014 listing adoptable packs requires project:read over the project");
26645
+ return storeListGlobalPacks();
26646
+ }
26647
+ function adoptProjectPack(cfg, credential, project2, name) {
26648
+ requireCap(cfg, credential, "project:admin", "project", project2, "Forbidden \u2014 adopting a project pack requires project:admin over the project");
26649
+ const resolution = executeApprovedResolveGlobalPacks([name]);
26650
+ if (resolution.resolved.length === 0) {
26651
+ throw new Error(`no such server-global pack "${name}" \u2014 cannot adopt a pack the instance does not carry`);
26652
+ }
26653
+ const resolved = resolution.resolved[0];
26654
+ return executeApprovedInstallProjectPack(cfg, project2, resolved.name, resolved.content);
26655
+ }
26604
26656
  function executeApprovedListProjectPacks(cfg, project2) {
26605
26657
  return runWithProjectRoot(boundProject2(cfg, project2), () => storeListProjectPacks());
26606
26658
  }
@@ -30706,6 +30758,15 @@ function installGlobalPackArchive2(cfg, credential, archive, name) {
30706
30758
  function installProjectPackArchive2(cfg, credential, project2, archive, name) {
30707
30759
  return installProjectPackArchive(cfg, credential, project2, archive, name);
30708
30760
  }
30761
+ function listAvailableProfiles2(cfg, credential) {
30762
+ return listAvailableProfiles(cfg, credential);
30763
+ }
30764
+ function listAdoptableProjectPacks2(cfg, credential, project2) {
30765
+ return listAdoptableProjectPacks(cfg, credential, project2);
30766
+ }
30767
+ function adoptProjectPack2(cfg, credential, project2, name) {
30768
+ return adoptProjectPack(cfg, credential, project2, name);
30769
+ }
30709
30770
  function getPackPolicy2(cfg, credential) {
30710
30771
  return getPackPolicy(cfg, credential);
30711
30772
  }
@@ -33999,6 +34060,15 @@ function opsInstallGlobalPackArchive(cfg, sessionId, req, body, res) {
33999
34060
  function opsInstallProjectPackArchive(cfg, sessionId, req, url, body, res) {
34000
34061
  sendJson(res, 200, installProjectPackArchive2(cfg, sessionId, q(url, "projectId") ?? "", archiveBody(body), packNameOverride(req)));
34001
34062
  }
34063
+ function opsListAvailableProfiles(cfg, sessionId, res) {
34064
+ sendJson(res, 200, { profiles: listAvailableProfiles2(cfg, sessionId) });
34065
+ }
34066
+ function opsListAdoptableProjectPacks(cfg, sessionId, url, res) {
34067
+ sendJson(res, 200, { packs: listAdoptableProjectPacks2(cfg, sessionId, q(url, "projectId") ?? "") });
34068
+ }
34069
+ function opsAdoptProjectPack(cfg, sessionId, body, res) {
34070
+ sendJson(res, 200, adoptProjectPack2(cfg, sessionId, String(body?.projectId ?? ""), String(body?.name ?? "")));
34071
+ }
34002
34072
  function opsGetPackPolicy(cfg, sessionId, res) {
34003
34073
  sendJson(res, 200, getPackPolicy2(cfg, sessionId));
34004
34074
  }
@@ -34237,6 +34307,12 @@ async function handleWebRequest(cfg, req, res, body, url, ctx) {
34237
34307
  if (req.method === "POST" && parts.length === 4 && parts[2] === "packs" && parts[3] === "remove") {
34238
34308
  return opsRemoveProjectPack(cfg, sessionId, body, res);
34239
34309
  }
34310
+ if (req.method === "GET" && parts.length === 4 && parts[2] === "packs" && parts[3] === "adoptable") {
34311
+ return opsListAdoptableProjectPacks(cfg, sessionId, url, res);
34312
+ }
34313
+ if (req.method === "POST" && parts.length === 4 && parts[2] === "packs" && parts[3] === "adopt") {
34314
+ return opsAdoptProjectPack(cfg, sessionId, body, res);
34315
+ }
34240
34316
  if (req.method === "GET" && parts.length === 3 && parts[2] === "policy") {
34241
34317
  return opsPolicyEvaluate(cfg, sessionId, url, res);
34242
34318
  }
@@ -34350,6 +34426,9 @@ async function handleWebRequest(cfg, req, res, body, url, ctx) {
34350
34426
  if (req.method === "POST" && parts.length === 4 && parts[2] === "packs" && parts[3] === "remove") {
34351
34427
  return opsRemoveGlobalPack(cfg, sessionId, body, res);
34352
34428
  }
34429
+ if (req.method === "GET" && parts.length === 3 && parts[2] === "profiles") {
34430
+ return opsListAvailableProfiles(cfg, sessionId, res);
34431
+ }
34353
34432
  if (req.method === "GET" && parts.length === 3 && parts[2] === "policy") {
34354
34433
  return opsGetPackPolicy(cfg, sessionId, res);
34355
34434
  }
@@ -35151,6 +35230,7 @@ var WEB_MUTATION_PATHS = /* @__PURE__ */ new Set([
35151
35230
  "/web/projects/packs",
35152
35231
  "/web/projects/packs/upload",
35153
35232
  "/web/projects/packs/remove",
35233
+ "/web/projects/packs/adopt",
35154
35234
  "/web/projects/policy/reconcile",
35155
35235
  "/web/projects/producers",
35156
35236
  "/web/projects/producers/remove",