@outputai/cli 0.1.13-next.320acd1.0 → 0.1.13-next.455ac5e.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/dist/assets/docker/docker-compose-dev.yml +1 -1
- package/dist/commands/credentials/set.d.ts +16 -0
- package/dist/commands/credentials/set.js +125 -0
- package/dist/commands/credentials/set.spec.d.ts +1 -0
- package/dist/commands/credentials/set.spec.js +160 -0
- package/dist/commands/workflow/plan.js +1 -1
- package/dist/generated/framework_version.json +1 -1
- package/dist/services/claude_client.d.ts +2 -2
- package/dist/services/claude_client.integration.test.js +2 -2
- package/dist/services/claude_client.js +5 -6
- package/dist/services/claude_client.spec.js +3 -3
- package/dist/services/workflow_builder.d.ts +1 -1
- package/dist/services/workflow_builder.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class CredentialsSet extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
value: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
environment: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
workflow: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
private confirmOverwrite;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { confirm } from '@inquirer/prompts';
|
|
3
|
+
import { load as parseYaml, dump as stringifyYaml } from 'js-yaml';
|
|
4
|
+
import { getErrorMessage } from '#utils/error_utils.js';
|
|
5
|
+
import { decryptCredentials, credentialsExist, writeEncrypted, resolveCredentialsPath } from '#services/credentials_service.js';
|
|
6
|
+
const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
+
const detectPathConflict = (obj, dotPath) => {
|
|
8
|
+
const parts = dotPath.split('.');
|
|
9
|
+
const intermediateKeys = parts.slice(0, -1);
|
|
10
|
+
const leafKey = parts[parts.length - 1];
|
|
11
|
+
const walked = intermediateKeys.reduce((state, key, i) => {
|
|
12
|
+
if (state.done) {
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
const next = state.cursor[key];
|
|
16
|
+
if (next === undefined) {
|
|
17
|
+
return { done: true, conflict: null };
|
|
18
|
+
}
|
|
19
|
+
if (!isPlainObject(next)) {
|
|
20
|
+
return {
|
|
21
|
+
done: true,
|
|
22
|
+
conflict: {
|
|
23
|
+
kind: 'primitive_to_object',
|
|
24
|
+
atPath: parts.slice(0, i + 1).join('.'),
|
|
25
|
+
existingValue: next
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { done: false, cursor: next };
|
|
30
|
+
}, { done: false, cursor: obj });
|
|
31
|
+
if (walked.done) {
|
|
32
|
+
return walked.conflict;
|
|
33
|
+
}
|
|
34
|
+
const leaf = walked.cursor[leafKey];
|
|
35
|
+
if (leaf !== undefined && (isPlainObject(leaf) || Array.isArray(leaf))) {
|
|
36
|
+
return { kind: 'object_to_primitive', atPath: dotPath, existingValue: leaf };
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
const setNestedValue = (obj, dotPath, value) => {
|
|
41
|
+
const parts = dotPath.split('.');
|
|
42
|
+
const parent = parts.slice(0, -1).reduce((current, key) => {
|
|
43
|
+
if (!isPlainObject(current[key])) {
|
|
44
|
+
current[key] = {};
|
|
45
|
+
}
|
|
46
|
+
return current[key];
|
|
47
|
+
}, obj);
|
|
48
|
+
parent[parts[parts.length - 1]] = value;
|
|
49
|
+
};
|
|
50
|
+
export default class CredentialsSet extends Command {
|
|
51
|
+
static description = 'Set a credential value by dot-notation path';
|
|
52
|
+
static examples = [
|
|
53
|
+
'<%= config.bin %> <%= command.id %> anthropic.api_key sk-ant-...',
|
|
54
|
+
'<%= config.bin %> <%= command.id %> openai.api_key sk-... --environment production',
|
|
55
|
+
'<%= config.bin %> <%= command.id %> stripe.key sk_live_... --workflow my_workflow'
|
|
56
|
+
];
|
|
57
|
+
static args = {
|
|
58
|
+
path: Args.string({
|
|
59
|
+
description: 'Dot-notation path to the credential (e.g. anthropic.api_key)',
|
|
60
|
+
required: true
|
|
61
|
+
}),
|
|
62
|
+
value: Args.string({
|
|
63
|
+
description: 'Value to set',
|
|
64
|
+
required: true
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
static flags = {
|
|
68
|
+
environment: Flags.string({
|
|
69
|
+
char: 'e',
|
|
70
|
+
description: 'Target environment (e.g. production, development)'
|
|
71
|
+
}),
|
|
72
|
+
workflow: Flags.string({
|
|
73
|
+
char: 'w',
|
|
74
|
+
description: 'Target a specific workflow directory'
|
|
75
|
+
}),
|
|
76
|
+
yes: Flags.boolean({
|
|
77
|
+
char: 'y',
|
|
78
|
+
description: 'Skip confirmation prompts when overwriting a value of a different shape',
|
|
79
|
+
default: false
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
async confirmOverwrite(conflict, newPath) {
|
|
83
|
+
if (conflict.kind === 'primitive_to_object') {
|
|
84
|
+
this.warn(`Writing to "${newPath}" will convert "${conflict.atPath}" from a value into an object, ` +
|
|
85
|
+
`discarding its current value (${JSON.stringify(conflict.existingValue)}).`);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.warn(`Writing to "${newPath}" will replace the existing object at that path ` +
|
|
89
|
+
`(${JSON.stringify(conflict.existingValue)}) with a string value.`);
|
|
90
|
+
}
|
|
91
|
+
return confirm({ message: 'Continue?', default: false });
|
|
92
|
+
}
|
|
93
|
+
async run() {
|
|
94
|
+
const { args, flags } = await this.parse(CredentialsSet);
|
|
95
|
+
const environment = flags.environment;
|
|
96
|
+
const workflow = flags.workflow;
|
|
97
|
+
if (environment && workflow) {
|
|
98
|
+
this.error('Cannot specify both --environment and --workflow.');
|
|
99
|
+
}
|
|
100
|
+
if (!credentialsExist(environment, workflow)) {
|
|
101
|
+
this.error(`No credentials file found at ${resolveCredentialsPath(environment, workflow)}. Run "output credentials init" first.`);
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const plaintext = decryptCredentials(environment, workflow);
|
|
105
|
+
const data = (parseYaml(plaintext) || {});
|
|
106
|
+
const conflict = detectPathConflict(data, args.path);
|
|
107
|
+
if (conflict && !flags.yes) {
|
|
108
|
+
const shouldContinue = await this.confirmOverwrite(conflict, args.path);
|
|
109
|
+
if (!shouldContinue) {
|
|
110
|
+
this.log('Aborted.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
setNestedValue(data, args.path, args.value);
|
|
115
|
+
writeEncrypted(environment, stringifyYaml(data), workflow);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (error instanceof Error && error.constructor.name === 'ExitPromptError') {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.error(`Failed to update credentials: ${getErrorMessage(error)}`);
|
|
122
|
+
}
|
|
123
|
+
this.log(`Set ${args.path}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
3
|
+
import { confirm } from '@inquirer/prompts';
|
|
4
|
+
import * as credentialsService from '#services/credentials_service.js';
|
|
5
|
+
import CredentialsSet from './set.js';
|
|
6
|
+
vi.mock('#services/credentials_service.js');
|
|
7
|
+
vi.mock('@inquirer/prompts', () => ({
|
|
8
|
+
confirm: vi.fn()
|
|
9
|
+
}));
|
|
10
|
+
vi.mock('js-yaml', () => ({
|
|
11
|
+
load: vi.fn((yaml) => {
|
|
12
|
+
if (yaml.includes('__PRIMITIVE_AT_X_Y__')) {
|
|
13
|
+
return { x: { y: 'FOO' } };
|
|
14
|
+
}
|
|
15
|
+
if (yaml.includes('__OBJECT_AT_X_Y__')) {
|
|
16
|
+
return { x: { y: { z: 'FOO' } } };
|
|
17
|
+
}
|
|
18
|
+
if (yaml.includes('sk-existing')) {
|
|
19
|
+
return { anthropic: { api_key: 'sk-existing' } };
|
|
20
|
+
}
|
|
21
|
+
return {};
|
|
22
|
+
}),
|
|
23
|
+
dump: vi.fn((obj) => JSON.stringify(obj))
|
|
24
|
+
}));
|
|
25
|
+
describe('credentials set command', () => {
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
vi.clearAllMocks();
|
|
28
|
+
vi.mocked(credentialsService.credentialsExist).mockReturnValue(true);
|
|
29
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('anthropic:\n api_key: sk-existing\n');
|
|
30
|
+
vi.mocked(credentialsService.writeEncrypted).mockImplementation(() => { });
|
|
31
|
+
vi.mocked(confirm).mockResolvedValue(true);
|
|
32
|
+
});
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
vi.restoreAllMocks();
|
|
35
|
+
});
|
|
36
|
+
const createTestCommand = (parsedArgs = {}, flags = {}) => {
|
|
37
|
+
const cmd = new CredentialsSet([], {});
|
|
38
|
+
cmd.log = vi.fn();
|
|
39
|
+
cmd.warn = vi.fn();
|
|
40
|
+
cmd.error = vi.fn((msg) => {
|
|
41
|
+
throw new Error(msg);
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(cmd, 'parse', {
|
|
44
|
+
value: vi.fn().mockResolvedValue({
|
|
45
|
+
args: { path: 'anthropic.api_key', value: 'sk-new-key', ...parsedArgs },
|
|
46
|
+
flags: { environment: undefined, workflow: undefined, yes: false, ...flags }
|
|
47
|
+
}),
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
return cmd;
|
|
51
|
+
};
|
|
52
|
+
describe('command structure', () => {
|
|
53
|
+
it('should have correct description', () => {
|
|
54
|
+
expect(CredentialsSet.description).toContain('credential value');
|
|
55
|
+
});
|
|
56
|
+
it('should have required path and value arguments', () => {
|
|
57
|
+
expect(CredentialsSet.args.path).toBeDefined();
|
|
58
|
+
expect(CredentialsSet.args.path.required).toBe(true);
|
|
59
|
+
expect(CredentialsSet.args.value).toBeDefined();
|
|
60
|
+
expect(CredentialsSet.args.value.required).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
it('should have environment, workflow, and yes flags', () => {
|
|
63
|
+
expect(CredentialsSet.flags.environment).toBeDefined();
|
|
64
|
+
expect(CredentialsSet.flags.workflow).toBeDefined();
|
|
65
|
+
expect(CredentialsSet.flags.yes).toBeDefined();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('command execution', () => {
|
|
69
|
+
it('should decrypt, update, and re-encrypt credentials', async () => {
|
|
70
|
+
const cmd = createTestCommand();
|
|
71
|
+
await cmd.run();
|
|
72
|
+
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith(undefined, undefined);
|
|
73
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith(undefined, expect.any(String), undefined);
|
|
74
|
+
expect(confirm).not.toHaveBeenCalled();
|
|
75
|
+
expect(cmd.log).toHaveBeenCalledWith('Set anthropic.api_key');
|
|
76
|
+
});
|
|
77
|
+
it('should create nested keys that do not exist', async () => {
|
|
78
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('');
|
|
79
|
+
const cmd = createTestCommand({ path: 'new.nested.key', value: 'my-value' });
|
|
80
|
+
await cmd.run();
|
|
81
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledTimes(1);
|
|
82
|
+
expect(confirm).not.toHaveBeenCalled();
|
|
83
|
+
expect(cmd.log).toHaveBeenCalledWith('Set new.nested.key');
|
|
84
|
+
});
|
|
85
|
+
it('should pass environment flag to service functions', async () => {
|
|
86
|
+
const cmd = createTestCommand({}, { environment: 'production' });
|
|
87
|
+
await cmd.run();
|
|
88
|
+
expect(credentialsService.credentialsExist).toHaveBeenCalledWith('production', undefined);
|
|
89
|
+
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith('production', undefined);
|
|
90
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith('production', expect.any(String), undefined);
|
|
91
|
+
});
|
|
92
|
+
it('should pass workflow flag to service functions', async () => {
|
|
93
|
+
const cmd = createTestCommand({}, { workflow: 'my_workflow' });
|
|
94
|
+
await cmd.run();
|
|
95
|
+
expect(credentialsService.credentialsExist).toHaveBeenCalledWith(undefined, 'my_workflow');
|
|
96
|
+
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith(undefined, 'my_workflow');
|
|
97
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith(undefined, expect.any(String), 'my_workflow');
|
|
98
|
+
});
|
|
99
|
+
it('should error when both environment and workflow are specified', async () => {
|
|
100
|
+
const cmd = createTestCommand({}, { environment: 'production', workflow: 'my_workflow' });
|
|
101
|
+
await expect(cmd.run()).rejects.toThrow('Cannot specify both');
|
|
102
|
+
});
|
|
103
|
+
it('should error when credentials file does not exist', async () => {
|
|
104
|
+
vi.mocked(credentialsService.credentialsExist).mockReturnValue(false);
|
|
105
|
+
vi.mocked(credentialsService.resolveCredentialsPath).mockReturnValue('/project/config/credentials.yml.enc');
|
|
106
|
+
const cmd = createTestCommand();
|
|
107
|
+
await expect(cmd.run()).rejects.toThrow('No credentials file found');
|
|
108
|
+
});
|
|
109
|
+
it('should surface a friendly error when decryption fails', async () => {
|
|
110
|
+
vi.mocked(credentialsService.decryptCredentials).mockImplementation(() => {
|
|
111
|
+
throw new Error('Invalid key');
|
|
112
|
+
});
|
|
113
|
+
const cmd = createTestCommand();
|
|
114
|
+
await expect(cmd.run()).rejects.toThrow('Failed to update credentials: Invalid key');
|
|
115
|
+
});
|
|
116
|
+
it('should surface a friendly error when encryption fails', async () => {
|
|
117
|
+
vi.mocked(credentialsService.writeEncrypted).mockImplementation(() => {
|
|
118
|
+
throw new Error('Permission denied');
|
|
119
|
+
});
|
|
120
|
+
const cmd = createTestCommand();
|
|
121
|
+
await expect(cmd.run()).rejects.toThrow('Failed to update credentials: Permission denied');
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
describe('shape-change confirmation', () => {
|
|
125
|
+
it('should prompt before converting a primitive value into an object', async () => {
|
|
126
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('__PRIMITIVE_AT_X_Y__');
|
|
127
|
+
const cmd = createTestCommand({ path: 'x.y.z', value: 'BAR' });
|
|
128
|
+
await cmd.run();
|
|
129
|
+
expect(cmd.warn).toHaveBeenCalledWith(expect.stringContaining('convert "x.y" from a value into an object'));
|
|
130
|
+
expect(confirm).toHaveBeenCalledTimes(1);
|
|
131
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledTimes(1);
|
|
132
|
+
expect(cmd.log).toHaveBeenCalledWith('Set x.y.z');
|
|
133
|
+
});
|
|
134
|
+
it('should prompt before replacing an object with a primitive value', async () => {
|
|
135
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('__OBJECT_AT_X_Y__');
|
|
136
|
+
const cmd = createTestCommand({ path: 'x.y', value: 'BAR' });
|
|
137
|
+
await cmd.run();
|
|
138
|
+
expect(cmd.warn).toHaveBeenCalledWith(expect.stringContaining('replace the existing object'));
|
|
139
|
+
expect(confirm).toHaveBeenCalledTimes(1);
|
|
140
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledTimes(1);
|
|
141
|
+
});
|
|
142
|
+
it('should abort without writing when the user declines the prompt', async () => {
|
|
143
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('__PRIMITIVE_AT_X_Y__');
|
|
144
|
+
vi.mocked(confirm).mockResolvedValue(false);
|
|
145
|
+
const cmd = createTestCommand({ path: 'x.y.z', value: 'BAR' });
|
|
146
|
+
await cmd.run();
|
|
147
|
+
expect(credentialsService.writeEncrypted).not.toHaveBeenCalled();
|
|
148
|
+
expect(cmd.log).toHaveBeenCalledWith('Aborted.');
|
|
149
|
+
expect(cmd.log).not.toHaveBeenCalledWith('Set x.y.z');
|
|
150
|
+
});
|
|
151
|
+
it('should skip the prompt when --yes is passed', async () => {
|
|
152
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('__PRIMITIVE_AT_X_Y__');
|
|
153
|
+
const cmd = createTestCommand({ path: 'x.y.z', value: 'BAR' }, { yes: true });
|
|
154
|
+
await cmd.run();
|
|
155
|
+
expect(confirm).not.toHaveBeenCalled();
|
|
156
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalledTimes(1);
|
|
157
|
+
expect(cmd.log).toHaveBeenCalledWith('Set x.y.z');
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
@@ -56,7 +56,7 @@ export default class WorkflowPlan extends Command {
|
|
|
56
56
|
return this.planModificationLoop(modifiedPlanContent);
|
|
57
57
|
}
|
|
58
58
|
async planGenerationLoop(promptDescription, planName, projectRoot) {
|
|
59
|
-
this.log('\nInvoking the /
|
|
59
|
+
this.log('\nInvoking the /output-plan-workflow command...');
|
|
60
60
|
this.log('This may take a moment...\n');
|
|
61
61
|
const planContent = await invokePlanWorkflow(promptDescription);
|
|
62
62
|
const modifiedPlanContent = await this.planModificationLoop(planContent);
|
|
@@ -20,7 +20,7 @@ export declare class ClaudeInvocationError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function replyToClaude(message: string, { anthropicOpts, applyAdditionalInstructions }?: ReplyToClaudeOptions): Promise<string>;
|
|
22
22
|
/**
|
|
23
|
-
* Invoke claude-code with /
|
|
23
|
+
* Invoke claude-code with /output-plan-workflow slash command
|
|
24
24
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
25
25
|
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
26
26
|
* @param description - Workflow description
|
|
@@ -28,7 +28,7 @@ export declare function replyToClaude(message: string, { anthropicOpts, applyAdd
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function invokePlanWorkflow(description: string): Promise<string>;
|
|
30
30
|
/**
|
|
31
|
-
* Invoke claude-code with /
|
|
31
|
+
* Invoke claude-code with /output-build-workflow slash command
|
|
32
32
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
33
33
|
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
34
34
|
* @param planFilePath - Absolute path to the plan file
|
|
@@ -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: `/
|
|
18
|
+
prompt: `/output-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 /
|
|
34
|
+
it('should successfully invoke /output-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 =====');
|
|
@@ -53,10 +53,9 @@ date: <plan-date>
|
|
|
53
53
|
`
|
|
54
54
|
};
|
|
55
55
|
// Slash-command naming convention used by the outputai plugin:
|
|
56
|
-
// -
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const BUILD_COMMAND = 'outputai:build_workflow';
|
|
56
|
+
// `output-<kebab-name>` — skills under coding_assistants/.../skills/, which surface as top-level slash commands without the plugin prefix.
|
|
57
|
+
const PLAN_COMMAND = 'output-plan-workflow';
|
|
58
|
+
const BUILD_COMMAND = 'output-build-workflow';
|
|
60
59
|
const MIGRATE_COMMAND = 'output-migrate';
|
|
61
60
|
const GLOBAL_CLAUDE_OPTIONS = {
|
|
62
61
|
settingSources: ['user', 'project', 'local']
|
|
@@ -212,7 +211,7 @@ export async function replyToClaude(message, { anthropicOpts, applyAdditionalIns
|
|
|
212
211
|
return singleQuery(applyInstructions(message, applyAdditionalInstructions), { continue: true, ...anthropicOpts });
|
|
213
212
|
}
|
|
214
213
|
/**
|
|
215
|
-
* Invoke claude-code with /
|
|
214
|
+
* Invoke claude-code with /output-plan-workflow slash command
|
|
216
215
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
217
216
|
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
218
217
|
* @param description - Workflow description
|
|
@@ -222,7 +221,7 @@ export async function invokePlanWorkflow(description) {
|
|
|
222
221
|
return singleQuery(applyInstructions(`/${PLAN_COMMAND} ${description}`, ADDITIONAL_INSTRUCTIONS.PLAN), PLAN_COMMAND_OPTIONS);
|
|
223
222
|
}
|
|
224
223
|
/**
|
|
225
|
-
* Invoke claude-code with /
|
|
224
|
+
* Invoke claude-code with /output-build-workflow slash command
|
|
226
225
|
* The SDK loads custom commands from .claude/commands/ when settingSources includes 'project'.
|
|
227
226
|
* ensureOutputAISystem() scaffolds the command files to that location.
|
|
228
227
|
* @param planFilePath - Absolute path to the plan file
|
|
@@ -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 /
|
|
16
|
+
it('should invoke /output-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('/
|
|
25
|
+
expect(calls[0]?.[0]?.prompt).toContain('/output-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(`/
|
|
39
|
+
expect(calls[0]?.[0]?.prompt).toContain(`/output-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,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Build a workflow from a plan file using the /
|
|
2
|
+
* Build a workflow from a plan file using the /output-build-workflow slash command
|
|
3
3
|
* @param planFilePath - Absolute path to the plan file
|
|
4
4
|
* @param workflowDir - Absolute path to the workflow directory
|
|
5
5
|
* @param workflowName - Name of the workflow
|
|
@@ -31,7 +31,7 @@ function isEmpty(modification) {
|
|
|
31
31
|
return modification.trim() === '';
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Build a workflow from a plan file using the /
|
|
34
|
+
* Build a workflow from a plan file using the /output-build-workflow slash command
|
|
35
35
|
* @param planFilePath - Absolute path to the plan file
|
|
36
36
|
* @param workflowDir - Absolute path to the workflow directory
|
|
37
37
|
* @param workflowName - Name of the workflow
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outputai/cli",
|
|
3
|
-
"version": "0.1.13-next.
|
|
3
|
+
"version": "0.1.13-next.455ac5e.0",
|
|
4
4
|
"description": "CLI for Output.ai workflow generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"react": "19.2.5",
|
|
36
36
|
"semver": "7.7.4",
|
|
37
37
|
"yaml": "^2.8.3",
|
|
38
|
-
"@outputai/credentials": "0.1.13-next.
|
|
39
|
-
"@outputai/
|
|
40
|
-
"@outputai/
|
|
38
|
+
"@outputai/credentials": "0.1.13-next.455ac5e.0",
|
|
39
|
+
"@outputai/evals": "0.1.13-next.455ac5e.0",
|
|
40
|
+
"@outputai/llm": "0.1.13-next.455ac5e.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/cli-progress": "3.11.6",
|