newo 1.5.0 → 1.5.2
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/.env.example +17 -6
- package/CHANGELOG.md +91 -0
- package/README.md +502 -105
- package/dist/akb.d.ts +1 -1
- package/dist/akb.js +21 -17
- package/dist/api.d.ts +3 -2
- package/dist/api.js +24 -21
- package/dist/auth.d.ts +5 -5
- package/dist/auth.js +332 -75
- package/dist/cli.js +225 -29
- package/dist/customer.d.ts +23 -0
- package/dist/customer.js +87 -0
- package/dist/customerAsync.d.ts +22 -0
- package/dist/customerAsync.js +67 -0
- package/dist/customerInit.d.ts +10 -0
- package/dist/customerInit.js +78 -0
- package/dist/env.d.ts +33 -0
- package/dist/env.js +82 -0
- package/dist/fsutil.d.ts +14 -6
- package/dist/fsutil.js +35 -12
- package/dist/hash.d.ts +2 -2
- package/dist/hash.js +31 -8
- package/dist/sync.d.ts +5 -5
- package/dist/sync.js +91 -52
- package/dist/types.d.ts +76 -53
- package/package.json +16 -9
- package/src/akb.ts +23 -18
- package/src/api.ts +27 -24
- package/src/auth.ts +367 -94
- package/src/cli.ts +234 -33
- package/src/customer.ts +102 -0
- package/src/customerAsync.ts +78 -0
- package/src/customerInit.ts +97 -0
- package/src/env.ts +118 -0
- package/src/fsutil.ts +43 -11
- package/src/hash.ts +29 -8
- package/src/sync.ts +105 -54
- package/src/types.ts +82 -54
package/README.md
CHANGED
|
@@ -1,103 +1,293 @@
|
|
|
1
1
|
# NEWO CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/newo)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
**NEWO CLI** - Sync NEWO AI Agent skills between the NEWO platform and your local development environment. Supports **multi-customer workspaces**, **Git-first workflows**, and **comprehensive project management**.
|
|
9
|
+
|
|
10
|
+
Mirror NEWO "Project → Agent → Flow → Skills" structure to local files with:
|
|
11
|
+
- 🔄 **Two-way synchronization** - Pull from NEWO, push local changes back
|
|
12
|
+
- 🏢 **Multi-customer support** - Work with multiple NEWO accounts simultaneously
|
|
13
|
+
- 📁 **Multi-project workspaces** - Manage multiple projects in organized folder structure
|
|
14
|
+
- 🔐 **Secure authentication** - API key-based auth with automatic token refresh
|
|
15
|
+
- ⚡ **Change detection** - SHA256-based efficient sync of only modified files
|
|
16
|
+
- 🧠 **AI skill formats** - Support for `.guidance` (AI prompts) and `.jinja` (NSL templates)
|
|
17
|
+
- 📊 **Knowledge base import** - Bulk import AKB articles from structured text files
|
|
18
|
+
- 🔧 **CI/CD ready** - GitHub Actions integration for automated deployments
|
|
4
19
|
|
|
5
|
-
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
6
25
|
|
|
7
|
-
|
|
26
|
+
**Option 1: Global Installation (Recommended)**
|
|
8
27
|
```bash
|
|
9
28
|
npm install -g newo
|
|
10
29
|
```
|
|
11
|
-
|
|
30
|
+
|
|
31
|
+
**Option 2: Local Project Installation**
|
|
12
32
|
```bash
|
|
13
|
-
newo
|
|
14
|
-
newo push
|
|
15
|
-
newo status
|
|
33
|
+
npm install newo
|
|
16
34
|
```
|
|
17
35
|
|
|
18
|
-
|
|
36
|
+
**Option 3: Development from Source**
|
|
19
37
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
git clone https://github.com/sabbah13/newo-cli.git
|
|
39
|
+
cd newo-cli
|
|
40
|
+
npm install && npm run build
|
|
22
41
|
```
|
|
23
|
-
|
|
42
|
+
|
|
43
|
+
### Basic Setup
|
|
44
|
+
|
|
45
|
+
1. **Get your NEWO API key** from [app.newo.ai](https://app.newo.ai) → Integrations → API Integration → Create Connector
|
|
46
|
+
2. **Configure environment**:
|
|
47
|
+
```bash
|
|
48
|
+
cp .env.example .env
|
|
49
|
+
# Edit .env with your API key
|
|
50
|
+
```
|
|
51
|
+
3. **Start syncing**:
|
|
52
|
+
```bash
|
|
53
|
+
newo pull # Download all projects
|
|
54
|
+
newo push # Upload changes back
|
|
55
|
+
newo status # See what's modified
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
### Single Customer Setup
|
|
63
|
+
|
|
64
|
+
For working with one NEWO account:
|
|
65
|
+
|
|
24
66
|
```bash
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
67
|
+
# .env file
|
|
68
|
+
NEWO_API_KEY=your_api_key_here
|
|
69
|
+
NEWO_PROJECT_ID=project_uuid_here # Optional: specific project only
|
|
28
70
|
```
|
|
29
71
|
|
|
30
|
-
###
|
|
72
|
+
### Multi-Customer Setup
|
|
73
|
+
|
|
74
|
+
Work with multiple NEWO accounts simultaneously using three flexible approaches:
|
|
75
|
+
|
|
76
|
+
#### Method 1: JSON Array (Recommended)
|
|
31
77
|
```bash
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
npm install
|
|
36
|
-
npm run build # Build TypeScript to JavaScript
|
|
78
|
+
# .env file
|
|
79
|
+
NEWO_API_KEYS=["api_key_customer_1", "api_key_customer_2", "api_key_customer_3"]
|
|
80
|
+
NEWO_DEFAULT_CUSTOMER=NEWO_ABC123 # Optional: set after first pull
|
|
37
81
|
```
|
|
38
82
|
|
|
39
|
-
|
|
83
|
+
#### Method 2: JSON Array with Project IDs
|
|
84
|
+
```bash
|
|
85
|
+
# .env file
|
|
86
|
+
NEWO_API_KEYS=[
|
|
87
|
+
{"key":"api_key_1","project_id":"project_uuid_1"},
|
|
88
|
+
{"key":"api_key_2","project_id":"project_uuid_2"},
|
|
89
|
+
{"key":"api_key_3"}
|
|
90
|
+
]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Method 3: Individual Environment Variables
|
|
94
|
+
```bash
|
|
95
|
+
# .env file
|
|
96
|
+
NEWO_CUSTOMER_ACME_API_KEY=acme_api_key_here
|
|
97
|
+
NEWO_CUSTOMER_BETA_API_KEY=beta_api_key_here
|
|
98
|
+
NEWO_CUSTOMER_GAMMA_API_KEY=gamma_api_key_here
|
|
99
|
+
```
|
|
40
100
|
|
|
41
|
-
###
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
101
|
+
### Getting Your NEWO API Keys
|
|
102
|
+
|
|
103
|
+
1. **Login** to [app.newo.ai](https://app.newo.ai)
|
|
104
|
+
2. **Navigate** to **Integrations** page
|
|
105
|
+
3. **Find** **API Integration** in the list
|
|
106
|
+
4. **Create** a new **Connector**
|
|
107
|
+
5. **Copy** the API key (format: `458663bd41f2d1...`)
|
|
47
108
|
|
|
48
109
|

|
|
49
110
|
|
|
50
|
-
###
|
|
111
|
+
### Advanced Configuration
|
|
112
|
+
|
|
51
113
|
```bash
|
|
52
|
-
|
|
53
|
-
#
|
|
114
|
+
# .env file
|
|
115
|
+
NEWO_BASE_URL=https://app.newo.ai # NEWO platform URL
|
|
116
|
+
NEWO_DEFAULT_CUSTOMER=NEWO_ABC123 # Default customer for operations
|
|
117
|
+
NEWO_ACCESS_TOKEN=direct_access_token # Alternative to API key
|
|
118
|
+
NEWO_REFRESH_TOKEN=refresh_token_here # For token refresh
|
|
119
|
+
NEWO_REFRESH_URL=custom_refresh_endpoint # Custom refresh endpoint
|
|
54
120
|
```
|
|
55
121
|
|
|
56
|
-
|
|
57
|
-
- `NEWO_BASE_URL` (default `https://app.newo.ai`)
|
|
58
|
-
- `NEWO_API_KEY` (your API key from Step 1)
|
|
59
|
-
|
|
60
|
-
Optional environment variables:
|
|
61
|
-
- `NEWO_PROJECT_ID` (specific project UUID - if not set, pulls all accessible projects)
|
|
62
|
-
- `NEWO_ACCESS_TOKEN` (direct access token)
|
|
63
|
-
- `NEWO_REFRESH_TOKEN` (refresh token)
|
|
64
|
-
- `NEWO_REFRESH_URL` (custom refresh endpoint)
|
|
122
|
+
---
|
|
65
123
|
|
|
66
124
|
## Commands
|
|
125
|
+
|
|
126
|
+
### Core Commands
|
|
127
|
+
|
|
128
|
+
| Command | Description | Examples |
|
|
129
|
+
|---------|-------------|----------|
|
|
130
|
+
| `newo pull` | Download projects from NEWO | `newo pull`<br>`newo pull --customer=ACME`<br>`newo pull --project=uuid` |
|
|
131
|
+
| `newo push` | Upload local changes to NEWO | `newo push`<br>`newo push --customer=BETA` |
|
|
132
|
+
| `newo status` | Show modified files | `newo status`<br>`newo status --verbose` |
|
|
133
|
+
| `newo list-customers` | List configured customers | `newo list-customers` |
|
|
134
|
+
| `newo import-akb` | Import knowledge base articles | `newo import-akb file.txt persona_id` |
|
|
135
|
+
| `newo meta` | Get project metadata | `newo meta --project=uuid` |
|
|
136
|
+
|
|
137
|
+
### Multi-Customer Commands
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# List all configured customers
|
|
141
|
+
newo list-customers
|
|
142
|
+
|
|
143
|
+
# Pull projects from specific customer
|
|
144
|
+
newo pull --customer=NEWO_ABC123
|
|
145
|
+
|
|
146
|
+
# Push changes to specific customer
|
|
147
|
+
newo push --customer=NEWO_XYZ789
|
|
148
|
+
|
|
149
|
+
# Work with default customer (all projects)
|
|
150
|
+
newo pull # Uses default or prompts for selection
|
|
151
|
+
newo push # Pushes to appropriate customers based on file origin
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Command Options
|
|
155
|
+
|
|
156
|
+
- `--customer=<customer_idn>` - Target specific customer
|
|
157
|
+
- `--project=<project_uuid>` - Target specific project
|
|
158
|
+
- `--verbose` / `-v` - Detailed output with debugging info
|
|
159
|
+
- `--help` / `-h` - Show command help
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Project Structure
|
|
164
|
+
|
|
165
|
+
### File Organization
|
|
166
|
+
|
|
167
|
+
**Multi-Customer Workspace**
|
|
168
|
+
```
|
|
169
|
+
newo_customers/ # Root folder for all customers
|
|
170
|
+
├── NEWO_ABC123/ # Customer folder (auto-detected IDN)
|
|
171
|
+
│ └── projects/ # Customer's projects
|
|
172
|
+
│ ├── flows.yaml # Customer's flows export
|
|
173
|
+
│ └── ProjectAlpha/ # Individual project folder
|
|
174
|
+
│ ├── metadata.json # Project metadata
|
|
175
|
+
│ ├── agent_support/ # Agent folder
|
|
176
|
+
│ │ ├── flow_onboarding/ # Flow folder
|
|
177
|
+
│ │ │ ├── skill_welcome.guidance # AI prompt skill
|
|
178
|
+
│ │ │ └── skill_setup.jinja # NSL template skill
|
|
179
|
+
│ │ └── flow_help/
|
|
180
|
+
│ │ └── skill_faq.guidance
|
|
181
|
+
│ └── agent_sales/
|
|
182
|
+
│ └── flow_demo/
|
|
183
|
+
│ └── skill_pitch.jinja
|
|
184
|
+
├── NEWO_XYZ789/ # Another customer
|
|
185
|
+
│ └── projects/
|
|
186
|
+
│ ├── flows.yaml
|
|
187
|
+
│ └── ProjectBeta/
|
|
188
|
+
│ └── ...
|
|
189
|
+
└── .newo/ # CLI state directory (hidden)
|
|
190
|
+
├── NEWO_ABC123/ # Customer-specific state
|
|
191
|
+
│ ├── map.json # NEWO ID mappings
|
|
192
|
+
│ └── hashes.json # Change detection hashes
|
|
193
|
+
├── NEWO_XYZ789/
|
|
194
|
+
│ ├── map.json
|
|
195
|
+
│ └── hashes.json
|
|
196
|
+
└── tokens.json # Authentication tokens
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### File Types
|
|
200
|
+
|
|
201
|
+
- **`.guidance`** - AI prompt skills (natural language instructions)
|
|
202
|
+
- **`.jinja`** - NSL template skills (Jinja2 templating with NEWO extensions)
|
|
203
|
+
- **`metadata.json`** - Project info (title, description, version, team)
|
|
204
|
+
- **`flows.yaml`** - Complete project structure export for external tools
|
|
205
|
+
|
|
206
|
+
### Customer & Project Identification
|
|
207
|
+
|
|
208
|
+
- **Customer IDN**: Auto-detected from API response (e.g., `NEWO_ABC123`)
|
|
209
|
+
- **Project folders**: Named as `{CustomerIDN}_{ProjectIDN}` for clarity
|
|
210
|
+
- **Change tracking**: SHA256 hashes prevent unnecessary uploads
|
|
211
|
+
- **Automatic mapping**: `.newo/map.json` maintains NEWO platform relationships
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Key Features
|
|
216
|
+
|
|
217
|
+
### 🏢 Multi-Customer Support
|
|
218
|
+
- **Multiple NEWO accounts** - Work with different customers/organizations
|
|
219
|
+
- **Flexible configuration** - JSON arrays, individual env vars, or mixed approaches
|
|
220
|
+
- **Customer isolation** - Separate authentication and project spaces
|
|
221
|
+
- **Auto-detection** - Customer IDNs automatically resolved from API responses
|
|
222
|
+
- **Default customer** - Set preferred customer for streamlined workflows
|
|
223
|
+
|
|
224
|
+
### 📁 Multi-Project Management
|
|
225
|
+
- **Workspace organization** - All accessible projects in structured folders
|
|
226
|
+
- **Project metadata** - Complete project info with `metadata.json`
|
|
227
|
+
- **Selective sync** - Target specific projects or sync everything
|
|
228
|
+
- **Project structure export** - `flows.yaml` for external tooling integration
|
|
229
|
+
- **Cross-project operations** - Commands work across entire workspace
|
|
230
|
+
|
|
231
|
+
### 🔄 Intelligent Synchronization
|
|
232
|
+
- **Two-way sync** - Pull from NEWO platform, push local changes back
|
|
233
|
+
- **Change detection** - SHA256 hashing prevents unnecessary uploads
|
|
234
|
+
- **Incremental sync** - Only modified files are transferred
|
|
235
|
+
- **Conflict resolution** - Safe handling of concurrent changes
|
|
236
|
+
- **Batch operations** - Efficient bulk file processing
|
|
237
|
+
|
|
238
|
+
### 🔐 Enterprise Security
|
|
239
|
+
- **API key authentication** - Secure token-based authentication
|
|
240
|
+
- **Automatic token refresh** - Seamless session management
|
|
241
|
+
- **Multi-customer isolation** - Separate auth contexts per customer
|
|
242
|
+
- **Environment protection** - Secure credential management
|
|
243
|
+
- **Audit logging** - Comprehensive operation tracking
|
|
244
|
+
|
|
245
|
+
### 🛠️ Developer Experience
|
|
246
|
+
- **TypeScript implementation** - Full type safety and IDE support
|
|
247
|
+
- **Comprehensive testing** - 500+ test cases with 90%+ coverage
|
|
248
|
+
- **Error handling** - User-friendly messages with troubleshooting
|
|
249
|
+
- **Verbose debugging** - Detailed logging with `--verbose` flag
|
|
250
|
+
- **CI/CD integration** - GitHub Actions workflows included
|
|
251
|
+
- **Cross-platform** - Windows, macOS, Linux support
|
|
252
|
+
|
|
253
|
+
## Robustness & Error Handling
|
|
254
|
+
|
|
255
|
+
NEWO CLI v1.5.1+ includes comprehensive error handling and validation:
|
|
256
|
+
|
|
257
|
+
### User-Friendly Error Messages
|
|
258
|
+
- **Authentication Errors**: Clear guidance when API keys are invalid or missing
|
|
259
|
+
- **Network Issues**: Helpful tips for connection problems and timeouts
|
|
260
|
+
- **Configuration Errors**: Step-by-step setup instructions for common issues
|
|
261
|
+
- **File System Errors**: Actionable guidance for permission and path problems
|
|
262
|
+
|
|
263
|
+
### Verbose Debugging
|
|
264
|
+
Use the `--verbose` or `-v` flag with any command for detailed technical information:
|
|
67
265
|
```bash
|
|
68
|
-
npx newo pull
|
|
69
|
-
npx newo
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
##
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- **Multiple file types**: `.guidance` (AI prompts) and `.jinja` (NSL templates)
|
|
92
|
-
- **Project metadata**: Each project includes `metadata.json` with complete project info
|
|
93
|
-
- **AKB import**: Import knowledge base articles from structured text files
|
|
94
|
-
- **Project structure export**: Generates `flows.yaml` with complete project metadata
|
|
95
|
-
- **Robust authentication**: API key exchange with automatic token refresh
|
|
96
|
-
- **CI/CD ready**: GitHub Actions workflow included
|
|
97
|
-
|
|
98
|
-
## CI/CD (GitHub Actions)
|
|
99
|
-
Create `.github/workflows/deploy.yml`:
|
|
266
|
+
npx newo pull --verbose # Detailed pull operation logs
|
|
267
|
+
npx newo push -v # Verbose push with full error context
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Enhanced Validation
|
|
271
|
+
- **API Key Validation**: Format and length validation with specific error messages
|
|
272
|
+
- **Token Security**: Automatic sanitization of sensitive data in logs
|
|
273
|
+
- **Network Timeouts**: 30-second request timeouts with proper error handling
|
|
274
|
+
- **Input Validation**: Comprehensive validation for all user inputs and configuration
|
|
275
|
+
|
|
276
|
+
### Troubleshooting Tips
|
|
277
|
+
When errors occur, NEWO CLI provides:
|
|
278
|
+
- 🔍 **Problem diagnosis** with specific error categories
|
|
279
|
+
- 💡 **Solution suggestions** for common configuration issues
|
|
280
|
+
- 📋 **Step-by-step guidance** for resolving authentication and network problems
|
|
281
|
+
- 🔧 **Configuration validation** to ensure proper setup
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## CI/CD Integration
|
|
286
|
+
|
|
287
|
+
### Single Customer CI/CD
|
|
288
|
+
|
|
100
289
|
```yaml
|
|
290
|
+
# .github/workflows/deploy.yml
|
|
101
291
|
name: Deploy NEWO Skills
|
|
102
292
|
on:
|
|
103
293
|
push:
|
|
@@ -105,6 +295,7 @@ on:
|
|
|
105
295
|
paths:
|
|
106
296
|
- 'projects/**/*.guidance'
|
|
107
297
|
- 'projects/**/*.jinja'
|
|
298
|
+
|
|
108
299
|
jobs:
|
|
109
300
|
deploy:
|
|
110
301
|
runs-on: ubuntu-latest
|
|
@@ -117,10 +308,75 @@ jobs:
|
|
|
117
308
|
- run: npm run build && node ./dist/cli.js push
|
|
118
309
|
env:
|
|
119
310
|
NEWO_BASE_URL: https://app.newo.ai
|
|
120
|
-
NEWO_PROJECT_ID: ${{ secrets.NEWO_PROJECT_ID }}
|
|
121
311
|
NEWO_API_KEY: ${{ secrets.NEWO_API_KEY }}
|
|
122
|
-
# Optional
|
|
123
|
-
|
|
312
|
+
NEWO_PROJECT_ID: ${{ secrets.NEWO_PROJECT_ID }} # Optional
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Multi-Customer CI/CD
|
|
316
|
+
|
|
317
|
+
```yaml
|
|
318
|
+
# .github/workflows/deploy-multi.yml
|
|
319
|
+
name: Deploy Multi-Customer NEWO Skills
|
|
320
|
+
on:
|
|
321
|
+
push:
|
|
322
|
+
branches: [ main ]
|
|
323
|
+
paths:
|
|
324
|
+
- 'projects/**/*.guidance'
|
|
325
|
+
- 'projects/**/*.jinja'
|
|
326
|
+
|
|
327
|
+
jobs:
|
|
328
|
+
deploy:
|
|
329
|
+
runs-on: ubuntu-latest
|
|
330
|
+
steps:
|
|
331
|
+
- uses: actions/checkout@v4
|
|
332
|
+
- uses: actions/setup-node@v4
|
|
333
|
+
with:
|
|
334
|
+
node-version: 20
|
|
335
|
+
- run: npm ci
|
|
336
|
+
- run: npm run build && node ./dist/cli.js push
|
|
337
|
+
env:
|
|
338
|
+
NEWO_BASE_URL: https://app.newo.ai
|
|
339
|
+
# Multi-customer API keys as JSON array
|
|
340
|
+
NEWO_API_KEYS: ${{ secrets.NEWO_API_KEYS }}
|
|
341
|
+
# Example: '["customer1_api_key", "customer2_api_key"]'
|
|
342
|
+
|
|
343
|
+
# Or individual customer keys
|
|
344
|
+
NEWO_CUSTOMER_ACME_API_KEY: ${{ secrets.NEWO_CUSTOMER_ACME_API_KEY }}
|
|
345
|
+
NEWO_CUSTOMER_BETA_API_KEY: ${{ secrets.NEWO_CUSTOMER_BETA_API_KEY }}
|
|
346
|
+
|
|
347
|
+
# Optional default customer
|
|
348
|
+
NEWO_DEFAULT_CUSTOMER: ${{ secrets.NEWO_DEFAULT_CUSTOMER }}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### GitHub Secrets Setup
|
|
352
|
+
|
|
353
|
+
Add these secrets to your repository:
|
|
354
|
+
|
|
355
|
+
**Single Customer:**
|
|
356
|
+
- `NEWO_API_KEY` - Your NEWO API key
|
|
357
|
+
- `NEWO_PROJECT_ID` - (Optional) Specific project UUID
|
|
358
|
+
|
|
359
|
+
**Multi-Customer:**
|
|
360
|
+
- `NEWO_API_KEYS` - JSON array: `["key1", "key2", "key3"]`
|
|
361
|
+
- `NEWO_CUSTOMER_<IDN>_API_KEY` - Individual customer keys
|
|
362
|
+
- `NEWO_DEFAULT_CUSTOMER` - (Optional) Default customer IDN
|
|
363
|
+
|
|
364
|
+
### Advanced CI/CD Workflows
|
|
365
|
+
|
|
366
|
+
```yaml
|
|
367
|
+
# Customer-specific deployment
|
|
368
|
+
- name: Deploy to specific customer
|
|
369
|
+
run: node ./dist/cli.js push --customer=NEWO_ABC123
|
|
370
|
+
|
|
371
|
+
# Verbose deployment with logging
|
|
372
|
+
- name: Deploy with detailed logs
|
|
373
|
+
run: node ./dist/cli.js push --verbose
|
|
374
|
+
|
|
375
|
+
# Pull before push (sync workflow)
|
|
376
|
+
- name: Sync and deploy
|
|
377
|
+
run: |
|
|
378
|
+
node ./dist/cli.js pull
|
|
379
|
+
node ./dist/cli.js push
|
|
124
380
|
```
|
|
125
381
|
|
|
126
382
|
## AKB Import
|
|
@@ -156,53 +412,194 @@ Each article will be imported with:
|
|
|
156
412
|
|
|
157
413
|
Use `--verbose` flag to see detailed import progress.
|
|
158
414
|
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Examples
|
|
418
|
+
|
|
419
|
+
### Basic Usage
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Single customer workflow
|
|
423
|
+
newo pull # Download all accessible projects
|
|
424
|
+
newo status # See what files are modified
|
|
425
|
+
newo push # Upload changes back to NEWO
|
|
426
|
+
|
|
427
|
+
# Multi-customer workflow
|
|
428
|
+
newo list-customers # See configured customers
|
|
429
|
+
newo pull --customer=ACME # Pull from specific customer
|
|
430
|
+
newo push --customer=BETA # Push to specific customer
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Working with Projects
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
# Pull specific project
|
|
437
|
+
newo pull --project=b78188ba-0df0-46a8-8713-f0d7cff0a06e
|
|
438
|
+
|
|
439
|
+
# Get project metadata
|
|
440
|
+
newo meta --project=b78188ba-0df0-46a8-8713-f0d7cff0a06e
|
|
441
|
+
|
|
442
|
+
# Verbose operations for debugging
|
|
443
|
+
newo pull --verbose
|
|
444
|
+
newo push --verbose --customer=ACME
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Knowledge Base Import
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Import AKB articles from structured text file
|
|
451
|
+
newo import-akb articles.txt da4550db-2b95-4500-91ff-fb4b60fe7be9
|
|
452
|
+
|
|
453
|
+
# With verbose output
|
|
454
|
+
newo import-akb articles.txt persona_id --verbose
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
159
459
|
## Development
|
|
160
460
|
|
|
161
|
-
|
|
461
|
+
### Prerequisites
|
|
462
|
+
- **Node.js 18+** - For runtime environment
|
|
463
|
+
- **TypeScript 5.6+** - For type safety and compilation
|
|
464
|
+
- **Git** - For version control and CI/CD integration
|
|
465
|
+
|
|
466
|
+
### Development Setup
|
|
162
467
|
|
|
163
|
-
### Development Commands
|
|
164
468
|
```bash
|
|
165
|
-
#
|
|
469
|
+
# Clone repository
|
|
470
|
+
git clone https://github.com/sabbah13/newo-cli.git
|
|
471
|
+
cd newo-cli
|
|
472
|
+
|
|
473
|
+
# Install dependencies
|
|
474
|
+
npm install
|
|
475
|
+
|
|
476
|
+
# Build TypeScript
|
|
166
477
|
npm run build
|
|
167
478
|
|
|
168
|
-
#
|
|
169
|
-
npm run
|
|
479
|
+
# Run development commands
|
|
480
|
+
npm run dev pull # Build and run pull
|
|
481
|
+
npm run dev push # Build and run push
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Development Commands
|
|
170
485
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
npm run
|
|
174
|
-
npm run
|
|
175
|
-
npm run
|
|
486
|
+
| Command | Description |
|
|
487
|
+
|---------|-------------|
|
|
488
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
|
489
|
+
| `npm run build:watch` | Watch mode compilation |
|
|
490
|
+
| `npm run typecheck` | Type checking without emission |
|
|
491
|
+
| `npm run dev <cmd>` | Build and run CLI command |
|
|
492
|
+
| `npm test` | Run full test suite |
|
|
493
|
+
| `npm run test:unit` | Run unit tests only |
|
|
494
|
+
| `npm run test:coverage` | Generate coverage report |
|
|
176
495
|
|
|
177
|
-
|
|
178
|
-
npm run typecheck
|
|
496
|
+
### Project Architecture
|
|
179
497
|
|
|
180
|
-
# Run tests
|
|
181
|
-
npm test
|
|
182
498
|
```
|
|
499
|
+
src/
|
|
500
|
+
├── cli.ts # Main CLI entry point
|
|
501
|
+
├── api.ts # NEWO API client
|
|
502
|
+
├── auth.ts # Authentication management
|
|
503
|
+
├── customer.ts # Multi-customer configuration
|
|
504
|
+
├── customerAsync.ts # Async customer operations
|
|
505
|
+
├── sync.ts # Project synchronization
|
|
506
|
+
├── akb.ts # Knowledge base import
|
|
507
|
+
├── types.ts # TypeScript definitions
|
|
508
|
+
└── fsutil.ts # File system utilities
|
|
509
|
+
|
|
510
|
+
test/
|
|
511
|
+
├── auth.test.js # Authentication tests
|
|
512
|
+
├── customer.test.js # Multi-customer tests
|
|
513
|
+
├── sync.test.js # Sync operation tests
|
|
514
|
+
├── api.test.js # API client tests
|
|
515
|
+
└── integration.test.js # End-to-end tests
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Testing
|
|
519
|
+
|
|
520
|
+
NEWO CLI includes comprehensive test coverage:
|
|
183
521
|
|
|
184
|
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
- `.newo/` - CLI state directory (tokens, hashes, mappings)
|
|
522
|
+
- **500+ test cases** covering all major functionality
|
|
523
|
+
- **90%+ code coverage** with detailed reporting
|
|
524
|
+
- **Multi-customer scenarios** including auth and sync
|
|
525
|
+
- **Error handling** validation for edge cases
|
|
526
|
+
- **Integration tests** for end-to-end workflows
|
|
190
527
|
|
|
191
528
|
### TypeScript Features
|
|
192
|
-
- Full type safety with strict TypeScript configuration
|
|
193
|
-
- Modern ES2022 target with ESNext modules
|
|
194
|
-
- Comprehensive type definitions for all NEWO API responses
|
|
195
|
-
- Enhanced error handling and validation
|
|
196
|
-
- IntelliSense support in compatible IDEs
|
|
197
529
|
|
|
198
|
-
|
|
530
|
+
- **Strict type checking** with comprehensive interfaces
|
|
531
|
+
- **Modern ES2022** target with ESNext modules
|
|
532
|
+
- **Complete API typing** for all NEWO endpoints
|
|
533
|
+
- **Enhanced IntelliSense** support in IDEs
|
|
534
|
+
- **Automatic compilation** with source maps
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## Contributing
|
|
539
|
+
|
|
540
|
+
We welcome contributions to NEWO CLI! Here's how to get involved:
|
|
541
|
+
|
|
542
|
+
### Reporting Issues
|
|
543
|
+
- **Bug reports**: Use [GitHub Issues](https://github.com/sabbah13/newo-cli/issues)
|
|
544
|
+
- **Feature requests**: Describe your use case and proposed solution
|
|
545
|
+
- **Security issues**: Email security@newo.ai for private disclosure
|
|
546
|
+
|
|
547
|
+
### Development Workflow
|
|
548
|
+
|
|
549
|
+
1. **Fork** the repository
|
|
550
|
+
2. **Create** a feature branch: `git checkout -b feature/amazing-feature`
|
|
551
|
+
3. **Write tests** for new functionality
|
|
552
|
+
4. **Ensure** all tests pass: `npm test`
|
|
553
|
+
5. **Commit** with clear messages: `git commit -m 'feat: add amazing feature'`
|
|
554
|
+
6. **Push** to branch: `git push origin feature/amazing-feature`
|
|
555
|
+
7. **Create** a Pull Request
|
|
556
|
+
|
|
557
|
+
### Code Standards
|
|
558
|
+
- **TypeScript** for all source code
|
|
559
|
+
- **Comprehensive tests** for new features
|
|
560
|
+
- **JSDoc comments** for public APIs
|
|
561
|
+
- **Semantic versioning** for releases
|
|
562
|
+
- **Conventional commits** for clear history
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## API Reference
|
|
567
|
+
|
|
568
|
+
NEWO CLI integrates with these NEWO platform endpoints:
|
|
569
|
+
|
|
570
|
+
### Authentication
|
|
571
|
+
- `POST /api/v1/auth/api-key/token` - Exchange API key for access tokens
|
|
572
|
+
|
|
573
|
+
### Project Management
|
|
199
574
|
- `GET /api/v1/designer/projects` - List all accessible projects
|
|
200
|
-
- `GET /api/v1/designer/projects/by-id/{projectId}` - Get
|
|
575
|
+
- `GET /api/v1/designer/projects/by-id/{projectId}` - Get project metadata
|
|
201
576
|
- `GET /api/v1/bff/agents/list?project_id=...` - List project agents
|
|
577
|
+
|
|
578
|
+
### Skills & Flows
|
|
202
579
|
- `GET /api/v1/designer/flows/{flowId}/skills` - List skills in flow
|
|
203
580
|
- `GET /api/v1/designer/skills/{skillId}` - Get skill content
|
|
204
581
|
- `PUT /api/v1/designer/flows/skills/{skillId}` - Update skill content
|
|
205
|
-
- `GET /api/v1/designer/flows/{flowId}/events` - List flow events
|
|
206
|
-
- `GET /api/v1/designer/flows/{flowId}/states` - List flow states
|
|
207
|
-
|
|
208
|
-
|
|
582
|
+
- `GET /api/v1/designer/flows/{flowId}/events` - List flow events
|
|
583
|
+
- `GET /api/v1/designer/flows/{flowId}/states` - List flow states
|
|
584
|
+
|
|
585
|
+
### Knowledge Base
|
|
586
|
+
- `POST /api/v1/akb/append-manual` - Import AKB articles to persona
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## License
|
|
591
|
+
|
|
592
|
+
**MIT License** - see [LICENSE](LICENSE) file for details.
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
## Support
|
|
597
|
+
|
|
598
|
+
- 📖 **Documentation**: [GitHub Repository](https://github.com/sabbah13/newo-cli)
|
|
599
|
+
- 🐛 **Bug Reports**: [GitHub Issues](https://github.com/sabbah13/newo-cli/issues)
|
|
600
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/sabbah13/newo-cli/discussions)
|
|
601
|
+
- 📧 **Email**: support@newo.ai
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
**Built with ❤️ by the NEWO team**
|
package/dist/akb.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ParsedArticle, AkbImportArticle } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Parse AKB file and extract articles
|
|
4
4
|
*/
|
|
5
|
-
export declare function parseAkbFile(filePath: string): ParsedArticle[]
|
|
5
|
+
export declare function parseAkbFile(filePath: string): Promise<ParsedArticle[]>;
|
|
6
6
|
/**
|
|
7
7
|
* Convert parsed articles to API format for bulk import
|
|
8
8
|
*/
|