asc-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseasc init — Project Context Initialisation
asc init — 项目上下文初始化
Saves the app ID, name, and bundle ID to in the current directory. Future commands and agents read this file instead of calling every session.
.asc/project.jsonasc apps list将App ID、应用名称和Bundle ID保存到当前目录下的文件中。后续的命令和Agent会读取该文件,无需每次会话都调用。
.asc/project.jsonasc apps listCommands
命令
init — pin project context
init — 固定项目上下文
bash
undefinedbash
undefinedDirect (no API list call)
直接指定(无需调用API列表)
asc init --app-id <id> [--pretty]
asc init --app-id <id> [--pretty]
By name (case-insensitive search)
通过名称搜索(不区分大小写)
asc init --name "My App" [--pretty]
asc init --name "My App" [--pretty]
Auto-detect from *.xcodeproj/project.pbxproj in cwd
自动检测当前目录下的*.xcodeproj/project.pbxproj文件
asc init [--pretty]
Priority: `--app-id` > `--name` > auto-detect.asc init [--pretty]
优先级:`--app-id` > `--name` > 自动检测。What Gets Saved
保存的内容
./.asc/project.jsonjson
{
"appId": "1234567890",
"appName": "My App",
"bundleId": "com.example.myapp"
}./.asc/project.jsonjson
{
"appId": "1234567890",
"appName": "My App",
"bundleId": "com.example.myapp"
}JSON Output
JSON输出
json
{
"data": [
{
"affordances": {
"checkReadiness": "asc versions check-readiness --version-id <id>",
"listAppInfos": "asc app-infos list --app-id 1234567890",
"listBuilds": "asc builds list --app-id 1234567890",
"listVersions": "asc versions list --app-id 1234567890"
},
"appId": "1234567890",
"appName": "My App",
"bundleId": "com.example.myapp"
}
]
}json
{
"data": [
{
"affordances": {
"checkReadiness": "asc versions check-readiness --version-id <id>",
"listAppInfos": "asc app-infos list --app-id 1234567890",
"listBuilds": "asc builds list --app-id 1234567890",
"listVersions": "asc versions list --app-id 1234567890"
},
"appId": "1234567890",
"appName": "My App",
"bundleId": "com.example.myapp"
}
]
}Typical Workflow
典型工作流程
bash
undefinedbash
undefined1. Run once per project directory
1. 每个项目目录仅需运行一次
cd /path/to/MyApp
asc init --pretty
cd /path/to/MyApp
asc init --pretty
2. In subsequent sessions, read the saved context
2. 在后续会话中,读取已保存的上下文
APP_ID=$(jq -r '.appId' .asc/project.json)
APP_ID=$(jq -r '.appId' .asc/project.json)
3. Use normally — no need for asc apps list
3. 正常使用,无需运行asc apps list
asc versions list --app-id "$APP_ID"
asc builds list --app-id "$APP_ID"
undefinedasc versions list --app-id "$APP_ID"
asc builds list --app-id "$APP_ID"
undefinedAuto-detect Logic
自动检测逻辑
When no flags are given, scans files in the current directory and extracts values. It then matches those bundle IDs against your App Store Connect apps.
asc init*.xcodeproj/project.pbxprojPRODUCT_BUNDLE_IDENTIFIERVariable references like are skipped — only literal values are matched.
$(PRODUCT_BUNDLE_IDENTIFIER)当未指定任何参数时,会扫描当前目录下的文件,提取的值。然后将这些Bundle ID与你的App Store Connect应用进行匹配。
asc init*.xcodeproj/project.pbxprojPRODUCT_BUNDLE_IDENTIFIER会跳过这类变量引用,仅匹配字面量值。
$(PRODUCT_BUNDLE_IDENTIFIER)Error Cases
错误场景
| Situation | Error |
|---|---|
| |
Auto-detect: no | |
| Auto-detect: bundle IDs don't match any ASC app | |
| 场景 | 错误信息 |
|---|---|
指定 | 未找到名为'…'的应用。请运行asc apps list查看可用应用。 |
自动检测:未找到 | 未找到Xcode项目。请使用--app-id或--name参数。 |
| 自动检测:Bundle ID未匹配到任何ASC应用 | 没有ASC应用匹配以下Bundle ID:com.example.app |
See Also
另请参阅
- Full feature doc:
docs/features/init.md - Follow affordances from the output to list versions, builds, or app infos without knowing the app ID
- 完整功能文档:
docs/features/init.md - 可根据输出中的affordances,在不了解App ID的情况下列出版本、构建版本或应用信息