@precisa-saude/cli 1.6.0 → 1.6.1

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.
@@ -15,6 +15,14 @@ You will receive a PR number. If not provided, detect it from the current branch
15
15
  gh pr view --json number --jq '.number'
16
16
  ```
17
17
 
18
+ Resolve the current repository once and reuse it throughout the workflow:
19
+
20
+ ```bash
21
+ REPO="${GITHUB_REPOSITORY:-$(gh repo view --json nameWithOwner --jq '.nameWithOwner')}"
22
+ OWNER="${REPO%%/*}"
23
+ NAME="${REPO#*/}"
24
+ ```
25
+
18
26
  ## Workflow
19
27
 
20
28
  Follow these steps exactly:
@@ -22,7 +30,7 @@ Follow these steps exactly:
22
30
  ### Step 1: Fetch all inline comments
23
31
 
24
32
  ```bash
25
- gh api repos/Precisa-Saude/platform/pulls/<PR_NUMBER>/comments \
33
+ gh api "repos/$REPO/pulls/<PR_NUMBER>/comments" \
26
34
  --jq '.[] | "\(.id) | \(.path):\(.line // .original_line) | \(.body)"'
27
35
  ```
28
36
 
@@ -46,26 +54,28 @@ For "Fix" items:
46
54
  Use the replies endpoint (NOT the comments endpoint):
47
55
 
48
56
  ```bash
49
- gh api repos/Precisa-Saude/platform/pulls/<PR_NUMBER>/comments/<COMMENT_ID>/replies \
57
+ gh api "repos/$REPO/pulls/<PR_NUMBER>/comments/<COMMENT_ID>/replies" \
50
58
  -f body="Fixed in upcoming commit - <explanation>"
51
59
  ```
52
60
 
53
61
  For "Won't fix" items, provide clear rationale:
54
62
 
55
63
  ```bash
56
- gh api repos/Precisa-Saude/platform/pulls/<PR_NUMBER>/comments/<COMMENT_ID>/replies \
64
+ gh api "repos/$REPO/pulls/<PR_NUMBER>/comments/<COMMENT_ID>/replies" \
57
65
  -f body="Won't fix - <rationale>"
58
66
  ```
59
67
 
60
68
  ### Step 5: Resolve all threads
61
69
 
62
- First, get thread IDs:
70
+ First, get thread IDs (pass owner/name as GraphQL variables via `-F`):
63
71
 
64
72
  ```bash
65
- gh api graphql -f query='
66
- query {
67
- repository(owner: "Precisa-Saude", name: "platform") {
68
- pullRequest(number: <PR_NUMBER>) {
73
+ gh api graphql \
74
+ -F owner="$OWNER" -F name="$NAME" -F number=<PR_NUMBER> \
75
+ -f query='
76
+ query($owner: String!, $name: String!, $number: Int!) {
77
+ repository(owner: $owner, name: $name) {
78
+ pullRequest(number: $number) {
69
79
  reviewThreads(first: 50) {
70
80
  nodes {
71
81
  id
@@ -101,10 +111,7 @@ Stage all modified files for a single commit. Do NOT create the commit — the u
101
111
  - **Batch all replies and resolves** into minimal Bash calls. Do not make individual tool calls per comment.
102
112
  - **Reply and resolve BEFORE pushing** — this prevents the reviewer from running again on push.
103
113
  - **Never add AI attribution** to replies or commits.
104
- - **Run lint and typecheck** on affected packages after making changes:
105
- ```bash
106
- pnpm turbo run lint typecheck --filter=@precisasaude/<package>
107
- ```
114
+ - **Run lint and typecheck** on affected packages after making changes.
108
115
  - **Ask before committing** — stage changes but let the user decide on commit message and timing.
109
116
 
110
117
  ## Output
@@ -245,11 +245,3 @@ templates:
245
245
  target: .github/workflows/doctor.yml
246
246
  required_when: always
247
247
  merge_strategy: overwrite
248
-
249
- # Standalone release workflow (alternative to _release+_publish split)
250
- # for tooling-style monorepos. Gated off by default; consumers choose
251
- # one or the other.
252
- - source: github/workflows/release.yml
253
- target: .github/workflows/release.yml
254
- required_when: never
255
- merge_strategy: overwrite
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@precisa-saude/cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Bootstrap and sync Precisa Saúde repositories — the `precisa` CLI.",
5
5
  "keywords": [
6
6
  "cli",
@@ -45,7 +45,7 @@
45
45
  "@types/prompts": "^2.4.9",
46
46
  "tsup": "^8.3.5",
47
47
  "typescript": "~5.7.3",
48
- "@precisa-saude/tsconfig": "1.6.0"
48
+ "@precisa-saude/tsconfig": "1.6.1"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=22.0.0"
@@ -1,76 +0,0 @@
1
- name: Release
2
-
3
- # Release standalone para repos que publicam pacotes SEM site associado
4
- # (ex.: tooling). Repos que têm site costumam integrar release+publish no
5
- # ci.yml — veja ci.yml do template.
6
-
7
- on:
8
- push:
9
- branches: [main]
10
- # Weekly cadence — picks up any docs/CI/chore commits that semantic-
11
- # release normally wouldn't promote. Ensures consumers stay within
12
- # one minor of the current HEAD even during low-commit weeks.
13
- # semantic-release is a no-op when there are no releasable commits,
14
- # so this is safe to run unconditionally.
15
- schedule:
16
- - cron: '0 9 * * 1'
17
- workflow_dispatch:
18
-
19
- concurrency:
20
- group: release-${{ github.ref }}
21
- cancel-in-progress: false
22
-
23
- jobs:
24
- release:
25
- name: semantic-release
26
- runs-on: ubuntu-latest
27
- # `id-token: write` is for Sigstore attestations (`--provenance`),
28
- # not for npm auth. npm auth uses the `NPM_TOKEN` org-secret.
29
- permissions:
30
- contents: write
31
- issues: write
32
- pull-requests: write
33
- id-token: write
34
- steps:
35
- - uses: actions/checkout@v6
36
- with:
37
- fetch-depth: 0
38
- persist-credentials: false
39
-
40
- - uses: pnpm/action-setup@v4
41
-
42
- - uses: actions/setup-node@v6
43
- with:
44
- node-version: 22
45
- cache: 'pnpm'
46
- registry-url: 'https://registry.npmjs.org'
47
-
48
- - name: Install dependencies
49
- run: pnpm install --frozen-lockfile
50
-
51
- - name: Build
52
- run: pnpm -r build
53
-
54
- - name: Configure npm auth
55
- # `actions/setup-node` writes `~/.npmrc` with a literal
56
- # `${NODE_AUTH_TOKEN}` placeholder that `npm` expands at publish
57
- # time, but `pnpm publish` (used by semantic-release's
58
- # `publishCmd`) doesn't always expand it. Write the resolved
59
- # token directly so pnpm reads it unambiguously. Lives in $HOME
60
- # so it doesn't pollute the working tree.
61
- env:
62
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
63
- run: |
64
- if [ -z "${NPM_TOKEN}" ]; then
65
- echo "::error::NPM_TOKEN secret is not configured"
66
- exit 1
67
- fi
68
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > "${HOME}/.npmrc"
69
- echo "registry=https://registry.npmjs.org/" >> "${HOME}/.npmrc"
70
-
71
- - name: Release
72
- env:
73
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
75
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76
- run: pnpm exec semantic-release