@diafunc/cli 0.13.0 → 0.14.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/README.md +5 -1
- package/dist/bin/diafunc.js +3 -3
- package/dist/{chunk-TWJWXUZL.js → chunk-5VMDFBM6.js} +2 -2
- package/dist/{chunk-TWJWXUZL.js.map → chunk-5VMDFBM6.js.map} +1 -1
- package/dist/{chunk-EJLRB75G.js → chunk-V3EXWLZP.js} +187 -15
- package/dist/chunk-V3EXWLZP.js.map +1 -0
- package/dist/{chunk-GOEDVSWO.js → chunk-XXWRNCTW.js} +2 -2
- package/dist/src/index.js +2 -2
- package/dist/update-check-3ZDZSY7M.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-EJLRB75G.js.map +0 -1
- package/dist/update-check-V23VUFO4.js +0 -8
- /package/dist/{chunk-GOEDVSWO.js.map → chunk-XXWRNCTW.js.map} +0 -0
- /package/dist/{update-check-V23VUFO4.js.map → update-check-3ZDZSY7M.js.map} +0 -0
package/README.md
CHANGED
|
@@ -56,6 +56,10 @@ diafunc config set defaults.project my-project
|
|
|
56
56
|
# List your projects
|
|
57
57
|
diafunc project list
|
|
58
58
|
|
|
59
|
+
# Create a table and load a file into it
|
|
60
|
+
diafunc table create my-table --name "My Table"
|
|
61
|
+
diafunc table import my-table data.csv
|
|
62
|
+
|
|
59
63
|
# View table data
|
|
60
64
|
diafunc table view my-table
|
|
61
65
|
|
|
@@ -193,7 +197,7 @@ Nothing is asked when stdin or stdout is not a terminal, with `--output json`, o
|
|
|
193
197
|
| `diafunc invoice` | List and download invoices |
|
|
194
198
|
| `diafunc utilization` | Show current credit utilization, and with `history` what each day of the billing cycle cost |
|
|
195
199
|
| `diafunc status` | Platform health: summary, per-component status, incidents |
|
|
196
|
-
| `diafunc admin` | User management, subscription, settings, backups, index rebuild, permission inspection |
|
|
200
|
+
| `diafunc admin` | User management, subscription, settings, platform settings, backups, index rebuild, permission inspection |
|
|
197
201
|
| `diafunc completion` | Generate shell completions |
|
|
198
202
|
|
|
199
203
|
Run `diafunc <command> --help` for detailed usage of any command.
|
package/dist/bin/diafunc.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
PromptCancelled,
|
|
5
5
|
createProgram,
|
|
6
6
|
handleError
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-V3EXWLZP.js";
|
|
8
8
|
import {
|
|
9
9
|
getUpdateNotice
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-XXWRNCTW.js";
|
|
11
11
|
import {
|
|
12
12
|
package_default
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-5VMDFBM6.js";
|
|
14
14
|
|
|
15
15
|
// bin/diafunc.ts
|
|
16
16
|
import chalk2 from "chalk";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@diafunc/cli",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.14.0",
|
|
5
5
|
description: "Diafunc CLI: the command-line interface for the Diafunc platform",
|
|
6
6
|
type: "module",
|
|
7
7
|
bin: {
|
|
@@ -62,4 +62,4 @@ var package_default = {
|
|
|
62
62
|
export {
|
|
63
63
|
package_default
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-5VMDFBM6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.14.0\",\n \"description\": \"Diafunc CLI: the command-line interface for the Diafunc platform\",\n \"type\": \"module\",\n \"bin\": {\n \"diafunc\": \"./dist/bin/diafunc.js\"\n },\n \"homepage\": \"https://diafunc.com\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://gitlab.com/diafunc/cli.git\"\n },\n \"bugs\": {\n \"url\": \"https://gitlab.com/diafunc/cli/-/issues\"\n },\n \"author\": \"Markus Pollak <markus.pollak@diafunc.com>\",\n \"scripts\": {\n \"build\": \"tsup && node -e \\\"const fs=require('fs');const f='dist/bin/diafunc.js';fs.writeFileSync(f,'#!/usr/bin/env node\\\\n'+fs.readFileSync(f,'utf8'))\\\"\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"lint\": \"tsc --noEmit\",\n \"start\": \"node dist/bin/diafunc.js\",\n \"prepublishOnly\": \"npm run lint && npm test && npm run build\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\",\n \"README.md\"\n ],\n \"keywords\": [\n \"diafunc\",\n \"cli\",\n \"data-science\",\n \"symbolic-regression\"\n ],\n \"license\": \"Apache-2.0\",\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"dependencies\": {\n \"@inquirer/prompts\": \"^7.0.0\",\n \"chalk\": \"^5.4.0\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^12.1.0\",\n \"ora\": \"^8.1.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.0.0\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^2.1.0\"\n }\n}\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,UAAY;AAAA,EACZ,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,QAAU;AAAA,EACV,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,MAAQ;AAAA,IACR,OAAS;AAAA,IACT,gBAAkB;AAAA,EACpB;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,QAAU;AAAA,IACV,UAAY;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,cAAgB;AAAA,IACd,qBAAqB;AAAA,IACrB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAa;AAAA,IACb,KAAO;AAAA,EACT;AAAA,EACA,iBAAmB;AAAA,IACjB,eAAe;AAAA,IACf,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,QAAU;AAAA,EACZ;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5VMDFBM6.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import chalk36 from "chalk";
|
|
@@ -689,6 +689,7 @@ function createAdminService(client) {
|
|
|
689
689
|
path: "/settings/"
|
|
690
690
|
});
|
|
691
691
|
},
|
|
692
|
+
// The platform expects one { name, value } pair, not a map keyed by the setting name.
|
|
692
693
|
async mergeSetting(setting) {
|
|
693
694
|
return client.request({
|
|
694
695
|
method: "PUT",
|
|
@@ -697,6 +698,23 @@ function createAdminService(client) {
|
|
|
697
698
|
body: setting
|
|
698
699
|
});
|
|
699
700
|
},
|
|
701
|
+
// Platform settings: the operator-facing catalogue, distinct from the per-user settings above.
|
|
702
|
+
// Every entry carries its compiled default, so an unset override reads as null rather than absent.
|
|
703
|
+
async listPlatformSettings() {
|
|
704
|
+
return client.request({
|
|
705
|
+
method: "GET",
|
|
706
|
+
service: SERVICE,
|
|
707
|
+
path: "/platform-settings"
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
async updatePlatformSetting(key, value, reason2) {
|
|
711
|
+
return client.request({
|
|
712
|
+
method: "PUT",
|
|
713
|
+
service: SERVICE,
|
|
714
|
+
path: `/platform-settings/${encodeURIComponent(key)}`,
|
|
715
|
+
body: { value, reason: reason2 }
|
|
716
|
+
});
|
|
717
|
+
},
|
|
700
718
|
// Subscription
|
|
701
719
|
async getCurrentSubscription() {
|
|
702
720
|
return client.request({
|
|
@@ -1850,11 +1868,12 @@ function createStorageService(client) {
|
|
|
1850
1868
|
});
|
|
1851
1869
|
},
|
|
1852
1870
|
// --- Linked Entities ---
|
|
1853
|
-
async getLinkedEntities(direction, ref) {
|
|
1871
|
+
async getLinkedEntities(direction, ref, linkId) {
|
|
1872
|
+
const byLink = linkId ? `/${enc(linkId)}` : "";
|
|
1854
1873
|
return client.request({
|
|
1855
1874
|
method: "GET",
|
|
1856
1875
|
service: SERVICE3,
|
|
1857
|
-
path: `/linked-entities/${enc(direction)}${entityPath(ref)}`
|
|
1876
|
+
path: `/linked-entities/${enc(direction)}${entityPath(ref)}${byLink}`
|
|
1858
1877
|
});
|
|
1859
1878
|
},
|
|
1860
1879
|
async saveLinkedEntities(ref, linkId, entities) {
|
|
@@ -4528,7 +4547,60 @@ function decodeCellValue(value, type) {
|
|
|
4528
4547
|
return bytes.toString("utf-8");
|
|
4529
4548
|
}
|
|
4530
4549
|
|
|
4550
|
+
// src/util/entity-attributes.ts
|
|
4551
|
+
function encodeTextAttribute(value) {
|
|
4552
|
+
return Buffer.from(value, "utf-8").toString("base64");
|
|
4553
|
+
}
|
|
4554
|
+
function decodeTextAttribute(value) {
|
|
4555
|
+
if (value === null || value === void 0) return null;
|
|
4556
|
+
return Buffer.from(value, "base64").toString("utf-8");
|
|
4557
|
+
}
|
|
4558
|
+
function encodeLongAttribute(value) {
|
|
4559
|
+
if (!Number.isSafeInteger(value)) {
|
|
4560
|
+
throw new RangeError(`Not an integer attribute value: ${value}`);
|
|
4561
|
+
}
|
|
4562
|
+
const bytes = Buffer.alloc(8);
|
|
4563
|
+
bytes.writeBigInt64BE(BigInt(value));
|
|
4564
|
+
return bytes.toString("base64");
|
|
4565
|
+
}
|
|
4566
|
+
|
|
4567
|
+
// src/util/table-entity.ts
|
|
4568
|
+
function buildTableEntity(args) {
|
|
4569
|
+
const now = Date.now();
|
|
4570
|
+
const attributes = { name: encodeTextAttribute(args.name) };
|
|
4571
|
+
const attributeTypes = { name: "text" };
|
|
4572
|
+
if (args.index !== void 0) {
|
|
4573
|
+
attributes.index = encodeLongAttribute(args.index);
|
|
4574
|
+
attributeTypes.index = "integer";
|
|
4575
|
+
}
|
|
4576
|
+
return {
|
|
4577
|
+
projectId: args.projectId,
|
|
4578
|
+
projectBranch: args.projectBranch,
|
|
4579
|
+
entityId: args.entityId,
|
|
4580
|
+
entityBranch: args.entityBranch,
|
|
4581
|
+
head: true,
|
|
4582
|
+
version: 1,
|
|
4583
|
+
type: "table",
|
|
4584
|
+
attributes,
|
|
4585
|
+
attributeTypes,
|
|
4586
|
+
metaAttributes: {},
|
|
4587
|
+
metaAttributeTypes: {},
|
|
4588
|
+
tags: [],
|
|
4589
|
+
modified: now,
|
|
4590
|
+
created: now,
|
|
4591
|
+
versioned: false,
|
|
4592
|
+
versionTtl: null,
|
|
4593
|
+
retain: false,
|
|
4594
|
+
contentAvailable: false,
|
|
4595
|
+
contentLoaded: false,
|
|
4596
|
+
contentType: null,
|
|
4597
|
+
contentSize: null,
|
|
4598
|
+
content: null
|
|
4599
|
+
};
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4531
4602
|
// src/commands/table/index.ts
|
|
4603
|
+
import { randomUUID } from "crypto";
|
|
4532
4604
|
function getOutputFormat7(cmd) {
|
|
4533
4605
|
const config = loadConfig();
|
|
4534
4606
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -4551,9 +4623,39 @@ function deriveOutFile(entityId, extension, archive, compression) {
|
|
|
4551
4623
|
}
|
|
4552
4624
|
return name;
|
|
4553
4625
|
}
|
|
4626
|
+
function projectPlacement(table) {
|
|
4627
|
+
return {
|
|
4628
|
+
parent: { projectId: table.projectId, projectBranch: table.projectBranch, entityId: table.projectId, entityBranch: "main" },
|
|
4629
|
+
linkId: "main"
|
|
4630
|
+
};
|
|
4631
|
+
}
|
|
4632
|
+
async function notebookPlacement(api, notebook, table) {
|
|
4633
|
+
const parent = parseEntityReference(notebook, { project: table.projectId, branch: table.projectBranch });
|
|
4634
|
+
if (parent.projectId !== table.projectId || parent.projectBranch !== table.projectBranch) {
|
|
4635
|
+
throw new CliError("The notebook must be in the same project and branch as the table.");
|
|
4636
|
+
}
|
|
4637
|
+
const entity = await api.storage.getEntity(parent, false).catch((error) => {
|
|
4638
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
4639
|
+
throw new CliError(`There is no notebook "${parent.entityId}".`, {
|
|
4640
|
+
hint: `List what the project holds with 'diafunc entity list ${parent.projectId}/${parent.projectBranch}'.`
|
|
4641
|
+
});
|
|
4642
|
+
}
|
|
4643
|
+
throw error;
|
|
4644
|
+
});
|
|
4645
|
+
if (entity.type !== "notebook" && entity.type !== "chapter") {
|
|
4646
|
+
throw new CliError(`"${parent.entityId}" is a ${entity.type ?? "untyped entity"}, not a notebook or chapter.`);
|
|
4647
|
+
}
|
|
4648
|
+
const sections = await api.storage.getLinkedEntities("FORWARD", parent, "sections");
|
|
4649
|
+
const last = sections.map((section) => decodeLongAttribute(section.attributes?.index)).filter((index) => index !== null).reduce((highest, index) => Math.max(highest, index), -1);
|
|
4650
|
+
return { parent, linkId: "sections", index: last + 1 };
|
|
4651
|
+
}
|
|
4652
|
+
function formatReference(ref) {
|
|
4653
|
+
return `${ref.projectId}/${ref.projectBranch}/${ref.entityId}/${ref.entityBranch}`;
|
|
4654
|
+
}
|
|
4554
4655
|
function registerTableCommands(program) {
|
|
4555
4656
|
const table = program.command("table").description("Manage tables").addHelpText("after", `
|
|
4556
4657
|
Examples:
|
|
4658
|
+
$ diafunc table create sales an empty table named "sales"
|
|
4557
4659
|
$ diafunc table view <ref> --rows 0:20 the first twenty rows
|
|
4558
4660
|
$ diafunc table import <ref> data.csv load a file
|
|
4559
4661
|
$ diafunc table export <ref> parquet write one out
|
|
@@ -4614,6 +4716,49 @@ Examples:
|
|
|
4614
4716
|
handleError(error);
|
|
4615
4717
|
}
|
|
4616
4718
|
});
|
|
4719
|
+
table.command("create").description("Create an empty table, at project level or as a section of a notebook").argument("[ref]", "The new table's entity reference (default: a new id in the default project)").option("--name <name>", 'Display name (defaults to the entity id, or "Table" for a generated id)').option("--notebook <ref>", "Add the table as a section of this notebook or chapter instead of at project level").addHelpText("after", `
|
|
4720
|
+
A table at project level is linked from the project, where 'diafunc entity list' shows it. With --notebook it
|
|
4721
|
+
becomes the notebook's last section, as Add Table in the Lab does. Either way it starts empty; load it with
|
|
4722
|
+
'diafunc table import <ref> <file>'.
|
|
4723
|
+
|
|
4724
|
+
Examples:
|
|
4725
|
+
$ diafunc table create sales --name "Sales 2026"
|
|
4726
|
+
$ diafunc table create --notebook <notebookId>
|
|
4727
|
+
`).action(async (ref, options, cmd) => {
|
|
4728
|
+
try {
|
|
4729
|
+
const outputFormat = getOutputFormat7(cmd);
|
|
4730
|
+
const overrides = getOverrides6(cmd);
|
|
4731
|
+
const resolved = parseEntityReference(ref ?? randomUUID(), overrides);
|
|
4732
|
+
if (resolved.entityId.includes(".partition.")) {
|
|
4733
|
+
throw new CliError(`"${resolved.entityId}" contains ".partition.", which names a table's storage blocks.`, {
|
|
4734
|
+
exitCode: EXIT_USAGE,
|
|
4735
|
+
hint: "Choose an id without it."
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
const api = createApiClient();
|
|
4739
|
+
if (await api.storage.entityExists(resolved)) {
|
|
4740
|
+
throw new CliError(`An entity "${resolved.entityId}" already exists in this project.`, {
|
|
4741
|
+
hint: `Import into it with 'diafunc table import ${formatReference(resolved)} <file>', or choose another id.`
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
const name = options.name ?? (ref ? resolved.entityId : "Table");
|
|
4745
|
+
const placement = options.notebook ? await notebookPlacement(api, options.notebook, resolved) : projectPlacement(resolved);
|
|
4746
|
+
const entity = buildTableEntity({ ...resolved, name, index: placement.index });
|
|
4747
|
+
await api.storage.saveLinkedEntities(placement.parent, placement.linkId, [entity]);
|
|
4748
|
+
const created = formatReference(resolved);
|
|
4749
|
+
if (outputFormat === "json") {
|
|
4750
|
+
format(
|
|
4751
|
+
{ ...resolved, name, parent: placement.parent.entityId, linkId: placement.linkId, index: placement.index ?? null },
|
|
4752
|
+
{ format: outputFormat }
|
|
4753
|
+
);
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4756
|
+
success(`Table "${name}" created: ${created}`);
|
|
4757
|
+
hint(`Load data with 'diafunc table import ${created} <file>'.`);
|
|
4758
|
+
} catch (error) {
|
|
4759
|
+
handleError(error);
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4617
4762
|
table.command("import").description("Import data from a file (any supported format; see `table import-formats`)").argument("<ref>", "Table entity reference").argument("<file>", "File to import").option("--selection <id>", "Pin a sheet / inner-table id for multi-table sources (Excel sheets, SQLite tables, archive entries)").action(async (ref, file, options, cmd) => {
|
|
4618
4763
|
try {
|
|
4619
4764
|
const overrides = getOverrides6(cmd);
|
|
@@ -4630,7 +4775,14 @@ Examples:
|
|
|
4630
4775
|
const importId = await withStatus(
|
|
4631
4776
|
`Uploading ${path3.basename(file)}`,
|
|
4632
4777
|
() => api.storage.importTable(resolved, formData, options.selection)
|
|
4633
|
-
)
|
|
4778
|
+
).catch((error) => {
|
|
4779
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
4780
|
+
throw new CliError(`There is no table "${resolved.entityId}" to import into.`, {
|
|
4781
|
+
hint: `Create it first with 'diafunc table create ${ref}', then import again.`
|
|
4782
|
+
});
|
|
4783
|
+
}
|
|
4784
|
+
throw error;
|
|
4785
|
+
});
|
|
4634
4786
|
const pollInterval = 1e3;
|
|
4635
4787
|
const maxAttempts = 300;
|
|
4636
4788
|
const status = new Status();
|
|
@@ -5096,7 +5248,7 @@ import * as fs6 from "fs";
|
|
|
5096
5248
|
import * as os2 from "os";
|
|
5097
5249
|
import * as path5 from "path";
|
|
5098
5250
|
import { spawn } from "child_process";
|
|
5099
|
-
import { randomUUID } from "crypto";
|
|
5251
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
5100
5252
|
|
|
5101
5253
|
// src/util/time-uuid.ts
|
|
5102
5254
|
import { randomBytes } from "crypto";
|
|
@@ -5160,11 +5312,11 @@ function buildFunctionEntity(args) {
|
|
|
5160
5312
|
const attributes = {};
|
|
5161
5313
|
const attributeTypes = {};
|
|
5162
5314
|
if (args.language !== null && args.language !== void 0) {
|
|
5163
|
-
attributes.language = args.language;
|
|
5315
|
+
attributes.language = encodeTextAttribute(args.language);
|
|
5164
5316
|
attributeTypes.language = "text";
|
|
5165
5317
|
}
|
|
5166
5318
|
if (args.name !== null && args.name !== void 0) {
|
|
5167
|
-
attributes.name = args.name;
|
|
5319
|
+
attributes.name = encodeTextAttribute(args.name);
|
|
5168
5320
|
attributeTypes.name = "text";
|
|
5169
5321
|
}
|
|
5170
5322
|
return {
|
|
@@ -5509,9 +5661,9 @@ Examples:
|
|
|
5509
5661
|
const api = createApiClient();
|
|
5510
5662
|
const entity = await api.storage.getEntity(resolved, true);
|
|
5511
5663
|
const currentSource = decodeFunctionSource(entity);
|
|
5512
|
-
const language = entity.attributes?.["language"] ?? "txt";
|
|
5664
|
+
const language = decodeTextAttribute(entity.attributes?.["language"]) ?? "txt";
|
|
5513
5665
|
const ext = extensionFor(language);
|
|
5514
|
-
const tmpFile = path5.join(os2.tmpdir(), `diafunc-${resolved.entityId}-${
|
|
5666
|
+
const tmpFile = path5.join(os2.tmpdir(), `diafunc-${resolved.entityId}-${randomUUID2()}.${ext}`);
|
|
5515
5667
|
fs6.writeFileSync(tmpFile, currentSource);
|
|
5516
5668
|
const editor = process.env.VISUAL ?? process.env.EDITOR ?? "vi";
|
|
5517
5669
|
await new Promise((resolve, reject) => {
|
|
@@ -5969,7 +6121,7 @@ var HELP = [
|
|
|
5969
6121
|
];
|
|
5970
6122
|
async function runChatRepl(options) {
|
|
5971
6123
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
5972
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
6124
|
+
const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
|
|
5973
6125
|
let sessionId = options.session;
|
|
5974
6126
|
let lastReportedSession;
|
|
5975
6127
|
console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -6423,12 +6575,32 @@ function registerAdminCommands(program) {
|
|
|
6423
6575
|
settings.command("set").description("Update a setting").argument("<key>", "Setting key").argument("<value>", "Setting value").action(async (key, value) => {
|
|
6424
6576
|
try {
|
|
6425
6577
|
const api = createApiClient();
|
|
6426
|
-
await api.admin.mergeSetting({
|
|
6578
|
+
await api.admin.mergeSetting({ name: key, value });
|
|
6427
6579
|
success(`Setting "${key}" updated.`);
|
|
6428
6580
|
} catch (error) {
|
|
6429
6581
|
handleError(error);
|
|
6430
6582
|
}
|
|
6431
6583
|
});
|
|
6584
|
+
const platformSettings = admin.command("platform-settings").description("Manage platform-wide settings (admin only)");
|
|
6585
|
+
platformSettings.command("list").description("Show every platform setting with its default and current override").action(async (_options, cmd) => {
|
|
6586
|
+
try {
|
|
6587
|
+
const outputFormat = getOutputFormat14(cmd);
|
|
6588
|
+
const api = createApiClient();
|
|
6589
|
+
const settingsList = await api.admin.listPlatformSettings();
|
|
6590
|
+
format(settingsList, { format: outputFormat });
|
|
6591
|
+
} catch (error) {
|
|
6592
|
+
handleError(error);
|
|
6593
|
+
}
|
|
6594
|
+
});
|
|
6595
|
+
platformSettings.command("set").description("Override one platform setting (an empty value restores the default)").argument("<key>", "Setting key, as shown by `platform-settings list`").argument("<value>", "New value; an empty string restores the compiled default").option("--reason <reason>", "Why it was changed; stored alongside the override").action(async (key, value, options) => {
|
|
6596
|
+
try {
|
|
6597
|
+
const api = createApiClient();
|
|
6598
|
+
await api.admin.updatePlatformSetting(key, value, options.reason);
|
|
6599
|
+
success(`Platform setting "${key}" set to "${value}".`);
|
|
6600
|
+
} catch (error) {
|
|
6601
|
+
handleError(error);
|
|
6602
|
+
}
|
|
6603
|
+
});
|
|
6432
6604
|
const backup = admin.command("backup").description("Manage backups");
|
|
6433
6605
|
backup.command("create-full").description("Create a full system short-term backup").option("--long-term", "Create a long-term backup instead").action(async (options) => {
|
|
6434
6606
|
try {
|
|
@@ -9228,7 +9400,7 @@ import * as fs11 from "fs";
|
|
|
9228
9400
|
import * as os3 from "os";
|
|
9229
9401
|
import * as path8 from "path";
|
|
9230
9402
|
import { spawn as spawn3 } from "child_process";
|
|
9231
|
-
import { randomUUID as
|
|
9403
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
9232
9404
|
function extensionFor2(language) {
|
|
9233
9405
|
const l = language.toLowerCase();
|
|
9234
9406
|
if (l === "java") return "java";
|
|
@@ -9239,7 +9411,7 @@ function extensionFor2(language) {
|
|
|
9239
9411
|
return "txt";
|
|
9240
9412
|
}
|
|
9241
9413
|
async function openInEditor(initial, ext) {
|
|
9242
|
-
const tmpFile = path8.join(os3.tmpdir(), `diafunc-shell-${
|
|
9414
|
+
const tmpFile = path8.join(os3.tmpdir(), `diafunc-shell-${randomUUID3()}.${ext}`);
|
|
9243
9415
|
fs11.writeFileSync(tmpFile, initial);
|
|
9244
9416
|
const editor = process.env.VISUAL ?? process.env.EDITOR ?? "vi";
|
|
9245
9417
|
await new Promise((resolve, reject) => {
|
|
@@ -9324,7 +9496,7 @@ function registerShellCommand(program) {
|
|
|
9324
9496
|
});
|
|
9325
9497
|
const api = createApiClient();
|
|
9326
9498
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
9327
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
9499
|
+
const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
|
|
9328
9500
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
9329
9501
|
console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
9330
9502
|
console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
@@ -10369,4 +10541,4 @@ export {
|
|
|
10369
10541
|
PromptCancelled,
|
|
10370
10542
|
createProgram
|
|
10371
10543
|
};
|
|
10372
|
-
//# sourceMappingURL=chunk-
|
|
10544
|
+
//# sourceMappingURL=chunk-V3EXWLZP.js.map
|