@diafunc/cli 0.9.0 → 0.9.2
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/bin/diafunc.js +3 -3
- package/dist/{chunk-2JCGI7M5.js → chunk-CBSJB5GC.js} +2 -2
- package/dist/{chunk-LTQLKVDU.js → chunk-SOXLUOWV.js} +129 -42
- package/dist/chunk-SOXLUOWV.js.map +1 -0
- package/dist/{chunk-GQBGVUCT.js → chunk-WPZBLPVY.js} +2 -2
- package/dist/{chunk-GQBGVUCT.js.map → chunk-WPZBLPVY.js.map} +1 -1
- package/dist/src/index.js +2 -2
- package/dist/update-check-JKIWTPFB.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-LTQLKVDU.js.map +0 -1
- package/dist/update-check-UOHMHDN6.js +0 -8
- /package/dist/{chunk-2JCGI7M5.js.map → chunk-CBSJB5GC.js.map} +0 -0
- /package/dist/{update-check-UOHMHDN6.js.map → update-check-JKIWTPFB.js.map} +0 -0
package/dist/bin/diafunc.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createProgram
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-SOXLUOWV.js";
|
|
5
5
|
import {
|
|
6
6
|
getUpdateNotice
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-CBSJB5GC.js";
|
|
8
8
|
import {
|
|
9
9
|
package_default
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-WPZBLPVY.js";
|
|
11
11
|
|
|
12
12
|
// bin/diafunc.ts
|
|
13
13
|
import chalk2 from "chalk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WPZBLPVY.js";
|
|
4
4
|
|
|
5
5
|
// src/util/update-check.ts
|
|
6
6
|
import * as fs from "fs";
|
|
@@ -72,4 +72,4 @@ async function getUpdateNotice() {
|
|
|
72
72
|
export {
|
|
73
73
|
getUpdateNotice
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-CBSJB5GC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WPZBLPVY.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import { Command } from "commander";
|
|
@@ -71,7 +71,7 @@ var ApiError = class _ApiError extends Error {
|
|
|
71
71
|
case 401:
|
|
72
72
|
return `Authentication failed. Run 'diafunc auth login' to configure your credentials.`;
|
|
73
73
|
case 403:
|
|
74
|
-
return `Permission denied
|
|
74
|
+
return this.message ? `Permission denied: ${this.message}${this.details ? ` (${this.details})` : ""}` : `Permission denied. Your token may not have the required scope.`;
|
|
75
75
|
case 404:
|
|
76
76
|
return `Not found: ${this.message}`;
|
|
77
77
|
case 409:
|
|
@@ -243,11 +243,15 @@ ${bodyPreview}`);
|
|
|
243
243
|
if (!response.ok) {
|
|
244
244
|
throw await parseErrorBody(response);
|
|
245
245
|
}
|
|
246
|
+
if (response.status === 204) {
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
246
249
|
const contentType = response.headers.get("content-type") ?? "";
|
|
250
|
+
const text = await response.text();
|
|
247
251
|
if (contentType.includes("application/json")) {
|
|
248
|
-
return
|
|
252
|
+
return text ? JSON.parse(text) : void 0;
|
|
249
253
|
}
|
|
250
|
-
return
|
|
254
|
+
return text;
|
|
251
255
|
},
|
|
252
256
|
async requestRaw(opts) {
|
|
253
257
|
const response = await doRequest(opts);
|
|
@@ -885,7 +889,8 @@ import chalk5 from "chalk";
|
|
|
885
889
|
// src/output/human.ts
|
|
886
890
|
import chalk4 from "chalk";
|
|
887
891
|
import Table from "cli-table3";
|
|
888
|
-
function formatHuman(data, columns) {
|
|
892
|
+
function formatHuman(data, columns, dateColumns) {
|
|
893
|
+
const isDate = (key) => dateColumns?.includes(key) ?? false;
|
|
889
894
|
if (Array.isArray(data)) {
|
|
890
895
|
if (data.length === 0) {
|
|
891
896
|
console.log(chalk4.dim("No results."));
|
|
@@ -898,7 +903,7 @@ function formatHuman(data, columns) {
|
|
|
898
903
|
});
|
|
899
904
|
for (const row of data) {
|
|
900
905
|
const r = row;
|
|
901
|
-
table.push(cols.map((c) => formatValue(r[c])));
|
|
906
|
+
table.push(cols.map((c) => formatValue(r[c], isDate(c))));
|
|
902
907
|
}
|
|
903
908
|
console.log(table.toString());
|
|
904
909
|
} else if (data && typeof data === "object") {
|
|
@@ -907,17 +912,27 @@ function formatHuman(data, columns) {
|
|
|
907
912
|
style: { head: [], border: [] }
|
|
908
913
|
});
|
|
909
914
|
for (const [key, value] of Object.entries(obj)) {
|
|
910
|
-
table.push({ [chalk4.bold(key)]: formatValue(value) });
|
|
915
|
+
table.push({ [chalk4.bold(key)]: formatValue(value, isDate(key)) });
|
|
911
916
|
}
|
|
912
917
|
console.log(table.toString());
|
|
913
918
|
} else {
|
|
914
919
|
console.log(String(data));
|
|
915
920
|
}
|
|
916
921
|
}
|
|
917
|
-
function formatValue(value) {
|
|
922
|
+
function formatValue(value, asDate = false) {
|
|
918
923
|
if (value === null || value === void 0) return chalk4.dim("\u2014");
|
|
924
|
+
if (asDate) return formatInstant(value);
|
|
919
925
|
if (typeof value === "boolean") return value ? chalk4.green("true") : chalk4.red("false");
|
|
920
926
|
if (typeof value === "number") return chalk4.cyan(String(value));
|
|
927
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
928
|
+
return String(value);
|
|
929
|
+
}
|
|
930
|
+
function formatInstant(value) {
|
|
931
|
+
if (value === null || value === void 0) return chalk4.dim("\u2014");
|
|
932
|
+
if (typeof value === "number") {
|
|
933
|
+
const d = new Date(value);
|
|
934
|
+
return Number.isNaN(d.getTime()) ? String(value) : d.toISOString().replace("T", " ").slice(0, 19);
|
|
935
|
+
}
|
|
921
936
|
return String(value);
|
|
922
937
|
}
|
|
923
938
|
|
|
@@ -934,17 +949,22 @@ function formatTable(data, columns) {
|
|
|
934
949
|
console.log(cols.join(" "));
|
|
935
950
|
for (const row of data) {
|
|
936
951
|
const r = row;
|
|
937
|
-
console.log(cols.map((c) =>
|
|
952
|
+
console.log(cols.map((c) => cell(r[c])).join(" "));
|
|
938
953
|
}
|
|
939
954
|
} else if (data && typeof data === "object") {
|
|
940
955
|
const obj = data;
|
|
941
956
|
for (const [key, value] of Object.entries(obj)) {
|
|
942
|
-
console.log(`${key} ${
|
|
957
|
+
console.log(`${key} ${cell(value)}`);
|
|
943
958
|
}
|
|
944
959
|
} else {
|
|
945
960
|
console.log(String(data));
|
|
946
961
|
}
|
|
947
962
|
}
|
|
963
|
+
function cell(value) {
|
|
964
|
+
if (value === null || value === void 0) return "";
|
|
965
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
966
|
+
return String(value);
|
|
967
|
+
}
|
|
948
968
|
|
|
949
969
|
// src/output/formatter.ts
|
|
950
970
|
function format(data, options) {
|
|
@@ -957,7 +977,7 @@ function format(data, options) {
|
|
|
957
977
|
break;
|
|
958
978
|
case "human":
|
|
959
979
|
default:
|
|
960
|
-
formatHuman(data, options.columns);
|
|
980
|
+
formatHuman(data, options.columns, options.dateColumns);
|
|
961
981
|
break;
|
|
962
982
|
}
|
|
963
983
|
}
|
|
@@ -2661,6 +2681,22 @@ async function pollUntilFinished(storage, projectId, projectBranch, bundleId, in
|
|
|
2661
2681
|
throw new Error(`Export ${bundleId} did not finish within the timeout \u2014 poll it with 'diafunc notebook bundles'`);
|
|
2662
2682
|
}
|
|
2663
2683
|
|
|
2684
|
+
// src/util/function-language.ts
|
|
2685
|
+
var DEFAULT_FUNCTION_LANGUAGE = "Java";
|
|
2686
|
+
async function resolveLanguage(api, projectId, explicit) {
|
|
2687
|
+
if (explicit) {
|
|
2688
|
+
return explicit;
|
|
2689
|
+
}
|
|
2690
|
+
try {
|
|
2691
|
+
const project = await api.admin.getProject(projectId);
|
|
2692
|
+
if (project?.language) {
|
|
2693
|
+
return project.language;
|
|
2694
|
+
}
|
|
2695
|
+
} catch {
|
|
2696
|
+
}
|
|
2697
|
+
return DEFAULT_FUNCTION_LANGUAGE;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2664
2700
|
// src/commands/project/index.ts
|
|
2665
2701
|
function getOutputFormat(cmd) {
|
|
2666
2702
|
const config = loadConfig();
|
|
@@ -2696,7 +2732,7 @@ function registerProjectCommands(program) {
|
|
|
2696
2732
|
handleError(error);
|
|
2697
2733
|
}
|
|
2698
2734
|
});
|
|
2699
|
-
project.command("create").description("Create a new project").option("--visibility <visibility>", "Project visibility (PRIVATE or PUBLIC)", "PRIVATE").option("--language <language>", "
|
|
2735
|
+
project.command("create").description("Create a new project").option("--visibility <visibility>", "Project visibility (PRIVATE or PUBLIC)", "PRIVATE").option("--language <language>", "The project's default language for functions (Java, Kotlin, Python, JavaScript, Scala)", DEFAULT_FUNCTION_LANGUAGE).action(async (options, cmd) => {
|
|
2700
2736
|
try {
|
|
2701
2737
|
const outputFormat = getOutputFormat(cmd);
|
|
2702
2738
|
const api = createApiClient();
|
|
@@ -2901,6 +2937,31 @@ function parseCount(value, label) {
|
|
|
2901
2937
|
}
|
|
2902
2938
|
return count;
|
|
2903
2939
|
}
|
|
2940
|
+
function formatMoney(cents, currency) {
|
|
2941
|
+
const sign = cents < 0 ? "-" : "";
|
|
2942
|
+
const abs = Math.abs(cents);
|
|
2943
|
+
return `${sign}${(abs / 100).toFixed(2)} ${currency.toUpperCase()}`;
|
|
2944
|
+
}
|
|
2945
|
+
function printInvoicePreview(preview, outputFormat) {
|
|
2946
|
+
if (outputFormat === "json") {
|
|
2947
|
+
format(preview, { format: outputFormat });
|
|
2948
|
+
return;
|
|
2949
|
+
}
|
|
2950
|
+
format(
|
|
2951
|
+
preview.lineItems.map((item) => ({
|
|
2952
|
+
description: item.description,
|
|
2953
|
+
amount: formatMoney(item.amountCents, preview.currency)
|
|
2954
|
+
})),
|
|
2955
|
+
{ format: outputFormat, columns: ["description", "amount"] }
|
|
2956
|
+
);
|
|
2957
|
+
console.log(`Total: ${formatMoney(preview.totalCents, preview.currency)}`);
|
|
2958
|
+
if (preview.nextBillingDate) {
|
|
2959
|
+
const next = preview.nextBillingAmountCents;
|
|
2960
|
+
console.log(
|
|
2961
|
+
`Next bill: ${preview.nextBillingDate}` + (next !== null && next !== void 0 ? ` for ${formatMoney(next, preview.currency)}` : "")
|
|
2962
|
+
);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2904
2965
|
function registerTeamCommands(program) {
|
|
2905
2966
|
const team = program.command("team").description("Manage teams: membership, invitations, seats, billing, and ownership");
|
|
2906
2967
|
team.command("list", { isDefault: true }).description("List the teams you belong to").action(async (_options, cmd) => {
|
|
@@ -2909,7 +2970,8 @@ function registerTeamCommands(program) {
|
|
|
2909
2970
|
const teams = await api.admin.listMyTeams();
|
|
2910
2971
|
format(teams, {
|
|
2911
2972
|
format: getOutputFormat2(cmd),
|
|
2912
|
-
columns: ["id", "name", "planId", "seatCount", "packCount", "renewal"]
|
|
2973
|
+
columns: ["id", "name", "planId", "seatCount", "packCount", "renewal"],
|
|
2974
|
+
dateColumns: ["createdAt", "dunningStartedAt"]
|
|
2913
2975
|
});
|
|
2914
2976
|
} catch (error) {
|
|
2915
2977
|
handleError(error);
|
|
@@ -2918,7 +2980,10 @@ function registerTeamCommands(program) {
|
|
|
2918
2980
|
team.command("get").description("Show a team").argument("<teamId>", "Team ID").action(async (teamId, _options, cmd) => {
|
|
2919
2981
|
try {
|
|
2920
2982
|
const api = createApiClient();
|
|
2921
|
-
format(await api.admin.getTeam(teamId), {
|
|
2983
|
+
format(await api.admin.getTeam(teamId), {
|
|
2984
|
+
format: getOutputFormat2(cmd),
|
|
2985
|
+
dateColumns: ["createdAt", "dunningStartedAt"]
|
|
2986
|
+
});
|
|
2922
2987
|
} catch (error) {
|
|
2923
2988
|
handleError(error);
|
|
2924
2989
|
}
|
|
@@ -3026,12 +3091,15 @@ function registerTeamCommands(program) {
|
|
|
3026
3091
|
}
|
|
3027
3092
|
function registerMemberCommands(team) {
|
|
3028
3093
|
const members = team.command("members").description("Manage team members");
|
|
3029
|
-
members.command("list", { isDefault: true }).description("List team members").argument("<teamId>", "Team ID").action(async (teamId,
|
|
3094
|
+
members.command("list", { isDefault: true }).description("List team members").argument("<teamId>", "Team ID").option("--all", "Include members who have been removed from the team").action(async (teamId, options, cmd) => {
|
|
3030
3095
|
try {
|
|
3031
3096
|
const api = createApiClient();
|
|
3032
|
-
|
|
3097
|
+
const all = await api.admin.listTeamMembers(teamId);
|
|
3098
|
+
const shown = options.all ? all : all.filter((m) => !m.removedAt);
|
|
3099
|
+
format(shown, {
|
|
3033
3100
|
format: getOutputFormat2(cmd),
|
|
3034
|
-
columns: ["userId", "name", "email", "role", "joinedAt"]
|
|
3101
|
+
columns: options.all ? ["userId", "name", "email", "role", "joinedAt", "removedAt"] : ["userId", "name", "email", "role", "joinedAt"],
|
|
3102
|
+
dateColumns: ["joinedAt", "invitedAt", "removedAt"]
|
|
3035
3103
|
});
|
|
3036
3104
|
} catch (error) {
|
|
3037
3105
|
handleError(error);
|
|
@@ -3072,7 +3140,8 @@ function registerInvitationCommands(team) {
|
|
|
3072
3140
|
const api = createApiClient();
|
|
3073
3141
|
format(await api.admin.listTeamInvitations(teamId), {
|
|
3074
3142
|
format: getOutputFormat2(cmd),
|
|
3075
|
-
columns: ["invitationId", "email", "role", "invitedBy", "expiresAt"]
|
|
3143
|
+
columns: ["invitationId", "email", "role", "invitedBy", "expiresAt"],
|
|
3144
|
+
dateColumns: ["createdAt", "expiresAt"]
|
|
3076
3145
|
});
|
|
3077
3146
|
} catch (error) {
|
|
3078
3147
|
handleError(error);
|
|
@@ -3121,9 +3190,10 @@ function registerSeatCommands(team) {
|
|
|
3121
3190
|
seats.command("preview").description("Preview the invoice for a seat-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New seat count").action(async (teamId, count, _options, cmd) => {
|
|
3122
3191
|
try {
|
|
3123
3192
|
const api = createApiClient();
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3193
|
+
printInvoicePreview(
|
|
3194
|
+
await api.admin.previewTeamSeatCount(teamId, parseCount(count, "seat count")),
|
|
3195
|
+
getOutputFormat2(cmd)
|
|
3196
|
+
);
|
|
3127
3197
|
} catch (error) {
|
|
3128
3198
|
handleError(error);
|
|
3129
3199
|
}
|
|
@@ -3150,9 +3220,10 @@ function registerPackCommands(team) {
|
|
|
3150
3220
|
packs.command("preview").description("Preview the invoice for a pack-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New pack count").action(async (teamId, count, _options, cmd) => {
|
|
3151
3221
|
try {
|
|
3152
3222
|
const api = createApiClient();
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3223
|
+
printInvoicePreview(
|
|
3224
|
+
await api.admin.previewTeamPackCount(teamId, parseCount(count, "pack count")),
|
|
3225
|
+
getOutputFormat2(cmd)
|
|
3226
|
+
);
|
|
3156
3227
|
} catch (error) {
|
|
3157
3228
|
handleError(error);
|
|
3158
3229
|
}
|
|
@@ -3193,7 +3264,17 @@ function registerOwnershipCommands(team) {
|
|
|
3193
3264
|
transfer.command("status", { isDefault: true }).description("Show the pending ownership transfer").argument("<teamId>", "Team ID").action(async (teamId, _options, cmd) => {
|
|
3194
3265
|
try {
|
|
3195
3266
|
const api = createApiClient();
|
|
3196
|
-
|
|
3267
|
+
const pending = await api.admin.getOwnershipTransfer(teamId);
|
|
3268
|
+
const outputFormat = getOutputFormat2(cmd);
|
|
3269
|
+
if (!pending) {
|
|
3270
|
+
if (outputFormat === "json") {
|
|
3271
|
+
format(null, { format: outputFormat });
|
|
3272
|
+
} else {
|
|
3273
|
+
console.log(`No pending ownership transfer for team "${teamId}".`);
|
|
3274
|
+
}
|
|
3275
|
+
return;
|
|
3276
|
+
}
|
|
3277
|
+
format(pending, { format: outputFormat, dateColumns: ["createdAt"] });
|
|
3197
3278
|
} catch (error) {
|
|
3198
3279
|
handleError(error);
|
|
3199
3280
|
}
|
|
@@ -3778,8 +3859,8 @@ function registerTableCommands(program) {
|
|
|
3778
3859
|
const sortedCols = [...snapshot.columns].sort((a, b) => a.index - b.index);
|
|
3779
3860
|
const colNames = sortedCols.map((c) => c.name || `col${c.index}`);
|
|
3780
3861
|
const cellMap = /* @__PURE__ */ new Map();
|
|
3781
|
-
for (const
|
|
3782
|
-
cellMap.set(`${
|
|
3862
|
+
for (const cell3 of snapshot.cells) {
|
|
3863
|
+
cellMap.set(`${cell3.rowIndex}:${cell3.columnIndex}`, cell3.value ?? "");
|
|
3783
3864
|
}
|
|
3784
3865
|
const sortedRows = [...snapshot.rows].sort((a, b) => a.index - b.index);
|
|
3785
3866
|
const tableData = sortedRows.map((row2) => {
|
|
@@ -4095,8 +4176,8 @@ function registerTableCommands(program) {
|
|
|
4095
4176
|
handleError(error);
|
|
4096
4177
|
}
|
|
4097
4178
|
});
|
|
4098
|
-
const
|
|
4099
|
-
|
|
4179
|
+
const cell2 = table.command("cell").description("Manage table cells");
|
|
4180
|
+
cell2.command("set").description("Set a cell value").argument("<ref>", "Table entity reference").argument("<row>", "Row index").argument("<col>", "Column index").argument("<value>", "Cell value").action(async (ref, row2, col, value, _options, cmd) => {
|
|
4100
4181
|
try {
|
|
4101
4182
|
const overrides = getOverrides6(cmd);
|
|
4102
4183
|
const resolved = parseEntityReference(ref, overrides);
|
|
@@ -4112,7 +4193,7 @@ function registerTableCommands(program) {
|
|
|
4112
4193
|
handleError(error);
|
|
4113
4194
|
}
|
|
4114
4195
|
});
|
|
4115
|
-
|
|
4196
|
+
cell2.command("delete").description("Delete a cell value").argument("<ref>", "Table entity reference").argument("<row>", "Row index").argument("<col>", "Column index").action(async (ref, row2, col, _options, cmd) => {
|
|
4116
4197
|
try {
|
|
4117
4198
|
const overrides = getOverrides6(cmd);
|
|
4118
4199
|
const resolved = parseEntityReference(ref, overrides);
|
|
@@ -4273,8 +4354,12 @@ function encodeFunctionSource(sourceCode) {
|
|
|
4273
4354
|
}
|
|
4274
4355
|
function buildFunctionEntity(args) {
|
|
4275
4356
|
const now = Date.now();
|
|
4276
|
-
const attributes = {
|
|
4277
|
-
const attributeTypes = {
|
|
4357
|
+
const attributes = {};
|
|
4358
|
+
const attributeTypes = {};
|
|
4359
|
+
if (args.language !== null && args.language !== void 0) {
|
|
4360
|
+
attributes.language = args.language;
|
|
4361
|
+
attributeTypes.language = "text";
|
|
4362
|
+
}
|
|
4278
4363
|
if (args.name !== null && args.name !== void 0) {
|
|
4279
4364
|
attributes.name = args.name;
|
|
4280
4365
|
attributeTypes.name = "text";
|
|
@@ -4535,7 +4620,7 @@ function registerFunctionCommands(program) {
|
|
|
4535
4620
|
handleError(error);
|
|
4536
4621
|
}
|
|
4537
4622
|
});
|
|
4538
|
-
fn.command("create").description("Create a new function entity").argument("<ref>", "Function entity reference").option("--language <lang>", "Function language (Java,
|
|
4623
|
+
fn.command("create").description("Create a new function entity").argument("<ref>", "Function entity reference").option("--language <lang>", "Function language (Java, Kotlin, Python, JavaScript, Scala); defaults to the project's language").option("--source <file>", "Initial source code file").option("--name <name>", "Display name (defaults to entityId)").action(async (ref, options, cmd) => {
|
|
4539
4624
|
try {
|
|
4540
4625
|
const overrides = getOverrides8(cmd);
|
|
4541
4626
|
const resolved = parseEntityReference(ref, overrides);
|
|
@@ -4547,11 +4632,12 @@ function registerFunctionCommands(program) {
|
|
|
4547
4632
|
entityId: resolved.entityId,
|
|
4548
4633
|
entityBranch: resolved.entityBranch,
|
|
4549
4634
|
name: options.name ?? resolved.entityId,
|
|
4550
|
-
language: options.language,
|
|
4635
|
+
language: options.language ?? null,
|
|
4551
4636
|
sourceCode
|
|
4552
4637
|
});
|
|
4553
4638
|
await api.storage.saveEntities([entity]);
|
|
4554
|
-
|
|
4639
|
+
const effective = options.language ? options.language : `${await resolveLanguage(api, resolved.projectId)}, the project's language`;
|
|
4640
|
+
console.log(chalk19.green(`Function "${resolved.entityId}" created (${effective}).`));
|
|
4555
4641
|
} catch (error) {
|
|
4556
4642
|
handleError(error);
|
|
4557
4643
|
}
|
|
@@ -4928,7 +5014,7 @@ Error: ${event.content}`));
|
|
|
4928
5014
|
}
|
|
4929
5015
|
async function runChatRepl(options) {
|
|
4930
5016
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
4931
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
5017
|
+
const { getUpdateNotice } = await import("./update-check-JKIWTPFB.js");
|
|
4932
5018
|
let sessionId = options.session;
|
|
4933
5019
|
console.log(chalk22.bold("Diafunc chat") + chalk22.dim(" \xB7 /help for commands, /quit to exit"));
|
|
4934
5020
|
if (sessionId) {
|
|
@@ -7415,12 +7501,12 @@ async function evaluate(api, fnRef, language, sourceCode) {
|
|
|
7415
7501
|
}
|
|
7416
7502
|
}
|
|
7417
7503
|
function registerShellCommand(program) {
|
|
7418
|
-
program.command("shell").description("Interactive REPL for function code evaluation").option("--function <ref>", "Function entity reference to use as scratch (required)").option("--language <lang>", "Source language
|
|
7504
|
+
program.command("shell").description("Interactive REPL for function code evaluation").option("--function <ref>", "Function entity reference to use as scratch (required)").option("--language <lang>", "Source language; defaults to the project's language").action(async (options, cmd) => {
|
|
7419
7505
|
try {
|
|
7420
7506
|
if (!options.function) {
|
|
7421
7507
|
console.error(chalk35.red("Missing --function <ref>."));
|
|
7422
7508
|
console.error(chalk35.dim("Pass an existing or new function entity reference to use as the shell target."));
|
|
7423
|
-
console.error(chalk35.dim("Example: diafunc shell --function my-project/main/scratch/main --language
|
|
7509
|
+
console.error(chalk35.dim("Example: diafunc shell --function my-project/main/scratch/main --language Kotlin"));
|
|
7424
7510
|
process.exit(1);
|
|
7425
7511
|
}
|
|
7426
7512
|
const config = loadConfig();
|
|
@@ -7431,14 +7517,15 @@ function registerShellCommand(program) {
|
|
|
7431
7517
|
});
|
|
7432
7518
|
const api = createApiClient();
|
|
7433
7519
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
7434
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
7435
|
-
|
|
7520
|
+
const { getUpdateNotice } = await import("./update-check-JKIWTPFB.js");
|
|
7521
|
+
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
7522
|
+
console.log(chalk35.bold("Diafunc shell") + chalk35.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
7436
7523
|
console.log(chalk35.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
7437
7524
|
console.log(chalk35.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
|
|
7438
7525
|
const notice = await getUpdateNotice();
|
|
7439
7526
|
if (notice) console.log(chalk35.dim(notice));
|
|
7440
7527
|
console.log();
|
|
7441
|
-
let language =
|
|
7528
|
+
let language = resolvedLanguage;
|
|
7442
7529
|
for (; ; ) {
|
|
7443
7530
|
let line;
|
|
7444
7531
|
try {
|
|
@@ -7692,4 +7779,4 @@ function createProgram() {
|
|
|
7692
7779
|
export {
|
|
7693
7780
|
createProgram
|
|
7694
7781
|
};
|
|
7695
|
-
//# sourceMappingURL=chunk-
|
|
7782
|
+
//# sourceMappingURL=chunk-SOXLUOWV.js.map
|