Skip to content

Latest commit

 

History

History
365 lines (276 loc) · 13 KB

File metadata and controls

365 lines (276 loc) · 13 KB

Bitsocial-CLI Renaming Guide

This document provides a comprehensive checklist for renaming the plebbit-cli codebase:

  • plebbit-clibitsocial-cli
  • plebbit (command) → bitsocial (command)
  • subplebbitcommunity

Note: plebbit-js has been rebranded to pkc-js (@pkcprotocol/pkc-js). All imports, class names, and API calls have been updated (PKC, createCommunity, getCommunity, etc.).

Summary Statistics

  • Total "plebbit" occurrences: ~739 across 38 files
  • Total "subplebbit" occurrences: ~187 across 26 files
  • Source files: 14 TypeScript files in src/
  • Test files: 9 test files
  • CI/Build files: 3 files in ci-bin/

Phase 1: Package Configuration & Project Files

1.1 Package Identity

  • package.json - Rename package
    • Line 2: "name": "plebbit-cli""name": "bitsocial-cli"
    • Line 4: "description": "Command line interface to Plebbit API""description": "Command line interface to BitSocial API"
    • Line 6: "homepage": "https://github.com/plebbit/plebbit-cli""homepage": "https://github.com/bitsocialhq/bitsocial-cli"
    • Line 7: "repository": "git@github.com:plebbit/plebbit-cli.git""repository": "git@github.com:bitsocialhq/bitsocial-cli.git"
    • Line 41: "plebbit": "./bin/run""bitsocial": "./bin/run"

1.2 Oclif Configuration (package.json)

  • package.json oclif section
    • Line 45: "bin": "plebbit""bin": "bitsocial"
    • Line 46: "dirname": "plebbit""dirname": "bitsocial"
    • Lines 54-59: Update topics (remove subplebbit:role topic as it has no commands)
      "topics": {
          "community": {
              "description": "Access and manage your communities"
          }
      }

1.3 External Dependencies

  • package.json dependencies - SKIPPED (plebbit-js not yet rebranded)
    • "@plebbit/plebbit-js": "..." remains unchanged

1.4 Oclif Manifest

  • oclif.manifest.json - This file is auto-generated by oclif manifest command
    • Regenerated after source code changes

Phase 2: Directory Structure Renaming

2.1 Source Directories

  • src/cli/commands/subplebbit/src/cli/commands/community/

2.2 Test Directories

  • Test files remain in test/cli/ but have been renamed (see Phase 9)

2.3 Data Storage Directories (Runtime)

  • Default data path: .plebbit.bitsocial (handled via env-paths)
  • IPFS directory: .ipfs-plebbit-cli.ipfs-bitsocial-cli
  • Note: Automatic migration skipped (Phase 13)

2.4 Gitignore Updates

  • .gitignore Line 110-111:
    • # Plebbit data directory# BitSocial data directory
    • .plebbit/.bitsocial/ (also kept .plebbit/ for compatibility)

Phase 3: Source File Renaming

3.1 Command Files

  • src/cli/commands/subplebbit/create.tssrc/cli/commands/community/create.ts
  • src/cli/commands/subplebbit/edit.tssrc/cli/commands/community/edit.ts
  • src/cli/commands/subplebbit/get.tssrc/cli/commands/community/get.ts
  • src/cli/commands/subplebbit/list.tssrc/cli/commands/community/list.ts
  • src/cli/commands/subplebbit/start.tssrc/cli/commands/community/start.ts
  • src/cli/commands/subplebbit/stop.tssrc/cli/commands/community/stop.ts

3.2 Type Files

  • src/cli/types.ts - SKIPPED (plebbit-js types unchanged)

3.3 Test Type Files

  • test/types/subplebbitTypes.tstest/types/communityTypes.ts

3.4 Test Fixtures

  • test/fixtures/subplebbitForEditFixture.tstest/fixtures/communityForEditFixture.ts

Phase 4: Class, Type & Interface Renaming

4.1 Type Definitions (src/cli/types.ts)

  • SKIPPED - plebbit-js types remain unchanged

4.2 Base Command (src/cli/base-command.ts)

  • SKIPPED - plebbit-js imports remain unchanged
  • Method _connectToPlebbitRpc() remains unchanged (plebbit-js API)

4.3 Test Types (test/types/communityTypes.ts)

  • File renamed but plebbit-js type references remain unchanged

Phase 5: CLI Commands Renaming

5.1 Command Structure

Old command structure:

