@icebreakers/monorepo-templates 1.0.14 → 1.1.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.
Files changed (32) hide show
  1. package/assets/.changeset/ledger.yaml +26 -0
  2. package/assets/.github/workflows/release.yml +35 -54
  3. package/assets/AGENTS.md +1 -1
  4. package/assets/package.json +15 -14
  5. package/assets/pnpm-workspace.yaml +8 -0
  6. package/assets/renovate.json +11 -0
  7. package/dist/cli.d.mts +1 -1
  8. package/package.json +1 -1
  9. package/templates/cli/package.json +1 -1
  10. package/templates/client/package.json +18 -18
  11. package/templates/client/tsconfig.app.json +0 -1
  12. package/templates/client/worker-configuration.d.ts +121 -13
  13. package/templates/server/package.json +6 -6
  14. package/templates/server/src/app.ts +3 -1
  15. package/templates/server/tsconfig.json +5 -4
  16. package/templates/server/tsconfig.worker.json +16 -0
  17. package/templates/server/vitest.config.ts +1 -4
  18. package/templates/server/worker-configuration.d.ts +121 -13
  19. package/templates/tsdown/vitest.config.ts +1 -4
  20. package/templates/vitepress/ai/llms-txt.md +6 -6
  21. package/templates/vitepress/en/repoctl/index.md +1 -1
  22. package/templates/vitepress/knowledge/index.md +1 -1
  23. package/templates/vitepress/monorepo/index.md +1 -1
  24. package/templates/vitepress/monorepo/publish.md +45 -217
  25. package/templates/vitepress/package.json +4 -4
  26. package/templates/vitepress/repoctl/index.md +1 -1
  27. package/templates/vitepress/thinking.md +1 -1
  28. package/templates/vitepress/tools/changeset.md +40 -63
  29. package/templates/vitepress/tools/index.md +10 -10
  30. package/templates/vue-lib/package.json +4 -4
  31. package/templates/vue-lib/vitest.config.ts +1 -1
  32. package/assets/.changeset/config.json +0 -21
@@ -2,8 +2,7 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "lib": [
5
- "ES2022",
6
- "WebWorker"
5
+ "ES2022"
7
6
  ],
8
7
  "paths": {
9
8
  "@/*": [
@@ -12,12 +11,14 @@
12
11
  },
13
12
  "types": [
14
13
  "node",
15
- "vitest/globals",
16
- "./worker-configuration.d.ts"
14
+ "vitest/globals"
17
15
  ]
18
16
  },
19
17
  "include": [
20
18
  "src",
21
19
  "test"
20
+ ],
21
+ "exclude": [
22
+ "src/fetch-entry.ts"
22
23
  ]
23
24
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5
+ "types": [
6
+ "./worker-configuration.d.ts"
7
+ ]
8
+ },
9
+ "include": [
10
+ "src"
11
+ ],
12
+ "exclude": [
13
+ "src/node-entry.ts",
14
+ "test"
15
+ ]
16
+ }
@@ -1,16 +1,13 @@
1
1
  import path from 'node:path'
2
- import { fileURLToPath } from 'node:url'
3
2
  import { defineVitestProjectConfig } from 'repoctl/tooling'
4
3
  import { defineProject } from 'vitest/config'
