Repository navigation
feat(rename): let the user choose the app's domain (--domain) - #158
Merged
Merged
Conversation
--domain=<domain> on the CLI, `domain` on the MCP generate_app tool and "domain is ..." in the generate-app skill. It replaces the template's nativeapptemplate.com (bare, subdomains, URLs, emails) and, reversed, the com.nativeapptemplate prefix: the iOS bundle ID and every other com.nativeapptemplate id (app.orangebaton.OrangeBaton.ios, test target, keychain services, log subsystem) and the Android package (app.orangebaton.orangebaton: applicationId, namespace, package/import declarations, proto java_package, google-services.json package_name, the API's FCM test), with the source directories moved from com/nativeapptemplate/<product> to the new prefix in every module and source set. rename.rb takes an optional appDomain and matches these whole, ahead of the product-name patterns, in the same single pass, so the product rename still handles what follows the prefix and never re-touches the replaced text. The package directories are moved before Pass 2 and pinned, so a domain label that is a rename token (shop.example) stays. Without --domain nothing is added: the rename is byte-for-byte today's. The domain is lowercased and must have at least two DNS labels, each starting with a letter (aapt2 rejects a package segment like _1password) and not all-numeric at the top. In the Android package a hyphen becomes _ and a Java or Kotlin keyword gets a trailing _; the run reports such labels. report.json meta.appDomain and the HTML report record the domain and the bundle ID / applicationId read back from the generated projects. Closes #157 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #157
What
--domain=<domain>(CLI),domain(MCPgenerate_app), and "domain is …" in thegenerate-appskill. Without it, nothing changes: rename.rb gets noappDomainand produces byte-for-byte today's output (<flat product>.com,com.<flat>).With
--domain=orangebaton.app(project Orange Baton):nativeapptemplate.com,api.nativeapptemplate.com,support@nativeapptemplate.com, URLsorangebaton.app,api.orangebaton.app,support@orangebaton.appcom.nativeapptemplate.NativeAppTemplate.ios(PRODUCT_BUNDLE_IDENTIFIER),…NativeAppTemplateTests, keychain services, log subsystemcom.nativeapptemplateapp.orangebaton.OrangeBaton.ios,app.orangebaton.OrangeBatonTests,app.orangebaton.OrangeBaton.…,app.orangebatoncom.nativeapptemplate.nativeapptemplate: applicationId, namespace (app, model),package/import, protojava_package,google-services.jsonpackage_nameapp.orangebaton.orangebatoncom/nativeapptemplate/nativeapptemplate(app main/test/androidTest, model main/test, …) and the slash form in tests (File("src/main/kotlin/com/…"))app/orangebaton/orangebatondevices_controller_test.rbbundle ids (com.nativeapptemplate.example,com.nativeapptemplate.nativeapptemplate)app.orangebaton.example,app.orangebaton.orangebatonLinks to the template's repos and
nativeapptemplate-agent(#155/#156) are still masked and untouched. The API's APNstopiclives in its credentials, not in files; the output checklist says to set it.How
src/app-domain.ts: validation, the Java/Kotlin segment mapping, derived prefixes, and reading the bundle ID / applicationId back from the generated projects.scripts/ruby/rename.rb: an optionalappDomainadds four patterns ahead of every product pattern, in the same single-pass combined regex:nativeapptemplate.com,com.nativeapptemplatebefore.nativeapptemplate…(Android, Java-safe prefix), its slash form, and any othercom.nativeapptemplate(iOS-style prefix, hyphens kept). What follows the prefix is renamed by the usual rules, and replaced text is never scanned again. A new Pass 1.5 moves<root>/com/nativeapptemplateunder the prefix before Pass 2. It removes the emptiedcom/(a lone.DS_Storedoesn't count) and pins the new directories, so Pass 2 leaves a label likeshopinshop.examplealone.meta.appDomain(domain, custom, prefixes, remapped labels, the iOS bundle ID and Android applicationId read back from the output). The HTML header shows the domain, and the Domain plan section has an "App identifiers" card.Validation
Lowercased. Needs ≥2 labels, each a DNS label (1–63
[a-z0-9-], no leading or trailing hyphen) and ≤253 chars total. Rejects a scheme, path, port or email, an all-numeric top label (IP), and a label starting with a digit. I checked the digit case: the JLS's_prefix givesapp._1orange.orangebaton, which aapt2 rejects (attribute 'package' in <manifest> tag is not a valid Android package name). In the Android package only,-becomes_and Java keywords/literals plus Kotlin hard keywords get a_suffix. iOS keeps hyphens. The CLI exits 2 with the message, and MCP returnsisErrorwith the same message.Tests
Unit tests cover validation, the segment mapping,
appIdentifiers, the read-back helpers,parseArgs, MCP (invalid and valid), and the report/HTML. Rename fixture tests cover: default unchanged (and--domain=<default>.comgives an identical tree); the custom domain for URLs, subdomains, emails, iOS, Android, directories, and the protected link (Layer 1 clean); hyphen mapping; and a domain label that is a rename token. I broke the code six ways (no pin, domain patterns last, no dir move, no keyword/digit rule, no hyphen mapping, no .DS_Store handling) and each time the matching tests failed.Sanity check (real paid substrates, rsync'd to a temp dir, Orange Baton plan +
--domain=orangebaton.app)nativeapptemplate.com, 0com.orangebaton/com/orangebaton, 0com.nativeapptemplate, nocom/dirs left; Layer 1 PASS ×3../gradlew --no-daemon assembleDebug: BUILD SUCCESSFUL (processDebugGoogleServices included, sincepackage_namefollows the applicationId). The APK package isapp.orangebaton.orangebaton.xcodebuild build(generic iOS Simulator): BUILD SUCCEEDED. CFBundleIdentifier isapp.orangebaton.OrangeBaton.iosplus the template'sSAMPLE_CODE_DISAMBIGUATOR.🤖 Generated with Claude Code
https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr