@inkeep/agents-cli 0.1.5 → 0.1.7
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/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/commands/create.d.ts +12 -0
- package/dist/commands/create.js +869 -0
- package/dist/config.d.ts +4 -4
- package/dist/index.js +5346 -20414
- package/package.json +15 -6
- package/dist/__tests__/api.test.d.ts +0 -1
- package/dist/__tests__/api.test.js +0 -257
- package/dist/__tests__/cli.test.d.ts +0 -1
- package/dist/__tests__/cli.test.js +0 -153
- package/dist/__tests__/commands/config.test.d.ts +0 -1
- package/dist/__tests__/commands/config.test.js +0 -154
- package/dist/__tests__/commands/init.test.d.ts +0 -1
- package/dist/__tests__/commands/init.test.js +0 -186
- package/dist/__tests__/commands/pull.test.d.ts +0 -1
- package/dist/__tests__/commands/pull.test.js +0 -54
- package/dist/__tests__/commands/push-spinner.test.d.ts +0 -1
- package/dist/__tests__/commands/push-spinner.test.js +0 -127
- package/dist/__tests__/commands/push.test.d.ts +0 -1
- package/dist/__tests__/commands/push.test.js +0 -265
- package/dist/__tests__/config-validation.test.d.ts +0 -1
- package/dist/__tests__/config-validation.test.js +0 -98
- package/dist/__tests__/package.test.d.ts +0 -1
- package/dist/__tests__/package.test.js +0 -82
- package/dist/__tests__/utils/json-comparator.test.d.ts +0 -1
- package/dist/__tests__/utils/json-comparator.test.js +0 -174
- package/dist/__tests__/utils/ts-loader.test.d.ts +0 -1
- package/dist/__tests__/utils/ts-loader.test.js +0 -232
- package/dist/api.d.ts +0 -23
- package/dist/api.js +0 -140
- package/dist/commands/chat-enhanced.d.ts +0 -7
- package/dist/commands/chat-enhanced.js +0 -396
- package/dist/commands/chat.d.ts +0 -5
- package/dist/commands/chat.js +0 -125
- package/dist/commands/config.d.ts +0 -6
- package/dist/commands/config.js +0 -128
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.js +0 -171
- package/dist/commands/list-graphs.d.ts +0 -6
- package/dist/commands/list-graphs.js +0 -131
- package/dist/commands/pull.d.ts +0 -15
- package/dist/commands/pull.js +0 -305
- package/dist/commands/pull.llm-generate.d.ts +0 -10
- package/dist/commands/pull.llm-generate.js +0 -184
- package/dist/commands/push.d.ts +0 -6
- package/dist/commands/push.js +0 -268
- package/dist/exports.d.ts +0 -2
- package/dist/exports.js +0 -2
- package/dist/index.js.map +0 -7
- package/dist/types/config.d.ts +0 -9
- package/dist/types/config.js +0 -3
- package/dist/types/graph.d.ts +0 -10
- package/dist/types/graph.js +0 -1
- package/dist/utils/json-comparator.d.ts +0 -60
- package/dist/utils/json-comparator.js +0 -222
- package/dist/utils/mcp-runner.d.ts +0 -6
- package/dist/utils/mcp-runner.js +0 -147
- package/dist/utils/ts-loader.d.ts +0 -5
- package/dist/utils/ts-loader.js +0 -145
package/dist/commands/config.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
export async function configGetCommand(key, options) {
|
|
5
|
-
const configPath = options?.configFilePath || join(process.cwd(), 'inkeep.config.ts');
|
|
6
|
-
if (!existsSync(configPath)) {
|
|
7
|
-
console.error(chalk.red('No configuration file found.'));
|
|
8
|
-
console.log(chalk.gray('Run "inkeep init" to create one, or specify a config file with --config-file-path'));
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
const content = readFileSync(configPath, 'utf-8');
|
|
13
|
-
// Parse the config file to extract values
|
|
14
|
-
const tenantIdMatch = content.match(/tenantId:\s*['"]([^'"]+)['"]/);
|
|
15
|
-
const apiUrlMatch = content.match(/apiUrl:\s*['"]([^'"]+)['"]/);
|
|
16
|
-
const config = {
|
|
17
|
-
tenantId: tenantIdMatch ? tenantIdMatch[1] : undefined,
|
|
18
|
-
apiUrl: apiUrlMatch ? apiUrlMatch[1] : undefined,
|
|
19
|
-
};
|
|
20
|
-
if (key) {
|
|
21
|
-
// Get specific key
|
|
22
|
-
const value = config[key];
|
|
23
|
-
if (value !== undefined) {
|
|
24
|
-
console.log(value);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
console.error(chalk.red(`Unknown configuration key: ${key}`));
|
|
28
|
-
console.log(chalk.gray('Available keys: tenantId, apiUrl'));
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// Display all config
|
|
34
|
-
console.log(chalk.cyan('Current configuration:'));
|
|
35
|
-
console.log(chalk.gray(' Config file:'), configPath);
|
|
36
|
-
console.log(chalk.gray(' Tenant ID:'), config.tenantId || chalk.yellow('(not set)'));
|
|
37
|
-
console.log(chalk.gray(' API URL:'), config.apiUrl || chalk.yellow('(not set)'));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
console.error(chalk.red('Failed to read configuration:'), error);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export async function configSetCommand(key, value, options) {
|
|
46
|
-
const configPath = options?.configFilePath || join(process.cwd(), 'inkeep.config.ts');
|
|
47
|
-
// Validate the key
|
|
48
|
-
if (!['tenantId', 'apiUrl'].includes(key)) {
|
|
49
|
-
console.error(chalk.red(`Invalid configuration key: ${key}`));
|
|
50
|
-
console.log(chalk.gray('Available keys: tenantId, apiUrl'));
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
// Validate apiUrl if setting it
|
|
54
|
-
if (key === 'apiUrl') {
|
|
55
|
-
try {
|
|
56
|
-
new URL(value);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
console.error(chalk.red('Invalid URL format'));
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!existsSync(configPath)) {
|
|
64
|
-
// Create a new config file if it doesn't exist
|
|
65
|
-
const configContent = `import { defineConfig } from '@inkeep/agents-cli';
|
|
66
|
-
|
|
67
|
-
export default defineConfig({
|
|
68
|
-
tenantId: '${key === 'tenantId' ? value : ''}',
|
|
69
|
-
projectId: '${key === 'projectId' ? value : 'default'}',
|
|
70
|
-
apiUrl: '${key === 'apiUrl' ? value : 'http://localhost:3002'}',
|
|
71
|
-
});
|
|
72
|
-
`;
|
|
73
|
-
try {
|
|
74
|
-
writeFileSync(configPath, configContent);
|
|
75
|
-
console.log(chalk.green('✓'), `Created config file and set ${key} to:`, chalk.cyan(value));
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error(chalk.red('Failed to create config file:'), error);
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Update existing config file
|
|
84
|
-
try {
|
|
85
|
-
let content = readFileSync(configPath, 'utf-8');
|
|
86
|
-
if (key === 'tenantId') {
|
|
87
|
-
// Update or add tenantId
|
|
88
|
-
if (content.includes('tenantId:')) {
|
|
89
|
-
content = content.replace(/tenantId:\s*['"][^'"]*['"]/, `tenantId: '${value}'`);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// Add tenantId to the config object
|
|
93
|
-
content = content.replace(/defineConfig\s*\(\s*{/, `defineConfig({\n tenantId: '${value}',`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (key === 'projectId') {
|
|
97
|
-
// Update or add projectId
|
|
98
|
-
if (content.includes('projectId:')) {
|
|
99
|
-
content = content.replace(/projectId:\s*['"][^'"]*['"]/, `projectId: '${value}'`);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
// Add projectId after tenantId
|
|
103
|
-
content = content.replace(/(tenantId:\s*['"][^'"]*['"]),?/, `$1,\n projectId: '${value}',`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else if (key === 'apiUrl') {
|
|
107
|
-
// Update or add apiUrl
|
|
108
|
-
if (content.includes('apiUrl:')) {
|
|
109
|
-
content = content.replace(/apiUrl:\s*['"][^'"]*['"]/, `apiUrl: '${value}'`);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
// Add apiUrl to the config object
|
|
113
|
-
content = content.replace(/defineConfig\s*\(\s*{/, `defineConfig({\n apiUrl: '${value}',`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
writeFileSync(configPath, content);
|
|
117
|
-
console.log(chalk.green('✓'), `Updated ${key} to:`, chalk.cyan(value));
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
console.error(chalk.red('Failed to update config file:'), error);
|
|
121
|
-
process.exit(1);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
export async function configListCommand(options) {
|
|
126
|
-
// Alias for configGetCommand without a key
|
|
127
|
-
await configGetCommand(undefined, options);
|
|
128
|
-
}
|
package/dist/commands/init.d.ts
DELETED
package/dist/commands/init.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { basename, dirname, join, resolve } from 'node:path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
/**
|
|
6
|
-
* Find the most appropriate directory for the config file by looking for
|
|
7
|
-
* common project root indicators
|
|
8
|
-
*/
|
|
9
|
-
function findProjectRoot(startPath) {
|
|
10
|
-
let currentPath = resolve(startPath);
|
|
11
|
-
const root = dirname(currentPath);
|
|
12
|
-
// Look for common project root indicators
|
|
13
|
-
const rootIndicators = [
|
|
14
|
-
'package.json',
|
|
15
|
-
'.git',
|
|
16
|
-
'.gitignore',
|
|
17
|
-
'tsconfig.json',
|
|
18
|
-
'package-lock.json',
|
|
19
|
-
'yarn.lock',
|
|
20
|
-
'pnpm-lock.yaml',
|
|
21
|
-
];
|
|
22
|
-
while (currentPath !== root) {
|
|
23
|
-
const files = readdirSync(currentPath);
|
|
24
|
-
// Check if any root indicators exist at this level
|
|
25
|
-
if (rootIndicators.some((indicator) => files.includes(indicator))) {
|
|
26
|
-
return currentPath;
|
|
27
|
-
}
|
|
28
|
-
const parentPath = dirname(currentPath);
|
|
29
|
-
if (parentPath === currentPath) {
|
|
30
|
-
break; // Reached filesystem root
|
|
31
|
-
}
|
|
32
|
-
currentPath = parentPath;
|
|
33
|
-
}
|
|
34
|
-
// If no project root found, use the original path
|
|
35
|
-
return startPath;
|
|
36
|
-
}
|
|
37
|
-
export async function initCommand(options) {
|
|
38
|
-
let configPath;
|
|
39
|
-
if (options?.path) {
|
|
40
|
-
// User specified a path
|
|
41
|
-
const resolvedPath = resolve(process.cwd(), options.path);
|
|
42
|
-
// Check if it's a directory or a file path
|
|
43
|
-
if (options.path.endsWith('.ts') || options.path.endsWith('.js')) {
|
|
44
|
-
// It's a file path
|
|
45
|
-
configPath = resolvedPath;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// It's a directory path
|
|
49
|
-
configPath = join(resolvedPath, 'inkeep.config.ts');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// Auto-detect project root
|
|
54
|
-
const projectRoot = findProjectRoot(process.cwd());
|
|
55
|
-
const suggestedPath = join(projectRoot, 'inkeep.config.ts');
|
|
56
|
-
if (options?.interactive === false) {
|
|
57
|
-
// Non-interactive mode: use the detected project root
|
|
58
|
-
configPath = suggestedPath;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// Ask user to confirm or change the location
|
|
62
|
-
const { confirmedPath } = await inquirer.prompt([
|
|
63
|
-
{
|
|
64
|
-
type: 'input',
|
|
65
|
-
name: 'confirmedPath',
|
|
66
|
-
message: 'Where should the config file be created?',
|
|
67
|
-
default: suggestedPath,
|
|
68
|
-
validate: (input) => {
|
|
69
|
-
if (!input || input.trim() === '') {
|
|
70
|
-
return 'Path is required';
|
|
71
|
-
}
|
|
72
|
-
// Check if the directory exists
|
|
73
|
-
const dir = input.endsWith('.ts') || input.endsWith('.js') ? dirname(input) : input;
|
|
74
|
-
const resolvedDir = resolve(process.cwd(), dir);
|
|
75
|
-
if (!existsSync(resolvedDir)) {
|
|
76
|
-
return `Directory does not exist: ${resolvedDir}`;
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
]);
|
|
82
|
-
const resolvedPath = resolve(process.cwd(), confirmedPath);
|
|
83
|
-
configPath =
|
|
84
|
-
confirmedPath.endsWith('.ts') || confirmedPath.endsWith('.js')
|
|
85
|
-
? resolvedPath
|
|
86
|
-
: join(resolvedPath, 'inkeep.config.ts');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Check if config file already exists
|
|
90
|
-
if (existsSync(configPath)) {
|
|
91
|
-
const { overwrite } = await inquirer.prompt([
|
|
92
|
-
{
|
|
93
|
-
type: 'confirm',
|
|
94
|
-
name: 'overwrite',
|
|
95
|
-
message: `${basename(configPath)} already exists at this location. Do you want to overwrite it?`,
|
|
96
|
-
default: false,
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
99
|
-
if (!overwrite) {
|
|
100
|
-
console.log(chalk.yellow('Init cancelled.'));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Prompt for configuration values
|
|
105
|
-
const answers = await inquirer.prompt([
|
|
106
|
-
{
|
|
107
|
-
type: 'input',
|
|
108
|
-
name: 'tenantId',
|
|
109
|
-
message: 'Enter your tenant ID:',
|
|
110
|
-
validate: (input) => {
|
|
111
|
-
if (!input || input.trim() === '') {
|
|
112
|
-
return 'Tenant ID is required';
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: 'input',
|
|
119
|
-
name: 'projectId',
|
|
120
|
-
message: 'Enter your project ID:',
|
|
121
|
-
default: 'default',
|
|
122
|
-
validate: (input) => {
|
|
123
|
-
if (!input || input.trim() === '') {
|
|
124
|
-
return 'Project ID is required';
|
|
125
|
-
}
|
|
126
|
-
return true;
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
type: 'input',
|
|
131
|
-
name: 'apiUrl',
|
|
132
|
-
message: 'Enter the API URL:',
|
|
133
|
-
default: 'http://localhost:3002',
|
|
134
|
-
validate: (input) => {
|
|
135
|
-
try {
|
|
136
|
-
new URL(input);
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
catch {
|
|
140
|
-
return 'Please enter a valid URL';
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
]);
|
|
145
|
-
// Generate the config file content
|
|
146
|
-
const configContent = `import { defineConfig } from '@inkeep/agents-cli';
|
|
147
|
-
|
|
148
|
-
export default defineConfig({
|
|
149
|
-
tenantId: '${answers.tenantId}',
|
|
150
|
-
projectId: '${answers.projectId}',
|
|
151
|
-
apiUrl: '${answers.apiUrl}',
|
|
152
|
-
});
|
|
153
|
-
`;
|
|
154
|
-
// Write the config file
|
|
155
|
-
try {
|
|
156
|
-
writeFileSync(configPath, configContent);
|
|
157
|
-
console.log(chalk.green('✓'), `Created ${chalk.cyan(configPath)}`);
|
|
158
|
-
console.log(chalk.gray('\nYou can now use the Inkeep CLI commands.'));
|
|
159
|
-
console.log(chalk.gray('For example: inkeep list-graphs'));
|
|
160
|
-
// If the config is not in the current directory, provide a hint
|
|
161
|
-
const configDir = dirname(configPath);
|
|
162
|
-
if (configDir !== process.cwd()) {
|
|
163
|
-
console.log(chalk.gray(`\nNote: Config file created in ${configDir}`));
|
|
164
|
-
console.log(chalk.gray(`Use --config ${configPath} with commands, or run commands from that directory.`));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
console.error(chalk.red('Failed to create config file:'), error);
|
|
169
|
-
process.exit(1);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
3
|
-
import { dirname, extname, resolve } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import Table from 'cli-table3';
|
|
7
|
-
import ora from 'ora';
|
|
8
|
-
import { ManagementApiClient } from '../api.js';
|
|
9
|
-
import { validateConfiguration } from '../config.js';
|
|
10
|
-
export async function listGraphsCommand(options) {
|
|
11
|
-
// Check if we need to re-run with tsx for TypeScript config files
|
|
12
|
-
if (!process.env.TSX_RUNNING) {
|
|
13
|
-
// Helper function to find config file
|
|
14
|
-
function findConfigFile(startPath = process.cwd()) {
|
|
15
|
-
let currentPath = resolve(startPath);
|
|
16
|
-
const root = '/';
|
|
17
|
-
const configNames = ['inkeep.config.ts', 'inkeep.config.js', '.inkeeprc.ts', '.inkeeprc.js'];
|
|
18
|
-
while (currentPath !== root) {
|
|
19
|
-
// Check for config files at this level
|
|
20
|
-
for (const configName of configNames) {
|
|
21
|
-
const configPath = resolve(currentPath, configName);
|
|
22
|
-
if (existsSync(configPath)) {
|
|
23
|
-
return configPath;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const parentPath = dirname(currentPath);
|
|
27
|
-
if (parentPath === currentPath) {
|
|
28
|
-
break; // Reached filesystem root
|
|
29
|
-
}
|
|
30
|
-
currentPath = parentPath;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
// Determine if we have a TypeScript config that needs tsx
|
|
35
|
-
let configPath = null;
|
|
36
|
-
if (options?.configFilePath) {
|
|
37
|
-
// User specified a config path
|
|
38
|
-
configPath = resolve(process.cwd(), options.configFilePath);
|
|
39
|
-
if (!existsSync(configPath)) {
|
|
40
|
-
// Config file doesn't exist, let the normal flow handle the error
|
|
41
|
-
configPath = null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// Search for config file
|
|
46
|
-
configPath = findConfigFile();
|
|
47
|
-
}
|
|
48
|
-
// If we found a TypeScript config file, re-run with tsx
|
|
49
|
-
if (configPath && extname(configPath) === '.ts') {
|
|
50
|
-
// Re-run this command with tsx
|
|
51
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
52
|
-
const __dirname = dirname(__filename);
|
|
53
|
-
const cliPath = resolve(__dirname, '../index.js');
|
|
54
|
-
const args = [cliPath, 'list-graphs'];
|
|
55
|
-
if (options?.tenantId)
|
|
56
|
-
args.push('--tenant-id', options.tenantId);
|
|
57
|
-
if (options?.managementApiUrl)
|
|
58
|
-
args.push('--management-api-url', options.managementApiUrl);
|
|
59
|
-
if (options?.configFilePath)
|
|
60
|
-
args.push('--config-file-path', options.configFilePath);
|
|
61
|
-
const child = spawn('npx', ['tsx', ...args], {
|
|
62
|
-
cwd: process.cwd(),
|
|
63
|
-
stdio: 'inherit',
|
|
64
|
-
env: { ...process.env, TSX_RUNNING: '1' },
|
|
65
|
-
});
|
|
66
|
-
child.on('error', (error) => {
|
|
67
|
-
console.error(chalk.red('Failed to load TypeScript configuration:'), error.message);
|
|
68
|
-
process.exit(1);
|
|
69
|
-
});
|
|
70
|
-
child.on('exit', (code) => {
|
|
71
|
-
process.exit(code || 0);
|
|
72
|
-
});
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Validate configuration
|
|
77
|
-
let config;
|
|
78
|
-
try {
|
|
79
|
-
config = await validateConfiguration(options.tenantId, options.managementApiUrl, undefined, // executionApiUrl not needed for list-graphs
|
|
80
|
-
options.configFilePath);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error(chalk.red(error.message));
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
// Log configuration sources for debugging
|
|
87
|
-
console.log(chalk.gray('Using configuration:'));
|
|
88
|
-
console.log(chalk.gray(` • Tenant ID: ${config.sources.tenantId}`));
|
|
89
|
-
console.log(chalk.gray(` • API URL: ${config.sources.managementApiUrl}`));
|
|
90
|
-
console.log();
|
|
91
|
-
const api = await ManagementApiClient.create(config.managementApiUrl, options.configFilePath, config.tenantId);
|
|
92
|
-
const spinner = ora('Fetching graphs...').start();
|
|
93
|
-
try {
|
|
94
|
-
const graphs = await api.listGraphs();
|
|
95
|
-
spinner.succeed(`Found ${graphs.length} graph(s)`);
|
|
96
|
-
if (graphs.length === 0) {
|
|
97
|
-
console.log(chalk.gray('No graphs found. Push a graph with: inkeep push <graph-path>'));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// Create a table to display graphs
|
|
101
|
-
const table = new Table({
|
|
102
|
-
head: [
|
|
103
|
-
chalk.cyan('Graph ID'),
|
|
104
|
-
chalk.cyan('Name'),
|
|
105
|
-
chalk.cyan('Default Agent'),
|
|
106
|
-
chalk.cyan('Created'),
|
|
107
|
-
],
|
|
108
|
-
style: {
|
|
109
|
-
head: [],
|
|
110
|
-
border: [],
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
for (const graph of graphs) {
|
|
114
|
-
const createdDate = graph.createdAt
|
|
115
|
-
? new Date(graph.createdAt).toLocaleDateString()
|
|
116
|
-
: 'Unknown';
|
|
117
|
-
table.push([
|
|
118
|
-
graph.id || '',
|
|
119
|
-
graph.name || graph.id || '',
|
|
120
|
-
graph.defaultAgentId || chalk.gray('None'),
|
|
121
|
-
createdDate,
|
|
122
|
-
]);
|
|
123
|
-
}
|
|
124
|
-
console.log('\n' + table.toString());
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
spinner.fail('Failed to fetch graphs');
|
|
128
|
-
console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
}
|
package/dist/commands/pull.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { FullGraphDefinition } from '../types/graph.js';
|
|
2
|
-
export interface PullOptions {
|
|
3
|
-
tenantId?: string;
|
|
4
|
-
apiUrl?: string;
|
|
5
|
-
configFilePath?: string;
|
|
6
|
-
outputPath?: string;
|
|
7
|
-
json?: boolean;
|
|
8
|
-
maxRetries?: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Convert a TypeScript graph file to its JSON representation
|
|
12
|
-
* Uses the exact same approach as the push command
|
|
13
|
-
*/
|
|
14
|
-
export declare function convertTypeScriptToJson(graphPath: string): Promise<FullGraphDefinition>;
|
|
15
|
-
export declare function pullCommand(graphId: string, options: PullOptions): Promise<void>;
|