5
4
 
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
-
8
5
  export default defineProject(await defineVitestProjectConfig({
9
6
  options: {
10
7
  alias: [
11
8
  {
12
9
  find: '@',
13
- replacement: path.resolve(__dirname, './src'),
10
+ replacement: path.resolve(import.meta.dirname, './src'),
14
11
  },
15
12
  ],
16
13
  },
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Generated by Wrangler by running `wrangler types` (hash: 047568eb9ed6843cb5540fa33180da01)
3
- // Runtime types generated with workerd@1.20260714.1 2025-10-16 nodejs_compat
3
+ // Runtime types generated with workerd@1.20260811.1 2025-10-16 nodejs_compat
4
4
  interface __BaseEnv_Env {
5
5
  }
6
6
  declare namespace Cloudflare {
@@ -435,6 +435,7 @@ interface ExecutionContext<Props = unknown> {
435
435
  cache?: CacheContext;
436
436
  readonly access?: CloudflareAccessContext;
437
437
  tracing: Tracing;
438
+ abort(reason?: any): void;
438
439
  }
439
440
  type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
440
441
  type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -2767,6 +2768,12 @@ interface TraceLog {
2767
2768
  readonly timestamp: number;
2768
2769
  readonly level: string;
2769
2770
  readonly message: any;
2771
+ readonly errorInfo?: (TraceLogErrorInfo | null)[];
2772
+ }
2773
+ interface TraceLogErrorInfo {
2774
+ name: string;
2775
+ message: string;
2776
+ stack?: string;
2770
2777
  }
2771
2778
  interface TraceException {
2772
2779
  readonly timestamp: number;
@@ -3307,18 +3314,26 @@ interface ContainerExecOptions {
3307
3314
  cwd?: string;
3308
3315
  env?: Record<string, string>;
3309
3316
  user?: string;
3317
+ signal?: AbortSignal;
3318
+ pty?: boolean | ContainerExecPtyOptions;
3310
3319
  stdin?: ReadableStream | "pipe";
3311
3320
  stdout?: "pipe" | "ignore";
3312
3321
  stderr?: "pipe" | "ignore" | "combined";
3313
3322
  }
3323
+ interface ContainerExecPtyOptions {
3324
+ cols?: number;
3325
+ rows?: number;
3326
+ }
3314
3327
  interface ExecProcess {
3315
3328
  readonly stdin: WritableStream | null;
3316
3329
  readonly stdout: ReadableStream | null;
3317
3330
  readonly stderr: ReadableStream | null;
3318
3331
  readonly pid: number;
3332
+ readonly isPty: boolean;
3319
3333
  readonly exitCode: Promise<number>;
3320
3334
  output(): Promise<ExecOutput>;
3321
3335
  kill(signal?: number): void;
3336
+ resize(cols: number, rows: number): void;
3322
3337
  }
3323
3338
  interface Container {
3324
3339
  get running(): boolean;
@@ -3365,6 +3380,11 @@ interface ContainerStartupOptions {
3365
3380
  directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3366
3381
  containerSnapshot?: ContainerSnapshot;
3367
3382
  }
3383
+ interface ContainerStartResources {
3384
+ vcpu: number;
3385
+ memoryMib: number;
3386
+ diskMb: number;
3387
+ }
3368
3388
  /**
3369
3389
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
3370
3390
  *
@@ -3505,11 +3525,13 @@ declare abstract class Performance {
3505
3525
  interface Tracing {
3506
3526
  enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
3507
3527
  startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
3528
+ startSpan(name: string): Span;
3508
3529
  Span: typeof Span;
3509
3530
  }
3510
3531
  declare abstract class Span {
3511
3532
  get isTraced(): boolean;
3512
- setAttribute(key: string, value?: (boolean | number | string)): void;
3533
+ setAttribute(key: string, value: boolean | number | string): this;
3534
+ setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
3513
3535
  end(): void;
3514
3536
  }
3515
3537
  /**
@@ -4149,6 +4171,13 @@ type AiSearchListItemsParams = {
4149
4171
  source?: string;
4150
4172
  /** JSON-encoded Vectorize filter for metadata filtering. */
4151
4173
  metadata_filter?: string;
4174
+ /** Filter items by their unique ID. Returns at most one item. */
4175
+ item_id?: string;
4176
+ /**
4177
+ * Filter items by their exact key (object key / filename). Keys are unique
4178
+ * per source, so combine with `source` to disambiguate across data sources.
4179
+ */
4180
+ key?: string;
4152
4181
  };
4153
4182
  type AiSearchListItemsResponse = {
4154
4183
  result: AiSearchItemInfo[];
@@ -12437,6 +12466,15 @@ interface Hyperdrive {
12437
12466
  * for your database.
12438
12467
  */
12439
12468
  readonly host: string;
12469
+ /*
12470
+ * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the
12471
+ * host field, is only valid within the context of the currently running
12472
+ * Worker and, when passed into the `connect()` function from the
12473
+ * "cloudflare:sockets" module, will connect to the Hyperdrive instance for
12474
+ * your database. This is provided for database drivers that require the host
12475
+ * to be an IP literal rather than a hostname.
12476
+ */
12477
+ readonly ip: string;
12440
12478
  /*
12441
12479
  * The port that must be paired the the host field when connecting.
12442
12480
  */
@@ -13123,6 +13161,26 @@ declare namespace CloudflareWorkersModule {
13123
13161
  timeout?: WorkflowTimeoutDuration | number;
13124
13162
  sensitive?: WorkflowStepSensitivity;
13125
13163
  };
13164
+ // Internal discriminators used only for `WorkflowStep.do` overload
13165
+ // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a
13166
+ // single kind so the callback context can be narrowed based on the shape of
13167
+ // the config argument (rather than on an inferred type parameter, which is
13168
+ // lost when the caller supplies an explicit return-type argument). Not
13169
+ // exported: they must not widen the public type surface.
13170
+ type WorkflowStepConfigWithStaticDelay = Omit<WorkflowStepConfig, 'retries'> & {
13171
+ retries?: {
13172
+ limit: number;
13173
+ delay: WorkflowDelayDuration | number;
13174
+ backoff?: WorkflowBackoff;
13175
+ };
13176
+ };
13177
+ type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
13178
+ retries: {
13179
+ limit: number;
13180
+ delay: WorkflowDelayFunction;
13181
+ backoff?: WorkflowBackoff;
13182
+ };
13183
+ };
13126
13184
  export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
13127
13185
  export type WorkflowCronSchedule = {
13128
13186
  /** Cron expression that triggered this event. */
@@ -13160,23 +13218,35 @@ declare namespace CloudflareWorkersModule {
13160
13218
  sensitive?: WorkflowStepSensitivity;
13161
13219
  };
13162
13220
  };
13163
- export type WorkflowRollbackContext<T = unknown> = {
13164
- ctx: WorkflowStepContext;
13221
+ // The rollback handler receives the step context, so it mirrors the same
13222
+ // delay discriminant as the step callback: when the step was configured with
13223
+ // a dynamic delay function the resolved `config.retries.delay` is omitted,
13224
+ // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`
13225
+ // overload that matched the step config.
13226
+ export type WorkflowRollbackContext<T = unknown, Delay = WorkflowDelayDuration | number> = {
13227
+ ctx: WorkflowStepContext<Delay>;
13165
13228
  error: Error;
13166
13229
  output: T | undefined;
13167
13230
  /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
13168
13231
  stepName: string;
13169
13232
  };
13170
- export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
13171
- export type WorkflowStepRollbackOptions<T = unknown> = {
13172
- rollback: WorkflowRollbackHandler<T>;
13233
+ export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
13234
+ export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
13235
+ rollback: WorkflowRollbackHandler<T, Delay>;
13173
13236
  rollbackConfig?: WorkflowStepRollbackConfig;
13174
13237
  };
13175
13238
  export abstract class WorkflowStep {
13176
13239
  do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
13177
- do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(name: string, config: C, callback: (ctx: WorkflowStepContext<C['retries'] extends {
13178
- delay: infer D;
13179
- } ? D : WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
13240
+ // The config overloads discriminate on the shape of `config.retries.delay`
13241
+ // so the callback context reflects whether the resolved delay is present
13242
+ // (static delay) or omitted (dynamic delay function). Each has a single
13243
+ // type parameter, so an explicit return-type argument (`do<T>(...)`) still
13244
+ // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`
13245
+ // fallback MUST remain last, otherwise it shadows the discriminating
13246
+ // overloads and narrowing is silently lost.
13247
+ do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
13248
+ do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
13249
+ do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
13180
13250
  sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
13181
13251
  sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
13182
13252
  waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
@@ -13951,11 +14021,12 @@ type MarkdownDocument = {
13951
14021
  name: string;
13952
14022
  blob: Blob;
13953
14023
  };
14024
+ type OutputFormat = 'markdown' | 'text';
13954
14025
  type ConversionResponse = {
13955
14026
  id: string;
13956
14027
  name: string;
13957
14028
  mimeType: string;
13958
- format: 'markdown';
14029
+ format: OutputFormat;
13959
14030
  tokens: number;
13960
14031
  data: string;
13961
14032
  } | {
@@ -13972,7 +14043,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
13972
14043
  convert?: boolean;
13973
14044
  maxConvertedImages?: number;
13974
14045
  };
14046
+ type ConversionOutputOptions = {
14047
+ format?: OutputFormat;
14048
+ };
13975
14049
  type ConversionOptions = {
14050
+ output?: ConversionOutputOptions;
13976
14051
  html?: {
13977
14052
  images?: EmbeddedImageConversionOptions & {
13978
14053
  convertOGImage?: boolean;
@@ -14121,11 +14196,22 @@ declare namespace TailStream {
14121
14196
  readonly message: string;
14122
14197
  readonly stack?: string;
14123
14198
  }
14124
- interface Log {
14199
+ interface TailStreamErrorInfo {
14200
+ readonly name: string;
14201
+ readonly message: string;
14202
+ readonly stack?: string;
14203
+ }
14204
+ type Log = {
14125
14205
  readonly type: "log";
14126
14206
  readonly level: "debug" | "error" | "info" | "log" | "warn";
14207
+ readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];
14208
+ } & ({
14127
14209
  readonly message: object;
14128
- }
14210
+ readonly truncated?: false;
14211
+ } | {
14212
+ readonly message: string;
14213
+ readonly truncated: true;
14214
+ });
14129
14215
  interface DroppedEventsDiagnostic {
14130
14216
  readonly diagnosticsType: "droppedEvents";
14131
14217
  readonly count: number;
@@ -14603,7 +14689,25 @@ declare abstract class Workflow<PARAMS = unknown> {
14603
14689
  * @returns A promise that resolves with a list of handles for the created instances.
14604
14690
  */
14605
14691
  public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
14692
+ /**
14693
+ * Delete a batch of Workflow instances and their stored state.
14694
+ * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.
14695
+ * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.
14696
+ * @param instanceIds IDs of the Workflow instances to delete
14697
+ * @returns A promise that resolves with the successfully deleted instances and any per-instance errors.
14698
+ */
14699
+ public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
14606
14700
  }
14701
+ type WorkflowBatchDeleteResult = {
14702
+ deleted: {
14703
+ id: string;
14704
+ }[];
14705
+ errors: {
14706
+ id: string;
14707
+ code: number;
14708
+ message: string;
14709
+ }[];
14710
+ };
14607
14711
  type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
14608
14712
  type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
14609
14713
  type WorkflowRetentionDuration = WorkflowSleepDuration;
@@ -14690,6 +14794,10 @@ declare abstract class WorkflowInstance {
14690
14794
  * @param options Options for the restart, including an optional step to restart from.
14691
14795
  */
14692
14796
  public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
14797
+ /**
14798
+ * Delete the instance and its stored state.
14799
+ */
14800
+ public delete(): Promise<void>;
14693
14801
  /**
14694
14802
  * Returns the current status of the instance.
14695
14803
  */
@@ -1,16 +1,13 @@
1
1
  import path from 'node:path'
2
- import { fileURLToPath } from 'node:url'
3
2
  import { defineVitestProjectConfig } from 'repoctl/tooling'
4
3
  import { defineProject } from 'vitest/config'
5
4
 
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
-
8
5
  export default defineProject(await defineVitestProjectConfig({
9
6
  options: {
10
7
  alias: [
11
8
  {
12
9
  find: '@',
13
- replacement: path.resolve(__dirname, './src'),
10
+ replacement: path.resolve(import.meta.dirname, './src'),
14
11
  },
15
12
  ],
16
13
  },
@@ -34,9 +34,9 @@ description: 说明这个页面解决的问题和适用场景。
34
34
 
35
35
  AI 入口应该保持显眼,但不要替代正常文档结构:
36
36
 
37
- | 页面类型 | 推荐位置 |
38
- | ------------------------------------- | ------------------------------------ |
39
- | repoctl 命令、校验、诊断、报告 | `/repoctl/` |
40
- | monorepo 和 npm 包基础知识 | `/knowledge/`、`/monorepo/`、`/why/` |
41
- | pnpm、Turborepo、changeset 等工具专题 | `/tools/` |
42
- | llms.txt 和 AI 工具读取约定 | `/ai/` |
37
+ | 页面类型 | 推荐位置 |
38
+ | -------------------------------------- | ------------------------------------ |
39
+ | repoctl 命令、校验、诊断、报告 | `/repoctl/` |
40
+ | monorepo 和 npm 包基础知识 | `/knowledge/`、`/monorepo/`、`/why/` |
41
+ | pnpm、Turborepo、versioning 等工具专题 | `/tools/` |
42
+ | llms.txt 和 AI 工具读取约定 | `/ai/` |
@@ -2,7 +2,7 @@
2
2
 
3
3
  `repoctl` is the user-facing package name for this monorepo toolkit. Its recommended command is `repo`.
4
4
 
5
- The CLI does not replace pnpm, Turborepo, or changesets. It gives teams a stable layer for common monorepo actions: setup, diagnostics, scaffolding, local verification, and template asset upgrades.
5
+ The CLI does not replace pnpm, Turborepo, or pnpm versioning. It gives teams a stable layer for common monorepo actions: setup, diagnostics, scaffolding, local verification, and template asset upgrades.
6
6
 
7
7
  ## When To Use It
8
8
 
@@ -12,7 +12,7 @@ description: repoctl 文档站的知识库入口,汇总 monorepo 管理、现
12
12
  | -------------------------------------------------- | ---------------------------------- |
13
13
  | [为什么往 monorepo 方向演进](../monorepo/index.md) | 判断多包仓库是否值得合并管理 |
14
14
  | [如何管理 monorepo](../monorepo/manage.md) | 理解 workspace、任务编排和依赖边界 |
15
- | [发包与变更日志](../monorepo/publish.md) | 设计 changeset、版本和发布链路 |
15
+ | [发包与变更日志](../monorepo/publish.md) | 设计 pnpm intent、版本和发布链路 |
16
16
  | [monorepo 命令参考](../monorepo/commands.md) | 查看通用 monorepo 操作命令 |
17
17
  | [monorepo 模板体系](../monorepo/templates.md) | 理解模板如何减少重复初始化 |
18
18
  | [monorepo 排障](../monorepo/troubleshooting.md) | 排查依赖、构建、类型和发布问题 |
@@ -47,7 +47,7 @@
47
47
  | 语言 | TypeScript 优先 |
48
48
  | 校验链路 | ESLint + Stylelint + typecheck + Vitest |
49
49
  | 提交规范 | Husky + lint-staged + commitlint |
50
- | 发包 | changesets |
50
+ | 发包 | pnpm versioning |
51
51
  | 命令入口 | `repo` 为主,`repoctl` 为完整包名入口 |
52
52
 
53
53
  这些选择的目的只有一个:减少“每个项目重新想一遍”的成本。