@promptbook/cli 0.114.0-34 → 0.114.0-38
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/apps/agents-server/package.json +1 -1
- package/apps/agents-server/scripts/build-agents-server.js +4 -0
- package/apps/agents-server/scripts/build-e2e.js +1 -1
- package/apps/agents-server/src/app/swagger/SwaggerPageClient.tsx +35 -19
- package/apps/agents-server/src/types/swagger-ui-dist.d.ts +5 -0
- package/esm/index.es.js +363 -98
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
- package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
- package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
- package/esm/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
- package/esm/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
- package/esm/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
- package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
- package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +3 -2
- package/src/book-2.0/agent-source/deduplicateSystemMessage.ts +327 -0
- package/src/cli/$initializePromptbookCliProgram.ts +87 -0
- package/src/cli/promptbookCli.ts +2 -87
- package/src/other/templates/getTemplatesPipelineCollection.ts +903 -663
- package/src/version.ts +2 -2
- package/src/versions.txt +4 -0
- package/umd/index.umd.js +363 -98
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
- package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
- package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
- package/umd/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
- package/umd/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
- package/umd/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
- package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
- package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { CLAIM } from '../config';
|
|
3
|
+
import { PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
4
|
+
import { $initializeAboutCommand } from './cli-commands/about';
|
|
5
|
+
import { $initializeAgentCommand } from './cli-commands/agent';
|
|
6
|
+
import { $initializeAgentFolderCommand } from './cli-commands/agent-folder';
|
|
7
|
+
import { $initializeAgentsServerCommand } from './cli-commands/agents-server';
|
|
8
|
+
import { $initializeCoderCommand } from './cli-commands/coder';
|
|
9
|
+
import { $initializeHelloCommand } from './cli-commands/hello';
|
|
10
|
+
import { $initializeListModelsCommand } from './cli-commands/list-models';
|
|
11
|
+
import { $initializeListScrapersCommand } from './cli-commands/list-scrapers';
|
|
12
|
+
import { $initializeLoginCommand } from './cli-commands/login';
|
|
13
|
+
import { $initializeMakeCommand } from './cli-commands/make';
|
|
14
|
+
import { $initializePrettifyCommand } from './cli-commands/prettify';
|
|
15
|
+
import { $initializeRunCommand } from './cli-commands/run';
|
|
16
|
+
import { $initializeStartAgentsServerCommand } from './cli-commands/start-agents-server';
|
|
17
|
+
import { $initializeStartPipelinesServerCommand } from './cli-commands/start-pipelines-server';
|
|
18
|
+
import { $initializeTestCommand } from './cli-commands/test-command';
|
|
19
|
+
import { $addGlobalOptionsToCommand } from './common/$addGlobalOptionsToCommand';
|
|
20
|
+
import { $deprecateCliCommand } from './common/$deprecateCliCommand';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Shared deprecation text for top-level CLI commands backed by the old pipeline system.
|
|
24
|
+
*/
|
|
25
|
+
const OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE = 'This command is part of the old pipeline system.';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Shared deprecation text for top-level CLI commands backed by the old pre-agent system.
|
|
29
|
+
*/
|
|
30
|
+
const OLD_SYSTEM_DEPRECATION_MESSAGE = 'This command is part of the old system.';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Deprecation guidance for top-level `ptbk` commands that remain for compatibility.
|
|
34
|
+
*/
|
|
35
|
+
const DEPRECATED_TOP_LEVEL_COMMAND_MESSAGES: Readonly<Record<string, string>> = {
|
|
36
|
+
run: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
37
|
+
login: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
38
|
+
make: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
39
|
+
prettify: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
40
|
+
test: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
41
|
+
'list-models': OLD_SYSTEM_DEPRECATION_MESSAGE,
|
|
42
|
+
'list-scrapers': OLD_SYSTEM_DEPRECATION_MESSAGE,
|
|
43
|
+
'start-agents-server': 'Use `ptbk agents-server start` instead.',
|
|
44
|
+
'start-pipelines-server': OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Registers the CLI commands on a fresh Commander program without parsing arguments or running an action.
|
|
49
|
+
* Tests can configure output and exit handling before registration, so subcommands inherit those settings.
|
|
50
|
+
*
|
|
51
|
+
* @private internal utility of `promptbookCli`
|
|
52
|
+
*/
|
|
53
|
+
export function $initializePromptbookCliProgram(program: Command): void {
|
|
54
|
+
program.name('promptbook');
|
|
55
|
+
program.alias('ptbk');
|
|
56
|
+
program.version(PROMPTBOOK_ENGINE_VERSION);
|
|
57
|
+
program.description(CLAIM);
|
|
58
|
+
|
|
59
|
+
// Commands are listed in registration order. Keep `coder` first and hide deprecated commands below.
|
|
60
|
+
$initializeCoderCommand(program);
|
|
61
|
+
$initializeAgentCommand(program);
|
|
62
|
+
$initializeAgentFolderCommand(program);
|
|
63
|
+
$initializeAgentsServerCommand(program);
|
|
64
|
+
$initializeAboutCommand(program);
|
|
65
|
+
$initializeHelloCommand(program);
|
|
66
|
+
$initializeRunCommand(program);
|
|
67
|
+
$initializeLoginCommand(program);
|
|
68
|
+
$initializeMakeCommand(program);
|
|
69
|
+
$initializePrettifyCommand(program);
|
|
70
|
+
$initializeTestCommand(program);
|
|
71
|
+
$initializeListModelsCommand(program);
|
|
72
|
+
$initializeListScrapersCommand(program);
|
|
73
|
+
$initializeStartAgentsServerCommand(program);
|
|
74
|
+
$initializeStartPipelinesServerCommand(program);
|
|
75
|
+
|
|
76
|
+
for (const command of program.commands) {
|
|
77
|
+
const deprecationMessage = DEPRECATED_TOP_LEVEL_COMMAND_MESSAGES[command.name()];
|
|
78
|
+
|
|
79
|
+
if (deprecationMessage !== undefined) {
|
|
80
|
+
$deprecateCliCommand(command, deprecationMessage);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
program.commands.forEach($addGlobalOptionsToCommand);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Note: [🟡] Code for CLI command registration [$initializePromptbookCliProgram](src/cli/$initializePromptbookCliProgram.ts) should never be published outside of `@promptbook/cli`
|
package/src/cli/promptbookCli.ts
CHANGED
|
@@ -1,54 +1,12 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
2
|
import commander from 'commander';
|
|
3
3
|
import { spaceTrim } from 'spacetrim';
|
|
4
|
-
import { CLAIM } from '../config';
|
|
5
4
|
import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
|
|
6
5
|
import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
|
|
7
6
|
import { PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
8
|
-
import { $
|
|
9
|
-
import { $initializeAgentCommand } from './cli-commands/agent';
|
|
10
|
-
import { $initializeAgentFolderCommand } from './cli-commands/agent-folder';
|
|
11
|
-
import { $initializeAgentsServerCommand } from './cli-commands/agents-server';
|
|
12
|
-
import { $initializeCoderCommand } from './cli-commands/coder';
|
|
13
|
-
import { $initializeHelloCommand } from './cli-commands/hello';
|
|
14
|
-
import { $initializeListModelsCommand } from './cli-commands/list-models';
|
|
15
|
-
import { $initializeListScrapersCommand } from './cli-commands/list-scrapers';
|
|
16
|
-
import { $initializeLoginCommand } from './cli-commands/login';
|
|
17
|
-
import { $initializeMakeCommand } from './cli-commands/make';
|
|
18
|
-
import { $initializePrettifyCommand } from './cli-commands/prettify';
|
|
19
|
-
import { $initializeRunCommand } from './cli-commands/run';
|
|
20
|
-
import { $initializeStartAgentsServerCommand } from './cli-commands/start-agents-server';
|
|
21
|
-
import { $initializeStartPipelinesServerCommand } from './cli-commands/start-pipelines-server';
|
|
22
|
-
import { $initializeTestCommand } from './cli-commands/test-command';
|
|
23
|
-
import { $addGlobalOptionsToCommand } from './common/$addGlobalOptionsToCommand';
|
|
24
|
-
import { $deprecateCliCommand } from './common/$deprecateCliCommand';
|
|
7
|
+
import { $initializePromptbookCliProgram } from './$initializePromptbookCliProgram';
|
|
25
8
|
import { $reportMissingCliSubcommand } from './common/$requireCliSubcommand';
|
|
26
9
|
|
|
27
|
-
/**
|
|
28
|
-
* Shared deprecation text for top-level CLI commands backed by the old pipeline system.
|
|
29
|
-
*/
|
|
30
|
-
const OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE = 'This command is part of the old pipeline system.';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Shared deprecation text for top-level CLI commands backed by the old pre-agent system.
|
|
34
|
-
*/
|
|
35
|
-
const OLD_SYSTEM_DEPRECATION_MESSAGE = 'This command is part of the old system.';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Deprecation guidance for top-level `ptbk` commands that remain for compatibility.
|
|
39
|
-
*/
|
|
40
|
-
const DEPRECATED_TOP_LEVEL_COMMAND_MESSAGES: Readonly<Record<string, string>> = {
|
|
41
|
-
run: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
42
|
-
login: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
43
|
-
make: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
44
|
-
prettify: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
45
|
-
test: OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
46
|
-
'list-models': OLD_SYSTEM_DEPRECATION_MESSAGE,
|
|
47
|
-
'list-scrapers': OLD_SYSTEM_DEPRECATION_MESSAGE,
|
|
48
|
-
'start-agents-server': 'Use `ptbk agents-server start` instead.',
|
|
49
|
-
'start-pipelines-server': OLD_PIPELINE_SYSTEM_DEPRECATION_MESSAGE,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
10
|
/**
|
|
53
11
|
* Raw top-level CLI arguments that print the Promptbook version.
|
|
54
12
|
*
|
|
@@ -90,37 +48,7 @@ export async function promptbookCli(): Promise<void> {
|
|
|
90
48
|
}
|
|
91
49
|
|
|
92
50
|
const program = new commander.Command();
|
|
93
|
-
program
|
|
94
|
-
program.alias('ptbk');
|
|
95
|
-
|
|
96
|
-
program.version(PROMPTBOOK_ENGINE_VERSION);
|
|
97
|
-
program.description(CLAIM);
|
|
98
|
-
|
|
99
|
-
// Note: These options are valid for all commands
|
|
100
|
-
|
|
101
|
-
// Note: Commands are listed in the help in the order they are registered,
|
|
102
|
-
// `coder` is the most used one so it goes first and the deprecated ones,
|
|
103
|
-
// which `$deprecateTopLevelCommands` hides from the help entirely, go last
|
|
104
|
-
$initializeCoderCommand(program);
|
|
105
|
-
$initializeAgentCommand(program);
|
|
106
|
-
$initializeAgentFolderCommand(program);
|
|
107
|
-
$initializeAgentsServerCommand(program);
|
|
108
|
-
$initializeAboutCommand(program);
|
|
109
|
-
$initializeHelloCommand(program);
|
|
110
|
-
$initializeRunCommand(program);
|
|
111
|
-
$initializeLoginCommand(program);
|
|
112
|
-
$initializeMakeCommand(program);
|
|
113
|
-
$initializePrettifyCommand(program);
|
|
114
|
-
$initializeTestCommand(program);
|
|
115
|
-
$initializeListModelsCommand(program);
|
|
116
|
-
$initializeListScrapersCommand(program);
|
|
117
|
-
$initializeStartAgentsServerCommand(program);
|
|
118
|
-
$initializeStartPipelinesServerCommand(program);
|
|
119
|
-
|
|
120
|
-
$deprecateTopLevelCommands(program);
|
|
121
|
-
|
|
122
|
-
// TODO: [🧠] Should it be here or not> $addGlobalOptionsToCommand(program);
|
|
123
|
-
program.commands.forEach($addGlobalOptionsToCommand);
|
|
51
|
+
$initializePromptbookCliProgram(program);
|
|
124
52
|
|
|
125
53
|
// Note: There is no default command, so `ptbk` without a subcommand asks for one
|
|
126
54
|
// instead of running the deprecated `ptbk run`
|
|
@@ -142,19 +70,6 @@ function isTopLevelVersionRequested(commandLineArguments: ReadonlyArray<string>)
|
|
|
142
70
|
return firstCommandLineArgument !== undefined && VERSION_OPTION_ARGUMENTS.has(firstCommandLineArgument);
|
|
143
71
|
}
|
|
144
72
|
|
|
145
|
-
/**
|
|
146
|
-
* Marks each configured top-level legacy command as deprecated, which keeps it usable but takes it out of the help.
|
|
147
|
-
*/
|
|
148
|
-
function $deprecateTopLevelCommands(program: commander.Command): void {
|
|
149
|
-
for (const command of program.commands) {
|
|
150
|
-
const deprecationMessage = DEPRECATED_TOP_LEVEL_COMMAND_MESSAGES[command.name()];
|
|
151
|
-
|
|
152
|
-
if (deprecationMessage !== undefined) {
|
|
153
|
-
$deprecateCliCommand(command, deprecationMessage);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
73
|
// Note: [🟡] Code for CLI program [promptbookCli](src/cli/promptbookCli.ts) should never be published outside of `@promptbook/cli`
|
|
159
74
|
// TODO: [🥠] Do not export, its just for CLI script
|
|
160
75
|
// TODO: [🕌] When more functionalities, rename
|