open-index/open-npm huggingface dataset:
npm package: @neardefi/shade-agent-cli
Description: A CLI for deploying Shade Agents
Author: Matt Lockyer
Latest version: 2.2.1

# @neardefi/shade-agent-cli

CLI for deploying and managing Shade Agent contracts and agent apps (either locally or in TEEs). Create the contract account, deploy the agent contract (from source, WASM, or global hash), approve measurements and PPIDs, build the Docker image and deploy to Phala Cloud.

## Install

```bash
npm install -g @neardefi/shade-agent-cli
```

## Commands

- **`shade deploy`** — Run the full deployment from your `deployment.yaml`.
- **`shade reproduce`** — Produces the reproducible Docker image hash and the app compose hash. Used when verifying the code.
- **`shade plan`** — Show what the deployment will do without executing.
- **`shade whitelist`** — Whitelist an agent account for local mode (`whitelist_agent_for_local`).
- **`shade auth`** — Set NEAR credentials (master account per network) and optional Phala API key for TEE deploys.

Run `shade` with no arguments for the interactive menu.

## Setup

1. Put a `deployment.yaml` in your project root (see example below).
2. Run **`shade auth set`** to store the NEAR master account (and Phala key if using TEE).
3. Run **`shade deploy`** from the project directory.

## Reference

The CLI docs are available [here](../docs/reference/cli.md).

## Example deployment.yaml

You can find example deployment files in the [example-deployment-files](./example-deployment-files) directory.
npm package: @neardefi/shade-agent-js
Description: A library for creating Shade Agent agents in JavaScript and TypeScript
Author: Matt Lockyer
Latest version: 2.1.0

# @neardefi/shade-agent-js

JavaScript/TypeScript library for building Shade Agent agents. Handles TEE attestation, ephemeral key derivation, and on-chain calls. Use it inside a TEE that supports Dstack or locally.

## Install

```bash
npm install @neardefi/shade-agent-js
```

## Usage

```ts
import { ShadeClient } from "@neardefi/shade-agent-js";

const client = await ShadeClient.create({
  networkId: "testnet",
  agentContractId: "agent-contract.testnet",
  sponsor: {
    accountId: "sponsor.testnet",
    privateKey: process.env.SPONSOR_PRIVATE_KEY,
  },
  numKeys: 10,
});

console.log(client.accountId());

await client.register();

const result = await client.call({
  methodName: "request_signature",
  args: { path: "...", payload: "0x...", key_type: "Ecdsa" },
  gas: BigInt("300000000000000"),
});
```

**ShadeClient:** `create(config)`, `accountId()`, `balance()`, `register()`, `call()`, `view()`, `getAttestation()`, `fund(amount)`, `isWhitelisted()`, `getPrivateKeys(acknowledgeRisk)` (use with care).

**Types:** `ShadeConfig`, `Measurements`, `FullMeasurements`, `DstackAttestationForContract`.

**Utilities:** `sanitize(value)`, `toThrowable(error)` for safe error handling.

## Key derivation and attestation

The library will detect if the library is running in a Dstack trusted execution environment. If it is in a TEE then key derivation will be random (via TEE and crypto entropy), and it will produce a real attestation. If its not in a TEE then key derivation is still random (crypto entropy) by default or deterministic if a derivation path is specified and it will produce a false default attestation (all zeros).

## Tests

Unit tests cover the whole library:

```bash
npm test
```

Coverage:

```bash
npm run test:coverage
```

## Reference

The API docs are available [here](../docs/reference/api.md).