# acong-tech-vault-sdk

Python SDK for [vault](https://github.com/acong-tech/vault) —— 读 credentials / resources / projects 不走 subprocess。

## 安装

```bash
pip install acong-tech-vault-sdk
# 或
uv add acong-tech-vault-sdk
```

## 使用

```python
import os
os.environ.setdefault("VAULT_DATA_DIR", "/path/to/vault/data")

from vault_sdk import cred, resource, project, find_credential

# 取 credential
c = cred("aliyun-power-app-ak")
print(c["credentials"]["access_key_id"])

# 取 resource
sign = resource("aliyun", "sms-sign", "杭州阿空智能科技")

# 取 project 的所有依赖
p = project("xiangqin")
print(p["uses"]["credentials"])  # ["aliyun-main", "aliyun-power-app-ak", ...]

# v1 兼容：按旧 platform 名查
c = find_credential("aliyun.power-app")
```

## 环境变量

- `VAULT_DATA_DIR`：必需。vault 的 `data/` 目录（或其子集）的路径。

  生产环境推荐把本项目需要的 credentials/resources/projects 文件推到独立目录，设 `VAULT_DATA_DIR=/opt/xiangqin/vault-data`。
  开发环境软链 `ln -s /Users/yarnb/vault/data ~/.vault/data` 即可。

## 心智模型

详见 vault 项目 `decisions/2026-04-22-2300-v2-schema-*.md`。5 概念分层：

```
Platform ─┬─ Account ── Credential
          └─ Resource
Project ─── uses {credentials, resources}
```

## License

MIT
