@fiete/drift 1.0.0 → 1.0.1
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 +49 -0
- package/dist/{AddForm-VA5UMZDC.js → AddForm-BXHHRR2V.js} +2 -2
- package/dist/{Browser-WWFMCIAC.js → Browser-6EKJ6MS7.js} +2 -2
- package/dist/{FileStore-W4YQ3VAM.js → FileStore-VX4RYNIH.js} +1 -1
- package/dist/{chunk-QT5M6VMT.js → chunk-V6RC35DD.js} +1 -1
- package/dist/{chunk-VS6YEHBV.js → chunk-VCY3CRYL.js} +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# drift
|
|
2
|
+
|
|
3
|
+
A TUI command vault for your shell. Save, search, and execute commands you use often but can never quite remember.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @brechtknecht/drift
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
drift # open the TUI browser
|
|
15
|
+
drift add # add a new command interactively
|
|
16
|
+
drift add "git log --oneline -20" # pre-fill the command
|
|
17
|
+
drift add "cd /project && npm run dev" --desc "Start dev" --tags "node,dev" # save without TUI
|
|
18
|
+
drift remove <id>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## TUI controls
|
|
22
|
+
|
|
23
|
+
| Key | Action |
|
|
24
|
+
|-----|--------|
|
|
25
|
+
| `↑` / `↓` | Navigate |
|
|
26
|
+
| `Shift+↑` / `Shift+↓` | Reorder |
|
|
27
|
+
| `/` | Enter search mode |
|
|
28
|
+
| `ESC` | Exit search / quit |
|
|
29
|
+
| `Enter` | Execute command |
|
|
30
|
+
| `Ctrl+E` | Copy to clipboard |
|
|
31
|
+
| `a` | Add new command |
|
|
32
|
+
| `e` | Edit selected |
|
|
33
|
+
| `Ctrl+D` | Delete selected |
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
Each saved command has:
|
|
38
|
+
- **Description** — what it does
|
|
39
|
+
- **Command** — the shell command
|
|
40
|
+
- **Directory** *(optional)* — when set, executing or copying prepends `cd <dir> &&`
|
|
41
|
+
- **Tags** — for organisation and search
|
|
42
|
+
|
|
43
|
+
## Search
|
|
44
|
+
|
|
45
|
+
Press `/` to enter search mode. Fuzzy search across command text, description, and tags. Press `Enter` to lock the filter, `ESC` to clear.
|
|
46
|
+
|
|
47
|
+
## Data
|
|
48
|
+
|
|
49
|
+
Commands are stored at `~/.config/drift/commands.json`.
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AddForm,
|
|
4
4
|
useStore
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VCY3CRYL.js";
|
|
6
|
+
import "./chunk-V6RC35DD.js";
|
|
7
7
|
|
|
8
8
|
// src/ui/Browser.tsx
|
|
9
9
|
import { useState as useState2, useCallback as useCallback2 } from "react";
|
|
@@ -5,7 +5,7 @@ import path from "path";
|
|
|
5
5
|
import os from "os";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import { nanoid } from "nanoid";
|
|
8
|
-
var STORE_DIR = path.join(os.homedir(), ".config", "
|
|
8
|
+
var STORE_DIR = path.join(os.homedir(), ".config", "drift");
|
|
9
9
|
var STORE_FILE = path.join(STORE_DIR, "commands.json");
|
|
10
10
|
var CURRENT_VERSION = 1;
|
|
11
11
|
var FileStore = class {
|
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)").action(async () => {
|
|
10
|
-
const { Browser } = await import("./Browser-
|
|
10
|
+
const { Browser } = await import("./Browser-6EKJ6MS7.js");
|
|
11
11
|
let commandToRun;
|
|
12
12
|
const { waitUntilExit } = render(
|
|
13
13
|
React.createElement(Browser, { onExecute: (cmd) => {
|
|
@@ -24,7 +24,7 @@ program.command("list", { isDefault: true }).description("Browse saved commands
|
|
|
24
24
|
});
|
|
25
25
|
program.command("add [command]").description("Add a command. Pass it as a quoted argument, or open the interactive form.").option("-d, --desc <description>", "Description for the command").option("-t, --tags <tags>", "Comma-separated tags").addHelpText("after", '\nExamples:\n drift add "git log --oneline -20"\n drift add "cd /project && npm run dev" --desc "Start dev server" --tags "node,dev"\n drift add (opens interactive form)').action(async (command, opts) => {
|
|
26
26
|
if (command && opts.desc !== void 0 && opts.tags !== void 0) {
|
|
27
|
-
const { FileStore } = await import("./FileStore-
|
|
27
|
+
const { FileStore } = await import("./FileStore-VX4RYNIH.js");
|
|
28
28
|
const store = new FileStore();
|
|
29
29
|
store.addCommand({
|
|
30
30
|
command: command.trim(),
|
|
@@ -34,7 +34,7 @@ program.command("add [command]").description("Add a command. Pass it as a quoted
|
|
|
34
34
|
console.log("Saved!");
|
|
35
35
|
process.exit(0);
|
|
36
36
|
}
|
|
37
|
-
const { AddForm } = await import("./AddForm-
|
|
37
|
+
const { AddForm } = await import("./AddForm-BXHHRR2V.js");
|
|
38
38
|
const initialValues = {
|
|
39
39
|
command: command ?? "",
|
|
40
40
|
description: opts.desc ?? "",
|
|
@@ -47,7 +47,7 @@ program.command("add [command]").description("Add a command. Pass it as a quoted
|
|
|
47
47
|
process.exit(0);
|
|
48
48
|
});
|
|
49
49
|
program.command("remove <id>").description("Remove a command by ID").action(async (id) => {
|
|
50
|
-
const { FileStore } = await import("./FileStore-
|
|
50
|
+
const { FileStore } = await import("./FileStore-VX4RYNIH.js");
|
|
51
51
|
const store = new FileStore();
|
|
52
52
|
const removed = store.removeCommand(id);
|
|
53
53
|
if (removed) {
|