Full Code of selefra/selefra for AI

main 95031072ca4c cached
310 files
1.1 MB
338.3k tokens
1522 symbols
1 requests
Download .txt
Showing preview only (1,178K chars total). Download the full file or copy to clipboard to get everything.
Repository: selefra/selefra
Branch: main
Commit: 95031072ca4c
Files: 310
Total size: 1.1 MB

Directory structure:
gitextract_p2txgac8/

├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.yaml
│   │   ├── config.yaml
│   │   └── feature-request.yaml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── ci.yaml
│       └── release.yaml
├── .gitignore
├── .goreleaser.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── SECURITY.md
├── cli_ui/
│   ├── client.go
│   ├── print.go
│   ├── progress.go
│   ├── select_providers.go
│   ├── select_providers_test.go
│   ├── table.go
│   ├── table_test.go
│   └── user.go
├── cmd/
│   ├── apply/
│   │   ├── apply.go
│   │   ├── apply_test.go
│   │   └── test_data/
│   │       └── test_query_module/
│   │           ├── modules.yaml
│   │           ├── rules/
│   │           │   └── rule.yaml
│   │           └── selefra.yaml
│   ├── fetch/
│   │   ├── fetch.go
│   │   ├── fetch_test.go
│   │   └── test_data/
│   │       └── test_fetch_module/
│   │           └── modules.yaml
│   ├── gpt/
│   │   ├── gpt.go
│   │   ├── gpt_test.go
│   │   └── test_data/
│   │       └── test_query_module/
│   │           └── modules.yaml
│   ├── init/
│   │   ├── init.go
│   │   ├── init_command_executor.go
│   │   ├── init_command_executor_test.go
│   │   ├── init_test.go
│   │   ├── rule_example/
│   │   │   ├── aws.yaml
│   │   │   ├── azure.yaml
│   │   │   ├── data.go
│   │   │   ├── default_template.yaml
│   │   │   ├── gcp.yaml
│   │   │   └── k8s.yaml
│   │   └── test_data/
│   │       └── init.sh
│   ├── login/
│   │   ├── login.go
│   │   ├── login_test.go
│   │   └── test_data/
│   │       └── login.sh
│   ├── logout/
│   │   ├── logout.go
│   │   ├── logout_test.go
│   │   └── test_data/
│   │       └── logout.sh
│   ├── module/
│   │   ├── get.go
│   │   ├── list.go
│   │   ├── search.go
│   │   └── tidy.go
│   ├── provider/
│   │   ├── install.go
│   │   ├── install_online_test.go
│   │   ├── install_test.go
│   │   ├── list.go
│   │   ├── list_online_test.go
│   │   ├── list_test.go
│   │   ├── provider.go
│   │   ├── remove.go
│   │   ├── remove_online_test.go
│   │   ├── remove_test.go
│   │   ├── sync.go
│   │   ├── sync_online_test.go
│   │   ├── sync_test.go
│   │   ├── test_data/
│   │   │   └── provider.sh
│   │   ├── update.go
│   │   ├── update_online_test.go
│   │   └── update_test.go
│   ├── query/
│   │   ├── client.go
│   │   ├── client_test.go
│   │   ├── parse.go
│   │   ├── query.go
│   │   ├── query_test.go
│   │   ├── sql.go
│   │   └── test_data/
│   │       └── query.sh
│   ├── root.go
│   ├── tools/
│   │   ├── providers.go
│   │   ├── providers_online_test.go
│   │   └── providers_test.go
│   └── version/
│       ├── version.go
│       └── version_test.go
├── config/
│   ├── config.go
│   ├── config_test.go
│   ├── downloader.go
│   └── downloader_test.go
├── global/
│   ├── flag.go
│   └── flag_test.go
├── go.mod
├── go.sum
├── install.sh
├── main.go
├── pkg/
│   ├── cli_env/
│   │   └── env.go
│   ├── cli_runtime/
│   │   └── runtime.go
│   ├── cloud_sdk/
│   │   ├── client.go
│   │   ├── credentials.go
│   │   ├── dsn.go
│   │   ├── dsn_test.go
│   │   ├── errors.go
│   │   ├── project.go
│   │   ├── project_test.go
│   │   ├── sdk.go
│   │   ├── sdk_test.go
│   │   ├── task.go
│   │   ├── task_test.go
│   │   ├── test_data/
│   │   │   └── sync_workspace/
│   │   │       ├── a.yml
│   │   │       └── b.yml
│   │   ├── user.go
│   │   ├── user_test.go
│   │   ├── workspace.go
│   │   └── workspace_test.go
│   ├── debug/
│   │   ├── debug.go
│   │   └── debug_test.go
│   ├── grpc/
│   │   ├── pb/
│   │   │   ├── cloud/
│   │   │   │   ├── cloud.pb.go
│   │   │   │   ├── cloud.proto
│   │   │   │   └── cloud_grpc.pb.go
│   │   │   ├── common/
│   │   │   │   ├── common.pb.go
│   │   │   │   └── common.proto
│   │   │   ├── issue/
│   │   │   │   ├── issue.pb.go
│   │   │   │   ├── issue.proto
│   │   │   │   └── issue_grpc.pb.go
│   │   │   └── log/
│   │   │       ├── log.pb.go
│   │   │       ├── log.proto
│   │   │       ├── log_grpc.pb.go
│   │   │       ├── transport.go
│   │   │       └── transport_test.go
│   │   ├── stream_uploader.go
│   │   ├── stream_uploader_test.go
│   │   └── tripartite/
│   │       └── google/
│   │           └── protobuf/
│   │               └── timestamp.proto
│   ├── http_client/
│   │   ├── getter.go
│   │   ├── github_repo_downloader.go
│   │   └── requests.go
│   ├── logger/
│   │   ├── config.go
│   │   ├── hc.go
│   │   ├── logger.go
│   │   └── schema.go
│   ├── message/
│   │   ├── message.go
│   │   └── message_test.go
│   ├── modules/
│   │   ├── executors/
│   │   │   ├── executor.go
│   │   │   ├── module_query_executor.go
│   │   │   ├── module_query_executor_test.go
│   │   │   ├── project_cloud_life_cycle_executor.go
│   │   │   ├── project_local_life_cycle_executor.go
│   │   │   ├── provider_fetch_executor.go
│   │   │   ├── provider_fetch_executor_test.go
│   │   │   ├── provider_install_executor.go
│   │   │   ├── provider_install_executor_test.go
│   │   │   └── test_data/
│   │   │       ├── test_fetch_module/
│   │   │       │   └── modules.yaml
│   │   │       ├── test_fetch_module_with_cache/
│   │   │       │   └── modules.yaml
│   │   │       └── test_query_module/
│   │   │           └── modules.yaml
│   │   ├── local_modules_manager/
│   │   │   ├── manager.go
│   │   │   ├── manager_get.go
│   │   │   ├── manager_list.go
│   │   │   ├── manager_search.go
│   │   │   ├── manager_tidy.go
│   │   │   └── manager_update.go
│   │   ├── module/
│   │   │   ├── block.go
│   │   │   ├── errors.go
│   │   │   ├── locatable.go
│   │   │   ├── locatable_test.go
│   │   │   ├── module.go
│   │   │   ├── modules_block.go
│   │   │   ├── providers_block.go
│   │   │   ├── providers_block_test.go
│   │   │   ├── rules_block.go
│   │   │   ├── selefra_block.go
│   │   │   ├── validator.go
│   │   │   ├── validator_test.go
│   │   │   └── variables_block.go
│   │   ├── module_loader/
│   │   │   ├── github_registry_module_loader.go
│   │   │   ├── github_registry_module_loader_test.go
│   │   │   ├── local_directory_module_loader.go
│   │   │   ├── local_directory_module_loader_test.go
│   │   │   ├── module_loader.go
│   │   │   ├── module_loader_manager.go
│   │   │   ├── module_loader_manager_test.go
│   │   │   ├── s3_bucket_path_module_loader.go
│   │   │   ├── test_data/
│   │   │   │   ├── contains_sub_module/
│   │   │   │   │   ├── sub_module_a/
│   │   │   │   │   │   ├── sub_module_a_1/
│   │   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   │   └── sub_module_a_2/
│   │   │   │   │   │       ├── modules.yml
│   │   │   │   │   │       ├── rules.yml
│   │   │   │   │   │       └── selefra.yml
│   │   │   │   │   ├── sub_module_b/
│   │   │   │   │   │   ├── sub_module_b_1/
│   │   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   │   └── sub_module_b_2/
│   │   │   │   │   │       ├── modules.yml
│   │   │   │   │   │       ├── rules.yml
│   │   │   │   │   │       └── selefra.yml
│   │   │   │   │   └── test.yaml
│   │   │   │   ├── dead_loop_module/
│   │   │   │   │   ├── modules.yaml
│   │   │   │   │   ├── sub_module_a/
│   │   │   │   │   │   └── modules.yaml
│   │   │   │   │   └── sub_module_b/
│   │   │   │   │       └── modules.yaml
│   │   │   │   ├── module_mixed/
│   │   │   │   │   ├── sub_module_local/
│   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   └── test.yaml
│   │   │   │   ├── module_use_circle/
│   │   │   │   │   └── test.yaml
│   │   │   │   └── normal_single_module/
│   │   │   │       └── test.yaml
│   │   │   ├── url_module_loader.go
│   │   │   └── url_module_loader_test.go
│   │   ├── parser/
│   │   │   ├── modules.go
│   │   │   ├── modules_test.go
│   │   │   ├── providers.go
│   │   │   ├── providers_test.go
│   │   │   ├── rules.go
│   │   │   ├── rules_test.go
│   │   │   ├── selefra.go
│   │   │   ├── selefra_test.go
│   │   │   ├── test_data/
│   │   │   │   ├── test_modules.yaml
│   │   │   │   ├── test_parse_modules/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_providers/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_rules/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_selefra/
│   │   │   │   │   └── modules.yaml
│   │   │   │   └── test_parse_variables/
│   │   │   │       └── modules.yaml
│   │   │   ├── variables.go
│   │   │   ├── variables_test.go
│   │   │   ├── yaml_file_to_module_parser.go
│   │   │   └── yaml_file_to_module_parser_test.go
│   │   └── planner/
│   │       ├── module_planner.go
│   │       ├── planner.go
│   │       ├── provider_fetch_planner.go
│   │       ├── provider_fetch_planner_test.go
│   │       ├── provider_install_planner.go
│   │       ├── provider_install_planner_test.go
│   │       ├── rule_planner.go
│   │       ├── rule_planner_test.go
│   │       ├── scope.go
│   │       ├── test_data/
│   │       │   ├── provider_fetch_planner/
│   │       │   │   └── modules.yaml
│   │       │   └── rule_planner/
│   │       │       └── test.yaml
│   │       ├── version_vote.go
│   │       └── version_vote_test.go
│   ├── oci/
│   │   ├── postgresql_installer.go
│   │   ├── postgresql_installer_test.go
│   │   └── test_data/
│   │       └── oci.sh
│   ├── plugin/
│   │   └── plugin.go
│   ├── providers/
│   │   └── local_providers_manager/
│   │       ├── exists.go
│   │       ├── exists_test.go
│   │       ├── get.go
│   │       ├── get_test.go
│   │       ├── install.go
│   │       ├── install_online_test.go
│   │       ├── install_test.go
│   │       ├── list.go
│   │       ├── list_online_test.go
│   │       ├── list_test.go
│   │       ├── local_provider.go
│   │       ├── manager.go
│   │       ├── remove.go
│   │       ├── remove_online_test.go
│   │       ├── remove_test.go
│   │       ├── search.go
│   │       ├── search_test.go
│   │       ├── sync.go
│   │       ├── sync_online_test.go
│   │       ├── sync_test.go
│   │       ├── update.go
│   │       ├── update_online_test.go
│   │       └── update_test.go
│   ├── registry/
│   │   ├── module_github_registry.go
│   │   ├── module_local_registry.go
│   │   ├── module_registry.go
│   │   ├── provider_github_registry.go
│   │   ├── provider_github_registry_test.go
│   │   ├── provider_local_registry.go
│   │   ├── provider_local_registry_test.go
│   │   └── provider_registry.go
│   ├── selefra_workspace/
│   │   ├── device_id.go
│   │   ├── device_id_test.go
│   │   └── workspace.go
│   ├── storage/
│   │   └── pgstorage/
│   │       ├── constants.go
│   │       ├── pgstorage-bak.go
│   │       ├── pgstorage-bak_test.go
│   │       ├── pgstorage.go
│   │       ├── schema_owner_information.go
│   │       ├── schema_owner_information_test.go
│   │       ├── table_cache_information.go
│   │       └── table_cache_information_test.go
│   ├── telemetry/
│   │   ├── analytics.go
│   │   ├── analytics_test.go
│   │   └── rudderstack.go
│   ├── utils/
│   │   ├── browser.go
│   │   ├── browser_test.go
│   │   ├── channel.go
│   │   ├── close.go
│   │   ├── command.go
│   │   ├── file.go
│   │   ├── github.go
│   │   ├── home.go
│   │   ├── lock.go
│   │   ├── log.go
│   │   ├── openai.go
│   │   ├── reg.go
│   │   ├── request.go
│   │   ├── slice.go
│   │   ├── strava.go
│   │   ├── template.go
│   │   ├── terminal_other.go
│   │   └── terminal_win.go
│   └── version/
│       └── version.go
├── scripts/
│   └── kill-postgresql.sh
└── tests/
    └── workspace/
        ├── offline/
        │   ├── module.yaml
        │   ├── rules/
        │   │   └── iam_mfa.yaml
        │   └── selefra.yaml
        └── online/
            ├── module.yaml
            ├── rules/
            │   └── iam_mfa.yaml
            └── selefra.yaml

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.yaml
================================================
name: 🐛 Bug report
description: Report a bug to help us improve selefra
title: "[Bug]: "
labels: [bug]
assignees:
  - selefra-bot
body:
  - type: markdown
    attributes:
      value: |
        Thanks for taking the time to fill out this bug report!
  - type: input
    id: contact
    attributes:
      label: Contact Details
      description: How can we get in touch with you if we need more info?
      placeholder: ex. email@example.com
    validations:
      required: false
  - type: input
    id: version
    attributes:
      label: Version
      description: Please enter the project version you are currently using?
      placeholder: 0.0.5
    validations:
      required: true
  - type: textarea
    id: what-happened
    attributes:
      label: What happened?
      description: Also tell us, what did you expect to happen?
      placeholder: Tell us what you see!
      value: "A bug happened!"
    validations:
      required: true
  - type: textarea
    id: logs
    attributes:
      label: Relevant log output
      description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
      render: shell
  - type: textarea
    id: advise
    attributes:
      label: Proposed changes
      description: You can provide us with good suggestions or modification plans.

================================================
FILE: .github/ISSUE_TEMPLATE/config.yaml
================================================
blank_issues_enabled: true
contact_links:
  - name: Ask a Question on Selefra Community
    url: https://www.selefra.io/community/join
    about: Join Selefra Community Slack to discuss Selefra with other community members.


================================================
FILE: .github/ISSUE_TEMPLATE/feature-request.yaml
================================================
name: 🚀 Feature Request
description: Suggest a new feature or improvement
title: "[Feature]: "
labels: [feature]
assignees:
  - selefra-bot
body:
  - type: markdown
    attributes:
      value: |
        Thanks for submitting a feature request! Please fill out the details below to help us understand your suggestion.
  - type: dropdown
    id: Priority
    attributes:
      label: Priority
      description: Select the priority of this feature request.
      options:
        - Low
        - Medium
        - High
        - Critical
    validations:
      required: true
  - type: input
    id: contact
    attributes:
      label: Contact Details
      description: How can we get in touch with you if we need more info?
      placeholder: ex. email@example.com
    validations:
      required: false
  - type: input
    id: summary
    attributes:
      label: Summary
      description: Briefly describe the feature you are requesting.
      placeholder: ex. "Add support for custom themes"
    validations:
      required: true
  - type: textarea
    id: description
    attributes:
      label: Description
      description: Provide a detailed description of the feature, including any relevant use cases or scenarios.
      placeholder: "As a user, I would like to be able to..."
    validations:
      required: true
  - type: textarea
    id: benefit
    attributes:
      label: Benefit
      description: Explain how this feature would benefit other users or improve the overall experience.
      placeholder: "This feature would make it easier for users to..."
    validations:
      required: true

================================================
FILE: .github/pull_request_template.md
================================================
## Description
Briefly describe the changes and improvements you have made.

## Related Issues or Feature Requests
List any GitHub issues or feature requests that are related to this PR.

## Testing Strategy
Describe your testing strategy, including the scope of your tests, testing methods, and any other relevant details.

## Screenshots
If you have made any UI changes, please provide screenshots here so that other contributors or project owners can quickly understand your changes.

## Dependencies
If your changes depend on any libraries, plugins, or tools, please list them here.

## Additional Information
Provide any additional information about your contribution, including your testing environment, any issues you encountered and how you solved them, and anything else that you think would be helpful to know.

## License
Your contribution is subject to the project's license agreement. Please specify the license agreement that applies to your contribution.

================================================
FILE: .github/workflows/ci.yaml
================================================
name: CI

on:
  pull_request:
  push:

jobs:
  selefra_test:
    name: go test
    runs-on: ubuntu-latest
    services:
      selefra_postgres:
        image: postgres
        ports:
          - 5432:5432
        env:
          POSTGRES_PASSWORD: pass
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Use Golang
        uses: actions/setup-go@v1
        with:
          go-version: 1.19
      - name: test
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          TZ: Asia/Shanghai
        run: go mod tidy && go test -short -timeout 3600s ./cmd/apply && go test -short -timeout 3600s ./cmd/provider
  selefra_upload:
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    name: Pull Code
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Unshallow
        run: git fetch

      - name: Use Golang
        uses: actions/setup-go@v1
        with:
          go-version: 1.19

      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v3
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Upload Assets
        uses: actions/upload-artifact@v3
        with:
          name: selefra
          path: |
            dist/*.zip
            dist/*.tar.gz

      # - uses: keithweaver/aws-s3-github-action@v1.0.0
      #   name: Copy Folder
      #   with:
      #     command: cp
      #     source: ./dist/
      #     destination: s3://dev-www.selefra.io/app-selefra/
      #     aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      #     aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      #     aws_region: us-east-1
      #     flags: --recursive

================================================
FILE: .github/workflows/release.yaml
================================================
name: release

on:
  release:
    types: [ created, edited ]

jobs:
  selefra_release:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ github.event.inputs.branch }}
      - name: Unshallow
        run: git fetch
      - name: Use Golang
        uses: actions/setup-go@v1
        with:
          go-version: 1.19
      - name: git
        run: git config --global url.https://${{ secrets.SELEFRA_TOKEN }}@github.com/.insteadOf https://github.com/

      # already replaced by compiler injection
      #      - name: Get the release version
      #        id: get_version
      #        run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
      #      - name: Set Version
      #        run: |
      #          sed -i "s#{{version}}#${{ steps.get_version.outputs.VERSION }}#g" cmd/version/version.go
      #          cat cmd/version/version.go

      - name: Run GoReleaser
        if: "github.event.release.prerelease"
        uses: goreleaser/goreleaser-action@v3
        with:
          version: latest
          args: release --skip-publish --skip-validate
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SELEFRA_TELEMETRY_TOKEN: ${{ secrets.SELEFRA_TELEMETRY_TOKEN }}

      - name: Release
        if: "github.event.release.prerelease"
        uses: softprops/action-gh-release@v1
        with:
          files: |
            dist/*checksums.txt
            dist/*.tar.gz
            dist/*.zip
          prerelease: true
          generate_release_notes: true
          token: ${{ secrets.GITHUB_TOKEN }}
        env:
          SELEFRA_TELEMETRY_TOKEN: ${{ secrets.SELEFRA_TELEMETRY_TOKEN }}

      - name: Run GoReleaser
        if: "!github.event.release.prerelease"
        uses: goreleaser/goreleaser-action@v3
        with:
          version: latest
          args: release --rm-dist --skip-validate
        env:
          GITHUB_TOKEN: ${{ secrets.SELEFRA_TOKEN }}
          SELEFRA_TELEMETRY_TOKEN: ${{ secrets.SELEFRA_TELEMETRY_TOKEN }}

================================================
FILE: .gitignore
================================================
.idea/*
.DS_Store
*.log
*.exe
**/test_download/*
**/*.log
test


================================================
FILE: .goreleaser.yml
================================================
project_name: selefra
builds:
  - env: [ CGO_ENABLED=0 ]
    goos:
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      - arm64
    ignore:
      - goos: windows
        goarch: arm64

    id: "selefra"
    binary:
      'selefra'
    ldflags:
      - -X 'github.com/selefra/selefra/cmd/version.Version={{.Version}}'
      - -X 'github.com/selefra/selefra/pkg/cli_env.SelefraTelemetryToken={{.Env.SELEFRA_TELEMETRY_TOKEN}}'

archives:
  - files:
      - none*
    format: zip
    id: homebrew
    name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
    format_overrides:
      - goos: linux
        format: tar.gz

brews:
  - ids:
      - homebrew
    name: selefra
    tap:
      owner: selefra
      name: homebrew-tap
      branch: main
    folder: Formula
    url_template: "https://github.com/selefra/selefra/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
    homepage: "https://selefra.io/"
    description: "Selefra - Infrastructure as Code for Infrastructure Analysis."
    skip_upload: auto
    install: |-
      bin.install "selefra"




================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)


================================================
FILE: CONTRIBUTING.md
================================================
<!-- Your Title -->
<p align="center">
<a href="https://www.selefra.io/" target="_blank">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/124020340/225567784-61adb5e7-06ae-402a-9907-69c1e6f1aa9e.png"><source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/124020340/224677116-44ae9c6c-a543-4813-9ef3-c7cbcacd2fbe.png"><img width="400px" alt="Steampipe Logo" src="https://user-images.githubusercontent.com/124020340/224677116-44ae9c6c-a543-4813-9ef3-c7cbcacd2fbe.png"></picture>
<a/>
</p>

<!-- Description -->
  <p align="center">
    <i>Selefra is an open-source policy-as-code software that provides analytics for multi-cloud and SaaS.</i>
  </p>
  
  <!-- Badges -->
<p align="center">   
<img alt="go" src="https://img.shields.io/badge/go-1.19-1E90FF"></a>
<a href="https://github.com/selefra/selefra"><img alt="Total" src="https://img.shields.io/github/downloads/selefra/selefra/total?logo=github"></a>
<a href="https://github.com/selefra/selefra/blob/master/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/selefra/selefra?style=social"></a>
  </p>
  
  <!-- Badges -->
  <p align="center">
<a href="https://selefra.io/community/join"><img src="https://img.shields.io/badge/-Slack-424549?style=social&logo=Slack" height=25></a>
    &nbsp;
    <a href="https://twitter.com/SelefraCorp"><img src="https://img.shields.io/badge/-Twitter-red?style=social&logo=twitter" height=25></a>
    &nbsp;
    <a href="https://www.reddit.com/r/Selefra"><img src="https://img.shields.io/badge/-Reddit-red?style=social&logo=reddit" height=25></a>
    &nbsp;
    <a href="https://selefra.medium.com/"><img src="https://img.shields.io/badge/-Medium-red?style=social&logo=medium" height=25></a>

  </p>
  
<p align="center">
  <img src="https://user-images.githubusercontent.com/124020340/225897757-188f1a50-2efa-4a9e-9199-7cb7f68485be.png">
</p>
<br/>

## Contributing to Selefra

Welcome aboard Selefra! First thing first, thank you for contributing to selefra! 

### Code of Conduct 

We value each and every member, make sure to take some time and read the [Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md) to help maintain a productive and friendly community.

### Selefra Architecture

#### Overview

Selefra is a project that consists of four main components: CLI, SDK, Provider, and Module. The CLI provides the interface for users to interact with the Selefra system. The SDK provides the necessary tools and capabilities for the CLI and Provider to communicate with each other. The Provider is responsible for detecting certain conditions or issues, while the Module stores the standards and rules for the Provider to use.

- CLI

  The CLI component is the user-facing part of the Selefra system. It provides a command-line interface for users to interact with the system and run various commands. The CLI communicates with the SDK to initiate detection processes and receive results from the Provider.

- SDK

  The SDK is the foundation of the Selefra project, providing the necessary tools and capabilities for the CLI and Provider to communicate with each other. It includes a set of APIs and libraries that allow developers to integrate their applications with Selefra easily. The SDK also handles all the communication and data transfer between the CLI and the Provider.

- Provider

  The Provider is responsible for detecting specific conditions or issues and reporting them back to the CLI. It interacts with the SDK and the Module to perform its tasks. The Provider is designed to be modular and extensible, meaning that developers can add their own detection capabilities by creating new Provider modules.

- Module

  The Module is where the detection standards and rules are stored. It provides the data that the Provider needs to perform its tasks. The Module is designed to be flexible, allowing developers to customize or extend it based on their needs.

### Provider Registry

The Provider Registry is a Registry Services directory of domain-specific services that are exposed by products. If you want us to add a new plugin or resource please open an [Issue](https://github.com/selefra/selefra/issues).

### Submitting PR

1. Fork the repository to your own GitHub account.
2. Clone the project to your machine.
3. Create a new branch to work on. Branch from `develop` if it exists, else from `main`.
4. Make your changes and commit them. Make sure your commits are concise and descriptive.
5. Push your changes to your GitHub account.
6. Create a Pull Request (PR) from your branch to the `develop` branch in the main repository.


## Community

Selefra is a community-driven project, we welcome you to open a [GitHub Issue](https://github.com/selefra/selefra/issues/new/choose) to report a bug, suggest an improvement, or request new feature.

-  Join <a href="https://selefra.io/community/join"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225563969-3f3d4c45-fb3f-4932-831d-01ab9e59c921.png"></a> [Selefra Community](https://selefra.io/community/join) on Slack. We host `Community Hour` for tutorials and Q&As on regular basis.
-  Follow us on <a href="https://twitter.com/SelefraCorp"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225564426-82f5afbc-5638-4123-871d-fec6fdc6457f.png"></a> [Twitter](https://twitter.com/SelefraCorp) and share your thoughts!
-  Email us at <a href="support@selefra.io"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225564710-741dc841-572f-4cde-853c-5ebaaf4d3d3c.png"></a>&nbsp;support@selefra.io

## License

[Mozilla Public License v2.0](https://github.com/selefra/selefra/blob/main/LICENSE)



================================================
FILE: Dockerfile
================================================
FROM golang:1.20

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y postgresql postgresql-contrib

ENV POSTGRES_USER postgres
ENV POSTGRES_PASSWORD pass

ENV POSTGRES_PORT 15432

ENV SELEFRA_DATABASE_DSN 'host=127.0.0.1 user=postgres password=pass port=15432 dbname=postgres sslmode=disable'

COPY . /selefra

WORKDIR /selefra

RUN go env -w GOPROXY=https://goproxy.cn,direct

RUN go mod tidy

RUN go build -o selefra

RUN mv selefra /usr/local/bin/

EXPOSE 15432

================================================
FILE: LICENSE
================================================
Mozilla Public License Version 2.0
==================================

1. Definitions
--------------

1.1. "Contributor"
    means each individual or legal entity that creates, contributes to
    the creation of, or owns Covered Software.

1.2. "Contributor Version"
    means the combination of the Contributions of others (if any) used
    by a Contributor and that particular Contributor's Contribution.

1.3. "Contribution"
    means Covered Software of a particular Contributor.

1.4. "Covered Software"
    means Source Code Form to which the initial Contributor has attached
    the notice in Exhibit A, the Executable Form of such Source Code
    Form, and Modifications of such Source Code Form, in each case
    including portions thereof.

1.5. "Incompatible With Secondary Licenses"
    means

    (a) that the initial Contributor has attached the notice described
        in Exhibit B to the Covered Software; or

    (b) that the Covered Software was made available under the terms of
        version 1.1 or earlier of the License, but not also under the
        terms of a Secondary License.

1.6. "Executable Form"
    means any form of the work other than Source Code Form.

1.7. "Larger Work"
    means a work that combines Covered Software with other material, in
    a separate file or files, that is not Covered Software.

1.8. "License"
    means this document.

1.9. "Licensable"
    means having the right to grant, to the maximum extent possible,
    whether at the time of the initial grant or subsequently, any and
    all of the rights conveyed by this License.

1.10. "Modifications"
    means any of the following:

    (a) any file in Source Code Form that results from an addition to,
        deletion from, or modification of the contents of Covered
        Software; or

    (b) any new file in Source Code Form that contains any Covered
        Software.

1.11. "Patent Claims" of a Contributor
    means any patent claim(s), including without limitation, method,
    process, and apparatus claims, in any patent Licensable by such
    Contributor that would be infringed, but for the grant of the
    License, by the making, using, selling, offering for sale, having
    made, import, or transfer of either its Contributions or its
    Contributor Version.

1.12. "Secondary License"
    means either the GNU General Public License, Version 2.0, the GNU
    Lesser General Public License, Version 2.1, the GNU Affero General
    Public License, Version 3.0, or any later versions of those
    licenses.

1.13. "Source Code Form"
    means the form of the work preferred for making modifications.

1.14. "You" (or "Your")
    means an individual or a legal entity exercising rights under this
    License. For legal entities, "You" includes any entity that
    controls, is controlled by, or is under common control with You. For
    purposes of this definition, "control" means (a) the power, direct
    or indirect, to cause the direction or management of such entity,
    whether by contract or otherwise, or (b) ownership of more than
    fifty percent (50%) of the outstanding shares or beneficial
    ownership of such entity.

2. License Grants and Conditions
--------------------------------

2.1. Grants

Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:

(a) under intellectual property rights (other than patent or trademark)
    Licensable by such Contributor to use, reproduce, make available,
    modify, display, perform, distribute, and otherwise exploit its
    Contributions, either on an unmodified basis, with Modifications, or
    as part of a Larger Work; and

(b) under Patent Claims of such Contributor to make, use, sell, offer
    for sale, have made, import, and otherwise transfer either its
    Contributions or its Contributor Version.

2.2. Effective Date

The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.

2.3. Limitations on Grant Scope

The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:

(a) for any code that a Contributor has removed from Covered Software;
    or

(b) for infringements caused by: (i) Your and any other third party's
    modifications of Covered Software, or (ii) the combination of its
    Contributions with other software (except as part of its Contributor
    Version); or

(c) under Patent Claims infringed by Covered Software in the absence of
    its Contributions.

This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).

2.4. Subsequent Licenses

No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).

2.5. Representation

Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.

2.6. Fair Use

This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.

2.7. Conditions

Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.

3. Responsibilities
-------------------

3.1. Distribution of Source Form

All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.

3.2. Distribution of Executable Form

If You distribute Covered Software in Executable Form then:

(a) such Covered Software must also be made available in Source Code
    Form, as described in Section 3.1, and You must inform recipients of
    the Executable Form how they can obtain a copy of such Source Code
    Form by reasonable means in a timely manner, at a charge no more
    than the cost of distribution to the recipient; and

(b) You may distribute such Executable Form under the terms of this
    License, or sublicense it under different terms, provided that the
    license for the Executable Form does not attempt to limit or alter
    the recipients' rights in the Source Code Form under this License.

3.3. Distribution of a Larger Work

You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).

3.4. Notices

You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.

3.5. Application of Additional Terms

You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.

4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------

If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.

5. Termination
--------------

5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.

5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.

5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.

************************************************************************
*                                                                      *
*  6. Disclaimer of Warranty                                           *
*  -------------------------                                           *
*                                                                      *
*  Covered Software is provided under this License on an "as is"       *
*  basis, without warranty of any kind, either expressed, implied, or  *
*  statutory, including, without limitation, warranties that the       *
*  Covered Software is free of defects, merchantable, fit for a        *
*  particular purpose or non-infringing. The entire risk as to the     *
*  quality and performance of the Covered Software is with You.        *
*  Should any Covered Software prove defective in any respect, You     *
*  (not any Contributor) assume the cost of any necessary servicing,   *
*  repair, or correction. This disclaimer of warranty constitutes an   *
*  essential part of this License. No use of any Covered Software is   *
*  authorized under this License except under this disclaimer.         *
*                                                                      *
************************************************************************

************************************************************************
*                                                                      *
*  7. Limitation of Liability                                          *
*  --------------------------                                          *
*                                                                      *
*  Under no circumstances and under no legal theory, whether tort      *
*  (including negligence), contract, or otherwise, shall any           *
*  Contributor, or anyone who distributes Covered Software as          *
*  permitted above, be liable to You for any direct, indirect,         *
*  special, incidental, or consequential damages of any character      *
*  including, without limitation, damages for lost profits, loss of    *
*  goodwill, work stoppage, computer failure or malfunction, or any    *
*  and all other commercial damages or losses, even if such party      *
*  shall have been informed of the possibility of such damages. This   *
*  limitation of liability shall not apply to liability for death or   *
*  personal injury resulting from such party's negligence to the       *
*  extent applicable law prohibits such limitation. Some               *
*  jurisdictions do not allow the exclusion or limitation of           *
*  incidental or consequential damages, so this exclusion and          *
*  limitation may not apply to You.                                    *
*                                                                      *
************************************************************************

8. Litigation
-------------

Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.

9. Miscellaneous
----------------

This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.

10. Versions of the License
---------------------------

10.1. New Versions

Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.

10.2. Effect of New Versions

You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.

10.3. Modified Versions

If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).

10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses

If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.

Exhibit A - Source Code Form License Notice
-------------------------------------------

  This Source Code Form is subject to the terms of the Mozilla Public
  License, v. 2.0. If a copy of the MPL was not distributed with this
  file, You can obtain one at http://mozilla.org/MPL/2.0/.

If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.

You may add additional accurate notices of copyright ownership.

Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------

  This Source Code Form is "Incompatible With Secondary Licenses", as
  defined by the Mozilla Public License, v. 2.0.


================================================
FILE: Makefile
================================================
news.ycombinator.com
github.com
freecodecamp.org
publickey1.jp
thenewstack.io
api.daily.dev
roadmap.sh
dev.to
statics.teams.cdn.office.net
hckrnews.com
freestuff.dev
medium.com
libhunt.com
itmedia.co.jp
fullstory.lightning.force.com
dynamitejobs.com
link.csdn.net
free-for.dev
bluelight.co
events.linuxfoundation.org
alvinashcraft.com
activecampaign.atlassian.net
app.otta.com
presearch.com
build5nines.com

================================================
FILE: README.md
================================================
<!-- Your Title -->
<p align="center">
<a href="https://www.selefra.io/" target="_blank">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/124020340/225567784-61adb5e7-06ae-402a-9907-69c1e6f1aa9e.png"><source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/124020340/224677116-44ae9c6c-a543-4813-9ef3-c7cbcacd2fbe.png"><img width="400px" alt="Steampipe Logo" src="https://user-images.githubusercontent.com/124020340/224677116-44ae9c6c-a543-4813-9ef3-c7cbcacd2fbe.png"></picture>
<a/>
</p>

<!-- Description -->
  <p align="center">
    <i>Selefra is an open-source policy-as-code software that provides analytics for multi-cloud and SaaS.</i>
  </p>

  <!-- Badges -->
<p align="center">   
<a href="https://pkg.go.dev/github.com/selefra/selefra"><img alt="go" src="https://img.shields.io/badge/go-1.19-1E90FF" /></a>
<a href="https://github.com/selefra/selefra"><img alt="Total" src="https://img.shields.io/github/downloads/selefra/selefra/total?logo=github"></a>
<a href="https://github.com/selefra/selefra/blob/master/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/selefra/selefra?style=social"></a>
  </p>

  <!-- Badges -->
  <p align="center">
<a href="https://selefra.io/community/join"><img src="https://img.shields.io/badge/-Slack-424549?style=social&logo=Slack" height=25></a>
    &nbsp;
    <a href="https://twitter.com/SelefraCorp"><img src="https://img.shields.io/badge/-Twitter-red?style=social&logo=twitter" height=25></a>
    &nbsp;
    <a href="https://www.reddit.com/r/Selefra"><img src="https://img.shields.io/badge/-Reddit-red?style=social&logo=reddit" height=25></a>
    &nbsp;
    <a href="https://selefra.medium.com/"><img src="https://img.shields.io/badge/-Medium-red?style=social&logo=medium" height=25></a>

  </p>

<p align="center">
  <img width="900" alt="banner" src="https://user-images.githubusercontent.com/124020340/232656647-58e2c31f-ba94-48f0-99fc-87ab660309d0.png">
</p>
<br/>

<!-- About Selefra -->

## About Selefra

Selefra means "select * from infrastructure". It is an open-source policy-as-code software that provides analysis for multi-cloud and SaaS environments, including over 30 services such as AWS, GCP, Azure, Alibaba Cloud, Kubernetes, Github, Cloudflare, and Slack.

For best practices and detailed instructions, refer to the Docs. Within the [Docs](https://selefra.io/docs/introduction), you will find information on installation, CLI usage, project workflow, and more guides on how to accomplish cloud inspection tasks.

With Selefra, you can engage in conversations with GPT models, which will analyze the information and provide relevant suggestions for security, cost, and architecture checks, helping you better manage their cloud resources, enhance security, reduce costs, and optimize architecture design.

<img align="right" width="570" alt="img_code" src="https://user-images.githubusercontent.com/124020340/232016353-67b21268-ae70-47a9-a848-cad0f2fce66f.gif">

#### 🔥 Policy as Code

Custom analysis policies (security, compliance, cost) can be written through a combination of SQL and YAML.

#### 💥 Configuration of Multi-Cloud, Multi-SaaS

Unified multi-cloud configuration data integration capabilities that can support analysis of configuration data from any cloud service via SQL.

#### 🌟 Version Control

Analysis policies can be managed through VCS such as GitHub/Gitlab.

#### 🥤 Automation

Policies can be automated to enforce compliance, security, and cost optimization rules through Scheduled tasks and cloud automation tools.

## Getting started

Read detailed documentation for how to [Get Started](https://selefra.io/docs/get-started/) with Selefra.

For quick start, run this demo, it should take less than a few minutes:

1. **Install Selefra**

   For non-macOS users, [download packages](https://github.com/selefra/selefra/releases) to install Selefra.

   On macOS, tap Selefra with Homebrew:

    ```bash
    brew tap selefra/tap
    ```

   Next, install Selefra:

    ```bash
    brew install selefra/tap/selefra
    ```

2. **Initialization project**

    ```bash
    mkdir selefra-demo && cd selefra-demo && selefra init
    ```

3. **Build code**

    ```bash
    selefra apply 
    ```
   
## 🔥 Analyze cloud resources using GPT

You can refer to the [documentation](https://selefra.io/docs/get-started#use-gpt)  to configure your OPENAPI_API_KEY in advance and start analyzing your cloud resources

```bash
selefra gpt <"what you want to analyze"> --openai_mode=gpt-3.5 --openai_limit=5 --openai_api_key=<Your Openai Api Key>
```

## Selefra Community Ecosystem

 Provider | Introduce | Status |
 | --------| ----- | ------ |
| [AWS](https://www.selefra.io/docs/providers-connector/aws)|The AWS Provider for Selefra can be used to extract data from many of the cloud services by AWS. The provider must be configured with credentials to extract and analyze infrastructure data from AWS. | Stable |
| [GCP](https://www.selefra.io/docs/providers-connector/gcp)|The GCP Provider for Selefra can be used to extract data from many of the cloud services by GCP. The provider must be configured with credentials to extract and analyze infrastructure data from GCP. | Stable |
| [K8S](https://www.selefra.io/docs/providers-connector/k8s)|The K8s Provider for Selefra can be used to extract data from many of the cloud services by K8s. The provider must be configured with credentials to extract and analyze infrastructure data from K8s. | Stable |
| [Azure](https://www.selefra.io/docs/providers-connector/azure)| The Azure Provider for Selefra can be used to extract data from many of the cloud services by Azure. The provider must be configured with credentials to extract and analyze infrastructure data from Azure.    | Stable |
| [Slack](https://www.selefra.io/docs/providers-connector/slack)| The Slack Provider for Selefra can be used to extract data from many of the cloud services by Slack. The provider must be configured with credentials to extract and analyze infrastructure data from Slack.    | Stable |
| [Cloudflare](https://www.selefra.io/docs/providers-connector/cloudflare)| The Cloudflare Provider for Selefra can be used to extract data from many of the cloud services by Cloudflare. The provider must be configured with credentials to extract and analyze infrastructure data from Cloudflare.    | Stable |
| [Datadog](https://www.selefra.io/docs/providers-connector/datadog)| The Datadog Provider for Selefra can be used to extract data from many of the cloud services by Datadog. The provider must be configured with credentials to extract and analyze infrastructure data from Datadog.    | Stable |
| [Microsoft365](https://www.selefra.io/docs/providers-connector/microsoft365)| The Microsoft365 Provider for Selefra can be used to extract data from many of the cloud services by Microsoft365. The provider must be configured with credentials to extract and analyze infrastructure data from Microsoft365.    | Stable |
| [Vercel](https://www.selefra.io/docs/providers-connector/vercel)| The Vercel Provider for Selefra can be used to extract data from many of the cloud services by Vercel. The provider must be configured with credentials to extract and analyze infrastructure data from Vercel.    | Stable |
| [Github](https://www.selefra.io/docs/providers-connector/github)| The Github Provider for Selefra can be used to extract data from many of the cloud services by Github. The provider must be configured with credentials to extract and analyze infrastructure data from Github.    | Stable |
| [GoogleWorksplace](https://www.selefra.io/docs/providers-connector/googleworksplace)| The GoogleWorksplace Provider for Selefra can be used to extract data from many of the cloud services by GoogleWorksplace. The provider must be configured with credentials to extract and analyze infrastructure data from GoogleWorksplace.    | Stable |
| [Auth0](https://www.selefra.io/docs/providers-connector/auth0)| The Auth0 Provider for Selefra can be used to extract data from many of the cloud services by Auth0. The provider must be configured with credentials to extract and analyze infrastructure data from Auth0.    | Stable |
| [Zendesk](https://www.selefra.io/docs/providers-connector/zendesk)| The Zendesk Provider for Selefra can be used to extract data from many of the cloud services by Zendesk. The provider must be configured with credentials to extract and analyze infrastructure data from Zendesk.    | Stable |
| [Consul](https://www.selefra.io/docs/providers-connector/consul)| The Consul Provider for Selefra can be used to extract data from many of the cloud services by Consul. The provider must be configured with credentials to extract and analyze infrastructure data from Consul.    | Stable |
| [Zoom](https://www.selefra.io/docs/providers-connector/zoom)| The Zoom Provider for Selefra can be used to extract data from many of the cloud services by Zoom. The provider must be configured with credentials to extract and analyze infrastructure data from Zoom.    | Stable |
| [Gandi](https://www.selefra.io/docs/providers-connector/gandi)| The Gandi Provider for Selefra can be used to extract data from many of the cloud services by Gandi. The provider must be configured with credentials to extract and analyze infrastructure data from Gandi.    | Stable |
| [Heroku](https://www.selefra.io/docs/providers-connector/heroku)| The Heroku Provider for Selefra can be used to extract data from many of the cloud services by Heroku. The provider must be configured with credentials to extract and analyze infrastructure data from Heroku.    | Stable |
| [IBM](https://www.selefra.io/docs/providers-connector/ibm)| The IBM Provider for Selefra can be used to extract data from many of the cloud services by IBM. The provider must be configured with credentials to extract and analyze infrastructure data from IBM.    | Stable |
| [Pagerduty](https://www.selefra.io/docs/providers-connector/pagerduty)| The Pagerduty Provider for Selefra can be used to extract data from many of the cloud services by Pagerduty. The provider must be configured with credentials to extract and analyze infrastructure data from Pagerduty.    | Stable |
| [AliCloud](https://www.selefra.io/docs/providers-connector/alicloud)| The AliCloud Provider for Selefra can be used to extract data from many of the cloud services by AliCloud. The provider must be configured with credentials to extract and analyze infrastructure data from AliCloud.    | Stable |
| [Okta](https://www.selefra.io/docs/providers-connector/okta)| The Okta Provider for Selefra can be used to extract data from many of the cloud services by Okta. The provider must be configured with credentials to extract and analyze infrastructure data from Okta.    | Stable |
| [Oci](https://www.selefra.io/docs/providers-connector/oci)| The Oci Provider for Selefra can be used to extract data from many of the cloud services by Oci. The provider must be configured with credentials to extract and analyze infrastructure data from Oci.    | Stable |
| [Boundary](https://www.selefra.io/docs/providers-connector/boundary)| The Boundary Provider for Selefra can be used to extract data from many of the cloud services by Boundary. The provider must be configured with credentials to extract and analyze infrastructure data from Boundary.    | Stable |
| [Stripe](https://www.selefra.io/docs/providers-connector/stripe)| The Stripe Provider for Selefra can be used to extract data from many of the cloud services by Stripe. The provider must be configured with credentials to extract and analyze infrastructure data from Stripe.    | Stable |
| [Planetscale](https://www.selefra.io/docs/providers-connector/planetscale)| The Planetscale Provider for Selefra can be used to extract data from many of the cloud services by Planetscale. The provider must be configured with credentials to extract and analyze infrastructure data from Planetscale.    | Stable |
| [Snowflake](https://www.selefra.io/docs/providers-connector/snowflake)| The Snowflake Provider for Selefra can be used to extract data from many of the cloud services by Snowflake. The provider must be configured with credentials to extract and analyze infrastructure data from Snowflake.    | coming soon |

## Community

Selefra is a community-driven project, we welcome you to open a [GitHub Issue](https://github.com/selefra/selefra/issues/new/choose) to report a bug, suggest an improvement, or request new feature.

-  Join <a href="https://selefra.io/community/join"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225563969-3f3d4c45-fb3f-4932-831d-01ab9e59c921.png"></a> [Selefra Community](https://selefra.io/community/join) on Slack. We host `Community Hour` for tutorials and Q&As on regular basis.
-  Follow us on <a href="https://twitter.com/SelefraCorp"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225564426-82f5afbc-5638-4123-871d-fec6fdc6457f.png"></a> [Twitter](https://twitter.com/SelefraCorp) and share your thoughts!
-  Email us at <a href="support@selefra.io"><img height="16" alt="humanitarian" src="https://user-images.githubusercontent.com/124020340/225564710-741dc841-572f-4cde-853c-5ebaaf4d3d3c.png"></a>&nbsp;support@selefra.io

## Contributing

For developers interested in building Selefra codebase, read through [Contributing.md](https://github.com/selefra/selefra/blob/main/CONTRIBUTING.md) and [Selefra Roadmap](https://github.com/orgs/selefra/projects/1).
Let us know what you would like to work on!

## License

[Mozilla Public License v2.0](https://github.com/selefra/selefra/blob/main/LICENSE)


================================================
FILE: SECURITY.md
================================================
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported          |
| ------- | ------------------ |
| 5.1.x   | :white_check_mark: |
| 5.0.x   | :x:                |
| 4.0.x   | :white_check_mark: |
| < 4.0   | :x:                |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.


================================================
FILE: cli_ui/client.go
================================================
package cli_ui

//import (
//	"context"
//	"errors"
//	"github.com/google/uuid"
//	"github.com/selefra/selefra-provider-sdk/storage"
//	"github.com/selefra/selefra/config"
//	"github.com/selefra/selefra/pkg/registry"
//	"github.com/selefra/selefra/pkg/storage/pgstorage"
//	"github.com/selefra/selefra/ui"
//)
//
//type Client struct {
//	Registry      interface{}
//	PluginManager interface{}
//	Storage       storage.Storage
//	instanceId    uuid.UUID
//}
//
//func CreateClientFromConfig(ctx context.Context, cfg *config.SelefraConfig, instanceId uuid.UUID, provider *config.ProviderDecl, cp config.Provider) (*Client, error) {
//
//	hub := new(interface{})
//	pm := new(interface{})
//
//	c := &Client{
//		Storage:       nil,
//		cfg:           cfg,
//		Registry:      hub,
//		PluginManager: pm,
//		instanceId:    instanceId,
//	}
//
//	schema := config.GetSchemaKey(provider, cp)
//	sto, diag := pgstorage.Storage(ctx, pgstorage.WithSearchPath(schema))
//	if diag != nil {
//		err := ui.PrintDiagnostic(diag.GetDiagnosticSlice())
//		if err != nil {
//			return nil, errors.New("failed to create pgstorage")
//		}
//	}
//	if sto != nil {
//		c.Storage = sto
//	}
//
//	c.Providers = registry.Providers{}
//	for _, rp := range cfg.RequireProvidersBlock {
//		c.Providers.Set(registry.Provider{Name: rp.Name, Version: rp.Version})
//	}
//
//	return c, nil
//}


================================================
FILE: cli_ui/print.go
================================================
package cli_ui

import (
	"errors"
	"fmt"
	"github.com/hashicorp/go-hclog"
	"runtime"
	"sync"
	"time"

	"github.com/fatih/color"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/logger"
)

// The UI logs are printed to both the console and the log file
type uiPrinter struct {

	// log record logs
	log *logger.Logger
}

func newUiPrinter() *uiPrinter {
	ua := &uiPrinter{}

	ua.log = logger.Default()
	return ua
}

var (
	printerOnce sync.Once
	printer     *uiPrinter
)

var (
	YellowColor  = color.New(color.FgYellow).SprintFunc()
	RedColor     = color.New(color.FgRed).SprintFunc()
	GreenColor   = color.New(color.FgGreen).SprintFunc()
	BlueColor    = color.New(color.FgBlue).SprintFunc()
	MagentaColor = color.New(color.FgMagenta).SprintFunc()
	BlackColor   = color.New(color.FgBlack).SprintFunc()
	CyanColor    = color.New(color.FgCyan).SprintFunc()
	WhiteColor   = color.New(color.FgWhite).SprintFunc()
)

//// fsync write msg to p.fw
//func (p *uiPrinter) fsync(color *color.Color, msg string) {
//	jsonLog := LogJSON{
//		Cmd:   global.Cmd(),
//		Stag:  global.Stage(),
//		Msg:   msg,
//		Time:  time.Now(),
//		Level: getLevel(color),
//	}
//	byteLog, err := json.Marshal(jsonLog)
//	if err != nil {
//		p.log.Error(err.Error())
//		return
//	}
//
//	strLog := string(byteLog)
//	_, _ = p.fw.WriteString(strLog + "\n")
//}

// sync do 2 things: 1. store msg to log file; 2. send msg to rpc server if rpc client exist
// sync do not show anything
//func (p *uiPrinter) sync(color *color.Color, msg string) {
//	// write to file
//	p.fsync(color, msg)
//
//	// send to rpc
//	//logStreamClient := p.rpcClient.LogStreamClient()
//	p.step++
//	if color == ErrorColor {
//		cloud_sdk.SetStatus("error")
//		//p.rpcClient.SetStatus("error")
//	}
//
//	if err := cloud_sdk.LogStreamSend(&logPb.ConnectMsg{
//		ActionName: "",
//		Data: &logPb.LogJOSN{
//			Cmd:   global.Cmd(),
//			Stag:  global.Stage(),
//			Msg:   msg,
//			Time:  timestamppb.Now(),
//			Level: getLevel(color),
//		},
//		Index: p.step,
//		Msg:   "",
//		BaseInfo: &logPb.BaseConnectionInfo{
//			Token:  cloud_sdk.Token(),
//			TaskId: cloud_sdk.TaskID(),
//		},
//	}); err != nil {
//		p.fsync(ErrorColor, err.Error())
//		return
//	}
//
//	return
//}

// printf The behavior of printf is like fmt.Printf that it will format the info
// when withLn is true, it will show format info with a "\n" and call sync, else without a "\n"
func (p *uiPrinter) printf(color *color.Color, format string, args ...any) {
	// logger to file
	if p.log != nil {
		if color == ErrorColor {
			if _, f, l, ok := runtime.Caller(2); ok {
				printer.log.Log(hclog.Error, "%s %s:%d", fmt.Sprintf(format, args...), f, l)
			}
		}
		p.log.Log(color2level(color), format, args...)
	}

	//msg := fmt.Sprintf(format, args...)

	//p.sync(color, msg)

	if color == nil {
		fmt.Printf(format, args...)
	} else {
		_, _ = color.Printf(format, args...)
	}

}

// println The behavior of println is like fmt.Println
// it will show the log info and then call sync
func (p *uiPrinter) println(color *color.Color, args ...any) {
	// logger to file
	if p.log != nil {
		if color == ErrorColor {
			if _, f, l, ok := runtime.Caller(2); ok {
				printer.log.Log(hclog.Error, "%s %s:%d", fmt.Sprintln(args...), f, l)
			}
		}
		p.log.Log(color2level(color), fmt.Sprintln(args...))
	}

	//msg := fmt.Sprint(args...)

	//p.sync(color, msg)

	if color == nil {
		fmt.Println(args...)
	} else {
		_, _ = color.Println(args...)
	}

	return
}

func color2level(color *color.Color) hclog.Level {
	switch color {
	case ErrorColor:
		return hclog.Error
	case WarningColor:
		return hclog.Warn
	case InfoColor:
		return hclog.Info
	case SuccessColor:
		return hclog.Info
	default:
		return hclog.Info
	}
}

var levelColor = []*color.Color{
	InfoColor,
	InfoColor,
	InfoColor,
	InfoColor,
	WarningColor,
	ErrorColor,
	ErrorColor,
}

var defaultLogger = logger.Default()

func init() {
	printerOnce.Do(func() {
		printer = newUiPrinter()
	})
}

const (
	prefixManaged   = "managed"
	prefixUnmanaged = "unmanaged"
	defaultAlias    = "default"
)

var (
	ErrorColor   = color.New(color.FgRed, color.Bold)
	WarningColor = color.New(color.FgYellow, color.Bold)
	//InfoColor    = color.New(color.FgWhite, color.Bold)
	InfoColor    *color.Color = nil
	SuccessColor              = color.New(color.FgGreen, color.Bold)
)

type LogJSON struct {
	Cmd   string    `json:"cmd"`
	Stag  string    `json:"stag"`
	Msg   string    `json:"msg"`
	Time  time.Time `json:"time"`
	Level string    `json:"level"`
}

func getLevel(c *color.Color) string {
	var level string
	switch c {
	case ErrorColor:
		level = "error"
	case WarningColor:
		level = "warn"
	case InfoColor:
		level = "info"
	case SuccessColor:
		level = "success"
	default:
	}
	return level
}

func Errorf(format string, a ...interface{}) {
	printer.printf(ErrorColor, format, a...)
}

func Warningf(format string, a ...interface{}) {
	printer.printf(WarningColor, format, a...)
}

func Successf(format string, a ...interface{}) {
	printer.printf(SuccessColor, format, a...)
}

// Infof info without color
func Infof(format string, a ...interface{}) {
	printer.printf(InfoColor, format, a...)
}

func Errorln(a ...interface{}) {
	printer.println(ErrorColor, a...)
}

func Warningln(a ...interface{}) {
	printer.println(WarningColor, a...)
}

func Successln(a ...interface{}) {
	printer.println(SuccessColor, a...)
}

func Infoln(a ...interface{}) {
	printer.println(InfoColor, a...)
}

func Printf(c *color.Color, format string, a ...any) {
	printer.printf(c, format, a...)
}

func Println(c *color.Color, a ...any) {
	printer.println(c, a...)
}

//func Print(msg string, show bool) {
//	if show {
//		Infoln(msg)
//		return
//	}
//
//	printer.sync(InfoColor, msg)
//}

func SaveLogToDiagnostic(diagnostics []*schema.Diagnostic) {
	for i := range diagnostics {
		if int(diagnostics[i].Level()) >= int(hclog.LevelFromString(global.LogLevel())) {
			defaultLogger.Log(hclog.LevelFromString(global.LogLevel())+1, diagnostics[i].Content())
		}
	}
}

var sdkLogLevelToCLILevelMap map[schema.DiagnosticLevel]hclog.Level

func init() {
	sdkLogLevelToCLILevelMap = make(map[schema.DiagnosticLevel]hclog.Level)
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelTrace] = hclog.Trace
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelDebug] = hclog.Debug
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelInfo] = hclog.Info
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelWarn] = hclog.Warn
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelError] = hclog.Error
	sdkLogLevelToCLILevelMap[schema.DiagnosisLevelFatal] = hclog.Error
}

func SDKLogLevelToCliLevel(level schema.DiagnosticLevel) hclog.Level {
	logLevel, exists := sdkLogLevelToCLILevelMap[level]
	if exists {
		return logLevel
	} else {
		return hclog.Info
	}
}

func PrintDiagnostic(diagnostics []*schema.Diagnostic) error {
	var err error
	for _, diagnostic := range diagnostics {
		logLevel := SDKLogLevelToCliLevel(diagnostic.Level())
		if int(logLevel) >= int(hclog.LevelFromString(global.LogLevel())) {
			defaultLogger.Log(logLevel, diagnostic.Content())
			Println(levelColor[logLevel], diagnostic.Content())
			if diagnostic.Level() == schema.DiagnosisLevelError {
				err = errors.New(diagnostic.Content())
			}
		}
	}
	return err
}

func PrintDiagnostics(diagnostics *schema.Diagnostics) error {
	if diagnostics == nil {
		return nil
	}
	return PrintDiagnostic(diagnostics.GetDiagnosticSlice())
}


================================================
FILE: cli_ui/progress.go
================================================
package cli_ui

import (
	"github.com/vbauerster/mpb/v7"
	"github.com/vbauerster/mpb/v7/decor"
	"io"
	"strings"
	"sync"
	"time"
)

// Bar represents a progress bar
type Bar struct {
	b       *mpb.Bar
	Name    string
	Desc    string
	Start   time.Time
	Current time.Time
}

// Progress is a progress object
type Progress struct {
	p       *mpb.Progress
	bars    sync.Map
	builder strings.Builder
	lock    sync.Mutex
}

func ShowDesc(bar *Bar, wcc ...decor.WC) decor.Decorator {
	producer := func(bar *Bar, wcc ...decor.WC) decor.DecorFunc {
		return func(s decor.Statistics) string {
			return bar.Desc
		}
	}
	return decor.Any(producer(bar), wcc...)
}

func (p *Progress) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser) {
	p.IOBar(src, stream, totalSize)
	return io.NopCloser(strings.NewReader(p.builder.String()))
}

// DefaultProgress creates a new progress object
func DefaultProgress() *Progress {
	p := &Progress{
		p:    mpb.New(),
		bars: sync.Map{},
	}
	return p
}
func (p *Progress) IOBar(name string, reader io.Reader, total int64) {

	bar := p.p.New(total,
		mpb.BarStyle().Rbound("|"),
		mpb.PrependDecorators(
			decor.CountersKibiByte("% .2f / % .2f"),
		),
		mpb.AppendDecorators(
			decor.EwmaETA(decor.ET_STYLE_GO, 90),
			decor.Name(" ] "),
			decor.EwmaSpeed(decor.UnitKiB, "% .2f", 60),
		),
	)
	// create proxy reader
	proxyReader := bar.ProxyReader(reader)
	defer proxyReader.Close()

	// copy from proxyReader, ignoring errors
	_, _ = io.Copy(&p.builder, proxyReader)
	p.p.Wait()
}

// Add adds a new bar to the progress
func (p *Progress) Add(name string, total int64) {

	_, ok := p.bars.Load(name)
	if ok {
		return
	}
	var bar Bar
	bar.b = p.p.AddBar(
		total,
		mpb.BarWidth(100),
		mpb.PrependDecorators(
			decor.Name(name, decor.WCSyncSpaceR),
			decor.CountersNoUnit("[%d/%d]", decor.WCSyncWidth),
		),
		mpb.AppendDecorators(
			decor.OnComplete(
				decor.Elapsed(decor.ET_STYLE_GO),
				"Success",
			),
		),
	)
	bar.Start = time.Now()
	bar.Current = time.Now()
	bar.Name = name
	p.bars.Store(name, &bar)
}

func (p *Progress) Increment(name string, n int64) {

	bar, ok := p.bars.Load(name)
	if !ok {
		return
	}
	bar.(*Bar).b.IncrInt64(n)
	bar.(*Bar).Current = time.Now()
}

func (p *Progress) Current(name string, n int64, desc ...string) {
	bar, ok := p.bars.Load(name)
	if !ok {
		return
	}
	bar.(*Bar).b.SetCurrent(n)
	bar.(*Bar).Current = time.Now()
	bar.(*Bar).Desc = desc[0]
}

func (p *Progress) SetTotal(name string, n int64) {
	bar, ok := p.bars.Load(name)
	if !ok {
		return
	}
	bar.(*Bar).b.SetTotal(n, false)
	bar.(*Bar).Current = time.Now()
}

func (p *Progress) Next(name string) {
	p.Increment(name, 1)
}

func (p *Progress) Done(name string) {
	bar, ok := p.bars.Load(name)
	if !ok {
		return
	}
	bar.(*Bar).b.EnableTriggerComplete()
}

func (p *Progress) Wait(name string) {
	bar, ok := p.bars.Load(name)
	if !ok {
		return
	}
	bar.(*Bar).b.Wait()
}


================================================
FILE: cli_ui/select_providers.go
================================================
package cli_ui

import (
	ui "github.com/gizak/termui/v3"
	"github.com/gizak/termui/v3/widgets"
	"log"
)

const DefaultSelectProvidersTitle = "[ Use arrows to move, Space to select, Enter to complete the selection ]"

// SelectProviders Give a list of providers and let the user select some of them
// Does the installation sequence have to be consistent with the selected sequence? Temporarily, I think it can be inconsistent
func SelectProviders(providers []string, title ...string) map[string]struct{} {

	if len(title) == 0 {
		title = append(title, DefaultSelectProvidersTitle)
	}

	selectProviders := make(map[string]struct{})

	if err := ui.Init(); err != nil {
		log.Fatalf("failed to initialize termui: %v", err)
	}
	defer ui.Close()

	l := newList(title[0], listForShow(providers, selectProviders))
	ui.Render(l)

	previousKey := ""
	uiEvents := ui.PollEvents()

	for {
		e := <-uiEvents
		switch e.ID {
		case "j", "<Down>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollDown()
		case "k", "<Up>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollUp()
		case "<C-d>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollHalfPageDown()
		case "<C-c>":
			return nil
		case "<C-u>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollHalfPageUp()
		case "<C-f>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollPageDown()
		case "<C-b>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollPageUp()
		case "g":
			if len(l.Rows) == 0 {
				continue
			}
			if previousKey == "g" {
				l.ScrollTop()
			}
		case "<Enter>":
			return selectProviders
		case "<Space>":

			if len(l.Rows) == 0 {
				continue
			}

			// Select or deselect provider
			operateProviderName := providers[l.SelectedRow]
			if _, exists := selectProviders[operateProviderName]; exists {
				delete(selectProviders, operateProviderName)
			} else {
				selectProviders[operateProviderName] = struct{}{}
			}
			l.Rows = listForShow(providers, selectProviders)

		case "<Home>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollTop()
		case "G", "<End>":
			if len(l.Rows) == 0 {
				continue
			}
			l.ScrollBottom()
		}

		if previousKey == "g" {
			previousKey = ""
		} else {
			previousKey = e.ID
		}

		ui.Render(l)
	}
}

// Create a list widgets for select providers
func newList(title string, lines []string) *widgets.List {
	l := widgets.NewList()
	l.Rows = lines
	l.TextStyle = ui.NewStyle(ui.ColorYellow)
	l.WrapText = false
	l.Title = title
	l.BorderLeft = false
	l.BorderRight = false
	l.BorderTop = false
	l.BorderBottom = false
	l.SelectedRowStyle = ui.NewStyle(ui.ColorRed)
	l.SetRect(0, 0, 800, 30)
	return l
}

// Shows all the providers and which ones are currently selected
func listForShow(providers []string, selectedProviders map[string]struct{}) []string {
	var listProviders []string
	for _, provider := range providers {
		if _, exists := selectedProviders[provider]; exists {
			// Putting the checkbox first avoids the provider name alignment problem
			listProviders = append(listProviders, " [✔] "+provider)
		} else {
			listProviders = append(listProviders, " [ ] "+provider)
		}
	}
	return listProviders
}


================================================
FILE: cli_ui/select_providers_test.go
================================================
package cli_ui

import (
	"testing"
)

func TestSelectProviders(t *testing.T) {
	//providers := []string{
	//	"aws",
	//	"gcp",
	//	"azure",
	//}
	//selectProviders := SelectProviders(providers)
	//t.Log(selectProviders)
}

func TestSelectProviders_Big(t *testing.T) {
	//var providers []string
	//for i := 0; i < 10000; i++ {
	//	providers = append(providers, fmt.Sprintf("%d-provider-%s", i, id_util.RandomId()))
	//}
	//selectProviders := SelectProviders(providers)
	//t.Log(selectProviders)
}


================================================
FILE: cli_ui/table.go
================================================
package cli_ui

import (
	"fmt"
	"github.com/olekukonko/tablewriter"
	"os"
	"strconv"
	"strings"
)

// ShowTable Shows which tables are currently available
func ShowTable(tableHeader []string, tableBody [][]string, tableFooter []string, setBorder bool) {
	data := tableBody
	table := tablewriter.NewWriter(os.Stdout)
	table.SetHeader(tableHeader)
	if len(tableFooter) > 0 {
		table.SetFooter(tableFooter) // Add Footer
	}
	table.SetBorder(setBorder) // Set Border to false
	table.AppendBulk(data)     // Add Bulk Data
	table.Render()
}

// ShowRows Display the table on the console
// TODO refactor function
func ShowRows(tableHeader []string, tableBodyMatrix [][]string, tableFooter []string, setBorder bool) {
	builder := strings.Builder{}
	tableF := "\t%" + strconv.Itoa(columnMaxWidth(tableHeader)) + "s"
	for rowIndex, row := range tableBodyMatrix {
		builder.WriteString(fmt.Sprintf("\n*********** Row %d **********\n\n", rowIndex))
		for columnIndex, column := range row {
			builder.WriteString(fmt.Sprintf(tableF+":\t%s\n", tableHeader[columnIndex], column))
		}
	}
	fmt.Println(builder.String())
}

// The width of the widest column of several columns is for column width alignment
func columnMaxWidth(columns []string) int {
	maxWidth := 0
	for _, column := range columns {
		if len(column) > maxWidth {
			maxWidth = len(column)
		}
	}
	return maxWidth
}


================================================
FILE: cli_ui/table_test.go
================================================
package cli_ui

func ExampleShowRows() {

	tableHeader := []string{
		"id", "name", "age",
	}
	tableBody := [][]string{
		{
			"1", "Tom", "18",
		},
		{
			"2", "Ada", "26",
		},
		{
			"3", "Sam", "30",
		},
	}
	tableFooter := []string{
		"footer1", "footer2", "footer",
	}
	setBorder := true
	ShowRows(tableHeader, tableBody, tableFooter, setBorder)
	// Output:
	// *********** Row 0 **********
	//
	//	  id:	1
	//	name:	Tom
	//	 age:	18
	//
	//*********** Row 1 **********
	//
	//	  id:	2
	//	name:	Ada
	//	 age:	26
	//
	//*********** Row 2 **********
	//
	//	  id:	3
	//	name:	Sam
	//	 age:	30

}

func ExampleShowTable() {

	tableHeader := []string{
		"id", "name", "age",
	}
	tableBody := [][]string{
		{
			"1", "Tom", "18",
		},
		{
			"2", "Ada", "26",
		},
		{
			"3", "Sam", "30",
		},
	}
	tableFooter := []string{
		"footer1", "footer2", "footer",
	}
	setBorder := true
	ShowTable(tableHeader, tableBody, tableFooter, setBorder)

	// Output:
	// +---------+---------+--------+
	// |   ID    |  NAME   |  AGE   |
	// +---------+---------+--------+
	// |       1 | Tom     |     18 |
	// |       2 | Ada     |     26 |
	// |       3 | Sam     |     30 |
	// +---------+---------+--------+
	// | FOOTER1 | FOOTER2 | FOOTER |
	// +---------+---------+--------+
}


================================================
FILE: cli_ui/user.go
================================================
package cli_ui

import (
	"fmt"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/utils"
	"strings"
)

// ------------------------------------------------- --------------------------------------------------------------------

// CloudTokenRequestPath What is the request path to obtain the cloud token
// If there is a change in the address of the cloud side, synchronize it here
const CloudTokenRequestPath = "/Settings/accessTokens"

// InputCloudToken Guide the user to enter a cloud token
func InputCloudToken(serverUrl string) (string, *schema.Diagnostics) {

	diagnostics := schema.NewDiagnostics()

	tipsTemplate := `selefra will login https://app.selefra.io in your default browser.
if login is successful, the token will be stored as a plain text file for future usage:

   Enter your access token from https://app.selefra.io{{.CloudTokenRequestPath}}
   or hit <ENTER> to complete login in browser:`

	// Render display tips
	data := make(map[string]string)
	data["CloudTokenRequestPath"] = CloudTokenRequestPath
	inputCloudTokenTips, err := utils.RenderingTemplate("input-token-tips-template", tipsTemplate, data)
	if err != nil {
		return "", diagnostics.AddErrorMsg("input-token-tips-template render error: %s", err.Error())
	}
	fmt.Println(inputCloudTokenTips)

	// Open a browser window to allow the user to log in
	_, _, _ = utils.OpenBrowser("https://app.selefra.io" + CloudTokenRequestPath)

	// Read the token entered by the user
	var rawToken string
	_, err = fmt.Scanln(&rawToken)
	//reader := bufio.NewReader(os.Stdin)
	//rawToken, err := reader.ReadString('\n')
	if err != nil {
		return "", diagnostics.AddErrorMsg("Input cloud token error: %s", err.Error())
	}
	cloudToken := strings.TrimSpace(strings.Replace(rawToken, "\n", "", -1))
	if cloudToken == "" {
		return "", diagnostics.AddErrorMsg("No token provided")
	}

	return cloudToken, diagnostics
}

// ShowLoginSuccess The CLI prompt indicating successful login is displayed
func ShowLoginSuccess(serverUrl string, cloudCredentials *cloud_sdk.CloudCredentials) {
	loginSuccessTemplate := `
Retrieved token for user: {{.UserName}}.
Welcome to Selefra CloudClient!
Logged in to selefra as {{.UserName}} (https://{{.ServerHost}}/{{.OrgName}})
`
	template, err := utils.RenderingTemplate("login-success-tips-template", loginSuccessTemplate, cloudCredentials)
	if err != nil {
		Errorf("render login success message error: %s\n", err.Error())
		return
	}
	Successf(template)
}

// ShowLoginFailed Displays a login failure message
func ShowLoginFailed(cloudToken string) {
	Errorf("You input token %s login failed \n", cloudToken)
}

// ------------------------------------------------- --------------------------------------------------------------------

// ShowRetrievedCloudCredentials Displays the results of the local retrieval of login credentials
func ShowRetrievedCloudCredentials(cloudCredentials *cloud_sdk.CloudCredentials) {
	if cloudCredentials == nil {
		return
	}
	Successf(fmt.Sprintf("Auto login with user %s \n", cloudCredentials.UserName))
}

// ------------------------------------------------- --------------------------------------------------------------------

// ShowLogout Display the logout success prompt
func ShowLogout(cloudCredentials *cloud_sdk.CloudCredentials) {
	if cloudCredentials == nil {
		return
	}
	Successf(fmt.Sprintf("User %s logout success \n", cloudCredentials.UserName))
}

// ------------------------------------------------- --------------------------------------------------------------------


================================================
FILE: cmd/apply/apply.go
================================================
package apply

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/executors"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/spf13/cobra"
	"sync/atomic"
)

func NewApplyCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "apply",
		Short:            "Analyze infrastructure",
		Long:             "Analyze infrastructure",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, args []string) error {
			output, _ := cmd.PersistentFlags().GetString("output")
			dir, _ := cmd.PersistentFlags().GetString("dir")
			openaiApiKey, _ := cmd.PersistentFlags().GetString("openai_api_key")
			openaiMode, _ := cmd.PersistentFlags().GetString("openai_mode")
			openaiLimit, _ := cmd.PersistentFlags().GetUint64("openai_limit")
			//projectWorkspace := "./test_data/test_query_module"
			//downloadWorkspace := "./test_download"
			instructions := make(map[string]interface{})
			instructions["output"] = output
			instructions["dir"] = dir
			instructions["openai_api_key"] = openaiApiKey
			instructions["openai_mode"] = openaiMode
			instructions["openai_limit"] = openaiLimit
			projectWorkspace := "./"
			downloadWorkspace, _ := config.GetDefaultDownloadCacheDirectory()

			return Apply(cmd.Context(), instructions, projectWorkspace, downloadWorkspace)
		},
	}
	cmd.PersistentFlags().StringP("output", "p", "", "display content format")
	cmd.PersistentFlags().StringP("dir", "d", "", "define the output directory")
	cmd.PersistentFlags().StringP("openai_api_key", "k", "", "your openai_api_key")
	cmd.PersistentFlags().StringP("openai_mode", "m", "", "what mode to use for analysis\n")
	cmd.PersistentFlags().Uint64P("openai_limit", "i", 10, "how many pieces were analyzed in total")

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

// ------------------------------------------------- --------------------------------------------------------------------

// Apply a project
func Apply(ctx context.Context, instructions map[string]interface{}, projectWorkspace, downloadWorkspace string) error {

	hasError := atomic.Bool{}
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		if utils.IsNotEmpty(message) {
			if err := cli_ui.PrintDiagnostics(message); err != nil {
				hasError.Store(true)
			}
		}
	})
	d := executors.NewProjectLocalLifeCycleExecutor(&executors.ProjectLocalLifeCycleExecutorOptions{
		Instruction:          instructions,
		ProjectWorkspace:     projectWorkspace,
		DownloadWorkspace:    downloadWorkspace,
		MessageChannel:       messageChannel,
		ProjectLifeCycleStep: executors.ProjectLifeCycleStepQuery,
		FetchStep:            executors.FetchStepFetch,
		ProjectCloudLifeCycleExecutorOptions: &executors.ProjectCloudLifeCycleExecutorOptions{
			EnableConsoleTips: true,
			IsNeedLogin:       true,
		},
		//DSN:                                  env.GetDatabaseDsn(),
		FetchWorkerNum: 1,
		QueryWorkerNum: 1,
	}).Execute(ctx)
	messageChannel.ReceiverWait()
	if err := cli_ui.PrintDiagnostics(d); err != nil {
		cli_ui.Errorln("Apply failed")
		return err
		//} else if hasError.Load() {
		//	cli_ui.Errorln("Apply failed")
		//	return fmt.Errorf("Apply Failed")
	} else {
		cli_ui.Infoln("Apply done")
		return nil
	}
}

// ------------------------------------------------- --------------------------------------------------------------------


================================================
FILE: cmd/apply/apply_test.go
================================================
package apply

import (
	"context"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestApply(t *testing.T) {
	//projectWorkspace := "D:\\workspace\\module-mock-test"
	projectWorkspace := "./test_data/test_query_module"
	//projectWorkspace := "D:\\selefra\\workplace\\sfslack-v2-bak"
	downloadWorkspace := "./test_download"
	Instructions := make(map[string]interface{})
	Instructions["dir"] = "./ssss"
	err := Apply(context.Background(), Instructions, projectWorkspace, downloadWorkspace)
	assert.Nil(t, err)
}


================================================
FILE: cmd/apply/test_data/test_query_module/modules.yaml
================================================
modules:
  - name: Misconfigure-S3
    uses: ./rules


================================================
FILE: cmd/apply/test_data/test_query_module/rules/rule.yaml
================================================
rules:
  - name: ebs_encryption_is_disabled_by_default
    query: |
      SELECT
        *
      FROM
        aws_ec2_regional_configs
      WHERE
        ebs_encryption_enabled_by_default IS FALSE;
    labels:
      resource_account_id: '{{.account_id}}'
      resource_id: '{{.region}}'
      resource_region: '{{.region}}'
      resource_type: S3
      bucket_url: 'https://{{.name}}.s3.{{.region}}.amazonaws.com'
      test:
        - test-b:
            test: test
            test1: test1
    metadata:
      author: Selefra
      id: SF010117
      provider: AWS
      remediation:
      severity: Low
      tags:
        - Security
        - Misconfiguration
      title: S3 Bucket is not configured with CORS rules
      main_table: "aws_ec2_regional_configs"
    output: "EBS encryption is disabled by default, region id: {{.region}}"
    main_table: "aws_ec2_regional_configs"

================================================
FILE: cmd/apply/test_data/test_query_module/selefra.yaml
================================================
selefra:
  cloud:
    project: example_project
    organization: example_org
  #    hostname: app.selefra.io
  connection:
    type: postgres
    username: postgres
    password: pass
    host: localhost
    port: "5432"
    database: postgres
    sslmode: disable
  name: example_project
  cli_version: v0.0.1
  providers:
    - name: aws
      source: aws
      version: latest
#    - name: gcp
#      source: gcp
#      version: ">=0.0.9,<=0.0.10"


providers:
  - name: AWS001
    cache: 1d
    provider: aws
    max_goroutines: 100


================================================
FILE: cmd/fetch/fetch.go
================================================
package fetch

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/executors"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/spf13/cobra"
	"sync/atomic"
)

func NewFetchCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "fetch",
		Short:            "Fetch resources from configured providers",
		Long:             "Fetch resources from configured providers",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, args []string) error {

			projectWorkspace := "./"
			downloadWorkspace, _ := config.GetDefaultDownloadCacheDirectory()

			//cli_runtime.Init(projectWorkspace)

			Fetch(projectWorkspace, downloadWorkspace)

			return nil
		},
	}

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func Fetch(projectWorkspace, downloadWorkspace string) *schema.Diagnostics {

	hasError := atomic.Bool{}
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		if utils.IsNotEmpty(message) {
			if err := cli_ui.PrintDiagnostics(message); err != nil {
				hasError.Store(true)
			}
		}
	})
	d := executors.NewProjectLocalLifeCycleExecutor(&executors.ProjectLocalLifeCycleExecutorOptions{
		ProjectWorkspace:                     projectWorkspace,
		DownloadWorkspace:                    downloadWorkspace,
		MessageChannel:                       messageChannel,
		ProjectLifeCycleStep:                 executors.ProjectLifeCycleStepFetch,
		FetchStep:                            executors.FetchStepFetch,
		ProjectCloudLifeCycleExecutorOptions: nil,
		//DSN:                                  env.GetDatabaseDsn(),
		FetchWorkerNum: 1,
		QueryWorkerNum: 20,
	}).Execute(context.Background())
	messageChannel.ReceiverWait()
	_ = cli_ui.PrintDiagnostics(d)
	if utils.HasError(d) || hasError.Load() {
		cli_ui.Errorln("fetch failed!")
	} else {
		cli_ui.Infoln("fetch done!")
	}

	return nil
}


================================================
FILE: cmd/fetch/fetch_test.go
================================================
package fetch

import (
	"testing"
)

func TestFetch(t *testing.T) {
	projectWorkspace := "./test_data/test_fetch_module"
	downloadWorkspace := "./test_download"
	Fetch(projectWorkspace, downloadWorkspace)
}


================================================
FILE: cmd/fetch/test_data/test_fetch_module/modules.yaml
================================================
selefra:
  cloud:
    project: example_project
    organization: example_org
    hostname: app.selefra.io
  #  connection:
  #    type: postgres
  #    username: postgres
  #    password: pass
  #    host: localhost
  #    port: 5432
  #    database: postgres
  #    sslmode: disable
  name: example_project
  cli_version: v0.0.1
  providers:
    - name: mock
      source: mock
      version: latest

providers:
  - name: mock
    cache: 1d
    provider: mock
    foo-count: 1
    bar-count: 1
    sleep-seconds: 0

================================================
FILE: cmd/gpt/gpt.go
================================================
package gpt

import (
	"context"
	"errors"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/executors"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/spf13/cobra"
	"sync/atomic"
)

func NewGPTCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "gpt [prompt]",
		Short:            "Use ChatGPT for analysis",
		Long:             "Use ChatGPT for analysis",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) < 1 {
				return errors.New("your need to input a prompt")
			}
			query := args[0]
			openaiApiKey, _ := cmd.PersistentFlags().GetString("openai_api_key")
			dir, _ := cmd.PersistentFlags().GetString("dir")
			openaiMode, _ := cmd.PersistentFlags().GetString("openai_mode")
			openaiLimit, _ := cmd.PersistentFlags().GetUint64("openai_limit")
			output, _ := cmd.PersistentFlags().GetString("output")

			//projectWorkspace := "./test_data/test_query_module"
			//downloadWorkspace := "./test_download"

			projectWorkspace := "./"
			downloadWorkspace, _ := config.GetDefaultDownloadCacheDirectory()

			instructions := make(map[string]interface{})
			instructions["query"] = query
			instructions["dir"] = dir
			instructions["openai_api_key"] = openaiApiKey
			instructions["openai_mode"] = openaiMode
			instructions["openai_limit"] = openaiLimit
			instructions["output"] = output

			if instructions["query"] == nil || instructions["query"] == "" {
				return errors.New("query is required")
			}

			return Gpt(cmd.Context(), instructions, projectWorkspace, downloadWorkspace)
		},
	}

	cmd.PersistentFlags().StringP("output", "p", "", "display content format")
	cmd.PersistentFlags().StringP("dir", "d", "", "define the output directory")
	cmd.PersistentFlags().StringP("openai_api_key", "k", "", "your openai_api_key")
	cmd.PersistentFlags().StringP("openai_mode", "m", "", "what mode to use for analysis")
	cmd.PersistentFlags().Uint64P("openai_limit", "i", 10, "how many pieces were analyzed in total")

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

// ------------------------------------------------- --------------------------------------------------------------------

// Apply a project
func Gpt(ctx context.Context, instructions map[string]interface{}, projectWorkspace, downloadWorkspace string) error {

	hasError := atomic.Bool{}
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		if utils.IsNotEmpty(message) {
			if err := cli_ui.PrintDiagnostics(message); err != nil {
				hasError.Store(true)
			}
		}
	})

	d := executors.NewProjectLocalLifeCycleExecutor(&executors.ProjectLocalLifeCycleExecutorOptions{
		Instruction:          instructions,
		ProjectWorkspace:     projectWorkspace,
		DownloadWorkspace:    downloadWorkspace,
		MessageChannel:       messageChannel,
		ProjectLifeCycleStep: executors.ProjectLifeCycleStepQuery,
		FetchStep:            executors.FetchStepFetch,
		ProjectCloudLifeCycleExecutorOptions: &executors.ProjectCloudLifeCycleExecutorOptions{
			EnableConsoleTips: true,
			IsNeedLogin:       true,
		},
		//DSN:                                  env.GetDatabaseDsn(),
		FetchWorkerNum: 1,
		QueryWorkerNum: 1,
	}).Execute(ctx)
	messageChannel.ReceiverWait()
	if err := cli_ui.PrintDiagnostics(d); err != nil {
		cli_ui.Errorln("Gpt failed")
		return err
	} else {
		cli_ui.Infoln("Selefra Exit")
		return nil
	}
}

// ------------------------------------------------- --------------------------------------------------------------------


================================================
FILE: cmd/gpt/gpt_test.go
================================================
package gpt

import (
	"context"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestGpt(t *testing.T) {
	//projectWorkspace := "D:\\workspace\\module-mock-test"
	projectWorkspace := "./test_data/test_query_module"
	//projectWorkspace := "D:\\selefra\\workplace\\sfslack-v2-bak"
	downloadWorkspace := "./test_download"
	Instructions := make(map[string]interface{})
	Instructions["query"] = "Please help me analyze the vulnerabilities in AWS S3?"
	Instructions["openai_api_key"] = "xx"
	Instructions["openai_mode"] = "gpt-3.5"
	Instructions["openai_limit"] = uint64(10)
	err := Gpt(context.Background(), Instructions, projectWorkspace, downloadWorkspace)
	assert.Nil(t, err)
}


================================================
FILE: cmd/gpt/test_data/test_query_module/modules.yaml
================================================
selefra:
  openai_api_key: openkey
  openai_mode: gpt-3.5
  openai_limit: 10
  cloud:
    project: example_project
    organization: example_org
  #    hostname: app.selefra.io
  connection:
    type: postgres
    username: postgres
    password: pass
    host: localhost
    port: "5432"
    database: postgres
    sslmode: disable
  name: example_project
  cli_version: v0.0.1
  providers:
    - name: aws
      source: aws
      version: latest
#    - name: gcp
#      source: gcp
#      version: ">=0.0.9,<=0.0.10"


providers:
  - name: aws
    cache: 7d
    provider: aws
    foo-count: 10
    bar-count: 10
    sleep-seconds: 1
    max_goroutines: 1

rules:
#  - name: bucket_versioning_is_disabled
#    query: "Please help me analyze the vulnerabilities in AWS S3?"
#    output: "S3 bucket versioning is disabled, arn: {{.arn}}"


================================================
FILE: cmd/init/init.go
================================================
package init

import (
	"context"
	"errors"
	"github.com/selefra/selefra-provider-sdk/env"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/pkg/cli_env"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/module_loader"
	"github.com/selefra/selefra/pkg/storage/pgstorage"
	"github.com/spf13/cobra"
	"os"
	"sync/atomic"
)

func NewInitCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "init [project name]",
		Short: "Prepare your working directory for other commands",
		Long:  "Prepare your working directory for other commands",
		RunE: func(cmd *cobra.Command, args []string) error {

			relevance, _ := cmd.PersistentFlags().GetString("relevance")
			force, _ := cmd.PersistentFlags().GetBool("force")

			downloadDirectory, err := config.GetDefaultDownloadCacheDirectory()
			if err != nil {
				return err
			}

			projectWorkspace := "./"

			dsn, err := getDsn(cmd.Context(), projectWorkspace, downloadDirectory)
			if err != nil {
				cli_ui.Errorf("Get dsn error: %s \n", err.Error())
				return err
			}

			return NewInitCommandExecutor(&InitCommandExecutorOptions{
				IsForceInit:       force,
				RelevanceProject:  relevance,
				ProjectWorkspace:  projectWorkspace,
				DownloadWorkspace: downloadDirectory,
				DSN:               dsn,
			}).Run(cmd.Context())
		},
	}
	cmd.PersistentFlags().BoolP("force", "f", false, "force overwriting the directory if it is not empty")
	cmd.PersistentFlags().StringP("relevance", "r", "", "associate to selefra cloud project, use only after login")

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func getDsn(ctx context.Context, projectWorkspace, downloadWorkspace string) (string, error) {

	// 1. load from project workspace
	dsn, _ := loadDSNFromProjectWorkspace(ctx, projectWorkspace, downloadWorkspace)
	if dsn != "" {
		cli_ui.Infof("Find database connection in workspace. %s \n", projectWorkspace)
		return dsn, nil
	}

	// 2. load from selefra cloud
	client, diagnostics := cloud_sdk.NewCloudClient(cli_env.GetServerHost())
	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
		return "", err
	}
	if c, _ := client.GetCredentials(); c != nil {
		c, d := client.Login(c.Token)
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		d = client.SaveCredentials(c)
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		orgDSN, d := client.FetchOrgDSN()
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		if orgDSN != "" {
			cli_ui.Infof("Find database connection in you selefra cloud. \n")
			return orgDSN, nil
		}
	}

	// 3. get dsn from env
	dsn = os.Getenv(env.DatabaseDsn)
	if dsn != "" {
		cli_ui.Infof("Find database connection in your env. \n")
		return dsn, nil
	}

	// 4. start default postgresql instance
	hasError := atomic.Bool{}
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		if err := cli_ui.PrintDiagnostics(message); err != nil {
			hasError.Store(true)
		}
	})
	dsn = pgstorage.DefaultPostgreSQL(downloadWorkspace, messageChannel)
	messageChannel.ReceiverWait()
	if dsn != "" {
		cli_ui.Infof("Start default postgresql. \n")
		return dsn, nil
	}

	return "", errors.New("Can not find database connection")
}

// Look for DSN in the configuration of the project's working directory
func loadDSNFromProjectWorkspace(ctx context.Context, projectWorkspace, downloadWorkspace string) (string, error) {
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		// Any error while loading will not print
		//if utils.IsNotEmpty(message) {
		//	_ = cli_ui.PrintDiagnostics(message)
		//}
	})
	loader, err := module_loader.NewLocalDirectoryModuleLoader(&module_loader.LocalDirectoryModuleLoaderOptions{
		ModuleLoaderOptions: &module_loader.ModuleLoaderOptions{
			Source:            projectWorkspace,
			Version:           "",
			DownloadDirectory: downloadWorkspace,
			ProgressTracker:   nil,
			MessageChannel:    messageChannel,
			DependenciesTree:  []string{projectWorkspace},
		},
	})
	if err != nil {
		messageChannel.SenderWaitAndClose()
		return "", err
	}
	rootModule, b := loader.Load(ctx)
	if !b {
		return "", nil
	}
	if rootModule.SelefraBlock != nil && rootModule.SelefraBlock.ConnectionBlock != nil && rootModule.SelefraBlock.ConnectionBlock.BuildDSN() != "" {
		return rootModule.SelefraBlock.ConnectionBlock.BuildDSN(), nil
	}
	return "", nil
}


================================================
FILE: cmd/init/init_command_executor.go
================================================
package init

import (
	"bufio"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"github.com/selefra/selefra-provider-sdk/grpc/shard"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
	"github.com/selefra/selefra-utils/pkg/pointer"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/cmd/init/rule_example"
	"github.com/selefra/selefra/cmd/version"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/executors"
	"github.com/selefra/selefra/pkg/modules/module"
	"github.com/selefra/selefra/pkg/modules/parser"
	"github.com/selefra/selefra/pkg/modules/planner"
	"github.com/selefra/selefra/pkg/plugin"
	"github.com/selefra/selefra/pkg/providers/local_providers_manager"
	"github.com/selefra/selefra/pkg/registry"
	"github.com/selefra/selefra/pkg/storage/pgstorage"
	"github.com/selefra/selefra/pkg/utils"
	"gopkg.in/yaml.v3"
	"io"
	"os"
	"path/filepath"
	"strings"
	"sync/atomic"
)

// ------------------------------------------------- --------------------------------------------------------------------

// InitCommandExecutorOptions The execution options of the executor that executes the initialization command
type InitCommandExecutorOptions struct {

	// Where to put the downloaded file
	DownloadWorkspace string

	// Which path to initialize as the working directory for your project
	ProjectWorkspace string

	// Whether to force the initialization of the working directory
	IsForceInit bool

	// Which project in the cloud you want to associate with
	RelevanceProject string

	// The database link to use
	DSN string
}

// ------------------------------------------------- --------------------------------------------------------------------

type InitCommandExecutor struct {

	// Used to connect to the selefra cloud
	cloudClient *cloud_sdk.CloudClient

	// Some options when executing the command
	options *InitCommandExecutorOptions
}

func NewInitCommandExecutor(options *InitCommandExecutorOptions) *InitCommandExecutor {
	return &InitCommandExecutor{
		options: options,
	}
}

func (x *InitCommandExecutor) Run(ctx context.Context) error {

	// 1. Check and verify that the working directory can be initialized
	if !x.checkWorkspace() {
		return nil
	}

	// 2. choose provider
	providerSlice, err := x.chooseProvidersList(ctx)
	if err != nil {
		return err
	}
	if len(providerSlice) == 0 {
		cli_ui.Infof("You not select provider\n")
	}

	// init files
	selefraBlock := x.initSelefraYaml(ctx, providerSlice)
	if selefraBlock != nil {
		x.initProvidersYaml(ctx, selefraBlock.RequireProvidersBlock)
	}

	x.initRulesYaml(providerSlice)

	//x.initModulesYaml()

	cli_ui.Infof("Selefra has been successfully initialized!\n")
	cli_ui.Infof("Your new Selefra project \"%s\" was created!\n", selefraBlock.Name)
	cli_ui.Infof("To perform an initial analysis, run selefra apply.\n")
	return nil
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *InitCommandExecutor) initHeaderOutput(providers []string) {
	//for i := range providers {
	//	cli_ui.Successln(" [✔]" + providers[i] + "\n")
	//}
	cli_ui.Infof(`	Running with selefra-cli %s

	This command will walk you through creating a new Selefra project

	Enter a value or leave blank to accept the (default), and press <ENTER>.
	Press ^C at any time to quit.`, version.Version)
	cli_ui.Infof("\n\n")
}

func (x *InitCommandExecutor) chooseProvidersList(ctx context.Context) ([]*registry.Provider, error) {
	providerSlice, err := x.requestProvidersList(ctx)
	if err != nil {
		return nil, err
	}

	if len(providerSlice) == 0 {
		return nil, fmt.Errorf("can not get provider list from registry")
	}

	providerNameSlice := make([]string, 0)
	for _, provider := range providerSlice {
		providerNameSlice = append(providerNameSlice, provider.Name)
	}

	x.initHeaderOutput(providerNameSlice)

	providersSet := cli_ui.SelectProviders(providerNameSlice)
	chooseProviderSlice := make([]*registry.Provider, 0)
	for _, provider := range providerSlice {
		if _, exists := providersSet[provider.Name]; exists {
			chooseProviderSlice = append(chooseProviderSlice, provider)
		}
	}
	return chooseProviderSlice, nil
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *InitCommandExecutor) checkWorkspace() bool {

	// 1. check if workspace dir exist, create it
	_, err := os.Stat(x.options.ProjectWorkspace)
	if errors.Is(err, os.ErrNotExist) {
		err = os.Mkdir(x.options.ProjectWorkspace, 0755)
		if err != nil {
			cli_ui.Errorf("Create workspace directory: %s failed: %s\n", x.options.ProjectWorkspace, err.Error())
			return false
		}
		cli_ui.Infof("Create workspace directory: %s success\n", x.options.ProjectWorkspace)
	}

	if x.isNeedForceInit() {
		if !x.options.IsForceInit {
			cli_ui.Errorf("Directory %s is not empty, rerun in an empty directory, or use -- force/-f to force overwriting in the current directory\n", x.options.ProjectWorkspace)
			return false
		} else if !x.reInitConfirm() {
			return false
		}
	}

	return true
}

// ------------------------------------------------- --------------------------------------------------------------------

// Determine whether mandatory initialization is required
func (x *InitCommandExecutor) isNeedForceInit() bool {
	dir, _ := os.ReadDir(x.options.ProjectWorkspace)
	files := make([]string, 0)
	for _, v := range dir {
		// Ignore files that are used internally
		if v.Name() == "logs" || v.Name() == "selefra" || v.Name() == "selefra.exe" {
			continue
		}
		files = append(files, v.Name())
	}
	return len(files) != 0
}

// ------------------------------------------------- --------------------------------------------------------------------

const (
	SelefraInputInitForceConfirm     = "SELEFRA_INPUT_INIT_FORCE_CONFIRM"
	SelefraInputInitRelevanceProject = "SELEFRA_INPUT_INIT_RELEVANCE_PROJECT"
)

// reInitConfirm check if current workspace is selefra workspace, then tell user to choose if rewrite selefra workspace
func (x *InitCommandExecutor) reInitConfirm() bool {

	reader := bufio.NewReader(os.Stdin)
	cli_ui.Warningf("Warning: %s is already init. Continue and overwrite it?[Y/N]", x.options.ProjectWorkspace)
	text, err := reader.ReadString('\n')
	text = strings.TrimSpace(strings.ToLower(text))
	if err != nil && !errors.Is(err, io.EOF) {
		cli_ui.Errorf("Read you input error: %s\n", err.Error())
		return false
	}

	// for test
	if text == "" {
		text = os.Getenv(SelefraInputInitForceConfirm)
	}

	if text != "y" && text != "Y" {
		cli_ui.Errorf("Config file already exists\n")
		return false
	}

	return true
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *InitCommandExecutor) initSelefraYaml(ctx context.Context, providerSlice []*registry.Provider) *module.SelefraBlock {

	selefraBlock := module.NewSelefraBlock()
	projectName, b := x.getProjectName()
	if !b {
		return nil
	}
	selefraBlock.Name = projectName

	// cloud block
	selefraBlock.CloudBlock = x.getCloudBlock(projectName)

	// cli version
	selefraBlock.CliVersion = version.Version
	selefraBlock.LogLevel = "info"

	if len(providerSlice) > 0 {
		requiredProviderSlice := make([]*module.RequireProviderBlock, len(providerSlice))
		for index, provider := range providerSlice {
			requiredProviderBlock := module.NewRequireProviderBlock()
			requiredProviderBlock.Name = provider.Name
			requiredProviderBlock.Source = provider.Name
			requiredProviderBlock.Version = provider.Version
			requiredProviderSlice[index] = requiredProviderBlock
		}
		selefraBlock.RequireProvidersBlock = requiredProviderSlice
	}

	selefraBlock.ConnectionBlock = x.GetConnectionBlock()

	out, err := yaml.Marshal(selefraBlock)
	if err != nil {
		cli_ui.Errorf("Selefra block yaml.Marshal error: %s \n", err.Error())
		return nil
	}
	var selefraNode yaml.Node
	err = yaml.Unmarshal(out, &selefraNode)
	if err != nil {
		cli_ui.Errorf("Selefra yaml.Unmarshal error: %s \n", err.Error())
		return nil
	}
	documentRoot := yaml.Node{
		Kind: yaml.MappingNode,
		Content: []*yaml.Node{
			&yaml.Node{Kind: yaml.ScalarNode, Value: parser.SelefraBlockFieldName},
			&yaml.Node{Kind: yaml.MappingNode, Content: selefraNode.Content[0].Content},
		},
	}
	marshal, err := yaml.Marshal(&documentRoot)
	if err != nil {
		cli_ui.Errorf("Selefra yaml.Marshal error: %s \n", err.Error())
		return nil
	}
	selefraFullPath := filepath.Join(utils.AbsPath(x.options.ProjectWorkspace), "selefra.yaml")
	err = os.WriteFile(selefraFullPath, marshal, 0644)
	if err != nil {
		cli_ui.Errorf("\tWrite %s error: %s \n", selefraFullPath, err.Error())
	} else {
		//cli_ui.Successf("\tWrite %s success \n", selefraFullPath)
	}

	return selefraBlock
}

func (x *InitCommandExecutor) getCloudBlock(projectName string) *module.CloudBlock {

	cloudBlock := module.NewCloudBlock()
	cloudBlock.Project = projectName

	if x.cloudClient != nil {
		credentials, diagnostics := x.cloudClient.GetCredentials()
		if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
			return nil
		}
		cloudBlock.Organization = credentials.OrgName
		cloudBlock.HostName = credentials.ServerHost
	}

	return cloudBlock
}

//// init module.yaml
//func (x *InitCommandExecutor) initModulesYaml() {
//	const moduleComment = `
//modules:
//  - name: AWS_Security_Demo
//    uses:
//    - ./rules/
//`
//	moduleFullPath := filepath.Join(utils.AbsPath(x.options.ProjectWorkspace), "module.yaml")
//	err := os.WriteFile(moduleFullPath, []byte(moduleComment), 0644)
//	if err != nil {
//		cli_ui.Errorf("Write %s error: %s\n", moduleFullPath, err.Error())
//	} else {
//		cli_ui.Successf("Write %s success\n", moduleFullPath)
//	}
//}

var rulesMap map[string]string

func init() {
	rulesMap = make(map[string]string)
	rulesMap["aws"] = rule_example.Aws
	rulesMap["azure"] = rule_example.Azure
	rulesMap["gcp"] = rule_example.GCP
	rulesMap["k8s"] = rule_example.K8S
}

func (x *InitCommandExecutor) initRulesYaml(providerSlice []*registry.Provider) {
	for _, provider := range providerSlice {
		ruleYamlString, exists := rulesMap[provider.Name]
		if !exists {
			ruleYamlString = rule_example.DefaultTemplate
		}
		ruleFullPath := filepath.Join(utils.AbsPath(x.options.ProjectWorkspace), fmt.Sprintf("rules_%s.yaml", provider.Name))
		err := os.WriteFile(ruleFullPath, []byte(ruleYamlString), 0644)
		if err != nil {
			cli_ui.Errorf("\tWrite %s error: %s \n", ruleFullPath, err.Error())
		} else {
			//cli_ui.Successf("\tWrite %s success \n", ruleFullPath)
		}
	}
}

func (x *InitCommandExecutor) initProvidersYaml(ctx context.Context, requiredProviders module.RequireProvidersBlock) {
	if len(requiredProviders) == 0 {
		cli_ui.Infof("No required provider, do not init providers file \n")
		return
	}
	providers, b := x.makeProviders(ctx, requiredProviders)
	if !b {
		return
	}
	out, err := yaml.Marshal(providers)
	if err != nil {
		cli_ui.Errorf("Providers block yaml.Marshal error: %s \n", err.Error())
		return
	}
	//fmt.Println("Providers Yaml string: " + string(out))

	var providersNode yaml.Node
	err = yaml.Unmarshal(out, &providersNode)
	if err != nil {
		cli_ui.Errorf("Providers yaml.Unmarshal error: %s \n", err.Error())
		return
	}
	//fmt.Println(fmt.Sprintf("length: %d", len(providersNode.Content[0].Content[0].Content)))
	documentRoot := &yaml.Node{
		Kind: yaml.MappingNode,
		Content: []*yaml.Node{
			&yaml.Node{Kind: yaml.ScalarNode, Value: parser.ProvidersBlockName},
			&yaml.Node{Kind: providersNode.Content[0].Kind, Content: providersNode.Content[0].Content},
		},
	}
	marshal, err := yaml.Marshal(documentRoot)
	if err != nil {
		cli_ui.Errorf("Providers yaml.Marshal error: %s \n", err.Error())
		return
	}
	//fmt.Println("Yaml string: " + string(marshal))
	providerFullName := filepath.Join(utils.AbsPath(x.options.ProjectWorkspace), "providers.yaml")
	err = os.WriteFile(providerFullName, marshal, 0644)
	if err != nil {
		cli_ui.Errorf("\tWrite %s error: %s \n", providerFullName, err.Error())
	} else {
		//cli_ui.Successf("\tWrite %s success \n", providerFullName)
	}
}

// ------------------------------------------------- --------------------------------------------------------------------

// TODO Automatically installs and starts the database and sets connection items
func (x *InitCommandExecutor) GetConnectionBlock() *module.ConnectionBlock {

	//// 1. Try to get the DSN from the cloud
	//if x.cloudClient != nil {
	//	dsn, diagnostics := x.cloudClient.FetchOrgDSN()
	//	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
	//		return nil
	//	}
	//	if dsn != "" {
	//		return x.parseDsnAsConnectionBlock(dsn)
	//	}
	//}
	//
	//// 2.

	//cli_runtime.Init(x.options.ProjectWorkspace)
	//
	//dsn, diagnostics := cli_runtime.GetDSN()
	//if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
	//	return nil
	//}
	//if dsn != "" {
	//	return module.ParseConnectionBlockFromDSN(dsn)
	//}

	return nil
}

func (x *InitCommandExecutor) getProjectName() (string, bool) {

	// 1. Use the specified one, if any
	if x.options.RelevanceProject != "" {
		return x.options.RelevanceProject, true
	}

	defaultProjectName := filepath.Base(utils.AbsPath(x.options.ProjectWorkspace))

	// 2. Let the user specify from standard input, the default project name is the name of the current folder
	var err error
	reader := bufio.NewReader(os.Stdin)
	fmt.Printf("Project name:(%s)", defaultProjectName)
	projectName, err := reader.ReadString('\n')
	if err != nil {
		cli_ui.Errorf("Read you project name error: %s\n", err.Error())
		return "", false
	}
	projectName = strings.TrimSpace(strings.Replace(projectName, "\n", "", -1))
	if projectName == "" {
		projectName = defaultProjectName
	}
	return projectName, true
}

// Pull all providers from the remote repository
func (x *InitCommandExecutor) requestProvidersList(ctx context.Context) ([]*registry.Provider, error) {
	githubRegistry, err := registry.NewProviderGithubRegistry(registry.NewProviderGithubRegistryOptions(x.options.DownloadWorkspace))
	if err != nil {
		return nil, err
	}
	providerSlice, err := githubRegistry.List(ctx)
	if err != nil {
		return nil, err
	}
	return providerSlice, nil
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *InitCommandExecutor) makeProviders(ctx context.Context, requiredProvidersBlock module.RequireProvidersBlock) (module.ProvidersBlock, bool) {

	providersBlock := make(module.ProvidersBlock, 0)
	// convert required provider block to
	for _, requiredProvider := range requiredProvidersBlock {

		//cli_ui.Infof("Begin install provider %s \n", requiredProvider.Source)

		providerInstallPlan := &planner.ProviderInstallPlan{
			Provider: registry.NewProvider(requiredProvider.Name, requiredProvider.Version),
		}

		// install providers
		hasError := atomic.Bool{}
		messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
			if err := cli_ui.PrintDiagnostics(message); err != nil {
				hasError.Store(true)
			}
		})
		executor, d := executors.NewProviderInstallExecutor(&executors.ProviderInstallExecutorOptions{
			Plans: []*planner.ProviderInstallPlan{
				providerInstallPlan,
			},
			MessageChannel:    messageChannel,
			DownloadWorkspace: x.options.DownloadWorkspace,
			// TODO
			ProgressTracker: nil,
		})
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			messageChannel.SenderWaitAndClose()
			return nil, false
		}
		d = executor.Execute(ctx)
		messageChannel.ReceiverWait()
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return nil, false
		}
		if hasError.Load() {
			return nil, false
		}
		cli_ui.Infof("\tInstall %s@%s verified \n", requiredProvider.Source, requiredProvider.Version)

		// init
		cli_ui.Infof("\tSynchronization %s@%s's config... \n", requiredProvider.Source, requiredProvider.Version)
		configuration, b := x.getProviderInitConfiguration(ctx, executor.GetLocalProviderManager(), providerInstallPlan)
		if !b {
			return nil, false
		}
		providerBlock := module.NewProviderBlock()
		providerBlock.Provider = requiredProvider.Name
		providerBlock.Name = requiredProvider.Name
		providerBlock.Cache = "1d"
		providerBlock.MaxGoroutines = pointer.ToUInt64Pointer(100)
		providerBlock.ProvidersConfigYamlString = configuration
		providersBlock = append(providersBlock, providerBlock)

		//fmt.Println("Provider Block: " + json_util.ToJsonString(providerBlock))

		//cli_ui.Infof("Init provider %s done \n", requiredProvider.Source)
	}
	return providersBlock, true
}

// run provider & get it's init configuration
func (x *InitCommandExecutor) getProviderInitConfiguration(ctx context.Context, localProviderManager *local_providers_manager.LocalProvidersManager, plan *planner.ProviderInstallPlan) (string, bool) {

	// start & get information
	//cli_ui.Infof("Begin init provider %s \n", plan.String())

	// Find the local path of the provider
	localProvider := &local_providers_manager.LocalProvider{
		Provider: plan.Provider,
	}
	installed, d := localProviderManager.IsProviderInstalled(ctx, localProvider)
	if err := cli_ui.PrintDiagnostics(d); err != nil {
		return "", false
	}
	if !installed {
		cli_ui.Errorf("Provider %s not installed, can not exec init for it! \n", plan.String())
		return "", false
	}

	// Find the local installation location of the provider
	localProviderMeta, d := localProviderManager.Get(ctx, localProvider)
	if err := cli_ui.PrintDiagnostics(d); err != nil {
		return "", false
	}

	// Start provider
	plug, err := plugin.NewManagedPlugin(localProviderMeta.ExecutableFilePath, plan.Name, plan.Version, "", nil)
	if err != nil {
		cli_ui.Errorf("Start provider %s at %s failed: %s \n", plan.String(), localProvider.ExecutableFilePath, err.Error())
		return "", false
	}
	// Close the provider at the end of the method execution
	defer plug.Close()

	//cli_ui.Infof("Start provider %s success \n", plan.String())

	// Database connection option
	storageOpt := postgresql_storage.NewPostgresqlStorageOptions(x.options.DSN)
	providerBlock := module.NewProviderBlock()
	providerBlock.Name = plan.Name
	// Because you do not need to actually interact with the database, it is set to public
	pgstorage.WithSearchPath("public")(storageOpt)
	opt, err := json.Marshal(storageOpt)
	if err != nil {
		cli_ui.Errorf("Json marshal postgresql options error: %s \n", err.Error())
		return "", false
	}

	// Initialize the provider
	pluginProvider := plug.Provider()
	//var providerYamlConfiguration string = module.GetDefaultProviderConfigYamlConfiguration(plan.Name, plan.Version)

	providerInitResponse, err := pluginProvider.Init(ctx, &shard.ProviderInitRequest{
		Workspace: pointer.ToStringPointer(utils.AbsPath(x.options.ProjectWorkspace)),
		Storage: &shard.Storage{
			Type:           0,
			StorageOptions: opt,
		},
		IsInstallInit: pointer.FalsePointer(),
		// Without passing in any configuration, there is no interaction with the database
		ProviderConfig: nil,
	})
	if err != nil {
		cli_ui.Errorf("Start provider failed: %s \n", err.Error())
		return "", false
	}
	if err := cli_ui.PrintDiagnostics(providerInitResponse.Diagnostics); err != nil {
		return "", false
	}
	cli_ui.Infof("\tSynchronization %s 's config successful \n", plan.String())

	// Get information about the started provider
	information, err := pluginProvider.GetProviderInformation(ctx, &shard.GetProviderInformationRequest{})
	if err != nil {
		cli_ui.Errorf("Provider %s, get provider information failed: %s \n", plan.String(), err.Error())
		return "", false
	}

	// just for debug
	//fmt.Println("Provider Information Name: " + json_util.ToJsonString(information.Name))
	//fmt.Println("Provider Information Version: " + json_util.ToJsonString(information.Version))
	//fmt.Println("Provider Information DefaultConfiguration: " + json_util.ToJsonString(information.DefaultConfigTemplate))

	return information.DefaultConfigTemplate, true
}

// ------------------------------------------------- --------------------------------------------------------------------


================================================
FILE: cmd/init/init_command_executor_test.go
================================================
package init

import (
	"context"
	"github.com/stretchr/testify/assert"
	"os"
	"testing"
)

func TestInitCommandExecutor_Run(t *testing.T) {

	_ = os.Setenv(SelefraInputInitForceConfirm, "y")

	err := NewInitCommandExecutor(&InitCommandExecutorOptions{
		DownloadWorkspace: "./test_download",
		ProjectWorkspace:  "./test_data",
		IsForceInit:       true,
		RelevanceProject:  "",
		DSN:               "",
	}).Run(context.Background())
	assert.NotNil(t, err)

}


================================================
FILE: cmd/init/init_test.go
================================================
package init

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/env"
	"github.com/stretchr/testify/assert"
	"os"
	"testing"
)

func Test_getDsn(t *testing.T) {
	projectWorkspace := "./test_data"
	downloadWorkspace := "./test_download"
	os.Setenv(env.DatabaseDsn, "")
	dsn, err := getDsn(context.Background(), projectWorkspace, downloadWorkspace)
	assert.Nil(t, err)
	assert.NotEmpty(t, dsn)
}


================================================
FILE: cmd/init/rule_example/aws.yaml
================================================
rules:
  - name: mfa_delete_is_disable
    query: |-
      SELECT
        *
      FROM
        aws_s3_buckets
      WHERE
        versioning_status IS DISTINCT
      FROM
        'Enabled'
        OR versioning_mfa_delete IS DISTINCT
      FROM
        'Enabled';
    labels:
      resource_account_id: '{{.account_id}}'
      resource_id: '{{.arn}}'
      resource_region: '{{.region}}'
      resource_type: S3
      bucket_url: 'https://{{.name}}.s3.{{.region}}.amazonaws.com'
    metadata:
      author: Selefra
      description: Ensure MFA Delete is enable on S3 buckets.
      id: SF010103
      provider: AWS
      severity: Medium
      tags:
        - Security
        - Misconfiguration
        - CIS Benchmark
        - PCI
        - GDPR
        - APRA
        - MAS
        - NIST4
        - ISO 27001
        - SOC 2
      title: MFA delete is disable
    output: "MFA delete is disable, arn: {{.arn}}"
  - name: bucket_logging_disable
    query: |-
      SELECT
        *
      FROM
        aws_s3_buckets
      WHERE
        logging_target_bucket IS NULL
        AND logging_target_prefix IS NULL;
    labels:
      resource_account_id: '{{.account_id}}'
      resource_id: '{{.arn}}'
      resource_region: '{{.region}}'
      resource_type: S3
      bucket_url: 'https://{{.name}}.s3.{{.region}}.amazonaws.com'
    metadata:
      author: Selefra
      description: Ensure S3 bucket logging is enabled.
      id: SF010111
      provider: AWS
      severity: Low
      tags:
        - Security
        - Misconfiguration
        - PCI
        - HIPAA
        - GDPR
        - APRA
        - MAS
        - NIST4
        - ISO 27001
        - SOC 2
        - AWS Config
      title: S3 bucket logging disable
    output: "S3 bucket logging disable, arn: {{.arn}}"
  - name: ebs_encryption_is_disabled_by_default
    query: |-
      SELECT
        *
      FROM
        aws_ec2_regional_configs
      WHERE
        ebs_encryption_enabled_by_default IS FALSE;
    labels:
      resource_account_id: '{{.account_id}}'
      resource_id: '{{.region}}'
      resource_region: '{{.region}}'
      resource_type: EC2
    metadata:
      author: Selefra
      description: Ensure that EBS encryption is enabled by default.
      id: SF010301
      provider: AWS
      severity: Medium
      tags:
        - Security
        - Misconfiguration
        - CIS Benchmark
        - PCI
        - HIPAA
        - GDPR
        - ISO 27001
        - SOC 2
      title: EBS encryption is disabled by default
    output: "EBS encryption is disabled by default, region id: {{.region}}"


================================================
FILE: cmd/init/rule_example/azure.yaml
================================================
rules:
  - name: secure_transfer_required_is_set_to_disabled
    query: |-
      SELECT
        *
      FROM
        azure_storage_accounts
      WHERE
        ( properties ->> 'supportsHttpsTrafficOnly' ) :: BOOLEAN = FALSE;
    labels:
      resource_account_id: '{{.subscription_id}}'
      resource_id: '{{.name}}'
      resource_region: '{{.location}}'
      resource_type: Storage Account
      bucket_url: 'https://{{.name}}.blob.core.windows.net'
    metadata:
      author: Selefra
      description: Enable data encryption in transit.
      id: SF030101
      provider: Azure
      severity: Medium
      tags:
        - Attack Surface
        - Security
        - Misconfiguration
        - CIS Benchmark
        - PCI
        - ISO 27001
        - SOC 2
      title: Secure transfer required is set to disabled
    output: "Secure transfer required is set to disabled, bucket name: {{.name}}, location: {{.location}}"
  - name: public_network_access_is_set_to_allow
    query: |-
      SELECT
        *
      FROM
        azure_storage_accounts
      WHERE
        properties -> 'network_acls' ->> 'defaultAction' IS DISTINCT FROM 'Deny';
    labels:
      resource_account_id: '{{.subscription_id}}'
      resource_id: '{{.name}}'
      resource_region: '{{.location}}'
      resource_type: Storage Account
      bucket_url: 'https://{{.name}}.blob.core.windows.net'
    metadata:
      author: Selefra
      description: Ensure Default Network Access Rule for Storage Accounts is Set to Deny.
      id: SF030105
      provider: Azure
      severity: High
      tags:
        - Attack Scenarios
        - Attack Surface
        - Security
        - Misconfiguration
        - CIS Benchmark
        - PCI
        - ISO 27001
        - SOC 2
      title: Public network access is set to allow
    output: "Public network access is set to allow, bucket name: {{.name}}, location: {{.location}}"
  - name: unattached_disk_exists
    query: |-
      SELECT
        *
      FROM
        azure_compute_disks
      WHERE
        properties ->> 'diskState' = 'Unattached';
    labels:
      resource_account_id: '{{.subscription_id}}'
      resource_id: '{{.name}}'
      resource_region: '{{.location}}'
      resource_type: Virtual Machines
    metadata:
      author: Selefra
      description: Identify any unattached (unused) Microsoft Azure virtual machine disk volumes available within your Azure cloud account and delete them in order to lower the cost of your monthly bill and reduce the risk of sensitive data leakage.
      id: SF030310
      provider: Azure
      severity: Low
      tags:
        - Security
        - Misconfiguration
        - Cost optimisation
      title: Unattached disk exists
    output: "Unattached disk exists, disk name: {{.name}}, location: {{.location}}"


================================================
FILE: cmd/init/rule_example/data.go
================================================
package rule_example

import (
	_ "embed"
)

//go:embed aws.yaml
var Aws string

//go:embed azure.yaml
var Azure string

//go:embed gcp.yaml
var GCP string

//go:embed k8s.yaml
var K8S string

//go:embed default_template.yaml
var DefaultTemplate string


================================================
FILE: cmd/init/rule_example/default_template.yaml
================================================
#rules:
#  - name: here_is_the_name_of_your_rule
#    query: |-
#      SELECT
#        *
#      FROM
#        demo_table
#      WHERE
#        demo_item;
#    output: "Here is the output of your rule when it hits, resource name: {{.name}}"

================================================
FILE: cmd/init/rule_example/gcp.yaml
================================================
rules:
  - name: bucket_does_not_have_uniform_bucket_level_access_enabled
    query: |-
      SELECT
        *
      FROM
        gcp_storage_buckets
      WHERE
        uniform_bucket_level_access :: jsonb ->> 'Enabled' = 'false';
    labels:
      resource_account_id: '{{.project_id}}'
      resource_id: '{{.name}}'
      resource_region: '{{.location}}'
      resource_type: Cloud Storage
      bucket_url: 'https://storage.googleapis.com/{{.name}}'
    metadata:
      author: Selefra
      description: Ensure That Cloud Storage Buckets Have Uniform Bucket-Level Access Enabled.
      id: SF020106
      provider: GCP
      severity: Low
      tags:
        - Attack Surface
        - Security
        - Misconfiguration
        - CIS Benchmark
        - PCI
        - ISO 27001
      title: Bucket does not have uniform bucket-level access enabled
    output: "Bucket does not have uniform bucket-level access enabled, bucket name: {{.name}}, region: {{.location}}"
  - name: bucket_logging_disable
    query: |-
      SELECT
        *
      FROM
        gcp_storage_buckets
      WHERE
        logging IS NULL;
    labels:
      resource_account_id: '{{.project_id}}'
      resource_id: '{{.name}}'
      resource_region: '{{.location}}'
      resource_type: Cloud Storage
      bucket_url: 'https://storage.googleapis.com/{{.name}}'
    metadata:
      author: Selefra
      description: Ensure bucket enable logging.
      id: SF020112
      provider: GCP
      severity: Low
      tags:
        - Security
        - Misconfiguration
        - ISO 27001
      title: Bucket logging disable
    output: "Bucket logging disable, bucket name: {{.name}}, region: {{.location}}"
  - name: instance_disable_deletion_protection
    query: |-
      SELECT
        a1.*,
        a2 ->> 'network_i_p' AS private_ip,
        a3 ->> 'nat_i_p' AS public_ip
      FROM
        gcp_compute_instances AS a1,
        jsonb_array_elements ( a1.network_interfaces :: JSONB ) AS a2,
        jsonb_array_elements ( a2 -> 'access_configs' ) AS a3
      WHERE
        deletion_protection IS FALSE;
    labels:
      resource_account_id: '{{.project_id}}'
      resource_id: '{{.id}}'
      resource_region: '{{.zone}}'
      resource_type: Compute
      public_ip: '{{.public_ip}}'
      private_ip: '{{.private_ip}}'
    metadata:
      author: Selefra
      description: Ensure that your production Google Compute Engine instances have Deletion Protection feature enabled in order to protect them from being accidentally deleted.
      id: SF020314
      provider: GCP
      remediation: ./remediation/compute/instance_disable_deletion_protection.md
      severity: Medium
      tags:
        - Security
        - Misconfiguration
      title: Instance disable deletion protection
    output: "Instance disable deletion protection, instance id: {{.id}}, zone: {{.zone}}"


================================================
FILE: cmd/init/rule_example/k8s.yaml
================================================
rules:
  - name: cronjob_cpu_no_limit
    query: |-
      SELECT
        a1.*
      FROM
        k8s_batch_cron_jobs AS a1,
        jsonb_array_elements (
          spec_job_template -> 'spec' -> 'template' -> 'spec' -> 'containers'
        ) AS a2
      WHERE
        a2 -> 'resources' -> 'limits' ->> 'cpu' IS NULL;
    labels:
      resource_account_id: '{{.namespace}}'
      resource_id: '{{.name}}'
      resource_region: 'Not available'
      resource_type: CronJob
    metadata:
      author: Selefra
      description: Containers in a CronJob should have CPU limit which restricts the container to use no more than a given amount of CPU.
      id: SF050101
      provider: K8S
      severity: Low
      tags:
        - Misconfiguration
        - NSA
      title: Cronjob cpu no limit
    output: "Cronjob cpu no limit, name: {{.name}}"
  - name: daemonset_memory_no_limit
    query: |-
      SELECT
        a1.*
      FROM
        k8s_apps_daemon_sets AS a1,
        jsonb_array_elements (
          spec_template -> 'spec' -> 'containers'
        ) AS a2
      WHERE
        a2 -> 'resources' -> 'limits' ->> 'memory' IS NULL;
    labels:
      resource_account_id: '{{.namespace}}'
      resource_id: '{{.name}}'
      resource_region: 'Not available'
      resource_type: DaemonSet
    metadata:
      author: Selefra
      description: Containers in a DaemonSet should have memory limit which restricts the container to use no more than a given amount of user or system memory.
      id: SF050203
      provider: K8S
      severity: Low
      tags:
        - Misconfiguration
        - NSA
      title: Daemonset memory no limit
    output: "Daemonset memory no limit, name: {{.name}}"


================================================
FILE: cmd/init/test_data/init.sh
================================================
#!/usr/bin/env bash
#######################################################################################################################
#                                                                                                                     #
#                              This script helps you test interactive programs                                        #
#                                                                                                                     #
#                                                                                                                     #
#                                                                                                   Version: 0.0.1    #
#                                                                                                                     #
#######################################################################################################################

# for command `selefra init`
cd ../../../
go build
rm -rf ./test
mkdir test
mv selefra.exe ./test
cd test
echo "begin run command selefra init"
./selefra.exe init $@



================================================
FILE: cmd/login/login.go
================================================
package login

import (
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/cli_env"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/logger"
	"github.com/spf13/cobra"
)

func NewLoginCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "login [token]",
		Short:            "Login to selefra cloud using token",
		Long:             "Login to selefra cloud using token",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE:             RunFunc,
	}

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func RunFunc(cmd *cobra.Command, args []string) error {

	diagnostics := schema.NewDiagnostics()

	cloudServerHost := cli_env.GetServerHost()
	logger.InfoF("Use server address: %s", cloudServerHost)

	client, d := cloud_sdk.NewCloudClient(cloudServerHost)
	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
		return err
	}
	logger.InfoF("Create cloud client success \n")

	var token string
	if len(args) != 0 {
		token = args[0]
		cli_ui.Warningf("Security warning: Entering a token directly on the command line will be recorded in the command line history and may cause your token to leak! \n")
	}

	// If you are already logged in, repeat login is not allowed and you must log out first
	getCredentials, _ := client.GetCredentials()
	if getCredentials != nil {
		cli_ui.Errorf("You already logged in as %s, please logout first. \n", getCredentials.UserName)
		return nil
	}

	// Read the token from standard input
	if token == "" {
		token, d = cli_ui.InputCloudToken(cloudServerHost)
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return err
		}
	}
	if token == "" {
		cli_ui.Errorf("Token can not be empty! \n")
		return nil
	}

	credentials, d := client.Login(token)
	if err := cli_ui.PrintDiagnostics(d); err != nil {
		cli_ui.ShowLoginFailed(token)
		return nil
	}

	cli_ui.ShowLoginSuccess(cloudServerHost, credentials)

	return nil
}


================================================
FILE: cmd/login/login_test.go
================================================
package login

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestRunFunc(t *testing.T) {
	err := RunFunc(nil, nil)
	assert.Nil(t, err)
}


================================================
FILE: cmd/login/test_data/login.sh
================================================
#!/usr/bin/env bash
#######################################################################################################################
#                                                                                                                     #
#                              This script helps you test interactive programs                                        #
#                                                                                                                     #
#                                                                                                                     #
#                                                                                                   Version: 0.0.1    #
#                                                                                                                     #
#######################################################################################################################

# for command `selefra login`
cd ../../../
go build
rm -rf ./test
mkdir test
mv selefra.exe ./test
cd test
echo "begin run command selefra login"
./selefra.exe login $@



================================================
FILE: cmd/logout/logout.go
================================================
package logout

import (
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/pkg/cli_env"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/logger"
	"github.com/spf13/cobra"
)

func NewLogoutCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "logout",
		Short: "Logout to selefra cloud",
		Long:  "Logout to selefra cloud",
		RunE:  RunFunc,
	}

	return cmd
}

func RunFunc(cmd *cobra.Command, args []string) error {

	diagnostics := schema.NewDiagnostics()

	// Server address
	cloudServerHost := cli_env.GetServerHost()
	logger.InfoF("Use server address: %s", cloudServerHost)

	client, d := cloud_sdk.NewCloudClient(cloudServerHost)
	if diagnostics.AddDiagnostics(d).HasError() {
		return cli_ui.PrintDiagnostics(diagnostics)
	}
	logger.InfoF("Create cloud client success \n")

	// If you are not logged in, you are not allowed to log out
	credentials, _ := client.GetCredentials()
	if credentials == nil {
		cli_ui.Errorln("You are not login, please login first! \n")
		return nil
	}
	logger.InfoF("Get credentials success \n")

	// Destroy the local token
	client.SetToken(credentials.Token)
	if err := cli_ui.PrintDiagnostics(client.Logout()); err != nil {
		return err
	}
	cli_ui.ShowLogout(credentials)
	return nil
}


================================================
FILE: cmd/logout/logout_test.go
================================================
package logout

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestRunFunc(t *testing.T) {
	err := RunFunc(nil, nil)
	assert.Nil(t, err)
}


================================================
FILE: cmd/logout/test_data/logout.sh
================================================
#!/usr/bin/env bash
#######################################################################################################################
#                                                                                                                     #
#                              This script helps you test interactive programs                                        #
#                                                                                                                     #
#                                                                                                                     #
#                                                                                                   Version: 0.0.1    #
#                                                                                                                     #
#######################################################################################################################

# for command `selefra logout`
cd ../../../
go build
rm -rf ./test
mkdir test
mv selefra.exe ./test
cd test
echo "begin run command selefra logout"
./selefra.exe logout $@



================================================
FILE: cmd/module/get.go
================================================
package module




================================================
FILE: cmd/module/list.go
================================================
package module


================================================
FILE: cmd/module/search.go
================================================
package module


================================================
FILE: cmd/module/tidy.go
================================================
package module




================================================
FILE: cmd/provider/install.go
================================================
package provider

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/providers/local_providers_manager"
	"github.com/selefra/selefra/pkg/version"
	"github.com/spf13/cobra"
)

func newCmdProviderInstall() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "install",
		Short:            "Install one or more providers, for example: selefra provider install aws",
		Long:             "Install one or more providers, for example: selefra provider install aws",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, args []string) error {
			ctx := cmd.Context()
			downloadDirectory, err := config.GetDefaultDownloadCacheDirectory()
			if err != nil {
				return err
			}
			return Install(ctx, downloadDirectory, args...)
		},
	}

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func Install(ctx context.Context, downloadWorkspace string, requiredProviders ...string) (err error) {

	if len(requiredProviders) == 0 {
		cli_ui.Errorf("Please specify one or more providers to install, for example: selefra provider install aws \n")
		return nil
	}

	manager, err := local_providers_manager.NewLocalProvidersManager(downloadWorkspace)
	if err != nil {
		return err
	}
	for _, nameAndVersionString := range requiredProviders {
		nameAndVersion := version.ParseNameAndVersion(nameAndVersionString)
		messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
			e := cli_ui.PrintDiagnostics(message)
			if err == nil {
				err = e
			}
		})
		manager.InstallProvider(ctx, &local_providers_manager.InstallProvidersOptions{
			RequiredProvider: local_providers_manager.NewLocalProvider(nameAndVersion.Name, nameAndVersion.Version),
			MessageChannel:   messageChannel,
		})
		messageChannel.ReceiverWait()
	}
	return err
}

//func install(ctx context.Context, args []string) error {
//	configYaml, err := config.GetConfig()
//	if err != nil {
//		cli_ui.Errorln(err.Error())
//		return err
//	}
//
//	namespace, _, err := utils.Home()
//	if err != nil {
//		cli_ui.Errorln(err.Error())
//		return nil
//	}
//
//	provider := registry.NewProviderRegistry(namespace)
//	for _, s := range args {
//		splitArr := strings.Split(s, "@")
//		var name string
//		var version string
//		if len(splitArr) > 1 {
//			name = splitArr[0]
//			version = splitArr[1]
//		} else {
//			name = splitArr[0]
//			version = "latest"
//		}
//		pr := registry.Provider{
//			Name:    name,
//			Version: version,
//			Source:  "",
//		}
//		p, err := provider.Download(ctx, pr, true)
//		continueFlag := false
//		for _, provider := range configYaml.Selefra.ProviderDecls {
//			providerName := *provider.Source
//			if strings.ToLower(providerName) == strings.ToLower(p.Name) && strings.ToLower(provider.Version) == strings.ToLower(p.Version) {
//				continueFlag = true
//				break
//			}
//		}
//		if continueFlag {
//			cli_ui.Warningln(fmt.Sprintf("ProviderBlock %s@%s already installed", p.Name, p.Version))
//			continue
//		}
//		if err != nil {
//			cli_ui.Errorf("Installed %s@%s failed:%s", p.Name, p.Version, err.Error())
//			return nil
//		} else {
//			cli_ui.Infof("Installed %s@%s verified", p.Name, p.Version)
//		}
//		cli_ui.Infof("Synchronization %s@%s's config...", p.Name, p.Version)
//		plug, err := plugin.NewManagedPlugin(p.Filepath, p.Name, p.Version, "", nil)
//		if err != nil {
//			cli_ui.Errorf("Synchronization %s@%s's config failed:%s", p.Name, p.Version, err.Error())
//			return nil
//		}
//
//		plugProvider := plug.Provider()
//		storageOpt := pgstorage.DefaultPgStorageOpts()
//		opt, err := json.Marshal(storageOpt)
//		initRes, err := plugProvider.Init(ctx, &shard.ProviderInitRequest{
//			ModuleLocalDirectory: pointer.ToStringPointer(global.WorkSpace()),
//			Storage: &shard.Storage{
//				Type:           0,
//				StorageOptions: opt,
//			},
//			IsInstallInit:  pointer.TruePointer(),
//			ProviderConfig: pointer.ToStringPointer(""),
//		})
//
//		if err != nil {
//			cli_ui.Errorln(err.Error())
//			return nil
//		}
//
//		if initRes != nil && initRes.Diagnostics != nil {
//			err := cli_ui.PrintDiagnostic(initRes.Diagnostics.GetDiagnosticSlice())
//			if err != nil {
//				return nil
//			}
//		}
//
//		res, err := plugProvider.GetProviderInformation(ctx, &shard.GetProviderInformationRequest{})
//		if err != nil {
//			cli_ui.Errorf("Synchronization %s@%s's config failed:%s", p.Name, p.Version, err.Error())
//			return nil
//		}
//		cli_ui.Infof("Synchronization %s@%s's config successful", p.Name, p.Version)
//		err = tools.AppendProviderDecl(p, configYaml, version)
//		if err != nil {
//			cli_ui.Errorln(err.Error())
//			return nil
//		}
//		hasProvider := false
//		for _, Node := range configYaml.Providers.Content {
//			if Node.Kind == yaml.ScalarNode && Node.Value == p.Name {
//				hasProvider = true
//				break
//			}
//		}
//		if !hasProvider {
//			err = tools.SetProviderTmpl(res.DefaultConfigTemplate, p, configYaml)
//		}
//		if err != nil {
//			cli_ui.Errorf("set %s@%s's config failed:%s", p.Name, p.Version, err.Error())
//			return nil
//		}
//	}
//
//	str, err := yaml.Marshal(configYaml)
//	if err != nil {
//		cli_ui.Errorln(err.Error())
//		return nil
//	}
//	path, err := config.GetConfigPath()
//	if err != nil {
//		cli_ui.Errorln(err.Error())
//		return nil
//	}
//	err = os.WriteFile(path, str, 0644)
//	return nil
//}


================================================
FILE: cmd/provider/install_online_test.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestInstallOnline(t *testing.T) {
//	if testing.Short() {
//		t.Skip("skipping test in short mode.")
//		return
//	}
//	global.Init("TestInstallOnline", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//	ctx := context.Background()
//	err := install(ctx, []string{"aws@latest"})
//	if err != nil {
//		t.Error(err)
//	}
//}


================================================
FILE: cmd/provider/install_test.go
================================================
package provider

import (
	"context"
	"github.com/stretchr/testify/assert"
	"testing"
)

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"github.com/spf13/cobra"
//	"github.com/stretchr/testify/require"
//	"testing"
//)
//
//func TestInstall(t *testing.T) {
//	global.Init("TestInstall", global.WithWorkspace("../../tests/workspace/offline"))
//
//	ctx := context.Background()
//	err := install(ctx, []string{"aws@latest"})
//	if err != nil {
//		t.Error(err)
//	}
//}
//
//func TestInstallCmd(t *testing.T) {
//	rootCmd := &cobra.Command{
//		Use: "provider",
//	}
//	installCmd := newCmdProviderInstall()
//	rootCmd.AddCommand(installCmd)
//
//	require.Equal(t, "provider install", global.Cmd())
//}

func Test_install(t *testing.T) {
	err := Install(context.Background(), "./test_download", "mock")
	assert.Nil(t, err)
}


================================================
FILE: cmd/provider/list.go
================================================
package provider

import (
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/providers/local_providers_manager"
	"github.com/selefra/selefra/pkg/version"
	"github.com/spf13/cobra"
)

func newCmdProviderList() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "list",
		Short:            "List currently installed providers",
		Long:             "List currently installed providers",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, args []string) error {

			downloadWorkspace, err := config.GetDefaultDownloadCacheDirectory()
			if err != nil {
				return err
			}

			return List(downloadWorkspace)
		},
	}

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func List(downloadWorkspace string) error {

	manager, err := local_providers_manager.NewLocalProvidersManager(downloadWorkspace)
	if err != nil {
		return err
	}
	providers, diagnostics := manager.ListProviders()
	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
		return err
	}
	if len(providers) == 0 {
		return nil
	}

	table := make([][]string, 0)
	for _, provider := range providers {
		versions := make([]string, 0)
		for versionString := range provider.ProviderVersionMap {
			versions = append(versions, versionString)
		}
		version.Sort(versions)
		for _, versionString := range versions {
			table = append(table, []string{
				provider.ProviderName, versionString, provider.ProviderVersionMap[versionString].ExecutableFilePath,
			})
		}
	}
	cli_ui.ShowTable([]string{"Name", "Version", "Source"}, table, nil, true)

	return nil
}


================================================
FILE: cmd/provider/list_online_test.go
================================================
package provider

//import (
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestListOnline(t *testing.T) {
//	if testing.Short() {
//		t.Skip("skipping test in short mode.")
//		return
//	}
//	global.Init("TestListOnline", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//	err := list()
//	if err != nil {
//		t.Error(err)
//	}
//}


================================================
FILE: cmd/provider/list_test.go
================================================
package provider

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

//import (
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestList(t *testing.T) {
//	global.Init("TestList", global.WithWorkspace("../../tests/workspace/offline"))
//	err := list()
//	if err != nil {
//		t.Error(err)
//	}
//}

func Test_list(t *testing.T) {
	err := List("./test_download")
	assert.Nil(t, err)
}


================================================
FILE: cmd/provider/provider.go
================================================
package provider

import (
	"github.com/spf13/cobra"
)

func NewProviderCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "provider [command]",
		Short: "Top-level command to interact with providers",
		Long:  "Top-level command to interact with providers",
	}

	//cmd.AddCommand(newCmdProviderUpdate(), newCmdProviderRemove(), newCmdProviderRemove(), newCmdProviderList(), newCmdProviderInstall())
	cmd.AddCommand(newCmdProviderRemove(), newCmdProviderList(), newCmdProviderInstall())

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}


================================================
FILE: cmd/provider/remove.go
================================================
package provider

import (
	"context"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/providers/local_providers_manager"
	"github.com/spf13/cobra"
)

func newCmdProviderRemove() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "remove",
		Short:            "Remove providers one or more from the download cache, for example: selefra provider remove aws@v0.0.1",
		Long:             "Remove providers one or more from the download cache, for example: selefra provider remove aws@v0.0.1",
		PersistentPreRun: global.DefaultWrappedInit(),
		RunE: func(cmd *cobra.Command, names []string) error {
			downloadDirectory, err := config.GetDefaultDownloadCacheDirectory()
			if err != nil {
				return err
			}
			return Remove(cmd.Context(), downloadDirectory, names...)
		},
	}

	cmd.SetHelpFunc(cmd.HelpFunc())
	return cmd
}

func Remove(ctx context.Context, downloadWorkspace string, names ...string) error {
	manager, err := local_providers_manager.NewLocalProvidersManager(downloadWorkspace)
	if err != nil {
		return err
	}
	d := manager.RemoveProviders(ctx, names...)
	return cli_ui.PrintDiagnostics(d)
}

//func Remove(names []string) error {
//	argsMap := make(map[string]bool)
//	for i := range names {
//		argsMap[names[i]] = true
//	}
//	deletedMap := make(map[string]bool)
//	cof, err := config.GetConfig()
//	if err != nil {
//		return err
//	}
//	namespace, _, err := utils.Home()
//	if err != nil {
//		return err
//	}
//	provider := registry.NewProviderRegistry(namespace)
//
//	for _, p := range cof.Selefra.ProviderDecls {
//		name := *p.Source
//		path := utils.GetPathBySource(*p.Source, p.Version)
//		prov := registry.ProviderBinary{
//			Provider: registry.Provider{
//				Name:    name,
//				Version: p.Version,
//				Source:  "",
//			},
//			Filepath: path,
//		}
//		if !argsMap[p.Name] || deletedMap[p.Path] {
//			break
//		}
//
//		err := provider.DeleteProvider(prov)
//		if err != nil {
//			if !errors.Is(err, os.ErrNotExist) {
//				cli_ui.Warningf("Failed to remove  %s: %s", p.Name, err.Error())
//			}
//		}
//		_, jsonPath, err := utils.Home()
//		if err != nil {
//			return err
//		}
//		c, err := os.ReadFile(jsonPath)
//		if err == nil {
//			var configMap = make(map[string]string)
//			err = json.Unmarshal(c, &configMap)
//			if err != nil {
//				return err
//			}
//			delete(configMap, *p.Source+"@"+p.Version)
//			c, err = json.Marshal(configMap)
//			if err != nil {
//				return err
//			}
//			err = os.Remove(jsonPath)
//			if err != nil {
//				return err
//			}
//			err = os.WriteFile(jsonPath, c, 0644)
//			if err != nil {
//				return err
//			}
//			deletedMap[path] = true
//		}
//		cli_ui.Infof("Removed %s success", *p.Source)
//	}
//	return nil
//}


================================================
FILE: cmd/provider/remove_online_test.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestRemoveOnline(t *testing.T) {
//	if testing.Short() {
//		t.Skip("skipping test in short mode.")
//		return
//	}
//	global.Init("TestRemoveOnline", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//	err := Remove([]string{"aws"})
//	if err != nil {
//		t.Error(err)
//	}
//	err = install(context.Background(), []string{"aws@latest"})
//	if err != nil {
//		t.Error(err)
//	}
//}


================================================
FILE: cmd/provider/remove_test.go
================================================
package provider

import (
	"context"
	"github.com/stretchr/testify/assert"
	"testing"
)

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestRemove(t *testing.T) {
//	global.Init("TestRemove", global.WithWorkspace("../../tests/workspace/offline"))
//	err := Remove([]string{"aws"})
//	if err != nil {
//		t.Error(err)
//	}
//	err = install(context.Background(), []string{"aws@latest"})
//	if err != nil {
//		t.Error(err)
//	}
//}

func TestRemove(t *testing.T) {

	provider := "mock@v0.0.3"

	err := Install(context.Background(), "./test_download", provider)
	assert.Nil(t, err)

	err = Remove(context.Background(), "./test_download", provider)
	assert.Nil(t, err)
}


================================================
FILE: cmd/provider/sync.go
================================================
package provider

//import (
//	"context"
//	"fmt"
//	"github.com/selefra/selefra-provider-sdk/provider/schema"
//	"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
//	"github.com/selefra/selefra-utils/pkg/id_util"
//	"github.com/selefra/selefra/cli_ui"
//	"github.com/selefra/selefra/cmd/fetch"
//	"github.com/selefra/selefra/cmd/test"
//	"github.com/selefra/selefra/cmd/tools"
//	"github.com/selefra/selefra/config"
//	"github.com/selefra/selefra/global"
//	"github.com/selefra/selefra/pkg/cloud_sdk"
//	"github.com/selefra/selefra/pkg/logger"
//	"github.com/selefra/selefra/pkg/registry"
//	"github.com/selefra/selefra/pkg/storage/pgstorage"
//	"github.com/selefra/selefra/pkg/utils"
//	"path/filepath"
//	"time"
//)
//
//type lockStruct struct {
//	SchemaKey string
//	Uuid      string
//	Storage   *postgresql_storage.PostgresqlStorage
//}
//
//// effectiveDecls check provider decls and download provider binary file, return the effective providers
//func effectiveDecls(ctx context.Context, decls []*config.RequireProvider) (effects []*config.RequireProvider, errlogs []string) {
//	namespace, _, err := utils.Home()
//	if err != nil {
//		errlogs = append(errlogs, err.Error())
//		return
//	}
//	provider := registry.NewProviderRegistry(namespace)
//	cli_ui.Infof("Selefra has been successfully installed providers!\n\n")
//	cli_ui.Infof("Checking Selefra provider updates......\n")
//
//	for _, decl := range decls {
//		configVersion := decl.Version
//		prov := registry.Provider{
//			Name:    decl.Name,
//			Version: decl.Version,
//			Source:  "",
//			Path:    decl.Path,
//		}
//		pp, err := provider.Download(ctx, prov, true)
//		if err != nil {
//			cli_ui.Errorf("%s@%s failed updated:%s", decl.Name, decl.Version, err.Error())
//			errlogs = append(errlogs, err.Error())
//			continue
//		} else {
//			decl.Path = pp.Filepath
//			decl.Version = pp.Version
//			err = tools.AppendProviderDecl(pp, nil, configVersion)
//			if err != nil {
//				cli_ui.Errorf("%s@%s failed updated:%s", decl.Name, decl.Version, err.Error())
//				errlogs = append(errlogs, err.Error())
//				continue
//			}
//			effects = append(effects, decl)
//			cli_ui.Infof("	%s@%s all ready updated!\n", decl.Name, decl.Version)
//		}
//	}
//
//	return effects, nil
//}
//
//func Sync(ctx context.Context) (lockSlice []lockStruct, err error) {
//	// load and check config
//	cli_ui.Infof("Initializing provider plugins...\n\n")
//	rootConfig, err := config.GetConfig()
//	if err != nil {
//		return nil, err
//	}
//
//	if err = test.CheckSelefraConfig(ctx, rootConfig); err != nil {
//		_ = http_client.TrySetUpStage(global.RelvPrjName(), http_client.Failed)
//		return nil, err
//	}
//
//	if _, err := cloud_sdk.UploadLogStatus(); err != nil {
//		cli_ui.Errorln(err.Error())
//	}
//
//	var errored bool
//
//	providerDecls, errLogs := effectiveDecls(ctx, rootConfig.Selefra.ProviderDecls)
//
//	cli_ui.Infof("Selefra has been finished update providers!\n")
//
//	global.SetStage("pull")
//	for _, decl := range providerDecls {
//		prvds := tools.ProvidersByID(rootConfig, decl.Name)
//		for _, prvd := range prvds {
//
//			// build a postgresql storage
//			schemaKey := config.GetSchemaKey(decl, *prvd)
//			store, err := pgstorage.PgStorageWithMeta(ctx, &schema.ClientMeta{
//				ClientLogger: logger.NewSchemaLogger(),
//			}, pgstorage.WithSearchPath(config.GetSchemaKey(decl, *prvd)))
//			if err != nil {
//				errored = true
//				cli_ui.Errorf("%s@%s failed updated:%s", decl.Name, decl.Version, err.Error())
//				errLogs = append(errLogs, fmt.Sprintf("%s@%s failed updated:%s", decl.Name, decl.Version, err.Error()))
//				continue
//			}
//
//			// try lock
//			// TODO: check unlock
//			uuid := id_util.RandomId()
//			for {
//				err = store.Lock(ctx, schemaKey, uuid)
//				if err == nil {
//					lockSlice = append(lockSlice, lockStruct{
//						SchemaKey: schemaKey,
//						Uuid:      uuid,
//						Storage:   store,
//					})
//					break
//				}
//				time.Sleep(5 * time.Second)
//			}
//
//			// check if cache expired
//			expired, _ := tools.CacheExpired(ctx, store, prvd.Cache)
//			if !expired {
//				cli_ui.Infof("%s %s@%s pull infrastructure data:\n", prvd.Name, decl.Name, decl.Version)
//				cli_ui.Print(fmt.Sprintf("Pulling %s@%s Please wait for resource information ...", decl.Name, decl.Version), false)
//				cli_ui.Infof("	%s@%s all ready use cache!\n", decl.Name, decl.Version)
//				continue
//			}
//
//			// if expired, fetch new data
//			err = fetch.Fetch(ctx, decl, prvd)
//			if err != nil {
//				cli_ui.Errorf("%s %s Synchronization failed:%s", decl.Name, decl.Version, err.Error())
//				errored = true
//				continue
//			}
//
//			// set fetch time
//			if err := pgstorage.SetStorageValue(ctx, store, config.GetCacheKey(), time.Now().Format(time.RFC3339)); err != nil {
//				cli_ui.Warningf("%s %s set cache time failed:%s", decl.Name, decl.Version, err.Error())
//				errored = true
//				continue
//			}
//		}
//	}
//	if errored {
//		cli_ui.Errorf(`
//This may be exception, view detailed exception in %s .
//`, filepath.Join(global.WorkSpace(), "logs"))
//	}
//
//	return lockSlice, nil
//}


================================================
FILE: cmd/provider/sync_online_test.go
================================================
package provider

//func TestSyncOnline(t *testing.T) {
//	if testing.Short() {
//		t.Skip("skipping test in short mode.")
//		return
//	}
//	global.Init("TestSyncOnline", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//	_, err := Sync(nil)
//	if err != nil {
//		t.Error(err)
//	}
//	if len(errLogs) != 0 {
//		t.Error(errLogs)
//	}
//}


================================================
FILE: cmd/provider/sync_test.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/config"
//	"github.com/selefra/selefra/global"
//	"github.com/stretchr/testify/require"
//	"testing"
//)
//
//func Test_effectiveDecls(t *testing.T) {
//	ctx := context.Background()
//	global.Init("", global.WithWorkspace("../../tests/workspace/offline"))
//	rootConfig, err := config.GetConfig()
//	if err != nil {
//		t.Fatal(err)
//	}
//
//	decls, _ := effectiveDecls(ctx, rootConfig.Selefra.ProviderDecls)
//
//	require.Equal(t, 1, len(decls))
//
//	require.Equal(t, "aws", decls[0].Name)
//	require.Equal(t, "v0.0.9", decls[0].Version)
//}


================================================
FILE: cmd/provider/test_data/provider.sh
================================================
#!/usr/bin/env bash
#######################################################################################################################
#                                                                                                                     #
#                              This script helps you test interactive programs                                        #
#                                                                                                                     #
#                                                                                                                     #
#                                                                                                   Version: 0.0.1    #
#                                                                                                                     #
#######################################################################################################################

# for command `selefra provider`
cd ../../../
go build
rm -rf ./test
mkdir test
mv selefra.exe ./test
cd test
echo "begin run command selefra provider"
./selefra.exe provider $@



================================================
FILE: cmd/provider/update.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/cli_ui"
//	"github.com/selefra/selefra/cmd/fetch"
//	"github.com/selefra/selefra/cmd/tools"
//	"github.com/selefra/selefra/config"
//	"github.com/selefra/selefra/global"
//	"github.com/selefra/selefra/pkg/registry"
//	"github.com/selefra/selefra/pkg/utils"
//	"github.com/spf13/cobra"
//)
//
//func newCmdProviderUpdate() *cobra.Command {
//	cmd := &cobra.Command{
//		Use:              "update",
//		Short:            "Upgrade one or more plugins",
//		Long:             "Upgrade one or more plugins",
//		PersistentPreRun: global.DefaultWrappedInit(),
//		RunE: func(cmd *cobra.Command, args []string) error {
//			return update(cmd.Context(), args)
//		},
//	}
//
//	cmd.SetHelpFunc(cmd.HelpFunc())
//	return cmd
//}
//
//func update(ctx context.Context, args []string) error {
//	err := config.IsSelefra()
//	if err != nil {
//		cli_ui.Errorln(err.Error())
//		return err
//	}
//	argsMap := make(map[string]bool)
//	for i := range args {
//		argsMap[args[i]] = true
//	}
//	rootConfig, err := config.GetConfig()
//	if err != nil {
//		return err
//	}
//	namespace, _, err := utils.Home()
//	if err != nil {
//		return err
//	}
//	provider := registry.NewProviderRegistry(namespace)
//	for _, decl := range rootConfig.Selefra.ProviderDecls {
//		prov := registry.ProviderBinary{
//			Provider: registry.Provider{
//				Name:    decl.Name,
//				Version: decl.Version,
//				Source:  "",
//			},
//			Filepath: decl.Path,
//		}
//		if len(args) != 0 && !argsMap[decl.Name] {
//			break
//		}
//
//		pp, err := provider.CheckUpdate(ctx, prov)
//		if err != nil {
//			return err
//		}
//		decl.Path = pp.Filepath
//		decl.Version = pp.Version
//
//		for _, prvd := range tools.ProvidersByID(rootConfig, decl.Name) {
//			err = fetch.Fetch(ctx, decl, prvd)
//			if err != nil {
//				return err
//			}
//		}
//	}
//	return nil
//}


================================================
FILE: cmd/provider/update_online_test.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestUpdateOnline(t *testing.T) {
//	if testing.Short() {
//		t.Skip("skipping test in short mode.")
//		return
//	}
//	global.Init("TestRemoveOnline", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//	ctx := context.Background()
//	arg := []string{"aws"}
//	err := update(ctx, arg)
//	if err != nil {
//		t.Error(err)
//	}
//}


================================================
FILE: cmd/provider/update_test.go
================================================
package provider

//import (
//	"context"
//	"github.com/selefra/selefra/global"
//	"testing"
//)
//
//func TestUpdate(t *testing.T) {
//	global.Init("TestUpdate", global.WithWorkspace("../../tests/workspace/offline"))
//	ctx := context.Background()
//	arg := []string{"aws"}
//	err := update(ctx, arg)
//	if err != nil {
//		t.Error(err)
//	}
//}


================================================
FILE: cmd/query/client.go
================================================
package query

import (
	"context"
	"github.com/c-bata/go-prompt"
	"github.com/selefra/selefra-provider-sdk/storage"
	"github.com/selefra/selefra-provider-sdk/storage_factory"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/pkg/utils"
	"os"
	"strings"
)

// ------------------------------------------------- --------------------------------------------------------------------

// SQLQueryClient TODO Optimize the experience of writing SQL statements
type SQLQueryClient struct {
	storageType storage_factory.StorageType
	Storage     storage.Storage

	Tables  []prompt.Suggest
	Columns []prompt.Suggest
}

func NewQueryClient(ctx context.Context, storageType storage_factory.StorageType, storage storage.Storage) (*SQLQueryClient, error) {
	client := &SQLQueryClient{
		storageType: storageType,
		Storage:     storage,
	}

	// TODO BUG: If you switch schema, the hints here will be outdated
	client.initTablesSuggest(ctx)
	client.initColumnsSuggest(ctx)

	return client, nil
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *SQLQueryClient) Run(ctx context.Context) {

	cli_ui.Infof("You can end the session by typing `exit` and press enter, now enter your query statement: \n")

	p := prompt.New(func(in string) {

		in = strings.TrimSpace(in)
		strArr := strings.Split(in, "\\")
		s := strArr[0]

		lowerSql := strings.ToLower(s)
		if lowerSql == "exit" || lowerSql == "exit;" || lowerSql == ".exit" {
			cli_ui.Infof("Bye.")
			os.Exit(0)
		}

		res, err := x.Storage.Query(ctx, s)
		if err != nil {
			cli_ui.Errorln(err)
		} else {
			tables, e := res.ReadRows(-1)
			if e != nil && e.HasError() {
				cli_ui.Errorln(err)
				return
			}
			header := tables.GetColumnNames()
			body := tables.GetMatrix()
			var tableBody [][]string
			for i := range body {
				var row []string
				for j := range body[i] {
					row = append(row, utils.Strava(body[i][j]))
				}
				tableBody = append(tableBody, row)
			}

			// \g or \G use row mode show query result
			if len(strArr) > 1 && (strArr[1] == "g" || strArr[1] == "G") {
				cli_ui.ShowRows(header, tableBody, []string{}, true)
			} else {
				cli_ui.ShowTable(header, tableBody, []string{}, true)
			}

		}

	}, x.completer,
		prompt.OptionTitle("Table"),
		prompt.OptionPrefix("> "),
		prompt.OptionAddKeyBind(prompt.KeyBind{
			Key: prompt.ControlC,
			Fn: func(buffer *prompt.Buffer) {
				os.Exit(0)
			},
		}),
	)
	p.Run()
}

// ------------------------------------------------- --------------------------------------------------------------------

// if there are no spaces this is the first word
func (x *SQLQueryClient) isFirstWord(text string) bool {
	return strings.LastIndex(text, " ") == -1
}

func (x *SQLQueryClient) completer(d prompt.Document) []prompt.Suggest {
	text := d.TextBeforeCursor()
	s := x.formatSuggest(d.Text, text)
	return prompt.FilterHasPrefix(s, d.GetWordBeforeCursor(), true)
}

func (x *SQLQueryClient) formatSuggest(text string, before string) []prompt.Suggest {
	var s []prompt.Suggest
	if x.isFirstWord(text) {
		if text != "" {
			s = []prompt.Suggest{
				{Text: "SELECT"},
				{Text: "WITH"},
			}
		}
	} else {
		texts := strings.Split(before, " ")
		if strings.ToLower(texts[len(texts)-2]) == "from" {
			s = x.Tables
		}
		if strings.ToLower(texts[len(texts)-2]) == "select" {
			s = x.Columns
		}
		if strings.ToLower(texts[len(texts)-2]) == "," {
			s = x.Columns
		}
	}
	return s
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *SQLQueryClient) initTablesSuggest(ctx context.Context) {
	res, diag := x.Storage.Query(ctx, x.getTablesSuggestSQL())
	var tables []prompt.Suggest
	if diag != nil {
		_ = cli_ui.PrintDiagnostic(diag.GetDiagnosticSlice())
	} else {
		rows, diag := res.ReadRows(-1)
		if diag != nil {
			_ = cli_ui.PrintDiagnostic(diag.GetDiagnosticSlice())
		}
		for i := range rows.GetMatrix() {
			tableName := rows.GetMatrix()[i][0].(string)
			tables = append(tables, prompt.Suggest{Text: tableName})
		}
	}
	x.Tables = tables
}

func (x *SQLQueryClient) getTablesSuggestSQL() string {
	switch x.storageType {
	case storage_factory.StorageTypePostgresql:
		return TABLESQL
	default:
		return ""
	}
}

// ------------------------------------------------- --------------------------------------------------------------------

func (x *SQLQueryClient) initColumnsSuggest(ctx context.Context) {
	rs, err := x.Storage.Query(ctx, x.getColumnsSuggestSQL())
	var columns []prompt.Suggest
	if err != nil {
		_ = cli_ui.PrintDiagnostic(err.GetDiagnosticSlice())
	} else {
		rows, err := rs.ReadRows(-1)
		if err != nil {
			_ = cli_ui.PrintDiagnostic(err.GetDiagnosticSlice())
		}
		for i := range rows.GetMatrix() {
			schemaName := rows.GetMatrix()[i][0].(string)
			tableName := rows.GetMatrix()[i][1].(string)
			columnName := rows.GetMatrix()[i][2].(string)
			columns = append(columns, prompt.Suggest{Text: columnName, Description: schemaName + "." + tableName})
		}
	}
	x.Columns = columns
}

func (x *SQLQueryClient) getColumnsSuggestSQL() string {
	switch x.storageType {
	case storage_factory.StorageTypePostgresql:
		return COLUMNSQL
	default:
		return ""
	}
}

// ------------------------------------------------- --------------------------------------------------------------------


================================================
FILE: cmd/query/client_test.go
================================================
package query

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/env"
	"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
	"github.com/selefra/selefra-provider-sdk/storage_factory"
	"github.com/selefra/selefra/cli_ui"
	"testing"
)

func TestNewQueryClient(t *testing.T) {
	ctx := context.Background()

	options := postgresql_storage.NewPostgresqlStorageOptions(env.GetDatabaseDsn())
	storage, diagnostics := storage_factory.NewStorage(context.Background(), storage_factory.StorageTypePostgresql, options)
	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
		return
	}
	queryClient, _ := NewQueryClient(ctx, storage_factory.StorageTypePostgresql, storage)
	if queryClient == nil {
		t.Error("queryClient is nil")
	}
	queryClient.Run(context.Background())
}

//func TestNewQueryClientOnline(t *testing.T) {
//	ctx := context.Background()
//	global.Init("query", global.WithWorkspace("../../tests/workspace/online"))
//	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
//	global.SERVER = "dev-api.selefra.io"
//
//	queryClient, _ := NewQueryClient(ctx)
//	if queryClient == nil {
//		t.Error("queryClient is nil")
//	}
//}

//func TestCreateColumnsSuggest(t *testing.T) {
//	ctx := context.Background()
//	global.Init("go_test", global.WithWorkspace("../../tests/workspace/offline"))
//	cof, err := config.GetConfig()
//	if err != nil {
//		cli_ui.Errorln(err)
//	}
//	for i := range cof.Selefra.ProviderDecls {
//		confs, err := tools.ProviderConfigStrs(cof, cof.Selefra.ProviderDecls[i].Name)
//		if err != nil {
//			cli_ui.Errorln(err.Error())
//		}
//		for _, conf := range confs {
//			var cp config.ProviderBlock
//			err := json.Unmarshal([]byte(conf), &cp)
//			if err != nil {
//				cli_ui.Errorln(err.Error())
//				continue
//			}
//			//ctx, c, err := createCtxAndClient(*cof, cof.Selefra.RequireProvidersBlock[i], cp)
//			//if err != nil {
//			//	t.Error(err)
//			//}
//			sto, _ := pgstorage.Storage(ctx)
//			columns := initColumnsSuggest(ctx, sto)
//			if columns == nil {
//				t.Error("Columns is nil")
//			}
//		}
//	}
//}
//
//func TestCreateTablesSuggest(t *testing.T) {
//	ctx := context.Background()
//	global.Init("go_test", global.WithWorkspace("../../tests/workspace/offline"))
//	cof, err := config.GetConfig()
//	if err != nil {
//		cli_ui.Errorln(err)
//	}
//	for i := range cof.Selefra.ProviderDecls {
//		confs, err := tools.ProviderConfigStrs(cof, cof.Selefra.ProviderDecls[i].Name)
//		if err != nil {
//			cli_ui.Errorln(err.Error())
//		}
//		for _, conf := range confs {
//			var cp config.ProviderBlock
//			err := json.Unmarshal([]byte(conf), &cp)
//			if err != nil {
//				cli_ui.Errorln(err.Error())
//				continue
//			}
//			sto, _ := pgstorage.Storage(ctx)
//			tables := initTablesSuggest(ctx, sto)
//			if tables == nil {
//				t.Error("Tables is nil")
//			}
//		}
//	}
//}


================================================
FILE: cmd/query/parse.go
================================================
package query

//import (
//	"github.com/blastrain/vitess-sqlparser/sqlparser"
//)
//
//// UnknownType 0
//// Select 1
//// Upgrade 2
//// Insert 3
//// Delete 4
//
//// Unknown => 0
//// Eq -> "=" 1
//// Ne -> "!=" 2
//// Gt -> ">" 3
//// Lt -> "<" 4
//// Gte -> ">=" 5
//// Lte -> "<=" 6
//
//func ParserSql(sql string) {
//	query, err := sqlparser.Parse(sql)
//	if err != nil {
//		panic(err)
//	}
//	query.WalkSubtree(walk)
//}
//
//func walk(node sqlparser.SQLNode) (kontinue bool, err error) {
//	if node != nil {
//		sqlparser.String(node)
//	}
//	return true, nil
//}


================================================
FILE: cmd/query/query.go
================================================
package query

import (
	"context"
	"errors"
	"github.com/selefra/selefra-provider-sdk/env"
	"github.com/selefra/selefra-provider-sdk/provider/schema"
	"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
	"github.com/selefra/selefra-provider-sdk/storage_factory"
	"github.com/selefra/selefra-utils/pkg/dsn_util"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/cli_env"
	"github.com/selefra/selefra/pkg/cloud_sdk"
	"github.com/selefra/selefra/pkg/message"
	"github.com/selefra/selefra/pkg/modules/module_loader"
	"github.com/selefra/selefra/pkg/storage/pgstorage"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/spf13/cobra"
	"os"
)

func NewQueryCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "query",
		Short:            "Query infrastructure data from pgstorage",
		Long:             "Query infrastructure data from pgstorage",
		PersistentPreRun: global.DefaultWrappedInit(),
		Run: func(cmd *cobra.Command, args []string) {

			ctx := cmd.Context()

			downloadDirectory, err := config.GetDefaultDownloadCacheDirectory()
			if err != nil {
				cli_ui.Errorln(err.Error() + " \n")
				return
			}

			projectWorkspace := "./"

			dsn, err := getDsn(ctx, projectWorkspace, downloadDirectory)
			if err != nil {
				cli_ui.Errorln(err.Error() + "\n")
				return
			}

			// show tips
			c, err := dsn_util.NewConfigByDSN(dsn)
			if err != nil {
				cli_ui.Errorln("Parse dsn %s error: %s", dsn, err.Error())
				return
			}
			cli_ui.Infof("Connection to you database `%s` ... \n", c.ToDSN(true))

			options := postgresql_storage.NewPostgresqlStorageOptions(dsn)
			databaseStorage, diagnostics := storage_factory.NewStorage(cmd.Context(), storage_factory.StorageTypePostgresql, options)
			if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
				return
			}

			defer func() {
				databaseStorage.Close()
			}()

			queryClient, _ := NewQueryClient(ctx, storage_factory.StorageTypePostgresql, databaseStorage)
			queryClient.Run(ctx)

		},
	}
	return cmd
}

func getDsn(ctx context.Context, projectWorkspace, downloadWorkspace string) (string, error) {

	// 1. load from project workspace
	dsn, _ := loadDSNFromProjectWorkspace(ctx, projectWorkspace, downloadWorkspace)
	if dsn != "" {
		cli_ui.Infof("Find database connection in workspace. %s \n", projectWorkspace)
		return dsn, nil
	}

	// 2. load from selefra cloud
	client, diagnostics := cloud_sdk.NewCloudClient(cli_env.GetServerHost())
	if err := cli_ui.PrintDiagnostics(diagnostics); err != nil {
		return "", err
	}
	if c, _ := client.GetCredentials(); c != nil {
		c, d := client.Login(c.Token)
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		d = client.SaveCredentials(c)
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		orgDSN, d := client.FetchOrgDSN()
		if err := cli_ui.PrintDiagnostics(d); err != nil {
			return "", err
		}
		if orgDSN != "" {
			cli_ui.Infof("Find database connection in you selefra cloud. \n")
			return orgDSN, nil
		}
	}

	// 3. get dsn from env
	dsn = os.Getenv(env.DatabaseDsn)
	if dsn != "" {
		cli_ui.Infof("Find database connection in your env. \n")
		return dsn, nil
	}

	// 4. start default postgresql instance
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		if utils.IsNotEmpty(message) {
			_ = cli_ui.PrintDiagnostics(message)
		}
	})
	dsn = pgstorage.DefaultPostgreSQL(downloadWorkspace, messageChannel)
	messageChannel.ReceiverWait()
	if dsn != "" {
		return dsn, nil
	}

	return "", errors.New("Can not find database connection")
}

// Look for DSN in the configuration of the project's working directory
func loadDSNFromProjectWorkspace(ctx context.Context, projectWorkspace, downloadWorkspace string) (string, error) {
	messageChannel := message.NewChannel[*schema.Diagnostics](func(index int, message *schema.Diagnostics) {
		// Any error while loading will not print
		//if utils.IsNotEmpty(message) {
		//	_ = cli_ui.PrintDiagnostics(message)
		//}
	})
	loader, err := module_loader.NewLocalDirectoryModuleLoader(&module_loader.LocalDirectoryModuleLoaderOptions{
		ModuleLoaderOptions: &module_loader.ModuleLoaderOptions{
			Source:            projectWorkspace,
			Version:           "",
			DownloadDirectory: downloadWorkspace,
			ProgressTracker:   nil,
			MessageChannel:    messageChannel,
			DependenciesTree:  []string{projectWorkspace},
		},
	})
	if err != nil {
		return "", err
	}
	rootModule, b := loader.Load(ctx)
	if !b {
		return "", nil
	}
	if rootModule.SelefraBlock != nil && rootModule.SelefraBlock.ConnectionBlock != nil && rootModule.SelefraBlock.ConnectionBlock.BuildDSN() != "" {
		return rootModule.SelefraBlock.ConnectionBlock.BuildDSN(), nil
	}
	return "", nil
}


================================================
FILE: cmd/query/query_test.go
================================================
package query



================================================
FILE: cmd/query/sql.go
================================================
package query

const TABLESQL = "SELECT tablename FROM pg_tables where schemaname = 'public' and tablename<>'pg_stat_statements'"
const COLUMNSQL = "select table_schema,table_name,column_name from information_schema.columns where table_schema='public' and table_name<>'pg_stat_statements'"


================================================
FILE: cmd/query/test_data/query.sh
================================================
#!/usr/bin/env bash
#######################################################################################################################
#                                                                                                                     #
#                              This script helps you test interactive programs                                        #
#                                                                                                                     #
#                                                                                                                     #
#                                                                                                   Version: 0.0.1    #
#                                                                                                                     #
#######################################################################################################################

# for command `selefra query`
cd ../../../
go build
rm -rf ./test
mkdir test
mv selefra.exe ./test
cd test
echo "begin run command selefra query"
./selefra.exe query $@



================================================
FILE: cmd/root.go
================================================
package cmd

import (
	"fmt"
	"github.com/selefra/selefra/cli_ui"
	"github.com/selefra/selefra/cmd/apply"
	"github.com/selefra/selefra/cmd/fetch"
	"github.com/selefra/selefra/cmd/gpt"
	initCmd "github.com/selefra/selefra/cmd/init"
	"github.com/selefra/selefra/cmd/login"
	"github.com/selefra/selefra/cmd/logout"
	"github.com/selefra/selefra/cmd/provider"
	"github.com/selefra/selefra/cmd/query"
	"github.com/selefra/selefra/cmd/test"
	"github.com/selefra/selefra/cmd/version"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/cli_env"
	"github.com/selefra/selefra/pkg/telemetry"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/spf13/cobra"
	"log"
	"os"
	"strings"
)

var group = make(map[string][]*cobra.Command)

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
	Use:   "selefra",
	Short: "Selefra - Simplify Cloud and SaaS analysis with Selefra.",
	Long: `
For details see the selefra document https://selefra.io/docs
If you like selefra, give us a star https://github.com/selefra/selefra
`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		level, _ := cmd.Flags().GetString("loglevel")
		global.SetLogLevel(level)

		// get telemetry from command params
		telemetryEnable, err := cmd.Flags().GetBool("telemetry")
		if err == nil {
			// user give telemetry param
			telemetry.TelemetryEnable = telemetryEnable
		} else {
			// try find it in env variables
			telemetryEnableString := cli_env.GetSelefraTelemetryEnable()
			if telemetryEnableString != "" {
				if telemetryEnableString == "true" || telemetryEnableString == "t" {
					telemetry.TelemetryEnable = true
				} else if telemetryEnableString == "false" || telemetryEnableString == "f" {
					telemetry.TelemetryEnable = false
				}
			} else {
				// keep default value
			}
		}
	},
	PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
		// need close telemetry on exit
		diagnostics := telemetry.Close(cmd.Context())
		return cli_ui.PrintDiagnostics(diagnostics)
	},
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
	logo := " _____        _         __              \n/  ___|      | |       / _|             \n\\ `--.   ___ | |  ___ | |_  _ __   __ _ \n `--. \\ / _ \\| | / _ \\|  _|| '__| / _` |\n/\\__/ /|  __/| ||  __/| |  | |   | (_| |\n\\____/  \\___||_| \\___||_|  |_|    \\__,_|\n\n"
	cli_ui.Infof(logo)
	cli_ui.Infof("Selefra - Simplify Cloud and SaaS analysis with Selefra.\n\n\n")

	defer func() {
		utils.Close()
	}()

	if err := rootCmd.Execute(); err != nil {
		log.Printf("Error occurred in Execute: %+v", err)
		os.Exit(1)
	}
}

func init() {
	rootCmd.PersistentFlags().StringP("loglevel", "l", "info", "log level")
	rootCmd.PersistentFlags().BoolP("telemetry ", "t", true, "Whether to enable telemetry. This parameter is enabled by default")
	//rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.test.yaml)")
	group["main"] = []*cobra.Command{
		initCmd.NewInitCmd(),
		test.NewTestCmd(),
		apply.NewApplyCmd(),
		login.NewLoginCmd(),
		logout.NewLogoutCmd(),
		gpt.NewGPTCmd(),
	}

	group["other"] = []*cobra.Command{
		fetch.NewFetchCmd(),
		provider.NewProviderCmd(),
		query.NewQueryCmd(),
		version.NewVersionCmd(),
	}

	rootCmd.AddCommand(group["main"]...)
	rootCmd.AddCommand(group["other"]...)

	rootCmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
		fmt.Println(strings.TrimSpace(cmd.Long))

		fmt.Println("\nUsage:")
		fmt.Printf("  %-13s", "selefra [command]\n\n")

		fmt.Println("Main commands:")
		for _, c := range group["main"] {
			fmt.Printf("  %-13s%s\n", c.Name(), c.Short)
		}
		fmt.Println()
		fmt.Println("All other commands:")
		for _, c := range group["other"] {
			fmt.Printf("  %-13s%s\n", c.Name(), c.Short)
		}
		fmt.Println()

		fmt.Println("Flags")
		fmt.Println(cmd.Flags().FlagUsages())

		fmt.Println(`Use "selefra [command] --help" for more information about a command.`)
	})

}


================================================
FILE: cmd/tools/providers.go
================================================
package tools

import (
	"context"
	"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/pkg/storage/pgstorage"
	"strconv"
	"strings"
	"time"
)

//// ProviderConfigStrs find all selefra provider config by id from selefra config and return provider config in string format
//// TODO: deprecated
//func ProviderConfigStrs(config *config.RootConfig, id string) ([]string, error) {
//	var providerConfs []string
//	for _, group := range config.Providers.Content {
//		for i, node := range group.Content {
//			if node.Kind == yaml.ScalarNode && node.Value == "provider" && group.Content[i+1].Value == id {
//				b, err := yaml.Marshal(group)
//				if err != nil {
//					return nil, err
//				}
//				providerConfs = append(providerConfs, string(b))
//
//			}
//		}
//	}
//	return providerConfs, nil
//}
//
//// ProvidersByID find all provider in rootConfig by id
//func ProvidersByID(rootConfig *config.RootConfig, id string) []*config.ProviderBlock {
//	var prvds = make([]*config.ProviderBlock, 0)
//	for _, group := range rootConfig.Providers.Content {
//		for i, node := range group.Content {
//			if node.Kind == yaml.ScalarNode && node.Value == "provider" && group.Content[i+1].Value == id {
//				b, err := yaml.Marshal(group)
//				if err != nil {
//					continue
//				}
//
//				var prvd config.ProviderBlock
//				if err := yaml.Unmarshal(b, &prvd); err != nil {
//					continue
//				}
//
//				prvds = append(prvds, &prvd)
//			}
//		}
//	}
//
//	return prvds
//}
//
//// SetProviderTmpl set the provider yaml template
//func SetProviderTmpl(template string, provider registry.ProviderBinary, config *config.RootConfig) error {
//	if config.Providers.Kind != yaml.SequenceNode {
//		config.Providers.Kind = yaml.SequenceNode
//		config.Providers.Tag = "!!seq"
//		config.Providers.Value = ""
//		config.Providers.Content = []*yaml.Node{}
//	}
//
//	var node yaml.Node
//
//	err := yaml.Unmarshal([]byte(template), &node)
//	if err != nil {
//		return err
//	}
//	var provNode yaml.Node
//	if node.Content == nil {
//		provNode.Content = []*yaml.Node{
//			{
//				Kind: yaml.MappingNode,
//				Tag:  "!!map",
//				Content: append([]*yaml.Node{
//					{
//						Kind:  yaml.ScalarNode,
//						Value: "name",
//					},
//					{
//						Kind:  yaml.ScalarNode,
//						Value: provider.Name,
//					},
//					{
//						Kind:        yaml.ScalarNode,
//						Value:       "provider",
//						FootComment: template,
//					},
//					{
//						Kind:  yaml.ScalarNode,
//						Value: provider.Name,
//					},
//				}),
//			},
//		}
//	} else {
//		provNode.Content = []*yaml.Node{
//			{
//				Kind: yaml.MappingNode,
//				Tag:  "!!map",
//				Content: append([]*yaml.Node{
//					{
//						Kind:  yaml.ScalarNode,
//						Value: "name",
//					},
//					{
//						Kind:  yaml.ScalarNode,
//						Value: provider.Name,
//					},
//					{
//						Kind:        yaml.ScalarNode,
//						Value:       "provider",
//						FootComment: template,
//					},
//					{
//						Kind:  yaml.ScalarNode,
//						Value: provider.Name,
//					},
//				}),
//			},
//		}
//	}
//
//	config.Providers.Content = append(config.Providers.Content, provNode.Content...)
//
//	return nil
//}
//
//// AppendProviderDecl append a provider declare for rootConfig.Selefra.RequireProvidersBlock
//func AppendProviderDecl(provider registry.ProviderBinary, rootConfig *config.RootConfig, configVersion string) error {
//	source, latestSource := utils.CreateSource(provider.Name, provider.Version, configVersion)
//	_, configPath, err := utils.Home()
//	if err != nil {
//		cli_ui.Errorln("SetSelefraProviderError: " + err.Error())
//		return err
//	}
//
//	var pathMap = make(map[string]string)
//	file, err := os.ReadFile(configPath)
//	if err != nil {
//		cli_ui.Errorln("SetSelefraProviderError: " + err.Error())
//		return err
//	}
//	json.Unmarshal(file, &pathMap)
//	if latestSource != "" {
//		pathMap[latestSource] = provider.Filepath
//	}
//
//	pathMap[source] = provider.Filepath
//
//	pathMapJson, err := json.Marshal(pathMap)
//
//	if err != nil {
//		cli_ui.Errorln("SetSelefraProviderError: " + err.Error())
//	}
//
//	err = os.WriteFile(configPath, pathMapJson, 0644)
//	if rootConfig != nil {
//		rootConfig.Selefra.ProviderDecls = append(rootConfig.Selefra.ProviderDecls, &config.RequireProvider{
//			Name:    provider.Name,
//			Source:  &strings.Split(source, "@")[0],
//			Version: provider.Version,
//		})
//	}
//	return nil
//}

// CacheExpired check whether the cache time expires
func CacheExpired(ctx context.Context, storage *postgresql_storage.PostgresqlStorage, cacheTime string) (bool, error) {
	requireKey := config.GetCacheKey()
	fetchTime, err := pgstorage.GetStorageValue(ctx, storage, requireKey)
	if err != nil {
		return true, err
	}
	fetchTimeLocal, err := time.ParseInLocation(time.RFC3339, fetchTime, time.Local)
	if err != nil {
		return true, err
	}

	duration, err := parseDuration(cacheTime)
	if err != nil || duration == 0 {
		return true, err
	}
	if time.Now().Sub(fetchTimeLocal) > duration {
		return true, nil
	}

	return false, nil
}

func parseDuration(d string) (time.Duration, error) {
	d = strings.TrimSpace(d)
	dr, err := time.ParseDuration(d)
	if err == nil {
		return dr, nil
	}
	if strings.Contains(d, "d") {
		index := strings.Index(d, "d")

		hour, _ := strconv.Atoi(d[:index])
		dr = time.Hour * 24 * time.Duration(hour)
		ndr, err := time.ParseDuration(d[index+1:])
		if err != nil {
			return dr, nil
		}
		return dr + ndr, nil
	}

	dv, err := strconv.ParseInt(d, 10, 64)
	return time.Duration(dv), err
}


================================================
FILE: cmd/tools/providers_online_test.go
================================================
package tools

import (
	"context"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/registry"
	"github.com/selefra/selefra/pkg/utils"
	"testing"
)

func getProviderAndConfigOnline() (registry.ProviderBinary, *config.RootConfig, error) {
	global.Init("getProviderAndConfigOnline", global.WithWorkspace("../../tests/workspace/online"))
	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
	global.SERVER = "dev-api.selefra.io"
	ctx := context.Background()
	cof, err := config.GetConfig()
	if err != nil {
		return registry.ProviderBinary{}, nil, err
	}
	pr := registry.Provider{
		Name:    "aws",
		Version: "latest",
		Source:  "",
	}
	namespace, _, err := utils.Home()
	if err != nil {
		return registry.ProviderBinary{}, nil, err
	}
	provider := registry.NewProviderRegistry(namespace)
	p, err := provider.Download(ctx, pr, true)
	return p, cof, err
}

func TestGetProvidersOnline(t *testing.T) {
	global.Init("TestGetProvidersOnline", global.WithWorkspace("../../tests/workspace/online"))
	global.SetToken("xxxxxxxxxxxxxxxxxxxxxx")
	global.SERVER = "dev-api.selefra.io"
	s, err := config.GetConfig()
	if err != nil {
		t.Error(err)
	}
	provider, err := ProviderConfigStrs(s, "aws")
	t.Log(provider)
	if err != nil {
		t.Error(err)
	}
	if len(provider) == 0 {
		t.Error("ProviderBlock is empty")
	}
}

func TestSetProvidersOnline(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping test in short mode.")
		return
	}
	p, cof, err := getProviderAndConfigOnline()
	s := `
      ##  Optional, Repeated. Add an accounts block for every account you want to assume-role into and fetch data from.
      #accounts:
      #    #     Optional. User identification
      #  - account_name: <UNIQUE ACCOUNT IDENTIFIER>
      #    #    Optional. Named profile in config or credential file from where Selefra should grab credentials
      #    shared_config_profile: < PROFILE_NAME >
      #    #    Optional. Location of shared configuration files
      #    shared_config_files:
      #      - <FILE_PATH>
      #    #   Optional. Location of shared credentials files
      #    shared_credentials_files:
      #      - <FILE_PATH>
      #    #    Optional. Role ARN we want to assume when accessing this account
      #    role_arn: < YOUR_ROLE_ARN >
      #    #    Optional. Named role session to grab specific operation under the assumed role
      #    role_session_name: <SESSION_NAME>
      #    #    Optional. Any outside of the org account id that has additional control
      #    external_id: <ID>
      #    #    Optional. Designated region of servers
      #    default_region: <REGION_CODE>
      #    #    Optional. by default assumes all regions
      #    regions:
      #      - us-east-1
      #      - us-west-2
      ##    The maximum number of times that a request will be retried for failures. Defaults to 10 retry attempts.
      #max_attempts: 10
      ##    The maximum back off delay between attempts. The backoff delays exponentially with a jitter based on the number of attempts. Defaults to 30 seconds.
      #max_backoff: 30
`
	err = SetProviderTmpl(s, p, cof)
	if err != nil {
		t.Error(err)
	}
}

func TestSetSelefraProviderOnLine(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping test in short mode.")
		return
	}
	p, cof, err := getProviderAndConfigOnline()
	if err != nil {
		t.Error(err)
	}
	err = AppendProviderDecl(p, cof, "latest")
	if err != nil {
		t.Error(err)
	}
}


================================================
FILE: cmd/tools/providers_test.go
================================================
package tools

import (
	"context"
	"github.com/selefra/selefra/config"
	"github.com/selefra/selefra/global"
	"github.com/selefra/selefra/pkg/registry"
	"github.com/selefra/selefra/pkg/utils"
	"github.com/stretchr/testify/require"
	"gopkg.in/yaml.v3"
	"testing"
)

func getProviderAndConfig() (registry.ProviderBinary, *config.RootConfig, error) {
	global.Init("", global.WithWorkspace("../../tests/workspace/offline"))
	ctx := context.Background()
	cof, err := config.GetConfig()
	if err != nil {
		return registry.ProviderBinary{}, nil, err
	}
	pr := registry.Provider{
		Name:    "aws",
		Version: "latest",
		Source:  "",
	}
	namespace, _, err := utils.Home()
	if err != nil {
		return registry.ProviderBinary{}, nil, err
	}
	provider := registry.NewProviderRegistry(namespace)
	p, err := provider.Download(ctx, pr, true)
	return p, cof, err
}

func TestGetProviders(t *testing.T) {
	global.Init("", global.WithWorkspace("../../tests/workspace/offline"))
	s, err := config.GetConfig()
	if err != nil {
		t.Error(err)
	}
	provider, err := ProviderConfigStrs(s, "aws")
	require.NoError(t, err)
	require.Equal(t, 1, len(provider))
	require.Equal(t, "aws_01", provider[0])
}

func TestSetProviders(t *testing.T) {
	p, cof, err := getProviderAndConfig()

	var node yaml.Node
	yamls := `providers:
    - name: aws_01
      cache: 1d
      provider: aws
      resources:`
	if err := yaml.Unmarshal([]byte(yamls), &node); err != nil {
		t.Fatal(err)
	}

	s := `
      ##  Optional, Repeated. Add an accounts block for every account you want to assume-role into and fetch data from.
      #accounts:
      #    #     Optional. User identification
      #  - account_name: <UNIQUE ACCOUNT IDENTIFIER>
      #    #    Optional. Named profile in config or credential file from where Selefra should grab credentials
      #    shared_config_profile: < PROFILE_NAME >
      #    #    Optional. Location of shared configuration files
      #    shared_config_files:
      #      - <FILE_PATH>
      #    #   Optional. Location of shared credentials files
      #    shared_credentials_files:
      #      - <FILE_PATH>
      #    #    Optional. Role ARN we want to assume when accessing this account
      #    role_arn: < YOUR_ROLE_ARN >
      #    #    Optional. Named role session to grab specific operation under the assumed role
      #    role_session_name: <SESSION_NAME>
      #    #    Optional. Any outside of the org account id that has additional control
      #    external_id: <ID>
      #    #    Optional. Designated region of servers
      #    default_region: <REGION_CODE>
      #    #    Optional. by default assumes all regions
      #    regions:
      #      - us-east-1
      #      - us-west-2
      ##    The maximum number of times that a request will be retried for failures. Defaults to 10 retry attempts.
      #max_attempts: 10
      ##    The maximum back off delay between attempts. The backoff delays exponentially with a jitter based on the number of attempts. Defaults to 30 seconds.
      #max_backoff: 30
`
	err = SetProviderTmpl(s, p, cof)
	b, err := yaml.Marshal(cof.Providers)
	t.Log(string(b))
	if err != nil {
		t.Error(err)
	}
}

func TestSetSelefraProvider(t *testing.T) {
	p, cof, err := getProviderAndConfig()

	if err != nil {
		t.Error(err)
	}
	err = AppendProviderDecl(p, cof, "latest")
	if err != nil {
		t.Error(err)
	}
}


================================================
FILE: cmd/version/version.go
================================================
package version

import (
	"fmt"
	"github.com/selefra/selefra/global"
	"github.com/spf13/cobra"
)

var Version = "{{version}}"

func NewVersionCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:              "version",
		Short:            "Print Selefra's version number",
		Long:             "Print Selefra's version number",
		PersistentPreRun: global.DefaultWrappedInit(),
		Run: func(cmd *cobra.Command, args []string) {
			version()
		},
	}
	return cmd
}

func version() {
	fmt.Println(Version)
}


================================================
FILE: cmd/version/version_test.go
================================================
package version

import "testing"

func TestVersion(t *testing.T) {
	version()
}


================================================
FILE: config/config.go
================================================
package config

import (
	"fmt"
	"github.com/mitchellh/go-homedir"
	"github.com/selefra/selefra/pkg/utils"
	"gopkg.in/yaml.v3"
	"os"
	"path/filepath"
)

// import (
//
//	"bytes"
//	"encoding/json"
//	"errors"
//	"fmt"
//	"github.com/mitchellh/go-homedir"
//	"github.com/selefra/selefra/cli_ui"
//	"github.com/selefra/selefra/pkg/utils"
//	"github.com/selefra/selefra/ui"
//	"github.com/spf13/viper"
//	"gopkg.in/yaml.v3"
//	"os"
//	"path"
//	"path/filepath"
//	"strings"
//
//	"github.com/selefra/selefra/global"
//
// )
//
// // ------------------------------------------------- --------------------------------------------------------------------
//
// type sectionName string
//
// const (
//
//	SELEFRA   sectionName = "selefra"
//	MODULES   sectionName = "modules"
//	PROVIDERS sectionName = "providers"
//	VARIABLES sectionName = "variables"
//	RULES     sectionName = "rules"
//
// )
//
//	var typeMap = map[sectionName]bool{
//		SELEFRA:   true,
//		MODULES:   true,
//		PROVIDERS: true,
//		RULES:     true,
//		VARIABLES: true,
//	}
//
// // ------------------------------------------------- --------------------------------------------------------------------
//
// // ProviderBlock is provider config
//
//	type ProviderBlock struct {
//		Name          string   `yaml:"name" json:"name"`
//		Cache         string   `yaml:"cache" json:"cache"`
//		Provider      string   `yaml:"provider" json:"provider"`
//		MaxGoroutines uint64   `yaml:"max_goroutines" json:"max_goroutines"`
//		Resources     []string `yaml:"resources" json:"resources"`
//		LogLevel      string   `yaml:"log_level" json:"log_level"`
//	}
//
//	type VariableBlock struct {
//		Key         string `yaml:"key" json:"key"`
//		Default     string `yaml:"default" json:"default"`
//		Description string `yaml:"description" json:"description"`
//		Author      string `yaml:"author" json:"author"`
//	}
//
// // RootConfig is root config for selefra project
//
//	type RootConfig struct {
//		Selefra   SelefraBlock    `yaml:"selefra"`
//		Providers yaml.Node       `yaml:"providers"`
//		Variables []VariableBlock `yaml:"variables"`
//	}
//
//	type RootConfigInit struct {
//		Selefra   SelefraConfigInit `yaml:"selefra"`
//		Providers yaml.Node         `yaml:"providers"`
//	}
//
//	type RootConfigInitWithLogin struct {
//		Selefra   SelefraConfigInitWithLogin `yaml:"selefra"`
//		Providers yaml.Node                  `yaml:"providers"`
//	}
//
//	type RuleSet struct {
//		Rules []Rule `yaml:"rules"`
//	}
//
//	type Rule struct {
//		Path     string         `yaml:"path" json:"path"`
//		Name     string         `yaml:"name" json:"name"`
//		Query    string         `yaml:"query" json:"query"`
//		Labels   map[string]any `yaml:"labels" json:"labels"`
//		Metadata struct {
//			Id          string   `yaml:"id" json:"id"`
//			Severity    string   `yaml:"severity" json:"severity"`
//			Provider    string   `yaml:"provider" json:"provider"`
//			Tags        []string `yaml:"tags" json:"tags"`
//			Author      string   `yaml:"author" json:"author"`
//			Remediation string   `yaml:"remediation" json:"remediation"`
//			Title       string   `yaml:"title" json:"title"`
//			Description string   `yaml:"description" json:"description"`
//		}
//		Output string `yaml:"output" json:"-"`
//	}
//
//	type ModuleConfig struct {
//		Modules []Module `yaml:"modules" json:"modules"`
//	}
//
//	type Module struct {
//		Name     string          `yaml:"name" json:"name"`
//		Uses     []string        `yaml:"uses" json:"uses"`
//		Children []*ModuleConfig `yaml:"-" json:"children"`
//	}
//
// // CloudBlock is config for selefra cloud
// // when user is login, cloud config exist, else not
//
//	type CloudBlock struct {
//		Project      string `yaml:"project" mapstructure:"project"`
//		Organization string `yaml:"organization" mapstructure:"organization"`
//		HostName     string `yaml:"hostname" mapstructure:"hostname"`
//	}
//
// // SelefraBlock is the project config
//
//	type SelefraBlock struct {
//		Cloud         *CloudBlock        `yaml:"cloud" mapstructure:"cloud"`
//		Name          string             `yaml:"name" mapstructure:"name"`
//		CliVersion    string             `yaml:"cli_version" mapstructure:"cli_version"`
//		LogLevel      string             `yaml:"log_level" mapstructure:"log_level"`
//		ProviderDecls []*RequireProvider `yaml:"providers" mapstructure:"providers"`
//		//ConnectionBlock *DB                 `yaml:"connection" mapstructure:"connection"`
//	}
//
// // SelefraConfigInit is a subset for SelefraBlock without cloud config
//
//	type SelefraConfigInit struct {
//		Name       string              `yaml:"name" mapstructure:"name"`
//		CliVersion string              `yaml:"cli_version" mapstructure:"cli_version"`
//		Providers  []*ProviderDeclInit `yaml:"providers"
Download .txt
gitextract_p2txgac8/

├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.yaml
│   │   ├── config.yaml
│   │   └── feature-request.yaml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── ci.yaml
│       └── release.yaml
├── .gitignore
├── .goreleaser.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── SECURITY.md
├── cli_ui/
│   ├── client.go
│   ├── print.go
│   ├── progress.go
│   ├── select_providers.go
│   ├── select_providers_test.go
│   ├── table.go
│   ├── table_test.go
│   └── user.go
├── cmd/
│   ├── apply/
│   │   ├── apply.go
│   │   ├── apply_test.go
│   │   └── test_data/
│   │       └── test_query_module/
│   │           ├── modules.yaml
│   │           ├── rules/
│   │           │   └── rule.yaml
│   │           └── selefra.yaml
│   ├── fetch/
│   │   ├── fetch.go
│   │   ├── fetch_test.go
│   │   └── test_data/
│   │       └── test_fetch_module/
│   │           └── modules.yaml
│   ├── gpt/
│   │   ├── gpt.go
│   │   ├── gpt_test.go
│   │   └── test_data/
│   │       └── test_query_module/
│   │           └── modules.yaml
│   ├── init/
│   │   ├── init.go
│   │   ├── init_command_executor.go
│   │   ├── init_command_executor_test.go
│   │   ├── init_test.go
│   │   ├── rule_example/
│   │   │   ├── aws.yaml
│   │   │   ├── azure.yaml
│   │   │   ├── data.go
│   │   │   ├── default_template.yaml
│   │   │   ├── gcp.yaml
│   │   │   └── k8s.yaml
│   │   └── test_data/
│   │       └── init.sh
│   ├── login/
│   │   ├── login.go
│   │   ├── login_test.go
│   │   └── test_data/
│   │       └── login.sh
│   ├── logout/
│   │   ├── logout.go
│   │   ├── logout_test.go
│   │   └── test_data/
│   │       └── logout.sh
│   ├── module/
│   │   ├── get.go
│   │   ├── list.go
│   │   ├── search.go
│   │   └── tidy.go
│   ├── provider/
│   │   ├── install.go
│   │   ├── install_online_test.go
│   │   ├── install_test.go
│   │   ├── list.go
│   │   ├── list_online_test.go
│   │   ├── list_test.go
│   │   ├── provider.go
│   │   ├── remove.go
│   │   ├── remove_online_test.go
│   │   ├── remove_test.go
│   │   ├── sync.go
│   │   ├── sync_online_test.go
│   │   ├── sync_test.go
│   │   ├── test_data/
│   │   │   └── provider.sh
│   │   ├── update.go
│   │   ├── update_online_test.go
│   │   └── update_test.go
│   ├── query/
│   │   ├── client.go
│   │   ├── client_test.go
│   │   ├── parse.go
│   │   ├── query.go
│   │   ├── query_test.go
│   │   ├── sql.go
│   │   └── test_data/
│   │       └── query.sh
│   ├── root.go
│   ├── tools/
│   │   ├── providers.go
│   │   ├── providers_online_test.go
│   │   └── providers_test.go
│   └── version/
│       ├── version.go
│       └── version_test.go
├── config/
│   ├── config.go
│   ├── config_test.go
│   ├── downloader.go
│   └── downloader_test.go
├── global/
│   ├── flag.go
│   └── flag_test.go
├── go.mod
├── go.sum
├── install.sh
├── main.go
├── pkg/
│   ├── cli_env/
│   │   └── env.go
│   ├── cli_runtime/
│   │   └── runtime.go
│   ├── cloud_sdk/
│   │   ├── client.go
│   │   ├── credentials.go
│   │   ├── dsn.go
│   │   ├── dsn_test.go
│   │   ├── errors.go
│   │   ├── project.go
│   │   ├── project_test.go
│   │   ├── sdk.go
│   │   ├── sdk_test.go
│   │   ├── task.go
│   │   ├── task_test.go
│   │   ├── test_data/
│   │   │   └── sync_workspace/
│   │   │       ├── a.yml
│   │   │       └── b.yml
│   │   ├── user.go
│   │   ├── user_test.go
│   │   ├── workspace.go
│   │   └── workspace_test.go
│   ├── debug/
│   │   ├── debug.go
│   │   └── debug_test.go
│   ├── grpc/
│   │   ├── pb/
│   │   │   ├── cloud/
│   │   │   │   ├── cloud.pb.go
│   │   │   │   ├── cloud.proto
│   │   │   │   └── cloud_grpc.pb.go
│   │   │   ├── common/
│   │   │   │   ├── common.pb.go
│   │   │   │   └── common.proto
│   │   │   ├── issue/
│   │   │   │   ├── issue.pb.go
│   │   │   │   ├── issue.proto
│   │   │   │   └── issue_grpc.pb.go
│   │   │   └── log/
│   │   │       ├── log.pb.go
│   │   │       ├── log.proto
│   │   │       ├── log_grpc.pb.go
│   │   │       ├── transport.go
│   │   │       └── transport_test.go
│   │   ├── stream_uploader.go
│   │   ├── stream_uploader_test.go
│   │   └── tripartite/
│   │       └── google/
│   │           └── protobuf/
│   │               └── timestamp.proto
│   ├── http_client/
│   │   ├── getter.go
│   │   ├── github_repo_downloader.go
│   │   └── requests.go
│   ├── logger/
│   │   ├── config.go
│   │   ├── hc.go
│   │   ├── logger.go
│   │   └── schema.go
│   ├── message/
│   │   ├── message.go
│   │   └── message_test.go
│   ├── modules/
│   │   ├── executors/
│   │   │   ├── executor.go
│   │   │   ├── module_query_executor.go
│   │   │   ├── module_query_executor_test.go
│   │   │   ├── project_cloud_life_cycle_executor.go
│   │   │   ├── project_local_life_cycle_executor.go
│   │   │   ├── provider_fetch_executor.go
│   │   │   ├── provider_fetch_executor_test.go
│   │   │   ├── provider_install_executor.go
│   │   │   ├── provider_install_executor_test.go
│   │   │   └── test_data/
│   │   │       ├── test_fetch_module/
│   │   │       │   └── modules.yaml
│   │   │       ├── test_fetch_module_with_cache/
│   │   │       │   └── modules.yaml
│   │   │       └── test_query_module/
│   │   │           └── modules.yaml
│   │   ├── local_modules_manager/
│   │   │   ├── manager.go
│   │   │   ├── manager_get.go
│   │   │   ├── manager_list.go
│   │   │   ├── manager_search.go
│   │   │   ├── manager_tidy.go
│   │   │   └── manager_update.go
│   │   ├── module/
│   │   │   ├── block.go
│   │   │   ├── errors.go
│   │   │   ├── locatable.go
│   │   │   ├── locatable_test.go
│   │   │   ├── module.go
│   │   │   ├── modules_block.go
│   │   │   ├── providers_block.go
│   │   │   ├── providers_block_test.go
│   │   │   ├── rules_block.go
│   │   │   ├── selefra_block.go
│   │   │   ├── validator.go
│   │   │   ├── validator_test.go
│   │   │   └── variables_block.go
│   │   ├── module_loader/
│   │   │   ├── github_registry_module_loader.go
│   │   │   ├── github_registry_module_loader_test.go
│   │   │   ├── local_directory_module_loader.go
│   │   │   ├── local_directory_module_loader_test.go
│   │   │   ├── module_loader.go
│   │   │   ├── module_loader_manager.go
│   │   │   ├── module_loader_manager_test.go
│   │   │   ├── s3_bucket_path_module_loader.go
│   │   │   ├── test_data/
│   │   │   │   ├── contains_sub_module/
│   │   │   │   │   ├── sub_module_a/
│   │   │   │   │   │   ├── sub_module_a_1/
│   │   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   │   └── sub_module_a_2/
│   │   │   │   │   │       ├── modules.yml
│   │   │   │   │   │       ├── rules.yml
│   │   │   │   │   │       └── selefra.yml
│   │   │   │   │   ├── sub_module_b/
│   │   │   │   │   │   ├── sub_module_b_1/
│   │   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   │   └── sub_module_b_2/
│   │   │   │   │   │       ├── modules.yml
│   │   │   │   │   │       ├── rules.yml
│   │   │   │   │   │       └── selefra.yml
│   │   │   │   │   └── test.yaml
│   │   │   │   ├── dead_loop_module/
│   │   │   │   │   ├── modules.yaml
│   │   │   │   │   ├── sub_module_a/
│   │   │   │   │   │   └── modules.yaml
│   │   │   │   │   └── sub_module_b/
│   │   │   │   │       └── modules.yaml
│   │   │   │   ├── module_mixed/
│   │   │   │   │   ├── sub_module_local/
│   │   │   │   │   │   ├── modules.yml
│   │   │   │   │   │   ├── rules.yml
│   │   │   │   │   │   └── selefra.yml
│   │   │   │   │   └── test.yaml
│   │   │   │   ├── module_use_circle/
│   │   │   │   │   └── test.yaml
│   │   │   │   └── normal_single_module/
│   │   │   │       └── test.yaml
│   │   │   ├── url_module_loader.go
│   │   │   └── url_module_loader_test.go
│   │   ├── parser/
│   │   │   ├── modules.go
│   │   │   ├── modules_test.go
│   │   │   ├── providers.go
│   │   │   ├── providers_test.go
│   │   │   ├── rules.go
│   │   │   ├── rules_test.go
│   │   │   ├── selefra.go
│   │   │   ├── selefra_test.go
│   │   │   ├── test_data/
│   │   │   │   ├── test_modules.yaml
│   │   │   │   ├── test_parse_modules/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_providers/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_rules/
│   │   │   │   │   └── modules.yaml
│   │   │   │   ├── test_parse_selefra/
│   │   │   │   │   └── modules.yaml
│   │   │   │   └── test_parse_variables/
│   │   │   │       └── modules.yaml
│   │   │   ├── variables.go
│   │   │   ├── variables_test.go
│   │   │   ├── yaml_file_to_module_parser.go
│   │   │   └── yaml_file_to_module_parser_test.go
│   │   └── planner/
│   │       ├── module_planner.go
│   │       ├── planner.go
│   │       ├── provider_fetch_planner.go
│   │       ├── provider_fetch_planner_test.go
│   │       ├── provider_install_planner.go
│   │       ├── provider_install_planner_test.go
│   │       ├── rule_planner.go
│   │       ├── rule_planner_test.go
│   │       ├── scope.go
│   │       ├── test_data/
│   │       │   ├── provider_fetch_planner/
│   │       │   │   └── modules.yaml
│   │       │   └── rule_planner/
│   │       │       └── test.yaml
│   │       ├── version_vote.go
│   │       └── version_vote_test.go
│   ├── oci/
│   │   ├── postgresql_installer.go
│   │   ├── postgresql_installer_test.go
│   │   └── test_data/
│   │       └── oci.sh
│   ├── plugin/
│   │   └── plugin.go
│   ├── providers/
│   │   └── local_providers_manager/
│   │       ├── exists.go
│   │       ├── exists_test.go
│   │       ├── get.go
│   │       ├── get_test.go
│   │       ├── install.go
│   │       ├── install_online_test.go
│   │       ├── install_test.go
│   │       ├── list.go
│   │       ├── list_online_test.go
│   │       ├── list_test.go
│   │       ├── local_provider.go
│   │       ├── manager.go
│   │       ├── remove.go
│   │       ├── remove_online_test.go
│   │       ├── remove_test.go
│   │       ├── search.go
│   │       ├── search_test.go
│   │       ├── sync.go
│   │       ├── sync_online_test.go
│   │       ├── sync_test.go
│   │       ├── update.go
│   │       ├── update_online_test.go
│   │       └── update_test.go
│   ├── registry/
│   │   ├── module_github_registry.go
│   │   ├── module_local_registry.go
│   │   ├── module_registry.go
│   │   ├── provider_github_registry.go
│   │   ├── provider_github_registry_test.go
│   │   ├── provider_local_registry.go
│   │   ├── provider_local_registry_test.go
│   │   └── provider_registry.go
│   ├── selefra_workspace/
│   │   ├── device_id.go
│   │   ├── device_id_test.go
│   │   └── workspace.go
│   ├── storage/
│   │   └── pgstorage/
│   │       ├── constants.go
│   │       ├── pgstorage-bak.go
│   │       ├── pgstorage-bak_test.go
│   │       ├── pgstorage.go
│   │       ├── schema_owner_information.go
│   │       ├── schema_owner_information_test.go
│   │       ├── table_cache_information.go
│   │       └── table_cache_information_test.go
│   ├── telemetry/
│   │   ├── analytics.go
│   │   ├── analytics_test.go
│   │   └── rudderstack.go
│   ├── utils/
│   │   ├── browser.go
│   │   ├── browser_test.go
│   │   ├── channel.go
│   │   ├── close.go
│   │   ├── command.go
│   │   ├── file.go
│   │   ├── github.go
│   │   ├── home.go
│   │   ├── lock.go
│   │   ├── log.go
│   │   ├── openai.go
│   │   ├── reg.go
│   │   ├── request.go
│   │   ├── slice.go
│   │   ├── strava.go
│   │   ├── template.go
│   │   ├── terminal_other.go
│   │   └── terminal_win.go
│   └── version/
│       └── version.go
├── scripts/
│   └── kill-postgresql.sh
└── tests/
    └── workspace/
        ├── offline/
        │   ├── module.yaml
        │   ├── rules/
        │   │   └── iam_mfa.yaml
        │   └── selefra.yaml
        └── online/
            ├── module.yaml
            ├── rules/
            │   └── iam_mfa.yaml
            └── selefra.yaml
Download .txt
SYMBOL INDEX (1522 symbols across 194 files)

FILE: cli_ui/print.go
  type uiPrinter (line 18) | type uiPrinter struct
    method printf (line 105) | func (p *uiPrinter) printf(color *color.Color, format string, args ......
    method println (line 130) | func (p *uiPrinter) println(color *color.Color, args ...any) {
  function newUiPrinter (line 24) | func newUiPrinter() *uiPrinter {
  function color2level (line 154) | func color2level(color *color.Color) hclog.Level {
  function init (line 181) | func init() {
  constant prefixManaged (line 188) | prefixManaged   = "managed"
  constant prefixUnmanaged (line 189) | prefixUnmanaged = "unmanaged"
  constant defaultAlias (line 190) | defaultAlias    = "default"
  type LogJSON (line 201) | type LogJSON struct
  function getLevel (line 209) | func getLevel(c *color.Color) string {
  function Errorf (line 225) | func Errorf(format string, a ...interface{}) {
  function Warningf (line 229) | func Warningf(format string, a ...interface{}) {
  function Successf (line 233) | func Successf(format string, a ...interface{}) {
  function Infof (line 238) | func Infof(format string, a ...interface{}) {
  function Errorln (line 242) | func Errorln(a ...interface{}) {
  function Warningln (line 246) | func Warningln(a ...interface{}) {
  function Successln (line 250) | func Successln(a ...interface{}) {
  function Infoln (line 254) | func Infoln(a ...interface{}) {
  function Printf (line 258) | func Printf(c *color.Color, format string, a ...any) {
  function Println (line 262) | func Println(c *color.Color, a ...any) {
  function SaveLogToDiagnostic (line 275) | func SaveLogToDiagnostic(diagnostics []*schema.Diagnostic) {
  function init (line 285) | func init() {
  function SDKLogLevelToCliLevel (line 295) | func SDKLogLevelToCliLevel(level schema.DiagnosticLevel) hclog.Level {
  function PrintDiagnostic (line 304) | func PrintDiagnostic(diagnostics []*schema.Diagnostic) error {
  function PrintDiagnostics (line 319) | func PrintDiagnostics(diagnostics *schema.Diagnostics) error {

FILE: cli_ui/progress.go
  type Bar (line 13) | type Bar struct
  type Progress (line 22) | type Progress struct
    method TrackProgress (line 38) | func (p *Progress) TrackProgress(src string, currentSize, totalSize in...
    method IOBar (line 51) | func (p *Progress) IOBar(name string, reader io.Reader, total int64) {
    method Add (line 74) | func (p *Progress) Add(name string, total int64) {
    method Increment (line 101) | func (p *Progress) Increment(name string, n int64) {
    method Current (line 111) | func (p *Progress) Current(name string, n int64, desc ...string) {
    method SetTotal (line 121) | func (p *Progress) SetTotal(name string, n int64) {
    method Next (line 130) | func (p *Progress) Next(name string) {
    method Done (line 134) | func (p *Progress) Done(name string) {
    method Wait (line 142) | func (p *Progress) Wait(name string) {
  function ShowDesc (line 29) | func ShowDesc(bar *Bar, wcc ...decor.WC) decor.Decorator {
  function DefaultProgress (line 44) | func DefaultProgress() *Progress {

FILE: cli_ui/select_providers.go
  constant DefaultSelectProvidersTitle (line 9) | DefaultSelectProvidersTitle = "[ Use arrows to move, Space to select, En...
  function SelectProviders (line 13) | func SelectProviders(providers []string, title ...string) map[string]str...
  function newList (line 114) | func newList(title string, lines []string) *widgets.List {
  function listForShow (line 130) | func listForShow(providers []string, selectedProviders map[string]struct...

FILE: cli_ui/select_providers_test.go
  function TestSelectProviders (line 7) | func TestSelectProviders(t *testing.T) {
  function TestSelectProviders_Big (line 17) | func TestSelectProviders_Big(t *testing.T) {

FILE: cli_ui/table.go
  function ShowTable (line 12) | func ShowTable(tableHeader []string, tableBody [][]string, tableFooter [...
  function ShowRows (line 26) | func ShowRows(tableHeader []string, tableBodyMatrix [][]string, tableFoo...
  function columnMaxWidth (line 39) | func columnMaxWidth(columns []string) int {

FILE: cli_ui/table_test.go
  function ExampleShowRows (line 3) | func ExampleShowRows() {
  function ExampleShowTable (line 45) | func ExampleShowTable() {

FILE: cli_ui/user.go
  constant CloudTokenRequestPath (line 15) | CloudTokenRequestPath = "/Settings/accessTokens"
  function InputCloudToken (line 18) | func InputCloudToken(serverUrl string) (string, *schema.Diagnostics) {
  function ShowLoginSuccess (line 57) | func ShowLoginSuccess(serverUrl string, cloudCredentials *cloud_sdk.Clou...
  function ShowLoginFailed (line 72) | func ShowLoginFailed(cloudToken string) {
  function ShowRetrievedCloudCredentials (line 79) | func ShowRetrievedCloudCredentials(cloudCredentials *cloud_sdk.CloudCred...
  function ShowLogout (line 89) | func ShowLogout(cloudCredentials *cloud_sdk.CloudCredentials) {

FILE: cmd/apply/apply.go
  function NewApplyCmd (line 16) | func NewApplyCmd() *cobra.Command {
  function Apply (line 55) | func Apply(ctx context.Context, instructions map[string]interface{}, pro...

FILE: cmd/apply/apply_test.go
  function TestApply (line 9) | func TestApply(t *testing.T) {

FILE: cmd/fetch/fetch.go
  function NewFetchCmd (line 16) | func NewFetchCmd() *cobra.Command {
  function Fetch (line 39) | func Fetch(projectWorkspace, downloadWorkspace string) *schema.Diagnosti...

FILE: cmd/fetch/fetch_test.go
  function TestFetch (line 7) | func TestFetch(t *testing.T) {

FILE: cmd/gpt/gpt.go
  function NewGPTCmd (line 17) | func NewGPTCmd() *cobra.Command {
  function Gpt (line 69) | func Gpt(ctx context.Context, instructions map[string]interface{}, proje...

FILE: cmd/gpt/gpt_test.go
  function TestGpt (line 9) | func TestGpt(t *testing.T) {

FILE: cmd/init/init.go
  function NewInitCmd (line 20) | func NewInitCmd() *cobra.Command {
  function getDsn (line 59) | func getDsn(ctx context.Context, projectWorkspace, downloadWorkspace str...
  function loadDSNFromProjectWorkspace (line 117) | func loadDSNFromProjectWorkspace(ctx context.Context, projectWorkspace, ...

FILE: cmd/init/init_command_executor.go
  type InitCommandExecutorOptions (line 38) | type InitCommandExecutorOptions struct
  type InitCommandExecutor (line 58) | type InitCommandExecutor struct
    method Run (line 73) | func (x *InitCommandExecutor) Run(ctx context.Context) error {
    method initHeaderOutput (line 107) | func (x *InitCommandExecutor) initHeaderOutput(providers []string) {
    method chooseProvidersList (line 120) | func (x *InitCommandExecutor) chooseProvidersList(ctx context.Context)...
    method checkWorkspace (line 149) | func (x *InitCommandExecutor) checkWorkspace() bool {
    method isNeedForceInit (line 177) | func (x *InitCommandExecutor) isNeedForceInit() bool {
    method reInitConfirm (line 198) | func (x *InitCommandExecutor) reInitConfirm() bool {
    method initSelefraYaml (line 224) | func (x *InitCommandExecutor) initSelefraYaml(ctx context.Context, pro...
    method getCloudBlock (line 288) | func (x *InitCommandExecutor) getCloudBlock(projectName string) *modul...
    method initRulesYaml (line 332) | func (x *InitCommandExecutor) initRulesYaml(providerSlice []*registry....
    method initProvidersYaml (line 348) | func (x *InitCommandExecutor) initProvidersYaml(ctx context.Context, r...
    method GetConnectionBlock (line 396) | func (x *InitCommandExecutor) GetConnectionBlock() *module.ConnectionB...
    method getProjectName (line 424) | func (x *InitCommandExecutor) getProjectName() (string, bool) {
    method requestProvidersList (line 450) | func (x *InitCommandExecutor) requestProvidersList(ctx context.Context...
    method makeProviders (line 464) | func (x *InitCommandExecutor) makeProviders(ctx context.Context, requi...
    method getProviderInitConfiguration (line 528) | func (x *InitCommandExecutor) getProviderInitConfiguration(ctx context...
  function NewInitCommandExecutor (line 67) | func NewInitCommandExecutor(options *InitCommandExecutorOptions) *InitCo...
  constant SelefraInputInitForceConfirm (line 193) | SelefraInputInitForceConfirm     = "SELEFRA_INPUT_INIT_FORCE_CONFIRM"
  constant SelefraInputInitRelevanceProject (line 194) | SelefraInputInitRelevanceProject = "SELEFRA_INPUT_INIT_RELEVANCE_PROJECT"
  function init (line 324) | func init() {

FILE: cmd/init/init_command_executor_test.go
  function TestInitCommandExecutor_Run (line 10) | func TestInitCommandExecutor_Run(t *testing.T) {

FILE: cmd/init/init_test.go
  function Test_getDsn (line 11) | func Test_getDsn(t *testing.T) {

FILE: cmd/login/login.go
  function NewLoginCmd (line 13) | func NewLoginCmd() *cobra.Command {
  function RunFunc (line 26) | func RunFunc(cmd *cobra.Command, args []string) error {

FILE: cmd/login/login_test.go
  function TestRunFunc (line 8) | func TestRunFunc(t *testing.T) {

FILE: cmd/logout/logout.go
  function NewLogoutCmd (line 12) | func NewLogoutCmd() *cobra.Command {
  function RunFunc (line 23) | func RunFunc(cmd *cobra.Command, args []string) error {

FILE: cmd/logout/logout_test.go
  function TestRunFunc (line 8) | func TestRunFunc(t *testing.T) {

FILE: cmd/provider/install.go
  function newCmdProviderInstall (line 15) | func newCmdProviderInstall() *cobra.Command {
  function Install (line 35) | func Install(ctx context.Context, downloadWorkspace string, requiredProv...

FILE: cmd/provider/install_test.go
  function Test_install (line 37) | func Test_install(t *testing.T) {

FILE: cmd/provider/list.go
  function newCmdProviderList (line 12) | func newCmdProviderList() *cobra.Command {
  function List (line 33) | func List(downloadWorkspace string) error {

FILE: cmd/provider/list_test.go
  function Test_list (line 21) | func Test_list(t *testing.T) {

FILE: cmd/provider/provider.go
  function NewProviderCmd (line 7) | func NewProviderCmd() *cobra.Command {

FILE: cmd/provider/remove.go
  function newCmdProviderRemove (line 12) | func newCmdProviderRemove() *cobra.Command {
  function Remove (line 31) | func Remove(ctx context.Context, downloadWorkspace string, names ...stri...

FILE: cmd/provider/remove_test.go
  function TestRemove (line 27) | func TestRemove(t *testing.T) {

FILE: cmd/query/client.go
  type SQLQueryClient (line 17) | type SQLQueryClient struct
    method Run (line 40) | func (x *SQLQueryClient) Run(ctx context.Context) {
    method isFirstWord (line 101) | func (x *SQLQueryClient) isFirstWord(text string) bool {
    method completer (line 105) | func (x *SQLQueryClient) completer(d prompt.Document) []prompt.Suggest {
    method formatSuggest (line 111) | func (x *SQLQueryClient) formatSuggest(text string, before string) []p...
    method initTablesSuggest (line 137) | func (x *SQLQueryClient) initTablesSuggest(ctx context.Context) {
    method getTablesSuggestSQL (line 155) | func (x *SQLQueryClient) getTablesSuggestSQL() string {
    method initColumnsSuggest (line 166) | func (x *SQLQueryClient) initColumnsSuggest(ctx context.Context) {
    method getColumnsSuggestSQL (line 186) | func (x *SQLQueryClient) getColumnsSuggestSQL() string {
  function NewQueryClient (line 25) | func NewQueryClient(ctx context.Context, storageType storage_factory.Sto...

FILE: cmd/query/client_test.go
  function TestNewQueryClient (line 12) | func TestNewQueryClient(t *testing.T) {

FILE: cmd/query/query.go
  function NewQueryCmd (line 24) | func NewQueryCmd() *cobra.Command {
  function getDsn (line 74) | func getDsn(ctx context.Context, projectWorkspace, downloadWorkspace str...
  function loadDSNFromProjectWorkspace (line 130) | func loadDSNFromProjectWorkspace(ctx context.Context, projectWorkspace, ...

FILE: cmd/query/sql.go
  constant TABLESQL (line 3) | TABLESQL = "SELECT tablename FROM pg_tables where schemaname = 'public' ...
  constant COLUMNSQL (line 4) | COLUMNSQL = "select table_schema,table_name,column_name from information...

FILE: cmd/root.go
  function Execute (line 68) | func Execute() {
  function init (line 83) | func init() {

FILE: cmd/tools/providers.go
  function CacheExpired (line 171) | func CacheExpired(ctx context.Context, storage *postgresql_storage.Postg...
  function parseDuration (line 193) | func parseDuration(d string) (time.Duration, error) {

FILE: cmd/tools/providers_online_test.go
  function getProviderAndConfigOnline (line 12) | func getProviderAndConfigOnline() (registry.ProviderBinary, *config.Root...
  function TestGetProvidersOnline (line 35) | func TestGetProvidersOnline(t *testing.T) {
  function TestSetProvidersOnline (line 53) | func TestSetProvidersOnline(t *testing.T) {
  function TestSetSelefraProviderOnLine (line 95) | func TestSetSelefraProviderOnLine(t *testing.T) {

FILE: cmd/tools/providers_test.go
  function getProviderAndConfig (line 14) | func getProviderAndConfig() (registry.ProviderBinary, *config.RootConfig...
  function TestGetProviders (line 35) | func TestGetProviders(t *testing.T) {
  function TestSetProviders (line 47) | func TestSetProviders(t *testing.T) {
  function TestSetSelefraProvider (line 98) | func TestSetSelefraProvider(t *testing.T) {

FILE: cmd/version/version.go
  function NewVersionCmd (line 11) | func NewVersionCmd() *cobra.Command {
  function version (line 24) | func version() {

FILE: cmd/version/version_test.go
  function TestVersion (line 5) | func TestVersion(t *testing.T) {

FILE: config/config.go
  function GetCacheKey (line 270) | func GetCacheKey() string {
  constant HomeSelefraRCConfigFileName (line 1062) | HomeSelefraRCConfigFileName = "selefra.rc"
  type HomeSelefraRCConfig (line 1064) | type HomeSelefraRCConfig struct
  function GetHomeSelefraRCConfigPath (line 1068) | func GetHomeSelefraRCConfigPath() (string, error) {
  function ReadHomeSelefraRCConfig (line 1076) | func ReadHomeSelefraRCConfig() (*HomeSelefraRCConfig, error) {
  function GetDefaultDownloadCacheDirectory (line 1096) | func GetDefaultDownloadCacheDirectory() (string, error) {
  function initHomeSelefraRCConfig (line 1112) | func initHomeSelefraRCConfig() error {
  constant SelefraHomeWorkspaceDirectoryName (line 1127) | SelefraHomeWorkspaceDirectoryName = ".selefra"
  function GetSelefraHomeWorkspacePath (line 1130) | func GetSelefraHomeWorkspacePath() (string, error) {

FILE: global/flag.go
  type Option (line 11) | type Option
  type Variable (line 14) | type Variable struct
  type readOnlyVariable (line 40) | type readOnlyVariable struct
  function WithWorkspace (line 57) | func WithWorkspace(workspace string) Option {
  function Init (line 64) | func Init(cmd string, opts ...Option) {
  function WrappedInit (line 83) | func WrappedInit(workspace string) func(cmd *cobra.Command, args []strin...
  function DefaultWrappedInit (line 90) | func DefaultWrappedInit() func(cmd *cobra.Command, args []string) {
  function parentCmdNames (line 97) | func parentCmdNames(cmd *cobra.Command) string {
  function SetToken (line 113) | func SetToken(token string) {
  function SetStage (line 120) | func SetStage(stage string) {
  function SetOrgName (line 127) | func SetOrgName(orgName string) {
  function SetProjectName (line 134) | func SetProjectName(prjName string) {
  function ProjectName (line 141) | func ProjectName() string {
  function SetRelvPrjName (line 148) | func SetRelvPrjName(name string) {
  function RelvPrjName (line 155) | func RelvPrjName() string {
  function SetLogLevel (line 162) | func SetLogLevel(level string) {
  function WorkSpace (line 169) | func WorkSpace() string {
  function Token (line 173) | func Token() string {
  function OrgName (line 180) | func OrgName() string {
  function Cmd (line 187) | func Cmd() string {
  function Stage (line 191) | func Stage() string {
  function LogLevel (line 198) | func LogLevel() string {
  constant PkgBasePath (line 205) | PkgBasePath = "ghcr.io/selefra/postgre_"
  constant PkgTag (line 206) | PkgTag = ":latest"

FILE: global/flag_test.go
  function Test_Variable (line 9) | func Test_Variable(t *testing.T) {
  function Test_parentCmdNames (line 24) | func Test_parentCmdNames(t *testing.T) {

FILE: main.go
  function main (line 25) | func main() {

FILE: pkg/cli_env/env.go
  constant SelefraCloudFlag (line 8) | SelefraCloudFlag = "SELEFRA_CLOUD_FLAG"
  function IsCloudEnv (line 11) | func IsCloudEnv() bool {
  constant SelefraServerHost (line 22) | SelefraServerHost = "SELEFRA_CLOUD_HOST"
  constant DefaultCloudHost (line 24) | DefaultCloudHost = "main-grpc.selefra.io:1234"
  function GetServerHost (line 27) | func GetServerHost() string {
  constant SelefraCloudToken (line 39) | SelefraCloudToken = "SELEFRA_CLOUD_TOKEN"
  function GetCloudToken (line 41) | func GetCloudToken() string {
  constant SelefraCloudHttpHost (line 47) | SelefraCloudHttpHost = "SELEFRA_CLOUD_HTTP_HOST"
  constant DefaultSelefraCloudHttpHost (line 49) | DefaultSelefraCloudHttpHost = "https://www.selefra.io"
  function GetSelefraCloudHttpHost (line 51) | func GetSelefraCloudHttpHost() string {
  constant SelefraTelemetryEnable (line 62) | SelefraTelemetryEnable = "SELEFRA_TELEMETRY_ENABLE"
  function GetSelefraTelemetryEnable (line 64) | func GetSelefraTelemetryEnable() string {
  constant SelefraTelemetryTokenEnvName (line 73) | SelefraTelemetryTokenEnvName = "SELEFRA_TELEMETRY_TOKEN"
  function GetSelefraTelemetryToken (line 75) | func GetSelefraTelemetryToken() string {

FILE: pkg/cloud_sdk/credentials.go
  constant CredentialsFileName (line 11) | CredentialsFileName = "credentials.json"
  type CloudCredentials (line 16) | type CloudCredentials struct
  method GetCredentialsWorkspacePath (line 41) | func (x *CloudClient) GetCredentialsWorkspacePath() (string, *schema.Dia...
  method SaveCredentials (line 50) | func (x *CloudClient) SaveCredentials(credentials *CloudCredentials) *sc...
  method GetCredentials (line 74) | func (x *CloudClient) GetCredentials() (*CloudCredentials, *schema.Diagn...

FILE: pkg/cloud_sdk/dsn.go
  method FetchOrgDSN (line 11) | func (x *CloudClient) FetchOrgDSN() (string, *schema.Diagnostics) {

FILE: pkg/cloud_sdk/dsn_test.go
  function TestCloudClient_FetchOrgDSN (line 9) | func TestCloudClient_FetchOrgDSN(t *testing.T) {

FILE: pkg/cloud_sdk/project.go
  method CreateProject (line 11) | func (x *CloudClient) CreateProject(projectName string) (*cloud.CreatePr...

FILE: pkg/cloud_sdk/project_test.go
  function TestCloudClient_CreateProject (line 10) | func TestCloudClient_CreateProject(t *testing.T) {

FILE: pkg/cloud_sdk/sdk.go
  constant IssueUploaderName (line 19) | IssueUploaderName = "issue-uploader"
  constant LogUploaderName (line 20) | LogUploaderName   = "log-uploader"
  type CloudClient (line 23) | type CloudClient struct
    method NewIssueStreamUploader (line 95) | func (x *CloudClient) NewIssueStreamUploader(messageChannel *message.C...
    method NewLogStreamUploader (line 119) | func (x *CloudClient) NewLogStreamUploader(messageChannel *message.Cha...
    method DialCloudHost (line 144) | func (x *CloudClient) DialCloudHost() (*grpc.ClientConn, error) {
    method BuildMetaContext (line 157) | func (x *CloudClient) BuildMetaContext() context.Context {
  function NewCloudClient (line 42) | func NewCloudClient(serverUrl string) (*CloudClient, *schema.Diagnostics) {

FILE: pkg/cloud_sdk/sdk_test.go
  function getUnAuthSDKClientForTest (line 18) | func getUnAuthSDKClientForTest() *CloudClient {
  function getAuthedSDKClientForTest (line 26) | func getAuthedSDKClientForTest() *CloudClient {
  function TestNewCloudClient (line 42) | func TestNewCloudClient(t *testing.T) {
  function TestCloudClient_NewIssueStreamUploader (line 48) | func TestCloudClient_NewIssueStreamUploader(t *testing.T) {
  function TestCloudClient_NewLogStreamUploader (line 101) | func TestCloudClient_NewLogStreamUploader(t *testing.T) {

FILE: pkg/cloud_sdk/task.go
  method CreateTask (line 9) | func (x *CloudClient) CreateTask(projectName string) (*cloud.CreateTask_...

FILE: pkg/cloud_sdk/task_test.go
  function TestCloudClient_CreateTask (line 10) | func TestCloudClient_CreateTask(t *testing.T) {

FILE: pkg/cloud_sdk/user.go
  method IsLoggedIn (line 14) | func (x *CloudClient) IsLoggedIn() bool {
  method SetToken (line 18) | func (x *CloudClient) SetToken(token string) {
  method Login (line 25) | func (x *CloudClient) Login(token string) (*CloudCredentials, *schema.Di...
  method Logout (line 62) | func (x *CloudClient) Logout() *schema.Diagnostics {

FILE: pkg/cloud_sdk/user_test.go
  function TestCloudClient_IsLoggedIn (line 9) | func TestCloudClient_IsLoggedIn(t *testing.T) {
  function TestCloudClient_Login (line 21) | func TestCloudClient_Login(t *testing.T) {
  function TestCloudClient_Logout (line 26) | func TestCloudClient_Logout(t *testing.T) {

FILE: pkg/cloud_sdk/workspace.go
  method UploadWorkspace (line 12) | func (x *CloudClient) UploadWorkspace(ctx context.Context, projectName, ...
  function workspaceYamlFileSlice (line 31) | func workspaceYamlFileSlice(dirname string) ([]*cloud.SyncWorkplace_Proj...

FILE: pkg/cloud_sdk/workspace_test.go
  function TestCloudClient_UploadWorkspace (line 11) | func TestCloudClient_UploadWorkspace(t *testing.T) {

FILE: pkg/debug/debug.go
  type SamplingService (line 17) | type SamplingService struct
    method Start (line 63) | func (x *SamplingService) Start() error {
    method Stop (line 75) | func (x *SamplingService) Stop() {
    method IsRunning (line 82) | func (x *SamplingService) IsRunning() bool {
    method StartWorker (line 89) | func (x *SamplingService) StartWorker() {
    method SamplingOnce (line 102) | func (x *SamplingService) SamplingOnce() {
  function NewSamplingService (line 31) | func NewSamplingService(outputDirectory string, samplingInterval time.Du...
  function getEncoder (line 47) | func getEncoder() zapcore.Encoder {
  function getLogWriter (line 54) | func getLogWriter(outputDirectory string) zapcore.WriteSyncer {

FILE: pkg/debug/debug_test.go
  function TestNewSamplingService (line 9) | func TestNewSamplingService(t *testing.T) {

FILE: pkg/grpc/pb/cloud/cloud.pb.go
  constant _ (line 19) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  constant _ (line 21) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  type RequestEmpty (line 24) | type RequestEmpty struct
    method Reset (line 30) | func (x *RequestEmpty) Reset() {
    method String (line 39) | func (x *RequestEmpty) String() string {
    method ProtoMessage (line 43) | func (*RequestEmpty) ProtoMessage() {}
    method ProtoReflect (line 45) | func (x *RequestEmpty) ProtoReflect() protoreflect.Message {
    method Descriptor (line 58) | func (*RequestEmpty) Descriptor() ([]byte, []int) {
  type ResponseEmpty (line 62) | type ResponseEmpty struct
    method Reset (line 68) | func (x *ResponseEmpty) Reset() {
    method String (line 77) | func (x *ResponseEmpty) String() string {
    method ProtoMessage (line 81) | func (*ResponseEmpty) ProtoMessage() {}
    method ProtoReflect (line 83) | func (x *ResponseEmpty) ProtoReflect() protoreflect.Message {
    method Descriptor (line 96) | func (*ResponseEmpty) Descriptor() ([]byte, []int) {
  type Login (line 100) | type Login struct
    method Reset (line 106) | func (x *Login) Reset() {
    method String (line 115) | func (x *Login) String() string {
    method ProtoMessage (line 119) | func (*Login) ProtoMessage() {}
    method ProtoReflect (line 121) | func (x *Login) ProtoReflect() protoreflect.Message {
    method Descriptor (line 134) | func (*Login) Descriptor() ([]byte, []int) {
  type FetchOrgDsn (line 138) | type FetchOrgDsn struct
    method Reset (line 144) | func (x *FetchOrgDsn) Reset() {
    method String (line 153) | func (x *FetchOrgDsn) String() string {
    method ProtoMessage (line 157) | func (*FetchOrgDsn) ProtoMessage() {}
    method ProtoReflect (line 159) | func (x *FetchOrgDsn) ProtoReflect() protoreflect.Message {
    method Descriptor (line 172) | func (*FetchOrgDsn) Descriptor() ([]byte, []int) {
  type Logout (line 176) | type Logout struct
    method Reset (line 182) | func (x *Logout) Reset() {
    method String (line 191) | func (x *Logout) String() string {
    method ProtoMessage (line 195) | func (*Logout) ProtoMessage() {}
    method ProtoReflect (line 197) | func (x *Logout) ProtoReflect() protoreflect.Message {
    method Descriptor (line 210) | func (*Logout) Descriptor() ([]byte, []int) {
  type CreateProject (line 214) | type CreateProject struct
    method Reset (line 220) | func (x *CreateProject) Reset() {
    method String (line 229) | func (x *CreateProject) String() string {
    method ProtoMessage (line 233) | func (*CreateProject) ProtoMessage() {}
    method ProtoReflect (line 235) | func (x *CreateProject) ProtoReflect() protoreflect.Message {
    method Descriptor (line 248) | func (*CreateProject) Descriptor() ([]byte, []int) {
  type SyncWorkplace (line 252) | type SyncWorkplace struct
    method Reset (line 258) | func (x *SyncWorkplace) Reset() {
    method String (line 267) | func (x *SyncWorkplace) String() string {
    method ProtoMessage (line 271) | func (*SyncWorkplace) ProtoMessage() {}
    method ProtoReflect (line 273) | func (x *SyncWorkplace) ProtoReflect() protoreflect.Message {
    method Descriptor (line 286) | func (*SyncWorkplace) Descriptor() ([]byte, []int) {
  type CreateTask (line 290) | type CreateTask struct
    method Reset (line 296) | func (x *CreateTask) Reset() {
    method String (line 305) | func (x *CreateTask) String() string {
    method ProtoMessage (line 309) | func (*CreateTask) ProtoMessage() {}
    method ProtoReflect (line 311) | func (x *CreateTask) ProtoReflect() protoreflect.Message {
    method Descriptor (line 324) | func (*CreateTask) Descriptor() ([]byte, []int) {
  type Login_Request (line 328) | type Login_Request struct
    method Reset (line 336) | func (x *Login_Request) Reset() {
    method String (line 345) | func (x *Login_Request) String() string {
    method ProtoMessage (line 349) | func (*Login_Request) ProtoMessage() {}
    method ProtoReflect (line 351) | func (x *Login_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 364) | func (*Login_Request) Descriptor() ([]byte, []int) {
    method GetToken (line 368) | func (x *Login_Request) GetToken() string {
  type Login_Response (line 375) | type Login_Response struct
    method Reset (line 387) | func (x *Login_Response) Reset() {
    method String (line 396) | func (x *Login_Response) String() string {
    method ProtoMessage (line 400) | func (*Login_Response) ProtoMessage() {}
    method ProtoReflect (line 402) | func (x *Login_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 415) | func (*Login_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 419) | func (x *Login_Response) GetDiagnosis() *common.Diagnosis {
    method GetTokenName (line 426) | func (x *Login_Response) GetTokenName() string {
    method GetUserName (line 433) | func (x *Login_Response) GetUserName() string {
    method GetOrgName (line 440) | func (x *Login_Response) GetOrgName() string {
    method GetServerHost (line 447) | func (x *Login_Response) GetServerHost() string {
  type FetchOrgDsn_Response (line 454) | type FetchOrgDsn_Response struct
    method Reset (line 463) | func (x *FetchOrgDsn_Response) Reset() {
    method String (line 472) | func (x *FetchOrgDsn_Response) String() string {
    method ProtoMessage (line 476) | func (*FetchOrgDsn_Response) ProtoMessage() {}
    method ProtoReflect (line 478) | func (x *FetchOrgDsn_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 491) | func (*FetchOrgDsn_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 495) | func (x *FetchOrgDsn_Response) GetDiagnosis() *common.Diagnosis {
    method GetDsn (line 502) | func (x *FetchOrgDsn_Response) GetDsn() string {
  type Logout_Response (line 509) | type Logout_Response struct
    method Reset (line 517) | func (x *Logout_Response) Reset() {
    method String (line 526) | func (x *Logout_Response) String() string {
    method ProtoMessage (line 530) | func (*Logout_Response) ProtoMessage() {}
    method ProtoReflect (line 532) | func (x *Logout_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 545) | func (*Logout_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 549) | func (x *Logout_Response) GetDiagnosis() *common.Diagnosis {
  type CreateProject_Request (line 556) | type CreateProject_Request struct
    method Reset (line 564) | func (x *CreateProject_Request) Reset() {
    method String (line 573) | func (x *CreateProject_Request) String() string {
    method ProtoMessage (line 577) | func (*CreateProject_Request) ProtoMessage() {}
    method ProtoReflect (line 579) | func (x *CreateProject_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 592) | func (*CreateProject_Request) Descriptor() ([]byte, []int) {
    method GetName (line 596) | func (x *CreateProject_Request) GetName() string {
  type CreateProject_Response (line 603) | type CreateProject_Response struct
    method Reset (line 613) | func (x *CreateProject_Response) Reset() {
    method String (line 622) | func (x *CreateProject_Response) String() string {
    method ProtoMessage (line 626) | func (*CreateProject_Response) ProtoMessage() {}
    method ProtoReflect (line 628) | func (x *CreateProject_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 641) | func (*CreateProject_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 645) | func (x *CreateProject_Response) GetDiagnosis() *common.Diagnosis {
    method GetName (line 652) | func (x *CreateProject_Response) GetName() string {
    method GetOrgName (line 659) | func (x *CreateProject_Response) GetOrgName() string {
  type SyncWorkplace_ProjectWorkplace (line 666) | type SyncWorkplace_ProjectWorkplace struct
    method Reset (line 675) | func (x *SyncWorkplace_ProjectWorkplace) Reset() {
    method String (line 684) | func (x *SyncWorkplace_ProjectWorkplace) String() string {
    method ProtoMessage (line 688) | func (*SyncWorkplace_ProjectWorkplace) ProtoMessage() {}
    method ProtoReflect (line 690) | func (x *SyncWorkplace_ProjectWorkplace) ProtoReflect() protoreflect.M...
    method Descriptor (line 703) | func (*SyncWorkplace_ProjectWorkplace) Descriptor() ([]byte, []int) {
    method GetPath (line 707) | func (x *SyncWorkplace_ProjectWorkplace) GetPath() string {
    method GetYamlContent (line 714) | func (x *SyncWorkplace_ProjectWorkplace) GetYamlContent() string {
  type SyncWorkplace_Request (line 721) | type SyncWorkplace_Request struct
    method Reset (line 730) | func (x *SyncWorkplace_Request) Reset() {
    method String (line 739) | func (x *SyncWorkplace_Request) String() string {
    method ProtoMessage (line 743) | func (*SyncWorkplace_Request) ProtoMessage() {}
    method ProtoReflect (line 745) | func (x *SyncWorkplace_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 758) | func (*SyncWorkplace_Request) Descriptor() ([]byte, []int) {
    method GetProjectName (line 762) | func (x *SyncWorkplace_Request) GetProjectName() string {
    method GetProjectWorkplace (line 769) | func (x *SyncWorkplace_Request) GetProjectWorkplace() []*SyncWorkplace...
  type SyncWorkplace_Response (line 776) | type SyncWorkplace_Response struct
    method Reset (line 784) | func (x *SyncWorkplace_Response) Reset() {
    method String (line 793) | func (x *SyncWorkplace_Response) String() string {
    method ProtoMessage (line 797) | func (*SyncWorkplace_Response) ProtoMessage() {}
    method ProtoReflect (line 799) | func (x *SyncWorkplace_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 812) | func (*SyncWorkplace_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 816) | func (x *SyncWorkplace_Response) GetDiagnosis() *common.Diagnosis {
  type CreateTask_Request (line 823) | type CreateTask_Request struct
    method Reset (line 834) | func (x *CreateTask_Request) Reset() {
    method String (line 843) | func (x *CreateTask_Request) String() string {
    method ProtoMessage (line 847) | func (*CreateTask_Request) ProtoMessage() {}
    method ProtoReflect (line 849) | func (x *CreateTask_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 862) | func (*CreateTask_Request) Descriptor() ([]byte, []int) {
    method GetProjectName (line 866) | func (x *CreateTask_Request) GetProjectName() string {
    method GetTaskId (line 873) | func (x *CreateTask_Request) GetTaskId() string {
    method GetTaskSource (line 880) | func (x *CreateTask_Request) GetTaskSource() string {
    method GetName (line 887) | func (x *CreateTask_Request) GetName() string {
  type CreateTask_Response (line 894) | type CreateTask_Response struct
    method Reset (line 904) | func (x *CreateTask_Response) Reset() {
    method String (line 913) | func (x *CreateTask_Response) String() string {
    method ProtoMessage (line 917) | func (*CreateTask_Response) ProtoMessage() {}
    method ProtoReflect (line 919) | func (x *CreateTask_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 932) | func (*CreateTask_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 936) | func (x *CreateTask_Response) GetDiagnosis() *common.Diagnosis {
    method GetTaskId (line 943) | func (x *CreateTask_Response) GetTaskId() string {
    method GetProjectTaskId (line 950) | func (x *CreateTask_Response) GetProjectTaskId() uint64 {
  function file_cloud_cloud_proto_rawDescGZIP (line 1070) | func file_cloud_cloud_proto_rawDescGZIP() []byte {
  function init (line 1127) | func init() { file_cloud_cloud_proto_init() }
  function file_cloud_cloud_proto_init (line 1128) | func file_cloud_cloud_proto_init() {

FILE: pkg/grpc/pb/cloud/cloud_grpc.pb.go
  constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
  type CloudNoAuthClient (line 24) | type CloudNoAuthClient interface
  type cloudNoAuthClient (line 28) | type cloudNoAuthClient struct
    method Login (line 36) | func (c *cloudNoAuthClient) Login(ctx context.Context, in *Login_Reque...
  function NewCloudNoAuthClient (line 32) | func NewCloudNoAuthClient(cc grpc.ClientConnInterface) CloudNoAuthClient {
  type CloudNoAuthServer (line 48) | type CloudNoAuthServer interface
  type UnimplementedCloudNoAuthServer (line 54) | type UnimplementedCloudNoAuthServer struct
    method Login (line 57) | func (UnimplementedCloudNoAuthServer) Login(context.Context, *Login_Re...
    method mustEmbedUnimplementedCloudNoAuthServer (line 60) | func (UnimplementedCloudNoAuthServer) mustEmbedUnimplementedCloudNoAut...
  type UnsafeCloudNoAuthServer (line 65) | type UnsafeCloudNoAuthServer interface
  function RegisterCloudNoAuthServer (line 69) | func RegisterCloudNoAuthServer(s grpc.ServiceRegistrar, srv CloudNoAuthS...
  function _CloudNoAuth_Login_Handler (line 73) | func _CloudNoAuth_Login_Handler(srv interface{}, ctx context.Context, de...
  type CloudClient (line 110) | type CloudClient interface
  type cloudClient (line 118) | type cloudClient struct
    method FetchOrgDsn (line 126) | func (c *cloudClient) FetchOrgDsn(ctx context.Context, in *RequestEmpt...
    method Logout (line 135) | func (c *cloudClient) Logout(ctx context.Context, in *RequestEmpty, op...
    method CreateProject (line 144) | func (c *cloudClient) CreateProject(ctx context.Context, in *CreatePro...
    method SyncWorkplace (line 153) | func (c *cloudClient) SyncWorkplace(ctx context.Context, in *SyncWorkp...
    method CreateTask (line 162) | func (c *cloudClient) CreateTask(ctx context.Context, in *CreateTask_R...
  function NewCloudClient (line 122) | func NewCloudClient(cc grpc.ClientConnInterface) CloudClient {
  type CloudServer (line 174) | type CloudServer interface
  type UnimplementedCloudServer (line 184) | type UnimplementedCloudServer struct
    method FetchOrgDsn (line 187) | func (UnimplementedCloudServer) FetchOrgDsn(context.Context, *RequestE...
    method Logout (line 190) | func (UnimplementedCloudServer) Logout(context.Context, *RequestEmpty)...
    method CreateProject (line 193) | func (UnimplementedCloudServer) CreateProject(context.Context, *Create...
    method SyncWorkplace (line 196) | func (UnimplementedCloudServer) SyncWorkplace(context.Context, *SyncWo...
    method CreateTask (line 199) | func (UnimplementedCloudServer) CreateTask(context.Context, *CreateTas...
    method mustEmbedUnimplementedCloudServer (line 202) | func (UnimplementedCloudServer) mustEmbedUnimplementedCloudServer() {}
  type UnsafeCloudServer (line 207) | type UnsafeCloudServer interface
  function RegisterCloudServer (line 211) | func RegisterCloudServer(s grpc.ServiceRegistrar, srv CloudServer) {
  function _Cloud_FetchOrgDsn_Handler (line 215) | func _Cloud_FetchOrgDsn_Handler(srv interface{}, ctx context.Context, de...
  function _Cloud_Logout_Handler (line 233) | func _Cloud_Logout_Handler(srv interface{}, ctx context.Context, dec fun...
  function _Cloud_CreateProject_Handler (line 251) | func _Cloud_CreateProject_Handler(srv interface{}, ctx context.Context, ...
  function _Cloud_SyncWorkplace_Handler (line 269) | func _Cloud_SyncWorkplace_Handler(srv interface{}, ctx context.Context, ...
  function _Cloud_CreateTask_Handler (line 287) | func _Cloud_CreateTask_Handler(srv interface{}, ctx context.Context, dec...

FILE: pkg/grpc/pb/common/common.pb.go
  constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  type Diagnosis_Code (line 23) | type Diagnosis_Code
    method Enum (line 48) | func (x Diagnosis_Code) Enum() *Diagnosis_Code {
    method String (line 54) | func (x Diagnosis_Code) String() string {
    method Descriptor (line 58) | func (Diagnosis_Code) Descriptor() protoreflect.EnumDescriptor {
    method Type (line 62) | func (Diagnosis_Code) Type() protoreflect.EnumType {
    method Number (line 66) | func (x Diagnosis_Code) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 71) | func (Diagnosis_Code) EnumDescriptor() ([]byte, []int) {
  constant Diagnosis_SUCCESS (line 26) | Diagnosis_SUCCESS      Diagnosis_Code = 0
  constant Diagnosis_IllegalToken (line 27) | Diagnosis_IllegalToken Diagnosis_Code = 2
  constant Diagnosis_Error (line 28) | Diagnosis_Error        Diagnosis_Code = 7
  constant Diagnosis_NoAuthority (line 29) | Diagnosis_NoAuthority  Diagnosis_Code = 11
  type Diagnosis (line 75) | type Diagnosis struct
    method Reset (line 84) | func (x *Diagnosis) Reset() {
    method String (line 93) | func (x *Diagnosis) String() string {
    method ProtoMessage (line 97) | func (*Diagnosis) ProtoMessage() {}
    method ProtoReflect (line 99) | func (x *Diagnosis) ProtoReflect() protoreflect.Message {
    method Descriptor (line 112) | func (*Diagnosis) Descriptor() ([]byte, []int) {
    method GetCode (line 116) | func (x *Diagnosis) GetCode() Diagnosis_Code {
    method GetMsg (line 123) | func (x *Diagnosis) GetMsg() string {
  function file_common_common_proto_rawDescGZIP (line 153) | func file_common_common_proto_rawDescGZIP() []byte {
  function init (line 175) | func init() { file_common_common_proto_init() }
  function file_common_common_proto_init (line 176) | func file_common_common_proto_init() {

FILE: pkg/grpc/pb/issue/issue.pb.go
  constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  type UploadIssueStream_Severity (line 23) | type UploadIssueStream_Severity
    method Enum (line 54) | func (x UploadIssueStream_Severity) Enum() *UploadIssueStream_Severity {
    method String (line 60) | func (x UploadIssueStream_Severity) String() string {
    method Descriptor (line 64) | func (UploadIssueStream_Severity) Descriptor() protoreflect.EnumDescri...
    method Type (line 68) | func (UploadIssueStream_Severity) Type() protoreflect.EnumType {
    method Number (line 72) | func (x UploadIssueStream_Severity) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 77) | func (UploadIssueStream_Severity) EnumDescriptor() ([]byte, []int) {
  constant UploadIssueStream_UNKNOWN (line 26) | UploadIssueStream_UNKNOWN       UploadIssueStream_Severity = 0
  constant UploadIssueStream_INFORMATIONAL (line 27) | UploadIssueStream_INFORMATIONAL UploadIssueStream_Severity = 1
  constant UploadIssueStream_LOW (line 28) | UploadIssueStream_LOW           UploadIssueStream_Severity = 2
  constant UploadIssueStream_MEDIUM (line 29) | UploadIssueStream_MEDIUM        UploadIssueStream_Severity = 3
  constant UploadIssueStream_HIGH (line 30) | UploadIssueStream_HIGH          UploadIssueStream_Severity = 4
  constant UploadIssueStream_CRITICAL (line 31) | UploadIssueStream_CRITICAL      UploadIssueStream_Severity = 5
  type UploadIssueStream_Rule_Status (line 81) | type UploadIssueStream_Rule_Status
    method Enum (line 103) | func (x UploadIssueStream_Rule_Status) Enum() *UploadIssueStream_Rule_...
    method String (line 109) | func (x UploadIssueStream_Rule_Status) String() string {
    method Descriptor (line 113) | func (UploadIssueStream_Rule_Status) Descriptor() protoreflect.EnumDes...
    method Type (line 117) | func (UploadIssueStream_Rule_Status) Type() protoreflect.EnumType {
    method Number (line 121) | func (x UploadIssueStream_Rule_Status) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 126) | func (UploadIssueStream_Rule_Status) EnumDescriptor() ([]byte, []int) {
  constant UploadIssueStream_Rule_UNKNOWN (line 84) | UploadIssueStream_Rule_UNKNOWN UploadIssueStream_Rule_Status = 0
  constant UploadIssueStream_Rule_SUCCESS (line 85) | UploadIssueStream_Rule_SUCCESS UploadIssueStream_Rule_Status = 1
  constant UploadIssueStream_Rule_FAILED (line 86) | UploadIssueStream_Rule_FAILED  UploadIssueStream_Rule_Status = 2
  type UploadIssueStream (line 130) | type UploadIssueStream struct
    method Reset (line 136) | func (x *UploadIssueStream) Reset() {
    method String (line 145) | func (x *UploadIssueStream) String() string {
    method ProtoMessage (line 149) | func (*UploadIssueStream) ProtoMessage() {}
    method ProtoReflect (line 151) | func (x *UploadIssueStream) ProtoReflect() protoreflect.Message {
    method Descriptor (line 164) | func (*UploadIssueStream) Descriptor() ([]byte, []int) {
  type UploadIssueStream_Response (line 168) | type UploadIssueStream_Response struct
    method Reset (line 174) | func (x *UploadIssueStream_Response) Reset() {
    method String (line 183) | func (x *UploadIssueStream_Response) String() string {
    method ProtoMessage (line 187) | func (*UploadIssueStream_Response) ProtoMessage() {}
    method ProtoReflect (line 189) | func (x *UploadIssueStream_Response) ProtoReflect() protoreflect.Messa...
    method Descriptor (line 202) | func (*UploadIssueStream_Response) Descriptor() ([]byte, []int) {
  type UploadIssueStream_Request (line 206) | type UploadIssueStream_Request struct
    method Reset (line 219) | func (x *UploadIssueStream_Request) Reset() {
    method String (line 228) | func (x *UploadIssueStream_Request) String() string {
    method ProtoMessage (line 232) | func (*UploadIssueStream_Request) ProtoMessage() {}
    method ProtoReflect (line 234) | func (x *UploadIssueStream_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 247) | func (*UploadIssueStream_Request) Descriptor() ([]byte, []int) {
    method GetIndex (line 251) | func (x *UploadIssueStream_Request) GetIndex() int32 {
    method GetRule (line 258) | func (x *UploadIssueStream_Request) GetRule() *UploadIssueStream_Rule {
    method GetProvider (line 265) | func (x *UploadIssueStream_Request) GetProvider() *UploadIssueStream_P...
    method GetModule (line 272) | func (x *UploadIssueStream_Request) GetModule() *UploadIssueStream_Mod...
    method GetContext (line 279) | func (x *UploadIssueStream_Request) GetContext() *UploadIssueStream_Co...
  type UploadIssueStream_Context (line 286) | type UploadIssueStream_Context struct
    method Reset (line 296) | func (x *UploadIssueStream_Context) Reset() {
    method String (line 305) | func (x *UploadIssueStream_Context) String() string {
    method ProtoMessage (line 309) | func (*UploadIssueStream_Context) ProtoMessage() {}
    method ProtoReflect (line 311) | func (x *UploadIssueStream_Context) ProtoReflect() protoreflect.Message {
    method Descriptor (line 324) | func (*UploadIssueStream_Context) Descriptor() ([]byte, []int) {
    method GetSrcTableNames (line 328) | func (x *UploadIssueStream_Context) GetSrcTableNames() []string {
    method GetSchema (line 335) | func (x *UploadIssueStream_Context) GetSchema() string {
  type UploadIssueStream_Module (line 342) | type UploadIssueStream_Module struct
    method Reset (line 352) | func (x *UploadIssueStream_Module) Reset() {
    method String (line 361) | func (x *UploadIssueStream_Module) String() string {
    method ProtoMessage (line 365) | func (*UploadIssueStream_Module) ProtoMessage() {}
    method ProtoReflect (line 367) | func (x *UploadIssueStream_Module) ProtoReflect() protoreflect.Message {
    method Descriptor (line 380) | func (*UploadIssueStream_Module) Descriptor() ([]byte, []int) {
    method GetName (line 384) | func (x *UploadIssueStream_Module) GetName() string {
    method GetSource (line 391) | func (x *UploadIssueStream_Module) GetSource() string {
    method GetDependenciesPath (line 398) | func (x *UploadIssueStream_Module) GetDependenciesPath() []string {
  type UploadIssueStream_Provider (line 405) | type UploadIssueStream_Provider struct
    method Reset (line 415) | func (x *UploadIssueStream_Provider) Reset() {
    method String (line 424) | func (x *UploadIssueStream_Provider) String() string {
    method ProtoMessage (line 428) | func (*UploadIssueStream_Provider) ProtoMessage() {}
    method ProtoReflect (line 430) | func (x *UploadIssueStream_Provider) ProtoReflect() protoreflect.Messa...
    method Descriptor (line 443) | func (*UploadIssueStream_Provider) Descriptor() ([]byte, []int) {
    method GetName (line 447) | func (x *UploadIssueStream_Provider) GetName() string {
    method GetProvider (line 454) | func (x *UploadIssueStream_Provider) GetProvider() string {
    method GetVersion (line 461) | func (x *UploadIssueStream_Provider) GetVersion() string {
  type UploadIssueStream_Rule (line 469) | type UploadIssueStream_Rule struct
    method Reset (line 485) | func (x *UploadIssueStream_Rule) Reset() {
    method String (line 494) | func (x *UploadIssueStream_Rule) String() string {
    method ProtoMessage (line 498) | func (*UploadIssueStream_Rule) ProtoMessage() {}
    method ProtoReflect (line 500) | func (x *UploadIssueStream_Rule) ProtoReflect() protoreflect.Message {
    method Descriptor (line 513) | func (*UploadIssueStream_Rule) Descriptor() ([]byte, []int) {
    method GetName (line 517) | func (x *UploadIssueStream_Rule) GetName() string {
    method GetQuery (line 524) | func (x *UploadIssueStream_Rule) GetQuery() string {
    method GetLabels (line 531) | func (x *UploadIssueStream_Rule) GetLabels() map[string]string {
    method GetMetadata (line 538) | func (x *UploadIssueStream_Rule) GetMetadata() *UploadIssueStream_Meta...
    method GetOutput (line 545) | func (x *UploadIssueStream_Rule) GetOutput() string {
    method GetStatus (line 552) | func (x *UploadIssueStream_Rule) GetStatus() UploadIssueStream_Rule_St...
  type UploadIssueStream_Metadata (line 560) | type UploadIssueStream_Metadata struct
    method Reset (line 575) | func (x *UploadIssueStream_Metadata) Reset() {
    method String (line 584) | func (x *UploadIssueStream_Metadata) String() string {
    method ProtoMessage (line 588) | func (*UploadIssueStream_Metadata) ProtoMessage() {}
    method ProtoReflect (line 590) | func (x *UploadIssueStream_Metadata) ProtoReflect() protoreflect.Messa...
    method Descriptor (line 603) | func (*UploadIssueStream_Metadata) Descriptor() ([]byte, []int) {
    method GetAuthor (line 607) | func (x *UploadIssueStream_Metadata) GetAuthor() string {
    method GetDescription (line 614) | func (x *UploadIssueStream_Metadata) GetDescription() string {
    method GetId (line 621) | func (x *UploadIssueStream_Metadata) GetId() string {
    method GetProvider (line 628) | func (x *UploadIssueStream_Metadata) GetProvider() string {
    method GetRemediation (line 635) | func (x *UploadIssueStream_Metadata) GetRemediation() string {
    method GetSeverity (line 642) | func (x *UploadIssueStream_Metadata) GetSeverity() UploadIssueStream_S...
    method GetTags (line 649) | func (x *UploadIssueStream_Metadata) GetTags() []string {
    method GetTitle (line 656) | func (x *UploadIssueStream_Metadata) GetTitle() string {
  function file_issue_proto_rawDescGZIP (line 765) | func file_issue_proto_rawDescGZIP() []byte {
  function init (line 805) | func init() { file_issue_proto_init() }
  function file_issue_proto_init (line 806) | func file_issue_proto_init() {

FILE: pkg/grpc/pb/issue/issue_grpc.pb.go
  constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
  type IssueClient (line 24) | type IssueClient interface
  type issueClient (line 28) | type issueClient struct
    method UploadIssueStream (line 36) | func (c *issueClient) UploadIssueStream(ctx context.Context, opts ...g...
  function NewIssueClient (line 32) | func NewIssueClient(cc grpc.ClientConnInterface) IssueClient {
  type Issue_UploadIssueStreamClient (line 45) | type Issue_UploadIssueStreamClient interface
  type issueUploadIssueStreamClient (line 51) | type issueUploadIssueStreamClient struct
    method Send (line 55) | func (x *issueUploadIssueStreamClient) Send(m *UploadIssueStream_Reque...
    method CloseAndRecv (line 59) | func (x *issueUploadIssueStreamClient) CloseAndRecv() (*UploadIssueStr...
  type IssueServer (line 73) | type IssueServer interface
  type UnimplementedIssueServer (line 79) | type UnimplementedIssueServer struct
    method UploadIssueStream (line 82) | func (UnimplementedIssueServer) UploadIssueStream(Issue_UploadIssueStr...
    method mustEmbedUnimplementedIssueServer (line 85) | func (UnimplementedIssueServer) mustEmbedUnimplementedIssueServer() {}
  type UnsafeIssueServer (line 90) | type UnsafeIssueServer interface
  function RegisterIssueServer (line 94) | func RegisterIssueServer(s grpc.ServiceRegistrar, srv IssueServer) {
  function _Issue_UploadIssueStream_Handler (line 98) | func _Issue_UploadIssueStream_Handler(srv interface{}, stream grpc.Serve...
  type Issue_UploadIssueStreamServer (line 102) | type Issue_UploadIssueStreamServer interface
  type issueUploadIssueStreamServer (line 108) | type issueUploadIssueStreamServer struct
    method SendAndClose (line 112) | func (x *issueUploadIssueStreamServer) SendAndClose(m *UploadIssueStre...
    method Recv (line 116) | func (x *issueUploadIssueStreamServer) Recv() (*UploadIssueStream_Requ...

FILE: pkg/grpc/pb/log/log.pb.go
  constant _ (line 20) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  constant _ (line 22) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  type StageType (line 25) | type StageType
    method Enum (line 47) | func (x StageType) Enum() *StageType {
    method String (line 53) | func (x StageType) String() string {
    method Descriptor (line 57) | func (StageType) Descriptor() protoreflect.EnumDescriptor {
    method Type (line 61) | func (StageType) Type() protoreflect.EnumType {
    method Number (line 65) | func (x StageType) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 70) | func (StageType) EnumDescriptor() ([]byte, []int) {
  constant StageType_STAGE_TYPE_INITIALIZING (line 28) | StageType_STAGE_TYPE_INITIALIZING            StageType = 0
  constant StageType_STAGE_TYPE_PULL_INFRASTRUCTURE (line 29) | StageType_STAGE_TYPE_PULL_INFRASTRUCTURE     StageType = 1
  constant StageType_STAGE_TYPE_INFRASTRUCTURE_ANALYSIS (line 30) | StageType_STAGE_TYPE_INFRASTRUCTURE_ANALYSIS StageType = 2
  type Status (line 74) | type Status
    method Enum (line 93) | func (x Status) Enum() *Status {
    method String (line 99) | func (x Status) String() string {
    method Descriptor (line 103) | func (Status) Descriptor() protoreflect.EnumDescriptor {
    method Type (line 107) | func (Status) Type() protoreflect.EnumType {
    method Number (line 111) | func (x Status) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 116) | func (Status) EnumDescriptor() ([]byte, []int) {
  constant Status_STATUS_SUCCESS (line 77) | Status_STATUS_SUCCESS Status = 0
  constant Status_STATUS_FAILED (line 78) | Status_STATUS_FAILED  Status = 1
  type Level (line 120) | type Level
    method Enum (line 148) | func (x Level) Enum() *Level {
    method String (line 154) | func (x Level) String() string {
    method Descriptor (line 158) | func (Level) Descriptor() protoreflect.EnumDescriptor {
    method Type (line 162) | func (Level) Type() protoreflect.EnumType {
    method Number (line 166) | func (x Level) Number() protoreflect.EnumNumber {
    method EnumDescriptor (line 171) | func (Level) EnumDescriptor() ([]byte, []int) {
  constant Level_LEVEL_DEBUG (line 123) | Level_LEVEL_DEBUG Level = 0
  constant Level_LEVEL_INFO (line 124) | Level_LEVEL_INFO  Level = 1
  constant Level_LEVEL_WARN (line 125) | Level_LEVEL_WARN  Level = 2
  constant Level_LEVEL_ERROR (line 126) | Level_LEVEL_ERROR Level = 3
  constant Level_LEVEL_FATAL (line 127) | Level_LEVEL_FATAL Level = 4
  type UploadLogStream (line 175) | type UploadLogStream struct
    method Reset (line 181) | func (x *UploadLogStream) Reset() {
    method String (line 190) | func (x *UploadLogStream) String() string {
    method ProtoMessage (line 194) | func (*UploadLogStream) ProtoMessage() {}
    method ProtoReflect (line 196) | func (x *UploadLogStream) ProtoReflect() protoreflect.Message {
    method Descriptor (line 209) | func (*UploadLogStream) Descriptor() ([]byte, []int) {
  type UploadLogStatus (line 213) | type UploadLogStatus struct
    method Reset (line 219) | func (x *UploadLogStatus) Reset() {
    method String (line 228) | func (x *UploadLogStatus) String() string {
    method ProtoMessage (line 232) | func (*UploadLogStatus) ProtoMessage() {}
    method ProtoReflect (line 234) | func (x *UploadLogStatus) ProtoReflect() protoreflect.Message {
    method Descriptor (line 247) | func (*UploadLogStatus) Descriptor() ([]byte, []int) {
  type UploadLogStream_Request (line 251) | type UploadLogStream_Request struct
    method Reset (line 265) | func (x *UploadLogStream_Request) Reset() {
    method String (line 274) | func (x *UploadLogStream_Request) String() string {
    method ProtoMessage (line 278) | func (*UploadLogStream_Request) ProtoMessage() {}
    method ProtoReflect (line 280) | func (x *UploadLogStream_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 293) | func (*UploadLogStream_Request) Descriptor() ([]byte, []int) {
    method GetStage (line 297) | func (x *UploadLogStream_Request) GetStage() StageType {
    method GetIndex (line 304) | func (x *UploadLogStream_Request) GetIndex() uint64 {
    method GetMsg (line 311) | func (x *UploadLogStream_Request) GetMsg() string {
    method GetLevel (line 318) | func (x *UploadLogStream_Request) GetLevel() Level {
    method GetTime (line 325) | func (x *UploadLogStream_Request) GetTime() *timestamppb.Timestamp {
  type UploadLogStream_Response (line 332) | type UploadLogStream_Response struct
    method Reset (line 338) | func (x *UploadLogStream_Response) Reset() {
    method String (line 347) | func (x *UploadLogStream_Response) String() string {
    method ProtoMessage (line 351) | func (*UploadLogStream_Response) ProtoMessage() {}
    method ProtoReflect (line 353) | func (x *UploadLogStream_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 366) | func (*UploadLogStream_Response) Descriptor() ([]byte, []int) {
  type UploadLogStatus_Request (line 370) | type UploadLogStatus_Request struct
    method Reset (line 381) | func (x *UploadLogStatus_Request) Reset() {
    method String (line 390) | func (x *UploadLogStatus_Request) String() string {
    method ProtoMessage (line 394) | func (*UploadLogStatus_Request) ProtoMessage() {}
    method ProtoReflect (line 396) | func (x *UploadLogStatus_Request) ProtoReflect() protoreflect.Message {
    method Descriptor (line 409) | func (*UploadLogStatus_Request) Descriptor() ([]byte, []int) {
    method GetStage (line 413) | func (x *UploadLogStatus_Request) GetStage() StageType {
    method GetStatus (line 420) | func (x *UploadLogStatus_Request) GetStatus() Status {
    method GetTime (line 427) | func (x *UploadLogStatus_Request) GetTime() *timestamppb.Timestamp {
  type UploadLogStatus_Response (line 434) | type UploadLogStatus_Response struct
    method Reset (line 442) | func (x *UploadLogStatus_Response) Reset() {
    method String (line 451) | func (x *UploadLogStatus_Response) String() string {
    method ProtoMessage (line 455) | func (*UploadLogStatus_Response) ProtoMessage() {}
    method ProtoReflect (line 457) | func (x *UploadLogStatus_Response) ProtoReflect() protoreflect.Message {
    method Descriptor (line 470) | func (*UploadLogStatus_Response) Descriptor() ([]byte, []int) {
    method GetDiagnosis (line 474) | func (x *UploadLogStatus_Response) GetDiagnosis() *common.Diagnosis {
  function file_log_log_proto_rawDescGZIP (line 551) | func file_log_log_proto_rawDescGZIP() []byte {
  function init (line 592) | func init() { file_log_log_proto_init() }
  function file_log_log_proto_init (line 593) | func file_log_log_proto_init() {

FILE: pkg/grpc/pb/log/log_grpc.pb.go
  constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
  type LogClient (line 24) | type LogClient interface
  type logClient (line 29) | type logClient struct
    method UploadLogStream (line 37) | func (c *logClient) UploadLogStream(ctx context.Context, opts ...grpc....
    method UploadLogStatus (line 71) | func (c *logClient) UploadLogStatus(ctx context.Context, in *UploadLog...
  function NewLogClient (line 33) | func NewLogClient(cc grpc.ClientConnInterface) LogClient {
  type Log_UploadLogStreamClient (line 46) | type Log_UploadLogStreamClient interface
  type logUploadLogStreamClient (line 52) | type logUploadLogStreamClient struct
    method Send (line 56) | func (x *logUploadLogStreamClient) Send(m *UploadLogStream_Request) er...
    method CloseAndRecv (line 60) | func (x *logUploadLogStreamClient) CloseAndRecv() (*UploadLogStream_Re...
  type LogServer (line 83) | type LogServer interface
  type UnimplementedLogServer (line 90) | type UnimplementedLogServer struct
    method UploadLogStream (line 93) | func (UnimplementedLogServer) UploadLogStream(Log_UploadLogStreamServe...
    method UploadLogStatus (line 96) | func (UnimplementedLogServer) UploadLogStatus(context.Context, *Upload...
    method mustEmbedUnimplementedLogServer (line 99) | func (UnimplementedLogServer) mustEmbedUnimplementedLogServer() {}
  type UnsafeLogServer (line 104) | type UnsafeLogServer interface
  function RegisterLogServer (line 108) | func RegisterLogServer(s grpc.ServiceRegistrar, srv LogServer) {
  function _Log_UploadLogStream_Handler (line 112) | func _Log_UploadLogStream_Handler(srv interface{}, stream grpc.ServerStr...
  type Log_UploadLogStreamServer (line 116) | type Log_UploadLogStreamServer interface
  type logUploadLogStreamServer (line 122) | type logUploadLogStreamServer struct
    method SendAndClose (line 126) | func (x *logUploadLogStreamServer) SendAndClose(m *UploadLogStream_Res...
    method Recv (line 130) | func (x *logUploadLogStreamServer) Recv() (*UploadLogStream_Request, e...
  function _Log_UploadLogStatus_Handler (line 138) | func _Log_UploadLogStatus_Handler(srv interface{}, ctx context.Context, ...

FILE: pkg/grpc/pb/log/transport.go
  function TransportWsMsg (line 12) | func TransportWsMsg(rec *UploadLogStream_Request) (ret []byte, err error) {

FILE: pkg/grpc/pb/log/transport_test.go
  function TestTransportWsMsg (line 9) | func TestTransportWsMsg(t *testing.T) {

FILE: pkg/grpc/stream_uploader.go
  type StreamClient (line 16) | type StreamClient interface
  type StreamUploaderOptions (line 24) | type StreamUploaderOptions struct
  type StreamUploader (line 41) | type StreamUploader struct
  function NewStreamUploader (line 53) | func NewStreamUploader[Client, ID, Request, Response any](options *Strea...
  method GetOptions (line 61) | func (x *StreamUploader[Client, ID, Request, Response]) GetOptions() *St...
  method Submit (line 66) | func (x *StreamUploader[Client, ID, Request, Response]) Submit(ctx conte...
  method ShutdownAndWait (line 90) | func (x *StreamUploader[Client, ID, Request, Response]) ShutdownAndWait(...
  method RunUploaderWorker (line 171) | func (x *StreamUploader[Client, ID, Request, Response]) RunUploaderWorke...
  type UploadTask (line 225) | type UploadTask struct

FILE: pkg/grpc/stream_uploader_test.go
  type testGRpcClient (line 15) | type testGRpcClient struct
    method Send (line 20) | func (t testGRpcClient) Send(request *testGRpcRequest) error {
    method CloseAndRecv (line 25) | func (t testGRpcClient) CloseAndRecv() (*testGRpcResponse, error) {
    method Header (line 30) | func (t testGRpcClient) Header() (metadata.MD, error) {
    method Trailer (line 34) | func (t testGRpcClient) Trailer() metadata.MD {
    method CloseSend (line 38) | func (t testGRpcClient) CloseSend() error {
    method Context (line 42) | func (t testGRpcClient) Context() context.Context {
    method SendMsg (line 46) | func (t testGRpcClient) SendMsg(m interface{}) error {
    method RecvMsg (line 50) | func (t testGRpcClient) RecvMsg(m interface{}) error {
  type testGRpcRequest (line 54) | type testGRpcRequest struct
  type testGRpcResponse (line 58) | type testGRpcResponse struct
  function TestNewStreamUploader (line 62) | func TestNewStreamUploader(t *testing.T) {

FILE: pkg/http_client/getter.go
  type Detector (line 12) | type Detector struct
  function DownloadToDirectory (line 69) | func DownloadToDirectory(ctx context.Context, saveDirectory, targetUrl s...

FILE: pkg/http_client/github_repo_downloader.go
  type GitHubRepoDownloaderOptions (line 17) | type GitHubRepoDownloaderOptions struct
  type GitHubRepoDownloader (line 38) | type GitHubRepoDownloader struct
    method Download (line 45) | func (x *GitHubRepoDownloader) Download(ctx context.Context, options *...
    method checkCache (line 69) | func (x *GitHubRepoDownloader) checkCache(downloadDirectory string, ca...
    method ReadCacheMeta (line 87) | func (x *GitHubRepoDownloader) ReadCacheMeta(downloadDirectory string)...
    method Save (line 101) | func (x *GitHubRepoDownloader) Save(downloadDirectory string, meta *Gi...
    method BuildCacheMetaFilePath (line 113) | func (x *GitHubRepoDownloader) BuildCacheMetaFilePath(downloadDirector...
  function NewGitHubRepoDownloader (line 41) | func NewGitHubRepoDownloader() *GitHubRepoDownloader {
  type GitHubRepoCacheMeta (line 81) | type GitHubRepoCacheMeta struct

FILE: pkg/http_client/requests.go
  constant DefaultMaxTryTimes (line 16) | DefaultMaxTryTimes = 3
  function GetYaml (line 20) | func GetYaml[Response any](ctx context.Context, targetUrl string, option...
  function GetJson (line 33) | func GetJson[Response any](ctx context.Context, targetUrl string, option...
  function PostJson (line 49) | func PostJson[Request any, Response any](ctx context.Context, targetUrl ...
  function GetBytes (line 74) | func GetBytes(ctx context.Context, targetUrl string, options ...*Options...
  function GetString (line 88) | func GetString(ctx context.Context, targetUrl string, options ...*Option...
  type ResponseHandler (line 99) | type ResponseHandler
  function BytesResponseHandler (line 102) | func BytesResponseHandler(readResponseOnStatusCodeIn ...int) ResponseHan...
  function StringResponseHandler (line 123) | func StringResponseHandler(readResponseOnStatusCodeIn ...int) ResponseHa...
  function YamlResponseHandler (line 133) | func YamlResponseHandler[Response any](readResponseOnStatusCodeIn ...int...
  function JsonResponseHandler (line 151) | func JsonResponseHandler[Response any](readResponseOnStatusCodeIn ...int...
  type RequestSetting (line 171) | type RequestSetting
  constant DefaultUserAgent (line 173) | DefaultUserAgent = "selefra-cli"
  function DefaultUserAgentRequestSetting (line 175) | func DefaultUserAgentRequestSetting() RequestSetting {
  function MyUserAgent (line 182) | func MyUserAgent() string {
  constant DefaultMethod (line 188) | DefaultMethod = http.MethodGet
  type Options (line 190) | type Options struct
  function NewOptions (line 200) | func NewOptions[Request any, Response any](targetUrl string, responseHan...
  method WithMaxTryTimes (line 211) | func (x *Options[Request, Response]) WithMaxTryTimes(maxTryTimes int) *O...
  method WithTargetURL (line 216) | func (x *Options[Request, Response]) WithTargetURL(targetURL string) *Op...
  method WithMethod (line 221) | func (x *Options[Request, Response]) WithMethod(method string) *Options[...
  method WithBody (line 226) | func (x *Options[Request, Response]) WithBody(body []byte) *Options[Requ...
  method WithRequestSettingSlice (line 234) | func (x *Options[Request, Response]) WithRequestSettingSlice(requestSett...
  method AppendRequestSetting (line 239) | func (x *Options[Request, Response]) AppendRequestSetting(requestSetting...
  method WithResponseHandler (line 244) | func (x *Options[Request, Response]) WithResponseHandler(responseHandler...
  method WithYamlResponseHandler (line 249) | func (x *Options[Request, Response]) WithYamlResponseHandler() *Options[...
  method WithJsonResponseHandler (line 254) | func (x *Options[Request, Response]) WithJsonResponseHandler() *Options[...
  method WithMessageChannel (line 259) | func (x *Options[Request, Response]) WithMessageChannel(messageChannel c...
  method SendMessage (line 264) | func (x *Options[Request, Response]) SendMessage(message *schema.Diagnos...
  function SendRequest (line 274) | func SendRequest[Request any, Response any](ctx context.Context, options...

FILE: pkg/logger/config.go
  type Config (line 12) | type Config struct
    method EncodeLevel (line 29) | func (c *Config) EncodeLevel() zapcore.LevelEncoder {
    method TranslationLevel (line 44) | func (c *Config) TranslationLevel() zapcore.Level {
    method GetEncoder (line 65) | func (c *Config) GetEncoder() zapcore.Encoder {
    method GetEncoderConfig (line 72) | func (c *Config) GetEncoderConfig() zapcore.EncoderConfig {
    method GetLogWriter (line 90) | func (c *Config) GetLogWriter(level string) zapcore.WriteSyncer {
    method GetEncoderCore (line 103) | func (c *Config) GetEncoderCore() []zapcore.Core {
    method GetLevelPriority (line 111) | func (c *Config) GetLevelPriority(level zapcore.Level) zap.LevelEnable...

FILE: pkg/logger/hc.go
  method Log (line 15) | func (l *Logger) Log(level hclog.Level, msg string, args ...interface{}) {
  method Trace (line 32) | func (l *Logger) Trace(msg string, args ...interface{}) {
  method Debug (line 36) | func (l *Logger) Debug(msg string, args ...interface{}) {
  method Info (line 40) | func (l *Logger) Info(msg string, args ...interface{}) {
  method Warn (line 44) | func (l *Logger) Warn(msg string, args ...interface{}) {
  method Error (line 48) | func (l *Logger) Error(msg string, args ...interface{}) {
  method Fatal (line 52) | func (l *Logger) Fatal(msg string, args ...interface{}) {
  method IsTrace (line 56) | func (l *Logger) IsTrace() bool {
  method IsDebug (line 60) | func (l *Logger) IsDebug() bool {
  method IsInfo (line 64) | func (l *Logger) IsInfo() bool {
  method IsWarn (line 68) | func (l *Logger) IsWarn() bool {
  method IsError (line 72) | func (l *Logger) IsError() bool {
  method ImpliedArgs (line 76) | func (l *Logger) ImpliedArgs() []interface{} {
  method With (line 80) | func (l *Logger) With(args ...interface{}) hclog.Logger {
  method Name (line 84) | func (l *Logger) Name() string {
  method Named (line 88) | func (l *Logger) Named(name string) hclog.Logger {
  method ResetNamed (line 92) | func (l *Logger) ResetNamed(name string) hclog.Logger {
  method SetLevel (line 96) | func (l *Logger) SetLevel(level hclog.Level) {
  method StandardLogger (line 100) | func (l *Logger) StandardLogger(opts *hclog.StandardLoggerOptions) *log....
  method StandardWriter (line 104) | func (l *Logger) StandardWriter(opts *hclog.StandardLoggerOptions) io.Wr...

FILE: pkg/logger/logger.go
  type Logger (line 11) | type Logger struct
  function Default (line 15) | func Default() *Logger {
  function DebugF (line 19) | func DebugF(msg string, args ...any) {
  function InfoF (line 23) | func InfoF(msg string, args ...any) {
  function ErrorF (line 27) | func ErrorF(msg string, args ...any) {
  function FatalF (line 31) | func FatalF(msg string, args ...any) {
  function NewLogger (line 46) | func NewLogger(c Config) (*Logger, error) {

FILE: pkg/logger/schema.go
  type SelefraSDKClientLogger (line 10) | type SelefraSDKClientLogger struct
    method Debug (line 26) | func (s *SelefraSDKClientLogger) Debug(msg string, fields ...zap.Field) {
    method DebugF (line 30) | func (s *SelefraSDKClientLogger) DebugF(msg string, args ...any) {
    method Info (line 34) | func (s *SelefraSDKClientLogger) Info(msg string, fields ...zap.Field) {
    method InfoF (line 38) | func (s *SelefraSDKClientLogger) InfoF(msg string, args ...any) {
    method Warn (line 42) | func (s *SelefraSDKClientLogger) Warn(msg string, fields ...zap.Field) {
    method WarnF (line 46) | func (s *SelefraSDKClientLogger) WarnF(msg string, args ...any) {
    method Error (line 50) | func (s *SelefraSDKClientLogger) Error(msg string, fields ...zap.Field) {
    method ErrorF (line 54) | func (s *SelefraSDKClientLogger) ErrorF(msg string, args ...any) {
    method Fatal (line 58) | func (s *SelefraSDKClientLogger) Fatal(msg string, fields ...zap.Field) {
    method FatalF (line 62) | func (s *SelefraSDKClientLogger) FatalF(msg string, args ...any) {
    method LogDiagnostics (line 66) | func (s *SelefraSDKClientLogger) LogDiagnostics(prefix string, d *sche...
  function NewSchemaLogger (line 17) | func NewSchemaLogger(wrappedLog ...*Logger) *SelefraSDKClientLogger {

FILE: pkg/message/message.go
  type Channel (line 9) | type Channel struct
  function NewChannel (line 25) | func NewChannel[Message any](consumerFunc func(index int, message Messag...
  method Send (line 64) | func (x *Channel[Message]) Send(message Message) {
  method MakeChildChannel (line 70) | func (x *Channel[Message]) MakeChildChannel() *Channel[Message] {
  method ReceiverWait (line 88) | func (x *Channel[Message]) ReceiverWait() {
  method SenderWaitAndClose (line 92) | func (x *Channel[Message]) SenderWaitAndClose() {

FILE: pkg/message/message_test.go
  function TestNewChannel (line 9) | func TestNewChannel(t *testing.T) {

FILE: pkg/modules/executors/executor.go
  type Executor (line 9) | type Executor interface

FILE: pkg/modules/executors/module_query_executor.go
  type RuleQueryResult (line 31) | type RuleQueryResult struct
  type ModuleQueryExecutorOptions (line 63) | type ModuleQueryExecutorOptions struct
  constant ModuleQueryExecutorName (line 92) | ModuleQueryExecutorName = "module-query-executor"
  type ModuleQueryExecutor (line 94) | type ModuleQueryExecutor struct
    method Name (line 111) | func (x *ModuleQueryExecutor) Name() string {
    method Execute (line 131) | func (x *ModuleQueryExecutor) Execute(ctx context.Context) *schema.Dia...
    method RunQueryWorker (line 150) | func (x *ModuleQueryExecutor) RunQueryWorker(ctx context.Context, chan...
    method toRulePlanChannel (line 159) | func (x *ModuleQueryExecutor) toRulePlanChannel(rulePlanSlice []*plann...
    method makeRulePlanSlice (line 187) | func (x *ModuleQueryExecutor) makeRulePlanSlice(ctx context.Context, m...
  function NewModuleQueryExecutor (line 103) | func NewModuleQueryExecutor(options *ModuleQueryExecutorOptions) *Module...
  type ModuleQueryExecutorWorker (line 206) | type ModuleQueryExecutorWorker struct
    method Run (line 221) | func (x *ModuleQueryExecutorWorker) Run(ctx context.Context) {
    method sendMessage (line 276) | func (x *ModuleQueryExecutorWorker) sendMessage(diagnostics *schema.Di...
    method execRulePlan (line 282) | func (x *ModuleQueryExecutorWorker) execRulePlan(ctx context.Context, ...
    method FmtOutputStr (line 354) | func (x *ModuleQueryExecutorWorker) FmtOutputStr(rule *module.RuleBloc...
    method execStorageQuery (line 387) | func (x *ModuleQueryExecutorWorker) execStorageQuery(ctx context.Conte...
    method processRuleRow (line 548) | func (x *ModuleQueryExecutorWorker) processRuleRow(ctx context.Context...
    method renderRule (line 581) | func (x *ModuleQueryExecutorWorker) renderRule(ctx context.Context, ru...
    method renderRuleMetadata (line 635) | func (x *ModuleQueryExecutorWorker) renderRuleMetadata(ctx context.Con...
    method filterTables (line 818) | func (x *ModuleQueryExecutorWorker) filterTables(ctx context.Context, ...
    method filterColumns (line 830) | func (x *ModuleQueryExecutorWorker) filterColumns(ctx context.Context,...
    method getRows (line 898) | func (x *ModuleQueryExecutorWorker) getRows(ctx context.Context, colum...
    method getIssue (line 924) | func (x *ModuleQueryExecutorWorker) getIssue(ctx context.Context, rows...
  function NewModuleQueryExecutorWorker (line 213) | func NewModuleQueryExecutorWorker(moduleQueryExecutor *ModuleQueryExecut...
  function isSql (line 346) | func isSql(query string) bool {
  function fmtTemplate (line 801) | func fmtTemplate(temp string, params map[string]interface{}) (string, er...
  function extractKey (line 1003) | func extractKey(str string) string {

FILE: pkg/modules/executors/module_query_executor_test.go
  function TestModuleQueryExecutor_Execute (line 12) | func TestModuleQueryExecutor_Execute(t *testing.T) {

FILE: pkg/modules/executors/project_cloud_life_cycle_executor.go
  type ProjectCloudLifeCycleExecutorOptions (line 26) | type ProjectCloudLifeCycleExecutorOptions struct
  type ProjectCloudLifeCycleExecutor (line 46) | type ProjectCloudLifeCycleExecutor struct
    method getServerHost (line 75) | func (x *ProjectCloudLifeCycleExecutor) getServerHost() string {
    method InitCloudClient (line 83) | func (x *ProjectCloudLifeCycleExecutor) InitCloudClient(ctx context.Co...
    method loginByCredentials (line 109) | func (x *ProjectCloudLifeCycleExecutor) loginByCredentials(ctx context...
    method initIssueUploader (line 184) | func (x *ProjectCloudLifeCycleExecutor) initIssueUploader(client *clou...
    method initLogUploader (line 198) | func (x *ProjectCloudLifeCycleExecutor) initLogUploader(client *cloud_...
    method UploadIssue (line 214) | func (x *ProjectCloudLifeCycleExecutor) UploadIssue(ctx context.Contex...
    method convertRuleQueryResultToIssueUploadRequest (line 253) | func (x *ProjectCloudLifeCycleExecutor) convertRuleQueryResultToIssueU...
    method ruleSeverity (line 322) | func (x *ProjectCloudLifeCycleExecutor) ruleSeverity(severity string) ...
    method UploadLog (line 344) | func (x *ProjectCloudLifeCycleExecutor) UploadLog(ctx context.Context,...
    method toGrpcLevel (line 377) | func (x *ProjectCloudLifeCycleExecutor) toGrpcLevel(level schema.Diagn...
    method ShutdownAndWait (line 399) | func (x *ProjectCloudLifeCycleExecutor) ShutdownAndWait(ctx context.Co...
    method ChangeLogStage (line 432) | func (x *ProjectCloudLifeCycleExecutor) ChangeLogStage(stage log.Stage...
    method ReportTaskStatus (line 438) | func (x *ProjectCloudLifeCycleExecutor) ReportTaskStatus(stage log.Sta...
    method Filter (line 461) | func (x *ProjectCloudLifeCycleExecutor) Filter(s string) string {
  function NewProjectCloudLifeCycleExecutor (line 69) | func NewProjectCloudLifeCycleExecutor(options *ProjectCloudLifeCycleExec...

FILE: pkg/modules/executors/project_local_life_cycle_executor.go
  type ProjectLifeCycleStep (line 25) | type ProjectLifeCycleStep
  constant ProjectLifeCycleStepQuery (line 31) | ProjectLifeCycleStepQuery ProjectLifeCycleStep = iota
  constant ProjectLifeCycleStepFetch (line 34) | ProjectLifeCycleStepFetch
  constant ProjectLifeCycleStepInstall (line 37) | ProjectLifeCycleStepInstall
  constant ProjectLifeCycleStepModuleCheck (line 40) | ProjectLifeCycleStepModuleCheck
  constant ProjectLifeCycleStepCloudInit (line 43) | ProjectLifeCycleStepCloudInit
  constant ProjectLifeCycleStepLoadModule (line 46) | ProjectLifeCycleStepLoadModule
  type ProjectLocalLifeCycleExecutorOptions (line 52) | type ProjectLocalLifeCycleExecutorOptions struct
  constant ProjectLifeCycleExecutorName (line 87) | ProjectLifeCycleExecutorName = "project-local-life-cycle-executor"
  type ProjectLocalLifeCycleExecutor (line 90) | type ProjectLocalLifeCycleExecutor struct
    method Name (line 112) | func (x *ProjectLocalLifeCycleExecutor) Name() string {
    method Execute (line 117) | func (x *ProjectLocalLifeCycleExecutor) Execute(ctx context.Context) *...
    method fixDsn (line 234) | func (x *ProjectLocalLifeCycleExecutor) fixDsn(ctx context.Context) bo...
    method loadModule (line 281) | func (x *ProjectLocalLifeCycleExecutor) loadModule(ctx context.Context...
    method install (line 316) | func (x *ProjectLocalLifeCycleExecutor) install(ctx context.Context) (...
    method fetch (line 356) | func (x *ProjectLocalLifeCycleExecutor) fetch(ctx context.Context, pro...
    method query (line 395) | func (x *ProjectLocalLifeCycleExecutor) query(ctx context.Context, fet...
    method initCloudClient (line 431) | func (x *ProjectLocalLifeCycleExecutor) initCloudClient(ctx context.Co...
  function NewProjectLocalLifeCycleExecutor (line 105) | func NewProjectLocalLifeCycleExecutor(options *ProjectLocalLifeCycleExec...

FILE: pkg/modules/executors/provider_fetch_executor.go
  type FetchStep (line 33) | type FetchStep
  constant FetchStepFetch (line 39) | FetchStepFetch FetchStep = iota
  constant FetchStepCreateAllTable (line 42) | FetchStepCreateAllTable FetchStep = iota
  constant FetchStepDropAllTable (line 45) | FetchStepDropAllTable FetchStep = iota
  constant FetchStepGetInformation (line 48) | FetchStepGetInformation FetchStep = iota
  constant FetchStepGetInit (line 51) | FetchStepGetInit FetchStep = iota
  constant FetchStepGetStart (line 54) | FetchStepGetStart FetchStep = iota
  type ProviderFetchExecutorOptions (line 60) | type ProviderFetchExecutorOptions struct
  constant FetchExecutorName (line 86) | FetchExecutorName = "provider-fetch-executor"
  type ProviderFetchExecutor (line 89) | type ProviderFetchExecutor struct
    method GetProviderInformationMap (line 104) | func (x *ProviderFetchExecutor) GetProviderInformationMap() map[string...
    method GetTableToProviderMap (line 108) | func (x *ProviderFetchExecutor) GetTableToProviderMap() map[string]str...
    method Name (line 127) | func (x *ProviderFetchExecutor) Name() string {
    method Execute (line 131) | func (x *ProviderFetchExecutor) Execute(ctx context.Context) *schema.D...
  function NewProviderFetchExecutor (line 98) | func NewProviderFetchExecutor(options *ProviderFetchExecutorOptions) *Pr...
  function flatTableToProviderMap (line 119) | func flatTableToProviderMap(providerName string, table *schema.Table, m ...
  type ProviderFetchExecutorWorker (line 174) | type ProviderFetchExecutorWorker struct
    method Run (line 198) | func (x *ProviderFetchExecutorWorker) Run() {
    method executePlan (line 213) | func (x *ProviderFetchExecutorWorker) executePlan(ctx context.Context,...
    method addProviderNameForMessage (line 505) | func (x *ProviderFetchExecutorWorker) addProviderNameForMessage(plan *...
    method sendMessage (line 516) | func (x *ProviderFetchExecutorWorker) sendMessage(message *schema.Diag...
    method tryHitCache (line 523) | func (x *ProviderFetchExecutorWorker) tryHitCache(ctx context.Context,...
    method isEnableFetchCache (line 550) | func (x *ProviderFetchExecutorWorker) isEnableFetchCache(ctx context.C...
    method computeAllNeedPullTableCanHitCache (line 558) | func (x *ProviderFetchExecutorWorker) computeAllNeedPullTableCanHitCac...
    method makeToRootTableMap (line 608) | func (x *ProviderFetchExecutorWorker) makeToRootTableMap(providerInfor...
    method flatTable (line 618) | func (x *ProviderFetchExecutorWorker) flatTable(table *schema.Table) [...
    method refreshPullTableTime (line 629) | func (x *ProviderFetchExecutorWorker) refreshPullTableTime(ctx context...
  function NewProviderFetchExecutorWorker (line 189) | func NewProviderFetchExecutorWorker(executor *ProviderFetchExecutor, pla...

FILE: pkg/modules/executors/provider_fetch_executor_test.go
  function TestProviderFetchExecutor_Execute (line 13) | func TestProviderFetchExecutor_Execute(t *testing.T) {
  function TestProviderFetchExecutorWorker_computeNeedFetchTables (line 41) | func TestProviderFetchExecutorWorker_computeNeedFetchTables(t *testing.T) {

FILE: pkg/modules/executors/provider_install_executor.go
  type ProviderInstallExecutorOptions (line 16) | type ProviderInstallExecutorOptions struct
  constant ProviderInstallExecutorName (line 33) | ProviderInstallExecutorName = "provider-install-executor"
  type ProviderInstallExecutor (line 35) | type ProviderInstallExecutor struct
    method GetLocalProviderManager (line 58) | func (x *ProviderInstallExecutor) GetLocalProviderManager() *local_pro...
    method Name (line 62) | func (x *ProviderInstallExecutor) Name() string {
    method Execute (line 66) | func (x *ProviderInstallExecutor) Execute(ctx context.Context) *schema...
    method executePlan (line 84) | func (x *ProviderInstallExecutor) executePlan(ctx context.Context, pla...
  function NewProviderInstallExecutor (line 43) | func NewProviderInstallExecutor(options *ProviderInstallExecutorOptions)...

FILE: pkg/modules/executors/provider_install_executor_test.go
  function TestProviderInstallExecutor_Execute (line 14) | func TestProviderInstallExecutor_Execute(t *testing.T) {

FILE: pkg/modules/local_modules_manager/manager.go
  type LocalModuleManager (line 4) | type LocalModuleManager struct
  function NewLocalModuleManager (line 10) | func NewLocalModuleManager() *LocalModuleManager {

FILE: pkg/modules/local_modules_manager/manager_get.go
  method Get (line 5) | func (x *LocalModuleManager) Get(module *registry.Module) {

FILE: pkg/modules/local_modules_manager/manager_list.go
  method List (line 3) | func (x *LocalModuleManager) List() {

FILE: pkg/modules/local_modules_manager/manager_search.go
  method Search (line 3) | func (x *LocalModuleManager) Search() {

FILE: pkg/modules/local_modules_manager/manager_tidy.go
  method Tidy (line 3) | func (x *LocalModuleManager) Tidy() {

FILE: pkg/modules/local_modules_manager/manager_update.go
  method Update (line 3) | func (x *LocalModuleManager) Update() {

FILE: pkg/modules/module/block.go
  type Block (line 10) | type Block interface
  type Validator (line 27) | type Validator interface
  type MergableBlock (line 36) | type MergableBlock interface
  type HaveRuntime (line 45) | type HaveRuntime interface

FILE: pkg/modules/module/errors.go
  constant DocSiteUrl (line 15) | DocSiteUrl = "http://selefra.io/docs"
  function RenderErrorTemplate (line 33) | func RenderErrorTemplate(errorType string, location *NodeLocation) string {
  function withUnderline (line 92) | func withUnderline(line string, begin, end int) string {

FILE: pkg/modules/module/locatable.go
  type Locatable (line 14) | type Locatable interface
  type NodeLocation (line 24) | type NodeLocation struct
    method ReadSourceString (line 58) | func (x *NodeLocation) ReadSourceString() string {
  function BuildLocationFromYamlNode (line 36) | func BuildLocationFromYamlNode(yamlFilePath string, yamlSelector string,...
  function rightLeafNode (line 50) | func rightLeafNode(node *yaml.Node) *yaml.Node {
  type Position (line 93) | type Position struct
  function NewPosition (line 102) | func NewPosition(line, column int) *Position {
  type LocatableImpl (line 111) | type LocatableImpl struct
    method GetNodeLocation (line 129) | func (x *LocatableImpl) GetNodeLocation(relativeSelector string) *Node...
    method SetNodeLocation (line 190) | func (x *LocatableImpl) SetNodeLocation(relativeSelector string, nodeL...
  function NewLocatableImpl (line 117) | func NewLocatableImpl() *LocatableImpl {
  constant NodeLocationSelfKey (line 125) | NodeLocationSelfKey   = "._key"
  constant NodeLocationSelfValue (line 126) | NodeLocationSelfValue = "._value"
  function MergeKeyValueLocation (line 150) | func MergeKeyValueLocation(keyLocation, valueLocation *NodeLocation) *No...
  function baseYamlSelector (line 167) | func baseYamlSelector(yamlSelector string) string {

FILE: pkg/modules/module/locatable_test.go
  function Test_baseYamlSelector (line 8) | func Test_baseYamlSelector(t *testing.T) {

FILE: pkg/modules/module/module.go
  type Module (line 14) | type Module struct
    method BuildFullName (line 47) | func (x *Module) BuildFullName() string {
    method HasRequiredProviderName (line 58) | func (x *Module) HasRequiredProviderName(requiredProviderName string) ...
    method ListRequiredProvidersName (line 68) | func (x *Module) ListRequiredProvidersName() []string {
    method Merge (line 79) | func (x *Module) Merge(other *Module) (*Module, *schema.Diagnostics) {
    method Check (line 132) | func (x *Module) Check(module *Module, validatorContext *ValidatorCont...
    method Traversal (line 176) | func (x *Module) Traversal(ctx context.Context, traversalFunc func(ctx...
    method internalTraversal (line 180) | func (x *Module) internalTraversal(ctx context.Context, traversalConte...
  function NewModule (line 40) | func NewModule() *Module {
  function MergeBlockWithDiagnostics (line 100) | func MergeBlockWithDiagnostics[T Block](blockA, blockB T, diagnostics *s...
  type TraversalContext (line 169) | type TraversalContext struct

FILE: pkg/modules/module/modules_block.go
  type ModulesBlock (line 10) | type ModulesBlock
    method Merge (line 15) | func (x ModulesBlock) Merge(other ModulesBlock) (ModulesBlock, *schema...
    method Check (line 49) | func (x ModulesBlock) Check(module *Module, validatorContext *Validato...
    method IsEmpty (line 57) | func (x ModulesBlock) IsEmpty() bool {
    method GetNodeLocation (line 61) | func (x ModulesBlock) GetNodeLocation(selector string) *NodeLocation {
    method SetNodeLocation (line 65) | func (x ModulesBlock) SetNodeLocation(selector string, nodeLocation *N...
    method ModulesInputMap (line 69) | func (x ModulesBlock) ModulesInputMap() map[string]*ModuleBlock {
  type Filter (line 79) | type Filter struct
  type ModuleBlock (line 86) | type ModuleBlock struct
    method Check (line 111) | func (x *ModuleBlock) Check(module *Module, validatorContext *Validato...
    method checkInput (line 134) | func (x *ModuleBlock) checkInput(module *Module, validatorContext *Val...
    method IsEmpty (line 139) | func (x *ModuleBlock) IsEmpty() bool {
  function NewModuleBlock (line 105) | func NewModuleBlock() *ModuleBlock {

FILE: pkg/modules/module/providers_block.go
  type ProvidersBlock (line 14) | type ProvidersBlock
    method ToProviderNameMap (line 19) | func (x ProvidersBlock) ToProviderNameMap() map[string]*ProviderBlock {
    method Merge (line 27) | func (x ProvidersBlock) Merge(other ProvidersBlock) (ProvidersBlock, *...
    method Check (line 59) | func (x ProvidersBlock) Check(module *Module, validatorContext *Valida...
    method IsEmpty (line 76) | func (x ProvidersBlock) IsEmpty() bool {
    method GetNodeLocation (line 80) | func (x ProvidersBlock) GetNodeLocation(selector string) *NodeLocation {
    method SetNodeLocation (line 85) | func (x ProvidersBlock) SetNodeLocation(selector string, nodeLocation ...
  type ProviderBlock (line 93) | type ProviderBlock struct
    method MarshalYAML (line 125) | func (x *ProviderBlock) MarshalYAML() (interface{}, error) {
    method Check (line 200) | func (x *ProviderBlock) Check(module *Module, validatorContext *Valida...
    method IsEmpty (line 252) | func (x *ProviderBlock) IsEmpty() bool {
  function NewProviderBlock (line 119) | func NewProviderBlock() *ProviderBlock {
  function GetDefaultProviderConfigYamlConfiguration (line 189) | func GetDefaultProviderConfigYamlConfiguration(providerName, providerVer...

FILE: pkg/modules/module/providers_block_test.go
  function TestProviderBlock_MarshalYAML (line 9) | func TestProviderBlock_MarshalYAML(t *testing.T) {

FILE: pkg/modules/module/rules_block.go
  type RulesBlock (line 11) | type RulesBlock
    method Merge (line 16) | func (x RulesBlock) Merge(other RulesBlock) (RulesBlock, *schema.Diagn...
    method Check (line 50) | func (x RulesBlock) Check(module *Module, validatorContext *ValidatorC...
    method IsEmpty (line 61) | func (x RulesBlock) IsEmpty() bool {
    method GetNodeLocation (line 65) | func (x RulesBlock) GetNodeLocation(selector string) *NodeLocation {
    method SetNodeLocation (line 69) | func (x RulesBlock) SetNodeLocation(selector string, nodeLocation *Nod...
  type GptResponseBlock (line 75) | type GptResponseBlock struct
  type RuleBlock (line 85) | type RuleBlock struct
    method Check (line 116) | func (x *RuleBlock) Check(module *Module, validatorContext *ValidatorC...
    method IsEmpty (line 153) | func (x *RuleBlock) IsEmpty() bool {
    method Copy (line 161) | func (x *RuleBlock) Copy() *RuleBlock {
  function NewRuleBlock (line 110) | func NewRuleBlock() *RuleBlock {
  type RuleMetadataBlock (line 179) | type RuleMetadataBlock struct
    method Check (line 222) | func (x *RuleMetadataBlock) Check(module *Module, validatorContext *Va...
    method IsEmpty (line 255) | func (x *RuleMetadataBlock) IsEmpty() bool {
    method Copy (line 266) | func (x *RuleMetadataBlock) Copy(runtime *RuleMetadataBlockRuntime) *R...
  function NewRuleMetadataBlock (line 214) | func NewRuleMetadataBlock(rule *RuleBlock) *RuleMetadataBlock {
  type RuleMetadataBlockRuntime (line 283) | type RuleMetadataBlockRuntime struct
  function NewRuleMetadataBlockRuntime (line 287) | func NewRuleMetadataBlockRuntime(rule *RuleBlock) *RuleMetadataBlockRunt...

FILE: pkg/modules/module/selefra_block.go
  type SelefraBlock (line 13) | type SelefraBlock struct
    method GetOpenaiApiKey (line 49) | func (x *SelefraBlock) GetOpenaiApiKey() string {
    method GetOpenaiMode (line 56) | func (x *SelefraBlock) GetOpenaiMode() string {
    method GetOpenaiLimit (line 66) | func (x *SelefraBlock) GetOpenaiLimit() uint64 {
    method Merge (line 77) | func (x *SelefraBlock) Merge(other *SelefraBlock) (*SelefraBlock, *sch...
    method Check (line 153) | func (x *SelefraBlock) Check(module *Module, validatorContext *Validat...
    method IsEmpty (line 183) | func (x *SelefraBlock) IsEmpty() bool {
  function NewSelefraBlock (line 43) | func NewSelefraBlock() *SelefraBlock {
  type CloudBlock (line 195) | type CloudBlock struct
    method Check (line 217) | func (x *CloudBlock) Check(module *Module, validatorContext *Validator...
    method IsEmpty (line 230) | func (x *CloudBlock) IsEmpty() bool {
  function NewCloudBlock (line 211) | func NewCloudBlock() *CloudBlock {
  type ConnectionBlock (line 247) | type ConnectionBlock struct
    method BuildDSN (line 275) | func (x *ConnectionBlock) BuildDSN() string {
    method Check (line 279) | func (x *ConnectionBlock) Check(module *Module, validatorContext *Vali...
    method IsEmpty (line 310) | func (x *ConnectionBlock) IsEmpty() bool {
  function NewConnectionBlock (line 263) | func NewConnectionBlock() *ConnectionBlock {
  function ParseConnectionBlockFromDSN (line 270) | func ParseConnectionBlockFromDSN(dsn string) *ConnectionBlock {
  type RequireProvidersBlock (line 323) | type RequireProvidersBlock
    method BuildNameToProviderBlockMap (line 328) | func (x RequireProvidersBlock) BuildNameToProviderBlockMap() map[strin...
    method Merge (line 336) | func (x RequireProvidersBlock) Merge(other RequireProvidersBlock) (Req...
    method Check (line 370) | func (x RequireProvidersBlock) Check(module *Module, validatorContext ...
    method IsEmpty (line 401) | func (x RequireProvidersBlock) IsEmpty() bool {
    method GetNodeLocation (line 405) | func (x RequireProvidersBlock) GetNodeLocation(selector string) *NodeL...
    method SetNodeLocation (line 409) | func (x RequireProvidersBlock) SetNodeLocation(selector string, nodeLo...
  type RequireProviderBlock (line 416) | type RequireProviderBlock struct
    method Check (line 446) | func (x *RequireProviderBlock) Check(module *Module, validatorContext ...
    method IsEmpty (line 481) | func (x *RequireProviderBlock) IsEmpty() bool {
  function NewRequireProviderBlock (line 438) | func NewRequireProviderBlock() *RequireProviderBlock {

FILE: pkg/modules/module/validator.go
  type ValidatorContext (line 12) | type ValidatorContext struct
    method AddRuleBlock (line 30) | func (x *ValidatorContext) AddRuleBlock(ruleBlock *RuleBlock) {
    method GetRuleBlockById (line 37) | func (x *ValidatorContext) GetRuleBlockById(ruleId string) (*RuleBlock...
    method AddModuleBlock (line 43) | func (x *ValidatorContext) AddModuleBlock(moduleBlock *ModuleBlock) {
    method GetModuleByName (line 48) | func (x *ValidatorContext) GetModuleByName(moduleName string) (*Module...
  function NewValidatorContext (line 22) | func NewValidatorContext() *ValidatorContext {
  constant CheckIdentityErrorMsg (line 55) | CheckIdentityErrorMsg = "only allow \"a-z,A-Z,0-9,_\" and can't start wi...
  function CheckIdentity (line 57) | func CheckIdentity(s string) bool {
  function ParseDuration (line 109) | func ParseDuration(d string) (time.Duration, error) {

FILE: pkg/modules/module/validator_test.go
  function TestParseDuration (line 8) | func TestParseDuration(t *testing.T) {

FILE: pkg/modules/module/variables_block.go
  type VariablesBlock (line 12) | type VariablesBlock
    method Merge (line 17) | func (x VariablesBlock) Merge(other VariablesBlock) (VariablesBlock, *...
    method Check (line 51) | func (x VariablesBlock) Check(module *Module, validatorContext *Valida...
    method IsEmpty (line 70) | func (x VariablesBlock) IsEmpty() bool {
    method GetNodeLocation (line 74) | func (x VariablesBlock) GetNodeLocation(selector string) *NodeLocation {
    method SetNodeLocation (line 78) | func (x VariablesBlock) SetNodeLocation(selector string, nodeLocation ...
  type VariableBlock (line 85) | type VariableBlock struct
    method Check (line 110) | func (x *VariableBlock) Check(module *Module, validatorContext *Valida...
    method IsEmpty (line 129) | func (x *VariableBlock) IsEmpty() bool {
  function NewVariableBlock (line 104) | func NewVariableBlock() *VariableBlock {

FILE: pkg/modules/module_loader/github_registry_module_loader.go
  type GitHubRegistryModuleLoaderOptions (line 18) | type GitHubRegistryModuleLoaderOptions struct
  type GitHubRegistryModuleLoader (line 28) | type GitHubRegistryModuleLoader struct
    method Name (line 74) | func (x *GitHubRegistryModuleLoader) Name() ModuleLoaderType {
    method Load (line 78) | func (x *GitHubRegistryModuleLoader) Load(ctx context.Context) (*modul...
    method Options (line 124) | func (x *GitHubRegistryModuleLoader) Options() *GitHubRegistryModuleLo...
  function NewGitHubRegistryModuleLoader (line 38) | func NewGitHubRegistryModuleLoader(options *GitHubRegistryModuleLoaderOp...

FILE: pkg/modules/module_loader/github_registry_module_loader_test.go
  constant testDownloadDirectory (line 12) | testDownloadDirectory = "./test_download"
  function TestGitHubRegistryModuleLoader_Load (line 14) | func TestGitHubRegistryModuleLoader_Load(t *testing.T) {

FILE: pkg/modules/module_loader/local_directory_module_loader.go
  type LocalDirectoryModuleLoaderOptions (line 21) | type LocalDirectoryModuleLoaderOptions struct
    method BuildFullName (line 44) | func (x *LocalDirectoryModuleLoaderOptions) BuildFullName() string {
  type LocalDirectoryModuleLoader (line 55) | type LocalDirectoryModuleLoader struct
    method Name (line 75) | func (x *LocalDirectoryModuleLoader) Name() ModuleLoaderType {
    method Load (line 79) | func (x *LocalDirectoryModuleLoader) Load(ctx context.Context) (*modul...
    method loadSubModules (line 149) | func (x *LocalDirectoryModuleLoader) loadSubModules(ctx context.Contex...
    method loadURLModule (line 202) | func (x *LocalDirectoryModuleLoader) loadURLModule(ctx context.Context...
    method loadLocalDirectoryModule (line 226) | func (x *LocalDirectoryModuleLoader) loadLocalDirectoryModule(ctx cont...
    method loadGitHubRegistryModule (line 256) | func (x *LocalDirectoryModuleLoader) loadGitHubRegistryModule(ctx cont...
    method loadS3BucketModule (line 283) | func (x *LocalDirectoryModuleLoader) loadS3BucketModule(ctx context.Co...
    method Options (line 311) | func (x *LocalDirectoryModuleLoader) Options() *LocalDirectoryModuleLo...
    method checkModuleDirectory (line 316) | func (x *LocalDirectoryModuleLoader) checkModuleDirectory() *schema.Di...
    method listModuleDirectoryYamlFilePath (line 334) | func (x *LocalDirectoryModuleLoader) listModuleDirectoryYamlFilePath()...
  function NewLocalDirectoryModuleLoader (line 61) | func NewLocalDirectoryModuleLoader(options *LocalDirectoryModuleLoaderOp...
  function IsYamlFile (line 352) | func IsYamlFile(entry os.DirEntry) bool {

FILE: pkg/modules/module_loader/local_directory_module_loader_test.go
  function TestLocalDirectoryModuleLoader_Load (line 12) | func TestLocalDirectoryModuleLoader_Load(t *testing.T) {

FILE: pkg/modules/module_loader/module_loader.go
  constant DownloadModulesDirectoryName (line 14) | DownloadModulesDirectoryName = "modules"
  type ModuleLoaderOptions (line 20) | type ModuleLoaderOptions struct
    method DeepDependenciesTree (line 42) | func (x *ModuleLoaderOptions) DeepDependenciesTree(source string) []st...
  type ModuleLoader (line 66) | type ModuleLoader interface

FILE: pkg/modules/module_loader/module_loader_manager.go
  type ModuleLoaderType (line 10) | type ModuleLoaderType
  constant ModuleLoaderTypeInvalid (line 15) | ModuleLoaderTypeInvalid ModuleLoaderType = ""
  constant ModuleLoaderTypeS3Bucket (line 18) | ModuleLoaderTypeS3Bucket ModuleLoaderType = "s3-bucket-module-loader"
  constant ModuleLoaderTypeGitHubRegistry (line 21) | ModuleLoaderTypeGitHubRegistry ModuleLoaderType = "github-registry-modul...
  constant ModuleLoaderTypeLocalDirectory (line 24) | ModuleLoaderTypeLocalDirectory ModuleLoaderType = "local-directory-modul...
  constant ModuleLoaderTypeURL (line 26) | ModuleLoaderTypeURL ModuleLoaderType = "url-module-loader"
  function NewModuleLoaderBySource (line 34) | func NewModuleLoaderBySource(source string) ModuleLoaderType {

FILE: pkg/modules/module_loader/module_loader_manager_test.go
  function TestNewModuleLoaderBySource (line 7) | func TestNewModuleLoaderBySource(t *testing.T) {

FILE: pkg/modules/module_loader/s3_bucket_path_module_loader.go
  type S3BucketModuleLoaderOptions (line 16) | type S3BucketModuleLoaderOptions struct
  type S3BucketModuleLoader (line 24) | type S3BucketModuleLoader struct
    method Name (line 46) | func (x *S3BucketModuleLoader) Name() ModuleLoaderType {
    method Options (line 50) | func (x *S3BucketModuleLoader) Options() *S3BucketModuleLoaderOptions {
    method Load (line 54) | func (x *S3BucketModuleLoader) Load(ctx context.Context) (*module.Modu...
  function NewS3BucketModuleLoader (line 31) | func NewS3BucketModuleLoader(options *S3BucketModuleLoaderOptions) (*S3B...

FILE: pkg/modules/module_loader/url_module_loader.go
  type URLModuleLoaderOptions (line 15) | type URLModuleLoaderOptions struct
  type URLModuleLoader (line 39) | type URLModuleLoader struct
    method Name (line 62) | func (x *URLModuleLoader) Name() ModuleLoaderType {
    method Load (line 66) | func (x *URLModuleLoader) Load(ctx context.Context) (*module.Module, b...
    method Options (line 106) | func (x *URLModuleLoader) Options() *URLModuleLoaderOptions {
  function NewURLModuleLoader (line 48) | func NewURLModuleLoader(options *URLModuleLoaderOptions) (*URLModuleLoad...

FILE: pkg/modules/module_loader/url_module_loader_test.go
  function TestURLModuleLoader_Load (line 12) | func TestURLModuleLoader_Load(t *testing.T) {

FILE: pkg/modules/parser/modules.go
  constant ModulesBlockName (line 15) | ModulesBlockName = "modules"
  method parseModulesBlock (line 19) | func (x *YamlFileToModuleParser) parseModulesBlock(moduleBlockKeyNode, m...
  constant ModuleBlockNameFieldName (line 42) | ModuleBlockNameFieldName   = "name"
  constant ModuleBlockUsesFieldName (line 43) | ModuleBlockUsesFieldName   = "uses"
  constant ModuleBlockFilterFieldName (line 44) | ModuleBlockFilterFieldName = "filter"
  constant ModuleBlockInputFieldName (line 45) | ModuleBlockInputFieldName  = "input"
  method parseModuleBlock (line 49) | func (x *YamlFileToModuleParser) parseModuleBlock(moduleIndex int, modul...
  method parseModuleInputBlock (line 93) | func (x *YamlFileToModuleParser) parseModuleInputBlock(moduleBlock *modu...

FILE: pkg/modules/parser/modules_test.go
  function TestYamlFileToModuleParser_parseModulesBlock (line 9) | func TestYamlFileToModuleParser_parseModulesBlock(t *testing.T) {

FILE: pkg/modules/parser/providers.go
  constant ProvidersBlockName (line 14) | ProvidersBlockName = "providers"
  method parseProvidersBlock (line 17) | func (x *YamlFileToModuleParser) parseProvidersBlock(providersBlockKeyNo...
  constant ProviderBlockNameFieldName (line 39) | ProviderBlockNameFieldName          = "name"
  constant ProviderBlockCacheFieldName (line 40) | ProviderBlockCacheFieldName         = "cache"
  constant ProviderBlockProviderFieldName (line 41) | ProviderBlockProviderFieldName      = "provider"
  constant ProviderBlockMaxGoroutinesFieldName (line 42) | ProviderBlockMaxGoroutinesFieldName = "max_goroutines"
  constant ProviderBlockResourcesFieldName (line 43) | ProviderBlockResourcesFieldName     = "resources"
  method parseProviderBlock (line 49) | func (x *YamlFileToModuleParser) parseProviderBlock(index int, providerB...

FILE: pkg/modules/parser/providers_test.go
  function TestYamlFileToModuleParser_parseProvidersBlock (line 10) | func TestYamlFileToModuleParser_parseProvidersBlock(t *testing.T) {

FILE: pkg/modules/parser/rules.go
  constant RulesBlockName (line 14) | RulesBlockName = "rules"
  method parseRulesBlock (line 17) | func (x *YamlFileToModuleParser) parseRulesBlock(rulesBlockKeyNode, rule...
  constant RuleBlockNameFieldName (line 42) | RuleBlockNameFieldName      = "name"
  constant RuleBlockQueryFieldName (line 43) | RuleBlockQueryFieldName     = "query"
  constant RuleBlockLabelsFieldName (line 44) | RuleBlockLabelsFieldName    = "labels"
  constant RuleBlockMetadataFieldName (line 45) | RuleBlockMetadataFieldName  = "metadata"
  constant RuleBlockMainTableFieldName (line 46) | RuleBlockMainTableFieldName = "main_table"
  constant RuleBlockOutputFieldName (line 47) | RuleBlockOutputFieldName    = "output"
  method parseRuleBlock (line 50) | func (x *YamlFileToModuleParser) parseRuleBlock(index int, ruleBlockNode...
  constant RuleMetadataBlockName (line 100) | RuleMetadataBlockName                 = "metadata"
  constant RuleMetadataBlockIdFieldName (line 101) | RuleMetadataBlockIdFieldName          = "id"
  constant RuleMetadataBlockSeverityFieldName (line 102) | RuleMetadataBlockSeverityFieldName    = "severity"
  constant RuleMetadataBlockProviderFieldName (line 103) | RuleMetadataBlockProviderFieldName    = "provider"
  constant RuleMetadataBlockTagsFieldName (line 104) | RuleMetadataBlockTagsFieldName        = "tags"
  constant RuleMetadataBlockAuthorFieldName (line 105) | RuleMetadataBlockAuthorFieldName      = "author"
  constant RuleMetadataBlockRemediationFieldName (line 106) | RuleMetadataBlockRemediationFieldName = "remediation"
  constant RuleMetadataBlockTitleFieldName (line 107) | RuleMetadataBlockTitleFieldName       = "title"
  constant RuleMetadataBlockDescriptionFieldName (line 108) | RuleMetadataBlockDescriptionFieldName = "description"
  constant RuleMetadataBlockMainTableFieldName (line 109) | RuleMetadataBlockMainTableFieldName   = "main_table"
  method parseMetadataBlock (line 112) | func (x *YamlFileToModuleParser) parseMetadataBlock(ruleIndex int, ruleB...

FILE: pkg/modules/parser/rules_test.go
  function TestYamlFileToModuleParser_parseRulesBlock (line 10) | func TestYamlFileToModuleParser_parseRulesBlock(t *testing.T) {

FILE: pkg/modules/parser/selefra.go
  constant SelefraBlockFieldName (line 14) | SelefraBlockFieldName             = "selefra"
  constant SelefraBlockOpenaiApiKeyName (line 15) | SelefraBlockOpenaiApiKeyName      = "openai_api_key"
  constant SelefraBlockOpenaiModeName (line 16) | SelefraBlockOpenaiModeName        = "openai_mode"
  constant SelefraBlockOpenaiLimitName (line 17) | SelefraBlockOpenaiLimitName       = "openai_limit"
  constant SelefraBlockNameFieldName (line 18) | SelefraBlockNameFieldName         = "name"
  constant SelefraBlockCLIVersionFieldName (line 19) | SelefraBlockCLIVersionFieldName   = "cli_version"
  constant SelefraBlockLogLevelFieldName (line 20) | SelefraBlockLogLevelFieldName     = "log_level"
  constant SelefraRequiredProvidersBlockName (line 21) | SelefraRequiredProvidersBlockName = "providers"
  constant SelefraConnectionsBlockName (line 22) | SelefraConnectionsBlockName       = "connection"
  constant SelefraCloudBlockName (line 23) | SelefraCloudBlockName             = "cloud"
  method parseSelefraBlock (line 26) | func (x *YamlFileToModuleParser) parseSelefraBlock(selefraBlockKeyNode, ...
  constant CloudBlockProjectFieldName (line 91) | CloudBlockProjectFieldName      = "project"
  constant CloudBlockOrganizationFieldName (line 92) | CloudBlockOrganizationFieldName = "organization"
  constant CloudBlockHostnameFieldName (line 93) | CloudBlockHostnameFieldName     = "hostname"
  method parseCloudBlock (line 96) | func (x *YamlFileToModuleParser) parseCloudBlock(cloudBlockKeyNode, clou...
  constant RequiredProviderBlockNameFieldName (line 138) | RequiredProviderBlockNameFieldName    = "name"
  constant RequiredProviderBlockSourceFieldName (line 139) | RequiredProviderBlockSourceFieldName  = "source"
  constant RequiredProviderBlockVersionFieldName (line 140) | RequiredProviderBlockVersionFieldName = "version"
  constant RequiredProviderBlockPathFieldName (line 141) | RequiredProviderBlockPathFieldName    = "path"
  method parseRequiredProvidersBlock (line 144) | func (x *YamlFileToModuleParser) parseRequiredProvidersBlock(requiredPro...
  method parseRequiredProviderBlock (line 167) | func (x *YamlFileToModuleParser) parseRequiredProviderBlock(index int, n...
  constant ConnectionBlockTypeFieldName (line 212) | ConnectionBlockTypeFieldName     = "type"
  constant ConnectionBlockUsernameFieldName (line 213) | ConnectionBlockUsernameFieldName = "username"
  constant ConnectionBlockPasswordFieldName (line 214) | ConnectionBlockPasswordFieldName = "password"
  constant ConnectionBlockHostFieldName (line 215) | ConnectionBlockHostFieldName     = "host"
  constant ConnectionBlockPortFieldName (line 216) | ConnectionBlockPortFieldName     = "port"
  constant ConnectionBlockDatabaseFieldName (line 217) | ConnectionBlockDatabaseFieldName = "database"
  constant ConnectionBlockSSLModeFieldName (line 218) | ConnectionBlockSSLModeFieldName  = "sslmode"
  constant ConnectionBlockExtrasFieldName (line 219) | ConnectionBlockExtrasFieldName   = "extras"
  method parseConnectionBlock (line 222) | func (x *YamlFileToModuleParser) parseConnectionBlock(connectionBlockKey...

FILE: pkg/modules/parser/selefra_test.go
  function TestYamlFileToModuleParser_parseSelefraBlock (line 9) | func TestYamlFileToModuleParser_parseSelefraBlock(t *testing.T) {

FILE: pkg/modules/parser/variables.go
  constant VariablesBlockName (line 11) | VariablesBlockName = "variables"
  method parseVariablesBlock (line 13) | func (x *YamlFileToModuleParser) parseVariablesBlock(variablesBlockKeyNo...
  constant VariableBlockKeyFieldName (line 39) | VariableBlockKeyFieldName         = "key"
  constant VariableBlockDefaultFieldName (line 40) | VariableBlockDefaultFieldName     = "default"
  constant VariableBlockDescriptionFieldName (line 41) | VariableBlockDescriptionFieldName = "description"
  constant VariableBlockAuthorFieldName (line 42) | VariableBlockAuthorFieldName      = "author"
  method parseVariableBlock (line 45) | func (x *YamlFileToModuleParser) parseVariableBlock(index int, node *yam...

FILE: pkg/modules/parser/variables_test.go
  function TestYamlFileToModuleParser_parseVariablesBlock (line 9) | func TestYamlFileToModuleParser_parseVariablesBlock(t *testing.T) {

FILE: pkg/modules/parser/yaml_file_to_module_parser.go
  type YamlFileToModuleParser (line 16) | type YamlFileToModuleParser struct
    method Parse (line 28) | func (x *YamlFileToModuleParser) Parse() (*module.Module, *schema.Diag...
    method parseUintValueWithDiagnosticsAndSetLocation (line 103) | func (x *YamlFileToModuleParser) parseUintValueWithDiagnosticsAndSetLo...
    method parseFilterValueWithDiagnosticsAndSetLocation (line 115) | func (x *YamlFileToModuleParser) parseFilterValueWithDiagnosticsAndSet...
    method parseStringValueWithDiagnosticsAndSetLocation (line 121) | func (x *YamlFileToModuleParser) parseStringValueWithDiagnosticsAndSet...
    method parseInterfaceValueWithDiagnosticsAndSetLocation (line 133) | func (x *YamlFileToModuleParser) parseInterfaceValueWithDiagnosticsAnd...
    method parseStringSlice (line 146) | func (x *YamlFileToModuleParser) parseStringSlice(node *yaml.Node, blo...
    method parseStringSliceAndSetLocation (line 164) | func (x *YamlFileToModuleParser) parseStringSliceAndSetLocation(block ...
    method parseStringMapAndSetLocation (line 213) | func (x *YamlFileToModuleParser) parseStringMapAndSetLocation(block mo...
    method parseAny (line 244) | func (x *YamlFileToModuleParser) parseAny(node *yaml.Node, blockPath s...
    method parseUintWithDiagnostics (line 269) | func (x *YamlFileToModuleParser) parseUintWithDiagnostics(node *yaml.N...
    method parseStringWithDiagnostics (line 286) | func (x *YamlFileToModuleParser) parseStringWithDiagnostics(node *yaml...
    method parseInterfaceWithDiagnostics (line 295) | func (x *YamlFileToModuleParser) parseInterfaceWithDiagnostics(node *y...
    method parseFilterWithDiagnostics (line 328) | func (x *YamlFileToModuleParser) parseFilterWithDiagnostics(node *yaml...
    method toMap (line 352) | func (x *YamlFileToModuleParser) toMap(node *yaml.Node, blockPath stri...
    method setLocationKVWithDiagnostics (line 380) | func (x *YamlFileToModuleParser) setLocationKVWithDiagnostics(block mo...
    method setLocationWithDiagnostics (line 391) | func (x *YamlFileToModuleParser) setLocationWithDiagnostics(block modu...
    method buildNodeErrorMsgForUnSupport (line 399) | func (x *YamlFileToModuleParser) buildNodeErrorMsgForUnSupport(keyNode...
    method buildNodeErrorMsgForScalarType (line 409) | func (x *YamlFileToModuleParser) buildNodeErrorMsgForScalarType(node *...
    method buildNodeErrorMsgForSequenceType (line 413) | func (x *YamlFileToModuleParser) buildNodeErrorMsgForSequenceType(node...
    method buildNodeErrorMsgForMappingType (line 417) | func (x *YamlFileToModuleParser) buildNodeErrorMsgForMappingType(node ...
    method buildNodeErrorMsgForArrayType (line 421) | func (x *YamlFileToModuleParser) buildNodeErrorMsgForArrayType(node *y...
    method buildNodeErrorMsg (line 425) | func (x *YamlFileToModuleParser) buildNodeErrorMsg(blockPath string, n...
  function NewYamlFileToModuleParser (line 21) | func NewYamlFileToModuleParser(yamlFilePath string, instruction map[stri...
  type nodeEntry (line 341) | type nodeEntry struct
  function newNodeEntry (line 345) | func newNodeEntry(key, value *yaml.Node) *nodeEntry {

FILE: pkg/modules/parser/yaml_file_to_module_parser_test.go
  function TestYamlFileToModuleParser_Parse (line 10) | func TestYamlFileToModuleParser_Parse(t *testing.T) {

FILE: pkg/modules/planner/module_planner.go
  function MakeModuleQueryPlan (line 13) | func MakeModuleQueryPlan(ctx context.Context, options *ModulePlannerOpti...
  type ModulePlan (line 20) | type ModulePlan struct
  type ModulePlannerOptions (line 52) | type ModulePlannerOptions struct
  type ModulePlanner (line 64) | type ModulePlanner struct
    method Name (line 76) | func (x *ModulePlanner) Name() string {
    method MakePlan (line 80) | func (x *ModulePlanner) MakePlan(ctx context.Context) (*ModulePlan, *s...
    method buildModulePlanner (line 85) | func (x *ModulePlanner) buildModulePlanner(ctx context.Context, module...
  function NewModulePlanner (line 70) | func NewModulePlanner(options *ModulePlannerOptions) *ModulePlanner {

FILE: pkg/modules/planner/planner.go
  type Planner (line 9) | type Planner interface

FILE: pkg/modules/planner/provider_fetch_planner.go
  type ProvidersFetchPlan (line 25) | type ProvidersFetchPlan
    method BuildProviderContextMap (line 28) | func (x ProvidersFetchPlan) BuildProviderContextMap(ctx context.Contex...
  type ProviderContext (line 62) | type ProviderContext struct
  constant DefaultMaxGoroutines (line 85) | DefaultMaxGoroutines = uint64(100)
  type ProviderFetchPlan (line 89) | type ProviderFetchPlan struct
    method GetProvidersConfigYamlString (line 115) | func (x *ProviderFetchPlan) GetProvidersConfigYamlString() string {
    method GetNeedPullTablesName (line 123) | func (x *ProviderFetchPlan) GetNeedPullTablesName() []string {
    method GetMaxGoroutines (line 135) | func (x *ProviderFetchPlan) GetMaxGoroutines() uint64 {
  function NewProviderFetchPlan (line 105) | func NewProviderFetchPlan(providerName, providerVersion string, provider...
  type ProviderFetchPlannerOptions (line 146) | type ProviderFetchPlannerOptions struct
  type ProviderFetchPlanner (line 163) | type ProviderFetchPlanner struct
    method Name (line 175) | func (x *ProviderFetchPlanner) Name() string {
    method MakePlan (line 179) | func (x *ProviderFetchPlanner) MakePlan(ctx context.Context) (Provider...
    method expandByConfiguration (line 189) | func (x *ProviderFetchPlanner) expandByConfiguration(ctx context.Conte...
    method decideDatabaseSchemaForNoProviderBlockPlan (line 259) | func (x *ProviderFetchPlanner) decideDatabaseSchemaForNoProviderBlockP...
    method grabDatabaseSchema (line 301) | func (x *ProviderFetchPlanner) grabDatabaseSchema(ctx context.Context,...
  function NewProviderFetchPlanner (line 169) | func NewProviderFetchPlanner(options *ProviderFetchPlannerOptions) *Prov...

FILE: pkg/modules/planner/provider_fetch_planner_test.go
  function TestProviderFetchPlanner_MakePlan (line 16) | func TestProviderFetchPlanner_MakePlan(t *testing.T) {

FILE: pkg/modules/planner/provider_install_planner.go
  function MakeProviderInstallPlan (line 17) | func MakeProviderInstallPlan(ctx context.Context, module *module.Module)...
  type ProvidersInstallPlan (line 23) | type ProvidersInstallPlan
    method ToMap (line 25) | func (x ProvidersInstallPlan) ToMap() map[string]string {
  type ProviderInstallPlan (line 36) | type ProviderInstallPlan struct
  function NewProviderInstallPlan (line 42) | func NewProviderInstallPlan(providerName, providerVersion string) *Provi...
  type ProviderInstallPlanner (line 51) | type ProviderInstallPlanner struct
    method Name (line 63) | func (x *ProviderInstallPlanner) Name() string {
    method MakePlan (line 67) | func (x *ProviderInstallPlanner) MakePlan(ctx context.Context) (Provid...
    method providerVersionVote (line 81) | func (x *ProviderInstallPlanner) providerVersionVote(ctx context.Conte...
    method buildVersionVoteFailedReport (line 127) | func (x *ProviderInstallPlanner) buildVersionVoteFailedReport(provider...
  function NewProviderInstallPlanner (line 57) | func NewProviderInstallPlanner(module *module.Module) *ProviderInstallPl...

FILE: pkg/modules/planner/provider_install_planner_test.go
  function TestNewProviderInstallPlanner (line 10) | func TestNewProviderInstallPlanner(t *testing.T) {

FILE: pkg/modules/planner/rule_planner.go
  type RulePlan (line 13) | type RulePlan struct
    method String (line 35) | func (x *RulePlan) String() string {
  function MakeRulePlan (line 46) | func MakeRulePlan(ctx context.Context, options *RulePlannerOptions) (*Ru...
  type RulePlannerOptions (line 53) | type RulePlannerOptions struct
  type RulePlanner (line 74) | type RulePlanner struct
    method Name (line 80) | func (x *RulePlanner) Name() string {
    method MakePlan (line 91) | func (x *RulePlanner) MakePlan(ctx context.Context) (*RulePlan, *schem...
    method extractBinding (line 138) | func (x *RulePlanner) extractBinding(query string, tableToProviderMap ...
  function NewRulePlanner (line 84) | func NewRulePlanner(options *RulePlannerOptions) *RulePlanner {

FILE: pkg/modules/planner/rule_planner_test.go
  function TestRulePlanner_MakePlan (line 13) | func TestRulePlanner_MakePlan(t *testing.T) {

FILE: pkg/modules/planner/scope.go
  type Scope (line 9) | type Scope struct
    method Extend (line 33) | func (x *Scope) Extend(scope *Scope) {
    method Clone (line 43) | func (x *Scope) Clone() *Scope {
    method GetVariable (line 57) | func (x *Scope) GetVariable(variableName string) (any, bool) {
    method SetVariable (line 63) | func (x *Scope) SetVariable(variableName string, variableValue any) any {
    method SetVariables (line 70) | func (x *Scope) SetVariables(variablesMap map[string]any) {
    method SetVariableIfNotExists (line 77) | func (x *Scope) SetVariableIfNotExists(variableName string, variableVa...
    method RenderingTemplate (line 86) | func (x *Scope) RenderingTemplate(templateName, templateString string)...
  function ExtendScope (line 19) | func ExtendScope(scope *Scope) *Scope {
  function NewScope (line 26) | func NewScope() *Scope {

FILE: pkg/modules/planner/version_vote.go
  type ProviderVersionVoteService (line 17) | type ProviderVersionVoteService struct
    method Vote (line 30) | func (x *ProviderVersionVoteService) Vote(ctx context.Context, module ...
  function NewProviderVersionVoteService (line 23) | func NewProviderVersionVoteService() *ProviderVersionVoteService {
  type ProviderVote (line 62) | type ProviderVote struct
    method Vote (line 77) | func (x *ProviderVote) Vote(voteModule *module.Module, requiredProvide...
    method InitProviderVersionVoteCountMap (line 113) | func (x *ProviderVote) InitProviderVersionVoteCountMap(ctx context.Con...
    method GetWinnersVersionVoteSummary (line 146) | func (x *ProviderVote) GetWinnersVersionVoteSummary() map[string]*Vers...
    method GetWinnersVersionSlice (line 157) | func (x *ProviderVote) GetWinnersVersionSlice() []string {
    method GetVoteVersions (line 166) | func (x *ProviderVote) GetVoteVersions() []string {
    method ToModuleAllowProviderVersionMap (line 175) | func (x *ProviderVote) ToModuleAllowProviderVersionMap() map[*module.M...
  function NewProviderVote (line 69) | func NewProviderVote(ctx context.Context, requiredProviderBlock *module....
  type VersionVoteSummary (line 188) | type VersionVoteSummary struct
  function NewVoteSummary (line 197) | func NewVoteSummary(providerName, providerVersion string) (*VersionVoteS...

FILE: pkg/modules/planner/version_vote_test.go
  function TestNewProviderVersionVoteService (line 12) | func TestNewProviderVersionVoteService(t *testing.T) {
  function randomModule (line 53) | func randomModule(requiredVersion string) *module.Module {

FILE: pkg/oci/postgresql_installer.go
  constant DefaultPostgreSQLPasswd (line 25) | DefaultPostgreSQLPasswd = "pass"
  constant DefaultPostgreSQLPort (line 27) | DefaultPostgreSQLPort = 15432
  type PostgreSQLDownloaderOptions (line 56) | type PostgreSQLDownloaderOptions struct
  type PostgreSQLInstaller (line 69) | type PostgreSQLInstaller struct
    method Run (line 79) | func (x *PostgreSQLInstaller) Run(ctx context.Context) bool {
    method DownloadOCIImage (line 112) | func (x *PostgreSQLInstaller) DownloadOCIImage(ctx context.Context) bo...
    method IsInstalled (line 137) | func (x *PostgreSQLInstaller) IsInstalled() bool {
    method Install (line 143) | func (x *PostgreSQLInstaller) Install(ctx context.Context) bool {
    method Start (line 186) | func (x *PostgreSQLInstaller) Start() bool {
    method Stop (line 204) | func (x *PostgreSQLInstaller) Stop() bool {
    method fixDiagnostics (line 226) | func (x *PostgreSQLInstaller) fixDiagnostics(diagnostics *schema.Diagn...
    method buildPgInstallDirectoryPath (line 246) | func (x *PostgreSQLInstaller) buildPgInstallDirectoryPath() string {
    method buildDataDirectory (line 251) | func (x *PostgreSQLInstaller) buildDataDirectory() string {
    method buildInitExecutePath (line 256) | func (x *PostgreSQLInstaller) buildInitExecutePath() string {
    method buildPgCtlExecutePath (line 265) | func (x *PostgreSQLInstaller) buildPgCtlExecutePath() string {
    method buildPgConfigFilePath (line 274) | func (x *PostgreSQLInstaller) buildPgConfigFilePath() string {
    method buildPgLogFilePath (line 279) | func (x *PostgreSQLInstaller) buildPgLogFilePath() string {
    method ChangeConfigFilePort (line 287) | func (x *PostgreSQLInstaller) ChangeConfigFilePort(port int) *schema.D...
  function NewPostgreSQLDownloader (line 73) | func NewPostgreSQLDownloader(options *PostgreSQLDownloaderOptions) *Post...

FILE: pkg/oci/postgresql_installer_test.go
  function TestPostgreSQLInstaller_Run1 (line 15) | func TestPostgreSQLInstaller_Run1(t *testing.T) {

FILE: pkg/plugin/plugin.go
  constant prefixManaged (line 14) | prefixManaged   = "managed"
  constant prefixUnmanaged (line 15) | prefixUnmanaged = "unmanaged"
  constant defaultAlias (line 16) | defaultAlias    = "default"
  type Plugin (line 19) | type Plugin interface
  type pluginBase (line 27) | type pluginBase struct
    method Name (line 34) | func (p pluginBase) Name() string {
    method Provider (line 38) | func (p pluginBase) Provider() shard.ProviderClient {
    method Version (line 42) | func (p pluginBase) Version() string {
  type managedPlugin (line 46) | type managedPlugin struct
    method ProtocolVersion (line 50) | func (m managedPlugin) ProtocolVersion() int {
    method Close (line 54) | func (m managedPlugin) Close() {
  type unmanagedPlugin (line 61) | type unmanagedPlugin struct
    method ProtocolVersion (line 66) | func (u unmanagedPlugin) ProtocolVersion() int {
    method Close (line 70) | func (u unmanagedPlugin) Close() {}
  function getProvider (line 88) | func getProvider(name string, client *plugin.Client) (shard.ProviderClie...
  function checkAlias (line 108) | func checkAlias(alias string) string {
  function NewManagedPlugin (line 115) | func NewManagedPlugin(filepath string, name string, version string, alia...
  function NewUnmanagedPlugin (line 157) | func NewUnmanagedPlugin(alias string, name string, version string, confi...

FILE: pkg/providers/local_providers_manager/exists.go
  method IsProviderInstalled (line 10) | func (x *LocalProvidersManager) IsProviderInstalled(ctx context.Context,...

FILE: pkg/providers/local_providers_manager/exists_test.go
  function getTestLocalProviderManager (line 10) | func getTestLocalProviderManager() *LocalProvidersManager {
  function TestLocalProvidersManager_IsProviderInstalled (line 18) | func TestLocalProvidersManager_IsProviderInstalled(t *testing.T) {

FILE: pkg/providers/local_providers_manager/get.go
  method Get (line 10) | func (x *LocalProvidersManager) Get(ctx context.Context, localProvider *...

FILE: pkg/providers/local_providers_manager/get_test.go
  function TestLocalProvidersManager_Get (line 12) | func TestLocalProvidersManager_Get(t *testing.T) {

FILE: pkg/providers/local_providers_manager/install.go
  type InstallProvidersOptions (line 17) | type InstallProvidersOptions struct
  method InstallProvider (line 28) | func (x *LocalProvidersManager) InstallProvider(ctx context.Context, opt...

FILE: pkg/providers/local_providers_manager/install_test.go
  function TestLocalProvidersManager_InstallProvider (line 25) | func TestLocalProvidersManager_InstallProvider(t *testing.T) {

FILE: pkg/providers/local_providers_manager/list.go
  method ListProviders (line 11) | func (x *LocalProvidersManager) ListProviders() ([]*LocalProviderVersion...
  method ListProviderVersions (line 42) | func (x *LocalProvidersManager) ListProviderVersions(providerName string...

FILE: pkg/providers/local_providers_manager/list_test.go
  function TestLocalProvidersManager_ListProviderVersions (line 25) | func TestLocalProvidersManager_ListProviderVersions(t *testing.T) {
  function TestLocalProvidersManager_ListProviders (line 56) | func TestLocalProvidersManager_ListProviders(t *testing.T) {

FILE: pkg/providers/local_providers_manager/local_provider.go
  type LocalProviderSource (line 10) | type LocalProviderSource
  constant LocalProviderSourceUnknown (line 13) | LocalProviderSourceUnknown LocalProviderSource = iota
  constant LocalProviderSourceGitHubRegistry (line 14) | LocalProviderSourceGitHubRegistry
  constant LocalProviderSourceLocalRegistry (line 15) | LocalProviderSourceLocalRegistry
  type LocalProvider (line 20) | type LocalProvider struct
  function NewLocalProvider (line 39) | func NewLocalProvider(providerName, providerVersion string) *LocalProvid...
  type LocalProviderVersions (line 48) | type LocalProviderVersions struct
    method AddLocalProvider (line 64) | func (x *LocalProviderVersions) AddLocalProvider(localProvider *LocalP...
  function NewLocalProviderVersions (line 57) | func NewLocalProviderVersions(providerName string) *LocalProviderVersions {

FILE: pkg/providers/local_providers_manager/manager.go
  constant LocalProvidersDirectoryName (line 11) | LocalProvidersDirectoryName = "providers"
  constant LocalProvidersVersionMetaFileName (line 14) | LocalProvidersVersionMetaFileName = ".version-meta.json"
  constant LocalProvidersProviderMetaFileName (line 17) | LocalProvidersProviderMetaFileName = ".provider-meta.json"
  type LocalProvidersManager (line 23) | type LocalProvidersManager struct
    method buildLocalProvidersPath (line 49) | func (x *LocalProvidersManager) buildLocalProvidersPath() string {
    method buildLocalProviderPath (line 53) | func (x *LocalProvidersManager) buildLocalProviderPath(providerName st...
    method buildLocalProviderMetaFilePath (line 58) | func (x *LocalProvidersManager) buildLocalProviderMetaFilePath(provide...
    method buildLocalProviderVersionPath (line 63) | func (x *LocalProvidersManager) buildLocalProviderVersionPath(provider...
    method buildLocalProviderVersionMetaFilePath (line 68) | func (x *LocalProvidersManager) buildLocalProviderVersionMetaFilePath(...
  function NewLocalProvidersManager (line 32) | func NewLocalProvidersManager(downloadWorkspace string) (*LocalProviders...

FILE: pkg/providers/local_providers_manager/remove.go
  method RemoveProviders (line 12) | func (x *LocalProvidersManager) RemoveProviders(ctx context.Context, pro...

FILE: pkg/providers/local_providers_manager/remove_test.go
  function TestLocalProvidersManager_RemoveProviders (line 28) | func TestLocalProvidersManager_RemoveProviders(t *testing.T) {

FILE: pkg/providers/local_providers_manager/search.go
  method SearchLocal (line 11) | func (x *LocalProvidersManager) SearchLocal(ctx context.Context, keyword...
  method SearchRegistry (line 32) | func (x *LocalProvidersManager) SearchRegistry(ctx context.Context, keyw...

FILE: pkg/providers/local_providers_manager/search_test.go
  function TestLocalProvidersManager_SearchLocal (line 12) | func TestLocalProvidersManager_SearchLocal(t *testing.T) {
  function TestLocalProvidersManager_SearchRegistry (line 50) | func TestLocalProvidersManager_SearchRegistry(t *testing.T) {

FILE: pkg/registry/module_github_registry.go
  constant ModulesListDirectoryName (line 20) | ModulesListDirectoryName = "module"
  constant ModuleGithubRegistryDefaultRepoFullName (line 24) | ModuleGithubRegistryDefaultRepoFullName = "selefra/registry"
  type ModuleGithubRegistryOptions (line 28) | type ModuleGithubRegistryOptions struct
    method Check (line 45) | func (x *ModuleGithubRegistryOptions) Check() *schema.Diagnostics {
  function NewModuleGithubRegistryOptions (line 33) | func NewModuleGithubRegistryOptions(downloadWorkspace string, registryRe...
  type ModuleGitHubRegistry (line 52) | type ModuleGitHubRegistry struct
    method Download (line 83) | func (x *ModuleGitHubRegistry) Download(ctx context.Context, module *M...
    method GetLatestVersion (line 87) | func (x *ModuleGitHubRegistry) GetLatestVersion(ctx context.Context, m...
    method GetAllVersion (line 95) | func (x *ModuleGitHubRegistry) GetAllVersion(ctx context.Context, modu...
    method GetMetadata (line 107) | func (x *ModuleGitHubRegistry) GetMetadata(ctx context.Context, module...
    method GetSupplement (line 111) | func (x *ModuleGitHubRegistry) GetSupplement(ctx context.Context, modu...
    method buildModuleRegistryDownloadDirectory (line 115) | func (x *ModuleGitHubRegistry) buildModuleRegistryDownloadDirectory() ...
    method List (line 119) | func (x *ModuleGitHubRegistry) List(ctx context.Context) ([]*Module, e...
    method Search (line 139) | func (x *ModuleGitHubRegistry) Search(ctx context.Context, keyword str...
    method buildRegistryRepoFullName (line 154) | func (x *ModuleGitHubRegistry) buildRegistryRepoFullName() string {
    method buildRegistryUrl (line 158) | func (x *ModuleGitHubRegistry) buildRegistryUrl() string {
    method CheckUpdate (line 162) | func (x *ModuleGitHubRegistry) CheckUpdate(ctx context.Context, module...
  function NewModuleGitHubRegistry (line 63) | func NewModuleGitHubRegistry(options *ModuleGithubRegistryOptions) (*Mod...
  function downloadModule (line 181) | func downloadModule(ctx context.Context, registryUrl string, module *Mod...
  function formatModuleVersion (line 228) | func formatModuleVersion(ctx context.Context, registryUrl string, module...
  function buildModuleDownloadPath (line 240) | func buildModuleDownloadPath(downloadWorkspace string, module *Module) s...
  function getModuleMeta (line 244) | func getModuleMeta(ctx context.Context, registryUrl string, module *Modu...
  function getModuleSupplement (line 253) | func getModuleSupplement(ctx context.Context, registryUrl string, module...

FILE: pkg/registry/module_local_registry.go
  type ModuleLocalRegistry (line 12) | type ModuleLocalRegistry struct
    method CheckUpdate (line 38) | func (x *ModuleLocalRegistry) CheckUpdate(ctx context.Context, module ...
    method Download (line 56) | func (x *ModuleLocalRegistry) Download(ctx context.Context, module *Mo...
    method GetLatestVersion (line 64) | func (x *ModuleLocalRegistry) GetLatestVersion(ctx context.Context, mo...
    method GetAllVersion (line 73) | func (x *ModuleLocalRegistry) GetAllVersion(ctx context.Context, modul...
    method GetMetadata (line 86) | func (x *ModuleLocalRegistry) GetMetadata(ctx context.Context, module ...
    method GetSupplement (line 95) | func (x *ModuleLocalRegistry) GetSupplement(ctx context.Context, modul...
    method List (line 104) | func (x *ModuleLocalRegistry) List(ctx context.Context) ([]*Module, er...
    method Search (line 125) | func (x *ModuleLocalRegistry) Search(ctx context.Context, keyword stri...
  function NewModuleLocalRegistry (line 19) | func NewModuleLocalRegistry(registryDirectory string, registryGitHubRepo...

FILE: pkg/registry/module_registry.go
  type Module (line 11) | type Module struct
  function ParseModule (line 15) | func ParseModule(moduleNameAndVersion string) *Module {
  function NewModule (line 21) | func NewModule(moduleName, moduleVersion string) *Module {
  type ModuleMetadata (line 29) | type ModuleMetadata struct
    method HasVersion (line 37) | func (x *ModuleMetadata) HasVersion(version string) bool {
  type ModuleSupplement (line 46) | type ModuleSupplement struct
  type ModuleRegistryDownloadOptions (line 54) | type ModuleRegistryDownloadOptions struct
  type ModuleRegistry (line 67) | type ModuleRegistry interface

FILE: pkg/registry/provider_github_registry.go
  constant ProviderGithubRegistryDefaultRepoFullName (line 20) | ProviderGithubRegistryDefaultRepoFullName = "selefra/registry"
  type ProviderGithubRegistryOptions (line 64) | type ProviderGithubRegistryOptions struct
    method Check (line 81) | func (x *ProviderGithubRegistryOptions) Check() *schema.Diagnostics {
  function NewProviderGithubRegistryOptions (line 69) | func NewProviderGithubRegistryOptions(downloadWorkspace string, registry...
  type ProviderGithubRegistry (line 87) | type ProviderGithubRegistry struct
    method buildRegistryRepoFullName (line 118) | func (x *ProviderGithubRegistry) buildRegistryRepoFullName() string {
    method buildRegistryUrl (line 122) | func (x *ProviderGithubRegistry) buildRegistryUrl() string {
    method buildProviderRegistryDownloadDirectory (line 130) | func (x *ProviderGithubRegistry) buildProviderRegistryDownloadDirector...
    method List (line 134) | func (x *ProviderGithubRegistry) List(ctx context.Context) ([]*Provide...
    method Search (line 154) | func (x *ProviderGithubRegistry) Search(ctx context.Context, keyword s...
    method GetLatestVersion (line 169) | func (x *ProviderGithubRegistry) GetLatestVersion(ctx context.Context,...
    method GetAllVersion (line 177) | func (x *ProviderGithubRegistry) GetAllVersion(ctx context.Context, pr...
    method CheckUpdate (line 189) | func (x *ProviderGithubRegistry) CheckUpdate(ctx context.Context, prov...
    method getSupplement (line 207) | func (x *ProviderGithubRegistry) getSupplement(ctx context.Context, pr...
    method getProviderMetadata (line 240) | func (x *ProviderGithubRegistry) getProviderMetadata(ctx context.Conte...
    method Download (line 244) | func (x *ProviderGithubRegistry) Download(ctx context.Context, provide...
    method GetMetadata (line 248) | func (x *ProviderGithubRegistry) GetMetadata(ctx context.Context, prov...
    method GetSupplement (line 252) | func (x *ProviderGithubRegistry) GetSupplement(ctx context.Context, pr...
  function NewProviderGithubRegistry (line 98) | func NewProviderGithubRegistry(options *ProviderGithubRegistryOptions) (...
  function downloadProvider (line 258) | func downloadProvider(ctx context.Context, registryUrl string, provider ...
  function formatProviderVersion (line 312) | func formatProviderVersion(ctx context.Context, registryUrl string, prov...
  function buildProviderDownloadPath (line 324) | func buildProviderDownloadPath(downloadWorkspace string, provider *Provi...
  function getProviderMeta (line 328) | func getProviderMeta(ctx context.Context, registryUrl string, provider *...
  function getProviderSupplement (line 337) | func getProviderSupplement(ctx context.Context, registryUrl string, prov...

FILE: pkg/registry/provider_github_registry_test.go
  function newTestProviderGithubRegistry (line 9) | func newTestProviderGithubRegistry() *ProviderGithubRegistry {
  function TestProviderGithubRegistry_Download (line 19) | func TestProviderGithubRegistry_Download(t *testing.T) {
  function TestProviderGithubRegistry_List (line 28) | func TestProviderGithubRegistry_List(t *testing.T) {
  function TestProviderGithubRegistry_Search (line 34) | func TestProviderGithubRegistry_Search(t *testing.T) {
  function TestProviderGithubRegistry_GetAllVersion (line 40) | func TestProviderGithubRegistry_GetAllVersion(t *testing.T) {
  function TestProviderGithubRegistry_GetMetadata (line 46) | func TestProviderGithubRegistry_GetMetadata(t *testing.T) {
  function TestProviderGithubRegistry_GetSupplement (line 52) | func TestProviderGithubRegistry_GetSupplement(t *testing.T) {
  function TestProviderGithubRegistry_GetLatestVersion (line 58) | func TestProviderGithubRegistry_GetLatestVersion(t *testing.T) {
  function TestProviderGithubRegistry_CheckUpdate (line 64) | func TestProviderGithubRegistry_CheckUpdate(t *testing.T) {

FILE: pkg/registry/provider_local_registry.go
  type ProviderLocalRegistry (line 13) | type ProviderLocalRegistry struct
    method CheckUpdate (line 39) | func (x *ProviderLocalRegistry) CheckUpdate(ctx context.Context, provi...
    method GetMetadata (line 58) | func (x *ProviderLocalRegistry) GetMetadata(ctx context.Context, provi...
    method GetSupplement (line 67) | func (x *ProviderLocalRegistry) GetSupplement(ctx context.Context, pro...
    method GetLatestVersion (line 76) | func (x *ProviderLocalRegistry) GetLatestVersion(ctx context.Context, ...
    method GetAllVersion (line 85) | func (x *ProviderLocalRegistry) GetAllVersion(ctx context.Context, pro...
    method Download (line 98) | func (x *ProviderLocalRegistry) Download(ctx context.Context, provider...
    method Search (line 106) | func (x *ProviderLocalRegistry) Search(ctx context.Context, keyword st...
    method List (line 121) | func (x *ProviderLocalRegistry) List(ctx context.Context) ([]*Provider...
  function NewProviderLocalRegistry (line 20) | func NewProviderLocalRegistry(registryDirectory string, registryGitHubRe...

FILE: pkg/registry/provider_local_registry_test.go
  function newTestProviderLocalRegistry (line 13) | func newTestProviderLocalRegistry() *ProviderLocalRegistry {
  function TestProviderLocalRegistry_Download (line 38) | func TestProviderLocalRegistry_Download(t *testing.T) {
  function TestProviderLocalRegistry_List (line 46) | func TestProviderLocalRegistry_List(t *testing.T) {
  function TestProviderLocalRegistry_Search (line 52) | func TestProviderLocalRegistry_Search(t *testing.T) {
  function TestProviderLocalRegistry_GetAllVersion (line 58) | func TestProviderLocalRegistry_GetAllVersion(t *testing.T) {
  function TestProviderLocalRegistry_GetMetadata (line 64) | func TestProviderLocalRegistry_GetMetadata(t *testing.T) {
  function TestProviderLocalRegistry_GetSupplement (line 70) | func TestProviderLocalRegistry_GetSupplement(t *testing.T) {
  function TestProviderLocalRegistry_GetLatestVersion (line 76) | func TestProviderLocalRegistry_GetLatestVersion(t *testing.T) {
  function TestProviderLocalRegistry_CheckUpdate (line 82) | func TestProviderLocalRegistry_CheckUpdate(t *testing.T) {

FILE: pkg/registry/provider_registry.go
  constant ProvidersListDirectoryName (line 14) | ProvidersListDirectoryName = "provider"
  constant MetaDataFileName (line 15) | MetaDataFileName           = "metadata.yaml"
  constant SupplementFileName (line 16) | SupplementFileName         = "supplement.yaml"
  type Provider (line 21) | type Provider struct
  function NewProvider (line 25) | func NewProvider(providerName, providerVersion string) *Provider {
  function ParseProvider (line 32) | func ParseProvider(providerNameAndVersion string) *Provider {
  type ProviderMetadata (line 41) | type ProviderMetadata struct
    method HasVersion (line 49) | func (x *ProviderMetadata) HasVersion(version string) bool {
  type ProviderSupplement (line 58) | type ProviderSupplement struct
  type Checksums (line 64) | type Checksums struct
    method selectChecksums (line 73) | func (x *Checksums) selectChecksums() (string, error) {
  type ProviderRegistryDownloadOptions (line 110) | type ProviderRegistryDownloadOptions struct
  type ProviderRegistry (line 123) | type ProviderRegistry interface

FILE: pkg/selefra_workspace/device_id.go
  type DeviceInformation (line 16) | type DeviceInformation struct
  function GetDeviceID (line 27) | func GetDeviceID() (string, *schema.Diagnostics) {
  function EnsureDeviceIDExists (line 55) | func EnsureDeviceIDExists() *schema.Diagnostics {
  function GetDeviceInformationFilePath (line 81) | func GetDeviceInformationFilePath() (string, error) {

FILE: pkg/selefra_workspace/device_id_test.go
  function TestGetDeviceID (line 8) | func TestGetDeviceID(t *testing.T) {

FILE: pkg/selefra_workspace/workspace.go
  function GetSelefraWorkspaceDirectory (line 6) | func GetSelefraWorkspaceDirectory() (string, error) {

FILE: pkg/storage/pgstorage/constants.go
  constant LockId (line 3) | LockId = "selefra-fetch-lock"

FILE: pkg/storage/pgstorage/pgstorage.go
  type Option (line 16) | type Option
  function WithSearchPath (line 26) | func WithSearchPath(searchPath string) Option {
  function GetStorageValue (line 76) | func GetStorageValue(ctx context.Context, storage *postgresql_storage.Po...
  function SetStorageValue (line 87) | func SetStorageValue(ctx context.Context, storage *postgresql_storage.Po...
  function DefaultPostgreSQL (line 106) | func DefaultPostgreSQL(downloadWorkspace string, messageChannel *message...
  function GetSchemaKey (line 165) | func GetSchemaKey(providerName, providerVersion string, providerConfigur...

FILE: pkg/storage/pgstorage/schema_owner_information.go
  constant SchemaOwnerKey (line 13) | SchemaOwnerKey = "schema-owner-key"
  type SchemaOwnerInformation (line 16) | type SchemaOwnerInformation struct
  function GetSchemaOwner (line 31) | func GetSchemaOwner(ctx context.Context, storage storage.Storage) (*Sche...
  function SaveSchemaOwner (line 47) | func SaveSchemaOwner(ctx context.Context, storage storage.Storage, owner...

FILE: pkg/storage/pgstorage/schema_owner_information_test.go
  function getTestStorage (line 16) | func getTestStorage(t *testing.T) storage.Storage {
  function TestSaveSchemaOwner (line 26) | func TestSaveSchemaOwner(t *testing.T) {

FILE: pkg/storage/pgstorage/table_cache_information.go
  type TableCacheInformation (line 15) | type TableCacheInformation struct
  function ReadTableCacheInformation (line 28) | func ReadTableCacheInformation(ctx context.Context, storage storage.Stor...
  function SaveTableCacheInformation (line 46) | func SaveTableCacheInformation(ctx context.Context, storage storage.Stor...
  function BuildCacheKey (line 55) | func BuildCacheKey(tableName string) string {

FILE: pkg/storage/pgstorage/table_cache_information_test.go
  function TestReadTableCacheInformation (line 13) | func TestReadTableCacheInformation(t *testing.T) {

FILE: pkg/telemetry/analytics.go
  type Analytics (line 20) | type Analytics interface
  type Event (line 34) | type Event struct
    method SetName (line 46) | func (x *Event) SetName(name string) *Event {
    method Add (line 51) | func (x *Event) Add(name string, value any) *Event {
    method ToJsonString (line 56) | func (x *Event) ToJsonString() string {
  function NewEvent (line 39) | func NewEvent(name string) *Event {
  function Init (line 65) | func Init(ctx context.Context) *schema.Diagnostics {
  function Submit (line 75) | func Submit(ctx context.Context, event *Event) *schema.Diagnostics {
  function Close (line 93) | func Close(ctx context.Context) *schema.Diagnostics {

FILE: pkg/telemetry/analytics_test.go
  function TestSubmit (line 10) | func TestSubmit(t *testing.T) {

FILE: pkg/telemetry/rudderstack.go
  type RudderstackAnalytics (line 13) | type RudderstackAnalytics struct
    method Init (line 20) | func (x *RudderstackAnalytics) Init(ctx context.Context) *schema.Diagn...
    method Submit (line 37) | func (x *RudderstackAnalytics) Submit(ctx context.Context, event *Even...
    method Close (line 50) | func (x *RudderstackAnalytics) Close(ctx context.Context) *schema.Diag...

FILE: pkg/utils/browser.go
  function OpenBrowser (line 9) | func OpenBrowser(targetUrl string) (stdout string, stderr string, err er...

FILE: pkg/utils/browser_test.go
  function TestOpenBrowser (line 8) | func TestOpenBrowser(t *testing.T) {

FILE: pkg/utils/close.go
  function RegisterClose (line 5) | func RegisterClose(name string, close func()) {
  function MultiRegisterClose (line 9) | func MultiRegisterClose(m map[string]func()) {
  function Close (line 15) | func Close() {

FILE: pkg/utils/command.go
  function RunCommand (line 8) | func RunCommand(command string, args ...string) (stdout string, stderr s...

FILE: pkg/utils/file.go
  function Exists (line 12) | func Exists(filepath string) bool {
  function ExistsFile (line 20) | func ExistsFile(filepath string) bool {
  function ExistsDirectory (line 28) | func ExistsDirectory(directoryPath string) bool {
  function EnsureDirectoryExists (line 37) | func EnsureDirectoryExists(directoryPath string) error {
  function EnsureDirectoryNotExists (line 48) | func EnsureDirectoryNotExists(directoryPath string) error {
  function EnsureFileExists (line 57) | func EnsureFileExists(fileFullPath string, initBytes []byte) error {
  function ReadYamlFile (line 77) | func ReadYamlFile[T any](yamlFilePath string) (T, error) {
  function ReadJsonFile (line 109) | func ReadJsonFile[T any](jsonFilePath string) (T, error) {
  function WriteJsonFile (line 123) | func WriteJsonFile[T any](jsonFilePath string, v T) error {
  function AbsPath (line 131) | func AbsPath(path string) string {

FILE: pkg/utils/github.go
  function ParseGitHubRepoFullName (line 10) | func ParseGitHubRepoFullName(repoFullName string) (owner, repo string, e...

FILE: pkg/utils/home.go
  function Home (line 13) | func Home() (homeDir string, configPath string, err error) {
  function GetTempPath (line 50) | func GetTempPath() (string, error) {
  function CreateSource (line 66) | func CreateSource(path, version, latest string) (string, string) {

FILE: pkg/utils/lock.go
  function BuildLockOwnerId (line 10) | func BuildLockOwnerId() string {

FILE: pkg/utils/log.go
  function HasError (line 5) | func HasError(diagnostics *schema.Diagnostics) bool {
  function NotHasError (line 9) | func NotHasError(diagnostics *schema.Diagnostics) bool {
  function IsNotEmpty (line 13) | func IsNotEmpty(diagnostics *schema.Diagnostics) bool {
  function IsEmpty (line 17) | func IsEmpty(diagnostics *schema.Diagnostics) bool {

FILE: pkg/utils/openai.go
  constant GPT3Dot5Turbo (line 11) | GPT3Dot5Turbo = "gpt-3.5"
  constant GPT3 (line 12) | GPT3          = "gpt-3"
  constant GPT4 (line 13) | GPT4          = "gpt-4"
  function OpenApiClient (line 169) | func OpenApiClient(ctx context.Context, sk string, mode string, promptTy...
  function GPT3Dot5TurboFunc (line 184) | func GPT3Dot5TurboFunc(ctx context.Context, client *openai.Client, promp...
  function GPT4TurboFunc (line 206) | func GPT4TurboFunc(ctx context.Context, client *openai.Client, prompt st...
  function GPT3Func (line 228) | func GPT3Func(ctx context.Context, client *openai.Client, Prompt string)...

FILE: pkg/utils/reg.go
  function DeleteExtraSpace (line 5) | func DeleteExtraSpace(s string) string {

FILE: pkg/utils/request.go
  type Header (line 11) | type Header struct
  function Request (line 16) | func Request(ctx context.Context, method string, _url string, body []byt...

FILE: pkg/utils/slice.go
  function FindFirstSameKeyInTwoStringArray (line 3) | func FindFirstSameKeyInTwoStringArray(a []string, b []string) string {

FILE: pkg/utils/strava.go
  function StringToUint64 (line 11) | func StringToUint64(string2 string) uint64 {
  function Strava (line 16) | func Strava(value interface{}) string {
  function RemoveRepeatedElement (line 75) | func RemoveRepeatedElement(arr []string) (newArr []string) {
  function GenerateString (line 92) | func GenerateString(leftVar, middleVar, rightVar string) string {
  function HasOne (line 109) | func HasOne(arr []string, key string) bool {

FILE: pkg/utils/template.go
  function RenderingTemplate (line 9) | func RenderingTemplate[T any](templateName, templateString string, data ...

FILE: pkg/utils/terminal_other.go
  function getTerminalWidth (line 13) | func getTerminalWidth() (int, error) {

FILE: pkg/utils/terminal_win.go
  function getTerminalWidth (line 12) | func getTerminalWidth() (int, error) {

FILE: pkg/version/version.go
  constant VersionLatest (line 13) | VersionLatest = "latest"
  constant NameVersionDelimiter (line 16) | NameVersionDelimiter = "@"
  type NameAndVersion (line 22) | type NameAndVersion struct
    method IsLatestVersion (line 52) | func (x *NameAndVersion) IsLatestVersion() bool {
    method String (line 56) | func (x *NameAndVersion) String() string {
  function NewNameAndVersion (line 27) | func NewNameAndVersion(name, version string) *NameAndVersion {
  function ParseNameAndVersion (line 35) | func ParseNameAndVersion(nameAndVersion string) *NameAndVersion {
  function Sort (line 66) | func Sort(versionsRaw []string) []string {
  function IsConstraintsAllow (line 88) | func IsConstraintsAllow(constraints version.Constraints, version *versio...
  function IsLatestVersion (line 99) | func IsLatestVersion(versionString string) bool {
Condensed preview — 310 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,208K chars).
[
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.yaml",
    "chars": 1352,
    "preview": "name: 🐛 Bug report\ndescription: Report a bug to help us improve selefra\ntitle: \"[Bug]: \"\nlabels: [bug]\nassignees:\n  - se"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yaml",
    "chars": 224,
    "preview": "blank_issues_enabled: true\ncontact_links:\n  - name: Ask a Question on Selefra Community\n    url: https://www.selefra.io/"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature-request.yaml",
    "chars": 1613,
    "preview": "name: 🚀 Feature Request\ndescription: Suggest a new feature or improvement\ntitle: \"[Feature]: \"\nlabels: [feature]\nassigne"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 969,
    "preview": "## Description\nBriefly describe the changes and improvements you have made.\n\n## Related Issues or Feature Requests\nList "
  },
  {
    "path": ".github/workflows/ci.yaml",
    "chars": 1920,
    "preview": "name: CI\n\non:\n  pull_request:\n  push:\n\njobs:\n  selefra_test:\n    name: go test\n    runs-on: ubuntu-latest\n    services:\n"
  },
  {
    "path": ".github/workflows/release.yaml",
    "chars": 2082,
    "preview": "name: release\n\non:\n  release:\n    types: [ created, edited ]\n\njobs:\n  selefra_release:\n    name: Build\n    runs-on: ubun"
  },
  {
    "path": ".gitignore",
    "chars": 63,
    "preview": ".idea/*\n.DS_Store\n*.log\n*.exe\n**/test_download/*\n**/*.log\ntest\n"
  },
  {
    "path": ".goreleaser.yml",
    "chars": 1079,
    "preview": "project_name: selefra\nbuilds:\n  - env: [ CGO_ENABLED=0 ]\n    goos:\n      - linux\n      - windows\n      - darwin\n    goar"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 1421,
    "preview": "# Contributor Code of Conduct\n\nAs contributors and maintainers of this project, we pledge to respect all people who cont"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 5843,
    "preview": "<!-- Your Title -->\n<p align=\"center\">\n<a href=\"https://www.selefra.io/\" target=\"_blank\">\n<picture><source media=\"(prefe"
  },
  {
    "path": "Dockerfile",
    "chars": 490,
    "preview": "FROM golang:1.20\n\nENV DEBIAN_FRONTEND noninteractive\n\nRUN apt-get update && apt-get install -y postgresql postgresql-con"
  },
  {
    "path": "LICENSE",
    "chars": 16725,
    "preview": "Mozilla Public License Version 2.0\n==================================\n\n1. Definitions\n--------------\n\n1.1. \"Contributor\""
  },
  {
    "path": "Makefile",
    "chars": 406,
    "preview": "news.ycombinator.com\ngithub.com\nfreecodecamp.org\npublickey1.jp\nthenewstack.io\napi.daily.dev\nroadmap.sh\ndev.to\nstatics.te"
  },
  {
    "path": "README.md",
    "chars": 13763,
    "preview": "<!-- Your Title -->\n<p align=\"center\">\n<a href=\"https://www.selefra.io/\" target=\"_blank\">\n<picture><source media=\"(prefe"
  },
  {
    "path": "SECURITY.md",
    "chars": 619,
    "preview": "# Security Policy\n\n## Supported Versions\n\nUse this section to tell people about which versions of your project are\ncurre"
  },
  {
    "path": "cli_ui/client.go",
    "chars": 1366,
    "preview": "package cli_ui\n\n//import (\n//\t\"context\"\n//\t\"errors\"\n//\t\"github.com/google/uuid\"\n//\t\"github.com/selefra/selefra-provider-"
  },
  {
    "path": "cli_ui/print.go",
    "chars": 7496,
    "preview": "package cli_ui\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/hashicorp/go-hclog\"\n\t\"runtime\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/fati"
  },
  {
    "path": "cli_ui/progress.go",
    "chars": 2956,
    "preview": "package cli_ui\n\nimport (\n\t\"github.com/vbauerster/mpb/v7\"\n\t\"github.com/vbauerster/mpb/v7/decor\"\n\t\"io\"\n\t\"strings\"\n\t\"sync\"\n"
  },
  {
    "path": "cli_ui/select_providers.go",
    "chars": 3152,
    "preview": "package cli_ui\n\nimport (\n\tui \"github.com/gizak/termui/v3\"\n\t\"github.com/gizak/termui/v3/widgets\"\n\t\"log\"\n)\n\nconst DefaultS"
  },
  {
    "path": "cli_ui/select_providers_test.go",
    "chars": 497,
    "preview": "package cli_ui\n\nimport (\n\t\"testing\"\n)\n\nfunc TestSelectProviders(t *testing.T) {\n\t//providers := []string{\n\t//\t\"aws\",\n\t//"
  },
  {
    "path": "cli_ui/table.go",
    "chars": 1367,
    "preview": "package cli_ui\n\nimport (\n\t\"fmt\"\n\t\"github.com/olekukonko/tablewriter\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// ShowTable Shows w"
  },
  {
    "path": "cli_ui/table_test.go",
    "chars": 1272,
    "preview": "package cli_ui\n\nfunc ExampleShowRows() {\n\n\ttableHeader := []string{\n\t\t\"id\", \"name\", \"age\",\n\t}\n\ttableBody := [][]string{\n"
  },
  {
    "path": "cli_ui/user.go",
    "chars": 3605,
    "preview": "package cli_ui\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/"
  },
  {
    "path": "cmd/apply/apply.go",
    "chars": 3589,
    "preview": "package apply\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selef"
  },
  {
    "path": "cmd/apply/apply_test.go",
    "chars": 519,
    "preview": "package apply\n\nimport (\n\t\"context\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestApply(t *testing.T) {\n\t/"
  },
  {
    "path": "cmd/apply/test_data/test_query_module/modules.yaml",
    "chars": 53,
    "preview": "modules:\n  - name: Misconfigure-S3\n    uses: ./rules\n"
  },
  {
    "path": "cmd/apply/test_data/test_query_module/rules/rule.yaml",
    "chars": 887,
    "preview": "rules:\n  - name: ebs_encryption_is_disabled_by_default\n    query: |\n      SELECT\n        *\n      FROM\n        aws_ec2_re"
  },
  {
    "path": "cmd/apply/test_data/test_query_module/selefra.yaml",
    "chars": 537,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n  #    hostname: app.selefra.io\n  connectio"
  },
  {
    "path": "cmd/fetch/fetch.go",
    "chars": 2106,
    "preview": "package fetch\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selef"
  },
  {
    "path": "cmd/fetch/fetch_test.go",
    "chars": 208,
    "preview": "package fetch\n\nimport (\n\t\"testing\"\n)\n\nfunc TestFetch(t *testing.T) {\n\tprojectWorkspace := \"./test_data/test_fetch_module"
  },
  {
    "path": "cmd/fetch/test_data/test_fetch_module/modules.yaml",
    "chars": 515,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n    hostname: app.selefra.io\n  #  connectio"
  },
  {
    "path": "cmd/gpt/gpt.go",
    "chars": 3748,
    "preview": "package gpt\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selef"
  },
  {
    "path": "cmd/gpt/gpt_test.go",
    "chars": 685,
    "preview": "package gpt\n\nimport (\n\t\"context\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestGpt(t *testing.T) {\n\t//pro"
  },
  {
    "path": "cmd/gpt/test_data/test_query_module/modules.yaml",
    "chars": 837,
    "preview": "selefra:\n  openai_api_key: openkey\n  openai_mode: gpt-3.5\n  openai_limit: 10\n  cloud:\n    project: example_project\n    o"
  },
  {
    "path": "cmd/init/init.go",
    "chars": 4621,
    "preview": "package init\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/selefra/selefra-"
  },
  {
    "path": "cmd/init/init_command_executor.go",
    "chars": 20231,
    "preview": "package init\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/g"
  },
  {
    "path": "cmd/init/init_command_executor_test.go",
    "chars": 462,
    "preview": "package init\n\nimport (\n\t\"context\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"os\"\n\t\"testing\"\n)\n\nfunc TestInitCommandExecutor"
  },
  {
    "path": "cmd/init/init_test.go",
    "chars": 405,
    "preview": "package init\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/stretchr/testify/assert\"\n\t"
  },
  {
    "path": "cmd/init/rule_example/aws.yaml",
    "chars": 2581,
    "preview": "rules:\n  - name: mfa_delete_is_disable\n    query: |-\n      SELECT\n        *\n      FROM\n        aws_s3_buckets\n      WHER"
  },
  {
    "path": "cmd/init/rule_example/azure.yaml",
    "chars": 2800,
    "preview": "rules:\n  - name: secure_transfer_required_is_set_to_disabled\n    query: |-\n      SELECT\n        *\n      FROM\n        azu"
  },
  {
    "path": "cmd/init/rule_example/data.go",
    "chars": 253,
    "preview": "package rule_example\n\nimport (\n\t_ \"embed\"\n)\n\n//go:embed aws.yaml\nvar Aws string\n\n//go:embed azure.yaml\nvar Azure string\n"
  },
  {
    "path": "cmd/init/rule_example/default_template.yaml",
    "chars": 239,
    "preview": "#rules:\n#  - name: here_is_the_name_of_your_rule\n#    query: |-\n#      SELECT\n#        *\n#      FROM\n#        demo_table"
  },
  {
    "path": "cmd/init/rule_example/gcp.yaml",
    "chars": 2861,
    "preview": "rules:\n  - name: bucket_does_not_have_uniform_bucket_level_access_enabled\n    query: |-\n      SELECT\n        *\n      FRO"
  },
  {
    "path": "cmd/init/rule_example/k8s.yaml",
    "chars": 1699,
    "preview": "rules:\n  - name: cronjob_cpu_no_limit\n    query: |-\n      SELECT\n        a1.*\n      FROM\n        k8s_batch_cron_jobs AS "
  },
  {
    "path": "cmd/init/test_data/init.sh",
    "chars": 1148,
    "preview": "#!/usr/bin/env bash\n####################################################################################################"
  },
  {
    "path": "cmd/login/login.go",
    "chars": 2019,
    "preview": "package login\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/cli_ui\"\n"
  },
  {
    "path": "cmd/login/login_test.go",
    "chars": 157,
    "preview": "package login\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestRunFunc(t *testing.T) {\n\terr := Run"
  },
  {
    "path": "cmd/login/test_data/login.sh",
    "chars": 1151,
    "preview": "#!/usr/bin/env bash\n####################################################################################################"
  },
  {
    "path": "cmd/logout/logout.go",
    "chars": 1330,
    "preview": "package logout\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/cli_ui\""
  },
  {
    "path": "cmd/logout/logout_test.go",
    "chars": 158,
    "preview": "package logout\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestRunFunc(t *testing.T) {\n\terr := Ru"
  },
  {
    "path": "cmd/logout/test_data/logout.sh",
    "chars": 1154,
    "preview": "#!/usr/bin/env bash\n####################################################################################################"
  },
  {
    "path": "cmd/module/get.go",
    "chars": 17,
    "preview": "package module\n\n\n"
  },
  {
    "path": "cmd/module/list.go",
    "chars": 15,
    "preview": "package module\n"
  },
  {
    "path": "cmd/module/search.go",
    "chars": 15,
    "preview": "package module\n"
  },
  {
    "path": "cmd/module/tidy.go",
    "chars": 17,
    "preview": "package module\n\n\n"
  },
  {
    "path": "cmd/provider/install.go",
    "chars": 5579,
    "preview": "package provider\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/se"
  },
  {
    "path": "cmd/provider/install_online_test.go",
    "chars": 523,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestInstallO"
  },
  {
    "path": "cmd/provider/install_test.go",
    "chars": 843,
    "preview": "package provider\n\nimport (\n\t\"context\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n//import (\n//\t\"context\"\n//\t\"gi"
  },
  {
    "path": "cmd/provider/list.go",
    "chars": 1651,
    "preview": "package provider\n\nimport (\n\t\"github.com/selefra/selefra/cli_ui\"\n\t\"github.com/selefra/selefra/config\"\n\t\"github.com/selefr"
  },
  {
    "path": "cmd/provider/list_online_test.go",
    "chars": 443,
    "preview": "package provider\n\n//import (\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestListOnline(t *testing"
  },
  {
    "path": "cmd/provider/list_test.go",
    "chars": 411,
    "preview": "package provider\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n//import (\n//\t\"github.com/selefra/selefra"
  },
  {
    "path": "cmd/provider/provider.go",
    "chars": 540,
    "preview": "package provider\n\nimport (\n\t\"github.com/spf13/cobra\"\n)\n\nfunc NewProviderCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t"
  },
  {
    "path": "cmd/provider/remove.go",
    "chars": 2817,
    "preview": "package provider\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra/cli_ui\"\n\t\"github.com/selefra/selefra/config\"\n\t\"github"
  },
  {
    "path": "cmd/provider/remove_online_test.go",
    "chars": 581,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestRemoveOn"
  },
  {
    "path": "cmd/provider/remove_test.go",
    "chars": 711,
    "preview": "package provider\n\nimport (\n\t\"context\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n//import (\n//\t\"context\"\n//\t\"gi"
  },
  {
    "path": "cmd/provider/sync.go",
    "chars": 5181,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"fmt\"\n//\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n//\t\"gith"
  },
  {
    "path": "cmd/provider/sync_online_test.go",
    "chars": 431,
    "preview": "package provider\n\n//func TestSyncOnline(t *testing.T) {\n//\tif testing.Short() {\n//\t\tt.Skip(\"skipping test in short mode."
  },
  {
    "path": "cmd/provider/sync_test.go",
    "chars": 618,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/config\"\n//\t\"github.com/selefra/selefra/global\"\n"
  },
  {
    "path": "cmd/provider/test_data/provider.sh",
    "chars": 1160,
    "preview": "#!/usr/bin/env bash\n####################################################################################################"
  },
  {
    "path": "cmd/provider/update.go",
    "chars": 1904,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/cli_ui\"\n//\t\"github.com/selefra/selefra/cmd/fetc"
  },
  {
    "path": "cmd/provider/update_online_test.go",
    "chars": 527,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestUpdateOn"
  },
  {
    "path": "cmd/provider/update_test.go",
    "chars": 348,
    "preview": "package provider\n\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestUpdate(t"
  },
  {
    "path": "cmd/query/client.go",
    "chars": 5392,
    "preview": "package query\n\nimport (\n\t\"context\"\n\t\"github.com/c-bata/go-prompt\"\n\t\"github.com/selefra/selefra-provider-sdk/storage\"\n\t\"g"
  },
  {
    "path": "cmd/query/client_test.go",
    "chars": 2874,
    "preview": "package query\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/selefra/selefra-provider-"
  },
  {
    "path": "cmd/query/parse.go",
    "chars": 576,
    "preview": "package query\n\n//import (\n//\t\"github.com/blastrain/vitess-sqlparser/sqlparser\"\n//)\n//\n//// UnknownType 0\n//// Select 1\n/"
  },
  {
    "path": "cmd/query/query.go",
    "chars": 4878,
    "preview": "package query\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/selefra/selefra"
  },
  {
    "path": "cmd/query/query_test.go",
    "chars": 15,
    "preview": "package query\n\n"
  },
  {
    "path": "cmd/query/sql.go",
    "chars": 290,
    "preview": "package query\n\nconst TABLESQL = \"SELECT tablename FROM pg_tables where schemaname = 'public' and tablename<>'pg_stat_sta"
  },
  {
    "path": "cmd/query/test_data/query.sh",
    "chars": 1151,
    "preview": "#!/usr/bin/env bash\n####################################################################################################"
  },
  {
    "path": "cmd/root.go",
    "chars": 4090,
    "preview": "package cmd\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra/cli_ui\"\n\t\"github.com/selefra/selefra/cmd/apply\"\n\t\"github.com/s"
  },
  {
    "path": "cmd/tools/providers.go",
    "chars": 5641,
    "preview": "package tools\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/storage/database_storage/postgresql_storage"
  },
  {
    "path": "cmd/tools/providers_online_test.go",
    "chars": 3457,
    "preview": "package tools\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra/config\"\n\t\"github.com/selefra/selefra/global\"\n\t\"github.co"
  },
  {
    "path": "cmd/tools/providers_test.go",
    "chars": 3363,
    "preview": "package tools\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra/config\"\n\t\"github.com/selefra/selefra/global\"\n\t\"github.co"
  },
  {
    "path": "cmd/version/version.go",
    "chars": 504,
    "preview": "package version\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra/global\"\n\t\"github.com/spf13/cobra\"\n)\n\nvar Version = \"{{vers"
  },
  {
    "path": "cmd/version/version_test.go",
    "chars": 81,
    "preview": "package version\n\nimport \"testing\"\n\nfunc TestVersion(t *testing.T) {\n\tversion()\n}\n"
  },
  {
    "path": "config/config.go",
    "chars": 34310,
    "preview": "package config\n\nimport (\n\t\"fmt\"\n\t\"github.com/mitchellh/go-homedir\"\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"gopkg.in/ya"
  },
  {
    "path": "config/config_test.go",
    "chars": 1871,
    "preview": "package config\n//\n//import (\n//\t\"github.com/selefra/selefra/global\"\n//\t\"testing\"\n//)\n//\n//func TestGetAllConfig(t *testi"
  },
  {
    "path": "config/downloader.go",
    "chars": 1459,
    "preview": "package config\n\n//import (\n//\t\"fmt\"\n//\t\"io\"\n//\t\"net/http\"\n//\t\"net/url\"\n//)\n//\n//type Downloader struct {\n//\tUrl string `"
  },
  {
    "path": "config/downloader_test.go",
    "chars": 430,
    "preview": "package config\n\n//import (\n//\t\"fmt\"\n//\t\"testing\"\n//)\n//\n//func TestDownloader_Get(t *testing.T) {\n//\td := Downloader{Url"
  },
  {
    "path": "global/flag.go",
    "chars": 3419,
    "preview": "package global\n\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/spf13/cobra\"\n)\n\ntype Option func(variable *Variable)\n\n//"
  },
  {
    "path": "global/flag_test.go",
    "chars": 699,
    "preview": "package global\n\nimport (\n\t\"github.com/spf13/cobra\"\n\t\"github.com/stretchr/testify/require\"\n\t\"testing\"\n)\n\nfunc Test_Variab"
  },
  {
    "path": "go.mod",
    "chars": 7091,
    "preview": "module github.com/selefra/selefra\n\ngo 1.19\n\nrequire (\n\tgithub.com/aws/aws-sdk-go v1.44.149 // indirect\n\tgithub.com/c-bat"
  },
  {
    "path": "go.sum",
    "chars": 135231,
    "preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
  },
  {
    "path": "install.sh",
    "chars": 5956,
    "preview": "#!/bin/bash\n############################################################################################################"
  },
  {
    "path": "main.go",
    "chars": 855,
    "preview": "/*\nCopyright © 2022 NAME HERE <EMAIL ADDRESS>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may n"
  },
  {
    "path": "pkg/cli_env/env.go",
    "chars": 2242,
    "preview": "package cli_env\n\nimport (\n\t\"os\"\n\t\"strings\"\n)\n\nconst SelefraCloudFlag = \"SELEFRA_CLOUD_FLAG\"\n\n// IsCloudEnv Check whether"
  },
  {
    "path": "pkg/cli_runtime/runtime.go",
    "chars": 4366,
    "preview": "package cli_runtime\n//\n//import (\n//\t\"context\"\n//\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n//\t\"github.c"
  },
  {
    "path": "pkg/cloud_sdk/client.go",
    "chars": 4710,
    "preview": "package cloud_sdk\n\n//import (\n//\t\"context\"\n//\t\"fmt\"\n//\t\"github.com/selefra/selefra/global\"\n//\t\"github.com/selefra/selefr"
  },
  {
    "path": "pkg/cloud_sdk/credentials.go",
    "chars": 2744,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/conf"
  },
  {
    "path": "pkg/cloud_sdk/dsn.go",
    "chars": 1044,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/pkg/"
  },
  {
    "path": "pkg/cloud_sdk/dsn_test.go",
    "chars": 323,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n"
  },
  {
    "path": "pkg/cloud_sdk/errors.go",
    "chars": 101,
    "preview": "package cloud_sdk\n\nimport \"errors\"\n\nvar (\n\tErrYouAreNotLogin = errors.New(\"you are not logged in\")\n)\n"
  },
  {
    "path": "pkg/cloud_sdk/project.go",
    "chars": 3640,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/pkg/"
  },
  {
    "path": "pkg/cloud_sdk/project_test.go",
    "chars": 421,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-utils/pkg/id_util\"\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"gi"
  },
  {
    "path": "pkg/cloud_sdk/sdk.go",
    "chars": 10264,
    "preview": "package cloud_sdk\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\tselefraGrpc \"github.c"
  },
  {
    "path": "pkg/cloud_sdk/sdk_test.go",
    "chars": 4213,
    "preview": "package cloud_sdk\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/se"
  },
  {
    "path": "pkg/cloud_sdk/task.go",
    "chars": 2274,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/pkg/"
  },
  {
    "path": "pkg/cloud_sdk/task_test.go",
    "chars": 532,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra-utils/pkg/id_util\"\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"gi"
  },
  {
    "path": "pkg/cloud_sdk/test_data/sync_workspace/a.yml",
    "chars": 9,
    "preview": "a: b\nc: d"
  },
  {
    "path": "pkg/cloud_sdk/test_data/sync_workspace/b.yml",
    "chars": 19,
    "preview": "ff: fff\nooo: asdasd"
  },
  {
    "path": "pkg/cloud_sdk/user.go",
    "chars": 5548,
    "preview": "package cloud_sdk\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/s"
  },
  {
    "path": "pkg/cloud_sdk/user_test.go",
    "chars": 767,
    "preview": "package cloud_sdk\n\nimport (\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n"
  },
  {
    "path": "pkg/cloud_sdk/workspace.go",
    "chars": 3308,
    "preview": "package cloud_sdk\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/s"
  },
  {
    "path": "pkg/cloud_sdk/workspace_test.go",
    "chars": 567,
    "preview": "package cloud_sdk\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-utils/pkg/id_util\"\n\t\"github.com/selefra/selefra/pkg/"
  },
  {
    "path": "pkg/debug/debug.go",
    "chars": 2854,
    "preview": "package debug\n\nimport (\n\t\"errors\"\n\t\"github.com/natefinch/lumberjack\"\n\t\"github.com/selefra/selefra/pkg/utils\"\n\t\"go.uber.o"
  },
  {
    "path": "pkg/debug/debug_test.go",
    "chars": 287,
    "preview": "package debug\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestNewSamplingService(t *testi"
  },
  {
    "path": "pkg/grpc/pb/cloud/cloud.pb.go",
    "chars": 44732,
    "preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc        v3.21.8\n// sou"
  },
  {
    "path": "pkg/grpc/pb/cloud/cloud.proto",
    "chars": 1944,
    "preview": "syntax = \"proto3\";\noption go_package = \"proto/cloud\";\npackage cloud;\nimport \"common/common.proto\";\n// protoc --proto_pat"
  },
  {
    "path": "pkg/grpc/pb/cloud/cloud_grpc.pb.go",
    "chars": 12117,
    "preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc           "
  },
  {
    "path": "pkg/grpc/pb/common/common.pb.go",
    "chars": 6604,
    "preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc        v3.21.8\n// sou"
  },
  {
    "path": "pkg/grpc/pb/common/common.proto",
    "chars": 408,
    "preview": "syntax = \"proto3\";\noption go_package = \"proto/common\";\npackage common;\n\n//protoc --proto_path=pkg/grpc/pb --go_out=pkg/g"
  },
  {
    "path": "pkg/grpc/pb/issue/issue.pb.go",
    "chars": 32718,
    "preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc        v3.21.8\n// sou"
  },
  {
    "path": "pkg/grpc/pb/issue/issue.proto",
    "chars": 1795,
    "preview": "syntax = \"proto3\";\noption go_package = \"github.com/selefra/selefra-cloud/pkg/grpc/pb/issue;issue\";\n\npackage issue;\n// pr"
  },
  {
    "path": "pkg/grpc/pb/issue/issue_grpc.pb.go",
    "chars": 4298,
    "preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc           "
  },
  {
    "path": "pkg/grpc/pb/log/log.pb.go",
    "chars": 22701,
    "preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc        v3.21.8\n// sou"
  },
  {
    "path": "pkg/grpc/pb/log/log.proto",
    "chars": 1428,
    "preview": "syntax = \"proto3\";\noption go_package = \"proto/log\";\npackage log;\nimport \"google/protobuf/timestamp.proto\";\nimport \"commo"
  },
  {
    "path": "pkg/grpc/pb/log/log_grpc.pb.go",
    "chars": 5598,
    "preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc           "
  },
  {
    "path": "pkg/grpc/pb/log/transport.go",
    "chars": 586,
    "preview": "package log\n\nimport (\n\t\"time\"\n\n\t\"github.com/songzhibin97/gkit/coding\"\n\t_ \"github.com/songzhibin97/gkit/coding/json\"\n)\n\nv"
  },
  {
    "path": "pkg/grpc/pb/log/transport_test.go",
    "chars": 315,
    "preview": "package log\n\nimport (\n\t\"testing\"\n\n\t\"google.golang.org/protobuf/types/known/timestamppb\"\n)\n\nfunc TestTransportWsMsg(t *te"
  },
  {
    "path": "pkg/grpc/stream_uploader.go",
    "chars": 9298,
    "preview": "package grpc\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefr"
  },
  {
    "path": "pkg/grpc/stream_uploader_test.go",
    "chars": 2045,
    "preview": "package grpc\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra"
  },
  {
    "path": "pkg/grpc/tripartite/google/protobuf/timestamp.proto",
    "chars": 6459,
    "preview": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://de"
  },
  {
    "path": "pkg/http_client/getter.go",
    "chars": 2738,
    "preview": "package http_client\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"os\"\n\t\"time\"\n\n\tgetter \"github.com/hashicorp/go-getter\"\n)\n\ntype Det"
  },
  {
    "path": "pkg/http_client/github_repo_downloader.go",
    "chars": 3337,
    "preview": "package http_client\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/hashicorp/go-getter\"\n\t\"github.com/selefra/"
  },
  {
    "path": "pkg/http_client/requests.go",
    "chars": 10101,
    "preview": "package http_client\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/prov"
  },
  {
    "path": "pkg/logger/config.go",
    "chars": 4732,
    "preview": "package logger\n\nimport (\n\t\"github.com/natefinch/lumberjack\"\n\t\"github.com/selefra/selefra/global\"\n\t\"go.uber.org/zap\"\n\t\"go"
  },
  {
    "path": "pkg/logger/hc.go",
    "chars": 2165,
    "preview": "package logger\n\nimport (\n\t\"fmt\"\n\t\"github.com/hashicorp/go-hclog\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n)\n\n// Log"
  },
  {
    "path": "pkg/logger/logger.go",
    "chars": 1346,
    "preview": "package logger\n\nimport (\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\n// Logger Logs used in "
  },
  {
    "path": "pkg/logger/schema.go",
    "chars": 2293,
    "preview": "package logger\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"go.uber.org/zap\"\n)\n\n// Sele"
  },
  {
    "path": "pkg/message/message.go",
    "chars": 2113,
    "preview": "package message\n\nimport (\n\t\"github.com/selefra/selefra-utils/pkg/reflect_util\"\n\t\"sync\"\n)\n\n// Channel Used to link multip"
  },
  {
    "path": "pkg/message/message_test.go",
    "chars": 444,
    "preview": "package message\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestNewChannel(t *testing.T) {\n\tchannel := NewChannel[string"
  },
  {
    "path": "pkg/modules/executors/executor.go",
    "chars": 230,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n)\n\n// Executor Used to"
  },
  {
    "path": "pkg/modules/executors/module_query_executor.go",
    "chars": 32736,
    "preview": "package executors\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/hashicorp/go-getter\"\n\t\"github.com/s"
  },
  {
    "path": "pkg/modules/executors/module_query_executor_test.go",
    "chars": 1650,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/s"
  },
  {
    "path": "pkg/modules/executors/project_cloud_life_cycle_executor.go",
    "chars": 15846,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/se"
  },
  {
    "path": "pkg/modules/executors/project_local_life_cycle_executor.go",
    "chars": 17238,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/selefra/selefra-provi"
  },
  {
    "path": "pkg/modules/executors/provider_fetch_executor.go",
    "chars": 25350,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/grpc/"
  },
  {
    "path": "pkg/modules/executors/provider_fetch_executor_test.go",
    "chars": 2346,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/env\"\n\t\"github.com/selefra/selefra-provi"
  },
  {
    "path": "pkg/modules/executors/provider_install_executor.go",
    "chars": 3753,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/hashicorp/go-getter\"\n\t\"github.com/selefra/selefra-provider-sdk/provi"
  },
  {
    "path": "pkg/modules/executors/provider_install_executor_test.go",
    "chars": 1412,
    "preview": "package executors\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/s"
  },
  {
    "path": "pkg/modules/executors/test_data/test_fetch_module/modules.yaml",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "pkg/modules/executors/test_data/test_fetch_module_with_cache/modules.yaml",
    "chars": 557,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n    hostname: app.selefra.io\n  #  connectio"
  },
  {
    "path": "pkg/modules/executors/test_data/test_query_module/modules.yaml",
    "chars": 525,
    "preview": "#rules:\n#  - name: bucket_versioning_is_disabled\n#    query: \"Please help me analyze the vulnerabilities in AWS S3?\"\n#  "
  },
  {
    "path": "pkg/modules/local_modules_manager/manager.go",
    "chars": 306,
    "preview": "package local_modules_manager\n\n// LocalModuleManager Manage the cache of locally downloaded modules\ntype LocalModuleMana"
  },
  {
    "path": "pkg/modules/local_modules_manager/manager_get.go",
    "chars": 144,
    "preview": "package local_modules_manager\n\nimport \"github.com/selefra/selefra/pkg/registry\"\n\nfunc (x *LocalModuleManager) Get(module"
  },
  {
    "path": "pkg/modules/local_modules_manager/manager_list.go",
    "chars": 72,
    "preview": "package local_modules_manager\n\nfunc (x *LocalModuleManager) List() {\n\n}\n"
  },
  {
    "path": "pkg/modules/local_modules_manager/manager_search.go",
    "chars": 74,
    "preview": "package local_modules_manager\n\nfunc (x *LocalModuleManager) Search() {\n\n}\n"
  },
  {
    "path": "pkg/modules/local_modules_manager/manager_tidy.go",
    "chars": 71,
    "preview": "package local_modules_manager\n\nfunc (x *LocalModuleManager) Tidy() {\n\n}"
  },
  {
    "path": "pkg/modules/local_modules_manager/manager_update.go",
    "chars": 74,
    "preview": "package local_modules_manager\n\nfunc (x *LocalModuleManager) Update() {\n\n}\n"
  },
  {
    "path": "pkg/modules/module/block.go",
    "chars": 1870,
    "preview": "package module\n\nimport (\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n)\n\n// ------------------------------"
  },
  {
    "path": "pkg/modules/module/errors.go",
    "chars": 3210,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/fatih/color\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nvar (\n\tErrNotSupport = \"not sup"
  },
  {
    "path": "pkg/modules/module/locatable.go",
    "chars": 5100,
    "preview": "package module\n\nimport (\n\t\"github.com/golang-infrastructure/go-trie\"\n\t\"gopkg.in/yaml.v3\"\n\t\"os\"\n\t\"strings\"\n\t\"unicode/utf8"
  },
  {
    "path": "pkg/modules/module/locatable_test.go",
    "chars": 312,
    "preview": "package module\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc Test_baseYamlSelector(t *testing.T) {\n"
  },
  {
    "path": "pkg/modules/module/module.go",
    "chars": 6690,
    "preview": "package module\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selef"
  },
  {
    "path": "pkg/modules/module/modules_block.go",
    "chars": 4311,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n)\n\n// -----------------------"
  },
  {
    "path": "pkg/modules/module/providers_block.go",
    "chars": 9597,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra-"
  },
  {
    "path": "pkg/modules/module/providers_block_test.go",
    "chars": 1843,
    "preview": "package module\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"gopkg.in/yaml.v3\"\n\t\"testing\"\n)\n\nfunc TestProviderBlock_"
  },
  {
    "path": "pkg/modules/module/rules_block.go",
    "chars": 8575,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"strings\"\n)\n\n// ------------"
  },
  {
    "path": "pkg/modules/module/selefra_block.go",
    "chars": 17957,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra/"
  },
  {
    "path": "pkg/modules/module/validator.go",
    "chars": 3696,
    "preview": "package module\n\nimport (\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n)\n\n// ------------------------------------------------- ---------"
  },
  {
    "path": "pkg/modules/module/validator_test.go",
    "chars": 217,
    "preview": "package module\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestParseDuration(t *testing.T) {\n\ts :"
  },
  {
    "path": "pkg/modules/module/variables_block.go",
    "chars": 4257,
    "preview": "package module\n\nimport (\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selefra/selefra-"
  },
  {
    "path": "pkg/modules/module_loader/github_registry_module_loader.go",
    "chars": 4947,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.co"
  },
  {
    "path": "pkg/modules/module_loader/github_registry_module_loader_test.go",
    "chars": 1085,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selef"
  },
  {
    "path": "pkg/modules/module_loader/local_directory_module_loader.go",
    "chars": 12409,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t"
  },
  {
    "path": "pkg/modules/module_loader/local_directory_module_loader_test.go",
    "chars": 1029,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selef"
  },
  {
    "path": "pkg/modules/module_loader/module_loader.go",
    "chars": 2511,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"github.com/hashicorp/go-getter\"\n\t\"github.com/selefra/selefra-provider-sdk/p"
  },
  {
    "path": "pkg/modules/module_loader/module_loader_manager.go",
    "chars": 1789,
    "preview": "package module_loader\n\nimport (\n\t\"regexp\"\n\t\"strings\"\n)\n\n// ------------------------------------------------- -----------"
  },
  {
    "path": "pkg/modules/module_loader/module_loader_manager_test.go",
    "chars": 183,
    "preview": "package module_loader\n\nimport (\n\t\"testing\"\n)\n\nfunc TestNewModuleLoaderBySource(t *testing.T) {\n\tsource := NewModuleLoade"
  },
  {
    "path": "pkg/modules/module_loader/s3_bucket_path_module_loader.go",
    "chars": 2554,
    "preview": "package module_loader\n\nimport (\n\t\"context\"\n\t\"github.com/selefra/selefra-provider-sdk/provider/schema\"\n\t\"github.com/selef"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_1/modules.yml",
    "chars": 1414,
    "preview": "modules:\n  - name: module_name_sub_module_a_1\n    uses:\n  #      - rules/s3/bucket_acl_publicly_readable.yaml\n  #      -"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_1/rules.yml",
    "chars": 937,
    "preview": "rules:\n  - name: rule_name_sub_module_a_1\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n        aws_s3_buc"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_1/selefra.yml",
    "chars": 486,
    "preview": "selefra:\n#  cloud:\n#    project: example_project\n#    organization: example_org\n#    hostname: app.selefra.io\n#  connect"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_2/modules.yml",
    "chars": 1414,
    "preview": "modules:\n  - name: module_name_sub_module_a_2\n    uses:\n  #      - rules/s3/bucket_acl_publicly_readable.yaml\n  #      -"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_2/rules.yml",
    "chars": 937,
    "preview": "rules:\n  - name: rule_name_sub_module_a_2\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n        aws_s3_buc"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_a/sub_module_a_2/selefra.yml",
    "chars": 486,
    "preview": "selefra:\n#  cloud:\n#    project: example_project\n#    organization: example_org\n#    hostname: app.selefra.io\n#  connect"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_1/modules.yml",
    "chars": 1414,
    "preview": "modules:\n  - name: module_name_sub_module_b_1\n    uses:\n  #      - rules/s3/bucket_acl_publicly_readable.yaml\n  #      -"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_1/rules.yml",
    "chars": 937,
    "preview": "rules:\n  - name: rule_name_sub_module_b_1\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n        aws_s3_buc"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_1/selefra.yml",
    "chars": 486,
    "preview": "selefra:\n#  cloud:\n#    project: example_project\n#    organization: example_org\n#    hostname: app.selefra.io\n#  connect"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_2/modules.yml",
    "chars": 1414,
    "preview": "modules:\n  - name: module_name_sub_module_b_2\n    uses:\n  #      - rules/s3/bucket_acl_publicly_readable.yaml\n  #      -"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_2/rules.yml",
    "chars": 937,
    "preview": "rules:\n  - name: rule_name_sub_module_b_2\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n        aws_s3_buc"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/sub_module_b/sub_module_b_2/selefra.yml",
    "chars": 486,
    "preview": "selefra:\n#  cloud:\n#    project: example_project\n#    organization: example_org\n#    hostname: app.selefra.io\n#  connect"
  },
  {
    "path": "pkg/modules/module_loader/test_data/contains_sub_module/test.yaml",
    "chars": 3392,
    "preview": "rules:\n  - name: bucket_is_not_configured_with_cors_rules\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n  "
  },
  {
    "path": "pkg/modules/module_loader/test_data/dead_loop_module/modules.yaml",
    "chars": 571,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n    hostname: app.selefra.io\n  connection:\n"
  },
  {
    "path": "pkg/modules/module_loader/test_data/dead_loop_module/sub_module_a/modules.yaml",
    "chars": 549,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n    hostname: app.selefra.io\n  connection:\n"
  },
  {
    "path": "pkg/modules/module_loader/test_data/dead_loop_module/sub_module_b/modules.yaml",
    "chars": 549,
    "preview": "selefra:\n  cloud:\n    project: example_project\n    organization: example_org\n    hostname: app.selefra.io\n  connection:\n"
  },
  {
    "path": "pkg/modules/module_loader/test_data/module_mixed/sub_module_local/modules.yml",
    "chars": 1408,
    "preview": "modules:\n  - name: sub_module_local\n    uses:\n  #      - rules/s3/bucket_acl_publicly_readable.yaml\n  #      - rules/s3/"
  },
  {
    "path": "pkg/modules/module_loader/test_data/module_mixed/sub_module_local/rules.yml",
    "chars": 934,
    "preview": "rules:\n  - name: rule_sub_module_local\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n        aws_s3_bucket"
  },
  {
    "path": "pkg/modules/module_loader/test_data/module_mixed/sub_module_local/selefra.yml",
    "chars": 486,
    "preview": "selefra:\n#  cloud:\n#    project: example_project\n#    organization: example_org\n#    hostname: app.selefra.io\n#  connect"
  },
  {
    "path": "pkg/modules/module_loader/test_data/module_mixed/test.yaml",
    "chars": 3223,
    "preview": "rules:\n  - name: bucket_is_not_configured_with_cors_rules\n    query: |\n      SELECT\n        DISTINCT(a1.*)\n      FROM\n  "
  }
]

// ... and 110 more files (download for full content)

About this extraction

This page contains the full source code of the selefra/selefra GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 310 files (1.1 MB), approximately 338.3k tokens, and a symbol index with 1522 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!