@infracraft/pulumi 1.10.0 → 1.12.0
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/dist/agents/hint.cjs +7 -5
- package/dist/agents/hint.cjs.map +1 -1
- package/dist/agents/hint.d.cts +7 -5
- package/dist/agents/hint.d.cts.map +1 -1
- package/dist/agents/hint.d.mts +7 -5
- package/dist/agents/hint.d.mts.map +1 -1
- package/dist/agents/hint.mjs +7 -5
- package/dist/agents/hint.mjs.map +1 -1
- package/dist/agents/index.cjs +4 -0
- package/dist/agents/index.d.cts +2 -0
- package/dist/agents/index.d.mts +2 -0
- package/dist/agents/index.mjs +3 -0
- package/dist/hash.cjs +17 -7
- package/dist/hash.cjs.map +1 -1
- package/dist/hash.d.cts +26 -2
- package/dist/hash.d.cts.map +1 -1
- package/dist/hash.d.mts +26 -2
- package/dist/hash.d.mts.map +1 -1
- package/dist/hash.mjs +16 -7
- package/dist/hash.mjs.map +1 -1
- package/package.json +4 -4
package/dist/agents/hint.cjs
CHANGED
|
@@ -26,15 +26,17 @@ const INFRACRAFT_DEFAULTS = [
|
|
|
26
26
|
* @returns Nothing; emits to the chosen channel as a side effect.
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
29
|
-
*
|
|
29
|
+
* import * as agents from "@infracraft/pulumi/agents";
|
|
30
|
+
*
|
|
31
|
+
* agents.hint({
|
|
30
32
|
* project: [
|
|
31
|
-
* "
|
|
32
|
-
* "
|
|
33
|
+
* "Production is protected — `unprotect <urn>` first for a deliberate change",
|
|
34
|
+
* "Feature env = imports:[staging], zero config; pulumi destroy is safe",
|
|
33
35
|
* ],
|
|
34
36
|
* });
|
|
35
37
|
* ```
|
|
36
38
|
*/
|
|
37
|
-
function
|
|
39
|
+
function hint(options = {}) {
|
|
38
40
|
if (!(options.enabled ?? (!!process.env.CLAUDECODE || !!process.env.AI_AGENT))) return;
|
|
39
41
|
const block = [
|
|
40
42
|
"<infracraft-hint>",
|
|
@@ -47,5 +49,5 @@ function agentHint(options = {}) {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
//#endregion
|
|
50
|
-
exports.
|
|
52
|
+
exports.hint = hint;
|
|
51
53
|
//# sourceMappingURL=hint.cjs.map
|
package/dist/agents/hint.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hint.cjs","names":[],"sources":["../../src/agents/hint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Generic infracraft reminders, prepended to every hint. These hold for any\n * infracraft stack regardless of the consuming project.\n */\nconst INFRACRAFT_DEFAULTS = [\n\t\"Adopt-or-create: re-running is safe — existing resources are adopted, missing ones created\",\n\t\"Shared resources (Railway services/projects, Neon projects) have no-op deletes — destroy never removes them\",\n\t\"Mark shared/production resources protect:true — pulumi destroy aborts on protected resources\",\n];\n\n/** Options for {@link agentHint}. */\nexport interface AgentHintOptions {\n\t/** Project-specific reminders appended after the infracraft defaults. */\n\tproject?: string[];\n\n\t/**\n\t * Force the hint on or off. Defaults to auto-detecting an AI coding agent via\n\t * the `CLAUDECODE` / `AI_AGENT` environment variables.\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Where to write the hint. `\"stderr\"` (default) prints it prominently the\n\t * instant the program loads, before Pulumi's own output — modeled on how the\n\t * Vercel CLI surfaces agent guidance. `\"pulumi-log\"` routes it through\n\t * `pulumi.log.info` (lands in the Diagnostics section instead).\n\t */\n\tchannel?: \"stderr\" | \"pulumi-log\";\n}\n\n/**\n * Emits a delimited `<infracraft-hint>` block of reminders for AI coding agents\n * operating this Pulumi stack — modeled on Vercel's `AGENTS.md` guidance: a\n * delimited block, an agent-directed intro, then terse directive bullets.\n *\n * No-op for humans (no agent env var) unless `enabled` is forced. Call it once at\n * the top of your Pulumi program; the infracraft defaults are always included and\n * `project` lines are appended.\n *\n * @param options Project reminders, channel, and detection override.\n * @returns Nothing; emits to the chosen channel as a side effect.\n * @example\n * ```typescript\n *
|
|
1
|
+
{"version":3,"file":"hint.cjs","names":[],"sources":["../../src/agents/hint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Generic infracraft reminders, prepended to every hint. These hold for any\n * infracraft stack regardless of the consuming project.\n */\nconst INFRACRAFT_DEFAULTS = [\n\t\"Adopt-or-create: re-running is safe — existing resources are adopted, missing ones created\",\n\t\"Shared resources (Railway services/projects, Neon projects) have no-op deletes — destroy never removes them\",\n\t\"Mark shared/production resources protect:true — pulumi destroy aborts on protected resources\",\n];\n\n/** Options for {@link agentHint}. */\nexport interface AgentHintOptions {\n\t/** Project-specific reminders appended after the infracraft defaults. */\n\tproject?: string[];\n\n\t/**\n\t * Force the hint on or off. Defaults to auto-detecting an AI coding agent via\n\t * the `CLAUDECODE` / `AI_AGENT` environment variables.\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Where to write the hint. `\"stderr\"` (default) prints it prominently the\n\t * instant the program loads, before Pulumi's own output — modeled on how the\n\t * Vercel CLI surfaces agent guidance. `\"pulumi-log\"` routes it through\n\t * `pulumi.log.info` (lands in the Diagnostics section instead).\n\t */\n\tchannel?: \"stderr\" | \"pulumi-log\";\n}\n\n/**\n * Emits a delimited `<infracraft-hint>` block of reminders for AI coding agents\n * operating this Pulumi stack — modeled on Vercel's `AGENTS.md` guidance: a\n * delimited block, an agent-directed intro, then terse directive bullets.\n *\n * No-op for humans (no agent env var) unless `enabled` is forced. Call it once at\n * the top of your Pulumi program; the infracraft defaults are always included and\n * `project` lines are appended.\n *\n * @param options Project reminders, channel, and detection override.\n * @returns Nothing; emits to the chosen channel as a side effect.\n * @example\n * ```typescript\n * import * as agents from \"@infracraft/pulumi/agents\";\n *\n * agents.hint({\n * project: [\n * \"Production is protected — `unprotect <urn>` first for a deliberate change\",\n * \"Feature env = imports:[staging], zero config; pulumi destroy is safe\",\n * ],\n * });\n * ```\n */\nexport function hint(options: AgentHintOptions = {}): void {\n\tconst enabled =\n\t\toptions.enabled ?? (!!process.env.CLAUDECODE || !!process.env.AI_AGENT);\n\n\tif (!enabled) {\n\t\treturn;\n\t}\n\n\tconst lines = [...INFRACRAFT_DEFAULTS, ...(options.project ?? [])];\n\n\tconst block = [\n\t\t\"<infracraft-hint>\",\n\t\t\"Reminders for AI agents operating this Pulumi stack:\",\n\t\t...lines.map((line) => `- ${line}`),\n\t\t\"</infracraft-hint>\",\n\t].join(\"\\n\");\n\n\tif (options.channel === \"pulumi-log\") {\n\t\tpulumi.log.info(block);\n\t} else {\n\t\tprocess.stderr.write(`${block}\\n`);\n\t}\n}\n"],"mappings":";;;;;;;;;;AAMA,MAAM,sBAAsB;CAC3B;CACA;CACA;AACD;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,KAAK,UAA4B,CAAC,GAAS;CAI1D,IAAI,EAFH,QAAQ,YAAY,CAAC,CAAC,QAAQ,IAAI,cAAc,CAAC,CAAC,QAAQ,IAAI,YAG9D;CAKD,MAAM,QAAQ;EACb;EACA;EACA,GAAG,CALW,GAAG,qBAAqB,GAAI,QAAQ,WAAW,CAAC,CAKvD,EAAE,KAAK,SAAS,KAAK,MAAM;EAClC;CACD,EAAE,KAAK,IAAI;CAEX,IAAI,QAAQ,YAAY,cACvB,eAAO,IAAI,KAAK,KAAK;MAErB,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;AAEnC"}
|
package/dist/agents/hint.d.cts
CHANGED
|
@@ -31,15 +31,17 @@ interface AgentHintOptions {
|
|
|
31
31
|
* @returns Nothing; emits to the chosen channel as a side effect.
|
|
32
32
|
* @example
|
|
33
33
|
* ```typescript
|
|
34
|
-
*
|
|
34
|
+
* import * as agents from "@infracraft/pulumi/agents";
|
|
35
|
+
*
|
|
36
|
+
* agents.hint({
|
|
35
37
|
* project: [
|
|
36
|
-
* "
|
|
37
|
-
* "
|
|
38
|
+
* "Production is protected — `unprotect <urn>` first for a deliberate change",
|
|
39
|
+
* "Feature env = imports:[staging], zero config; pulumi destroy is safe",
|
|
38
40
|
* ],
|
|
39
41
|
* });
|
|
40
42
|
* ```
|
|
41
43
|
*/
|
|
42
|
-
declare function
|
|
44
|
+
declare function hint(options?: AgentHintOptions): void;
|
|
43
45
|
//#endregion
|
|
44
|
-
export { AgentHintOptions,
|
|
46
|
+
export { AgentHintOptions, hint };
|
|
45
47
|
//# sourceMappingURL=hint.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hint.d.cts","names":[],"sources":["../../src/agents/hint.ts"],"mappings":";;;;UAaiB,gBAAA;;EAEhB,OAAA;EAFgC;;;;EAQhC,OAAA;EAQA;;AAAO;
|
|
1
|
+
{"version":3,"file":"hint.d.cts","names":[],"sources":["../../src/agents/hint.ts"],"mappings":";;;;UAaiB,gBAAA;;EAEhB,OAAA;EAFgC;;;;EAQhC,OAAA;EAQA;;AAAO;AA0BR;;;EA1BC,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA0Be,IAAA,CAAK,OAA8B,GAArB,gBAAqB"}
|
package/dist/agents/hint.d.mts
CHANGED
|
@@ -31,15 +31,17 @@ interface AgentHintOptions {
|
|
|
31
31
|
* @returns Nothing; emits to the chosen channel as a side effect.
|
|
32
32
|
* @example
|
|
33
33
|
* ```typescript
|
|
34
|
-
*
|
|
34
|
+
* import * as agents from "@infracraft/pulumi/agents";
|
|
35
|
+
*
|
|
36
|
+
* agents.hint({
|
|
35
37
|
* project: [
|
|
36
|
-
* "
|
|
37
|
-
* "
|
|
38
|
+
* "Production is protected — `unprotect <urn>` first for a deliberate change",
|
|
39
|
+
* "Feature env = imports:[staging], zero config; pulumi destroy is safe",
|
|
38
40
|
* ],
|
|
39
41
|
* });
|
|
40
42
|
* ```
|
|
41
43
|
*/
|
|
42
|
-
declare function
|
|
44
|
+
declare function hint(options?: AgentHintOptions): void;
|
|
43
45
|
//#endregion
|
|
44
|
-
export { AgentHintOptions,
|
|
46
|
+
export { AgentHintOptions, hint };
|
|
45
47
|
//# sourceMappingURL=hint.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hint.d.mts","names":[],"sources":["../../src/agents/hint.ts"],"mappings":";;;;UAaiB,gBAAA;;EAEhB,OAAA;EAFgC;;;;EAQhC,OAAA;EAQA;;AAAO;
|
|
1
|
+
{"version":3,"file":"hint.d.mts","names":[],"sources":["../../src/agents/hint.ts"],"mappings":";;;;UAaiB,gBAAA;;EAEhB,OAAA;EAFgC;;;;EAQhC,OAAA;EAQA;;AAAO;AA0BR;;;EA1BC,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA0Be,IAAA,CAAK,OAA8B,GAArB,gBAAqB"}
|
package/dist/agents/hint.mjs
CHANGED
|
@@ -24,15 +24,17 @@ const INFRACRAFT_DEFAULTS = [
|
|
|
24
24
|
* @returns Nothing; emits to the chosen channel as a side effect.
|
|
25
25
|
* @example
|
|
26
26
|
* ```typescript
|
|
27
|
-
*
|
|
27
|
+
* import * as agents from "@infracraft/pulumi/agents";
|
|
28
|
+
*
|
|
29
|
+
* agents.hint({
|
|
28
30
|
* project: [
|
|
29
|
-
* "
|
|
30
|
-
* "
|
|
31
|
+
* "Production is protected — `unprotect <urn>` first for a deliberate change",
|
|
32
|
+
* "Feature env = imports:[staging], zero config; pulumi destroy is safe",
|
|
31
33
|
* ],
|
|
32
34
|
* });
|
|
33
35
|
* ```
|
|
34
36
|
*/
|
|
35
|
-
function
|
|
37
|
+
function hint(options = {}) {
|
|
36
38
|
if (!(options.enabled ?? (!!process.env.CLAUDECODE || !!process.env.AI_AGENT))) return;
|
|
37
39
|
const block = [
|
|
38
40
|
"<infracraft-hint>",
|
|
@@ -45,5 +47,5 @@ function agentHint(options = {}) {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
//#endregion
|
|
48
|
-
export {
|
|
50
|
+
export { hint };
|
|
49
51
|
//# sourceMappingURL=hint.mjs.map
|
package/dist/agents/hint.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hint.mjs","names":[],"sources":["../../src/agents/hint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Generic infracraft reminders, prepended to every hint. These hold for any\n * infracraft stack regardless of the consuming project.\n */\nconst INFRACRAFT_DEFAULTS = [\n\t\"Adopt-or-create: re-running is safe — existing resources are adopted, missing ones created\",\n\t\"Shared resources (Railway services/projects, Neon projects) have no-op deletes — destroy never removes them\",\n\t\"Mark shared/production resources protect:true — pulumi destroy aborts on protected resources\",\n];\n\n/** Options for {@link agentHint}. */\nexport interface AgentHintOptions {\n\t/** Project-specific reminders appended after the infracraft defaults. */\n\tproject?: string[];\n\n\t/**\n\t * Force the hint on or off. Defaults to auto-detecting an AI coding agent via\n\t * the `CLAUDECODE` / `AI_AGENT` environment variables.\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Where to write the hint. `\"stderr\"` (default) prints it prominently the\n\t * instant the program loads, before Pulumi's own output — modeled on how the\n\t * Vercel CLI surfaces agent guidance. `\"pulumi-log\"` routes it through\n\t * `pulumi.log.info` (lands in the Diagnostics section instead).\n\t */\n\tchannel?: \"stderr\" | \"pulumi-log\";\n}\n\n/**\n * Emits a delimited `<infracraft-hint>` block of reminders for AI coding agents\n * operating this Pulumi stack — modeled on Vercel's `AGENTS.md` guidance: a\n * delimited block, an agent-directed intro, then terse directive bullets.\n *\n * No-op for humans (no agent env var) unless `enabled` is forced. Call it once at\n * the top of your Pulumi program; the infracraft defaults are always included and\n * `project` lines are appended.\n *\n * @param options Project reminders, channel, and detection override.\n * @returns Nothing; emits to the chosen channel as a side effect.\n * @example\n * ```typescript\n *
|
|
1
|
+
{"version":3,"file":"hint.mjs","names":[],"sources":["../../src/agents/hint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Generic infracraft reminders, prepended to every hint. These hold for any\n * infracraft stack regardless of the consuming project.\n */\nconst INFRACRAFT_DEFAULTS = [\n\t\"Adopt-or-create: re-running is safe — existing resources are adopted, missing ones created\",\n\t\"Shared resources (Railway services/projects, Neon projects) have no-op deletes — destroy never removes them\",\n\t\"Mark shared/production resources protect:true — pulumi destroy aborts on protected resources\",\n];\n\n/** Options for {@link agentHint}. */\nexport interface AgentHintOptions {\n\t/** Project-specific reminders appended after the infracraft defaults. */\n\tproject?: string[];\n\n\t/**\n\t * Force the hint on or off. Defaults to auto-detecting an AI coding agent via\n\t * the `CLAUDECODE` / `AI_AGENT` environment variables.\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Where to write the hint. `\"stderr\"` (default) prints it prominently the\n\t * instant the program loads, before Pulumi's own output — modeled on how the\n\t * Vercel CLI surfaces agent guidance. `\"pulumi-log\"` routes it through\n\t * `pulumi.log.info` (lands in the Diagnostics section instead).\n\t */\n\tchannel?: \"stderr\" | \"pulumi-log\";\n}\n\n/**\n * Emits a delimited `<infracraft-hint>` block of reminders for AI coding agents\n * operating this Pulumi stack — modeled on Vercel's `AGENTS.md` guidance: a\n * delimited block, an agent-directed intro, then terse directive bullets.\n *\n * No-op for humans (no agent env var) unless `enabled` is forced. Call it once at\n * the top of your Pulumi program; the infracraft defaults are always included and\n * `project` lines are appended.\n *\n * @param options Project reminders, channel, and detection override.\n * @returns Nothing; emits to the chosen channel as a side effect.\n * @example\n * ```typescript\n * import * as agents from \"@infracraft/pulumi/agents\";\n *\n * agents.hint({\n * project: [\n * \"Production is protected — `unprotect <urn>` first for a deliberate change\",\n * \"Feature env = imports:[staging], zero config; pulumi destroy is safe\",\n * ],\n * });\n * ```\n */\nexport function hint(options: AgentHintOptions = {}): void {\n\tconst enabled =\n\t\toptions.enabled ?? (!!process.env.CLAUDECODE || !!process.env.AI_AGENT);\n\n\tif (!enabled) {\n\t\treturn;\n\t}\n\n\tconst lines = [...INFRACRAFT_DEFAULTS, ...(options.project ?? [])];\n\n\tconst block = [\n\t\t\"<infracraft-hint>\",\n\t\t\"Reminders for AI agents operating this Pulumi stack:\",\n\t\t...lines.map((line) => `- ${line}`),\n\t\t\"</infracraft-hint>\",\n\t].join(\"\\n\");\n\n\tif (options.channel === \"pulumi-log\") {\n\t\tpulumi.log.info(block);\n\t} else {\n\t\tprocess.stderr.write(`${block}\\n`);\n\t}\n}\n"],"mappings":";;;;;;;;AAMA,MAAM,sBAAsB;CAC3B;CACA;CACA;AACD;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,KAAK,UAA4B,CAAC,GAAS;CAI1D,IAAI,EAFH,QAAQ,YAAY,CAAC,CAAC,QAAQ,IAAI,cAAc,CAAC,CAAC,QAAQ,IAAI,YAG9D;CAKD,MAAM,QAAQ;EACb;EACA;EACA,GAAG,CALW,GAAG,qBAAqB,GAAI,QAAQ,WAAW,CAAC,CAKvD,EAAE,KAAK,SAAS,KAAK,MAAM;EAClC;CACD,EAAE,KAAK,IAAI;CAEX,IAAI,QAAQ,YAAY,cACvB,OAAO,IAAI,KAAK,KAAK;MAErB,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;AAEnC"}
|
package/dist/hash.cjs
CHANGED
|
@@ -4,6 +4,8 @@ let node_fs = require("node:fs");
|
|
|
4
4
|
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_chunk.__toESM(node_path, 1);
|
|
7
|
+
let _pulumi_pulumi = require("@pulumi/pulumi");
|
|
8
|
+
_pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
|
|
7
9
|
let node_crypto = require("node:crypto");
|
|
8
10
|
node_crypto = require_chunk.__toESM(node_crypto, 1);
|
|
9
11
|
|
|
@@ -16,9 +18,17 @@ const DEFAULT_IGNORE = new Set([
|
|
|
16
18
|
".git",
|
|
17
19
|
".vercel"
|
|
18
20
|
]);
|
|
19
|
-
function
|
|
21
|
+
function hash(input, options) {
|
|
22
|
+
if (typeof input !== "string") {
|
|
23
|
+
const keys = Object.keys(input).sort();
|
|
24
|
+
return _pulumi_pulumi.unsecret(_pulumi_pulumi.all(keys.map((key) => input[key])).apply((values) => {
|
|
25
|
+
const digest = node_crypto.createHash("sha256");
|
|
26
|
+
for (const [index, key] of keys.entries()) digest.update(`${key}=${values[index]}\0`);
|
|
27
|
+
return digest.digest("hex");
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
20
30
|
const ignore = options?.ignore ?? DEFAULT_IGNORE;
|
|
21
|
-
const
|
|
31
|
+
const digest = node_crypto.createHash("sha256");
|
|
22
32
|
function walk(currentPath) {
|
|
23
33
|
const entries = node_fs.readdirSync(currentPath, { withFileTypes: true });
|
|
24
34
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -26,15 +36,15 @@ function hashDirectory(dirPath, options) {
|
|
|
26
36
|
const fullPath = node_path.join(currentPath, entry.name);
|
|
27
37
|
if (entry.isDirectory()) walk(fullPath);
|
|
28
38
|
else if (entry.isFile()) {
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
digest.update(entry.name);
|
|
40
|
+
digest.update(node_fs.readFileSync(fullPath));
|
|
31
41
|
}
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
|
-
walk(
|
|
35
|
-
return
|
|
44
|
+
walk(input);
|
|
45
|
+
return digest.digest("hex");
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
//#endregion
|
|
39
|
-
exports.
|
|
49
|
+
exports.hash = hash;
|
|
40
50
|
//# sourceMappingURL=hash.cjs.map
|
package/dist/hash.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.cjs","names":["crypto","fs","path"],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\nexport function
|
|
1
|
+
{"version":3,"file":"hash.cjs","names":["pulumi","crypto","fs","path"],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\n/**\n * Produces a stable SHA-256 hex digest for use as a resource/deploy trigger,\n * from either a source directory or an environment map.\n *\n * - **Directory** (`string`): recursively hashes file names + contents (build\n * and VCS directories skipped). Synchronous — returns a plain `string`.\n * - **Env map** (`Record<string, Input<string>>`): resolves the values, sorts\n * by key, and hashes them into a single non-secret `Output<string>`. Passing\n * secret `Output`s straight into a dynamic resource's inputs intermittently\n * races Pulumi's gRPC secret serialization (`Unexpected struct type`, issue\n * #16041) — the reason such deploys otherwise need `--parallel 1`. Collapsing\n * the env to one `unsecret` digest keeps the trigger moving on any change\n * while carrying no secret, so deploys are safe to (re)create at full\n * parallelism. Exposing the digest is safe: it is a one-way hash of\n * high-entropy secrets.\n *\n * @param input A source directory path, or a map of env var name to value.\n * @param options Directory mode only: `ignore` overrides the default skip set.\n * @returns `string` for a directory, `Output<string>` for an env map.\n * @example\n * triggers: [hash(appDir), hash(env)]\n */\nexport function hash(directory: string, options?: HashOptions): string;\nexport function hash(\n\tenv: Record<string, pulumi.Input<string>>,\n): pulumi.Output<string>;\nexport function hash(\n\tinput: string | Record<string, pulumi.Input<string>>,\n\toptions?: HashOptions,\n): string | pulumi.Output<string> {\n\tif (typeof input !== \"string\") {\n\t\tconst keys = Object.keys(input).sort();\n\n\t\treturn pulumi.unsecret(\n\t\t\tpulumi.all(keys.map((key) => input[key])).apply((values) => {\n\t\t\t\tconst digest = crypto.createHash(\"sha256\");\n\n\t\t\t\tfor (const [index, key] of keys.entries()) {\n\t\t\t\t\tdigest.update(`${key}=${values[index]}\\0`);\n\t\t\t\t}\n\n\t\t\t\treturn digest.digest(\"hex\");\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst ignore = options?.ignore ?? DEFAULT_IGNORE;\n\tconst digest = crypto.createHash(\"sha256\");\n\n\tfunction walk(currentPath: string) {\n\t\tconst entries = fs.readdirSync(currentPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (ignore.has(entry.name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = path.join(currentPath, entry.name);\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\twalk(fullPath);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\tdigest.update(entry.name);\n\t\t\t\tdigest.update(fs.readFileSync(fullPath));\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(input);\n\n\treturn digest.digest(\"hex\");\n}\n"],"mappings":";;;;;;;;;;;;AAKA,MAAM,iBAAiB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAgCD,SAAgB,KACf,OACA,SACiC;CACjC,IAAI,OAAO,UAAU,UAAU;EAC9B,MAAM,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK;EAErC,OAAOA,eAAO,SACbA,eAAO,IAAI,KAAK,KAAK,QAAQ,MAAM,IAAI,CAAC,EAAE,OAAO,WAAW;GAC3D,MAAM,SAASC,YAAO,WAAW,QAAQ;GAEzC,KAAK,MAAM,CAAC,OAAO,QAAQ,KAAK,QAAQ,GACvC,OAAO,OAAO,GAAG,IAAI,GAAG,OAAO,OAAO,GAAG;GAG1C,OAAO,OAAO,OAAO,KAAK;EAC3B,CAAC,CACF;CACD;CAEA,MAAM,SAAS,SAAS,UAAU;CAClC,MAAM,SAASA,YAAO,WAAW,QAAQ;CAEzC,SAAS,KAAK,aAAqB;EAClC,MAAM,UAAUC,QAAG,YAAY,aAAa,EAAE,eAAe,KAAK,CAAC;EAEnE,KAAK,MAAM,SAAS,QAAQ,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC,GAAG;GACzE,IAAI,OAAO,IAAI,MAAM,IAAI,GACxB;GAGD,MAAM,WAAWC,UAAK,KAAK,aAAa,MAAM,IAAI;GAElD,IAAI,MAAM,YAAY,GACrB,KAAK,QAAQ;QACP,IAAI,MAAM,OAAO,GAAG;IAC1B,OAAO,OAAO,MAAM,IAAI;IACxB,OAAO,OAAOD,QAAG,aAAa,QAAQ,CAAC;GACxC;EACD;CACD;CAEA,KAAK,KAAK;CAEV,OAAO,OAAO,OAAO,KAAK;AAC3B"}
|
package/dist/hash.d.cts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-OPjESj5l.cjs";
|
|
2
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
3
|
|
|
3
4
|
//#region src/hash.d.ts
|
|
4
5
|
interface HashOptions {
|
|
5
6
|
ignore?: Set<string>;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Produces a stable SHA-256 hex digest for use as a resource/deploy trigger,
|
|
10
|
+
* from either a source directory or an environment map.
|
|
11
|
+
*
|
|
12
|
+
* - **Directory** (`string`): recursively hashes file names + contents (build
|
|
13
|
+
* and VCS directories skipped). Synchronous — returns a plain `string`.
|
|
14
|
+
* - **Env map** (`Record<string, Input<string>>`): resolves the values, sorts
|
|
15
|
+
* by key, and hashes them into a single non-secret `Output<string>`. Passing
|
|
16
|
+
* secret `Output`s straight into a dynamic resource's inputs intermittently
|
|
17
|
+
* races Pulumi's gRPC secret serialization (`Unexpected struct type`, issue
|
|
18
|
+
* #16041) — the reason such deploys otherwise need `--parallel 1`. Collapsing
|
|
19
|
+
* the env to one `unsecret` digest keeps the trigger moving on any change
|
|
20
|
+
* while carrying no secret, so deploys are safe to (re)create at full
|
|
21
|
+
* parallelism. Exposing the digest is safe: it is a one-way hash of
|
|
22
|
+
* high-entropy secrets.
|
|
23
|
+
*
|
|
24
|
+
* @param input A source directory path, or a map of env var name to value.
|
|
25
|
+
* @param options Directory mode only: `ignore` overrides the default skip set.
|
|
26
|
+
* @returns `string` for a directory, `Output<string>` for an env map.
|
|
27
|
+
* @example
|
|
28
|
+
* triggers: [hash(appDir), hash(env)]
|
|
29
|
+
*/
|
|
30
|
+
declare function hash(directory: string, options?: HashOptions): string;
|
|
31
|
+
declare function hash(env: Record<string, pulumi.Input<string>>): pulumi.Output<string>;
|
|
8
32
|
//#endregion
|
|
9
|
-
export {
|
|
33
|
+
export { hash };
|
|
10
34
|
//# sourceMappingURL=hash.d.cts.map
|
package/dist/hash.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.cts","names":[],"sources":["../src/hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.cts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;UAcU,WAAA;EACT,MAAA,GAAS,GAAG;AAAA;AAZ4B;;;;AAY5B;AAyBb;;;;;;;;AAA6D;AAC7D;;;;;;;;AAtCyC,iBAqCzB,IAAA,CAAK,SAAA,UAAmB,OAAA,GAAU,WAAW;AAAA,iBAC7C,IAAA,CACf,GAAA,EAAK,MAAA,SAAe,MAAA,CAAO,KAAA,YACzB,MAAA,CAAO,MAAA"}
|
package/dist/hash.d.mts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
3
|
|
|
3
4
|
//#region src/hash.d.ts
|
|
4
5
|
interface HashOptions {
|
|
5
6
|
ignore?: Set<string>;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Produces a stable SHA-256 hex digest for use as a resource/deploy trigger,
|
|
10
|
+
* from either a source directory or an environment map.
|
|
11
|
+
*
|
|
12
|
+
* - **Directory** (`string`): recursively hashes file names + contents (build
|
|
13
|
+
* and VCS directories skipped). Synchronous — returns a plain `string`.
|
|
14
|
+
* - **Env map** (`Record<string, Input<string>>`): resolves the values, sorts
|
|
15
|
+
* by key, and hashes them into a single non-secret `Output<string>`. Passing
|
|
16
|
+
* secret `Output`s straight into a dynamic resource's inputs intermittently
|
|
17
|
+
* races Pulumi's gRPC secret serialization (`Unexpected struct type`, issue
|
|
18
|
+
* #16041) — the reason such deploys otherwise need `--parallel 1`. Collapsing
|
|
19
|
+
* the env to one `unsecret` digest keeps the trigger moving on any change
|
|
20
|
+
* while carrying no secret, so deploys are safe to (re)create at full
|
|
21
|
+
* parallelism. Exposing the digest is safe: it is a one-way hash of
|
|
22
|
+
* high-entropy secrets.
|
|
23
|
+
*
|
|
24
|
+
* @param input A source directory path, or a map of env var name to value.
|
|
25
|
+
* @param options Directory mode only: `ignore` overrides the default skip set.
|
|
26
|
+
* @returns `string` for a directory, `Output<string>` for an env map.
|
|
27
|
+
* @example
|
|
28
|
+
* triggers: [hash(appDir), hash(env)]
|
|
29
|
+
*/
|
|
30
|
+
declare function hash(directory: string, options?: HashOptions): string;
|
|
31
|
+
declare function hash(env: Record<string, pulumi.Input<string>>): pulumi.Output<string>;
|
|
8
32
|
//#endregion
|
|
9
|
-
export {
|
|
33
|
+
export { hash };
|
|
10
34
|
//# sourceMappingURL=hash.d.mts.map
|
package/dist/hash.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.mts","names":[],"sources":["../src/hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.mts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;UAcU,WAAA;EACT,MAAA,GAAS,GAAG;AAAA;AAZ4B;;;;AAY5B;AAyBb;;;;;;;;AAA6D;AAC7D;;;;;;;;AAtCyC,iBAqCzB,IAAA,CAAK,SAAA,UAAmB,OAAA,GAAU,WAAW;AAAA,iBAC7C,IAAA,CACf,GAAA,EAAK,MAAA,SAAe,MAAA,CAAO,KAAA,YACzB,MAAA,CAAO,MAAA"}
|
package/dist/hash.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
4
5
|
import * as crypto from "node:crypto";
|
|
5
6
|
|
|
6
7
|
//#region src/hash.ts
|
|
@@ -12,9 +13,17 @@ const DEFAULT_IGNORE = new Set([
|
|
|
12
13
|
".git",
|
|
13
14
|
".vercel"
|
|
14
15
|
]);
|
|
15
|
-
function
|
|
16
|
+
function hash(input, options) {
|
|
17
|
+
if (typeof input !== "string") {
|
|
18
|
+
const keys = Object.keys(input).sort();
|
|
19
|
+
return pulumi.unsecret(pulumi.all(keys.map((key) => input[key])).apply((values) => {
|
|
20
|
+
const digest = crypto.createHash("sha256");
|
|
21
|
+
for (const [index, key] of keys.entries()) digest.update(`${key}=${values[index]}\0`);
|
|
22
|
+
return digest.digest("hex");
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
16
25
|
const ignore = options?.ignore ?? DEFAULT_IGNORE;
|
|
17
|
-
const
|
|
26
|
+
const digest = crypto.createHash("sha256");
|
|
18
27
|
function walk(currentPath) {
|
|
19
28
|
const entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
20
29
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -22,15 +31,15 @@ function hashDirectory(dirPath, options) {
|
|
|
22
31
|
const fullPath = path.join(currentPath, entry.name);
|
|
23
32
|
if (entry.isDirectory()) walk(fullPath);
|
|
24
33
|
else if (entry.isFile()) {
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
digest.update(entry.name);
|
|
35
|
+
digest.update(fs.readFileSync(fullPath));
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
|
-
walk(
|
|
31
|
-
return
|
|
39
|
+
walk(input);
|
|
40
|
+
return digest.digest("hex");
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
//#endregion
|
|
35
|
-
export {
|
|
44
|
+
export { hash };
|
|
36
45
|
//# sourceMappingURL=hash.mjs.map
|
package/dist/hash.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.mjs","names":[],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\nexport function
|
|
1
|
+
{"version":3,"file":"hash.mjs","names":[],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\n/**\n * Produces a stable SHA-256 hex digest for use as a resource/deploy trigger,\n * from either a source directory or an environment map.\n *\n * - **Directory** (`string`): recursively hashes file names + contents (build\n * and VCS directories skipped). Synchronous — returns a plain `string`.\n * - **Env map** (`Record<string, Input<string>>`): resolves the values, sorts\n * by key, and hashes them into a single non-secret `Output<string>`. Passing\n * secret `Output`s straight into a dynamic resource's inputs intermittently\n * races Pulumi's gRPC secret serialization (`Unexpected struct type`, issue\n * #16041) — the reason such deploys otherwise need `--parallel 1`. Collapsing\n * the env to one `unsecret` digest keeps the trigger moving on any change\n * while carrying no secret, so deploys are safe to (re)create at full\n * parallelism. Exposing the digest is safe: it is a one-way hash of\n * high-entropy secrets.\n *\n * @param input A source directory path, or a map of env var name to value.\n * @param options Directory mode only: `ignore` overrides the default skip set.\n * @returns `string` for a directory, `Output<string>` for an env map.\n * @example\n * triggers: [hash(appDir), hash(env)]\n */\nexport function hash(directory: string, options?: HashOptions): string;\nexport function hash(\n\tenv: Record<string, pulumi.Input<string>>,\n): pulumi.Output<string>;\nexport function hash(\n\tinput: string | Record<string, pulumi.Input<string>>,\n\toptions?: HashOptions,\n): string | pulumi.Output<string> {\n\tif (typeof input !== \"string\") {\n\t\tconst keys = Object.keys(input).sort();\n\n\t\treturn pulumi.unsecret(\n\t\t\tpulumi.all(keys.map((key) => input[key])).apply((values) => {\n\t\t\t\tconst digest = crypto.createHash(\"sha256\");\n\n\t\t\t\tfor (const [index, key] of keys.entries()) {\n\t\t\t\t\tdigest.update(`${key}=${values[index]}\\0`);\n\t\t\t\t}\n\n\t\t\t\treturn digest.digest(\"hex\");\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst ignore = options?.ignore ?? DEFAULT_IGNORE;\n\tconst digest = crypto.createHash(\"sha256\");\n\n\tfunction walk(currentPath: string) {\n\t\tconst entries = fs.readdirSync(currentPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (ignore.has(entry.name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = path.join(currentPath, entry.name);\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\twalk(fullPath);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\tdigest.update(entry.name);\n\t\t\t\tdigest.update(fs.readFileSync(fullPath));\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(input);\n\n\treturn digest.digest(\"hex\");\n}\n"],"mappings":";;;;;;;AAKA,MAAM,iBAAiB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAgCD,SAAgB,KACf,OACA,SACiC;CACjC,IAAI,OAAO,UAAU,UAAU;EAC9B,MAAM,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK;EAErC,OAAO,OAAO,SACb,OAAO,IAAI,KAAK,KAAK,QAAQ,MAAM,IAAI,CAAC,EAAE,OAAO,WAAW;GAC3D,MAAM,SAAS,OAAO,WAAW,QAAQ;GAEzC,KAAK,MAAM,CAAC,OAAO,QAAQ,KAAK,QAAQ,GACvC,OAAO,OAAO,GAAG,IAAI,GAAG,OAAO,OAAO,GAAG;GAG1C,OAAO,OAAO,OAAO,KAAK;EAC3B,CAAC,CACF;CACD;CAEA,MAAM,SAAS,SAAS,UAAU;CAClC,MAAM,SAAS,OAAO,WAAW,QAAQ;CAEzC,SAAS,KAAK,aAAqB;EAClC,MAAM,UAAU,GAAG,YAAY,aAAa,EAAE,eAAe,KAAK,CAAC;EAEnE,KAAK,MAAM,SAAS,QAAQ,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC,GAAG;GACzE,IAAI,OAAO,IAAI,MAAM,IAAI,GACxB;GAGD,MAAM,WAAW,KAAK,KAAK,aAAa,MAAM,IAAI;GAElD,IAAI,MAAM,YAAY,GACrB,KAAK,QAAQ;QACP,IAAI,MAAM,OAAO,GAAG;IAC1B,OAAO,OAAO,MAAM,IAAI;IACxB,OAAO,OAAO,GAAG,aAAa,QAAQ,CAAC;GACxC;EACD;CACD;CAEA,KAAK,KAAK;CAEV,OAAO,OAAO,OAAO,KAAK;AAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infracraft/pulumi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"types": "./dist/fly/index.d.mts",
|
|
26
26
|
"default": "./dist/fly/index.mjs"
|
|
27
27
|
},
|
|
28
|
-
"./agents
|
|
29
|
-
"types": "./dist/agents/
|
|
30
|
-
"default": "./dist/agents/
|
|
28
|
+
"./agents": {
|
|
29
|
+
"types": "./dist/agents/index.d.mts",
|
|
30
|
+
"default": "./dist/agents/index.mjs"
|
|
31
31
|
},
|
|
32
32
|
"./hash": {
|
|
33
33
|
"types": "./dist/hash.d.mts",
|