@inkeep/create-agents 0.0.0-chat-to-edit-20251119071712
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/LICENSE.md +56 -0
- package/README.md +149 -0
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/__tests__/e2e/quickstart.test.d.ts +1 -0
- package/dist/__tests__/e2e/quickstart.test.js +178 -0
- package/dist/__tests__/e2e/utils.d.ts +41 -0
- package/dist/__tests__/e2e/utils.js +217 -0
- package/dist/__tests__/templates.test.d.ts +1 -0
- package/dist/__tests__/templates.test.js +283 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/__tests__/utils.test.js +333 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/templates.d.ts +17 -0
- package/dist/templates.js +266 -0
- package/dist/utils.d.ts +46 -0
- package/dist/utils.js +460 -0
- package/package.json +74 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
3
|
+
Source: ./LICENSE.md
|
|
4
|
+
This file is automatically copied from the root LICENSE.md during build.
|
|
5
|
+
Any changes should be made to the root LICENSE.md file.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
9
|
+
|
|
10
|
+
NOTE: The Inkeep SDK is licensed under the Elastic License 2.0 (ELv2), subject to Supplemental Terms included in [SUPPLEMENTAL_TERMS.md](SUPPLEMENTAL_TERMS.md). In the event of conflict, the Supplemental Terms control.
|
|
11
|
+
|
|
12
|
+
# Elastic License 2.0
|
|
13
|
+
|
|
14
|
+
## Acceptance
|
|
15
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
16
|
+
|
|
17
|
+
## Copyright License
|
|
18
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
|
|
19
|
+
|
|
20
|
+
## Limitations
|
|
21
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
22
|
+
|
|
23
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
24
|
+
|
|
25
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
26
|
+
|
|
27
|
+
## Patents
|
|
28
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
32
|
+
|
|
33
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
34
|
+
|
|
35
|
+
## No Other Rights
|
|
36
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
37
|
+
|
|
38
|
+
## Termination
|
|
39
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
40
|
+
|
|
41
|
+
## No Liability
|
|
42
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
43
|
+
|
|
44
|
+
## Definitions
|
|
45
|
+
The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
|
|
46
|
+
|
|
47
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
48
|
+
|
|
49
|
+
**your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
50
|
+
|
|
51
|
+
**your licenses** are all the licenses granted to you for the software under these terms.
|
|
52
|
+
|
|
53
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
54
|
+
|
|
55
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
56
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# create-agents
|
|
2
|
+
|
|
3
|
+
Create an Inkeep Agent Framework directory with multi-service architecture.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Interactive mode
|
|
9
|
+
npx create-agents
|
|
10
|
+
|
|
11
|
+
# With directory name
|
|
12
|
+
npx create-agents my-agent-directory
|
|
13
|
+
|
|
14
|
+
# With options
|
|
15
|
+
npx create-agents my-agent-directory --project-id my-project --openai-key sk-... --anthropic-key sk-ant-...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
`@inkeep/create-agents` is a wrapper around the Inkeep CLI's `create` command that sets up a complete Agent Framework directory with:
|
|
21
|
+
|
|
22
|
+
### Interactive Mode
|
|
23
|
+
Run without arguments for an interactive setup experience:
|
|
24
|
+
```bash
|
|
25
|
+
npx create-agents
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You'll be prompted for:
|
|
29
|
+
- Directory name
|
|
30
|
+
- Tenant ID
|
|
31
|
+
- Project ID
|
|
32
|
+
- Anthropic API key (recommended)
|
|
33
|
+
- OpenAI API key (optional)
|
|
34
|
+
|
|
35
|
+
### Direct Mode
|
|
36
|
+
Specify options directly:
|
|
37
|
+
```bash
|
|
38
|
+
pnpm create-agents my-agent-directory --project-id my-project-id --anthropic-key sk-ant-... --openai-key sk-...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Options
|
|
42
|
+
|
|
43
|
+
- `--project-id <project-id>` - Project identifier for your agents
|
|
44
|
+
- `--openai-key <openai-key>` - OpenAI API key (optional)
|
|
45
|
+
- `--anthropic-key <anthropic-key>` - Anthropic API key (recommended)
|
|
46
|
+
|
|
47
|
+
## What's Created
|
|
48
|
+
|
|
49
|
+
After running `@inkeep/create-agents`, you'll have a complete Agent Framework Directory:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
my-agent-directory/
|
|
53
|
+
├── src/
|
|
54
|
+
│ └── <project-id>/ # Agent configurations
|
|
55
|
+
│ ├── hello-agent.ts # Example agent configuration
|
|
56
|
+
│ ├── inkeep.config.ts # Inkeep CLI configuration
|
|
57
|
+
│ └── .env # CLI environment variables
|
|
58
|
+
├── apps/
|
|
59
|
+
│ ├── manage-api/ # Manage API service
|
|
60
|
+
│ │ ├── src/index.ts # API server entry point
|
|
61
|
+
│ │ ├── package.json # Service dependencies
|
|
62
|
+
│ │ ├── tsconfig.json # TypeScript config
|
|
63
|
+
│ │ └── .env # Service environment
|
|
64
|
+
│ ├── run-api/ # Run API service
|
|
65
|
+
│ │ ├── src/index.ts # API server entry point
|
|
66
|
+
│ │ ├── package.json # Service dependencies
|
|
67
|
+
│ │ ├── tsconfig.json # TypeScript config
|
|
68
|
+
│ │ └── .env # Service environment
|
|
69
|
+
│ └── shared/ # Shared code
|
|
70
|
+
│ └── credential-stores.ts # Credential store config
|
|
71
|
+
├── package.json # Root package with workspaces
|
|
72
|
+
├── turbo.json # Turbo build configuration
|
|
73
|
+
├── drizzle.config.ts # Database configuration
|
|
74
|
+
├── biome.json # Linting and formatting
|
|
75
|
+
├── .env # Root environment variables
|
|
76
|
+
├── .env.example # Environment template
|
|
77
|
+
├── .gitignore # Git ignore rules
|
|
78
|
+
└── README.md # Project documentation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Next Steps
|
|
82
|
+
|
|
83
|
+
1. **Navigate to your directory:**
|
|
84
|
+
```bash
|
|
85
|
+
cd my-agent-directory
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. **Start the services:**
|
|
89
|
+
```bash
|
|
90
|
+
# Start both Manage API and Run API
|
|
91
|
+
pnpm dev
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
3. **In a new terminal, start the Manage UI:**
|
|
95
|
+
```bash
|
|
96
|
+
inkeep dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
4. **Deploy your project:**
|
|
100
|
+
```bash
|
|
101
|
+
cd src/<project-id>/
|
|
102
|
+
pnpm inkeep push
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Available Services
|
|
106
|
+
|
|
107
|
+
After setup, you'll have access to:
|
|
108
|
+
|
|
109
|
+
- **Manage API** (Port 3002): Agent configuration and management
|
|
110
|
+
- **Run API** (Port 3003): Agent execution and chat processing
|
|
111
|
+
- **Manage UI** (Port 3000): Visual agent builder (via `npx inkeep dev`)
|
|
112
|
+
|
|
113
|
+
## Commands Available in Your Directory
|
|
114
|
+
|
|
115
|
+
- `pnpm dev` - Start both API services with hot reload
|
|
116
|
+
- `pnpm db:migrate` - Apply database migrations
|
|
117
|
+
- `inkeep dev` - Start the Manage UI
|
|
118
|
+
- `inkeep push` - Deploy project configurations
|
|
119
|
+
|
|
120
|
+
## Environment Variables
|
|
121
|
+
|
|
122
|
+
The directory includes multiple environment files:
|
|
123
|
+
|
|
124
|
+
### Root `.env` (shared configuration)
|
|
125
|
+
```bash
|
|
126
|
+
# AI Provider Keys
|
|
127
|
+
ANTHROPIC_API_KEY=your-anthropic-key-here
|
|
128
|
+
OPENAI_API_KEY=your-openai-key-here
|
|
129
|
+
|
|
130
|
+
# Service Ports
|
|
131
|
+
MANAGE_API_PORT=3002
|
|
132
|
+
RUN_API_PORT=3003
|
|
133
|
+
|
|
134
|
+
# Database
|
|
135
|
+
DATABASE_URL=your-pg-database-url-here
|
|
136
|
+
|
|
137
|
+
# Environment
|
|
138
|
+
ENVIRONMENT=development
|
|
139
|
+
LOG_LEVEL=debug
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Service-specific `.env` files
|
|
143
|
+
- `apps/manage-api/.env` - Manage API configuration
|
|
144
|
+
- `apps/run-api/.env` - Run API configuration
|
|
145
|
+
- `src/<project-id>/.env` - CLI configuration
|
|
146
|
+
|
|
147
|
+
## Learn More
|
|
148
|
+
|
|
149
|
+
- 📚 [Documentation](https://docs.inkeep.com)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
3
|
+
Source: ./SUPPLEMENTAL_TERMS.md
|
|
4
|
+
This file is automatically copied from the root SUPPLEMENTAL_TERMS.md during build.
|
|
5
|
+
Any changes should be made to the root SUPPLEMENTAL_TERMS.md file.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
9
|
+
|
|
10
|
+
The Inkeep [SDK] (the "Software") is licensed under the Elastic License 2.0 ("ELv2"), available at [https://www.elastic.co/licensing/elastic-license](https://www.elastic.co/licensing/elastic-license), subject to the supplemental terms below. By using the Software, you, your company, and your licensees agree to both ELv2 and these Supplemental Terms – for purposes of these Supplemental Terms, references to "you" have the same meaning as in ELv2 and include your company and contractors acting on your behalf. In the event of conflict, these Supplemental Terms control.
|
|
11
|
+
|
|
12
|
+
Any copy or redistribution of the Software must include both the ELv2 license reference and these Supplemental Terms.
|
|
13
|
+
|
|
14
|
+
## 1. Restrictions
|
|
15
|
+
|
|
16
|
+
### 1.1
|
|
17
|
+
You may not use the Software, directly or indirectly, to offer, enable, operate, or provide any Agent Builder.
|
|
18
|
+
|
|
19
|
+
### 1.2
|
|
20
|
+
You may not repackage, rebrand, or otherwise expose the Software's agent-creation or orchestration functionality for third-party use, including in specialized or verticalized offerings that present substantially similar functionality to the Software.
|
|
21
|
+
|
|
22
|
+
### 1.3
|
|
23
|
+
For clarity, the foregoing restrictions do not prohibit your use of the Software as Embedded Assistants or Professional Services, provided neither allow third parties to create, configure, train, orchestrate, deploy, or manage their own agents or agent workflows.
|
|
24
|
+
|
|
25
|
+
## 2. Definitions
|
|
26
|
+
|
|
27
|
+
### 2.1 Inkeep
|
|
28
|
+
**"Inkeep"** means Inkeep, Inc., a Delaware corporation with principal offices at 169 Madison Ave, Ste 2544, New York, NY, 10016, the licensor (as defined in ELv2) of the Software.
|
|
29
|
+
|
|
30
|
+
### 2.2 Agent Builder
|
|
31
|
+
**"Agent Builder"** means any hosted or on-premise product, platform, UI or API that allows third parties (e.g., customers, developers, or community users other than your personnel) to create, configure, compose, train, orchestrate, deploy, or manage their own Agents using the Software, or that otherwise exposes a substantial set of the Agent-creation and orchestration functionality of the Software.
|
|
32
|
+
|
|
33
|
+
### 2.3 Agents
|
|
34
|
+
**"Agents"** means autonomous, semi-autonomous, or automated systems — including assistants, copilots, workflows, orchestrations, or other systems powered by or incorporating artificial intelligence, machine learning, large language models, or related technologies.
|
|
35
|
+
|
|
36
|
+
### 2.4 Embedded Assistant
|
|
37
|
+
**"Embedded Assistant"** means embedding the Software in your own products or services to power a specific assistant/copilot/agent experience for you or your end users (e.g., a support bot in your app or an internal helpdesk agent), where end users do not receive access to any substantial set of the Software's agent-creation or orchestration features.
|
|
38
|
+
|
|
39
|
+
### 2.5 Professional Services
|
|
40
|
+
**"Professional Services"** means using the Software to deliver a bespoke solution to a single client where only your personnel operate the Software, the client receives access solely to the resulting assistant within the client's environment and not to the agent-creation/orchestration features of the Software, and no multi-tenant or self-service builder is provided.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { cleanupDir, createTempDir, linkLocalPackages, runCommand, runCreateAgentsCLI, verifyDirectoryStructure, verifyFile, waitForServerReady, } from './utils';
|
|
5
|
+
const manageApiUrl = 'http://localhost:3002';
|
|
6
|
+
describe('create-agents quickstart e2e', () => {
|
|
7
|
+
let testDir;
|
|
8
|
+
let projectDir;
|
|
9
|
+
const workspaceName = 'test-project';
|
|
10
|
+
const projectId = 'activities-planner';
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
// Create a temporary directory for each test
|
|
13
|
+
testDir = await createTempDir();
|
|
14
|
+
projectDir = path.join(testDir, workspaceName);
|
|
15
|
+
});
|
|
16
|
+
afterEach(async () => {
|
|
17
|
+
await cleanupDir(testDir);
|
|
18
|
+
});
|
|
19
|
+
it('should work e2e', async () => {
|
|
20
|
+
const monorepoRoot = path.join(__dirname, '../../../../../');
|
|
21
|
+
const createAgentsPrefix = path.join(monorepoRoot, 'create-agents-template');
|
|
22
|
+
const projectTemplatesPrefix = path.join(monorepoRoot, 'agents-cookbook/template-projects');
|
|
23
|
+
// Run the CLI with all options (non-interactive mode)
|
|
24
|
+
console.log('Running CLI with options:');
|
|
25
|
+
console.log(`Working directory: ${testDir}`);
|
|
26
|
+
const result = await runCreateAgentsCLI([
|
|
27
|
+
workspaceName,
|
|
28
|
+
'--openai-key',
|
|
29
|
+
'test-openai-key',
|
|
30
|
+
'--disable-git', // Skip git init for faster tests
|
|
31
|
+
'--local-agents-prefix',
|
|
32
|
+
createAgentsPrefix,
|
|
33
|
+
'--local-templates-prefix',
|
|
34
|
+
projectTemplatesPrefix,
|
|
35
|
+
], testDir);
|
|
36
|
+
// Verify the CLI completed successfully
|
|
37
|
+
expect(result.exitCode, `CLI failed with exit code ${result.exitCode}\nstdout: ${result.stdout}\nstderr: ${result.stderr}`).toBe(0);
|
|
38
|
+
console.log('CLI completed successfully');
|
|
39
|
+
// Verify the core directory structure
|
|
40
|
+
console.log('Verifying directory structure...');
|
|
41
|
+
await verifyDirectoryStructure(projectDir, [
|
|
42
|
+
'src',
|
|
43
|
+
'src/inkeep.config.ts',
|
|
44
|
+
`src/projects/${projectId}`,
|
|
45
|
+
'apps/manage-api',
|
|
46
|
+
'apps/run-api',
|
|
47
|
+
'apps/mcp',
|
|
48
|
+
'apps/manage-ui',
|
|
49
|
+
'.env',
|
|
50
|
+
'package.json',
|
|
51
|
+
'drizzle.config.ts',
|
|
52
|
+
]);
|
|
53
|
+
console.log('Directory structure verified');
|
|
54
|
+
// Verify .env file has required variables
|
|
55
|
+
console.log('Verifying .env file...');
|
|
56
|
+
await verifyFile(path.join(projectDir, '.env'), [
|
|
57
|
+
/ENVIRONMENT=development/,
|
|
58
|
+
/OPENAI_API_KEY=test-openai-key/,
|
|
59
|
+
/DATABASE_URL=postgresql:\/\/appuser:password@localhost:5432\/inkeep_agents/,
|
|
60
|
+
/INKEEP_AGENTS_MANAGE_API_URL="http:\/\/localhost:3002"/,
|
|
61
|
+
/INKEEP_AGENTS_RUN_API_URL="http:\/\/localhost:3003"/,
|
|
62
|
+
/INKEEP_AGENTS_JWT_SIGNING_SECRET=\w+/, // Random secret should be generated
|
|
63
|
+
]);
|
|
64
|
+
console.log('.env file verified');
|
|
65
|
+
// Verify inkeep.config.ts was created
|
|
66
|
+
console.log('Verifying inkeep.config.ts...');
|
|
67
|
+
await verifyFile(path.join(projectDir, 'src/inkeep.config.ts'));
|
|
68
|
+
console.log('inkeep.config.ts verified');
|
|
69
|
+
console.log('Setting up project in database');
|
|
70
|
+
await runCommand('pnpm', ['db:migrate'], projectDir);
|
|
71
|
+
console.log('Project setup in database');
|
|
72
|
+
console.log('Starting dev servers');
|
|
73
|
+
// Start dev servers in background with output monitoring
|
|
74
|
+
const devProcess = execa('pnpm', ['dev'], {
|
|
75
|
+
cwd: path.join(projectDir, 'apps/manage-api'),
|
|
76
|
+
env: {
|
|
77
|
+
...process.env,
|
|
78
|
+
FORCE_COLOR: '0',
|
|
79
|
+
NODE_ENV: 'test',
|
|
80
|
+
},
|
|
81
|
+
cleanup: true,
|
|
82
|
+
detached: false,
|
|
83
|
+
stderr: 'pipe',
|
|
84
|
+
});
|
|
85
|
+
// Monitor output for errors and readiness signals
|
|
86
|
+
let serverOutput = '';
|
|
87
|
+
const outputHandler = (data) => {
|
|
88
|
+
const text = data.toString();
|
|
89
|
+
serverOutput += text;
|
|
90
|
+
// Log important messages in CI
|
|
91
|
+
if (process.env.CI) {
|
|
92
|
+
if (text.includes('Error') || text.includes('EADDRINUSE') || text.includes('ready')) {
|
|
93
|
+
console.log('[Server]:', text.trim());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
if (devProcess.stderr)
|
|
98
|
+
devProcess.stderr.on('data', outputHandler);
|
|
99
|
+
// Handle process crashes during startup
|
|
100
|
+
devProcess.catch((error) => {
|
|
101
|
+
console.error('Dev process crashed during startup:', error.message);
|
|
102
|
+
console.error('Server output:', serverOutput);
|
|
103
|
+
});
|
|
104
|
+
console.log('Waiting for servers to be ready');
|
|
105
|
+
try {
|
|
106
|
+
// Wait for servers to be ready with retries
|
|
107
|
+
await waitForServerReady(`${manageApiUrl}/health`, 120000); // Increased to 2 minutes for CI
|
|
108
|
+
console.log('Manage API is ready');
|
|
109
|
+
console.log('Pushing project');
|
|
110
|
+
const pushResult = await runCommand('pnpm', [
|
|
111
|
+
'inkeep',
|
|
112
|
+
'push',
|
|
113
|
+
'--project',
|
|
114
|
+
`src/projects/${projectId}`,
|
|
115
|
+
'--config',
|
|
116
|
+
'src/inkeep.config.ts',
|
|
117
|
+
], projectDir, 30000);
|
|
118
|
+
expect(pushResult.exitCode, `Push failed with exit code ${pushResult.exitCode}\nstdout: ${pushResult.stdout}\nstderr: ${pushResult.stderr}`).toBe(0);
|
|
119
|
+
console.log('Testing API requests');
|
|
120
|
+
// Test API requests
|
|
121
|
+
const response = await fetch(`${manageApiUrl}/tenants/default/projects/${projectId}`);
|
|
122
|
+
const data = await response.json();
|
|
123
|
+
expect(data.data.tenantId).toBe('default');
|
|
124
|
+
expect(data.data.id).toBe(projectId);
|
|
125
|
+
// Link to local monorepo packages
|
|
126
|
+
await linkLocalPackages(projectDir, monorepoRoot);
|
|
127
|
+
const pushResultLocal = await runCommand('pnpm', [
|
|
128
|
+
'inkeep',
|
|
129
|
+
'push',
|
|
130
|
+
'--project',
|
|
131
|
+
`src/projects/${projectId}`,
|
|
132
|
+
'--config',
|
|
133
|
+
'src/inkeep.config.ts',
|
|
134
|
+
], projectDir, 30000);
|
|
135
|
+
expect(pushResultLocal.exitCode, `Push with local packages failed with exit code ${pushResultLocal.exitCode}\nstdout: ${pushResultLocal.stdout}\nstderr: ${pushResultLocal.stderr}`).toBe(0);
|
|
136
|
+
// Test that the project works with local packages
|
|
137
|
+
const responseLocal = await fetch(`${manageApiUrl}/tenants/default/projects/${projectId}`);
|
|
138
|
+
expect(responseLocal.status).toBe(200);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error('Test failed with error:', error);
|
|
142
|
+
// Print server output for debugging
|
|
143
|
+
if (devProcess.stdout) {
|
|
144
|
+
const stdout = await devProcess.stdout;
|
|
145
|
+
console.log('Server stdout:', stdout);
|
|
146
|
+
}
|
|
147
|
+
if (devProcess.stderr) {
|
|
148
|
+
const stderr = await devProcess.stderr;
|
|
149
|
+
console.error('Server stderr:', stderr);
|
|
150
|
+
}
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
console.log('Killing dev process');
|
|
155
|
+
// Kill the process and wait for it to die
|
|
156
|
+
try {
|
|
157
|
+
devProcess.kill('SIGTERM');
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// Might already be dead
|
|
161
|
+
}
|
|
162
|
+
// Give it 2 seconds to shut down gracefully, then force kill
|
|
163
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
164
|
+
try {
|
|
165
|
+
devProcess.kill('SIGKILL');
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// Already dead or couldn't kill
|
|
169
|
+
}
|
|
170
|
+
// Wait for the process to be fully cleaned up (with timeout)
|
|
171
|
+
await Promise.race([
|
|
172
|
+
devProcess.catch(() => { }), // Wait for process to exit
|
|
173
|
+
new Promise((resolve) => setTimeout(resolve, 5000)), // Or timeout after 5s
|
|
174
|
+
]);
|
|
175
|
+
console.log('Dev process cleanup complete');
|
|
176
|
+
}
|
|
177
|
+
}, 720000); // 12 minute timeout for full flow with network calls (CI can be slow)
|
|
178
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the create-agents CLI with the given arguments
|
|
3
|
+
*/
|
|
4
|
+
export declare function runCreateAgentsCLI(args: string[], cwd: string, timeout?: number): Promise<{
|
|
5
|
+
stdout: string;
|
|
6
|
+
stderr: string;
|
|
7
|
+
exitCode: number | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Run a command in the created project directory
|
|
11
|
+
*/
|
|
12
|
+
export declare function runCommand(command: string, args: string[], cwd: string, timeout?: number): Promise<{
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
exitCode: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a temporary directory for testing
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTempDir(prefix?: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Clean up a test directory with retries
|
|
23
|
+
*/
|
|
24
|
+
export declare function cleanupDir(dir: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Verify that a file exists and optionally check its contents
|
|
27
|
+
*/
|
|
28
|
+
export declare function verifyFile(filePath: string, expectedContents?: string[] | RegExp[]): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Verify that a directory has the expected structure
|
|
31
|
+
*/
|
|
32
|
+
export declare function verifyDirectoryStructure(baseDir: string, expectedPaths: string[]): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Link local monorepo packages to the created project
|
|
35
|
+
* This replaces published @inkeep packages with local versions for testing
|
|
36
|
+
*/
|
|
37
|
+
export declare function linkLocalPackages(projectDir: string, monorepoRoot: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Wait for a server to be ready by polling a health endpoint
|
|
40
|
+
*/
|
|
41
|
+
export declare function waitForServerReady(url: string, timeout: number): Promise<void>;
|