@teambit/ci 1.0.643 → 1.0.644

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.
@@ -1,5 +1,5 @@
1
1
  ;
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.git_ci@1.0.643/dist/ci.docs.mdx';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.git_ci@1.0.644/dist/ci.docs.mdx';
3
3
 
4
4
  export const compositions = [];
5
5
  export const overview = [overview_0];
@@ -0,0 +1,50 @@
1
+ import type { ScaffoldFileOutcome } from './init-scaffold';
2
+ /**
3
+ * `bit ci sync --init` writes the sync rules for coding agents into AGENTS.md. Agents that work in a
4
+ * mirror must know that review happens on the pull request, that the workflows own the default branch,
5
+ * and how a lane and a branch map to each other. The generic Bit instructions say otherwise (a bit.cloud
6
+ * change request, `bit tag` on main), so the section goes at the top and says that it wins.
7
+ *
8
+ * TEMPLATE SOURCE OF TRUTH: `agents-sync-section.md`, next to this file. The reference repository
9
+ * teambit/acme-modular-store carries the same section, rendered for its scope.
10
+ */
11
+ /** Where `--init` writes the agent instructions, relative to the workspace root. */
12
+ export declare const AGENTS_MD_RELATIVE_PATH = "AGENTS.md";
13
+ /** The marker that opens the section. Its presence means the section is there: a re-run leaves the file alone. */
14
+ export declare const AGENTS_SECTION_START = "<!-- bit-ci-sync:start";
15
+ /** The marker that closes the section. */
16
+ export declare const AGENTS_SECTION_END = "<!-- bit-ci-sync:end -->";
17
+ /**
18
+ * The repository value when `--init` runs before origin is a GitHub remote. It differs from the
19
+ * `<org>/<repo>` examples in the section, so a later run can fill in this one and leave those alone.
20
+ */
21
+ export declare const UNKNOWN_REPO = "<org>/<this-repo>";
22
+ export interface AgentsSectionValues {
23
+ /** the scope this repository mirrors, e.g. `acme.billing` */
24
+ scope: string;
25
+ /** the repository as `gh -R` takes it: `owner/repo`, or `host/owner/repo` on GitHub Enterprise Server */
26
+ repo: string;
27
+ /** the repository's default branch, the one the workflows own */
28
+ defaultBranch: string;
29
+ }
30
+ /**
31
+ * The sync section, with the scope, the repository and the default branch filled in. `{{branch-sh}}`
32
+ * is the branch as a shell word, for commands: a git branch name can hold `$` or a quote.
33
+ */
34
+ export declare function renderAgentsSection(values: AgentsSectionValues): string;
35
+ /**
36
+ * `existing` with `section` placed after its title and the paragraph under the title, and before
37
+ * everything else. Front matter stays first. A file with no title gets the section at the top.
38
+ */
39
+ export declare function insertAgentsSection(existing: string, section: string): string;
40
+ /**
41
+ * Write the sync section into `<workspaceDir>/AGENTS.md`. A missing file is created, an existing file
42
+ * gets the section at the top, and a file that already has it is left unchanged, hand edits included.
43
+ * One exception: a section written before the repository was known gets the repository filled in.
44
+ */
45
+ export declare function scaffoldAgentsMd(workspaceDir: string, values: AgentsSectionValues): ScaffoldFileOutcome;
46
+ /**
47
+ * `content` with `UNKNOWN_REPO` replaced by `repo` inside the sync section only. Unchanged when the
48
+ * repository is still unknown, or the section has no placeholder left.
49
+ */
50
+ export declare function fillInRepo(content: string, repo: string): string;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UNKNOWN_REPO = exports.AGENTS_SECTION_START = exports.AGENTS_SECTION_END = exports.AGENTS_MD_RELATIVE_PATH = void 0;
7
+ exports.fillInRepo = fillInRepo;
8
+ exports.insertAgentsSection = insertAgentsSection;
9
+ exports.renderAgentsSection = renderAgentsSection;
10
+ exports.scaffoldAgentsMd = scaffoldAgentsMd;
11
+ function _fs() {
12
+ const data = _interopRequireDefault(require("fs"));
13
+ _fs = function () {
14
+ return data;
15
+ };
16
+ return data;
17
+ }
18
+ function _path() {
19
+ const data = _interopRequireDefault(require("path"));
20
+ _path = function () {
21
+ return data;
22
+ };
23
+ return data;
24
+ }
25
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
+ /**
27
+ * `bit ci sync --init` writes the sync rules for coding agents into AGENTS.md. Agents that work in a
28
+ * mirror must know that review happens on the pull request, that the workflows own the default branch,
29
+ * and how a lane and a branch map to each other. The generic Bit instructions say otherwise (a bit.cloud
30
+ * change request, `bit tag` on main), so the section goes at the top and says that it wins.
31
+ *
32
+ * TEMPLATE SOURCE OF TRUTH: `agents-sync-section.md`, next to this file. The reference repository
33
+ * teambit/acme-modular-store carries the same section, rendered for its scope.
34
+ */
35
+
36
+ /** Where `--init` writes the agent instructions, relative to the workspace root. */
37
+ const AGENTS_MD_RELATIVE_PATH = exports.AGENTS_MD_RELATIVE_PATH = 'AGENTS.md';
38
+
39
+ /** The marker that opens the section. Its presence means the section is there: a re-run leaves the file alone. */
40
+ const AGENTS_SECTION_START = exports.AGENTS_SECTION_START = '<!-- bit-ci-sync:start';
41
+
42
+ /** The marker that closes the section. */
43
+ const AGENTS_SECTION_END = exports.AGENTS_SECTION_END = '<!-- bit-ci-sync:end -->';
44
+
45
+ /**
46
+ * The repository value when `--init` runs before origin is a GitHub remote. It differs from the
47
+ * `<org>/<repo>` examples in the section, so a later run can fill in this one and leave those alone.
48
+ */
49
+ const UNKNOWN_REPO = exports.UNKNOWN_REPO = '<org>/<this-repo>';
50
+
51
+ /** The title of an AGENTS.md that `--init` creates. */
52
+ const NEW_FILE_TITLE = '# Agent instructions';
53
+ /**
54
+ * The sync section, with the scope, the repository and the default branch filled in. `{{branch-sh}}`
55
+ * is the branch as a shell word, for commands: a git branch name can hold `$` or a quote.
56
+ */
57
+ function renderAgentsSection(values) {
58
+ const raw = _fs().default.readFileSync(_path().default.join(__dirname, 'agents-sync-section.md'), 'utf8');
59
+ const byKey = {
60
+ scope: values.scope,
61
+ repo: values.repo,
62
+ branch: values.defaultBranch,
63
+ 'branch-sh': shellWord(values.defaultBranch)
64
+ };
65
+ // A function replacement inserts the value verbatim: `$` is legal in a branch name.
66
+ return raw.replace(/\{\{(scope|repo|branch|branch-sh)\}\}/g, (_match, key) => byKey[key]);
67
+ }
68
+
69
+ /**
70
+ * `value` as one POSIX shell word: plain names as they are, anything else single-quoted. The same
71
+ * rule as `shellQuote` in init-scaffold.ts, which imports this module, so it is not imported here.
72
+ */
73
+ function shellWord(value) {
74
+ return /^[\w./@:+-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
75
+ }
76
+
77
+ /**
78
+ * Does `line` open a Markdown block other than a paragraph: a heading, a rule, a fence, a comment, a
79
+ * table, a quote, or a bulleted or numbered list item?
80
+ */
81
+ function startsBlock(line) {
82
+ return /^\s*(#{1,6}(\s|$)|---|```|~~~|<!--|\||>|[-*+](\s|$)|\d+[.)](\s|$))/.test(line);
83
+ }
84
+
85
+ /** Is `line` a level-one ATX heading? Markdown permits up to three spaces before the `#`. */
86
+ function isTitle(line) {
87
+ return /^ {0,3}#(\s|$)/.test(line);
88
+ }
89
+
90
+ /**
91
+ * `existing` with `section` placed after its title and the paragraph under the title, and before
92
+ * everything else. Front matter stays first. A file with no title gets the section at the top.
93
+ */
94
+ function insertAgentsSection(existing, section) {
95
+ const lines = existing.split('\n');
96
+ let at = 0;
97
+ if (lines[0]?.trim() === '---') {
98
+ // YAML closes a document with `---` or `...`.
99
+ const end = lines.findIndex((line, i) => i > 0 && (line.trim() === '---' || line.trim() === '...'));
100
+ if (end > 0) at = end + 1;
101
+ }
102
+ let next = at;
103
+ while (next < lines.length && !lines[next].trim()) next++;
104
+ if (next < lines.length && isTitle(lines[next])) {
105
+ next++;
106
+ while (next < lines.length && !lines[next].trim()) next++;
107
+ // The paragraph under the title introduces the file; it stays with the title. A list, a heading or
108
+ // another block is content: the section goes before it, so the rules come first.
109
+ if (next < lines.length && !startsBlock(lines[next])) {
110
+ next++;
111
+ while (next < lines.length && lines[next].trim() && !startsBlock(lines[next])) next++;
112
+ }
113
+ at = next;
114
+ }
115
+ const before = lines.slice(0, at).join('\n').trimEnd();
116
+ const after = lines.slice(at).join('\n').trim();
117
+ const parts = [before, section.trim(), ...(after ? ['---', after] : [])].filter(Boolean);
118
+ return `${parts.join('\n\n')}\n`;
119
+ }
120
+
121
+ /**
122
+ * Write the sync section into `<workspaceDir>/AGENTS.md`. A missing file is created, an existing file
123
+ * gets the section at the top, and a file that already has it is left unchanged, hand edits included.
124
+ * One exception: a section written before the repository was known gets the repository filled in.
125
+ */
126
+ function scaffoldAgentsMd(workspaceDir, values) {
127
+ const relativePath = AGENTS_MD_RELATIVE_PATH;
128
+ const absPath = _path().default.join(workspaceDir, relativePath);
129
+ const section = renderAgentsSection(values);
130
+ if (!_fs().default.existsSync(absPath)) {
131
+ _fs().default.writeFileSync(absPath, `${NEW_FILE_TITLE}\n\n${section.trim()}\n`);
132
+ return {
133
+ relativePath,
134
+ status: 'written'
135
+ };
136
+ }
137
+ const existing = _fs().default.readFileSync(absPath, 'utf8');
138
+ if (existing.includes(AGENTS_SECTION_START)) {
139
+ const filled = fillInRepo(existing, values.repo);
140
+ if (filled === existing) return {
141
+ relativePath,
142
+ status: 'skipped'
143
+ };
144
+ _fs().default.writeFileSync(absPath, filled);
145
+ return {
146
+ relativePath,
147
+ status: 'updated',
148
+ note: 'filled in the repository in the sync rules'
149
+ };
150
+ }
151
+ _fs().default.writeFileSync(absPath, insertAgentsSection(existing, section));
152
+ return {
153
+ relativePath,
154
+ status: 'updated'
155
+ };
156
+ }
157
+
158
+ /**
159
+ * `content` with `UNKNOWN_REPO` replaced by `repo` inside the sync section only. Unchanged when the
160
+ * repository is still unknown, or the section has no placeholder left.
161
+ */
162
+ function fillInRepo(content, repo) {
163
+ if (repo === UNKNOWN_REPO) return content;
164
+ const start = content.indexOf(AGENTS_SECTION_START);
165
+ const end = content.indexOf(AGENTS_SECTION_END, start);
166
+ if (start < 0 || end < 0) return content;
167
+ const section = content.slice(start, end);
168
+ if (!section.includes(UNKNOWN_REPO)) return content;
169
+ return content.slice(0, start) + section.split(UNKNOWN_REPO).join(repo) + content.slice(end);
170
+ }
171
+
172
+ //# sourceMappingURL=agents-md.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_fs","data","_interopRequireDefault","require","_path","e","__esModule","default","AGENTS_MD_RELATIVE_PATH","exports","AGENTS_SECTION_START","AGENTS_SECTION_END","UNKNOWN_REPO","NEW_FILE_TITLE","renderAgentsSection","values","raw","fs","readFileSync","path","join","__dirname","byKey","scope","repo","branch","defaultBranch","shellWord","replace","_match","key","value","test","startsBlock","line","isTitle","insertAgentsSection","existing","section","lines","split","at","trim","end","findIndex","i","next","length","before","slice","trimEnd","after","parts","filter","Boolean","scaffoldAgentsMd","workspaceDir","relativePath","absPath","existsSync","writeFileSync","status","includes","filled","fillInRepo","note","content","start","indexOf"],"sources":["agents-md.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { ScaffoldFileOutcome } from './init-scaffold';\n\n/**\n * `bit ci sync --init` writes the sync rules for coding agents into AGENTS.md. Agents that work in a\n * mirror must know that review happens on the pull request, that the workflows own the default branch,\n * and how a lane and a branch map to each other. The generic Bit instructions say otherwise (a bit.cloud\n * change request, `bit tag` on main), so the section goes at the top and says that it wins.\n *\n * TEMPLATE SOURCE OF TRUTH: `agents-sync-section.md`, next to this file. The reference repository\n * teambit/acme-modular-store carries the same section, rendered for its scope.\n */\n\n/** Where `--init` writes the agent instructions, relative to the workspace root. */\nexport const AGENTS_MD_RELATIVE_PATH = 'AGENTS.md';\n\n/** The marker that opens the section. Its presence means the section is there: a re-run leaves the file alone. */\nexport const AGENTS_SECTION_START = '<!-- bit-ci-sync:start';\n\n/** The marker that closes the section. */\nexport const AGENTS_SECTION_END = '<!-- bit-ci-sync:end -->';\n\n/**\n * The repository value when `--init` runs before origin is a GitHub remote. It differs from the\n * `<org>/<repo>` examples in the section, so a later run can fill in this one and leave those alone.\n */\nexport const UNKNOWN_REPO = '<org>/<this-repo>';\n\n/** The title of an AGENTS.md that `--init` creates. */\nconst NEW_FILE_TITLE = '# Agent instructions';\n\nexport interface AgentsSectionValues {\n /** the scope this repository mirrors, e.g. `acme.billing` */\n scope: string;\n /** the repository as `gh -R` takes it: `owner/repo`, or `host/owner/repo` on GitHub Enterprise Server */\n repo: string;\n /** the repository's default branch, the one the workflows own */\n defaultBranch: string;\n}\n\n/**\n * The sync section, with the scope, the repository and the default branch filled in. `{{branch-sh}}`\n * is the branch as a shell word, for commands: a git branch name can hold `$` or a quote.\n */\nexport function renderAgentsSection(values: AgentsSectionValues): string {\n const raw = fs.readFileSync(path.join(__dirname, 'agents-sync-section.md'), 'utf8');\n const byKey: Record<string, string> = {\n scope: values.scope,\n repo: values.repo,\n branch: values.defaultBranch,\n 'branch-sh': shellWord(values.defaultBranch),\n };\n // A function replacement inserts the value verbatim: `$` is legal in a branch name.\n return raw.replace(/\\{\\{(scope|repo|branch|branch-sh)\\}\\}/g, (_match, key: string) => byKey[key]);\n}\n\n/**\n * `value` as one POSIX shell word: plain names as they are, anything else single-quoted. The same\n * rule as `shellQuote` in init-scaffold.ts, which imports this module, so it is not imported here.\n */\nfunction shellWord(value: string): string {\n return /^[\\w./@:+-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n/**\n * Does `line` open a Markdown block other than a paragraph: a heading, a rule, a fence, a comment, a\n * table, a quote, or a bulleted or numbered list item?\n */\nfunction startsBlock(line: string): boolean {\n return /^\\s*(#{1,6}(\\s|$)|---|```|~~~|<!--|\\||>|[-*+](\\s|$)|\\d+[.)](\\s|$))/.test(line);\n}\n\n/** Is `line` a level-one ATX heading? Markdown permits up to three spaces before the `#`. */\nfunction isTitle(line: string): boolean {\n return /^ {0,3}#(\\s|$)/.test(line);\n}\n\n/**\n * `existing` with `section` placed after its title and the paragraph under the title, and before\n * everything else. Front matter stays first. A file with no title gets the section at the top.\n */\nexport function insertAgentsSection(existing: string, section: string): string {\n const lines = existing.split('\\n');\n let at = 0;\n if (lines[0]?.trim() === '---') {\n // YAML closes a document with `---` or `...`.\n const end = lines.findIndex((line, i) => i > 0 && (line.trim() === '---' || line.trim() === '...'));\n if (end > 0) at = end + 1;\n }\n let next = at;\n while (next < lines.length && !lines[next].trim()) next++;\n if (next < lines.length && isTitle(lines[next])) {\n next++;\n while (next < lines.length && !lines[next].trim()) next++;\n // The paragraph under the title introduces the file; it stays with the title. A list, a heading or\n // another block is content: the section goes before it, so the rules come first.\n if (next < lines.length && !startsBlock(lines[next])) {\n next++;\n while (next < lines.length && lines[next].trim() && !startsBlock(lines[next])) next++;\n }\n at = next;\n }\n const before = lines.slice(0, at).join('\\n').trimEnd();\n const after = lines.slice(at).join('\\n').trim();\n const parts = [before, section.trim(), ...(after ? ['---', after] : [])].filter(Boolean);\n return `${parts.join('\\n\\n')}\\n`;\n}\n\n/**\n * Write the sync section into `<workspaceDir>/AGENTS.md`. A missing file is created, an existing file\n * gets the section at the top, and a file that already has it is left unchanged, hand edits included.\n * One exception: a section written before the repository was known gets the repository filled in.\n */\nexport function scaffoldAgentsMd(workspaceDir: string, values: AgentsSectionValues): ScaffoldFileOutcome {\n const relativePath = AGENTS_MD_RELATIVE_PATH;\n const absPath = path.join(workspaceDir, relativePath);\n const section = renderAgentsSection(values);\n if (!fs.existsSync(absPath)) {\n fs.writeFileSync(absPath, `${NEW_FILE_TITLE}\\n\\n${section.trim()}\\n`);\n return { relativePath, status: 'written' };\n }\n const existing = fs.readFileSync(absPath, 'utf8');\n if (existing.includes(AGENTS_SECTION_START)) {\n const filled = fillInRepo(existing, values.repo);\n if (filled === existing) return { relativePath, status: 'skipped' };\n fs.writeFileSync(absPath, filled);\n return { relativePath, status: 'updated', note: 'filled in the repository in the sync rules' };\n }\n fs.writeFileSync(absPath, insertAgentsSection(existing, section));\n return { relativePath, status: 'updated' };\n}\n\n/**\n * `content` with `UNKNOWN_REPO` replaced by `repo` inside the sync section only. Unchanged when the\n * repository is still unknown, or the section has no placeholder left.\n */\nexport function fillInRepo(content: string, repo: string): string {\n if (repo === UNKNOWN_REPO) return content;\n const start = content.indexOf(AGENTS_SECTION_START);\n const end = content.indexOf(AGENTS_SECTION_END, start);\n if (start < 0 || end < 0) return content;\n const section = content.slice(start, end);\n if (!section.includes(UNKNOWN_REPO)) return content;\n return content.slice(0, start) + section.split(UNKNOWN_REPO).join(repo) + content.slice(end);\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMG,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,WAAW;;AAElD;AACO,MAAME,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,wBAAwB;;AAE5D;AACO,MAAMC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,GAAG,0BAA0B;;AAE5D;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAAH,OAAA,CAAAG,YAAA,GAAG,mBAAmB;;AAE/C;AACA,MAAMC,cAAc,GAAG,sBAAsB;AAW7C;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,MAA2B,EAAU;EACvE,MAAMC,GAAG,GAAGC,aAAE,CAACC,YAAY,CAACC,eAAI,CAACC,IAAI,CAACC,SAAS,EAAE,wBAAwB,CAAC,EAAE,MAAM,CAAC;EACnF,MAAMC,KAA6B,GAAG;IACpCC,KAAK,EAAER,MAAM,CAACQ,KAAK;IACnBC,IAAI,EAAET,MAAM,CAACS,IAAI;IACjBC,MAAM,EAAEV,MAAM,CAACW,aAAa;IAC5B,WAAW,EAAEC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CAAC;EACnD,MAAMiC,GAAG,GAAGuB,OAAO,CAACE,OAAO,CAACzD,kBAAkB,EAAEwD,KAAK,CAAC;EACtD,IAAIA,KAAK,GAAG,CAAC,IAAIxB,GAAG,GAAG,CAAC,EAAE,OAAOuB,OAAO;EACxC,MAAM5B,OAAO,GAAG4B,OAAO,CAACjB,KAAK,CAACkB,KAAK,EAAExB,GAAG,CAAC;EACzC,IAAI,CAACL,OAAO,CAACwB,QAAQ,CAAClD,YAAY,CAAC,EAAE,OAAOsD,OAAO;EACnD,OAAOA,OAAO,CAACjB,KAAK,CAAC,CAAC,EAAEkB,KAAK,CAAC,GAAG7B,OAAO,CAACE,KAAK,CAAC5B,YAAY,CAAC,CAACQ,IAAI,CAACI,IAAI,CAAC,GAAG0C,OAAO,CAACjB,KAAK,CAACN,GAAG,CAAC;AAC9F","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ function _chai() {
4
+ const data = require("chai");
5
+ _chai = function () {
6
+ return data;
7
+ };
8
+ return data;
9
+ }
10
+ function _fs() {
11
+ const data = _interopRequireDefault(require("fs"));
12
+ _fs = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _os() {
18
+ const data = _interopRequireDefault(require("os"));
19
+ _os = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ function _path() {
25
+ const data = _interopRequireDefault(require("path"));
26
+ _path = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
31
+ function _agentsMd() {
32
+ const data = require("./agents-md");
33
+ _agentsMd = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
38
+ function _initScaffold() {
39
+ const data = require("./init-scaffold");
40
+ _initScaffold = function () {
41
+ return data;
42
+ };
43
+ return data;
44
+ }
45
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
47
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
48
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
49
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
50
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
51
+ const VALUES = {
52
+ scope: 'acme.billing',
53
+ repo: 'acme/billing',
54
+ defaultBranch: 'trunk'
55
+ };
56
+ const SECTION = '<!-- bit-ci-sync:start -->\n\n## Sync\n\nrules\n\n<!-- bit-ci-sync:end -->\n';
57
+ describe('agents-md', () => {
58
+ describe('renderAgentsSection', () => {
59
+ it('fills in every placeholder', () => {
60
+ const rendered = (0, _agentsMd().renderAgentsSection)(VALUES);
61
+ (0, _chai().expect)(rendered).to.not.include('{{');
62
+ (0, _chai().expect)(rendered).to.include('this repository mirrors `acme.billing`');
63
+ (0, _chai().expect)(rendered).to.include('gh pr list -R acme/billing --head <lane-name>');
64
+ (0, _chai().expect)(rendered).to.include('Never push to `trunk`');
65
+ (0, _chai().expect)(rendered).to.not.include('`main` equals');
66
+ });
67
+ it('inserts a branch name with `$` in it verbatim', () => {
68
+ const rendered = (0, _agentsMd().renderAgentsSection)(_objectSpread(_objectSpread({}, VALUES), {}, {
69
+ defaultBranch: "a$'b$&"
70
+ }));
71
+ (0, _chai().expect)(rendered).to.include("Never push to `a$'b$&`");
72
+ // in a command, the branch is one shell word: `$` does not expand and the quote does not end it
73
+ (0, _chai().expect)(rendered).to.include(`git switch 'a$'\\''b$&' && git pull`);
74
+ });
75
+ it('opens and closes with the markers', () => {
76
+ const rendered = (0, _agentsMd().renderAgentsSection)(VALUES).trim();
77
+ (0, _chai().expect)(rendered.startsWith(_agentsMd().AGENTS_SECTION_START)).to.equal(true);
78
+ (0, _chai().expect)(rendered.endsWith('<!-- bit-ci-sync:end -->')).to.equal(true);
79
+ });
80
+ });
81
+ describe('insertAgentsSection', () => {
82
+ it('goes after the title and the paragraph under it', () => {
83
+ const existing = '# Bit Workspace\n\nThis file teaches agents.\nRead it fully.\n\n## What is Bit?\n\nBit is…\n';
84
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`# Bit Workspace\n\nThis file teaches agents.\nRead it fully.\n\n${SECTION.trim()}\n\n---\n\n## What is Bit?\n\nBit is…\n`);
85
+ });
86
+ it('goes right after the title when a heading follows it', () => {
87
+ const existing = '# Title\n\n## First\n\ntext\n';
88
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`# Title\n\n${SECTION.trim()}\n\n---\n\n## First\n\ntext\n`);
89
+ });
90
+ it('goes before a numbered list under the title', () => {
91
+ const existing = '# Rules\n\n1. Always submit a change request.\n2. Tag on main.\n';
92
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`# Rules\n\n${SECTION.trim()}\n\n---\n\n1. Always submit a change request.\n2. Tag on main.\n`);
93
+ });
94
+ it('goes before a list that follows the intro paragraph with no blank line', () => {
95
+ const existing = '# Rules\n\nFollow these:\n1) Submit a change request.\n+ Tag on main.\n';
96
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`# Rules\n\nFollow these:\n\n${SECTION.trim()}\n\n---\n\n1) Submit a change request.\n+ Tag on main.\n`);
97
+ });
98
+ it('keeps a paragraph line that starts with `#` but is no heading in the intro', () => {
99
+ const existing = '# Rules\n\nTag the PR with\n#not-a-heading for triage.\n\n## More\n';
100
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`# Rules\n\nTag the PR with\n#not-a-heading for triage.\n\n${SECTION.trim()}\n\n---\n\n## More\n`);
101
+ });
102
+ it('finds a title indented by up to three spaces', () => {
103
+ const existing = ' # Title\n\nIntro.\n\n## First\n';
104
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(` # Title\n\nIntro.\n\n${SECTION.trim()}\n\n---\n\n## First\n`);
105
+ });
106
+ it('goes at the top of a file with no title', () => {
107
+ const existing = '## Rules\n\n- one\n';
108
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`${SECTION.trim()}\n\n---\n\n## Rules\n\n- one\n`);
109
+ });
110
+ it('keeps front matter first', () => {
111
+ const existing = '---\nalwaysApply: true\n---\n\n# Title\n\nIntro.\n';
112
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`---\nalwaysApply: true\n---\n\n# Title\n\nIntro.\n\n${SECTION.trim()}\n`);
113
+ });
114
+ it('keeps front matter that closes with `...` first', () => {
115
+ const existing = '---\nalwaysApply: true\n...\n\n# Title\n';
116
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)(existing, SECTION)).to.equal(`---\nalwaysApply: true\n...\n\n# Title\n\n${SECTION.trim()}\n`);
117
+ });
118
+ it('fills an empty file', () => {
119
+ (0, _chai().expect)((0, _agentsMd().insertAgentsSection)('', SECTION)).to.equal(`${SECTION.trim()}\n`);
120
+ });
121
+ });
122
+ describe('fillInRepo', () => {
123
+ const doc = `before ${_agentsMd().UNKNOWN_REPO}\n${_agentsMd().AGENTS_SECTION_START} -->\nrun -R ${_agentsMd().UNKNOWN_REPO}\n<!-- bit-ci-sync:end -->\nafter ${_agentsMd().UNKNOWN_REPO}\n`;
124
+ it('replaces the placeholder inside the section only', () => {
125
+ (0, _chai().expect)((0, _agentsMd().fillInRepo)(doc, 'acme/billing')).to.equal(`before ${_agentsMd().UNKNOWN_REPO}\n${_agentsMd().AGENTS_SECTION_START} -->\nrun -R acme/billing\n<!-- bit-ci-sync:end -->\nafter ${_agentsMd().UNKNOWN_REPO}\n`);
126
+ });
127
+ it('changes nothing while the repository is still unknown', () => {
128
+ (0, _chai().expect)((0, _agentsMd().fillInRepo)(doc, _agentsMd().UNKNOWN_REPO)).to.equal(doc);
129
+ });
130
+ });
131
+ describe('scaffoldAgentsMd', () => {
132
+ let workspaceDir;
133
+ const agentsPath = () => _path().default.join(workspaceDir, _agentsMd().AGENTS_MD_RELATIVE_PATH);
134
+ beforeEach(() => {
135
+ workspaceDir = _fs().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'agents-md-'));
136
+ });
137
+ afterEach(() => {
138
+ _fs().default.rmSync(workspaceDir, {
139
+ recursive: true,
140
+ force: true
141
+ });
142
+ });
143
+ it('creates AGENTS.md when there is none', () => {
144
+ (0, _chai().expect)((0, _agentsMd().scaffoldAgentsMd)(workspaceDir, VALUES)).to.deep.equal({
145
+ relativePath: _agentsMd().AGENTS_MD_RELATIVE_PATH,
146
+ status: 'written'
147
+ });
148
+ const written = _fs().default.readFileSync(agentsPath(), 'utf8');
149
+ (0, _chai().expect)(written.startsWith('# Agent instructions\n\n<!-- bit-ci-sync:start')).to.equal(true);
150
+ });
151
+ it('adds the section to the top of an existing AGENTS.md and keeps the rest', () => {
152
+ _fs().default.writeFileSync(agentsPath(), '# Bit Workspace\n\nIntro.\n\n## Saving and Publishing Changes\n\nsubmit a change request\n');
153
+ (0, _chai().expect)((0, _agentsMd().scaffoldAgentsMd)(workspaceDir, VALUES).status).to.equal('updated');
154
+ const updated = _fs().default.readFileSync(agentsPath(), 'utf8');
155
+ (0, _chai().expect)(updated.indexOf(_agentsMd().AGENTS_SECTION_START)).to.be.lessThan(updated.indexOf('## Saving and Publishing'));
156
+ (0, _chai().expect)(updated).to.include('submit a change request');
157
+ });
158
+ it('fills in the repository on a re-run once origin is known, and changes nothing else', () => {
159
+ (0, _agentsMd().scaffoldAgentsMd)(workspaceDir, _objectSpread(_objectSpread({}, VALUES), {}, {
160
+ repo: _agentsMd().UNKNOWN_REPO
161
+ }));
162
+ const first = _fs().default.readFileSync(agentsPath(), 'utf8');
163
+ (0, _chai().expect)(first).to.include(`gh pr list -R ${_agentsMd().UNKNOWN_REPO}`);
164
+ (0, _chai().expect)((0, _agentsMd().scaffoldAgentsMd)(workspaceDir, VALUES)).to.deep.equal({
165
+ relativePath: _agentsMd().AGENTS_MD_RELATIVE_PATH,
166
+ status: 'updated',
167
+ note: 'filled in the repository in the sync rules'
168
+ });
169
+ const second = _fs().default.readFileSync(agentsPath(), 'utf8');
170
+ (0, _chai().expect)(second).to.not.include(_agentsMd().UNKNOWN_REPO);
171
+ (0, _chai().expect)(second).to.include('gh pr list -R acme/billing --head <lane-name>');
172
+ // the examples for other repositories keep their placeholder
173
+ (0, _chai().expect)(second).to.include('gh repo create <org>/<repo>');
174
+ (0, _chai().expect)(second.split(_agentsMd().UNKNOWN_REPO).join('acme/billing')).to.equal(first.split(_agentsMd().UNKNOWN_REPO).join('acme/billing'));
175
+ (0, _chai().expect)((0, _agentsMd().scaffoldAgentsMd)(workspaceDir, VALUES).status).to.equal('skipped');
176
+ });
177
+ it('leaves a file that already has the section unchanged on a re-run', () => {
178
+ (0, _agentsMd().scaffoldAgentsMd)(workspaceDir, VALUES);
179
+ const edited = `${_fs().default.readFileSync(agentsPath(), 'utf8')}\nhand edit\n`;
180
+ _fs().default.writeFileSync(agentsPath(), edited);
181
+ (0, _chai().expect)((0, _agentsMd().scaffoldAgentsMd)(workspaceDir, _objectSpread(_objectSpread({}, VALUES), {}, {
182
+ scope: 'other.scope'
183
+ })).status).to.equal('skipped');
184
+ (0, _chai().expect)(_fs().default.readFileSync(agentsPath(), 'utf8')).to.equal(edited);
185
+ });
186
+ });
187
+ describe('in the init report', () => {
188
+ const report = (status, note) => (0, _initScaffold().renderInitReport)({
189
+ scopeId: 'acme.billing',
190
+ ownerRepo: {
191
+ owner: 'acme',
192
+ repo: 'billing',
193
+ host: 'github.com'
194
+ },
195
+ defaultBranch: 'main',
196
+ files: [{
197
+ relativePath: _agentsMd().AGENTS_MD_RELATIVE_PATH,
198
+ status,
199
+ note,
200
+ displayPath: 'AGENTS.md'
201
+ }],
202
+ configAdded: true
203
+ });
204
+ it('says what each outcome did', () => {
205
+ (0, _chai().expect)(report('written')).to.include('tells coding agents how the sync works in this repository');
206
+ (0, _chai().expect)(report('updated')).to.include('added the sync rules at the top');
207
+ (0, _chai().expect)(report('skipped')).to.include('already has the sync rules, left unchanged');
208
+ (0, _chai().expect)(report('updated', 'filled in the repository in the sync rules')).to.include('filled in the repository in the sync rules');
209
+ });
210
+ it('stages AGENTS.md with the other files', () => {
211
+ (0, _chai().expect)(report('written')).to.match(/git add -- .*AGENTS\.md/);
212
+ });
213
+ });
214
+ });
215
+
216
+ //# sourceMappingURL=agents-md.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_chai","data","require","_fs","_interopRequireDefault","_os","_path","_agentsMd","_initScaffold","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","VALUES","scope","repo","defaultBranch","SECTION","describe","it","rendered","renderAgentsSection","expect","to","not","include","trim","startsWith","AGENTS_SECTION_START","equal","endsWith","existing","insertAgentsSection","doc","UNKNOWN_REPO","fillInRepo","workspaceDir","agentsPath","path","join","AGENTS_MD_RELATIVE_PATH","beforeEach","fs","mkdtempSync","os","tmpdir","afterEach","rmSync","recursive","force","scaffoldAgentsMd","deep","relativePath","status","written","readFileSync","writeFileSync","updated","indexOf","be","lessThan","first","note","second","split","edited","report","renderInitReport","scopeId","ownerRepo","owner","host","files","displayPath","configAdded","match"],"sources":["agents-md.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport {\n AGENTS_MD_RELATIVE_PATH,\n AGENTS_SECTION_START,\n UNKNOWN_REPO,\n fillInRepo,\n insertAgentsSection,\n renderAgentsSection,\n scaffoldAgentsMd,\n} from './agents-md';\nimport { renderInitReport } from './init-scaffold';\n\nconst VALUES = { scope: 'acme.billing', repo: 'acme/billing', defaultBranch: 'trunk' };\nconst SECTION = '<!-- bit-ci-sync:start -->\\n\\n## Sync\\n\\nrules\\n\\n<!-- bit-ci-sync:end -->\\n';\n\ndescribe('agents-md', () => {\n describe('renderAgentsSection', () => {\n it('fills in every placeholder', () => {\n const rendered = renderAgentsSection(VALUES);\n expect(rendered).to.not.include('{{');\n expect(rendered).to.include('this repository mirrors `acme.billing`');\n expect(rendered).to.include('gh pr list -R acme/billing --head <lane-name>');\n expect(rendered).to.include('Never push to `trunk`');\n expect(rendered).to.not.include('`main` equals');\n });\n\n it('inserts a branch name with `$` in it verbatim', () => {\n const rendered = renderAgentsSection({ ...VALUES, defaultBranch: \"a$'b$&\" });\n expect(rendered).to.include(\"Never push to `a$'b$&`\");\n // in a command, the branch is one shell word: `$` does not expand and the quote does not end it\n expect(rendered).to.include(`git switch 'a$'\\\\''b$&' && git pull`);\n });\n\n it('opens and closes with the markers', () => {\n const rendered = renderAgentsSection(VALUES).trim();\n expect(rendered.startsWith(AGENTS_SECTION_START)).to.equal(true);\n expect(rendered.endsWith('<!-- bit-ci-sync:end -->')).to.equal(true);\n });\n });\n\n describe('insertAgentsSection', () => {\n it('goes after the title and the paragraph under it', () => {\n const existing = '# Bit Workspace\\n\\nThis file teaches agents.\\nRead it fully.\\n\\n## What is Bit?\\n\\nBit is…\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `# Bit Workspace\\n\\nThis file teaches agents.\\nRead it fully.\\n\\n${SECTION.trim()}\\n\\n---\\n\\n## What is Bit?\\n\\nBit is…\\n`\n );\n });\n\n it('goes right after the title when a heading follows it', () => {\n const existing = '# Title\\n\\n## First\\n\\ntext\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `# Title\\n\\n${SECTION.trim()}\\n\\n---\\n\\n## First\\n\\ntext\\n`\n );\n });\n\n it('goes before a numbered list under the title', () => {\n const existing = '# Rules\\n\\n1. Always submit a change request.\\n2. Tag on main.\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `# Rules\\n\\n${SECTION.trim()}\\n\\n---\\n\\n1. Always submit a change request.\\n2. Tag on main.\\n`\n );\n });\n\n it('goes before a list that follows the intro paragraph with no blank line', () => {\n const existing = '# Rules\\n\\nFollow these:\\n1) Submit a change request.\\n+ Tag on main.\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `# Rules\\n\\nFollow these:\\n\\n${SECTION.trim()}\\n\\n---\\n\\n1) Submit a change request.\\n+ Tag on main.\\n`\n );\n });\n\n it('keeps a paragraph line that starts with `#` but is no heading in the intro', () => {\n const existing = '# Rules\\n\\nTag the PR with\\n#not-a-heading for triage.\\n\\n## More\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `# Rules\\n\\nTag the PR with\\n#not-a-heading for triage.\\n\\n${SECTION.trim()}\\n\\n---\\n\\n## More\\n`\n );\n });\n\n it('finds a title indented by up to three spaces', () => {\n const existing = ' # Title\\n\\nIntro.\\n\\n## First\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n ` # Title\\n\\nIntro.\\n\\n${SECTION.trim()}\\n\\n---\\n\\n## First\\n`\n );\n });\n\n it('goes at the top of a file with no title', () => {\n const existing = '## Rules\\n\\n- one\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(`${SECTION.trim()}\\n\\n---\\n\\n## Rules\\n\\n- one\\n`);\n });\n\n it('keeps front matter first', () => {\n const existing = '---\\nalwaysApply: true\\n---\\n\\n# Title\\n\\nIntro.\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `---\\nalwaysApply: true\\n---\\n\\n# Title\\n\\nIntro.\\n\\n${SECTION.trim()}\\n`\n );\n });\n\n it('keeps front matter that closes with `...` first', () => {\n const existing = '---\\nalwaysApply: true\\n...\\n\\n# Title\\n';\n expect(insertAgentsSection(existing, SECTION)).to.equal(\n `---\\nalwaysApply: true\\n...\\n\\n# Title\\n\\n${SECTION.trim()}\\n`\n );\n });\n\n it('fills an empty file', () => {\n expect(insertAgentsSection('', SECTION)).to.equal(`${SECTION.trim()}\\n`);\n });\n });\n\n describe('fillInRepo', () => {\n const doc = `before ${UNKNOWN_REPO}\\n${AGENTS_SECTION_START} -->\\nrun -R ${UNKNOWN_REPO}\\n<!-- bit-ci-sync:end -->\\nafter ${UNKNOWN_REPO}\\n`;\n\n it('replaces the placeholder inside the section only', () => {\n expect(fillInRepo(doc, 'acme/billing')).to.equal(\n `before ${UNKNOWN_REPO}\\n${AGENTS_SECTION_START} -->\\nrun -R acme/billing\\n<!-- bit-ci-sync:end -->\\nafter ${UNKNOWN_REPO}\\n`\n );\n });\n\n it('changes nothing while the repository is still unknown', () => {\n expect(fillInRepo(doc, UNKNOWN_REPO)).to.equal(doc);\n });\n });\n\n describe('scaffoldAgentsMd', () => {\n let workspaceDir: string;\n const agentsPath = () => path.join(workspaceDir, AGENTS_MD_RELATIVE_PATH);\n\n beforeEach(() => {\n workspaceDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agents-md-'));\n });\n afterEach(() => {\n fs.rmSync(workspaceDir, { recursive: true, force: true });\n });\n\n it('creates AGENTS.md when there is none', () => {\n expect(scaffoldAgentsMd(workspaceDir, VALUES)).to.deep.equal({\n relativePath: AGENTS_MD_RELATIVE_PATH,\n status: 'written',\n });\n const written = fs.readFileSync(agentsPath(), 'utf8');\n expect(written.startsWith('# Agent instructions\\n\\n<!-- bit-ci-sync:start')).to.equal(true);\n });\n\n it('adds the section to the top of an existing AGENTS.md and keeps the rest', () => {\n fs.writeFileSync(\n agentsPath(),\n '# Bit Workspace\\n\\nIntro.\\n\\n## Saving and Publishing Changes\\n\\nsubmit a change request\\n'\n );\n expect(scaffoldAgentsMd(workspaceDir, VALUES).status).to.equal('updated');\n const updated = fs.readFileSync(agentsPath(), 'utf8');\n expect(updated.indexOf(AGENTS_SECTION_START)).to.be.lessThan(updated.indexOf('## Saving and Publishing'));\n expect(updated).to.include('submit a change request');\n });\n\n it('fills in the repository on a re-run once origin is known, and changes nothing else', () => {\n scaffoldAgentsMd(workspaceDir, { ...VALUES, repo: UNKNOWN_REPO });\n const first = fs.readFileSync(agentsPath(), 'utf8');\n expect(first).to.include(`gh pr list -R ${UNKNOWN_REPO}`);\n expect(scaffoldAgentsMd(workspaceDir, VALUES)).to.deep.equal({\n relativePath: AGENTS_MD_RELATIVE_PATH,\n status: 'updated',\n note: 'filled in the repository in the sync rules',\n });\n const second = fs.readFileSync(agentsPath(), 'utf8');\n expect(second).to.not.include(UNKNOWN_REPO);\n expect(second).to.include('gh pr list -R acme/billing --head <lane-name>');\n // the examples for other repositories keep their placeholder\n expect(second).to.include('gh repo create <org>/<repo>');\n expect(second.split(UNKNOWN_REPO).join('acme/billing')).to.equal(first.split(UNKNOWN_REPO).join('acme/billing'));\n expect(scaffoldAgentsMd(workspaceDir, VALUES).status).to.equal('skipped');\n });\n\n it('leaves a file that already has the section unchanged on a re-run', () => {\n scaffoldAgentsMd(workspaceDir, VALUES);\n const edited = `${fs.readFileSync(agentsPath(), 'utf8')}\\nhand edit\\n`;\n fs.writeFileSync(agentsPath(), edited);\n expect(scaffoldAgentsMd(workspaceDir, { ...VALUES, scope: 'other.scope' }).status).to.equal('skipped');\n expect(fs.readFileSync(agentsPath(), 'utf8')).to.equal(edited);\n });\n });\n\n describe('in the init report', () => {\n const report = (status: 'written' | 'updated' | 'skipped', note?: string) =>\n renderInitReport({\n scopeId: 'acme.billing',\n ownerRepo: { owner: 'acme', repo: 'billing', host: 'github.com' },\n defaultBranch: 'main',\n files: [{ relativePath: AGENTS_MD_RELATIVE_PATH, status, note, displayPath: 'AGENTS.md' }],\n configAdded: true,\n });\n\n it('says what each outcome did', () => {\n expect(report('written')).to.include('tells coding agents how the sync works in this repository');\n expect(report('updated')).to.include('added the sync rules at the top');\n expect(report('skipped')).to.include('already has the sync rules, left unchanged');\n expect(report('updated', 'filled in the repository in the sync rules')).to.include(\n 'filled in the repository in the sync rules'\n );\n });\n\n it('stages AGENTS.md with the other files', () => {\n expect(report('written')).to.match(/git add -- .*AGENTS\\.md/);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAO,cAAA;EAAA,MAAAP,IAA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