gwqadd 0.5.2 → 0.6.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.
- package/README.md +1 -1
- package/bin/gwqadd.mjs +109 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ gwqadd feat/logout --from main
|
|
|
104
104
|
Run `gwqadd` with no branch name and it rolls one before it asks you anything:
|
|
105
105
|
|
|
106
106
|
```
|
|
107
|
-
│
|
|
107
|
+
│ tidy-dancing-kite off main
|
|
108
108
|
│ create it? [Y]es · [n]o, name it properly · [e]dit · [r]eroll
|
|
109
109
|
```
|
|
110
110
|
|
package/bin/gwqadd.mjs
CHANGED
|
@@ -998,139 +998,137 @@ function defaultBranch(dir) {
|
|
|
998
998
|
// Adjectives and nouns: glitchdotcom/friendly-words, MIT (c) 2018 Glitch.
|
|
999
999
|
// Gerunds: dariusk/corpora, CC0.
|
|
1000
1000
|
//
|
|
1001
|
-
//
|
|
1002
|
-
//
|
|
1001
|
+
// What keeps these readable to someone who does not read English all day is
|
|
1002
|
+
// EFF's short diceware wordlist, which EFF built from Ghent University's
|
|
1003
|
+
// word-familiarity data: five characters or fewer, no homophones, nothing hard
|
|
1004
|
+
// to spell. Every adjective and every noun here is a member of it. **No gerund
|
|
1005
|
+
// is, and none can be** — that list stops at five characters and these run six
|
|
1006
|
+
// to nine; what is easy about a gerund is its verb, so each was conjugated from
|
|
1007
|
+
// an infinitive the list holds (`cook` is there, `cooking` never could be).
|
|
1008
|
+
//
|
|
1009
|
+
// That is why the three lists are this small — 149 * 130 * 353 = 6,837,610
|
|
1010
|
+
// combinations, against the 9,582,408 of the revision that took whatever
|
|
1011
|
+
// friendly-words offered. `randomName()` below cannot reach 8,840 of them (the
|
|
1012
|
+
// 68 words that are both an adjective and a noun, times the gerunds), so the
|
|
1013
|
+
// number of names it actually hands out is 6,828,770.
|
|
1003
1014
|
|
|
1004
1015
|
const ADJECTIVES = [
|
|
1005
|
-
'
|
|
1006
|
-
'
|
|
1007
|
-
'
|
|
1008
|
-
'
|
|
1009
|
-
'
|
|
1010
|
-
'
|
|
1011
|
-
'
|
|
1012
|
-
'
|
|
1013
|
-
'
|
|
1014
|
-
'
|
|
1015
|
-
'
|
|
1016
|
-
'
|
|
1017
|
-
'
|
|
1018
|
-
'
|
|
1019
|
-
'
|
|
1020
|
-
'
|
|
1021
|
-
'
|
|
1022
|
-
'mercurial', 'mica', 'military', 'mire', 'modest', 'mousy', 'narrow',
|
|
1023
|
-
'nebula', 'nice', 'ninth', 'numerous', 'occipital', 'olivine', 'orchid',
|
|
1024
|
-
'ossified', 'pale', 'past', 'pear', 'perfect', 'petalite', 'picayune',
|
|
1025
|
-
'pineapple', 'plaid', 'platinum', 'plume', 'polarized', 'polyester',
|
|
1026
|
-
'prairie', 'private', 'proximal', 'pyrite', 'quickest', 'quilted', 'radical',
|
|
1027
|
-
'raspy', 'regal', 'repeated', 'respected', 'ringed', 'road', 'romantic',
|
|
1028
|
-
'round', 'rustic', 'salt', 'sapphire', 'scented', 'season', 'sedate',
|
|
1029
|
-
'separate', 'shaded', 'sheer', 'shiny', 'shrub', 'silky', 'sincere',
|
|
1030
|
-
'skitter', 'slimy', 'smooth', 'solar', 'southern', 'speckle', 'spiced',
|
|
1031
|
-
'spiral', 'spotless', 'spurious', 'steel', 'stone', 'strong', 'subdued',
|
|
1032
|
-
'sugar', 'sumptuous', 'superb', 'sweet', 'tame', 'tartan', 'temporal',
|
|
1033
|
-
'thankful', 'thoracic', 'tide', 'tiny', 'torpid', 'tropical', 'tundra',
|
|
1034
|
-
'typhoon', 'unique', 'upbeat', 'valiant', 'vast', 'verbose', 'violet',
|
|
1035
|
-
'volcano', 'water', 'west', 'wholesale', 'winter', 'wobbly', 'woolen',
|
|
1036
|
-
'young', 'zest'
|
|
1016
|
+
'aged', 'ahead', 'ajar', 'alike', 'alive', 'apple', 'atom', 'awake', 'blend',
|
|
1017
|
+
'blush', 'brick', 'broad', 'brook', 'busy', 'cake', 'calm', 'candy', 'cedar',
|
|
1018
|
+
'chain', 'charm', 'chief', 'chill', 'chip', 'clean', 'clear', 'cloud',
|
|
1019
|
+
'cold', 'copy', 'coral', 'daily', 'dandy', 'dawn', 'denim', 'dent', 'dot',
|
|
1020
|
+
'dust', 'early', 'east', 'equal', 'even', 'false', 'fancy', 'fifth', 'five',
|
|
1021
|
+
'flame', 'flint', 'foam', 'fog', 'foil', 'fresh', 'frill', 'frost', 'gem',
|
|
1022
|
+
'glass', 'glow', 'good', 'goofy', 'grape', 'grass', 'gray', 'green', 'half',
|
|
1023
|
+
'happy', 'icy', 'iron', 'ivy', 'jelly', 'jet', 'jolly', 'kiwi', 'lake',
|
|
1024
|
+
'lemon', 'level', 'lilac', 'lunar', 'mango', 'mousy', 'mud', 'navy', 'near',
|
|
1025
|
+
'neat', 'neon', 'ninth', 'oasis', 'oil', 'olive', 'open', 'oval', 'palm',
|
|
1026
|
+
'paper', 'patch', 'petal', 'plant', 'prism', 'prong', 'quiet', 'quill',
|
|
1027
|
+
'quilt', 'relic', 'rich', 'ritzy', 'river', 'rogue', 'royal', 'rust', 'sage',
|
|
1028
|
+
'salt', 'same', 'sandy', 'satin', 'sepia', 'shade', 'sharp', 'shell',
|
|
1029
|
+
'shine', 'shiny', 'shore', 'showy', 'silk', 'silly', 'sixth', 'sky', 'sleet',
|
|
1030
|
+
'slimy', 'small', 'snowy', 'spiny', 'spot', 'steep', 'storm', 'stump',
|
|
1031
|
+
'sugar', 'surf', 'tall', 'tasty', 'thorn', 'tidal', 'tidy', 'tiny', 'tree',
|
|
1032
|
+
'tulip', 'water', 'wheat', 'wind', 'wiry', 'wise', 'wool', 'zesty', 'zippy'
|
|
1037
1033
|
];
|
|
1038
1034
|
|
|
1039
1035
|
const GERUNDS = [
|
|
1040
|
-
'
|
|
1041
|
-
'
|
|
1042
|
-
'
|
|
1043
|
-
'
|
|
1044
|
-
'
|
|
1045
|
-
'
|
|
1046
|
-
'
|
|
1047
|
-
'
|
|
1048
|
-
'
|
|
1049
|
-
'
|
|
1050
|
-
'
|
|
1051
|
-
'
|
|
1052
|
-
'
|
|
1053
|
-
'
|
|
1054
|
-
'
|
|
1055
|
-
'
|
|
1056
|
-
'
|
|
1057
|
-
'
|
|
1036
|
+
'amusing', 'blessing', 'blinking', 'blotting', 'blushing', 'boasting',
|
|
1037
|
+
'boiling', 'bolting', 'booking', 'brushing', 'buzzing', 'carrying',
|
|
1038
|
+
'carving', 'causing', 'chasing', 'cheering', 'chewing', 'chopping',
|
|
1039
|
+
'claiming', 'cleaning', 'clearing', 'clipping', 'coaching', 'coiling',
|
|
1040
|
+
'copying', 'coughing', 'covering', 'crawling', 'crossing', 'curing',
|
|
1041
|
+
'curling', 'curving', 'cycling', 'dancing', 'dressing', 'drying', 'dusting',
|
|
1042
|
+
'entering', 'fading', 'fancying', 'faxing', 'fencing', 'fetching', 'filming',
|
|
1043
|
+
'fitting', 'floating', 'founding', 'framing', 'glowing', 'gluing',
|
|
1044
|
+
'greeting', 'gripping', 'guiding', 'heaping', 'heating', 'helping',
|
|
1045
|
+
'hugging', 'hunting', 'hurrying', 'judging', 'jumping', 'kicking', 'landing',
|
|
1046
|
+
'lasting', 'leveling', 'listing', 'marching', 'marrying', 'matching',
|
|
1047
|
+
'mating', 'moving', 'nailing', 'naming', 'nesting', 'opening', 'parking',
|
|
1048
|
+
'planting', 'pointing', 'pressing', 'printing', 'pulling', 'pushing',
|
|
1049
|
+
'racing', 'reaching', 'relaxing', 'replying', 'rhyming', 'rinsing',
|
|
1050
|
+
'rocking', 'ruling', 'rushing', 'scrubbing', 'serving', 'shading', 'sharing',
|
|
1051
|
+
'shopping', 'sipping', 'skipping', 'slipping', 'smashing', 'smelling',
|
|
1052
|
+
'smiling', 'sniffing', 'snoring', 'spilling', 'spotting', 'spraying',
|
|
1053
|
+
'staining', 'stamping', 'starting', 'stepping', 'stirring', 'stuffing',
|
|
1054
|
+
'tasting', 'thanking', 'thawing', 'tracing', 'trading', 'training',
|
|
1055
|
+
'treating', 'trying', 'twisting', 'walking', 'watching', 'watering',
|
|
1056
|
+
'winking', 'wiping', 'wishing', 'working', 'zooming'
|
|
1058
1057
|
];
|
|
1059
1058
|
|
|
1060
1059
|
const NOUNS = [
|
|
1061
|
-
'
|
|
1062
|
-
'
|
|
1063
|
-
'
|
|
1064
|
-
'
|
|
1065
|
-
'
|
|
1066
|
-
'
|
|
1067
|
-
'
|
|
1068
|
-
'
|
|
1069
|
-
'
|
|
1070
|
-
'
|
|
1071
|
-
'
|
|
1072
|
-
'
|
|
1073
|
-
'
|
|
1074
|
-
'
|
|
1075
|
-
'
|
|
1076
|
-
'
|
|
1077
|
-
'
|
|
1078
|
-
'
|
|
1079
|
-
'
|
|
1080
|
-
'
|
|
1081
|
-
'
|
|
1082
|
-
'
|
|
1083
|
-
'
|
|
1084
|
-
'
|
|
1085
|
-
'
|
|
1086
|
-
'
|
|
1087
|
-
'
|
|
1088
|
-
'
|
|
1089
|
-
'
|
|
1090
|
-
'
|
|
1091
|
-
'
|
|
1092
|
-
'
|
|
1093
|
-
'
|
|
1094
|
-
'
|
|
1095
|
-
'
|
|
1096
|
-
'
|
|
1097
|
-
'
|
|
1098
|
-
'
|
|
1099
|
-
'
|
|
1100
|
-
'
|
|
1101
|
-
'riddle', 'riverbed', 'rock', 'rook', 'rosemary', 'rubidium', 'runner',
|
|
1102
|
-
'saguaro', 'salary', 'salute', 'sapphire', 'saturn', 'saxophone', 'scapula',
|
|
1103
|
-
'school', 'scooter', 'screen', 'seaplane', 'second', 'seer', 'server',
|
|
1104
|
-
'shallot', 'shear', 'shift', 'shop', 'shroud', 'silence', 'silver', 'skull',
|
|
1105
|
-
'slice', 'slipper', 'smoke', 'sneeze', 'snowman', 'soarer', 'sodalite',
|
|
1106
|
-
'sole', 'soul', 'soy', 'spark', 'spectrum', 'spider', 'split', 'sprint',
|
|
1107
|
-
'spy', 'stage', 'station', 'step', 'sting', 'stocking', 'story', 'streetcar',
|
|
1108
|
-
'subject', 'suit', 'sundial', 'sunspot', 'surgeon', 'sweater', 'swordfish',
|
|
1109
|
-
'system', 'tailor', 'tangelo', 'target', 'tartan', 'teal', 'tellurium',
|
|
1110
|
-
'tent', 'textbook', 'thorium', 'throne', 'tick', 'tile', 'tip', 'toast',
|
|
1111
|
-
'topaz', 'town', 'traffic', 'traveler', 'tricorne', 'trouser', 'trust',
|
|
1112
|
-
'tugboat', 'turkey', 'turret', 'twine', 'uncle', 'vacation', 'variety',
|
|
1113
|
-
'vein', 'vertebra', 'viola', 'viscose', 'voice', 'walk', 'walleye',
|
|
1114
|
-
'warbler', 'wasp', 'wave', 'weaver', 'whale', 'whitefish', 'wineberry',
|
|
1115
|
-
'wisteria', 'wolfsbane', 'woolen', 'wrinkle', 'xylophone', 'yarrow', 'zebra',
|
|
1116
|
-
'zinnia'
|
|
1060
|
+
'acorn', 'alibi', 'angle', 'ankle', 'apple', 'area', 'army', 'art', 'atom',
|
|
1061
|
+
'attic', 'bagel', 'barge', 'barn', 'basil', 'bath', 'blade', 'boat', 'bolt',
|
|
1062
|
+
'book', 'booth', 'brick', 'brook', 'broom', 'brush', 'cadet', 'cake',
|
|
1063
|
+
'candy', 'card', 'carol', 'case', 'cause', 'chair', 'cheek', 'chef', 'chess',
|
|
1064
|
+
'chili', 'chill', 'chip', 'city', 'class', 'click', 'cloak', 'clock',
|
|
1065
|
+
'cloth', 'cloud', 'coast', 'coat', 'cod', 'coil', 'cold', 'colt', 'comic',
|
|
1066
|
+
'comma', 'cone', 'copy', 'coral', 'cork', 'cost', 'couch', 'cough', 'cover',
|
|
1067
|
+
'crane', 'crate', 'crepe', 'crib', 'crop', 'cross', 'crowd', 'crown', 'cub',
|
|
1068
|
+
'curve', 'cycle', 'dance', 'dart', 'dash', 'data', 'date', 'dawn', 'deal',
|
|
1069
|
+
'denim', 'derby', 'desk', 'dill', 'dime', 'dish', 'donut', 'dove', 'draw',
|
|
1070
|
+
'dress', 'drill', 'drive', 'drum', 'dry', 'duck', 'duke', 'dust', 'eagle',
|
|
1071
|
+
'earth', 'echo', 'edge', 'eel', 'elbow', 'elf', 'elk', 'elm', 'emu', 'fact',
|
|
1072
|
+
'fall', 'fang', 'feast', 'femur', 'ferry', 'fiber', 'fifth', 'finch', 'flag',
|
|
1073
|
+
'flame', 'flock', 'floss', 'foam', 'fog', 'food', 'fox', 'frame', 'frill',
|
|
1074
|
+
'front', 'frost', 'fruit', 'game', 'gas', 'gear', 'gecko', 'gem', 'giver',
|
|
1075
|
+
'glass', 'glove', 'glow', 'glue', 'goal', 'golf', 'gong', 'grain', 'grape',
|
|
1076
|
+
'grass', 'gray', 'green', 'grill', 'grip', 'guide', 'heat', 'hedge', 'help',
|
|
1077
|
+
'hub', 'ice', 'icon', 'iron', 'jam', 'jeep', 'jet', 'judge', 'juice', 'jump',
|
|
1078
|
+
'jury', 'kick', 'king', 'kite', 'kiwi', 'knee', 'koala', 'lake', 'land',
|
|
1079
|
+
'legal', 'lemon', 'lens', 'level', 'lever', 'lift', 'lilac', 'line', 'lint',
|
|
1080
|
+
'lion', 'lip', 'list', 'liver', 'lunch', 'lung', 'lyric', 'mango', 'map',
|
|
1081
|
+
'march', 'match', 'math', 'motor', 'mouse', 'mouth', 'move', 'movie', 'mule',
|
|
1082
|
+
'muse', 'music', 'nail', 'name', 'navy', 'neon', 'nest', 'net', 'niece',
|
|
1083
|
+
'oak', 'ocean', 'oil', 'olive', 'onion', 'opal', 'open', 'opera', 'otter',
|
|
1084
|
+
'ounce', 'oval', 'owl', 'palm', 'panda', 'paper', 'park', 'party', 'pasta',
|
|
1085
|
+
'patch', 'path', 'patio', 'perch', 'plank', 'plant', 'plot', 'plow', 'print',
|
|
1086
|
+
'proof', 'prune', 'quiet', 'quill', 'quilt', 'quit', 'radar', 'radio',
|
|
1087
|
+
'raft', 'rail', 'rake', 'range', 'raven', 'reply', 'rice', 'rise', 'river',
|
|
1088
|
+
'roast', 'rock', 'rover', 'ruby', 'rule', 'sage', 'salad', 'salsa', 'salt',
|
|
1089
|
+
'satin', 'scale', 'scarf', 'shade', 'shape', 'share', 'sheep', 'sheet',
|
|
1090
|
+
'shelf', 'shell', 'ship', 'shirt', 'shop', 'silk', 'skate', 'skirt', 'sky',
|
|
1091
|
+
'sled', 'sleep', 'sleet', 'slice', 'slip', 'slug', 'smile', 'snap', 'snout',
|
|
1092
|
+
'speak', 'spoon', 'spot', 'spur', 'squid', 'stage', 'stamp', 'steam', 'stem',
|
|
1093
|
+
'step', 'stew', 'stick', 'sting', 'stock', 'storm', 'stove', 'straw',
|
|
1094
|
+
'sugar', 'surf', 'sushi', 'swan', 'swim', 'swing', 'swoop', 'syrup', 'talon',
|
|
1095
|
+
'tank', 'thing', 'thorn', 'thumb', 'tiger', 'tile', 'track', 'trade',
|
|
1096
|
+
'train', 'tray', 'tree', 'truck', 'trunk', 'tulip', 'twine', 'twist',
|
|
1097
|
+
'uncle', 'value', 'verse', 'vest', 'visor', 'voice', 'wake', 'walk', 'wasp',
|
|
1098
|
+
'watch', 'water', 'wind', 'wing', 'wish', 'wok', 'wolf', 'wool', 'word',
|
|
1099
|
+
'work', 'wrist', 'yam', 'yard', 'year', 'zebra', 'zone'
|
|
1117
1100
|
];
|
|
1118
1101
|
|
|
1119
1102
|
// ── random names ─────────────────────────────────────────────────────────────
|
|
1120
1103
|
|
|
1121
1104
|
// crypto, not Math.random: two shells started in the same second must not be
|
|
1122
1105
|
// able to agree on a branch name. The modulo biases the first few words of each
|
|
1123
|
-
// list upward by about
|
|
1106
|
+
// list upward by about 353 / 2^32, which is invisible at any number of branches
|
|
1124
1107
|
// a person will ever create.
|
|
1125
1108
|
const pick = (a) => a[randomBytes(4).readUInt32BE(0) % a.length];
|
|
1126
|
-
|
|
1109
|
+
|
|
1110
|
+
// 68 easy words are both an adjective and a noun — `cold`, `chip`, `storm` —
|
|
1111
|
+
// against 9 before the lists were cut to words people actually know, so
|
|
1112
|
+
// `storm-twisting-storm` went from one roll in 9,768 to one in 773 and became
|
|
1113
|
+
// worth guarding. Dropping the overlap from either list instead would cost
|
|
1114
|
+
// `green`, `cold` and `chill`, three of the best words in both.
|
|
1115
|
+
//
|
|
1116
|
+
// The guard filters rather than rerolling in a `while`, which would never end
|
|
1117
|
+
// if the only noun left is the adjective. The shipped lists cannot reach that
|
|
1118
|
+
// state; a shrunken copy of them can, and the tests use exactly such a copy.
|
|
1119
|
+
// The fallback repeats the word, because a name beats a hang.
|
|
1120
|
+
const randomName = () => {
|
|
1121
|
+
const adjective = pick(ADJECTIVES);
|
|
1122
|
+
const nouns = NOUNS.filter((w) => w !== adjective);
|
|
1123
|
+
return `${adjective}-${pick(GERUNDS)}-${pick(nouns.length ? nouns : NOUNS)}`;
|
|
1124
|
+
};
|
|
1127
1125
|
|
|
1128
1126
|
const RANDOM_TRIES = 10;
|
|
1129
1127
|
|
|
1130
1128
|
// `claude -w` lets a collision become a hard error; we reroll instead. The
|
|
1131
1129
|
// check has to happen before the name is shown, so the confirmation prompt can
|
|
1132
1130
|
// never offer something that cannot be created (I24). Ten failures in a
|
|
1133
|
-
//
|
|
1131
|
+
// 6,828,770-name space means our randomness is broken, not the user's luck.
|
|
1134
1132
|
//
|
|
1135
1133
|
// The branch check alone is enough, and a `worktreePath()` call beside it would
|
|
1136
1134
|
// be unreachable: `git worktree list --porcelain` only prints `branch
|