compshare-cli 0.5.3__tar.gz → 0.5.5__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.
- compshare_cli-0.5.5/.agents/plugins/marketplace.json +20 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/CHANGELOG.md +14 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/MANIFEST.in +2 -0
- {compshare_cli-0.5.3/src/compshare_cli.egg-info → compshare_cli-0.5.5}/PKG-INFO +20 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/README.md +19 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/RELEASING.md +16 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/connector/compshare/connector-meta.json +1 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/connector/compshare/mcp.json +1 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/connector/compshare/skills/compshare/SKILL.md +1 -1
- compshare_cli-0.5.5/plugin.json +32 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/__init__.py +1 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/output.py +4 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5/src/compshare_cli.egg-info}/PKG-INFO +20 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli.egg-info/SOURCES.txt +2 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_config.py +4 -2
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_output.py +13 -0
- compshare_cli-0.5.5/tests/test_release_version.py +50 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_remote_jobs.py +4 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_ssh.py +5 -1
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_ssh_cache.py +12 -4
- compshare_cli-0.5.3/tests/test_release_version.py +0 -19
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/LICENSE +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/connector/compshare/icon.svg +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/connector/compshare/token-schema.json +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/pyproject.toml +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/setup.cfg +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/skills/compshare-cli/SKILL.md +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/skills/compshare-cli/agents/openai.yaml +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/__main__.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/actions.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/api.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/cli.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/__init__.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/bandwidth.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/common.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/doctor.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/feedback.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/image.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/instance.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/minimax.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/storage.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/commands/team.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/config.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/errors.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/i18n.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/insights.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/instance_templates.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/location.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/mcp_server.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/parsing.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/remote_jobs.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/runtime.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/sdk.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/ssh.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli/ssh_cache.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli.egg-info/dependency_links.txt +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli.egg-info/entry_points.txt +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli.egg-info/requires.txt +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/src/compshare_cli.egg-info/top_level.txt +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_actions.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_api.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_bandwidth.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_cli.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_feedback.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_instance_templates.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_location.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_mcp_server.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_minimax.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_minimax_media.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_parsing.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_sdk.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_ssh_integration.py +0 -0
- {compshare_cli-0.5.3 → compshare_cli-0.5.5}/tests/test_workbuddy_connector.py +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "compshare",
|
|
3
|
+
"interface": {
|
|
4
|
+
"displayName": "CompShare"
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
{
|
|
8
|
+
"name": "compshare-cli",
|
|
9
|
+
"source": {
|
|
10
|
+
"source": "local",
|
|
11
|
+
"path": "./"
|
|
12
|
+
},
|
|
13
|
+
"policy": {
|
|
14
|
+
"installation": "AVAILABLE",
|
|
15
|
+
"authentication": "ON_INSTALL"
|
|
16
|
+
},
|
|
17
|
+
"category": "Developer Tools"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.5.5
|
|
6
|
+
|
|
7
|
+
- 新增 Codex Plugin 和 CompShare 插件市场配置,复用现有 CLI Skill,支持从 GitHub 安装;
|
|
8
|
+
将插件配置纳入源码包和发布版本一致性校验。
|
|
9
|
+
- 精简 README 插件说明,将 Codex Plugin 章节移到 WorkBuddy Connector 下方、SDK 上方。
|
|
10
|
+
|
|
11
|
+
## 0.5.4
|
|
12
|
+
|
|
13
|
+
- 修复 Windows 下 PowerShell 5.1/7 使用 GBK 代码页时中文 JSON 乱码或无法解析的问题,保持 UTF-8
|
|
14
|
+
输出和原有 JSON 数据结构。
|
|
15
|
+
- 适配 Windows 测试的平台条件,验证 DPAPI 凭证缓存加密,并完成监控、SSH、中文路径传输
|
|
16
|
+
和持久化远程任务的真实 PowerShell 回归。
|
|
17
|
+
- Windows 经 SSH 会话嵌套调用 OpenSSH 仍可能挂起,独立 PowerShell 实测通过。
|
|
18
|
+
|
|
5
19
|
## 0.5.3
|
|
6
20
|
|
|
7
21
|
- 恢复 `instance monitor`:自动定位实例地域并按最多 10 台分批查询,终端显示各设备最新
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compshare-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: Command-line client for CompShare GPU compute and MiniMax H3
|
|
5
5
|
Author: CompShare
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -133,6 +133,25 @@ compshare-mcp
|
|
|
133
133
|
正式 Connector 使用 `uvx` 从 PyPI 安装固定版本,并将只读、预演和需要明确确认的写操作
|
|
134
134
|
分开暴露。MiniMax H3 使用表单中可选的独立模型 API Key。
|
|
135
135
|
|
|
136
|
+
## Codex Plugin
|
|
137
|
+
|
|
138
|
+
仓库内置符合 [OpenAI 插件规范](https://developers.openai.com/plugins/build/plugins) 的
|
|
139
|
+
Skill 插件,直接复用 `skills/compshare-cli`,通过本地 `compshare` 命令管理资源。
|
|
140
|
+
先安装 CLI 并按「配置」说明设置凭证,再在仓库根目录执行:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
codex plugin marketplace add .
|
|
144
|
+
codex plugin add compshare-cli@compshare
|
|
145
|
+
codex plugin list --marketplace compshare --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
也可以从任意目录通过 GitHub 安装:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
codex plugin marketplace add compshare-cn/compshare-cli
|
|
152
|
+
codex plugin add compshare-cli@compshare
|
|
153
|
+
```
|
|
154
|
+
|
|
136
155
|
## SDK
|
|
137
156
|
|
|
138
157
|
如需通过 SDK 集成 CompShare API,可参考独立的
|
|
@@ -106,6 +106,25 @@ compshare-mcp
|
|
|
106
106
|
正式 Connector 使用 `uvx` 从 PyPI 安装固定版本,并将只读、预演和需要明确确认的写操作
|
|
107
107
|
分开暴露。MiniMax H3 使用表单中可选的独立模型 API Key。
|
|
108
108
|
|
|
109
|
+
## Codex Plugin
|
|
110
|
+
|
|
111
|
+
仓库内置符合 [OpenAI 插件规范](https://developers.openai.com/plugins/build/plugins) 的
|
|
112
|
+
Skill 插件,直接复用 `skills/compshare-cli`,通过本地 `compshare` 命令管理资源。
|
|
113
|
+
先安装 CLI 并按「配置」说明设置凭证,再在仓库根目录执行:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
codex plugin marketplace add .
|
|
117
|
+
codex plugin add compshare-cli@compshare
|
|
118
|
+
codex plugin list --marketplace compshare --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
也可以从任意目录通过 GitHub 安装:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
codex plugin marketplace add compshare-cn/compshare-cli
|
|
125
|
+
codex plugin add compshare-cli@compshare
|
|
126
|
+
```
|
|
127
|
+
|
|
109
128
|
## SDK
|
|
110
129
|
|
|
111
130
|
如需通过 SDK 集成 CompShare API,可参考独立的
|
|
@@ -16,7 +16,7 @@ PyPI Trusted Publishing 自动上传。仓库不需要保存 PyPI Token。
|
|
|
16
16
|
|
|
17
17
|
## 发布新版本
|
|
18
18
|
|
|
19
|
-
1. 更新 `src/compshare_cli/__init__.py` 中的版本和 `CHANGELOG.md`。
|
|
19
|
+
1. 更新 `src/compshare_cli/__init__.py`、`plugin.json` 中的版本和 `CHANGELOG.md`。
|
|
20
20
|
2. 运行 `ruff check .`、`ruff format --check .` 和 `pytest`。
|
|
21
21
|
3. 创建与包版本一致的标签,例如 `v0.2.2`。
|
|
22
22
|
4. 发布对应的 GitHub Release。
|
|
@@ -27,3 +27,18 @@ PyPI;失败时应发布新版本,不能覆盖已有文件。
|
|
|
27
27
|
如果 GitHub Release 早于自动发布工作流,可以在 Actions 中手动运行
|
|
28
28
|
`Publish to PyPI`,输入已有的 Release 标签补发。工作流会从该标签构建,避免同一版本
|
|
29
29
|
混入标签之后的改动。
|
|
30
|
+
|
|
31
|
+
## 公共插件市场
|
|
32
|
+
|
|
33
|
+
确认插件改动已提交并推送到 GitHub 后,在仓库根目录创建上传包:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
mkdir -p dist
|
|
37
|
+
git archive --format=zip --output=dist/compshare-cli-plugin.zip HEAD \
|
|
38
|
+
plugin.json skills/compshare-cli connector/compshare/icon.svg LICENSE
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
上传包包含插件清单、Skill、图标和许可证。到
|
|
42
|
+
[OpenAI Plugins](https://platform.openai.com/plugins) 选择已验证的开发者身份,上传 ZIP,
|
|
43
|
+
等待元数据和 Skill 检查完成后提交审核。审核通过后再选择 `Publish plugin` 公开发布。
|
|
44
|
+
完整流程见 [官方提交说明](https://developers.openai.com/plugins/deploy/submission)。
|
|
@@ -3,7 +3,7 @@ name: compshare
|
|
|
3
3
|
description: Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the controlled CompShare MCP bridge.
|
|
4
4
|
description_zh: 通过受控 CompShare MCP 桥接查询和管理优云智算 GPU 云资源及 MiniMax H3 视频、图片和语音任务。
|
|
5
5
|
description_en: Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the controlled CompShare MCP bridge.
|
|
6
|
-
version: "0.5.
|
|
6
|
+
version: "0.5.5"
|
|
7
7
|
author: "CompShare"
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "compshare-cli",
|
|
4
|
+
"version": "0.5.5",
|
|
5
|
+
"description": "Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the compshare CLI.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "CompShare"
|
|
8
|
+
},
|
|
9
|
+
"repository": "https://github.com/compshare-cn/compshare-cli",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"extensions": {
|
|
12
|
+
"com.openai": {
|
|
13
|
+
"interface": {
|
|
14
|
+
"displayName": "CompShare CLI",
|
|
15
|
+
"shortDescription": "GPU and AI media workflows",
|
|
16
|
+
"longDescription": "Manage CompShare GPU instances, images, disks, networking and teams. Connect over SSH, transfer files and run durable remote jobs. Create and inspect MiniMax H3 video, image and speech tasks. Requires Python 3.9 or later, the locally installed compshare-cli package and your own CompShare API credentials; media generation uses a separate model API key. Inspect prices and dry runs, and approve resource changes before execution.",
|
|
17
|
+
"developerName": "CompShare",
|
|
18
|
+
"category": "Developer Tools",
|
|
19
|
+
"websiteURL": "https://github.com/compshare-cn/compshare-cli",
|
|
20
|
+
"supportURL": "https://github.com/compshare-cn/compshare-cli/issues",
|
|
21
|
+
"composerIcon": "./connector/compshare/icon.svg",
|
|
22
|
+
"logo": "./connector/compshare/icon.svg",
|
|
23
|
+
"defaultPrompt": [
|
|
24
|
+
"Use $compshare-cli:compshare-cli to manage CompShare GPU or MiniMax H3 resources safely."
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"publication": {
|
|
28
|
+
"release_notes": "Initial Codex plugin release with the existing CompShare CLI skill for GPU resources, remote jobs and MiniMax H3 media tasks."
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -150,7 +150,10 @@ def _project_rows(
|
|
|
150
150
|
|
|
151
151
|
def _write_json(payload: Dict[str, Any]) -> None:
|
|
152
152
|
"""Write one UTF-8 JSON document independently of the console code page."""
|
|
153
|
-
|
|
153
|
+
# PowerShell can decode native pipes using a legacy Windows console code page.
|
|
154
|
+
document = (
|
|
155
|
+
json.dumps(payload, ensure_ascii=sys.platform == "win32", separators=(",", ":")) + "\n"
|
|
156
|
+
)
|
|
154
157
|
stream = sys.stdout
|
|
155
158
|
binary = getattr(stream, "buffer", None)
|
|
156
159
|
if binary is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compshare-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: Command-line client for CompShare GPU compute and MiniMax H3
|
|
5
5
|
Author: CompShare
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -133,6 +133,25 @@ compshare-mcp
|
|
|
133
133
|
正式 Connector 使用 `uvx` 从 PyPI 安装固定版本,并将只读、预演和需要明确确认的写操作
|
|
134
134
|
分开暴露。MiniMax H3 使用表单中可选的独立模型 API Key。
|
|
135
135
|
|
|
136
|
+
## Codex Plugin
|
|
137
|
+
|
|
138
|
+
仓库内置符合 [OpenAI 插件规范](https://developers.openai.com/plugins/build/plugins) 的
|
|
139
|
+
Skill 插件,直接复用 `skills/compshare-cli`,通过本地 `compshare` 命令管理资源。
|
|
140
|
+
先安装 CLI 并按「配置」说明设置凭证,再在仓库根目录执行:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
codex plugin marketplace add .
|
|
144
|
+
codex plugin add compshare-cli@compshare
|
|
145
|
+
codex plugin list --marketplace compshare --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
也可以从任意目录通过 GitHub 安装:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
codex plugin marketplace add compshare-cn/compshare-cli
|
|
152
|
+
codex plugin add compshare-cli@compshare
|
|
153
|
+
```
|
|
154
|
+
|
|
136
155
|
## SDK
|
|
137
156
|
|
|
138
157
|
如需通过 SDK 集成 CompShare API,可参考独立的
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import stat
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
@@ -21,8 +22,9 @@ def test_profile_round_trip_and_file_permissions(monkeypatch, tmp_path) -> None:
|
|
|
21
22
|
expected = Profile("public", "private")
|
|
22
23
|
store.save_profile("testing", expected)
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
if os.name != "nt":
|
|
26
|
+
assert stat.S_IMODE(path.stat().st_mode) == 0o600
|
|
27
|
+
assert stat.S_IMODE(path.parent.stat().st_mode) == 0o700
|
|
26
28
|
assert store.load_profile("testing") == expected
|
|
27
29
|
saved = json.loads(path.read_text(encoding="utf-8"))["profiles"]["testing"]
|
|
28
30
|
assert set(saved) == {"public_key", "private_key"}
|
|
@@ -53,6 +53,19 @@ def test_json_renderer_writes_utf8_bytes_under_a_gbk_stdout(monkeypatch) -> None
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
def test_windows_json_survives_legacy_powershell_pipe_decoding(monkeypatch) -> None:
|
|
57
|
+
raw = BytesIO()
|
|
58
|
+
monkeypatch.setattr(output.sys, "platform", "win32")
|
|
59
|
+
monkeypatch.setattr(output.sys, "stdout", TextIOWrapper(raw, encoding="gbk"))
|
|
60
|
+
|
|
61
|
+
Renderer(True).data({"value": "中文 😀"})
|
|
62
|
+
|
|
63
|
+
document = raw.getvalue()
|
|
64
|
+
assert document.isascii()
|
|
65
|
+
assert document.count(b"\n") == 1
|
|
66
|
+
assert json.loads(document.decode("gbk"))["data"]["value"] == "中文 😀"
|
|
67
|
+
|
|
68
|
+
|
|
56
69
|
def test_json_renderer_reports_redacted_field_paths(capsys) -> None:
|
|
57
70
|
Renderer(True).data({"Password": "secret", "IPSet": [{"IP": "203.0.113.1"}]})
|
|
58
71
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from compshare_cli import __version__
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_release_version_sources_are_consistent() -> None:
|
|
11
|
+
root = Path(__file__).resolve().parents[1]
|
|
12
|
+
completed = subprocess.run(
|
|
13
|
+
[sys.executable, str(root / "scripts/check_release_version.py")],
|
|
14
|
+
cwd=root,
|
|
15
|
+
capture_output=True,
|
|
16
|
+
text=True,
|
|
17
|
+
check=False,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
assert completed.returncode == 0, completed.stderr
|
|
21
|
+
assert f"Release version {__version__} is consistent." in completed.stdout
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_release_version_rejects_stale_plugin(tmp_path: Path) -> None:
|
|
25
|
+
root = Path(__file__).resolve().parents[1]
|
|
26
|
+
for name in (
|
|
27
|
+
"scripts/check_release_version.py",
|
|
28
|
+
"src/compshare_cli/__init__.py",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"pyproject.toml",
|
|
31
|
+
"plugin.json",
|
|
32
|
+
):
|
|
33
|
+
target = tmp_path / name
|
|
34
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
shutil.copyfile(root / name, target)
|
|
36
|
+
plugin_path = tmp_path / "plugin.json"
|
|
37
|
+
plugin = json.loads(plugin_path.read_text(encoding="utf-8"))
|
|
38
|
+
plugin["version"] = "0.0.0"
|
|
39
|
+
plugin_path.write_text(json.dumps(plugin), encoding="utf-8")
|
|
40
|
+
|
|
41
|
+
completed = subprocess.run(
|
|
42
|
+
[sys.executable, str(tmp_path / "scripts/check_release_version.py")],
|
|
43
|
+
cwd=tmp_path,
|
|
44
|
+
capture_output=True,
|
|
45
|
+
text=True,
|
|
46
|
+
check=False,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
assert completed.returncode != 0
|
|
50
|
+
assert "plugin.json=0.0.0" in completed.stderr
|
|
@@ -91,6 +91,7 @@ def test_protocol_parser_and_normalizer() -> None:
|
|
|
91
91
|
parse_records("COMPSHARE_JOB_UNSUPPORTED\n")
|
|
92
92
|
|
|
93
93
|
|
|
94
|
+
@pytest.mark.skipif(os.name == "nt", reason="requires a local POSIX shell")
|
|
94
95
|
def test_relative_xdg_state_home_falls_back_to_home(tmp_path) -> None:
|
|
95
96
|
environment = os.environ.copy()
|
|
96
97
|
environment.update({"HOME": str(tmp_path), "XDG_STATE_HOME": "relative/state"})
|
|
@@ -106,6 +107,7 @@ def test_relative_xdg_state_home_falls_back_to_home(tmp_path) -> None:
|
|
|
106
107
|
assert (tmp_path / ".local" / "state" / "compshare" / "jobs").is_dir()
|
|
107
108
|
|
|
108
109
|
|
|
110
|
+
@pytest.mark.skipif(os.name == "nt", reason="requires a local POSIX shell")
|
|
109
111
|
def test_submit_show_and_read_logs_with_xdg_state_directory(tmp_path) -> None:
|
|
110
112
|
bin_directory = tmp_path / "bin"
|
|
111
113
|
bin_directory.mkdir()
|
|
@@ -166,6 +168,7 @@ def test_submit_show_and_read_logs_with_xdg_state_directory(tmp_path) -> None:
|
|
|
166
168
|
assert [record["JobId"] for record in parse_records(listed.stdout)] == ["job-test"]
|
|
167
169
|
|
|
168
170
|
|
|
171
|
+
@pytest.mark.skipif(os.name == "nt", reason="requires a local POSIX shell")
|
|
169
172
|
def test_submit_is_idempotent_for_the_same_job_id(tmp_path) -> None:
|
|
170
173
|
job_directory = tmp_path / "state" / "compshare" / "jobs" / "job-existing"
|
|
171
174
|
job_directory.mkdir(parents=True)
|
|
@@ -206,6 +209,7 @@ def test_submit_is_idempotent_for_the_same_job_id(tmp_path) -> None:
|
|
|
206
209
|
parse_records(cwd_conflict.stdout)
|
|
207
210
|
|
|
208
211
|
|
|
212
|
+
@pytest.mark.skipif(os.name == "nt", reason="requires a local POSIX shell")
|
|
209
213
|
def test_prune_removes_only_old_terminal_jobs(tmp_path) -> None:
|
|
210
214
|
jobs_root = tmp_path / "state" / "compshare" / "jobs"
|
|
211
215
|
old_job = jobs_root / "job-old"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from pathlib import Path
|
|
2
3
|
from types import SimpleNamespace
|
|
3
4
|
|
|
@@ -7,6 +8,7 @@ from compshare_cli import ssh
|
|
|
7
8
|
from compshare_cli.errors import CLIError, UsageError
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
@pytest.mark.skipif(os.name == "nt", reason="pexpect requires POSIX")
|
|
10
12
|
def test_connect_with_password_answers_split_prompt_once(monkeypatch) -> None:
|
|
11
13
|
calls = []
|
|
12
14
|
sent = []
|
|
@@ -68,6 +70,7 @@ def test_connect_with_password_answers_split_prompt_once(monkeypatch) -> None:
|
|
|
68
70
|
|
|
69
71
|
|
|
70
72
|
def test_connect_with_password_requires_an_interactive_terminal(monkeypatch) -> None:
|
|
73
|
+
monkeypatch.setattr(ssh, "_is_windows", lambda: False)
|
|
71
74
|
monkeypatch.setattr(ssh.sys, "stdin", SimpleNamespace(isatty=lambda: False))
|
|
72
75
|
|
|
73
76
|
try:
|
|
@@ -382,7 +385,8 @@ def test_captured_password_authentication_cleans_up_on_failure(monkeypatch, runn
|
|
|
382
385
|
password_file = Path(kwargs["env"][ssh._ASKPASS_PASSWORD_FILE_ENV])
|
|
383
386
|
password_files.append(password_file)
|
|
384
387
|
assert password_file.read_text() == "temporary-secret"
|
|
385
|
-
|
|
388
|
+
if os.name != "nt":
|
|
389
|
+
assert password_file.stat().st_mode & 0o777 == 0o600
|
|
386
390
|
raise OSError("test process failure")
|
|
387
391
|
|
|
388
392
|
monkeypatch.setattr(ssh.subprocess, "run", run)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import stat
|
|
3
4
|
|
|
4
5
|
import pytest
|
|
@@ -28,9 +29,14 @@ def test_ssh_cache_round_trip_is_profile_scoped_and_permission_restricted(tmp_pa
|
|
|
28
29
|
key: value for key, value in _host().items() if key != "Unrelated"
|
|
29
30
|
}
|
|
30
31
|
assert cache.get("beta", "uhost-1", ttl=60, now=150) is None
|
|
31
|
-
|
|
32
|
+
if os.name != "nt":
|
|
33
|
+
assert stat.S_IMODE(path.stat().st_mode) == 0o600
|
|
32
34
|
saved = json.loads(path.read_text(encoding="utf-8"))
|
|
33
|
-
|
|
35
|
+
saved_host = next(iter(saved["entries"].values()))["host"]
|
|
36
|
+
assert "Unrelated" not in saved_host
|
|
37
|
+
if os.name == "nt":
|
|
38
|
+
assert saved_host["Password"].startswith("dpapi:")
|
|
39
|
+
assert saved_host["Password"] != _host()["Password"]
|
|
34
40
|
|
|
35
41
|
|
|
36
42
|
def test_ssh_cache_expires_and_can_be_deleted(tmp_path) -> None:
|
|
@@ -68,8 +74,9 @@ def test_non_utf8_cache_is_ignored(tmp_path) -> None:
|
|
|
68
74
|
|
|
69
75
|
def test_cache_does_not_change_existing_parent_permissions(tmp_path) -> None:
|
|
70
76
|
tmp_path.chmod(0o755)
|
|
77
|
+
permissions = stat.S_IMODE(tmp_path.stat().st_mode)
|
|
71
78
|
SSHCredentialCache(tmp_path / "ssh-cache.json").put("default", "uhost-1", _host())
|
|
72
|
-
assert stat.S_IMODE(tmp_path.stat().st_mode) ==
|
|
79
|
+
assert stat.S_IMODE(tmp_path.stat().st_mode) == permissions
|
|
73
80
|
|
|
74
81
|
|
|
75
82
|
@pytest.mark.parametrize("field", ["Region", "Zone", "SshLoginCommand", "Password"])
|
|
@@ -93,7 +100,8 @@ def test_failed_cache_write_keeps_previous_credentials_and_removes_temporary_fil
|
|
|
93
100
|
) -> None:
|
|
94
101
|
cache = SSHCredentialCache(tmp_path / "private" / "ssh-cache.json")
|
|
95
102
|
cache.put("default", "uhost-1", _host("old-password"), now=100)
|
|
96
|
-
|
|
103
|
+
if os.name != "nt":
|
|
104
|
+
assert stat.S_IMODE(cache.path.parent.stat().st_mode) == 0o700
|
|
97
105
|
|
|
98
106
|
def fail(*_):
|
|
99
107
|
raise OSError("simulated replacement failure")
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import sys
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
from compshare_cli import __version__
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_release_version_sources_are_consistent() -> None:
|
|
9
|
-
root = Path(__file__).resolve().parents[1]
|
|
10
|
-
completed = subprocess.run(
|
|
11
|
-
[sys.executable, str(root / "scripts/check_release_version.py")],
|
|
12
|
-
cwd=root,
|
|
13
|
-
capture_output=True,
|
|
14
|
-
text=True,
|
|
15
|
-
check=False,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
assert completed.returncode == 0, completed.stderr
|
|
19
|
-
assert f"Release version {__version__} is consistent." in completed.stdout
|
|
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
|
|
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
|
|
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
|
|
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
|