@lotics/cli 0.96.4 → 0.96.5
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/src/cli.js +20 -0
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -70166,6 +70166,16 @@ function runNpm(args, cwd) {
|
|
|
70166
70166
|
});
|
|
70167
70167
|
});
|
|
70168
70168
|
}
|
|
70169
|
+
function readAppWorkspaceId(projectDir) {
|
|
70170
|
+
try {
|
|
70171
|
+
const pkgPath2 = path5.join(projectDir, "package.json");
|
|
70172
|
+
if (!fs4.existsSync(pkgPath2)) return null;
|
|
70173
|
+
const pkg2 = JSON.parse(fs4.readFileSync(pkgPath2, "utf-8"));
|
|
70174
|
+
return pkg2.lotics?.workspace_id ?? null;
|
|
70175
|
+
} catch {
|
|
70176
|
+
return null;
|
|
70177
|
+
}
|
|
70178
|
+
}
|
|
70169
70179
|
function readAppMeta(projectDir) {
|
|
70170
70180
|
const pkgPath2 = path5.join(projectDir, "package.json");
|
|
70171
70181
|
if (!fs4.existsSync(pkgPath2)) {
|
|
@@ -91542,6 +91552,14 @@ function announceTarget(ctx, workspaceId) {
|
|
|
91542
91552
|
}
|
|
91543
91553
|
console.error(`lotics \u2192 ${org} / ${workspaceId}`);
|
|
91544
91554
|
}
|
|
91555
|
+
function applyAppManifestWorkspace(ctx, command, subcommand, pathArg, flags) {
|
|
91556
|
+
if (command !== "app") return;
|
|
91557
|
+
if (flags.workspace || process.env.LOTICS_WORKSPACE) return;
|
|
91558
|
+
if (subcommand === "create" || subcommand === "pull") return;
|
|
91559
|
+
const dir = pathArg && !pathArg.startsWith("-") ? pathArg : process.cwd();
|
|
91560
|
+
const workspaceId = readAppWorkspaceId(dir);
|
|
91561
|
+
if (workspaceId) ctx.workspaceId = workspaceId;
|
|
91562
|
+
}
|
|
91545
91563
|
async function resolveWorkspace(client, ctx) {
|
|
91546
91564
|
if (ctx.workspaceId) {
|
|
91547
91565
|
announceTarget(ctx, ctx.workspaceId);
|
|
@@ -91744,6 +91762,7 @@ async function main() {
|
|
|
91744
91762
|
await appCodegen({ projectDir });
|
|
91745
91763
|
return;
|
|
91746
91764
|
}
|
|
91765
|
+
applyAppManifestWorkspace(ctx2, command, subcommand, projectDir, flags);
|
|
91747
91766
|
const viewAsMemberId = flags.viewAs ?? process.env.LOTICS_VIEW_AS;
|
|
91748
91767
|
const client2 = new LoticsClient({ apiKey: ctx2.apiKey, workspaceId: ctx2.workspaceId, viewAsMemberId });
|
|
91749
91768
|
await resolveWorkspace(client2, ctx2);
|
|
@@ -91969,6 +91988,7 @@ Available workspaces:`);
|
|
|
91969
91988
|
if (ctx.orgName) console.error(`Org: ${ctx.orgName}`);
|
|
91970
91989
|
return;
|
|
91971
91990
|
}
|
|
91991
|
+
applyAppManifestWorkspace(ctx, command, subcommand, subcommand === "dev" ? toolArgs : void 0, flags);
|
|
91972
91992
|
await resolveWorkspace(client, ctx);
|
|
91973
91993
|
if (command === "knowledge") {
|
|
91974
91994
|
await runKnowledgeCommand(client, subcommand, toolArgs, flags);
|