geeknative 0.0.0-stage → 0.1.0

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.
Files changed (159) hide show
  1. package/LICENSE +202 -0
  2. package/bin/geeknative.js +12 -0
  3. package/package.json +31 -4
  4. package/src/cli.js +61 -0
  5. package/src/codegen/app.js +97 -0
  6. package/src/codegen/icons.js +87 -0
  7. package/src/codegen/index.js +44 -0
  8. package/src/codegen/strings.js +308 -0
  9. package/src/codegen/tokens.js +449 -0
  10. package/src/codegen/util.js +122 -0
  11. package/src/commands/check.js +143 -0
  12. package/src/commands/create.js +78 -0
  13. package/src/commands/doctor.js +108 -0
  14. package/src/commands/gen.js +44 -0
  15. package/src/commands/parity.js +134 -0
  16. package/src/commands/run.js +91 -0
  17. package/src/lib/exec.js +77 -0
  18. package/src/lib/fsutil.js +92 -0
  19. package/src/lib/log.js +37 -0
  20. package/src/lib/managed.js +80 -0
  21. package/src/lib/project.js +52 -0
  22. package/src/lib/toolchains.js +126 -0
  23. package/template/.claude/agents/android-engineer.md +15 -0
  24. package/template/.claude/agents/ios-engineer.md +15 -0
  25. package/template/.claude/agents/web-engineer.md +15 -0
  26. package/template/.claude/settings.json +65 -0
  27. package/template/.geeknative/framework.mk +41 -0
  28. package/template/.geeknative/hooks/after-edit.mjs +28 -0
  29. package/template/.geeknative/hooks/parity-guard.mjs +49 -0
  30. package/template/.geeknative/hooks/subagent-context.mjs +24 -0
  31. package/template/.geeknative/playbooks/bug.md +7 -0
  32. package/template/.geeknative/playbooks/design.md +10 -0
  33. package/template/.geeknative/playbooks/engineering.md +9 -0
  34. package/template/.geeknative/playbooks/feature.md +11 -0
  35. package/template/.geeknative/playbooks/platform-specific.md +8 -0
  36. package/template/.geeknative/playbooks/product.md +12 -0
  37. package/template/.geeknative/templates/feature.md +49 -0
  38. package/template/.gemini/settings.json +5 -0
  39. package/template/.github/dependabot.yml +18 -0
  40. package/template/AGENTS.md +97 -0
  41. package/template/CLAUDE.md +9 -0
  42. package/template/DESIGN.md +65 -0
  43. package/template/Makefile +6 -0
  44. package/template/PRODUCT.md +40 -0
  45. package/template/README.md +28 -0
  46. package/template/_gitignore +33 -0
  47. package/template/apps/android/AGENTS.md +66 -0
  48. package/template/apps/android/CLAUDE.md +1 -0
  49. package/template/apps/android/app/build.gradle.kts +68 -0
  50. package/template/apps/android/app/identity.properties +4 -0
  51. package/template/apps/android/app/src/main/AndroidManifest.xml +24 -0
  52. package/template/apps/android/app/src/main/kotlin/app/App.kt +15 -0
  53. package/template/apps/android/app/src/main/kotlin/app/MainActivity.kt +49 -0
  54. package/template/apps/android/app/src/main/kotlin/app/core/AppContainer.kt +27 -0
  55. package/template/apps/android/app/src/main/kotlin/app/core/designsystem/AppCard.kt +30 -0
  56. package/template/apps/android/app/src/main/kotlin/app/core/designsystem/AppTheme.kt +35 -0
  57. package/template/apps/android/app/src/main/kotlin/app/core/navigation/AppNavigation.kt +40 -0
  58. package/template/apps/android/app/src/main/kotlin/app/core/navigation/Route.kt +13 -0
  59. package/template/apps/android/app/src/main/kotlin/app/features/home/HomeScreen.kt +67 -0
  60. package/template/apps/android/app/src/main/kotlin/app/features/settings/Appearance.kt +22 -0
  61. package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsRepository.kt +40 -0
  62. package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsScreen.kt +113 -0
  63. package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsViewModel.kt +28 -0
  64. package/template/apps/android/app/src/main/kotlin/app/generated/AppIdentity.kt +10 -0
  65. package/template/apps/android/app/src/main/kotlin/app/generated/Icons.kt +15 -0
  66. package/template/apps/android/app/src/main/kotlin/app/generated/Tokens.kt +144 -0
  67. package/template/apps/android/app/src/main/res/drawable/ic_launcher_foreground.xml +17 -0
  68. package/template/apps/android/app/src/main/res/mipmap/ic_launcher.xml +10 -0
  69. package/template/apps/android/app/src/main/res/mipmap/ic_launcher_round.xml +10 -0
  70. package/template/apps/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
  71. package/template/apps/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
  72. package/template/apps/android/app/src/main/res/values/generated_colors.xml +15 -0
  73. package/template/apps/android/app/src/main/res/values/generated_strings.xml +16 -0
  74. package/template/apps/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
  75. package/template/apps/android/app/src/main/res/values/themes.xml +7 -0
  76. package/template/apps/android/app/src/main/res/values-night/generated_colors.xml +15 -0
  77. package/template/apps/android/app/src/main/res/values-night/themes.xml +6 -0
  78. package/template/apps/android/app/src/test/kotlin/app/features/settings/SettingsTest.kt +90 -0
  79. package/template/apps/android/build.gradle.kts +5 -0
  80. package/template/apps/android/gradle/gradle-daemon-jvm.properties +12 -0
  81. package/template/apps/android/gradle/libs.versions.toml +37 -0
  82. package/template/apps/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  83. package/template/apps/android/gradle/wrapper/gradle-wrapper.properties +9 -0
  84. package/template/apps/android/gradle.properties +7 -0
  85. package/template/apps/android/gradlew +248 -0
  86. package/template/apps/android/gradlew.bat +82 -0
  87. package/template/apps/android/settings.gradle.kts +29 -0
  88. package/template/apps/ios/AGENTS.md +70 -0
  89. package/template/apps/ios/App/AppMain.swift +13 -0
  90. package/template/apps/ios/App/Core/AppContainer.swift +22 -0
  91. package/template/apps/ios/App/Core/DesignSystem/AppCard.swift +15 -0
  92. package/template/apps/ios/App/Core/Navigation/Route.swift +4 -0
  93. package/template/apps/ios/App/Core/RootView.swift +32 -0
  94. package/template/apps/ios/App/Features/Home/HomeScreen.swift +35 -0
  95. package/template/apps/ios/App/Features/Settings/Appearance.swift +27 -0
  96. package/template/apps/ios/App/Features/Settings/SettingsRepository.swift +40 -0
  97. package/template/apps/ios/App/Features/Settings/SettingsScreen.swift +40 -0
  98. package/template/apps/ios/App/Features/Settings/SettingsViewModel.swift +23 -0
  99. package/template/apps/ios/App/Generated/AppIdentity.swift +9 -0
  100. package/template/apps/ios/App/Generated/Colors.xcassets/AccentColor.colorset/Contents.json +38 -0
  101. package/template/apps/ios/App/Generated/Colors.xcassets/Contents.json +6 -0
  102. package/template/apps/ios/App/Generated/Icons.swift +8 -0
  103. package/template/apps/ios/App/Generated/Localizable.xcstrings +127 -0
  104. package/template/apps/ios/App/Generated/Strings.swift +40 -0
  105. package/template/apps/ios/App/Generated/Tokens.swift +65 -0
  106. package/template/apps/ios/App/Resources/Assets.xcassets/AppIcon.appiconset/AppIcon.png +0 -0
  107. package/template/apps/ios/App/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  108. package/template/apps/ios/App/Resources/Assets.xcassets/Contents.json +6 -0
  109. package/template/apps/ios/App.xcodeproj/project.pbxproj +298 -0
  110. package/template/apps/ios/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  111. package/template/apps/ios/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme +89 -0
  112. package/template/apps/ios/AppTests/SettingsTests.swift +54 -0
  113. package/template/apps/ios/CLAUDE.md +1 -0
  114. package/template/apps/ios/Config/App.xcconfig +23 -0
  115. package/template/apps/ios/Config/AppTests.xcconfig +10 -0
  116. package/template/apps/ios/Config/Base.xcconfig +25 -0
  117. package/template/apps/ios/Config/Debug.xcconfig +9 -0
  118. package/template/apps/ios/Config/Identity.xcconfig +5 -0
  119. package/template/apps/ios/Config/Release.xcconfig +6 -0
  120. package/template/apps/web/AGENTS.md +63 -0
  121. package/template/apps/web/CLAUDE.md +1 -0
  122. package/template/apps/web/package.json +38 -0
  123. package/template/apps/web/public/favicon.svg +6 -0
  124. package/template/apps/web/src/core/AppContainer.ts +18 -0
  125. package/template/apps/web/src/core/AppearanceEffect.tsx +31 -0
  126. package/template/apps/web/src/core/designsystem/AppCard.tsx +6 -0
  127. package/template/apps/web/src/features/home/HomeScreen.tsx +15 -0
  128. package/template/apps/web/src/features/home/home.test.tsx +22 -0
  129. package/template/apps/web/src/features/settings/Appearance.ts +29 -0
  130. package/template/apps/web/src/features/settings/LocalStorageSettingsRepository.ts +21 -0
  131. package/template/apps/web/src/features/settings/SettingsRepository.ts +7 -0
  132. package/template/apps/web/src/features/settings/SettingsScreen.tsx +44 -0
  133. package/template/apps/web/src/features/settings/settings.test.ts +45 -0
  134. package/template/apps/web/src/features/settings/useSettingsViewModel.ts +42 -0
  135. package/template/apps/web/src/generated/app.ts +9 -0
  136. package/template/apps/web/src/generated/icons.ts +9 -0
  137. package/template/apps/web/src/generated/strings.ts +88 -0
  138. package/template/apps/web/src/generated/tokens.css +86 -0
  139. package/template/apps/web/src/routeTree.gen.ts +86 -0
  140. package/template/apps/web/src/router.tsx +23 -0
  141. package/template/apps/web/src/routes/__root.tsx +72 -0
  142. package/template/apps/web/src/routes/index.tsx +6 -0
  143. package/template/apps/web/src/routes/settings.tsx +9 -0
  144. package/template/apps/web/src/styles.css +9 -0
  145. package/template/apps/web/tsconfig.json +26 -0
  146. package/template/apps/web/tsr.config.json +3 -0
  147. package/template/apps/web/vite.config.ts +9 -0
  148. package/template/apps/web/vitest.config.ts +9 -0
  149. package/template/contracts/app.json +7 -0
  150. package/template/contracts/icons.json +5 -0
  151. package/template/contracts/strings/en.json +13 -0
  152. package/template/contracts/tokens.json +40 -0
  153. package/template/package.json +17 -0
  154. package/template/spec/decisions.md +10 -0
  155. package/template/spec/features/home.md +39 -0
  156. package/template/spec/features/settings.md +50 -0
  157. package/template/spec/navigation.md +16 -0
  158. package/template/spec/parity.md +29 -0
  159. package/README.md +0 -3
