@timekast/factory 1.7.1 → 1.8.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/dist/commands/new.js +19 -3
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/commands/new.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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).
|
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
|
|
@@ -97,7 +101,7 @@ async function main(argv) {
|
|
|
97
101
|
if (!name) {
|
|
98
102
|
throw new CLIError('Falta el nombre del proyecto. Uso: `factory new <Nombre>`.');
|
|
99
103
|
}
|
|
100
|
-
await runNew(name);
|
|
104
|
+
await runNew(name, parseNewFlags(rest));
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
case 'add': {
|