biucingcli 0.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- biucingcli/__init__.py +5 -0
- biucingcli/cli.py +849 -0
- biucingcli/template_data/android/template/.editorconfig +9 -0
- biucingcli/template_data/android/template/.gitignore +26 -0
- biucingcli/template_data/android/template/.mise.toml +3 -0
- biucingcli/template_data/android/template/Brewfile +6 -0
- biucingcli/template_data/android/template/Makefile +103 -0
- biucingcli/template_data/android/template/README.md +163 -0
- biucingcli/template_data/android/template/app/build.gradle.kts +178 -0
- biucingcli/template_data/android/template/app/proguard-rules.pro +1 -0
- biucingcli/template_data/android/template/app/src/androidTest/java/app/HomeRouteUiTest.kt +21 -0
- biucingcli/template_data/android/template/app/src/main/AndroidManifest.xml +18 -0
- biucingcli/template_data/android/template/app/src/main/java/app/MainActivity.kt +36 -0
- biucingcli/template_data/android/template/app/src/main/res/values/strings.xml +4 -0
- biucingcli/template_data/android/template/app/src/main/res/values/themes.xml +8 -0
- biucingcli/template_data/android/template/app/src/test/java/app/AppSmokeTest.kt +19 -0
- biucingcli/template_data/android/template/build.gradle.kts +27 -0
- biucingcli/template_data/android/template/core/designsystem/build.gradle.kts +33 -0
- biucingcli/template_data/android/template/core/designsystem/src/main/java/designsystem/Components.kt +75 -0
- biucingcli/template_data/android/template/core/designsystem/src/main/java/designsystem/DesignTokens.kt +23 -0
- biucingcli/template_data/android/template/core/designsystem/src/main/java/designsystem/Theme.kt +110 -0
- biucingcli/template_data/android/template/core/model/build.gradle.kts +26 -0
- biucingcli/template_data/android/template/core/model/src/main/java/model/Greeting.kt +6 -0
- biucingcli/template_data/android/template/core/model/src/test/java/model/GreetingTest.kt +16 -0
- biucingcli/template_data/android/template/core/network/build.gradle.kts +26 -0
- biucingcli/template_data/android/template/core/network/src/main/java/network/AppEnvironment.kt +17 -0
- biucingcli/template_data/android/template/core/testing/build.gradle.kts +27 -0
- biucingcli/template_data/android/template/core/testing/src/main/java/testing/FakeAppEnvironmentProvider.kt +13 -0
- biucingcli/template_data/android/template/docs/release-delivery.md +68 -0
- biucingcli/template_data/android/template/docs/release-signing.properties.example +20 -0
- biucingcli/template_data/android/template/fastlane/.env.example +22 -0
- biucingcli/template_data/android/template/fastlane/Appfile +1 -0
- biucingcli/template_data/android/template/fastlane/Fastfile +121 -0
- biucingcli/template_data/android/template/feature/home/build.gradle.kts +35 -0
- biucingcli/template_data/android/template/feature/home/src/main/java/home/HomeRoute.kt +38 -0
- biucingcli/template_data/android/template/feature/settings/build.gradle.kts +34 -0
- biucingcli/template_data/android/template/feature/settings/src/main/java/settings/SettingsRoute.kt +35 -0
- biucingcli/template_data/android/template/gradle/libs.versions.toml +35 -0
- biucingcli/template_data/android/template/gradle/verification-metadata.xml +3462 -0
- biucingcli/template_data/android/template/gradle/wrapper/gradle-wrapper.jar +0 -0
- biucingcli/template_data/android/template/gradle/wrapper/gradle-wrapper.jar.sha256 +1 -0
- biucingcli/template_data/android/template/gradle/wrapper/gradle-wrapper.properties +10 -0
- biucingcli/template_data/android/template/gradle.properties +4 -0
- biucingcli/template_data/android/template/gradlew +252 -0
- biucingcli/template_data/android/template/gradlew.bat +94 -0
- biucingcli/template_data/android/template/scripts/artifact-info +11 -0
- biucingcli/template_data/android/template/scripts/bootstrap +17 -0
- biucingcli/template_data/android/template/scripts/doctor +133 -0
- biucingcli/template_data/android/template/scripts/setup-android-sdk +23 -0
- biucingcli/template_data/android/template/scripts/sync-gradle-wrapper +19 -0
- biucingcli/template_data/android/template/scripts/verify-gradle-supply-chain +61 -0
- biucingcli/template_data/android/template/scripts/verify-release-artifact +104 -0
- biucingcli/template_data/android/template/settings.gradle.kts +25 -0
- biucingcli/template_data/android/template.json +146 -0
- biucingcli/template_data/apple/template/.gitignore +28 -0
- biucingcli/template_data/apple/template/.mise.toml +4 -0
- biucingcli/template_data/apple/template/.swiftformat +10 -0
- biucingcli/template_data/apple/template/.swiftlint.yml +33 -0
- biucingcli/template_data/apple/template/App/Config/ProjectDescriptionHelpers/Module.swift +6 -0
- biucingcli/template_data/apple/template/App/Config/XCConfig/Base.xcconfig +4 -0
- biucingcli/template_data/apple/template/App/Project.swift +66 -0
- biucingcli/template_data/apple/template/App/Targets/App/Resources/.gitkeep +1 -0
- biucingcli/template_data/apple/template/App/Targets/App/Sources/AppEntry.swift +9 -0
- biucingcli/template_data/apple/template/App/Targets/App/Sources/HomeView.swift +18 -0
- biucingcli/template_data/apple/template/App/Targets/App/Sources/HomeViewModel.swift +38 -0
- biucingcli/template_data/apple/template/App/Targets/AppTests/Sources/AppTests.swift +59 -0
- biucingcli/template_data/apple/template/Brewfile +8 -0
- biucingcli/template_data/apple/template/Makefile +128 -0
- biucingcli/template_data/apple/template/Packages/AppServices/Package.swift +20 -0
- biucingcli/template_data/apple/template/Packages/AppServices/Sources/AppServices/StarterMetadata.swift +52 -0
- biucingcli/template_data/apple/template/Packages/DesignSystem/Package.swift +20 -0
- biucingcli/template_data/apple/template/Packages/DesignSystem/Sources/DesignSystem/Theme.swift +8 -0
- biucingcli/template_data/apple/template/README.md +133 -0
- biucingcli/template_data/apple/template/Tuist.swift +8 -0
- biucingcli/template_data/apple/template/Workspace.swift +11 -0
- biucingcli/template_data/apple/template/docs/release-delivery.md +55 -0
- biucingcli/template_data/apple/template/fastlane/.env.example +20 -0
- biucingcli/template_data/apple/template/fastlane/Appfile +3 -0
- biucingcli/template_data/apple/template/fastlane/Fastfile +126 -0
- biucingcli/template_data/apple/template/fastlane/Matchfile +7 -0
- biucingcli/template_data/apple/template/scripts/bootstrap +9 -0
- biucingcli/template_data/apple/template/scripts/doctor +163 -0
- biucingcli/template_data/apple/template/scripts/setup-xcode +6 -0
- biucingcli/template_data/apple/template/scripts/test-destination +42 -0
- biucingcli/template_data/apple/template/scripts/verify-release-identity +88 -0
- biucingcli/template_data/apple/template.json +110 -0
- biucingcli/template_data/frontend/template/.dockerignore +8 -0
- biucingcli/template_data/frontend/template/.env.example +1 -0
- biucingcli/template_data/frontend/template/.gitignore +7 -0
- biucingcli/template_data/frontend/template/.npmrc +1 -0
- biucingcli/template_data/frontend/template/.prettierignore +2 -0
- biucingcli/template_data/frontend/template/.prettierrc.json +4 -0
- biucingcli/template_data/frontend/template/Dockerfile +25 -0
- biucingcli/template_data/frontend/template/Dockerfile.dev +35 -0
- biucingcli/template_data/frontend/template/Dockerfile.dev.full +40 -0
- biucingcli/template_data/frontend/template/Makefile +137 -0
- biucingcli/template_data/frontend/template/README.md +146 -0
- biucingcli/template_data/frontend/template/compose.dev.yaml +29 -0
- biucingcli/template_data/frontend/template/eslint.config.js +27 -0
- biucingcli/template_data/frontend/template/index.html +12 -0
- biucingcli/template_data/frontend/template/nginx.conf +11 -0
- biucingcli/template_data/frontend/template/package.json +50 -0
- biucingcli/template_data/frontend/template/playwright.production.config.ts +21 -0
- biucingcli/template_data/frontend/template/playwright.smoke.config.ts +19 -0
- biucingcli/template_data/frontend/template/pnpm-lock.yaml +4054 -0
- biucingcli/template_data/frontend/template/public/.gitkeep +1 -0
- biucingcli/template_data/frontend/template/scripts/browser-smoke-production +55 -0
- biucingcli/template_data/frontend/template/scripts/doctor +46 -0
- biucingcli/template_data/frontend/template/src/App.test.tsx +18 -0
- biucingcli/template_data/frontend/template/src/App.tsx +5 -0
- biucingcli/template_data/frontend/template/src/components/MetricCard.tsx +14 -0
- biucingcli/template_data/frontend/template/src/components/TaskPanel.tsx +32 -0
- biucingcli/template_data/frontend/template/src/config/env.ts +3 -0
- biucingcli/template_data/frontend/template/src/hooks/useProjectOverview.ts +24 -0
- biucingcli/template_data/frontend/template/src/index.css +208 -0
- biucingcli/template_data/frontend/template/src/main.tsx +11 -0
- biucingcli/template_data/frontend/template/src/pages/HomePage.tsx +60 -0
- biucingcli/template_data/frontend/template/src/router/AppRouter.tsx +14 -0
- biucingcli/template_data/frontend/template/src/services/api/client.ts +33 -0
- biucingcli/template_data/frontend/template/src/services/projectOverview.ts +39 -0
- biucingcli/template_data/frontend/template/src/test/setup.ts +1 -0
- biucingcli/template_data/frontend/template/src/types/projectOverview.ts +22 -0
- biucingcli/template_data/frontend/template/src/vite-env.d.ts +9 -0
- biucingcli/template_data/frontend/template/tests/browser-smoke.spec.ts +16 -0
- biucingcli/template_data/frontend/template/tests/production-browser-smoke.spec.ts +22 -0
- biucingcli/template_data/frontend/template/tsconfig.json +21 -0
- biucingcli/template_data/frontend/template/vite.config.ts +12 -0
- biucingcli/template_data/frontend/template.json +81 -0
- biucingcli/template_data/harmonyos/template/.gitignore +21 -0
- biucingcli/template_data/harmonyos/template/.mise.toml +2 -0
- biucingcli/template_data/harmonyos/template/AppScope/app.json5 +10 -0
- biucingcli/template_data/harmonyos/template/AppScope/resources/base/element/string.json +8 -0
- biucingcli/template_data/harmonyos/template/AppScope/resources/base/media/background.svg +3 -0
- biucingcli/template_data/harmonyos/template/AppScope/resources/base/media/foreground.svg +4 -0
- biucingcli/template_data/harmonyos/template/AppScope/resources/base/media/layered_image.json +6 -0
- biucingcli/template_data/harmonyos/template/Makefile +106 -0
- biucingcli/template_data/harmonyos/template/README.md +152 -0
- biucingcli/template_data/harmonyos/template/build-profile.json5 +36 -0
- biucingcli/template_data/harmonyos/template/code-linter.json5 +12 -0
- biucingcli/template_data/harmonyos/template/docs/release-signing.local.properties.example +14 -0
- biucingcli/template_data/harmonyos/template/entry/build-profile.json5 +9 -0
- biucingcli/template_data/harmonyos/template/entry/hvigorfile.ts +6 -0
- biucingcli/template_data/harmonyos/template/entry/oh-package.json5 +9 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/ets/core/config/AppConfig.ets +10 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/ets/core/designsystem/Tokens.ets +28 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/ets/entryability/EntryAbility.ets +29 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/ets/pages/Index.ets +47 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/ets/pages/Settings.ets +96 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/module.json5 +34 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/resources/base/element/color.json +24 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/resources/base/element/string.json +12 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/resources/base/media/app_icon.svg +5 -0
- biucingcli/template_data/harmonyos/template/entry/src/main/resources/base/profile/main_pages.json +6 -0
- biucingcli/template_data/harmonyos/template/entry/src/test/List.test.ets +11 -0
- biucingcli/template_data/harmonyos/template/hvigor/hvigor-config.json5 +8 -0
- biucingcli/template_data/harmonyos/template/hvigorfile.ts +6 -0
- biucingcli/template_data/harmonyos/template/oh-package-lock.json5 +19 -0
- biucingcli/template_data/harmonyos/template/oh-package.json5 +13 -0
- biucingcli/template_data/harmonyos/template/scripts/artifact-info +31 -0
- biucingcli/template_data/harmonyos/template/scripts/bootstrap +38 -0
- biucingcli/template_data/harmonyos/template/scripts/doctor +147 -0
- biucingcli/template_data/harmonyos/template/scripts/lint +105 -0
- biucingcli/template_data/harmonyos/template/scripts/release-build +199 -0
- biucingcli/template_data/harmonyos/template/scripts/release-preflight +109 -0
- biucingcli/template_data/harmonyos/template/scripts/test +28 -0
- biucingcli/template_data/harmonyos/template/scripts/verify-release-artifact +173 -0
- biucingcli/template_data/harmonyos/template/scripts/verify-supply-chain +70 -0
- biucingcli/template_data/harmonyos/template.json +134 -0
- biucingcli/template_data/microservice/template/.air.toml +11 -0
- biucingcli/template_data/microservice/template/.dockerignore +5 -0
- biucingcli/template_data/microservice/template/.gitignore +4 -0
- biucingcli/template_data/microservice/template/.mise.toml +3 -0
- biucingcli/template_data/microservice/template/Brewfile +7 -0
- biucingcli/template_data/microservice/template/Dockerfile +44 -0
- biucingcli/template_data/microservice/template/Dockerfile.dev +50 -0
- biucingcli/template_data/microservice/template/Makefile +145 -0
- biucingcli/template_data/microservice/template/README.md +191 -0
- biucingcli/template_data/microservice/template/api/buf.gen.yaml +11 -0
- biucingcli/template_data/microservice/template/api/buf.yaml +11 -0
- biucingcli/template_data/microservice/template/api/proto/service/v1/service.proto +18 -0
- biucingcli/template_data/microservice/template/cmd/server/main.go +81 -0
- biucingcli/template_data/microservice/template/compose.dev.yaml +49 -0
- biucingcli/template_data/microservice/template/configs/config.yaml +18 -0
- biucingcli/template_data/microservice/template/deploy/compose.yaml +35 -0
- biucingcli/template_data/microservice/template/deploy/otel-collector.yaml +15 -0
- biucingcli/template_data/microservice/template/go.mod +53 -0
- biucingcli/template_data/microservice/template/go.sum +138 -0
- biucingcli/template_data/microservice/template/internal/config/config.go +112 -0
- biucingcli/template_data/microservice/template/internal/config/config_test.go +92 -0
- biucingcli/template_data/microservice/template/internal/handler/health.go +25 -0
- biucingcli/template_data/microservice/template/internal/handler/ping.go +25 -0
- biucingcli/template_data/microservice/template/internal/model/health.go +8 -0
- biucingcli/template_data/microservice/template/internal/model/ping.go +7 -0
- biucingcli/template_data/microservice/template/internal/repository/.gitkeep +1 -0
- biucingcli/template_data/microservice/template/internal/router/router.go +26 -0
- biucingcli/template_data/microservice/template/internal/runtime/server.go +116 -0
- biucingcli/template_data/microservice/template/internal/runtime/server_test.go +161 -0
- biucingcli/template_data/microservice/template/internal/service/health.go +26 -0
- biucingcli/template_data/microservice/template/internal/service/ping.go +23 -0
- biucingcli/template_data/microservice/template/internal/telemetry/telemetry.go +56 -0
- biucingcli/template_data/microservice/template/internal/transport/grpc.go +51 -0
- biucingcli/template_data/microservice/template/internal/transport/ping.go +28 -0
- biucingcli/template_data/microservice/template/scripts/bootstrap +29 -0
- biucingcli/template_data/microservice/template/scripts/doctor +115 -0
- biucingcli/template_data/microservice/template/tests/server_test.go +153 -0
- biucingcli/template_data/microservice/template.json +114 -0
- biucingcli/template_data/web-service/template/.air.toml +11 -0
- biucingcli/template_data/web-service/template/.dockerignore +5 -0
- biucingcli/template_data/web-service/template/.gitignore +5 -0
- biucingcli/template_data/web-service/template/.mise.toml +2 -0
- biucingcli/template_data/web-service/template/Brewfile +5 -0
- biucingcli/template_data/web-service/template/Dockerfile +41 -0
- biucingcli/template_data/web-service/template/Dockerfile.dev +45 -0
- biucingcli/template_data/web-service/template/Makefile +113 -0
- biucingcli/template_data/web-service/template/README.md +164 -0
- biucingcli/template_data/web-service/template/cmd/server/main.go +50 -0
- biucingcli/template_data/web-service/template/compose.dev.yaml +28 -0
- biucingcli/template_data/web-service/template/compose.yaml +14 -0
- biucingcli/template_data/web-service/template/configs/config.yaml +10 -0
- biucingcli/template_data/web-service/template/go.mod +36 -0
- biucingcli/template_data/web-service/template/go.sum +89 -0
- biucingcli/template_data/web-service/template/internal/config/config.go +84 -0
- biucingcli/template_data/web-service/template/internal/config/config_test.go +88 -0
- biucingcli/template_data/web-service/template/internal/handler/health.go +25 -0
- biucingcli/template_data/web-service/template/internal/handler/ping.go +25 -0
- biucingcli/template_data/web-service/template/internal/handler/user.go +40 -0
- biucingcli/template_data/web-service/template/internal/model/health.go +6 -0
- biucingcli/template_data/web-service/template/internal/model/ping.go +7 -0
- biucingcli/template_data/web-service/template/internal/model/user.go +7 -0
- biucingcli/template_data/web-service/template/internal/repository/.gitkeep +1 -0
- biucingcli/template_data/web-service/template/internal/repository/user.go +37 -0
- biucingcli/template_data/web-service/template/internal/router/router.go +28 -0
- biucingcli/template_data/web-service/template/internal/runtime/server.go +76 -0
- biucingcli/template_data/web-service/template/internal/runtime/server_test.go +139 -0
- biucingcli/template_data/web-service/template/internal/service/health.go +22 -0
- biucingcli/template_data/web-service/template/internal/service/ping.go +23 -0
- biucingcli/template_data/web-service/template/internal/service/user.go +27 -0
- biucingcli/template_data/web-service/template/scripts/bootstrap +23 -0
- biucingcli/template_data/web-service/template/scripts/doctor +83 -0
- biucingcli/template_data/web-service/template/tests/server_test.go +160 -0
- biucingcli/template_data/web-service/template.json +88 -0
- biucingcli/template_data/worker/template/.dockerignore +3 -0
- biucingcli/template_data/worker/template/.gitignore +2 -0
- biucingcli/template_data/worker/template/.mise.toml +2 -0
- biucingcli/template_data/worker/template/Brewfile +1 -0
- biucingcli/template_data/worker/template/Dockerfile +19 -0
- biucingcli/template_data/worker/template/Dockerfile.dev +9 -0
- biucingcli/template_data/worker/template/Makefile +105 -0
- biucingcli/template_data/worker/template/README.md +164 -0
- biucingcli/template_data/worker/template/cmd/worker/main.go +41 -0
- biucingcli/template_data/worker/template/compose.dev.yaml +29 -0
- biucingcli/template_data/worker/template/configs/config.json +11 -0
- biucingcli/template_data/worker/template/go.mod +3 -0
- biucingcli/template_data/worker/template/go.sum +1 -0
- biucingcli/template_data/worker/template/internal/config/config.go +108 -0
- biucingcli/template_data/worker/template/internal/config/config_test.go +86 -0
- biucingcli/template_data/worker/template/internal/runtime/runner.go +199 -0
- biucingcli/template_data/worker/template/internal/runtime/runner_test.go +215 -0
- biucingcli/template_data/worker/template/internal/task/heartbeat.go +19 -0
- biucingcli/template_data/worker/template/scripts/bootstrap +6 -0
- biucingcli/template_data/worker/template/scripts/doctor +41 -0
- biucingcli/template_data/worker/template/tests/worker_test.go +44 -0
- biucingcli/template_data/worker/template.json +100 -0
- biucingcli/templates.py +902 -0
- biucingcli-0.9.1.dist-info/METADATA +204 -0
- biucingcli-0.9.1.dist-info/RECORD +269 -0
- biucingcli-0.9.1.dist-info/WHEEL +5 -0
- biucingcli-0.9.1.dist-info/entry_points.txt +2 -0
- biucingcli-0.9.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "harmonyos",
|
|
3
|
+
"description": "ArkTS HarmonyOS app starter for DevEco Studio projects",
|
|
4
|
+
"category": "native",
|
|
5
|
+
"stack": ["ArkTS", "ArkUI", "HarmonyOS", "DevEco Studio", "hvigor", "ohpm"],
|
|
6
|
+
"tags": ["harmonyos", "arkts", "arkui", "deveco", "native"],
|
|
7
|
+
"platforms": ["harmonyos"],
|
|
8
|
+
"maturity": {
|
|
9
|
+
"level": "experimental",
|
|
10
|
+
"summary": "HarmonyOS starter with DevEco-compatible project files, ArkTS entry ability, doctor checks, Hypium test wiring, build verification, artifact checks, and local release-signing preflight."
|
|
11
|
+
},
|
|
12
|
+
"validation": {
|
|
13
|
+
"status": "generated-project-verified",
|
|
14
|
+
"verification_tier": "generated-project",
|
|
15
|
+
"evidence": [
|
|
16
|
+
"python unittest template rendering coverage",
|
|
17
|
+
"repo-level template metadata and placeholder validation",
|
|
18
|
+
"generated-project bootstrap, lint, test, build, artifact, and release-preflight commands"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"operating_assumptions": [
|
|
22
|
+
"The starter assumes DevEco Studio or a local HarmonyOS SDK provides ohpm and hvigor.",
|
|
23
|
+
"Generated projects are structured for an ArkTS Stage model app with one entry module."
|
|
24
|
+
],
|
|
25
|
+
"workflow_labels": ["bootstrap", "doctor", "lint", "test", "build", "verify", "release", "open"],
|
|
26
|
+
"commands": {
|
|
27
|
+
"bootstrap": "make bootstrap",
|
|
28
|
+
"doctor": "make doctor",
|
|
29
|
+
"lint": "make lint",
|
|
30
|
+
"test": "make test",
|
|
31
|
+
"verify": "make verify",
|
|
32
|
+
"build": "make build",
|
|
33
|
+
"clean": "make clean",
|
|
34
|
+
"help": "make help"
|
|
35
|
+
},
|
|
36
|
+
"worktree": {
|
|
37
|
+
"support_level": "worktree-ready",
|
|
38
|
+
"isolation_dimensions": [
|
|
39
|
+
"caches",
|
|
40
|
+
"generated-output",
|
|
41
|
+
"local-config",
|
|
42
|
+
"installed-app-identity",
|
|
43
|
+
"cleanup",
|
|
44
|
+
"diagnostics"
|
|
45
|
+
],
|
|
46
|
+
"diagnostics": [
|
|
47
|
+
"make worktree-info",
|
|
48
|
+
"make worktree-doctor"
|
|
49
|
+
],
|
|
50
|
+
"cleanup": [
|
|
51
|
+
"make clean-worktree"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"variables": [
|
|
55
|
+
{
|
|
56
|
+
"name": "project_name",
|
|
57
|
+
"required": true,
|
|
58
|
+
"validator": "project-name"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "display_name",
|
|
62
|
+
"required": false,
|
|
63
|
+
"default_from": "project_name",
|
|
64
|
+
"validator": "display-name"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "bundle_name",
|
|
68
|
+
"required": true,
|
|
69
|
+
"prompt": "HarmonyOS bundle name: ",
|
|
70
|
+
"validator": "java-package"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "harmony_module_name",
|
|
74
|
+
"required": false,
|
|
75
|
+
"default": "entry",
|
|
76
|
+
"validator": "identifier"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "ability_name",
|
|
80
|
+
"required": false,
|
|
81
|
+
"default": "EntryAbility",
|
|
82
|
+
"validator": "identifier"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "compatible_sdk_version",
|
|
86
|
+
"required": false,
|
|
87
|
+
"default": "5.0.0(12)",
|
|
88
|
+
"validator": "harmony-sdk-version"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "target_sdk_version",
|
|
92
|
+
"required": false,
|
|
93
|
+
"default": "5.0.0(12)",
|
|
94
|
+
"validator": "harmony-sdk-version"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "min_api_version",
|
|
98
|
+
"required": false,
|
|
99
|
+
"default": "12",
|
|
100
|
+
"validator": "positive-integer",
|
|
101
|
+
"maximum": 100
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "harmony_version_code",
|
|
105
|
+
"required": false,
|
|
106
|
+
"default": "1",
|
|
107
|
+
"validator": "positive-integer",
|
|
108
|
+
"maximum": 2100000000
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "harmony_version_name",
|
|
112
|
+
"required": false,
|
|
113
|
+
"default": "1.0.0",
|
|
114
|
+
"validator": "semantic-version"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "organization_name",
|
|
118
|
+
"required": false,
|
|
119
|
+
"default": "Example Team",
|
|
120
|
+
"validator": "display-name"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"next_steps": [
|
|
124
|
+
"make bootstrap",
|
|
125
|
+
"make doctor",
|
|
126
|
+
"make lint",
|
|
127
|
+
"make test",
|
|
128
|
+
"make build",
|
|
129
|
+
"make artifact-info",
|
|
130
|
+
"make verify",
|
|
131
|
+
"make release-preflight",
|
|
132
|
+
"open -a \"DevEco Studio\" ."
|
|
133
|
+
]
|
|
134
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
ARG BUILDER_IMAGE=golang:1.26-alpine
|
|
2
|
+
ARG RUNTIME_IMAGE=alpine:3.20
|
|
3
|
+
|
|
4
|
+
FROM ${BUILDER_IMAGE} AS builder
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
ARG GOPROXY=https://proxy.golang.org,direct
|
|
9
|
+
ARG GOSUMDB=sum.golang.org
|
|
10
|
+
ENV GOPROXY=${GOPROXY}
|
|
11
|
+
ENV GOSUMDB=${GOSUMDB}
|
|
12
|
+
|
|
13
|
+
COPY go.mod ./
|
|
14
|
+
RUN set -eux; \
|
|
15
|
+
attempt=1; \
|
|
16
|
+
until go mod download; do \
|
|
17
|
+
if [ "$attempt" -ge 3 ]; then \
|
|
18
|
+
exit 1; \
|
|
19
|
+
fi; \
|
|
20
|
+
attempt=$((attempt + 1)); \
|
|
21
|
+
sleep 5; \
|
|
22
|
+
done
|
|
23
|
+
|
|
24
|
+
COPY . .
|
|
25
|
+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH:-amd64} go build -o /out/server ./cmd/server
|
|
26
|
+
|
|
27
|
+
FROM ${RUNTIME_IMAGE}
|
|
28
|
+
|
|
29
|
+
WORKDIR /app
|
|
30
|
+
|
|
31
|
+
COPY --from=builder /out/server /app/server
|
|
32
|
+
COPY configs/config.yaml /app/configs/config.yaml
|
|
33
|
+
COPY deploy/otel-collector.yaml /app/deploy/otel-collector.yaml
|
|
34
|
+
|
|
35
|
+
EXPOSE {{HTTP_PORT}}
|
|
36
|
+
EXPOSE {{GRPC_PORT}}
|
|
37
|
+
|
|
38
|
+
ENV CONFIG_FILE=/app/configs/config.yaml
|
|
39
|
+
ENV OTEL_EXPORTER_OTLP_ENDPOINT={{OTEL_EXPORTER_ENDPOINT}}
|
|
40
|
+
|
|
41
|
+
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
|
42
|
+
CMD ["/app/server", "healthcheck", "http://127.0.0.1:{{HTTP_PORT}}/healthz"]
|
|
43
|
+
|
|
44
|
+
CMD ["/app/server"]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
FROM golang:1.26-bookworm
|
|
2
|
+
|
|
3
|
+
WORKDIR /workspace
|
|
4
|
+
|
|
5
|
+
ARG AIR_VERSION=1.65.3
|
|
6
|
+
ARG BUF_VERSION=1.70.0
|
|
7
|
+
ARG GOLANGCI_LINT_VERSION=2.12.2
|
|
8
|
+
ARG GOPROXY=https://proxy.golang.org,direct
|
|
9
|
+
ARG GOSUMDB=sum.golang.org
|
|
10
|
+
ARG TARGETARCH
|
|
11
|
+
|
|
12
|
+
RUN apt-get update \
|
|
13
|
+
&& apt-get install -y --no-install-recommends bash ca-certificates curl git make tar unzip \
|
|
14
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
RUN set -eux; \
|
|
17
|
+
case "${TARGETARCH}" in \
|
|
18
|
+
arm64) air_arch="arm64"; buf_arch="aarch64"; golangci_arch="arm64" ;; \
|
|
19
|
+
amd64) air_arch="amd64"; buf_arch="x86_64"; golangci_arch="amd64" ;; \
|
|
20
|
+
*) echo "Unsupported TARGETARCH: ${TARGETARCH}"; exit 1 ;; \
|
|
21
|
+
esac; \
|
|
22
|
+
curl -fsSL "https://github.com/air-verse/air/releases/download/v${AIR_VERSION}/air_${AIR_VERSION}_linux_${air_arch}.tar.gz" \
|
|
23
|
+
| tar -xz -C /usr/local/bin air; \
|
|
24
|
+
curl -fsSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-${buf_arch}.tar.gz" \
|
|
25
|
+
| tar -xz -C /tmp; \
|
|
26
|
+
mv /tmp/buf/bin/buf /usr/local/bin/buf; \
|
|
27
|
+
rm -rf /tmp/buf; \
|
|
28
|
+
curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-${golangci_arch}.tar.gz" \
|
|
29
|
+
| tar -xz -C /tmp; \
|
|
30
|
+
mv "/tmp/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-${golangci_arch}/golangci-lint" /usr/local/bin/golangci-lint; \
|
|
31
|
+
rm -rf /tmp/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-${golangci_arch}
|
|
32
|
+
|
|
33
|
+
COPY go.mod go.sum ./
|
|
34
|
+
ENV GOPROXY=${GOPROXY}
|
|
35
|
+
ENV GOSUMDB=${GOSUMDB}
|
|
36
|
+
RUN set -eux; \
|
|
37
|
+
attempt=1; \
|
|
38
|
+
until go mod download; do \
|
|
39
|
+
if [ "$attempt" -ge 3 ]; then \
|
|
40
|
+
exit 1; \
|
|
41
|
+
fi; \
|
|
42
|
+
attempt=$((attempt + 1)); \
|
|
43
|
+
sleep 5; \
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
ENV PATH="/go/bin:${PATH}"
|
|
47
|
+
ENV GOCACHE=/workspace/.cache/go-build
|
|
48
|
+
ENV GOLANGCI_LINT_CACHE=/workspace/.cache/golangci-lint
|
|
49
|
+
|
|
50
|
+
CMD ["air", "-c", ".air.toml"]
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
APP_NAME={{SERVICE_NAME}}
|
|
2
|
+
WORKTREE_ROOT ?=$(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
3
|
+
WORKTREE_LABEL ?=$(shell basename "$(WORKTREE_ROOT)" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-//; s/-$$//')
|
|
4
|
+
WORKTREE_ID ?=$(shell printf '%s' "$(WORKTREE_ROOT)" | shasum | cut -c1-8)
|
|
5
|
+
WORKTREE_SLUG ?=$(APP_NAME)-$(WORKTREE_ID)
|
|
6
|
+
COMPOSE_PROJECT_NAME ?=$(WORKTREE_SLUG)
|
|
7
|
+
IMAGE ?=$(WORKTREE_SLUG)
|
|
8
|
+
TAG ?=dev
|
|
9
|
+
IMAGE_REF := $(IMAGE):$(TAG)
|
|
10
|
+
COMPOSE ?=COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) docker compose
|
|
11
|
+
HTTP_PORT ?={{HTTP_PORT}}
|
|
12
|
+
GRPC_PORT ?={{GRPC_PORT}}
|
|
13
|
+
HOST_HTTP_PORT ?={{HTTP_PORT}}
|
|
14
|
+
HOST_GRPC_PORT ?={{GRPC_PORT}}
|
|
15
|
+
HOST_DEPENDENCY_STORE_PORT ?={{DEPENDENCY_STORE_PORT}}
|
|
16
|
+
HOST_OTEL_GRPC_PORT ?=4317
|
|
17
|
+
HOST_OTEL_HTTP_PORT ?=4318
|
|
18
|
+
DEV_COMPOSE_FILE ?=compose.dev.yaml
|
|
19
|
+
DEV_SERVICE ?=app-dev
|
|
20
|
+
DOCKER_VARIANT ?=alpine
|
|
21
|
+
DOCKER_PLATFORM ?=linux/arm64
|
|
22
|
+
COMPOSE_FILE ?=deploy/compose.yaml
|
|
23
|
+
GOPROXY ?=https://proxy.golang.org,direct
|
|
24
|
+
GOSUMDB ?=sum.golang.org
|
|
25
|
+
GOCACHE ?= $(CURDIR)/.cache/go-build
|
|
26
|
+
GOMODCACHE ?= $(CURDIR)/.cache/go-mod
|
|
27
|
+
GOLANGCI_LINT_CACHE ?= $(CURDIR)/.cache/golangci-lint
|
|
28
|
+
export COMPOSE_PROJECT_NAME
|
|
29
|
+
export IMAGE
|
|
30
|
+
export TAG
|
|
31
|
+
export HTTP_PORT
|
|
32
|
+
export GRPC_PORT
|
|
33
|
+
export HOST_HTTP_PORT
|
|
34
|
+
export HOST_GRPC_PORT
|
|
35
|
+
export HOST_DEPENDENCY_STORE_PORT
|
|
36
|
+
export HOST_OTEL_GRPC_PORT
|
|
37
|
+
export HOST_OTEL_HTTP_PORT
|
|
38
|
+
export GOCACHE
|
|
39
|
+
export GOMODCACHE
|
|
40
|
+
export GOLANGCI_LINT_CACHE
|
|
41
|
+
|
|
42
|
+
ifeq ($(DOCKER_VARIANT),ubuntu)
|
|
43
|
+
BUILDER_IMAGE ?= public.ecr.aws/docker/library/golang:1.26
|
|
44
|
+
RUNTIME_IMAGE ?= public.ecr.aws/docker/library/ubuntu:26.04
|
|
45
|
+
else
|
|
46
|
+
BUILDER_IMAGE ?= golang:1.26-alpine
|
|
47
|
+
RUNTIME_IMAGE ?= alpine:3.20
|
|
48
|
+
endif
|
|
49
|
+
|
|
50
|
+
.PHONY: worktree-info worktree-doctor worktree-compose-config clean-worktree bootstrap doctor dev dev-shell tidy proto lint test verify run up down logs build clean help docker-build docker-run
|
|
51
|
+
|
|
52
|
+
worktree-info:
|
|
53
|
+
@printf '%s\n' "Worktree root: $(WORKTREE_ROOT)"
|
|
54
|
+
@printf '%s\n' "Worktree label: $(WORKTREE_LABEL)"
|
|
55
|
+
@printf '%s\n' "Worktree ID: $(WORKTREE_ID)"
|
|
56
|
+
@printf '%s\n' "Worktree slug: $(WORKTREE_SLUG)"
|
|
57
|
+
@printf '%s\n' "Compose project: $(COMPOSE_PROJECT_NAME)"
|
|
58
|
+
@printf '%s\n' "HTTP URL: http://127.0.0.1:$(HOST_HTTP_PORT)"
|
|
59
|
+
@printf '%s\n' "gRPC host port: $(HOST_GRPC_PORT)"
|
|
60
|
+
@printf '%s\n' "{{DEPENDENCY_STORE}} host port: $(HOST_DEPENDENCY_STORE_PORT)"
|
|
61
|
+
@printf '%s\n' "OTel gRPC host port: $(HOST_OTEL_GRPC_PORT)"
|
|
62
|
+
@printf '%s\n' "OTel HTTP host port: $(HOST_OTEL_HTTP_PORT)"
|
|
63
|
+
@printf '%s\n' "Image ref: $(IMAGE_REF)"
|
|
64
|
+
@printf '%s\n' "Go cache: $(GOCACHE)"
|
|
65
|
+
@printf '%s\n' "Go module cache: $(GOMODCACHE)"
|
|
66
|
+
@printf '%s\n' "golangci-lint cache: $(GOLANGCI_LINT_CACHE)"
|
|
67
|
+
|
|
68
|
+
worktree-doctor:
|
|
69
|
+
@$(MAKE) --no-print-directory worktree-info
|
|
70
|
+
@case "$(GOCACHE)" in "$(WORKTREE_ROOT)"/*) ;; *) printf '%s\n' "GOCACHE should stay inside this worktree: $(GOCACHE)"; exit 1;; esac
|
|
71
|
+
@case "$(GOMODCACHE)" in "$(WORKTREE_ROOT)"/*) ;; *) printf '%s\n' "GOMODCACHE should stay inside this worktree: $(GOMODCACHE)"; exit 1;; esac
|
|
72
|
+
@case "$(GOLANGCI_LINT_CACHE)" in "$(WORKTREE_ROOT)"/*) ;; *) printf '%s\n' "GOLANGCI_LINT_CACHE should stay inside this worktree: $(GOLANGCI_LINT_CACHE)"; exit 1;; esac
|
|
73
|
+
@if [ "$(HOST_HTTP_PORT)" = "{{HTTP_PORT}}" ]; then printf '%s\n' "Warning: HOST_HTTP_PORT uses the generated default {{HTTP_PORT}}; override it when another worktree is running."; fi
|
|
74
|
+
@if [ "$(HOST_GRPC_PORT)" = "{{GRPC_PORT}}" ]; then printf '%s\n' "Warning: HOST_GRPC_PORT uses the generated default {{GRPC_PORT}}; override it when another worktree is running."; fi
|
|
75
|
+
@if [ "$(HOST_DEPENDENCY_STORE_PORT)" = "{{DEPENDENCY_STORE_PORT}}" ]; then printf '%s\n' "Warning: HOST_DEPENDENCY_STORE_PORT uses {{DEPENDENCY_STORE_PORT}}; override it when another dependency store is running."; fi
|
|
76
|
+
@if [ "$(HOST_OTEL_GRPC_PORT)" = "4317" ]; then printf '%s\n' "Warning: HOST_OTEL_GRPC_PORT uses 4317; override it when another collector is running."; fi
|
|
77
|
+
@if [ "$(HOST_OTEL_HTTP_PORT)" = "4318" ]; then printf '%s\n' "Warning: HOST_OTEL_HTTP_PORT uses 4318; override it when another collector is running."; fi
|
|
78
|
+
@if ! command -v lsof >/dev/null 2>&1; then printf '%s\n' "Port occupancy checks skipped: lsof is not available."; else \
|
|
79
|
+
if lsof -nP -iTCP:$(HOST_HTTP_PORT) -sTCP:LISTEN >/dev/null 2>&1; then printf '%s\n%s\n' "Warning: HOST_HTTP_PORT $(HOST_HTTP_PORT) is already in use." "Suggested override: HOST_HTTP_PORT=$$(( $(HOST_HTTP_PORT) + 10000 )) make dev"; fi; \
|
|
80
|
+
if lsof -nP -iTCP:$(HOST_GRPC_PORT) -sTCP:LISTEN >/dev/null 2>&1; then printf '%s\n%s\n' "Warning: HOST_GRPC_PORT $(HOST_GRPC_PORT) is already in use." "Suggested override: HOST_GRPC_PORT=$$(( $(HOST_GRPC_PORT) + 10000 )) make dev"; fi; \
|
|
81
|
+
if lsof -nP -iTCP:$(HOST_DEPENDENCY_STORE_PORT) -sTCP:LISTEN >/dev/null 2>&1; then printf '%s\n%s\n' "Warning: HOST_DEPENDENCY_STORE_PORT $(HOST_DEPENDENCY_STORE_PORT) is already in use." "Suggested override: HOST_DEPENDENCY_STORE_PORT=$$(( $(HOST_DEPENDENCY_STORE_PORT) + 10000 )) make dev"; fi; \
|
|
82
|
+
if lsof -nP -iTCP:$(HOST_OTEL_GRPC_PORT) -sTCP:LISTEN >/dev/null 2>&1; then printf '%s\n%s\n' "Warning: HOST_OTEL_GRPC_PORT $(HOST_OTEL_GRPC_PORT) is already in use." "Suggested override: HOST_OTEL_GRPC_PORT=$$(( $(HOST_OTEL_GRPC_PORT) + 10000 )) make dev"; fi; \
|
|
83
|
+
if lsof -nP -iTCP:$(HOST_OTEL_HTTP_PORT) -sTCP:LISTEN >/dev/null 2>&1; then printf '%s\n%s\n' "Warning: HOST_OTEL_HTTP_PORT $(HOST_OTEL_HTTP_PORT) is already in use." "Suggested override: HOST_OTEL_HTTP_PORT=$$(( $(HOST_OTEL_HTTP_PORT) + 10000 )) make dev"; fi; \
|
|
84
|
+
fi
|
|
85
|
+
@printf '%s\n' "Compose config check: make worktree-compose-config"
|
|
86
|
+
|
|
87
|
+
worktree-compose-config:
|
|
88
|
+
@if ! command -v docker >/dev/null 2>&1; then printf '%s\n' "Docker is not available; cannot render Compose config."; exit 1; fi
|
|
89
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) config
|
|
90
|
+
|
|
91
|
+
clean-worktree:
|
|
92
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) down --remove-orphans --volumes
|
|
93
|
+
|
|
94
|
+
bootstrap:
|
|
95
|
+
GOPROXY=$(GOPROXY) GOSUMDB=$(GOSUMDB) $(COMPOSE) -f $(DEV_COMPOSE_FILE) build $(DEV_SERVICE)
|
|
96
|
+
|
|
97
|
+
doctor:
|
|
98
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) ./scripts/doctor
|
|
99
|
+
|
|
100
|
+
dev: proto
|
|
101
|
+
GOPROXY=$(GOPROXY) GOSUMDB=$(GOSUMDB) $(COMPOSE) -f $(DEV_COMPOSE_FILE) up $(DEV_SERVICE) {{DEPENDENCY_STORE}} otel-collector
|
|
102
|
+
|
|
103
|
+
dev-shell:
|
|
104
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) bash
|
|
105
|
+
|
|
106
|
+
tidy:
|
|
107
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) go mod tidy
|
|
108
|
+
|
|
109
|
+
proto:
|
|
110
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) bash -lc "cd api && buf generate"
|
|
111
|
+
|
|
112
|
+
lint: proto
|
|
113
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) bash -lc "cd api && buf lint && cd .. && golangci-lint run --disable-all --enable=errcheck --enable=govet --enable=ineffassign --enable=staticcheck --enable=unused ./..."
|
|
114
|
+
|
|
115
|
+
test: proto
|
|
116
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) go test ./...
|
|
117
|
+
|
|
118
|
+
verify: doctor lint test build
|
|
119
|
+
|
|
120
|
+
run: proto
|
|
121
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm --service-ports $(DEV_SERVICE)
|
|
122
|
+
|
|
123
|
+
up: proto
|
|
124
|
+
GOPROXY=$(GOPROXY) GOSUMDB=$(GOSUMDB) $(COMPOSE) -f $(DEV_COMPOSE_FILE) up $(DEV_SERVICE) {{DEPENDENCY_STORE}} otel-collector
|
|
125
|
+
|
|
126
|
+
down:
|
|
127
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) down --remove-orphans
|
|
128
|
+
|
|
129
|
+
logs:
|
|
130
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) logs -f
|
|
131
|
+
|
|
132
|
+
build: proto
|
|
133
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) run --rm $(DEV_SERVICE) go build -o bin/$(APP_NAME) ./cmd/server
|
|
134
|
+
|
|
135
|
+
clean:
|
|
136
|
+
$(COMPOSE) -f $(DEV_COMPOSE_FILE) down --remove-orphans
|
|
137
|
+
|
|
138
|
+
help:
|
|
139
|
+
@printf '%s\n' "Common commands:" " make bootstrap Prepare the development environment" " make doctor Check required tools and project configuration" " make lint Run static analysis" " make test Run tests" " make verify Run the complete local verification contract" " make build Build the application" " make clean Remove generated runtime state" " make help Show this command summary"
|
|
140
|
+
|
|
141
|
+
docker-build: proto
|
|
142
|
+
docker build --platform $(DOCKER_PLATFORM) --build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) --build-arg RUNTIME_IMAGE=$(RUNTIME_IMAGE) --build-arg GOPROXY=$(GOPROXY) --build-arg GOSUMDB=$(GOSUMDB) -t $(IMAGE_REF) .
|
|
143
|
+
|
|
144
|
+
docker-run:
|
|
145
|
+
docker run --rm -p $(HOST_HTTP_PORT):$(HTTP_PORT) -p $(HOST_GRPC_PORT):$(GRPC_PORT) $(IMAGE_REF)
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# {{SERVICE_NAME}}
|
|
2
|
+
|
|
3
|
+
This project was generated by BiucingCLI.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
- Go
|
|
8
|
+
- Gin
|
|
9
|
+
- Protobuf
|
|
10
|
+
- Buf
|
|
11
|
+
- Docker Compose
|
|
12
|
+
- OpenTelemetry
|
|
13
|
+
- Docker
|
|
14
|
+
|
|
15
|
+
## Project Layout
|
|
16
|
+
|
|
17
|
+
- `cmd/server`: application startup and server wiring
|
|
18
|
+
- `internal/config`: config loading and overrides
|
|
19
|
+
- `internal/handler`: HTTP handlers
|
|
20
|
+
- `internal/service`: business logic
|
|
21
|
+
- `internal/transport`: gRPC server wiring
|
|
22
|
+
- `internal/runtime`: coordinated HTTP/gRPC serving and bounded shutdown
|
|
23
|
+
- `internal/telemetry`: OpenTelemetry setup
|
|
24
|
+
- `api/proto`: protobuf contracts
|
|
25
|
+
- `deploy`: local compose and collector config
|
|
26
|
+
|
|
27
|
+
## Docker Workflow
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
make bootstrap
|
|
31
|
+
make dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `make up` when you want the service, `{{DEPENDENCY_STORE}}`, and the OpenTelemetry Collector to start together with hot reload inside Docker.
|
|
35
|
+
|
|
36
|
+
## Available Commands
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
make bootstrap
|
|
40
|
+
make dev
|
|
41
|
+
make dev-shell
|
|
42
|
+
make doctor
|
|
43
|
+
make proto
|
|
44
|
+
make lint
|
|
45
|
+
make test
|
|
46
|
+
make verify
|
|
47
|
+
make build
|
|
48
|
+
make docker-build
|
|
49
|
+
make docker-run
|
|
50
|
+
make clean
|
|
51
|
+
make help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Environment
|
|
55
|
+
|
|
56
|
+
- `Brewfile`: optional host workstation tool installation
|
|
57
|
+
- `.mise.toml`: pinned Go and Buf versions for host workflows
|
|
58
|
+
- `Dockerfile.dev`: Go development image with `air`, `buf`, and `golangci-lint`
|
|
59
|
+
- `compose.dev.yaml`: Docker development topology with the service, `{{DEPENDENCY_STORE}}`, and the collector
|
|
60
|
+
- `.air.toml`: hot reload config for the development container
|
|
61
|
+
- `scripts/bootstrap`: host-oriented setup helper when you do not use Docker
|
|
62
|
+
- `scripts/doctor`: local environment checks
|
|
63
|
+
- `make proto`: generate protobuf code through `Buf` inside Docker
|
|
64
|
+
- `make test`: generate protobuf code, then run HTTP and in-memory gRPC contract tests inside Docker
|
|
65
|
+
- `make verify`: run doctor, protobuf generation, lint, and tests together inside Docker
|
|
66
|
+
- the development image prewarms `go mod download`; the first `make proto` may still fetch remote Buf plugin artifacts when the cache is empty
|
|
67
|
+
- `GOPROXY` and `GOSUMDB` can be overridden on `make bootstrap`, `make dev`, `make up`, and `make docker-build` when your network needs a different Go module proxy or checksum policy
|
|
68
|
+
|
|
69
|
+
## Runtime Defaults
|
|
70
|
+
|
|
71
|
+
- HTTP port: `{{HTTP_PORT}}`
|
|
72
|
+
- gRPC port: `{{GRPC_PORT}}`
|
|
73
|
+
- Proto package: `{{PROTO_PACKAGE}}`
|
|
74
|
+
- Local dependency store: `{{DEPENDENCY_STORE}}`
|
|
75
|
+
- OTLP endpoint: `{{OTEL_EXPORTER_ENDPOINT}}`
|
|
76
|
+
- HTTP read timeout: `5s`
|
|
77
|
+
- HTTP read-header timeout: `5s`
|
|
78
|
+
- HTTP write timeout: `15s`
|
|
79
|
+
- HTTP idle timeout: `60s`
|
|
80
|
+
- Graceful shutdown timeout: `10s`
|
|
81
|
+
|
|
82
|
+
## Runtime Safety
|
|
83
|
+
|
|
84
|
+
- `SIGINT` and `SIGTERM` start one coordinated shutdown for HTTP, gRPC, and OpenTelemetry.
|
|
85
|
+
- The gRPC health service switches to `NOT_SERVING` before draining active RPCs.
|
|
86
|
+
- HTTP stops accepting new work and drains in-flight requests with the configured deadline.
|
|
87
|
+
- If gRPC graceful stop exceeds `server.shutdown_timeout_seconds`, the server is force-stopped and the process exits non-zero.
|
|
88
|
+
- The runtime image checks `GET /healthz` every 10 seconds. Compose allows 15 seconds for the default 10-second shutdown window.
|
|
89
|
+
|
|
90
|
+
## Local Workflows
|
|
91
|
+
|
|
92
|
+
Start the Docker development topology:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
make dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Open a shell in the development container:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
make dev-shell
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Run the composed local topology:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
make up
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Stop the composed topology:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
make down
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Tail compose logs:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
make logs
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Build the runtime image:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
make docker-build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Run the runtime image directly:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
make docker-run
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Worktree Workflow
|
|
135
|
+
|
|
136
|
+
This starter is safe to run from parallel Git worktrees when each worktree keeps its own identity and host ports.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
make worktree-info
|
|
140
|
+
make worktree-doctor
|
|
141
|
+
make worktree-compose-config
|
|
142
|
+
HOST_HTTP_PORT=8081 HOST_GRPC_PORT=9091 HOST_DEPENDENCY_STORE_PORT=5433 make up
|
|
143
|
+
make clean-worktree
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- `WORKTREE_LABEL` is derived from the worktree directory name for display.
|
|
147
|
+
- `WORKTREE_ID` is derived from the current worktree path by default and can be overridden.
|
|
148
|
+
- `COMPOSE_PROJECT_NAME` defaults to `{{SERVICE_NAME}}-$(WORKTREE_ID)`, so Compose containers, networks, dependency stores, and cache volumes stay scoped to the worktree.
|
|
149
|
+
- `IMAGE` defaults to the worktree slug and `TAG` defaults to `dev`, so runtime image tags do not overwrite another worktree by default.
|
|
150
|
+
- `GOCACHE`, `GOMODCACHE`, and `GOLANGCI_LINT_CACHE` stay under the current worktree's `.cache/` directory.
|
|
151
|
+
- The Docker dev workflow mounts Go build, module, and lint caches as Compose-scoped volumes, so dependency versions and downloads do not bleed across worktrees.
|
|
152
|
+
- `HOST_HTTP_PORT`, `HOST_GRPC_PORT`, `HOST_DEPENDENCY_STORE_PORT`, `HOST_OTEL_GRPC_PORT`, and `HOST_OTEL_HTTP_PORT` can be overridden when several worktrees run at once.
|
|
153
|
+
- `make worktree-doctor` checks whether published host ports are already in use and prints suggested overrides.
|
|
154
|
+
- `make worktree-compose-config` renders the current worktree's Compose config without starting containers.
|
|
155
|
+
- `make clean-worktree` removes only the current worktree's Compose containers, networks, and volumes.
|
|
156
|
+
|
|
157
|
+
## Contracts
|
|
158
|
+
|
|
159
|
+
The canonical service contract lives under `api/proto/service/v1/service.proto`.
|
|
160
|
+
Because the template accepts a caller-defined protobuf package while keeping a stable starter file layout, Buf exempts only `PACKAGE_DIRECTORY_MATCH`; every other `STANDARD` lint rule remains enabled.
|
|
161
|
+
|
|
162
|
+
Generate Go code with:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
make proto
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The generated server registers `{{PROTO_PACKAGE}}.{{SERVICE_TYPE_NAME}}Service/Ping` on the configured gRPC port. The test suite calls the generated Go client over an in-memory gRPC listener and verifies the full method name plus the `message` and `service` response fields.
|
|
169
|
+
|
|
170
|
+
With the service running, exercise the same contract from the command line:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
grpcurl -plaintext \
|
|
174
|
+
-d '{"requestId":"local-check"}' \
|
|
175
|
+
127.0.0.1:{{GRPC_PORT}} \
|
|
176
|
+
{{PROTO_PACKAGE}}.{{SERVICE_TYPE_NAME}}Service/Ping
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Observability
|
|
180
|
+
|
|
181
|
+
The template includes a local `OpenTelemetry Collector` config at `deploy/otel-collector.yaml`.
|
|
182
|
+
|
|
183
|
+
When you run `make up` or `make dev`, the service exports telemetry to the collector container. When you run `make docker-run`, the service uses the endpoint from `configs/config.yaml` unless overridden by `OTEL_EXPORTER_OTLP_ENDPOINT`.
|
|
184
|
+
|
|
185
|
+
## Source of Truth
|
|
186
|
+
|
|
187
|
+
- `api/proto/*.proto`: RPC and message contracts
|
|
188
|
+
- `api/buf.yaml` and `api/buf.gen.yaml`: protobuf workflow
|
|
189
|
+
- `configs/config.yaml`: local service defaults
|
|
190
|
+
- `deploy/compose.yaml`: local composed development
|
|
191
|
+
- `Makefile`: supported team commands
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package {{PROTO_PACKAGE}};
|
|
4
|
+
|
|
5
|
+
option go_package = "{{MODULE_NAME}}/api/gen/go/service/v1;servicev1";
|
|
6
|
+
|
|
7
|
+
service {{SERVICE_TYPE_NAME}}Service {
|
|
8
|
+
rpc Ping(PingRequest) returns (PingResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message PingRequest {
|
|
12
|
+
string request_id = 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message PingResponse {
|
|
16
|
+
string message = 1;
|
|
17
|
+
string service = 2;
|
|
18
|
+
}
|