-
-
Notifications
You must be signed in to change notification settings - Fork 483
docs: refresh CLAUDE.md files for 1.8.2 state #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf59776
ae22e40
dd3218d
a2b92ad
dbbd057
b8a08f3
e2dbc3a
204aca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -257,6 +257,78 @@ object AssetVariant { | |||||||||||||||||||||||||||||||
| * the glob would just equal the filename and provides no rescue | ||||||||||||||||||||||||||||||||
| * value beyond exact-match. | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||
| * Extracts the **base-name stem** of an asset — the lowercased, | ||||||||||||||||||||||||||||||||
| * separator-stripped concatenation of every token that isn't a | ||||||||||||||||||||||||||||||||
| * version-like number, an arch token, or a flavor token. Used to | ||||||||||||||||||||||||||||||||
| * detect "sibling app in the same repo" cases where two releases | ||||||||||||||||||||||||||||||||
| * ship `AppA-1.10.apk` and `AppB-2.20.apk` and the auto-picker | ||||||||||||||||||||||||||||||||
| * would otherwise swap one for the other based on numeric version | ||||||||||||||||||||||||||||||||
| * alone (issue #591). | ||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||
| * `AppA-1.10.apk` → `"appa"` | ||||||||||||||||||||||||||||||||
| * `AppB-2.20.apk` → `"appb"` | ||||||||||||||||||||||||||||||||
| * `app-arm64-v8a-1.10.apk` and `app-x86_64-1.10.apk` → both `"app"` | ||||||||||||||||||||||||||||||||
| * `app-1.0.apk` and `app-fdroid-1.0.apk` → both `"app"` | ||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||
| * Returns an empty string when stripping leaves nothing behind | ||||||||||||||||||||||||||||||||
| * (release ships only a versioned filename like `2.0.apk`). Callers | ||||||||||||||||||||||||||||||||
| * treat empty as "no stem signal — don't filter". | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| fun extractBaseStem(assetName: String): String { | ||||||||||||||||||||||||||||||||
| val tokens = tokenize(assetName) | ||||||||||||||||||||||||||||||||
| if (tokens.isEmpty()) return "" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Mirror `extractTokens`' n-gram consumption pass so the | ||||||||||||||||||||||||||||||||
| // fragments of compound vocab entries (e.g. `arm64-v8a` → | ||||||||||||||||||||||||||||||||
| // tokens `["arm64","v8a"]`) are both stripped, not just the | ||||||||||||||||||||||||||||||||
| // canonical-form half. Without this, `v8a` / `v7a` would | ||||||||||||||||||||||||||||||||
| // survive the filter and `app-arm64-v8a-1.10.apk` would yield | ||||||||||||||||||||||||||||||||
| // a different stem than `app-x86_64-1.10.apk`, defeating the | ||||||||||||||||||||||||||||||||
| // sibling-app detection for arch-variant releases. | ||||||||||||||||||||||||||||||||
| val consumed = BooleanArray(tokens.size) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| for (i in 0 until tokens.size - 2) { | ||||||||||||||||||||||||||||||||
| if (consumed[i] || consumed[i + 1] || consumed[i + 2]) continue | ||||||||||||||||||||||||||||||||
| val candidate = "${tokens[i]}-${tokens[i + 1]}-${tokens[i + 2]}" | ||||||||||||||||||||||||||||||||
| if (candidate in VOCABULARY) { | ||||||||||||||||||||||||||||||||
| consumed[i] = true; consumed[i + 1] = true; consumed[i + 2] = true | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| for (i in 0 until tokens.size - 1) { | ||||||||||||||||||||||||||||||||
| if (consumed[i] || consumed[i + 1]) continue | ||||||||||||||||||||||||||||||||
| val dashed = "${tokens[i]}-${tokens[i + 1]}" | ||||||||||||||||||||||||||||||||
| val underscored = "${tokens[i]}_${tokens[i + 1]}" | ||||||||||||||||||||||||||||||||
| if (dashed in VOCABULARY || underscored in VOCABULARY) { | ||||||||||||||||||||||||||||||||
| consumed[i] = true; consumed[i + 1] = true | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| val out = StringBuilder() | ||||||||||||||||||||||||||||||||
| for (i in tokens.indices) { | ||||||||||||||||||||||||||||||||
| if (consumed[i]) continue | ||||||||||||||||||||||||||||||||
| val t = tokens[i] | ||||||||||||||||||||||||||||||||
| if (t in VOCABULARY) continue | ||||||||||||||||||||||||||||||||
| if (isVersionLikeToken(t)) continue | ||||||||||||||||||||||||||||||||
| out.append(t) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| return out.toString() | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||
| * `1`, `10`, `1.0.0`, `v2.0.1`, `2024.04.10`, `1.0-rc1`, `beta3` — | ||||||||||||||||||||||||||||||||
| * common patterns used in release filenames to encode the version. | ||||||||||||||||||||||||||||||||
| * Conservative on purpose: false positives here just lose a stem | ||||||||||||||||||||||||||||||||
| * character; false negatives would let a numeric variant leak into | ||||||||||||||||||||||||||||||||
| * the stem and break the sibling-app detection. | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
|
Comment on lines
+318
to
+324
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| private fun isVersionLikeToken(token: String): Boolean { | ||||||||||||||||||||||||||||||||
| if (token.isEmpty()) return false | ||||||||||||||||||||||||||||||||
| if (token.all { it.isDigit() }) return true | ||||||||||||||||||||||||||||||||
| if (token.startsWith("v") && token.drop(1).all { it.isDigit() }) return true | ||||||||||||||||||||||||||||||||
| return false | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+325
to
+330
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broaden version-token stripping to keep stems stable across prerelease bumps. At Line 325, 💡 Suggested fix+ private val QUALIFIER_VERSION_TOKEN =
+ Regex("""^(alpha|beta|rc|pre|preview)\d+$""")
private fun isVersionLikeToken(token: String): Boolean {
- if (token.isEmpty()) return false
- if (token.all { it.isDigit() }) return true
- if (token.startsWith("v") && token.drop(1).all { it.isDigit() }) return true
+ if (token.isEmpty()) return false
+ val t = token.lowercase()
+ if (t.all { it.isDigit() }) return true
+ if (t.startsWith("v") && t.length > 1 && t.drop(1).all { it.isDigit() }) return true
+ if (QUALIFIER_VERSION_TOKEN.matches(t)) return true
return false
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| fun deriveGlob(assetName: String): String? { | ||||||||||||||||||||||||||||||||
| val lower = assetName.lowercase() | ||||||||||||||||||||||||||||||||
| // Match either: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deriveGlobextractBaseStem(andisVersionLikeToken) were inserted immediately after the closing*/ofderiveGlob's KDoc block, placing them between the doc comment and thefun deriveGlob(...)declaration at line 332. As a resultderiveGlobnow has no KDoc attached (the floating comment aboveextractBaseStem's own block is not attributed to it), and IDEs will showderiveGlobas undocumented. MovingextractBaseStem+isVersionLikeTokento before thederiveGlobKDoc block restores the association.