@islamihab/kds 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/index.js +132 -32
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14587,7 +14587,7 @@ import { join } from "path";
14587
14587
  // package.json
14588
14588
  var package_default = {
14589
14589
  name: "cli",
14590
- version: "0.1.3",
14590
+ version: "0.1.4",
14591
14591
  private: true,
14592
14592
  type: "module",
14593
14593
  bin: {
@@ -14626,7 +14626,7 @@ var DEFAULT_SERVER_URL = "https://dashboard.kaidev.studio";
14626
14626
  var DISCOVERY_PATH = "/api/discovery";
14627
14627
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
14628
14628
  var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
14629
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/values/base64.js
14629
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/values/base64.js
14630
14630
  var lookup = [];
14631
14631
  var revLookup = [];
14632
14632
  var Arr = Uint8Array;
@@ -14710,7 +14710,7 @@ function fromByteArray(uint8) {
14710
14710
  return parts.join("");
14711
14711
  }
14712
14712
 
14713
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/common/index.js
14713
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/common/index.js
14714
14714
  function parseArgs2(args) {
14715
14715
  if (args === undefined) {
14716
14716
  return {};
@@ -14746,13 +14746,33 @@ function isSimpleObject(value) {
14746
14746
  return isObject2 && isSimple;
14747
14747
  }
14748
14748
 
14749
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/values/value.js
14749
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/values/value.js
14750
14750
  var LITTLE_ENDIAN = true;
14751
14751
  var MIN_INT64 = BigInt("-9223372036854775808");
14752
14752
  var MAX_INT64 = BigInt("9223372036854775807");
14753
14753
  var ZERO = BigInt("0");
14754
14754
  var EIGHT = BigInt("8");
14755
14755
  var TWOFIFTYSIX = BigInt("256");
14756
+ var COMMIT_TS_UNRESOLVED = "This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.";
14757
+
14758
+ class CommitTsPlaceholder {
14759
+ [Symbol.toPrimitive](hint) {
14760
+ if (hint === "string") {
14761
+ return this.toString();
14762
+ }
14763
+ throw new Error(COMMIT_TS_UNRESOLVED);
14764
+ }
14765
+ valueOf() {
14766
+ throw new Error(COMMIT_TS_UNRESOLVED);
14767
+ }
14768
+ toJSON() {
14769
+ throw new Error(COMMIT_TS_UNRESOLVED);
14770
+ }
14771
+ toString() {
14772
+ return "[unresolved commit timestamp]";
14773
+ }
14774
+ }
14775
+ var commitTsPlaceholder = new CommitTsPlaceholder;
14756
14776
  function isSpecial(n) {
14757
14777
  return Number.isNaN(n) || !Number.isFinite(n) || Object.is(n, -0);
14758
14778
  }
@@ -14869,6 +14889,12 @@ function jsonToConvex(value) {
14869
14889
  }
14870
14890
  return float;
14871
14891
  }
14892
+ if (key === "$commitTs") {
14893
+ if (value.$commitTs !== null) {
14894
+ throw new Error(`Malformed $commitTs field on ${value}`);
14895
+ }
14896
+ return commitTsPlaceholder;
14897
+ }
14872
14898
  if (key === "$set") {
14873
14899
  throw new Error(`Received a Set which is no longer supported as a Convex type.`);
14874
14900
  }
@@ -14937,6 +14963,9 @@ function convexToJsonInternal(value, originalValue, context, includeTopLevelUnde
14937
14963
  if (value instanceof ArrayBuffer) {
14938
14964
  return { $bytes: fromByteArray(new Uint8Array(value)) };
14939
14965
  }
14966
+ if (value instanceof CommitTsPlaceholder) {
14967
+ return { $commitTs: null };
14968
+ }
14940
14969
  if (Array.isArray(value)) {
14941
14970
  return value.map((value2, i2) => convexToJsonInternal(value2, originalValue, context + `[${i2}]`, false));
14942
14971
  }
@@ -14985,10 +15014,10 @@ function convexOrUndefinedToJsonInternal(value, originalValue, context) {
14985
15014
  function convexToJson(value) {
14986
15015
  return convexToJsonInternal(value, value, "", false);
14987
15016
  }
14988
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/server/functionName.js
15017
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/server/functionName.js
14989
15018
  var functionName = Symbol.for("functionName");
14990
15019
 
14991
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/server/components/paths.js
15020
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/server/components/paths.js
14992
15021
  var toReferencePath = Symbol.for("toReferencePath");
14993
15022
  function extractReferencePath(reference) {
14994
15023
  return reference[toReferencePath] ?? null;
@@ -15016,7 +15045,7 @@ function getFunctionAddress(functionReference) {
15016
15045
  return functionAddress;
15017
15046
  }
15018
15047
 
15019
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/server/api.js
15048
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/server/api.js
15020
15049
  function getFunctionName(functionReference) {
15021
15050
  const address = getFunctionAddress(functionReference);
15022
15051
  if (address.name === undefined) {
@@ -15063,10 +15092,10 @@ function createApi(pathParts = []) {
15063
15092
  return new Proxy({}, handler);
15064
15093
  }
15065
15094
  var anyApi = createApi();
15066
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/index.js
15067
- var version2 = "1.42.1";
15095
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/index.js
15096
+ var version2 = "1.43.0";
15068
15097
 
15069
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/values/errors.js
15098
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/values/errors.js
15070
15099
  var __defProp2 = Object.defineProperty;
15071
15100
  var __defNormalProp = (obj, key, value) => (key in obj) ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15072
15101
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -15084,7 +15113,7 @@ class ConvexError extends (_b = Error, _a3 = IDENTIFYING_FIELD, _b) {
15084
15113
  }
15085
15114
  }
15086
15115
 
15087
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/server/components/index.js
15116
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/server/components/index.js
15088
15117
  function createChildComponents(root, pathParts) {
15089
15118
  const handler = {
15090
15119
  get(_, prop) {
@@ -15114,13 +15143,14 @@ var KDS_DEVICE_AUTH_CLIENT_ID = "kds-cli";
15114
15143
  var PAGE_MODES = ["themed", "raw"];
15115
15144
  var PAGE_VISIBILITIES = ["public", "private"];
15116
15145
  var MAX_PAGE_HTML_BYTES = 4000000;
15146
+ var MAX_PROJECT_REPO_LENGTH = 200;
15117
15147
 
15118
15148
  // src/commands/auth/login.ts
15119
15149
  import open from "open";
15120
- // ../../node_modules/.bun/@convex-dev+better-auth@0.12.1+7592867d216cc73d/node_modules/@convex-dev/better-auth/dist/version.js
15150
+ // ../../node_modules/.bun/@convex-dev+better-auth@0.12.1+2116c7faeda40f52/node_modules/@convex-dev/better-auth/dist/version.js
15121
15151
  var VERSION = "0.12.1";
15122
15152
 
15123
- // ../../node_modules/.bun/@convex-dev+better-auth@0.12.1+7592867d216cc73d/node_modules/@convex-dev/better-auth/dist/plugins/convex/client.js
15153
+ // ../../node_modules/.bun/@convex-dev+better-auth@0.12.1+2116c7faeda40f52/node_modules/@convex-dev/better-auth/dist/plugins/convex/client.js
15124
15154
  var convexClient = () => {
15125
15155
  return {
15126
15156
  id: "convex",
@@ -15312,7 +15342,7 @@ var BetterAuthError = class extends Error {
15312
15342
  }
15313
15343
  };
15314
15344
 
15315
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/utils/url.mjs
15345
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/utils/url.mjs
15316
15346
  var SLASH_CHAR_CODE = 47;
15317
15347
  function trimTrailingSlashes(value) {
15318
15348
  let end = value.length;
@@ -15402,13 +15432,13 @@ function getOrigin(url2) {
15402
15432
  return null;
15403
15433
  }
15404
15434
  }
15405
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/package.mjs
15435
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/package.mjs
15406
15436
  var version3 = "1.6.23";
15407
15437
 
15408
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/version.mjs
15438
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/version.mjs
15409
15439
  var PACKAGE_VERSION = version3;
15410
15440
 
15411
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/broadcast-channel.mjs
15441
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/broadcast-channel.mjs
15412
15442
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
15413
15443
  var now = () => Math.floor(Date.now() / 1000);
15414
15444
  var WindowBroadcastChannel = class {
@@ -15642,7 +15672,7 @@ var onMount = ($store, initialize) => {
15642
15672
  };
15643
15673
  });
15644
15674
  };
15645
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/equality.mjs
15675
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/equality.mjs
15646
15676
  function isPlainObject2(value) {
15647
15677
  if (typeof value !== "object" || value === null)
15648
15678
  return false;
@@ -15679,7 +15709,7 @@ function withEquality(store, isEqual) {
15679
15709
  });
15680
15710
  }
15681
15711
 
15682
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/focus-manager.mjs
15712
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/focus-manager.mjs
15683
15713
  var kFocusManager = Symbol.for("better-auth:focus-manager");
15684
15714
  var WindowFocusManager = class {
15685
15715
  listeners = /* @__PURE__ */ new Set;
@@ -15711,7 +15741,7 @@ function getGlobalFocusManager() {
15711
15741
  return globalThis[kFocusManager];
15712
15742
  }
15713
15743
 
15714
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/online-manager.mjs
15744
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/online-manager.mjs
15715
15745
  var kOnlineManager = Symbol.for("better-auth:online-manager");
15716
15746
  var WindowOnlineManager = class {
15717
15747
  listeners = /* @__PURE__ */ new Set;
@@ -15745,7 +15775,7 @@ function getGlobalOnlineManager() {
15745
15775
  return globalThis[kOnlineManager];
15746
15776
  }
15747
15777
 
15748
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/parser.mjs
15778
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/parser.mjs
15749
15779
  var PROTO_POLLUTION_PATTERNS = {
15750
15780
  proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
15751
15781
  constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
@@ -15823,7 +15853,7 @@ function parseJSON(value, options = { strict: true }) {
15823
15853
  return betterJSONParse(value, options);
15824
15854
  }
15825
15855
 
15826
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/session-refresh.mjs
15856
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/session-refresh.mjs
15827
15857
  var now2 = () => Math.floor(Date.now() / 1000);
15828
15858
  var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
15829
15859
  function createSessionRefreshManager(opts) {
@@ -15971,7 +16001,7 @@ function isSafeUrlScheme(value) {
15971
16001
  return !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);
15972
16002
  }
15973
16003
 
15974
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/fetch-plugins.mjs
16004
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/fetch-plugins.mjs
15975
16005
  var redirectPlugin = {
15976
16006
  id: "redirect",
15977
16007
  name: "Redirect",
@@ -15987,7 +16017,7 @@ var redirectPlugin = {
15987
16017
  } }
15988
16018
  };
15989
16019
 
15990
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/session-atom.mjs
16020
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/session-atom.mjs
15991
16021
  var isServer = () => typeof window === "undefined";
15992
16022
  function normalizeSessionResponse(res) {
15993
16023
  if (typeof res === "object" && res !== null && "data" in res && "error" in res)
@@ -16828,7 +16858,7 @@ var betterFetch = async (url2, options) => {
16828
16858
  };
16829
16859
  };
16830
16860
 
16831
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/config.mjs
16861
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/config.mjs
16832
16862
  var resolvePublicAuthUrl = (basePath) => {
16833
16863
  if (typeof process === "undefined")
16834
16864
  return;
@@ -16938,7 +16968,7 @@ var getClientConfig = (options, loadEnv) => {
16938
16968
  };
16939
16969
  };
16940
16970
 
16941
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/utils/is-atom.mjs
16971
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/utils/is-atom.mjs
16942
16972
  function isAtom(value) {
16943
16973
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
16944
16974
  }
@@ -16956,7 +16986,7 @@ function toKebabCase(input) {
16956
16986
  return splitWords(input).map((word) => word.toLowerCase()).join("-");
16957
16987
  }
16958
16988
 
16959
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/proxy.mjs
16989
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/proxy.mjs
16960
16990
  function getMethod2(path, knownPathMethods, args) {
16961
16991
  const method = knownPathMethods[path];
16962
16992
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -17038,7 +17068,7 @@ function createDynamicPathProxy(routes, client3, knownPathMethods, atoms, atomLi
17038
17068
  return createProxy();
17039
17069
  }
17040
17070
 
17041
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/client/vanilla.mjs
17071
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/client/vanilla.mjs
17042
17072
  function createAuthClient(options) {
17043
17073
  const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
17044
17074
  const resolvedHooks = {};
@@ -17051,7 +17081,7 @@ function createAuthClient(options) {
17051
17081
  $store
17052
17082
  }, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
17053
17083
  }
17054
- // ../../node_modules/.bun/better-auth@1.6.23+7367520ea0616224/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
17084
+ // ../../node_modules/.bun/better-auth@1.6.23+2c138958c46c0bcd/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
17055
17085
  var deviceAuthorizationClient = () => {
17056
17086
  return {
17057
17087
  id: "device-authorization",
@@ -17133,7 +17163,7 @@ var revokeCliSession = async (config2) => {
17133
17163
  throw new Error("The auth server did not confirm sign out");
17134
17164
  await saveConfig({ ...config2, sessionToken: undefined });
17135
17165
  };
17136
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/browser/logging.js
17166
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/browser/logging.js
17137
17167
  var __defProp4 = Object.defineProperty;
17138
17168
  var __defNormalProp3 = (obj, key, value) => (key in obj) ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17139
17169
  var __publicField2 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -17239,7 +17269,7 @@ function logForFunction(logger2, type, source, udfPath, message) {
17239
17269
  }
17240
17270
  }
17241
17271
 
17242
- // ../../node_modules/.bun/convex@1.42.1+e14d3f224186685e/node_modules/convex/dist/esm/browser/http_client.js
17272
+ // ../../node_modules/.bun/convex@1.43.0+e14d3f224186685e/node_modules/convex/dist/esm/browser/http_client.js
17243
17273
  var __defProp5 = Object.defineProperty;
17244
17274
  var __defNormalProp4 = (obj, key, value) => (key in obj) ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17245
17275
  var __publicField3 = (obj, key, value) => __defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -17984,6 +18014,76 @@ var pages = group({
17984
18014
  commands: [create, list, get, update, versions2, revert, remove]
17985
18015
  });
17986
18016
 
18017
+ // ../../packages/backend/convex/lib/projectRepo.ts
18018
+ var DEFAULT_REPO_HOST = "github.com";
18019
+ var REPO_FORMAT_ERROR = "Enter a repository like github.com/owner/name.";
18020
+ var HOST_PATTERN = /^[a-z0-9][a-z0-9.-]*\.[a-z]{2,}$/;
18021
+ var SEGMENT_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
18022
+ var normalizeProjectRepo = (value) => {
18023
+ const trimmed = value?.trim();
18024
+ if (!trimmed)
18025
+ return;
18026
+ if (trimmed.length > MAX_PROJECT_REPO_LENGTH) {
18027
+ throw new ConvexError(`Repository must be ${MAX_PROJECT_REPO_LENGTH} characters or fewer.`);
18028
+ }
18029
+ const path = trimmed.toLowerCase().replace(/^(https?|ssh|git):\/\//, "").replace(/^[^/@:]+@/, "").replace(":", "/").replace(/\/+$/, "").replace(/\.git$/, "");
18030
+ const segments = path.split("/");
18031
+ const [host, owner, name] = segments.length === 2 ? [DEFAULT_REPO_HOST, ...segments] : segments.length === 3 ? segments : [];
18032
+ if (!host || !owner || !name)
18033
+ throw new ConvexError(REPO_FORMAT_ERROR);
18034
+ if (!HOST_PATTERN.test(host) || !SEGMENT_PATTERN.test(owner) || !SEGMENT_PATTERN.test(name)) {
18035
+ throw new ConvexError(REPO_FORMAT_ERROR);
18036
+ }
18037
+ const key = `${host}/${owner}/${name}`;
18038
+ if (key.length > MAX_PROJECT_REPO_LENGTH) {
18039
+ throw new ConvexError(`Repository must be ${MAX_PROJECT_REPO_LENGTH} characters or fewer.`);
18040
+ }
18041
+ return key;
18042
+ };
18043
+ var tryNormalizeProjectRepo = (value) => {
18044
+ try {
18045
+ return normalizeProjectRepo(value);
18046
+ } catch {
18047
+ return;
18048
+ }
18049
+ };
18050
+
18051
+ // src/lib/repo.ts
18052
+ var currentRepoKey = async () => {
18053
+ const proc = Bun.spawn(["git", "remote", "get-url", "origin"], { stdout: "pipe", stderr: "ignore" });
18054
+ const url2 = await new Response(proc.stdout).text();
18055
+ return await proc.exited === 0 ? tryNormalizeProjectRepo(url2) : undefined;
18056
+ };
18057
+
18058
+ // src/commands/project.ts
18059
+ var project = command({
18060
+ name: "project",
18061
+ description: "Show the project connected to this checkout's repository",
18062
+ options: {
18063
+ repo: exports_external.string().optional().describe("Resolve this repository instead of the checkout's origin remote"),
18064
+ json: exports_external.boolean().default(false).describe("Print as JSON")
18065
+ },
18066
+ run: async ({ options: { repo: repoOption, json: json2 } }) => {
18067
+ const repo = repoOption ?? await currentRepoKey();
18068
+ if (!repo) {
18069
+ throw new Error("No repository here: not a git checkout with an origin remote. Pass --repo <owner/name>.");
18070
+ }
18071
+ const found = await (await backendClient()).query(api2.projects.findByRepo, { repo });
18072
+ if (!found)
18073
+ throw new Error(`No project is connected to ${repo}. Connect one on the project in the dashboard.`);
18074
+ if (json2)
18075
+ return console.log(JSON.stringify(found, null, 2));
18076
+ console.log(found.name);
18077
+ if (found.summary)
18078
+ console.log(found.summary);
18079
+ console.log(`Repo: ${found.repo}`);
18080
+ console.log(`Status: ${found.status}${found.health ? ` \xB7 Health: ${found.health}` : ""}`);
18081
+ console.log(`Progress: ${found.progress.done}/${found.progress.total} issues done`);
18082
+ if (found.targetDate)
18083
+ console.log(`Target date: ${found.targetDate}`);
18084
+ }
18085
+ });
18086
+
17987
18087
  // src/commands/upgrade.ts
17988
18088
  var upgrade = command({
17989
18089
  name: "upgrade",
@@ -17999,7 +18099,7 @@ var upgrade = command({
17999
18099
  var rootCommand = group({
18000
18100
  name: "kds",
18001
18101
  description: "KDS CLI",
18002
- commands: [auth, pages, upgrade],
18102
+ commands: [auth, pages, project, upgrade],
18003
18103
  options: {
18004
18104
  version: exports_external.boolean().default(false).describe("Show the version").meta({ short: "v" })
18005
18105
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islamihab/kds",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Command-line client for Kai Dev Studio",
5
5
  "license": "MIT",
6
6
  "publishConfig": {