@elevasis/sdk 1.9.0 → 1.10.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/cli.cjs +207 -49
- package/dist/test-utils/index.d.ts +8273 -0
- package/dist/test-utils/index.js +20070 -0
- package/dist/types/worker/index.d.ts +20 -1
- package/dist/worker/index.js +3 -2
- package/package.json +8 -2
- package/reference/_navigation.md +15 -1
- package/reference/_reference-manifest.json +56 -0
- package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -0
- package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +1 -1
- package/reference/packages/core/src/test-utils/README.md +5 -10
- package/reference/packages/ui/src/test-utils/README.md +5 -0
- package/reference/scaffold/operations/workflow-recipes.md +94 -1
- package/reference/scaffold/recipes/add-a-feature.md +4 -4
- package/reference/scaffold/recipes/add-a-resource.md +1 -1
- package/reference/scaffold/recipes/customize-organization-model.md +2 -2
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -102,8 +102,8 @@ var require_package = __commonJS({
|
|
|
102
102
|
// ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
|
|
103
103
|
var require_main = __commonJS({
|
|
104
104
|
"../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
105
|
-
var
|
|
106
|
-
var
|
|
105
|
+
var fs2 = require("fs");
|
|
106
|
+
var path3 = require("path");
|
|
107
107
|
var os2 = require("os");
|
|
108
108
|
var crypto = require("crypto");
|
|
109
109
|
var packageJson = require_package();
|
|
@@ -211,7 +211,7 @@ var require_main = __commonJS({
|
|
|
211
211
|
if (options && options.path && options.path.length > 0) {
|
|
212
212
|
if (Array.isArray(options.path)) {
|
|
213
213
|
for (const filepath of options.path) {
|
|
214
|
-
if (
|
|
214
|
+
if (fs2.existsSync(filepath)) {
|
|
215
215
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -219,15 +219,15 @@ var require_main = __commonJS({
|
|
|
219
219
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
220
220
|
}
|
|
221
221
|
} else {
|
|
222
|
-
possibleVaultPath =
|
|
222
|
+
possibleVaultPath = path3.resolve(process.cwd(), ".env.vault");
|
|
223
223
|
}
|
|
224
|
-
if (
|
|
224
|
+
if (fs2.existsSync(possibleVaultPath)) {
|
|
225
225
|
return possibleVaultPath;
|
|
226
226
|
}
|
|
227
227
|
return null;
|
|
228
228
|
}
|
|
229
229
|
function _resolveHome(envPath2) {
|
|
230
|
-
return envPath2[0] === "~" ?
|
|
230
|
+
return envPath2[0] === "~" ? path3.join(os2.homedir(), envPath2.slice(1)) : envPath2;
|
|
231
231
|
}
|
|
232
232
|
function _configVault(options) {
|
|
233
233
|
const debug = Boolean(options && options.debug);
|
|
@@ -244,7 +244,7 @@ var require_main = __commonJS({
|
|
|
244
244
|
return { parsed };
|
|
245
245
|
}
|
|
246
246
|
function configDotenv(options) {
|
|
247
|
-
const dotenvPath =
|
|
247
|
+
const dotenvPath = path3.resolve(process.cwd(), ".env");
|
|
248
248
|
let encoding = "utf8";
|
|
249
249
|
const debug = Boolean(options && options.debug);
|
|
250
250
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -268,13 +268,13 @@ var require_main = __commonJS({
|
|
|
268
268
|
}
|
|
269
269
|
let lastError;
|
|
270
270
|
const parsedAll = {};
|
|
271
|
-
for (const
|
|
271
|
+
for (const path4 of optionPaths) {
|
|
272
272
|
try {
|
|
273
|
-
const parsed = DotenvModule.parse(
|
|
273
|
+
const parsed = DotenvModule.parse(fs2.readFileSync(path4, { encoding }));
|
|
274
274
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
275
275
|
} catch (e) {
|
|
276
276
|
if (debug) {
|
|
277
|
-
_debug(`Failed to load ${
|
|
277
|
+
_debug(`Failed to load ${path4} ${e.message}`);
|
|
278
278
|
}
|
|
279
279
|
lastError = e;
|
|
280
280
|
}
|
|
@@ -289,7 +289,7 @@ var require_main = __commonJS({
|
|
|
289
289
|
const shortPaths = [];
|
|
290
290
|
for (const filePath of optionPaths) {
|
|
291
291
|
try {
|
|
292
|
-
const relative =
|
|
292
|
+
const relative = path3.relative(process.cwd(), filePath);
|
|
293
293
|
shortPaths.push(relative);
|
|
294
294
|
} catch (e) {
|
|
295
295
|
if (debug) {
|
|
@@ -1284,8 +1284,8 @@ var require_command = __commonJS({
|
|
|
1284
1284
|
"../../node_modules/.pnpm/commander@11.1.0/node_modules/commander/lib/command.js"(exports2) {
|
|
1285
1285
|
var EventEmitter = require("events").EventEmitter;
|
|
1286
1286
|
var childProcess = require("child_process");
|
|
1287
|
-
var
|
|
1288
|
-
var
|
|
1287
|
+
var path3 = require("path");
|
|
1288
|
+
var fs2 = require("fs");
|
|
1289
1289
|
var process8 = require("process");
|
|
1290
1290
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1291
1291
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2108,10 +2108,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2108
2108
|
let launchWithNode = false;
|
|
2109
2109
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2110
2110
|
function findFile(baseDir, baseName) {
|
|
2111
|
-
const localBin =
|
|
2112
|
-
if (
|
|
2113
|
-
if (sourceExt.includes(
|
|
2114
|
-
const foundExt = sourceExt.find((ext) =>
|
|
2111
|
+
const localBin = path3.resolve(baseDir, baseName);
|
|
2112
|
+
if (fs2.existsSync(localBin)) return localBin;
|
|
2113
|
+
if (sourceExt.includes(path3.extname(baseName))) return void 0;
|
|
2114
|
+
const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${ext}`));
|
|
2115
2115
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2116
2116
|
return void 0;
|
|
2117
2117
|
}
|
|
@@ -2122,23 +2122,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2122
2122
|
if (this._scriptPath) {
|
|
2123
2123
|
let resolvedScriptPath;
|
|
2124
2124
|
try {
|
|
2125
|
-
resolvedScriptPath =
|
|
2125
|
+
resolvedScriptPath = fs2.realpathSync(this._scriptPath);
|
|
2126
2126
|
} catch (err) {
|
|
2127
2127
|
resolvedScriptPath = this._scriptPath;
|
|
2128
2128
|
}
|
|
2129
|
-
executableDir =
|
|
2129
|
+
executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
|
|
2130
2130
|
}
|
|
2131
2131
|
if (executableDir) {
|
|
2132
2132
|
let localFile = findFile(executableDir, executableFile);
|
|
2133
2133
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2134
|
-
const legacyName =
|
|
2134
|
+
const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
|
|
2135
2135
|
if (legacyName !== this._name) {
|
|
2136
2136
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
executableFile = localFile || executableFile;
|
|
2140
2140
|
}
|
|
2141
|
-
launchWithNode = sourceExt.includes(
|
|
2141
|
+
launchWithNode = sourceExt.includes(path3.extname(executableFile));
|
|
2142
2142
|
let proc;
|
|
2143
2143
|
if (process8.platform !== "win32") {
|
|
2144
2144
|
if (launchWithNode) {
|
|
@@ -2921,7 +2921,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2921
2921
|
* @return {Command}
|
|
2922
2922
|
*/
|
|
2923
2923
|
nameFromFilename(filename) {
|
|
2924
|
-
this._name =
|
|
2924
|
+
this._name = path3.basename(filename, path3.extname(filename));
|
|
2925
2925
|
return this;
|
|
2926
2926
|
}
|
|
2927
2927
|
/**
|
|
@@ -2935,9 +2935,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2935
2935
|
* @param {string} [path]
|
|
2936
2936
|
* @return {string|null|Command}
|
|
2937
2937
|
*/
|
|
2938
|
-
executableDir(
|
|
2939
|
-
if (
|
|
2940
|
-
this._executableDir =
|
|
2938
|
+
executableDir(path4) {
|
|
2939
|
+
if (path4 === void 0) return this._executableDir;
|
|
2940
|
+
this._executableDir = path4;
|
|
2941
2941
|
return this;
|
|
2942
2942
|
}
|
|
2943
2943
|
/**
|
|
@@ -8456,10 +8456,10 @@ var require_util = __commonJS({
|
|
|
8456
8456
|
function cloneDef2(schema) {
|
|
8457
8457
|
return mergeDefs2(schema._zod.def);
|
|
8458
8458
|
}
|
|
8459
|
-
function getElementAtPath2(obj,
|
|
8460
|
-
if (!
|
|
8459
|
+
function getElementAtPath2(obj, path3) {
|
|
8460
|
+
if (!path3)
|
|
8461
8461
|
return obj;
|
|
8462
|
-
return
|
|
8462
|
+
return path3.reduce((acc, key) => acc?.[key], obj);
|
|
8463
8463
|
}
|
|
8464
8464
|
function promiseAllObject2(promisesObj) {
|
|
8465
8465
|
const keys = Object.keys(promisesObj);
|
|
@@ -8821,11 +8821,11 @@ var require_util = __commonJS({
|
|
|
8821
8821
|
}
|
|
8822
8822
|
return false;
|
|
8823
8823
|
}
|
|
8824
|
-
function prefixIssues2(
|
|
8824
|
+
function prefixIssues2(path3, issues) {
|
|
8825
8825
|
return issues.map((iss) => {
|
|
8826
8826
|
var _a;
|
|
8827
8827
|
(_a = iss).path ?? (_a.path = []);
|
|
8828
|
-
iss.path.unshift(
|
|
8828
|
+
iss.path.unshift(path3);
|
|
8829
8829
|
return iss;
|
|
8830
8830
|
});
|
|
8831
8831
|
}
|
|
@@ -9029,7 +9029,7 @@ var require_errors2 = __commonJS({
|
|
|
9029
9029
|
}
|
|
9030
9030
|
function treeifyError2(error46, mapper = (issue2) => issue2.message) {
|
|
9031
9031
|
const result = { errors: [] };
|
|
9032
|
-
const processError = (error47,
|
|
9032
|
+
const processError = (error47, path3 = []) => {
|
|
9033
9033
|
var _a, _b;
|
|
9034
9034
|
for (const issue2 of error47.issues) {
|
|
9035
9035
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -9039,7 +9039,7 @@ var require_errors2 = __commonJS({
|
|
|
9039
9039
|
} else if (issue2.code === "invalid_element") {
|
|
9040
9040
|
processError({ issues: issue2.issues }, issue2.path);
|
|
9041
9041
|
} else {
|
|
9042
|
-
const fullpath = [...
|
|
9042
|
+
const fullpath = [...path3, ...issue2.path];
|
|
9043
9043
|
if (fullpath.length === 0) {
|
|
9044
9044
|
result.errors.push(mapper(issue2));
|
|
9045
9045
|
continue;
|
|
@@ -9071,8 +9071,8 @@ var require_errors2 = __commonJS({
|
|
|
9071
9071
|
}
|
|
9072
9072
|
function toDotPath2(_path) {
|
|
9073
9073
|
const segs = [];
|
|
9074
|
-
const
|
|
9075
|
-
for (const seg of
|
|
9074
|
+
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
9075
|
+
for (const seg of path3) {
|
|
9076
9076
|
if (typeof seg === "number")
|
|
9077
9077
|
segs.push(`[${seg}]`);
|
|
9078
9078
|
else if (typeof seg === "symbol")
|
|
@@ -24771,10 +24771,10 @@ function mergeDefs(...defs) {
|
|
|
24771
24771
|
function cloneDef(schema) {
|
|
24772
24772
|
return mergeDefs(schema._zod.def);
|
|
24773
24773
|
}
|
|
24774
|
-
function getElementAtPath(obj,
|
|
24775
|
-
if (!
|
|
24774
|
+
function getElementAtPath(obj, path3) {
|
|
24775
|
+
if (!path3)
|
|
24776
24776
|
return obj;
|
|
24777
|
-
return
|
|
24777
|
+
return path3.reduce((acc, key) => acc?.[key], obj);
|
|
24778
24778
|
}
|
|
24779
24779
|
function promiseAllObject(promisesObj) {
|
|
24780
24780
|
const keys = Object.keys(promisesObj);
|
|
@@ -25135,11 +25135,11 @@ function aborted(x, startIndex = 0) {
|
|
|
25135
25135
|
}
|
|
25136
25136
|
return false;
|
|
25137
25137
|
}
|
|
25138
|
-
function prefixIssues(
|
|
25138
|
+
function prefixIssues(path3, issues) {
|
|
25139
25139
|
return issues.map((iss) => {
|
|
25140
25140
|
var _a;
|
|
25141
25141
|
(_a = iss).path ?? (_a.path = []);
|
|
25142
|
-
iss.path.unshift(
|
|
25142
|
+
iss.path.unshift(path3);
|
|
25143
25143
|
return iss;
|
|
25144
25144
|
});
|
|
25145
25145
|
}
|
|
@@ -25301,7 +25301,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
|
|
|
25301
25301
|
}
|
|
25302
25302
|
function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
25303
25303
|
const result = { errors: [] };
|
|
25304
|
-
const processError = (error47,
|
|
25304
|
+
const processError = (error47, path3 = []) => {
|
|
25305
25305
|
var _a, _b;
|
|
25306
25306
|
for (const issue2 of error47.issues) {
|
|
25307
25307
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -25311,7 +25311,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
25311
25311
|
} else if (issue2.code === "invalid_element") {
|
|
25312
25312
|
processError({ issues: issue2.issues }, issue2.path);
|
|
25313
25313
|
} else {
|
|
25314
|
-
const fullpath = [...
|
|
25314
|
+
const fullpath = [...path3, ...issue2.path];
|
|
25315
25315
|
if (fullpath.length === 0) {
|
|
25316
25316
|
result.errors.push(mapper(issue2));
|
|
25317
25317
|
continue;
|
|
@@ -25343,8 +25343,8 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
25343
25343
|
}
|
|
25344
25344
|
function toDotPath(_path) {
|
|
25345
25345
|
const segs = [];
|
|
25346
|
-
const
|
|
25347
|
-
for (const seg of
|
|
25346
|
+
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
25347
|
+
for (const seg of path3) {
|
|
25348
25348
|
if (typeof seg === "number")
|
|
25349
25349
|
segs.push(`[${seg}]`);
|
|
25350
25350
|
else if (typeof seg === "symbol")
|
|
@@ -40447,7 +40447,9 @@ function resolveProjectRelative(relOrAbsPath) {
|
|
|
40447
40447
|
return (0, import_path.resolve)(getProjectRoot(), relOrAbsPath);
|
|
40448
40448
|
}
|
|
40449
40449
|
function findEnvFile(_startDir) {
|
|
40450
|
-
const
|
|
40450
|
+
const projectRoot = tryFindProjectRoot(process.cwd());
|
|
40451
|
+
if (projectRoot === null) return void 0;
|
|
40452
|
+
const candidate = (0, import_path.join)(projectRoot, ".env");
|
|
40451
40453
|
return (0, import_fs.existsSync)(candidate) ? candidate : void 0;
|
|
40452
40454
|
}
|
|
40453
40455
|
function findPackageRoot(startDir) {
|
|
@@ -40580,7 +40582,7 @@ function wrapAction(commandName, fn) {
|
|
|
40580
40582
|
// package.json
|
|
40581
40583
|
var package_default = {
|
|
40582
40584
|
name: "@elevasis/sdk",
|
|
40583
|
-
version: "1.
|
|
40585
|
+
version: "1.10.0",
|
|
40584
40586
|
description: "SDK for building Elevasis organization resources",
|
|
40585
40587
|
type: "module",
|
|
40586
40588
|
bin: {
|
|
@@ -40594,6 +40596,10 @@ var package_default = {
|
|
|
40594
40596
|
"./worker": {
|
|
40595
40597
|
types: "./dist/types/worker/index.d.ts",
|
|
40596
40598
|
import: "./dist/worker/index.js"
|
|
40599
|
+
},
|
|
40600
|
+
"./test-utils": {
|
|
40601
|
+
types: "./dist/test-utils/index.d.ts",
|
|
40602
|
+
import: "./dist/test-utils/index.js"
|
|
40597
40603
|
}
|
|
40598
40604
|
},
|
|
40599
40605
|
files: [
|
|
@@ -40603,6 +40609,8 @@ var package_default = {
|
|
|
40603
40609
|
"dist/types/worker/index.d.ts",
|
|
40604
40610
|
"dist/types/worker/platform.d.ts",
|
|
40605
40611
|
"dist/types/worker/adapters/",
|
|
40612
|
+
"dist/test-utils/index.js",
|
|
40613
|
+
"dist/test-utils/index.d.ts",
|
|
40606
40614
|
"dist/cli.cjs",
|
|
40607
40615
|
"reference/"
|
|
40608
40616
|
],
|
|
@@ -42956,9 +42964,151 @@ ${issues}`);
|
|
|
42956
42964
|
);
|
|
42957
42965
|
}
|
|
42958
42966
|
|
|
42959
|
-
// src/cli/commands/
|
|
42960
|
-
var
|
|
42967
|
+
// src/cli/commands/ui/ui-switcher.ts
|
|
42968
|
+
var import_node_child_process = require("node:child_process");
|
|
42969
|
+
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
42961
42970
|
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
42971
|
+
function run(command, args, cwd) {
|
|
42972
|
+
(0, import_node_child_process.execFileSync)(command, args, {
|
|
42973
|
+
cwd,
|
|
42974
|
+
stdio: "inherit",
|
|
42975
|
+
shell: process.platform === "win32"
|
|
42976
|
+
});
|
|
42977
|
+
}
|
|
42978
|
+
function readJson(filePath) {
|
|
42979
|
+
return JSON.parse(import_node_fs3.default.readFileSync(filePath, "utf8"));
|
|
42980
|
+
}
|
|
42981
|
+
function writeJson(filePath, value) {
|
|
42982
|
+
import_node_fs3.default.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
42983
|
+
`);
|
|
42984
|
+
}
|
|
42985
|
+
function requireDependencies(packageJson, filePath) {
|
|
42986
|
+
if (!packageJson.dependencies) {
|
|
42987
|
+
throw new Error(`${filePath} does not define dependencies`);
|
|
42988
|
+
}
|
|
42989
|
+
return packageJson.dependencies;
|
|
42990
|
+
}
|
|
42991
|
+
function resolveExistingDir(label, dir) {
|
|
42992
|
+
const resolved = import_node_path3.default.resolve(dir);
|
|
42993
|
+
if (!import_node_fs3.default.existsSync(resolved) || !import_node_fs3.default.statSync(resolved).isDirectory()) {
|
|
42994
|
+
throw new Error(`${label} not found: ${resolved}`);
|
|
42995
|
+
}
|
|
42996
|
+
return resolved;
|
|
42997
|
+
}
|
|
42998
|
+
function findRepoRootFromProject(projectRoot) {
|
|
42999
|
+
let dir = projectRoot;
|
|
43000
|
+
while (true) {
|
|
43001
|
+
if (import_node_fs3.default.existsSync(import_node_path3.default.join(dir, "packages", "ui", "package.json"))) return dir;
|
|
43002
|
+
const parent = import_node_path3.default.dirname(dir);
|
|
43003
|
+
if (parent === dir) return null;
|
|
43004
|
+
dir = parent;
|
|
43005
|
+
}
|
|
43006
|
+
}
|
|
43007
|
+
function resolveUiPackageRoot(projectRoot, explicitRoot) {
|
|
43008
|
+
if (explicitRoot) return resolveExistingDir("UI package root", explicitRoot);
|
|
43009
|
+
const repoRoot = findRepoRootFromProject(projectRoot);
|
|
43010
|
+
if (repoRoot === null) {
|
|
43011
|
+
throw new Error(
|
|
43012
|
+
"Could not find packages/ui from this Elevasis project. Pass --ui-package-root <path> from a monorepo checkout."
|
|
43013
|
+
);
|
|
43014
|
+
}
|
|
43015
|
+
return import_node_path3.default.join(repoRoot, "packages", "ui");
|
|
43016
|
+
}
|
|
43017
|
+
function removeLocalUiTarballs(templateTmpDir) {
|
|
43018
|
+
if (!import_node_fs3.default.existsSync(templateTmpDir)) return;
|
|
43019
|
+
for (const entry of import_node_fs3.default.readdirSync(templateTmpDir)) {
|
|
43020
|
+
if (entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz")) {
|
|
43021
|
+
import_node_fs3.default.rmSync(import_node_path3.default.join(templateTmpDir, entry), { force: true });
|
|
43022
|
+
}
|
|
43023
|
+
}
|
|
43024
|
+
}
|
|
43025
|
+
function prepareUiPackageForPack(uiPackageJson) {
|
|
43026
|
+
const publishConfig = uiPackageJson.publishConfig ?? {};
|
|
43027
|
+
const packedPackageJson = {
|
|
43028
|
+
...uiPackageJson,
|
|
43029
|
+
name: publishConfig.name ?? uiPackageJson.name
|
|
43030
|
+
};
|
|
43031
|
+
if (publishConfig.exports) packedPackageJson.exports = publishConfig.exports;
|
|
43032
|
+
if (publishConfig.peerDependencies) packedPackageJson.peerDependencies = publishConfig.peerDependencies;
|
|
43033
|
+
if (publishConfig.peerDependenciesMeta) packedPackageJson.peerDependenciesMeta = publishConfig.peerDependenciesMeta;
|
|
43034
|
+
delete packedPackageJson.publishConfig;
|
|
43035
|
+
return packedPackageJson;
|
|
43036
|
+
}
|
|
43037
|
+
function useLocalUi(options = {}) {
|
|
43038
|
+
const projectRoot = getProjectRoot();
|
|
43039
|
+
const repoRoot = findRepoRootFromProject(projectRoot);
|
|
43040
|
+
const uiPackageRoot = resolveUiPackageRoot(projectRoot, options.uiPackageRoot);
|
|
43041
|
+
const commandRoot = repoRoot ?? import_node_path3.default.dirname(import_node_path3.default.dirname(uiPackageRoot));
|
|
43042
|
+
const templateUiPackageJsonPath = import_node_path3.default.join(projectRoot, "ui", "package.json");
|
|
43043
|
+
const templateTmpDir = import_node_path3.default.join(projectRoot, "tmp");
|
|
43044
|
+
const uiPackageJsonPath = import_node_path3.default.join(uiPackageRoot, "package.json");
|
|
43045
|
+
const uiPackageBackupPath = import_node_path3.default.join(uiPackageRoot, "package.json.local-pack.bak");
|
|
43046
|
+
if (!import_node_fs3.default.existsSync(templateUiPackageJsonPath)) {
|
|
43047
|
+
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
43048
|
+
}
|
|
43049
|
+
import_node_fs3.default.mkdirSync(templateTmpDir, { recursive: true });
|
|
43050
|
+
removeLocalUiTarballs(templateTmpDir);
|
|
43051
|
+
run("pnpm", ["--filter", "@repo/ui", "build:publish"], commandRoot);
|
|
43052
|
+
try {
|
|
43053
|
+
const raw = import_node_fs3.default.readFileSync(uiPackageJsonPath, "utf8");
|
|
43054
|
+
import_node_fs3.default.writeFileSync(uiPackageBackupPath, raw);
|
|
43055
|
+
writeJson(uiPackageJsonPath, prepareUiPackageForPack(JSON.parse(raw)));
|
|
43056
|
+
run("pnpm", ["-C", uiPackageRoot, "pack", "--pack-destination", templateTmpDir], commandRoot);
|
|
43057
|
+
} finally {
|
|
43058
|
+
if (import_node_fs3.default.existsSync(uiPackageBackupPath)) {
|
|
43059
|
+
import_node_fs3.default.copyFileSync(uiPackageBackupPath, uiPackageJsonPath);
|
|
43060
|
+
import_node_fs3.default.rmSync(uiPackageBackupPath, { force: true });
|
|
43061
|
+
}
|
|
43062
|
+
}
|
|
43063
|
+
const tarballName = import_node_fs3.default.readdirSync(templateTmpDir).find((entry) => entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz"));
|
|
43064
|
+
if (!tarballName) {
|
|
43065
|
+
throw new Error(`Failed to create local @elevasis/ui tarball in ${templateTmpDir}`);
|
|
43066
|
+
}
|
|
43067
|
+
const templateUiPackageJson = readJson(templateUiPackageJsonPath);
|
|
43068
|
+
requireDependencies(templateUiPackageJson, templateUiPackageJsonPath)["@elevasis/ui"] = `file:../tmp/${tarballName}`;
|
|
43069
|
+
writeJson(templateUiPackageJsonPath, templateUiPackageJson);
|
|
43070
|
+
run("pnpm", ["-C", projectRoot, "install"], commandRoot);
|
|
43071
|
+
console.log(`${import_node_path3.default.basename(projectRoot)}/ui now uses local @elevasis/ui tarball: ${tarballName}`);
|
|
43072
|
+
}
|
|
43073
|
+
function usePublishedUi(options = {}) {
|
|
43074
|
+
const projectRoot = getProjectRoot();
|
|
43075
|
+
const repoRoot = findRepoRootFromProject(projectRoot);
|
|
43076
|
+
const commandRoot = repoRoot ?? projectRoot;
|
|
43077
|
+
const templateUiPackageJsonPath = import_node_path3.default.join(projectRoot, "ui", "package.json");
|
|
43078
|
+
const templateTmpDir = import_node_path3.default.join(projectRoot, "tmp");
|
|
43079
|
+
const uiPackageRoot = options.version ? void 0 : resolveUiPackageRoot(projectRoot, options.uiPackageRoot);
|
|
43080
|
+
const uiVersion = options.version ?? readJson(import_node_path3.default.join(uiPackageRoot, "package.json")).version;
|
|
43081
|
+
if (!uiVersion) {
|
|
43082
|
+
throw new Error("Could not determine @elevasis/ui version. Pass --version <version>.");
|
|
43083
|
+
}
|
|
43084
|
+
if (!import_node_fs3.default.existsSync(templateUiPackageJsonPath)) {
|
|
43085
|
+
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
43086
|
+
}
|
|
43087
|
+
const templateUiPackageJson = readJson(templateUiPackageJsonPath);
|
|
43088
|
+
requireDependencies(templateUiPackageJson, templateUiPackageJsonPath)["@elevasis/ui"] = `^${uiVersion}`;
|
|
43089
|
+
writeJson(templateUiPackageJsonPath, templateUiPackageJson);
|
|
43090
|
+
removeLocalUiTarballs(templateTmpDir);
|
|
43091
|
+
run("pnpm", ["-C", projectRoot, "install"], commandRoot);
|
|
43092
|
+
console.log(`${import_node_path3.default.basename(projectRoot)}/ui restored to published @elevasis/ui ^${uiVersion}`);
|
|
43093
|
+
}
|
|
43094
|
+
|
|
43095
|
+
// src/cli/commands/ui/ui.ts
|
|
43096
|
+
function registerUiCommands(program3) {
|
|
43097
|
+
program3.command("ui:use-local").description("Switch this Elevasis project to a local @elevasis/ui tarball").option("--ui-package-root <path>", "Path to the local packages/ui checkout").action(
|
|
43098
|
+
wrapAction("ui:use-local", async (options) => {
|
|
43099
|
+
useLocalUi(options);
|
|
43100
|
+
})
|
|
43101
|
+
);
|
|
43102
|
+
program3.command("ui:use-published").description("Restore this Elevasis project to a published @elevasis/ui dependency").option("--ui-package-root <path>", "Path to the local packages/ui checkout used to infer the version").option("--version <version>", "Explicit @elevasis/ui version to restore").action(
|
|
43103
|
+
wrapAction("ui:use-published", async (options) => {
|
|
43104
|
+
usePublishedUi(options);
|
|
43105
|
+
})
|
|
43106
|
+
);
|
|
43107
|
+
}
|
|
43108
|
+
|
|
43109
|
+
// src/cli/commands/doctor.ts
|
|
43110
|
+
var import_node_fs4 = require("node:fs");
|
|
43111
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
42962
43112
|
function ok(label, detail) {
|
|
42963
43113
|
console.log(`${source_default.green("[OK]")} ${source_default.bold(label)}: ${detail}`);
|
|
42964
43114
|
}
|
|
@@ -42994,8 +43144,8 @@ function registerDoctorCommand(program3) {
|
|
|
42994
43144
|
printSummary(failCount);
|
|
42995
43145
|
process.exit(1);
|
|
42996
43146
|
}
|
|
42997
|
-
const envPath2 =
|
|
42998
|
-
const envExists = (0,
|
|
43147
|
+
const envPath2 = import_node_path4.default.join(projectRoot, ".env");
|
|
43148
|
+
const envExists = (0, import_node_fs4.existsSync)(envPath2);
|
|
42999
43149
|
if (!envExists) {
|
|
43000
43150
|
fail(".env", `Not found at ${envPath2}. Create it from .env.example and fill in ELEVASIS_PLATFORM_KEY.`);
|
|
43001
43151
|
if (isVerbose) verbose(`Checked: ${envPath2}`);
|
|
@@ -43084,11 +43234,15 @@ function printSummary(failCount) {
|
|
|
43084
43234
|
|
|
43085
43235
|
// src/cli/index.ts
|
|
43086
43236
|
var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
43237
|
+
var LOCAL_PROJECT_COMMANDS = /* @__PURE__ */ new Set(["ui:use-local", "ui:use-published"]);
|
|
43087
43238
|
function shouldSkipPreflight() {
|
|
43088
43239
|
const args = process.argv.slice(2);
|
|
43089
43240
|
if (args.length === 0) return true;
|
|
43090
43241
|
return args.every((a) => PREFLIGHT_SKIP_FLAGS.has(a));
|
|
43091
43242
|
}
|
|
43243
|
+
function isLocalProjectCommand() {
|
|
43244
|
+
return LOCAL_PROJECT_COMMANDS.has(process.argv[2] ?? "");
|
|
43245
|
+
}
|
|
43092
43246
|
function runPreflight() {
|
|
43093
43247
|
if (shouldSkipPreflight()) return;
|
|
43094
43248
|
const projectRoot = tryFindProjectRoot(process.cwd());
|
|
@@ -43101,6 +43255,7 @@ function runPreflight() {
|
|
|
43101
43255
|
);
|
|
43102
43256
|
process.exit(1);
|
|
43103
43257
|
}
|
|
43258
|
+
if (isLocalProjectCommand()) return;
|
|
43104
43259
|
const envPath2 = (0, import_path3.join)(projectRoot, ".env");
|
|
43105
43260
|
if (!(0, import_fs2.existsSync)(envPath2)) {
|
|
43106
43261
|
process.stderr.write(source_default.red(`No \`.env\` found at \`${envPath2}\`. Set \`ELEVASIS_PLATFORM_KEY\`.
|
|
@@ -43142,6 +43297,8 @@ Commands:
|
|
|
43142
43297
|
elevasis-sdk project:resolve <query> Resolve a project ID from a name or UUID
|
|
43143
43298
|
elevasis-sdk project:work <query> Open a lifecycle-aware project work brief
|
|
43144
43299
|
elevasis-sdk request:submit -f <path> Submit a structured request report
|
|
43300
|
+
elevasis-sdk ui:use-local Use a local @elevasis/ui tarball
|
|
43301
|
+
elevasis-sdk ui:use-published Restore published @elevasis/ui
|
|
43145
43302
|
elevasis-sdk rename <id> --to <newId> [--prod] Rename resource across platform tables
|
|
43146
43303
|
elevasis-sdk doctor [--verbose] Check project environment and API connectivity
|
|
43147
43304
|
|
|
@@ -43163,6 +43320,7 @@ registerErrorCommand(program2);
|
|
|
43163
43320
|
registerRenameCommand(program2);
|
|
43164
43321
|
registerProjectCommands(program2);
|
|
43165
43322
|
registerRequestCommands(program2);
|
|
43323
|
+
registerUiCommands(program2);
|
|
43166
43324
|
registerDoctorCommand(program2);
|
|
43167
43325
|
program2.parse();
|
|
43168
43326
|
// Annotate the CommonJS export names for ESM import in node:
|