@output.ai/cli 0.5.6 → 0.7.0
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 -0
- package/dist/api/generated/api.d.ts +25 -0
- package/dist/api/generated/api.js +11 -0
- package/dist/commands/agents/init.d.ts +0 -1
- package/dist/commands/agents/init.js +9 -16
- package/dist/commands/agents/init.spec.js +49 -224
- package/dist/commands/workflow/generate.js +2 -2
- package/dist/commands/workflow/plan.js +3 -3
- package/dist/commands/workflow/plan.spec.js +13 -13
- package/dist/commands/workflow/terminate.d.ts +13 -0
- package/dist/commands/workflow/terminate.js +39 -0
- package/dist/services/claude_client.d.ts +4 -4
- package/dist/services/claude_client.integration.test.js +2 -2
- package/dist/services/claude_client.js +7 -7
- package/dist/services/claude_client.spec.js +3 -3
- package/dist/services/coding_agents.d.ts +10 -24
- package/dist/services/coding_agents.js +112 -368
- package/dist/services/coding_agents.spec.js +101 -290
- package/dist/services/project_scaffold.js +3 -3
- package/dist/services/workflow_builder.d.ts +1 -1
- package/dist/services/workflow_builder.js +1 -1
- package/dist/services/workflow_planner.js +5 -3
- package/dist/services/workflow_planner.spec.js +4 -5
- package/dist/templates/agent_instructions/dotclaude/settings.json.template +29 -0
- package/dist/templates/agent_instructions/{AGENTS.md.template → dotoutputai/AGENTS.md.template} +12 -10
- package/dist/utils/claude.d.ts +5 -0
- package/dist/utils/claude.js +19 -0
- package/dist/utils/claude.spec.d.ts +1 -0
- package/dist/utils/claude.spec.js +119 -0
- package/dist/utils/paths.d.ts +0 -4
- package/dist/utils/paths.js +0 -6
- package/package.json +3 -3
- package/dist/templates/agent_instructions/agents/workflow_context_fetcher.md.template +0 -82
- package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +0 -98
- package/dist/templates/agent_instructions/agents/workflow_planner.md.template +0 -113
- package/dist/templates/agent_instructions/agents/workflow_prompt_writer.md.template +0 -595
- package/dist/templates/agent_instructions/agents/workflow_quality.md.template +0 -244
- package/dist/templates/agent_instructions/commands/build_workflow.md.template +0 -290
- package/dist/templates/agent_instructions/commands/debug_workflow.md.template +0 -198
- package/dist/templates/agent_instructions/commands/plan_workflow.md.template +0 -261
- package/dist/templates/agent_instructions/meta/post_flight.md.template +0 -94
- package/dist/templates/agent_instructions/meta/pre_flight.md.template +0 -60
- package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +0 -249
- package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +0 -298
- package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +0 -265
- package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +0 -252
- package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +0 -226
- package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +0 -209
- package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +0 -128
- package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +0 -117
- package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +0 -199
- package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +0 -228
- package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +0 -141
- package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +0 -201
- package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +0 -151
- package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +0 -164
- package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +0 -134
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { postWorkflowIdTerminate } from '#api/generated/api.js';
|
|
3
|
+
import { handleApiError } from '#utils/error_handler.js';
|
|
4
|
+
export default class WorkflowTerminate extends Command {
|
|
5
|
+
static description = 'Terminate a workflow execution (force stop)';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> <%= command.id %> wf-12345',
|
|
8
|
+
'<%= config.bin %> <%= command.id %> wf-12345 --reason "Cleaning up old workflows"'
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
workflowId: Args.string({
|
|
12
|
+
description: 'The workflow ID to terminate',
|
|
13
|
+
required: true
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
static flags = {
|
|
17
|
+
reason: Flags.string({
|
|
18
|
+
char: 'r',
|
|
19
|
+
description: 'Reason for termination'
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { args, flags } = await this.parse(WorkflowTerminate);
|
|
24
|
+
this.log(`Terminating workflow: ${args.workflowId}...`);
|
|
25
|
+
await postWorkflowIdTerminate(args.workflowId, { reason: flags.reason });
|
|
26
|
+
const output = [
|
|
27
|
+
'Workflow terminated successfully',
|
|
28
|
+
'',
|
|
29
|
+
`Workflow ID: ${args.workflowId}`,
|
|
30
|
+
flags.reason ? `Reason: ${flags.reason}` : ''
|
|
31
|
+
].filter(Boolean).join('\n');
|
|
32
|
+
this.log(`\n${output}`);
|
|
33
|
+
}
|
|
34
|
+
async catch(error) {
|
|
35
|
+
return handleApiError(error, (...args) => this.error(...args), {
|
|
36
|
+
404: 'Workflow not found. Check the workflow ID.'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -10,17 +10,17 @@ export declare class ClaudeInvocationError extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function replyToClaude(message: string, options?: Options): Promise<string>;
|
|
12
12
|
/**
|
|
13
|
-
* Invoke claude-code with /plan_workflow slash command
|
|
13
|
+
* Invoke claude-code with /outputai:plan_workflow slash command
|
|
14
14
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
15
|
-
*
|
|
15
|
+
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
16
16
|
* @param description - Workflow description
|
|
17
17
|
* @returns Plan output from claude-code
|
|
18
18
|
*/
|
|
19
19
|
export declare function invokePlanWorkflow(description: string): Promise<string>;
|
|
20
20
|
/**
|
|
21
|
-
* Invoke claude-code with /build_workflow slash command
|
|
21
|
+
* Invoke claude-code with /outputai:build_workflow slash command
|
|
22
22
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
23
|
-
*
|
|
23
|
+
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
24
24
|
* @param planFilePath - Absolute path to the plan file
|
|
25
25
|
* @param workflowDir - Absolute path to the workflow directory
|
|
26
26
|
* @param workflowName - Name of the workflow
|
|
@@ -15,7 +15,7 @@ describe('invokePlanWorkflow - Integration Tests', () => {
|
|
|
15
15
|
const messages = [];
|
|
16
16
|
try {
|
|
17
17
|
for await (const message of query({
|
|
18
|
-
prompt: `/plan_workflow ${description}`,
|
|
18
|
+
prompt: `/outputai:plan_workflow ${description}`,
|
|
19
19
|
options: { maxTurns: 1 }
|
|
20
20
|
})) {
|
|
21
21
|
console.log('\nReceived message:', JSON.stringify(message, null, 2));
|
|
@@ -31,7 +31,7 @@ describe('invokePlanWorkflow - Integration Tests', () => {
|
|
|
31
31
|
// This test is just for debugging - we expect messages
|
|
32
32
|
expect(messages.length).toBeGreaterThan(0);
|
|
33
33
|
}, 60000); // 60 second timeout
|
|
34
|
-
it('should successfully invoke /plan_workflow slash command and return content', async () => {
|
|
34
|
+
it('should successfully invoke /outputai:plan_workflow slash command and return content', async () => {
|
|
35
35
|
const description = 'Simple workflow that takes a number and doubles it';
|
|
36
36
|
const result = await invokePlanWorkflow(description);
|
|
37
37
|
console.log('\n===== PLAN RESULT =====');
|
|
@@ -33,8 +33,8 @@ const ADDITIONAL_INSTRUCTIONS_BUILD = `
|
|
|
33
33
|
|
|
34
34
|
4. After you mark all todos as complete, provide a summary of what was implemented.
|
|
35
35
|
`;
|
|
36
|
-
const PLAN_COMMAND = 'plan_workflow';
|
|
37
|
-
const BUILD_COMMAND = 'build_workflow';
|
|
36
|
+
const PLAN_COMMAND = 'outputai:plan_workflow';
|
|
37
|
+
const BUILD_COMMAND = 'outputai:build_workflow';
|
|
38
38
|
const GLOBAL_CLAUDE_OPTIONS = {
|
|
39
39
|
settingSources: ['user', 'project', 'local']
|
|
40
40
|
};
|
|
@@ -86,7 +86,7 @@ function displaySystemValidationWarnings(validation) {
|
|
|
86
86
|
ux.warn(`Missing required claude-code slash command: /${command}`);
|
|
87
87
|
});
|
|
88
88
|
ux.warn('Your claude-code agent is missing key configurations, it may not behave as expected.');
|
|
89
|
-
ux.warn('Please run "output
|
|
89
|
+
ux.warn('Please run "npx output agents init" to fix this.');
|
|
90
90
|
}
|
|
91
91
|
function applyDefaultOptions(options) {
|
|
92
92
|
return {
|
|
@@ -186,9 +186,9 @@ export async function replyToClaude(message, options = {}) {
|
|
|
186
186
|
return singleQuery(applyInstructions(message), { continue: true, ...options });
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* Invoke claude-code with /plan_workflow slash command
|
|
189
|
+
* Invoke claude-code with /outputai:plan_workflow slash command
|
|
190
190
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
191
|
-
*
|
|
191
|
+
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
192
192
|
* @param description - Workflow description
|
|
193
193
|
* @returns Plan output from claude-code
|
|
194
194
|
*/
|
|
@@ -196,9 +196,9 @@ export async function invokePlanWorkflow(description) {
|
|
|
196
196
|
return singleQuery(applyInstructions(`/${PLAN_COMMAND} ${description}`), PLAN_COMMAND_OPTIONS);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* Invoke claude-code with /build_workflow slash command
|
|
199
|
+
* Invoke claude-code with /outputai:build_workflow slash command
|
|
200
200
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
201
|
-
*
|
|
201
|
+
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
202
202
|
* @param planFilePath - Absolute path to the plan file
|
|
203
203
|
* @param workflowDir - Absolute path to the workflow directory
|
|
204
204
|
* @param workflowName - Name of the workflow
|
|
@@ -13,7 +13,7 @@ describe('invokePlanWorkflow', () => {
|
|
|
13
13
|
// Clean up environment variables
|
|
14
14
|
delete process.env.ANTHROPIC_API_KEY;
|
|
15
15
|
});
|
|
16
|
-
it('should invoke /plan_workflow slash command with settingSources', async () => {
|
|
16
|
+
it('should invoke /outputai:plan_workflow slash command with settingSources', async () => {
|
|
17
17
|
const { query } = await import('@anthropic-ai/claude-agent-sdk');
|
|
18
18
|
process.env.ANTHROPIC_API_KEY = 'test-key';
|
|
19
19
|
async function* mockIterator() {
|
|
@@ -22,7 +22,7 @@ describe('invokePlanWorkflow', () => {
|
|
|
22
22
|
vi.mocked(query).mockReturnValue(mockIterator());
|
|
23
23
|
await invokePlanWorkflow('Test workflow');
|
|
24
24
|
const calls = vi.mocked(query).mock.calls;
|
|
25
|
-
expect(calls[0]?.[0]?.prompt).toContain('/plan_workflow Test workflow');
|
|
25
|
+
expect(calls[0]?.[0]?.prompt).toContain('/outputai:plan_workflow Test workflow');
|
|
26
26
|
expect(calls[0]?.[0]?.options?.settingSources).toEqual(['user', 'project', 'local']);
|
|
27
27
|
expect(calls[0]?.[0]?.options?.allowedTools).toEqual(['Read', 'Grep', 'WebSearch', 'WebFetch', 'TodoWrite']);
|
|
28
28
|
});
|
|
@@ -36,7 +36,7 @@ describe('invokePlanWorkflow', () => {
|
|
|
36
36
|
const description = 'Build a user authentication system';
|
|
37
37
|
await invokePlanWorkflow(description);
|
|
38
38
|
const calls = vi.mocked(query).mock.calls;
|
|
39
|
-
expect(calls[0]?.[0]?.prompt).toContain(`/plan_workflow ${description}`);
|
|
39
|
+
expect(calls[0]?.[0]?.prompt).toContain(`/outputai:plan_workflow ${description}`);
|
|
40
40
|
expect(calls[0]?.[0]?.options?.settingSources).toEqual(['user', 'project', 'local']);
|
|
41
41
|
});
|
|
42
42
|
it('should return plan output from claude-code', async () => {
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
export interface FileMapping {
|
|
2
|
-
from: string;
|
|
3
|
-
to: string;
|
|
4
|
-
type: 'template' | 'symlink' | 'copy';
|
|
5
|
-
}
|
|
6
|
-
export interface AgentSystemConfig {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
mappings: FileMapping[];
|
|
10
|
-
}
|
|
11
1
|
export interface StructureCheckResult {
|
|
12
|
-
dirExists: boolean;
|
|
13
|
-
missingFiles: string[];
|
|
14
2
|
isComplete: boolean;
|
|
3
|
+
needsInit: boolean;
|
|
15
4
|
}
|
|
16
5
|
export interface InitOptions {
|
|
17
6
|
projectRoot: string;
|
|
18
7
|
force: boolean;
|
|
19
|
-
agentProvider: string;
|
|
20
8
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Agent configuration mappings for different providers
|
|
23
|
-
*/
|
|
24
|
-
export declare const AGENT_CONFIGS: Record<string, AgentSystemConfig>;
|
|
25
|
-
export declare function getRequiredFiles(): string[];
|
|
26
9
|
/**
|
|
27
10
|
* Get the full path to the agent configuration directory
|
|
28
11
|
*/
|
|
@@ -37,14 +20,17 @@ export declare function checkAgentStructure(projectRoot: string): Promise<Struct
|
|
|
37
20
|
*/
|
|
38
21
|
export declare function prepareTemplateVariables(): Record<string, string>;
|
|
39
22
|
/**
|
|
40
|
-
* Initialize agent configuration files
|
|
41
|
-
*
|
|
23
|
+
* Initialize agent configuration files and register Claude Code plugin
|
|
24
|
+
* Creates 3 files:
|
|
25
|
+
* - .outputai/AGENTS.md (from template with Handlebars processing)
|
|
26
|
+
* - .claude/settings.json (static JSON)
|
|
27
|
+
* - CLAUDE.md symlink to .outputai/AGENTS.md
|
|
28
|
+
* Then runs Claude CLI commands to register the plugin marketplace and install the plugin
|
|
42
29
|
*/
|
|
43
30
|
export declare function initializeAgentConfig(options: InitOptions): Promise<void>;
|
|
44
31
|
/**
|
|
45
|
-
* Ensure
|
|
46
|
-
*
|
|
32
|
+
* Ensure OutputAI system is initialized by invoking agents init if needed
|
|
33
|
+
* Creates configuration files and registers Claude Code plugin
|
|
47
34
|
* @param projectRoot - Root directory of the project
|
|
48
|
-
* @throws Error if user declines to initialize or if initialization fails
|
|
49
35
|
*/
|
|
50
|
-
export declare function
|
|
36
|
+
export declare function ensureOutputAISystem(projectRoot: string): Promise<void>;
|