@muxion/dev-config 0.1.1 → 0.2.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.
@@ -0,0 +1,29 @@
1
+ # Muxion Engineering Principles
2
+
3
+ Shared rules come from `@muxion/dev-config/agents`. Change them there, not in a repository.
4
+
5
+ Use ASD-STE100 when you write documentation, comments, errors, commit messages, and review notes.
6
+
7
+ The rule layers inherit: these principles, then a language layer, then a target layer. A narrow layer adds rules. It does not repeat or change a rule of a wider layer, unless it names the rule that it replaces.
8
+
9
+ ## Engineering rules
10
+
11
+ - Prioritize correctness, simple code, clear boundaries, and measured performance.
12
+ - Fix root causes. Do not add silent fallbacks or incomplete workarounds.
13
+ - Add an abstraction only for a current need. Remove it when the need no longer exists.
14
+ - Keep one explicit state for each lifecycle. Make cleanup idempotent and observable.
15
+ - Keep resource acquisition and release close together. Use structured cleanup for success and failure.
16
+ - Do not detach a promise without a rejection handler and a comment that explains why.
17
+ - Keep functions and classes at one level of abstraction.
18
+ - Preserve protocol wire formats, public APIs, ABI versions, protocol versions, and compatibility identifiers unless the task explicitly changes them.
19
+
20
+ ## Tests
21
+
22
+ - Add a regression test for each behavior change.
23
+ - Prefer real implementations and integration tests when practical.
24
+ - Test partial construction failure, operation failure, repeated close, close during open, cancellation, and peer failure for resource owners.
25
+
26
+ ## Commits
27
+
28
+ - Use a short, imperative, lowercase Conventional Commit subject.
29
+ - Keep each commit focused. Commit each substantial verified change.
@@ -0,0 +1,38 @@
1
+ # Muxion Repository Rules
2
+
3
+ This layer adds to the engineering principles.
4
+
5
+ ## Repository structure
6
+
7
+ - Use npm 11 workspaces and commit `package-lock.json` in repositories that contain packages.
8
+ - Put workspace packages in `packages/`. Put runnable examples in `examples/`.
9
+ - Each package directory in `packages/` ends with `-js` (cross-platform JavaScript), `-node` (Node.js), `-web` (browser), or `-rust`. The `muxion-agents check` command enforces this.
10
+ - Put shared integration tests in `tests/`. Put benchmarks or diagnostics in their named top-level directories.
11
+ - Keep generated files in the output directory that owns them. Do not edit generated files by hand.
12
+ - Use Turborepo for dependency-ordered `build`, `test`, and `lint` tasks.
13
+ - Do not use Yarn files, Yarn commands, or `workspace:*` dependency ranges.
14
+ - Use exact `0.1.0` versions for packages in the same repository. Use `^0.1.0` for packages from another Muxion repository.
15
+ - Keep development dependency versions in the root `package.json`. Child workspaces use `"*"` for those tools.
16
+ - Do not import another package's `src`, `dist`, `generated`, or other private files.
17
+
18
+ ## Shared development configuration
19
+
20
+ - Install `@muxion/dev-config`, TypeScript, Oxlint, and Oxfmt in the repository root.
21
+ - Extend the applicable `@muxion/dev-config/tsconfig/*.json` preset.
22
+ - In a local TypeScript config, set only `rootDir`, `outDir`, and `include`.
23
+ - Keep the root `.oxlintrc.json` limited to its schema and the shared `extends` entry.
24
+ - Keep the root `.oxfmtrc.mjs` limited to the shared configuration re-export.
25
+ - Do not copy or override shared TypeScript, Oxlint, or Oxfmt policy.
26
+ - Link `.claude/rules/muxion` to `../../node_modules/@muxion/dev-config/agents`. Do not copy the shared rules.
27
+
28
+ ## Verification
29
+
30
+ - Before review, run `npm run build`, `npm test`, `npm run lint`, and `npm run format:check`.
31
+ - Confirm that generated files are current and Git status is clean.
32
+
33
+ ## Releases
34
+
35
+ - Run repository verification, package dry runs, content checks, and dependency checks before a public publish.
36
+ - Publish public packages only with `npm run publish` in the child repository. It runs the `muxion-publish` tool from `@muxion/dev-config`. To publish all child repositories in dependency order, run `npm run publish:all` in `muxion-all`.
37
+ - Do not run `npm publish` directly.
38
+ - Run the publish script with `-- --dry-run` first. If it reports a changed package, increase the version of that package before you publish.
@@ -0,0 +1,18 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*core-rust/**'
4
+ ---
5
+
6
+ # Rust Protocol Core Rules
7
+
8
+ This layer adds to the Rust layer.
9
+
10
+ - Keep protocol cores deterministic and independent of runtimes and platforms.
11
+ - Do not use `unsafe` outside ABI modules.
12
+ - Use the sans-IO shape: `handle_input(bytes, now)`, `poll_transmit(now)`, and `poll_timeout()`. The host gives time and seeds.
13
+ - Do not panic on peer input. Check bounds in all parsing (`clippy::indexing_slicing`).
14
+ - Use `checked_`, `saturating_`, or `wrapping_` arithmetic explicitly (`clippy::arithmetic_side_effects`).
15
+ - Use `try_from` for narrowing conversions. Do not use `as` (`clippy::cast_possible_truncation`).
16
+ - Do not iterate a hash map or hash set when the order changes the output (`clippy::iter_over_hash_type`).
17
+ - Keep the core ready for `no_std` with `alloc`. Use `core` and `alloc` paths (`clippy::std_instead_of_core`, `clippy::std_instead_of_alloc`).
18
+ - Give each queue, buffer, and map that peer input can grow a limit from configuration.
@@ -0,0 +1,20 @@
1
+ ---
2
+ paths:
3
+ - '**/abi.rs'
4
+ - '**/abi/**/*.rs'
5
+ ---
6
+
7
+ # Rust C ABI Rules
8
+
9
+ This layer adds to the Rust layer. It applies to ABI modules.
10
+
11
+ - Confine handwritten `unsafe` code to ABI or generated boundary modules.
12
+ - Add a safety explanation to each handwritten `unsafe` block.
13
+ - Give each `unsafe fn` a `# Safety` section. Put one unsafe operation in each block (`clippy::undocumented_unsafe_blocks`, `clippy::multiple_unsafe_ops_per_block`, `clippy::missing_safety_doc`).
14
+ - Write `#[unsafe(no_mangle)]` and `unsafe extern "C"`.
15
+ - Do not let a panic cross `extern "C"`. Catch it with `catch_unwind` and return an error code. Choose one panic strategy for the crate and state it.
16
+ - Use opaque handles. The destroy function accepts null and is idempotent.
17
+ - Free memory on the side that allocated it. Export a `*_free` function for each owned output.
18
+ - Export `abi_version()`. Use `#[repr(u32)]` enums. Reject unknown discriminants on input.
19
+ - Return status codes. Return values through out-parameters.
20
+ - Keep native results borrowed only for the current operation. Copy data before the next native call.
@@ -0,0 +1,15 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*-cli-rust/**'
4
+ - '**/packages/*-proxy-rust/**'
5
+ ---
6
+
7
+ # Rust Tokio Rules
8
+
9
+ This layer adds to the Rust layer. It applies to async hosts and command-line tools.
10
+
11
+ - Each `tokio::select!` branch must be cancellation-safe, or the future must be pinned outside the loop.
12
+ - Each spawned task has an owner that joins or aborts it (`JoinSet`, `TaskTracker` with `CancellationToken`).
13
+ - Put blocking work in `spawn_blocking`.
14
+ - Libraries use `tracing`. Only `main` installs the subscriber.
15
+ - Set exit codes explicitly. Write data to stdout and diagnostics to stderr.
@@ -0,0 +1,13 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*-wasm-rust/**'
4
+ ---
5
+
6
+ # Rust WebAssembly Rules
7
+
8
+ This layer adds to the Rust layer.
9
+
10
+ - A JavaScript view of wasm memory becomes invalid when memory grows. Copy the data, or get the view again after each call.
11
+ - Free exported objects explicitly with `free()` or dispose. Use `FinalizationRegistry` only as a fallback.
12
+ - After a panic, the module instance is poisoned. Throw a typed error and make a new instance.
13
+ - Use OS entropy and clocks only at the wasm edge. Do not use them in the core.
package/agents/rust.md ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ paths:
3
+ - '**/*.rs'
4
+ - '**/Cargo.toml'
5
+ ---
6
+
7
+ # Rust Rules
8
+
9
+ This layer adds to the engineering principles.
10
+
11
+ - Use edition 2024.
12
+ - Keep `cargo fmt` and workspace Clippy settings in each repository that contains Rust.
13
+ - Put lint policy in `[workspace.lints]`. Set `lints.workspace = true` in each crate. Do not put `#![deny]` at crate roots.
14
+ - Suppress a lint with `#[expect(lint, reason = "...")]`. Do not use `allow` (`clippy::allow_attributes_without_reason`).
15
+ - Libraries return typed errors. Only binaries use `anyhow`.
16
+ - Do not use `unwrap`, `expect`, or `panic!` outside tests. The exception is a local invariant with a comment (`clippy::unwrap_used`, `clippy::expect_used`).
17
+ - Use `Drop` as fallback cleanup. Provide an explicit close operation when shutdown can fail.
@@ -0,0 +1,11 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*-js/**'
4
+ ---
5
+
6
+ # Cross-Platform JavaScript Rules
7
+
8
+ This layer adds to the TypeScript layer. A `-js` package runs in Node.js and in browsers.
9
+
10
+ - Do not use platform globals. Inject them, or select them with the `node` and `browser` export conditions. Do not check `typeof window` at runtime.
11
+ - Data that crosses a worker boundary must be structured-cloneable. Transfer buffers. Do not copy them.
@@ -0,0 +1,13 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*-node/**'
4
+ - '**/packages/*-node-*/**'
5
+ ---
6
+
7
+ # Node.js Rules
8
+
9
+ This layer adds to the TypeScript layer.
10
+
11
+ - A `.ts` file that Node runs directly uses only erasable syntax. Published packages ship `.js` files.
12
+ - Document the `--permission` flags that the package needs (`--allow-addons`, `--allow-ffi`). Test the package with those flags.
13
+ - Release native handles through dispose. Use `FinalizationRegistry` only as an observable fallback.
@@ -0,0 +1,12 @@
1
+ ---
2
+ paths:
3
+ - '**/packages/*-web/**'
4
+ ---
5
+
6
+ # Browser Rules
7
+
8
+ This layer adds to the TypeScript layer.
9
+
10
+ - Use only Web Crypto. Make a `CryptoKey` non-extractable unless the operation needs the key bytes.
11
+ - Create module workers with `new Worker(new URL(path, import.meta.url), { type: "module" })`.
12
+ - Close `RTCPeerConnection` and `RTCDataChannel` explicitly. Use `bufferedAmountLowThreshold` for backpressure.
@@ -0,0 +1,42 @@
1
+ ---
2
+ paths:
3
+ - '**/*.ts'
4
+ - '**/*.mts'
5
+ - '**/*.js'
6
+ - '**/*.mjs'
7
+ - '**/package.json'
8
+ ---
9
+
10
+ # TypeScript and JavaScript Rules
11
+
12
+ This layer adds to the engineering principles.
13
+
14
+ ## Language
15
+
16
+ - Use two-space indentation, ES modules, explicit type-only exports, and strict checks.
17
+ - Use `camelCase` for values and functions. Use `PascalCase` for types and classes.
18
+ - Use JavaScript `#` private fields and methods. Do not use the TypeScript `private` keyword.
19
+ - Do not use method overloads, `Object.freeze`, `Object.assign`, `Awaited`, or `ReturnType`.
20
+ - Use `bigint` for 64-bit values at TypeScript and native boundaries.
21
+ - Trust typed values. Validate untyped input only when it enters a typed boundary.
22
+ - Use integer discriminators across runtime and native boundaries.
23
+ - Keep lint suppressions on the smallest item and state the reason.
24
+
25
+ ## APIs
26
+
27
+ - Accept an `AbortSignal` in each async operation that a caller can cancel. Reject with `signal.reason`.
28
+ - A resource owner implements `Symbol.asyncDispose` or `Symbol.dispose` and keeps an explicit `close()`.
29
+ - When you wrap an error, give the original error as `cause`.
30
+ - Use `Uint8Array` at public boundaries. Do not use `Buffer`.
31
+ - Do not use internal barrel files. Do not make import cycles (`oxc/no-barrel-file`, `import/no-cycle`).
32
+
33
+ ## Packages
34
+
35
+ - Publish only through the `exports` map. Put the `types` condition first. Do not let consumers import deep paths.
36
+ - Set `"sideEffects": false`. Module top-level code does not register globals, change prototypes, or start I/O.
37
+ - Use package `imports` (`#internal/*`) for private aliases. Do not use tsconfig `paths`.
38
+
39
+ ## Tests
40
+
41
+ - Use Vitest `assert`. Do not use `expect`.
42
+ - Name TypeScript tests `*.test.ts`.
@@ -0,0 +1,5 @@
1
+ export declare const agentsLinkPath = ".claude/rules/muxion";
2
+ export declare const agentsLinkTarget = "../../node_modules/@muxion/dev-config/agents";
3
+ export declare const isTargetPackageName: (name: string) => boolean;
4
+ export declare const checkRepository: (root: string) => Promise<string[]>;
5
+ //# sourceMappingURL=agents-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents-check.d.ts","sourceRoot":"","sources":["../src/agents-check.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,yBAAyB,CAAA;AACpD,eAAO,MAAM,gBAAgB,iDAAiD,CAAA;AAI9E,eAAO,MAAM,mBAAmB,SAAU,MAAM,KAAG,OACgC,CAAA;AA2FnF,eAAO,MAAM,eAAe,SAAgB,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAGpE,CAAA"}
@@ -0,0 +1,93 @@
1
+ // oxlint-disable-next-line import/no-nodejs-modules -- The check reads the repository files.
2
+ import { lstat, readdir, readFile, readlink, stat } from 'node:fs/promises';
3
+ // oxlint-disable-next-line import/no-nodejs-modules -- The check makes repository paths.
4
+ import { dirname, join } from 'node:path';
5
+ export const agentsLinkPath = '.claude/rules/muxion';
6
+ export const agentsLinkTarget = '../../node_modules/@muxion/dev-config/agents';
7
+ const targetSuffixes = ['-js', '-node', '-web', '-rust'];
8
+ export const isTargetPackageName = (name) => targetSuffixes.some((suffix) => name.endsWith(suffix)) || name.includes('-node-');
9
+ const isNotFound = (error) => error instanceof Error && 'code' in error && error.code === 'ENOENT';
10
+ const exists = async (path) => {
11
+ try {
12
+ await stat(path);
13
+ return true;
14
+ }
15
+ catch (error) {
16
+ if (isNotFound(error)) {
17
+ return false;
18
+ }
19
+ throw error;
20
+ }
21
+ };
22
+ const checkLink = async (root) => {
23
+ const link = join(root, agentsLinkPath);
24
+ let isLink;
25
+ try {
26
+ const stats = await lstat(link);
27
+ isLink = stats.isSymbolicLink();
28
+ }
29
+ catch (error) {
30
+ if (isNotFound(error)) {
31
+ return [`${agentsLinkPath} does not exist. Make it a symlink to ${agentsLinkTarget}.`];
32
+ }
33
+ throw error;
34
+ }
35
+ if (!isLink) {
36
+ return [`${agentsLinkPath} is not a symlink. Make it a symlink to ${agentsLinkTarget}.`];
37
+ }
38
+ const target = await readlink(link);
39
+ if (target !== agentsLinkTarget) {
40
+ return [`${agentsLinkPath} points to ${target}. It must point to ${agentsLinkTarget}.`];
41
+ }
42
+ if (!(await exists(join(dirname(link), target)))) {
43
+ return [
44
+ `${agentsLinkPath} does not resolve. Run npm install, and use @muxion/dev-config 0.2.0 or later.`,
45
+ ];
46
+ }
47
+ return [];
48
+ };
49
+ const readExempt = async (root) => {
50
+ const manifest = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
51
+ if (typeof manifest !== 'object' || manifest === null || !('muxionAgents' in manifest)) {
52
+ return [];
53
+ }
54
+ const { muxionAgents } = manifest;
55
+ if (typeof muxionAgents !== 'object' || muxionAgents === null || !('exempt' in muxionAgents)) {
56
+ return [];
57
+ }
58
+ const { exempt } = muxionAgents;
59
+ if (!Array.isArray(exempt) || !exempt.every((name) => typeof name === 'string')) {
60
+ throw new TypeError('muxionAgents.exempt must be an array of strings.');
61
+ }
62
+ return exempt;
63
+ };
64
+ const readPackageDirectories = async (root) => {
65
+ try {
66
+ const entries = await readdir(join(root, 'packages'), { withFileTypes: true });
67
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
68
+ }
69
+ catch (error) {
70
+ if (isNotFound(error)) {
71
+ return [];
72
+ }
73
+ throw error;
74
+ }
75
+ };
76
+ const checkPackages = async (root) => {
77
+ const exempt = await readExempt(root);
78
+ const directories = await readPackageDirectories(root);
79
+ const errors = directories
80
+ .filter((name) => !isTargetPackageName(name) && !exempt.includes(name))
81
+ .map((name) => `packages/${name} must end with -js, -node, -web, or -rust, or be in muxionAgents.exempt.`);
82
+ for (const name of exempt) {
83
+ if (!directories.includes(name)) {
84
+ errors.push(`The exempt package ${name} does not exist in packages/. Remove it from muxionAgents.exempt.`);
85
+ }
86
+ }
87
+ return errors;
88
+ };
89
+ export const checkRepository = async (root) => [
90
+ ...(await checkLink(root)),
91
+ ...(await checkPackages(root)),
92
+ ];
93
+ //# sourceMappingURL=agents-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents-check.js","sourceRoot":"","sources":["../src/agents-check.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC3E,yFAAyF;AACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAA;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,8CAA8C,CAAA;AAE9E,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAW,EAAE,CAC3D,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,EA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EAAE,CAAC;IACxE,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1B,GAAG,CAAC,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;CAC/B,CAAA"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":""}
package/dist/agents.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // oxlint-disable-next-line import/no-nodejs-modules -- The entry point reads the command arguments.
3
+ import { parseArgs } from 'node:util';
4
+ import { checkRepository } from './agents-check.js';
5
+ try {
6
+ const { positionals } = parseArgs({ allowPositionals: true, options: {} });
7
+ if (positionals.length !== 1 || positionals[0] !== 'check') {
8
+ throw new Error('Usage: muxion-agents check');
9
+ }
10
+ const errors = await checkRepository(process.cwd());
11
+ for (const error of errors) {
12
+ console.error(`error: ${error}`);
13
+ }
14
+ if (errors.length > 0) {
15
+ process.exitCode = 1;
16
+ }
17
+ }
18
+ catch (error) {
19
+ let message = String(error);
20
+ if (error instanceof Error) {
21
+ ;
22
+ ({ message } = error);
23
+ }
24
+ console.error(`error: ${message}`);
25
+ process.exitCode = 1;
26
+ }
27
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":";AACA,oGAAoG;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,IAAI,CAAC;IACH,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;IAC1E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC/C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IACnD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE,CAAC,CAAA;IAClC,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACtB,CAAC;AACH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,CAAC;QAAA,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAA;IACxB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IAClC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@muxion/dev-config",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vietthang/muxion-common.git"
8
8
  },
