@odla-ai/cli 0.21.0 → 0.22.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/bin.cjs +166 -133
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-CZSQ443A.js → chunk-DINDRUDA.js} +40 -8
- package/dist/chunk-DINDRUDA.js.map +1 -0
- package/dist/index.cjs +177 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-CZSQ443A.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -6844,6 +6844,18 @@ function describeProblem(problem) {
|
|
|
6844
6844
|
const where = problem.validPrefix ? `after "${problem.validPrefix}"` : "as a command";
|
|
6845
6845
|
return `"${problem.word}" is not accepted ${where} \u2014 try: ${problem.accepted.join(", ")}`;
|
|
6846
6846
|
}
|
|
6847
|
+
function invocationPath(words2) {
|
|
6848
|
+
let node = COMMAND_SURFACE;
|
|
6849
|
+
const path = [];
|
|
6850
|
+
for (const word of words2) {
|
|
6851
|
+
const next = node[word];
|
|
6852
|
+
if (!next) break;
|
|
6853
|
+
path.push(word);
|
|
6854
|
+
node = next;
|
|
6855
|
+
if (Object.keys(node).length === 0) break;
|
|
6856
|
+
}
|
|
6857
|
+
return path;
|
|
6858
|
+
}
|
|
6847
6859
|
function surfacePaths(node = COMMAND_SURFACE, prefix = []) {
|
|
6848
6860
|
const paths = [];
|
|
6849
6861
|
for (const [word, child] of Object.entries(node)) {
|
|
@@ -8167,10 +8179,28 @@ async function pmCommand(parsed, deps = {}) {
|
|
|
8167
8179
|
}
|
|
8168
8180
|
}
|
|
8169
8181
|
|
|
8182
|
+
// src/record.ts
|
|
8183
|
+
import { appendFileSync } from "fs";
|
|
8184
|
+
import process9 from "process";
|
|
8185
|
+
function recordInvocation(parsed) {
|
|
8186
|
+
const file = process9.env.ODLA_CLI_RECORD;
|
|
8187
|
+
if (!file) return;
|
|
8188
|
+
try {
|
|
8189
|
+
const entry = {
|
|
8190
|
+
path: invocationPath(parsed.positionals),
|
|
8191
|
+
options: Object.keys(parsed.options).sort()
|
|
8192
|
+
};
|
|
8193
|
+
if (!entry.path.length) return;
|
|
8194
|
+
appendFileSync(file, `${JSON.stringify(entry)}
|
|
8195
|
+
`);
|
|
8196
|
+
} catch {
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
|
|
8170
8200
|
// src/runbook-command.ts
|
|
8171
8201
|
import { existsSync as existsSync10 } from "fs";
|
|
8172
8202
|
import { join as join12, resolve as resolve10 } from "path";
|
|
8173
|
-
import
|
|
8203
|
+
import process11 from "process";
|
|
8174
8204
|
|
|
8175
8205
|
// src/runbook-actions.ts
|
|
8176
8206
|
import { readFileSync as readFileSync8 } from "fs";
|
|
@@ -8824,9 +8854,9 @@ import { spawnSync } from "child_process";
|
|
|
8824
8854
|
import { mkdtempSync, readFileSync as readFileSync11, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
8825
8855
|
import { tmpdir as tmpdir4 } from "os";
|
|
8826
8856
|
import { join as join11 } from "path";
|
|
8827
|
-
import
|
|
8857
|
+
import process10 from "process";
|
|
8828
8858
|
var EDITOR_ENV = ["ODLA_EDITOR", "VISUAL", "EDITOR"];
|
|
8829
|
-
function resolveEditor(env =
|
|
8859
|
+
function resolveEditor(env = process10.env) {
|
|
8830
8860
|
for (const name of EDITOR_ENV) {
|
|
8831
8861
|
const value = env[name];
|
|
8832
8862
|
if (value && value.trim()) return value.trim();
|
|
@@ -8840,8 +8870,8 @@ function defaultRun(command, path) {
|
|
|
8840
8870
|
return result.status ?? 0;
|
|
8841
8871
|
}
|
|
8842
8872
|
function editText(initial, slug, deps = {}) {
|
|
8843
|
-
const env = deps.env ??
|
|
8844
|
-
const interactive = deps.interactive ?? (() => Boolean(
|
|
8873
|
+
const env = deps.env ?? process10.env;
|
|
8874
|
+
const interactive = deps.interactive ?? (() => Boolean(process10.stdin.isTTY));
|
|
8845
8875
|
const editor = resolveEditor(env);
|
|
8846
8876
|
if (!editor)
|
|
8847
8877
|
throw new Error(
|
|
@@ -8959,10 +8989,10 @@ var CONFIG_FREE = /* @__PURE__ */ new Set(["list", "search", "ask", "get", "cat"
|
|
|
8959
8989
|
async function loadOrDefaultConfig(configPath, action, appId) {
|
|
8960
8990
|
const projectScoped = appId !== void 0;
|
|
8961
8991
|
if (!projectScoped && CONFIG_FREE.has(action) && !existsSync10(resolve10(configPath))) {
|
|
8962
|
-
const rootDir =
|
|
8992
|
+
const rootDir = process11.cwd();
|
|
8963
8993
|
return {
|
|
8964
8994
|
configPath,
|
|
8965
|
-
platformUrl:
|
|
8995
|
+
platformUrl: process11.env.ODLA_PLATFORM_URL ?? "https://odla.ai",
|
|
8966
8996
|
rootDir,
|
|
8967
8997
|
app: { id: "", name: "" },
|
|
8968
8998
|
local: { tokenFile: join12(rootDir, ".odla/dev-token.json") }
|
|
@@ -9554,6 +9584,7 @@ function exitCodeFor(err) {
|
|
|
9554
9584
|
}
|
|
9555
9585
|
async function runCli(argv = process.argv.slice(2), dependencies = {}) {
|
|
9556
9586
|
const parsed = parseArgv(argv);
|
|
9587
|
+
recordInvocation(parsed);
|
|
9557
9588
|
const command = parsed.positionals[0] ?? "help";
|
|
9558
9589
|
if (command === "version" || command === "-v" || parsed.options.version === true) {
|
|
9559
9590
|
assertArgs(parsed, ["version"], 1);
|
|
@@ -9702,6 +9733,7 @@ export {
|
|
|
9702
9733
|
acceptedAfter,
|
|
9703
9734
|
validateInvocation,
|
|
9704
9735
|
describeProblem,
|
|
9736
|
+
invocationPath,
|
|
9705
9737
|
surfacePaths,
|
|
9706
9738
|
runHostedSecurity,
|
|
9707
9739
|
getHostedSecurityIntent,
|
|
@@ -9715,4 +9747,4 @@ export {
|
|
|
9715
9747
|
exitCodeFor,
|
|
9716
9748
|
runCli
|
|
9717
9749
|
};
|
|
9718
|
-
//# sourceMappingURL=chunk-
|
|
9750
|
+
//# sourceMappingURL=chunk-DINDRUDA.js.map
|