Skip to content

cli : add /glob command#21084

Merged
CISC merged 3 commits into
masterfrom
cisc/cli-glob-command
Mar 28, 2026
Merged

cli : add /glob command#21084
CISC merged 3 commits into
masterfrom
cisc/cli-glob-command

Conversation

@CISC

@CISC CISC commented Mar 27, 2026

Copy link
Copy Markdown
Member

Overview

Add /glob command to be able to batch load text files.

Requirements

@CISC CISC requested review from a team and ngxson as code owners March 27, 2026 21:24
@CISC CISC removed the server label Mar 27, 2026

@pwilkin pwilkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either add_text_to_file should have a size limit or we should approve the files to read - there's way too much risk of reading some binary or other huge file by accident and poisoning the context IMO.

@CISC

CISC commented Mar 27, 2026

Copy link
Copy Markdown
Member Author

Either add_text_to_file should have a size limit or we should approve the files to read - there's way too much risk of reading some binary or other huge file by accident and poisoning the context IMO.

If you're a dumbass and use *, sure. :)

Only way to prevent that is to somehow inspect and verify files, that gets way too complicated, and limiting on file size is too arbitrary. It does list the files though, so you can catch the mistake and use /clear before actually submitting them.

@ngxson ngxson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re. risk of invisibly / accidentally reading more files than needed, I think we can improve the UX by first listing a list of files, then ask Y/N to confirm read. But this can be a follow-up improvement.

Comment thread common/common.cpp
Comment on lines +664 to +670
if (pattern[0] == '*' && pattern[1] == '*') {
const char * p = pattern + 2;
if (*p == '/') p++;
if (glob_match(p, str)) return true;
if (*str != '\0') return glob_match(pattern, str + 1);
return false;
}

@ngxson ngxson Mar 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude gives this suggestion, not sure if that makes sense (feel free to ignore it if it's irrelevant)

if (pattern[0] == '*' && pattern[1] == '*') {
    const char * p = pattern + 2;
    if (*p == '/') p++;
    // try matching the rest of pattern at every position in str
    do {
        if (glob_match(p, str)) return true;
    } while (*str != '\0' && str++);
    return false;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought Claude already wrote this in your PR? :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really makes no sense, I think Claude got confused at the intention.

@CISC CISC removed the server label Mar 28, 2026
@CISC CISC merged commit c46758d into master Mar 28, 2026
45 checks passed
@CISC CISC deleted the cisc/cli-glob-command branch March 28, 2026 01:33
slartibardfast pushed a commit to slartibardfast/llama.cpp that referenced this pull request Apr 12, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
fewtarius pushed a commit to fewtarius/CachyLLama that referenced this pull request May 30, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
MrLordCat referenced this pull request in MrLordCat/llama.cpp-with-GUI Jul 16, 2026
* add /glob command

* output error when max files reached

* support globbing outside curdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants