@timekast/factory 1.7.1 → 1.9.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.
@@ -90,6 +90,9 @@ export async function runAdd(flags = { core: false, full: false }) {
90
90
  // A legacy `add` redirect is never a beta channel operation.
91
91
  beta: false,
92
92
  stable: false,
93
+ // `add` is interactive: keep the legacy confirm prompt. Only the GUI/headless
94
+ // caller passes `--yes` (via `update` directly), never this redirect.
95
+ yes: false,
93
96
  });
94
97
  return;
95
98
  }
@@ -52,9 +52,20 @@ async function createRepo(name) {
52
52
  throw new CLIError(`No se pudo crear el repo \`${FACTORY_ORG}/${name}\` en GitHub.${detail}`);
53
53
  }
54
54
  }
55
- export async function runNew(name) {
55
+ /**
56
+ * Parse `new`'s argv slice into flags. Lets a GUI launcher / headless caller run
57
+ * non-interactively (`new <Name> --full`); without a flag, `new` still prompts.
58
+ */
59
+ export function parseNewFlags(argv) {
60
+ return { core: argv.includes('--core'), full: argv.includes('--full') };
61
+ }
62
+ export async function runNew(name, flags = { core: false, full: false }) {
56
63
  // 1. Validate offline, before any network call.
57
64
  const validName = validateProjectName(name);
65
+ // Reject contradictory profile flags before any network call (mirrors `add`).
66
+ if (flags.core && flags.full) {
67
+ throw new CLIError('No puedes combinar `--core` con `--full`.');
68
+ }
58
69
  // 2. Refuse to run inside an existing repo (before any destructive action).
59
70
  const cwd = process.cwd();
60
71
  if (existsSync(path.join(cwd, '.git'))) {
@@ -68,8 +79,13 @@ export async function runNew(name) {
68
79
  }
69
80
  // 4. Preflight: gh installed + authed + org member.
70
81
  await runPreflight();
71
- // 5. Choose profile.
72
- const profile = await promptProfile();
82
+ // 5. Choose profile. A `--full`/`--core` flag skips the prompt (lets a GUI or
83
+ // headless caller run non-interactively); absent → interactive select.
84
+ const profile = flags.full
85
+ ? PROFILES.full
86
+ : flags.core
87
+ ? PROFILES.core
88
+ : await promptProfile();
73
89
  // 6. Network: create the repo.
74
90
  await createRepo(validName);
75
91
  // 7. Download + unpack into a temp dir, validate, then move into place (M2).
@@ -62,6 +62,7 @@ export function parseUpdateFlags(argv) {
62
62
  noCommit: argv.includes('--no-commit'),
63
63
  beta: argv.includes('--beta'),
64
64
  stable: argv.includes('--stable'),
65
+ yes: argv.includes('--yes') || argv.includes('-y'),
65
66
  };
66
67
  }
67
68
  /** Default acquire: download the sticky-profile tarball, stage + validate it. */
@@ -454,7 +455,7 @@ export async function runUpdate(flags, deps = {}) {
454
455
  if (legacy) {
455
456
  profile = flags.full ? PROFILES.full : flags.core ? PROFILES.core : detectProfile(rootDir);
456
457
  oldLock = { version: '0.0.0', profile, files: [] };
457
- await confirmLegacy(profile);
458
+ await confirmLegacy(profile, flags.yes);
458
459
  }
459
460
  else {
460
461
  oldLock = readLockfile(rootDir);
@@ -576,7 +577,12 @@ async function guardChannelChange(oldLock, flags) {
576
577
  }
577
578
  }
578
579
  /** Warn the dev before a legacy auto-register sync (design §8 edge case). */
579
- async function confirmLegacy(profile) {
580
+ async function confirmLegacy(profile, assumeYes) {
581
+ // `--yes` (GUI launcher / headless): skip the interactive confirm. The caller
582
+ // already surfaced the overwrite warning (the app shows it as a native dialog).
583
+ // An interactive terminal run without `--yes` still gets the prompt below.
584
+ if (assumeYes)
585
+ return;
580
586
  const detected = profile === PROFILES.full
581
587
  ? 'Detectado como derivado del Factory (`factoryVersion` en package.json) → perfil `full` ' +
582
588
  '(incluye sk-* + SK.md). Usa `--core` si quieres solo el cerebro base.'
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { fileURLToPath } from 'node:url';
12
12
  import { CLIError } from './lib/cli-error.js';
13
13
  import { parseAddFlags, runAdd } from './commands/add.js';
14
14
  import { runDoctor } from './commands/doctor.js';
15
- import { runNew } from './commands/new.js';
15
+ import { parseNewFlags, runNew } from './commands/new.js';
16
16
  import { parsePublishArgs, runPublish } from './commands/publish.js';
17
17
  import { runStatus } from './commands/status.js';
18
18
  import { parseUnpublishTargets, runUnpublish } from './commands/unpublish.js';
@@ -33,6 +33,10 @@ Comandos:
33
33
  publish <qué> Publica el entregable (proposal|mockup|both) a proposals.timekast.mx
34
34
  unpublish [qué] Baja del hub un entregable publicado (proposal|mockup|both; default both)
35
35
 
36
+ Sobre \`new\`:
37
+ Pregunta el perfil de forma interactiva. Los flags \`--full\` / \`--core\` lo
38
+ fijan sin preguntar (útil para un lanzador GUI o uso headless).
39
+
36
40
  Sobre \`add\`:
37
41
  Requiere estar dentro de un repo git (al menos \`git init\`). Por default instala
38
42
  el cerebro \`full\` (incluye sk-* + SK.md) si el repo es un derivado del Factory
@@ -55,6 +59,8 @@ Sobre \`update\`:
55
59
  --verify Reporta diferencias disco-vs-lockfile sin modificar nada
56
60
  --beta Entra al canal beta (instala el último pre-release \`-beta.N\`)
57
61
  --stable Sale del canal beta y baja al estable (limpia \`beta\` del lockfile)
62
+ --yes / -y Auto-confirma el auto-registro de un repo legacy (sin lockfile) —
63
+ para lanzadores GUI / headless; en terminal interactiva sigue preguntando
58
64
  Un \`update\` sin \`--beta\` sobre un lockfile beta pide confirmación (y en headless
59
65
  rechaza, sin degradar en silencio).
60
66
 
@@ -97,7 +103,7 @@ async function main(argv) {
97
103
  if (!name) {
98
104
  throw new CLIError('Falta el nombre del proyecto. Uso: `factory new <Nombre>`.');
99
105
  }
100
- await runNew(name);
106
+ await runNew(name, parseNewFlags(rest));
101
107
  return;
102
108
  }
103
109
  case 'add': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timekast/factory",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "Public, thin CLI to bootstrap and maintain TimeKast Factory derived projects.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",