Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ tmux attach -t my-agent
| `watch` | `--capture[=ms]` | Instead of reading stdin, poll `tmux capture-pane` and classify each whole rendered frame; useful for TUIs whose pipe-pane stream has no line feeds. Interval in milliseconds, default `1000` |
| `watch` | `--pane=<target>` | tmux pane to poll in `--capture` mode (defaults to the session name) |
| `watch` | `--patterns-dir=<dir>` | Load pattern files from this directory |
| `patterns` | `--patterns-dir=<dir>` | Show the patterns loaded from this directory (same lookup as `watch`) |
| `subscribe` | `--from-beginning` | Replay the existing log from the start instead of only new lines |
| `subscribe` | `--verbose` | Show debug output |
| `sessions`, `subscribe` | `--run-dir=<path>` | Run directory to read (overrides `PLUK_RUN_DIR`) |
Expand Down
1 change: 1 addition & 0 deletions changelog.d/fixed-256.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `pluk patterns` now honors `--patterns-dir`, so a custom pattern set is shown (and its CLI names listed) instead of a false "no pattern set".
11 changes: 8 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ${ANSI_CYAN}Usage:${ANSI_RESET}
pluk subscribe <session> [--filter=type1,type2] [--from-beginning] [--verbose] [--diagnostics[=secs]]
pluk watch <session> [--cli=claude] [--filter=type1,type2] [--include-raw] [--capture[=ms]] [--diagnostics[=secs]]
pluk send <session> --text="<text>" [--enter] [--literal]
pluk patterns [--cli=claude]
pluk patterns [--cli=claude] [--patterns-dir=<dir>]
pluk version

${ANSI_CYAN}Commands:${ANSI_RESET}
Expand Down Expand Up @@ -292,8 +292,13 @@ function cmdPatterns(args: string[]): void {
const { flags } = parseArgs(args);
const cli = flags['cli'] ?? 'claude';

const patterns = getPatterns(cli);
const available = listAvailableCLIs(bundledPatternsDir()).join(', ') || builtinCLIList();
const patternsDir = flags['patterns-dir'];
const patterns = getPatterns(cli, patternsDir);
const names = [
...(patternsDir ? listAvailableCLIs(patternsDir) : []),
...listAvailableCLIs(bundledPatternsDir()),
];
const available = [...new Set(names)].join(', ') || builtinCLIList();
if (!hasAnyPattern(patterns)) {
log('info', `no pattern set for ${cli}; available CLIs: ${available}`);
}
Expand Down
18 changes: 18 additions & 0 deletions test/cli-branches.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ test('watch without a session labels events "stdin" and honors --patterns-dir',
);
});

test('patterns honors --patterns-dir and lists its CLIs', () => {
const patternsDir = join(scratch, 'patterns-cmd');
mkdirSync(patternsDir, { recursive: true });
writeFileSync(
join(patternsDir, 'testcli.patterns'),
"WORKING_PATTERNS='CUSTOM_BUSY_MARKER'\n",
);
const { code, stdout, stderr } = runCli(
['patterns', '--cli=testcli', `--patterns-dir=${patternsDir}`],
);
assert.equal(code, 0);
const working = stdout.split('\n').find(l => l.includes('working'));
assert.ok(working && working.includes('CUSTOM_BUSY_MARKER'), `got: ${stdout}`);
assert.ok(!stdout.includes('no pattern set') && !stderr.includes('no pattern set'));
const avail = stdout.split('\n').find(l => l.includes('Available CLIs:'));
assert.ok(avail && avail.includes('testcli'), `got: ${stdout}`);
});

// --- watch: capture mode --pane target ------------------------------------------

test('watch --capture polls the pane named by --pane, not the session', async () => {
Expand Down
Loading