@memberjunction/cli 2.118.0 β 2.120.0
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 +93 -0
- package/dist/commands/ai/audit/agent-run.d.ts +24 -0
- package/dist/commands/ai/audit/agent-run.js +213 -0
- package/dist/commands/ai/audit/index.d.ts +6 -0
- package/dist/commands/ai/audit/index.js +12 -0
- package/dist/commands/clean/index.js +2 -4
- package/dist/commands/dbdoc/analyze.js +1 -1
- package/dist/commands/dbdoc/export.js +1 -1
- package/dist/commands/dbdoc/generate-queries.d.ts +13 -0
- package/dist/commands/dbdoc/generate-queries.js +82 -0
- package/dist/commands/dbdoc/init.js +1 -1
- package/dist/commands/dbdoc/reset.js +1 -1
- package/dist/commands/dbdoc/status.js +1 -1
- package/dist/commands/migrate/index.js +3 -5
- package/dist/config.d.ts +16 -12
- package/dist/config.js +45 -9
- package/oclif.manifest.json +285 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -209,6 +209,7 @@ Available AI commands:
|
|
|
209
209
|
- `actions run` - Execute an AI action with parameters
|
|
210
210
|
- `prompts list` - List available AI models for direct prompt execution
|
|
211
211
|
- `prompts run` - Execute a direct prompt with an AI model
|
|
212
|
+
- `audit agent-run` - Audit and analyze AI agent execution runs for debugging
|
|
212
213
|
|
|
213
214
|
**π For detailed documentation:** See the [AI-CLI README](../AI/AICLI/README.md)
|
|
214
215
|
|
|
@@ -248,6 +249,21 @@ mj ai prompts run -p "Explain quantum computing in simple terms"
|
|
|
248
249
|
# Use a specific model
|
|
249
250
|
mj ai prompts run -p "Write a Python function to sort a list" --model "gpt-4"
|
|
250
251
|
|
|
252
|
+
# Audit recent agent runs
|
|
253
|
+
mj ai audit agent-run --list --status failed --days 7
|
|
254
|
+
|
|
255
|
+
# Audit specific run with summary
|
|
256
|
+
mj ai audit agent-run <run-id>
|
|
257
|
+
|
|
258
|
+
# Examine specific step in detail
|
|
259
|
+
mj ai audit agent-run <run-id> --step 3 --detail full
|
|
260
|
+
|
|
261
|
+
# Analyze errors in a run
|
|
262
|
+
mj ai audit agent-run <run-id> --errors
|
|
263
|
+
|
|
264
|
+
# Export full audit data
|
|
265
|
+
mj ai audit agent-run <run-id> --export full --file audit.json
|
|
266
|
+
|
|
251
267
|
# Use system prompt and temperature
|
|
252
268
|
mj ai prompts run -p "Generate a haiku" --system "You are a poet" --temperature 0.3
|
|
253
269
|
```
|
|
@@ -281,6 +297,22 @@ mj ai prompts run -p "Generate a haiku" --system "You are a poet" --temperature
|
|
|
281
297
|
- `-v, --verbose`: Show detailed execution information
|
|
282
298
|
- `--timeout <ms>`: Execution timeout in milliseconds (default: 300000)
|
|
283
299
|
|
|
300
|
+
**Audit Commands:**
|
|
301
|
+
- `<run-id>`: Agent Run ID (UUID) to audit (optional for --list mode)
|
|
302
|
+
- `-l, --list`: List recent agent runs (filter with other options)
|
|
303
|
+
- `-a, --agent <name>`: Filter by agent name (requires --list)
|
|
304
|
+
- `--status <status>`: Filter by status: success, failed, running, all (default: all)
|
|
305
|
+
- `--days <number>`: Number of days to look back (default: 7)
|
|
306
|
+
- `--limit <number>`: Maximum runs to return (default: 50)
|
|
307
|
+
- `-s, --step <number>`: Show details for specific step (1-based index)
|
|
308
|
+
- `-d, --detail <level>`: Detail level for step: minimal, standard, detailed, full (default: standard)
|
|
309
|
+
- `-e, --errors`: Show only error details and context
|
|
310
|
+
- `--export <type>`: Export data: full, summary, steps
|
|
311
|
+
- `-f, --file <path>`: Output file path for export
|
|
312
|
+
- `--max-tokens <number>`: Max tokens per field (default: 5000, 0 = no limit)
|
|
313
|
+
- `-o, --output <format>`: Output format (compact, json, table, markdown)
|
|
314
|
+
- `-v, --verbose`: Show detailed diagnostic information
|
|
315
|
+
|
|
284
316
|
#### AI Features:
|
|
285
317
|
|
|
286
318
|
**Progress Tracking**: Real-time visual progress indicators during agent execution
|
|
@@ -299,6 +331,15 @@ mj ai prompts run -p "Generate a haiku" --system "You are a poet" --temperature
|
|
|
299
331
|
- Natural back-and-forth dialogue
|
|
300
332
|
- Exit with "exit", "quit", or Ctrl+C
|
|
301
333
|
|
|
334
|
+
**Agent Run Auditing**: Comprehensive debugging and analysis tools
|
|
335
|
+
- List recent runs with filtering by agent, status, and date
|
|
336
|
+
- View run summaries with performance metrics and step breakdowns
|
|
337
|
+
- Deep dive into specific steps with smart truncation for large payloads
|
|
338
|
+
- Automatic error pattern detection with suggested fixes
|
|
339
|
+
- Multiple output formats including markdown for AI assistants
|
|
340
|
+
- Export capabilities for offline analysis
|
|
341
|
+
- Optimized for read-only performance with `simple` result type
|
|
342
|
+
|
|
302
343
|
#### AI Configuration:
|
|
303
344
|
|
|
304
345
|
Add AI-specific settings to your `mj.config.cjs`:
|
|
@@ -451,6 +492,7 @@ mj dbdoc [COMMAND] [OPTIONS]
|
|
|
451
492
|
Available dbdoc commands:
|
|
452
493
|
- `init` - Initialize a new DBAutoDoc project
|
|
453
494
|
- `analyze` - Analyze database and generate documentation
|
|
495
|
+
- `generate-queries` - Generate sample SQL queries from existing analysis state
|
|
454
496
|
- `export` - Export documentation in multiple formats (SQL, Markdown, HTML, CSV, Mermaid)
|
|
455
497
|
- `status` - Show analysis status and progress
|
|
456
498
|
- `reset` - Reset analysis state
|
|
@@ -472,6 +514,14 @@ mj dbdoc analyze --resume ./output/run-6/state.json
|
|
|
472
514
|
# Use custom config
|
|
473
515
|
mj dbdoc analyze --config ./my-config.json
|
|
474
516
|
|
|
517
|
+
# Generate sample SQL queries from existing state
|
|
518
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json
|
|
519
|
+
|
|
520
|
+
# Generate with custom settings
|
|
521
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json \
|
|
522
|
+
--queries-per-table 10 \
|
|
523
|
+
--output-dir ./queries
|
|
524
|
+
|
|
475
525
|
# Export all formats
|
|
476
526
|
mj dbdoc export --sql --markdown --html --csv --mermaid
|
|
477
527
|
|
|
@@ -504,6 +554,13 @@ mj dbdoc reset --force
|
|
|
504
554
|
- `-r, --resume <path>`: Resume from an existing state file
|
|
505
555
|
- `-c, --config <path>`: Path to config file (default: ./config.json)
|
|
506
556
|
|
|
557
|
+
**Generate Queries Command:**
|
|
558
|
+
- `--from-state <path>`: Path to existing state.json file from previous analysis (required)
|
|
559
|
+
- `--output-dir <path>`: Output directory for generated queries (optional)
|
|
560
|
+
- `-c, --config <path>`: Path to config file for database connection and AI settings (default: ./config.json)
|
|
561
|
+
- `--queries-per-table <number>`: Number of queries to generate per table (optional, overrides config)
|
|
562
|
+
- `--max-execution-time <ms>`: Maximum execution time for query validation in milliseconds (optional, overrides config)
|
|
563
|
+
|
|
507
564
|
**Export Command:**
|
|
508
565
|
- `-s, --state-file <path>`: Path to state JSON file
|
|
509
566
|
- `-o, --output-dir <path>`: Output directory for generated files
|
|
@@ -541,6 +598,7 @@ mj dbdoc reset --force
|
|
|
541
598
|
|
|
542
599
|
**Advanced Features:**
|
|
543
600
|
- π **Relationship Discovery** - Detect missing primary and foreign keys
|
|
601
|
+
- π― **Sample Query Generation** - Generate reference SQL queries for AI agent training with alignment tracking
|
|
544
602
|
- π‘οΈ **Granular Guardrails** - Multi-level resource controls
|
|
545
603
|
- βΈοΈ **Resume Capability** - Pause and resume from checkpoint
|
|
546
604
|
- π¦ **Programmatic API** - Use as a library in your applications
|
|
@@ -552,6 +610,41 @@ mj dbdoc reset --force
|
|
|
552
610
|
- CSV Exports (spreadsheet-ready)
|
|
553
611
|
- Mermaid Diagrams (standalone ERD files)
|
|
554
612
|
- Analysis Reports (detailed metrics)
|
|
613
|
+
- Sample Queries (JSON with SQL, metadata, and alignment tracking)
|
|
614
|
+
|
|
615
|
+
**Sample Query Generation:**
|
|
616
|
+
|
|
617
|
+
DBAutoDoc can generate reference SQL queries that solve the **query alignment problem** where multi-query patterns (summary + detail) have inconsistent filtering logic. These "gold standard" queries include:
|
|
618
|
+
- Explicit filtering rules for consistency
|
|
619
|
+
- Alignment tracking via `relatedQueryIds`
|
|
620
|
+
- Query patterns (Summary+Detail, Multi-Entity Drilldown, Time Series)
|
|
621
|
+
- Validated, executable SQL
|
|
622
|
+
- Perfect for few-shot prompting in AI agents like Skip
|
|
623
|
+
|
|
624
|
+
Enable in config:
|
|
625
|
+
```json
|
|
626
|
+
{
|
|
627
|
+
"analysis": {
|
|
628
|
+
"sampleQueryGeneration": {
|
|
629
|
+
"enabled": true,
|
|
630
|
+
"queriesPerTable": 5,
|
|
631
|
+
"includeMultiQueryPatterns": true,
|
|
632
|
+
"validateAlignment": true
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Or generate separately from existing state:
|
|
639
|
+
```bash
|
|
640
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**Use Cases:**
|
|
644
|
+
- Training AI agents to generate consistent multi-query patterns
|
|
645
|
+
- Creating reference examples for few-shot prompting
|
|
646
|
+
- Documenting common query patterns for your database
|
|
647
|
+
- Validating that related queries use consistent filtering logic
|
|
555
648
|
|
|
556
649
|
---
|
|
557
650
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class AgentRun extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
step: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
detail: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
errors: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
list: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
agent: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
status: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
days: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
export: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
'max-tokens': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
static args: {
|
|
21
|
+
runId: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const core_1 = require("@oclif/core");
|
|
30
|
+
const ai_cli_1 = require("@memberjunction/ai-cli");
|
|
31
|
+
const ora_classic_1 = __importDefault(require("ora-classic"));
|
|
32
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
33
|
+
const fs = __importStar(require("fs/promises"));
|
|
34
|
+
class AgentRun extends core_1.Command {
|
|
35
|
+
static description = 'Audit and analyze AI agent execution runs for debugging and performance analysis';
|
|
36
|
+
static examples = [
|
|
37
|
+
// Summary mode
|
|
38
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456',
|
|
39
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456 --output=markdown',
|
|
40
|
+
// Step detail mode
|
|
41
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456 --step 3',
|
|
42
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456 --step 3 --detail full',
|
|
43
|
+
// Error analysis
|
|
44
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456 --errors',
|
|
45
|
+
// List recent runs
|
|
46
|
+
'<%= config.bin %> <%= command.id %> --list --agent "Skip: Requirements Expert"',
|
|
47
|
+
'<%= config.bin %> <%= command.id %> --list --status failed --days 7',
|
|
48
|
+
// Export mode
|
|
49
|
+
'<%= config.bin %> <%= command.id %> abc-123-def-456 --export full --file report.json',
|
|
50
|
+
];
|
|
51
|
+
static flags = {
|
|
52
|
+
// Output format
|
|
53
|
+
output: core_1.Flags.string({
|
|
54
|
+
char: 'o',
|
|
55
|
+
description: 'Output format',
|
|
56
|
+
options: ['compact', 'json', 'table', 'markdown'],
|
|
57
|
+
default: 'compact',
|
|
58
|
+
}),
|
|
59
|
+
// Step detail mode
|
|
60
|
+
step: core_1.Flags.integer({
|
|
61
|
+
char: 's',
|
|
62
|
+
description: 'Show details for specific step number (1-based index)',
|
|
63
|
+
exclusive: ['list', 'errors'],
|
|
64
|
+
}),
|
|
65
|
+
detail: core_1.Flags.string({
|
|
66
|
+
char: 'd',
|
|
67
|
+
description: 'Detail level for step output (default: standard)',
|
|
68
|
+
options: ['minimal', 'standard', 'detailed', 'full'],
|
|
69
|
+
dependsOn: ['step'],
|
|
70
|
+
}),
|
|
71
|
+
// Error analysis mode
|
|
72
|
+
errors: core_1.Flags.boolean({
|
|
73
|
+
char: 'e',
|
|
74
|
+
description: 'Show only error details and context',
|
|
75
|
+
default: false,
|
|
76
|
+
exclusive: ['step', 'list'],
|
|
77
|
+
}),
|
|
78
|
+
// List mode
|
|
79
|
+
list: core_1.Flags.boolean({
|
|
80
|
+
char: 'l',
|
|
81
|
+
description: 'List recent agent runs',
|
|
82
|
+
default: false,
|
|
83
|
+
exclusive: ['step', 'errors'],
|
|
84
|
+
}),
|
|
85
|
+
agent: core_1.Flags.string({
|
|
86
|
+
char: 'a',
|
|
87
|
+
description: 'Filter by agent name',
|
|
88
|
+
dependsOn: ['list'],
|
|
89
|
+
}),
|
|
90
|
+
status: core_1.Flags.string({
|
|
91
|
+
description: 'Filter by run status',
|
|
92
|
+
options: ['success', 'failed', 'running', 'all'],
|
|
93
|
+
default: 'all',
|
|
94
|
+
dependsOn: ['list'],
|
|
95
|
+
}),
|
|
96
|
+
days: core_1.Flags.integer({
|
|
97
|
+
description: 'Number of days to look back',
|
|
98
|
+
default: 7,
|
|
99
|
+
dependsOn: ['list'],
|
|
100
|
+
}),
|
|
101
|
+
limit: core_1.Flags.integer({
|
|
102
|
+
description: 'Maximum number of runs to return',
|
|
103
|
+
default: 50,
|
|
104
|
+
dependsOn: ['list'],
|
|
105
|
+
}),
|
|
106
|
+
// Export mode
|
|
107
|
+
export: core_1.Flags.string({
|
|
108
|
+
description: 'Export full data to file',
|
|
109
|
+
options: ['full', 'summary', 'steps'],
|
|
110
|
+
dependsOn: ['file'],
|
|
111
|
+
}),
|
|
112
|
+
file: core_1.Flags.string({
|
|
113
|
+
char: 'f',
|
|
114
|
+
description: 'Output file path for export',
|
|
115
|
+
}),
|
|
116
|
+
// Truncation control
|
|
117
|
+
'max-tokens': core_1.Flags.integer({
|
|
118
|
+
description: 'Maximum tokens per field (0 = no limit)',
|
|
119
|
+
default: 5000,
|
|
120
|
+
}),
|
|
121
|
+
// Verbose mode
|
|
122
|
+
verbose: core_1.Flags.boolean({
|
|
123
|
+
char: 'v',
|
|
124
|
+
description: 'Show detailed diagnostic information',
|
|
125
|
+
default: false,
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
static args = {
|
|
129
|
+
runId: core_1.Args.string({
|
|
130
|
+
description: 'AI Agent Run ID to audit (UUID)',
|
|
131
|
+
required: false, // Optional because --list mode doesn't need it
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
134
|
+
async run() {
|
|
135
|
+
const { args, flags } = await this.parse(AgentRun);
|
|
136
|
+
const spinner = (0, ora_classic_1.default)();
|
|
137
|
+
try {
|
|
138
|
+
const service = new ai_cli_1.AgentAuditService();
|
|
139
|
+
// MODE 1: List recent runs
|
|
140
|
+
if (flags.list) {
|
|
141
|
+
spinner.start('Loading recent agent runs...');
|
|
142
|
+
const runs = await service.listRecentRuns({
|
|
143
|
+
agentName: flags.agent,
|
|
144
|
+
status: flags.status,
|
|
145
|
+
days: flags.days,
|
|
146
|
+
limit: flags.limit,
|
|
147
|
+
});
|
|
148
|
+
spinner.stop();
|
|
149
|
+
this.log(service.formatRunList(runs, flags.output));
|
|
150
|
+
process.exit(0);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// Validate runId for non-list modes
|
|
154
|
+
if (!args.runId) {
|
|
155
|
+
this.error('Run ID is required (use --list to see recent runs)');
|
|
156
|
+
}
|
|
157
|
+
// MODE 2: Step detail mode
|
|
158
|
+
if (flags.step != null) {
|
|
159
|
+
spinner.start(`Loading step ${flags.step} details...`);
|
|
160
|
+
const stepDetail = await service.getStepDetail(args.runId, flags.step, {
|
|
161
|
+
detailLevel: (flags.detail || 'standard'),
|
|
162
|
+
maxTokens: flags['max-tokens'],
|
|
163
|
+
});
|
|
164
|
+
spinner.stop();
|
|
165
|
+
this.log(service.formatStepDetail(stepDetail, flags.output));
|
|
166
|
+
process.exit(0);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// MODE 3: Error analysis mode
|
|
170
|
+
if (flags.errors) {
|
|
171
|
+
spinner.start('Analyzing errors...');
|
|
172
|
+
const errorAnalysis = await service.analyzeErrors(args.runId);
|
|
173
|
+
spinner.stop();
|
|
174
|
+
this.log(service.formatErrorAnalysis(errorAnalysis, flags.output));
|
|
175
|
+
process.exit(0);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
// MODE 4: Export mode
|
|
179
|
+
if (flags.export && flags.file) {
|
|
180
|
+
spinner.start('Exporting full audit data...');
|
|
181
|
+
const exportData = await service.exportRun(args.runId, flags.export);
|
|
182
|
+
await fs.writeFile(flags.file, JSON.stringify(exportData, null, 2), 'utf8');
|
|
183
|
+
spinner.stop();
|
|
184
|
+
this.log(chalk_1.default.green(`β Full audit data exported to ${flags.file}`));
|
|
185
|
+
this.log(chalk_1.default.dim(` File size: ${(JSON.stringify(exportData).length / 1024).toFixed(1)} KB`));
|
|
186
|
+
process.exit(0);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// MODE 5: Summary mode (default)
|
|
190
|
+
spinner.start('Loading agent run summary...');
|
|
191
|
+
const summary = await service.getRunSummary(args.runId, {
|
|
192
|
+
includeStepList: true,
|
|
193
|
+
maxTokens: flags['max-tokens'],
|
|
194
|
+
});
|
|
195
|
+
spinner.stop();
|
|
196
|
+
this.log(service.formatRunSummary(summary, flags.output));
|
|
197
|
+
if (flags.verbose) {
|
|
198
|
+
this.log(chalk_1.default.dim('\nπ‘ Tip: Use --step <N> to see details for a specific step'));
|
|
199
|
+
this.log(chalk_1.default.dim('π‘ Tip: Use --errors to see only error information'));
|
|
200
|
+
}
|
|
201
|
+
process.exit(0);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
spinner.fail('Audit failed');
|
|
205
|
+
if (flags.verbose && error instanceof Error) {
|
|
206
|
+
this.log(chalk_1.default.red('\nError Details:'));
|
|
207
|
+
this.log(error.stack || error.message);
|
|
208
|
+
}
|
|
209
|
+
this.error(error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.default = AgentRun;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
class Audit extends core_1.Command {
|
|
5
|
+
static description = 'Analyze and audit AI agent runs, prompts, and actions for debugging and performance analysis';
|
|
6
|
+
static hidden = false;
|
|
7
|
+
async run() {
|
|
8
|
+
// This command just displays help for the audit topic
|
|
9
|
+
await this.config.runCommand('help', ['ai', 'audit']);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = Audit;
|
|
@@ -20,10 +20,8 @@ class Clean extends core_1.Command {
|
|
|
20
20
|
async run() {
|
|
21
21
|
const parsed = await this.parse(Clean);
|
|
22
22
|
this.flags = parsed.flags;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
const flywayConfig = await (0, config_1.getFlywayConfig)(config_1.config);
|
|
23
|
+
const config = (0, config_1.getValidatedConfig)();
|
|
24
|
+
const flywayConfig = await (0, config_1.getFlywayConfig)(config);
|
|
27
25
|
const flyway = new node_flyway_1.Flyway(flywayConfig);
|
|
28
26
|
this.log('Resetting MJ database to pre-installation state');
|
|
29
27
|
this.log('Note that users and roles have not been dropped');
|
|
@@ -46,7 +46,7 @@ class DbDocAnalyze extends core_1.Command {
|
|
|
46
46
|
async run() {
|
|
47
47
|
const { flags } = await this.parse(DbDocAnalyze);
|
|
48
48
|
// Load DBAutoDoc command dynamically
|
|
49
|
-
const { default: AnalyzeCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/analyze
|
|
49
|
+
const { default: AnalyzeCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/analyze')));
|
|
50
50
|
// Build args array for DBAutoDoc command
|
|
51
51
|
const args = [];
|
|
52
52
|
if (flags.resume) {
|
|
@@ -78,7 +78,7 @@ class DbDocExport extends core_1.Command {
|
|
|
78
78
|
async run() {
|
|
79
79
|
const { flags } = await this.parse(DbDocExport);
|
|
80
80
|
// Load DBAutoDoc command dynamically
|
|
81
|
-
const { default: ExportCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/export
|
|
81
|
+
const { default: ExportCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/export')));
|
|
82
82
|
// Build args array for DBAutoDoc command
|
|
83
83
|
const args = [];
|
|
84
84
|
if (flags['state-file'])
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class DbDocGenerateQueries extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'from-state': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'output-dir': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
config: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
'queries-per-table': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
'max-execution-time': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const core_1 = require("@oclif/core");
|
|
27
|
+
class DbDocGenerateQueries extends core_1.Command {
|
|
28
|
+
static description = 'Generate sample SQL queries from existing analysis state (delegates to db-auto-doc generate-queries)';
|
|
29
|
+
static examples = [
|
|
30
|
+
'<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json',
|
|
31
|
+
'<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --output-dir ./queries',
|
|
32
|
+
'<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --queries-per-table 10',
|
|
33
|
+
];
|
|
34
|
+
static flags = {
|
|
35
|
+
'from-state': core_1.Flags.string({
|
|
36
|
+
description: 'Path to existing state.json file from previous analysis',
|
|
37
|
+
required: true
|
|
38
|
+
}),
|
|
39
|
+
'output-dir': core_1.Flags.string({
|
|
40
|
+
description: 'Output directory for generated queries',
|
|
41
|
+
required: false
|
|
42
|
+
}),
|
|
43
|
+
config: core_1.Flags.string({
|
|
44
|
+
char: 'c',
|
|
45
|
+
description: 'Path to config file (for database connection and AI settings)',
|
|
46
|
+
default: './config.json'
|
|
47
|
+
}),
|
|
48
|
+
'queries-per-table': core_1.Flags.integer({
|
|
49
|
+
description: 'Number of queries to generate per table',
|
|
50
|
+
required: false
|
|
51
|
+
}),
|
|
52
|
+
'max-execution-time': core_1.Flags.integer({
|
|
53
|
+
description: 'Maximum execution time for query validation (ms)',
|
|
54
|
+
required: false
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
async run() {
|
|
58
|
+
const { flags } = await this.parse(DbDocGenerateQueries);
|
|
59
|
+
// Load DBAutoDoc command dynamically
|
|
60
|
+
const { default: GenerateQueriesCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/generate-queries')));
|
|
61
|
+
// Build args array for DBAutoDoc command
|
|
62
|
+
const args = [];
|
|
63
|
+
if (flags['from-state']) {
|
|
64
|
+
args.push('--from-state', flags['from-state']);
|
|
65
|
+
}
|
|
66
|
+
if (flags['output-dir']) {
|
|
67
|
+
args.push('--output-dir', flags['output-dir']);
|
|
68
|
+
}
|
|
69
|
+
if (flags.config) {
|
|
70
|
+
args.push('--config', flags.config);
|
|
71
|
+
}
|
|
72
|
+
if (flags['queries-per-table']) {
|
|
73
|
+
args.push('--queries-per-table', flags['queries-per-table'].toString());
|
|
74
|
+
}
|
|
75
|
+
if (flags['max-execution-time']) {
|
|
76
|
+
args.push('--max-execution-time', flags['max-execution-time'].toString());
|
|
77
|
+
}
|
|
78
|
+
// Execute the DBAutoDoc generate-queries command
|
|
79
|
+
await GenerateQueriesCommand.run(args);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.default = DbDocGenerateQueries;
|
|
@@ -31,7 +31,7 @@ class DbDocInit extends core_1.Command {
|
|
|
31
31
|
];
|
|
32
32
|
async run() {
|
|
33
33
|
// Load DBAutoDoc command dynamically
|
|
34
|
-
const { default: InitCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/init
|
|
34
|
+
const { default: InitCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/init')));
|
|
35
35
|
// Execute the DBAutoDoc init command
|
|
36
36
|
await InitCommand.run([]);
|
|
37
37
|
}
|
|
@@ -40,7 +40,7 @@ class DbDocReset extends core_1.Command {
|
|
|
40
40
|
async run() {
|
|
41
41
|
const { flags } = await this.parse(DbDocReset);
|
|
42
42
|
// Load DBAutoDoc command dynamically
|
|
43
|
-
const { default: ResetCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/reset
|
|
43
|
+
const { default: ResetCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/reset')));
|
|
44
44
|
// Build args array for DBAutoDoc command
|
|
45
45
|
const args = [];
|
|
46
46
|
if (flags.force) {
|
|
@@ -39,7 +39,7 @@ class DbDocStatus extends core_1.Command {
|
|
|
39
39
|
async run() {
|
|
40
40
|
const { flags } = await this.parse(DbDocStatus);
|
|
41
41
|
// Load DBAutoDoc command dynamically
|
|
42
|
-
const { default: StatusCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/status
|
|
42
|
+
const { default: StatusCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/status')));
|
|
43
43
|
// Build args array for DBAutoDoc command
|
|
44
44
|
const args = [];
|
|
45
45
|
if (flags['state-file']) {
|
|
@@ -19,14 +19,12 @@ class Migrate extends core_1.Command {
|
|
|
19
19
|
};
|
|
20
20
|
async run() {
|
|
21
21
|
const { flags } = await this.parse(Migrate);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
const flywayConfig = await (0, config_1.getFlywayConfig)(config_1.config, flags.tag);
|
|
22
|
+
const config = (0, config_1.getValidatedConfig)();
|
|
23
|
+
const flywayConfig = await (0, config_1.getFlywayConfig)(config, flags.tag);
|
|
26
24
|
const flyway = new node_flyway_1.Flyway(flywayConfig);
|
|
27
25
|
if (flags.verbose) {
|
|
28
26
|
this.log(`Connecting to ${flywayConfig.url}`);
|
|
29
|
-
this.log(`Migrating ${
|
|
27
|
+
this.log(`Migrating ${config.coreSchema} schema using migrations from:\n\t- ${flywayConfig.migrationLocations.join('\n\t- ')}\n`);
|
|
30
28
|
}
|
|
31
29
|
if (flags.tag) {
|
|
32
30
|
this.log(`Migrating to ${flags.tag}`);
|
package/dist/config.d.ts
CHANGED
|
@@ -47,18 +47,22 @@ export declare const config: {
|
|
|
47
47
|
coreSchema: string;
|
|
48
48
|
mjRepoUrl: string;
|
|
49
49
|
} | undefined;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Get validated config for commands that require database connection.
|
|
52
|
+
* Throws error if config is invalid.
|
|
53
|
+
*/
|
|
54
|
+
export declare const getValidatedConfig: () => MJConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Get optional config for commands that don't require database connection.
|
|
57
|
+
* Returns undefined if no config exists, or partial config if it exists.
|
|
58
|
+
*/
|
|
59
|
+
export declare const getOptionalConfig: () => Partial<MJConfig> | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Legacy function for backward compatibility with codegen.
|
|
62
|
+
* Validates and returns updated config.
|
|
63
|
+
* Returns undefined silently if config is invalid (command will handle the error).
|
|
64
|
+
*/
|
|
65
|
+
export declare const updatedConfig: () => MJConfig | undefined;
|
|
62
66
|
export declare const createFlywayUrl: (mjConfig: MJConfig) => string;
|
|
63
67
|
export declare const getFlywayConfig: (mjConfig: MJConfig, tag?: string) => Promise<FlywayConfig>;
|
|
64
68
|
export {};
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFlywayConfig = exports.createFlywayUrl = exports.updatedConfig = exports.config = void 0;
|
|
3
|
+
exports.getFlywayConfig = exports.createFlywayUrl = exports.updatedConfig = exports.getOptionalConfig = exports.getValidatedConfig = exports.config = void 0;
|
|
4
4
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const node_os_1 = require("node:os");
|
|
@@ -9,6 +9,7 @@ const zod_1 = require("zod");
|
|
|
9
9
|
const MJ_REPO_URL = 'https://github.com/MemberJunction/MJ.git';
|
|
10
10
|
const explorer = (0, cosmiconfig_1.cosmiconfigSync)('mj', { searchStrategy: 'global' });
|
|
11
11
|
const result = explorer.search(process.cwd());
|
|
12
|
+
// Schema for database-dependent config (required fields)
|
|
12
13
|
const mjConfigSchema = zod_1.z.object({
|
|
13
14
|
dbHost: zod_1.z.string().default('localhost'),
|
|
14
15
|
dbDatabase: zod_1.z.string(),
|
|
@@ -21,16 +22,51 @@ const mjConfigSchema = zod_1.z.object({
|
|
|
21
22
|
cleanDisabled: zod_1.z.boolean().optional().default(true),
|
|
22
23
|
mjRepoUrl: zod_1.z.string().url().catch(MJ_REPO_URL),
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
// Schema for non-database commands (all fields optional)
|
|
26
|
+
const mjConfigSchemaOptional = zod_1.z.object({
|
|
27
|
+
dbHost: zod_1.z.string().optional(),
|
|
28
|
+
dbDatabase: zod_1.z.string().optional(),
|
|
29
|
+
dbPort: zod_1.z.number({ coerce: true }).optional(),
|
|
30
|
+
codeGenLogin: zod_1.z.string().optional(),
|
|
31
|
+
codeGenPassword: zod_1.z.string().optional(),
|
|
32
|
+
migrationsLocation: zod_1.z.string().optional().default('filesystem:./migrations'),
|
|
33
|
+
dbTrustServerCertificate: zod_1.z.coerce.boolean().default(false),
|
|
34
|
+
coreSchema: zod_1.z.string().optional().default('__mj'),
|
|
35
|
+
cleanDisabled: zod_1.z.boolean().optional().default(true),
|
|
36
|
+
mjRepoUrl: zod_1.z.string().url().catch(MJ_REPO_URL),
|
|
37
|
+
});
|
|
38
|
+
// Don't validate at module load - let commands decide when they need validated config
|
|
39
|
+
exports.config = result?.config;
|
|
40
|
+
/**
|
|
41
|
+
* Get validated config for commands that require database connection.
|
|
42
|
+
* Throws error if config is invalid.
|
|
43
|
+
*/
|
|
44
|
+
const getValidatedConfig = () => {
|
|
45
|
+
const parsedConfig = mjConfigSchema.safeParse(result?.config);
|
|
46
|
+
if (!parsedConfig.success) {
|
|
47
|
+
throw new Error(`Invalid or missing mj.config.cjs file. Database commands require valid configuration.\n` +
|
|
48
|
+
`Missing fields: ${parsedConfig.error.issues.map(i => i.path.join('.')).join(', ')}`);
|
|
49
|
+
}
|
|
50
|
+
return parsedConfig.data;
|
|
51
|
+
};
|
|
52
|
+
exports.getValidatedConfig = getValidatedConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Get optional config for commands that don't require database connection.
|
|
55
|
+
* Returns undefined if no config exists, or partial config if it exists.
|
|
56
|
+
*/
|
|
57
|
+
const getOptionalConfig = () => {
|
|
58
|
+
const parsedConfig = mjConfigSchemaOptional.safeParse(result?.config);
|
|
59
|
+
return parsedConfig.success ? parsedConfig.data : undefined;
|
|
60
|
+
};
|
|
61
|
+
exports.getOptionalConfig = getOptionalConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Legacy function for backward compatibility with codegen.
|
|
64
|
+
* Validates and returns updated config.
|
|
65
|
+
* Returns undefined silently if config is invalid (command will handle the error).
|
|
66
|
+
*/
|
|
29
67
|
const updatedConfig = () => {
|
|
30
68
|
const maybeConfig = mjConfigSchema.safeParse(explorer.search(process.cwd())?.config);
|
|
31
|
-
|
|
32
|
-
console.error('Error parsing config file', JSON.stringify(maybeConfig.error.issues, null, 2));
|
|
33
|
-
}
|
|
69
|
+
// Don't log errors here - let the calling command handle validation
|
|
34
70
|
return maybeConfig.success ? maybeConfig.data : undefined;
|
|
35
71
|
};
|
|
36
72
|
exports.updatedConfig = updatedConfig;
|
package/oclif.manifest.json
CHANGED
|
@@ -305,6 +305,74 @@
|
|
|
305
305
|
"export.js"
|
|
306
306
|
]
|
|
307
307
|
},
|
|
308
|
+
"dbdoc:generate-queries": {
|
|
309
|
+
"aliases": [],
|
|
310
|
+
"args": {},
|
|
311
|
+
"description": "Generate sample SQL queries from existing analysis state (delegates to db-auto-doc generate-queries)",
|
|
312
|
+
"examples": [
|
|
313
|
+
"<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json",
|
|
314
|
+
"<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --output-dir ./queries",
|
|
315
|
+
"<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --queries-per-table 10"
|
|
316
|
+
],
|
|
317
|
+
"flags": {
|
|
318
|
+
"from-state": {
|
|
319
|
+
"description": "Path to existing state.json file from previous analysis",
|
|
320
|
+
"name": "from-state",
|
|
321
|
+
"required": true,
|
|
322
|
+
"hasDynamicHelp": false,
|
|
323
|
+
"multiple": false,
|
|
324
|
+
"type": "option"
|
|
325
|
+
},
|
|
326
|
+
"output-dir": {
|
|
327
|
+
"description": "Output directory for generated queries",
|
|
328
|
+
"name": "output-dir",
|
|
329
|
+
"required": false,
|
|
330
|
+
"hasDynamicHelp": false,
|
|
331
|
+
"multiple": false,
|
|
332
|
+
"type": "option"
|
|
333
|
+
},
|
|
334
|
+
"config": {
|
|
335
|
+
"char": "c",
|
|
336
|
+
"description": "Path to config file (for database connection and AI settings)",
|
|
337
|
+
"name": "config",
|
|
338
|
+
"default": "./config.json",
|
|
339
|
+
"hasDynamicHelp": false,
|
|
340
|
+
"multiple": false,
|
|
341
|
+
"type": "option"
|
|
342
|
+
},
|
|
343
|
+
"queries-per-table": {
|
|
344
|
+
"description": "Number of queries to generate per table",
|
|
345
|
+
"name": "queries-per-table",
|
|
346
|
+
"required": false,
|
|
347
|
+
"hasDynamicHelp": false,
|
|
348
|
+
"multiple": false,
|
|
349
|
+
"type": "option"
|
|
350
|
+
},
|
|
351
|
+
"max-execution-time": {
|
|
352
|
+
"description": "Maximum execution time for query validation (ms)",
|
|
353
|
+
"name": "max-execution-time",
|
|
354
|
+
"required": false,
|
|
355
|
+
"hasDynamicHelp": false,
|
|
356
|
+
"multiple": false,
|
|
357
|
+
"type": "option"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"hasDynamicHelp": false,
|
|
361
|
+
"hiddenAliases": [],
|
|
362
|
+
"id": "dbdoc:generate-queries",
|
|
363
|
+
"pluginAlias": "@memberjunction/cli",
|
|
364
|
+
"pluginName": "@memberjunction/cli",
|
|
365
|
+
"pluginType": "core",
|
|
366
|
+
"strict": true,
|
|
367
|
+
"enableJsonFlag": false,
|
|
368
|
+
"isESM": false,
|
|
369
|
+
"relativePath": [
|
|
370
|
+
"dist",
|
|
371
|
+
"commands",
|
|
372
|
+
"dbdoc",
|
|
373
|
+
"generate-queries.js"
|
|
374
|
+
]
|
|
375
|
+
},
|
|
308
376
|
"dbdoc": {
|
|
309
377
|
"aliases": [],
|
|
310
378
|
"args": {},
|
|
@@ -1753,6 +1821,222 @@
|
|
|
1753
1821
|
"run.js"
|
|
1754
1822
|
]
|
|
1755
1823
|
},
|
|
1824
|
+
"ai:audit:agent-run": {
|
|
1825
|
+
"aliases": [],
|
|
1826
|
+
"args": {
|
|
1827
|
+
"runId": {
|
|
1828
|
+
"description": "AI Agent Run ID to audit (UUID)",
|
|
1829
|
+
"name": "runId",
|
|
1830
|
+
"required": false
|
|
1831
|
+
}
|
|
1832
|
+
},
|
|
1833
|
+
"description": "Audit and analyze AI agent execution runs for debugging and performance analysis",
|
|
1834
|
+
"examples": [
|
|
1835
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456",
|
|
1836
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456 --output=markdown",
|
|
1837
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456 --step 3",
|
|
1838
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456 --step 3 --detail full",
|
|
1839
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456 --errors",
|
|
1840
|
+
"<%= config.bin %> <%= command.id %> --list --agent \"Skip: Requirements Expert\"",
|
|
1841
|
+
"<%= config.bin %> <%= command.id %> --list --status failed --days 7",
|
|
1842
|
+
"<%= config.bin %> <%= command.id %> abc-123-def-456 --export full --file report.json"
|
|
1843
|
+
],
|
|
1844
|
+
"flags": {
|
|
1845
|
+
"output": {
|
|
1846
|
+
"char": "o",
|
|
1847
|
+
"description": "Output format",
|
|
1848
|
+
"name": "output",
|
|
1849
|
+
"default": "compact",
|
|
1850
|
+
"hasDynamicHelp": false,
|
|
1851
|
+
"multiple": false,
|
|
1852
|
+
"options": [
|
|
1853
|
+
"compact",
|
|
1854
|
+
"json",
|
|
1855
|
+
"table",
|
|
1856
|
+
"markdown"
|
|
1857
|
+
],
|
|
1858
|
+
"type": "option"
|
|
1859
|
+
},
|
|
1860
|
+
"step": {
|
|
1861
|
+
"char": "s",
|
|
1862
|
+
"description": "Show details for specific step number (1-based index)",
|
|
1863
|
+
"exclusive": [
|
|
1864
|
+
"list",
|
|
1865
|
+
"errors"
|
|
1866
|
+
],
|
|
1867
|
+
"name": "step",
|
|
1868
|
+
"hasDynamicHelp": false,
|
|
1869
|
+
"multiple": false,
|
|
1870
|
+
"type": "option"
|
|
1871
|
+
},
|
|
1872
|
+
"detail": {
|
|
1873
|
+
"char": "d",
|
|
1874
|
+
"dependsOn": [
|
|
1875
|
+
"step"
|
|
1876
|
+
],
|
|
1877
|
+
"description": "Detail level for step output (default: standard)",
|
|
1878
|
+
"name": "detail",
|
|
1879
|
+
"hasDynamicHelp": false,
|
|
1880
|
+
"multiple": false,
|
|
1881
|
+
"options": [
|
|
1882
|
+
"minimal",
|
|
1883
|
+
"standard",
|
|
1884
|
+
"detailed",
|
|
1885
|
+
"full"
|
|
1886
|
+
],
|
|
1887
|
+
"type": "option"
|
|
1888
|
+
},
|
|
1889
|
+
"errors": {
|
|
1890
|
+
"char": "e",
|
|
1891
|
+
"description": "Show only error details and context",
|
|
1892
|
+
"exclusive": [
|
|
1893
|
+
"step",
|
|
1894
|
+
"list"
|
|
1895
|
+
],
|
|
1896
|
+
"name": "errors",
|
|
1897
|
+
"allowNo": false,
|
|
1898
|
+
"type": "boolean"
|
|
1899
|
+
},
|
|
1900
|
+
"list": {
|
|
1901
|
+
"char": "l",
|
|
1902
|
+
"description": "List recent agent runs",
|
|
1903
|
+
"exclusive": [
|
|
1904
|
+
"step",
|
|
1905
|
+
"errors"
|
|
1906
|
+
],
|
|
1907
|
+
"name": "list",
|
|
1908
|
+
"allowNo": false,
|
|
1909
|
+
"type": "boolean"
|
|
1910
|
+
},
|
|
1911
|
+
"agent": {
|
|
1912
|
+
"char": "a",
|
|
1913
|
+
"dependsOn": [
|
|
1914
|
+
"list"
|
|
1915
|
+
],
|
|
1916
|
+
"description": "Filter by agent name",
|
|
1917
|
+
"name": "agent",
|
|
1918
|
+
"hasDynamicHelp": false,
|
|
1919
|
+
"multiple": false,
|
|
1920
|
+
"type": "option"
|
|
1921
|
+
},
|
|
1922
|
+
"status": {
|
|
1923
|
+
"dependsOn": [
|
|
1924
|
+
"list"
|
|
1925
|
+
],
|
|
1926
|
+
"description": "Filter by run status",
|
|
1927
|
+
"name": "status",
|
|
1928
|
+
"default": "all",
|
|
1929
|
+
"hasDynamicHelp": false,
|
|
1930
|
+
"multiple": false,
|
|
1931
|
+
"options": [
|
|
1932
|
+
"success",
|
|
1933
|
+
"failed",
|
|
1934
|
+
"running",
|
|
1935
|
+
"all"
|
|
1936
|
+
],
|
|
1937
|
+
"type": "option"
|
|
1938
|
+
},
|
|
1939
|
+
"days": {
|
|
1940
|
+
"dependsOn": [
|
|
1941
|
+
"list"
|
|
1942
|
+
],
|
|
1943
|
+
"description": "Number of days to look back",
|
|
1944
|
+
"name": "days",
|
|
1945
|
+
"default": 7,
|
|
1946
|
+
"hasDynamicHelp": false,
|
|
1947
|
+
"multiple": false,
|
|
1948
|
+
"type": "option"
|
|
1949
|
+
},
|
|
1950
|
+
"limit": {
|
|
1951
|
+
"dependsOn": [
|
|
1952
|
+
"list"
|
|
1953
|
+
],
|
|
1954
|
+
"description": "Maximum number of runs to return",
|
|
1955
|
+
"name": "limit",
|
|
1956
|
+
"default": 50,
|
|
1957
|
+
"hasDynamicHelp": false,
|
|
1958
|
+
"multiple": false,
|
|
1959
|
+
"type": "option"
|
|
1960
|
+
},
|
|
1961
|
+
"export": {
|
|
1962
|
+
"dependsOn": [
|
|
1963
|
+
"file"
|
|
1964
|
+
],
|
|
1965
|
+
"description": "Export full data to file",
|
|
1966
|
+
"name": "export",
|
|
1967
|
+
"hasDynamicHelp": false,
|
|
1968
|
+
"multiple": false,
|
|
1969
|
+
"options": [
|
|
1970
|
+
"full",
|
|
1971
|
+
"summary",
|
|
1972
|
+
"steps"
|
|
1973
|
+
],
|
|
1974
|
+
"type": "option"
|
|
1975
|
+
},
|
|
1976
|
+
"file": {
|
|
1977
|
+
"char": "f",
|
|
1978
|
+
"description": "Output file path for export",
|
|
1979
|
+
"name": "file",
|
|
1980
|
+
"hasDynamicHelp": false,
|
|
1981
|
+
"multiple": false,
|
|
1982
|
+
"type": "option"
|
|
1983
|
+
},
|
|
1984
|
+
"max-tokens": {
|
|
1985
|
+
"description": "Maximum tokens per field (0 = no limit)",
|
|
1986
|
+
"name": "max-tokens",
|
|
1987
|
+
"default": 5000,
|
|
1988
|
+
"hasDynamicHelp": false,
|
|
1989
|
+
"multiple": false,
|
|
1990
|
+
"type": "option"
|
|
1991
|
+
},
|
|
1992
|
+
"verbose": {
|
|
1993
|
+
"char": "v",
|
|
1994
|
+
"description": "Show detailed diagnostic information",
|
|
1995
|
+
"name": "verbose",
|
|
1996
|
+
"allowNo": false,
|
|
1997
|
+
"type": "boolean"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
"hasDynamicHelp": false,
|
|
2001
|
+
"hiddenAliases": [],
|
|
2002
|
+
"id": "ai:audit:agent-run",
|
|
2003
|
+
"pluginAlias": "@memberjunction/cli",
|
|
2004
|
+
"pluginName": "@memberjunction/cli",
|
|
2005
|
+
"pluginType": "core",
|
|
2006
|
+
"strict": true,
|
|
2007
|
+
"enableJsonFlag": false,
|
|
2008
|
+
"isESM": false,
|
|
2009
|
+
"relativePath": [
|
|
2010
|
+
"dist",
|
|
2011
|
+
"commands",
|
|
2012
|
+
"ai",
|
|
2013
|
+
"audit",
|
|
2014
|
+
"agent-run.js"
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"ai:audit": {
|
|
2018
|
+
"aliases": [],
|
|
2019
|
+
"args": {},
|
|
2020
|
+
"description": "Analyze and audit AI agent runs, prompts, and actions for debugging and performance analysis",
|
|
2021
|
+
"flags": {},
|
|
2022
|
+
"hasDynamicHelp": false,
|
|
2023
|
+
"hidden": false,
|
|
2024
|
+
"hiddenAliases": [],
|
|
2025
|
+
"id": "ai:audit",
|
|
2026
|
+
"pluginAlias": "@memberjunction/cli",
|
|
2027
|
+
"pluginName": "@memberjunction/cli",
|
|
2028
|
+
"pluginType": "core",
|
|
2029
|
+
"strict": true,
|
|
2030
|
+
"enableJsonFlag": false,
|
|
2031
|
+
"isESM": false,
|
|
2032
|
+
"relativePath": [
|
|
2033
|
+
"dist",
|
|
2034
|
+
"commands",
|
|
2035
|
+
"ai",
|
|
2036
|
+
"audit",
|
|
2037
|
+
"index.js"
|
|
2038
|
+
]
|
|
2039
|
+
},
|
|
1756
2040
|
"ai:prompts:list": {
|
|
1757
2041
|
"aliases": [],
|
|
1758
2042
|
"args": {},
|
|
@@ -1893,5 +2177,5 @@
|
|
|
1893
2177
|
]
|
|
1894
2178
|
}
|
|
1895
2179
|
},
|
|
1896
|
-
"version": "2.
|
|
2180
|
+
"version": "2.120.0"
|
|
1897
2181
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.120.0",
|
|
4
4
|
"description": "MemberJunction command line tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oclif"
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@inquirer/prompts": "^5.0.1",
|
|
54
|
-
"@memberjunction/ai-cli": "2.
|
|
55
|
-
"@memberjunction/codegen-lib": "2.
|
|
56
|
-
"@memberjunction/core": "2.
|
|
57
|
-
"@memberjunction/db-auto-doc": "2.
|
|
58
|
-
"@memberjunction/metadata-sync": "2.
|
|
59
|
-
"@memberjunction/sqlserver-dataprovider": "2.
|
|
60
|
-
"@memberjunction/testing-cli": "2.
|
|
54
|
+
"@memberjunction/ai-cli": "2.120.0",
|
|
55
|
+
"@memberjunction/codegen-lib": "2.120.0",
|
|
56
|
+
"@memberjunction/core": "2.120.0",
|
|
57
|
+
"@memberjunction/db-auto-doc": "2.120.0",
|
|
58
|
+
"@memberjunction/metadata-sync": "2.120.0",
|
|
59
|
+
"@memberjunction/sqlserver-dataprovider": "2.120.0",
|
|
60
|
+
"@memberjunction/testing-cli": "2.120.0",
|
|
61
61
|
"@oclif/core": "^3",
|
|
62
62
|
"@oclif/plugin-help": "^6",
|
|
63
63
|
"@oclif/plugin-version": "^2.0.17",
|