nativeapptemplate-agent 0.2.4 → 0.3.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/AGENTS.md +6 -4
- package/README.md +40 -10
- package/dist/agents/judge.d.ts.map +1 -1
- package/dist/agents/judge.js +3 -2
- package/dist/agents/judge.js.map +1 -1
- package/dist/agents/planner.d.ts +93 -0
- package/dist/agents/planner.d.ts.map +1 -1
- package/dist/agents/planner.js +110 -80
- package/dist/agents/planner.js.map +1 -1
- package/dist/agents/repair.d.ts +2 -0
- package/dist/agents/repair.d.ts.map +1 -1
- package/dist/agents/repair.js +25 -16
- package/dist/agents/repair.js.map +1 -1
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/workers/android.d.ts +2 -0
- package/dist/agents/workers/android.d.ts.map +1 -1
- package/dist/agents/workers/android.js +10 -6
- package/dist/agents/workers/android.js.map +1 -1
- package/dist/agents/workers/copy.d.ts +3 -0
- package/dist/agents/workers/copy.d.ts.map +1 -1
- package/dist/agents/workers/copy.js +46 -0
- package/dist/agents/workers/copy.js.map +1 -1
- package/dist/agents/workers/ios.d.ts +2 -0
- package/dist/agents/workers/ios.d.ts.map +1 -1
- package/dist/agents/workers/ios.js +22 -8
- package/dist/agents/workers/ios.js.map +1 -1
- package/dist/agents/workers/rails.d.ts +4 -1
- package/dist/agents/workers/rails.d.ts.map +1 -1
- package/dist/agents/workers/rails.js +18 -7
- package/dist/agents/workers/rails.js.map +1 -1
- package/dist/dispatch.d.ts +4 -0
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +23 -3
- package/dist/dispatch.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/dist/japanese-nouns.d.ts +5 -0
- package/dist/japanese-nouns.d.ts.map +1 -0
- package/dist/japanese-nouns.js +18 -0
- package/dist/japanese-nouns.js.map +1 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +7 -2
- package/dist/mcp.js.map +1 -1
- package/dist/models.d.ts +11 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +27 -0
- package/dist/models.js.map +1 -0
- package/dist/rename-overrides.d.ts +12 -0
- package/dist/rename-overrides.d.ts.map +1 -1
- package/dist/rename-overrides.js +49 -1
- package/dist/rename-overrides.js.map +1 -1
- package/dist/report/render.js +1 -1
- package/dist/report/render.js.map +1 -1
- package/dist/reserved-words.d.ts +13 -0
- package/dist/reserved-words.d.ts.map +1 -0
- package/dist/reserved-words.js +72 -0
- package/dist/reserved-words.js.map +1 -0
- package/dist/slug.js +1 -1
- package/dist/slug.js.map +1 -1
- package/dist/structured-output.d.ts +6 -0
- package/dist/structured-output.d.ts.map +1 -0
- package/dist/structured-output.js +32 -0
- package/dist/structured-output.js.map +1 -0
- package/dist/validation/layer1.d.ts.map +1 -1
- package/dist/validation/layer1.js +13 -1
- package/dist/validation/layer1.js.map +1 -1
- package/dist/validation/layer3.d.ts +21 -0
- package/dist/validation/layer3.d.ts.map +1 -1
- package/dist/validation/layer3.js +65 -51
- package/dist/validation/layer3.js.map +1 -1
- package/dist/validation/stage2-judge.d.ts.map +1 -1
- package/dist/validation/stage2-judge.js +2 -1
- package/dist/validation/stage2-judge.js.map +1 -1
- package/dist/validation/visual-judge.d.ts +1 -0
- package/dist/validation/visual-judge.d.ts.map +1 -1
- package/dist/validation/visual-judge.js +8 -2
- package/dist/validation/visual-judge.js.map +1 -1
- package/package.json +3 -3
- package/scripts/ruby/rename.rb +30 -5
package/scripts/ruby/rename.rb
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
#
|
|
3
3
|
# Apply a rename plan to a Rails project tree.
|
|
4
|
-
# Stdin: { "renamePlan": [{"from":"Shop","to":"Clinic"}, ...],
|
|
4
|
+
# Stdin: { "renamePlan": [{"from":"Shop","to":"Clinic"}, ...],
|
|
5
|
+
# "japaneseRenamePlan": [{"from":"店舗","to":"医院"}, ...], (optional)
|
|
6
|
+
# "root": "/abs/path" }
|
|
5
7
|
# Stdout: { "files_scanned": N, "files_changed": N, "substitutions": N, "files_renamed": N }
|
|
6
8
|
#
|
|
7
9
|
# Rewrites file content AND renames files/directories for every
|
|
@@ -16,6 +18,7 @@ require "json"
|
|
|
16
18
|
|
|
17
19
|
input = JSON.parse($stdin.read)
|
|
18
20
|
plan = input.fetch("renamePlan")
|
|
21
|
+
japanese_plan = input.fetch("japaneseRenamePlan", [])
|
|
19
22
|
root = input.fetch("root")
|
|
20
23
|
|
|
21
24
|
stats = { files_scanned: 0, files_changed: 0, substitutions: 0, files_renamed: 0 }
|
|
@@ -25,7 +28,7 @@ SKIP_SUBPATHS = %w[vendor/bundle app/assets/builds public/assets].freeze
|
|
|
25
28
|
TEXT_EXTS = %w[
|
|
26
29
|
.rb .erb .yml .yaml .json .md .gemspec .rake .ru .txt .sample .example .conf
|
|
27
30
|
.html .css .scss .js .mjs .tt .lock
|
|
28
|
-
.swift .plist .strings .xcconfig .entitlements .pbxproj .xcworkspacedata .modulemap .xcscheme
|
|
31
|
+
.swift .plist .strings .xcstrings .xcconfig .entitlements .pbxproj .xcworkspacedata .modulemap .xcscheme
|
|
29
32
|
.kt .kts .xml .gradle .pro .toml .properties .cfg
|
|
30
33
|
.proto
|
|
31
34
|
.svg .webmanifest
|
|
@@ -34,6 +37,7 @@ TEXT_BASENAMES = %w[
|
|
|
34
37
|
Gemfile Gemfile.lock Rakefile Procfile Procfile.dev
|
|
35
38
|
.gitignore .env.sample .ruby-version .node-version
|
|
36
39
|
config.ru Dockerfile
|
|
40
|
+
secrets secrets-common
|
|
37
41
|
Podfile Podfile.lock Package.swift Cartfile Makefile
|
|
38
42
|
gradlew gradlew.bat gradle.properties local.properties
|
|
39
43
|
brakeman.ignore .swiftformat
|
|
@@ -87,6 +91,17 @@ def build_patterns(from, to)
|
|
|
87
91
|
to_camel = camel_case(to)
|
|
88
92
|
from_camel_pl = pluralize(from_camel)
|
|
89
93
|
to_camel_pl = pluralize(to_camel)
|
|
94
|
+
# SCREAMING form: the upper case of whatever its lower-case spelling becomes.
|
|
95
|
+
# A one-word `from` has a single lower-case spelling (snake == flat) and the
|
|
96
|
+
# snake pattern above wins for it, so `nativeapptemplateapi` becomes
|
|
97
|
+
# `barber_queue_api`; NATIVEAPPTEMPLATEAPI must then become BARBER_QUEUE_API,
|
|
98
|
+
# not BARBERQUEUEAPI, or code that derives one from the other breaks (the
|
|
99
|
+
# API's deploy test checks `$#{SERVICE.upcase}_SENTRY_DSN` in .kamal/secrets).
|
|
100
|
+
# A multi-word `from` (NativeAppTemplate) keeps the flat form, matching its
|
|
101
|
+
# flat lower-case rename (NATIVEAPPTEMPLATE_API_DOMAIN -> CLINICQUEUE_API_DOMAIN).
|
|
102
|
+
one_word = from_snake == from_flat
|
|
103
|
+
to_upper = one_word ? to_snake.upcase : to.upcase
|
|
104
|
+
to_upper_pl = one_word ? to_snake_pl.upcase : to_pl.upcase
|
|
90
105
|
from_human_lo = humanize_lower(from)
|
|
91
106
|
to_human_lo = humanize_lower(to)
|
|
92
107
|
from_human_ti = humanize_title(from)
|
|
@@ -115,6 +130,9 @@ def build_patterns(from, to)
|
|
|
115
130
|
pascal_r = "(?:(?![A-Za-z])|(?=[A-Z]))"
|
|
116
131
|
snake_l = "(?<![A-Za-z])"
|
|
117
132
|
snake_r = "(?:(?![A-Za-z])|(?=[A-Z]))"
|
|
133
|
+
# SCREAMING tokens also follow Gradle's `-P` (`-PNATIVEAPPTEMPLATE_SENTRY_DSN=...`
|
|
134
|
+
# in the Android template's docs and build script comments).
|
|
135
|
+
upper_l = "(?:(?<![A-Za-z])|(?<=-P))"
|
|
118
136
|
|
|
119
137
|
patterns = [
|
|
120
138
|
[/#{pascal_l}#{Regexp.escape(from_pl)}#{pascal_r}/, to_pl],
|
|
@@ -132,8 +150,8 @@ def build_patterns(from, to)
|
|
|
132
150
|
# (from `ItemTag`) or `itemTagInfoFromNdefMessage`.
|
|
133
151
|
[/#{snake_l}#{Regexp.escape(from_camel_pl)}#{snake_r}/, to_camel_pl],
|
|
134
152
|
[/#{snake_l}#{Regexp.escape(from_camel)}#{snake_r}/, to_camel],
|
|
135
|
-
[/#{
|
|
136
|
-
[/#{
|
|
153
|
+
[/#{upper_l}#{Regexp.escape(from_pl.upcase)}(?![A-Za-z])/, to_upper_pl],
|
|
154
|
+
[/#{upper_l}#{Regexp.escape(from.upcase)}(?![A-Za-z])/, to_upper],
|
|
137
155
|
]
|
|
138
156
|
|
|
139
157
|
# Humanized display forms — three case shapes per number:
|
|
@@ -162,7 +180,14 @@ def build_patterns(from, to)
|
|
|
162
180
|
patterns
|
|
163
181
|
end
|
|
164
182
|
|
|
165
|
-
|
|
183
|
+
# Japanese has no word boundaries and its nouns don't inflect, so a plain
|
|
184
|
+
# substring covers compounds (店舗名) and every sentence the noun appears in.
|
|
185
|
+
# Longest first, so a noun inside another (タグ in アイテムタグ) can't win.
|
|
186
|
+
japanese_patterns = japanese_plan
|
|
187
|
+
.sort_by { |p| -p.fetch("from").length }
|
|
188
|
+
.map { |p| [/#{Regexp.escape(p.fetch("from"))}/, p.fetch("to")] }
|
|
189
|
+
|
|
190
|
+
all_patterns = japanese_patterns + plan.flat_map { |p| build_patterns(p.fetch("from"), p.fetch("to")) }
|
|
166
191
|
|
|
167
192
|
# One combined regex, applied in a single pass, so a replacement is never
|
|
168
193
|
# re-scanned by a later pair: with NativeAppTemplate→PetShop and Shop→Store,
|