@fiete/drift 1.0.4 → 1.0.5

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  AddForm
4
- } from "./chunk-ZMUIDCTO.js";
4
+ } from "./chunk-GUH6BVED.js";
5
5
  import "./chunk-CRXU4OLG.js";
6
6
  export {
7
7
  AddForm
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AddForm,
4
4
  useStore
5
- } from "./chunk-ZMUIDCTO.js";
5
+ } from "./chunk-GUH6BVED.js";
6
6
  import "./chunk-CRXU4OLG.js";
7
7
 
8
8
  // src/ui/Browser.tsx
@@ -470,13 +470,13 @@ function Browser({ onExecute, forceOnboarding = false }) {
470
470
  return;
471
471
  }
472
472
  if (key.return && selected) {
473
- const full = selected.directory ? `cd "${selected.directory}" && ${selected.command}` : selected.command;
473
+ const full = selected.directory && selected.command ? `cd "${selected.directory}" && ${selected.command}` : selected.directory ? `cd "${selected.directory}"` : selected.command;
474
474
  onExecute(full);
475
475
  exit();
476
476
  return;
477
477
  }
478
478
  if (key.ctrl && input === "e" && selected) {
479
- const full = selected.directory ? `cd "${selected.directory}" && ${selected.command}` : selected.command;
479
+ const full = selected.directory && selected.command ? `cd "${selected.directory}" && ${selected.command}` : selected.directory ? `cd "${selected.directory}"` : selected.command;
480
480
  clipboard.writeSync(full);
481
481
  flash("Copied!");
482
482
  return;
@@ -53,7 +53,7 @@ var FIELD_ORDER = ["description", "command", "directory", "tags"];
53
53
  var LABELS = {
54
54
  description: "Description",
55
55
  command: "Command",
56
- directory: "Directory (optional)",
56
+ directory: "Directory",
57
57
  tags: "Tags (comma-separated)"
58
58
  };
59
59
  var PLACEHOLDERS = {
@@ -104,8 +104,8 @@ function AddForm({ initialValues, onSave, onCancel }) {
104
104
  if (fieldIndex < FIELD_ORDER.length - 1) {
105
105
  setFieldIndex((i) => i + 1);
106
106
  } else {
107
- if (!updated.command.trim()) {
108
- cancel();
107
+ if (!updated.command.trim() && !updated.directory.trim()) {
108
+ setFieldIndex(1);
109
109
  return;
110
110
  }
111
111
  addCommand({
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import React from "react";
7
7
  import { execa } from "execa";
8
8
  program.name("drift").description("cmdvault \u2014 A TUI command vault for your shell").version("1.0.0");
9
9
  program.command("list", { isDefault: true }).description("Browse saved commands (default)").option("--onboarding", "Force the onboarding screen (debug)").action(async (opts) => {
10
- const { Browser } = await import("./Browser-GYSQENKK.js");
10
+ const { Browser } = await import("./Browser-6Q6XF5D4.js");
11
11
  let commandToRun;
12
12
  const { waitUntilExit } = render(
13
13
  React.createElement(Browser, {
@@ -38,7 +38,7 @@ program.command("add [command]").description("Add a command. Pass it as a quoted
38
38
  console.log("Saved!");
39
39
  process.exit(0);
40
40
  }
41
- const { AddForm } = await import("./AddForm-R45F2RCQ.js");
41
+ const { AddForm } = await import("./AddForm-NVOWLCPV.js");
42
42
  const initialValues = {
43
43
  command: command ?? "",
44
44
  description: opts.desc ?? "",
@@ -128,7 +128,7 @@ program.command("execute <id>").description("Execute a saved command by ID").act
128
128
  console.error(`No command found with ID: ${id}`);
129
129
  process.exit(1);
130
130
  }
131
- const toRun = cmd.directory ? `cd "${cmd.directory}" && ${cmd.command}` : cmd.command;
131
+ const toRun = cmd.directory && cmd.command ? `cd "${cmd.directory}" && ${cmd.command}` : cmd.directory ? `cd "${cmd.directory}"` : cmd.command;
132
132
  await execa(toRun, { shell: true, stdio: "inherit" }).catch(() => process.exit(1));
133
133
  process.exit(0);
134
134
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiete/drift",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A TUI command vault for your shell",
5
5
  "type": "module",
6
6
  "preferGlobal": true,