buildx-cli 1.8.16 → 1.8.18

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/README.md CHANGED
@@ -527,6 +527,90 @@ Key options:
527
527
  npx buildx-cli function:diff --project-id hello-world --target-dir ./.sandbox/buildx-cli
528
528
  ```
529
529
 
530
+ #### `function:revisions <function-name>`
531
+ Lists function revisions and shows which revision is `live` plus alias mapping.
532
+
533
+ Key options:
534
+ - `-p, --project-id <id>`
535
+ - `-u, --api-url <url>`
536
+ - `--json`
537
+
538
+ ```bash
539
+ npx buildx-cli function:revisions process-order --project-id hello-world
540
+ ```
541
+
542
+ #### `function:publish <function-name> [revision]`
543
+ Publishes a revision to alias (default alias: `live`). If `revision` is omitted, CLI publishes the latest revision.
544
+
545
+ Key options:
546
+ - `-p, --project-id <id>`
547
+ - `-u, --api-url <url>`
548
+ - `--alias <alias>` (default: `live`)
549
+
550
+ ```bash
551
+ npx buildx-cli function:publish process-order --project-id hello-world
552
+ npx buildx-cli function:publish process-order r12 --project-id hello-world
553
+ npx buildx-cli function:publish process-order 12 --project-id hello-world --alias stable
554
+ ```
555
+
556
+ Best practices:
557
+ - Use aliases as stable pointers for environments/traffic, not raw revision numbers in app code.
558
+ - Revision identifier is system-managed (`r1`, `r2`, ...). You cannot set revision id manually.
559
+ - If you want deployment traceability by git commit, use git hash as an alias (for example: `a1b2c3d4` -> `r42`).
560
+ - Recommended alias convention:
561
+ - `live`: production traffic
562
+ - `stable`: last known good release
563
+ - `canary`: limited rollout / verification
564
+ - Typical release flow:
565
+ 1. Save function in Studio/CLI (creates new revision automatically)
566
+ 2. Validate with `function:invoke --revision rN`
567
+ 3. Promote by alias: `function:alias:set <fn> canary rN`
568
+ 4. Promote to production: `function:publish <fn> rN --alias live`
569
+ 5. Fast rollback: `function:alias:set <fn> live <previous-revision>`
570
+ - For routine publish operations, run `function:publish <fn>` without revision to move the latest revision to `live`.
571
+ - Keep revision IDs immutable and treat alias changes as deployment events (track in release notes/ops logs).
572
+ - Use `function:revisions <fn>` to list revision id, checksum (short), and alias mapping in one place.
573
+
574
+ Git-hash alias example:
575
+ ```bash
576
+ # Point alias named by git hash to a revision
577
+ npx buildx-cli function:alias:set process-order a1b2c3d4 r42 --project-id hello-world
578
+
579
+ # Publish latest revision to a git-hash alias
580
+ npx buildx-cli function:publish process-order --project-id hello-world --alias a1b2c3d4
581
+
582
+ # Inspect mapping + checksum
583
+ npx buildx-cli function:revisions process-order --project-id hello-world
584
+ ```
585
+
586
+ #### `function:alias:set <function-name> <alias> <revision>`
587
+ Sets alias pointer directly to a revision.
588
+
589
+ Key options:
590
+ - `-p, --project-id <id>`
591
+ - `-u, --api-url <url>`
592
+
593
+ ```bash
594
+ npx buildx-cli function:alias:set process-order canary r15 --project-id hello-world
595
+ ```
596
+
597
+ #### `function:invoke <function-name>`
598
+ Invokes function with optional `revision` or `alias`.
599
+
600
+ Key options:
601
+ - `-p, --project-id <id>`
602
+ - `-u, --api-url <url>`
603
+ - `-X, --method <method>`
604
+ - `--revision <revision>`
605
+ - `--alias <alias>`
606
+ - `--data <json>`
607
+ - `--data-file <path>`
608
+
609
+ ```bash
610
+ npx buildx-cli function:invoke process-order --project-id hello-world --alias live --data '{"order_id":"A001"}'
611
+ npx buildx-cli function:invoke process-order --project-id hello-world --revision r12 --data-file ./payload.json
612
+ ```
613
+
530
614
  ### Configuration Commands
531
615
 
532
616
  #### `config:setup`
@@ -585,6 +669,159 @@ The CLI interacts with the following API endpoints:
585
669
  - `GET /project/:project_id/functions` - List functions
586
670
  - `GET /project/:project_id/functions/:function_name` - Fetch function source
587
671
  - `POST /project/:project_id/functions/:function_name` - Upsert function source
672
+ - `GET /project/:project_id/functions/:function_name/revisions` - List function revisions
673
+ - `POST /project/:project_id/functions/:function_name/revisions/:revision/publish` - Publish function revision
674
+ - `PUT /project/:project_id/functions/:function_name/aliases/:alias` - Update function alias
675
+ - `POST /project/:project_id/functions/run/:function_name` - Invoke function
676
+
677
+ ## CLI Output Formats (All Commands)
678
+
679
+ Detailed command-by-command examples (normal + `--json`): see [OUTPUT_EXAMPLES.md](./OUTPUT_EXAMPLES.md).
680
+
681
+ General rules:
682
+ - Success output is human-readable by default unless command has explicit JSON mode.
683
+ - Error output is plain text: `Error: <message>` and exits non-zero.
684
+ - Commands with `--json` print JSON to stdout for automation.
685
+ - Commands that return documents (`data:list/get/create/update/delete`) are already JSON by default.
686
+
687
+ ### Authentication
688
+ - `auth:login`:
689
+ - default: human-readable status lines
690
+ - `--json`: `{ success, method, username, tokenMasked, expiresAt }`
691
+ - `auth:logout`:
692
+ - default: human-readable confirmation
693
+ - `--json`: `{ success, authenticated }`
694
+ - `auth:status`:
695
+ - default: human-readable session summary
696
+ - `--json`: `{ success, authenticated, user?, tokenMasked?, expiresAt? }`
697
+
698
+ ### Projects
699
+ - `projects:list`:
700
+ - default: human-readable list
701
+ - `--json`: `{ success, projects[], total, defaultProjectId }`
702
+ - `projects:set-default`:
703
+ - default: human-readable confirmation
704
+ - `--json`: `{ success, defaultProjectId, project }`
705
+ - `projects:current`:
706
+ - default: human-readable summary
707
+ - `--json`: `{ success, defaultProject }`
708
+ - `projects:metadata:get`: prints pretty JSON for selected metadata path.
709
+ - `--output <file>` writes JSON file and prints success line.
710
+ - `projects:metadata:update`:
711
+ - default: human-readable summary (`default_language`, `timezone`, key count)
712
+ - `--json`: updated project payload JSON
713
+ - `--dry-run`: payload JSON only
714
+ - `projects:locale:validate`: success line + JSON validation result.
715
+
716
+ ### Configuration
717
+ - `config:setup`:
718
+ - default: interactive + human-readable summary
719
+ - `--json`: `{ success, api: { endpoint, apiKeyMasked } }`
720
+ - `config:show`:
721
+ - default: human-readable configuration report
722
+ - `--json`: structured config payload (`api`, `auth`, `projects`, `sync`, `configPath`, `envSources`)
723
+ - `config:clear`:
724
+ - default: human-readable confirmation
725
+ - `--json`: `{ success, cleared }`
726
+
727
+ ### Users
728
+ - `user:list`:
729
+ - default: tab-separated table (`id`, `username`, `name`, `email`) + total
730
+ - `--json`: raw users array JSON
731
+ - `user:create`:
732
+ - default: human-readable confirmation
733
+ - `--json`: created user JSON
734
+
735
+ ### Schema
736
+ - `schema:pull` / `schema:sync`:
737
+ - default: file write summary
738
+ - `--dry-run`: file preview blocks (JSON/text)
739
+ - `--json`: `{ success, command, project_id, output, dryRun }`
740
+ - `schema:push`:
741
+ - default: per-collection lines + `pushed/skipped` summary
742
+ - `--json`: `{ success, pushed, skipped, results[] }`
743
+ - `schema:list`:
744
+ - default: one `collection_id` per line + total
745
+ - `--json`: `{ success, total, collections[] }`
746
+ - `schema:diff` markers:
747
+ - `= same`
748
+ - `~ changed`
749
+ - `+ local-only`
750
+ - `- remote-only`
751
+ - `--json`: `{ success, summary, results[] }`
752
+ - `schema:types:convert`:
753
+ - default: conversion summary + output path
754
+ - `--dry-run`: generated JSON preview
755
+ - `--json`: `{ success, dryRun, output, collections_count, warnings[] }`
756
+
757
+ ### Functions
758
+ - `function:pull` / `function:sync`:
759
+ - default: file write summary
760
+ - `--dry-run`: context/source/manifest preview blocks
761
+ - `--json`: `{ success, command, project_id, output, dryRun }`
762
+ - `function:push`:
763
+ - default: per-function lines + `pushed/skipped` summary
764
+ - `--dry-run`: would-push + manifest preview
765
+ - `--json`: `{ success, pushed, skipped, results[] }`
766
+ - `function:list`:
767
+ - default: one function name per line + total
768
+ - `--json`: `{ success, total, functions[] }`
769
+ - `function:logs`:
770
+ - default: `timestamp status message` lines + shown count
771
+ - `--json`: raw log rows JSON
772
+ - `function:diff` markers:
773
+ - `= same`
774
+ - `~ changed`
775
+ - `+ local-missing`
776
+ - `- remote-missing`
777
+ - `! remote-drift`
778
+ - `--json`: `{ success, summary, results[] }`
779
+ - `function:revisions`:
780
+ - default: one line per revision with
781
+ - live marker (`[live]`)
782
+ - `revision` + `revision_id`
783
+ - short checksum (`source_checksum` first 12 chars)
784
+ - `createdAt`
785
+ - alias mapping (`aliases=...`)
786
+ - `--json`: array entries with keys:
787
+ - `revision`
788
+ - `revision_id`
789
+ - `checksum`
790
+ - `createdAt`
791
+ - `live`
792
+ - `aliases`
793
+ - `function:publish`:
794
+ - default: confirmation + live revision + aliases object
795
+ - `[revision]` omitted => auto uses latest revision
796
+ - `--json`: `{ success, function, publishedRevision, alias, live_revision_id, aliases }`
797
+ - `function:alias:set`:
798
+ - default: confirmation line with alias target
799
+ - `--json`: `{ success, function, alias, revision, aliases }`
800
+ - `function:invoke`:
801
+ - object/array response: pretty JSON
802
+ - text response: plain text
803
+ - `--raw`: raw response output
804
+
805
+ ### Data
806
+ - `data:list`: pretty JSON response.
807
+ - `data:get`: pretty JSON response.
808
+ - `data:create`: pretty JSON response.
809
+ - `data:update`: pretty JSON response.
810
+ - `data:delete`: pretty JSON response.
811
+ - `data:export`: writes JSON file + summary line.
812
+ - `--json`: `{ success, collection_id, project_id, count, output }`
813
+ - `data:import`:
814
+ - default: summary (`created`, `updated`)
815
+ - `--dry-run`: simulated summary lines
816
+ - `--json`: structured import result (`success`, `collection_id`, `project_id`, `mode`, `batch`, `dryRun`, `created`, `updated`, `match?`)
817
+
818
+ ### Revision/Alias Definition (Important)
819
+ - Function revision is system-managed and immutable (`r1`, `r2`, ...).
820
+ - You cannot set custom revision id (for example git hash) as revision.
821
+ - If you need git-traceable deployment labels, use alias names as git hash values.
822
+ - Example:
823
+ - `function:alias:set process-order a1b2c3d4 r42`
824
+ - `function:revisions process-order` (to inspect mapping + checksum)
588
825
 
589
826
  ## Development
590
827
 
package/dist/README.md CHANGED
@@ -527,6 +527,90 @@ Key options:
527
527
  npx buildx-cli function:diff --project-id hello-world --target-dir ./.sandbox/buildx-cli
528
528
  ```
