sofia-cli 0.1.1 → 0.1.2

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.
@@ -141,11 +141,30 @@ export class RalphLoop {
141
141
  spinner?.startThinking();
142
142
  const scaffoldStart = Date.now();
143
143
  try {
144
- scaffoldResult = await generateDynamicScaffold({
145
- client,
146
- session,
147
- outputDir,
148
- });
144
+ // Use injected scaffolder (for tests) or dynamic LLM-based scaffolder
145
+ if (this.options.scaffolder) {
146
+ const scaffoldCtx = PocScaffolder.buildContext(session, outputDir, templateEntry);
147
+ const legacyResult = await this.options.scaffolder.scaffold(scaffoldCtx);
148
+ scaffoldResult = {
149
+ createdFiles: legacyResult.createdFiles,
150
+ techStack: scaffoldCtx.techStack
151
+ ? {
152
+ language: scaffoldCtx.techStack.language ?? 'unknown',
153
+ runtime: scaffoldCtx.techStack.runtime ?? 'unknown',
154
+ testRunner: scaffoldCtx.techStack.testRunner ?? 'unknown',
155
+ framework: scaffoldCtx.techStack.framework,
156
+ buildCommand: scaffoldCtx.techStack.buildCommand,
157
+ }
158
+ : { language: 'unknown', runtime: 'unknown', testRunner: 'unknown' },
159
+ };
160
+ }
161
+ else {
162
+ scaffoldResult = await generateDynamicScaffold({
163
+ client,
164
+ session,
165
+ outputDir,
166
+ });
167
+ }
149
168
  techStack = scaffoldResult.techStack;
150
169
  }
151
170
  catch (err) {
@@ -115,7 +115,7 @@ describe('PoC Scaffold Integration', () => {
115
115
  const ctx = PocScaffolder.buildContext(fixtureSession, tmpDir);
116
116
  await scaffolder.scaffold(ctx);
117
117
  const indexContent = await readFile(join(tmpDir, 'src', 'index.ts'), 'utf-8');
118
- expect(indexContent).toContain('export function main');
118
+ expect(indexContent).toContain('export async function main');
119
119
  });
120
120
  it('tests/index.test.ts contains vitest imports', async () => {
121
121
  const scaffolder = new PocScaffolder();
@@ -256,12 +256,14 @@ describe('workshopCommand Plan→Develop transition (T052)', () => {
256
256
  const { workshopCommand } = await import('../../../src/cli/workshopCommand.js');
257
257
  await workshopCommand({ session: 'plan-test-001' });
258
258
  const allOutput = ioWrites.join(' ');
259
+ // FR-020: Shows transition message for PoC generation
260
+ expect(allOutput).toContain('Starting PoC Generation');
261
+ // Session lacks selection/plan so RalphLoop throws — workshop shows recovery guidance
259
262
  expect(allOutput).toContain('sofia dev --session plan-test-001');
260
- expect(allOutput).toContain('Ready for PoC Generation');
261
263
  });
262
264
  });
263
- // ── T053: Workshop offers auto-transition prompt in interactive mode ──────
264
- describe('workshopCommand auto-transition prompt (T053)', () => {
265
+ // ── T053: Workshop auto-runs PoC generation after Plan phase ─────────────
266
+ describe('workshopCommand auto-run PoC generation (T053)', () => {
265
267
  beforeEach(() => {
266
268
  ioWrites = [];
267
269
  ioReadResponses = [];
@@ -275,7 +277,7 @@ describe('workshopCommand auto-transition prompt (T053)', () => {
275
277
  afterEach(() => {
276
278
  process.exitCode = undefined;
277
279
  });
278
- it('offers auto-transition prompt in interactive mode after Plan phase (FR-021)', async () => {
280
+ it('auto-runs PoC generation after Plan phase, shows warning on failure (FR-021)', async () => {
279
281
  const session = {
280
282
  sessionId: 'transition-test-001',
281
283
  schemaVersion: '1.0.0',
@@ -294,14 +296,13 @@ describe('workshopCommand auto-transition prompt (T053)', () => {
294
296
  const { workshopCommand } = await import('../../../src/cli/workshopCommand.js');
295
297
  await workshopCommand({ session: 'transition-test-001' });
296
298
  const allOutput = ioWrites.join(' ');
297
- // FR-021: The transition message includes tech stack info and scaffolding description
298
- expect(allOutput).toContain('scaffold a project');
299
- expect(allOutput).toContain('technology stack');
300
- expect(allOutput).toContain('install dependencies');
301
- // FR-021: readInput was called with the auto-transition prompt
302
- expect(ioReadInputPrompts.some((p) => p.includes('Would you like to start PoC development'))).toBe(true);
299
+ // FR-021: PoC generation runs automatically after Plan phase
300
+ expect(allOutput).toContain('Starting PoC Generation');
301
+ // Session lacks selection/plan so RalphLoop throws — workshop shows recovery guidance
302
+ expect(allOutput).toContain('PoC generation failed');
303
+ expect(allOutput).toContain('sofia dev --session transition-test-001');
303
304
  });
304
- it('exits workshop when user accepts auto-transition prompt (FR-021)', async () => {
305
+ it('continues workshop after PoC generation failure (FR-021)', async () => {
305
306
  const session = {
306
307
  sessionId: 'auto-transition-001',
307
308
  schemaVersion: '1.0.0',
@@ -315,15 +316,13 @@ describe('workshopCommand auto-transition prompt (T053)', () => {
315
316
  };
316
317
  mockStore.exists.mockResolvedValue(true);
317
318
  mockStore.load.mockResolvedValue(session);
318
- // Continue from Plan → user answers 'y' to auto-transition
319
- decisionGateResponses = [{ choice: 'continue' }];
320
- // First null exits the conversation loop; 'y' answers the auto-transition prompt
321
- ioReadResponses = [null, 'y'];
319
+ // Continue from Plan → PoC fails continues to Develop phase → exit
320
+ decisionGateResponses = [{ choice: 'continue' }, { choice: 'exit' }];
322
321
  const { workshopCommand } = await import('../../../src/cli/workshopCommand.js');
323
322
  await workshopCommand({ session: 'auto-transition-001' });
324
323
  const allOutput = ioWrites.join(' ');
325
- // Workshop should show transition message and exit (returning early)
326
- expect(allOutput).toContain('Starting PoC development');
324
+ // Workshop continues after PoC failure doesn't block
325
+ expect(allOutput).toContain('Starting PoC Generation');
327
326
  expect(allOutput).toContain('sofia dev --session auto-transition-001');
328
327
  });
329
328
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sofia-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/src/cli/index.js",