@cleartrip/frontguard 0.1.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/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@cleartrip/frontguard",
3
+ "version": "0.1.0",
4
+ "description": "Org-wide frontend PR guardrails: linting, hygiene, any-delta, cycles, dead code, bundle/CWV hints, custom rules, optional LLM brief",
5
+ "type": "module",
6
+ "bin": {
7
+ "frontguard": "./dist/cli.js"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "templates"
21
+ ],
22
+ "engines": {
23
+ "node": ">=18.17.0"
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "dev": "tsup --watch",
28
+ "typecheck": "tsc --noEmit",
29
+ "format": "prettier --write .",
30
+ "prepack": "npm run build"
31
+ },
32
+ "keywords": [
33
+ "eslint",
34
+ "ci",
35
+ "pull-request",
36
+ "frontend",
37
+ "guardrails"
38
+ ],
39
+ "license": "MIT",
40
+ "dependencies": {
41
+ "citty": "^0.1.6",
42
+ "defu": "^6.1.4",
43
+ "fast-glob": "^3.3.3",
44
+ "picocolors": "^1.1.1",
45
+ "tinyexec": "^1.0.1"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.14.0",
49
+ "prettier": "^3.5.3",
50
+ "tsup": "^8.4.0",
51
+ "typescript": "^5.8.2"
52
+ }
53
+ }
@@ -0,0 +1,44 @@
1
+ # FrontGuard + PR comment (Bitbucket Cloud)
2
+ #
3
+ # Per-repo setup:
4
+ # 1. Repository settings → Repository variables → add SECURED variable:
5
+ # Name: BITBUCKET_ACCESS_TOKEN
6
+ # Value: API token with permission to comment on pull requests (rotate if ever leaked).
7
+ # 2. Add @cleartrip/frontguard as a devDependency and commit this as bitbucket-pipelines.yml
8
+ # at the repository root, or merge the pull-requests section into your existing pipelines file.
9
+ #
10
+ # URL shape matches your example; workspace/repo comes from BITBUCKET_REPO_FULL_NAME so the same
11
+ # file works for cleartrip/ct-pwa2.0 and every other repo.
12
+ #
13
+ # Duplicate comments: each run adds a new comment. To upsert one comment, add a script that
14
+ # GETs /pullrequests/{id}/comments and DELETEs or updates the previous FrontGuard comment.
15
+
16
+ image: node:20
17
+
18
+ pipelines:
19
+ pull-requests:
20
+ '**':
21
+ - step:
22
+ name: FrontGuard – post review on PR
23
+ caches:
24
+ - node
25
+ script:
26
+ - corepack enable
27
+ - yarn install --immutable || yarn install
28
+ - yarn frontguard run --markdown > frontguard-report.md
29
+ - |
30
+ python3 << 'PY'
31
+ import json
32
+ with open("frontguard-report.md", encoding="utf-8") as f:
33
+ body = f.read()
34
+ with open("frontguard-payload.json", "w", encoding="utf-8") as out:
35
+ json.dump({"content": {"raw": body}}, out, ensure_ascii=False)
36
+ PY
37
+ - |
38
+ test -n "${BITBUCKET_ACCESS_TOKEN:-}" || { echo "Missing secured var BITBUCKET_ACCESS_TOKEN"; exit 1; }
39
+ curl --silent --show-error --fail --request POST \
40
+ --url "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_FULL_NAME}/pullrequests/${BITBUCKET_PR_ID}/comments" \
41
+ --header 'Accept: application/json' \
42
+ --header 'Content-Type: application/json' \
43
+ --header "Authorization: Bearer ${BITBUCKET_ACCESS_TOKEN}" \
44
+ --data @frontguard-payload.json