@topolo/cli 0.1.13 → 0.1.14
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/index.js +23 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1620,6 +1620,9 @@ import { mkdir, readFile, writeFile, chmod } from "fs/promises";
|
|
|
1620
1620
|
import { existsSync } from "fs";
|
|
1621
1621
|
import { homedir, platform } from "os";
|
|
1622
1622
|
import { dirname, join } from "path";
|
|
1623
|
+
var BUILTIN_SERVICE_URL_OVERRIDES = {
|
|
1624
|
+
one: "https://one.topolo.app"
|
|
1625
|
+
};
|
|
1623
1626
|
function configPath() {
|
|
1624
1627
|
const override = process.env.TOPOLO_CONFIG_PATH;
|
|
1625
1628
|
if (override) return override;
|
|
@@ -1690,7 +1693,10 @@ function resolveAgentName(configAgentName) {
|
|
|
1690
1693
|
return process.env.TOPOLO_AGENT_NAME ?? configAgentName;
|
|
1691
1694
|
}
|
|
1692
1695
|
function resolveServiceUrls(configUrls) {
|
|
1693
|
-
const merged = {
|
|
1696
|
+
const merged = {
|
|
1697
|
+
...BUILTIN_SERVICE_URL_OVERRIDES,
|
|
1698
|
+
...configUrls ?? {}
|
|
1699
|
+
};
|
|
1694
1700
|
for (const [k, v] of Object.entries(process.env)) {
|
|
1695
1701
|
if (k.startsWith("TOPOLO_SERVICE_URL_") && v) {
|
|
1696
1702
|
merged[k.slice("TOPOLO_SERVICE_URL_".length).toLowerCase()] = v;
|
|
@@ -1942,7 +1948,7 @@ function sleep(ms) {
|
|
|
1942
1948
|
}
|
|
1943
1949
|
|
|
1944
1950
|
// src/version.ts
|
|
1945
|
-
var CLI_VERSION = "0.1.
|
|
1951
|
+
var CLI_VERSION = "0.1.14";
|
|
1946
1952
|
|
|
1947
1953
|
// src/client.ts
|
|
1948
1954
|
async function buildClient(options) {
|
|
@@ -5095,25 +5101,29 @@ async function requirePlatformAdminSession() {
|
|
|
5095
5101
|
|
|
5096
5102
|
// src/commands/services.ts
|
|
5097
5103
|
function registerServicesCommand(program2) {
|
|
5098
|
-
program2.command("services").description("List every Topolo service the SDK can route to").option("--json", "Output JSON", true).option("--no-json", "Output human-readable table").action((opts) => {
|
|
5104
|
+
program2.command("services").description("List every Topolo service the SDK can route to").option("--json", "Output JSON", true).option("--no-json", "Output human-readable table").action(async (opts) => {
|
|
5099
5105
|
const mode = resolveOutputMode(opts.json);
|
|
5100
5106
|
try {
|
|
5101
|
-
const
|
|
5102
|
-
|
|
5103
|
-
const effectiveUrl = resolveServiceUrl(id);
|
|
5104
|
-
return {
|
|
5105
|
-
id,
|
|
5106
|
-
defaultUrl,
|
|
5107
|
-
effectiveUrl,
|
|
5108
|
-
overridden: defaultUrl !== effectiveUrl
|
|
5109
|
-
};
|
|
5110
|
-
});
|
|
5107
|
+
const config = await readConfig();
|
|
5108
|
+
const rows = buildRows(resolveServiceUrls(config.serviceUrls));
|
|
5111
5109
|
emit({ services: rows }, mode, () => formatRows2(rows));
|
|
5112
5110
|
} catch (err) {
|
|
5113
5111
|
fail(err, mode);
|
|
5114
5112
|
}
|
|
5115
5113
|
});
|
|
5116
5114
|
}
|
|
5115
|
+
function buildRows(overrides) {
|
|
5116
|
+
return Object.keys(DEFAULT_SERVICE_URLS).sort().map((id) => {
|
|
5117
|
+
const defaultUrl = DEFAULT_SERVICE_URLS[id];
|
|
5118
|
+
const effectiveUrl = resolveServiceUrl(id, overrides);
|
|
5119
|
+
return {
|
|
5120
|
+
id,
|
|
5121
|
+
defaultUrl,
|
|
5122
|
+
effectiveUrl,
|
|
5123
|
+
overridden: defaultUrl !== effectiveUrl
|
|
5124
|
+
};
|
|
5125
|
+
});
|
|
5126
|
+
}
|
|
5117
5127
|
function formatRows2(rows) {
|
|
5118
5128
|
const idWidth = Math.max(3, ...rows.map((r) => r.id.length));
|
|
5119
5129
|
const urlWidth = Math.max(7, ...rows.map((r) => r.effectiveUrl.length));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Command-line interface for Topolo developers, operators, and agents, with internal first-party scaffolding available under the topolo platform namespace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|