geeknative 0.0.0-stage → 0.1.1
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/LICENSE +202 -0
- package/bin/geeknative.js +12 -0
- package/package.json +42 -4
- package/src/cli.js +61 -0
- package/src/codegen/app.js +105 -0
- package/src/codegen/icons.js +87 -0
- package/src/codegen/index.js +44 -0
- package/src/codegen/strings.js +308 -0
- package/src/codegen/tokens.js +449 -0
- package/src/codegen/util.js +122 -0
- package/src/commands/check.js +148 -0
- package/src/commands/create.js +82 -0
- package/src/commands/doctor.js +108 -0
- package/src/commands/gen.js +44 -0
- package/src/commands/parity.js +134 -0
- package/src/commands/run.js +91 -0
- package/src/lib/exec.js +77 -0
- package/src/lib/fsutil.js +92 -0
- package/src/lib/log.js +37 -0
- package/src/lib/managed.js +80 -0
- package/src/lib/project.js +52 -0
- package/src/lib/toolchains.js +126 -0
- package/template/.claude/agents/android-engineer.md +15 -0
- package/template/.claude/agents/ios-engineer.md +15 -0
- package/template/.claude/agents/web-engineer.md +15 -0
- package/template/.claude/settings.json +65 -0
- package/template/.geeknative/framework.mk +41 -0
- package/template/.geeknative/hooks/after-edit.mjs +28 -0
- package/template/.geeknative/hooks/parity-guard.mjs +49 -0
- package/template/.geeknative/hooks/subagent-context.mjs +24 -0
- package/template/.geeknative/playbooks/bug.md +7 -0
- package/template/.geeknative/playbooks/design.md +10 -0
- package/template/.geeknative/playbooks/engineering.md +9 -0
- package/template/.geeknative/playbooks/feature.md +11 -0
- package/template/.geeknative/playbooks/platform-specific.md +8 -0
- package/template/.geeknative/playbooks/product.md +12 -0
- package/template/.geeknative/templates/feature.md +49 -0
- package/template/.gemini/settings.json +5 -0
- package/template/.github/dependabot.yml +18 -0
- package/template/AGENTS.md +97 -0
- package/template/CLAUDE.md +9 -0
- package/template/DESIGN.md +65 -0
- package/template/Makefile +6 -0
- package/template/PRODUCT.md +40 -0
- package/template/README.md +28 -0
- package/template/_gitignore +33 -0
- package/template/apps/android/AGENTS.md +66 -0
- package/template/apps/android/CLAUDE.md +1 -0
- package/template/apps/android/app/build.gradle.kts +68 -0
- package/template/apps/android/app/identity.properties +4 -0
- package/template/apps/android/app/src/main/AndroidManifest.xml +24 -0
- package/template/apps/android/app/src/main/kotlin/app/App.kt +15 -0
- package/template/apps/android/app/src/main/kotlin/app/MainActivity.kt +49 -0
- package/template/apps/android/app/src/main/kotlin/app/core/AppContainer.kt +27 -0
- package/template/apps/android/app/src/main/kotlin/app/core/designsystem/AppCard.kt +30 -0
- package/template/apps/android/app/src/main/kotlin/app/core/designsystem/AppTheme.kt +35 -0
- package/template/apps/android/app/src/main/kotlin/app/core/navigation/AppNavigation.kt +40 -0
- package/template/apps/android/app/src/main/kotlin/app/core/navigation/Route.kt +13 -0
- package/template/apps/android/app/src/main/kotlin/app/features/home/HomeScreen.kt +67 -0
- package/template/apps/android/app/src/main/kotlin/app/features/settings/Appearance.kt +22 -0
- package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsRepository.kt +40 -0
- package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsScreen.kt +113 -0
- package/template/apps/android/app/src/main/kotlin/app/features/settings/SettingsViewModel.kt +28 -0
- package/template/apps/android/app/src/main/kotlin/app/generated/AppIdentity.kt +10 -0
- package/template/apps/android/app/src/main/kotlin/app/generated/Icons.kt +15 -0
- package/template/apps/android/app/src/main/kotlin/app/generated/Tokens.kt +144 -0
- package/template/apps/android/app/src/main/res/drawable/ic_launcher_foreground.xml +17 -0
- package/template/apps/android/app/src/main/res/mipmap/ic_launcher.xml +10 -0
- package/template/apps/android/app/src/main/res/mipmap/ic_launcher_round.xml +10 -0
- package/template/apps/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/template/apps/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/template/apps/android/app/src/main/res/values/generated_colors.xml +15 -0
- package/template/apps/android/app/src/main/res/values/generated_strings.xml +16 -0
- package/template/apps/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
- package/template/apps/android/app/src/main/res/values/themes.xml +7 -0
- package/template/apps/android/app/src/main/res/values-night/generated_colors.xml +15 -0
- package/template/apps/android/app/src/main/res/values-night/themes.xml +6 -0
- package/template/apps/android/app/src/test/kotlin/app/features/settings/SettingsTest.kt +90 -0
- package/template/apps/android/build.gradle.kts +5 -0
- package/template/apps/android/gradle/gradle-daemon-jvm.properties +12 -0
- package/template/apps/android/gradle/libs.versions.toml +37 -0
- package/template/apps/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/apps/android/gradle/wrapper/gradle-wrapper.properties +9 -0
- package/template/apps/android/gradle.properties +7 -0
- package/template/apps/android/gradlew +248 -0
- package/template/apps/android/gradlew.bat +82 -0
- package/template/apps/android/settings.gradle.kts +29 -0
- package/template/apps/ios/AGENTS.md +70 -0
- package/template/apps/ios/App/AppMain.swift +13 -0
- package/template/apps/ios/App/Core/AppContainer.swift +22 -0
- package/template/apps/ios/App/Core/DesignSystem/AppCard.swift +15 -0
- package/template/apps/ios/App/Core/Navigation/Route.swift +4 -0
- package/template/apps/ios/App/Core/RootView.swift +32 -0
- package/template/apps/ios/App/Features/Home/HomeScreen.swift +35 -0
- package/template/apps/ios/App/Features/Settings/Appearance.swift +27 -0
- package/template/apps/ios/App/Features/Settings/SettingsRepository.swift +40 -0
- package/template/apps/ios/App/Features/Settings/SettingsScreen.swift +40 -0
- package/template/apps/ios/App/Features/Settings/SettingsViewModel.swift +23 -0
- package/template/apps/ios/App/Generated/AppIdentity.swift +9 -0
- package/template/apps/ios/App/Generated/Colors.xcassets/AccentColor.colorset/Contents.json +38 -0
- package/template/apps/ios/App/Generated/Colors.xcassets/Contents.json +6 -0
- package/template/apps/ios/App/Generated/Icons.swift +8 -0
- package/template/apps/ios/App/Generated/Localizable.xcstrings +127 -0
- package/template/apps/ios/App/Generated/Strings.swift +40 -0
- package/template/apps/ios/App/Generated/Tokens.swift +65 -0
- package/template/apps/ios/App/Resources/Assets.xcassets/AppIcon.appiconset/AppIcon.png +0 -0
- package/template/apps/ios/App/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/template/apps/ios/App/Resources/Assets.xcassets/Contents.json +6 -0
- package/template/apps/ios/App.xcodeproj/project.pbxproj +298 -0
- package/template/apps/ios/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/template/apps/ios/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme +89 -0
- package/template/apps/ios/AppTests/SettingsTests.swift +54 -0
- package/template/apps/ios/CLAUDE.md +1 -0
- package/template/apps/ios/Config/App.xcconfig +23 -0
- package/template/apps/ios/Config/AppTests.xcconfig +10 -0
- package/template/apps/ios/Config/Base.xcconfig +25 -0
- package/template/apps/ios/Config/Debug.xcconfig +9 -0
- package/template/apps/ios/Config/Identity.xcconfig +5 -0
- package/template/apps/ios/Config/Release.xcconfig +6 -0
- package/template/apps/web/AGENTS.md +63 -0
- package/template/apps/web/CLAUDE.md +1 -0
- package/template/apps/web/package.json +38 -0
- package/template/apps/web/public/favicon.svg +6 -0
- package/template/apps/web/src/core/AppContainer.ts +18 -0
- package/template/apps/web/src/core/AppearanceEffect.tsx +31 -0
- package/template/apps/web/src/core/designsystem/AppCard.tsx +6 -0
- package/template/apps/web/src/features/home/HomeScreen.tsx +15 -0
- package/template/apps/web/src/features/home/home.test.tsx +22 -0
- package/template/apps/web/src/features/settings/Appearance.ts +29 -0
- package/template/apps/web/src/features/settings/LocalStorageSettingsRepository.ts +21 -0
- package/template/apps/web/src/features/settings/SettingsRepository.ts +7 -0
- package/template/apps/web/src/features/settings/SettingsScreen.tsx +44 -0
- package/template/apps/web/src/features/settings/settings.test.ts +45 -0
- package/template/apps/web/src/features/settings/useSettingsViewModel.ts +42 -0
- package/template/apps/web/src/generated/app.ts +9 -0
- package/template/apps/web/src/generated/icons.ts +9 -0
- package/template/apps/web/src/generated/strings.ts +88 -0
- package/template/apps/web/src/generated/tokens.css +86 -0
- package/template/apps/web/src/routeTree.gen.ts +86 -0
- package/template/apps/web/src/router.tsx +23 -0
- package/template/apps/web/src/routes/__root.tsx +72 -0
- package/template/apps/web/src/routes/index.tsx +6 -0
- package/template/apps/web/src/routes/settings.tsx +9 -0
- package/template/apps/web/src/styles.css +9 -0
- package/template/apps/web/tsconfig.json +26 -0
- package/template/apps/web/tsr.config.json +3 -0
- package/template/apps/web/vite.config.ts +9 -0
- package/template/apps/web/vitest.config.ts +9 -0
- package/template/contracts/app.json +7 -0
- package/template/contracts/icons.json +5 -0
- package/template/contracts/strings/en.json +13 -0
- package/template/contracts/tokens.json +40 -0
- package/template/package.json +17 -0
- package/template/spec/decisions.md +10 -0
- package/template/spec/features/home.md +39 -0
- package/template/spec/features/settings.md +50 -0
- package/template/spec/navigation.md +16 -0
- package/template/spec/parity.md +29 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from '../src/cli.js'
|
|
3
|
+
import { CliError, color } from '../src/lib/log.js'
|
|
4
|
+
|
|
5
|
+
main(process.argv.slice(2)).catch((error) => {
|
|
6
|
+
if (error instanceof CliError || error?.code === 'ERR_PARSE_ARGS_UNKNOWN_OPTION') {
|
|
7
|
+
console.error(`${color.red('✖')} ${error.message}`)
|
|
8
|
+
} else {
|
|
9
|
+
console.error(error)
|
|
10
|
+
}
|
|
11
|
+
process.exitCode = 1
|
|
12
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geeknative",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "One prompt, three native apps: your coding agent builds SwiftUI, Jetpack Compose and TanStack Start apps from one shared spec.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://geekyants.github.io/geeknative/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/GeekyAnts/geeknative.git",
|
|
10
|
+
"directory": "packages/geeknative"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/GeekyAnts/geeknative/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "GeekyAnts (https://geekyants.com)",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"agents",
|
|
18
|
+
"AGENTS.md",
|
|
19
|
+
"swiftui",
|
|
20
|
+
"jetpack-compose",
|
|
21
|
+
"tanstack-start",
|
|
22
|
+
"native",
|
|
23
|
+
"codegen",
|
|
24
|
+
"design-tokens"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"geeknative": "bin/geeknative.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin",
|
|
32
|
+
"src",
|
|
33
|
+
"template",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"prepack": "node scripts/prepack.js",
|
|
41
|
+
"postpack": "node scripts/prepack.js --clean",
|
|
42
|
+
"test": "node --test 'test/**/*.test.js'"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { parseArgs } from 'node:util'
|
|
3
|
+
import { check } from './commands/check.js'
|
|
4
|
+
import { create } from './commands/create.js'
|
|
5
|
+
import { doctor } from './commands/doctor.js'
|
|
6
|
+
import { gen } from './commands/gen.js'
|
|
7
|
+
import { parity } from './commands/parity.js'
|
|
8
|
+
import { run } from './commands/run.js'
|
|
9
|
+
import { CliError, color } from './lib/log.js'
|
|
10
|
+
import { findProjectRoot, packageVersion } from './lib/project.js'
|
|
11
|
+
|
|
12
|
+
const HELP = `${color.bold('geeknative')}: one prompt, three native apps (SwiftUI, Jetpack Compose, TanStack Start)
|
|
13
|
+
|
|
14
|
+
Usage: geeknative <command>
|
|
15
|
+
|
|
16
|
+
create <folder> Create a project. Options: --name "My App" --id com.acme.myapp --no-install --no-git
|
|
17
|
+
gen Regenerate platform code from contracts/
|
|
18
|
+
check [targets] Verify contracts, then build and test. Targets: all (default), contracts, ios, android, web
|
|
19
|
+
doctor [--fix] Check Xcode, the Android SDK and Node; --fix installs what it can
|
|
20
|
+
parity Update spec/parity.md from feature specs and tests
|
|
21
|
+
run <platform> Build and launch: ios (simulator), android (emulator or device), web (dev server)
|
|
22
|
+
version Print the version
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
/** @param {string[]} argv */
|
|
26
|
+
export async function main(argv) {
|
|
27
|
+
const { values, positionals } = parseArgs({
|
|
28
|
+
args: argv,
|
|
29
|
+
allowPositionals: true,
|
|
30
|
+
options: {
|
|
31
|
+
name: { type: 'string' },
|
|
32
|
+
id: { type: 'string' },
|
|
33
|
+
'no-install': { type: 'boolean' },
|
|
34
|
+
'no-git': { type: 'boolean' },
|
|
35
|
+
fix: { type: 'boolean' },
|
|
36
|
+
help: { type: 'boolean', short: 'h' },
|
|
37
|
+
version: { type: 'boolean', short: 'v' },
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
const [command, ...rest] = positionals
|
|
41
|
+
|
|
42
|
+
if (values.version || command === 'version') return console.log(packageVersion())
|
|
43
|
+
if (values.help || !command || command === 'help') return console.log(HELP)
|
|
44
|
+
|
|
45
|
+
switch (command) {
|
|
46
|
+
case 'create':
|
|
47
|
+
return create(rest[0], { name: values.name, id: values.id, install: !values['no-install'], git: !values['no-git'] })
|
|
48
|
+
case 'gen':
|
|
49
|
+
return void gen(findProjectRoot())
|
|
50
|
+
case 'check':
|
|
51
|
+
return check(findProjectRoot(), rest)
|
|
52
|
+
case 'doctor':
|
|
53
|
+
return doctor(findProjectRoot(), { fix: values.fix })
|
|
54
|
+
case 'parity':
|
|
55
|
+
return parity(findProjectRoot())
|
|
56
|
+
case 'run':
|
|
57
|
+
return run(findProjectRoot(), rest[0])
|
|
58
|
+
default:
|
|
59
|
+
throw new CliError(`Unknown command "${command}".\n\n${HELP}`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { readJson } from '../lib/fsutil.js'
|
|
4
|
+
import { CliError } from '../lib/log.js'
|
|
5
|
+
import { banner, kotlinString, OUT, swiftString } from './util.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {{ name: string, id: string, version: string, build: number, defaultLocale: string }} AppIdentity
|
|
9
|
+
* @typedef {{ path: string, content: string | Buffer }} Output
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @param {string} root @returns {AppIdentity} */
|
|
13
|
+
export function readApp(root) {
|
|
14
|
+
return validateApp(readJson(path.join(root, 'contracts', 'app.json'), 'contracts/app.json'))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Checks an app identity and fills in defaults. Throws a CliError describing the first problem.
|
|
19
|
+
* @param {any} app
|
|
20
|
+
* @returns {AppIdentity}
|
|
21
|
+
*/
|
|
22
|
+
export function validateApp(app) {
|
|
23
|
+
const where = 'contracts/app.json'
|
|
24
|
+
if (typeof app.name !== 'string' || !app.name.trim() || /[\n$]|\/\//.test(app.name)) {
|
|
25
|
+
throw new CliError(`${where} "name" must be a non-empty display name without "$", "//" or line breaks.`)
|
|
26
|
+
}
|
|
27
|
+
if (typeof app.id !== 'string' || !/^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(app.id)) {
|
|
28
|
+
throw new CliError(`${where} "id" must be a reverse-DNS identifier like "com.acme.notes" (used as the iOS bundle ID and Android application ID).`)
|
|
29
|
+
}
|
|
30
|
+
if (typeof app.version !== 'string' || !/^\d+(\.\d+){0,2}$/.test(app.version)) {
|
|
31
|
+
throw new CliError(`${where} "version" must look like "1.0.0".`)
|
|
32
|
+
}
|
|
33
|
+
if (!Number.isInteger(app.build) || app.build < 1) {
|
|
34
|
+
throw new CliError(`${where} "build" must be a whole number of 1 or more.`)
|
|
35
|
+
}
|
|
36
|
+
const defaultLocale = app.defaultLocale ?? 'en'
|
|
37
|
+
if (typeof defaultLocale !== 'string' || !/^[a-z]{2,3}(-[A-Za-z0-9]+)*$/.test(defaultLocale)) {
|
|
38
|
+
throw new CliError(`${where} "defaultLocale" must be a language code like "en" or "pt-BR".`)
|
|
39
|
+
}
|
|
40
|
+
return { name: app.name.trim(), id: app.id, version: app.version, build: app.build, defaultLocale }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @param {AppIdentity} app @returns {Output[]} */
|
|
44
|
+
export function appOutputs(app) {
|
|
45
|
+
const source = 'contracts/app.json'
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
path: OUT.iosIdentity,
|
|
49
|
+
content: `// ${banner(source)}
|
|
50
|
+
APP_DISPLAY_NAME = ${app.name}
|
|
51
|
+
APP_BUNDLE_ID = ${app.id}
|
|
52
|
+
APP_VERSION = ${app.version}
|
|
53
|
+
APP_BUILD = ${app.build}
|
|
54
|
+
`,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
path: `${OUT.iosGenerated}/AppIdentity.swift`,
|
|
58
|
+
content: `// ${banner(source)}
|
|
59
|
+
|
|
60
|
+
/// The app's name, identifier and version, shared with the Android and web apps.
|
|
61
|
+
nonisolated enum AppIdentity {
|
|
62
|
+
static let name = ${swiftString(app.name)}
|
|
63
|
+
static let id = ${swiftString(app.id)}
|
|
64
|
+
static let version = ${swiftString(app.version)}
|
|
65
|
+
static let build = ${app.build}
|
|
66
|
+
}
|
|
67
|
+
`,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: OUT.androidIdentity,
|
|
71
|
+
content: `# ${banner(source)}
|
|
72
|
+
applicationId=${app.id}
|
|
73
|
+
versionName=${app.version}
|
|
74
|
+
versionCode=${app.build}
|
|
75
|
+
`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
path: `${OUT.androidKotlin}/AppIdentity.kt`,
|
|
79
|
+
content: `// ${banner(source)}
|
|
80
|
+
package app.generated
|
|
81
|
+
|
|
82
|
+
/** The app's name, identifier and version, shared with the iOS and web apps. */
|
|
83
|
+
object AppIdentity {
|
|
84
|
+
const val NAME = ${kotlinString(app.name)}
|
|
85
|
+
const val ID = ${kotlinString(app.id)}
|
|
86
|
+
const val VERSION = ${kotlinString(app.version)}
|
|
87
|
+
const val BUILD = ${app.build}
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
path: `${OUT.webGenerated}/app.ts`,
|
|
93
|
+
content: `// ${banner(source)}
|
|
94
|
+
|
|
95
|
+
/** The app's name, identifier and version, shared with the iOS and Android apps. */
|
|
96
|
+
export const AppIdentity = {
|
|
97
|
+
name: ${JSON.stringify(app.name)},
|
|
98
|
+
id: ${JSON.stringify(app.id)},
|
|
99
|
+
version: ${JSON.stringify(app.version)},
|
|
100
|
+
build: ${app.build},
|
|
101
|
+
} as const
|
|
102
|
+
`,
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { readJson } from '../lib/fsutil.js'
|
|
4
|
+
import { CliError } from '../lib/log.js'
|
|
5
|
+
import { assertIdentifier, banner, OUT, swiftString } from './util.js'
|
|
6
|
+
|
|
7
|
+
const SOURCE = 'contracts/icons.json'
|
|
8
|
+
const ANDROID_ICON = /^Icons\.(AutoMirrored\.)?(Filled|Outlined|Rounded|Sharp|TwoTone)\.([A-Z][A-Za-z0-9]*)$/
|
|
9
|
+
const LUCIDE_ICON = /^[A-Z][A-Za-z0-9]*$/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {{ ios: string, android: string, web: string }} Icon
|
|
13
|
+
* @typedef {{ path: string, content: string | Buffer }} Output
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** @param {string} root @returns {Record<string, Icon>} */
|
|
17
|
+
export function readIcons(root) {
|
|
18
|
+
const raw = readJson(path.join(root, 'contracts', 'icons.json'), SOURCE)
|
|
19
|
+
/** @type {Record<string, Icon>} */
|
|
20
|
+
const icons = {}
|
|
21
|
+
for (const [name, value] of Object.entries(raw)) {
|
|
22
|
+
if (name.startsWith('$')) continue
|
|
23
|
+
assertIdentifier(name, `${SOURCE} icon`)
|
|
24
|
+
const where = `${SOURCE} "${name}"`
|
|
25
|
+
const { ios, android, web } = value ?? {}
|
|
26
|
+
if (typeof ios !== 'string' || !ios) throw new CliError(`${where} needs "ios": an SF Symbol name like "gearshape".`)
|
|
27
|
+
if (typeof android !== 'string' || !ANDROID_ICON.test(android)) {
|
|
28
|
+
throw new CliError(`${where} needs "android": a Material icon like "Icons.Filled.Settings" or "Icons.AutoMirrored.Filled.ArrowBack".`)
|
|
29
|
+
}
|
|
30
|
+
if (typeof web !== 'string' || !LUCIDE_ICON.test(web)) throw new CliError(`${where} needs "web": a Lucide icon name like "Settings".`)
|
|
31
|
+
icons[name] = { ios, android, web }
|
|
32
|
+
}
|
|
33
|
+
return icons
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @param {Record<string, Icon>} icons @returns {Output[]} */
|
|
37
|
+
export function iconOutputs(icons) {
|
|
38
|
+
const entries = Object.entries(icons).sort(([a], [b]) => (a < b ? -1 : 1))
|
|
39
|
+
return [
|
|
40
|
+
{ path: `${OUT.iosGenerated}/Icons.swift`, content: swift(entries) },
|
|
41
|
+
{ path: `${OUT.androidKotlin}/Icons.kt`, content: kotlin(entries) },
|
|
42
|
+
{ path: `${OUT.webGenerated}/icons.ts`, content: typescript(entries) },
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @param {[string, Icon][]} entries */
|
|
47
|
+
function swift(entries) {
|
|
48
|
+
return `// ${banner(SOURCE)}
|
|
49
|
+
|
|
50
|
+
/// Icons as SF Symbol names. Use with \`Image(systemName: AppIcon.settings)\`.
|
|
51
|
+
nonisolated enum AppIcon {
|
|
52
|
+
${entries.map(([name, icon]) => ` static let ${name} = ${swiftString(icon.ios)}`).join('\n')}
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @param {[string, Icon][]} entries */
|
|
58
|
+
function kotlin(entries) {
|
|
59
|
+
const imports = new Set(['androidx.compose.material.icons.Icons', 'androidx.compose.ui.graphics.vector.ImageVector'])
|
|
60
|
+
for (const [, icon] of entries) {
|
|
61
|
+
const [, mirrored, style, name] = /** @type {RegExpMatchArray} */ (icon.android.match(ANDROID_ICON))
|
|
62
|
+
imports.add(`androidx.compose.material.icons.${mirrored ? 'automirrored.' : ''}${style.toLowerCase()}.${name}`)
|
|
63
|
+
}
|
|
64
|
+
return `// ${banner(SOURCE)}
|
|
65
|
+
package app.generated
|
|
66
|
+
|
|
67
|
+
${[...imports].sort().map((i) => `import ${i}`).join('\n')}
|
|
68
|
+
|
|
69
|
+
/** Icons as Material icons. Use with \`Icon(AppIcons.settings, contentDescription = ...)\`. */
|
|
70
|
+
object AppIcons {
|
|
71
|
+
${entries.map(([name, icon]) => ` val ${name}: ImageVector get() = ${icon.android}`).join('\n')}
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** @param {[string, Icon][]} entries */
|
|
77
|
+
function typescript(entries) {
|
|
78
|
+
const components = [...new Set(entries.map(([, icon]) => icon.web))].sort()
|
|
79
|
+
return `// ${banner(SOURCE)}
|
|
80
|
+
import { ${components.join(', ')} } from 'lucide-react'
|
|
81
|
+
|
|
82
|
+
/** Icons as Lucide components. Use as \`<AppIcons.settings className="size-6" />\`. */
|
|
83
|
+
export const AppIcons = {
|
|
84
|
+
${entries.map(([name, icon]) => ` ${name}: ${icon.web},`).join('\n')}
|
|
85
|
+
} as const
|
|
86
|
+
`
|
|
87
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { readdirSync, existsSync } from 'node:fs'
|
|
4
|
+
import { walk } from '../lib/fsutil.js'
|
|
5
|
+
import { rel } from '../lib/project.js'
|
|
6
|
+
import { appOutputs, readApp } from './app.js'
|
|
7
|
+
import { iconOutputs, readIcons } from './icons.js'
|
|
8
|
+
import { readStrings, stringOutputs } from './strings.js'
|
|
9
|
+
import { readTokens, tokenOutputs } from './tokens.js'
|
|
10
|
+
import { OUT } from './util.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reads and validates every contract, and returns the files they generate in each app.
|
|
14
|
+
* @param {string} root
|
|
15
|
+
* @returns {{ path: string, content: string | Buffer }[]}
|
|
16
|
+
*/
|
|
17
|
+
export function generate(root) {
|
|
18
|
+
const app = readApp(root)
|
|
19
|
+
return [
|
|
20
|
+
...appOutputs(app),
|
|
21
|
+
...tokenOutputs(readTokens(root)),
|
|
22
|
+
...stringOutputs(readStrings(root, app.defaultLocale), app.name),
|
|
23
|
+
...iconOutputs(readIcons(root)),
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generated files that exist on disk but are no longer produced (e.g. a removed locale).
|
|
29
|
+
* @param {string} root
|
|
30
|
+
* @param {Set<string>} produced relative paths
|
|
31
|
+
*/
|
|
32
|
+
export function staleFiles(root, produced) {
|
|
33
|
+
const owned = [OUT.iosGenerated, OUT.androidKotlin, OUT.webGenerated].flatMap((dir) => walk(path.join(root, dir)))
|
|
34
|
+
const res = path.join(root, OUT.androidRes)
|
|
35
|
+
if (existsSync(res)) {
|
|
36
|
+
for (const dir of readdirSync(res)) {
|
|
37
|
+
if (!dir.startsWith('values')) continue
|
|
38
|
+
for (const file of readdirSync(path.join(res, dir))) {
|
|
39
|
+
if (file.startsWith('generated_')) owned.push(path.join(res, dir, file))
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return owned.map((file) => rel(root, file)).filter((file) => !produced.has(file))
|
|
44
|
+
}
|