@@ -0,0 +1,248 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # gradlew start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh gradlew
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+
118
+
119
+ # Determine the Java command to use to start the JVM.
120
+ if [ -n "$JAVA_HOME" ] ; then
121
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
122
+ # IBM's JDK on AIX uses strange locations for the executables
123
+ JAVACMD=$JAVA_HOME/jre/sh/java
124
+ else
125
+ JAVACMD=$JAVA_HOME/bin/java
126
+ fi
127
+ if [ ! -x "$JAVACMD" ] ; then
128
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
129
+
130
+ Please set the JAVA_HOME variable in your environment to match the
131
+ location of your Java installation."
132
+ fi
133
+ else
134
+ JAVACMD=java
135
+ if ! command -v java >/dev/null 2>&1
136
+ then
137
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
138
+
139
+ Please set the JAVA_HOME variable in your environment to match the
140
+ location of your Java installation."
141
+ fi
142
+ fi
143
+
144
+ # Increase the maximum file descriptors if we can.
145
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
146
+ case $MAX_FD in #(
147
+ max*)
148
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
149
+ # shellcheck disable=SC2039,SC3045
150
+ MAX_FD=$( ulimit -H -n ) ||
151
+ warn "Could not query maximum file descriptor limit"
152
+ esac
153
+ case $MAX_FD in #(
154
+ '' | soft) :;; #(
155
+ *)
156
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
157
+ # shellcheck disable=SC2039,SC3045
158
+ ulimit -n "$MAX_FD" ||
159
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
160
+ esac
161
+ fi
162
+
163
+ # Collect all arguments for the java command, stacking in reverse order:
164
+ # * args from the command line
165
+ # * the main class name
166
+ # * -classpath
167
+ # * -D...appname settings
168
+ # * --module-path (only if needed)
169
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
170
+
171
+ # For Cygwin or MSYS, switch paths to Windows format before running java
172
+ if "$cygwin" || "$msys" ; then
173
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
174
+
175
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
176
+
177
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
+ for arg do
179
+ if
180
+ case $arg in #(
181
+ -*) false ;; # don't mess with options #(
182
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183
+ [ -e "$t" ] ;; #(
184
+ *) false ;;
185
+ esac
186
+ then
187
+ arg=$( cygpath --path --ignore --mixed "$arg" )
188
+ fi
189
+ # Roll the args list around exactly as many times as the number of
190
+ # args, so each arg winds up back in the position where it started, but
191
+ # possibly modified.
192
+ #
193
+ # NB: a `for` loop captures its iteration list before it begins, so
194
+ # changing the positional parameters here affects neither the number of
195
+ # iterations, nor the values presented in `arg`.
196
+ shift # remove old arg
197
+ set -- "$@" "$arg" # push replacement arg
198
+ done
199
+ fi
200
+
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
205
+ # Collect all arguments for the java command:
206
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+ # and any embedded shellness will be escaped.
208
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+ # treated as '${Hostname}' itself on the command line.
210
+
211
+ set -- \
212
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
213
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
214
+ "$@"
215
+
216
+ # Stop when "xargs" is not available.
217
+ if ! command -v xargs >/dev/null 2>&1
218
+ then
219
+ die "xargs is not available"
220
+ fi
221
+
222
+ # Use "xargs" to parse quoted args.
223
+ #
224
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
225
+ #
226
+ # In Bash we could simply go:
227
+ #
228
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
229
+ # set -- "${ARGS[@]}" "$@"
230
+ #
231
+ # but POSIX shell has neither arrays nor command substitution, so instead we
232
+ # post-process each arg (as a line of input to sed) to backslash-escape any
233
+ # character that might be a shell metacharacter, then use eval to reverse
234
+ # that process (while maintaining the separation between arguments), and wrap
235
+ # the whole thing up as a single "set" statement.
236
+ #
237
+ # This will of course break if any of these variables contains a newline or
238
+ # an unmatched quote.
239
+ #
240
+
241
+ eval "set -- $(
242
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
243
+ xargs -n1 |
244
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
245
+ tr '\n' ' '
246
+ )" '"$@"'
247
+
248
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,82 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
18
+
19
+ @if "%DEBUG%"=="" @echo off
20
+ @rem ##########################################################################
21
+ @rem
22
+ @rem gradlew startup script for Windows
23
+ @rem
24
+ @rem ##########################################################################
25
+
26
+ @rem Set local scope for the variables, and ensure extensions are enabled
27
+ setlocal EnableExtensions
28
+
29
+ set DIRNAME=%~dp0
30
+ if "%DIRNAME%"=="" set DIRNAME=.
31
+ @rem This is normally unused
32
+ set APP_BASE_NAME=%~n0
33
+ set APP_HOME=%DIRNAME%
34
+
35
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
+
38
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40
+
41
+ @rem Find java.exe
42
+ if defined JAVA_HOME goto findJavaFromJavaHome
43
+
44
+ set JAVA_EXE=java.exe
45
+ %JAVA_EXE% -version >NUL 2>&1
46
+ if %ERRORLEVEL% equ 0 goto execute
47
+
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
53
+
54
+ "%COMSPEC%" /c exit 1
55
+
56
+ :findJavaFromJavaHome
57
+ set JAVA_HOME=%JAVA_HOME:"=%
58
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59
+
60
+ if exist "%JAVA_EXE%" goto execute
61
+
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
67
+
68
+ "%COMSPEC%" /c exit 1
69
+
70
+ :execute
71
+ @rem Setup the command line
72
+
73
+
74
+
75
+ @rem Execute gradlew
76
+ @rem endlocal doesn't take effect until after the line is parsed and variables are expanded
77
+ @rem which allows us to clear the local environment before executing the java command
78
+ endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
79
+
80
+ :exitWithErrorLevel
81
+ @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
82
+ "%COMSPEC%" /c exit %ERRORLEVEL%
@@ -0,0 +1,29 @@
1
+ pluginManagement {
2
+ repositories {
3
+ google {
4
+ content {
5
+ includeGroupByRegex("com\\.android.*")
6
+ includeGroupByRegex("com\\.google.*")
7
+ includeGroupByRegex("androidx.*")
8
+ }
9
+ }
10
+ mavenCentral()
11
+ gradlePluginPortal()
12
+ }
13
+ }
14
+
15
+ plugins {
16
+ // Lets Gradle download the JDK the build needs (see gradle/gradle-daemon-jvm.properties).
17
+ id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
18
+ }
19
+
20
+ dependencyResolutionManagement {
21
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
22
+ repositories {
23
+ google()
24
+ mavenCentral()
25
+ }
26
+ }
27
+
28
+ rootProject.name = "App"
29
+ include(":app")
@@ -0,0 +1,70 @@
1
+ <!-- geeknative:begin (managed by geeknative: replaced on upgrade. Add your own rules under "Project rules" at the end.) -->
2
+ # iOS app (SwiftUI)
3
+
4
+ Read the root AGENTS.md first. This file covers how the iOS app is built.
5
+
6
+ ## Stack
7
+
8
+ - SwiftUI and Observation (`@Observable`), iOS 17 and later (Observation's minimum).
9
+ - Swift 6 language mode. Code is main-actor isolated by default; mark background work `nonisolated` or `@concurrent` explicitly.
10
+ - Swift Testing (`import Testing`) for tests.
11
+ - No third-party dependencies unless the user asks for one.
12
+
13
+ ## Layout
14
+
15
+ ```
16
+ apps/ios/
17
+ App.xcodeproj Rarely edited. App/ and AppTests/ are synchronized folders:
18
+ new files are picked up automatically. Never add files to project.pbxproj.
19
+ Config/ Build settings as .xcconfig files. Identity.xcconfig is generated.
20
+ App/
21
+ AppMain.swift @main: creates AppContainer and shows RootView
22
+ Core/ AppContainer, RootView, Navigation/Route.swift, DesignSystem/
23
+ Features/<Name>/ <Name>Screen.swift, <Name>ViewModel.swift, <Name>Repository.swift, models
24
+ Generated/ From contracts/ by `make gen`. Never edit.
25
+ Resources/ Assets.xcassets (app icon)
26
+ AppTests/ Swift Testing tests, named after acceptance criteria
27
+ ```
28
+
29
+ ## Patterns
30
+
31
+ Same names and responsibilities as the Android and web apps.
32
+
33
+ | Concept | iOS |
34
+ |---|---|
35
+ | Screen | `struct NotesScreen: View` in Features/Notes/ |
36
+ | State and actions | `@Observable final class NotesViewModel`, held in `@State` by its screen |
37
+ | Data | `protocol NotesRepository`, plus implementations such as `UserDefaultsNotesRepository` and `InMemoryNotesRepository` |
38
+ | Dependencies | `AppContainer`, read with `@Environment(AppContainer.self)`; `.live()` for the app, `.preview()` for previews and tests |
39
+ | Navigation | Add a case to `Route` and handle it in RootView's `navigationDestination` |
40
+ | Copy | `Strings.notesEmptyTitle` (generated) |
41
+ | Colors, spacing, radii, type | `AppColors.primary`, `AppSpacing.md`, `AppRadius.lg`, `AppTypography.title` (generated) |
42
+ | Icons | `Image(systemName: AppIcon.settings)` (generated) |
43
+ | Test IDs | `.accessibilityIdentifier("notes.addButton")` |
44
+
45
+ Follow Features/Settings as the reference implementation.
46
+
47
+ ## Rules
48
+
49
+ - Never hardcode user-facing text, colors or spacing. Add them to contracts/ and run `make gen`.
50
+ - Prefer native components and behavior: `NavigationStack`, `Form`, `List`, toolbar items, sheets, swipe actions and SF Symbols. DESIGN.md says what must match the other platforms.
51
+ - Support Dynamic Type, dark mode and VoiceOver: icon-only buttons need an accessibility label from Strings.
52
+ - Give each screen a `#Preview` that uses `AppContainer.preview()` or in-memory repositories.
53
+ - Name tests after acceptance criteria: `@Test("AC-notes-2: ...")`.
54
+
55
+ ## Commands
56
+
57
+ - `make check-ios`: builds the app and runs the tests on a simulator. Full log: .geeknative/logs/ios.log.
58
+ - `make run-ios`: builds, installs and launches the app on a simulator.
59
+ - `open apps/ios/App.xcodeproj` opens it in Xcode.
60
+
61
+ ## Gotchas
62
+
63
+ - Don't edit project.pbxproj to add files or folders. To change a build setting, edit Config/*.xcconfig.
64
+ - Adding a Swift package changes the project file; ask the user first.
65
+ - To run on a device, set `DEVELOPMENT_TEAM` in Config/App.xcconfig.
66
+ <!-- geeknative:end -->
67
+
68
+ ## Project rules
69
+
70
+ <!-- Your iOS-specific rules. They override the defaults above, and geeknative upgrades never touch them. -->
@@ -0,0 +1,13 @@
1
+ import SwiftUI
2
+
3
+ @main
4
+ struct AppMain: App {
5
+ @State private var container = AppContainer.live()
6
+
7
+ var body: some Scene {
8
+ WindowGroup {
9
+ RootView()
10
+ .environment(container)
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,22 @@
1
+ import Foundation
2
+ import Observation
3
+
4
+ /// The app's dependencies, created once at launch. Screens read it from the environment.
5
+ /// Swap an implementation here (for example, a backend-backed repository) without touching screens.
6
+ @Observable
7
+ final class AppContainer {
8
+ let settingsRepository: any SettingsRepository
9
+
10
+ init(settingsRepository: any SettingsRepository) {
11
+ self.settingsRepository = settingsRepository
12
+ }
13
+
14
+ static func live() -> AppContainer {
15
+ AppContainer(settingsRepository: UserDefaultsSettingsRepository(defaults: .standard))
16
+ }
17
+
18
+ /// In-memory dependencies, for previews and tests.
19
+ static func preview() -> AppContainer {
20
+ AppContainer(settingsRepository: InMemorySettingsRepository())
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ import SwiftUI
2
+
3
+ /// A card for grouped content on a screen (DESIGN.md: Card).
4
+ struct AppCard<Content: View>: View {
5
+ @ViewBuilder var content: Content
6
+
7
+ var body: some View {
8
+ VStack(alignment: .leading, spacing: AppSpacing.sm) {
9
+ content
10
+ }
11
+ .frame(maxWidth: .infinity, alignment: .leading)
12
+ .padding(AppSpacing.lg)
13
+ .background(AppColors.surface, in: .rect(cornerRadius: AppRadius.lg))
14
+ }
15
+ }
@@ -0,0 +1,4 @@
1
+ /// Screens that can be pushed onto the navigation stack. Names match spec/navigation.md.
2
+ enum Route: Hashable {
3
+ case settings
4
+ }
@@ -0,0 +1,32 @@
1
+ import SwiftUI
2
+ import UIKit
3
+
4
+ /// The navigation root. Also applies the chosen appearance to every window.
5
+ struct RootView: View {
6
+ @Environment(AppContainer.self) private var container
7
+ @State private var path: [Route] = []
8
+
9
+ var body: some View {
10
+ NavigationStack(path: $path) {
11
+ HomeScreen()
12
+ .navigationDestination(for: Route.self) { route in
13
+ switch route {
14
+ case .settings:
15
+ SettingsScreen(viewModel: SettingsViewModel(repository: container.settingsRepository))
16
+ }
17
+ }
18
+ }
19
+ .onChange(of: container.settingsRepository.appearance, initial: true) { _, appearance in
20
+ apply(appearance)
21
+ }
22
+ }
23
+
24
+ /// Overrides the style on the windows themselves, so sheets and alerts follow too.
25
+ private func apply(_ appearance: Appearance) {
26
+ for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
27
+ for window in scene.windows {
28
+ window.overrideUserInterfaceStyle = appearance.interfaceStyle
29
+ }
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,35 @@
1
+ import SwiftUI
2
+
3
+ struct HomeScreen: View {
4
+ var body: some View {
5
+ ScrollView {
6
+ AppCard {
7
+ Text(Strings.homeWelcomeTitle)
8
+ .font(AppTypography.title)
9
+ .foregroundStyle(AppColors.onSurface)
10
+ Text(Strings.homeWelcomeBody)
11
+ .font(AppTypography.body)
12
+ .foregroundStyle(AppColors.onSurfaceVariant)
13
+ }
14
+ .padding(AppSpacing.lg)
15
+ }
16
+ .background(AppColors.background)
17
+ .navigationTitle(AppIdentity.name)
18
+ .toolbar {
19
+ ToolbarItem(placement: .primaryAction) {
20
+ NavigationLink(value: Route.settings) {
21
+ Image(systemName: AppIcon.settings)
22
+ }
23
+ .accessibilityLabel(Strings.homeOpenSettings)
24
+ .accessibilityIdentifier("home.openSettings")
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ #Preview {
31
+ NavigationStack {
32
+ HomeScreen()
33
+ }
34
+ .environment(AppContainer.preview())
35
+ }
@@ -0,0 +1,27 @@
1
+ import UIKit
2
+
3
+ /// The appearance setting. Stored as these exact raw values on every platform.
4
+ nonisolated enum Appearance: String, CaseIterable, Identifiable {
5
+ case system, light, dark
6
+
7
+ /// Storage key, shared with the Android and web apps.
8
+ static let storageKey = "settings.appearance"
9
+
10
+ var id: Self { self }
11
+
12
+ var label: String {
13
+ switch self {
14
+ case .system: Strings.settingsAppearanceSystem
15
+ case .light: Strings.settingsAppearanceLight
16
+ case .dark: Strings.settingsAppearanceDark
17
+ }
18
+ }
19
+
20
+ var interfaceStyle: UIUserInterfaceStyle {
21
+ switch self {
22
+ case .system: .unspecified
23
+ case .light: .light
24
+ case .dark: .dark
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,40 @@
1
+ import Foundation
2
+ import Observation
3
+
4
+ /// Stores the user's preferences. Screens use whichever implementation AppContainer provides.
5
+ protocol SettingsRepository: AnyObject {
6
+ var appearance: Appearance { get }
7
+ func setAppearance(_ appearance: Appearance)
8
+ }
9
+
10
+ /// Keeps settings in UserDefaults.
11
+ @Observable
12
+ final class UserDefaultsSettingsRepository: SettingsRepository {
13
+ private(set) var appearance: Appearance
14
+ @ObservationIgnored private let defaults: UserDefaults
15
+
16
+ init(defaults: UserDefaults) {
17
+ self.defaults = defaults
18
+ // A missing or unknown stored value counts as .system.
19
+ appearance = defaults.string(forKey: Appearance.storageKey).flatMap(Appearance.init(rawValue:)) ?? .system
20
+ }
21
+
22
+ func setAppearance(_ appearance: Appearance) {
23
+ self.appearance = appearance
24
+ defaults.set(appearance.rawValue, forKey: Appearance.storageKey)
25
+ }
26
+ }
27
+
28
+ /// Keeps settings in memory, for previews and tests.
29
+ @Observable
30
+ final class InMemorySettingsRepository: SettingsRepository {
31
+ private(set) var appearance: Appearance
32
+
33
+ init(appearance: Appearance = .system) {
34
+ self.appearance = appearance
35
+ }
36
+
37
+ func setAppearance(_ appearance: Appearance) {
38
+ self.appearance = appearance
39
+ }
40
+ }
@@ -0,0 +1,40 @@
1
+ import SwiftUI
2
+
3
+ struct SettingsScreen: View {
4
+ @State private var viewModel: SettingsViewModel
5
+
6
+ init(viewModel: SettingsViewModel) {
7
+ _viewModel = State(initialValue: viewModel)
8
+ }
9
+
10
+ var body: some View {
11
+ Form {
12
+ Section(Strings.settingsAppearanceTitle) {
13
+ Picker(Strings.settingsAppearanceTitle, selection: Binding(
14
+ get: { viewModel.appearance },
15
+ set: { viewModel.selectAppearance($0) }
16
+ )) {
17
+ ForEach(viewModel.appearanceOptions) { option in
18
+ Text(option.label).tag(option)
19
+ }
20
+ }
21
+ .pickerStyle(.inline)
22
+ .labelsHidden()
23
+ .accessibilityIdentifier("settings.appearance")
24
+ }
25
+
26
+ Section(Strings.settingsAboutTitle) {
27
+ Text(viewModel.versionText)
28
+ .foregroundStyle(AppColors.onSurfaceVariant)
29
+ .accessibilityIdentifier("settings.version")
30
+ }
31
+ }
32
+ .navigationTitle(Strings.settingsTitle)
33
+ }
34
+ }
35
+
36
+ #Preview {
37
+ NavigationStack {
38
+ SettingsScreen(viewModel: SettingsViewModel(repository: InMemorySettingsRepository()))
39
+ }
40
+ }