@uniquedivine/tg-sai 0.0.3 → 0.0.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 (3) hide show
  1. package/health.ts +1 -1
  2. package/main.ts +18 -6
  3. package/package.json +1 -1
package/health.ts CHANGED
@@ -297,7 +297,7 @@ function checkPassword(
297
297
  profile: TgSaiProfile | null,
298
298
  ): void {
299
299
  if (env.TELEGRAM_PASSWORD || profile?.password) {
300
- info(collector, "password_status: present")
300
+ good(collector, "password_status: present")
301
301
  return
302
302
  }
303
303
  warning(
package/main.ts CHANGED
@@ -334,7 +334,7 @@ function printAudit(input: ChatAuditInput) {
334
334
  console.log(
335
335
  `target_can_receive_ownership: ${audit.targetCanReceiveOwnership}`,
336
336
  )
337
- console.log(`proposed_actions: ${audit.proposedActions.join("; ")}`)
337
+ console.log(`proposed_actions: ${formatActionList(audit.proposedActions)}`)
338
338
  }
339
339
 
340
340
  function shouldRunAction(
@@ -344,6 +344,10 @@ function shouldRunAction(
344
344
  return proposedActions.includes(action)
345
345
  }
346
346
 
347
+ function formatActionList(actions: ProposedAction[]): string {
348
+ return JSON.stringify(actions)
349
+ }
350
+
347
351
  async function withClient<T>(
348
352
  profileName: string | undefined,
349
353
  fn: (
@@ -404,7 +408,9 @@ async function runAddBot(options: AddBotOptions): Promise<void> {
404
408
  console.log(`target_peer: ${options.targetPeer}`)
405
409
  console.log(`actor_role: ${beforePlan.actorRole}`)
406
410
  console.log(`target_role_before: ${beforePlan.targetRole}`)
407
- console.log(`proposed_actions: ${beforePlan.proposedActions.join("; ")}`)
411
+ console.log(
412
+ `proposed_actions: ${formatActionList(beforePlan.proposedActions)}`,
413
+ )
408
414
 
409
415
  if (options.run !== true) {
410
416
  console.log("dry_run: pass --run to add/promote the bot")
@@ -451,7 +457,9 @@ async function runAddBot(options: AddBotOptions): Promise<void> {
451
457
 
452
458
  console.log(`target_role_after: ${afterPlan.targetRole}`)
453
459
  console.log(`target_is_admin_after: ${afterPlan.targetIsAdmin}`)
454
- console.log(`remaining_actions: ${afterPlan.proposedActions.join("; ")}`)
460
+ console.log(
461
+ `remaining_actions: ${formatActionList(afterPlan.proposedActions)}`,
462
+ )
455
463
  })
456
464
  }
457
465
 
@@ -472,7 +480,9 @@ async function runAddOwner(options: AddOwnerOptions): Promise<void> {
472
480
  console.log(
473
481
  `target_can_receive_ownership_before: ${beforePlan.targetCanReceiveOwnership}`,
474
482
  )
475
- console.log(`proposed_actions: ${beforePlan.proposedActions.join("; ")}`)
483
+ console.log(
484
+ `proposed_actions: ${formatActionList(beforePlan.proposedActions)}`,
485
+ )
476
486
 
477
487
  if (options.run !== true) {
478
488
  console.log("dry_run: pass --run to add/promote the target user")
@@ -522,7 +532,9 @@ async function runAddOwner(options: AddOwnerOptions): Promise<void> {
522
532
  console.log(
523
533
  `target_can_receive_ownership_after: ${afterPlan.targetCanReceiveOwnership}`,
524
534
  )
525
- console.log(`remaining_actions: ${afterPlan.proposedActions.join("; ")}`)
535
+ console.log(
536
+ `remaining_actions: ${formatActionList(afterPlan.proposedActions)}`,
537
+ )
526
538
 
527
539
  if (!afterPlan.actorCanTransferOwnership) {
528
540
  console.log("ownership_transfer: skipped_actor_not_owner")
@@ -1131,7 +1143,7 @@ export function createProgram(): Command {
1131
1143
  program
1132
1144
  .name("tg-sai")
1133
1145
  .description("Audit and manage Sai Telegram chat admin state")
1134
- .version(packageJson.version)
1146
+ .version(packageJson.version, "--version", "output the version number")
1135
1147
  .helpOption("--help", "display help for command")
1136
1148
 
1137
1149
  program.action(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniquedivine/tg-sai",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Sai Telegram admin audit and bootstrap CLI",