@shepai/cli 1.5.0 → 1.6.1
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 +1 -1
- package/dist/src/application/ports/output/agent-validator.interface.d.ts +37 -0
- package/dist/src/application/ports/output/agent-validator.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-validator.interface.js +11 -0
- package/dist/src/application/ports/output/index.d.ts +1 -0
- package/dist/src/application/ports/output/index.d.ts.map +1 -1
- package/dist/src/application/use-cases/agents/configure-agent.use-case.d.ts +47 -0
- package/dist/src/application/use-cases/agents/configure-agent.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/configure-agent.use-case.js +82 -0
- package/dist/src/application/use-cases/agents/validate-agent-auth.use-case.d.ts +31 -0
- package/dist/src/application/use-cases/agents/validate-agent-auth.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/validate-agent-auth.use-case.js +51 -0
- package/dist/src/domain/factories/settings-defaults.factory.d.ts +1 -0
- package/dist/src/domain/factories/settings-defaults.factory.d.ts.map +1 -1
- package/dist/src/domain/factories/settings-defaults.factory.js +17 -0
- package/dist/src/domain/generated/output.d.ts +32 -0
- package/dist/src/domain/generated/output.d.ts.map +1 -1
- package/dist/src/domain/generated/output.js +13 -0
- package/dist/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/src/infrastructure/di/container.js +12 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +3 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
- package/dist/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +10 -0
- package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
- package/dist/src/infrastructure/persistence/sqlite/migrations.js +4 -1
- package/dist/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
- package/dist/src/infrastructure/repositories/sqlite-settings.repository.js +11 -6
- package/dist/src/infrastructure/services/agents/agent-validator.service.d.ts +43 -0
- package/dist/src/infrastructure/services/agents/agent-validator.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/agent-validator.service.js +62 -0
- package/dist/src/presentation/cli/commands/settings/agent.command.d.ts +16 -0
- package/dist/src/presentation/cli/commands/settings/agent.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/settings/agent.command.js +75 -0
- package/dist/src/presentation/cli/commands/settings/index.d.ts +1 -0
- package/dist/src/presentation/cli/commands/settings/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/settings/index.js +4 -1
- package/dist/src/presentation/cli/commands/settings/show.command.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/settings/show.command.js +16 -18
- package/dist/src/presentation/cli/ui/index.d.ts +1 -1
- package/dist/src/presentation/cli/ui/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/output.d.ts +5 -4
- package/dist/src/presentation/cli/ui/output.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/output.js +6 -7
- package/dist/src/presentation/cli/ui/tables.d.ts +10 -5
- package/dist/src/presentation/cli/ui/tables.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/tables.js +62 -17
- package/dist/src/presentation/tui/index.d.ts +3 -0
- package/dist/src/presentation/tui/index.d.ts.map +1 -0
- package/dist/src/presentation/tui/index.js +2 -0
- package/dist/src/presentation/tui/prompts/agent-select.prompt.d.ts +48 -0
- package/dist/src/presentation/tui/prompts/agent-select.prompt.d.ts.map +1 -0
- package/dist/src/presentation/tui/prompts/agent-select.prompt.js +47 -0
- package/dist/src/presentation/tui/prompts/auth-method.prompt.d.ts +36 -0
- package/dist/src/presentation/tui/prompts/auth-method.prompt.d.ts.map +1 -0
- package/dist/src/presentation/tui/prompts/auth-method.prompt.js +32 -0
- package/dist/src/presentation/tui/themes/shep.theme.d.ts +23 -0
- package/dist/src/presentation/tui/themes/shep.theme.d.ts.map +1 -0
- package/dist/src/presentation/tui/themes/shep.theme.js +23 -0
- package/dist/src/presentation/tui/wizards/agent-config.wizard.d.ts +27 -0
- package/dist/src/presentation/tui/wizards/agent-config.wizard.d.ts.map +1 -0
- package/dist/src/presentation/tui/wizards/agent-config.wizard.js +38 -0
- package/dist/src/presentation/web/components/ui/button.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/cache/.previewinfo +1 -1
- package/web/.next/cache/.rscinfo +1 -1
- package/web/.next/cache/config.json +3 -3
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.html +2 -2
- package/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/index.html +2 -2
- package/web/.next/server/app/index.rsc +1 -1
- package/web/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.html +2 -2
- package/web/.next/server/app/version.rsc +1 -1
- package/web/.next/server/app/version.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version.segment.rsc +1 -1
- package/web/.next/server/pages/404.html +2 -2
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/trace +1 -1
- package/web/.next/trace-build +1 -1
- /package/web/.next/static/{Z9XCmAv7-DjAFCpNEPaUt → tXmFlRBlP8T8QaqOrcoHM}/_buildManifest.js +0 -0
- /package/web/.next/static/{Z9XCmAv7-DjAFCpNEPaUt → tXmFlRBlP8T8QaqOrcoHM}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{Z9XCmAv7-DjAFCpNEPaUt → tXmFlRBlP8T8QaqOrcoHM}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Validator Service
|
|
3
|
+
*
|
|
4
|
+
* Infrastructure implementation of the IAgentValidator port.
|
|
5
|
+
* Checks if AI agent binaries are available on the system by
|
|
6
|
+
* executing `<binary> --version` via subprocess.
|
|
7
|
+
*
|
|
8
|
+
* Uses constructor dependency injection for the command executor
|
|
9
|
+
* to enable testability without mocking node:child_process directly.
|
|
10
|
+
*/
|
|
11
|
+
import type { AgentType } from '../../../domain/generated/output.js';
|
|
12
|
+
import type { IAgentValidator, AgentValidationResult } from '../../../application/ports/output/agent-validator.interface.js';
|
|
13
|
+
/**
|
|
14
|
+
* Type for the command executor dependency.
|
|
15
|
+
* Matches the promisified signature of child_process.execFile.
|
|
16
|
+
* Injected via constructor to avoid direct node module mocking in tests.
|
|
17
|
+
*/
|
|
18
|
+
export type ExecFunction = (file: string, args: string[]) => Promise<{
|
|
19
|
+
stdout: string;
|
|
20
|
+
stderr: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Service that validates agent tool availability on the system.
|
|
24
|
+
*
|
|
25
|
+
* Checks if the agent binary exists and is executable by running
|
|
26
|
+
* `<binary> --version` and parsing the output.
|
|
27
|
+
*/
|
|
28
|
+
export declare class AgentValidatorService implements IAgentValidator {
|
|
29
|
+
private readonly execFn;
|
|
30
|
+
/**
|
|
31
|
+
* @param execFn - Command executor function (injectable for testing).
|
|
32
|
+
* Uses execFile semantics (no shell) to prevent command injection.
|
|
33
|
+
*/
|
|
34
|
+
constructor(execFn: ExecFunction);
|
|
35
|
+
/**
|
|
36
|
+
* Check if the specified agent tool is available on the system.
|
|
37
|
+
*
|
|
38
|
+
* @param agentType - The agent type to check
|
|
39
|
+
* @returns Validation result with availability status and version
|
|
40
|
+
*/
|
|
41
|
+
isAvailable(agentType: AgentType): Promise<AgentValidationResult>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=agent-validator.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-validator.service.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/services/agents/agent-validator.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,gEAAgE,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,KACX,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AASjD;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IAEtC;;;OAGG;gBACS,MAAM,EAAE,YAAY;IAIhC;;;;;OAKG;IACG,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC;CA2BxE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Validator Service
|
|
3
|
+
*
|
|
4
|
+
* Infrastructure implementation of the IAgentValidator port.
|
|
5
|
+
* Checks if AI agent binaries are available on the system by
|
|
6
|
+
* executing `<binary> --version` via subprocess.
|
|
7
|
+
*
|
|
8
|
+
* Uses constructor dependency injection for the command executor
|
|
9
|
+
* to enable testability without mocking node:child_process directly.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Map of supported agent types to their binary command names.
|
|
13
|
+
*/
|
|
14
|
+
const AGENT_BINARY_MAP = {
|
|
15
|
+
'claude-code': 'claude',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Service that validates agent tool availability on the system.
|
|
19
|
+
*
|
|
20
|
+
* Checks if the agent binary exists and is executable by running
|
|
21
|
+
* `<binary> --version` and parsing the output.
|
|
22
|
+
*/
|
|
23
|
+
export class AgentValidatorService {
|
|
24
|
+
execFn;
|
|
25
|
+
/**
|
|
26
|
+
* @param execFn - Command executor function (injectable for testing).
|
|
27
|
+
* Uses execFile semantics (no shell) to prevent command injection.
|
|
28
|
+
*/
|
|
29
|
+
constructor(execFn) {
|
|
30
|
+
this.execFn = execFn;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if the specified agent tool is available on the system.
|
|
34
|
+
*
|
|
35
|
+
* @param agentType - The agent type to check
|
|
36
|
+
* @returns Validation result with availability status and version
|
|
37
|
+
*/
|
|
38
|
+
async isAvailable(agentType) {
|
|
39
|
+
const binary = AGENT_BINARY_MAP[agentType];
|
|
40
|
+
if (!binary) {
|
|
41
|
+
return {
|
|
42
|
+
available: false,
|
|
43
|
+
error: `Agent type "${agentType}" is not supported yet`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const { stdout } = await this.execFn(binary, ['--version']);
|
|
48
|
+
const version = stdout.trim();
|
|
49
|
+
return {
|
|
50
|
+
available: true,
|
|
51
|
+
version,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
56
|
+
return {
|
|
57
|
+
available: false,
|
|
58
|
+
error: `Binary "${binary}" not found or not executable: ${message}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Configuration Command
|
|
3
|
+
*
|
|
4
|
+
* Configures the AI coding agent used by Shep for all LLM-powered operations.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* shep settings agent # Interactive wizard
|
|
8
|
+
* shep settings agent --agent claude-code --auth session # Non-interactive
|
|
9
|
+
* shep settings agent --agent claude-code --auth token --token sk-xxx # Token auth
|
|
10
|
+
*/
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
/**
|
|
13
|
+
* Create the agent configuration command
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAgentCommand(): Command;
|
|
16
|
+
//# sourceMappingURL=agent.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.command.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/agent.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAgE5C"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Configuration Command
|
|
3
|
+
*
|
|
4
|
+
* Configures the AI coding agent used by Shep for all LLM-powered operations.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* shep settings agent # Interactive wizard
|
|
8
|
+
* shep settings agent --agent claude-code --auth session # Non-interactive
|
|
9
|
+
* shep settings agent --agent claude-code --auth token --token sk-xxx # Token auth
|
|
10
|
+
*/
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
import { container } from '../../../../infrastructure/di/container.js';
|
|
13
|
+
import { ConfigureAgentUseCase, } from '../../../../application/use-cases/agents/configure-agent.use-case.js';
|
|
14
|
+
import { agentConfigWizard } from '../../../tui/wizards/agent-config.wizard.js';
|
|
15
|
+
import { resetSettings, initializeSettings, } from '../../../../infrastructure/services/settings.service.js';
|
|
16
|
+
import { messages } from '../../ui/index.js';
|
|
17
|
+
/**
|
|
18
|
+
* Create the agent configuration command
|
|
19
|
+
*/
|
|
20
|
+
export function createAgentCommand() {
|
|
21
|
+
return new Command('agent')
|
|
22
|
+
.description('Configure AI coding agent')
|
|
23
|
+
.option('--agent <type>', 'Agent type (e.g., claude-code)')
|
|
24
|
+
.option('--auth <method>', 'Auth method (session or token)')
|
|
25
|
+
.option('--token <key>', 'API token for token-based auth')
|
|
26
|
+
.addHelpText('after', `
|
|
27
|
+
Examples:
|
|
28
|
+
$ shep settings agent Interactive wizard
|
|
29
|
+
$ shep settings agent --agent claude-code --auth session Non-interactive
|
|
30
|
+
$ shep settings agent --agent claude-code --auth token --token sk-xxx Token auth`)
|
|
31
|
+
.action(async (options) => {
|
|
32
|
+
try {
|
|
33
|
+
const isNonInteractive = options.agent !== undefined;
|
|
34
|
+
let input;
|
|
35
|
+
if (isNonInteractive) {
|
|
36
|
+
// Non-interactive: require --auth when --agent is provided
|
|
37
|
+
if (!options.auth) {
|
|
38
|
+
messages.error('--auth is required when using --agent flag');
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
input = {
|
|
43
|
+
type: options.agent,
|
|
44
|
+
authMethod: options.auth,
|
|
45
|
+
...(options.token !== undefined && { token: options.token }),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Interactive: launch wizard
|
|
50
|
+
const wizardResult = await agentConfigWizard();
|
|
51
|
+
input = {
|
|
52
|
+
type: wizardResult.type,
|
|
53
|
+
authMethod: wizardResult.authMethod,
|
|
54
|
+
...(wizardResult.token !== undefined && { token: wizardResult.token }),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const useCase = container.resolve(ConfigureAgentUseCase);
|
|
58
|
+
const updatedSettings = await useCase.execute(input);
|
|
59
|
+
// Update the in-memory settings singleton
|
|
60
|
+
resetSettings();
|
|
61
|
+
initializeSettings(updatedSettings);
|
|
62
|
+
messages.success(`Agent configured: ${input.type} (${input.authMethod})`);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
66
|
+
// Handle user cancellation (Ctrl+C) gracefully
|
|
67
|
+
if (err.message.includes('force closed') || err.message.includes('User force closed')) {
|
|
68
|
+
messages.info('Configuration cancelled.');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
messages.error('Failed to configure agent', err);
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C"}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* Usage:
|
|
7
7
|
* shep settings show # Display current settings
|
|
8
8
|
* shep settings init # Initialize settings to defaults
|
|
9
|
+
* shep settings agent # Configure AI coding agent
|
|
9
10
|
*/
|
|
10
11
|
import { Command } from 'commander';
|
|
11
12
|
import { createShowCommand } from './show.command.js';
|
|
12
13
|
import { createInitCommand } from './init.command.js';
|
|
14
|
+
import { createAgentCommand } from './agent.command.js';
|
|
13
15
|
/**
|
|
14
16
|
* Create the settings command group
|
|
15
17
|
*/
|
|
@@ -17,5 +19,6 @@ export function createSettingsCommand() {
|
|
|
17
19
|
return new Command('settings')
|
|
18
20
|
.description('Manage Shep global settings')
|
|
19
21
|
.addCommand(createShowCommand())
|
|
20
|
-
.addCommand(createInitCommand())
|
|
22
|
+
.addCommand(createInitCommand())
|
|
23
|
+
.addCommand(createAgentCommand());
|
|
21
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"show.command.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/show.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAO5C;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"show.command.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/show.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAO5C;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CA+B3C"}
|
|
@@ -13,7 +13,7 @@ import { OutputFormatter } from '../../ui/output.js';
|
|
|
13
13
|
import { getShepDbPath } from '../../../../infrastructure/services/filesystem/shep-directory.service.js';
|
|
14
14
|
import { getSettings } from '../../../../infrastructure/services/settings.service.js';
|
|
15
15
|
import { statSync } from 'node:fs';
|
|
16
|
-
import { messages
|
|
16
|
+
import { messages } from '../../ui/index.js';
|
|
17
17
|
/**
|
|
18
18
|
* Create the show settings command
|
|
19
19
|
*/
|
|
@@ -31,24 +31,10 @@ Examples:
|
|
|
31
31
|
.action((options) => {
|
|
32
32
|
try {
|
|
33
33
|
const settings = getSettings();
|
|
34
|
-
|
|
34
|
+
// Build database metadata for table format
|
|
35
|
+
const dbMeta = options.output === 'table' ? getDatabaseMeta() : undefined;
|
|
36
|
+
const output = OutputFormatter.format(settings, options.output, dbMeta);
|
|
35
37
|
console.log(output);
|
|
36
|
-
// Show database metadata for table format
|
|
37
|
-
if (options.output === 'table') {
|
|
38
|
-
const dbPath = getShepDbPath();
|
|
39
|
-
let sizeStr = 'unknown';
|
|
40
|
-
try {
|
|
41
|
-
const stats = statSync(dbPath);
|
|
42
|
-
sizeStr = formatFileSize(stats.size);
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
// File may not be accessible
|
|
46
|
-
}
|
|
47
|
-
messages.newline();
|
|
48
|
-
console.log(fmt.heading('Database'));
|
|
49
|
-
console.log(` ${fmt.label('Path:')} ${dbPath}`);
|
|
50
|
-
console.log(` ${fmt.label('Size:')} ${sizeStr}`);
|
|
51
|
-
}
|
|
52
38
|
}
|
|
53
39
|
catch (error) {
|
|
54
40
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -57,6 +43,18 @@ Examples:
|
|
|
57
43
|
}
|
|
58
44
|
});
|
|
59
45
|
}
|
|
46
|
+
function getDatabaseMeta() {
|
|
47
|
+
const dbPath = getShepDbPath();
|
|
48
|
+
let size = 'unknown';
|
|
49
|
+
try {
|
|
50
|
+
const stats = statSync(dbPath);
|
|
51
|
+
size = formatFileSize(stats.size);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// File may not be accessible
|
|
55
|
+
}
|
|
56
|
+
return { path: dbPath, size };
|
|
57
|
+
}
|
|
60
58
|
function formatFileSize(bytes) {
|
|
61
59
|
if (bytes < 1024)
|
|
62
60
|
return `${bytes} B`;
|
|
@@ -15,6 +15,6 @@ export { colors, type Colors } from './colors.js';
|
|
|
15
15
|
export { symbols, type Symbols } from './symbols.js';
|
|
16
16
|
export { fmt, type Formatters } from './formatters.js';
|
|
17
17
|
export { messages, type Messages } from './messages.js';
|
|
18
|
-
export { TableFormatter } from './tables.js';
|
|
18
|
+
export { TableFormatter, type DatabaseMeta } from './tables.js';
|
|
19
19
|
export { OutputFormatter, type OutputFormat } from './output.js';
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* Output Format Utilities
|
|
3
3
|
*
|
|
4
4
|
* Provides utilities for formatting output in multiple formats:
|
|
5
|
-
* - Table (default,
|
|
5
|
+
* - Table (default, clean text-based layout)
|
|
6
6
|
* - JSON (structured data)
|
|
7
7
|
* - YAML (human-readable structured data)
|
|
8
8
|
*
|
|
9
9
|
* @module output
|
|
10
10
|
*/
|
|
11
|
+
import { type DatabaseMeta } from './tables.js';
|
|
11
12
|
export type OutputFormat = 'table' | 'json' | 'yaml';
|
|
12
13
|
/**
|
|
13
14
|
* Output formatter for multiple formats
|
|
@@ -16,11 +17,11 @@ export declare class OutputFormatter {
|
|
|
16
17
|
/**
|
|
17
18
|
* Formats data according to the specified output format
|
|
18
19
|
*/
|
|
19
|
-
static format(data: unknown, format: OutputFormat): string;
|
|
20
|
+
static format(data: unknown, format: OutputFormat, dbMeta?: DatabaseMeta): string;
|
|
20
21
|
/**
|
|
21
|
-
* Formats data as a
|
|
22
|
+
* Formats data as a clean text display
|
|
22
23
|
*/
|
|
23
|
-
static formatAsTable(data: unknown): string;
|
|
24
|
+
static formatAsTable(data: unknown, dbMeta?: DatabaseMeta): string;
|
|
24
25
|
/**
|
|
25
26
|
* Formats data as JSON
|
|
26
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM;IAWjF;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM;IAIlE;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAI1C;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;CAG3C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Output Format Utilities
|
|
3
3
|
*
|
|
4
4
|
* Provides utilities for formatting output in multiple formats:
|
|
5
|
-
* - Table (default,
|
|
5
|
+
* - Table (default, clean text-based layout)
|
|
6
6
|
* - JSON (structured data)
|
|
7
7
|
* - YAML (human-readable structured data)
|
|
8
8
|
*
|
|
@@ -17,10 +17,10 @@ export class OutputFormatter {
|
|
|
17
17
|
/**
|
|
18
18
|
* Formats data according to the specified output format
|
|
19
19
|
*/
|
|
20
|
-
static format(data, format) {
|
|
20
|
+
static format(data, format, dbMeta) {
|
|
21
21
|
switch (format) {
|
|
22
22
|
case 'table':
|
|
23
|
-
return OutputFormatter.formatAsTable(data);
|
|
23
|
+
return OutputFormatter.formatAsTable(data, dbMeta);
|
|
24
24
|
case 'json':
|
|
25
25
|
return OutputFormatter.formatAsJSON(data);
|
|
26
26
|
case 'yaml':
|
|
@@ -28,11 +28,10 @@ export class OutputFormatter {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Formats data as a
|
|
31
|
+
* Formats data as a clean text display
|
|
32
32
|
*/
|
|
33
|
-
static formatAsTable(data) {
|
|
34
|
-
|
|
35
|
-
return table.toString();
|
|
33
|
+
static formatAsTable(data, dbMeta) {
|
|
34
|
+
return TableFormatter.createSettingsTable(data, dbMeta);
|
|
36
35
|
}
|
|
37
36
|
/**
|
|
38
37
|
* Formats data as JSON
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Table Formatting Utilities
|
|
3
3
|
*
|
|
4
|
-
* Provides
|
|
5
|
-
*
|
|
4
|
+
* Provides clean text-based rendering for structured CLI output.
|
|
5
|
+
* Uses alignment, whitespace, and colors instead of box-drawing borders.
|
|
6
6
|
*
|
|
7
7
|
* @module tables
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
export interface DatabaseMeta {
|
|
10
|
+
path: string;
|
|
11
|
+
size: string;
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* Table formatter for CLI output
|
|
12
15
|
*/
|
|
13
16
|
export declare class TableFormatter {
|
|
17
|
+
private static readonly LABEL_WIDTH;
|
|
14
18
|
/**
|
|
15
|
-
* Creates a formatted
|
|
19
|
+
* Creates a clean, formatted settings display string.
|
|
16
20
|
*/
|
|
17
|
-
static createSettingsTable(settings: unknown):
|
|
21
|
+
static createSettingsTable(settings: unknown, dbMeta?: DatabaseMeta): string;
|
|
22
|
+
private static section;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/cli/ui/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAM;IAEzC;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM;IAgE5E,OAAO,CAAC,MAAM,CAAC,OAAO;CAcvB"}
|
|
@@ -1,32 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Table Formatting Utilities
|
|
3
3
|
*
|
|
4
|
-
* Provides
|
|
5
|
-
*
|
|
4
|
+
* Provides clean text-based rendering for structured CLI output.
|
|
5
|
+
* Uses alignment, whitespace, and colors instead of box-drawing borders.
|
|
6
6
|
*
|
|
7
7
|
* @module tables
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
9
|
+
import { colors } from './colors.js';
|
|
10
|
+
import pc from 'picocolors';
|
|
10
11
|
/**
|
|
11
12
|
* Table formatter for CLI output
|
|
12
13
|
*/
|
|
13
14
|
export class TableFormatter {
|
|
15
|
+
static LABEL_WIDTH = 15;
|
|
14
16
|
/**
|
|
15
|
-
* Creates a formatted
|
|
17
|
+
* Creates a clean, formatted settings display string.
|
|
16
18
|
*/
|
|
17
|
-
static createSettingsTable(settings) {
|
|
19
|
+
static createSettingsTable(settings, dbMeta) {
|
|
18
20
|
const s = settings;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Models
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const lines = [];
|
|
22
|
+
lines.push(` ${pc.bold(colors.brand('Settings'))}`);
|
|
23
|
+
lines.push('');
|
|
24
|
+
// Models
|
|
25
|
+
lines.push(...TableFormatter.section('Models', [
|
|
26
|
+
['Analyze', s.models.analyze],
|
|
27
|
+
['Requirements', s.models.requirements],
|
|
28
|
+
['Plan', s.models.plan],
|
|
29
|
+
['Implement', s.models.implement],
|
|
30
|
+
]));
|
|
31
|
+
// User
|
|
32
|
+
lines.push(...TableFormatter.section('User', [
|
|
33
|
+
['Name', s.user.name],
|
|
34
|
+
['Email', s.user.email],
|
|
35
|
+
['GitHub', s.user.githubUsername],
|
|
36
|
+
]));
|
|
37
|
+
// Environment
|
|
38
|
+
lines.push(...TableFormatter.section('Environment', [
|
|
39
|
+
['Editor', s.environment.defaultEditor],
|
|
40
|
+
['Shell', s.environment.shellPreference],
|
|
41
|
+
]));
|
|
42
|
+
// System
|
|
43
|
+
lines.push(...TableFormatter.section('System', [
|
|
44
|
+
['Auto-Update', String(s.system.autoUpdate)],
|
|
45
|
+
['Log Level', s.system.logLevel],
|
|
46
|
+
]));
|
|
47
|
+
// Agent
|
|
48
|
+
lines.push(...TableFormatter.section('Agent', [
|
|
49
|
+
['Type', s.agent.type],
|
|
50
|
+
['Auth', s.agent.authMethod],
|
|
51
|
+
...(s.agent.token ? [['Token', '••••••••']] : []),
|
|
52
|
+
]));
|
|
53
|
+
// Database
|
|
54
|
+
if (dbMeta) {
|
|
55
|
+
lines.push(...TableFormatter.section('Database', [
|
|
56
|
+
['Path', dbMeta.path],
|
|
57
|
+
['Size', dbMeta.size],
|
|
58
|
+
]));
|
|
59
|
+
}
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
}
|
|
62
|
+
static section(title, rows) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
lines.push(` ${pc.bold(title)}`);
|
|
65
|
+
for (const [label, value] of rows) {
|
|
66
|
+
const paddedLabel = label.padEnd(TableFormatter.LABEL_WIDTH);
|
|
67
|
+
if (value === undefined || value === null) {
|
|
68
|
+
lines.push(` ${colors.muted(paddedLabel)}${pc.italic(colors.muted('(not set)'))}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lines.push(` ${colors.muted(paddedLabel)}${value}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
lines.push('');
|
|
75
|
+
return lines;
|
|
31
76
|
}
|
|
32
77
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/presentation/tui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Select Prompt Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configuration for the @inquirer/select prompt that lets users
|
|
5
|
+
* choose their AI coding agent.
|
|
6
|
+
*/
|
|
7
|
+
import { AgentType } from '@/domain/generated/output.js';
|
|
8
|
+
/**
|
|
9
|
+
* Creates the @inquirer/select configuration for selecting an AI coding agent.
|
|
10
|
+
*
|
|
11
|
+
* Only Claude Code is currently available. Other agents are shown as
|
|
12
|
+
* disabled with a "Coming Soon" badge.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAgentSelectConfig(): {
|
|
15
|
+
readonly message: "Select your AI coding agent";
|
|
16
|
+
readonly choices: readonly [{
|
|
17
|
+
readonly name: "Claude Code";
|
|
18
|
+
readonly value: AgentType.ClaudeCode;
|
|
19
|
+
readonly description: "Anthropic Claude Code CLI";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "Gemini CLI";
|
|
22
|
+
readonly value: AgentType.GeminiCli;
|
|
23
|
+
readonly disabled: "(Coming Soon)";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "Aider";
|
|
26
|
+
readonly value: AgentType.Aider;
|
|
27
|
+
readonly disabled: "(Coming Soon)";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "Continue";
|
|
30
|
+
readonly value: AgentType.Continue;
|
|
31
|
+
readonly disabled: "(Coming Soon)";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "Cursor";
|
|
34
|
+
readonly value: AgentType.Cursor;
|
|
35
|
+
readonly disabled: "(Coming Soon)";
|
|
36
|
+
}];
|
|
37
|
+
readonly theme: {
|
|
38
|
+
readonly prefix: {
|
|
39
|
+
readonly idle: string;
|
|
40
|
+
readonly done: string;
|
|
41
|
+
};
|
|
42
|
+
readonly style: {
|
|
43
|
+
readonly highlight: import("picocolors/types.js").Formatter;
|
|
44
|
+
readonly answer: import("picocolors/types.js").Formatter;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=agent-select.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-select.prompt.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/tui/prompts/agent-select.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCtC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Select Prompt Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configuration for the @inquirer/select prompt that lets users
|
|
5
|
+
* choose their AI coding agent.
|
|
6
|
+
*/
|
|
7
|
+
import { AgentType } from '@/domain/generated/output.js';
|
|
8
|
+
import { shepTheme } from '../themes/shep.theme.js';
|
|
9
|
+
/**
|
|
10
|
+
* Creates the @inquirer/select configuration for selecting an AI coding agent.
|
|
11
|
+
*
|
|
12
|
+
* Only Claude Code is currently available. Other agents are shown as
|
|
13
|
+
* disabled with a "Coming Soon" badge.
|
|
14
|
+
*/
|
|
15
|
+
export function createAgentSelectConfig() {
|
|
16
|
+
return {
|
|
17
|
+
message: 'Select your AI coding agent',
|
|
18
|
+
choices: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Claude Code',
|
|
21
|
+
value: AgentType.ClaudeCode,
|
|
22
|
+
description: 'Anthropic Claude Code CLI',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Gemini CLI',
|
|
26
|
+
value: AgentType.GeminiCli,
|
|
27
|
+
disabled: '(Coming Soon)',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Aider',
|
|
31
|
+
value: AgentType.Aider,
|
|
32
|
+
disabled: '(Coming Soon)',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Continue',
|
|
36
|
+
value: AgentType.Continue,
|
|
37
|
+
disabled: '(Coming Soon)',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Cursor',
|
|
41
|
+
value: AgentType.Cursor,
|
|
42
|
+
disabled: '(Coming Soon)',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
theme: shepTheme,
|
|
46
|
+
};
|
|
47
|
+
}
|