@youtyan/code-viewer 0.1.51 → 0.1.52

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youtyan/code-viewer",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "Local browser-based code and git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: code-viewer-query
3
+ description: Use when investigating database contents, checking schema, running SQL queries, or answering questions about data in SQLite/MySQL/PostgreSQL databases visible to code-viewer. Triggers on "query", "SQL", "database", "テーブル", "データベース", "クエリ", "スキーマ", "DB".
4
+ ---
5
+
6
+ # code-viewer query
7
+
8
+ Execute read-only SQL queries against databases discovered by code-viewer.
9
+ Results are saved to query history and appear in the browser's Database
10
+ view, so the human can review what you queried.
11
+
12
+ ## When to use
13
+
14
+ - Answering "what does this data look like?"
15
+ - Checking schema, row counts, sample data
16
+ - Investigating data quality or anomalies
17
+ - Exploring table relationships
18
+
19
+ ## Requirements
20
+
21
+ - A code-viewer server must already be running for the repository
22
+ (the human starts it with: `code-viewer`). The CLI never starts one.
23
+ - Run from inside the repository, or pass `--cwd <repo>`.
24
+ - If `code-viewer` is not on PATH, prefix every command with
25
+ `npx -y @youtyan/code-viewer`.
26
+
27
+ ## Workflow
28
+
29
+ 1. List available databases:
30
+
31
+ ```sh
32
+ code-viewer query list
33
+ ```
34
+
35
+ 2. Execute a query:
36
+
37
+ ```sh
38
+ code-viewer query exec --db data.db --sql "SELECT * FROM users LIMIT 10" \
39
+ --title "Sample user data" --body "Checking what user records look like."
40
+ ```
41
+
42
+ 3. The human sees results in the browser's Database > Query History panel.
43
+
44
+ ## Guidelines
45
+
46
+ - Always use LIMIT. The server caps rows but be explicit.
47
+ - Write --title for the human, not for yourself.
48
+ - Use --body to explain why the query matters.
49
+ - Do not query broad PII or secrets unless explicitly asked.
50
+ - Use --no-save for exploratory queries that should not remain in history.
51
+ - Prefer specific columns over SELECT *.
52
+
53
+ ## Full reference
54
+
55
+ Before composing queries, read the complete agent guide:
56
+
57
+ ```sh
58
+ code-viewer query agent-help
59
+ ```