navcli 0.2.0__tar.gz → 0.2.2__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.
Files changed (45) hide show
  1. {navcli-0.2.0 → navcli-0.2.2}/PKG-INFO +3 -1
  2. navcli-0.2.2/README.md +180 -0
  3. {navcli-0.2.0 → navcli-0.2.2}/docs/README.md +2 -0
  4. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/__init__.py +16 -3
  5. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/browser.py +4 -1
  6. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/PKG-INFO +3 -1
  7. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/SOURCES.txt +1 -0
  8. {navcli-0.2.0 → navcli-0.2.2}/pyproject.toml +1 -1
  9. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/__init__.py +0 -0
  10. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/app.py +0 -0
  11. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/client.py +0 -0
  12. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/__init__.py +0 -0
  13. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/base.py +0 -0
  14. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/control.py +0 -0
  15. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/explore.py +0 -0
  16. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/interaction.py +0 -0
  17. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/navigation.py +0 -0
  18. {navcli-0.2.0 → navcli-0.2.2}/navcli/cli/commands/query.py +0 -0
  19. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/__init__.py +0 -0
  20. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/models/__init__.py +0 -0
  21. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/models/dom.py +0 -0
  22. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/models/element.py +0 -0
  23. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/models/feedback.py +0 -0
  24. {navcli-0.2.0 → navcli-0.2.2}/navcli/core/models/state.py +0 -0
  25. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/app.py +0 -0
  26. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/middleware/__init__.py +0 -0
  27. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/__init__.py +0 -0
  28. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/control.py +0 -0
  29. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/explore.py +0 -0
  30. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/interaction.py +0 -0
  31. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/navigation.py +0 -0
  32. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/query.py +0 -0
  33. {navcli-0.2.0 → navcli-0.2.2}/navcli/server/routes/session.py +0 -0
  34. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/__init__.py +0 -0
  35. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/image.py +0 -0
  36. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/js.py +0 -0
  37. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/selector.py +0 -0
  38. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/text.py +0 -0
  39. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/time.py +0 -0
  40. {navcli-0.2.0 → navcli-0.2.2}/navcli/utils/url.py +0 -0
  41. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/dependency_links.txt +0 -0
  42. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/entry_points.txt +0 -0
  43. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/requires.txt +0 -0
  44. {navcli-0.2.0 → navcli-0.2.2}/navcli.egg-info/top_level.txt +0 -0
  45. {navcli-0.2.0 → navcli-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: navcli
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: 可交互、可探索的浏览器命令行工具,专为 AI Agent 设计
5
5
  Author: NavCLI Team
6
6
  License: MIT
@@ -76,4 +76,6 @@ Become the **standard browser interaction layer** for AI Agents, enabling any Ag
76
76
 
77
77
  ## Related Documentation
78
78
 
79
+ - [Skill File Download](https://github.com/wumu2013/navcli/blob/main/docs/skill.md)
80
+ - [Project Homepage](https://make.datavoid.fun/navcli/)
79
81
  - [PRD Product Requirements](./NAVCLI_PRD.md)
navcli-0.2.2/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # NavCLI - Browser Automation CLI for AI Agents
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/navcli)](https://pypi.org/project/navcli/)
4
+ [![GitHub](https://img.shields.io/badge/GitHub-wumu2013/navcli-blue)](https://github.com/wumu2013/navcli)
5
+
6
+ **Enable AI Agents to browse the web like humans.**
7
+
8
+ ## What is NavCLI?
9
+
10
+ NavCLI is an interactive, explorable browser CLI designed for AI Agents. Unlike HTTP APIs or headless browser scripts, NavCLI provides:
11
+
12
+ - **Full SPA Support** - JavaScript-rendered pages work seamlessly
13
+ - **Session Persistence** - Cookies and login sessions maintained across requests
14
+ - **Interactive CLI** - Agents can explore and interact dynamically
15
+ - **Token Optimization** - Lightweight element queries with on-demand content
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ pip install navcli
21
+ ```
22
+
23
+ ### Start Server
24
+
25
+ ```bash
26
+ nav-server
27
+ ```
28
+
29
+ ### Use CLI
30
+
31
+ ```bash
32
+ nav
33
+ ```
34
+
35
+ Or run commands directly:
36
+
37
+ ```bash
38
+ nav g https://example.com
39
+ nav tables
40
+ nav paragraphs
41
+ ```
42
+
43
+ ## Data Extraction
44
+
45
+ > **IMPORTANT**: For data extraction, focus on `tables` and `paragraphs`.
46
+
47
+ | Command | Description |
48
+ |---------|-------------|
49
+ | `nav tables` | Extract all `<table>` elements with structured data |
50
+ | `nav paragraphs` | Extract large text paragraphs (200+ chars) |
51
+ | `nav g <url>` | Navigate + auto-fetch paragraphs on first call |
52
+
53
+ ## Core Commands
54
+
55
+ ### Navigation
56
+
57
+ ```bash
58
+ nav g <url> # Navigate to URL
59
+ nav b # Go back
60
+ nav f # Go forward
61
+ nav r # Reload
62
+ ```
63
+
64
+ ### Interaction
65
+
66
+ ```bash
67
+ nav c <sel> [--force] # Click element
68
+ nav t <sel> <txt> # Type text
69
+ nav clear <sel> # Clear input
70
+ nav upload <sel> <path> # Upload file
71
+ ```
72
+
73
+ ### Query
74
+
75
+ ```bash
76
+ nav elements # Interactive elements
77
+ nav text # Page text content
78
+ nav html # Page HTML
79
+ nav screenshot # Screenshot (base64)
80
+ nav state # Full page state
81
+ nav url # Current URL
82
+ nav title # Page title
83
+ nav tables # All tables with data
84
+ nav paragraphs [len] # Large text paragraphs
85
+ nav links # All hyperlinks
86
+ nav forms # All forms
87
+ ```
88
+
89
+ ### Explore
90
+
91
+ ```bash
92
+ nav find <text> # Find element by text
93
+ nav findall <text> # Find all elements by text
94
+ nav inspect <sel> # Inspect element details
95
+ nav wait_idle [sec] # Wait for network idle
96
+ nav scroll top|bottom|up|down # Scroll page
97
+ ```
98
+
99
+ ### Session
100
+
101
+ ```bash
102
+ nav cookies # Show cookies
103
+ nav save_session [name] # Save session
104
+ nav load_session [name] # Load session
105
+ ```
106
+
107
+ ### Control
108
+
109
+ ```bash
110
+ nav quit # Close browser
111
+ nav exit # Exit CLI
112
+ ```
113
+
114
+ ## Agent Workflow
115
+
116
+ ```
117
+ Navigate → Observe → Interact → Feedback → Continue
118
+ ```
119
+
120
+ ```bash
121
+ # 1 Navigate - Go to target page
122
+ nav g https://example.com/data-page
123
+
124
+ # 2 Observe - Check what data is available
125
+ nav tables # Extract tabular data
126
+ nav paragraphs # Extract text content
127
+
128
+ # 3 Interact - Navigate/paginate if needed
129
+ nav find "Next"
130
+ nav c a.next-page
131
+ nav wait_idle
132
+
133
+ # 4 Feedback - Verify data extraction
134
+ nav tables
135
+ nav paragraphs
136
+
137
+ # 5 Continue - Proceed to next data source
138
+ nav g https://example.com/page2
139
+ ```
140
+
141
+ ## API
142
+
143
+ NavCLI uses a client-server architecture with HTTP API:
144
+
145
+ | Method | Endpoint | Description |
146
+ |--------|----------|-------------|
147
+ | POST | `/cmd/goto?url=<url>` | Navigate to URL |
148
+ | POST | `/cmd/click?selector=<s>` | Click element |
149
+ | GET | `/query/tables` | Get all tables |
150
+ | GET | `/query/paragraphs` | Get large text paragraphs |
151
+ | GET | `/query/elements` | Get interactive elements |
152
+ | POST | `/cmd/session/save?name=<n>` | Save session |
153
+ | POST | `/cmd/session/load?name=<n>` | Load session |
154
+
155
+ See [docs/skill.md](docs/skill.md) for complete API reference.
156
+
157
+ ## Session Persistence
158
+
159
+ Save login sessions for authenticated access:
160
+
161
+ ```bash
162
+ # Save after login
163
+ nav save_session jisilu
164
+
165
+ # Load session for future headless access
166
+ nav load_session jisilu
167
+ ```
168
+
169
+ Sessions are stored in `~/.navcli/sessions/`.
170
+
171
+ ## Documentation
172
+
173
+ - [CLI & API Reference](docs/skill.md)
174
+ - [Skill File Download](https://github.com/wumu2013/navcli/blob/main/docs/skill.md)
175
+ - [Project Homepage](https://make.datavoid.fun/navcli/)
176
+ - [Product Requirements](docs/NAVCLI_PRD.md)
177
+
178
+ ## License
179
+
180
+ MIT
@@ -43,4 +43,6 @@ Become the **standard browser interaction layer** for AI Agents, enabling any Ag
43
43
 
44
44
  ## Related Documentation
45
45
 
46
+ - [Skill File Download](https://github.com/wumu2013/navcli/blob/main/docs/skill.md)
47
+ - [Project Homepage](https://make.datavoid.fun/navcli/)
46
48
  - [PRD Product Requirements](./NAVCLI_PRD.md)
@@ -22,13 +22,15 @@ _NAVCLI_SESSIONS_DIR = os.path.join(_NAVCLI_HOME, "sessions")
22
22
  _server: Optional[uvicorn.Server] = None
23
23
 
24
24
 
25
- async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool = True) -> uvicorn.Server:
25
+ async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool = True,
26
+ browser_args: Optional[list] = None) -> uvicorn.Server:
26
27
  """Start the browser server.
27
28
 
28
29
  Args:
29
30
  host: Host to bind
30
31
  port: Port to listen
31
32
  headless: Run browser in headless mode (default: True)
33
+ browser_args: Additional browser launch arguments
32
34
 
33
35
  Returns:
34
36
  Uvicorn server instance
@@ -36,7 +38,7 @@ async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool
36
38
  global _server
37
39
 
38
40
  # Start browser
39
- await start_browser(headless=headless)
41
+ await start_browser(headless=headless, args=browser_args)
40
42
 
41
43
  # Create app
42
44
  app = create_app()
@@ -80,9 +82,20 @@ def main():
80
82
  help="Run in headless mode (default)")
81
83
  parser.add_argument("--no-headless", dest="headless", action="store_false",
82
84
  help="Run with GUI (non-headless)")
85
+ parser.add_argument("--memory-limit", type=int, default=None,
86
+ help="Browser memory limit in MB (e.g., --memory-limit 512)")
83
87
 
84
88
  args = parser.parse_args()
85
89
 
90
+ # Build browser args for memory limit
91
+ browser_args = None
92
+ if args.memory_limit:
93
+ browser_args = [
94
+ f"--js-flags=--max-old-space-size={args.memory_limit}",
95
+ "--disable-dev-shm-usage",
96
+ ]
97
+ print(f"Memory limit: {args.memory_limit}MB")
98
+
86
99
  print(f"Starting NavCLI Browser Server on {args.host}:{args.port}...")
87
100
  print(f"Headless: {args.headless}")
88
101
  print("-" * 60)
@@ -117,7 +130,7 @@ def main():
117
130
  print("-" * 60)
118
131
 
119
132
  try:
120
- asyncio.run(start_server(args.host, args.port, headless=args.headless))
133
+ asyncio.run(start_server(args.host, args.port, headless=args.headless, browser_args=browser_args))
121
134
  except KeyboardInterrupt:
122
135
  print("\nShutting down...")
123
136
  sys.exit(0)
@@ -25,11 +25,12 @@ _NAVCLI_SESSIONS_DIR = os.path.join(_NAVCLI_HOME, "sessions")
25
25
  _storage_state_path: str = os.path.join(_NAVCLI_SESSIONS_DIR, "session.json") # Default session file
26
26
 
27
27
 
28
- async def start_browser(headless: bool = True):
28
+ async def start_browser(headless: bool = True, args: Optional[list] = None):
29
29
  """Start the browser.
30
30
 
31
31
  Args:
32
32
  headless: Whether to run in headless mode (default: True)
33
+ args: Additional browser launch arguments
33
34
  """
34
35
  global _browser, _context, _page
35
36
 
@@ -43,6 +44,8 @@ async def start_browser(headless: bool = True):
43
44
  user_data_dir = os.environ.get("NAVCLI_USER_DATA_DIR")
44
45
 
45
46
  launch_kwargs = {"headless": headless}
47
+ if args:
48
+ launch_kwargs["args"] = args
46
49
  if executable_path:
47
50
  launch_kwargs["executable_path"] = executable_path
48
51
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: navcli
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: 可交互、可探索的浏览器命令行工具,专为 AI Agent 设计
5
5
  Author: NavCLI Team
6
6
  License: MIT
@@ -76,4 +76,6 @@ Become the **standard browser interaction layer** for AI Agents, enabling any Ag
76
76
 
77
77
  ## Related Documentation
78
78
 
79
+ - [Skill File Download](https://github.com/wumu2013/navcli/blob/main/docs/skill.md)
80
+ - [Project Homepage](https://make.datavoid.fun/navcli/)
79
81
  - [PRD Product Requirements](./NAVCLI_PRD.md)
@@ -1,3 +1,4 @@
1
+ README.md
1
2
  pyproject.toml
2
3
  docs/README.md
3
4
  navcli.egg-info/PKG-INFO
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "navcli"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "可交互、可探索的浏览器命令行工具,专为 AI Agent 设计"
9
9
  readme = "docs/README.md"
10
10
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes