fizzy-cli 0.1.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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2025 Rogério Vicente
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/Makefile ADDED
@@ -0,0 +1,32 @@
1
+ .PHONY: help dev-tools run build build-all clean test
2
+
3
+ help:
4
+ @echo 'Usage: make [target]'
5
+ @echo ''
6
+ @echo 'Available targets:'
7
+ @grep -E '^[a-zA-Z_-]+:' Makefile | sed 's/:.*//g' | sed 's/^/ /'
8
+
9
+ dev-tools:
10
+ @echo "Installing development tools..."
11
+ go install github.com/spf13/cobra@latest
12
+
13
+ run:
14
+ go run .
15
+
16
+ build:
17
+ go build -o bin/fizzy .
18
+
19
+ build-all: clean
20
+ mkdir -p bin
21
+ GOOS=darwin GOARCH=amd64 go build -o bin/fizzy-darwin-amd64 .
22
+ GOOS=darwin GOARCH=arm64 go build -o bin/fizzy-darwin-arm64 .
23
+ GOOS=linux GOARCH=amd64 go build -o bin/fizzy-linux-amd64 .
24
+ GOOS=linux GOARCH=arm64 go build -o bin/fizzy-linux-arm64 .
25
+ GOOS=windows GOARCH=amd64 go build -o bin/fizzy-windows-amd64.exe .
26
+ @echo "Binaries built successfully in bin/"
27
+
28
+ clean:
29
+ rm -rf bin/
30
+
31
+ test:
32
+ go test -v ./...
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # Fizzy CLI
2
+
3
+ This is a command-line interface for https://fizzy.do
4
+
5
+ ## Install
6
+
7
+ Soon...
package/bin/fizzy ADDED
Binary file
package/cmd/board.go ADDED
@@ -0,0 +1,23 @@
1
+ package cmd
2
+
3
+ import "github.com/spf13/cobra"
4
+
5
+ var boardCmd = &cobra.Command{
6
+ Use: "board",
7
+ Short: "Manage boards",
8
+ Long: `Manage boards in Fizzy`,
9
+ }
10
+
11
+ func init() {
12
+ rootCmd.AddCommand(boardCmd)
13
+
14
+ // Here you will define your flags and configuration settings.
15
+
16
+ // Cobra supports Persistent Flags which will work for this command
17
+ // and all subcommands, e.g.:
18
+ // boardCmd.PersistentFlags().String("foo", "", "A help for foo")
19
+
20
+ // Cobra supports local flags which will only run when this command
21
+ // is called directly, e.g.:
22
+ // boardCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
23
+ }
@@ -0,0 +1,58 @@
1
+ package cmd
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+
7
+ "github.com/spf13/cobra"
8
+ )
9
+
10
+ var boardListCmd = &cobra.Command{
11
+ Use: "list",
12
+ Short: "List all boards",
13
+ Long: `Retrieve and display all boards from Fizzy`,
14
+ RunE: listBoards,
15
+ }
16
+
17
+ func listBoards(cmd *cobra.Command, args []string) error {
18
+ ctx := context.Background()
19
+
20
+ // TODO: Implement API call to fetch boards
21
+ boards, err := fetchBoards(ctx)
22
+ if err != nil {
23
+ return fmt.Errorf("failed to list boards: %w", err)
24
+ }
25
+
26
+ // TODO: Format and display boards
27
+ if err := displayBoards(boards); err != nil {
28
+ return fmt.Errorf("failed to display boards: %w", err)
29
+ }
30
+
31
+ return nil
32
+ }
33
+
34
+ // fetchBoards retrieves all boards from the Fizzy API.
35
+ func fetchBoards(ctx context.Context) ([]Board, error) {
36
+ // TODO: Implement API call
37
+ return nil, nil
38
+ }
39
+
40
+ // displayBoards formats and outputs the boards.
41
+ func displayBoards(boards []Board) error {
42
+ // TODO: Implement output formatting
43
+ for _, board := range boards {
44
+ fmt.Printf("Board: %+v\n", board)
45
+ }
46
+ return nil
47
+ }
48
+
49
+ // Board represents a Fizzy board.
50
+ type Board struct {
51
+ ID string
52
+ Name string
53
+ // TODO: Add additional fields as needed
54
+ }
55
+
56
+ func init() {
57
+ boardCmd.AddCommand(boardListCmd)
58
+ }
package/cmd/login.go ADDED
@@ -0,0 +1,23 @@
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/spf13/cobra"
7
+ )
8
+
9
+ var loginCmd = &cobra.Command{
10
+ Use: "login",
11
+ Short: "Prints instructions on how to authenticate with the Fizzy API",
12
+ Long: `Prints intructions on how to authenticate with the Fizzy API`,
13
+ Run: func(cmd *cobra.Command, args []string) {
14
+ fmt.Println("To authenticate with Fizzy's API you need an access token.")
15
+ fmt.Println("\nGo to https://app.fizzy.do/<account_slug>/my/access_tokens and follow the instructions...")
16
+ fmt.Println("(Replace <account_slug> with your account slug/id)")
17
+ fmt.Println("\nThen export it as an environment variable in your shell, with the name FIZZY_ACCESS_TOKEN")
18
+ },
19
+ }
20
+
21
+ func init() {
22
+ rootCmd.AddCommand(loginCmd)
23
+ }
package/cmd/root.go ADDED
@@ -0,0 +1,27 @@
1
+ package cmd
2
+
3
+ import (
4
+ "os"
5
+
6
+ "github.com/spf13/cobra"
7
+ )
8
+
9
+ var rootCmd = &cobra.Command{
10
+ Use: "fizzy-cli",
11
+ Short: "Fizzy CLI",
12
+ Long: `Fizzy CLI`,
13
+ // Run: func(cmd *cobra.Command, args []string) { },
14
+ }
15
+
16
+ func Execute() {
17
+ err := rootCmd.Execute()
18
+ if err != nil {
19
+ os.Exit(1)
20
+ }
21
+ }
22
+
23
+ func init() {
24
+ // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.fizzy-cli.yaml)")
25
+
26
+ rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
27
+ }
package/go.mod ADDED
@@ -0,0 +1,10 @@
1
+ module github.com/rogeriopvl/fizzy-cli
2
+
3
+ go 1.25.1
4
+
5
+ require github.com/spf13/cobra v1.10.2
6
+
7
+ require (
8
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
9
+ github.com/spf13/pflag v1.0.9 // indirect
10
+ )
package/go.sum ADDED
@@ -0,0 +1,10 @@
1
+ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
2
+ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3
+ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4
+ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
5
+ github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
6
+ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
7
+ github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
8
+ github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9
+ go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
10
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
package/main.go ADDED
@@ -0,0 +1,7 @@
1
+ package main
2
+
3
+ import "github.com/rogeriopvl/fizzy-cli/cmd"
4
+
5
+ func main() {
6
+ cmd.Execute()
7
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "fizzy-cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI for https://fizzy.do",
5
+ "main": "bin/fizzy",
6
+ "type": "module",
7
+ "bin": {
8
+ "fizzy": "bin/fizzy"
9
+ },
10
+ "scripts": {
11
+ "postinstall": "node scripts/postinstall.js",
12
+ "build": "make build-all"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/rogeriopvl/fizzy-cli"
17
+ },
18
+ "keywords": [
19
+ "fizzy",
20
+ "cli",
21
+ "api"
22
+ ],
23
+ "author": "",
24
+ "license": "MIT",
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ },
28
+ "os": [
29
+ "darwin",
30
+ "linux",
31
+ "win32"
32
+ ],
33
+ "cpu": [
34
+ "x64",
35
+ "arm64"
36
+ ]
37
+ }
@@ -0,0 +1,57 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { execSync } from "child_process";
4
+ import { fileURLToPath } from "url";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+ const packageDir = path.join(__dirname, "..");
9
+
10
+ const platform = process.platform;
11
+ const arch = process.arch;
12
+
13
+ const archMap = {
14
+ x64: "amd64",
15
+ arm64: "arm64",
16
+ };
17
+
18
+ const platformMap = {
19
+ darwin: "darwin",
20
+ linux: "linux",
21
+ win32: "windows",
22
+ };
23
+
24
+ const goOS = platformMap[platform];
25
+ const goArch = archMap[arch];
26
+
27
+ if (!goOS || !goArch) {
28
+ console.error(
29
+ `Unsupported platform: ${platform} ${arch}. Skipping binary download.`,
30
+ );
31
+ process.exit(0);
32
+ }
33
+
34
+ const binaryName = platform === "win32" ? "fizzy.exe" : "fizzy";
35
+ const releaseTag = process.env.FIZZY_RELEASE_TAG || "latest";
36
+
37
+ const downloadUrl = `https://github.com/rogeriopvl/fizzy-cli/releases/download/${releaseTag}/fizzy-${goOS}-${goArch}${platform === "win32" ? ".exe" : ""}`;
38
+
39
+ const binDir = path.join(packageDir, "bin");
40
+ const binaryPath = path.join(binDir, binaryName);
41
+
42
+ if (!fs.existsSync(binDir)) {
43
+ fs.mkdirSync(binDir, { recursive: true });
44
+ }
45
+
46
+ console.log(
47
+ `Downloading fizzy binary for ${goOS}-${goArch} from ${downloadUrl}`,
48
+ );
49
+
50
+ try {
51
+ execSync(`curl -L -o ${binaryPath} ${downloadUrl}`, { stdio: "inherit" });
52
+ fs.chmodSync(binaryPath, 0o755);
53
+ console.log(`Successfully installed fizzy binary to ${binaryPath}`);
54
+ } catch (error) {
55
+ console.error(`Failed to download fizzy binary: ${error.message}`);
56
+ process.exit(1);
57
+ }