@tdk-landscape/tdk-cli-core 1.3.101 → 1.3.103

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # TDK CLI — start services on your laptop
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@tdk-landscape/tdk-cli-core.svg?style=flat&color=blue)](https://www.npmjs.com/package/@tdk-landscape/tdk-cli-core)
4
+ [![unpacked size](https://img.shields.io/npm/unpacked-size/@tdk-landscape/tdk-cli-core)](https://packagephobia.com/result?p=@tdk-landscape/tdk-cli-core)
5
+ [![install size](https://packagephobia.com/badge?p=@tdk-landscape/tdk-cli-core@1.3.81)](https://packagephobia.com/result?p=@tdk-landscape/tdk-cli-core@1.3.81)
6
+ [![CI](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml)
7
+ [![Quickstart E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml)
8
+ [![ERP fixture scale E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml)
9
+ [![Example apps E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml/badge.svg?branch=main)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml)
10
+ [![Known Vulnerabilities](https://snyk.io/test/github/tdk-landscape/tdk-cli-core/badge.svg)](https://snyk.io/test/github/tdk-landscape/tdk-cli-core)
11
+ [![Socket Badge](https://badge.socket.dev/npm/package/@tdk-landscape/tdk-cli-core/latest)](https://socket.dev/npm/package/@tdk-landscape/tdk-cli-core/overview)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
+
3
14
  English | [简体中文](README-zh_cn.md) | [繁體中文](README-zh_tw.md) | [日本語](README-ja.md) | [한국어](README-ko.md)
4
15
 
5
16
  TDK CLI starts your services on your laptop. It is not a deploy and not a Compose file: define each service in `service.json`, then run `tdk up`. No Kubernetes is needed on the machine.
@@ -34,15 +45,6 @@ If Helm, Compose, or your existing Tilt setup already gives you a working local
34
45
 
35
46
  See [how TDK CLI works alongside Helm](https://tdk-landscape.github.io/tdk-website/docs/with-helm/), the [service schema](engine/schemas/service-schema.json), and the [project configuration schema](engine/schemas/project-schema.json).
36
47
 
37
- [![npm version](https://img.shields.io/npm/v/@tdk-landscape/tdk-cli-core.svg?style=flat&color=blue)](https://www.npmjs.com/package/@tdk-landscape/tdk-cli-core)
38
- [![CI](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml)
39
- [![Quickstart E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml)
40
- [![ERP fixture scale E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml/badge.svg)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml)
41
- [![Example apps E2E](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml/badge.svg?branch=main)](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml)
42
- [![Known Vulnerabilities](https://snyk.io/test/github/tdk-landscape/tdk-cli-core/badge.svg)](https://snyk.io/test/github/tdk-landscape/tdk-cli-core)
43
- [![Socket Badge](https://badge.socket.dev/npm/package/@tdk-landscape/tdk-cli-core/latest)](https://socket.dev/npm/package/@tdk-landscape/tdk-cli-core/overview)
44
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
45
-
46
48
  ## Installation
47
49
 
48
50
  Install the CLI from npm (requires Node.js 22.12+) or use the prebuilt binary (no Node.js or Bun required):
package/Tiltfile CHANGED
@@ -35,6 +35,7 @@ load('./engine/topologies/tilt/resources/conditions.star', _Database='Database')
35
35
  load('./engine/topologies/tilt/resources/declaration.star', _Orchestrator='Orchestrator')
36
36
  load('./engine/topologies/tilt/resources/ordering.star', _Infra='Infra')
37
37
  load('./engine/topologies/tilt/resources/triggers.star', _Watchers='Watchers')
38
+ load('./engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star', _resource_defers_start='resource_defers_start')
38
39
 
39
40
  # =============================================================================
40
41
  # SPECS (Tech stack and standards)
@@ -128,6 +129,10 @@ Orchestrator = _Orchestrator
128
129
  Infra = _Infra
129
130
  Watchers = _Watchers
130
131
 
132
+ # True when a manifest's deferStart is actually active (licensed); decides whether a `<name>-image` prebuild resource exists.
133
+ # The generated Tiltfile loads this from ext://tdk-cli, which resolves to this root Tiltfile.
134
+ resource_defers_start = _resource_defers_start
135
+
131
136
  # Specs
132
137
  assert_tech_stack = _assert_tech_stack
133
138
  TECH_STACK = _TECH_STACK
package/cli/dist/cli.js CHANGED
@@ -8,6 +8,7 @@ import { doctorCommand } from "./commands/doctor.js";
8
8
  import { downCommand } from "./commands/down.js";
9
9
  import { ejectCommand } from "./commands/eject.js";
10
10
  import { showHelp } from "./commands/help.js";
11
+ import { importCommand } from "./commands/import.js";
11
12
  import { maintainersCommand } from "./commands/maintainers.js";
12
13
  import { networksCommand } from "./commands/networks.js";
13
14
  import { projectCommand } from "./commands/project.js";
@@ -46,6 +47,7 @@ program.addCommand(projectsCommand);
46
47
  program.addCommand(upCommand);
47
48
  program.addCommand(downCommand);
48
49
  program.addCommand(ejectCommand);
50
+ program.addCommand(importCommand);
49
51
  program.addCommand(statusCommand);
50
52
  program.addCommand(stackCommand);
51
53
  program.addCommand(resourceCommand);
@@ -0,0 +1,39 @@
1
+ import { spawn } from "node:child_process";
2
+ import { Command } from "commander";
3
+ /**
4
+ * The importer lives in its own repo so detectors can ship without a CLI release. Until it is
5
+ * published to npm it is run from git; `TDK_IMPORT_PACKAGE` overrides the package spec.
6
+ */
7
+ export const IMPORT_PACKAGE = "github:tdk-landscape/tdk-import";
8
+ export function importInvocation(args, env = process.env, platform = process.platform) {
9
+ const pkg = env.TDK_IMPORT_PACKAGE || IMPORT_PACKAGE;
10
+ return {
11
+ command: platform === "win32" ? "npx.cmd" : "npx",
12
+ args: ["--yes", pkg, ...args],
13
+ shell: platform === "win32",
14
+ };
15
+ }
16
+ /** Runs tdk-import with the caller's terminal and resolves to its exit code. */
17
+ export function runImport(args, spawnFn = spawn) {
18
+ const invocation = importInvocation(args);
19
+ return new Promise((resolve) => {
20
+ const child = spawnFn(invocation.command, invocation.args, {
21
+ stdio: "inherit",
22
+ shell: invocation.shell,
23
+ });
24
+ child.on("error", (err) => {
25
+ console.error(`tdk import: could not run npx (${err.message}). Install Node.js/npm and retry.`);
26
+ resolve(127);
27
+ });
28
+ child.on("close", (code) => resolve(code ?? 1));
29
+ });
30
+ }
31
+ export const importCommand = new Command("import")
32
+ .description("Import the services a directory describes (runs tdk-import)")
33
+ .argument("[args...]", "Passed to tdk-import: [dir] --dry-run --yes --force --only <ids>")
34
+ .allowUnknownOption()
35
+ .helpOption(false)
36
+ .action(async (args) => {
37
+ process.exitCode = await runImport(args);
38
+ });
39
+ //# sourceMappingURL=import.js.map
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.101",
4
+ "version": "1.3.103",
5
5
  "description": "TDK CLI — start services on your laptop.",
6
6
  "keywords": [
7
7
  "tdk",
@@ -89,6 +89,7 @@ load('ext://tdk-cli',
89
89
  'APP_RESOURCES',
90
90
  'GLOBAL_CONFIG_EXPORT',
91
91
  'Registry',
92
+ 'resource_defers_start',
92
93
  )
93
94
 
94
95
  # =============================================================================
@@ -265,7 +266,9 @@ for _KNOWN_SVC in _app_resources_list:
265
266
  _KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME + '-config-gen')
266
267
  _KNOWN_RES_MANIFEST = _KNOWN_RES.get('_manifest', {})
267
268
  _KNOWN_RES_SABLIER = _KNOWN_RES_MANIFEST.get('sablier', {})
268
- if _KNOWN_RES_SABLIER.get('enable', False) and _KNOWN_RES_SABLIER.get('deferStart', False):
269
+ # Mirrors _register_single_resource: the prebuild only exists for
270
+ # a resource that gets a docker_build (has syncs, not a library/sdk/BYO).
271
+ if resource_defers_start(_KNOWN_RES_MANIFEST) and _KNOWN_RES_MANIFEST.get('appType', 'backend') not in ['library', 'sdk', 'bring-your-own'] and _KNOWN_RES_MANIFEST.get('syncs'):
269
272
  _DEFERRED_IMAGE_RESOURCES.add(_KNOWN_RES_NAME + '-image')
270
273
  if _KNOWN_SVC_STACK:
271
274
  _STACK_TO_RESOURCE_NAMES.setdefault(_KNOWN_SVC_STACK, [])
@@ -291,7 +294,11 @@ if FOCUS_MODE and FOCUS_ENABLED_RESOURCES:
291
294
  # local_resource because their dc_resource is not auto-init.
292
295
  # Keep that prebuild in focus mode so `tdk up <stack>` still
293
296
  # prepares the image before the first request wakes the service.
294
- _FILTERED_RESOURCES.append(_STACK_RES_NAME + '-image')
297
+ # Only when it exists: without a license deferStart is off and
298
+ # no `-image` resource is registered, and Tilt errors on an
299
+ # enabled name it cannot find.
300
+ if _STACK_RES_NAME + '-image' in _DEFERRED_IMAGE_RESOURCES:
301
+ _FILTERED_RESOURCES.append(_STACK_RES_NAME + '-image')
295
302
  else:
296
303
  _MATCHED = [kr for kr in _KNOWN_TILT_RESOURCES if kr != 'service-discovery-daemon' and kr.startswith(_R + '-')]
297
304
  _FILTERED_RESOURCES.extend(_MATCHED)
package/engine/Tiltfile CHANGED
@@ -39,6 +39,7 @@ load('./topologies/tilt/resources/conditions.star', _Database='Database')
39
39
  load('./topologies/tilt/resources/declaration.star', _Orchestrator='Orchestrator')
40
40
  load('./topologies/tilt/resources/ordering.star', _Infra='Infra')
41
41
  load('./topologies/tilt/resources/triggers.star', _Watchers='Watchers')
42
+ load('./topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star', _resource_defers_start='resource_defers_start')
42
43
 
43
44
  # =============================================================================
44
45
  # RE-EXPORTS
@@ -77,4 +78,7 @@ Orchestrator = _Orchestrator
77
78
  Infra = _Infra
78
79
  Watchers = _Watchers
79
80
 
81
+ # True when a manifest's deferStart is actually active (licensed); decides whether a `<name>-image` prebuild resource exists.
82
+ resource_defers_start = _resource_defers_start
83
+
80
84
  print("✅ TDK Engine loaded: orchestration, resources, and lifecycle")
@@ -36,6 +36,7 @@ load("./topologies/tilt/resources/conditions.star", _Database = "Database")
36
36
  load("./topologies/tilt/resources/declaration.star", _Orchestrator = "Orchestrator")
37
37
  load("./topologies/tilt/resources/ordering.star", _Infra = "Infra")
38
38
  load("./topologies/tilt/resources/triggers.star", _Watchers = "Watchers")
39
+ load("./topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star", _resource_defers_start = "resource_defers_start")
39
40
 
40
41
  Utils = _Utils
41
42
  Manifest = _Manifest
@@ -65,6 +66,7 @@ Database = _Database
65
66
  Orchestrator = _Orchestrator
66
67
  Infra = _Infra
67
68
  Watchers = _Watchers
69
+ resource_defers_start = _resource_defers_start
68
70
 
69
71
  # =============================================================================
70
72
  # 🔮 AUTO-DISCOVERY DAEMON
@@ -290,6 +290,11 @@ def _wake_compose_invocation(project_root, resource_path, res_name, resource_nam
290
290
  }
291
291
 
292
292
 
293
+ def _image_target(config):
294
+ """The Dockerfile target Tilt builds and the deferStart prebuild must match: `development` for Go with `dev.liveReload`."""
295
+ return 'development' if Docker.go_live_reload(config.get('manifest', {})) else 'production'
296
+
297
+
293
298
  def _register_docker_build(config, live_update_rules):
294
299
  """Register docker_build with live_update for hot-reload support."""
295
300
  TypescriptBuilders.build_typescript_service(
@@ -298,7 +303,7 @@ def _register_docker_build(config, live_update_rules):
298
303
  _resolve_dockerfile(config),
299
304
  live_update_rules,
300
305
  config['res_deps'],
301
- target = 'development' if Docker.go_live_reload(config.get('manifest', {})) else 'production',
306
+ target = _image_target(config),
302
307
  )
303
308
 
304
309
 
@@ -309,20 +314,23 @@ def _register_deferred_image_prebuild(config, auto_init_apps):
309
314
  live on tdk-erp-system, task 7.2), so a fresh project's first request would
310
315
  find no image and the wake gateway would fall back to `tilt trigger`, which
311
316
  queues behind every other build. This local_resource builds the same image
312
- (same Dockerfile, `production` target, host network, and an allowlist
317
+ (same Dockerfile and target as docker_build: `production`, or `development` for Go with `dev.liveReload`; host network, and an allowlist
313
318
  .dockerignore equivalent to docker_build's only=/ignore=) under the tag the
314
319
  compose service declares, so the gateway can start it directly.
315
320
  """
316
321
  project_root = config.get('project_root', '')
317
322
  dockerfile = _resolve_dockerfile(config)
318
323
  prebuild_dockerfile = dockerfile + '.prebuild'
324
+ # The same target _register_docker_build picks: a Go service with `dev.liveReload` runs the development image (the watcher), so
325
+ # prebuilding `production` under the same tag would start the compiled binary with no reload.
326
+ target = _image_target(config)
319
327
  ignore_content = TypescriptBuilders.prebuild_dockerignore(dockerfile, project_root, config['res_path'])
320
328
  # BuildKit reads `<dockerfile>.dockerignore` for `-f <dockerfile>`; the
321
329
  # original Dockerfile already has a (denylist) one, hence the copy.
322
330
  cmd = (
323
331
  "cp '" + dockerfile + "' '" + prebuild_dockerfile + "'"
324
332
  + " && printf '%s' '" + ignore_content + "' > '" + prebuild_dockerfile + ".dockerignore'"
325
- + " && docker build --network host --target production"
333
+ + " && docker build --network host --target " + target
326
334
  + " -f '" + prebuild_dockerfile + "'"
327
335
  + " -t '" + _app_image_name(config['resource_name'], config['res_name']) + "'"
328
336
  + " '" + (project_root or '.') + "'"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdk-landscape/tdk-cli-core",
3
- "version": "1.3.101",
3
+ "version": "1.3.103",
4
4
  "description": "TDK CLI — start services on your laptop.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {