@rigstate/cli 0.7.37 → 0.7.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigstate/cli",
3
- "version": "0.7.37",
3
+ "version": "0.7.38",
4
4
  "description": "Rigstate CLI - Code audit, sync and supervision tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,6 +32,7 @@ interface GenesisStatusResponse {
32
32
 
33
33
  interface GenesisTriggerResponse {
34
34
  success: boolean;
35
+ simulation?: boolean;
35
36
  data: {
36
37
  project_name: string;
37
38
  template: string;
@@ -51,6 +52,7 @@ export function createGenesisCommand(): Command {
51
52
  return new Command('genesis')
52
53
  .description('Initialize project foundation (Phase 0). Detects stack and injects foundation steps.')
53
54
  .option('--force', 'Re-run genesis even if already initialized (use with caution)')
55
+ .option('--simulate', 'Dry-run: Calculate plan without modifying database')
54
56
  .option('--status', 'Check genesis status without triggering')
55
57
  .option('--project-id <id>', 'Override project ID (defaults to linked project)')
56
58
  .action(async (options) => {
@@ -71,7 +73,7 @@ export function createGenesisCommand(): Command {
71
73
  if (options.status) {
72
74
  await checkGenesisStatus(projectId, apiKey, apiUrl);
73
75
  } else {
74
- await triggerGenesis(projectId, apiKey, apiUrl, options.force ?? false);
76
+ await triggerGenesis(projectId, apiKey, apiUrl, options.force ?? false, options.simulate ?? false);
75
77
  }
76
78
  });
77
79
  }
@@ -161,11 +163,17 @@ export async function triggerGenesis(
161
163
  projectId: string,
162
164
  apiKey: string,
163
165
  apiUrl: string,
164
- force = false
166
+ force = false,
167
+ simulate = false
165
168
  ): Promise<boolean> {
166
169
  console.log('');
167
- console.log(chalk.bold.blue('🏗️ GENESIS PROTOCOL'));
168
- console.log(chalk.dim('Initializing project foundation...'));
170
+ if (simulate) {
171
+ console.log(chalk.bold.magenta('🔮 GENESIS SIMULATION'));
172
+ console.log(chalk.dim('Dry-run: Calculating plan without executing changes...'));
173
+ } else {
174
+ console.log(chalk.bold.blue('🏗️ GENESIS PROTOCOL'));
175
+ console.log(chalk.dim('Initializing project foundation...'));
176
+ }
169
177
  console.log('');
170
178
 
171
179
  const spinner = ora('Detecting tech stack...').start();
@@ -201,7 +209,7 @@ export async function triggerGenesis(
201
209
  // Step 2: Trigger Genesis
202
210
  const response = await axios.post<GenesisTriggerResponse>(
203
211
  `${apiUrl}/api/v1/genesis`,
204
- { project_id: projectId, force },
212
+ { project_id: projectId, force, simulate },
205
213
  {
206
214
  headers: { Authorization: `Bearer ${apiKey}` },
207
215
  timeout: 60000 // AI enrichment can take time
@@ -230,6 +238,34 @@ export async function triggerGenesis(
230
238
 
231
239
  const { data } = response.data;
232
240
 
241
+ // ── Simulation Output ─────────────────────────────────────────────────
242
+ if (response.data.simulation) {
243
+ console.log(chalk.bold.magenta('🔮 SIMULATION RESULTS'));
244
+ console.log(chalk.dim('────────────────────────────────────────'));
245
+ console.log(`${chalk.bold('Project:')} ${chalk.cyan(data.project_name)}`);
246
+ console.log(`${chalk.bold('Stack:')} ${chalk.magenta(data.template)}`);
247
+ console.log(`${chalk.bold('Will Create:')} ${chalk.white(data.steps_created)} foundation steps`);
248
+
249
+ if (data.existing_steps_shifted > 0) {
250
+ console.log(`${chalk.bold('Will Shift:')} ${chalk.yellow(`${data.existing_steps_shifted} existing steps down`)}`);
251
+ }
252
+
253
+ console.log('');
254
+ console.log(chalk.bold('📋 Planner Preview:'));
255
+ data.steps.forEach(step => {
256
+ const stepNum = step.step_number;
257
+ // In simulation, step numbers returned might be 1-based index relative to insert,
258
+ // but usually the AI/Builder assigns them relative to start.
259
+ console.log(` ${step.icon || '🔹'} ${chalk.bold(`T-${stepNum}`)}: ${step.title}`);
260
+ if (step.verification_path) {
261
+ console.log(` ${chalk.dim(`Verify: ${step.verification_path}`)}`);
262
+ }
263
+ });
264
+ console.log('');
265
+ console.log(chalk.dim('To execute this plan, run without --simulate.'));
266
+ return true;
267
+ }
268
+
233
269
  // ── Success Output ────────────────────────────────────────────────────
234
270
  console.log(chalk.bold.green('✅ GENESIS COMPLETE'));
235
271
  console.log(chalk.dim('────────────────────────────────────────'));