@staff0rd/assist 0.184.1 → 0.186.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.
package/README.md CHANGED
@@ -33,6 +33,7 @@ After installation, the `assist` command will be available globally. You can als
33
33
 
34
34
  ## Claude Commands
35
35
 
36
+ - `/add-command` - Add a new run command to assist.yml
36
37
  - `/bug` - File a bug with reproduction steps, expected and actual behavior
37
38
  - `/comment` - Add pending review comments to the current PR
38
39
  - `/commit` - Commit only relevant files from the session
@@ -108,6 +109,7 @@ After installation, the `assist` command will be available globally. You can als
108
109
  - `assist roam show-claude-code-icon` - Forward Claude Code hook activity to Roam local API
109
110
  - `assist run <name> [params...]` - Run a configured command from assist.yml (positional params are matched to `params` config; supports `pre` array of commands to run first)
110
111
  - `assist run add` - Add a new run configuration to assist.yml and create a Claude command file
112
+ - `assist run remove <name>` - Remove a run configuration from assist.yml and delete its Claude command file
111
113
  - `assist config set <key> <value>` - Set a config value (e.g. commit.push true)
112
114
  - `assist config get <key>` - Get a config value
113
115
  - `assist config list` - List all config values
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Add a new run command to assist.yml
3
+ allowed_args: "[description of the command to add]"
4
+ ---
5
+
6
+ The user wants to register a new run command via `assist run add`. This command adds a named entry to the `run` section of `assist.yml` so it can be invoked with `assist run <name>`.
7
+
8
+ ## Step 1: Understand the request
9
+
10
+ If the user provided a description via $ARGUMENTS, use that as a starting point. Otherwise, ask what command they want to add.
11
+
12
+ ## Step 2: Determine the correct syntax
13
+
14
+ Run `assist run add --help` to see the current CLI usage and options. Use the output to construct the correct command.
15
+
16
+ ## Step 3: Add the command
17
+
18
+ Run `assist run add <name> <command> [args...]` with the appropriate arguments. For example:
19
+
20
+ ```
21
+ assist run add lint biome check --write
22
+ ```
23
+
24
+ If the command needs a working directory, use `--cwd <dir>`.
25
+
26
+ ## Step 4: Verify
27
+
28
+ Run `assist run <name>` to confirm the command works, or `assist run <name> --help` if it accepts params.
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.184.1",
9
+ version: "0.186.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -11733,6 +11733,59 @@ Done in ${elapsed}`);
11733
11733
  });
11734
11734
  }
11735
11735
 
11736
+ // src/commands/run/index.ts
11737
+ function buildCommand(command, configArgs, extraArgs) {
11738
+ const parts = [command, ...configArgs];
11739
+ return [...parts.map(shellQuote), ...extraArgs.map(shellQuote)].join(" ");
11740
+ }
11741
+ function printAvailableConfigs(configs) {
11742
+ console.error("Available configurations:");
11743
+ for (const r of configs) {
11744
+ console.error(` - ${r.name}`);
11745
+ }
11746
+ }
11747
+ function exitNoRunConfigs() {
11748
+ console.error("No run configurations found in assist.yml");
11749
+ process.exit(1);
11750
+ }
11751
+ function requireRunConfigs() {
11752
+ const { run: run4 } = loadConfig();
11753
+ if (!run4 || run4.length === 0) return exitNoRunConfigs();
11754
+ return run4;
11755
+ }
11756
+ function exitWithConfigNotFound(name, configs) {
11757
+ console.error(`No run configuration found with name: ${name}`);
11758
+ printAvailableConfigs(configs);
11759
+ process.exit(1);
11760
+ }
11761
+ function findRunConfig(name) {
11762
+ const configs = requireRunConfigs();
11763
+ return configs.find((r) => r.name === name) ?? exitWithConfigNotFound(name, configs);
11764
+ }
11765
+ function listRunConfigs() {
11766
+ const configs = requireRunConfigs();
11767
+ for (const config of configs) {
11768
+ const args = config.args?.length ? ` ${config.args.join(" ")}` : "";
11769
+ console.log(`${config.name}: ${config.command}${args}`);
11770
+ }
11771
+ }
11772
+ function run3(name, args) {
11773
+ if (!name) {
11774
+ console.error("error: missing required argument 'name'");
11775
+ console.error(formatConfiguredCommands());
11776
+ process.exit(1);
11777
+ }
11778
+ const runConfig = findRunConfig(name);
11779
+ const resolvedCwd = runConfig.cwd ? resolve5(getConfigDir(), runConfig.cwd) : void 0;
11780
+ if (runConfig.pre) runPreCommands(runConfig.pre, resolvedCwd);
11781
+ const resolved = resolveParams(runConfig.params, args);
11782
+ spawnRunCommand(
11783
+ buildCommand(runConfig.command, runConfig.args ?? [], resolved),
11784
+ runConfig.env,
11785
+ resolvedCwd
11786
+ );
11787
+ }
11788
+
11736
11789
  // src/commands/run/add.ts
