@tdk-landscape/tdk-cli-core 1.3.113 → 1.3.115

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.
@@ -168,7 +168,7 @@ export const networksCommand = new Command("networks")
168
168
  const action = async () => {
169
169
  const projectRoot = options.json || options.jsonLegacy ? findProjectRoot() : requireProjectRoot();
170
170
  if (!projectRoot) {
171
- throw new Error("Could not find project root (no .tdk/project.json found)");
171
+ throw errorFactories.notInProject();
172
172
  }
173
173
  const discovery = createDiscoveryContext();
174
174
  if (options.stack && !stackExists(options.stack, discovery.resources)) {
@@ -20,7 +20,7 @@ export const resourcesCommand = new Command("resources")
20
20
  const action = async () => {
21
21
  if (options.json) {
22
22
  if (!findProjectRoot()) {
23
- writeMachineError(new Error("Could not find project root (no .tdk/project.json found)"));
23
+ writeMachineError(errorFactories.notInProject());
24
24
  }
25
25
  }
26
26
  else {
@@ -1,7 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import { Command } from "commander";
3
3
  import { createDiscoveryContext } from "../utils/discovery-context.js";
4
- import { runCommand } from "../utils/errors.js";
4
+ import { errorFactories, runCommand } from "../utils/errors.js";
5
5
  import { formatCount, showDetail, showEmptyState, showStep } from "../utils/formatting.js";
6
6
  import { createMachineEnvelope, writeMachineError } from "../utils/machine-output.js";
7
7
  import { findProjectRoot } from "../utils/paths.js";
@@ -14,7 +14,7 @@ export const stacksCommand = new Command("stacks")
14
14
  .action(async (options) => {
15
15
  const action = async () => {
16
16
  if (options.json && !findProjectRoot()) {
17
- writeMachineError(new Error("Could not find project root (no .tdk/project.json found)"));
17
+ writeMachineError(errorFactories.notInProject());
18
18
  }
19
19
  const discovery = createDiscoveryContext();
20
20
  const verbose = options.verbose || stacksCommand.parent?.opts().verbose === true;
@@ -87,6 +87,7 @@ export const statusCommand = new Command("status")
87
87
  resources: tiltResources,
88
88
  readiness,
89
89
  },
90
+ resourceCount: discovery.resources.length,
90
91
  resources: discovery.resources.map((resource) => ({
91
92
  name: resource.name,
92
93
  stack: resource.stack ?? null,
@@ -98,7 +99,9 @@ export const statusCommand = new Command("status")
98
99
  stacks: discovery.stacks.map((stack) => ({
99
100
  name: stack.name,
100
101
  resourceCount: stack.resourceCount,
102
+ resources: stack.resources.map((resource) => resource.name),
101
103
  })),
104
+ unassignedResources: discovery.unassignedResources.map((resource) => resource.name),
102
105
  };
103
106
  console.log(JSON.stringify(createMachineEnvelope(data, errors)));
104
107
  if (errors.length > 0) {
@@ -144,7 +147,7 @@ export const statusCommand = new Command("status")
144
147
  }
145
148
  }
146
149
  console.log();
147
- showDetail('Run "tdk list-stacks" to see all stacks.');
150
+ showDetail('Run "tdk stacks" to see all stacks.');
148
151
  showDetail('Run "tdk up <stack-name>" to start a stack.');
149
152
  };
150
153
  if (options.json) {
@@ -71,9 +71,7 @@ export const errorFactories = {
71
71
  export function requireProjectRoot() {
72
72
  const projectRoot = findProjectRoot();
73
73
  if (!projectRoot) {
74
- console.error(chalk.red("Error: Could not find project root (no .tdk/project.json found)."));
75
- console.error(chalk.gray("Run `tdk project --yes` to initialize a new project."));
76
- process.exit(1);
74
+ return errorFactories.notInProject().exit();
77
75
  }
78
76
  return projectRoot;
79
77
  }
@@ -2,6 +2,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { Cache, createCacheValidator } from "./cache.js";
4
4
  import { AUTOGENERATED_FILE_PATTERNS, SKIP_DIRECTORIES } from "./constants.js";
5
+ import { errorFactories } from "./errors.js";
5
6
  import { formatCount } from "./formatting.js";
6
7
  import { findProjectRoot } from "./paths.js";
7
8
  import { validateServiceManifest } from "./service-manifest.js";
@@ -133,14 +134,14 @@ export function discoverResourcesFromRoot(projectRoot) {
133
134
  export function discoverResources() {
134
135
  const projectRoot = findProjectRoot();
135
136
  if (!projectRoot) {
136
- throw new Error("Could not find project root (no .tdk/project.json found). Run `tdk project --yes` first.");
137
+ throw errorFactories.notInProject();
137
138
  }
138
139
  return discoverResourcesFromRoot(projectRoot);
139
140
  }
140
141
  export function discoverResourcesStrict() {
141
142
  const projectRoot = findProjectRoot();
142
143
  if (!projectRoot) {
143
- throw new Error("Could not find project root (no .tdk/project.json found). Run `tdk project --yes` first.");
144
+ throw errorFactories.notInProject();
144
145
  }
145
146
  const { resources, problems } = discoverResourcesWithProblems(projectRoot);
146
147
  if (problems.length > 0) {
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.113",
4
+ "version": "1.3.115",
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.113",
3
+ "version": "1.3.115",
4
4
  "description": "TDK CLI — start services on your laptop.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {