2026-02-21 05:16:57 +00:00
|
|
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
|
|
|
import { createProjectCommand } from '../../src/commands/project.js';
|
|
|
|
|
import type { ApiClient } from '../../src/api-client.js';
|
|
|
|
|
|
|
|
|
|
function mockClient(): ApiClient {
|
|
|
|
|
return {
|
|
|
|
|
get: vi.fn(async () => []),
|
|
|
|
|
post: vi.fn(async () => ({ id: 'proj-1', name: 'my-project' })),
|
|
|
|
|
put: vi.fn(async () => ({})),
|
|
|
|
|
delete: vi.fn(async () => {}),
|
|
|
|
|
} as unknown as ApiClient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
describe('project command', () => {
|
|
|
|
|
let client: ReturnType<typeof mockClient>;
|
|
|
|
|
let output: string[];
|
|
|
|
|
const log = (...args: unknown[]) => output.push(args.map(String).join(' '));
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
client = mockClient();
|
|
|
|
|
output = [];
|
|
|
|
|
});
|
|
|
|
|
|
feat: replace profiles with kubernetes-style secrets
Replace the confused Profile abstraction with a dedicated Secret resource
following Kubernetes conventions. Servers now have env entries with inline
values or secretRef references. Env vars are resolved and passed to
containers at startup (fixes existing gap).
- Add Secret CRUD (model, repo, service, routes, CLI commands)
- Server env: {name, value} or {name, valueFrom: {secretRef: {name, key}}}
- Add env-resolver utility shared by instance startup and config generation
- Remove all profile-related code (models, services, routes, CLI, tests)
- Update backup/restore for secrets instead of profiles
- describe secret masks values by default, --show-values to reveal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 18:40:58 +00:00
|
|
|
it('creates command with alias', () => {
|
|
|
|
|
const cmd = createProjectCommand({ client, log });
|
|
|
|
|
expect(cmd.name()).toBe('project');
|
|
|
|
|
expect(cmd.alias()).toBe('proj');
|
2026-02-21 05:16:57 +00:00
|
|
|
});
|
|
|
|
|
});
|