@org-dashboard/cli 0.0.1-beta.13 → 0.0.1-beta.15
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 +9 -0
- package/dist/index.js +126 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@ npm install -g @org-dashboard/cli@beta
|
|
|
19
19
|
org help
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
Point the CLI at a preview or self-hosted environment:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
org config set base-url https://dev.orgdashboard.com
|
|
26
|
+
```
|
|
27
|
+
|
|
22
28
|
## Login
|
|
23
29
|
|
|
24
30
|
```sh
|
|
@@ -40,4 +46,7 @@ org tools github repos list
|
|
|
40
46
|
org tools github issues search --json '{"repo":"isaiahb/org-dashboard","query":"cli"}'
|
|
41
47
|
org tools linear
|
|
42
48
|
org tools linear teams list
|
|
49
|
+
org tools gmail
|
|
50
|
+
org tools gmail labels list
|
|
51
|
+
org tools gmail threads list --json '{"query":"from:customer newer_than:7d"}'
|
|
43
52
|
```
|
package/dist/index.js
CHANGED
|
@@ -4053,7 +4053,7 @@ var kbSearchSchema = exports_external.object({
|
|
|
4053
4053
|
offset: exports_external.number().int().min(0).optional().default(0)
|
|
4054
4054
|
});
|
|
4055
4055
|
// ../shared/constants.ts
|
|
4056
|
-
var DEFAULT_API_URL = "
|
|
4056
|
+
var DEFAULT_API_URL = "https://orgdashboard.com";
|
|
4057
4057
|
// ../shared/api-client.ts
|
|
4058
4058
|
class OrgDashboardClient {
|
|
4059
4059
|
baseUrl;
|
|
@@ -4093,6 +4093,15 @@ class OrgDashboardClient {
|
|
|
4093
4093
|
body: JSON.stringify(input)
|
|
4094
4094
|
});
|
|
4095
4095
|
}
|
|
4096
|
+
async toolsHistory(params) {
|
|
4097
|
+
const searchParams = new URLSearchParams;
|
|
4098
|
+
if (params?.provider)
|
|
4099
|
+
searchParams.set("provider", params.provider);
|
|
4100
|
+
if (params?.limit)
|
|
4101
|
+
searchParams.set("limit", String(params.limit));
|
|
4102
|
+
const suffix = searchParams.size > 0 ? `?${searchParams.toString()}` : "";
|
|
4103
|
+
return this.request(`/tools/executions${suffix}`);
|
|
4104
|
+
}
|
|
4096
4105
|
async actionPropose(action2) {
|
|
4097
4106
|
return this.request("/actions", {
|
|
4098
4107
|
method: "POST",
|
|
@@ -4109,6 +4118,9 @@ class OrgDashboardClient {
|
|
|
4109
4118
|
// lib/config.ts
|
|
4110
4119
|
var CONFIG_DIR = join(homedir(), ".orgdashboard");
|
|
4111
4120
|
var CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
4121
|
+
function getConfigPath() {
|
|
4122
|
+
return CONFIG_FILE;
|
|
4123
|
+
}
|
|
4112
4124
|
function getConfig() {
|
|
4113
4125
|
if (!existsSync(CONFIG_FILE)) {
|
|
4114
4126
|
return { authToken: "", apiKey: "", baseUrl: DEFAULT_API_URL };
|
|
@@ -4150,6 +4162,9 @@ COMMANDS
|
|
|
4150
4162
|
help Show this help (+ org context if authenticated)
|
|
4151
4163
|
login Authenticate in the browser
|
|
4152
4164
|
auth <token> Store an API key or CLI token manually
|
|
4165
|
+
config Show local CLI config
|
|
4166
|
+
config get base-url Print the configured API base URL
|
|
4167
|
+
config set base-url <url> Set the API base URL
|
|
4153
4168
|
|
|
4154
4169
|
connections list List connected data sources
|
|
4155
4170
|
|
|
@@ -4157,6 +4172,7 @@ COMMANDS
|
|
|
4157
4172
|
tools <provider> List commands for a provider
|
|
4158
4173
|
tools <provider> <cmd> Execute a provider command
|
|
4159
4174
|
tools <provider> exec <slug> <json> Execute a raw provider tool slug
|
|
4175
|
+
tools history Show recent tool executions
|
|
4160
4176
|
|
|
4161
4177
|
action propose <action> Propose a write action for approval
|
|
4162
4178
|
|
|
@@ -4200,6 +4216,83 @@ async function auth(args) {
|
|
|
4200
4216
|
console.log("Authenticated successfully. Token stored.");
|
|
4201
4217
|
}
|
|
4202
4218
|
|
|
4219
|
+
// commands/config.ts
|
|
4220
|
+
async function config(args) {
|
|
4221
|
+
const subcommand = args[0];
|
|
4222
|
+
if (!subcommand) {
|
|
4223
|
+
return showConfig();
|
|
4224
|
+
}
|
|
4225
|
+
if (subcommand === "get") {
|
|
4226
|
+
return getConfigValue(args.slice(1));
|
|
4227
|
+
}
|
|
4228
|
+
if (subcommand === "set") {
|
|
4229
|
+
return setConfigValue(args.slice(1));
|
|
4230
|
+
}
|
|
4231
|
+
console.error("Usage: org config [get|set] [key] [value]");
|
|
4232
|
+
process.exit(1);
|
|
4233
|
+
}
|
|
4234
|
+
function showConfig() {
|
|
4235
|
+
const current = getConfig();
|
|
4236
|
+
const authToken = getAuthToken(current);
|
|
4237
|
+
console.log(`OrgDashboard CLI config
|
|
4238
|
+
`);
|
|
4239
|
+
console.log(`Path: ${getConfigPath()}`);
|
|
4240
|
+
console.log(`Base URL: ${current.baseUrl}`);
|
|
4241
|
+
console.log(`Auth: ${authToken ? "configured" : "not configured"}`);
|
|
4242
|
+
if (current.apiKey && current.authToken === current.apiKey) {
|
|
4243
|
+
console.log("Token type: legacy api key");
|
|
4244
|
+
} else if (current.authToken) {
|
|
4245
|
+
console.log("Token type: cli token");
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
function getConfigValue(args) {
|
|
4249
|
+
const key = args[0];
|
|
4250
|
+
if (!key) {
|
|
4251
|
+
console.error("Usage: org config get <base-url>");
|
|
4252
|
+
process.exit(1);
|
|
4253
|
+
}
|
|
4254
|
+
const current = getConfig();
|
|
4255
|
+
switch (key) {
|
|
4256
|
+
case "base-url":
|
|
4257
|
+
console.log(current.baseUrl);
|
|
4258
|
+
return;
|
|
4259
|
+
default:
|
|
4260
|
+
console.error(`Unsupported config key: ${key}`);
|
|
4261
|
+
process.exit(1);
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
function setConfigValue(args) {
|
|
4265
|
+
const key = args[0];
|
|
4266
|
+
const value = args[1];
|
|
4267
|
+
if (!key || !value) {
|
|
4268
|
+
console.error("Usage: org config set <base-url> <value>");
|
|
4269
|
+
process.exit(1);
|
|
4270
|
+
}
|
|
4271
|
+
switch (key) {
|
|
4272
|
+
case "base-url": {
|
|
4273
|
+
const normalized = normalizeBaseUrl(value);
|
|
4274
|
+
saveConfig({ baseUrl: normalized });
|
|
4275
|
+
console.log(`Saved base URL: ${normalized}`);
|
|
4276
|
+
return;
|
|
4277
|
+
}
|
|
4278
|
+
default:
|
|
4279
|
+
console.error(`Unsupported config key: ${key}`);
|
|
4280
|
+
process.exit(1);
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
function normalizeBaseUrl(value) {
|
|
4284
|
+
try {
|
|
4285
|
+
const url = new URL(value);
|
|
4286
|
+
url.pathname = "";
|
|
4287
|
+
url.search = "";
|
|
4288
|
+
url.hash = "";
|
|
4289
|
+
return url.toString().replace(/\/$/, "");
|
|
4290
|
+
} catch {
|
|
4291
|
+
console.error("Base URL must be a valid absolute URL, e.g. https://dev.orgdashboard.com");
|
|
4292
|
+
process.exit(1);
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4203
4296
|
// commands/login.ts
|
|
4204
4297
|
var LOGIN_TIMEOUT_MS = 2 * 60 * 1000;
|
|
4205
4298
|
function renderCallbackPage(input) {
|
|
@@ -4523,7 +4616,7 @@ async function exchangeCode(baseUrl, payload) {
|
|
|
4523
4616
|
return body;
|
|
4524
4617
|
}
|
|
4525
4618
|
async function login(args) {
|
|
4526
|
-
const
|
|
4619
|
+
const config2 = getConfig();
|
|
4527
4620
|
const label = args.join(" ").trim() || "CLI";
|
|
4528
4621
|
const state = randomHex();
|
|
4529
4622
|
let timeoutId = null;
|
|
@@ -4575,7 +4668,7 @@ async function login(args) {
|
|
|
4575
4668
|
}
|
|
4576
4669
|
});
|
|
4577
4670
|
const callbackUrl = `http://127.0.0.1:${server.port}/callback`;
|
|
4578
|
-
const browserUrl = withPath(
|
|
4671
|
+
const browserUrl = withPath(config2.baseUrl, "/cli/login");
|
|
4579
4672
|
browserUrl.searchParams.set("callback_url", callbackUrl);
|
|
4580
4673
|
browserUrl.searchParams.set("state", state);
|
|
4581
4674
|
browserUrl.searchParams.set("label", label);
|
|
@@ -4593,7 +4686,7 @@ ${browserUrl.toString()}`);
|
|
|
4593
4686
|
timeoutId = setTimeout(() => reject(new Error("Timed out waiting for browser login")), LOGIN_TIMEOUT_MS);
|
|
4594
4687
|
})
|
|
4595
4688
|
]);
|
|
4596
|
-
const result = await exchangeCode(
|
|
4689
|
+
const result = await exchangeCode(config2.baseUrl, callback);
|
|
4597
4690
|
saveConfig({ authToken: result.token });
|
|
4598
4691
|
console.log("Authenticated successfully. CLI token stored.");
|
|
4599
4692
|
} finally {
|
|
@@ -4618,6 +4711,12 @@ async function tools(client, args) {
|
|
|
4618
4711
|
renderProviders(result2.items);
|
|
4619
4712
|
return;
|
|
4620
4713
|
}
|
|
4714
|
+
if (provider === "history") {
|
|
4715
|
+
const historyProvider = args[1];
|
|
4716
|
+
const result2 = await client.toolsHistory({ provider: historyProvider });
|
|
4717
|
+
renderHistory(result2);
|
|
4718
|
+
return;
|
|
4719
|
+
}
|
|
4621
4720
|
if (args.length === 1) {
|
|
4622
4721
|
const result2 = await client.toolsProvider(provider);
|
|
4623
4722
|
renderProviderManifest(result2.provider, result2.status, result2.items);
|
|
@@ -4638,6 +4737,7 @@ function renderProviders(items) {
|
|
|
4638
4737
|
console.log(`- ${item.provider} (${item.status})`);
|
|
4639
4738
|
}
|
|
4640
4739
|
console.log("\nUse `org tools <provider>` to inspect provider commands.");
|
|
4740
|
+
console.log("Use `org tools history` to inspect recent executions.");
|
|
4641
4741
|
}
|
|
4642
4742
|
function renderProviderManifest(provider, status, items) {
|
|
4643
4743
|
console.log(`${provider} (${status})`);
|
|
@@ -4658,6 +4758,22 @@ Commands:
|
|
|
4658
4758
|
Use \`org tools ${provider} <command> --json '{...}'\` to execute a command.`);
|
|
4659
4759
|
console.log(`Use \`org tools ${provider} exec <TOOL_SLUG> '{...}'\` to execute by raw tool slug.`);
|
|
4660
4760
|
}
|
|
4761
|
+
function renderHistory(items) {
|
|
4762
|
+
if (items.length === 0) {
|
|
4763
|
+
console.log("No tool executions recorded yet.");
|
|
4764
|
+
return;
|
|
4765
|
+
}
|
|
4766
|
+
console.log(`Recent tool executions:
|
|
4767
|
+
`);
|
|
4768
|
+
for (const item of items) {
|
|
4769
|
+
const command = item.command_path.join(" ") || item.tool_slug;
|
|
4770
|
+
const timestamp = new Date(item.created_at).toLocaleString();
|
|
4771
|
+
console.log(`- ${item.provider} :: ${command} :: ${item.status} :: ${timestamp}`);
|
|
4772
|
+
if (item.error) {
|
|
4773
|
+
console.log(` error: ${item.error}`);
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4661
4777
|
function parseToolExecutionArgs(args) {
|
|
4662
4778
|
if (args[0] === "exec") {
|
|
4663
4779
|
const tool = args[1];
|
|
@@ -4736,14 +4852,17 @@ async function main() {
|
|
|
4736
4852
|
if (command === "login") {
|
|
4737
4853
|
return login(args.slice(1));
|
|
4738
4854
|
}
|
|
4739
|
-
|
|
4740
|
-
|
|
4855
|
+
if (command === "config") {
|
|
4856
|
+
return config(args.slice(1));
|
|
4857
|
+
}
|
|
4858
|
+
const config2 = getConfig();
|
|
4859
|
+
const authToken = getAuthToken(config2);
|
|
4741
4860
|
if (!authToken) {
|
|
4742
4861
|
console.error("Not authenticated. Run: org login");
|
|
4743
4862
|
process.exit(1);
|
|
4744
4863
|
}
|
|
4745
4864
|
const client = new OrgDashboardClient({
|
|
4746
|
-
baseUrl:
|
|
4865
|
+
baseUrl: config2.baseUrl,
|
|
4747
4866
|
apiKey: authToken
|
|
4748
4867
|
});
|
|
4749
4868
|
switch (command) {
|