integreat 1.6.6 → 1.7.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/AGENTS.md ADDED
@@ -0,0 +1,112 @@
1
+ # AI Agent Rules
2
+
3
+ Instructions for AI coding assistants working on this codebase.
4
+
5
+ Integreat is an integration layer written in TypeScript. It is given a
6
+ configuration of services, schemas, and the mapping (mutations) between them. It
7
+ also supports jobs/flows and authenticators. The core concept is build on
8
+ dispatching actions, that are first passed through a middleware, before being
9
+ routed to a handler based on the given action type.
10
+
11
+ # Preferred agent behavior
12
+
13
+ - IMPORTANT: Read what kind of conversation we're in before acting. Two modes:
14
+ - **Directive** — I've handed you a task ("please fix this", "add X", "rename
15
+ Y"). Here, go ahead and do it; a hunch I include ("...my hunch is it's the
16
+ cache") is help, not a gate.
17
+ - **Discussion** — we're figuring something out together ("what do you think
18
+ about this?", "should we...?", "I'm wondering if..."). Here your job is to
19
+ investigate, explain, and propose so we can reach a conclusion together. Do
20
+ NOT start implementing mid-discussion — that breaks the back-and-forth
21
+ before we've actually decided.
22
+ - In a discussion, my replies (including hunches and opinions) are turns in the
23
+ conversation, not approval. Implement only once we've landed on a conclusion
24
+ together, or once the discussion clearly turns into a directive ("ok, do it").
25
+ - When you can't tell which mode we're in, assume discussion: answer, propose,
26
+ and wait.
27
+ - Keep your answers short when you can. Elaborate answers on topics I didn't ask
28
+ about does not help. Instead mention your objections without diving fully into
29
+ it.
30
+ - Don't do more than the user ask you to do. If the user ask you a question,
31
+ answer it and then STOP.
32
+ - Don't implement fixes, make changes, or address other issues you notice unless
33
+ explicitly asked. Even if you find problems while investigating, only mention
34
+ them if directly relevant to the question.
35
+ - When a plan is approved, that's a signal for you to start implementing. Don't
36
+ ask if for permission to start implementing an approved plan. :)
37
+ - If you run into unexpected issues while implementing a plan, so that you have,
38
+ to reconsider parts of the plan – stop and ask for input. Don't make any big
39
+ decitions to change the plan without consulting the user.
40
+
41
+ # Approach and philosophy
42
+
43
+ - Maintain separation of concerns between components.
44
+ - Prefer functional style programming over classes, unless there's a specific
45
+ reason for using a class.
46
+ - Never create local `.md` files for setup guides, API documentation, or usage
47
+ examples. Keep setup instructions, function usage, and implementation details
48
+ as comments above the relevant code.
49
+ - After writing or editing any file, run `npx prettier --write` on it.
50
+ - Update `README.md`, when you implement something that directly affect
51
+ functionality at the user-facing level.
52
+ - When using an external package, try first to use the features of that package,
53
+ before implementing custom workarounds.
54
+ - When you can't use file editing tool in the repo, don't compensate by
55
+ outputting code the chat. Instead describe your approach at a higher level and
56
+ ask if you should implement it.
57
+
58
+ # TypeScript rules
59
+
60
+ - Check for TypeScript and lint errors
61
+ - Important: You should NEVER use `any` to fix type issues!
62
+ - Whenever you use inline typing with `as` you should reconsider if there are
63
+ better ways of doing this.
64
+ - You should avoid doing local type overrides as far as possible.
65
+ - Avoid inline types like `{ foo: string }` - instead reuse existing types from
66
+ the codebase.
67
+ - Prefer using generic type parameters over type assertions - for example,
68
+ `createMockGraphQLRequestClient<MutationArgs>(...)` instead of
69
+ `(variables as MutationArgs)`.
70
+ - When importing types, use `import type` and place directive below other import
71
+ directives.
72
+ - When a file has a main function, use default export. When a file have several
73
+ functions, without any of them being the main one, use named exports. Also use
74
+ named exports for "support function" when there's a main function.
75
+ - Don't use `await import` (dyanamic imports) unless there's a real need for it.
76
+
77
+ # Node.js rules
78
+
79
+ - Prefer built-in Node.js functionality over installing packages.
80
+ - Prefer packages from @sindresorhus over equal alternatives from others.
81
+ - Prefer the latest version of packages, and check that packages are not
82
+ deprecated by doing a web search.
83
+
84
+ # Testing rules
85
+
86
+ - Write tests in the built in node test runner.
87
+ - Import assertions from `node:assert/strict` so you don't have to specify
88
+ "strict" on every assertion.
89
+ - Write test names starting with "should", e.g. "should return the first item"
90
+ - For test files that need a mock database or some common setup, wrap all tests
91
+ in a `describe` block with a common setup using `beforeEach` and `afterEach`.
92
+ - Each test should consist of three steps in this exact order:
93
+ 1. **Setup** - Set up any necessary preconditions and define expected values
94
+ 2. **Execution** - Call the function or code being tested
95
+ 3. **Assertions** - Verify the results match expectations
96
+ - Separate these three groups with blank lines. Don't use blank lines within a
97
+ group.
98
+ - In the setup section, define an `expected` variable when the test involves
99
+ comparing a result to an expected value. If there are more expected values,
100
+ name them with the `expected` prefix. Keep the expected variables below the
101
+ other setup code. This makes the test's purpose clearer.
102
+ - When the expected result is fully deterministic, use `assert.deepEqual` to
103
+ compare the entire response — this catches unexpected changes in any field.
104
+ When the result contains dynamic values (`id`, `createdAt`, timestamps), use
105
+ field-level assertions (`assert.equal`, `assert.ok`) on the known fields.
106
+ - Use `sinon` for mocking.
107
+ - Chaining methods in test setup, like
108
+ `sinon.stub().returns(...).onFirstCall().returns(...)`, as oposed to starting
109
+ each line with the mock variable.
110
+ - Keep unit tests with the file that's being tested.
111
+ - When I ask you to update tests, do it without updating the implementation. I
112
+ want to see the tests failing before I ask you to update the implementation.
package/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md