@bakers-build/addon-workspace-git 0.7.1-next.7 → 0.8.1-next.1

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.
@@ -5,7 +5,7 @@ export { pushCurrentEnv, runBranchGit, setNoAutoSetupMerge, } from './git-config
5
5
  export { loadInstructions } from './instructions.js';
6
6
  export { removeGitWorktree, type WorktreeGitExec, } from './remove-git-worktree.js';
7
7
  /** Default branch template: `<prefix><key>-<title-slug>` (readable). */
8
- export declare const DEFAULT_BRANCH_TEMPLATE = "{branchPrefix}{key}-{titleSlug}";
8
+ export declare const DEFAULT_BRANCH_TEMPLATE = "{branch_prefix}{key}-{title_slug}";
9
9
  /** Runs `git <args>` in a cwd; resolves with stdout when it has one. */
10
10
  export type GitRunner = (args: string[], cwd: string) => Promise<string | undefined>;
11
11
  export interface GitWorkspaceOptions {
@@ -16,8 +16,8 @@ export interface GitWorkspaceOptions {
16
16
  /** Branch name prefix per ticket. Default: 'bakers/'. */
17
17
  branchPrefix?: string;
18
18
  /**
19
- * Branch name template. Vars: {branchPrefix}, {key} (sanitized identifier),
20
- * {identifier}, {titleSlug}. Default: `{branchPrefix}{key}-{titleSlug}`.
19
+ * Branch name template. Vars: {branch_prefix}, {key} (sanitized identifier),
20
+ * {identifier}, {title_slug}. Default: `{branch_prefix}{key}-{title_slug}`.
21
21
  */
22
22
  branchTemplate?: string;
23
23
  /**
@@ -46,5 +46,11 @@ export declare class GitWorkspace implements BbWorkspace {
46
46
  /** Tear down the ticket worktree with git ({@link removeGitWorktree}). */
47
47
  remove(branch: string, worktreePath?: string): Promise<WorktreeTeardown>;
48
48
  }
49
- export declare function gitWorkspace(opts?: Pick<GitWorkspaceOptions, 'branchPrefix' | 'branchTemplate' | 'autoSetupMerge'>): WorkspacePlugin;
49
+ /** The addon entry's `with` value (see options.schema.json). */
50
+ export interface GitWorkspaceAddonOptions {
51
+ branch_prefix?: string;
52
+ branch_template?: string;
53
+ auto_setup_merge?: boolean;
54
+ }
55
+ export declare function gitWorkspace(opts?: GitWorkspaceAddonOptions): WorkspacePlugin;
50
56
  export default gitWorkspace;
package/dist/src/index.js CHANGED
@@ -14,7 +14,7 @@ export { pushCurrentEnv, runBranchGit, setNoAutoSetupMerge, } from './git-config
14
14
  export { loadInstructions } from './instructions.js';
15
15
  export { removeGitWorktree, } from './remove-git-worktree.js';
16
16
  /** Default branch template: `<prefix><key>-<title-slug>` (readable). */
17
- export const DEFAULT_BRANCH_TEMPLATE = '{branchPrefix}{key}-{titleSlug}';
17
+ export const DEFAULT_BRANCH_TEMPLATE = '{branch_prefix}{key}-{title_slug}';
18
18
  function renderBranchTemplate(template, vars) {
19
19
  const rendered = template.replace(/\{(\w+)\}/g, (whole, key) => {
20
20
  const value = vars[key];
@@ -53,10 +53,10 @@ export class GitWorkspace {
53
53
  /** Render the branch name for a ticket from the configured template. */
54
54
  branchFor(identifier, title) {
55
55
  return renderBranchTemplate(this.branchTemplate, {
56
- branchPrefix: this.branchPrefix,
56
+ branch_prefix: this.branchPrefix,
57
57
  key: this.keyFor(identifier),
58
58
  identifier,
59
- titleSlug: slugify(title ?? ''),
59
+ title_slug: slugify(title ?? ''),
60
60
  });
61
61
  }
62
62
  keyFor(identifier) {
@@ -103,7 +103,7 @@ export class GitWorkspace {
103
103
  }
104
104
  export function gitWorkspace(opts = {}) {
105
105
  return {
106
- kind: 'workspace',
106
+ kind: 'worktree',
107
107
  id: 'git',
108
108
  requiredModules: [],
109
109
  async createWorkspace(config, deps) {
@@ -112,9 +112,11 @@ export function gitWorkspace(opts = {}) {
112
112
  const root = await deriveCheckoutRoot(config.config_path);
113
113
  return new GitWorkspace({
114
114
  root,
115
- ...(opts.branchPrefix ? { branchPrefix: opts.branchPrefix } : {}),
116
- ...(opts.branchTemplate ? { branchTemplate: opts.branchTemplate } : {}),
117
- ...(opts.autoSetupMerge ? { autoSetupMerge: true } : {}),
115
+ ...(opts.branch_prefix ? { branchPrefix: opts.branch_prefix } : {}),
116
+ ...(opts.branch_template
117
+ ? { branchTemplate: opts.branch_template }
118
+ : {}),
119
+ ...(opts.auto_setup_merge ? { autoSetupMerge: true } : {}),
118
120
  ...(deps?.logger ? { logger: deps.logger } : {}),
119
121
  });
120
122
  },
@@ -1,3 +1,3 @@
1
1
  import type { Preset } from '@bakers-build/conductor/contract';
2
- export declare const workspaces: Preset['workspaces'];
2
+ export declare const worktrees: Preset['worktrees'];
3
3
  export declare const scopes: Preset['scopes'];
@@ -1,7 +1,7 @@
1
1
  import { gitWorkspace } from './index.js';
2
- export const workspaces = (acc, opts) => [
2
+ export const worktrees = (acc, opts) => [
3
3
  ...acc,
4
4
  gitWorkspace(opts),
5
5
  ];
6
- // Conductor wiring of one project: list this addon in .bakers/conductor.config.js addons[].
6
+ // Conductor wiring of one project: list this addon in .bakers/project.config.js addons[].
7
7
  export const scopes = ['project'];
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bakers.build/schema/addon-workspace-git/options.schema.json",
4
+ "title": "@bakers-build/addon-workspace-git options",
5
+ "type": "object",
6
+ "properties": {
7
+ "branch_prefix": {
8
+ "type": "string",
9
+ "description": "Branch name prefix per ticket. Default: 'bakers/'."
10
+ },
11
+ "branch_template": {
12
+ "type": "string",
13
+ "description": "Branch name template. Placeholders: {branch_prefix}, {key}, {identifier}, {title_slug}. Default: '{branch_prefix}{key}-{title_slug}'."
14
+ },
15
+ "auto_setup_merge": {
16
+ "type": "boolean",
17
+ "description": "true leaves Git's branch.autoSetupMerge alone; default false sets it to false before creating a worktree."
18
+ }
19
+ },
20
+ "additionalProperties": false
21
+ }
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-workspace-git",
3
- "version": "0.7.1-next.7",
3
+ "version": "0.8.1-next.1",
4
4
  "description": "bakers.build conductor workspace addon: plain git-worktree workspace + the WORKFLOW.md instruction loader.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "exports": {
8
8
  ".": "./dist/src/index.js",
9
- "./preset": "./dist/src/preset.js"
9
+ "./preset": "./dist/src/preset.js",
10
+ "./options.schema.json": "./options.schema.json"
10
11
  },
11
12
  "files": [
12
- "dist/src"
13
+ "dist/src",
14
+ "options.schema.json"
13
15
  ],
14
16
  "publishConfig": {
15
17
  "access": "public"
@@ -20,11 +22,11 @@
20
22
  "directory": "bakers-cli/addons/workspace-git"
21
23
  },
22
24
  "peerDependencies": {
23
- "@bakers-build/conductor": "^0.7.1-next.7",
24
- "@bakers-build/core": "^0.7.1-next.7"
25
+ "@bakers-build/conductor": "^0.8.1-next.1",
26
+ "@bakers-build/core": "^0.8.1-next.1"
25
27
  },
26
28
  "bakersBuild": {
27
- "commit": "082d8c57436f78e751f5a9a26a4446cec42209ce",
29
+ "commit": "c4a887bee37bb2fed14bb9ba15ad0aacf0e26f7e",
28
30
  "channel": "next"
29
31
  }
30
32
  }