rosetta init¶
Scaffold a strict-JSON skeleton for a new (app, version) pair.
Synopsis¶
Arguments¶
| Argument | Required | Description |
|---|---|---|
<app> |
Yes | Android package name, e.g. com.example.app. Becomes the top-level "app" field in the scaffolded map. |
<version> |
Yes | App versionName, e.g. 3.4.5. Becomes the "version" field (a human label). |
--version-code <code> |
Yes | The Android PackageInfo.versionCode (a positive integer). It is the authoritative O(1) selection key and the default output filename (<version_code>.json), so it is required — without it the filename can't obey the basename == version_code invariant. |
-o, --output <path> |
No | Output path. Defaults to maps/<app>/<version_code>.json. |
-f, --force |
No | Overwrite an existing file at the output path. |
What it writes¶
A plain strict-JSON skeleton (no comments — field documentation lives in Maps — format) with:
- All required top-level metadata filled in, including the mandatory
non-zero
version_codeyou supplied via--version-code. - A single worked example class entry under
classesso you see the shape and edit it in place.
{
"schema_version": 5,
"app": "com.example.app",
"version": "3.4.5",
"version_code": 30405,
"captured_at": "",
"sources": [
{
"tool": "hand-authored",
"classes": 1
}
],
"classes": {
"com.example.app.IRemoteService$Stub": {
"obfuscated": "aaaa",
"kind": "class",
"methods": {
"requestTicket": {
"obfuscated": "c",
"signature": "(Landroid/os/Bundle;Lbbbb;)V"
}
},
"fields": {
"sessionId": {
"obfuscated": "a",
"type": "Ljava/lang/String;"
}
}
}
}
}
Examples¶
Default path¶
Custom path¶
$ npx rosetta init com.example.app 3.4.5 --version-code 30405 -o vendor/maps/example.json
wrote vendor/maps/example.json
Refuses to overwrite by default¶
$ npx rosetta init com.example.app 3.4.5 --version-code 30405
error: refusing to overwrite existing file: maps/com.example.app/30405.json (pass --force to overwrite)
$ npx rosetta init com.example.app 3.4.5 --version-code 30405 --force
wrote maps/com.example.app/30405.json
Missing --version-code fails fast¶
$ npx rosetta init com.example.app 3.4.5
rosetta init: init requires --version-code <n> (a positive integer Android versionCode); without it the output filename cannot obey the filename == version_code invariant
Behavior notes¶
- The output directory is created recursively if missing
(
mkdir -p). - The scaffold's
captured_atfield is left empty — fill it with an ISO date when you commit the map. --version-codeis required and must be a positive integer; it is written verbatim into the skeleton'sversion_codeand used as the default filename. It is the authoritative key the runtime selects maps by, so there is no0placeholder to remember to replace.- The scaffold's
sourcesarray has onehand-authoredentry withclasses: 1(the worked example). Update it as you add real entries; the field is free-form provenance. - No flag enables auto-detect of the running version from a
connected device.
initis purely a filesystem scaffold; for runtime detection seerosetta.session({ })'s in-process auto-detect.
Exit codes¶
| Code | Meaning |
|---|---|
0 |
Skeleton written. |
1 |
Bad arguments, target exists and --force not passed, or filesystem error. |
What to do next¶
After running init:
- Open the skeleton in your editor.
- Fill in entries from jadx, sigmatcher, or hand-authored discoveries.
- Run
rosetta validateto check the shape. - Compile a hook and run it on a device to verify the health check passes.
- Commit.
See Authoring maps for the full workflow.