@staff0rd/assist 0.177.1 → 0.178.0

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.177.1",
9
+ version: "0.178.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -4217,13 +4217,30 @@ import chalk55 from "chalk";
4217
4217
  async function done(id, summary) {
4218
4218
  const result = loadAndFindItem(id);
4219
4219
  if (!result) return;
4220
- result.item.status = "done";
4220
+ const { item } = result;
4221
+ if (item.plan && item.plan.length > 0) {
4222
+ const completed = item.currentPhase ?? 0;
4223
+ const pending = item.plan.slice(completed);
4224
+ if (pending.length > 0) {
4225
+ console.log(
4226
+ chalk55.red(
4227
+ `Cannot complete item #${id}: ${pending.length} pending phase(s):`
4228
+ )
4229
+ );
4230
+ for (const phase of pending) {
4231
+ console.log(chalk55.yellow(` - ${phase.name}`));
4232
+ }
4233
+ process.exitCode = 1;
4234
+ return;
4235
+ }
4236
+ }
4237
+ item.status = "done";
4221
4238
  if (summary) {
4222
- const phase = result.item.currentPhase ?? 0;
4223
- addPhaseSummary(result.item, summary, phase);
4239
+ const phase = item.currentPhase ?? 0;
4240
+ addPhaseSummary(item, summary, phase);
4224
4241
  }
4225
4242
  saveBacklog(result.items);
4226
- console.log(chalk55.green(`Completed item #${id}: ${result.item.name}`));
4243
+ console.log(chalk55.green(`Completed item #${id}: ${item.name}`));
4227
4244
  }
4228
4245
 
4229
4246
  // src/commands/backlog/start/index.ts
@@ -11372,6 +11389,16 @@ function registerRoam(program2) {
11372
11389
  // src/commands/run/index.ts
11373
11390
  import { execSync as execSync39 } from "child_process";
11374
11391
 
11392
+ // src/commands/run/formatConfiguredCommands.ts
11393
+ function formatConfiguredCommands() {
11394
+ const { run: configs } = loadConfig();
11395
+ if (!configs || configs.length === 0) return "\nNo configured commands";
11396
+ const names = configs.map((r) => ` ${r.name}`).join("\n");
11397
+ return `
11398
+ Configured commands:
11399
+ ${names}`;
11400
+ }
11401
+
11375
11402
  // src/commands/run/resolveParams.ts
11376
11403
  function resolveParams(params, cliArgs) {
11377
11404
  if (!params || params.length === 0) return cliArgs;
@@ -11533,6 +11560,11 @@ function runPreCommands(pre) {
11533
11560
  }
11534
11561
  }
11535
11562
  function run3(name, args) {
11563
+ if (!name) {
11564
+ console.error("error: missing required argument 'name'");
11565
+ console.error(formatConfiguredCommands());
11566
+ process.exit(1);
11567
+ }
11536
11568
  const runConfig = findRunConfig(name);
11537
11569
  if (runConfig.pre) runPreCommands(runConfig.pre);
11538
11570
  const resolved = resolveParams(runConfig.params, args);
@@ -11936,9 +11968,7 @@ var configCommand = program.command("config").description("View and modify assis
11936
11968
  configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").action((key, value, options2) => configSet(key, value, options2));
11937
11969
  configCommand.command("get <key>").description("Get a config value").action(configGet);
11938
11970
  configCommand.command("list").description("List all config values").action(configList);
11939
- var runCommand = program.command("run").description("Run a configured command from assist.yml").argument("<name>", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().action((name, args) => {
11940
- run3(name, args);
11941
- });
11971
+ var runCommand = program.command("run").description("Run a configured command from assist.yml").argument("[name]", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().addHelpText("after", () => formatConfiguredCommands()).action((name, args) => run3(name, args));
11942
11972
  runCommand.command("list").description("List configured run commands").action(listRunConfigs);
11943
11973
  runCommand.command("add").description("Add a new run configuration to assist.yml").argument("<name>", "Name for the run configuration").argument("<command>", "Command to execute").argument("[args...]", "Static args to pass to the command").addHelpText(
11944
11974
  "after",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.177.1",
3
+ "version": "0.178.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {