maxc-cli 0.2.4__tar.gz → 0.3.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.
Files changed (92) hide show
  1. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/PKG-INFO +11 -6
  2. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/README.md +9 -4
  3. maxc_cli-0.3.0/scripts/pyinstaller_entry.py +4 -0
  4. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/setup.py +2 -2
  5. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/__init__.py +1 -1
  6. maxc_cli-0.3.0/src/maxc_cli/_samples.py +180 -0
  7. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/app.py +603 -642
  8. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/auth_providers.py +26 -2
  9. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/auth.py +4 -0
  10. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/data.py +96 -26
  11. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/job.py +27 -7
  12. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/meta.py +56 -14
  13. maxc_cli-0.3.0/src/maxc_cli/backend/odps.py +201 -0
  14. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/query.py +18 -3
  15. maxc_cli-0.3.0/src/maxc_cli/catalog_bootstrap.py +223 -0
  16. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/cli.py +457 -143
  17. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/config.py +50 -12
  18. maxc_cli-0.3.0/src/maxc_cli/help_format.py +135 -0
  19. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/helpers.py +80 -23
  20. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/models.py +3 -28
  21. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/SKILL.md +64 -48
  22. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/bootstrap-auth.md +16 -21
  23. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/bootstrap-flow.md +11 -9
  24. maxc_cli-0.3.0/src/maxc_cli/skills/references/command-patterns.md +363 -0
  25. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/json-output-format.md +59 -5
  26. maxc_cli-0.3.0/src/maxc_cli/skills/references/maxcompute-select-guide.md +733 -0
  27. maxc_cli-0.3.0/src/maxc_cli/skills/references/maxcompute-sql-notes.md +50 -0
  28. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/migrate-from-odpscmd.md +11 -11
  29. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/partition-guide.md +11 -11
  30. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/red-lines.md +4 -4
  31. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/references/setup-install.md +18 -10
  32. maxc_cli-0.3.0/src/maxc_cli/skills/references/sql-common-errors.md +195 -0
  33. maxc_cli-0.3.0/src/maxc_cli/skills/references/sql-query-patterns.md +464 -0
  34. maxc_cli-0.3.0/src/maxc_cli/skills/references/text2sql-principles.md +85 -0
  35. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/utils.py +23 -1
  36. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli.egg-info/PKG-INFO +11 -6
  37. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli.egg-info/SOURCES.txt +24 -1
  38. maxc_cli-0.3.0/src/maxc_cli.egg-info/requires.txt +2 -0
  39. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_agent_skill_commands_context.py +114 -1
  40. maxc_cli-0.3.0/tests/test_backend_data.py +30 -0
  41. maxc_cli-0.3.0/tests/test_backend_data_serialization.py +248 -0
  42. maxc_cli-0.3.0/tests/test_backend_meta.py +93 -0
  43. maxc_cli-0.3.0/tests/test_build_release_script.py +59 -0
  44. maxc_cli-0.3.0/tests/test_catalog_bootstrap.py +236 -0
  45. maxc_cli-0.3.0/tests/test_cli_arg_validation.py +132 -0
  46. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_cli_mock.py +805 -30
  47. maxc_cli-0.3.0/tests/test_cli_query_parse_and_sanitize.py +120 -0
  48. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_compat.py +5 -3
  49. maxc_cli-0.3.0/tests/test_envelope_shape.py +212 -0
  50. maxc_cli-0.3.0/tests/test_error_translation.py +101 -0
  51. maxc_cli-0.3.0/tests/test_help_format.py +166 -0
  52. maxc_cli-0.3.0/tests/test_helpers.py +51 -0
  53. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_integration_real.py +28 -49
  54. maxc_cli-0.3.0/tests/test_meta_schema_and_partition_cols.py +233 -0
  55. maxc_cli-0.3.0/tests/test_pyinstaller_bundle.py +61 -0
  56. maxc_cli-0.3.0/tests/test_query_result_csv_fallback.py +235 -0
  57. maxc_cli-0.3.0/tests/test_skill_renderer.py +201 -0
  58. maxc_cli-0.2.4/src/maxc_cli/backend/odps.py +0 -134
  59. maxc_cli-0.2.4/src/maxc_cli/skills/references/command-patterns.md +0 -418
  60. maxc_cli-0.2.4/src/maxc_cli/skills/references/maxcompute-sql-notes.md +0 -178
  61. maxc_cli-0.2.4/src/maxc_cli.egg-info/requires.txt +0 -2
  62. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/MANIFEST.in +0 -0
  63. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/pyproject.toml +0 -0
  64. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/scripts/regression_test.py +0 -0
  65. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/setup.cfg +0 -0
  66. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/__main__.py +0 -0
  67. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/audit.py +0 -0
  68. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/__init__.py +0 -0
  69. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/backend/catalog.py +0 -0
  70. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/cache.py +0 -0
  71. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/exceptions.py +0 -0
  72. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/masking.py +0 -0
  73. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/output.py +0 -0
  74. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/setting_parser.py +0 -0
  75. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/skills/agents/openai.yaml +0 -0
  76. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli/store.py +0 -0
  77. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli.egg-info/dependency_links.txt +0 -0
  78. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli.egg-info/entry_points.txt +0 -0
  79. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/src/maxc_cli.egg-info/top_level.txt +0 -0
  80. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_agent_hints_and_cli.py +0 -0
  81. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_cache.py +0 -0
  82. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_catalog.py +0 -0
  83. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_e2e_smoke.py +0 -0
  84. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_error_self_correction.py +0 -0
  85. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_external_auth.py +0 -0
  86. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_helpers_csv.py +0 -0
  87. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_integration.py +0 -0
  88. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_job_improvements.py +0 -0
  89. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_masking.py +0 -0
  90. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_phase1_improvements.py +0 -0
  91. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_query_auto_promote.py +0 -0
  92. {maxc_cli-0.2.4 → maxc_cli-0.3.0}/tests/test_setting_parser.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maxc-cli
