sdk-environment 0.1.3 → 0.1.4
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/bin/run +16 -0
- package/bin/run.bun.sdk-environment.bc +0 -0
- package/dist/contract/cli/getCommit.d.ts +5 -0
- package/dist/contract/cli/getCommit.js +25 -0
- package/dist/contract/cli/getCommit.js.map +1 -0
- package/dist/contract/cli/invoke.d.ts +1 -0
- package/dist/contract/cli/invoke.js +12 -0
- package/dist/contract/cli/invoke.js.map +1 -0
- package/package.json +21 -6
package/bin/run
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
######################################################################
|
|
3
|
+
# .what = bash shim to invoke bun-compiled cli binary
|
|
4
|
+
# .why = enables symlink resolution from node_modules/.bin/
|
|
5
|
+
######################################################################
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
BIN="${BASH_SOURCE[0]}"
|
|
9
|
+
while [ -L "$BIN" ]; do
|
|
10
|
+
BIN_DIR="$(cd "$(dirname "$BIN")" && pwd)"
|
|
11
|
+
BIN="$(readlink "$BIN")"
|
|
12
|
+
[[ "$BIN" != /* ]] && BIN="$BIN_DIR/$BIN"
|
|
13
|
+
done
|
|
14
|
+
BIN_DIR="$(cd "$(dirname "$BIN")" && pwd)"
|
|
15
|
+
|
|
16
|
+
exec "$BIN_DIR/run.bun.sdk-environment.bc" "$@"
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommit = void 0;
|
|
4
|
+
const getEnvCommitFromGit_1 = require("../../domain.operations/parsers/commit/getEnvCommitFromGit");
|
|
5
|
+
/**
|
|
6
|
+
* .what = outputs commit slug to stdout for cli capture
|
|
7
|
+
* .why = consumers need canonical commit format at deploy time
|
|
8
|
+
*/
|
|
9
|
+
const getCommit = () => {
|
|
10
|
+
try {
|
|
11
|
+
const slug = getEnvCommitFromGit_1.getEnvCommitFromGit.sync();
|
|
12
|
+
if (!slug) {
|
|
13
|
+
process.stderr.write('error: could not determine commit (not a git repo or no ref found)\n');
|
|
14
|
+
process.exit(2);
|
|
15
|
+
}
|
|
16
|
+
process.stdout.write(`${slug}\n`);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
process.stderr.write(`error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.getCommit = getCommit;
|
|
25
|
+
//# sourceMappingURL=getCommit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCommit.js","sourceRoot":"","sources":["../../../src/contract/cli/getCommit.ts"],"names":[],"mappings":";;;AAAA,oGAAiG;AAEjG;;;GAGG;AACI,MAAM,SAAS,GAAG,GAAS,EAAE;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,yCAAmB,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sEAAsE,CACvE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CACrE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,SAAS,aAiBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getCommit_1 = require("./getCommit");
|
|
4
|
+
const [, , cmd, subcmd] = process.argv;
|
|
5
|
+
if (cmd === 'get' && subcmd === 'commit') {
|
|
6
|
+
(0, getCommit_1.getCommit)();
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
process.stderr.write('unknown command\n');
|
|
10
|
+
process.exit(2);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../../src/contract/cli/invoke.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AAExC,MAAM,CAAC,EAAE,AAAD,EAAG,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;AAEvC,IAAI,GAAG,KAAK,KAAK,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;IACzC,IAAA,qBAAS,GAAE,CAAC;AACd,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "sdk-environment",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "parse and expose the environment your code runs in",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.4",
|
|
6
6
|
"repository": "ehmpathy/sdk-environment",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/sdk-environment",
|
|
8
8
|
"keywords": [
|
|
@@ -16,11 +16,15 @@
|
|
|
16
16
|
"bugs": "https://github.com/ehmpathy/sdk-environment/issues",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"main": "dist/index.js",
|
|
19
|
+
"bin": {
|
|
20
|
+
"sdk-environment": "./bin/run"
|
|
21
|
+
},
|
|
19
22
|
"engines": {
|
|
20
23
|
"node": ">=8.0.0"
|
|
21
24
|
},
|
|
22
25
|
"files": [
|
|
23
|
-
"/dist"
|
|
26
|
+
"/dist",
|
|
27
|
+
"/bin"
|
|
24
28
|
],
|
|
25
29
|
"scripts": {
|
|
26
30
|
"build:ts": "tsc -p ./tsconfig.build.json",
|
|
@@ -33,6 +37,10 @@
|
|
|
33
37
|
"build:clean:tsc": "(chmod -R u+w dist 2>/dev/null || true) && rm -rf dist/",
|
|
34
38
|
"build:clean": "npm run build:clean:tsc && npm run build:clean:bun",
|
|
35
39
|
"build:compile:tsc": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
|
|
40
|
+
"build:compile:bun": "npm run build:compile:bun:check:before && npm run build:compile:bun:run && npm run build:compile:bun:check:after",
|
|
41
|
+
"build:compile:bun:check:before": "echo '🔍 bun check...' && BUN_VERSION=$(bun --version) && [ -n \"$BUN_VERSION\" ] && echo \"👌 bun installed: $BUN_VERSION\" || (echo '⛈️ bun not functional' && exit 1)",
|
|
42
|
+
"build:compile:bun:check:after": "test -f ./bin/run.bun.sdk-environment.bc && echo '👌 .bc file created' || (echo '⛈️ .bc file not found' && ls -la ./bin/ && exit 1)",
|
|
43
|
+
"build:compile:bun:run": "bun build ./src/contract/cli/invoke.ts --compile --bytecode --outfile ./bin/run.bun.sdk-environment.bc",
|
|
36
44
|
"build:compile": "npm run build:compile:tsc && npm run build:compile:bun --if-present",
|
|
37
45
|
"build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
|
|
38
46
|
"test:auth": "[ \"$ECHO\" = 'true' ] && echo '. .agent/repo=.this/role=any/skills/use.apikeys.sh' || . .agent/repo=.this/role=any/skills/use.apikeys.sh",
|
|
@@ -54,7 +62,7 @@
|
|
|
54
62
|
"preversion": "npm run prepush",
|
|
55
63
|
"postversion": "git push origin HEAD --tags --no-verify",
|
|
56
64
|
"prepare:husky": "husky install && chmod ug+x .husky/*",
|
|
57
|
-
"prepare:rhachet": "rhachet init --hooks --roles behaver mechanic reviewer",
|
|
65
|
+
"prepare:rhachet": "npm run build && rhachet init --hooks --roles behaver mechanic reviewer",
|
|
58
66
|
"prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
|
|
59
67
|
"upgrade:rhachet": "rhachet upgrade"
|
|
60
68
|
},
|
|
@@ -65,7 +73,9 @@
|
|
|
65
73
|
"with-simple-cache": "0.15.3"
|
|
66
74
|
},
|
|
67
75
|
"devDependencies": {
|
|
76
|
+
"sdk-environment": "link:.",
|
|
68
77
|
"@biomejs/biome": "2.3.8",
|
|
78
|
+
"bun": "1.3.5",
|
|
69
79
|
"@commitlint/cli": "19.5.0",
|
|
70
80
|
"@commitlint/config-conventional": "19.5.0",
|
|
71
81
|
"@swc/core": "1.15.3",
|
|
@@ -87,12 +97,12 @@
|
|
|
87
97
|
"helpful-errors": "1.5.3",
|
|
88
98
|
"husky": "8.0.3",
|
|
89
99
|
"jest": "30.2.0",
|
|
90
|
-
"rhachet": "1.41.
|
|
100
|
+
"rhachet": "1.41.11",
|
|
91
101
|
"rhachet-brains-anthropic": "0.4.1",
|
|
92
102
|
"rhachet-brains-xai": "0.3.3",
|
|
93
103
|
"rhachet-roles-bhrain": "0.27.6",
|
|
94
104
|
"rhachet-roles-bhuild": "0.21.9",
|
|
95
|
-
"rhachet-roles-ehmpathy": "1.35.
|
|
105
|
+
"rhachet-roles-ehmpathy": "1.35.6",
|
|
96
106
|
"test-fns": "1.7.2",
|
|
97
107
|
"ts-jest": "29.1.3",
|
|
98
108
|
"ts-node": "10.9.2",
|
|
@@ -106,5 +116,10 @@
|
|
|
106
116
|
"path": "./node_modules/cz-conventional-changelog"
|
|
107
117
|
}
|
|
108
118
|
},
|
|
109
|
-
"packageManager": "pnpm@10.24.0"
|
|
119
|
+
"packageManager": "pnpm@10.24.0",
|
|
120
|
+
"pnpm": {
|
|
121
|
+
"onlyBuiltDependencies": [
|
|
122
|
+
"bun"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
110
125
|
}
|