@crewhaus/target-onchain-game 0.1.8 → 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.
package/dist/index.d.ts CHANGED
@@ -32,9 +32,9 @@
32
32
  * loop end-to-end against an anvil fork.
33
33
  */
34
34
  import { CrewhausError } from "@crewhaus/errors";
35
- import type { Bundle, IrChainGameV0 } from "@crewhaus/ir";
35
+ import { type Bundle, type EmitReadmeOptions, type IrChainGameV0 } from "@crewhaus/ir";
36
36
  export declare class TargetEmitError extends CrewhausError {
37
37
  readonly name = "TargetEmitError";
38
38
  constructor(message: string, cause?: unknown);
39
39
  }
40
- export declare function emitOnchainGame(ir: IrChainGameV0): Bundle;
40
+ export declare function emitOnchainGame(ir: IrChainGameV0, opts?: EmitReadmeOptions): Bundle;
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@
33
33
  */
34
34
  import { CrewhausError } from "@crewhaus/errors";
35
35
  import { escapeJsonString } from "@crewhaus/infra-utils";
36
+ import { renderBundleReadme, } from "@crewhaus/ir";
36
37
  export class TargetEmitError extends CrewhausError {
37
38
  name = "TargetEmitError";
38
39
  constructor(message, cause) {
@@ -59,7 +60,7 @@ function renderWalletKeyRef(walletId, ref) {
59
60
  }
60
61
  return renderSecretRef(ref);
61
62
  }
62
- export function emitOnchainGame(ir) {
63
+ export function emitOnchainGame(ir, opts = {}) {
63
64
  if (ir.chain.id !== ir.wallet.chainId) {
64
65
  throw new TargetEmitError(`wallet.chainId "${ir.wallet.chainId}" does not match chain.id "${ir.chain.id}"`);
65
66
  }
@@ -184,5 +185,11 @@ function selectorOf(method: string): string {
184
185
  );
185
186
  }
186
187
  `;
187
- return { files: [{ path: "agent.ts", content }] };
188
+ const files = [{ path: "agent.ts", content }];
189
+ // Item 42 — generated bundle README; default ON (`crewhaus compile
190
+ // --no-readme` opts out).
191
+ if (opts.readme !== false) {
192
+ files.push({ path: "README.md", content: renderBundleReadme(ir) });
193
+ }
194
+ return { files };
188
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/target-onchain-game",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Codegen for the §47 `onchain-game` perceive-act-perceive loop. Emits a daemon that reads game state, asks the model for a move, broadcasts the move, awaits confirmation, and repeats.",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,9 @@
15
15
  "test": "bun test src"
16
16
  },
17
17
  "dependencies": {
18
- "@crewhaus/errors": "0.1.8",
19
- "@crewhaus/infra-utils": "0.1.8",
20
- "@crewhaus/ir": "0.1.8"
18
+ "@crewhaus/errors": "0.2.0",
19
+ "@crewhaus/infra-utils": "0.2.0",
20
+ "@crewhaus/ir": "0.2.0"
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "author": {