11737
11790
  import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
11738
11791
  import { join as join43 } from "path";
@@ -11813,64 +11866,62 @@ function add3() {
11813
11866
  );
11814
11867
  }
11815
11868
 
11816
- // src/commands/run/index.ts
11817
- function buildCommand(command, configArgs, extraArgs) {
11818
- const parts = [command, ...configArgs];
11819
- return [...parts.map(shellQuote), ...extraArgs.map(shellQuote)].join(" ");
11869
+ // src/commands/run/remove.ts
11870
+ import { existsSync as existsSync40, unlinkSync as unlinkSync11 } from "fs";
11871
+ import { join as join44 } from "path";
11872
+ function findRemoveIndex() {
11873
+ const idx = process.argv.indexOf("remove");
11874
+ if (idx === -1 || idx + 1 >= process.argv.length) return -1;
11875
+ return idx;
11820
11876
  }
11821
- function printAvailableConfigs(configs) {
11822
- console.error("Available configurations:");
11823
- for (const r of configs) {
11824
- console.error(` - ${r.name}`);
11877
+ function parseRemoveName() {
11878
+ const idx = findRemoveIndex();
11879
+ if (idx === -1) {
11880
+ console.error("Usage: assist run remove <name>");
11881
+ process.exit(1);
11825
11882
  }
11883
+ return process.argv[idx + 1];
11826
11884
  }
11827
- function exitNoRunConfigs() {
11828
- console.error("No run configurations found in assist.yml");
11829
- process.exit(1);
11830
- }
11831
- function requireRunConfigs() {
11832
- const { run: run4 } = loadConfig();
11833
- if (!run4 || run4.length === 0) return exitNoRunConfigs();
11834
- return run4;
11835
- }
11836
- function exitWithConfigNotFound(name, configs) {
11837
- console.error(`No run configuration found with name: ${name}`);
11838
- printAvailableConfigs(configs);
11839
- process.exit(1);
11840
- }
11841
- function findRunConfig(name) {
11842
- const configs = requireRunConfigs();
11843
- return configs.find((r) => r.name === name) ?? exitWithConfigNotFound(name, configs);
11844
- }
11845
- function listRunConfigs() {
11846
- const configs = requireRunConfigs();
11847
- for (const config of configs) {
11848
- const args = config.args?.length ? ` ${config.args.join(" ")}` : "";
11849
- console.log(`${config.name}: ${config.command}${args}`);
11885
+ function deleteCommandFile(name) {
11886
+ const filePath = join44(".claude", "commands", `${name}.md`);
11887
+ if (existsSync40(filePath)) {
11888
+ unlinkSync11(filePath);
11889
+ console.log(`Deleted command file: ${filePath}`);
11850
11890
  }
11851
11891
  }
11852
- function run3(name, args) {
11853
- if (!name) {
11854
- console.error("error: missing required argument 'name'");
11855
- console.error(formatConfiguredCommands());
11892
+ function remove() {
11893
+ const name = parseRemoveName();
11894
+ const config = loadProjectConfig();
11895
+ const runList = config.run;
11896
+ if (!runList || !runList.find((r) => r.name === name)) {
11897
+ console.error(`Run configuration "${name}" not found`);
11856
11898
  process.exit(1);
11857
11899
  }
11858
- const runConfig = findRunConfig(name);
11859
- const resolvedCwd = runConfig.cwd ? resolve5(getConfigDir(), runConfig.cwd) : void 0;
11860
- if (runConfig.pre) runPreCommands(runConfig.pre, resolvedCwd);
11861
- const resolved = resolveParams(runConfig.params, args);
11862
- spawnRunCommand(
11863
- buildCommand(runConfig.command, runConfig.args ?? [], resolved),
11864
- runConfig.env,
11865
- resolvedCwd
11866
- );
11900
+ config.run = runList.filter((r) => r.name !== name);
11901
+ saveConfig(config);
11902
+ deleteCommandFile(name);
11903
+ console.log(`Removed run configuration: ${name}`);
11904
+ }
11905
+
11906
+ // src/commands/run/registerRun.ts
11907
+ function registerRun(program2) {
11908
+ const runCommand = program2.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));
11909
+ runCommand.command("list").description("List configured run commands").action(listRunConfigs);
11910
+ 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").option(
11911
+ "--cwd <dir>",
11912
+ "Working directory (resolved relative to the config file)"
11913
+ ).addHelpText(
11914
+ "after",
11915
+ '\nPositional params can be added to the config manually:\n params:\n - name: env # assist run deploy prod \u2192 appends "prod"\n required: true\n - name: tag\n default: latest'
11916
+ ).allowUnknownOption().allowExcessArguments().action(() => add3());
11917
+ runCommand.command("remove").description("Remove a run configuration from assist.yml").argument("<name>", "Name of the run configuration to remove").action(() => remove());
11867
11918
  }
11868
11919
 
11869
11920
  // src/commands/screenshot/index.ts
11870
11921
  import { execSync as execSync41 } from "child_process";
11871
- import { existsSync as existsSync40, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
11922
+ import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
11872
11923
  import { tmpdir as tmpdir6 } from "os";
11873
- import { join as join44, resolve as resolve6 } from "path";
11924
+ import { join as join45, resolve as resolve6 } from "path";
11874
11925
  import chalk131 from "chalk";
11875
11926
 
11876
11927
  // src/commands/screenshot/captureWindowPs1.ts
@@ -12000,14 +12051,14 @@ Write-Output $OutputPath
12000
12051
 
12001
12052
  // src/commands/screenshot/index.ts
12002
12053
  function buildOutputPath(outputDir, processName) {
12003
- if (!existsSync40(outputDir)) {
12054
+ if (!existsSync41(outputDir)) {
12004
12055
  mkdirSync14(outputDir, { recursive: true });
12005
12056
  }
12006
12057
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
12007
12058
  return resolve6(outputDir, `${processName}-${timestamp}.png`);
12008
12059
  }
12009
12060
  function runPowerShellScript(processName, outputPath) {
12010
- const scriptPath = join44(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
12061
+ const scriptPath = join45(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
12011
12062
  writeFileSync29(scriptPath, captureWindowPs1, "utf-8");
12012
12063
  try {
12013
12064
  execSync41(
@@ -12015,7 +12066,7 @@ function runPowerShellScript(processName, outputPath) {
12015
12066
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
12016
12067
  );
12017
12068
  } finally {
12018
- unlinkSync11(scriptPath);
12069
+ unlinkSync12(scriptPath);
12019
12070
  }
12020
12071
  }
12021
12072
  function screenshot(processName) {
@@ -12257,15 +12308,7 @@ program.command("sync").description("Copy command files to ~/.claude/commands").
12257
12308
  program.command("init").description("Initialize VS Code and verify configurations").action(init4);
12258
12309
  program.command("commit").description("Create a git commit with validation").argument("<args...>", "status | <message> [files...]").action(commit);
12259
12310
  registerConfig(program);
12260
- 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));
12261
- runCommand.command("list").description("List configured run commands").action(listRunConfigs);
12262
- 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").option(
12263
- "--cwd <dir>",
12264
- "Working directory (resolved relative to the config file)"
12265
- ).addHelpText(
12266
- "after",
12267
- '\nPositional params can be added to the config manually:\n params:\n - name: env # assist run deploy prod \u2192 appends "prod"\n required: true\n - name: tag\n default: latest'
12268
- ).allowUnknownOption().allowExcessArguments().action(() => add3());
12311
+ registerRun(program);
12269
12312
  registerNew(program);
12270
12313
  var lintCommand = program.command("lint").description("Run lint checks for conventions not enforced by biomejs").option("-f, --fix", "Auto-fix violations where possible").action(lint);
12271
12314
  lintCommand.command("init").description("Initialize Biome with standard linter config").action(init);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.184.1",
3
+ "version": "0.186.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {