@camunda8/cli 4.7.0-alpha.3 → 4.7.0-alpha.30

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.
Files changed (118) hide show
  1. package/CONTEXT.md +11 -0
  2. package/PLUGIN-HELP.md +1 -1
  3. package/README.md +9 -1
  4. package/dist/commands/deploy.d.ts.map +1 -1
  5. package/dist/commands/deploy.js +48 -9
  6. package/dist/commands/deploy.js.map +1 -1
  7. package/dist/commands/helpers/deploy-helpers.d.ts +96 -2
  8. package/dist/commands/helpers/deploy-helpers.d.ts.map +1 -1
  9. package/dist/commands/helpers/deploy-helpers.js +213 -70
  10. package/dist/commands/helpers/deploy-helpers.js.map +1 -1
  11. package/dist/commands/mcp-proxy.d.ts.map +1 -1
  12. package/dist/commands/mcp-proxy.js +13 -8
  13. package/dist/commands/mcp-proxy.js.map +1 -1
  14. package/dist/commands/profiles.d.ts.map +1 -1
  15. package/dist/commands/profiles.js +13 -7
  16. package/dist/commands/profiles.js.map +1 -1
  17. package/dist/commands/run.d.ts.map +1 -1
  18. package/dist/commands/run.js +1 -8
  19. package/dist/commands/run.js.map +1 -1
  20. package/dist/commands/watch.d.ts.map +1 -1
  21. package/dist/commands/watch.js +309 -16
  22. package/dist/commands/watch.js.map +1 -1
  23. package/dist/core/client.d.ts +13 -0
  24. package/dist/core/client.d.ts.map +1 -1
  25. package/dist/core/client.js +48 -21
  26. package/dist/core/client.js.map +1 -1
  27. package/dist/core/config.d.ts +34 -3
  28. package/dist/core/config.d.ts.map +1 -1
  29. package/dist/core/config.js +91 -9
  30. package/dist/core/config.js.map +1 -1
  31. package/dist/core/env-address.d.ts +22 -0
  32. package/dist/core/env-address.d.ts.map +1 -0
  33. package/dist/core/env-address.js +30 -0
  34. package/dist/core/env-address.js.map +1 -0
  35. package/dist/core/errors.d.ts +17 -0
  36. package/dist/core/errors.d.ts.map +1 -1
  37. package/dist/core/errors.js +32 -0
  38. package/dist/core/errors.js.map +1 -1
  39. package/dist/core/index.d.ts +2 -0
  40. package/dist/core/index.d.ts.map +1 -1
  41. package/dist/core/index.js +2 -0
  42. package/dist/core/index.js.map +1 -1
  43. package/dist/core/logger.d.ts.map +1 -1
  44. package/dist/core/logger.js +2 -1
  45. package/dist/core/logger.js.map +1 -1
  46. package/dist/core/node-version.d.ts +18 -0
  47. package/dist/core/node-version.d.ts.map +1 -0
  48. package/dist/core/node-version.js +38 -0
  49. package/dist/core/node-version.js.map +1 -0
  50. package/dist/default-plugins/cluster/README.md +1 -1
  51. package/dist/default-plugins/cluster/c8ctl-plugin.js +289 -36
  52. package/dist/default-plugins/element-template/c8ctl-plugin.js +248 -7
  53. package/dist/default-plugins/mcp/README.md +33 -0
  54. package/dist/default-plugins/mcp/c8ctl-plugin.js +4870 -0
  55. package/dist/default-plugins/mcp/package.json +8 -0
  56. package/dist/default-plugins/modeler/README.md +23 -0
  57. package/dist/default-plugins/modeler/c8ctl-plugin.js +4314 -0
  58. package/dist/default-plugins/modeler/package.json +8 -0
  59. package/dist/default-plugins/setup/README.md +43 -0
  60. package/dist/default-plugins/setup/c8ctl-plugin.js +6903 -0
  61. package/dist/default-plugins/setup/package.json +8 -0
  62. package/dist/default-plugins/skills/README.md +35 -0
  63. package/dist/default-plugins/skills/c8ctl-plugin.js +3352 -0
  64. package/dist/default-plugins/skills/package.json +8 -0
  65. package/dist/framework/argv-parser.d.ts +14 -0
  66. package/dist/framework/argv-parser.d.ts.map +1 -1
  67. package/dist/framework/argv-parser.js +25 -0
  68. package/dist/framework/argv-parser.js.map +1 -1
  69. package/dist/framework/command-registry.d.ts +26 -0
  70. package/dist/framework/command-registry.d.ts.map +1 -1
  71. package/dist/framework/command-registry.js +45 -0
  72. package/dist/framework/command-registry.js.map +1 -1
  73. package/dist/framework/plugins/plugin-loader.d.ts +20 -2
  74. package/dist/framework/plugins/plugin-loader.d.ts.map +1 -1
  75. package/dist/framework/plugins/plugin-loader.js.map +1 -1
  76. package/dist/framework/ui/help.d.ts.map +1 -1
  77. package/dist/framework/ui/help.js +57 -14
  78. package/dist/framework/ui/help.js.map +1 -1
  79. package/dist/framework/ui/prompt.d.ts +88 -0
  80. package/dist/framework/ui/prompt.d.ts.map +1 -1
  81. package/dist/framework/ui/prompt.js +344 -0
  82. package/dist/framework/ui/prompt.js.map +1 -1
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +68 -12
  85. package/dist/index.js.map +1 -1
  86. package/dist/utils/command-local/mcp-install-helpers.d.ts +49 -0
  87. package/dist/utils/command-local/mcp-install-helpers.d.ts.map +1 -0
  88. package/dist/utils/command-local/mcp-install-helpers.js +394 -0
  89. package/dist/utils/command-local/mcp-install-helpers.js.map +1 -0
  90. package/dist/utils/command-local/process-instance-helpers.d.ts +6 -0
  91. package/dist/utils/command-local/process-instance-helpers.d.ts.map +1 -1
  92. package/dist/utils/command-local/process-instance-helpers.js +9 -0
  93. package/dist/utils/command-local/process-instance-helpers.js.map +1 -1
  94. package/dist/utils/command-local/skills-install-helpers.d.ts +45 -0
  95. package/dist/utils/command-local/skills-install-helpers.d.ts.map +1 -0
  96. package/dist/utils/command-local/skills-install-helpers.js +423 -0
  97. package/dist/utils/command-local/skills-install-helpers.js.map +1 -0
  98. package/dist/utils/index.d.ts +3 -1
  99. package/dist/utils/index.d.ts.map +1 -1
  100. package/dist/utils/index.js +3 -1
  101. package/dist/utils/index.js.map +1 -1
  102. package/dist/utils/shared/camunda-json.d.ts +24 -3
  103. package/dist/utils/shared/camunda-json.d.ts.map +1 -1
  104. package/dist/utils/shared/camunda-json.js +23 -5
  105. package/dist/utils/shared/camunda-json.js.map +1 -1
  106. package/dist/utils/shared/deploy-resource-selection.d.ts +165 -0
  107. package/dist/utils/shared/deploy-resource-selection.d.ts.map +1 -0
  108. package/dist/utils/shared/deploy-resource-selection.js +466 -0
  109. package/dist/utils/shared/deploy-resource-selection.js.map +1 -0
  110. package/dist/utils/shared/ignore.d.ts +26 -0
  111. package/dist/utils/shared/ignore.d.ts.map +1 -1
  112. package/dist/utils/shared/ignore.js +6 -2
  113. package/dist/utils/shared/ignore.js.map +1 -1
  114. package/package.json +3 -2
  115. package/dist/utils/command-local/setup-prerequisites.d.ts +0 -67
  116. package/dist/utils/command-local/setup-prerequisites.d.ts.map +0 -1
  117. package/dist/utils/command-local/setup-prerequisites.js +0 -238
  118. package/dist/utils/command-local/setup-prerequisites.js.map +0 -1
@@ -22,6 +22,18 @@
22
22
  export declare const CAMUNDA_PROJECT_FILE = "camunda.json";
23
23
  /** Legacy marker, superseded by {@link CAMUNDA_PROJECT_FILE}. */
24
24
  export declare const PROCESS_APPLICATION_FILE = ".process-application";
25
+ /** Tool-agnostic error codes, shared with the parity fixtures. */
26
+ export type DeployResourcesErrorCode = "invalid-config" | "empty-selection" | "read-error";
27
+ /**
28
+ * Raised for an invalid `camunda.json` or `deployResources` configuration
29
+ * (including malformed JSON), an empty final selection, or a selected
30
+ * path that cannot be read (`read-error`). `code` matches the `error`
31
+ * value used by the shared parity fixtures.
32
+ */
33
+ export declare class DeployResourcesError extends Error {
34
+ readonly code: DeployResourcesErrorCode;
35
+ constructor(code: DeployResourcesErrorCode, message: string);
36
+ }
25
37
  /**
26
38
  * Parsed contents of a `camunda.json` descriptor. Mirrors the JSON shape
27
39
  * of the file so future fields can be added in place.
@@ -32,6 +44,14 @@ export interface CamundaProject {
32
44
  /** ID of the linked project in Camunda Hub. */
33
45
  projectId?: string;
34
46
  };
47
+ /**
48
+ * Raw value of the optional `deployResources` field, kept verbatim
49
+ * when the key is present (even when it is `null` or wrong-typed) so
50
+ * the integration that consumes it can validate strictly and report
51
+ * a precise error. Absent key → property absent. Validate with
52
+ * `parseDeployResources` from `deploy-resource-selection.ts`.
53
+ */
54
+ deployResources?: unknown;
35
55
  }
36
56
  /**
37
57
  * Decode descriptor bytes, tolerating the BOMs that Windows tooling
@@ -44,15 +64,16 @@ export declare function decodeCamundaJson(buffer: Buffer): string;
44
64
  *
45
65
  * @param content - Raw file contents (after {@link decodeCamundaJson}).
46
66
  * @param source - Path used in error messages.
47
- * @throws {Error} When the content is not valid JSON or the top level is
48
- * not an object.
67
+ * @throws {DeployResourcesError} `invalid-config` when the content is not
68
+ * valid JSON or the top level is not an object.
49
69
  */
50
70
  export declare function parseCamundaJson(content: string, source?: string): CamundaProject;
51
71
  /**
52
72
  * Read and parse the `camunda.json` descriptor in a directory.
53
73
  * Returns `null` when no readable descriptor exists.
54
74
  *
55
- * @throws {Error} When the file exists but is not valid JSON.
75
+ * @throws {DeployResourcesError} `invalid-config` when the file exists but
76
+ * is not valid JSON.
56
77
  */
57
78
  export declare function readCamundaProject(dirPath: string): CamundaProject | null;
58
79
  //# sourceMappingURL=camunda-json.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"camunda-json.d.ts","sourceRoot":"","sources":["../../../src/utils/shared/camunda-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,uCAAuC;IACvC,GAAG,CAAC,EAAE;QACL,+CAA+C;QAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAA6B,GACnC,cAAc,CAgChB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CASzE"}
1
+ {"version":3,"file":"camunda-json.d.ts","sourceRoot":"","sources":["../../../src/utils/shared/camunda-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,kEAAkE;AAClE,MAAM,MAAM,wBAAwB,GACjC,gBAAgB,GAChB,iBAAiB,GACjB,YAAY,CAAC;AAEhB;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;gBAC5B,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM;CAK3D;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,uCAAuC;IACvC,GAAG,CAAC,EAAE;QACL,+CAA+C;QAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAA6B,GACnC,cAAc,CAsChB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CASzE"}
@@ -25,6 +25,20 @@ import { isRecord, normalizeToError } from "../../core/index.js";
25
25
  export const CAMUNDA_PROJECT_FILE = "camunda.json";
26
26
  /** Legacy marker, superseded by {@link CAMUNDA_PROJECT_FILE}. */
27
27
  export const PROCESS_APPLICATION_FILE = ".process-application";
28
+ /**
29
+ * Raised for an invalid `camunda.json` or `deployResources` configuration
30
+ * (including malformed JSON), an empty final selection, or a selected
31
+ * path that cannot be read (`read-error`). `code` matches the `error`
32
+ * value used by the shared parity fixtures.
33
+ */
34
+ export class DeployResourcesError extends Error {
35
+ code;
36
+ constructor(code, message) {
37
+ super(message);
38
+ this.name = "DeployResourcesError";
39
+ this.code = code;
40
+ }
41
+ }
28
42
  /**
29
43
  * Decode descriptor bytes, tolerating the BOMs that Windows tooling
30
44
  * writes: UTF-8 BOM (stripped) and UTF-16LE BOM (Windows PowerShell 5.1
@@ -41,8 +55,8 @@ export function decodeCamundaJson(buffer) {
41
55
  *
42
56
  * @param content - Raw file contents (after {@link decodeCamundaJson}).
43
57
  * @param source - Path used in error messages.
44
- * @throws {Error} When the content is not valid JSON or the top level is
45
- * not an object.
58
+ * @throws {DeployResourcesError} `invalid-config` when the content is not
59
+ * valid JSON or the top level is not an object.
46
60
  */
47
61
  export function parseCamundaJson(content, source = CAMUNDA_PROJECT_FILE) {
48
62
  // A whitespace-only file is an empty descriptor — the natural outcome
@@ -55,11 +69,11 @@ export function parseCamundaJson(content, source = CAMUNDA_PROJECT_FILE) {
55
69
  parsed = JSON.parse(content);
56
70
  }
57
71
  catch (error) {
58
- throw new Error(`Invalid JSON in ${source}: ${normalizeToError(error).message}. ` +
72
+ throw new DeployResourcesError("invalid-config", `Invalid JSON in ${source}: ${normalizeToError(error).message}. ` +
59
73
  "camunda.json must contain a JSON object; use {} for an empty descriptor");
60
74
  }
61
75
  if (!isRecord(parsed)) {
62
- throw new Error(`${source} must contain a single JSON object; use {} for an empty descriptor`);
76
+ throw new DeployResourcesError("invalid-config", `${source} must contain a single JSON object; use {} for an empty descriptor`);
63
77
  }
64
78
  const project = {};
65
79
  const hub = parsed.hub;
@@ -67,13 +81,17 @@ export function parseCamundaJson(content, source = CAMUNDA_PROJECT_FILE) {
67
81
  project.hub =
68
82
  typeof hub.projectId === "string" ? { projectId: hub.projectId } : {};
69
83
  }
84
+ if (Object.hasOwn(parsed, "deployResources")) {
85
+ project.deployResources = parsed.deployResources;
86
+ }
70
87
  return project;
71
88
  }
72
89
  /**
73
90
  * Read and parse the `camunda.json` descriptor in a directory.
74
91
  * Returns `null` when no readable descriptor exists.
75
92
  *
76
- * @throws {Error} When the file exists but is not valid JSON.
93
+ * @throws {DeployResourcesError} `invalid-config` when the file exists but
94
+ * is not valid JSON.
77
95
  */
78
96
  export function readCamundaProject(dirPath) {
79
97
  const filePath = join(dirPath, CAMUNDA_PROJECT_FILE);
@@ -1 +1 @@
1
- {"version":3,"file":"camunda-json.js","sourceRoot":"","sources":["../../../src/utils/shared/camunda-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAEnD,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAc/D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC/C,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC/B,OAAe,EACf,SAAiB,oBAAoB;IAErC,sEAAsE;IACtE,8DAA8D;IAC9D,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACJ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC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oB,CAC7B,gBAAgB,EAChB,mBAAmB,MAAM,KAAK,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI;YAChE,yEAAyE,CAC1E,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,oBAAoB,CAC7B,gBAAgB,EAChB,GAAG,MAAM,oEAAoE,CAC7E,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACvB,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG;YACV,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAE,CAAC;QAC9C,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;IAClD,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IACrD,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACJ,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * `deployResources` — descriptor-based selection of a project's resources.
3
+ *
4
+ * The optional top-level `deployResources` array in `camunda.json` selects
5
+ * which project files are deployed (and watched with `watch --project`).
6
+ *
7
+ * Patterns use the same engine and syntax as `.c8ignore` (`parsePattern`
8
+ * from `ignore.ts`, evaluated with `node:path#matchesGlob` relative to the
9
+ * project root with `/` separators), with two deliberate differences:
10
+ *
11
+ * - **Inverted polarity.** Selection starts empty; a positive pattern
12
+ * selects, a `!` pattern deselects, and the last matching pattern wins
13
+ * per file.
14
+ * - **Direct descendant selection.** There is no gitignore "excluded
15
+ * parent" rule: a later positive pattern restores a file below an
16
+ * earlier excluded directory. The directory walk therefore never prunes
17
+ * a directory because a negative pattern matched it — it only skips a
18
+ * directory when no positive pattern can match anything below it.
19
+ *
20
+ * Defaults: `node_modules/`, `target/`, `.git/` and the project-root
21
+ * `camunda.json` are evaluated as implicit leading `!` patterns, so any
22
+ * later positive pattern that matches a file inside them overrides them.
23
+ *
24
+ * Hidden files: the engine's wildcards (`*`, `?`, `**`, `[...]`) never
25
+ * match a path segment that starts with `.`. A pattern selects a
26
+ * dot-prefixed file — or anything inside a dot-prefixed directory — only
27
+ * when it names that segment explicitly (e.g. `resources/.prompt.md`,
28
+ * `.config/**`). The walker still descends into hidden directories so
29
+ * such explicit patterns can reach them.
30
+ */
31
+ import { type CamundaProject, DeployResourcesError } from "./camunda-json.ts";
32
+ /** Name of the descriptor field. */
33
+ export declare const DEPLOY_RESOURCES_FIELD = "deployResources";
34
+ /**
35
+ * Default exclusions, applied as implicit leading negations before the
36
+ * user's patterns. The root descriptor is anchored; the directories match
37
+ * at any depth (same as the `.c8ignore` defaults).
38
+ */
39
+ export declare const DEPLOY_RESOURCES_DEFAULT_EXCLUSIONS: readonly string[];
40
+ /**
41
+ * Validate the raw `deployResources` value read from `camunda.json`.
42
+ *
43
+ * @param value - The raw field value (`CamundaProject.deployResources`).
44
+ * @param source - Descriptor path used in error messages.
45
+ * @returns The validated pattern list (possibly empty).
46
+ * @throws {DeployResourcesError} `invalid-config` when the value is not an
47
+ * array of valid pattern strings.
48
+ */
49
+ export declare function parseDeployResources(value: unknown, source?: string): string[];
50
+ /**
51
+ * Strictly read the `camunda.json` descriptor of a directory that is being
52
+ * resolved for deployment or watching.
53
+ *
54
+ * Unlike `readCamundaProject` (lenient marker detection), a descriptor
55
+ * that exists but cannot be read — a directory named `camunda.json`, no
56
+ * permission, an I/O error — is an `invalid-config` error. Degrading to
57
+ * "no descriptor" would silently fall back to the default scan and
58
+ * bypass a `deployResources` allowlist.
59
+ *
60
+ * @returns The parsed descriptor, or `null` only when no `camunda.json`
61
+ * exists.
62
+ * @throws {DeployResourcesError} `invalid-config` when the file exists but
63
+ * cannot be read.
64
+ * @throws {DeployResourcesError} `invalid-config` when `camunda.json` is
65
+ * not valid JSON or not a JSON object.
66
+ */
67
+ export declare function readProjectDescriptor(dirPath: string): CamundaProject | null;
68
+ /** Outcome of reading a project's `deployResources` configuration. */
69
+ export type DeployResourcesState = {
70
+ kind: "no-descriptor";
71
+ } | {
72
+ kind: "no-field";
73
+ } | {
74
+ kind: "patterns";
75
+ patterns: string[];
76
+ };
77
+ /**
78
+ * Read a project's `deployResources` state, distinguishing a missing
79
+ * descriptor from a descriptor without the field.
80
+ *
81
+ * @throws {DeployResourcesError} `invalid-config` when the descriptor
82
+ * cannot be read or the field is invalid.
83
+ * @throws {DeployResourcesError} `invalid-config` when `camunda.json` is
84
+ * not valid JSON or not a JSON object.
85
+ */
86
+ export declare function readDeployResourcesState(projectRoot: string): DeployResourcesState;
87
+ /**
88
+ * The `deployResources` state of an already-read descriptor (`null` when
89
+ * there is none), so a caller can decide from a single read.
90
+ *
91
+ * @throws {DeployResourcesError} `invalid-config` when the field is invalid.
92
+ */
93
+ export declare function deployResourcesStateOf(project: CamundaProject | null, projectRoot: string): DeployResourcesState;
94
+ /**
95
+ * Read the validated `deployResources` patterns of the project rooted at
96
+ * `projectRoot`.
97
+ *
98
+ * @returns The patterns, or `null` when there is no descriptor or the
99
+ * descriptor has no `deployResources` key (default scan applies).
100
+ * @throws {DeployResourcesError} `invalid-config` when `camunda.json` is
101
+ * not valid JSON or not a JSON object.
102
+ * @throws {DeployResourcesError} `invalid-config` when the descriptor
103
+ * cannot be read or the field is invalid.
104
+ */
105
+ export declare function readDeployResources(projectRoot: string): string[] | null;
106
+ /** A compiled `deployResources` pattern list. */
107
+ export interface ResourceSelector {
108
+ /** The user's patterns, in order. */
109
+ readonly patterns: readonly string[];
110
+ /** Whether the project-relative file path is selected. */
111
+ selects(relPath: string): boolean;
112
+ /**
113
+ * Whether any file below the project-relative directory could be
114
+ * selected. Conservative: `true` whenever a positive pattern might
115
+ * match below `relDir`. Used only to skip walking directories that can
116
+ * never contribute (e.g. `.git/` under `["**\/*"]`).
117
+ */
118
+ couldSelectUnder(relDir: string): boolean;
119
+ /**
120
+ * Whether the folder is excluded: a `!` pattern matches it (e.g.
121
+ * `!vendor/`, or a default exclusion) and no later positive pattern
122
+ * matches it or can reach below it. Used to skip a folder that can't be
123
+ * read only when nothing inside it can be selected.
124
+ */
125
+ excludesFolder(relDir: string): boolean;
126
+ }
127
+ /**
128
+ * Compile validated `deployResources` patterns into a selector.
129
+ * Call {@link parseDeployResources} first to validate raw input.
130
+ */
131
+ export declare function compileDeployResources(patterns: readonly string[]): ResourceSelector;
132
+ /**
133
+ * Walk `projectRoot` and return the project-relative (`/`-separated)
134
+ * paths of every file the selector selects, sorted.
135
+ *
136
+ * - Symlinks are followed (same as the default deploy discovery). A
137
+ * directory reachable under several project-relative paths (a symlink
138
+ * alias and its real path) is walked under each of them, because
139
+ * patterns are evaluated against the project-relative path. Cycles are
140
+ * cut by skipping a directory whose real path is already on the
141
+ * current descent (an active ancestor). Files that resolve to the same
142
+ * real path are kept once (first path in sorted order wins).
143
+ * - Hidden files and directories are not skipped by the walker — the
144
+ * pattern engine decides (see module docs).
145
+ * - Nested `camunda.json` folders are ordinary folders here: nested
146
+ * projects are unsupported and are not excluded from the selection.
147
+ */
148
+ export declare function selectProjectFiles(projectRoot: string, selector: ResourceSelector): string[];
149
+ /**
150
+ * The `read-error` raised when a path a `deployResources` pattern can
151
+ * select cannot be read. Names the path and, for a dangling symlink,
152
+ * says so.
153
+ */
154
+ export declare function unreadablePath(path: string, error: unknown,
155
+ /** Project-relative path, used to suggest an exclusion pattern. */
156
+ rel?: string): DeployResourcesError;
157
+ /**
158
+ * Resolve the deployed resource set of a project from its validated
159
+ * `deployResources` patterns.
160
+ *
161
+ * @throws {DeployResourcesError} `empty-selection` when nothing is
162
+ * selected (an unmatched pattern alone is silently ignored).
163
+ */
164
+ export declare function resolveDeployResources(projectRoot: string, patterns: readonly string[]): string[];
165
+ //# sourceMappingURL=deploy-resource-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-resource-selection.d.ts","sourceRoot":"","sources":["../../../src/utils/shared/deploy-resource-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAWH,OAAO,EAEN,KAAK,cAAc,EACnB,oBAAoB,EAGpB,MAAM,mBAAmB,CAAC;AAO3B,oCAAoC;AACpC,eAAO,MAAM,sBAAsB,oBAAoB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,EAAE,SAAS,MAAM,EAKhE,CAAC;AAkCF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,OAAO,EACd,MAAM,SAAiB,GACrB,MAAM,EAAE,CA0BV;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CA4B5E;AAED,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAC7B;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACvC,WAAW,EAAE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