@openfort/cli 0.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/dist/bin.js +24 -0
- package/dist/chunk-SZO4OB6U.js +23 -0
- package/dist/cli.js +2886 -0
- package/package.json +30 -0
- package/src/bin.ts +25 -0
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfort/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Openfort CLI — manage wallets, policies, and transactions from the terminal.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"openfort": "./dist/bin.js",
|
|
8
|
+
"openfort.src": "./src/bin.ts"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/cli.js",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@openfort/openfort-node": "^0.10.1",
|
|
16
|
+
"incur": "^0.3.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "latest",
|
|
20
|
+
"tsup": "^8.5.1",
|
|
21
|
+
"tsx": "^4.21.0",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "node --import tsx src/bin.ts",
|
|
26
|
+
"build": "tsup src/bin.ts src/cli.ts --format esm --clean",
|
|
27
|
+
"openfort": "node --import tsx src/bin.ts",
|
|
28
|
+
"skills": "pnpm openfort skills add"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/bin.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
2
|
+
import { CREDENTIALS_PATH } from './config.js'
|
|
3
|
+
|
|
4
|
+
function loadEnvIntoProcess(filePath: string) {
|
|
5
|
+
if (!existsSync(filePath)) return
|
|
6
|
+
const content = readFileSync(filePath, 'utf-8')
|
|
7
|
+
for (const line of content.split('\n')) {
|
|
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
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Load global credentials (user-specific keys like OPENFORT_API_KEY)
|
|
21
|
+
loadEnvIntoProcess(CREDENTIALS_PATH)
|
|
22
|
+
|
|
23
|
+
const { default: cli } = await import('./cli.js')
|
|
24
|
+
|
|
25
|
+
cli.serve()
|