@sunasteriskrnd/takumi 1.0.0-dev.59 → 1.0.0-dev.60

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/dist/index.js +77 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19815,7 +19815,7 @@ var package_default;
19815
19815
  var init_package = __esm(() => {
19816
19816
  package_default = {
19817
19817
  name: "@sunasteriskrnd/takumi",
19818
- version: "1.0.0-dev.59",
19818
+ version: "1.0.0-dev.60",
19819
19819
  description: "CLI tool for bootstrapping and managing Takumi projects",
19820
19820
  type: "module",
19821
19821
  repository: {
@@ -20012,7 +20012,7 @@ function getLegacyManifestPath(providerRoot) {
20012
20012
  return join4(providerRoot, LEGACY_MANIFEST_FILENAME);
20013
20013
  }
20014
20014
  function getCliVersion() {
20015
- return "1.0.0-dev.59"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20015
+ return "1.0.0-dev.60"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20016
20016
  }
20017
20017
  function getCliUserAgent() {
20018
20018
  return `${TAKUMI_CLI_NPM_PACKAGE_NAME}/${getCliVersion()}`;
@@ -78823,6 +78823,25 @@ async function hooksCommand(subcommand, options2 = {}) {
78823
78823
  usage();
78824
78824
  process.exitCode = 1;
78825
78825
  }
78826
+ // src/commands/init/init-command.ts
78827
+ init_auth_client();
78828
+
78829
+ // src/domains/auth/kit-auth-preflight.ts
78830
+ init_auth_client();
78831
+ function needsKitAuth(options2) {
78832
+ if (options2.kitPath || options2.archive || options2.local)
78833
+ return false;
78834
+ if (options2.useGh || options2.useGit)
78835
+ return false;
78836
+ return true;
78837
+ }
78838
+ async function preflightKitAuth(options2 = {}) {
78839
+ if (!needsKitAuth(options2))
78840
+ return;
78841
+ const ensure = options2.ensureAuthenticatedFn ?? ensureAuthenticated;
78842
+ await ensure({ nonInteractive: options2.nonInteractive ?? false });
78843
+ }
78844
+
78826
78845
  // src/commands/init/init-command.ts
78827
78846
  init_registry();
78828
78847
  init_skill_prune();
@@ -80019,6 +80038,7 @@ async function readKitMinCliVersion(extractDir) {
80019
80038
 
80020
80039
  // src/commands/init/init-command.ts
80021
80040
  init_manifest();
80041
+ init_environment();
80022
80042
  init_logger();
80023
80043
  init_process_lock();
80024
80044
  init_types2();
@@ -87039,8 +87059,16 @@ async function resolveKitSkillGroupIntent(ctx, targetAgents2 = ["claude-code"])
87039
87059
  skillSelectionExplicitThisRun: explicit
87040
87060
  };
87041
87061
  }
87042
- async function executeInit(options2, prompts) {
87062
+ async function executeInit(options2, prompts, deps) {
87043
87063
  let ctx = createInitContext(options2, prompts);
87064
+ await (deps?.preflightKitAuthFn ?? preflightKitAuth)({
87065
+ kitPath: options2.kitPath,
87066
+ archive: options2.archive,
87067
+ local: options2.local,
87068
+ useGh: options2.useGh,
87069
+ useGit: options2.useGit,
87070
+ nonInteractive: options2.yes || isNonInteractive()
87071
+ });
87044
87072
  ctx = await resolveOptions(ctx);
87045
87073
  if (ctx.cancelled)
87046
87074
  return;
@@ -87206,18 +87234,23 @@ ${errorLines.join(`
87206
87234
  prompts.note(`${installedLine}
87207
87235
  ${protectedLine}`, "Initialization complete");
87208
87236
  }
87209
- async function initCommand(options2) {
87237
+ async function initCommand(options2, deps) {
87210
87238
  const prompts = new PromptsManager;
87211
87239
  prompts.intro("Initialize/Update Project");
87212
87240
  try {
87213
87241
  await withProcessLock("kit-install", async () => {
87214
- await executeInit(options2, prompts);
87242
+ await executeInit(options2, prompts, deps);
87215
87243
  });
87216
87244
  } catch (error) {
87217
87245
  if (error instanceof Error && error.message === "Merge cancelled by user") {
87218
87246
  logger.warning("Update cancelled");
87219
87247
  return;
87220
87248
  }
87249
+ if (error instanceof NotLoggedInError) {
87250
+ logger.error(error.message);
87251
+ process.exitCode = 1;
87252
+ return;
87253
+ }
87221
87254
  logger.error(error instanceof Error ? error.message : "Unknown error occurred");
87222
87255
  process.exitCode = 1;
87223
87256
  throw error;
@@ -90749,14 +90782,16 @@ ${import_picocolors31.default.yellow("User modifications will be permanently del
90749
90782
  }
90750
90783
  }
90751
90784
  // src/commands/update-cli.ts
90752
- init_takumi_config_manager();
90753
- init_npm_registry();
90785
+ init_auth_client();
90754
90786
  import { exec as exec8, spawn as spawn5 } from "node:child_process";
90755
90787
  import { promisify as promisify14 } from "node:util";
90788
+ init_takumi_config_manager();
90789
+ init_npm_registry();
90756
90790
  init_metadata_migration();
90757
90791
  init_version_utils();
90758
90792
  init_manifest_path_resolver();
90759
90793
  init_takumi_scanner();
90794
+ init_environment();
90760
90795
  init_logger();
90761
90796
  init_safe_prompts();
90762
90797
  init_takumi_constants();
@@ -90906,6 +90941,17 @@ async function promptKitUpdate(beta, yes, deps) {
90906
90941
  if (selection.kit && kitVersion) {
90907
90942
  logger.info(`Current kit version: ${selection.kit}@${kitVersion}`);
90908
90943
  }
90944
+ try {
90945
+ await (deps?.preflightAuthFn ?? preflightKitAuth)({
90946
+ nonInteractive: yes === true || isNonInteractive()
90947
+ });
90948
+ } catch (error) {
90949
+ if (error instanceof NotLoggedInError) {
90950
+ logger.warning("Skipping kit content update — not logged in. Run `tkm auth login`, then `tkm update`.");
90951
+ return;
90952
+ }
90953
+ throw error;
90954
+ }
90909
90955
  let alreadyAtLatest = false;
90910
90956
  if (yes && selection.kit && kitVersion) {
90911
90957
  const getTagFn = deps?.getLatestReleaseTagFn ?? fetchLatestReleaseTag;
@@ -91177,6 +91223,7 @@ Manual update: ${redactCommandForLog(updateCmd)}`;
91177
91223
  // src/commands/version.ts
91178
91224
  init_auth_client();
91179
91225
  init_github_client();
91226
+ init_environment();
91180
91227
  init_logger();
91181
91228
  init_types2();
91182
91229
  var import_picocolors32 = __toESM(require_picocolors(), 1);
@@ -91230,33 +91277,52 @@ async function fetchReleasesForKit(kitType, options2) {
91230
91277
  const entries = await worker.fetchReleaseList(options2.includePrereleases);
91231
91278
  return entries.slice(0, options2.limit);
91232
91279
  }
91233
- async function versionCommand(options2) {
91280
+ async function versionCommand(options2, deps) {
91234
91281
  const prompts2 = new PromptsManager;
91235
91282
  prompts2.intro("\uD83D\uDCE6 Takumi - Available Versions");
91236
91283
  try {
91237
91284
  const validOptions = VersionCommandOptionsSchema.parse(options2);
91285
+ try {
91286
+ await (deps?.preflightKitAuthFn ?? preflightKitAuth)({
91287
+ useGh: validOptions.useGh,
91288
+ nonInteractive: isNonInteractive()
91289
+ });
91290
+ } catch (error) {
91291
+ if (error instanceof NotLoggedInError) {
91292
+ prompts2.errorOutro(error.message);
91293
+ process.exitCode = 1;
91294
+ return;
91295
+ }
91296
+ throw error;
91297
+ }
91238
91298
  const kitsToFetch = validOptions.kit ? [validOptions.kit] : Object.keys(AVAILABLE_KITS);
91239
91299
  const limit = validOptions.limit || 30;
91240
91300
  const includePrereleases = !!validOptions.all;
91241
91301
  const releasePromises = kitsToFetch.map(async (kitType) => {
91242
91302
  const kitConfig = AVAILABLE_KITS[kitType];
91243
91303
  try {
91244
- const releases = await fetchReleasesForKit(kitType, {
91304
+ const releases = await (deps?.fetchReleasesForKitFn ?? fetchReleasesForKit)(kitType, {
91245
91305
  includePrereleases,
91246
91306
  limit,
91247
91307
  useGh: validOptions.useGh
91248
91308
  });
91249
- return { kitType, kitConfig, releases, error: null };
91309
+ return { kitType, kitConfig, releases, error: null, authFailed: false };
91250
91310
  } catch (error) {
91251
91311
  return {
91252
91312
  kitType,
91253
91313
  kitConfig,
91254
91314
  releases: [],
91255
- error: error instanceof Error ? error.message : "Unknown error"
91315
+ error: error instanceof Error ? error.message : "Unknown error",
91316
+ authFailed: error instanceof NotLoggedInError
91256
91317
  };
91257
91318
  }
91258
91319
  });
91259
91320
  const results = await Promise.all(releasePromises);
91321
+ if (results.some((result) => result.authFailed)) {
91322
+ prompts2.errorOutro(new NotLoggedInError().message);
91323
+ process.exitCode = 1;
91324
+ return;
91325
+ }
91260
91326
  for (const result of results) {
91261
91327
  if (result.error) {
91262
91328
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunasteriskrnd/takumi",
3
- "version": "1.0.0-dev.59",
3
+ "version": "1.0.0-dev.60",
4
4
  "description": "CLI tool for bootstrapping and managing Takumi projects",
5
5
  "type": "module",
6
6
  "repository": {