529
529
 
530
+ #### `function:revisions <function-name>`
531
+ Lists function revisions and shows which revision is `live` plus alias mapping.
532
+
533
+ Key options:
534
+ - `-p, --project-id <id>`
535
+ - `-u, --api-url <url>`
536
+ - `--json`
537
+
538
+ ```bash
539
+ npx buildx-cli function:revisions process-order --project-id hello-world
540
+ ```
541
+
542
+ #### `function:publish <function-name> [revision]`
543
+ Publishes a revision to alias (default alias: `live`). If `revision` is omitted, CLI publishes the latest revision.
544
+
545
+ Key options:
546
+ - `-p, --project-id <id>`
547
+ - `-u, --api-url <url>`
548
+ - `--alias <alias>` (default: `live`)
549
+
550
+ ```bash
551
+ npx buildx-cli function:publish process-order --project-id hello-world
552
+ npx buildx-cli function:publish process-order r12 --project-id hello-world
553
+ npx buildx-cli function:publish process-order 12 --project-id hello-world --alias stable
554
+ ```
555
+
556
+ Best practices:
557
+ - Use aliases as stable pointers for environments/traffic, not raw revision numbers in app code.
558
+ - Revision identifier is system-managed (`r1`, `r2`, ...). You cannot set revision id manually.
559
+ - If you want deployment traceability by git commit, use git hash as an alias (for example: `a1b2c3d4` -> `r42`).
560
+ - Recommended alias convention:
561
+ - `live`: production traffic
562
+ - `stable`: last known good release
563
+ - `canary`: limited rollout / verification
564
+ - Typical release flow:
565
+ 1. Save function in Studio/CLI (creates new revision automatically)
566
+ 2. Validate with `function:invoke --revision rN`
567
+ 3. Promote by alias: `function:alias:set <fn> canary rN`
568
+ 4. Promote to production: `function:publish <fn> rN --alias live`
569
+ 5. Fast rollback: `function:alias:set <fn> live <previous-revision>`
570
+ - For routine publish operations, run `function:publish <fn>` without revision to move the latest revision to `live`.
571
+ - Keep revision IDs immutable and treat alias changes as deployment events (track in release notes/ops logs).
572
+ - Use `function:revisions <fn>` to list revision id, checksum (short), and alias mapping in one place.
573
+
574
+ Git-hash alias example:
575
+ ```bash
576
+ # Point alias named by git hash to a revision
577
+ npx buildx-cli function:alias:set process-order a1b2c3d4 r42 --project-id hello-world
578
+
579
+ # Publish latest revision to a git-hash alias
580
+ npx buildx-cli function:publish process-order --project-id hello-world --alias a1b2c3d4
581
+
582
+ # Inspect mapping + checksum
583
+ npx buildx-cli function:revisions process-order --project-id hello-world
584
+ ```
585
+
586
+ #### `function:alias:set <function-name> <alias> <revision>`
587
+ Sets alias pointer directly to a revision.
588
+
589
+ Key options:
590
+ - `-p, --project-id <id>`
591
+ - `-u, --api-url <url>`
592
+
593
+ ```bash
594
+ npx buildx-cli function:alias:set process-order canary r15 --project-id hello-world
595
+ ```
596
+
597
+ #### `function:invoke <function-name>`
598
+ Invokes function with optional `revision` or `alias`.
599
+
600
+ Key options:
601
+ - `-p, --project-id <id>`
602
+ - `-u, --api-url <url>`
603
+ - `-X, --method <method>`
604
+ - `--revision <revision>`
605
+ - `--alias <alias>`
606
+ - `--data <json>`
607
+ - `--data-file <path>`
608
+
609
+ ```bash
610
+ npx buildx-cli function:invoke process-order --project-id hello-world --alias live --data '{"order_id":"A001"}'
611
+ npx buildx-cli function:invoke process-order --project-id hello-world --revision r12 --data-file ./payload.json
612
+ ```
613
+
530
614
  ### Configuration Commands
