@alwaysmeticulous/cli 2.331.3 → 2.332.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/README.md +16 -0
- package/dist/commands/onboard/__tests__/print-next-steps.spec.d.ts +2 -0
- package/dist/commands/onboard/__tests__/print-next-steps.spec.d.ts.map +1 -0
- package/dist/commands/onboard/__tests__/print-next-steps.spec.js +67 -0
- package/dist/commands/onboard/__tests__/print-next-steps.spec.js.map +1 -0
- package/dist/commands/onboard/__tests__/resolve-project.spec.d.ts +2 -0
- package/dist/commands/onboard/__tests__/resolve-project.spec.d.ts.map +1 -0
- package/dist/commands/onboard/__tests__/resolve-project.spec.js +44 -0
- package/dist/commands/onboard/__tests__/resolve-project.spec.js.map +1 -0
- package/dist/commands/onboard/__tests__/skills-install-choice.spec.d.ts +2 -0
- package/dist/commands/onboard/__tests__/skills-install-choice.spec.d.ts.map +1 -0
- package/dist/commands/onboard/__tests__/skills-install-choice.spec.js +51 -0
- package/dist/commands/onboard/__tests__/skills-install-choice.spec.js.map +1 -0
- package/dist/commands/onboard/__tests__/validate-ci-yaml.spec.d.ts +2 -0
- package/dist/commands/onboard/__tests__/validate-ci-yaml.spec.d.ts.map +1 -0
- package/dist/commands/onboard/__tests__/validate-ci-yaml.spec.js +112 -0
- package/dist/commands/onboard/__tests__/validate-ci-yaml.spec.js.map +1 -0
- package/dist/commands/onboard/build-context.d.ts +1 -0
- package/dist/commands/onboard/build-context.d.ts.map +1 -1
- package/dist/commands/onboard/build-context.js +6 -6
- package/dist/commands/onboard/build-context.js.map +1 -1
- package/dist/commands/onboard/customer-agents.json +0 -1
- package/dist/commands/onboard/customer-docs.json +1 -0
- package/dist/commands/onboard/docs-urls.d.ts +2 -0
- package/dist/commands/onboard/docs-urls.d.ts.map +1 -1
- package/dist/commands/onboard/docs-urls.js +5 -3
- package/dist/commands/onboard/docs-urls.js.map +1 -1
- package/dist/commands/onboard/index.d.ts.map +1 -1
- package/dist/commands/onboard/index.js +8 -6
- package/dist/commands/onboard/index.js.map +1 -1
- package/dist/commands/onboard/launch-agent.d.ts +1 -0
- package/dist/commands/onboard/launch-agent.d.ts.map +1 -1
- package/dist/commands/onboard/launch-agent.js +26 -15
- package/dist/commands/onboard/launch-agent.js.map +1 -1
- package/dist/commands/onboard/resolve-project.d.ts +9 -1
- package/dist/commands/onboard/resolve-project.d.ts.map +1 -1
- package/dist/commands/onboard/resolve-project.js +26 -4
- package/dist/commands/onboard/resolve-project.js.map +1 -1
- package/dist/commands/onboard/setup-agent-integrations.d.ts +2 -1
- package/dist/commands/onboard/setup-agent-integrations.d.ts.map +1 -1
- package/dist/commands/onboard/setup-agent-integrations.js +32 -7
- package/dist/commands/onboard/setup-agent-integrations.js.map +1 -1
- package/dist/commands/onboard/templates/CLAUDE.md +22 -9
- package/dist/commands/onboard/templates/agents/ci-setup.md +28 -0
- package/dist/commands/onboard/templates/agents/recorder-installation.md +6 -0
- package/dist/commands/onboard/templates/docs/ci.ts +2 -6
- package/dist/commands/onboard/templates/docs/github-actions-v2.ts +43 -37
- package/dist/commands/onboard/templates/docs/how-to/connect-git-provider.ts +26 -0
- package/dist/commands/onboard/templates/docs/how-to/typescript-types.ts +1 -1
- package/dist/commands/onboard/templates/docs/onboarding-guide.ts +77 -356
- package/dist/commands/onboard/templates/docs/recorder-getting-started.ts +5 -2
- package/dist/commands/onboard/templates/docs/recorder-snippets/script-based-instructions/nuxtjs-instructions.ts +1 -1
- package/dist/commands/onboard/templates/docs/recorder-snippets/script-based-instructions/rsbuild-instructions.ts +1 -1
- package/dist/commands/onboard/templates/docs/recorder-snippets/script-based-instructions/vite-instructions.ts +1 -1
- package/dist/commands/onboard/templates/docs/reference/cli-commands.ts +37 -0
- package/dist/commands/onboard/validate-ci-yaml.d.ts +22 -0
- package/dist/commands/onboard/validate-ci-yaml.d.ts.map +1 -0
- package/dist/commands/onboard/validate-ci-yaml.js +113 -0
- package/dist/commands/onboard/validate-ci-yaml.js.map +1 -0
- package/package.json +14 -13
- package/dist/commands/onboard/templates/agents/local-simulation-verification.md +0 -96
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { METICULOUS_SUPPORT_EMAIL } from "src/lib/next/next.constants";
|
|
2
2
|
import {
|
|
3
3
|
BRANCHES_REQUIRED_TO_RUN_ON_URL,
|
|
4
|
-
CLOUD_REPLAY_URL,
|
|
5
4
|
ENABLE_SOURCE_COVERAGE_URL,
|
|
6
5
|
MAKE_CHECK_BLOCKING_URL,
|
|
6
|
+
ONBOARDING_GUIDE_URL,
|
|
7
7
|
} from "src/lib/utils/internal-urls/docs-urls.utils";
|
|
8
8
|
import {
|
|
9
9
|
GITHUB_ACTION_UPLOAD_ASSETS_NAME,
|
|
@@ -44,8 +44,14 @@ on:
|
|
|
44
44
|
pull_request: {}
|
|
45
45
|
# Important: We need the workflow to be triggered on workflow_dispatch events,
|
|
46
46
|
# so that Meticulous can run the workflow on the base commit to compare
|
|
47
|
-
# against if an existing workflow hasn't run
|
|
48
|
-
|
|
47
|
+
# against if an existing workflow hasn't run. The meticulous-commit-sha input
|
|
48
|
+
# lets Meticulous ask for a specific commit (e.g. stacked PRs); without it,
|
|
49
|
+
# a dispatched run can only build whatever the branch currently points at.
|
|
50
|
+
workflow_dispatch:
|
|
51
|
+
inputs:
|
|
52
|
+
meticulous-commit-sha:
|
|
53
|
+
description: Commit Meticulous has asked this run to build. Defaults to the branch head.
|
|
54
|
+
required: false`;
|
|
49
55
|
|
|
50
56
|
const workflowShared = `
|
|
51
57
|
name: Meticulous
|
|
@@ -61,6 +67,11 @@ permissions:
|
|
|
61
67
|
pull-requests: write
|
|
62
68
|
statuses: read
|
|
63
69
|
|
|
70
|
+
env:
|
|
71
|
+
# Prefer the dispatched commit when set; otherwise the PR head. On pull_request github.sha is the merge commit,
|
|
72
|
+
# not the PR head SHA that Meticulous looks up.
|
|
73
|
+
METICULOUS_COMMIT_SHA: \${{ github.event.inputs['meticulous-commit-sha'] || (github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha) }}
|
|
74
|
+
|
|
64
75
|
jobs:
|
|
65
76
|
test:
|
|
66
77
|
name: Meticulous
|
|
@@ -69,6 +80,8 @@ jobs:
|
|
|
69
80
|
steps:
|
|
70
81
|
- name: Checkout repository
|
|
71
82
|
uses: actions/checkout@v4
|
|
83
|
+
with:
|
|
84
|
+
ref: \${{ env.METICULOUS_COMMIT_SHA }}
|
|
72
85
|
|
|
73
86
|
- name: Install pnpm
|
|
74
87
|
uses: pnpm/action-setup@v4
|
|
@@ -95,29 +108,13 @@ jobs:
|
|
|
95
108
|
pnpm install --frozen-lockfile
|
|
96
109
|
|
|
97
110
|
- name: Build project
|
|
98
|
-
# METICULOUS_BUILD marks this as a build for Meticulous testing
|
|
111
|
+
# METICULOUS_BUILD marks this as a build for Meticulous testing.
|
|
99
112
|
env:
|
|
100
113
|
METICULOUS_BUILD: "true"
|
|
101
114
|
run: |
|
|
102
115
|
pnpm build
|
|
103
116
|
`;
|
|
104
117
|
|
|
105
|
-
const meticulousBuildEnvNote = `
|
|
106
|
-
{% callout_card variant="info" title="The METICULOUS_BUILD environment variable" %}
|
|
107
|
-
The example workflows below set \`METICULOUS_BUILD=true\` on the build (and, for container
|
|
108
|
-
builds, on the image). This marks the build as one that Meticulous will test, so your app can
|
|
109
|
-
detect it and adjust behaviour that would otherwise be unreliable during replay — most
|
|
110
|
-
commonly **skipping retry-heavy data fetches** in server-side lifecycle hooks
|
|
111
|
-
(\`getServerSideProps\`, \`getInitialProps\`, loaders) that have no recorded response during
|
|
112
|
-
replay and would otherwise fail and be retried repeatedly.
|
|
113
|
-
|
|
114
|
-
Because it is set **only** in your Meticulous build (never in production), it is safe to gate
|
|
115
|
-
behaviour on — unlike a request header, it cannot be spoofed. In server / build-time code read
|
|
116
|
-
it with \`process.env.METICULOUS_BUILD === "true"\`; in browser code prefer
|
|
117
|
-
\`window.Meticulous?.isRunningAsTest\`. If your app does not need it, leaving it set is harmless.
|
|
118
|
-
{% /callout_card %}
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
118
|
export const document = `---
|
|
122
119
|
{
|
|
123
120
|
"title": "Setting up Meticulous tests to run in your CI provider"
|
|
@@ -133,7 +130,7 @@ In this guide, we'll show you how to set up Meticulous to run in your CI system.
|
|
|
133
130
|
|
|
134
131
|
## 1. Install the Meticulous GitHub App
|
|
135
132
|
|
|
136
|
-
|
|
133
|
+
If you haven't already connected this repository in [Connect your repository](${ONBOARDING_GUIDE_URL}#1-connect-your-repository), visit [${METICULOUS_GITHUB_APP_INSTALL_URL}](${METICULOUS_GITHUB_APP_INSTALL_URL}) to install our GitHub App.
|
|
137
134
|
|
|
138
135
|
## 2. Add your Meticulous API token as a secret to your GitHub repository
|
|
139
136
|
|
|
@@ -176,12 +173,6 @@ We offer two approaches to running Meticulous tests on CI. We recommend choosing
|
|
|
176
173
|
1. **Upload your built assets** for us to test. This is the recommended approach if your app is a static site, i.e. it can be served as a folder of static assets (HTML/JS/CSS) without any server-side rendering or complex request rewriting. This approach is **NOT recommended** for Next.js applications as they typically cannot be served as static assets.
|
|
177
174
|
2. **Upload a built container image** (e.g. a Docker image) for us to test. This is the recommended approach for most other apps, including Next.js applications. Almost any app can be containerized, so this is the universal fallback.
|
|
178
175
|
|
|
179
|
-
{% callout_card variant="info" title="Recommended approaches" %}
|
|
180
|
-
We recommend **uploading static assets** or **uploading a container image**. These are the simplest and most reliable ways to run Meticulous tests.
|
|
181
|
-
|
|
182
|
-
If you use a preview URL provider such as Vercel, Netlify, or similar, Meticulous can also test your PRs using [cloud replay](${CLOUD_REPLAY_URL}). Uploading static assets or a container image are still the preferred approaches.
|
|
183
|
-
{% /callout_card %}
|
|
184
|
-
${meticulousBuildEnvNote}
|
|
185
176
|
{% tabs tabNameSpace="type" %}
|
|
186
177
|
{% tab label="Upload static assets" %}
|
|
187
178
|
|
|
@@ -235,9 +226,9 @@ ${workflowShared}
|
|
|
235
226
|
uses: docker/build-push-action@v6
|
|
236
227
|
with:
|
|
237
228
|
context: .
|
|
238
|
-
tags: my-app:\${{
|
|
229
|
+
tags: my-app:\${{ env.METICULOUS_COMMIT_SHA }}
|
|
239
230
|
push: false
|
|
240
|
-
# Marks the image as a Meticulous build
|
|
231
|
+
# Marks the image as a Meticulous build. Consume it in your
|
|
241
232
|
# Dockerfile with \`ARG METICULOUS_BUILD\` / \`ENV METICULOUS_BUILD=$METICULOUS_BUILD\`
|
|
242
233
|
# if you need it at build time (e.g. getStaticProps / static generation).
|
|
243
234
|
build-args: |
|
|
@@ -247,11 +238,11 @@ ${workflowShared}
|
|
|
247
238
|
uses: ${GITHUB_ACTION_UPLOAD_CONTAINER_NAME}@v1
|
|
248
239
|
with:
|
|
249
240
|
api-token: \${{ secrets.METICULOUS_API_TOKEN }}
|
|
250
|
-
image-tag: my-app:\${{
|
|
241
|
+
image-tag: my-app:\${{ env.METICULOUS_COMMIT_SHA }}
|
|
251
242
|
# Optional inputs:
|
|
252
243
|
container-port: 1234
|
|
253
244
|
# METICULOUS_BUILD is also passed at runtime so server-side code (e.g.
|
|
254
|
-
# getServerSideProps) can detect the Meticulous replay.
|
|
245
|
+
# getServerSideProps) can detect the Meticulous replay.
|
|
255
246
|
container-env: |
|
|
256
247
|
MY_ENV_VAR=my-value
|
|
257
248
|
METICULOUS_BUILD=true
|
|
@@ -319,7 +310,11 @@ on:
|
|
|
319
310
|
paths:
|
|
320
311
|
- "apps/dashboard/**"
|
|
321
312
|
- "packages/ui/**"
|
|
322
|
-
workflow_dispatch:
|
|
313
|
+
workflow_dispatch:
|
|
314
|
+
inputs:
|
|
315
|
+
meticulous-commit-sha:
|
|
316
|
+
description: Commit Meticulous has asked this run to build. Defaults to the branch head.
|
|
317
|
+
required: false
|
|
323
318
|
|
|
324
319
|
permissions:
|
|
325
320
|
actions: write
|
|
@@ -328,6 +323,11 @@ permissions:
|
|
|
328
323
|
pull-requests: write
|
|
329
324
|
statuses: read
|
|
330
325
|
|
|
326
|
+
env:
|
|
327
|
+
# Prefer the dispatched commit when set; otherwise the PR head. On pull_request github.sha is the merge commit,
|
|
328
|
+
# not the PR head SHA that Meticulous looks up.
|
|
329
|
+
METICULOUS_COMMIT_SHA: \${{ github.event.inputs['meticulous-commit-sha'] || (github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha) }}
|
|
330
|
+
|
|
331
331
|
jobs:
|
|
332
332
|
test:
|
|
333
333
|
name: Meticulous (dashboard)
|
|
@@ -335,6 +335,8 @@ jobs:
|
|
|
335
335
|
|
|
336
336
|
steps:
|
|
337
337
|
- uses: actions/checkout@v4
|
|
338
|
+
with:
|
|
339
|
+
ref: \${{ env.METICULOUS_COMMIT_SHA }}
|
|
338
340
|
- uses: actions/setup-node@v4
|
|
339
341
|
with:
|
|
340
342
|
node-version: "24"
|
|
@@ -510,6 +512,8 @@ then you can use our \`ci upload-assets\` CLI command to upload your built asset
|
|
|
510
512
|
|
|
511
513
|
## 1. Link GitLab to Meticulous
|
|
512
514
|
|
|
515
|
+
If you haven't already connected this repository in [Connect your repository](${ONBOARDING_GUIDE_URL}#1-connect-your-repository), complete the steps below.
|
|
516
|
+
|
|
513
517
|
${linkGitLabInstructions}
|
|
514
518
|
|
|
515
519
|
## 2. Add your Meticulous API token as a CI/CD variable
|
|
@@ -529,7 +533,7 @@ METICULOUS_API_TOKEN:
|
|
|
529
533
|
To run Meticulous on CI, add a new \`.gitlab-ci.yml\` file to your repository. The pipeline needs to run on both pushes to your main branch and on merge requests.
|
|
530
534
|
|
|
531
535
|
This pipeline should use our \`ci upload-assets\` CLI command to upload your built assets for us to test.
|
|
532
|
-
|
|
536
|
+
|
|
533
537
|
File name: \`.gitlab-ci.yml\`
|
|
534
538
|
|
|
535
539
|
File contents:
|
|
@@ -545,7 +549,7 @@ variables:
|
|
|
545
549
|
build:
|
|
546
550
|
stage: build
|
|
547
551
|
image: node:24-alpine
|
|
548
|
-
# METICULOUS_BUILD marks this as a build for Meticulous testing
|
|
552
|
+
# METICULOUS_BUILD marks this as a build for Meticulous testing.
|
|
549
553
|
variables:
|
|
550
554
|
METICULOUS_BUILD: "true"
|
|
551
555
|
script:
|
|
@@ -781,6 +785,8 @@ then you can use our \`ci upload-assets\` CLI command to upload your built asset
|
|
|
781
785
|
|
|
782
786
|
## 1. Link Bitbucket to Meticulous
|
|
783
787
|
|
|
788
|
+
If you haven't already connected this repository in [Connect your repository](${ONBOARDING_GUIDE_URL}#1-connect-your-repository), complete the steps below.
|
|
789
|
+
|
|
784
790
|
${linkBitbucketInstructions}
|
|
785
791
|
|
|
786
792
|
## 2. Add your Meticulous API token as a repository variable
|
|
@@ -800,7 +806,7 @@ METICULOUS_API_TOKEN:
|
|
|
800
806
|
To run Meticulous on CI, add a \`bitbucket-pipelines.yml\` file to your repository. The pipeline needs to run on both pushes to your main branch and on pull requests.
|
|
801
807
|
|
|
802
808
|
This pipeline should use our \`ci upload-assets\` CLI command to upload your built assets for us to test.
|
|
803
|
-
|
|
809
|
+
|
|
804
810
|
On pull request builds, Bitbucket merges the destination branch into the source branch during **Build Setup** before your steps run. Meticulous does **not** support testing that ephemeral merge commit. **Checkout the PR source tip** before building so uploads use a commit Bitbucket exposes via the API and the backend can compare against the **merge-base** with the destination branch.
|
|
805
811
|
|
|
806
812
|
Add this step at the start of your pull-request pipeline script:
|
|
@@ -827,7 +833,7 @@ pipelines:
|
|
|
827
833
|
- node
|
|
828
834
|
script:
|
|
829
835
|
- npm ci
|
|
830
|
-
# METICULOUS_BUILD marks this as a build for Meticulous testing
|
|
836
|
+
# METICULOUS_BUILD marks this as a build for Meticulous testing.
|
|
831
837
|
- METICULOUS_BUILD=true npm run build
|
|
832
838
|
- >
|
|
833
839
|
npx @alwaysmeticulous/cli ci upload-assets
|
|
@@ -843,7 +849,7 @@ pipelines:
|
|
|
843
849
|
script:
|
|
844
850
|
- git reset --hard "$BITBUCKET_COMMIT"
|
|
845
851
|
- npm ci
|
|
846
|
-
# METICULOUS_BUILD marks this as a build for Meticulous testing
|
|
852
|
+
# METICULOUS_BUILD marks this as a build for Meticulous testing.
|
|
847
853
|
- METICULOUS_BUILD=true npm run build
|
|
848
854
|
- >
|
|
849
855
|
npx @alwaysmeticulous/cli ci upload-assets
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { METICULOUS_GITHUB_APP_INSTALL_URL } from "../constants";
|
|
2
|
+
import { linkBitbucketInstructions } from "./link-bitbucket";
|
|
3
|
+
import { linkGitLabInstructions } from "./link-gitlab";
|
|
4
|
+
|
|
5
|
+
export const connectGitProviderInstructions = `
|
|
6
|
+
{% tabs tabNameSpace="provider" %}
|
|
7
|
+
{% tab label="GitHub" %}
|
|
8
|
+
|
|
9
|
+
1. Sign in to [Meticulous](https://app.meticulous.ai) and create or select your organization.
|
|
10
|
+
2. Choose **Connect to GitHub** when creating the project.
|
|
11
|
+
3. [Install the Meticulous GitHub App](${METICULOUS_GITHUB_APP_INSTALL_URL}) for the organization and repositories you want Meticulous to test.
|
|
12
|
+
4. Return to Meticulous, select the repository, and create the linked project.
|
|
13
|
+
|
|
14
|
+
{% /tab %}
|
|
15
|
+
{% tab label="GitLab" %}
|
|
16
|
+
|
|
17
|
+
${linkGitLabInstructions}
|
|
18
|
+
|
|
19
|
+
{% /tab %}
|
|
20
|
+
{% tab label="Bitbucket" %}
|
|
21
|
+
|
|
22
|
+
${linkBitbucketInstructions}
|
|
23
|
+
|
|
24
|
+
{% /tab %}
|
|
25
|
+
{% /tabs %}
|
|
26
|
+
`;
|
|
@@ -13,7 +13,7 @@ TypeScript definitions for the \`window.Meticulous\` object are available in the
|
|
|
13
13
|
Install the package as a dev dependency:
|
|
14
14
|
|
|
15
15
|
\`\`\`bash
|
|
16
|
-
npm install --save-dev @alwaysmeticulous/sdk-bundles-api
|
|
16
|
+
npm install --save-dev @alwaysmeticulous/sdk-bundles-api@latest
|
|
17
17
|
\`\`\`
|
|
18
18
|
|
|
19
19
|
## Usage
|