@tagma/sdk 0.6.0 → 0.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/LICENSE +21 -21
- package/README.md +573 -573
- package/dist/drivers/opencode.d.ts.map +1 -1
- package/dist/drivers/opencode.js +47 -17
- package/dist/drivers/opencode.js.map +1 -1
- package/package.json +2 -2
- package/src/bootstrap.ts +37 -37
- package/src/completions/output-check.ts +92 -92
- package/src/dag.ts +245 -245
- package/src/drivers/opencode.ts +410 -371
- package/src/engine.ts +1220 -1220
- package/src/hooks.ts +193 -193
- package/src/middlewares/static-context.ts +49 -49
- package/src/pipeline-runner.ts +173 -173
- package/src/prompt-doc.ts +49 -49
- package/src/registry.ts +267 -267
- package/src/runner.ts +460 -460
- package/src/schema.test.ts +101 -101
- package/src/schema.ts +338 -338
- package/src/sdk.ts +118 -118
- package/src/task-ref.test.ts +401 -401
- package/src/task-ref.ts +120 -120
- package/src/validate-raw.ts +412 -412
- package/dist/drivers/claude-code.d.ts +0 -3
- package/dist/drivers/claude-code.d.ts.map +0 -1
- package/dist/drivers/claude-code.js +0 -225
- package/dist/drivers/claude-code.js.map +0 -1
package/src/schema.test.ts
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import yaml from 'js-yaml';
|
|
3
|
-
import type { PipelineConfig, RawPipelineConfig } from './types';
|
|
4
|
-
import { deresolvePipeline, serializePipeline } from './schema';
|
|
5
|
-
|
|
6
|
-
function parsePipelineYaml(content: string): RawPipelineConfig {
|
|
7
|
-
const doc = yaml.load(content) as { pipeline: RawPipelineConfig };
|
|
8
|
-
return doc.pipeline;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe('completion default serialization', () => {
|
|
12
|
-
test('serializePipeline omits default exit_code completions from raw configs', () => {
|
|
13
|
-
const raw: RawPipelineConfig = {
|
|
14
|
-
name: 'Serialize Defaults',
|
|
15
|
-
tracks: [
|
|
16
|
-
{
|
|
17
|
-
id: 'track_a',
|
|
18
|
-
name: 'Track A',
|
|
19
|
-
tasks: [
|
|
20
|
-
{ id: 'task_1', prompt: 'hello', completion: { type: 'exit_code' } },
|
|
21
|
-
{ id: 'task_2', prompt: 'world', completion: { type: 'exit_code', expect: 0 } },
|
|
22
|
-
{ id: 'task_3', prompt: 'keep me', completion: { type: 'exit_code', expect: 2 } },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const parsed = parsePipelineYaml(serializePipeline(raw));
|
|
29
|
-
expect(parsed.tracks[0].tasks[0].completion).toBeUndefined();
|
|
30
|
-
expect(parsed.tracks[0].tasks[1].completion).toBeUndefined();
|
|
31
|
-
expect(parsed.tracks[0].tasks[2].completion).toEqual({ type: 'exit_code', expect: 2 });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('serializePipeline preserves non-default completion plugins', () => {
|
|
35
|
-
const raw: RawPipelineConfig = {
|
|
36
|
-
name: 'Serialize Explicit',
|
|
37
|
-
tracks: [
|
|
38
|
-
{
|
|
39
|
-
id: 'track_a',
|
|
40
|
-
name: 'Track A',
|
|
41
|
-
tasks: [
|
|
42
|
-
{
|
|
43
|
-
id: 'task_1',
|
|
44
|
-
prompt: 'check file',
|
|
45
|
-
completion: { type: 'file_exists', path: './out.txt' },
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const parsed = parsePipelineYaml(serializePipeline(raw));
|
|
53
|
-
expect(parsed.tracks[0].tasks[0].completion).toEqual({
|
|
54
|
-
type: 'file_exists',
|
|
55
|
-
path: './out.txt',
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('deresolvePipeline also omits the default exit_code completion', () => {
|
|
60
|
-
const resolved: PipelineConfig = {
|
|
61
|
-
name: 'Deresolve Defaults',
|
|
62
|
-
tracks: [
|
|
63
|
-
{
|
|
64
|
-
id: 'track_a',
|
|
65
|
-
name: 'Track A',
|
|
66
|
-
driver: 'opencode',
|
|
67
|
-
permissions: { read: true, write: false, execute: false },
|
|
68
|
-
on_failure: 'skip_downstream',
|
|
69
|
-
cwd: 'D:/workspace',
|
|
70
|
-
tasks: [
|
|
71
|
-
{
|
|
72
|
-
id: 'task_1',
|
|
73
|
-
name: 'Task 1',
|
|
74
|
-
prompt: 'hello',
|
|
75
|
-
driver: 'opencode',
|
|
76
|
-
permissions: { read: true, write: false, execute: false },
|
|
77
|
-
cwd: 'D:/workspace',
|
|
78
|
-
completion: { type: 'exit_code', expect: 0 },
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: 'task_2',
|
|
82
|
-
name: 'Task 2',
|
|
83
|
-
prompt: 'custom',
|
|
84
|
-
driver: 'opencode',
|
|
85
|
-
permissions: { read: true, write: false, execute: false },
|
|
86
|
-
cwd: 'D:/workspace',
|
|
87
|
-
completion: { type: 'output_check', check: 'test -f ./done.txt' },
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const raw = deresolvePipeline(resolved, 'D:/workspace');
|
|
95
|
-
expect(raw.tracks[0].tasks[0].completion).toBeUndefined();
|
|
96
|
-
expect(raw.tracks[0].tasks[1].completion).toEqual({
|
|
97
|
-
type: 'output_check',
|
|
98
|
-
check: 'test -f ./done.txt',
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import yaml from 'js-yaml';
|
|
3
|
+
import type { PipelineConfig, RawPipelineConfig } from './types';
|
|
4
|
+
import { deresolvePipeline, serializePipeline } from './schema';
|
|
5
|
+
|
|
6
|
+
function parsePipelineYaml(content: string): RawPipelineConfig {
|
|
7
|
+
const doc = yaml.load(content) as { pipeline: RawPipelineConfig };
|
|
8
|
+
return doc.pipeline;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe('completion default serialization', () => {
|
|
12
|
+
test('serializePipeline omits default exit_code completions from raw configs', () => {
|
|
13
|
+
const raw: RawPipelineConfig = {
|
|
14
|
+
name: 'Serialize Defaults',
|
|
15
|
+
tracks: [
|
|
16
|
+
{
|
|
17
|
+
id: 'track_a',
|
|
18
|
+
name: 'Track A',
|
|
19
|
+
tasks: [
|
|
20
|
+
{ id: 'task_1', prompt: 'hello', completion: { type: 'exit_code' } },
|
|
21
|
+
{ id: 'task_2', prompt: 'world', completion: { type: 'exit_code', expect: 0 } },
|
|
22
|
+
{ id: 'task_3', prompt: 'keep me', completion: { type: 'exit_code', expect: 2 } },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const parsed = parsePipelineYaml(serializePipeline(raw));
|
|
29
|
+
expect(parsed.tracks[0].tasks[0].completion).toBeUndefined();
|
|
30
|
+
expect(parsed.tracks[0].tasks[1].completion).toBeUndefined();
|
|
31
|
+
expect(parsed.tracks[0].tasks[2].completion).toEqual({ type: 'exit_code', expect: 2 });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('serializePipeline preserves non-default completion plugins', () => {
|
|
35
|
+
const raw: RawPipelineConfig = {
|
|
36
|
+
name: 'Serialize Explicit',
|
|
37
|
+
tracks: [
|
|
38
|
+
{
|
|
39
|
+
id: 'track_a',
|
|
40
|
+
name: 'Track A',
|
|
41
|
+
tasks: [
|
|
42
|
+
{
|
|
43
|
+
id: 'task_1',
|
|
44
|
+
prompt: 'check file',
|
|
45
|
+
completion: { type: 'file_exists', path: './out.txt' },
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const parsed = parsePipelineYaml(serializePipeline(raw));
|
|
53
|
+
expect(parsed.tracks[0].tasks[0].completion).toEqual({
|
|
54
|
+
type: 'file_exists',
|
|
55
|
+
path: './out.txt',
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('deresolvePipeline also omits the default exit_code completion', () => {
|
|
60
|
+
const resolved: PipelineConfig = {
|
|
61
|
+
name: 'Deresolve Defaults',
|
|
62
|
+
tracks: [
|
|
63
|
+
{
|
|
64
|
+
id: 'track_a',
|
|
65
|
+
name: 'Track A',
|
|
66
|
+
driver: 'opencode',
|
|
67
|
+
permissions: { read: true, write: false, execute: false },
|
|
68
|
+
on_failure: 'skip_downstream',
|
|
69
|
+
cwd: 'D:/workspace',
|
|
70
|
+
tasks: [
|
|
71
|
+
{
|
|
72
|
+
id: 'task_1',
|
|
73
|
+
name: 'Task 1',
|
|
74
|
+
prompt: 'hello',
|
|
75
|
+
driver: 'opencode',
|
|
76
|
+
permissions: { read: true, write: false, execute: false },
|
|
77
|
+
cwd: 'D:/workspace',
|
|
78
|
+
completion: { type: 'exit_code', expect: 0 },
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'task_2',
|
|
82
|
+
name: 'Task 2',
|
|
83
|
+
prompt: 'custom',
|
|
84
|
+
driver: 'opencode',
|
|
85
|
+
permissions: { read: true, write: false, execute: false },
|
|
86
|
+
cwd: 'D:/workspace',
|
|
87
|
+
completion: { type: 'output_check', check: 'test -f ./done.txt' },
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const raw = deresolvePipeline(resolved, 'D:/workspace');
|
|
95
|
+
expect(raw.tracks[0].tasks[0].completion).toBeUndefined();
|
|
96
|
+
expect(raw.tracks[0].tasks[1].completion).toEqual({
|
|
97
|
+
type: 'output_check',
|
|
98
|
+
check: 'test -f ./done.txt',
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|