Watch a directory for file changes and automatically update the code graph. This command runs in the foreground and monitors the specified directory for any file changes. When changes are detected, the code graph is automatically updated. The watcher will: - Perfor
(
path: str = typer.Argument(".", help="Path to the directory to watch. Defaults to current directory."),
context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use"),
)
| 1261 | |
| 1262 | @app.command() |
| 1263 | def watch( |
| 1264 | path: str = typer.Argument(".", help="Path to the directory to watch. Defaults to current directory."), |
| 1265 | context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use"), |
| 1266 | ): |
| 1267 | """ |
| 1268 | Watch a directory for file changes and automatically update the code graph. |
| 1269 | |
| 1270 | This command runs in the foreground and monitors the specified directory |
| 1271 | for any file changes. When changes are detected, the code graph is |
| 1272 | automatically updated. |
| 1273 | |
| 1274 | The watcher will: |
| 1275 | - Perform an initial scan if the directory is not yet indexed |
| 1276 | - Monitor for file creation, modification, deletion, and moves |
| 1277 | - Automatically re-index affected files and update relationships |
| 1278 | |
| 1279 | Press Ctrl+C to stop watching. |
| 1280 | |
| 1281 | Examples: |
| 1282 | cgc watch . # Watch current directory |
| 1283 | cgc watch /path/to/project # Watch specific directory |
| 1284 | cgc w . # Using shortcut alias |
| 1285 | """ |
| 1286 | _load_credentials() |
| 1287 | watch_helper(path, context) |
| 1288 | |
| 1289 | @app.command() |
| 1290 | def unwatch( |
no test coverage detected