gh-manager-cli 1.19.2 → 1.20.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.20.0](https://github.com/wiiiimm/gh-manager-cli/compare/v1.19.2...v1.20.0) (2025-09-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * add repository rename functionality ([#23](https://github.com/wiiiimm/gh-manager-cli/issues/23)) ([4f25a7d](https://github.com/wiiiimm/gh-manager-cli/commit/4f25a7d080f678a91f846dddf78734d02fa69b91))
7
+
1
8
  ## [1.19.2](https://github.com/wiiiimm/gh-manager-cli/compare/v1.19.1...v1.19.2) (2025-09-03)
2
9
 
3
10
 
package/README.md CHANGED
@@ -407,7 +407,7 @@ APOLLO_TTL_MS=1800000 npx gh-manager-cli
407
407
  GH_MANAGER_DEBUG=1 npx gh-manager-cli
408
408
 
409
409
  # Combine multiple environment variables
410
- REPOS_PER_FETCH=5 GH_MANAGER_DEBUG=1 npx gh-manager-cli-cli
410
+ REPOS_PER_FETCH=5 GH_MANAGER_DEBUG=1 npx gh-manager-cli
411
411
  ```
412
412
 
413
413
  ## Troubleshooting
@@ -1211,6 +1211,54 @@ async function updateCacheWithRepository(token, repository) {
1211
1211
  } catch {
1212
1212
  }
1213
1213
  }
1214
+ async function updateCacheAfterRename(token, repositoryId, newName, nameWithOwner) {
1215
+ try {
1216
+ const ap = await makeApolloClient(token);
1217
+ if (!ap || !ap.client) return;
1218
+ ap.client.cache.modify({
1219
+ id: `Repository:${repositoryId}`,
1220
+ fields: {
1221
+ name: () => newName,
1222
+ nameWithOwner: () => nameWithOwner
1223
+ }
1224
+ });
1225
+ } catch {
1226
+ }
1227
+ }
1228
+ async function renameRepositoryById(client, repositoryId, newName) {
1229
+ logger.info("Renaming repository", {
1230
+ repositoryId,
1231
+ newName
1232
+ });
1233
+ const mutation = (
1234
+ /* GraphQL */
1235
+ `
1236
+ mutation RenameRepo($repositoryId: ID!, $name: String!) {
1237
+ updateRepository(input: { repositoryId: $repositoryId, name: $name }) {
1238
+ repository {
1239
+ id
1240
+ name
1241
+ nameWithOwner
1242
+ }
1243
+ }
1244
+ }
1245
+ `
1246
+ );
1247
+ try {
1248
+ const result = await client(mutation, { repositoryId, name: newName });
1249
+ logger.info("Repository renamed successfully", {
1250
+ repositoryId,
1251
+ newName: result?.updateRepository?.repository?.name
1252
+ });
1253
+ } catch (error) {
1254
+ logger.error("Failed to rename repository", {
1255
+ repositoryId,
1256
+ newName,
1257
+ error: error.message
1258
+ });
1259
+ throw error;
1260
+ }
1261
+ }
1214
1262
  async function inspectCacheStatus() {
1215
1263
  try {
1216
1264
  const fs3 = await import("fs");
@@ -1279,5 +1327,7 @@ export {
1279
1327
  updateCacheAfterArchive,
1280
1328
  updateCacheAfterVisibilityChange,
1281
1329
  updateCacheWithRepository,
1330
+ updateCacheAfterRename,
1331
+ renameRepositoryById,
1282
1332
  inspectCacheStatus
1283
1333
  };
@@ -13,14 +13,16 @@ import {
13
13
  inspectCacheStatus,
14
14
  makeClient,
15
15
  purgeApolloCacheFiles,
16
+ renameRepositoryById,
16
17
  searchRepositoriesUnified,
17
18
  syncForkWithUpstream,
18
19
  unarchiveRepositoryById,
19
20
  updateCacheAfterArchive,
20
21
  updateCacheAfterDelete,
22
+ updateCacheAfterRename,
21
23
  updateCacheAfterVisibilityChange,
22
24
  updateCacheWithRepository
23
- } from "./chunk-FPJS7YJW.js";
25
+ } from "./chunk-RI2B33OX.js";
24
26
  export {
25
27
  archiveRepositoryById,
26
28
  changeRepositoryVisibility,
@@ -35,11 +37,13 @@ export {
35
37
  inspectCacheStatus,
36
38
  makeClient,
37
39
  purgeApolloCacheFiles,
40
+ renameRepositoryById,
38
41
  searchRepositoriesUnified,
39
42
  syncForkWithUpstream,
40
43
  unarchiveRepositoryById,
41
44
  updateCacheAfterArchive,
42
45
  updateCacheAfterDelete,
46
+ updateCacheAfterRename,
43
47
  updateCacheAfterVisibilityChange,
44
48
  updateCacheWithRepository
45
49
  };