Skip to content

remove Yeoman and switched to Oclif for the CLI#640

Open
OsamaRab3 wants to merge 33 commits intohyperledger-labs:mainfrom
OsamaRab3:del-yeoman
Open

remove Yeoman and switched to Oclif for the CLI#640
OsamaRab3 wants to merge 33 commits intohyperledger-labs:mainfrom
OsamaRab3:del-yeoman

Conversation

@OsamaRab3
Copy link
Contributor

Description

This PR introduces the initial setup for removing and fully migrating the CLI to Oclif.
The goal is to simplify the CLI implementation, remove the generator dependency, and make future features easier to maintain and extend.

All commands are currently working as expected, but I haven’t run the full automated test suite yet

Current Progress

Implemented so far

  • Replaced Yeoman-based commands with Oclif commands.
  • Added the new init implementation using Oclif.
  • fablo init now accepts the following optional features (order does not matter):
fablo init [node] [dev] [rest] [ccaas] [gateway]
  • Added initial Oclif commands for:
    • up
    • down
    • start
    • stop
    • recreate
    • prune

Basic usage examples

Run the network:

ffablo up -c fablo-config.json

The -c flag is optional if omitted, it will default to fablo-config.json just like the original Fablo CLI

Important Note

  • I temporarily named the executable ffablo to avoid conflicts with the existing fablo command during development.
    Once the migration is complete and fully tested, the name will be switched back to fablo
  • I haven’t removed the old Yeoman-based code yet.
    Once the new Oclif implementation is fully completed and fully tested, I will remove all legacy code.

@OsamaRab3
Copy link
Contributor Author

To run and test it locally, please follow these steps

npm install
npm run build
npm link

Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
dzikowski and others added 10 commits December 5, 2025 15:50
Signed-off-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
Signed-off-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Comment on lines +84 to +86
"bin": "ffablo",
"commands": "./generators/commands",
"dirname": "ffablo",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"bin": "ffablo",
"commands": "./generators/commands",
"dirname": "ffablo",
"bin": "fablo",
"commands": "./generators/commands",
"dirname": "fablo",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we no longer need this file since we have migrated away from Yeoman. It does not seem to be used anywhere, so we can safely remove it.

Comment on lines +25 to +27
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "npm run lint",
"prepack": "oclif manifest && oclif readme",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these scripts?

Signed-off-by: OsamaRab3 <osrab3@gmail.com>
Signed-off-by: OsamaRab3 <osrab3@gmail.com>
}

executeOnFabloDocker() {
# set -x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we can remove that line

Comment on lines +202 to +213
if [ -f /etc/passwd ]; then
fablo_workspace_params+=(
-v /etc/passwd:/etc/passwd:ro
)
fi

if [ -f /etc/group ]; then
fablo_workspace_params+=(
-v /etc/group:/etc/group:ro
)
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does it do? do we need it?


if [ -f "$FABLO_TARGET/fabric-docker.sh" ]; then
echo "Executing Fablo Docker command: $1"
chmod +x "$FABLO_TARGET/fabric-docker.sh" || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should not be required. We should grant x permission when the file is created

"noEmit": true,
// "noEmit": true,
"rootDir": "./",
"outDir": "./generators",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ultimately we should change it to dist an update references

networkUp() {
"$FABLO_HOME/fablo-build.sh"
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" init node dev)
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" init --node && cat "$TEST_TMP/fablo-config.json")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test looks different because we were checking node/dev mode. Here we have no dev/ccaas mode

RUN npm install --global --silent yo

# copy fablo files
COPY generators /fablo/generators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> dist

Comment on lines 18 to 25
# Add a yeoman user because Yeoman freaks out and runs setuid(501).
# This was because less technical people would run Yeoman as root and cause problems.
# Setting uid to 501 here since it's already a random number being thrown around.
# @see https://github.com/yeoman/yeoman.github.io/issues/282
# @see https://github.com/cthulhu666/docker-yeoman/blob/master/Dockerfile
# @see https://github.com/phase2/docker-yeoman/blob/master/Dockerfile
RUN adduser -D -u 501 yeoman && \
echo "yeoman ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need that weird user setup anymore

Comment on lines 7 to 16
if [ "$(id -u)" = 0 ]; then
# root user detected, running as yeoman user
sudo chown -R yeoman:yeoman "$yeoman_target_dir"
# root user detected, running as yeoman user (keeping for compatibility)
sudo chown -R yeoman:yeoman "$target_dir"
# shellcheck disable=SC2086
(cd "$yeoman_target_dir" && sudo -E -u yeoman yo --no-insight $command_with_params)
sudo chown -R root:root "$yeoman_target_dir"
(cd "$target_dir" && sudo -E -u yeoman node --no-warnings /fablo/bin/run.mjs $command_with_params)
sudo chown -R root:root "$target_dir"
else
# shellcheck disable=SC2086
(cd "$yeoman_target_dir" && yo --no-insight $command_with_params)
(cd "$target_dir" && node --no-warnings /fablo/bin/run.mjs $command_with_params)
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably don't need it anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants