@intentius/chant-lexicon-pulumi 0.124.97 → 0.124.99

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 (316) hide show
  1. package/dist/adopt.d.ts +0 -1
  2. package/dist/capability-plugin.d.ts +0 -1
  3. package/dist/change-set.d.ts +0 -1
  4. package/dist/changed-units.d.ts +0 -1
  5. package/dist/check-step.d.ts +0 -1
  6. package/dist/ci-setup.d.ts +0 -1
  7. package/dist/codegen/docs-cli.d.ts +0 -1
  8. package/dist/codegen/docs.d.ts +0 -1
  9. package/dist/codegen/package.d.ts +0 -1
  10. package/dist/composites/pulumi-adopt-op.d.ts +0 -1
  11. package/dist/composites/pulumi-watch-op.d.ts +0 -1
  12. package/dist/config.d.ts +0 -1
  13. package/dist/describe-resources.d.ts +0 -1
  14. package/dist/drift-read.d.ts +0 -1
  15. package/dist/drift-record.d.ts +0 -1
  16. package/dist/engine-events.d.ts +0 -1
  17. package/dist/engine-graph.d.ts +0 -1
  18. package/dist/exit-codes.d.ts +0 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/init-templates.d.ts +0 -1
  21. package/dist/integrity.json +2 -2
  22. package/dist/lint/audit-catalog.d.ts +0 -1
  23. package/dist/lint/post-synth/index.d.ts +0 -1
  24. package/dist/lint/post-synth/member-read-helpers.d.ts +0 -1
  25. package/dist/lint/post-synth/pul001.d.ts +0 -1
  26. package/dist/lint/post-synth/pul002.d.ts +0 -1
  27. package/dist/lint/post-synth/pul003.d.ts +0 -1
  28. package/dist/lint/post-synth/pul004.d.ts +0 -1
  29. package/dist/lint/post-synth/pul005.d.ts +0 -1
  30. package/dist/lint/post-synth/pul006.d.ts +0 -1
  31. package/dist/lint/post-synth/pul007.d.ts +0 -1
  32. package/dist/lint/post-synth/pul008.d.ts +0 -1
  33. package/dist/lint/post-synth/pul009.d.ts +0 -1
  34. package/dist/lint/post-synth/pul010.d.ts +0 -1
  35. package/dist/lint/post-synth/pul011.d.ts +0 -1
  36. package/dist/lint/post-synth/pul012.d.ts +0 -1
  37. package/dist/lint/post-synth/pul013.d.ts +0 -1
  38. package/dist/lint/post-synth/pul014.d.ts +0 -1
  39. package/dist/lint/post-synth/pul015.d.ts +0 -1
  40. package/dist/lint/rules/index.d.ts +0 -1
  41. package/dist/lint/rules/member-dir-absolute.d.ts +0 -1
  42. package/dist/lock-rows.d.ts +0 -1
  43. package/dist/lsp/completions.d.ts +0 -1
  44. package/dist/lsp/documents.d.ts +0 -1
  45. package/dist/lsp/hover.d.ts +0 -1
  46. package/dist/lsp/keys.d.ts +0 -1
  47. package/dist/lsp/object-path.d.ts +0 -1
  48. package/dist/lsp/yaml-cursor.d.ts +0 -1
  49. package/dist/manifest.json +1 -1
  50. package/dist/member-engine.d.ts +0 -1
  51. package/dist/member-outputs.d.ts +0 -1
  52. package/dist/op/activities/index.d.ts +0 -1
  53. package/dist/op/activities/pulumi-adopt.d.ts +0 -1
  54. package/dist/op/activities/pulumi.d.ts +0 -1
  55. package/dist/op/activity-contracts.d.ts +0 -1
  56. package/dist/op/builders.d.ts +0 -1
  57. package/dist/package-cli.d.ts +0 -1
  58. package/dist/plan-shape.d.ts +0 -1
  59. package/dist/planned-output-changes.d.ts +0 -1
  60. package/dist/plugin.d.ts +0 -1
  61. package/dist/plunge-timings.d.ts +0 -1
  62. package/dist/preview-tips.d.ts +0 -1
  63. package/dist/pulumi-up.d.ts +0 -1
  64. package/dist/release-copy.d.ts +0 -1
  65. package/dist/review-stack.d.ts +0 -1
  66. package/dist/run.d.ts +0 -1
  67. package/dist/serializer.d.ts +0 -1
  68. package/dist/stack-export-snapshot.d.ts +0 -1
  69. package/dist/stack-ops.d.ts +0 -1
  70. package/dist/stack-outputs.d.ts +0 -1
  71. package/dist/stack-references.d.ts +0 -1
  72. package/dist/trace-facts.d.ts +0 -1
  73. package/dist/values.d.ts +0 -1
  74. package/dist/workspace-member.d.ts +0 -1
  75. package/package.json +3 -4
  76. package/dist/adopt.d.ts.map +0 -1
  77. package/dist/capability-plugin.d.ts.map +0 -1
  78. package/dist/change-set.d.ts.map +0 -1
  79. package/dist/changed-units.d.ts.map +0 -1
  80. package/dist/check-step.d.ts.map +0 -1
  81. package/dist/ci-setup.d.ts.map +0 -1
  82. package/dist/codegen/docs-cli.d.ts.map +0 -1
  83. package/dist/codegen/docs.d.ts.map +0 -1
  84. package/dist/codegen/package.d.ts.map +0 -1
  85. package/dist/composites/pulumi-adopt-op.d.ts.map +0 -1
  86. package/dist/composites/pulumi-watch-op.d.ts.map +0 -1
  87. package/dist/config.d.ts.map +0 -1
  88. package/dist/describe-resources.d.ts.map +0 -1
  89. package/dist/drift-read.d.ts.map +0 -1
  90. package/dist/drift-record.d.ts.map +0 -1
  91. package/dist/engine-events.d.ts.map +0 -1
  92. package/dist/engine-graph.d.ts.map +0 -1
  93. package/dist/exit-codes.d.ts.map +0 -1
  94. package/dist/index.d.ts.map +0 -1
  95. package/dist/init-templates.d.ts.map +0 -1
  96. package/dist/lint/audit-catalog.d.ts.map +0 -1
  97. package/dist/lint/post-synth/index.d.ts.map +0 -1
  98. package/dist/lint/post-synth/member-read-helpers.d.ts.map +0 -1
  99. package/dist/lint/post-synth/pul001.d.ts.map +0 -1
  100. package/dist/lint/post-synth/pul002.d.ts.map +0 -1
  101. package/dist/lint/post-synth/pul003.d.ts.map +0 -1
  102. package/dist/lint/post-synth/pul004.d.ts.map +0 -1
  103. package/dist/lint/post-synth/pul005.d.ts.map +0 -1
  104. package/dist/lint/post-synth/pul006.d.ts.map +0 -1
  105. package/dist/lint/post-synth/pul007.d.ts.map +0 -1
  106. package/dist/lint/post-synth/pul008.d.ts.map +0 -1
  107. package/dist/lint/post-synth/pul009.d.ts.map +0 -1
  108. package/dist/lint/post-synth/pul010.d.ts.map +0 -1
  109. package/dist/lint/post-synth/pul011.d.ts.map +0 -1
  110. package/dist/lint/post-synth/pul012.d.ts.map +0 -1
  111. package/dist/lint/post-synth/pul013.d.ts.map +0 -1
  112. package/dist/lint/post-synth/pul014.d.ts.map +0 -1
  113. package/dist/lint/post-synth/pul015.d.ts.map +0 -1
  114. package/dist/lint/rules/index.d.ts.map +0 -1
  115. package/dist/lint/rules/member-dir-absolute.d.ts.map +0 -1
  116. package/dist/lock-rows.d.ts.map +0 -1
  117. package/dist/lsp/completions.d.ts.map +0 -1
  118. package/dist/lsp/documents.d.ts.map +0 -1
  119. package/dist/lsp/hover.d.ts.map +0 -1
  120. package/dist/lsp/keys.d.ts.map +0 -1
  121. package/dist/lsp/object-path.d.ts.map +0 -1
  122. package/dist/lsp/yaml-cursor.d.ts.map +0 -1
  123. package/dist/member-engine.d.ts.map +0 -1
  124. package/dist/member-outputs.d.ts.map +0 -1
  125. package/dist/op/activities/index.d.ts.map +0 -1
  126. package/dist/op/activities/pulumi-adopt.d.ts.map +0 -1
  127. package/dist/op/activities/pulumi.d.ts.map +0 -1
  128. package/dist/op/activity-contracts.d.ts.map +0 -1
  129. package/dist/op/builders.d.ts.map +0 -1
  130. package/dist/package-cli.d.ts.map +0 -1
  131. package/dist/plan-shape.d.ts.map +0 -1
  132. package/dist/planned-output-changes.d.ts.map +0 -1
  133. package/dist/plugin.d.ts.map +0 -1
  134. package/dist/plunge-timings.d.ts.map +0 -1
  135. package/dist/preview-tips.d.ts.map +0 -1
  136. package/dist/pulumi-up.d.ts.map +0 -1
  137. package/dist/release-copy.d.ts.map +0 -1
  138. package/dist/review-stack.d.ts.map +0 -1
  139. package/dist/run.d.ts.map +0 -1
  140. package/dist/serializer.d.ts.map +0 -1
  141. package/dist/stack-export-snapshot.d.ts.map +0 -1
  142. package/dist/stack-ops.d.ts.map +0 -1
  143. package/dist/stack-outputs.d.ts.map +0 -1
  144. package/dist/stack-references.d.ts.map +0 -1
  145. package/dist/trace-facts.d.ts.map +0 -1
  146. package/dist/values.d.ts.map +0 -1
  147. package/dist/workspace-member.d.ts.map +0 -1
  148. package/src/adopt.ts +0 -202
  149. package/src/capability-plugin.ts +0 -34
  150. package/src/change-set.test.ts +0 -245
  151. package/src/change-set.ts +0 -508
  152. package/src/changed-units.test.ts +0 -87
  153. package/src/changed-units.ts +0 -96
  154. package/src/check-step.test.ts +0 -191
  155. package/src/check-step.ts +0 -316
  156. package/src/ci-setup.test.ts +0 -234
  157. package/src/ci-setup.ts +0 -224
  158. package/src/codegen/docs-cli.ts +0 -4
  159. package/src/codegen/docs.ts +0 -58
  160. package/src/codegen/package.ts +0 -63
  161. package/src/composites/pulumi-adopt-op.test.ts +0 -258
  162. package/src/composites/pulumi-adopt-op.ts +0 -193
  163. package/src/composites/pulumi-watch-op.test.ts +0 -42
  164. package/src/composites/pulumi-watch-op.ts +0 -85
  165. package/src/config.ts +0 -43
  166. package/src/describe-resources.test.ts +0 -112
  167. package/src/describe-resources.ts +0 -118
  168. package/src/drift-read.test.ts +0 -178
  169. package/src/drift-read.ts +0 -94
  170. package/src/drift-record.test.ts +0 -197
  171. package/src/drift-record.ts +0 -326
  172. package/src/engine-events.test.ts +0 -160
  173. package/src/engine-events.ts +0 -395
  174. package/src/engine-graph.test.ts +0 -141
  175. package/src/engine-graph.ts +0 -149
  176. package/src/exit-codes.test.ts +0 -21
  177. package/src/exit-codes.ts +0 -71
  178. package/src/index.ts +0 -139
  179. package/src/init-templates.ts +0 -85
  180. package/src/lint/audit-catalog.test.ts +0 -33
  181. package/src/lint/audit-catalog.ts +0 -174
  182. package/src/lint/post-synth/index.ts +0 -35
  183. package/src/lint/post-synth/member-read-helpers.ts +0 -122
  184. package/src/lint/post-synth/post-synth.test.ts +0 -245
  185. package/src/lint/post-synth/pul001.ts +0 -38
  186. package/src/lint/post-synth/pul002.ts +0 -38
  187. package/src/lint/post-synth/pul003.ts +0 -43
  188. package/src/lint/post-synth/pul004.ts +0 -32
  189. package/src/lint/post-synth/pul005.ts +0 -31
  190. package/src/lint/post-synth/pul006.ts +0 -31
  191. package/src/lint/post-synth/pul007.ts +0 -35
  192. package/src/lint/post-synth/pul008.ts +0 -35
  193. package/src/lint/post-synth/pul009.ts +0 -32
  194. package/src/lint/post-synth/pul010.ts +0 -42
  195. package/src/lint/post-synth/pul011.ts +0 -38
  196. package/src/lint/post-synth/pul012.ts +0 -35
  197. package/src/lint/post-synth/pul013.ts +0 -35
  198. package/src/lint/post-synth/pul014.ts +0 -32
  199. package/src/lint/post-synth/pul015.ts +0 -39
  200. package/src/lint/rules/index.ts +0 -7
  201. package/src/lint/rules/member-dir-absolute.test.ts +0 -37
  202. package/src/lint/rules/member-dir-absolute.ts +0 -83
  203. package/src/lock-rows.test.ts +0 -60
  204. package/src/lock-rows.ts +0 -56
  205. package/src/lsp/completions.test.ts +0 -69
  206. package/src/lsp/completions.ts +0 -119
  207. package/src/lsp/documents.ts +0 -48
  208. package/src/lsp/hover.test.ts +0 -56
  209. package/src/lsp/hover.ts +0 -83
  210. package/src/lsp/keys.ts +0 -169
  211. package/src/lsp/object-path.ts +0 -71
  212. package/src/lsp/yaml-cursor.ts +0 -85
  213. package/src/member-engine.test.ts +0 -112
  214. package/src/member-engine.ts +0 -97
  215. package/src/member-outputs.test.ts +0 -339
  216. package/src/member-outputs.ts +0 -157
  217. package/src/op/activities/index.ts +0 -36
  218. package/src/op/activities/pulumi-adopt.ts +0 -345
  219. package/src/op/activities/pulumi.ts +0 -136
  220. package/src/op/activity-contracts.ts +0 -129
  221. package/src/op/builders.ts +0 -67
  222. package/src/package-cli.ts +0 -14
  223. package/src/plan-shape.test.ts +0 -91
  224. package/src/plan-shape.ts +0 -105
  225. package/src/planned-output-changes.test.ts +0 -85
  226. package/src/planned-output-changes.ts +0 -141
  227. package/src/plugin.test.ts +0 -96
  228. package/src/plugin.ts +0 -272
  229. package/src/plunge-timings.test.ts +0 -241
  230. package/src/plunge-timings.ts +0 -115
  231. package/src/plunge-up-failed.test.ts +0 -54
  232. package/src/pr-note.test.ts +0 -87
  233. package/src/preview-generated.test.ts +0 -124
  234. package/src/preview-tips.test.ts +0 -134
  235. package/src/preview-tips.ts +0 -128
  236. package/src/pulumi-up.test.ts +0 -581
  237. package/src/pulumi-up.ts +0 -1102
  238. package/src/pulumi-urn-node.test.ts +0 -94
  239. package/src/release-copy.test.ts +0 -162
  240. package/src/release-copy.ts +0 -223
  241. package/src/review-stack.test.ts +0 -254
  242. package/src/review-stack.ts +0 -266
  243. package/src/run-plan-flags.test.ts +0 -53
  244. package/src/run.test.ts +0 -540
  245. package/src/run.ts +0 -1129
  246. package/src/serializer.test.ts +0 -9
  247. package/src/serializer.ts +0 -15
  248. package/src/skills/chant-pulumi-plunge.md +0 -51
  249. package/src/skills/chant-pulumi-stack-export.md +0 -54
  250. package/src/skills/chant-pulumi.md +0 -83
  251. package/src/stack-export-snapshot.test.ts +0 -192
  252. package/src/stack-export-snapshot.ts +0 -312
  253. package/src/stack-ops.fake-binary.test.ts +0 -323
  254. package/src/stack-ops.test.ts +0 -511
  255. package/src/stack-ops.ts +0 -1082
  256. package/src/stack-outputs.ts +0 -66
  257. package/src/stack-references.test.ts +0 -96
  258. package/src/stack-references.ts +0 -110
  259. package/src/testdata/plunge-drift/README.md +0 -10
  260. package/src/testdata/plunge-drift/assets-drifted.ndjson +0 -3
  261. package/src/testdata/plunge-drift/component-unsupported.ndjson +0 -3
  262. package/src/testdata/plunge-drift/role-in-sync.ndjson +0 -3
  263. package/src/testdata/plunge-drift/settled-empty.ndjson +0 -2
  264. package/src/testdata/plunge-graph/Pulumi.yaml +0 -4
  265. package/src/testdata/plunge-graph/README.md +0 -12
  266. package/src/testdata/plunge-graph/engine-graph.json +0 -158
  267. package/src/testdata/plunge-graph/stack-export.json +0 -49
  268. package/src/testdata/plunge-member/Pulumi.yaml +0 -4
  269. package/src/testdata/plunge-member/README.md +0 -3
  270. package/src/testdata/plunge-member/stack-export.json +0 -480
  271. package/src/testdata/plunge-outputs/Pulumi.yaml +0 -9
  272. package/src/testdata/plunge-outputs/README.md +0 -7
  273. package/src/testdata/plunge-outputs/stack-export.json +0 -2003
  274. package/src/testdata/plunge-outputs/stack-output.json +0 -19
  275. package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
  276. package/src/testdata/pulumi-member/README.md +0 -50
  277. package/src/testdata/pulumi-member/recording/Pulumi.dev.yaml +0 -19
  278. package/src/testdata/pulumi-member/recording/Pulumi.yaml +0 -7
  279. package/src/testdata/pulumi-member/recording/index.js +0 -47
  280. package/src/testdata/pulumi-member/recording/package-lock.json +0 -2707
  281. package/src/testdata/pulumi-member/recording/package.json +0 -9
  282. package/src/testdata/pulumi-member/stack-export.json +0 -746
  283. package/src/testdata/pulumi-outputs/Pulumi.yaml +0 -7
  284. package/src/testdata/pulumi-outputs/README.md +0 -9
  285. package/src/testdata/pulumi-outputs/preview-replaced.json +0 -2894
  286. package/src/testdata/pulumi-outputs/preview-settled.json +0 -2894
  287. package/src/testdata/pulumi-outputs/stack-export.json +0 -1919
  288. package/src/testdata/pulumi-outputs/stack-output.json +0 -19
  289. package/src/testdata/pulumi-preview/Pulumi.yaml +0 -7
  290. package/src/testdata/pulumi-preview/README.md +0 -9
  291. package/src/testdata/pulumi-preview/preview-create.json +0 -992
  292. package/src/testdata/pulumi-preview/preview.json +0 -2894
  293. package/src/testdata/pulumi-preview/stack-export.json +0 -1919
  294. package/src/testdata/pulumi-refresh/Pulumi.yaml +0 -7
  295. package/src/testdata/pulumi-refresh/README.md +0 -14
  296. package/src/testdata/pulumi-refresh/all.json +0 -3742
  297. package/src/testdata/pulumi-refresh/bucket-edited.json +0 -468
  298. package/src/testdata/pulumi-refresh/policy-deleted.json +0 -95
  299. package/src/testdata/pulumi-refresh/queue-edited.json +0 -250
  300. package/src/testdata/pulumi-refresh/role-same.json +0 -242
  301. package/src/testdata/pulumi-refresh/secret-edited.json +0 -247
  302. package/src/testdata/pulumi-refresh/stack-export.json +0 -1907
  303. package/src/testdata/pulumi-stream/README.md +0 -16
  304. package/src/testdata/pulumi-stream/preview-stream.ndjson +0 -42
  305. package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +0 -5
  306. package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
  307. package/src/testdata/pulumi-urn-node/Pulumi.yaml +0 -7
  308. package/src/testdata/pulumi-urn-node/README.md +0 -9
  309. package/src/testdata/pulumi-urn-node/preview.json +0 -2894
  310. package/src/testdata/pulumi-urn-node/stack-export.json +0 -1919
  311. package/src/trace-facts.test.ts +0 -38
  312. package/src/trace-facts.ts +0 -83
  313. package/src/values.ts +0 -147
  314. package/src/workspace-kinds.test.ts +0 -47
  315. package/src/workspace-member.test.ts +0 -127
  316. package/src/workspace-member.ts +0 -304
@@ -1,60 +0,0 @@
1
- /**
2
- * #4552: the rows a plunge apply holds on the resource grain: `urn` rows,
3
- * `object` rows for anything but a create, the root stack's row when its
4
- * outputs change, and the `stack` row in place of the URN rows when
5
- * something may appear only at apply (ruling C).
6
- */
7
- import { describe, expect, test } from "vitest";
8
- import type { ChangeSetEntry, ChangeSetPart } from "@intentius/chant/change-set";
9
- import { pulumiLockRows } from "./lock-rows";
10
-
11
- const urn = (type: string, name: string) => `urn:pulumi:dev::site::${type}::${name}`;
12
- const STACK = urn("pulumi:pulumi:Stack", "site-dev");
13
- const BUCKET = urn("aws:s3/bucket:Bucket", "logs");
14
- const QUEUE = urn("aws:sqs/queue:Queue", "jobs");
15
- const TABLE = urn("aws:dynamodb/table:Table", "state");
16
-
17
- const entry = (address: string, action: ChangeSetEntry["action"], extra: Partial<ChangeSetEntry> = {}): ChangeSetEntry => ({
18
- member: "site/dev",
19
- lexicon: "pulumi",
20
- planner: "pulumi",
21
- address,
22
- type: "t",
23
- action,
24
- scope: "dev",
25
- attributes: [],
26
- ...extra,
27
- });
28
-
29
- const part = (entries: ChangeSetEntry[]): ChangeSetPart => ({
30
- member: { member: "site/dev", lexicon: "pulumi", planner: "pulumi", scope: "dev", status: "planned", planDigest: "sha256:x", holes: [] },
31
- entries,
32
- });
33
-
34
- describe("pulumiLockRows", () => {
35
- test("a URN row per change, an object row for anything but a create, nothing for same and read", () => {
36
- const rows = pulumiLockRows(
37
- part([entry(BUCKET, "update", { id: "logs-1" }), entry(QUEUE, "create"), entry(TABLE, "no-op", { id: "state-1" }), entry(STACK, "no-op")]),
38
- "site/dev",
39
- );
40
- expect(rows.map((r) => r.key)).toEqual(["object logs-1", `urn ${BUCKET}`, `urn ${QUEUE}`]);
41
- expect(rows.every((r) => r.target === "site/dev")).toBe(true);
42
- });
43
-
44
- test("the root stack's row when its outputs change, so two runs that rewrite them serialize", () => {
45
- const rows = pulumiLockRows(part([entry(STACK, "update"), entry(BUCKET, "create")]), "site/dev");
46
- expect(rows.map((r) => r.key)).toContain(`urn ${STACK}`);
47
- });
48
-
49
- test("a may-appear entry turns the URN rows into the stack's row, and keeps the object rows", () => {
50
- const appear = `urn:pulumi:dev::site::my:web:Site$*::site/*`;
51
- const rows = pulumiLockRows(part([entry(BUCKET, "delete", { id: "logs-1" }), entry(appear, "create", { mayAppear: true })]), "site/dev");
52
- expect(rows.map((r) => r.key)).toEqual(["object logs-1", "stack site/dev"]);
53
- });
54
-
55
- test("with no URN to read the stack from, the step's project and stack key the row", () => {
56
- const rows = pulumiLockRows(part([entry("not-a-urn", "create", { mayAppear: true })]), "site/dev", { project: "site", stack: "dev" });
57
- expect(rows.map((r) => r.key)).toEqual(["stack site/dev"]);
58
- expect(() => pulumiLockRows({ ...part([entry("not-a-urn", "create", { mayAppear: true })]), member: { ...part([]).member, scope: undefined } }, "site/dev")).toThrow(/cannot be keyed/);
59
- });
60
- });
package/src/lock-rows.ts DELETED
@@ -1,56 +0,0 @@
1
- /**
2
- * The rows a Pulumi or plunge apply holds on the resource lock grain
3
- * (#4552), from the member's change-set part (`./change-set.ts`):
4
- *
5
- * - `urn <urn>` for every resource the preview changes (create, update,
6
- * replace, delete or forget). The URN carries the project and the stack,
7
- * so two stacks never meet on a URN row.
8
- * - `object <id>` for an update, replace, delete or forget whose resource
9
- * has an id, so two members that act on one live object meet on its row,
10
- * whatever lexicon or stack they are in.
11
- * - The root `pulumi:pulumi:Stack` URN's row when its step is not `same`:
12
- * two runs that rewrite the stack's outputs serialize. It is one more
13
- * changed entry, so it needs no rule of its own.
14
- * - When any entry is `mayAppear` (a component may register children only
15
- * at apply, or the last export holds a resource the preview did not list),
16
- * one `stack <project>/<stack>` row in place of the URN rows (ruling C),
17
- * which conflicts with every `urn` row of the stack. The `object` rows stay.
18
- *
19
- * `same` and `read` steps hold nothing.
20
- */
21
- import type { ChangeSetPart } from "@intentius/chant/change-set";
22
- import { objectRowKey, sortedLockRows, stackRowKey, urnRowKey, type LockRow } from "@intentius/chant/lifecycle/lock-rows";
23
- import { parsePulumiUrn } from "@intentius/chant/pulumi-urn";
24
-
25
- const HOLDS = new Set(["create", "update", "replace", "delete", "forget"]);
26
-
27
- /** The project and stack a part's URNs name, or the fallbacks when no URN parses. */
28
- function stackOf(part: ChangeSetPart, fallback: { project?: string; stack?: string }): { project: string; stack: string } | undefined {
29
- for (const e of part.entries) {
30
- const parsed = parsePulumiUrn(e.address);
31
- if (parsed) return { project: parsed.project, stack: parsed.stack };
32
- }
33
- const stack = part.member.scope ?? fallback.stack;
34
- return fallback.project && stack ? { project: fallback.project, stack } : undefined;
35
- }
36
-
37
- /**
38
- * The rows of one Pulumi member's part. `target` names the member in a
39
- * refusal (`<project>/<stack>`); `fallback` gives the project and stack when
40
- * no entry's address is a URN.
41
- */
42
- export function pulumiLockRows(part: ChangeSetPart, target: string, fallback: { project?: string; stack?: string } = {}): LockRow[] {
43
- const changing = part.entries.filter((e) => HOLDS.has(e.action));
44
- const rows: LockRow[] = [];
45
- for (const e of changing) {
46
- if (e.action !== "create" && e.id) rows.push({ key: objectRowKey(e.id), target, address: e.address });
47
- }
48
- if (changing.some((e) => e.mayAppear === true)) {
49
- const at = stackOf(part, fallback);
50
- if (!at) throw new Error(`"${target}": some resources of the stack may appear only at apply, and neither a URN nor the step names the stack, so its row cannot be keyed`);
51
- rows.push({ key: stackRowKey(at.project, at.stack), target, address: `${at.project}/${at.stack}` });
52
- return sortedLockRows(rows);
53
- }
54
- for (const e of changing) rows.push({ key: urnRowKey(e.address), target, address: e.address });
55
- return sortedLockRows(rows);
56
- }
@@ -1,69 +0,0 @@
1
- import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
- import { tmpdir } from "node:os";
3
- import { join } from "node:path";
4
- import { afterEach, describe, expect, test } from "vitest";
5
- import type { CompletionContext } from "@intentius/chant/lsp/types";
6
- import { completions } from "./completions";
7
-
8
- /** A context whose cursor sits at the end of `content`. */
9
- function at(uri: string, content: string): CompletionContext {
10
- const lines = content.split("\n");
11
- const line = lines.length - 1;
12
- const linePrefix = lines[line];
13
- return {
14
- uri,
15
- content,
16
- position: { line, character: linePrefix.length },
17
- linePrefix,
18
- wordAtCursor: /(\w+)$/.exec(linePrefix)?.[1] ?? "",
19
- };
20
- }
21
-
22
- const labels = (items: { label: string }[]) => items.map((i) => i.label);
23
-
24
- let dirs: string[] = [];
25
- afterEach(() => {
26
- for (const d of dirs) rmSync(d, { recursive: true, force: true });
27
- dirs = [];
28
- });
29
-
30
- describe("pulumi completions", () => {
31
- test("ignore every document that is not a pulumi surface", () => {
32
- expect(completions(at("file:///p/src/infra.ts", "export const x = {"))).toEqual([]);
33
- expect(completions(at("file:///p/values.yaml", "na"))).toEqual([]);
34
- });
35
-
36
- test("Pulumi.yaml: top-level keys by prefix", () => {
37
- expect(labels(completions(at("file:///p/Pulumi.yaml", "name: app\nru")))).toEqual(["runtime"]);
38
- expect(labels(completions(at("file:///p/Pulumi.yaml", "")))).toContain("backend");
39
- });
40
-
41
- test("Pulumi.yaml: runtime values and nested keys", () => {
42
- expect(labels(completions(at("file:///p/Pulumi.yaml", "name: app\nruntime: no")))).toEqual(["nodejs"]);
43
- expect(labels(completions(at("file:///p/Pulumi.yaml", "name: app\nruntime:\n name: ya")))).toEqual(["yaml"]);
44
- expect(labels(completions(at("file:///p/Pulumi.yaml", "name: app\nbackend:\n u")))).toEqual(["url"]);
45
- expect(labels(completions(at("file:///p/Pulumi.yaml", "runtime:\n name: nodejs\n options:\n package")))).toEqual(["packagemanager"]);
46
- });
47
-
48
- test("Pulumi.<stack>.yaml: stack keys, and the project's namespace under config", () => {
49
- const dir = mkdtempSync(join(tmpdir(), "pulumi-lsp-"));
50
- dirs.push(dir);
51
- writeFileSync(join(dir, "Pulumi.yaml"), "name: shop\nruntime: yaml\n");
52
- expect(labels(completions(at(`file://${dir}/Pulumi.dev.yaml`, "secrets")))).toEqual(["secretsprovider"]);
53
- expect(labels(completions(at(`file://${dir}/Pulumi.dev.yaml`, "config:\n sh")))).toEqual(["shop:"]);
54
- expect(labels(completions(at(`file://${dir}/Pulumi.dev.yaml`, "config:\n zz")))).toEqual([]);
55
- });
56
-
57
- test("chant.workspace.json: pulumi as a member kind, and nowhere else", () => {
58
- const decl = `{\n "name": "w",\n "members": [\n { "name": "infra", "dir": "infra", "kind": "pu`;
59
- expect(labels(completions(at("file:///w/chant.workspace.json", decl)))).toEqual(["pulumi"]);
60
- expect(completions(at("file:///w/chant.workspace.json", `{\n "records": [{ "kind": "pu`))).toEqual([]);
61
- });
62
-
63
- test("chant.config.ts: the pulumi namespace, member keys and engine values", () => {
64
- expect(labels(completions(at("file:///p/chant.config.ts", "export default {\n pulumi: {\n me")))).toEqual(["member"]);
65
- expect(labels(completions(at("file:///p/chant.config.ts", "export default {\n pulumi: { member: {\n ")))).toEqual(["dir", "label", "engine", "stack"]);
66
- expect(labels(completions(at("file:///p/chant.config.ts", 'export default { pulumi: { member: { dir: "./infra", engine: "pl')))).toEqual(["plunge"]);
67
- expect(completions(at("file:///p/chant.config.ts", "export default {\n terraform: {\n ro"))).toEqual([]);
68
- });
69
- });
@@ -1,119 +0,0 @@
1
- /**
2
- * LSP completions for the pulumi lexicon (#4468).
3
- *
4
- * There is no typed resource surface to complete (the lexicon declares no
5
- * kinds), so this completes the files a pulumi member is made of, the way
6
- * the terraform lexicon completes its config and builder options rather than
7
- * HCL types:
8
- *
9
- * - `Pulumi.yaml`: the project keys, at the level the cursor is on, and the
10
- * values of `runtime` and the few other keys with a closed set;
11
- * - `Pulumi.<stack>.yaml`: the stack keys, and under `config:` the project's
12
- * own namespace (`<name>:`), read from the `Pulumi.yaml` beside it;
13
- * - `chant.workspace.json`: `pulumi` as a member's `"kind"`;
14
- * - `chant.config.ts`: the `pulumi` namespace's `member` and its keys, and
15
- * `engine`'s two values.
16
- *
17
- * See `./documents.ts` for how a document is recognised and `./keys.ts` for
18
- * what each key says.
19
- */
20
- import { existsSync, readFileSync } from "node:fs";
21
- import { join } from "node:path";
22
- import type { CompletionContext, CompletionItem } from "@intentius/chant/lsp/types";
23
- import { pulumiDocument, uriDir } from "./documents";
24
- import { CONFIG_NAMESPACE_KEYS, MEMBER_CONFIG_KEYS, MEMBER_KIND_DOC, PROJECT_KEYS, STACK_KEYS, type KeyDoc } from "./keys";
25
- import { endsWith, enclosingKeys, offsetOf } from "./object-path";
26
- import { yamlCursor } from "./yaml-cursor";
27
-
28
- function keyItems(keys: KeyDoc[], prefix: string): CompletionItem[] {
29
- const lower = prefix.toLowerCase();
30
- return keys
31
- .filter((k) => !lower || k.key.toLowerCase().startsWith(lower))
32
- .map((k) => ({ label: k.key, insertText: k.key, kind: "property" as const, documentation: k.doc }));
33
- }
34
-
35
- function valueItems(key: KeyDoc | undefined, prefix: string): CompletionItem[] {
36
- const lower = prefix.trim().replace(/^["']/, "").toLowerCase();
37
- return (key?.values ?? [])
38
- .filter((v) => !lower || v.value.toLowerCase().startsWith(lower))
39
- .map((v) => ({ label: v.value, insertText: v.value, kind: "value" as const, documentation: v.doc }));
40
- }
41
-
42
- function yamlCompletions(table: Record<string, KeyDoc[]>, ctx: CompletionContext): CompletionItem[] {
43
- const cursor = yamlCursor(ctx.content ?? "", ctx.position?.line ?? 0, ctx.position?.character ?? 0);
44
- const keys = table[cursor.parents.join(".")];
45
- if (!keys) return [];
46
- if (cursor.key !== undefined) return valueItems(keys.find((k) => k.key === cursor.key), cursor.valuePrefix);
47
- return keyItems(keys, cursor.keyPrefix);
48
- }
49
-
50
- /** The `name:` of the `Pulumi.yaml` in `dir`, when there is one. */
51
- export function projectName(dir: string | undefined): string | undefined {
52
- if (!dir) return undefined;
53
- for (const file of ["Pulumi.yaml", "Pulumi.yml"]) {
54
- const path = join(dir, file);
55
- if (!existsSync(path)) continue;
56
- try {
57
- const m = /^name:\s*["']?([^\s"'#]+)/m.exec(readFileSync(path, "utf-8"));
58
- return m?.[1];
59
- } catch {
60
- return undefined;
61
- }
62
- }
63
- return undefined;
64
- }
65
-
66
- function stackCompletions(ctx: CompletionContext): CompletionItem[] {
67
- const cursor = yamlCursor(ctx.content ?? "", ctx.position?.line ?? 0, ctx.position?.character ?? 0);
68
- if (cursor.parents.length === 1 && cursor.parents[0] === "config" && cursor.key === undefined) {
69
- const name = projectName(uriDir(ctx.uri));
70
- if (!name || !`${name}:`.startsWith(cursor.keyPrefix)) return [];
71
- return [
72
- {
73
- label: `${name}:`,
74
- insertText: `${name}:`,
75
- kind: "property",
76
- detail: "this project's config namespace",
77
- documentation: `Config the program reads with \`new pulumi.Config()\`, keyed \`${name}:<key>\`.`,
78
- },
79
- ];
80
- }
81
- return yamlCompletions(STACK_KEYS, ctx);
82
- }
83
-
84
- function workspaceCompletions(ctx: CompletionContext): CompletionItem[] {
85
- const m = /"kind"\s*:\s*"([\w-]*)$/.exec(ctx.linePrefix ?? "");
86
- if (!m || !"pulumi".startsWith(m[1])) return [];
87
- const before = (ctx.content ?? "").slice(0, offsetOf(ctx.content ?? "", ctx.position?.line ?? 0, ctx.position?.character ?? 0));
88
- if (!enclosingKeys(before).includes("members")) return [];
89
- return [{ label: "pulumi", insertText: "pulumi", kind: "value", detail: "a Pulumi program, with a Pulumi.yaml", documentation: MEMBER_KIND_DOC }];
90
- }
91
-
92
- function configCompletions(ctx: CompletionContext): CompletionItem[] {
93
- const content = ctx.content ?? "";
94
- const before = content.slice(0, offsetOf(content, ctx.position?.line ?? 0, ctx.position?.character ?? 0));
95
- const path = enclosingKeys(before);
96
- const engine = /\bengine\s*:\s*["']([\w]*)$/.exec(ctx.linePrefix ?? "");
97
- if (engine) {
98
- return endsWith(path, ["pulumi", "member"]) ? valueItems(MEMBER_CONFIG_KEYS.find((k) => k.key === "engine"), engine[1]) : [];
99
- }
100
- if (endsWith(path, ["pulumi", "member"])) return keyItems(MEMBER_CONFIG_KEYS, ctx.wordAtCursor ?? "");
101
- if (endsWith(path, ["pulumi"])) return keyItems(CONFIG_NAMESPACE_KEYS, ctx.wordAtCursor ?? "");
102
- return [];
103
- }
104
-
105
- export function completions(ctx: CompletionContext): CompletionItem[] {
106
- const doc = pulumiDocument(ctx.uri ?? "");
107
- switch (doc?.kind) {
108
- case "project":
109
- return yamlCompletions(PROJECT_KEYS, ctx);
110
- case "stack":
111
- return stackCompletions(ctx);
112
- case "workspace":
113
- return workspaceCompletions(ctx);
114
- case "config":
115
- return configCompletions(ctx);
116
- default:
117
- return [];
118
- }
119
- }
@@ -1,48 +0,0 @@
1
- /**
2
- * Which pulumi surface an editor document is (#4468).
3
- *
4
- * The lexicon declares no resource types, so there is no typed source to
5
- * complete. Its real surface is four files, told apart by name alone:
6
- *
7
- * - `Pulumi.yaml` (or `.yml`): the project file, which the `pulumi` member
8
- * kind probes for and which carries the backend URL chant reads to pick
9
- * the engine (`../run.ts`, `pulumiMemberEngine`);
10
- * - `Pulumi.<stack>.yaml`: a stack's config;
11
- * - `chant.workspace.json` / `.jsonc`: the workspace declaration, where a
12
- * member says `"kind": "pulumi"`;
13
- * - `chant.config.ts`: the project config, where `pulumi.member` names a
14
- * member to read into the build.
15
- *
16
- * Every other document is someone else's, and the providers return nothing
17
- * for it.
18
- */
19
-
20
- export type PulumiDocument =
21
- | { kind: "project" }
22
- | { kind: "stack"; stack: string }
23
- | { kind: "workspace" }
24
- | { kind: "config" };
25
-
26
- function fileName(uri: string): string {
27
- const path = uri.replace(/[?#].*$/, "");
28
- const slash = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
29
- return decodeURIComponent(slash === -1 ? path : path.slice(slash + 1));
30
- }
31
-
32
- export function pulumiDocument(uri: string): PulumiDocument | undefined {
33
- const name = fileName(uri);
34
- if (name === "Pulumi.yaml" || name === "Pulumi.yml") return { kind: "project" };
35
- const stack = /^Pulumi\.(.+)\.ya?ml$/.exec(name);
36
- if (stack) return { kind: "stack", stack: stack[1] };
37
- if (name === "chant.workspace.json" || name === "chant.workspace.jsonc") return { kind: "workspace" };
38
- if (/^chant\.config\.(ts|mts|js|mjs)$/.test(name)) return { kind: "config" };
39
- return undefined;
40
- }
41
-
42
- /** The directory part of a `file://` URI, as a filesystem path; undefined for any other scheme. */
43
- export function uriDir(uri: string): string | undefined {
44
- if (!uri.startsWith("file://")) return undefined;
45
- const path = decodeURIComponent(uri.slice("file://".length).replace(/[?#].*$/, ""));
46
- const slash = path.lastIndexOf("/");
47
- return slash <= 0 ? "/" : path.slice(0, slash);
48
- }
@@ -1,56 +0,0 @@
1
- import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
- import { tmpdir } from "node:os";
3
- import { join } from "node:path";
4
- import { afterEach, describe, expect, test } from "vitest";
5
- import type { HoverContext } from "@intentius/chant/lsp/types";
6
- import { hover } from "./hover";
7
-
8
- /** A context hovering `word` on line `line` of `content`. */
9
- function on(uri: string, content: string, line: number, word: string): HoverContext {
10
- const lineText = content.split("\n")[line];
11
- return { uri, content, position: { line, character: lineText.indexOf(word) + 1 }, word, lineText };
12
- }
13
-
14
- let dirs: string[] = [];
15
- afterEach(() => {
16
- for (const d of dirs) rmSync(d, { recursive: true, force: true });
17
- dirs = [];
18
- });
19
-
20
- describe("pulumi hover", () => {
21
- test("returns nothing for a document that is not a pulumi surface", () => {
22
- expect(hover(on("file:///p/src/infra.ts", "const name = 1", 0, "name"))).toBeUndefined();
23
- });
24
-
25
- test("Pulumi.yaml: a key says what chant does with it", () => {
26
- const content = "name: app\nruntime: nodejs\nbackend:\n url: plunge+file://./state\n";
27
- expect(hover(on("file:///p/Pulumi.yaml", content, 0, "name"))?.contents).toContain("URN");
28
- expect(hover(on("file:///p/Pulumi.yaml", content, 3, "url"))?.contents).toContain("plunge");
29
- expect(hover(on("file:///p/Pulumi.yaml", content, 1, "nodejs"))?.contents).toContain("Node.js");
30
- });
31
-
32
- test("Pulumi.<stack>.yaml: config keys by namespace, and secure", () => {
33
- const dir = mkdtempSync(join(tmpdir(), "pulumi-lsp-"));
34
- dirs.push(dir);
35
- writeFileSync(join(dir, "Pulumi.yaml"), "name: shop\nruntime: yaml\n");
36
- const content = "config:\n shop:bucketName: assets\n aws:region: us-east-1\n shop:token:\n secure: AAAB\n";
37
- const uri = `file://${dir}/Pulumi.dev.yaml`;
38
- expect(hover(on(uri, content, 1, "bucketName"))?.contents).toContain("This project's config key");
39
- expect(hover(on(uri, content, 2, "aws"))?.contents).toContain("`aws` package or provider");
40
- expect(hover(on(uri, content, 4, "secure"))?.contents).toContain("never decrypts");
41
- expect(hover(on(uri, content, 0, "config"))?.contents).toContain("selected stack");
42
- });
43
-
44
- test("chant.workspace.json: the member kind", () => {
45
- const content = `{ "members": [\n { "name": "infra", "dir": "infra", "kind": "pulumi" }\n] }`;
46
- expect(hover(on("file:///w/chant.workspace.json", content, 1, "pulumi"))?.contents).toContain("pulumi preview --json");
47
- expect(hover(on("file:///w/chant.workspace.json", content, 1, "infra"))).toBeUndefined();
48
- });
49
-
50
- test("chant.config.ts: pulumi.member keys", () => {
51
- const content = 'export default {\n pulumi: {\n member: {\n dir: "./infra",\n engine: "plunge",\n },\n },\n};';
52
- expect(hover(on("file:///p/chant.config.ts", content, 3, "dir"))?.contents).toContain("project root");
53
- expect(hover(on("file:///p/chant.config.ts", content, 4, "engine"))?.contents).toContain("backend.url");
54
- expect(hover(on("file:///p/chant.config.ts", content, 2, "member"))?.contents).toContain("stack-export.json");
55
- });
56
- });
package/src/lsp/hover.ts DELETED
@@ -1,83 +0,0 @@
1
- /**
2
- * LSP hover for the pulumi lexicon (#4468), over the same four files
3
- * `./completions.ts` completes: a key in `Pulumi.yaml` or a stack's config
4
- * says what it is and what chant does with it, `"kind": "pulumi"` in the
5
- * workspace declaration says what chant reads from the member and runs
6
- * against it, and a key of `pulumi.member` in `chant.config.ts` says what it
7
- * sets.
8
- */
9
- import type { HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
10
- import { pulumiDocument, uriDir } from "./documents";
11
- import { projectName } from "./completions";
12
- import { CONFIG_NAMESPACE_KEYS, MEMBER_CONFIG_KEYS, MEMBER_KIND_DOC, PROJECT_KEYS, STACK_CONFIG_VALUE_KEYS, STACK_KEYS, type KeyDoc } from "./keys";
13
- import { endsWith, enclosingKeys, offsetOf } from "./object-path";
14
- import { yamlKeyAt } from "./yaml-cursor";
15
-
16
- function keyHover(entry: KeyDoc | undefined, label: string): HoverInfo | undefined {
17
- return entry ? { contents: `**${label}**\n\n${entry.doc}` } : undefined;
18
- }
19
-
20
- function yamlHover(table: Record<string, KeyDoc[]>, ctx: HoverContext): HoverInfo | undefined {
21
- const at = yamlKeyAt(ctx.content ?? "", ctx.position?.line ?? 0);
22
- if (!at || !ctx.word) return undefined;
23
- const entry = table[at.path.slice(0, -1).join(".")]?.find((k) => k.key === at.key);
24
- if (!entry) return undefined;
25
- if (at.key.includes(ctx.word)) return keyHover(entry, at.path.join("."));
26
- const value = entry.values?.find((v) => v.value === ctx.word && at.value.replace(/^["']|["']$/g, "") === v.value);
27
- return value ? { contents: `**${at.key}: ${value.value}**\n\n${value.doc}` } : undefined;
28
- }
29
-
30
- function stackHover(ctx: HoverContext): HoverInfo | undefined {
31
- const at = yamlKeyAt(ctx.content ?? "", ctx.position?.line ?? 0);
32
- if (!at || !ctx.word) return undefined;
33
- if (at.path.length === 2 && at.path[0] === "config" && at.key.includes(ctx.word)) {
34
- const colon = at.key.indexOf(":");
35
- if (colon === -1) return undefined;
36
- const namespace = at.key.slice(0, colon);
37
- const own = namespace === projectName(uriDir(ctx.uri));
38
- return {
39
- contents:
40
- `**${at.key}**\n\n` +
41
- (own
42
- ? `This project's config key \`${at.key.slice(colon + 1)}\`, read by the program with \`new pulumi.Config()\`.`
43
- : `Config for the \`${namespace}\` package or provider, key \`${at.key.slice(colon + 1)}\`.`),
44
- };
45
- }
46
- if (at.path.length === 3 && at.path[0] === "config" && STACK_CONFIG_VALUE_KEYS[at.key] && at.key === ctx.word) {
47
- return { contents: `**${at.key}**\n\n${STACK_CONFIG_VALUE_KEYS[at.key]}` };
48
- }
49
- return yamlHover(STACK_KEYS, ctx);
50
- }
51
-
52
- function workspaceHover(ctx: HoverContext): HoverInfo | undefined {
53
- if (ctx.word !== "pulumi" || !/"kind"\s*:\s*"pulumi"/.test(ctx.lineText ?? "")) return undefined;
54
- return { contents: MEMBER_KIND_DOC };
55
- }
56
-
57
- function configHover(ctx: HoverContext): HoverInfo | undefined {
58
- const content = ctx.content ?? "";
59
- const line = ctx.lineText ?? "";
60
- const word = ctx.word ?? "";
61
- if (!word || !new RegExp(`\\b${word}\\s*:`).test(line)) return undefined;
62
- const before = content.slice(0, offsetOf(content, ctx.position?.line ?? 0, line.indexOf(word)));
63
- const path = enclosingKeys(before);
64
- if (endsWith(path, ["pulumi", "member"])) return keyHover(MEMBER_CONFIG_KEYS.find((k) => k.key === word), `pulumi.member.${word}`);
65
- if (endsWith(path, ["pulumi"])) return keyHover(CONFIG_NAMESPACE_KEYS.find((k) => k.key === word), `pulumi.${word}`);
66
- return undefined;
67
- }
68
-
69
- export function hover(ctx: HoverContext): HoverInfo | undefined {
70
- const doc = pulumiDocument(ctx.uri ?? "");
71
- switch (doc?.kind) {
72
- case "project":
73
- return yamlHover(PROJECT_KEYS, ctx);
74
- case "stack":
75
- return stackHover(ctx);
76
- case "workspace":
77
- return workspaceHover(ctx);
78
- case "config":
79
- return configHover(ctx);
80
- default:
81
- return undefined;
82
- }
83
- }