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
1 change: 1 addition & 0 deletions .changeset/cli-tool.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
"@scope3/agentic-client": minor
"scope3": minor
---

Add dynamic CLI tool for Scope3 Agentic API with automatic command generation
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ jobs:
title: 'chore: version packages'
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60 changes: 60 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Source files (we only publish compiled JS)
src/
*.ts
!*.d.ts

# Tests
**/*.test.js
**/*.test.ts
**/__tests__/

# Development files
.env
.env.*
!.env.example
.vscode/
.idea/

# Build artifacts we don't need
*.tsbuildinfo
tsconfig.json

# Documentation
docs/
examples/
*.md
!README.md

# Git
.git/
.gitignore
.github/

# CI/CD
.husky/

# Config files
.eslintrc.json
.prettierrc.json
jest.config.js

# OpenAPI specs (large files not needed at runtime)
*.yaml
openapi.yaml
media-agent-openapi.yaml
outcome-agent-openapi.yaml
partner-api.yaml
platform-api.yaml

# Test files
test-*.ts
test-*.js

# Changesets
.changeset/

# Scripts
scripts/

# Conductor config
conductor.json
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { Scope3AgenticClient } from '@scope3/agentic-client';

const client = new Scope3AgenticClient({
apiKey: process.env.SCOPE3_API_KEY,
// Optional: specify environment (defaults to 'production')
environment: 'production', // or 'staging'
});

// List brand agents
Expand All @@ -49,19 +51,35 @@ const campaign = await client.campaigns.create({
The CLI dynamically discovers available commands from the API server, ensuring it's always up-to-date:

```bash
# Install globally
# Install globally or use npx
npm install -g @scope3/agentic-client
# or
npx @scope3/agentic-client --help

# Configure authentication
scope3 config set apiKey your_api_key_here

# Configure environment (optional - defaults to production)
scope3 config set environment staging

# Or use environment variables
export SCOPE3_API_KEY=your_api_key_here
export SCOPE3_ENVIRONMENT=staging # or 'production'

# Or use command-line flags
scope3 --environment staging list-tools

# Discover available commands (80+ auto-generated)
scope3 list-tools

# Examples
scope3 brand-agent list
scope3 campaign create --prompt "Q1 2024 Spring Campaign" --brandAgentId 123
scope3 media-buy execute --mediaBuyId "buy_123"

# Switch environments on the fly
scope3 --environment production campaign list
scope3 --environment staging campaign list
```

**Dynamic Updates:** Commands automatically stay in sync with API changes. No manual updates needed!
Expand All @@ -71,11 +89,23 @@ scope3 media-buy execute --mediaBuyId "buy_123"
```typescript
const client = new Scope3AgenticClient({
apiKey: 'your-api-key',
baseUrl: 'https://api.agentic.scope3.com', // optional, defaults to production
timeout: 30000, // optional, request timeout in ms

// Option 1: Use environment (recommended)
environment: 'production', // 'production' or 'staging' (default: 'production')

// Option 2: Use custom base URL (overrides environment)
baseUrl: 'https://custom-api.example.com',

// Optional settings
timeout: 30000, // request timeout in ms
});
```

### Environment URLs

- **Production**: `https://api.agentic.scope3.com`
- **Staging**: `https://api.agentic.staging.scope3.com`

## API Resources

The client provides access to all Scope3 API resources:
Expand Down
26 changes: 24 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"name": "@scope3/agentic-client",
"version": "1.0.4",
"version": "1.0.5",
"description": "TypeScript client for the Scope3 Agentic API with AdCP webhook support",
"workspaces": [
"packages/*"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"README.md",
"LICENSE",
".env.example"
],
"publishConfig": {
"access": "public"
},
Expand All @@ -23,10 +32,11 @@
"generate-platform-api-types": "openapi-typescript platform-api.yaml -o src/types/platform-api.ts",
"update-schemas": "curl -f -o outcome-agent-openapi.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/outcome-agent-openapi.yaml && curl -f -o partner-api.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/partner-api.yaml && curl -f -o platform-api.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/platform-api.yaml && npm run generate-outcome-agent-types && npm run generate-partner-api-types && npm run generate-platform-api-types",
"prepare": "husky",
"prepublishOnly": "npm run build",
"pretest": "npm run type-check",
"changeset": "changeset",
"version": "changeset version",
"release": "npm run build && npm publish"
"release": "npm run build && changeset publish"
},
"keywords": [
"scope3",
Expand Down
1 change: 1 addition & 0 deletions packages/scope3-cli/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Automatically rewrite file: dependencies to version numbers on publish
48 changes: 48 additions & 0 deletions packages/scope3-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# scope3

Command-line interface for the Scope3 Agentic API.

This is a thin wrapper around [@scope3/agentic-client](https://www.npmjs.com/package/@scope3/agentic-client) that provides a shorter package name for easier CLI usage.

## Installation

```bash
# Global installation
npm install -g scope3

# Or use directly with npx
npx scope3 --help
```

## Usage

```bash
# Configure your API key
scope3 config set apiKey YOUR_API_KEY

# List available commands
scope3 list-tools

# Use dynamic commands
scope3 brand-agent list
scope3 campaign create --name "My Campaign"

# Output formats
scope3 media-product list --format json
scope3 media-product list --format list
scope3 media-product list --format table # default

# Environment switching
scope3 --environment staging brand-agent list

# Debug mode
scope3 --debug campaign get --campaignId 123
```

## Documentation

For full documentation, see [@scope3/agentic-client](https://www.npmjs.com/package/@scope3/agentic-client)

## License

MIT
3 changes: 3 additions & 0 deletions packages/scope3-cli/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
// Thin wrapper that re-exports the CLI from @scope3/agentic-client
require('@scope3/agentic-client/dist/cli.js');
36 changes: 36 additions & 0 deletions packages/scope3-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "scope3",
"version": "1.0.5",
"description": "Scope3 Agentic CLI - Command-line interface for the Scope3 Agentic API",
"bin": {
"scope3": "./cli.js"
},
"files": [
"cli.js",
"README.md"
],
"keywords": [
"scope3",
"agentic",
"cli",
"advertising",
"adtech"
],
"author": "Scope3",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/scope3data/agentic-client.git",
"directory": "packages/scope3-cli"
},
"homepage": "https://github.com/scope3data/agentic-client#readme",
"bugs": {
"url": "https://github.com/scope3data/agentic-client/issues"
},
"dependencies": {
"@scope3/agentic-client": "file:../.."
},
"publishConfig": {
"access": "public"
}
}
Loading