nanocode-cli 0.1.0__tar.gz → 0.2.0__tar.gz
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.
- {nanocode_cli-0.1.0/nanocode_cli.egg-info → nanocode_cli-0.2.0}/PKG-INFO +26 -3
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/README.md +25 -2
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode.py +33 -3
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0/nanocode_cli.egg-info}/PKG-INFO +26 -3
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/pyproject.toml +1 -1
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/LICENSE +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/MANIFEST.in +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode_cli.egg-info/SOURCES.txt +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode_cli.egg-info/dependency_links.txt +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode_cli.egg-info/entry_points.txt +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode_cli.egg-info/requires.txt +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/nanocode_cli.egg-info/top_level.txt +0 -0
- {nanocode_cli-0.1.0 → nanocode_cli-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nanocode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A lightweight terminal-based AI coding assistant
|
|
5
5
|
Author-email: hit9 <hit9@icloud.com>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -30,12 +30,15 @@ Dynamic: license-file
|
|
|
30
30
|
|
|
31
31
|
# nanocode
|
|
32
32
|
|
|
33
|
+
A lightweight terminal-based AI coding assistant.
|
|
34
|
+
|
|
35
|
+
nanocode is used to build itself, including features such as `@file` path completion.
|
|
33
36
|
|
|
34
37
|
## Screenshots
|
|
35
38
|
|
|
36
39
|
| | |
|
|
37
40
|
|---|---|
|
|
38
|
-
|  |  |
|
|
39
42
|
|
|
40
43
|
## Install
|
|
41
44
|
|
|
@@ -55,7 +58,7 @@ uv run nanocode
|
|
|
55
58
|
Required:
|
|
56
59
|
|
|
57
60
|
```sh
|
|
58
|
-
export NANOCODE_API_URL="https://api.example.com/v1
|
|
61
|
+
export NANOCODE_API_URL="https://api.example.com/v1"
|
|
59
62
|
export NANOCODE_API_KEY="your-api-key"
|
|
60
63
|
export NANOCODE_MODEL="your-model"
|
|
61
64
|
```
|
|
@@ -72,6 +75,26 @@ export NANOCODE_SHELL_TIMEOUT="60"
|
|
|
72
75
|
export NANOCODE_COMPACT_AT="100"
|
|
73
76
|
```
|
|
74
77
|
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
Start nanocode:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
nanocode
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Show available commands:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
/help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Ask a source-aware question about nanocode itself:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
/help how does compact work?
|
|
96
|
+
```
|
|
97
|
+
|
|
75
98
|
## Safety
|
|
76
99
|
|
|
77
100
|
nanocode does not provide sandbox protection. It can run shell commands and edit files in the environment where you start it.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# nanocode
|
|
2
2
|
|
|
3
|
+
A lightweight terminal-based AI coding assistant.
|
|
4
|
+
|
|
5
|
+
nanocode is used to build itself, including features such as `@file` path completion.
|
|
3
6
|
|
|
4
7
|
## Screenshots
|
|
5
8
|
|
|
6
9
|
| | |
|
|
7
10
|
|---|---|
|
|
8
|
-
|  |  |
|
|
9
12
|
|
|
10
13
|
## Install
|
|
11
14
|
|
|
@@ -25,7 +28,7 @@ uv run nanocode
|
|
|
25
28
|
Required:
|
|
26
29
|
|
|
27
30
|
```sh
|
|
28
|
-
export NANOCODE_API_URL="https://api.example.com/v1
|
|
31
|
+
export NANOCODE_API_URL="https://api.example.com/v1"
|
|
29
32
|
export NANOCODE_API_KEY="your-api-key"
|
|
30
33
|
export NANOCODE_MODEL="your-model"
|
|
31
34
|
```
|
|
@@ -42,6 +45,26 @@ export NANOCODE_SHELL_TIMEOUT="60"
|
|
|
42
45
|
export NANOCODE_COMPACT_AT="100"
|
|
43
46
|
```
|
|
44
47
|
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
Start nanocode:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
nanocode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Show available commands:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
/help
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Ask a source-aware question about nanocode itself:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
/help how does compact work?
|
|
66
|
+
```
|
|
67
|
+
|
|
45
68
|
## Safety
|
|
46
69
|
|
|
47
70
|
nanocode does not provide sandbox protection. It can run shell commands and edit files in the environment where you start it.
|
|
@@ -32,7 +32,7 @@ from enum import StrEnum
|
|
|
32
32
|
from typing import Any, Callable, ClassVar, final, Iterator, Protocol, Self, Type, TypeAlias
|
|
33
33
|
from typing_extensions import override
|
|
34
34
|
from prompt_toolkit import PromptSession, print_formatted_text
|
|
35
|
-
from prompt_toolkit.completion import WordCompleter
|
|
35
|
+
from prompt_toolkit.completion import Completer, Completion, WordCompleter
|
|
36
36
|
from prompt_toolkit.formatted_text import FormattedText
|
|
37
37
|
from prompt_toolkit.history import FileHistory
|
|
38
38
|
from prompt_toolkit.output.defaults import create_output
|
|
@@ -41,7 +41,7 @@ from prompt_toolkit.patch_stdout import patch_stdout
|
|
|
41
41
|
|
|
42
42
|
JsonValue: TypeAlias = Any
|
|
43
43
|
Json: TypeAlias = dict[str, JsonValue]
|
|
44
|
-
__version__ = "0.
|
|
44
|
+
__version__ = "0.2.0"
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
class Error(Exception): ...
|
|
@@ -56,6 +56,34 @@ class LLMError(Exception): ...
|
|
|
56
56
|
class Cancellation(Exception): ...
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
class ReferenceFileCompleter(Completer):
|
|
60
|
+
def __init__(self, cwd: str, command_completer: WordCompleter):
|
|
61
|
+
self.cwd = cwd
|
|
62
|
+
self.command_completer = command_completer
|
|
63
|
+
|
|
64
|
+
def get_completions(self, document, complete_event):
|
|
65
|
+
match = re.search(r"(?:^|\s)@([^\s]*)$", document.text_before_cursor)
|
|
66
|
+
if match is None:
|
|
67
|
+
yield from self.command_completer.get_completions(document, complete_event)
|
|
68
|
+
return
|
|
69
|
+
|
|
70
|
+
partial = match.group(1)
|
|
71
|
+
dirname, prefix = os.path.split(partial)
|
|
72
|
+
base_dir = os.path.abspath(os.path.join(self.cwd, dirname))
|
|
73
|
+
try:
|
|
74
|
+
names = sorted(os.listdir(base_dir))
|
|
75
|
+
except OSError:
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
for name in names:
|
|
79
|
+
if not name.startswith(prefix):
|
|
80
|
+
continue
|
|
81
|
+
full_path = os.path.join(base_dir, name)
|
|
82
|
+
suffix = "/" if os.path.isdir(full_path) else ""
|
|
83
|
+
candidate = os.path.join(dirname, name) + suffix if dirname else name + suffix
|
|
84
|
+
yield Completion(candidate, start_position=-len(partial), display="@" + candidate)
|
|
85
|
+
|
|
86
|
+
|
|
59
87
|
class PromptItem:
|
|
60
88
|
@abstractmethod
|
|
61
89
|
def format(self, indent: str = "") -> str:
|
|
@@ -2806,6 +2834,8 @@ class CommandDispatcher:
|
|
|
2806
2834
|
current_category = spec.category
|
|
2807
2835
|
lines.append(current_category + ":")
|
|
2808
2836
|
lines.append(" " + spec.display_name() + " - " + spec.description)
|
|
2837
|
+
lines.append("")
|
|
2838
|
+
lines.append("Tip: use @path to autocomplete file paths in prompts.")
|
|
2809
2839
|
return "\n".join(lines)
|
|
2810
2840
|
|
|
2811
2841
|
def _format_source_help_question(self, question: str) -> str:
|
|
@@ -3114,7 +3144,7 @@ class AgentLoop:
|
|
|
3114
3144
|
os.makedirs(os.path.dirname(self.history_path), exist_ok=True)
|
|
3115
3145
|
return PromptSession(
|
|
3116
3146
|
history=FileHistory(self.history_path),
|
|
3117
|
-
completer=self._command_completer(),
|
|
3147
|
+
completer=ReferenceFileCompleter(self.agent.session.cwd, self._command_completer()),
|
|
3118
3148
|
complete_while_typing=True,
|
|
3119
3149
|
)
|
|
3120
3150
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nanocode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A lightweight terminal-based AI coding assistant
|
|
5
5
|
Author-email: hit9 <hit9@icloud.com>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -30,12 +30,15 @@ Dynamic: license-file
|
|
|
30
30
|
|
|
31
31
|
# nanocode
|
|
32
32
|
|
|
33
|
+
A lightweight terminal-based AI coding assistant.
|
|
34
|
+
|
|
35
|
+
nanocode is used to build itself, including features such as `@file` path completion.
|
|
33
36
|
|
|
34
37
|
## Screenshots
|
|
35
38
|
|
|
36
39
|
| | |
|
|
37
40
|
|---|---|
|
|
38
|
-
|  |  |
|
|
39
42
|
|
|
40
43
|
## Install
|
|
41
44
|
|
|
@@ -55,7 +58,7 @@ uv run nanocode
|
|
|
55
58
|
Required:
|
|
56
59
|
|
|
57
60
|
```sh
|
|
58
|
-
export NANOCODE_API_URL="https://api.example.com/v1
|
|
61
|
+
export NANOCODE_API_URL="https://api.example.com/v1"
|
|
59
62
|
export NANOCODE_API_KEY="your-api-key"
|
|
60
63
|
export NANOCODE_MODEL="your-model"
|
|
61
64
|
```
|
|
@@ -72,6 +75,26 @@ export NANOCODE_SHELL_TIMEOUT="60"
|
|
|
72
75
|
export NANOCODE_COMPACT_AT="100"
|
|
73
76
|
```
|
|
74
77
|
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
Start nanocode:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
nanocode
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Show available commands:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
/help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Ask a source-aware question about nanocode itself:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
/help how does compact work?
|
|
96
|
+
```
|
|
97
|
+
|
|
75
98
|
## Safety
|
|
76
99
|
|
|
77
100
|
nanocode does not provide sandbox protection. It can run shell commands and edit files in the environment where you start it.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|