3
- Version: 0.2.4
3
+ Version: 0.3.0
4
4
  Summary: Agent-native MaxCompute CLI for external coding agents
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.9
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.14
12
12
  Requires-Python: >=3.9
13
13
  Description-Content-Type: text/markdown
14
14
  Requires-Dist: PyYAML>=5.4
15
- Requires-Dist: pyodps
15
+ Requires-Dist: pyodps>=0.12.0
16
16
  Dynamic: classifier
17
17
  Dynamic: description
18
18
  Dynamic: description-content-type
@@ -29,9 +29,12 @@ MaxCompute CLI — 不是 Agent,而是给 Agent 调用的结构化工具层。
29
29
  ```bash
30
30
  pip install maxc-cli
31
31
 
32
- # 认证
33
- maxc auth login --from-env --json # 从环境变量
34
- maxc auth login --access-id ID --secret-access-key KEY --project PROJ --endpoint URL --json
32
+ # 认证(推荐:交互式 Catalog Picker,无需手填 project)
33
+ maxc auth login --access-id ID --access-key-secret KEY --json
34
+
35
+ # 其他方式
36
+ maxc auth login --from-env --json # 从环境变量
37
+ maxc auth login --access-id ID --access-key-secret KEY --project PROJ --endpoint URL --json # CI / 脚本:显式 project
35
38
 
36
39
  # 确认就绪
37
40
  maxc auth whoami --json
@@ -180,7 +183,9 @@ src/maxc_cli/
180
183
  ## 限制
181
184
 
182
185
  - **只读**:CLI 强制 SELECT-only,不支持 DDL/DML
183
- - **auth login**:AK/SK 明文存储于 `~/.maxc/config.yaml`(文件权限 0600
186
+ - **auth login**:AK/SK 明文存储于 `~/.maxc/config.yaml`(文件权限 0600)。
187
+ 省略 `--project` 时通过 Catalog API 弹交互式 project picker(需 TTY,仅支持中国区 project)。
188
+ CI 用 `--no-picker`;想重选已保存的 project 用 `--reselect`;非中国区用 `--catalog-endpoint` 覆盖。
184
189
  - **list-tables 分页**:CLI 侧 offset token,非服务端游标
185
190
  - **diff data**:按主键快照对比,非全量 diff
186
191
 
@@ -7,9 +7,12 @@ MaxCompute CLI — 不是 Agent,而是给 Agent 调用的结构化工具层。
7
7
  ```bash
