@beacon-build/sdk 1.16.0 → 1.16.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.
Files changed (57) hide show
  1. package/package.json +3 -3
  2. package/dist/cli/backlog.d.ts +0 -14
  3. package/dist/cli/backlog.d.ts.map +0 -1
  4. package/dist/cli/backlog.js +0 -228
  5. package/dist/cli/backlog.js.map +0 -1
  6. package/dist/cli/claude-md-check.d.ts +0 -18
  7. package/dist/cli/claude-md-check.d.ts.map +0 -1
  8. package/dist/cli/claude-md-check.js +0 -57
  9. package/dist/cli/claude-md-check.js.map +0 -1
  10. package/dist/cli/context.d.ts +0 -14
  11. package/dist/cli/context.d.ts.map +0 -1
  12. package/dist/cli/context.js +0 -465
  13. package/dist/cli/context.js.map +0 -1
  14. package/dist/cli/help.d.ts +0 -17
  15. package/dist/cli/help.d.ts.map +0 -1
  16. package/dist/cli/help.js +0 -71
  17. package/dist/cli/help.js.map +0 -1
  18. package/dist/cli/index.d.ts +0 -22
  19. package/dist/cli/index.d.ts.map +0 -1
  20. package/dist/cli/index.js +0 -212
  21. package/dist/cli/index.js.map +0 -1
  22. package/dist/cli/project-log.d.ts +0 -16
  23. package/dist/cli/project-log.d.ts.map +0 -1
  24. package/dist/cli/project-log.js +0 -185
  25. package/dist/cli/project-log.js.map +0 -1
  26. package/dist/cli/setup-worktree.d.ts +0 -23
  27. package/dist/cli/setup-worktree.d.ts.map +0 -1
  28. package/dist/cli/setup-worktree.js +0 -396
  29. package/dist/cli/setup-worktree.js.map +0 -1
  30. package/dist/cli/update-client.d.ts +0 -14
  31. package/dist/cli/update-client.d.ts.map +0 -1
  32. package/dist/cli/update-client.js +0 -629
  33. package/dist/cli/update-client.js.map +0 -1
  34. package/dist/cli/workflow-sync.d.ts +0 -19
  35. package/dist/cli/workflow-sync.d.ts.map +0 -1
  36. package/dist/cli/workflow-sync.js +0 -133
  37. package/dist/cli/workflow-sync.js.map +0 -1
  38. package/dist/lib/context.d.ts +0 -69
  39. package/dist/lib/context.d.ts.map +0 -1
  40. package/dist/lib/context.js +0 -225
  41. package/dist/lib/context.js.map +0 -1
  42. package/dist/lib/db.d.ts +0 -16
  43. package/dist/lib/db.d.ts.map +0 -1
  44. package/dist/lib/db.js +0 -50
  45. package/dist/lib/db.js.map +0 -1
  46. package/dist/lib/logger.d.ts +0 -14
  47. package/dist/lib/logger.d.ts.map +0 -1
  48. package/dist/lib/logger.js +0 -14
  49. package/dist/lib/logger.js.map +0 -1
  50. package/dist/lib/opencode.d.ts +0 -33
  51. package/dist/lib/opencode.d.ts.map +0 -1
  52. package/dist/lib/opencode.js +0 -101
  53. package/dist/lib/opencode.js.map +0 -1
  54. package/dist/lib/utils.d.ts +0 -18
  55. package/dist/lib/utils.d.ts.map +0 -1
  56. package/dist/lib/utils.js +0 -40
  57. package/dist/lib/utils.js.map +0 -1
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * beacon-workflow-sync — @beacon-build/sdk (F85)
4
- *
5
- * Syncs workflow files from the filesystem into the documents table
6
- * (type=workflow). Content-addressable: only updates documents whose
7
- * diskHash has changed (INV-5). diskPath + diskHash are set exclusively
8
- * by this script (INV-4).
9
- *
10
- * Usage:
11
- * beacon-workflow-sync <project> --workflows-dir=<path> [--write] [--dry-run]
12
- *
13
- * Options:
14
- * --workflows-dir=<path> Path to workflows/ directory (required)
15
- * --write Write changes to DB (without this, --dry-run is assumed)
16
- * --dry-run Show what would be synced without writing (default)
17
- */
18
- export {};
19
- //# sourceMappingURL=workflow-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-sync.d.ts","sourceRoot":"","sources":["../../src/cli/workflow-sync.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * beacon-workflow-sync — @beacon-build/sdk (F85)
4
- *
5
- * Syncs workflow files from the filesystem into the documents table
6
- * (type=workflow). Content-addressable: only updates documents whose
7
- * diskHash has changed (INV-5). diskPath + diskHash are set exclusively
8
- * by this script (INV-4).
9
- *
10
- * Usage:
11
- * beacon-workflow-sync <project> --workflows-dir=<path> [--write] [--dry-run]
12
- *
13
- * Options:
14
- * --workflows-dir=<path> Path to workflows/ directory (required)
15
- * --write Write changes to DB (without this, --dry-run is assumed)
16
- * --dry-run Show what would be synced without writing (default)
17
- */
18
- import { Pool } from 'pg';
19
- import { createHash } from 'node:crypto';
20
- import { readFileSync, readdirSync, statSync } from 'node:fs';
21
- import { resolve, join, relative } from 'node:path';
22
- import { getDatabaseUrl } from '../lib/db.js';
23
- import { createCliLogger } from '../lib/logger.js';
24
- const log = createCliLogger('workflow-sync');
25
- // ── CLI ──────────────────────────────────────────────────────────────────────
26
- const argv = process.argv.slice(2);
27
- const positional = argv.filter((a) => !a.startsWith('-'));
28
- const flags = argv.filter((a) => a.startsWith('-'));
29
- const project = positional[0];
30
- const workflowsDirFlag = flags.find((f) => f.startsWith('--workflows-dir='));
31
- const doWrite = flags.includes('--write');
32
- const isDryRun = flags.includes('--dry-run') || !doWrite;
33
- if (!project || !workflowsDirFlag) {
34
- log.error('missing required arguments', {
35
- usage: 'beacon-cli workflow-sync <project> --workflows-dir=<path> [--write]',
36
- });
37
- process.exit(1);
38
- }
39
- const workflowsDirRaw = workflowsDirFlag.replace('--workflows-dir=', '');
40
- const workflowsDir = resolve(process.cwd(), workflowsDirRaw);
41
- // ── Collect workflow files ───────────────────────────────────────────────────
42
- /**
43
- * Recursively collect all .md files under dir, excluding _*.md (INV-3).
44
- */
45
- function collectWorkflows(dir, baseDir) {
46
- const results = [];
47
- let entries;
48
- try {
49
- entries = readdirSync(dir);
50
- }
51
- catch {
52
- log.error('cannot read directory', { dir });
53
- process.exit(1);
54
- }
55
- for (const entry of entries) {
56
- const fullPath = join(dir, entry);
57
- const stat = statSync(fullPath);
58
- if (stat.isDirectory()) {
59
- results.push(...collectWorkflows(fullPath, baseDir));
60
- }
61
- else if (entry.endsWith('.md') && !entry.startsWith('_')) {
62
- const relPath = relative(baseDir, fullPath);
63
- const name = relPath.replace(/\.md$/, '');
64
- const content = readFileSync(fullPath, 'utf-8');
65
- results.push({ name, diskPath: fullPath, content });
66
- }
67
- }
68
- return results;
69
- }
70
- // ── SHA-256 hash ─────────────────────────────────────────────────────────────
71
- function sha256(content) {
72
- return createHash('sha256').update(content, 'utf-8').digest('hex');
73
- }
74
- // ── Main ─────────────────────────────────────────────────────────────────────
75
- async function main() {
76
- const pool = new Pool({ connectionString: getDatabaseUrl() });
77
- const workflows = collectWorkflows(workflowsDir, workflowsDir);
78
- const total = workflows.length;
79
- if (total === 0) {
80
- log.info('sync complete', { synced: 0, skipped: 0, total: 0 });
81
- await pool.end();
82
- return;
83
- }
84
- let synced = 0;
85
- let skipped = 0;
86
- if (isDryRun) {
87
- log.info('dry-run scan', { project, total });
88
- }
89
- for (const { name, diskPath, content } of workflows) {
90
- const diskHash = sha256(content);
91
- const { rows } = await pool.query(`SELECT id, disk_hash FROM documents
92
- WHERE project = $1 AND type = 'workflow' AND name = $2 AND task_id IS NULL
93
- LIMIT 1`, [project, name]);
94
- const existing = rows[0];
95
- if (existing && existing.disk_hash === diskHash) {
96
- skipped++;
97
- if (isDryRun) {
98
- log.info('skip (unchanged)', { name });
99
- }
100
- continue;
101
- }
102
- if (isDryRun) {
103
- const action = existing ? 'update' : 'insert';
104
- log.info(action, { name });
105
- synced++;
106
- continue;
107
- }
108
- if (existing) {
109
- await pool.query(`UPDATE documents
110
- SET content = $1, disk_path = $2, disk_hash = $3, updated_at = NOW()
111
- WHERE id = $4`, [content, diskPath, diskHash, existing.id]);
112
- }
113
- else {
114
- await pool.query(`INSERT INTO documents (project, type, name, content, status, disk_path, disk_hash, updated_at)
115
- VALUES ($1, 'workflow', $2, $3, 'active', $4, $5, NOW())`, [project, name, content, diskPath, diskHash]);
116
- }
117
- synced++;
118
- }
119
- await pool.end();
120
- if (isDryRun) {
121
- log.info('dry-run complete', { wouldSync: synced, skipped, total });
122
- console.log(`[dry-run] ${synced} would be synced, ${skipped} skipped (unchanged), ${total} total`);
123
- }
124
- else {
125
- log.info('sync complete', { synced, skipped, total });
126
- console.log(`${synced} synced, ${skipped} skipped (unchanged), ${total} total`);
127
- }
128
- }
129
- main().catch((err) => {
130
- log.error('unexpected error', { error: err.message });
131
- process.exit(1);
132
- });
133
- //# sourceMappingURL=workflow-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-sync.js","sourceRoot":"","sources":["../../src/cli/workflow-sync.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,GAAG,GAAG,eAAe,CAAC,eAAe,CAAC,CAAA;AAE5C,gFAAgF;AAEhF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;AACzD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;AAEnD,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;AAC7B,MAAM,gBAAgB,GAAG,KAAK,CAA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E,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAC/C,CAAA;QACL,CAAC;QAED,MAAM,EAAE,CAAA;IACZ,CAAC;IAED,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;IAEhB,IAAI,QAAQ,EAAE,CAAC;QACX,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;QACnE,OAAO,CAAC,GAAG,CACP,aAAa,MAAM,qBAAqB,OAAO,yBAAyB,KAAK,QAAQ,CACxF,CAAA;IACL,CAAC;SAAM,CAAC;QACJ,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;QACrD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,YAAY,OAAO,yBAAyB,KAAK,QAAQ,CAAC,CAAA;IACnF,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE;IACxB,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA"}
@@ -1,69 +0,0 @@
1
- /**
2
- * context.ts — AGENTS.md / CLAUDE.md generation helpers (F161)
3
- *
4
- * Pure functions — no filesystem access, no side effects.
5
- * Consumed by CLI scripts and by @beacon-build/mcp-agent (readAgentsMdFrontmatter).
6
- */
7
- /** Sections that belong in AGENTS.md (system-agnostic). */
8
- export declare const AGENTS_SECTIONS: string[];
9
- /** Sections that stay in CLAUDE.md (Claude Code-specific). */
10
- export declare const CLAUDE_SECTIONS: string[];
11
- export declare const MARKER_START: (section: string) => string;
12
- export declare const MARKER_END: (section: string) => string;
13
- /**
14
- * Merge generated sections into existing file content using marker comments.
15
- * Sections not in `allowedSections` are skipped.
16
- * Legacy stale section names are always removed.
17
- */
18
- export declare function mergeSections(existing: string, sections: Record<string, string | null>, allowedSections: string[], staleSections: string[]): string;
19
- /**
20
- * Merge generated sections into AGENTS.md content.
21
- * Only AGENTS_SECTIONS are written; CLAUDE_SECTIONS are ignored.
22
- */
23
- export declare function mergeWithAgentsMd(existing: string, sections: Record<string, string | null>): string;
24
- /**
25
- * Generate the default AGENTS.md template for a new project.
26
- */
27
- export declare function agentsMdTemplate(projectName: string): string;
28
- /**
29
- * Ensure `@AGENTS.md` appears as the first line after the `# CLAUDE.md — …` title.
30
- * Idempotent: no duplicate insertion if already present.
31
- */
32
- export declare function ensureAgentsMdImport(content: string): string;
33
- /**
34
- * Merge generated sections into CLAUDE.md content.
35
- * - Removes CLAUDE_STALE_SECTIONS
36
- * - Writes only CLAUDE_SECTIONS (triggers)
37
- * - Ensures @AGENTS.md import after title
38
- */
39
- export declare function mergeWithClaudeMd(existing: string, sections: Record<string, string | null>): string;
40
- /**
41
- * Ensure `AGENTS.md` is listed in a .gitignore file.
42
- * Returns updated content, or minimal new content if file doesn't exist.
43
- */
44
- export declare function ensureAgentsMdInGitignore(existingContent: string | null): string;
45
- /**
46
- * Remove `AGENTS.md` from a .gitignore file (inverse of ensureAgentsMdInGitignore).
47
- * Used by --force to migrate repos where AGENTS.md was previously gitignored.
48
- * Returns updated content (idempotent if already absent).
49
- */
50
- export declare function removeAgentsMdFromGitignore(content: string): string;
51
- export interface AgentsMdFrontmatter {
52
- project?: string;
53
- agent?: string;
54
- }
55
- /**
56
- * Parse YAML frontmatter from AGENTS.md content.
57
- * Returns { project?, agent? } or null if no frontmatter present.
58
- */
59
- export declare function parseAgentsMdFrontmatter(content: string): AgentsMdFrontmatter | null;
60
- /**
61
- * Write (or replace) YAML frontmatter in AGENTS.md content.
62
- * Idempotent — existing frontmatter is replaced with new values.
63
- * `agent` is omitted if falsy (main workspace has no agent field).
64
- */
65
- export declare function writeAgentsMdFrontmatter(content: string, { project, agent }: {
66
- project: string;
67
- agent?: string;
68
- }): string;
69
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/lib/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,2DAA2D;AAC3D,eAAO,MAAM,eAAe,UAAuC,CAAA;AAEnE,8DAA8D;AAC9D,eAAO,MAAM,eAAe,UAAe,CAAA;AAI3C,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAA+C,CAAA;AAC9F,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,MAA6C,CAAA;AAI1F;;;;GAIG;AACH,wBAAgB,aAAa,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EACvC,eAAe,EAAE,MAAM,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,GACxB,MAAM,CAwCR;AAOD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACxC,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0D5D;AAcD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAW5D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACxC,MAAM,CAIR;AAID;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOhF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnE;AAID,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAYpF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,MAAM,EACf,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,MAAM,CAUR"}
@@ -1,225 +0,0 @@
1
- /**
2
- * context.ts — AGENTS.md / CLAUDE.md generation helpers (F161)
3
- *
4
- * Pure functions — no filesystem access, no side effects.
5
- * Consumed by CLI scripts and by @beacon-build/mcp-agent (readAgentsMdFrontmatter).
6
- */
7
- // ─── Section routing ─────────────────────────────────────────────────────────
8
- /** Sections that belong in AGENTS.md (system-agnostic). */
9
- export const AGENTS_SECTIONS = ['context', 'monorepo', 'code-repo'];
10
- /** Sections that stay in CLAUDE.md (Claude Code-specific). */
11
- export const CLAUDE_SECTIONS = ['triggers'];
12
- // ─── Marker helpers ──────────────────────────────────────────────────────────
13
- export const MARKER_START = (section) => `<!-- generated:${section}:start -->`;
14
- export const MARKER_END = (section) => `<!-- generated:${section}:end -->`;
15
- // ─── Generic merge ────────────────────────────────────────────────────────────
16
- /**
17
- * Merge generated sections into existing file content using marker comments.
18
- * Sections not in `allowedSections` are skipped.
19
- * Legacy stale section names are always removed.
20
- */
21
- export function mergeSections(existing, sections, allowedSections, staleSections) {
22
- // Remove stale sections
23
- for (const section of staleSections) {
24
- const startMarker = MARKER_START(section);
25
- const endMarker = MARKER_END(section);
26
- const startIdx = existing.indexOf(startMarker);
27
- const endIdx = existing.indexOf(endMarker);
28
- if (startIdx !== -1 && endIdx !== -1) {
29
- const afterEnd = endIdx + endMarker.length;
30
- const trailing = existing[afterEnd] === '\n' ? 1 : 0;
31
- existing = existing.slice(0, startIdx) + existing.slice(afterEnd + trailing);
32
- }
33
- }
34
- // Clean up multiple consecutive blank lines
35
- existing = existing.replace(/\n{3,}/g, '\n\n');
36
- // Write allowed sections
37
- for (const [section, content] of Object.entries(sections)) {
38
- if (!allowedSections.includes(section))
39
- continue;
40
- if (!content)
41
- continue;
42
- const startMarker = MARKER_START(section);
43
- const endMarker = MARKER_END(section);
44
- // Blank line before end marker prevents Prettier from indenting
45
- // HTML comments that immediately follow a Markdown list item.
46
- const block = `${startMarker}\n${content.trimEnd()}\n\n${endMarker}`;
47
- const startIdx = existing.indexOf(startMarker);
48
- const endIdx = existing.indexOf(endMarker);
49
- if (startIdx !== -1 && endIdx !== -1) {
50
- existing =
51
- existing.slice(0, startIdx) + block + existing.slice(endIdx + endMarker.length);
52
- }
53
- else {
54
- existing = existing.trimEnd() + '\n\n' + block + '\n';
55
- }
56
- }
57
- return existing;
58
- }
59
- // ─── AGENTS.md merge ─────────────────────────────────────────────────────────
60
- // 'worker' was previously generated; now identity lives in frontmatter only.
61
- const AGENTS_STALE_SECTIONS = ['worker'];
62
- /**
63
- * Merge generated sections into AGENTS.md content.
64
- * Only AGENTS_SECTIONS are written; CLAUDE_SECTIONS are ignored.
65
- */
66
- export function mergeWithAgentsMd(existing, sections) {
67
- return mergeSections(existing, sections, AGENTS_SECTIONS, AGENTS_STALE_SECTIONS);
68
- }
69
- /**
70
- * Generate the default AGENTS.md template for a new project.
71
- */
72
- export function agentsMdTemplate(projectName) {
73
- return [
74
- `# AGENTS.md — ${projectName}`,
75
- '',
76
- '> Canonical context file for AI agents — system-agnostic.',
77
- '> Claude Code-specific additions: see CLAUDE.md.',
78
- '',
79
- '## Session Start',
80
- '',
81
- 'Read frontmatter (`project` + `agent`). Call `session_start` with:',
82
- '- `project` → frontmatter `project`',
83
- '- `alias` → frontmatter `agent`',
84
- '',
85
- 'Never choose an alias manually.',
86
- '',
87
- // Placeholders so mergeSections inserts generated content here, before Memory Hygiene
88
- MARKER_START('context'),
89
- '',
90
- MARKER_END('context'),
91
- '',
92
- MARKER_START('monorepo'),
93
- '',
94
- MARKER_END('monorepo'),
95
- '',
96
- MARKER_START('code-repo'),
97
- '',
98
- MARKER_END('code-repo'),
99
- '',
100
- '## Memory Hygiene',
101
- '',
102
- 'Memories are stored via `memory_upsert` in the DB — **NEVER as files in the filesystem**.',
103
- '',
104
- '**When to save:**',
105
- '',
106
- '- Real corrections that would repeat (type: `correction`)',
107
- '- Non-obvious patterns not derivable from code (type: `pattern`)',
108
- '- Explicit user preferences (type: `preference`)',
109
- '- Architectural decisions not captured in ADRs/docs (type: `decision`)',
110
- '',
111
- '**Do NOT save:**',
112
- '',
113
- '- Task status, PR numbers, temporary state',
114
- '- Anything already in CLAUDE.md, ADRs, domain docs or code',
115
- '- Every minor correction — only what would repeat',
116
- '',
117
- '**Board workflow:**',
118
- '',
119
- '- Never call `board_mark_read` — resolve actions via `board_resolve`',
120
- '- ACTION/URGENT messages stay unread until explicitly resolved',
121
- '- `session_start` auto-marks INFO only; ACTION/URGENT must be resolved manually',
122
- '',
123
- '**Cleanup:**',
124
- '',
125
- '- `memory_get` to see all memories (with IDs)',
126
- '- `memory_delete <id>` for stale or redundant entries',
127
- '- `reinforced_count` as quality signal: often confirmed = valuable, ×1 = check if still relevant',
128
- '',
129
- ].join('\n');
130
- }
131
- // ─── CLAUDE.md merge ─────────────────────────────────────────────────────────
132
- /**
133
- * Sections that once lived in CLAUDE.md but now belong in AGENTS.md.
134
- * Treated as stale and removed from CLAUDE.md on every run.
135
- */
136
- const CLAUDE_MIGRATED_OUT = ['worker', 'context', 'monorepo', 'code-repo'];
137
- const CLAUDE_LEGACY_STALE = ['status', 'tools', 'stdd', 'structure', 'session', 'ops'];
138
- const CLAUDE_STALE_SECTIONS = [...CLAUDE_MIGRATED_OUT, ...CLAUDE_LEGACY_STALE];
139
- /**
140
- * Ensure `@AGENTS.md` appears as the first line after the `# CLAUDE.md — …` title.
141
- * Idempotent: no duplicate insertion if already present.
142
- */
143
- export function ensureAgentsMdImport(content) {
144
- if (/^@AGENTS\.md\s*$/m.test(content))
145
- return content;
146
- const lines = content.split('\n');
147
- const titleIdx = lines.findIndex((l) => l.startsWith('# '));
148
- if (titleIdx === -1) {
149
- return `@AGENTS.md\n\n${content}`;
150
- }
151
- lines.splice(titleIdx + 1, 0, '', '@AGENTS.md');
152
- return lines.join('\n').replace(/\n{3,}/g, '\n\n');
153
- }
154
- /**
155
- * Merge generated sections into CLAUDE.md content.
156
- * - Removes CLAUDE_STALE_SECTIONS
157
- * - Writes only CLAUDE_SECTIONS (triggers)
158
- * - Ensures @AGENTS.md import after title
159
- */
160
- export function mergeWithClaudeMd(existing, sections) {
161
- let result = mergeSections(existing, sections, CLAUDE_SECTIONS, CLAUDE_STALE_SECTIONS);
162
- result = ensureAgentsMdImport(result);
163
- return result;
164
- }
165
- // ─── .gitignore helper ───────────────────────────────────────────────────────
166
- /**
167
- * Ensure `AGENTS.md` is listed in a .gitignore file.
168
- * Returns updated content, or minimal new content if file doesn't exist.
169
- */
170
- export function ensureAgentsMdInGitignore(existingContent) {
171
- const lines = (existingContent ?? '').split('\n');
172
- if (lines.some((l) => l.trim() === 'AGENTS.md')) {
173
- return existingContent ?? '';
174
- }
175
- const base = existingContent ?? '';
176
- return base.trimEnd() + (base.length > 0 ? '\n' : '') + 'AGENTS.md\n';
177
- }
178
- /**
179
- * Remove `AGENTS.md` from a .gitignore file (inverse of ensureAgentsMdInGitignore).
180
- * Used by --force to migrate repos where AGENTS.md was previously gitignored.
181
- * Returns updated content (idempotent if already absent).
182
- */
183
- export function removeAgentsMdFromGitignore(content) {
184
- return content
185
- .split('\n')
186
- .filter((l) => l.trim() !== 'AGENTS.md')
187
- .join('\n');
188
- }
189
- /**
190
- * Parse YAML frontmatter from AGENTS.md content.
191
- * Returns { project?, agent? } or null if no frontmatter present.
192
- */
193
- export function parseAgentsMdFrontmatter(content) {
194
- const match = content.match(/^---\n([\s\S]*?)\n---/);
195
- if (!match)
196
- return null;
197
- const result = {};
198
- for (const line of match[1].split('\n')) {
199
- const colon = line.indexOf(':');
200
- if (colon === -1)
201
- continue;
202
- const key = line.slice(0, colon).trim();
203
- const val = line.slice(colon + 1).trim();
204
- if (key && val)
205
- result[key] = val;
206
- }
207
- return Object.keys(result).length ? result : null;
208
- }
209
- /**
210
- * Write (or replace) YAML frontmatter in AGENTS.md content.
211
- * Idempotent — existing frontmatter is replaced with new values.
212
- * `agent` is omitted if falsy (main workspace has no agent field).
213
- */
214
- export function writeAgentsMdFrontmatter(content, { project, agent }) {
215
- const lines = ['---', `project: ${project}`];
216
- if (agent)
217
- lines.push(`agent: ${agent}`);
218
- lines.push('---');
219
- const block = lines.join('\n');
220
- if (/^---\n/.test(content)) {
221
- return content.replace(/^---\n[\s\S]*?\n---\n?/, block + '\n');
222
- }
223
- return block + '\n' + content;
224
- }
225
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/lib/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAEhF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;AAEnE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAU,CAAC,CAAA;AAE3C,gFAAgF;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,kBAAkB,OAAO,YAAY,CAAA;AAC9F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,kBAAkB,OAAO,UAAU,CAAA;AAE1F,iFAAiF;AAEjF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CACzB,QAAgB,EAChB,QAAuC,EACvC,eAAyB,EACzB,aAAuB;IAEvB,wBAAwB;IACxB,KAAK,MAAM,O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AC,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,OAAO,CAAC,wBAAwB,EAAE,KAAK,GAAG,IAAI,CAAC,CAAA;IAClE,CAAC;IACD,OAAO,KAAK,GAAG,IAAI,GAAG,OAAO,CAAA;AACjC,CAAC"}
package/dist/lib/db.d.ts DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * db.ts — Database URL resolution for CLI scripts
3
- *
4
- * Shared helper for SDK CLI commands that need a PostgreSQL connection.
5
- * Not part of the public SDK API — internal use only.
6
- */
7
- /**
8
- * Resolve DATABASE_URL from environment or op-cache.
9
- *
10
- * Priority:
11
- * 1. DATABASE_URL env var (most explicit)
12
- * 2. op-cache: ~/.beacon-platform/op-cache.json (DB_ENV defaults to "production")
13
- * 3. localhost fallback for local development
14
- */
15
- export declare function getDatabaseUrl(): string;
16
- //# sourceMappingURL=db.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/lib/db.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAqBvC"}
package/dist/lib/db.js DELETED
@@ -1,50 +0,0 @@
1
- /**
2
- * db.ts — Database URL resolution for CLI scripts
3
- *
4
- * Shared helper for SDK CLI commands that need a PostgreSQL connection.
5
- * Not part of the public SDK API — internal use only.
6
- */
7
- import { readFileSync, existsSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- /**
10
- * Resolve DATABASE_URL from environment or op-cache.
11
- *
12
- * Priority:
13
- * 1. DATABASE_URL env var (most explicit)
14
- * 2. op-cache: ~/.beacon-platform/op-cache.json (DB_ENV defaults to "production")
15
- * 3. localhost fallback for local development
16
- */
17
- export function getDatabaseUrl() {
18
- if (process.env.DATABASE_URL)
19
- return process.env.DATABASE_URL;
20
- const home = process.env.HOME ?? process.env.USERPROFILE ?? '';
21
- const opCachePath = join(home, '.beacon-platform', 'op-cache.json');
22
- if (existsSync(opCachePath)) {
23
- try {
24
- const cache = JSON.parse(readFileSync(opCachePath, 'utf-8'));
25
- const env = process.env.DB_ENV ?? 'production';
26
- const url = cache[`beacon-platform/beacon-platform-${env}`]?.fields?.DATABASE_URL;
27
- if (url)
28
- return normalizeDbUrl(url);
29
- }
30
- catch {
31
- // fall through
32
- }
33
- }
34
- return 'postgresql://beacon:beacon@localhost:5432/beacon';
35
- }
36
- /**
37
- * pg-connection-string@2.x treats sslrootcert as a file path to readFileSync.
38
- * PostgreSQL 16+ added sslrootcert=system (use system CA store), which the library
39
- * doesn't recognise — strip it and downgrade sslmode to avoid ENOENT on 'system'.
40
- */
41
- function normalizeDbUrl(url) {
42
- if (!url.includes('sslrootcert=system'))
43
- return url;
44
- return url
45
- .replace(/[?&]sslrootcert=system/, (match) => (match.startsWith('?') ? '?' : ''))
46
- .replace('sslmode=verify-full', 'sslmode=require')
47
- .replace('??', '?')
48
- .replace(/[?&]$/, '');
49
- }
50
- //# sourceMappingURL=db.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/lib/db.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;IAE7D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAA;IAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAA;IAEnE,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1B,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAG1D,CAAA;YACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,YAAY,CAAA;YAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,CAAA;YACjF,IAAI,GAAG;gBAAE,OAAO,cAAc,CAAC,GAAG,CAAC,CAAA;QACvC,CAAC;QAAC,MAAM,CAAC;YACL,eAAe;QACnB,CAAC;IACL,CAAC;IAED,OAAO,kDAAkD,CAAA;AAC7D,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,GAAW;IAC/B,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,GAAG,CAAA;IACnD,OAAO,GAAG;SACL,OAAO,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAChF,OAAO,CAAC,qBAAqB,EAAE,iBAAiB,CAAC;SACjD,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC7B,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * CLI logger — re-exports createCliLogger from @beacon-build/logger.
3
- *
4
- * Writes to:
5
- * - stderr: pino-pretty (colorized, human-readable)
6
- * - file: ~/.beacon-platform/logs/beacon-cli-YYYY-MM-DD.log (JSON)
7
- *
8
- * Usage:
9
- * const log = createCliLogger('backlog')
10
- * log.info('generating backlog', { project })
11
- * log.error('failed', { error: err.message })
12
- */
13
- export { createCliLogger } from '@beacon-build/logger';
14
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,14 +0,0 @@
1
- /**
2
- * CLI logger — re-exports createCliLogger from @beacon-build/logger.
3
- *
4
- * Writes to:
5
- * - stderr: pino-pretty (colorized, human-readable)
6
- * - file: ~/.beacon-platform/logs/beacon-cli-YYYY-MM-DD.log (JSON)
7
- *
8
- * Usage:
9
- * const log = createCliLogger('backlog')
10
- * log.info('generating backlog', { project })
11
- * log.error('failed', { error: err.message })
12
- */
13
- export { createCliLogger } from '@beacon-build/logger';
14
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,33 +0,0 @@
1
- /**
2
- * opencode.ts — Role→tool mapping and opencode.jsonc generation (C51)
3
- *
4
- * Single source of truth for MCP server selection per agent role.
5
- * INV-1: Never duplicate the role→tool mapping elsewhere.
6
- * INV-3: beacon-platform root is always ~/workspace/beacon-platform.
7
- * INV-4: mcp-wrapper.mjs lives in ~/.beacon-platform/hooks/.
8
- */
9
- /** Tools always included regardless of role. */
10
- export declare const ALWAYS_TOOLS: readonly ["beacon-agent", "beacon-docs", "beacon-git"];
11
- /** Additional tools per role. */
12
- export declare const ROLE_TOOLS: Record<string, string[]>;
13
- /** Dist path suffix relative to `<beacon-platform-root>/node_modules/@beacon-build/`. */
14
- export declare const TOOL_DIST_PATHS: Record<string, string>;
15
- /**
16
- * Resolve the full set of MCP tools for a given set of roles.
17
- * Returns: always-tools first, then role-specific tools (deduped, alphabetical).
18
- * INV-6: Empty roles → always-tools only.
19
- */
20
- export declare function toolsForRoles(roles: string[]): string[];
21
- export interface GenerateOpencodeConfigOpts {
22
- alias: string;
23
- roles: string[];
24
- model: string;
25
- beaconPlatformRoot: string;
26
- mcpWrapperPath: string;
27
- }
28
- /**
29
- * Generate the content of opencode.jsonc for an agent worktree.
30
- * INV-2: This file is always generated — never manually edited.
31
- */
32
- export declare function generateOpencodeConfig(opts: GenerateOpencodeConfigOpts): string;
33
- //# sourceMappingURL=opencode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/lib/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,gDAAgD;AAChD,eAAO,MAAM,YAAY,wDAAyD,CAAA;AAElF,iCAAiC;AACjC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAM/C,CAAA;AAED,yFAAyF;AACzF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWlD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAUvD;AAID,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,kBAAkB,EAAE,MAAM,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAAG,MAAM,CAgD/E"}