9
9
  "bin": {
10
+ "muxion-agents": "dist/agents.js",
10
11
  "muxion-publish": "dist/publish.js"
11
12
  },
12
13
  "files": [
13
- "AGENTS.md",
14
+ "agents",
14
15
  "dist",
15
16
  "oxfmt.js",
16
17
  "oxlint.json",
@@ -18,7 +19,7 @@
18
19
  ],
19
20
  "type": "module",
20
21
  "exports": {
21
- "./AGENTS.md": "./AGENTS.md",
22
+ "./agents/*": "./agents/*",
22
23
  "./oxfmt": "./oxfmt.js",
23
24
  "./oxlint.json": "./oxlint.json",
24
25
  "./tsconfig/base.json": "./tsconfig/base.json",
package/AGENTS.md DELETED
@@ -1,72 +0,0 @@
1
- # Muxion Repository Rules
2
-
3
- Use ASD-STE100 when you write documentation, comments, errors, commit messages, and review notes.
4
-
5
- ## Repository structure
6
-
7
- - Use npm 11 workspaces and commit `package-lock.json`.
8
- - Put workspace packages in `packages/`. Put runnable examples in `examples/`.
9
- - Put shared integration tests in `tests/`. Put benchmarks or diagnostics in their named top-level directories.
10
- - Keep generated files in the output directory that owns them. Do not edit generated files by hand.
11
- - Use Turborepo for dependency-ordered `build`, `test`, and `lint` tasks.
12
- - Do not use Yarn files, Yarn commands, or `workspace:*` dependency ranges.
13
- - Use exact `0.1.0` versions for packages in the same repository. Use `^0.1.0` for packages from another Muxion repository.
14
- - Keep development dependency versions in the root `package.json`. Child workspaces use `"*"` for those tools.
15
- - Do not import another package's `src`, `dist`, `generated`, or other private files.
16
-
17
- ## Shared development configuration
18
-
19
- - Install `@muxion/dev-config`, TypeScript, Oxlint, and Oxfmt in the repository root.
20
- - Extend the applicable `@muxion/dev-config/tsconfig/*.json` preset.
21
- - In a local TypeScript config, set only `rootDir`, `outDir`, and `include`.
22
- - Keep the root `.oxlintrc.json` limited to its schema and the shared `extends` entry.
23
- - Keep the root `.oxfmtrc.mjs` limited to the shared configuration re-export.
24
- - Do not copy or override shared TypeScript, Oxlint, or Oxfmt policy.
25
- - Keep Rust `cargo fmt` and workspace Clippy settings in each repository that contains Rust.
26
-
27
- ## Engineering rules
28
-
29
- - Prioritize correctness, simple code, clear boundaries, and measured performance.
30
- - Fix root causes. Do not add silent fallbacks or incomplete workarounds.
31
- - Add an abstraction only for a current need. Remove it when the need no longer exists.
32
- - Keep one explicit state for each lifecycle. Make cleanup idempotent and observable.
33
- - Keep resource acquisition and release close together. Use structured cleanup for success and failure.
34
- - Do not detach a promise without a rejection handler and a comment that explains why.
35
- - Keep functions and classes at one level of abstraction.
36
- - Preserve protocol wire formats, public APIs, ABI versions, protocol versions, and compatibility identifiers unless the task explicitly changes them.
37
-
38
- ## TypeScript and JavaScript
39
-
40
- - Use two-space indentation, ES modules, explicit type-only exports, and strict checks.
41
- - Use `camelCase` for values and functions. Use `PascalCase` for types and classes.
42
- - Use JavaScript `#` private fields and methods. Do not use the TypeScript `private` keyword.
43
- - Do not use method overloads, `Object.freeze`, `Object.assign`, `Awaited`, or `ReturnType`.
44
- - Use `bigint` for 64-bit values at TypeScript and native boundaries.
45
- - Trust typed values. Validate untyped input only when it enters a typed boundary.
46
- - Use integer discriminators across runtime and native boundaries.
47
- - Keep lint suppressions on the smallest item and state the reason.
48
-
49
- ## Rust and native boundaries
50
-
51
- - Keep protocol cores deterministic and independent of runtimes and platforms.
52
- - Confine handwritten `unsafe` code to ABI or generated boundary modules.
53
- - Add a safety explanation to each handwritten `unsafe` block.
54
- - Use `Drop` as fallback cleanup. Provide an explicit close operation when shutdown can fail.
55
- - Keep native results borrowed only for the current operation. Copy data before the next native call.
56
-
57
- ## Tests and verification
58
-
59
- - Add a regression test for each behavior change.
60
- - Prefer real implementations and integration tests when practical.
61
- - Use Vitest `assert`. Do not use `expect`.
62
- - Name TypeScript tests `*.test.ts`.
63
- - Test partial construction failure, operation failure, repeated close, close during open, cancellation, and peer failure for resource owners.
64
- - Before review, run `npm run build`, `npm test`, `npm run lint`, and `npm run format:check`.
65
- - Confirm that generated files are current and Git status is clean.
66
-
67
- ## Commits and releases
68
-
69
- - Use a short, imperative, lowercase Conventional Commit subject.
70
- - Keep each commit focused. Commit each substantial verified change.
71
- - Run repository verification, package dry runs, content checks, and dependency checks before a public publish.
72
- - Publish public packages with `npm publish --access public` in the documented dependency order.