@aipt/idp-cli 0.1.1 → 0.1.2

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/bin/idp.mjs CHANGED
@@ -6,6 +6,7 @@ import { spawnSync } from 'node:child_process';
6
6
 
7
7
  const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
8
8
  const spacesRoot = resolve(repoRoot, '..');
9
+ const cliVersion = JSON.parse(await import('node:fs/promises').then(({ readFile }) => readFile(resolve(repoRoot, 'package.json'), 'utf8'))).version;
9
10
 
10
11
  function executable(path) {
11
12
  try { accessSync(path, constants.X_OK); return true; } catch { return false; }
@@ -101,6 +102,7 @@ function help() {
101
102
 
102
103
  try {
103
104
  const { cwd, json, rest } = parseGlobal(process.argv.slice(2));
105
+ if (rest[0] === '--version' || rest[0] === 'version') { console.log(json ? JSON.stringify({ schemaVersion: 1, command: 'version', version: cliVersion }) : cliVersion); process.exit(0); }
104
106
  if (rest.length === 0 || rest[0] === '--help' || rest[0] === 'help') { help(); process.exit(0); }
105
107
  const [group, action, ...args] = rest;
106
108
  let status;
@@ -0,0 +1,10 @@
1
+ # IDP CLI 命令入口
2
+
3
+ `idp` 是薄门面,不复制 Dyyto Kernel 或 idp-deploy Kernel 的实现。
4
+
5
+ - `idp --version --json`:显示当前门面版本及可执行路径。
6
+ - `idp doctor --cwd <项目路径>`:检查开发和交付 Kernel。
7
+ - 工程采用、Catalog、Plan/Apply/Verify 委托给 `dyyto`。
8
+ - Config Dir、本地 Docker、镜像与私有化交付委托给 `idpctl`。
9
+
10
+ 项目必须使用 Bootstrap 产生的工具链锁,禁止依靠任意全局最新版形成不可复现行为。
@@ -0,0 +1,6 @@
1
+ # IDP CLI 双 Registry 包发布设计
2
+
3
+ - 状态:approved
4
+ - 批准依据:用户明确要求将 `idp`、`idpctl`、`dyyto` 等工程 CLI 发布到私有与公开 npm Registry。
5
+
6
+ `@aipt/idp-cli` 是薄入口包,只包含 `bin/idp.mjs` 与 README,不复制 Dyyto Kernel 或 idp-deploy。发布前必须运行测试、审计 tarball,发布后分别从两个 Registry 回读版本并在仓库外临时目录执行 `idp --help`。同一版本已存在但摘要不同则停止,不覆盖或 unpublish。
@@ -0,0 +1,48 @@
1
+ # 开发者统一 CLI DESIGN
2
+
3
+ 状态:approved
4
+ 批准依据:用户于 2026-09-01 确认三环境、三层 CLI 总体方案并授权实现。
5
+
6
+ ## 目标
7
+
8
+ 提供 `idp` 薄门面,让开发者发现上下文、获得中文反馈,并显式委托两个既有 Kernel:
9
+
10
+ - `dyyto`:工程脚手架、能力采用、开发与验证;
11
+ - `idpctl`:交付、环境、GitOps 与部署运维。
12
+
13
+ 本地没有 Kubernetes、ACK、ACR、KMS、SLS 或 ARMS 时,工程创建、检查和能力操作仍可进行。只有委托的具体部署动作自行检查其前置条件。
14
+
15
+ ## 公共契约
16
+
17
+ | 入口 | 委托 |
18
+ | --- | --- |
19
+ | `idp doctor` | 只读发现 Git、Dyyto、idpctl、kubectl 与当前工程;不连接或推断目标集群 |
20
+ | `idp app create` | `dyyto create` |
21
+ | `idp app inspect` | `dyyto inspect` |
22
+ | `idp capability ...` | 参数原样委托 `dyyto ...` |
23
+ | `idp delivery ...` | 参数原样委托 `idpctl ...` |
24
+ | `idp environment ...` | 参数原样委托 `idpctl ...` |
25
+
26
+ 所有 `...` 都是 argv,不经 shell。`--cwd` 只由门面消费;`--json` 为门面 doctor 输出格式,其他命令原样传给 Kernel。
27
+
28
+ ## 上下文发现
29
+
30
+ 顺序固定:显式环境变量(`IDP_DYYTO_BIN`、`IDP_DEPLOY_BIN`)→ PATH 可执行文件 → 当前仓库同级标准目录。发现结果只决定可执行入口,不推断业务事实。
31
+
32
+ ## 失败与恢复
33
+
34
+ - Kernel 缺失:在启动前失败并给出中文修复建议。
35
+ - Kernel 非零退出:保留其 stdout、stderr 和退出码,不包装成成功。
36
+ - 当前目录不存在:在启动前失败。
37
+ - 委托中断:转发 SIGINT/SIGTERM,不产生中间状态。
38
+ - 门面自身不写消费者仓库,因此无 Preimage;所有写入与恢复仍由 Kernel 负责。
39
+
40
+ ## 脚手架与人工验收
41
+
42
+ `npm run example` 在 `.examples/delegation` 创建临时 fixture consumer,以契约 Kernel 验证 argv、cwd、退出码和无 Kubernetes 行为;结束可执行 `npm run example:clean` 清理。真实工程采用仍必须使用 Dyyto Catalog、Plan、Apply、Verifier 链路,门面不生成旁路模板。
43
+
44
+ ## 非目标
45
+
46
+ - 不实现 Portal、AI Runtime 或产品领域能力;
47
+ - 不实现 CI、Registry、GitOps 或 Kubernetes 控制器;
48
+ - 不把不存在的 `build trigger` 等未来命令伪装成已完成能力。
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@aipt/idp-cli",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "documents": [
6
6
  { "id": "idp-integration", "path": "docs/integration.md", "digest": "sha256:ad16f812d516763140c14efe8a0afb275b420987d23e0d6071fbbb7312b7324c" },
7
- { "id": "tool-delegation", "path": "docs/tool-delegation.md", "digest": "sha256:8dc76242bd21bfbd477609b1e3459e96fd092504bfe9e9b4b81db2d5391270a2" }
7
+ { "id": "tool-delegation", "path": "docs/tool-delegation.md", "digest": "sha256:8dc76242bd21bfbd477609b1e3459e96fd092504bfe9e9b4b81db2d5391270a2" },
8
+ { "id": "idp-command-reference", "path": "docs/command-reference.md", "digest": "sha256:cf523daf3bb9a6883c1c0f1c5b411aef49f42985ab101980df7b5213e6d44d4a" }
8
9
  ]
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipt/idp-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "IDP 开发者统一入口,委托 Dyyto 与 idp-deploy 执行工程和交付能力。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,8 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "bin",
11
- "docs/integration.md",
12
- "docs/tool-delegation.md",
11
+ "docs",
13
12
  "documentation-manifest.json",
14
13
  "README.md"
15
14
  ],