gipity 1.1.27 → 1.1.29

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.
@@ -1,6 +1,6 @@
1
1
  import { Command, Option } from 'commander';
2
- import { existsSync, mkdirSync, writeFileSync } from 'fs';
3
- import { join } from 'path';
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
3
+ import { isAbsolute, join, resolve } from 'path';
4
4
  import { get, post, put, del } from '../api.js';
5
5
  import { getConfig, requireConfig, getProjectRoot } from '../config.js';
6
6
  import { pushFile } from '../sync.js';
@@ -312,10 +312,20 @@ steps:
312
312
  then return { summary, needs_attention } where needs_attention is a list of short strings.
313
313
  tools: [memory, db_query]
314
314
  `;
315
+ /** Read a workflow YAML from disk: an absolute path, a path from the cwd, or
316
+ * a project-relative one. The text is sent to the server, so the file need not
317
+ * be synced (a probe in tmp/ works). */
318
+ function readWorkflowYaml(from) {
319
+ const candidates = isAbsolute(from) ? [from] : [resolve(from), ...(getProjectRoot() ? [join(getProjectRoot(), from)] : [])];
320
+ const found = candidates.find((p) => existsSync(p));
321
+ if (!found)
322
+ throw new Error(`No workflow file at ${from}.`);
323
+ return readFileSync(found, 'utf-8');
324
+ }
315
325
  workflowCommand
316
326
  .command('create')
317
327
  .description('Create a workflow from a YAML file in the project (e.g. workflows/foo.yaml)')
318
- .option('--from <path>', 'Project-relative YAML file path')
328
+ .option('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
319
329
  .option('--heartbeat', `Scaffold ${HEARTBEAT_PATH} (a daily check-in that keeps notes in project memory) and create it`)
320
330
  .option('--name <name>', 'Override the name in the YAML')
321
331
  .option('--json', 'Output as JSON')
@@ -339,7 +349,7 @@ workflowCommand
339
349
  await pushFile(local);
340
350
  }
341
351
  const body = {
342
- config_yaml_path: from,
352
+ config_yaml: readWorkflowYaml(from),
343
353
  project_guid: config.projectGuid,
344
354
  };
345
355
  if (opts.name)
@@ -352,14 +362,14 @@ workflowCommand
352
362
  .command('edit <name>')
353
363
  .alias('update')
354
364
  .description('Update a workflow from a YAML file')
355
- .requiredOption('--from <path>', 'Project-relative YAML file path')
365
+ .requiredOption('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
356
366
  .option('--json', 'Output as JSON')
357
367
  .action((name, _opts, cmd) => run('Edit', async () => {
358
368
  const opts = mergedOpts(cmd);
359
369
  const config = requireConfig();
360
370
  const wf = await resolveWorkflow(name);
361
371
  await put(`/workflows/${wf.short_guid}`, {
362
- config_yaml_path: opts.from,
372
+ config_yaml: readWorkflowYaml(opts.from),
363
373
  project_guid: config.projectGuid,
364
374
  });
365
375
  printResult(`Updated "${wf.name}" from ${opts.from}.`, opts, { updated: wf.name });