8
8
  pip install maxc-cli
9
9
 
10
- # 认证
11
- maxc auth login --from-env --json # 从环境变量
12
- maxc auth login --access-id ID --secret-access-key KEY --project PROJ --endpoint URL --json
10
+ # 认证(推荐:交互式 Catalog Picker,无需手填 project)
11
+ maxc auth login --access-id ID --access-key-secret KEY --json
12
+
13
+ # 其他方式
14
+ maxc auth login --from-env --json # 从环境变量
15
+ maxc auth login --access-id ID --access-key-secret KEY --project PROJ --endpoint URL --json # CI / 脚本:显式 project
13
16
 
14
17
  # 确认就绪
15
18
  maxc auth whoami --json
@@ -158,7 +161,9 @@ src/maxc_cli/
158
161
  ## 限制
159
162
 
160
163
  - **只读**:CLI 强制 SELECT-only,不支持 DDL/DML
161
- - **auth login**:AK/SK 明文存储于 `~/.maxc/config.yaml`(文件权限 0600
164
+ - **auth login**:AK/SK 明文存储于 `~/.maxc/config.yaml`(文件权限 0600)。
165
+ 省略 `--project` 时通过 Catalog API 弹交互式 project picker(需 TTY,仅支持中国区 project)。
166
+ CI 用 `--no-picker`;想重选已保存的 project 用 `--reselect`;非中国区用 `--catalog-endpoint` 覆盖。
162
167
  - **list-tables 分页**:CLI 侧 offset token,非服务端游标
163
168
  - **diff data**:按主键快照对比,非全量 diff
164
169
 
@@ -0,0 +1,4 @@
1
+ from maxc_cli.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
@@ -9,7 +9,7 @@ README = ROOT / "README.md"
9
9
 
10
10
  setup(
11
11
  name="maxc-cli",
12
- version="0.2.4",
12
+ version="0.3.0",
13
13
  description="Agent-native MaxCompute CLI for external coding agents",
14
14
  long_description=README.read_text(encoding="utf-8"),
15
15
  long_description_content_type="text/markdown",
@@ -35,7 +35,7 @@ setup(
35
35
  ],
36
36
  install_requires=[
37
37
  "PyYAML>=5.4",
38
- "pyodps",
38
+ "pyodps>=0.12.0",
39
39
  ],
40
40
  entry_points={
41
41
  "console_scripts": [
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.2.4"
5
+ __version__ = "0.3.0"
@@ -0,0 +1,180 @@
1
+ """Per-command sample text for ``--help``. Keys are dotted command names.
2
+
3
+ Style: 1-3 lines, concrete and copy-pasteable. Prefer realistic project names
4
+ ('my_proj') over placeholders ('PROJECT'). Wrap user-facing commands in the
5
+ quoting style they'd actually type.
6
+ """
7
+ from __future__ import annotations
8
+
9
+
10
+ SAMPLES: dict[str, str] = {
11
+ "__top__": (
12
+ "maxc auth login\n"
13
+ 'maxc query "SELECT 1"\n'
14
+ "maxc meta list-tables --project my_proj"
15
+ ),
16
+ # ── query ──────────────────────────────────────────────────────────────
17
+ "query": (
18
+ 'maxc query "SELECT 1"\n'
19
+ 'maxc query cost "SELECT * FROM big_table"\n'
20
+ "maxc query explain \"SELECT * FROM t WHERE dt='20260101'\""
21
+ ),
22
+ # ── auth ───────────────────────────────────────────────────────────────
23
+ "auth": "maxc auth login\nmaxc auth whoami --json",
24
+ "auth.login": (
25
+ "maxc auth login # interactive picker\n"
26
+ "maxc auth login --access-id AK --secret-access-key SK --no-picker"
27
+ ),
28
+ "auth.login-external": (
29
+ "maxc auth login-external --process-command 'curl -s https://my-sts/token'"
30
+ ),
31
+ "auth.whoami": "maxc auth whoami\nmaxc auth whoami --json",
32
+ "auth.can-i": "maxc auth can-i --table my_proj.my_table --operation SELECT",
33
+ # ── job ────────────────────────────────────────────────────────────────
34
+ "job": (
35
+ 'maxc job submit "SELECT count(*) FROM my_table"\n'
36
+ "maxc job list --limit 20\n"
37
+ "maxc job status <job_id>"
38
+ ),
39
+ "job.submit": (
40
+ 'maxc job submit "SELECT count(*) FROM my_table"\n'
41
+ 'maxc job submit --file query.sql --project my_proj'
42
+ ),
43
+ "job.status": "maxc job status <job_id>\nmaxc job status <job_id> --json",
44
+ "job.wait": (
45
+ "maxc job wait <job_id>\n"
46
+ "maxc job wait <job_id> --timeout 600 --stream"
47
+ ),
48
+ "job.diagnose": "maxc job diagnose <job_id>\nmaxc job diagnose <job_id> --json",
49
+ "job.result": (
50
+ "maxc job result <job_id>\n"
51
+ "maxc job result <job_id> --max-rows 1000 --json"
52
+ ),
53
+ "job.cancel": "maxc job cancel <job_id>",
54
+ "job.list": "maxc job list\nmaxc job list --limit 50 --json",
55
+ # ── meta ───────────────────────────────────────────────────────────────
56
+ "meta": (
57
+ "maxc meta list-tables --project my_proj\n"
58
+ "maxc meta describe my_table\n"
59
+ "maxc meta search orders"
60
+ ),
61
+ "meta.list-tables": (
62
+ "maxc meta list-tables --project my_proj\n"
63
+ "maxc meta list-tables --schema default --limit 50 --json"
64
+ ),
65
+ "meta.describe": (
66
+ "maxc meta describe my_table\n"
67
+ "maxc meta describe my_proj.my_table --full --json"
68
+ ),
69
+ "meta.search": (
70
+ "maxc meta search orders\n"
71
+ "maxc meta search user --project my_proj --json"
72
+ ),
73
+ "meta.search-columns": (
74
+ "maxc meta search-columns user_id\n"
75
+ "maxc meta search-columns dt --project my_proj --json"
76
+ ),
77
+ "meta.latest-partition": (
78
+ "maxc meta latest-partition my_table\n"
79
+ "maxc meta latest-partition my_proj.my_table --json"
80
+ ),
81
+ "meta.freshness": (
82
+ "maxc meta freshness my_table\n"
83
+ "maxc meta freshness my_proj.my_table --json"
84
+ ),
85
+ "meta.partitions": (
86
+ "maxc meta partitions my_table\n"
87
+ "maxc meta partitions my_proj.my_table --limit 50 --json"
88
+ ),
89
+ "meta.list-projects": "maxc meta list-projects\nmaxc meta list-projects --json",
90
+ "meta.list-schemas": (
91
+ "maxc meta list-schemas\n"
92
+ "maxc meta list-schemas --project my_proj --json"
93
+ ),
94
+ # ── meta semantic ──────────────────────────────────────────────────────
95
+ "meta.semantic": (
96
+ "maxc meta semantic set my_table --desc 'Order facts'\n"
97
+ "maxc meta semantic get my_table\n"
98
+ "maxc meta semantic list-missing"
99
+ ),
100
+ "meta.semantic.set": (
101
+ "maxc meta semantic set my_table --desc 'Order facts'\n"
102
+ "maxc meta semantic set my_table --use-cases reporting analytics --sample-questions 'top users by revenue'"
103
+ ),
104
+ "meta.semantic.get": (
105
+ "maxc meta semantic get my_table\n"
106
+ "maxc meta semantic get my_table --json"
107
+ ),
108
+ "meta.semantic.list-missing": (
109
+ "maxc meta semantic list-missing\n"
110
+ "maxc meta semantic list-missing --json"
111
+ ),
112
+ # ── session ────────────────────────────────────────────────────────────
113
+ "session": (
114
+ "maxc session set --project my_proj\n"
115
+ "maxc session show\n"
116
+ "maxc session unset"
117
+ ),
118
+ "session.set": (
119
+ "maxc session set --project my_proj\n"
120
+ "maxc session set --project my_proj --schema default"
121
+ ),
122
+ "session.show": "maxc session show\nmaxc session show --json",
123
+ "session.unset": "maxc session unset",
124
+ # ── data ───────────────────────────────────────────────────────────────
125
+ "data": (
126
+ "maxc data sample my_table --rows 10\n"
127
+ "maxc data profile my_table\n"
128
+ "maxc data download my_table --output rows.csv"
129
+ ),
130
+ "data.sample": (
131
+ "maxc data sample my_table --rows 10\n"
132
+ "maxc data sample my_table --partition \"dt='20260101'\" --columns id,name"
133
+ ),
134
+ "data.profile": (
135
+ "maxc data profile my_table\n"
136
+ "maxc data profile my_table --partition \"dt='20260101'\" --json"
137
+ ),
138
+ "data.upload": (
139
+ "maxc data upload my_table --file rows.csv\n"
140
+ "maxc data upload my_table --file rows.tsv --delimiter $'\\t' --partition \"dt='20260101'\" --overwrite"
141
+ ),
142
+ "data.download": (
143
+ "maxc data download my_table --output rows.csv\n"
144
+ "maxc data download my_table --output rows.csv --columns id,name --limit 1000"
145
+ ),
146
+ # ── agent ──────────────────────────────────────────────────────────────
147
+ "agent": (
148
+ "maxc agent context\n"
149
+ "maxc agent skill\n"
150
+ "maxc agent install-skill claude-code"
151
+ ),
152
+ "agent.context": "maxc agent context\nmaxc agent context --json",
153
+ "agent.skill": "maxc agent skill\nmaxc agent skill --json",
154
+ "agent.install-skill": (
155
+ "maxc agent install-skill # defaults to claude-code\n"
156
+ "maxc agent install-skill cursor"
157
+ ),
158
+ # ── cache ──────────────────────────────────────────────────────────────
159
+ "cache": (
160
+ "maxc cache build --project my_proj\n"
161
+ "maxc cache status --project my_proj\n"
162
+ "maxc cache clear --project my_proj"
163
+ ),
164
+ "cache.build": (
165
+ "maxc cache build --project my_proj\n"
166
+ "maxc cache build --project my_proj --schema default --async"
167
+ ),
168
+ "cache.build-status": (
169
+ "maxc cache build-status --project my_proj\n"
170
+ "maxc cache build-status --project my_proj --build-id <id> --json"
171
+ ),
172
+ "cache.status": (
173
+ "maxc cache status --project my_proj\n"
174
+ "maxc cache status --project my_proj --schema default --json"
175
+ ),
176
+ "cache.clear": (
177
+ "maxc cache clear --project my_proj\n"
178
+ "maxc cache clear --project my_proj --schema default"
179
+ ),
180
+ }