Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions KeeperSdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ Most examples call the shared `login()` helper, which attempts persistent login

See [`examples/sdk_example/README.md`](../examples/sdk_example/README.md) for the full command list.

Prefer an interactive shell over one-off scripts? See [`examples/repl`](../examples/repl/README.md)
for a REPL that logs in once and runs vault commands (`ls`, `cd`, `get`, `find`, …) until you exit.

---

## Development Setup
Expand Down Expand Up @@ -467,6 +470,7 @@ keeper-sdk-javascript/
├── keeperapi/ # @keeper-security/keeperapi
└── examples/
├── sdk_example/ # Runnable Node scripts (auth, records, folders, …)
├── repl/ # Interactive vault shell
├── print-vault-node/ # Additional Node sample
└── print-vault-browser/ # Browser sample
```
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ keeper-sdk-javascript/
├── KeeperSdk/ # @keeper-security/keeper-sdk-javascript
├── keeperapi/ # @keeper-security/keeperapi
└── examples/
└── sdk_example/ # Runnable Node scripts (auth, records, folders, …)
├── sdk_example/ # Runnable Node scripts (auth, records, folders, …)
└── repl/ # Interactive vault shell (see examples/repl/README.md)
```

**Start here for CLI / vault behavior:** [`KeeperSdk/README.md`](KeeperSdk/README.md) — built-in commands, `get` / `whoami` output, and `KeeperCliHost` adapter requirements.
Expand All @@ -46,6 +47,15 @@ npm run auth:restore-session -- --from-json /path/to/session.json
npm run records:list:shell-cli -- --from-json /path/to/session.json
```

Or jump into the interactive vault REPL (needs `KeeperSdk` linked via `npm run link-local` above):

```bash
cd examples/repl && npm install
npm start
```

See [`examples/repl/README.md`](examples/repl/README.md) for the command list.

## Package docs

- [`KeeperSdk/README.md`](KeeperSdk/README.md) — API, CLI commands, host adapter
Expand Down
67 changes: 67 additions & 0 deletions examples/repl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Keeper Vault REPL

An interactive shell for the Keeper Vault: log in once, then run `ls`, `cd`, `get`, `find`, and
other commands against your vault until you exit.

## Prerequisites

- Node.js 20 LTS or newer
- A Keeper account with credentials

## Setup

This example depends on the sibling `KeeperSdk` and `keeperapi` packages by local path
(`file:../../KeeperSdk`, `file:../../keeperapi`), so those need to be built once before the REPL
can resolve `@keeper-security/keeperapi` at runtime:

```bash
# From the repository root
cd keeperapi && npm install && npm run build
cd ../KeeperSdk && npm install && npm run link-local && npm run build

# Now the REPL itself
cd ../examples/repl
npm install
```

## Run

```bash
npm start
```

There's no config file to set up first — on first run you'll be prompted interactively for
server, username, and password. Credentials/session are then saved to `~/.keeper/config.json` for
persistent login on subsequent runs (same file used by the other examples in this repo).

## Commands

Type `help` inside the REPL for the live list. Summary:

| Command | Description |
|---|---|
| `help` | List available commands |
| `whoami` | Show current session info |
| `pwd` | Print current working folder |
| `ls [path]` | List contents of the current (or given) folder |
| `cd [path]` | Change the current working folder (`cd /` for vault root) |
| `tree [path]` | Show the folder tree from the current (or given) folder |
| `list` | List every record in the vault |
| `find <text>` | Search records by title, login, or URL |
| `get <uid\|title>` | Show details for a single record |
| `sync` | Re-sync the vault with the server |
| `get_controllers` | Call the PAM router API (`pam/get_controllers`) and list enterprise gateways |
| `get_online_controllers` | Call the PAM router API (`loadOnlineControllers`) and list connected gateways |
| `run <script.ts> [args...]` | Execute a TypeScript file exporting `default async function(vault, args)` — see [`scripts/README.md`](scripts/README.md) |
| `history` | Show command history |
| `clear` | Clear the screen |
| `exit` / `quit` | Log out and quit the REPL |

Command history persists across sessions in `~/.keeper/repl_history` (excluding `history`, `exit`,
`quit`, `clear`); use `!<n>` to re-run entry `n` from `history`, bash-style.

## Extending

Drop a `.ts` file under [`scripts/`](scripts/README.md) and run it with `run scripts/<file>.ts` for
one-off tasks against the live, authenticated `vault` — no rebuild needed. Promote anything that
turns out to be a permanent command into `src/commands.ts`.
Loading