@studio-foundation/cli 0.3.0-beta.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/ARCHITECTURE.md +40 -0
- package/LICENSE +663 -0
- package/README.md +165 -0
- package/dist/commands/api.d.ts +16 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +118 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/config.d.ts +32 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +390 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +93 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +728 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +22 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/integrations.d.ts +14 -0
- package/dist/commands/integrations.d.ts.map +1 -0
- package/dist/commands/integrations.js +282 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +161 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/logs.d.ts +7 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +98 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/ollama.d.ts +6 -0
- package/dist/commands/ollama.d.ts.map +1 -0
- package/dist/commands/ollama.js +161 -0
- package/dist/commands/ollama.js.map +1 -0
- package/dist/commands/project.d.ts +38 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +137 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/registry/audit.d.ts +13 -0
- package/dist/commands/registry/audit.d.ts.map +1 -0
- package/dist/commands/registry/audit.js +65 -0
- package/dist/commands/registry/audit.js.map +1 -0
- package/dist/commands/registry/index.d.ts +3 -0
- package/dist/commands/registry/index.d.ts.map +1 -0
- package/dist/commands/registry/index.js +53 -0
- package/dist/commands/registry/index.js.map +1 -0
- package/dist/commands/registry/install.d.ts +17 -0
- package/dist/commands/registry/install.d.ts.map +1 -0
- package/dist/commands/registry/install.js +153 -0
- package/dist/commands/registry/install.js.map +1 -0
- package/dist/commands/registry/publish.d.ts +8 -0
- package/dist/commands/registry/publish.d.ts.map +1 -0
- package/dist/commands/registry/publish.js +94 -0
- package/dist/commands/registry/publish.js.map +1 -0
- package/dist/commands/registry/remove.d.ts +8 -0
- package/dist/commands/registry/remove.d.ts.map +1 -0
- package/dist/commands/registry/remove.js +82 -0
- package/dist/commands/registry/remove.js.map +1 -0
- package/dist/commands/registry/search.d.ts +9 -0
- package/dist/commands/registry/search.d.ts.map +1 -0
- package/dist/commands/registry/search.js +68 -0
- package/dist/commands/registry/search.js.map +1 -0
- package/dist/commands/registry/sync.d.ts +8 -0
- package/dist/commands/registry/sync.d.ts.map +1 -0
- package/dist/commands/registry/sync.js +19 -0
- package/dist/commands/registry/sync.js.map +1 -0
- package/dist/commands/registry/update.d.ts +15 -0
- package/dist/commands/registry/update.d.ts.map +1 -0
- package/dist/commands/registry/update.js +48 -0
- package/dist/commands/registry/update.js.map +1 -0
- package/dist/commands/replay.d.ts +36 -0
- package/dist/commands/replay.d.ts.map +1 -0
- package/dist/commands/replay.js +453 -0
- package/dist/commands/replay.js.map +1 -0
- package/dist/commands/run.d.ts +18 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +406 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +144 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/template/index.d.ts +2 -0
- package/dist/commands/template/index.d.ts.map +1 -0
- package/dist/commands/template/index.js +57 -0
- package/dist/commands/template/index.js.map +1 -0
- package/dist/commands/template/validate.d.ts +8 -0
- package/dist/commands/template/validate.d.ts.map +1 -0
- package/dist/commands/template/validate.js +135 -0
- package/dist/commands/template/validate.js.map +1 -0
- package/dist/commands/templates.d.ts +14 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +86 -0
- package/dist/commands/templates.js.map +1 -0
- package/dist/commands/tools.d.ts +12 -0
- package/dist/commands/tools.d.ts.map +1 -0
- package/dist/commands/tools.js +200 -0
- package/dist/commands/tools.js.map +1 -0
- package/dist/commands/users.d.ts +4 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +123 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +39 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +64 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +178 -0
- package/dist/index.js.map +1 -0
- package/dist/models-cache.d.ts +13 -0
- package/dist/models-cache.d.ts.map +1 -0
- package/dist/models-cache.js +106 -0
- package/dist/models-cache.js.map +1 -0
- package/dist/output/file-changes.d.ts +15 -0
- package/dist/output/file-changes.d.ts.map +1 -0
- package/dist/output/file-changes.js +77 -0
- package/dist/output/file-changes.js.map +1 -0
- package/dist/output/formatter.d.ts +6 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +70 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/formatters.d.ts +42 -0
- package/dist/output/formatters.d.ts.map +1 -0
- package/dist/output/formatters.js +280 -0
- package/dist/output/formatters.js.map +1 -0
- package/dist/output/logger.d.ts +3 -0
- package/dist/output/logger.d.ts.map +1 -0
- package/dist/output/logger.js +15 -0
- package/dist/output/logger.js.map +1 -0
- package/dist/output/parallel-progress.d.ts +33 -0
- package/dist/output/parallel-progress.d.ts.map +1 -0
- package/dist/output/parallel-progress.js +85 -0
- package/dist/output/parallel-progress.js.map +1 -0
- package/dist/output/progress.d.ts +32 -0
- package/dist/output/progress.d.ts.map +1 -0
- package/dist/output/progress.js +393 -0
- package/dist/output/progress.js.map +1 -0
- package/dist/provider-validator.d.ts +15 -0
- package/dist/provider-validator.d.ts.map +1 -0
- package/dist/provider-validator.js +85 -0
- package/dist/provider-validator.js.map +1 -0
- package/dist/registry/cache.d.ts +10 -0
- package/dist/registry/cache.d.ts.map +1 -0
- package/dist/registry/cache.js +36 -0
- package/dist/registry/cache.js.map +1 -0
- package/dist/registry/client.d.ts +19 -0
- package/dist/registry/client.d.ts.map +1 -0
- package/dist/registry/client.js +63 -0
- package/dist/registry/client.js.map +1 -0
- package/dist/registry/lockfile.d.ts +17 -0
- package/dist/registry/lockfile.d.ts.map +1 -0
- package/dist/registry/lockfile.js +61 -0
- package/dist/registry/lockfile.js.map +1 -0
- package/dist/registry/resolver.d.ts +13 -0
- package/dist/registry/resolver.d.ts.map +1 -0
- package/dist/registry/resolver.js +79 -0
- package/dist/registry/resolver.js.map +1 -0
- package/dist/registry/types.d.ts +59 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +14 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/run-logger.d.ts +8 -0
- package/dist/run-logger.d.ts.map +1 -0
- package/dist/run-logger.js +53 -0
- package/dist/run-logger.js.map +1 -0
- package/dist/run-store-factory.d.ts +9 -0
- package/dist/run-store-factory.d.ts.map +1 -0
- package/dist/run-store-factory.js +26 -0
- package/dist/run-store-factory.js.map +1 -0
- package/dist/studio-dir.d.ts +7 -0
- package/dist/studio-dir.d.ts.map +1 -0
- package/dist/studio-dir.js +27 -0
- package/dist/studio-dir.js.map +1 -0
- package/dist/utils/input-wizard.d.ts +4 -0
- package/dist/utils/input-wizard.d.ts.map +1 -0
- package/dist/utils/input-wizard.js +56 -0
- package/dist/utils/input-wizard.js.map +1 -0
- package/dist/utils/placeholders.d.ts +6 -0
- package/dist/utils/placeholders.d.ts.map +1 -0
- package/dist/utils/placeholders.js +12 -0
- package/dist/utils/placeholders.js.map +1 -0
- package/package.json +43 -0
- package/src/commands/api.ts +126 -0
- package/src/commands/config.ts +433 -0
- package/src/commands/init.ts +879 -0
- package/src/commands/install.ts +23 -0
- package/src/commands/integrations.ts +332 -0
- package/src/commands/list.ts +197 -0
- package/src/commands/logs.ts +119 -0
- package/src/commands/ollama.ts +168 -0
- package/src/commands/project.ts +167 -0
- package/src/commands/registry/audit.ts +87 -0
- package/src/commands/registry/index.ts +63 -0
- package/src/commands/registry/install.ts +222 -0
- package/src/commands/registry/publish.ts +112 -0
- package/src/commands/registry/remove.ts +89 -0
- package/src/commands/registry/search.ts +93 -0
- package/src/commands/registry/sync.ts +24 -0
- package/src/commands/registry/update.ts +63 -0
- package/src/commands/replay.ts +559 -0
- package/src/commands/run.ts +454 -0
- package/src/commands/status.ts +163 -0
- package/src/commands/template/index.ts +59 -0
- package/src/commands/template/validate.ts +175 -0
- package/src/commands/templates.ts +99 -0
- package/src/commands/tools.ts +227 -0
- package/src/commands/users.ts +127 -0
- package/src/commands/validate.ts +46 -0
- package/src/config.ts +101 -0
- package/src/index.ts +201 -0
- package/src/models-cache.ts +127 -0
- package/src/output/file-changes.ts +97 -0
- package/src/output/formatter.ts +85 -0
- package/src/output/formatters.ts +303 -0
- package/src/output/logger.ts +18 -0
- package/src/output/parallel-progress.ts +103 -0
- package/src/output/progress.ts +414 -0
- package/src/provider-validator.ts +109 -0
- package/src/registry/cache.ts +46 -0
- package/src/registry/client.ts +84 -0
- package/src/registry/lockfile.ts +68 -0
- package/src/registry/resolver.ts +113 -0
- package/src/registry/types.ts +66 -0
- package/src/run-logger.ts +66 -0
- package/src/run-store-factory.ts +30 -0
- package/src/studio-dir.ts +28 -0
- package/src/utils/input-wizard.ts +73 -0
- package/src/utils/placeholders.ts +10 -0
- package/templates/.studiorc.yaml +16 -0
- package/templates/projects/blank/metadata.json +7 -0
- package/templates/studio-config.yaml +14 -0
- package/tests/__stubs__/studio-runner.ts +104 -0
- package/tests/commands/api.test.ts +110 -0
- package/tests/commands/config.test.ts +221 -0
- package/tests/commands/init.test.ts +919 -0
- package/tests/commands/install.test.ts +52 -0
- package/tests/commands/integrations.test.ts +158 -0
- package/tests/commands/ollama.test.ts +139 -0
- package/tests/commands/project.test.ts +179 -0
- package/tests/commands/registry/audit.test.ts +56 -0
- package/tests/commands/registry/install.test.ts +200 -0
- package/tests/commands/registry/publish.test.ts +56 -0
- package/tests/commands/registry/remove.test.ts +103 -0
- package/tests/commands/registry/search.test.ts +44 -0
- package/tests/commands/registry/sync.test.ts +37 -0
- package/tests/commands/registry/update.test.ts +62 -0
- package/tests/commands/replay.test.ts +283 -0
- package/tests/commands/template/validate.test.ts +150 -0
- package/tests/commands/templates.test.ts +42 -0
- package/tests/commands/tools.test.ts +106 -0
- package/tests/config.test.ts +142 -0
- package/tests/formatter.test.ts +158 -0
- package/tests/integration/sigint.test.ts +188 -0
- package/tests/models-cache.test.ts +250 -0
- package/tests/output/file-changes.test.ts +178 -0
- package/tests/output/formatters.test.ts +448 -0
- package/tests/output/progress-spinner.test.ts +232 -0
- package/tests/output/progress-timer.test.ts +230 -0
- package/tests/provider-validator.test.ts +182 -0
- package/tests/registry/cache.test.ts +66 -0
- package/tests/registry/client.test.ts +70 -0
- package/tests/registry/lockfile.test.ts +87 -0
- package/tests/registry/resolver.test.ts +122 -0
- package/tests/run-logger-events.test.ts +326 -0
- package/tests/run-logger.test.ts +64 -0
- package/tests/run-store-factory.test.ts +51 -0
- package/tests/studio-dir.test.ts +31 -0
- package/tests/utils/input-wizard.test.ts +153 -0
- package/tests/utils/placeholders.test.ts +36 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +20 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import type { InputSchema } from '@studio-foundation/contracts';
|
|
3
|
+
import { collectStructuredInput } from '../../src/utils/input-wizard.js';
|
|
4
|
+
|
|
5
|
+
// Mock @inquirer/prompts at module level
|
|
6
|
+
vi.mock('@inquirer/prompts', () => ({
|
|
7
|
+
input: vi.fn(),
|
|
8
|
+
}));
|
|
9
|
+
import { validateInputSchema } from '../../src/utils/input-wizard.js';
|
|
10
|
+
|
|
11
|
+
describe('validateInputSchema', () => {
|
|
12
|
+
it('accepts a valid text field', () => {
|
|
13
|
+
const result = validateInputSchema({
|
|
14
|
+
type: 'structured',
|
|
15
|
+
fields: [{ name: 'brief_summary', type: 'text', prompt: 'Brief summary', required: true }],
|
|
16
|
+
});
|
|
17
|
+
expect(result.fields).toHaveLength(1);
|
|
18
|
+
expect(result.fields[0].name).toBe('brief_summary');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('accepts a valid array field', () => {
|
|
22
|
+
const result = validateInputSchema({
|
|
23
|
+
type: 'structured',
|
|
24
|
+
fields: [{ name: 'criteria', type: 'array', items: 'text', prompt: 'Criteria', required: true }],
|
|
25
|
+
});
|
|
26
|
+
expect(result.fields[0].type).toBe('array');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('accepts an optional field with a default', () => {
|
|
30
|
+
const result = validateInputSchema({
|
|
31
|
+
type: 'structured',
|
|
32
|
+
fields: [{ name: 'page', type: 'text', prompt: 'Target page', required: false, default: 'src/index.ts' }],
|
|
33
|
+
});
|
|
34
|
+
expect(result.fields[0].default).toBe('src/index.ts');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('throws when fields is missing', () => {
|
|
38
|
+
expect(() => validateInputSchema({ type: 'structured' })).toThrow(
|
|
39
|
+
'input_schema must have at least one field'
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('throws when fields is empty', () => {
|
|
44
|
+
expect(() => validateInputSchema({ type: 'structured', fields: [] })).toThrow(
|
|
45
|
+
'input_schema must have at least one field'
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('throws when a field is missing prompt', () => {
|
|
50
|
+
expect(() =>
|
|
51
|
+
validateInputSchema({
|
|
52
|
+
type: 'structured',
|
|
53
|
+
fields: [{ name: 'foo', type: 'text', required: true }],
|
|
54
|
+
})
|
|
55
|
+
).toThrow("Field 'foo' must have a non-empty 'prompt'");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('throws when a field has empty prompt', () => {
|
|
59
|
+
expect(() =>
|
|
60
|
+
validateInputSchema({
|
|
61
|
+
type: 'structured',
|
|
62
|
+
fields: [{ name: 'foo', type: 'text', prompt: ' ', required: true }],
|
|
63
|
+
})
|
|
64
|
+
).toThrow("Field 'foo' must have a non-empty 'prompt'");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('throws when a field has invalid type', () => {
|
|
68
|
+
expect(() =>
|
|
69
|
+
validateInputSchema({
|
|
70
|
+
type: 'structured',
|
|
71
|
+
fields: [{ name: 'foo', type: 'number', prompt: 'Foo', required: true }],
|
|
72
|
+
})
|
|
73
|
+
).toThrow("Field 'foo' has invalid type 'number'. Must be 'text' or 'array'");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('throws when an array field is missing items', () => {
|
|
77
|
+
expect(() =>
|
|
78
|
+
validateInputSchema({
|
|
79
|
+
type: 'structured',
|
|
80
|
+
fields: [{ name: 'foo', type: 'array', prompt: 'Foo', required: true }],
|
|
81
|
+
})
|
|
82
|
+
).toThrow("Array field 'foo' must have items: 'text'");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('throws when an array field has non-text items', () => {
|
|
86
|
+
expect(() =>
|
|
87
|
+
validateInputSchema({
|
|
88
|
+
type: 'structured',
|
|
89
|
+
fields: [{ name: 'foo', type: 'array', items: 'number', prompt: 'Foo', required: true }],
|
|
90
|
+
})
|
|
91
|
+
).toThrow("Array field 'foo' must have items: 'text'");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('collectStructuredInput', () => {
|
|
96
|
+
beforeEach(() => {
|
|
97
|
+
vi.clearAllMocks();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('collects a single text field', async () => {
|
|
101
|
+
const { input: mockInput } = await import('@inquirer/prompts');
|
|
102
|
+
(mockInput as ReturnType<typeof vi.fn>).mockResolvedValueOnce('Add dark mode');
|
|
103
|
+
|
|
104
|
+
const schema: InputSchema = {
|
|
105
|
+
type: 'structured',
|
|
106
|
+
fields: [{ name: 'brief_summary', type: 'text', prompt: 'Brief summary', required: true }],
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const result = await collectStructuredInput(schema);
|
|
110
|
+
|
|
111
|
+
expect(result).toEqual({ brief_summary: 'Add dark mode' });
|
|
112
|
+
expect(mockInput).toHaveBeenCalledWith(
|
|
113
|
+
expect.objectContaining({ message: 'Brief summary' })
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('collects an array field with multiple entries', async () => {
|
|
118
|
+
const { input: mockInput } = await import('@inquirer/prompts');
|
|
119
|
+
(mockInput as ReturnType<typeof vi.fn>)
|
|
120
|
+
.mockResolvedValueOnce('First criterion')
|
|
121
|
+
.mockResolvedValueOnce('Second criterion')
|
|
122
|
+
.mockResolvedValueOnce(''); // empty → stop
|
|
123
|
+
|
|
124
|
+
const schema: InputSchema = {
|
|
125
|
+
type: 'structured',
|
|
126
|
+
fields: [{ name: 'criteria', type: 'array', items: 'text', prompt: 'Criteria', required: true }],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const result = await collectStructuredInput(schema);
|
|
130
|
+
|
|
131
|
+
expect(result).toEqual({ criteria: ['First criterion', 'Second criterion'] });
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('collects multiple fields', async () => {
|
|
135
|
+
const { input: mockInput } = await import('@inquirer/prompts');
|
|
136
|
+
(mockInput as ReturnType<typeof vi.fn>)
|
|
137
|
+
.mockResolvedValueOnce('Add dark mode') // text field
|
|
138
|
+
.mockResolvedValueOnce('Must work') // array entry 1
|
|
139
|
+
.mockResolvedValueOnce(''); // array stop
|
|
140
|
+
|
|
141
|
+
const schema: InputSchema = {
|
|
142
|
+
type: 'structured',
|
|
143
|
+
fields: [
|
|
144
|
+
{ name: 'summary', type: 'text', prompt: 'Summary', required: true },
|
|
145
|
+
{ name: 'criteria', type: 'array', items: 'text', prompt: 'Criteria', required: true },
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const result = await collectStructuredInput(schema);
|
|
150
|
+
|
|
151
|
+
expect(result).toEqual({ summary: 'Add dark mode', criteria: ['Must work'] });
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { applyPlaceholders } from '../../src/utils/placeholders.js';
|
|
3
|
+
|
|
4
|
+
describe('applyPlaceholders', () => {
|
|
5
|
+
it('replaces a single known placeholder', () => {
|
|
6
|
+
expect(applyPlaceholders('Hello {{PROJECT_NAME}}', { PROJECT_NAME: 'my-app' }))
|
|
7
|
+
.toBe('Hello my-app');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('replaces multiple placeholders in one pass', () => {
|
|
11
|
+
const result = applyPlaceholders(
|
|
12
|
+
'name: {{PROJECT_NAME}}\ntemplate: {{TEMPLATE_NAME}}\nyear: {{YEAR}}',
|
|
13
|
+
{ PROJECT_NAME: 'x', TEMPLATE_NAME: 'software', YEAR: '2026' }
|
|
14
|
+
);
|
|
15
|
+
expect(result).toBe('name: x\ntemplate: software\nyear: 2026');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('replaces the same placeholder multiple times', () => {
|
|
19
|
+
expect(applyPlaceholders('{{PROJECT_NAME}} / {{PROJECT_NAME}}', { PROJECT_NAME: 'app' }))
|
|
20
|
+
.toBe('app / app');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('throws on unresolved placeholder', () => {
|
|
24
|
+
expect(() => applyPlaceholders('{{UNKNOWN}}', {}))
|
|
25
|
+
.toThrow('Unresolved placeholder: {{UNKNOWN}}');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns content unchanged when no placeholders', () => {
|
|
29
|
+
expect(applyPlaceholders('no placeholders here', {})).toBe('no placeholders here');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('does not replace lowercase or mixed-case patterns', () => {
|
|
33
|
+
// Only {{ALL_CAPS_WITH_UNDERSCORES}} are treated as placeholders
|
|
34
|
+
expect(applyPlaceholders('{{lowercase}}', {})).toBe('{{lowercase}}');
|
|
35
|
+
});
|
|
36
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*"],
|
|
23
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
24
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
// Use a stub only when @studio/runner has not been built (e.g. a fresh git worktree).
|
|
6
|
+
// When dist/ exists (CI, main checkout) the real package is used so that transitive
|
|
7
|
+
// imports from other packages (e.g. @studio/api) continue to resolve correctly.
|
|
8
|
+
const runnerDist = resolve(import.meta.dirname, '../runner/dist/index.js');
|
|
9
|
+
const runnerAlias = existsSync(runnerDist) ? {} : {
|
|
10
|
+
'@studio-foundation/runner': resolve(import.meta.dirname, 'tests/__stubs__/studio-runner.ts'),
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: runnerAlias,
|
|
16
|
+
},
|
|
17
|
+
test: {
|
|
18
|
+
include: ['tests/**/*.test.ts'],
|
|
19
|
+
},
|
|
20
|
+
});
|