@topogram/cli 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +67 -0
- package/CHANGELOG.md +240 -0
- package/README.md +223 -0
- package/package.json +51 -0
- package/src/adoption/index.js +3 -0
- package/src/adoption/plan.js +702 -0
- package/src/adoption/reporting.js +464 -0
- package/src/adoption/review-groups.js +313 -0
- package/src/agent-ops/query-builders.js +5012 -0
- package/src/archive/archive.js +141 -0
- package/src/archive/compact.js +26 -0
- package/src/archive/jsonl.js +70 -0
- package/src/archive/resolver-bridge.js +82 -0
- package/src/archive/schema.js +87 -0
- package/src/archive/unarchive.js +108 -0
- package/src/catalog.js +752 -0
- package/src/cli/catalog-alias.js +166 -0
- package/src/cli.js +9738 -0
- package/src/component-behavior.js +173 -0
- package/src/example-implementation.js +91 -0
- package/src/format.js +19 -0
- package/src/generator/adapters.d.ts +4 -0
- package/src/generator/adapters.js +325 -0
- package/src/generator/api.d.ts +1 -0
- package/src/generator/api.js +1196 -0
- package/src/generator/check.js +355 -0
- package/src/generator/component-conformance.js +767 -0
- package/src/generator/components.js +39 -0
- package/src/generator/context/bundle.js +291 -0
- package/src/generator/context/diff.js +256 -0
- package/src/generator/context/digest.js +182 -0
- package/src/generator/context/domain-coverage.js +94 -0
- package/src/generator/context/domain-page.js +137 -0
- package/src/generator/context/index.js +42 -0
- package/src/generator/context/report.js +121 -0
- package/src/generator/context/shared.js +1397 -0
- package/src/generator/context/slice.js +703 -0
- package/src/generator/context/task-mode.js +466 -0
- package/src/generator/docs.js +327 -0
- package/src/generator/index.js +161 -0
- package/src/generator/native/parity-bundle.js +311 -0
- package/src/generator/output.js +300 -0
- package/src/generator/registry.js +482 -0
- package/src/generator/runtime/app-bundle.js +456 -0
- package/src/generator/runtime/bundle-shared.js +166 -0
- package/src/generator/runtime/compile-check.js +163 -0
- package/src/generator/runtime/deployment.js +287 -0
- package/src/generator/runtime/environment.js +635 -0
- package/src/generator/runtime/index.js +32 -0
- package/src/generator/runtime/runtime-check.js +554 -0
- package/src/generator/runtime/shared.js +515 -0
- package/src/generator/runtime/smoke.js +219 -0
- package/src/generator/schema.js +204 -0
- package/src/generator/sdlc/board.js +66 -0
- package/src/generator/sdlc/doc-page.js +53 -0
- package/src/generator/sdlc/index.js +23 -0
- package/src/generator/sdlc/release-notes.js +62 -0
- package/src/generator/sdlc/traceability-matrix.js +65 -0
- package/src/generator/shared.js +29 -0
- package/src/generator/surfaces/contracts.js +146 -0
- package/src/generator/surfaces/databases/contract.js +40 -0
- package/src/generator/surfaces/databases/index.js +84 -0
- package/src/generator/surfaces/databases/lifecycle-shared.d.ts +1 -0
- package/src/generator/surfaces/databases/lifecycle-shared.js +612 -0
- package/src/generator/surfaces/databases/migration-plan.js +281 -0
- package/src/generator/surfaces/databases/postgres/capabilities.js +14 -0
- package/src/generator/surfaces/databases/postgres/drizzle.js +99 -0
- package/src/generator/surfaces/databases/postgres/index.js +9 -0
- package/src/generator/surfaces/databases/postgres/lifecycle.js +16 -0
- package/src/generator/surfaces/databases/postgres/prisma.js +159 -0
- package/src/generator/surfaces/databases/postgres/sql-migration.js +102 -0
- package/src/generator/surfaces/databases/postgres/sql-schema.js +34 -0
- package/src/generator/surfaces/databases/shared.d.ts +1 -0
- package/src/generator/surfaces/databases/shared.js +350 -0
- package/src/generator/surfaces/databases/snapshot.js +96 -0
- package/src/generator/surfaces/databases/sqlite/capabilities.js +14 -0
- package/src/generator/surfaces/databases/sqlite/index.js +8 -0
- package/src/generator/surfaces/databases/sqlite/lifecycle.js +16 -0
- package/src/generator/surfaces/databases/sqlite/prisma.js +143 -0
- package/src/generator/surfaces/databases/sqlite/sql-migration.js +65 -0
- package/src/generator/surfaces/databases/sqlite/sql-schema.js +27 -0
- package/src/generator/surfaces/index.js +25 -0
- package/src/generator/surfaces/native/swiftui-app.js +38 -0
- package/src/generator/surfaces/native/swiftui-templates/Package.swift.txt +20 -0
- package/src/generator/surfaces/native/swiftui-templates/README.generated.md +26 -0
- package/src/generator/surfaces/native/swiftui-templates/runtime/DynamicScreens.swift +682 -0
- package/src/generator/surfaces/native/swiftui-templates/runtime/TodoAPIClient.swift +156 -0
- package/src/generator/surfaces/native/swiftui-templates/runtime/TodoSwiftUIApp.swift +44 -0
- package/src/generator/surfaces/native/swiftui-templates/runtime/Visibility.swift +183 -0
- package/src/generator/surfaces/services/express.d.ts +1 -0
- package/src/generator/surfaces/services/express.js +766 -0
- package/src/generator/surfaces/services/hono.d.ts +1 -0
- package/src/generator/surfaces/services/hono.js +204 -0
- package/src/generator/surfaces/services/index.js +42 -0
- package/src/generator/surfaces/services/persistence-wiring.js +240 -0
- package/src/generator/surfaces/services/runtime-helpers.js +631 -0
- package/src/generator/surfaces/services/server-contract.js +80 -0
- package/src/generator/surfaces/services/stateless.d.ts +1 -0
- package/src/generator/surfaces/services/stateless.js +97 -0
- package/src/generator/surfaces/shared.js +64 -0
- package/src/generator/surfaces/web/api-client.js +1 -0
- package/src/generator/surfaces/web/forms.js +1 -0
- package/src/generator/surfaces/web/index.d.ts +2 -0
- package/src/generator/surfaces/web/index.js +53 -0
- package/src/generator/surfaces/web/react-components.js +248 -0
- package/src/generator/surfaces/web/react.js +538 -0
- package/src/generator/surfaces/web/routes.js +1 -0
- package/src/generator/surfaces/web/screens.js +1 -0
- package/src/generator/surfaces/web/shared.js +369 -0
- package/src/generator/surfaces/web/sveltekit-actions.js +28 -0
- package/src/generator/surfaces/web/sveltekit-components.js +234 -0
- package/src/generator/surfaces/web/sveltekit.js +426 -0
- package/src/generator/surfaces/web/ui-web-contract.js +65 -0
- package/src/generator/surfaces/web/vanilla.js +239 -0
- package/src/generator/verification.js +84 -0
- package/src/generator.js +1 -0
- package/src/import/core/context.js +52 -0
- package/src/import/core/contracts.js +23 -0
- package/src/import/core/registry.js +81 -0
- package/src/import/core/runner.js +646 -0
- package/src/import/core/shared.js +910 -0
- package/src/import/enrichers/auth-session.js +18 -0
- package/src/import/enrichers/django-rest.js +226 -0
- package/src/import/enrichers/doc-linking.js +20 -0
- package/src/import/enrichers/rails-controllers.js +246 -0
- package/src/import/enrichers/rails-models.js +130 -0
- package/src/import/enrichers/workflow-target-state.js +10 -0
- package/src/import/extractors/api/aspnet-core.js +304 -0
- package/src/import/extractors/api/django-routes.js +318 -0
- package/src/import/extractors/api/express.js +154 -0
- package/src/import/extractors/api/fastify.js +371 -0
- package/src/import/extractors/api/flutter-dio.js +135 -0
- package/src/import/extractors/api/generic-route-fallback.js +90 -0
- package/src/import/extractors/api/graphql-code-first.js +565 -0
- package/src/import/extractors/api/graphql-sdl.js +309 -0
- package/src/import/extractors/api/jaxrs.js +303 -0
- package/src/import/extractors/api/micronaut.js +213 -0
- package/src/import/extractors/api/next-route.js +50 -0
- package/src/import/extractors/api/next-server-action.js +51 -0
- package/src/import/extractors/api/nextauth.js +52 -0
- package/src/import/extractors/api/openapi-code.js +242 -0
- package/src/import/extractors/api/openapi.js +232 -0
- package/src/import/extractors/api/rails-routes.js +230 -0
- package/src/import/extractors/api/react-native-repository.js +128 -0
- package/src/import/extractors/api/retrofit.js +103 -0
- package/src/import/extractors/api/spring-web.js +372 -0
- package/src/import/extractors/api/swift-webapi.js +116 -0
- package/src/import/extractors/api/trpc.js +212 -0
- package/src/import/extractors/db/django-models.js +232 -0
- package/src/import/extractors/db/dotnet-models.js +93 -0
- package/src/import/extractors/db/drizzle.js +242 -0
- package/src/import/extractors/db/ef-core.js +221 -0
- package/src/import/extractors/db/flutter-entities.js +120 -0
- package/src/import/extractors/db/jpa.js +120 -0
- package/src/import/extractors/db/liquibase.js +180 -0
- package/src/import/extractors/db/mybatis-xml.js +145 -0
- package/src/import/extractors/db/prisma.js +185 -0
- package/src/import/extractors/db/rails-schema.js +175 -0
- package/src/import/extractors/db/react-native-entities.js +95 -0
- package/src/import/extractors/db/room.js +193 -0
- package/src/import/extractors/db/snapshot.js +112 -0
- package/src/import/extractors/db/sql.js +180 -0
- package/src/import/extractors/db/swiftdata.js +137 -0
- package/src/import/extractors/ui/android-compose.js +230 -0
- package/src/import/extractors/ui/backend-only.js +70 -0
- package/src/import/extractors/ui/blazor.js +227 -0
- package/src/import/extractors/ui/flutter-screens.js +152 -0
- package/src/import/extractors/ui/maui-xaml.js +135 -0
- package/src/import/extractors/ui/next-app-router.js +83 -0
- package/src/import/extractors/ui/next-pages-router.js +141 -0
- package/src/import/extractors/ui/razor-pages.js +181 -0
- package/src/import/extractors/ui/react-native-screens.js +166 -0
- package/src/import/extractors/ui/react-router.js +139 -0
- package/src/import/extractors/ui/sveltekit.js +123 -0
- package/src/import/extractors/ui/swiftui.js +193 -0
- package/src/import/extractors/ui/uikit.js +175 -0
- package/src/import/extractors/verification/generic.js +290 -0
- package/src/import/extractors/workflows/generic.js +137 -0
- package/src/import/index.js +7 -0
- package/src/import/provenance.js +158 -0
- package/src/new-project.js +2107 -0
- package/src/parser.js +439 -0
- package/src/policy/review-boundaries.js +165 -0
- package/src/project-config.js +535 -0
- package/src/proofs/backend-parity.js +19 -0
- package/src/proofs/contract-audit.js +220 -0
- package/src/proofs/ios-parity.js +7 -0
- package/src/proofs/issues-parity.js +10 -0
- package/src/proofs/web-parity.js +50 -0
- package/src/realization/api/build-api-realization.js +5 -0
- package/src/realization/api/index.js +1 -0
- package/src/realization/backend/build-backend-runtime-realization.js +82 -0
- package/src/realization/backend/index.d.ts +1 -0
- package/src/realization/backend/index.js +4 -0
- package/src/realization/db/build-db-realization.js +17 -0
- package/src/realization/db/index.js +3 -0
- package/src/realization/db/migration-plan.js +5 -0
- package/src/realization/db/snapshot.js +5 -0
- package/src/realization/ui/build-ui-shared-realization.js +305 -0
- package/src/realization/ui/build-web-realization.js +189 -0
- package/src/realization/ui/index.js +2 -0
- package/src/reconcile/docs.js +280 -0
- package/src/reconcile/index.js +3 -0
- package/src/reconcile/journeys.js +441 -0
- package/src/resolver/docs.js +1 -0
- package/src/resolver/enrich/acceptance-criterion.js +14 -0
- package/src/resolver/enrich/bug.js +12 -0
- package/src/resolver/enrich/component.js +2 -0
- package/src/resolver/enrich/index.js +1 -0
- package/src/resolver/enrich/pitch.js +18 -0
- package/src/resolver/enrich/requirement.js +20 -0
- package/src/resolver/enrich/task.js +16 -0
- package/src/resolver/expressions.js +1 -0
- package/src/resolver/index.js +2422 -0
- package/src/resolver/normalize.js +1 -0
- package/src/resolver.js +1 -0
- package/src/sdlc/adopt.js +65 -0
- package/src/sdlc/check.js +86 -0
- package/src/sdlc/dod/acceptance-criterion.js +22 -0
- package/src/sdlc/dod/bug.js +26 -0
- package/src/sdlc/dod/document.js +23 -0
- package/src/sdlc/dod/index.js +25 -0
- package/src/sdlc/dod/pitch.js +23 -0
- package/src/sdlc/dod/requirement.js +34 -0
- package/src/sdlc/dod/task.js +39 -0
- package/src/sdlc/explain.js +116 -0
- package/src/sdlc/history.js +80 -0
- package/src/sdlc/paths.js +11 -0
- package/src/sdlc/release.js +106 -0
- package/src/sdlc/scaffold.js +89 -0
- package/src/sdlc/status-filter.js +54 -0
- package/src/sdlc/transition.js +112 -0
- package/src/sdlc/transitions/acceptance-criterion.js +28 -0
- package/src/sdlc/transitions/bug.js +31 -0
- package/src/sdlc/transitions/document.js +29 -0
- package/src/sdlc/transitions/index.js +56 -0
- package/src/sdlc/transitions/pitch.js +34 -0
- package/src/sdlc/transitions/requirement.js +31 -0
- package/src/sdlc/transitions/task.js +34 -0
- package/src/template-trust.js +597 -0
- package/src/validator/expressions.js +1 -0
- package/src/validator/index.js +3424 -0
- package/src/validator/kinds.js +346 -0
- package/src/validator/per-kind/acceptance-criterion.js +91 -0
- package/src/validator/per-kind/bug.js +77 -0
- package/src/validator/per-kind/component.js +274 -0
- package/src/validator/per-kind/domain.js +205 -0
- package/src/validator/per-kind/pitch.js +101 -0
- package/src/validator/per-kind/requirement.js +75 -0
- package/src/validator/per-kind/task.js +96 -0
- package/src/validator/registry.js +1 -0
- package/src/validator/utils.js +12 -0
- package/src/validator.js +1 -0
- package/src/workflows.js +7597 -0
- package/src/workspace-docs.js +265 -0
- package/template-helpers/react.js +5 -0
- package/template-helpers/sveltekit.js +5 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { getExampleImplementation } from "../../example-implementation.js";
|
|
2
|
+
import { getDefaultEnvironmentProjections, resolveRuntimeTopology, runtimeUrls } from "../runtime/shared.js";
|
|
3
|
+
|
|
4
|
+
/** Pinned toolchains for reproducible native parity stubs (document in README). */
|
|
5
|
+
export const NATIVE_PARITY_PINNED = {
|
|
6
|
+
gradleDistribution: "8.7",
|
|
7
|
+
androidGradlePlugin: "8.6.0",
|
|
8
|
+
kotlin: "1.9.24",
|
|
9
|
+
compileSdk: 34,
|
|
10
|
+
minSdk: 26,
|
|
11
|
+
targetSdk: 34,
|
|
12
|
+
swiftTools: "5.9",
|
|
13
|
+
iosDeploymentMajor: 17,
|
|
14
|
+
macOSCompanionMajor: 14
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ANDROID_PACKAGE = "io.topogram.nativeparity";
|
|
18
|
+
|
|
19
|
+
function escapeKotlinString(value) {
|
|
20
|
+
return String(value ?? "")
|
|
21
|
+
.replace(/\\/g, "\\\\")
|
|
22
|
+
.replace(/"/g, '\\"');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function escapeSwiftString(value) {
|
|
26
|
+
return String(value ?? "")
|
|
27
|
+
.replace(/\\/g, "\\\\")
|
|
28
|
+
.replace(/"/g, '\\"');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function buildNativeParityPlan(graph, options = {}) {
|
|
32
|
+
const runtimeReference = getExampleImplementation(graph, options).runtime.reference;
|
|
33
|
+
const topology = resolveRuntimeTopology(graph, options);
|
|
34
|
+
const { apiProjection, uiProjection, dbProjection } = getDefaultEnvironmentProjections(graph, options);
|
|
35
|
+
const urls = runtimeUrls(runtimeReference, topology);
|
|
36
|
+
const demoUserId = runtimeReference.demoEnv?.userId ?? null;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
type: "native_parity_plan",
|
|
40
|
+
name: "native_parity_plan",
|
|
41
|
+
projections: {
|
|
42
|
+
api: apiProjection.id,
|
|
43
|
+
ui: uiProjection.id,
|
|
44
|
+
db: dbProjection.id
|
|
45
|
+
},
|
|
46
|
+
pinned_toolchains: { ...NATIVE_PARITY_PINNED },
|
|
47
|
+
resolved_urls: {
|
|
48
|
+
PUBLIC_TOPOGRAM_API_BASE_URL: urls.api,
|
|
49
|
+
PUBLIC_TOPOGRAM_WEB_BASE_URL: urls.web
|
|
50
|
+
},
|
|
51
|
+
demo_user_id: demoUserId,
|
|
52
|
+
android: {
|
|
53
|
+
package: ANDROID_PACKAGE,
|
|
54
|
+
application_id: ANDROID_PACKAGE
|
|
55
|
+
},
|
|
56
|
+
ios: {
|
|
57
|
+
module: "TopogramNativeParity",
|
|
58
|
+
swift_tools_version: NATIVE_PARITY_PINNED.swiftTools
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function renderRootReadme(plan, urls) {
|
|
64
|
+
const demoOpsUrl =
|
|
65
|
+
"https://github.com/attebury/topogram/blob/main/docs/README.md";
|
|
66
|
+
return `# Native parity bundle
|
|
67
|
+
|
|
68
|
+
Minimal **Android (Gradle/Kotlin)** and **iOS (Swift Package / SwiftUI)** stubs wired to the same runtime URL metadata as other Topogram bundles.
|
|
69
|
+
|
|
70
|
+
## Resolved URLs (from workspace)
|
|
71
|
+
|
|
72
|
+
- **API:** \`${urls.api}\`
|
|
73
|
+
- **Web:** \`${urls.web}\`
|
|
74
|
+
|
|
75
|
+
Plan metadata: \`native-parity-plan.json\`.
|
|
76
|
+
|
|
77
|
+
## Android (\`android/\`)
|
|
78
|
+
|
|
79
|
+
Pinned AGP **${plan.pinned_toolchains.androidGradlePlugin}**, Kotlin **${plan.pinned_toolchains.kotlin}**, compile/target SDK **${plan.pinned_toolchains.compileSdk}**.
|
|
80
|
+
|
|
81
|
+
If \`gradlew\` is not present, generate the wrapper once (requires a local Gradle install):
|
|
82
|
+
|
|
83
|
+
\`\`\`bash
|
|
84
|
+
cd android
|
|
85
|
+
gradle wrapper --gradle-version ${plan.pinned_toolchains.gradleDistribution}
|
|
86
|
+
./gradlew assembleDebug
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
## iOS (\`ios/\`)
|
|
90
|
+
|
|
91
|
+
Swift tools **${plan.pinned_toolchains.swiftTools}**, iOS **${plan.pinned_toolchains.iosDeploymentMajor}+** (Swift Package).
|
|
92
|
+
|
|
93
|
+
Open \`Package.swift\` in Xcode or build on macOS:
|
|
94
|
+
|
|
95
|
+
\`\`\`bash
|
|
96
|
+
cd ios
|
|
97
|
+
swift build
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
(\`swift build\` requires Swift; iOS-only SwiftUI may require Xcode for simulator/device builds.)
|
|
101
|
+
|
|
102
|
+
## Promotion
|
|
103
|
+
|
|
104
|
+
Native parity promotion is deferred while the active docs focus on generated app demos. See [Topogram docs](${demoOpsUrl}).
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function renderAndroidFiles(plan, apiUrl) {
|
|
109
|
+
const kotlinApi = escapeKotlinString(apiUrl);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
"android/settings.gradle.kts": `pluginManagement {
|
|
113
|
+
repositories {
|
|
114
|
+
google()
|
|
115
|
+
mavenCentral()
|
|
116
|
+
gradlePluginPortal()
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
dependencyResolutionManagement {
|
|
120
|
+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
121
|
+
repositories {
|
|
122
|
+
google()
|
|
123
|
+
mavenCentral()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
rootProject.name = "TopogramNativeParity"
|
|
128
|
+
include(":app")
|
|
129
|
+
`,
|
|
130
|
+
"android/build.gradle.kts": `plugins {
|
|
131
|
+
alias(libs.plugins.android.application) apply false
|
|
132
|
+
alias(libs.plugins.kotlin.android) apply false
|
|
133
|
+
}
|
|
134
|
+
`,
|
|
135
|
+
"android/gradle.properties": `org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|
136
|
+
android.useAndroidX=true
|
|
137
|
+
android.nonTransitiveRClass=true
|
|
138
|
+
kotlin.code.style=official
|
|
139
|
+
`,
|
|
140
|
+
"android/gradle/libs.versions.toml": `[versions]
|
|
141
|
+
agp = "${plan.pinned_toolchains.androidGradlePlugin}"
|
|
142
|
+
kotlin = "${plan.pinned_toolchains.kotlin}"
|
|
143
|
+
compileSdk = "${plan.pinned_toolchains.compileSdk}"
|
|
144
|
+
minSdk = "${plan.pinned_toolchains.minSdk}"
|
|
145
|
+
targetSdk = "${plan.pinned_toolchains.targetSdk}"
|
|
146
|
+
appcompat = "1.6.1"
|
|
147
|
+
|
|
148
|
+
[libraries]
|
|
149
|
+
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
|
150
|
+
|
|
151
|
+
[plugins]
|
|
152
|
+
android-application = { id = "com.android.application", version.ref = "agp" }
|
|
153
|
+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
|
154
|
+
`,
|
|
155
|
+
"android/gradle/wrapper/gradle-wrapper.properties": `distributionBase=GRADLE_USER_HOME
|
|
156
|
+
distributionPath=wrapper/dists
|
|
157
|
+
distributionUrl=https\\://services.gradle.org/distributions/gradle-${plan.pinned_toolchains.gradleDistribution}-bin.zip
|
|
158
|
+
networkTimeout=10000
|
|
159
|
+
validateDistributionUrl=true
|
|
160
|
+
zipStoreBase=GRADLE_USER_HOME
|
|
161
|
+
zipStorePath=wrapper/dists
|
|
162
|
+
`,
|
|
163
|
+
"android/app/build.gradle.kts": `plugins {
|
|
164
|
+
alias(libs.plugins.android.application)
|
|
165
|
+
alias(libs.plugins.kotlin.android)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
android {
|
|
169
|
+
namespace = "${ANDROID_PACKAGE}"
|
|
170
|
+
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
171
|
+
|
|
172
|
+
defaultConfig {
|
|
173
|
+
applicationId = "${ANDROID_PACKAGE}"
|
|
174
|
+
minSdk = libs.versions.minSdk.get().toInt()
|
|
175
|
+
targetSdk = libs.versions.targetSdk.get().toInt()
|
|
176
|
+
versionCode = 1
|
|
177
|
+
versionName = "1.0"
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
buildTypes {
|
|
181
|
+
release {
|
|
182
|
+
isMinifyEnabled = false
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
kotlinOptions {
|
|
187
|
+
jvmTarget = "17"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
dependencies {
|
|
192
|
+
implementation(libs.androidx.appcompat)
|
|
193
|
+
}
|
|
194
|
+
`,
|
|
195
|
+
[`android/app/src/main/java/${ANDROID_PACKAGE.replaceAll(".", "/")}/ParityConfig.kt`]: `package ${ANDROID_PACKAGE}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Resolved from Topogram native-parity bundle generation (matches runtimeUrls.api).
|
|
199
|
+
*/
|
|
200
|
+
object ParityConfig {
|
|
201
|
+
const val API_BASE_URL: String = "${kotlinApi}"
|
|
202
|
+
}
|
|
203
|
+
`,
|
|
204
|
+
[`android/app/src/main/java/${ANDROID_PACKAGE.replaceAll(".", "/")}/MainActivity.kt`]: `package ${ANDROID_PACKAGE}
|
|
205
|
+
|
|
206
|
+
import android.os.Bundle
|
|
207
|
+
import android.widget.TextView
|
|
208
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
209
|
+
|
|
210
|
+
class MainActivity : AppCompatActivity() {
|
|
211
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
212
|
+
super.onCreate(savedInstanceState)
|
|
213
|
+
val label = TextView(this).apply {
|
|
214
|
+
text = ParityConfig.API_BASE_URL
|
|
215
|
+
textSize = 14f
|
|
216
|
+
setPadding(32, 32, 32, 32)
|
|
217
|
+
}
|
|
218
|
+
setContentView(label)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
`,
|
|
222
|
+
"android/app/src/main/AndroidManifest.xml": `<?xml version="1.0" encoding="utf-8"?>
|
|
223
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
224
|
+
|
|
225
|
+
<application
|
|
226
|
+
android:allowBackup="true"
|
|
227
|
+
android:label="Topogram parity"
|
|
228
|
+
android:supportsRtl="true"
|
|
229
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
|
230
|
+
<activity
|
|
231
|
+
android:name=".MainActivity"
|
|
232
|
+
android:exported="true">
|
|
233
|
+
<intent-filter>
|
|
234
|
+
<action android:name="android.intent.action.MAIN" />
|
|
235
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
236
|
+
</intent-filter>
|
|
237
|
+
</activity>
|
|
238
|
+
</application>
|
|
239
|
+
|
|
240
|
+
</manifest>
|
|
241
|
+
`
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function renderIosFiles(plan, apiUrl) {
|
|
246
|
+
const swiftApi = escapeSwiftString(apiUrl);
|
|
247
|
+
const iosMajor = plan.pinned_toolchains.iosDeploymentMajor;
|
|
248
|
+
const macMajor = plan.pinned_toolchains.macOSCompanionMajor;
|
|
249
|
+
// Platforms use Swift literal suffixes .v17 — templating `${iosMajor}` yields `.v17`.
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
"ios/Package.swift": `// swift-tools-version: ${plan.pinned_toolchains.swiftTools}
|
|
253
|
+
import PackageDescription
|
|
254
|
+
|
|
255
|
+
let package = Package(
|
|
256
|
+
name: "TopogramNativeParity",
|
|
257
|
+
platforms: [.iOS(.v${iosMajor}), .macOS(.v${macMajor})],
|
|
258
|
+
products: [
|
|
259
|
+
.library(name: "TopogramNativeParity", targets: ["TopogramNativeParity"])
|
|
260
|
+
],
|
|
261
|
+
targets: [
|
|
262
|
+
.target(
|
|
263
|
+
name: "TopogramNativeParity",
|
|
264
|
+
path: "Sources/TopogramNativeParity"
|
|
265
|
+
)
|
|
266
|
+
]
|
|
267
|
+
)
|
|
268
|
+
`,
|
|
269
|
+
"ios/Sources/TopogramNativeParity/ParityConfig.swift": `import Foundation
|
|
270
|
+
|
|
271
|
+
public enum ParityConfig {
|
|
272
|
+
/// Resolved from Topogram runtimeUrls at generation time.
|
|
273
|
+
public static let apiBaseURL: URL = URL(string: "${swiftApi}")!
|
|
274
|
+
}
|
|
275
|
+
`,
|
|
276
|
+
"ios/Sources/TopogramNativeParity/ParityRootView.swift": `import SwiftUI
|
|
277
|
+
|
|
278
|
+
public struct ParityRootView: View {
|
|
279
|
+
public init() {}
|
|
280
|
+
|
|
281
|
+
public var body: some View {
|
|
282
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
283
|
+
Text("Topogram native parity stub")
|
|
284
|
+
.font(.headline)
|
|
285
|
+
Text(ParityConfig.apiBaseURL.absoluteString)
|
|
286
|
+
.font(.footnote)
|
|
287
|
+
.textSelection(.enabled)
|
|
288
|
+
}
|
|
289
|
+
.padding()
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export function generateNativeParityPlan(graph, options = {}) {
|
|
297
|
+
return buildNativeParityPlan(graph, options);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function generateNativeParityBundle(graph, options = {}) {
|
|
301
|
+
const plan = buildNativeParityPlan(graph, options);
|
|
302
|
+
const runtimeReference = getExampleImplementation(graph, options).runtime.reference;
|
|
303
|
+
const urls = runtimeUrls(runtimeReference, resolveRuntimeTopology(graph, options));
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
"native-parity-plan.json": `${JSON.stringify(plan, null, 2)}\n`,
|
|
307
|
+
"README.md": renderRootReadme(plan, urls),
|
|
308
|
+
...renderAndroidFiles(plan, urls.api),
|
|
309
|
+
...renderIosFiles(plan, urls.api)
|
|
310
|
+
};
|
|
311
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
export function buildOutputFiles(result, options = {}) {
|
|
2
|
+
if (result.target === "context-digest") {
|
|
3
|
+
return Object.keys(result.artifact)
|
|
4
|
+
.sort()
|
|
5
|
+
.map((filePath) => ({
|
|
6
|
+
path: filePath,
|
|
7
|
+
contents: result.artifact[filePath]
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (result.target === "context-diff") {
|
|
12
|
+
return [{ path: "context-diff.json", contents: result.artifact }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (result.target === "context-slice") {
|
|
16
|
+
const sliceId =
|
|
17
|
+
options.capabilityId || options.projectionId || options.entityId || options.journeyId || options.workflowId || "context";
|
|
18
|
+
return [{ path: `${sliceId}.context-slice.json`, contents: result.artifact }];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (result.target === "context-bundle") {
|
|
22
|
+
const files = [{ path: `context-bundle.${options.taskId || "bundle"}.json`, contents: result.artifact }];
|
|
23
|
+
if (options.taskId === "maintained-app" && result.artifact?.maintained_boundary) {
|
|
24
|
+
files.push({ path: "maintained-boundary.json", contents: result.artifact.maintained_boundary });
|
|
25
|
+
}
|
|
26
|
+
return files;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (result.target === "context-report") {
|
|
30
|
+
return [{ path: "context-report.json", contents: result.artifact }];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (result.target === "context-task-mode") {
|
|
34
|
+
return [{ path: `${options.modeId || "task-mode"}.context-task-mode.json`, contents: result.artifact }];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (result.target === "openapi") {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
path: options.capabilityId ? `${options.capabilityId}.openapi.json` : "openapi.json",
|
|
41
|
+
contents: result.artifact
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (result.target === "api-contract-debug") {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
path: options.capabilityId ? `${options.capabilityId}.api-contract-debug.md` : "api-contract-debug.md",
|
|
50
|
+
contents: result.artifact
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (result.target === "ui-contract-debug") {
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
path: options.projectionId ? `${options.projectionId}.ui-contract-debug.md` : "ui-contract-debug.md",
|
|
59
|
+
contents: result.artifact
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (result.target === "api-contract-graph") {
|
|
65
|
+
if (options.capabilityId) {
|
|
66
|
+
return [{ path: `${options.capabilityId}.api-contract-graph.json`, contents: result.artifact }];
|
|
67
|
+
}
|
|
68
|
+
return Object.keys(result.artifact).sort().map((capabilityId) => ({
|
|
69
|
+
path: `${capabilityId}.api-contract-graph.json`,
|
|
70
|
+
contents: result.artifact[capabilityId]
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (result.target === "ui-contract-graph") {
|
|
75
|
+
if (options.projectionId) {
|
|
76
|
+
return [{ path: `${options.projectionId}.ui-contract-graph.json`, contents: result.artifact }];
|
|
77
|
+
}
|
|
78
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
79
|
+
path: `${projectionId}.ui-contract-graph.json`,
|
|
80
|
+
contents: result.artifact[projectionId]
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (result.target === "ui-component-contract") {
|
|
85
|
+
if (result.artifact == null) {
|
|
86
|
+
throw new Error("ui-component-contract generator returned no artifact");
|
|
87
|
+
}
|
|
88
|
+
if (options.componentId) {
|
|
89
|
+
return [{ path: `${options.componentId}.ui-component-contract.json`, contents: result.artifact }];
|
|
90
|
+
}
|
|
91
|
+
return Object.keys(result.artifact).sort().map((componentId) => ({
|
|
92
|
+
path: `${componentId}.ui-component-contract.json`,
|
|
93
|
+
contents: result.artifact[componentId]
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (result.target === "component-conformance-report") {
|
|
98
|
+
const suffix = [options.projectionId, options.componentId].filter(Boolean).join(".");
|
|
99
|
+
return [{
|
|
100
|
+
path: suffix
|
|
101
|
+
? `${suffix}.component-conformance-report.json`
|
|
102
|
+
: "component-conformance-report.json",
|
|
103
|
+
contents: result.artifact
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (result.target === "component-behavior-report") {
|
|
108
|
+
const suffix = [options.projectionId, options.componentId].filter(Boolean).join(".");
|
|
109
|
+
return [{
|
|
110
|
+
path: suffix
|
|
111
|
+
? `${suffix}.component-behavior-report.json`
|
|
112
|
+
: "component-behavior-report.json",
|
|
113
|
+
contents: result.artifact
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (result.target === "ui-web-debug") {
|
|
118
|
+
return [
|
|
119
|
+
{
|
|
120
|
+
path: options.projectionId ? `${options.projectionId}.ui-web-debug.md` : "ui-web-debug.md",
|
|
121
|
+
contents: result.artifact
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (result.target === "ui-web-contract") {
|
|
127
|
+
if (options.projectionId) {
|
|
128
|
+
return [{ path: `${options.projectionId}.ui-web-contract.json`, contents: result.artifact }];
|
|
129
|
+
}
|
|
130
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
131
|
+
path: `${projectionId}.ui-web-contract.json`,
|
|
132
|
+
contents: result.artifact[projectionId]
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (
|
|
137
|
+
result.target === "sveltekit-app" ||
|
|
138
|
+
result.target === "swiftui-app" ||
|
|
139
|
+
result.target === "db-lifecycle-bundle" ||
|
|
140
|
+
result.target === "environment-bundle" ||
|
|
141
|
+
result.target === "deployment-bundle" ||
|
|
142
|
+
result.target === "runtime-smoke-bundle" ||
|
|
143
|
+
result.target === "runtime-check-bundle" ||
|
|
144
|
+
result.target === "compile-check-bundle" ||
|
|
145
|
+
result.target === "app-bundle" ||
|
|
146
|
+
result.target === "persistence-scaffold" ||
|
|
147
|
+
result.target === "hono-server" ||
|
|
148
|
+
result.target === "express-server"
|
|
149
|
+
) {
|
|
150
|
+
return Object.keys(result.artifact)
|
|
151
|
+
.sort()
|
|
152
|
+
.map((filePath) => ({
|
|
153
|
+
path: filePath,
|
|
154
|
+
contents: result.artifact[filePath]
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (result.target === "db-contract-debug") {
|
|
159
|
+
return [
|
|
160
|
+
{
|
|
161
|
+
path: options.projectionId ? `${options.projectionId}.db-contract-debug.md` : "db-contract-debug.md",
|
|
162
|
+
contents: result.artifact
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (result.target === "db-contract-graph") {
|
|
168
|
+
if (options.projectionId) {
|
|
169
|
+
return [{ path: `${options.projectionId}.db-contract-graph.json`, contents: result.artifact }];
|
|
170
|
+
}
|
|
171
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
172
|
+
path: `${projectionId}.db-contract-graph.json`,
|
|
173
|
+
contents: result.artifact[projectionId]
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (result.target === "db-schema-snapshot") {
|
|
178
|
+
if (options.projectionId) {
|
|
179
|
+
return [{ path: `${options.projectionId}.db-schema-snapshot.json`, contents: result.artifact }];
|
|
180
|
+
}
|
|
181
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
182
|
+
path: `${projectionId}.db-schema-snapshot.json`,
|
|
183
|
+
contents: result.artifact[projectionId]
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (result.target === "db-migration-plan") {
|
|
188
|
+
return [
|
|
189
|
+
{
|
|
190
|
+
path: options.projectionId ? `${options.projectionId}.db-migration-plan.json` : "db-migration-plan.json",
|
|
191
|
+
contents: result.artifact
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (result.target === "db-lifecycle-plan") {
|
|
197
|
+
if (options.projectionId) {
|
|
198
|
+
return [{ path: `${options.projectionId}.db-lifecycle-plan.json`, contents: result.artifact }];
|
|
199
|
+
}
|
|
200
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
201
|
+
path: `${projectionId}.db-lifecycle-plan.json`,
|
|
202
|
+
contents: result.artifact[projectionId]
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (result.target === "sql-schema") {
|
|
207
|
+
return [{ path: options.projectionId ? `${options.projectionId}.sql` : "schema.sql", contents: result.artifact }];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (result.target === "sql-migration") {
|
|
211
|
+
return [{ path: options.projectionId ? `${options.projectionId}.migration.sql` : "migration.sql", contents: result.artifact }];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (result.target === "environment-plan") {
|
|
215
|
+
return [{ path: "environment-plan.json", contents: result.artifact }];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (result.target === "deployment-plan") {
|
|
219
|
+
return [{ path: options.profileId ? `deployment-plan.${options.profileId}.json` : "deployment-plan.json", contents: result.artifact }];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (result.target === "runtime-smoke-plan") {
|
|
223
|
+
return [{ path: "runtime-smoke-plan.json", contents: result.artifact }];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (result.target === "runtime-check-plan") {
|
|
227
|
+
return [{ path: "runtime-check-plan.json", contents: result.artifact }];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (result.target === "compile-check-plan") {
|
|
231
|
+
return [{ path: "compile-check-plan.json", contents: result.artifact }];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (result.target === "app-bundle-plan") {
|
|
235
|
+
return [{ path: "app-bundle-plan.json", contents: result.artifact }];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (result.target === "prisma-schema") {
|
|
239
|
+
return [{ path: "schema.prisma", contents: result.artifact }];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (result.target === "drizzle-schema") {
|
|
243
|
+
return [{ path: options.projectionId ? `${options.projectionId}.drizzle.ts` : "schema.ts", contents: result.artifact }];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (result.target === "server-contract") {
|
|
247
|
+
if (options.projectionId) {
|
|
248
|
+
return [{ path: `${options.projectionId}.server-contract.json`, contents: result.artifact }];
|
|
249
|
+
}
|
|
250
|
+
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
251
|
+
path: `${projectionId}.server-contract.json`,
|
|
252
|
+
contents: result.artifact[projectionId]
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (result.target === "shape-transform-debug") {
|
|
257
|
+
return [{ path: options.shapeId ? `${options.shapeId}.transform-debug.md` : "shape-transform-debug.md", contents: result.artifact }];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (result.target === "shape-transform-graph") {
|
|
261
|
+
if (options.shapeId) {
|
|
262
|
+
return [{ path: `${options.shapeId}.transform-graph.json`, contents: result.artifact }];
|
|
263
|
+
}
|
|
264
|
+
return Object.keys(result.artifact).sort().map((shapeId) => ({
|
|
265
|
+
path: `${shapeId}.transform-graph.json`,
|
|
266
|
+
contents: result.artifact[shapeId]
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (result.target === "docs") {
|
|
271
|
+
return [{ path: "topogram-docs.md", contents: result.artifact }];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (result.target === "docs-index") {
|
|
275
|
+
return [{ path: "docs-index.json", contents: result.artifact }];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (result.target === "verification-plan") {
|
|
279
|
+
return [{ path: "verification-plan.json", contents: result.artifact }];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (result.target === "verification-checklist") {
|
|
283
|
+
return [{ path: "verification-checklist.md", contents: result.artifact }];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (result.target !== "json-schema") {
|
|
287
|
+
throw new Error(`Unsupported file output target '${result.target}'`);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (options.shapeId) {
|
|
291
|
+
return [{ path: `${options.shapeId}.schema.json`, contents: result.artifact }];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return Object.keys(result.artifact)
|
|
295
|
+
.sort()
|
|
296
|
+
.map((shapeId) => ({
|
|
297
|
+
path: `${shapeId}.schema.json`,
|
|
298
|
+
contents: result.artifact[shapeId]
|
|
299
|
+
}));
|
|
300
|
+
}
|