@openfort/cli 0.1.7 → 0.1.9
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 +0 -8
- package/dist/bin.js +6 -17
- package/dist/chunk-SVNLXGFY.js +68 -0
- package/dist/cli.js +726 -766
- package/package.json +1 -1
- package/src/bin.ts +5 -17
- package/dist/chunk-QJGHQ7ID.js +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfort/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Openfort CLI — manage wallets, policies, and transactions from the terminal.",
|
|
5
5
|
"author": "Openfort (https://www.openfort.io)",
|
|
6
6
|
"bugs": "https://github.com/openfort-xyz/cli/issues",
|
package/src/bin.ts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
2
1
|
import { CREDENTIALS_PATH } from './config.js'
|
|
2
|
+
import { loadEnvFile } from './env.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const trimmed = line.trim()
|
|
9
|
-
if (!trimmed || trimmed.startsWith('#')) continue
|
|
10
|
-
const eqIndex = trimmed.indexOf('=')
|
|
11
|
-
if (eqIndex === -1) continue
|
|
12
|
-
const key = trimmed.slice(0, eqIndex).trim()
|
|
13
|
-
const value = trimmed.slice(eqIndex + 1).trim()
|
|
14
|
-
if (!process.env[key]) {
|
|
15
|
-
process.env[key] = value
|
|
16
|
-
}
|
|
4
|
+
// Load global credentials into process.env (user-specific keys like OPENFORT_API_KEY)
|
|
5
|
+
for (const [key, value] of loadEnvFile(CREDENTIALS_PATH)) {
|
|
6
|
+
if (!process.env[key]) {
|
|
7
|
+
process.env[key] = value
|
|
17
8
|
}
|
|
18
9
|
}
|
|
19
10
|
|
|
20
|
-
// Load global credentials (user-specific keys like OPENFORT_API_KEY)
|
|
21
|
-
loadEnvIntoProcess(CREDENTIALS_PATH)
|
|
22
|
-
|
|
23
11
|
const { default: cli } = await import('./cli.js')
|
|
24
12
|
|
|
25
13
|
cli.serve()
|
package/dist/chunk-QJGHQ7ID.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/config.ts
|
|
4
|
-
import { homedir } from "os";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
import { mkdirSync } from "fs";
|
|
7
|
-
function getConfigDir() {
|
|
8
|
-
if (process.env.XDG_CONFIG_HOME) {
|
|
9
|
-
return join(process.env.XDG_CONFIG_HOME, "openfort");
|
|
10
|
-
}
|
|
11
|
-
if (process.platform === "win32" && process.env.APPDATA) {
|
|
12
|
-
return join(process.env.APPDATA, "openfort");
|
|
13
|
-
}
|
|
14
|
-
return join(homedir(), ".config", "openfort");
|
|
15
|
-
}
|
|
16
|
-
var CONFIG_DIR = getConfigDir();
|
|
17
|
-
var CREDENTIALS_PATH = join(CONFIG_DIR, "credentials");
|
|
18
|
-
function ensureConfigDir() {
|
|
19
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
CREDENTIALS_PATH,
|
|
24
|
-
ensureConfigDir
|
|
25
|
-
};
|