531
615
 
532
616
  #### `config:setup`
@@ -585,6 +669,159 @@ The CLI interacts with the following API endpoints:
585
669
  - `GET /project/:project_id/functions` - List functions
586
670
  - `GET /project/:project_id/functions/:function_name` - Fetch function source
587
671
  - `POST /project/:project_id/functions/:function_name` - Upsert function source
672
+ - `GET /project/:project_id/functions/:function_name/revisions` - List function revisions
673
+ - `POST /project/:project_id/functions/:function_name/revisions/:revision/publish` - Publish function revision
674
+ - `PUT /project/:project_id/functions/:function_name/aliases/:alias` - Update function alias
675
+ - `POST /project/:project_id/functions/run/:function_name` - Invoke function
676
+
677
+ ## CLI Output Formats (All Commands)
678
+
679
+ Detailed command-by-command examples (normal + `--json`): see [OUTPUT_EXAMPLES.md](./OUTPUT_EXAMPLES.md).
680
+
681
+ General rules:
682
+ - Success output is human-readable by default unless command has explicit JSON mode.
683
+ - Error output is plain text: `Error: <message>` and exits non-zero.
684
+ - Commands with `--json` print JSON to stdout for automation.
685
+ - Commands that return documents (`data:list/get/create/update/delete`) are already JSON by default.
686
+
687
+ ### Authentication
688
+ - `auth:login`:
689
+ - default: human-readable status lines
690
+ - `--json`: `{ success, method, username, tokenMasked, expiresAt }`
691
+ - `auth:logout`:
692
+ - default: human-readable confirmation
693
+ - `--json`: `{ success, authenticated }`
694
+ - `auth:status`:
695
+ - default: human-readable session summary
696
+ - `--json`: `{ success, authenticated, user?, tokenMasked?, expiresAt? }`
697
+
698
+ ### Projects
699
+ - `projects:list`:
700
+ - default: human-readable list
701
+ - `--json`: `{ success, projects[], total, defaultProjectId }`
702
+ - `projects:set-default`:
703
+ - default: human-readable confirmation
704
+ - `--json`: `{ success, defaultProjectId, project }`
705
+ - `projects:current`:
706
+ - default: human-readable summary
707
+ - `--json`: `{ success, defaultProject }`
708
+ - `projects:metadata:get`: prints pretty JSON for selected metadata path.
709
+ - `--output <file>` writes JSON file and prints success line.
710
+ - `projects:metadata:update`:
711
+ - default: human-readable summary (`default_language`, `timezone`, key count)
712
+ - `--json`: updated project payload JSON
713
+ - `--dry-run`: payload JSON only
714
+ - `projects:locale:validate`: success line + JSON validation result.
715
+
716
+ ### Configuration
717
+ - `config:setup`:
718
+ - default: interactive + human-readable summary
719
+ - `--json`: `{ success, api: { endpoint, apiKeyMasked } }`
720
+ - `config:show`:
721
+ - default: human-readable configuration report
722
+ - `--json`: structured config payload (`api`, `auth`, `projects`, `sync`, `configPath`, `envSources`)
723
+ - `config:clear`:
724
+ - default: human-readable confirmation
725
+ - `--json`: `{ success, cleared }`
726
+
727
+ ### Users
728
+ - `user:list`:
729
+ - default: tab-separated table (`id`, `username`, `name`, `email`) + total
730
+ - `--json`: raw users array JSON
731
+ - `user:create`:
732
+ - default: human-readable confirmation
733
+ - `--json`: created user JSON
734
+
735
+ ### Schema
736
+ - `schema:pull` / `schema:sync`:
737
+ - default: file write summary
738
+ - `--dry-run`: file preview blocks (JSON/text)
739
+ - `--json`: `{ success, command, project_id, output, dryRun }`
740
+ - `schema:push`:
741
+ - default: per-collection lines + `pushed/skipped` summary
742
+ - `--json`: `{ success, pushed, skipped, results[] }`
743
+ - `schema:list`:
744
+ - default: one `collection_id` per line + total
745
+ - `--json`: `{ success, total, collections[] }`
746
+ - `schema:diff` markers:
747
+ - `= same`
748
+ - `~ changed`
749
+ - `+ local-only`
750
+ - `- remote-only`
751
+ - `--json`: `{ success, summary, results[] }`
752
+ - `schema:types:convert`:
753
+ - default: conversion summary + output path
754
+ - `--dry-run`: generated JSON preview
755
+ - `--json`: `{ success, dryRun, output, collections_count, warnings[] }`
756
+
757
+ ### Functions
758
+ - `function:pull` / `function:sync`:
759
+ - default: file write summary
760
+ - `--dry-run`: context/source/manifest preview blocks
761
+ - `--json`: `{ success, command, project_id, output, dryRun }`
762
+ - `function:push`:
763
+ - default: per-function lines + `pushed/skipped` summary
764
+ - `--dry-run`: would-push + manifest preview
765
+ - `--json`: `{ success, pushed, skipped, results[] }`
766
+ - `function:list`:
767
+ - default: one function name per line + total
768
+ - `--json`: `{ success, total, functions[] }`
769
+ - `function:logs`:
770
+ - default: `timestamp status message` lines + shown count
771
+ - `--json`: raw log rows JSON
772
+ - `function:diff` markers:
773
+ - `= same`
774
+ - `~ changed`
775
+ - `+ local-missing`
776
+ - `- remote-missing`
777
+ - `! remote-drift`
778
+ - `--json`: `{ success, summary, results[] }`
779
+ - `function:revisions`:
780
+ - default: one line per revision with
781
+ - live marker (`[live]`)
782
+ - `revision` + `revision_id`
783
+ - short checksum (`source_checksum` first 12 chars)
784
+ - `createdAt`
785
+ - alias mapping (`aliases=...`)
786
+ - `--json`: array entries with keys:
787
+ - `revision`
788
+ - `revision_id`
789
+ - `checksum`
790
+ - `createdAt`
791
+ - `live`
792
+ - `aliases`
793
+ - `function:publish`:
794
+ - default: confirmation + live revision + aliases object
795
+ - `[revision]` omitted => auto uses latest revision
796
+ - `--json`: `{ success, function, publishedRevision, alias, live_revision_id, aliases }`
797
+ - `function:alias:set`:
798
+ - default: confirmation line with alias target
799
+ - `--json`: `{ success, function, alias, revision, aliases }`
800
+ - `function:invoke`:
801
+ - object/array response: pretty JSON
802
+ - text response: plain text
803
+ - `--raw`: raw response output
804
+
805
+ ### Data
806
+ - `data:list`: pretty JSON response.
807
+ - `data:get`: pretty JSON response.
808
+ - `data:create`: pretty JSON response.
809
+ - `data:update`: pretty JSON response.
810
+ - `data:delete`: pretty JSON response.
811
+ - `data:export`: writes JSON file + summary line.
812
+ - `--json`: `{ success, collection_id, project_id, count, output }`
813
+ - `data:import`:
814
+ - default: summary (`created`, `updated`)
815
+ - `--dry-run`: simulated summary lines
816
+ - `--json`: structured import result (`success`, `collection_id`, `project_id`, `mode`, `batch`, `dryRun`, `created`, `updated`, `match?`)
817
+
818
+ ### Revision/Alias Definition (Important)
819
+ - Function revision is system-managed and immutable (`r1`, `r2`, ...).
820
+ - You cannot set custom revision id (for example git hash) as revision.
821
+ - If you need git-traceable deployment labels, use alias names as git hash values.
822
+ - Example:
823
+ - `function:alias:set process-order a1b2c3d4 r42`
824
+ - `function:revisions process-order` (to inspect mapping + checksum)
588
825
 
589
826
  ## Development
590
827