termi-kids 0.2.1 → 0.2.2

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.
@@ -54,7 +54,7 @@ async function pickProjectName(idea) {
54
54
  const suggested = defaultNameForIdea(idea);
55
55
  const typed = await p.text({
56
56
  message: 'Name your game.',
57
- placeholder: suggested,
57
+ initialValue: suggested,
58
58
  defaultValue: suggested,
59
59
  validate: (value) => {
60
60
  const trimmed = (value ?? '').trim() || suggested;
@@ -112,16 +112,24 @@ async function obtainPrompt(idea) {
112
112
  draft = suggestPromptFromAnswers(idea, answers);
113
113
  p.note(draft, 'Suggested prompt');
114
114
  }
115
+ // clack: initialValue pre-fills the field; defaultValue is only applied
116
+ // AFTER validate. Empty Enter with only defaultValue fails validate, so
117
+ // we pre-fill and also accept empty when a draft already exists.
115
118
  const text = await p.text({
116
119
  message: path === 'write' ? 'Type your prompt.' : 'Edit the prompt, or press Enter to run it.',
117
- defaultValue: draft,
118
- placeholder: draft || 'Make a fun browser game where...',
119
- validate: (value) => (value ?? '').trim().length > 0 ? undefined : 'Need a prompt to build.',
120
+ initialValue: draft.length > 0 ? draft : undefined,
121
+ defaultValue: draft.length > 0 ? draft : undefined,
122
+ placeholder: draft.length > 0 ? undefined : 'Make a fun browser game where...',
123
+ validate: (value) => {
124
+ const resolved = (value ?? '').trim() || draft.trim();
125
+ return resolved.length > 0 ? undefined : 'Need a prompt to build.';
126
+ },
120
127
  });
121
128
  if (p.isCancel(text)) {
122
129
  return null;
123
130
  }
124
- return text.trim();
131
+ const resolved = text.trim() || draft.trim();
132
+ return resolved.length > 0 ? resolved : null;
125
133
  }
126
134
  function listKidFileSummaries(project) {
127
135
  const out = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termi-kids",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Termi is a friendly coding buddy for kids. Build browser games with AI prompts, Learn AI lessons, and strong local safety rails.",
5
5
  "keywords": [
6
6
  "kids",