@ait-co/console-cli 0.1.38 → 0.1.39

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/README.en.md CHANGED
@@ -223,6 +223,28 @@ The following command groups are implemented end-to-end:
223
223
 
224
224
  `app logs` is deferred until the backend endpoint is available. See the [organization landing page](https://aitc.dev/) for the full roadmap.
225
225
 
226
+ ## Issuing a Deploy Key
227
+
228
+ Issue a workspace-scoped credential (Deploy Key) for deploy automation:
229
+
230
+ ```sh
231
+ aitcc keys create --name ci-deploy
232
+ ```
233
+
234
+ The key is automatically saved to `~/.ait/credentials` under the `ci-deploy` profile as soon as it is issued — no separate `ait token add` step required:
235
+
236
+ ```sh
237
+ ait deploy --profile ci-deploy ./bundle.ait
238
+ ```
239
+
240
+ Only the plaintext key is written to stdout (pipe-friendly). stderr confirms which profile was saved. If you are piping the key into an external secret manager and do not need a local profile, pass `--no-save-profile`:
241
+
242
+ ```sh
243
+ aitcc keys create --name ci-deploy --no-save-profile | secret-tool store --label=… key password
244
+ ```
245
+
246
+ To save the profile under a different name than `--name`, pass `--save-profile <other-name>`. The plaintext key is exposed once at issuance and cannot be retrieved later — if you lose it, revoke it with `aitcc keys revoke <id>` and issue a new one.
247
+
226
248
  ## Pre-commit hook
227
249
 
228
250
  Optional but recommended. After cloning, activate the standard pre-commit hook (runs `biome check` on staged files):
package/README.md CHANGED
@@ -223,6 +223,28 @@ aitcc telemetry tier0-on # Tier 0 다시 활성화
223
223
 
224
224
  `app logs`는 백엔드 endpoint 확보 후 구현 예정입니다. 전체 로드맵은 [organization landing page](https://aitc.dev/) 참조.
225
225
 
226
+ ## Deploy Key 발급
227
+
228
+ 배포 자동화를 위한 워크스페이스-scope 자격증명(Deploy Key)을 발급합니다.
229
+
230
+ ```sh
231
+ aitcc keys create --name ci-deploy
232
+ ```
233
+
234
+ 키 발급 즉시 `~/.ait/credentials`에 `ci-deploy` 프로파일로 저장되므로, 별도 `ait token add` 단계 없이 바로 사용할 수 있습니다:
235
+
236
+ ```sh
237
+ ait deploy --profile ci-deploy ./bundle.ait
238
+ ```
239
+
240
+ stdout에는 plaintext 키 한 줄만 나옵니다 (파이프 친화적). stderr는 저장된 프로파일 이름을 확인해줍니다. CI 파이프에서 키를 외부 secret manager에 직접 주입할 때처럼 로컬 저장이 필요 없다면 `--no-save-profile`로 저장을 건너뜁니다:
241
+
242
+ ```sh
243
+ aitcc keys create --name ci-deploy --no-save-profile | secret-tool store --label=… key password
244
+ ```
245
+
246
+ 프로파일 이름을 `--name`과 다르게 지정하려면 `--save-profile <other-name>`을 사용합니다. plaintext 키는 발급 시 한 번만 노출되며 목록 endpoint에서 다시 확인할 수 없습니다 — 분실 시 `aitcc keys revoke <id>`로 무효화하고 재발급합니다.
247
+
226
248
  ## Pre-commit hook
227
249
 
228
250
  선택 사항이지만 권장합니다. clone 후 표준 pre-commit hook을 활성화하면 staged 파일에 `biome check`가 자동으로 돕니다 (push 전 빠른 피드백):
package/dist/cli.mjs CHANGED
@@ -6833,8 +6833,11 @@ function readCredentials(path) {
6833
6833
  }
6834
6834
  function writeCredentials(path, map) {
6835
6835
  const dir = join(path, "..");
6836
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
6837
- writeFileSync(path, JSON.stringify(map, null, 2) + "\n", {
6836
+ if (!existsSync(dir)) mkdirSync(dir, {
6837
+ recursive: true,
6838
+ mode: 448
6839
+ });
6840
+ writeFileSync(path, `${JSON.stringify(map, null, 2)}\n`, {
6838
6841
  encoding: "utf8",
6839
6842
  mode: 384
6840
6843
  });
@@ -6952,6 +6955,20 @@ function validateKeyName(raw) {
6952
6955
  if (!NAME_REGEX.test(raw)) return "bad-chars";
6953
6956
  return null;
6954
6957
  }
6958
+ /**
6959
+ * Resolve the ait profile name to save the Deploy Key under.
6960
+ *
6961
+ * - `noSaveProfile: true` → undefined (skip saving)
6962
+ * - `saveProfileOverride` present → use that name
6963
+ * - default → use `name` (the --name value)
6964
+ *
6965
+ * Exported for unit testing.
6966
+ */
6967
+ function resolveProfileName(name, opts) {
6968
+ if (opts.noSaveProfile) return void 0;
6969
+ if (opts.saveProfileOverride) return opts.saveProfileOverride;
6970
+ return name;
6971
+ }
6955
6972
  function parseAppsFlag(raw) {
6956
6973
  const slugs = raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
6957
6974
  if (slugs.length === 0) return {
@@ -7045,7 +7062,12 @@ const createCommand = defineCommand({
7045
7062
  },
7046
7063
  "save-profile": {
7047
7064
  type: "string",
7048
- description: "After issuing, save the key as an `ait` token profile (written to `~/.ait/credentials`). The named profile can then be used with `ait deploy --profile <name>` immediately. If omitted, the key is printed to stdout once and not persisted locally."
7065
+ description: "Profile name for the ait token (defaults to --name). The key is written to `~/.ait/credentials` so `ait deploy --profile <name>` works immediately. Use --no-save-profile to skip."
7066
+ },
7067
+ "no-save-profile": {
7068
+ type: "boolean",
7069
+ default: false,
7070
+ description: "Do not save the issued key to an ait token profile — print to stdout only (for CI pipes that store it elsewhere)."
7049
7071
  },
7050
7072
  json: {
7051
7073
  type: "boolean",
@@ -7096,7 +7118,10 @@ const createCommand = defineCommand({
7096
7118
  name,
7097
7119
  target
7098
7120
  }, session.cookies);
7099
- const saveProfileName = args["save-profile"] ? String(args["save-profile"]) : void 0;
7121
+ const saveProfileName = resolveProfileName(name, {
7122
+ noSaveProfile: args["no-save-profile"],
7123
+ ...args["save-profile"] ? { saveProfileOverride: String(args["save-profile"]) } : {}
7124
+ });
7100
7125
  let savedProfile;
7101
7126
  let saveProfileWarning;
7102
7127
  if (saveProfileName !== void 0) {
@@ -9167,7 +9192,7 @@ function resolveVersion() {
9167
9192
  if (typeof injected === "string" && injected.length > 0) return injected;
9168
9193
  } catch {}
9169
9194
  try {
9170
- return "0.1.38";
9195
+ return "0.1.39";
9171
9196
  } catch {}
9172
9197
  return "0.0.0-dev";
9173
9198
  }