@wairon/cli 5.0.2-dev.10 → 5.0.2-dev.11
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 +176 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +51 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6208,6 +6208,16 @@ var init_type_references = __esm({
|
|
|
6208
6208
|
}
|
|
6209
6209
|
});
|
|
6210
6210
|
|
|
6211
|
+
// src/utils/filenames.ts
|
|
6212
|
+
function safeFilenamePart(value) {
|
|
6213
|
+
return value.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
6214
|
+
}
|
|
6215
|
+
var init_filenames = __esm({
|
|
6216
|
+
"src/utils/filenames.ts"() {
|
|
6217
|
+
"use strict";
|
|
6218
|
+
}
|
|
6219
|
+
});
|
|
6220
|
+
|
|
6211
6221
|
// src/core/statehash.ts
|
|
6212
6222
|
function computeStateId() {
|
|
6213
6223
|
const tree = {
|
|
@@ -6738,29 +6748,53 @@ function removeSnapshot(projectName, rootDir = getProjectRoot()) {
|
|
|
6738
6748
|
function loadSurfaceSnapshots() {
|
|
6739
6749
|
return listSnapshots();
|
|
6740
6750
|
}
|
|
6741
|
-
function
|
|
6742
|
-
const
|
|
6743
|
-
|
|
6751
|
+
function selectPortalSpec(renderedSet, portalId) {
|
|
6752
|
+
const hit = renderedSet.find((spec) => spec.portalId === portalId);
|
|
6753
|
+
if (!hit) {
|
|
6754
|
+
const known = renderedSet.map((s) => s.portalId).join(", ");
|
|
6755
|
+
throw new Error(`Unknown portal "${portalId}" \u2014 this surface renders: ${known || "(no portals)"}.`);
|
|
6756
|
+
}
|
|
6757
|
+
return [hit];
|
|
6758
|
+
}
|
|
6759
|
+
function perPortalPath(resolvedOut, portalId) {
|
|
6760
|
+
const ext = path5.extname(resolvedOut);
|
|
6761
|
+
const stem = ext ? resolvedOut.slice(0, -ext.length) : resolvedOut;
|
|
6762
|
+
return `${stem}.${safeFilenamePart(portalId)}${ext}`;
|
|
6744
6763
|
}
|
|
6745
|
-
function writeSurfaceFile(outPath,
|
|
6764
|
+
function writeSurfaceFile(outPath, snapshot, renderedSet) {
|
|
6746
6765
|
const resolved = path5.resolve(outPath);
|
|
6747
6766
|
fs4.mkdirSync(path5.dirname(resolved), { recursive: true });
|
|
6748
|
-
if (
|
|
6749
|
-
|
|
6750
|
-
|
|
6767
|
+
if (!renderedSet || renderedSet.length === 0) {
|
|
6768
|
+
writeYamlFile(resolved, snapshot);
|
|
6769
|
+
return [resolved];
|
|
6770
|
+
}
|
|
6771
|
+
if (renderedSet.length === 1) {
|
|
6772
|
+
fs4.writeFileSync(resolved, renderedSet[0].document);
|
|
6773
|
+
return [resolved];
|
|
6774
|
+
}
|
|
6775
|
+
return renderedSet.map((spec) => {
|
|
6776
|
+
const target = perPortalPath(resolved, spec.portalId);
|
|
6777
|
+
fs4.writeFileSync(target, spec.document);
|
|
6778
|
+
return target;
|
|
6779
|
+
});
|
|
6751
6780
|
}
|
|
6752
|
-
function
|
|
6753
|
-
const
|
|
6754
|
-
const openapi = format === "openapi" ? renderOpenApiForms(snapshot) : void 0;
|
|
6755
|
-
const body = openapi?.rendered ?? openapi?.renderedSet[0]?.document;
|
|
6756
|
-
const writtenTo = outPath ? writeSurfaceFile(outPath, body, snapshot) : void 0;
|
|
6781
|
+
function exportResult(snapshot, renderedSet, writtenPaths) {
|
|
6782
|
+
const rendered = renderedSet?.length === 1 ? renderedSet[0].document : void 0;
|
|
6757
6783
|
return {
|
|
6758
6784
|
snapshot,
|
|
6759
|
-
...
|
|
6760
|
-
...
|
|
6761
|
-
...
|
|
6785
|
+
...rendered !== void 0 ? { rendered } : {},
|
|
6786
|
+
...renderedSet ? { renderedSet } : {},
|
|
6787
|
+
...writtenPaths.length === 1 ? { writtenTo: writtenPaths[0] } : {},
|
|
6788
|
+
...writtenPaths.length ? { writtenPaths } : {}
|
|
6762
6789
|
};
|
|
6763
6790
|
}
|
|
6791
|
+
function exportSurface(maxAudience, format, outPath, portalId) {
|
|
6792
|
+
const snapshot = projectOwnSurface(maxAudience);
|
|
6793
|
+
let renderedSet = format === "openapi" ? toOpenApiSet(snapshot) : void 0;
|
|
6794
|
+
if (renderedSet && portalId) renderedSet = selectPortalSpec(renderedSet, portalId);
|
|
6795
|
+
const writtenPaths = outPath ? writeSurfaceFile(outPath, snapshot, renderedSet) : [];
|
|
6796
|
+
return exportResult(snapshot, renderedSet, writtenPaths);
|
|
6797
|
+
}
|
|
6764
6798
|
function importSurface(sourcePath, origin) {
|
|
6765
6799
|
const resolved = path5.resolve(sourcePath);
|
|
6766
6800
|
if (!fs4.existsSync(resolved)) {
|
|
@@ -6825,6 +6859,7 @@ var init_surfaces = __esm({
|
|
|
6825
6859
|
path5 = __toESM(require("path"));
|
|
6826
6860
|
init_fs();
|
|
6827
6861
|
init_yaml();
|
|
6862
|
+
init_filenames();
|
|
6828
6863
|
init_models();
|
|
6829
6864
|
init_specs2();
|
|
6830
6865
|
init_statehash();
|
|
@@ -15690,7 +15725,7 @@ function defaultTargetConfig(type) {
|
|
|
15690
15725
|
enabled: true
|
|
15691
15726
|
};
|
|
15692
15727
|
}
|
|
15693
|
-
var WAIRON_VERSION = "5.0.2-dev.
|
|
15728
|
+
var WAIRON_VERSION = "5.0.2-dev.11";
|
|
15694
15729
|
var GITHUB_REPO = "SYW-Apps/Waffle-AIron";
|
|
15695
15730
|
var ARCHITECT_AGENT_ID = "agent-architect";
|
|
15696
15731
|
var ARCHITECT_TEMPLATE_ID = "architect";
|