@betterness/cli 1.0.1 → 1.1.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 +1 -1
- package/dist/index.js +45 -7
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ Each skill folder contains a `SKILL.md` (activation rules and patterns) and a `r
|
|
|
191
191
|
|
|
192
192
|
## Full CLI Reference
|
|
193
193
|
|
|
194
|
-
See [CLI_REFERENCE.md](
|
|
194
|
+
See [CLI_REFERENCE.md](https://github.com/Betterness/betterness-cli/blob/main/CLI_REFERENCE.md) for the complete list of commands, options, and descriptions.
|
|
195
195
|
|
|
196
196
|
## License
|
|
197
197
|
|
package/dist/index.js
CHANGED
|
@@ -92,10 +92,10 @@ var ApiClient = class {
|
|
|
92
92
|
constructor(options = {}) {
|
|
93
93
|
const credentials = resolveCredentials(options.apiKey);
|
|
94
94
|
this.apiKey = credentials.apiKey;
|
|
95
|
-
const apiUrl =
|
|
95
|
+
const apiUrl = "https://api.betterness.com";
|
|
96
96
|
if (!apiUrl) {
|
|
97
97
|
throw new CliError(
|
|
98
|
-
"No API URL configured.
|
|
98
|
+
"No API URL configured. This is a build error \u2014 BETTERNESS_API_URL should be baked in at build time.",
|
|
99
99
|
"CONFIG_MISSING"
|
|
100
100
|
);
|
|
101
101
|
}
|
|
@@ -125,7 +125,7 @@ var ApiClient = class {
|
|
|
125
125
|
headers: {
|
|
126
126
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
127
127
|
"Content-Type": "application/json",
|
|
128
|
-
"User-Agent":
|
|
128
|
+
"User-Agent": `betterness-cli/${"1.1.0"}`,
|
|
129
129
|
"Accept": "application/json"
|
|
130
130
|
},
|
|
131
131
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -189,7 +189,7 @@ var ApiClient = class {
|
|
|
189
189
|
method: "POST",
|
|
190
190
|
headers: {
|
|
191
191
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
192
|
-
"User-Agent":
|
|
192
|
+
"User-Agent": `betterness-cli/${"1.1.0"}`,
|
|
193
193
|
"Accept": "application/json"
|
|
194
194
|
},
|
|
195
195
|
body: formData,
|
|
@@ -1341,10 +1341,10 @@ function registerLabResultsCommands(program2) {
|
|
|
1341
1341
|
});
|
|
1342
1342
|
labResults.command("upload").description("Upload a lab result PDF for processing").requiredOption("--file <path>", "Path to the PDF file").action(async (opts, cmd) => {
|
|
1343
1343
|
try {
|
|
1344
|
-
const { existsSync:
|
|
1344
|
+
const { existsSync: existsSync3 } = await import("fs");
|
|
1345
1345
|
const { resolve } = await import("path");
|
|
1346
1346
|
const filePath = resolve(opts.file);
|
|
1347
|
-
if (!
|
|
1347
|
+
if (!existsSync3(filePath)) {
|
|
1348
1348
|
console.error(`File not found: ${filePath}`);
|
|
1349
1349
|
process.exit(1);
|
|
1350
1350
|
}
|
|
@@ -1806,10 +1806,47 @@ function registerSchemaCommand(program2) {
|
|
|
1806
1806
|
});
|
|
1807
1807
|
}
|
|
1808
1808
|
|
|
1809
|
+
// src/commands/debug.ts
|
|
1810
|
+
import { homedir as homedir2 } from "os";
|
|
1811
|
+
import { join as join2 } from "path";
|
|
1812
|
+
import { existsSync as existsSync2 } from "fs";
|
|
1813
|
+
function registerDebugCommands(program2) {
|
|
1814
|
+
const debug = program2.command("debug", { hidden: true }).description("Internal debug utilities");
|
|
1815
|
+
debug.command("config").description("Show resolved configuration").action((_, cmd) => {
|
|
1816
|
+
const credentialsPath = join2(homedir2(), ".betterness", "credentials.json");
|
|
1817
|
+
const stored = loadCredentials();
|
|
1818
|
+
const envKey = process.env.BETTERNESS_API_KEY;
|
|
1819
|
+
const parentOpts = cmd.optsWithGlobals();
|
|
1820
|
+
const authSource = parentOpts.apiKey ? "--api-key flag" : envKey ? "BETTERNESS_API_KEY env" : stored ? "~/.betterness/credentials.json" : "none";
|
|
1821
|
+
const config = {
|
|
1822
|
+
version: "1.1.0",
|
|
1823
|
+
apiUrl: "https://api.betterness.com",
|
|
1824
|
+
authSource,
|
|
1825
|
+
credentialsFile: credentialsPath,
|
|
1826
|
+
credentialsExists: String(existsSync2(credentialsPath))
|
|
1827
|
+
};
|
|
1828
|
+
if (stored?.email) {
|
|
1829
|
+
config.storedEmail = stored.email;
|
|
1830
|
+
}
|
|
1831
|
+
if (stored?.savedAt) {
|
|
1832
|
+
config.credentialsSavedAt = stored.savedAt;
|
|
1833
|
+
}
|
|
1834
|
+
const parentFormat = parentOpts.json ? "json" : parentOpts.markdown ? "markdown" : "table";
|
|
1835
|
+
if (parentFormat === "json") {
|
|
1836
|
+
console.log(JSON.stringify(config, null, 2));
|
|
1837
|
+
} else {
|
|
1838
|
+
const maxKey = Math.max(...Object.keys(config).map((k) => k.length));
|
|
1839
|
+
for (const [key, value] of Object.entries(config)) {
|
|
1840
|
+
console.log(`${key.padEnd(maxKey)} ${value}`);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1809
1846
|
// src/program.ts
|
|
1810
1847
|
function createProgram() {
|
|
1811
1848
|
const program2 = new Command();
|
|
1812
|
-
program2.name("betterness").description("Betterness CLI - Agent-first terminal interface for the Betterness platform").version("
|
|
1849
|
+
program2.name("betterness").description("Betterness CLI - Agent-first terminal interface for the Betterness platform").version("1.1.0").option("--api-key <key>", "API key (overrides env and stored credentials)").option("--json", "Output as JSON").option("--markdown", "Output as Markdown").option("--quiet", "Suppress output (exit code only)");
|
|
1813
1850
|
registerAuthCommands(program2);
|
|
1814
1851
|
registerProfileCommands(program2);
|
|
1815
1852
|
registerBiomarkersCommands(program2);
|
|
@@ -1827,6 +1864,7 @@ function createProgram() {
|
|
|
1827
1864
|
registerSmartListingsCommands(program2);
|
|
1828
1865
|
registerWorkflowCommands(program2);
|
|
1829
1866
|
registerSchemaCommand(program2);
|
|
1867
|
+
registerDebugCommands(program2);
|
|
1830
1868
|
return program2;
|
|
1831
1869
|
}
|
|
1832
1870
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterness/cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Betterness CLI - Agent-first terminal interface for the Betterness platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,15 +15,13 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"dev": "
|
|
19
|
-
"dev:watch": "tsup --watch",
|
|
18
|
+
"dev": "npm run build && ln -sf $(pwd)/dist/index.js /usr/local/bin/bttr && chmod +x /usr/local/bin/bttr",
|
|
20
19
|
"build": "tsup",
|
|
21
20
|
"lint": "eslint src/",
|
|
22
21
|
"typecheck": "tsc --noEmit",
|
|
23
22
|
"test": "vitest run",
|
|
24
|
-
"test:watch": "vitest",
|
|
25
23
|
"docs": "tsx scripts/generate-docs.ts",
|
|
26
|
-
"prepublishOnly": "npm run build"
|
|
24
|
+
"prepublishOnly": "NODE_ENV=production npm run build"
|
|
27
25
|
},
|
|
28
26
|
"engines": {
|
|
29
27
|
"node": ">=20.0.0"
|