@saptools/bruno 0.3.5 → 0.3.6
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 -77
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Scaffold a CF-aware collection. Resolve requests by `region/org/space/app` short
|
|
|
13
13
|
[](https://www.typescriptlang.org)
|
|
14
14
|
[](https://github.com/dongitran/saptools/actions/workflows/bruno.yml)
|
|
15
15
|
|
|
16
|
-
[**Install**](#-install) · [**Quick Start**](#-quick-start) · [**CLI**](#-cli) · [**
|
|
16
|
+
[**Install**](#-install) · [**Quick Start**](#-quick-start) · [**CLI**](#-cli) · [**FAQ**](#-faq) · [**Roadmap**](#-roadmap)
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -253,82 +253,6 @@ The context lives at `~/.saptools/bruno-context.json`.
|
|
|
253
253
|
|
|
254
254
|
---
|
|
255
255
|
|
|
256
|
-
## 🧑💻 Programmatic Usage
|
|
257
|
-
|
|
258
|
-
```ts
|
|
259
|
-
import {
|
|
260
|
-
buildRunPlan,
|
|
261
|
-
readContext,
|
|
262
|
-
runBruno,
|
|
263
|
-
scanCollection,
|
|
264
|
-
setupApp,
|
|
265
|
-
useContext,
|
|
266
|
-
} from "@saptools/bruno";
|
|
267
|
-
|
|
268
|
-
// 1. Scaffold an app folder (BYO prompts — perfect for headless/CI)
|
|
269
|
-
const result = await setupApp({
|
|
270
|
-
root: "./collections",
|
|
271
|
-
prompts: {
|
|
272
|
-
selectRegion: async (choices) => choices[0]!.value,
|
|
273
|
-
selectOrg: async (choices) => choices[0]!.value,
|
|
274
|
-
selectSpace: async (choices) => choices[0]!.value,
|
|
275
|
-
selectApp: async (choices) => choices[0]!.value,
|
|
276
|
-
confirmCreate: async () => true,
|
|
277
|
-
selectEnvironments: async ({ common }) => [...common, "qa-eu"],
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
console.log(`Created ${result.environments.length} env files at ${result.appPath}`);
|
|
281
|
-
|
|
282
|
-
// 2. Pin a default context for later runs
|
|
283
|
-
await useContext({ shorthand: "ap10/my-org/dev/my-srv" });
|
|
284
|
-
|
|
285
|
-
// 3. Run Bruno — token is fetched and injected for you
|
|
286
|
-
const run = await runBruno({
|
|
287
|
-
root: "./collections",
|
|
288
|
-
target: "ap10/my-org/dev/my-srv",
|
|
289
|
-
environment: "dev",
|
|
290
|
-
});
|
|
291
|
-
process.exit(run.code);
|
|
292
|
-
|
|
293
|
-
// 4. Need the plan without spawning `bru`? (CI dry-runs, IDE integrations)
|
|
294
|
-
const plan = await buildRunPlan({
|
|
295
|
-
root: "./collections",
|
|
296
|
-
target: "ap10/my-org/dev/my-srv",
|
|
297
|
-
environment: "dev",
|
|
298
|
-
});
|
|
299
|
-
console.log(plan.bruArgs);
|
|
300
|
-
// → ["run", "--env", "dev", "--env-var", "accessToken=..."]
|
|
301
|
-
|
|
302
|
-
// 5. Walk a whole collection to build a UI tree
|
|
303
|
-
const tree = await scanCollection("./collections");
|
|
304
|
-
console.log(tree.regions.map((r) => r.key));
|
|
305
|
-
|
|
306
|
-
// 6. Inspect the active default context
|
|
307
|
-
const ctx = await readContext();
|
|
308
|
-
console.log(ctx?.app);
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
<details>
|
|
312
|
-
<summary><b>📚 Full export list</b></summary>
|
|
313
|
-
|
|
314
|
-
| Export | Description |
|
|
315
|
-
| --- | --- |
|
|
316
|
-
| `setupApp(options)` | Interactive app-folder scaffolder with pluggable prompts |
|
|
317
|
-
| `COMMON_ENVIRONMENTS` | Default environment-name suggestions (`local`, `dev`, `staging`, `prod`) |
|
|
318
|
-
| `runBruno(options)` | Build a plan and spawn `bru run` with token injected |
|
|
319
|
-
| `buildRunPlan(options)` | Build the plan (args, cwd, env file, token) without spawning |
|
|
320
|
-
| `useContext({ shorthand, verify })` | Pin a default region/org/space/app context |
|
|
321
|
-
| `readContext()` | Read the pinned context, or `undefined` |
|
|
322
|
-
| `writeContext(ctx)` | Persist a new default context |
|
|
323
|
-
| `scanCollection(root)` | Walk the folder tree and return a typed `region → org → space → app → env` view |
|
|
324
|
-
| `parseShorthandPath(shorthand)` | Split `region/org/space/app[/file]` into a typed ref |
|
|
325
|
-
| `parseBruEnvFile(raw)` / `writeBruEnvFile(...)` | Minimal `.bru` env reader/writer |
|
|
326
|
-
| `readCfMetaFromFile(path)` / `writeCfMetaToFile(path, ref)` | Round-trip `__cf_*` vars in an env file |
|
|
327
|
-
|
|
328
|
-
</details>
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
256
|
## 📁 Folder Layout
|
|
333
257
|
|
|
334
258
|
All state lives under your home directory or your collection root:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saptools/bruno",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Smart runner for Bruno \u2014 CF-aware env metadata, automatic token injection, and shorthand paths",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@inquirer/prompts": "^8.3.2",
|
|
55
|
-
"@saptools/cf-sync": "^0.4.
|
|
56
|
-
"@saptools/cf-xsuaa": "^0.1.
|
|
55
|
+
"@saptools/cf-sync": "^0.4.15",
|
|
56
|
+
"@saptools/cf-xsuaa": "^0.1.11",
|
|
57
57
|
"@usebruno/cli": "^3.5.0",
|
|
58
58
|
"commander": "^13.0.0"
|
|
59
59
|
},
|