openfaas / openfaas/faas-cli

Proposal: Create/extract faas-cli SDK

Open
#232 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
816
Forks
230
Avg merge
6h 4m
Merged PRs (30d)
1

Description

Detach faas-cli logic currently in commands package to an autonomous package. This would make reusability a lot easier and testing (as library or exposed as service) .

Expected Behaviour

I would like to reuse commands in a grpc service (https://github.com/muka/faas-cli-grpc) to expose build & deploy as a service API

Currently this may be done by just running shell scipts, but raw response, error management and configuration make it difficult to handle.

Other area of improvement are where to store local files (eg. the template/ folder ) and also ease up test eventually as a positive side effect.

Current Behaviour

The CLI works great but there is room for improvement on reusability of the features

Possible Solution

  • Moved most of the commands logic under api
  • Added a workdir flag and setter/getter for where to put local files
  • refactored paths reference to be resolved via filepath.Resolve
  • Tried to maintan backward compatibility at end user side

I have built a POC here https://github.com/muka/faas-cli
Not all commands has been ported (still missing logout, new, remove, version) but all tests passes

Would love to get feedback! Thanks

Context

I am looking to enable function building as a service in a multi-tenant and eventually distributed environment

Issue that may be related or addressable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the current logic in the commands package and compare it with the POC linked in the issue, then inspect the existing tests. Trace how the template/ folder and other local files are resolved, and verify that the extracted API supports the stated build/deploy use case while preserving CLI behavior and test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend, cli
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.