plebbit daemon
plebbit subplebbit create
plebbit subplebbit edit
plebbit subplebbit get
plebbit subplebbit list
plebbit subplebbit start
plebbit subplebbit stop

New command structure:

bitsocial daemon
bitsocial community create
bitsocial community edit
bitsocial community get
bitsocial community list
bitsocial community start
bitsocial community stop

5.2 Command File Updates

src/cli/commands/daemon.ts:

  • Update description: "Run a network-connected Plebbit node...""Run a network-connected BitSocial node..."
  • Update examples: "plebbit daemon""bitsocial daemon"
  • Update config path reference: .ipfs-plebbit-cli/config.ipfs-bitsocial-cli/config
  • Update output: "Subplebbits in data path""Communities in data path"
  • Update output: "Plebbit data path""BitSocial data path"

src/cli/commands/community/create.ts:

  • Update description: "Create a subplebbit...""Create a community..."
  • Update examples
  • Update logger namespace: "plebbit-cli:commands:subplebbit:create""bitsocial-cli:commands:community:create"

src/cli/commands/community/edit.ts:

  • Update description: "Edit a subplebbit...""Edit a community..."
  • Update examples
  • Update logger namespace

src/cli/commands/community/get.ts:

  • Update description and examples
  • Update logger namespace

src/cli/commands/community/list.ts:

  • Update description and examples
  • Update logger namespace

src/cli/commands/community/start.ts:

  • Update description: "Start a subplebbit...""Start a community..."
  • Update examples
  • Update logger namespace

src/cli/commands/community/stop.ts:

  • Update description: "Stop a subplebbit...""Stop a community..."
  • Update examples
  • Update logger namespace

5.3 Hook Files

src/cli/hooks/prerun/parse-dynamic-flags-hook.ts:

  • Update command IDs:
    • "subplebbit:edit""community:edit"
    • "subplebbit:create""community:create"

5.4 Daemon Log File Naming

src/cli/commands/daemon.ts:

  • Update log file prefix check: "plebbit_cli_daemon""bitsocial_cli_daemon"
  • Update log file naming

Phase 6: Environment Variables & Paths

6.1 Defaults (src/common-utils/defaults.ts)

  • envPaths("plebbit", ...)envPaths("bitsocial", ...)
  • Note: Variable names like PLEBBIT_DATA_PATH kept for now (internal only)

6.2 Utility Functions (src/util.ts)

  • .ipfs-plebbit-cli.ipfs-bitsocial-cli

6.3 IPFS Data Path

  • src/ipfs/startIpfs.ts: .plebbit-cli.ipfs.bitsocial-cli.ipfs

Phase 7: Logger Namespaces

7.1 Logger Prefix Changes

  • All logger namespaces updated:
Old Namespace New Namespace
plebbit-cli:daemon bitsocial-cli:daemon
plebbit-cli:daemon:startDaemonServer bitsocial-cli:daemon:startDaemonServer
plebbit-cli:commands:subplebbit:create bitsocial-cli:commands:community:create
plebbit-cli:commands:subplebbit:edit bitsocial-cli:commands:community:edit
plebbit-cli:commands:subplebbit:list bitsocial-cli:commands:community:list
plebbit-cli:commands:subplebbit:start bitsocial-cli:commands:community:start
plebbit-cli:commands:subplebbit:stop bitsocial-cli:commands:community:stop
plebbit-cli:ipfs:startKuboNode bitsocial-cli:ipfs:startKuboNode

7.2 Debug Environment Variable

  • .vscode/launch.json: "DEBUG": "plebbit*""DEBUG": "bitsocial*, plebbit*"
  • src/cli/commands/daemon.ts: Default debug namespace updated to include bitsocial*

Phase 8: Installation Scripts

8.1 Install Script (bin/install.sh)

  • Tarball naming: plebbit_*.tar.gzbitsocial_*.tar.gz
  • GitHub URLs: github.com/plebbit/plebbit-cligithub.com/bitsocialhq/bitsocial-cli
  • Install directory: $HOME/.plebbit_install_files$HOME/.bitsocial_install_files
  • Binary paths and symlinks updated
  • User-facing messages updated

Phase 9: Test Files

9.1 Test File Renaming

  • test/cli/create.subplebbit.test.tstest/cli/create.community.test.ts
  • test/cli/edit.subplebbit.test.tstest/cli/edit.community.test.ts
  • test/cli/get.subplebbit.test.tstest/cli/get.community.test.ts
  • test/cli/list.subplebbit.test.tstest/cli/list.community.test.ts
  • test/cli/start.subplebbit.test.tstest/cli/start.community.test.ts
  • test/cli/stop.subplebbit.test.tstest/cli/stop.community.test.ts

9.2 Test Content Updates

  • Command references updated: plebbit subplebbit createbitsocial community create
  • Import paths updated to new file locations
  • Describe blocks updated

9.3 Test Fixture Files

  • test/fixtures/sub_0_private_key.pemtest/fixtures/community_0_private_key.pem
  • test/fixtures/sub_1_private_key.pemtest/fixtures/community_1_private_key.pem
  • Fixture path references updated in test files

9.4 Daemon Test File

  • test/cli/daemon.test.ts - Updated describe blocks and comments

Phase 10: Documentation

10.1 README.md

  • Project title: plebbit-clibitsocial-cli
  • All command examples: plebbitbitsocial
  • All subplebbit references → community
  • Installation instructions updated
  • GitHub URLs updated
  • Data path examples updated
  • Commands section (auto-generated, will update with npm run generate:readme)

Phase 11: CI/CD & Build

11.1 CI Scripts (ci-bin/)

ci-bin/rename-tarballs-installers.ts:

  • Tarball naming: plebbit_bitsocial_
  • Installer naming: plebbit_installer_bitsocial_installer_

ci-bin/run-daemon-before-release.ts:

  • Logger namespaces updated
  • Function name: spawnPlebbitProcessspawnBitsocialProcess
  • Variable names updated
  • Commands updated: subplebbitcommunity
  • Wait pattern: "Subplebbits in data path""Communities in data path"

11.2 GitHub Workflows (.github/workflows/)

CI.yml:

  • Job name: test-plebbit-cli:test-bitsocial-cli:
  • Debug env: DEBUG="plebbit*"DEBUG="bitsocial*, plebbit*"

Phase 12: External Dependencies

12.1 NPM Packages

  • SKIPPED - plebbit-js not yet rebranded
    • @plebbit/plebbit-js remains unchanged
    • @plebbit/plebbit-logger remains unchanged (imported via plebbit-js)

12.2 WebUI Server (src/webui/daemon-server.ts)

  • Logger namespace updated
  • plebbit-js imports remain unchanged

12.3 IPFS Startup (src/ipfs/startIpfs.ts)

  • Log message: "Applied plebbit CLI defaults...""Applied bitsocial CLI defaults..."
  • Logger namespace updated

Phase 13: Data Migration (Automatic)

  • SKIPPED - Migration code not added per user request
  • Note: Users with existing .plebbit directories will need to manually migrate or the CLI will create new .bitsocial directories

Phase 14: VSCode Configuration

14.1 Launch Configuration (.vscode/launch.json)

  • "DEBUG": "plebbit*""DEBUG": "bitsocial*, plebbit*"

Progress Tracking

Phase Status Notes
Phase 1: Package Config [x] Complete
Phase 2: Directory Structure [x] Complete
Phase 3: Source Files [x] Complete
Phase 4: Classes & Types [ ] Skipped plebbit-js not rebranded
Phase 5: CLI Commands [x] Complete
Phase 6: Environment Variables [x] Complete
Phase 7: Logger Namespaces [x] Complete
Phase 8: Installation Scripts [x] Complete
Phase 9: Test Files [x] Complete
Phase 10: Documentation [x] Complete
Phase 11: CI/CD & Build [x] Complete
Phase 12: External Dependencies [ ] Skipped plebbit-js not rebranded
Phase 13: Data Migration [ ] Skipped Per user request
Phase 14: VSCode Config [x] Complete
Final Verification [x] Complete Build & tests pass

What Was NOT Changed (plebbit-js dependency)

Since plebbit-js has not been rebranded yet, the following remain unchanged:

  • @plebbit/plebbit-js import and dependency
  • Plebbit class name
  • plebbit.createSubplebbit() method calls
  • plebbit.getSubplebbit() method calls
  • plebbit.subplebbits property
  • SubplebbitEditOptions and other plebbit-js types
  • plebbitRpcClientsOptions and similar plebbit-js options
  • --plebbitRpcUrl CLI flag (maps to plebbit-js)
  • --plebbitOptions.* CLI flags

External Repositories Requiring Changes

These repositories are outside bitsocial-cli but will need coordinated updates:

Repository Changes Needed Status
@plebbit/plebbit-js → @pkcprotocol/pkc-js Core library rename [ ] Not Started
@plebbit/plebbit-logger → @pkcprotocol/pkc-logger Logger package rename [ ] Not Started
WebUIs (seedit, plebchan, plebones) Update default options variable names [ ] Not Started