Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/harsh-magenta-panda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inkeep/agents-cli": patch
---

Fix relative path formatting on Windows during push --all in agents-cli
32 changes: 32 additions & 0 deletions agents-cli/src/commands/__tests__/push.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';

describe('push command', () => {
beforeEach(() => {
vi.clearAllMocks();
});

describe('pushCommand', () => {
it('should be defined and exported', async () => {
const { pushCommand } = await import('../push');
expect(pushCommand).toBeDefined();
expect(typeof pushCommand).toBe('function');
});
});

describe('PushOptions interface', () => {
it('should support all options', () => {
const options = {
all: true,
project: 'test-proj',
config: 'inkeep.config.ts',
tag: 'prod',
quiet: true,
force: true,
json: true,
};
expect(options.all).toBe(true);
expect(options.project).toBe('test-proj');
expect(options.tag).toBe('prod');
});
});
});
12 changes: 4 additions & 8 deletions agents-cli/src/commands/push.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, readdirSync, statSync } from 'node:fs';
import { basename, dirname, join, resolve } from 'node:path';
import { basename, dirname, join, relative, resolve } from 'node:path';
import * as p from '@clack/prompts';
import chalk from 'chalk';
import { ManagementApiClient } from '../api';
Expand Down Expand Up @@ -490,7 +490,7 @@ async function pushAllProjects(options: PushOptions): Promise<void> {

console.log(chalk.gray(`Found ${projectDirs.length} project(s) to push:\n`));
for (const dir of projectDirs) {
const relativePath = dir === process.cwd() ? '.' : dir.replace(`${process.cwd()}/`, '');
const relativePath = relative(process.cwd(), dir) || '.';
console.log(chalk.gray(` • ${relativePath}`));
}
console.log();
Expand All @@ -500,8 +500,7 @@ async function pushAllProjects(options: PushOptions): Promise<void> {

for (let i = 0; i < projectDirs.length; i++) {
const projectDir = projectDirs[i];
const relativePath =
projectDir === process.cwd() ? '.' : projectDir.replace(`${process.cwd()}/`, '');
const relativePath = relative(process.cwd(), projectDir) || '.';
const progress = `[${i + 1}/${total}]`;

console.log(chalk.cyan(`${progress} Pushing ${relativePath}...`));
Expand Down Expand Up @@ -530,10 +529,7 @@ async function pushAllProjects(options: PushOptions): Promise<void> {
console.log(chalk.red('\nFailed projects:'));
for (const result of results) {
if (!result.success) {
const relativePath =
result.projectDir === process.cwd()
? '.'
: result.projectDir.replace(`${process.cwd()}/`, '');
const relativePath = relative(process.cwd(), result.projectDir) || '.';
console.log(chalk.red(` • ${relativePath}: ${result.error}`));
}
}
Expand Down
Loading