@contrail/cli 3.6.0-alpha-8-alpha.302405c → 3.6.0-alpha-8-alpha.ec2a2fe

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
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/3.6.0-alpha-8-alpha.302405c linux-x64 node-v24.22.2
20
+ @contrail/cli/3.6.0-alpha-8-alpha.ec2a2fe linux-x64 node-v24.22.2
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -676,11 +676,11 @@ EXAMPLES
676
676
 
677
677
  $ contrail entities get color -- id=123
678
678
 
679
- $ contrail entities get loader-process -- createdOn=2025-09-15..2025-09-16
679
+ $ contrail entities get loader-process -- createdOn=2026-09-01..2026-09-11
680
680
 
681
- $ contrail entities get item -- updatedOn=2025-09-15T04:00:00Z..
681
+ $ contrail entities get loader-process -- createdOn=2026-09-05..
682
682
 
683
- $ contrail entities get color -- createdOn=..2025-09-16T23:59:59Z
683
+ $ contrail entities get loader-process -- createdOn=..2026-09-05
684
684
  ```
685
685
 
686
686
  ## `contrail entities update ENTITYNAME [IDS]`
@@ -59,6 +59,10 @@ class DeleteEntity extends basecommand_1.BaseCommand {
59
59
  await (0, login_1.authUser)();
60
60
  const { args, flags, argv } = await this.parse(DeleteEntity);
61
61
  const { entityName } = args;
62
+ const idParsedAsFlag = (0, common_1.findIdParsedAsFlag)(process.argv);
63
+ if (idParsedAsFlag) {
64
+ this.error(`${idParsedAsFlag} starts with a hyphen, so it is read as flags rather than an id. Pass it after -- instead, or use an input file (-i).`);
65
+ }
62
66
  const { inputFile: inputFilename, suffix, apiVersion } = flags;
63
67
  if (flags.dryRun) {
64
68
  IS_DRY_RUN = true;
@@ -80,11 +84,13 @@ class DeleteEntity extends basecommand_1.BaseCommand {
80
84
  this.error('You must provide one or more ids or an input file (-i) of entities to delete.');
81
85
  }
82
86
  const jsonInput = inputFilename ? (0, file_helpers_1.parseFileAsJsonArray)(inputFilename) : undefined;
83
- const rowsWithId = jsonInput?.filter((item) => item.id);
84
- if (jsonInput && rowsWithId.length < jsonInput.length) {
85
- console.error(`${jsonInput.length - rowsWithId.length} row(s) without an id were skipped.`);
87
+ // the file may hold bare ids or {id, ...} rows; delete only ever needs the id
88
+ const idsFromFile = jsonInput?.map((row) => (typeof row === 'string' ? row : row?.id));
89
+ const idsFromFileWithValue = idsFromFile?.filter(Boolean);
90
+ if (jsonInput && idsFromFileWithValue.length < jsonInput.length) {
91
+ console.error(`${jsonInput.length - idsFromFileWithValue.length} row(s) without an id were skipped.`);
86
92
  }
87
- const ids = rowsWithId ? rowsWithId.map((item) => item.id) : positionalIds;
93
+ const ids = idsFromFileWithValue ?? positionalIds;
88
94
  try {
89
95
  const response = await deleteEntityByIds(entityName, ids, {
90
96
  suffix,
@@ -21,9 +21,9 @@ class GetEntity extends basecommand_1.BaseCommand {
21
21
  'contrail entities get color 123',
22
22
  'contrail entities get color id1 id2 id3',
23
23
  'contrail entities get color -- id=123',
24
- 'contrail entities get loader-process -- createdOn=2025-09-15..2025-09-16',
25
- 'contrail entities get item -- updatedOn=2025-09-15T04:00:00Z..',
26
- 'contrail entities get color -- createdOn=..2025-09-16T23:59:59Z',
24
+ 'contrail entities get loader-process -- createdOn=2026-09-01..2026-09-11',
25
+ 'contrail entities get loader-process -- createdOn=2026-09-05..',
26
+ 'contrail entities get loader-process -- createdOn=..2026-09-05',
27
27
  ];
28
28
  static flags = {
29
29
  ...basecommand_1.BaseCommand.baseFlags,
@@ -94,6 +94,10 @@ class GetEntity extends basecommand_1.BaseCommand {
94
94
  await (0, login_1.authUser)();
95
95
  const { args, flags, argv } = await this.parse(GetEntity);
96
96
  const { entityName } = args;
97
+ const idParsedAsFlag = (0, common_1.findIdParsedAsFlag)(process.argv);
98
+ if (idParsedAsFlag) {
99
+ this.error(`${idParsedAsFlag} starts with a hyphen, so it is read as flags rather than an id. Pass it after -- instead, or use an input file (-i).`);
100
+ }
97
101
  if (entityName.includes(':')) {
98
102
  this.error(`get takes an entity name, not a type path. Use: contrail entities get ${entityName.split(':')[0]} [ID...]`);
99
103
  }
@@ -67,6 +67,10 @@ class UpdateEntity extends basecommand_1.BaseCommand {
67
67
  await (0, login_1.authUser)();
68
68
  const { args, argv } = await this.parse(UpdateEntity);
69
69
  const { entityName } = args;
70
+ const idParsedAsFlag = (0, common_1.findIdParsedAsFlag)(process.argv);
71
+ if (idParsedAsFlag) {
72
+ this.error(`${idParsedAsFlag} starts with a hyphen, so it is read as flags rather than an id. Pass it after -- instead, or use an input file (-i).`);
73
+ }
70
74
  const { dryRun: isDryRun, inputFile: inputFilename, skipHydrateRelationships, suffix, apiVersion, } = this.flags;
71
75
  if (entityName.includes(':')) {
72
76
  this.error(`update takes an entity name, not a type path. Use: contrail entities update ${entityName.split(':')[0]} <ID...>`);
@@ -74,7 +78,7 @@ class UpdateEntity extends basecommand_1.BaseCommand {
74
78
  const { ids: positionalIds, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(argv.slice(1));
75
79
  const propertySpec = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)(specs);
76
80
  if (propertySpec.has('id') || propertySpec.has('ids')) {
77
- this.error('The -- payload is values to write. Pass ids positionally: contrail entities update <typePath> <ID...> -- slug=value');
81
+ this.error('The -- payload is values to write. Pass ids positionally: contrail entities update <entityName> <ID...> -- slug=value');
78
82
  }
79
83
  if (inputFilename && positionalIds.length > 0) {
80
84
  this.error('You cannot use --inputFile and positional ids together. Please specify one or the other.');
package/dist/common.d.ts CHANGED
@@ -5,3 +5,9 @@ export declare function removeSlash(string: string): string;
5
5
  export declare function routeConsoleLogToStderr(): void;
6
6
  export declare function sdkErrorMessage(reason: any): string;
7
7
  export declare const promptOnStderr: any;
8
+ /**
9
+ * An id beginning with a hyphen is consumed as flags before a command sees it,
10
+ * which can silently switch on a boolean flag and shift the remaining arguments.
11
+ * Platform ids are long enough to tell apart from a cluster of short flags.
12
+ */
13
+ export declare function findIdParsedAsFlag(argv: string[]): string | undefined;
package/dist/common.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptOnStderr = exports.sdkErrorMessage = exports.routeConsoleLogToStderr = exports.removeSlash = exports.delay = exports.getSeparatorByPlatform = void 0;
3
+ exports.findIdParsedAsFlag = exports.promptOnStderr = exports.sdkErrorMessage = exports.routeConsoleLogToStderr = exports.removeSlash = exports.delay = exports.getSeparatorByPlatform = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
6
6
  function getSeparatorByPlatform() {
@@ -33,3 +33,14 @@ exports.sdkErrorMessage = sdkErrorMessage;
33
33
  // inquirer renders prompt UI to its output stream directly, bypassing the
34
34
  // console.log redirect; stdout must stay data-only
35
35
  exports.promptOnStderr = inquirer_1.default.createPromptModule({ output: process.stderr });
36
+ /**
37
+ * An id beginning with a hyphen is consumed as flags before a command sees it,
38
+ * which can silently switch on a boolean flag and shift the remaining arguments.
39
+ * Platform ids are long enough to tell apart from a cluster of short flags.
40
+ */
41
+ function findIdParsedAsFlag(argv) {
42
+ const separator = argv.indexOf('--');
43
+ const beforeSeparator = separator === -1 ? argv : argv.slice(0, separator);
44
+ return beforeSeparator.find((token) => /^-[A-Za-z0-9_-]{8,}$/.test(token));
45
+ }
46
+ exports.findIdParsedAsFlag = findIdParsedAsFlag;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.302405c",
2
+ "version": "3.6.0-alpha-8-alpha.ec2a2fe",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -903,9 +903,9 @@
903
903
  "contrail entities get color 123",
904
904
  "contrail entities get color id1 id2 id3",
905
905
  "contrail entities get color -- id=123",
906
- "contrail entities get loader-process -- createdOn=2025-09-15..2025-09-16",
907
- "contrail entities get item -- updatedOn=2025-09-15T04:00:00Z..",
908
- "contrail entities get color -- createdOn=..2025-09-16T23:59:59Z"
906
+ "contrail entities get loader-process -- createdOn=2026-09-01..2026-09-11",
907
+ "contrail entities get loader-process -- createdOn=2026-09-05..",
908
+ "contrail entities get loader-process -- createdOn=..2026-09-05"
909
909
  ],
910
910
  "flags": {
911
911
  "logLevel": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.6.0-alpha-8-alpha.302405c",
3
+ "version": "3.6.0-alpha-8-alpha.ec2a2fe",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",