@tdk-landscape/tdk-cli-core 1.3.111 → 1.3.112

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/CHANGELOG.md CHANGED
@@ -4,6 +4,7 @@ Notable changes to the `tdk` CLI. Versions match [npm](https://www.npmjs.com/pac
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ - `tdk eject` no longer claims files it does not create or prints a command that cannot work. It still writes only `EJECTED.md` (no file is copied, moved or generated; the Tiltfile and engine stay in git-ignored `.tdk/.tdk-out/`, and the per-service Compose files, golden-layer Dockerfile and Traefik file only exist after Tilt has run). `EJECTED.md` no longer lists them under "Keep" and says the Tiltfile still reads `.tdk/project.json` and the `service.json` files. `Next: tilt up` (which finds no Tiltfile at the project root) is replaced by `tilt up -f .tdk/.tdk-out/Tiltfile -- --focus=<stack>`, the form `tdk up` runs. A project that already has an `EJECTED.md` keeps its old text (the file is never overwritten) and is now told so. `--dry-run` headings read `Generated files, left where they are (git-ignored):` and `Files written:`. A command that exports plain Compose files and Dockerfiles does not exist. Fixes #610.
7
8
  - `tdk config regenerate` now restores a root `.tiltignore` that TDK wrote (it carries the `SYSTEM-GENERATED BY TDK CLI` header) and that was edited by hand, and prints `Restored: .tiltignore → project root (hand edits discarded)`. Before, it only copied the file when none existed, so `tdk config verify` kept failing with `Out of sync: .tiltignore (run 'tdk config regenerate')` after the advice was followed. A root `.tiltignore` without the header is still never overwritten, and plain `tdk project --yes` still does not overwrite an existing one. Docs: `docs/adopt-tdk.md` now quotes the current `tdk doctor` unknown-field wording.
8
9
  - `tdk doctor` now checks the project's own resource configs for duplicates. Two resources with the same `appName` fail (`Duplicate resource names`, naming both `service.json` paths): the name becomes the Compose service and Traefik router, so they collide, and before nothing reported it. Two backend, mcp or routed bring-your-own resources on the same `port` give a warning, not a failure (`Duplicate resource ports`): service ports are not published on the host and each service has its own container, so the pair can run, but it is usually a copied `service.json`. Frontends, workers, libraries and a missing `port` are ignored. Fixes #76.
9
10
  - `tdk doctor` no longer fails with `N resources without a package.json` for a bring-your-own resource. A bring-your-own resource (`--image`, `--dockerfile` or `buildContext`) is a plain container: its image is pulled or built from its own Dockerfile, never from the generated Dockerfile that copies a `package.json`, so the check was a false positive that made `tdk doctor` (and CI recipes that gate on it) exit non-zero right after wrapping an existing service. Backend, frontend, worker, migrator, mcp, library and sdk resources without a `package.json` still fail; Python, Go and Rust backends were already exempt. The other doctor checks were run on a project with only bring-your-own resources and report nothing. Fixes #599.
@@ -5,25 +5,44 @@ import { Command } from "commander";
5
5
  import { confirmOrCancel } from "../utils/command-helpers.js";
6
6
  import { runCommand } from "../utils/errors.js";
7
7
  import { findProjectRoot } from "../utils/paths.js";
8
+ // Same location `tdk up` hands to Tilt (see getTiltfilePath in utils/tilt.ts), relative to the project root.
9
+ export const TILTFILE_RELATIVE_PATH = ".tdk/.tdk-out/Tiltfile";
10
+ export const TILT_UP_COMMAND = `tilt up -f ${TILTFILE_RELATIVE_PATH} -- --focus=<stack>`;
8
11
  export const EJECTED_CONTENT = `# Ejected from TDK
9
12
 
10
- These files were generated by TDK. You can keep using Docker and Tilt without the tdk CLI.
13
+ \`tdk eject\` wrote this file and nothing else. It did not copy, move or generate anything, and it did
14
+ not remove TDK. What exists is what TDK had already generated, and that is still TDK-owned output.
11
15
 
12
- Keep:
13
- - Tiltfile
14
- - Dockerfiles
15
- - compose files TDK wrote
16
- - Traefik / proxy config TDK wrote
16
+ ## Where the generated files are
17
17
 
18
- Optional to delete later:
19
- - .tdk/
20
- - service.json files (only if you no longer want tdk up)
18
+ - \`.tdk/.tdk-out/\` holds the Tiltfile and the engine it loads (\`tdk-cli-ext/\`). It is git-ignored.
19
+ \`tdk config regenerate\` rewrites the master files in it.
20
+ - The per-service Compose files (\`services/<stack>/<name>/.autogenerated/\`), the golden-layer
21
+ Dockerfile and the Traefik file (\`.tdk/.tdk-out/\`) are written by Tilt when it runs, not by
22
+ \`tdk eject\`. Until Tilt has run they do not exist. They are git-ignored too.
23
+ - Your own Dockerfiles, \`service.json\` files and source code are untouched.
21
24
 
22
- To go back: install TDK and run \`tdk config regenerate\`.
25
+ ## Running the stack without the tdk CLI
26
+
27
+ There is no Tiltfile at the project root, so a plain \`tilt up\` does not find one. TDK runs:
28
+
29
+ ${TILT_UP_COMMAND}
30
+
31
+ from the project root (\`<stack>\` is a stack name under \`services/\`; without \`--focus\` the Tiltfile
32
+ falls back to its default phase). The Tiltfile still reads \`.tdk/project.json\` and the
33
+ \`service.json\` files, so those must stay. \`tdk up\` also does steps before Tilt starts (it chooses
34
+ host ports and exports them to Tilt); running Tilt by hand skips them.
35
+
36
+ ## Cleaning up
37
+
38
+ Optional to delete later: this file, and \`.tdk/\` plus the \`service.json\` files if you stop using TDK.
39
+ Deleting them also removes what the Tiltfile needs.
40
+
41
+ To go back to TDK: install it and run \`tdk config regenerate\`.
23
42
  `;
24
43
  export const ejectCommand = new Command("eject")
25
- .description("Take ownership of the generated Tilt and Docker files")
26
- .option("--dry-run", "List generated files without changing the project", false)
44
+ .description("Write EJECTED.md describing the generated Tilt files (copies and generates nothing; they stay in .tdk/.tdk-out/)")
45
+ .option("--dry-run", "List the generated files and what would be written, without changing the project", false)
27
46
  .option("--yes", "Skip the confirmation prompt", false)
28
47
  .action(async (options) => {
29
48
  await runCommand(async () => {
@@ -48,15 +67,19 @@ export const ejectCommand = new Command("eject")
48
67
  throw new Error("Generated Tilt files are missing. Run `tdk project --yes` before ejecting.");
49
68
  }
50
69
  const rootTiltfile = join(projectRoot, "Tiltfile");
51
- if (existsSync(rootTiltfile))
52
- files.push("Tiltfile");
70
+ const userTiltfile = existsSync(rootTiltfile) ? ["Tiltfile"] : [];
53
71
  const ejectedPath = join(projectRoot, "EJECTED.md");
54
72
  const willCreate = existsSync(ejectedPath) ? [] : ["EJECTED.md"];
55
73
  if (options.dryRun) {
56
- console.log("Files kept:");
74
+ console.log("Generated files, left where they are (git-ignored):");
57
75
  for (const path of files)
58
76
  console.log(` ${path}`);
59
- console.log("Files created:");
77
+ if (userTiltfile.length > 0) {
78
+ console.log("Root Tiltfile, left where it is (not generated, not git-ignored):");
79
+ for (const path of userTiltfile)
80
+ console.log(` ${path}`);
81
+ }
82
+ console.log("Files written:");
60
83
  for (const path of willCreate)
61
84
  console.log(` ${path}`);
62
85
  if (willCreate.length === 0)
@@ -64,13 +87,19 @@ export const ejectCommand = new Command("eject")
64
87
  return;
65
88
  }
66
89
  if (!options.yes &&
67
- !(await confirmOrCancel("Take ownership of the generated Tilt and Docker files?"))) {
90
+ !(await confirmOrCancel("Write EJECTED.md? (Generated files stay in .tdk/.tdk-out/; nothing is copied or moved.)"))) {
68
91
  return;
69
92
  }
70
- if (!existsSync(ejectedPath))
93
+ if (existsSync(ejectedPath)) {
94
+ console.log(chalk.green("EJECTED.md already exists and was left unchanged. Nothing was copied, moved or generated."));
95
+ }
96
+ else {
71
97
  writeFileSync(ejectedPath, EJECTED_CONTENT, { flag: "wx" });
72
- console.log(chalk.green("Ejected. Tilt and Docker files are yours."));
73
- console.log("Next: tilt up");
98
+ console.log(chalk.green("Wrote EJECTED.md. Nothing was copied, moved or generated."));
99
+ }
100
+ console.log("Generated files stay in .tdk/.tdk-out/ (git-ignored) and still need TDK inputs.");
101
+ console.log(`Run from the project root: ${TILT_UP_COMMAND}`);
102
+ console.log("Replace <stack> with a stack name under services/, or omit --focus to use the Tiltfile's default phase.");
74
103
  console.log("Read EJECTED.md");
75
104
  });
76
105
  });
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tdk-cli-internal",
3
3
  "private": true,
4
- "version": "1.3.111",
4
+ "version": "1.3.112",
5
5
  "description": "TDK CLI — start services on your laptop.",
6
6
  "keywords": [
7
7
  "tdk",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdk-landscape/tdk-cli-core",
3
- "version": "1.3.111",
3
+ "version": "1.3.112",
4
4
  "description": "TDK CLI — start services on your laptop.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {