baller-maester 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -652,7 +652,7 @@ async function loadCitadelConfig(repoRoot) {
652
652
  const path8 = citadelConfigPath(repoRoot);
653
653
  if (!existsSync(path8)) {
654
654
  throw new ConfigError(
655
- "No citadel.yaml found at the repository root. Run `npx maester init` to create one.",
655
+ "No citadel.yaml found at the repository root. Run `npx baller-maester init` to create one.",
656
656
  { filePath: path8 }
657
657
  );
658
658
  }
@@ -663,7 +663,7 @@ async function loadMaesterConfig(repoRoot) {
663
663
  const path8 = maesterConfigPath(repoRoot);
664
664
  if (!existsSync(path8)) {
665
665
  throw new ConfigError(
666
- "No maester.yaml found at the repository root. Run `npx maester publish` to create one.",
666
+ "No maester.yaml found at the repository root. Run `npx baller-maester publish` to create one.",
667
667
  { filePath: path8 }
668
668
  );
669
669
  }
@@ -1757,7 +1757,7 @@ var citadel_awareness_default = '## Citadel awareness\n\nThis repository is a **
1757
1757
  var connector_policy_default = "## Connector tools (traveling maesters)\n\nThis citadel may expose one or more **traveling maesters** as MCP tools whose\nnames begin with the connector slug (e.g. `team_gl__list_issues`).\n\n- Their output is **live, point-in-time data** from an external service. Cite\n specific identifiers (issue iids, ticket numbers) when surfacing it, do not\n treat it as a stable corpus, and flag the **freshness verdict** in your\n answer when it is not `up-to-date`.\n- The tools' arguments and return shapes are described in MCP `tools/list`;\n do not assume undocumented fields.\n- Connector tool results are JSON envelopes carrying a `dataSchema` version\n alongside the payload \u2014 if your reading of the data depends on a specific\n shape, branch on `dataSchema`.\n";
1758
1758
 
1759
1759
  // src/core/skill/templates/content/freshness-awareness.md
1760
- var freshness_awareness_default = '## Freshness awareness\n\nCitadel content can drift out of date when remote sources advance after the\nlast sync. The Grand Maester is **auto-sync directed**: when the citadel is\nbehind, refresh it before reading rather than relying on stale content.\n\n**Auto-sync policy**\n\nWhen you discover that the citadel is behind \u2014 either from the Claude Code\npre-read hook\'s `additionalContext` message, or from a manual run of\n`npx maester status` \u2014 follow these steps without prompting the user:\n\n1. Run `npx maester sync` to refresh every configured source.\n - Exits 0 on success.\n - Exits non-zero if any source failed (missing auth env var, ref typo,\n network error). Report the failure to the user and proceed cautiously.\n2. **Invalidate the pre-read hook\'s debounce cache** so the next read\n observes fresh state instead of the stale verdict captured before the\n sync:\n ```\n rm -f .maester/.skill-cache.json\n ```\n3. Proceed with the original read of the citadel file.\n\nYou do not need to ask the user before syncing. `maester sync` is read-only\nagainst the remote sources it pulls from; it only materializes content the\n`citadel.yaml` already declared. The same sync the user would run manually.\n\n**Don\'t loop on failures.** If `maester sync` fails (or the hook reports a\n`failed` verdict from `maester status`), do **not** retry sync repeatedly.\nSurface the failure to the user, proceed with the read, and flag that cited\ncontent may be stale.\n\n**Avoid redundant syncs within a session.** Once you have synced and\ninvalidated the cache, ignore any further "citadel is behind" messages that\narrive before you have done another citadel read \u2014 they are cached signals\ncaptured before your sync completed.\n\n**Manual status check**\n\n```\nnpx maester status\n```\n\nExit codes:\n\n- **`0`** \u2014 every source is up to date.\n- **`1`** \u2014 at least one source is behind (remote advanced, manifest\n changed, or never-synced). Run the auto-sync policy above.\n- **`2`** \u2014 the status check itself failed. Surface to the user; proceed\n with a caveat that staleness cannot be verified.\n\nFor machine-readable output, pass `--json` and parse the NDJSON stream on\nstdout. The final line contains `{ "type": "summary", "upToDate": N,\n"behind": N, "failed": N }`.\n\n**On Claude Code specifically**, a `PreToolUse` hook installed by\n`maester skill install` runs the status check automatically before any\n`Read`, `Glob`, or `Grep` targeting a path under `{{baseDir}}/`. The\nhook debounces (default 300s, override with `MAESTER_SKILL_STATUS_TTL`) so\nthe check does not run more than once per session for routine reads.\n';
1760
+ var freshness_awareness_default = '## Freshness awareness\n\nCitadel content can drift out of date when remote sources advance after the\nlast sync. The Grand Maester is **auto-sync directed**: when the citadel is\nbehind, refresh it before reading rather than relying on stale content.\n\n**Auto-sync policy**\n\nWhen you discover that the citadel is behind \u2014 either from the Claude Code\npre-read hook\'s `additionalContext` message, or from a manual run of\n`npx baller-maester status` \u2014 follow these steps without prompting the user:\n\n1. Run `npx baller-maester sync` to refresh every configured source.\n - Exits 0 on success.\n - Exits non-zero if any source failed (missing auth env var, ref typo,\n network error). Report the failure to the user and proceed cautiously.\n2. **Invalidate the pre-read hook\'s debounce cache** so the next read\n observes fresh state instead of the stale verdict captured before the\n sync:\n ```\n rm -f .maester/.skill-cache.json\n ```\n3. Proceed with the original read of the citadel file.\n\nYou do not need to ask the user before syncing. `maester sync` is read-only\nagainst the remote sources it pulls from; it only materializes content the\n`citadel.yaml` already declared. The same sync the user would run manually.\n\n**Don\'t loop on failures.** If `maester sync` fails (or the hook reports a\n`failed` verdict from `maester status`), do **not** retry sync repeatedly.\nSurface the failure to the user, proceed with the read, and flag that cited\ncontent may be stale.\n\n**Avoid redundant syncs within a session.** Once you have synced and\ninvalidated the cache, ignore any further "citadel is behind" messages that\narrive before you have done another citadel read \u2014 they are cached signals\ncaptured before your sync completed.\n\n**Manual status check**\n\n```\nnpx baller-maester status\n```\n\nExit codes:\n\n- **`0`** \u2014 every source is up to date.\n- **`1`** \u2014 at least one source is behind (remote advanced, manifest\n changed, or never-synced). Run the auto-sync policy above.\n- **`2`** \u2014 the status check itself failed. Surface to the user; proceed\n with a caveat that staleness cannot be verified.\n\nFor machine-readable output, pass `--json` and parse the NDJSON stream on\nstdout. The final line contains `{ "type": "summary", "upToDate": N,\n"behind": N, "failed": N }`.\n\n**On Claude Code specifically**, a `PreToolUse` hook installed by\n`maester skill install` runs the status check automatically before any\n`Read`, `Glob`, or `Grep` targeting a path under `{{baseDir}}/`. The\nhook debounces (default 300s, override with `MAESTER_SKILL_STATUS_TTL`) so\nthe check does not run more than once per session for routine reads.\n';
1761
1761
 
1762
1762
  // src/core/skill/templates/content/state-awareness.md
1763
1763
  var state_awareness_default = '## State awareness (canon vs draft)\n\nEvery citadel file may declare a publication state of `canon` (authoritative)\nor `draft` (work-in-progress). The state lives **inline** in the file using\nthe format\'s native convention:\n\n- **Markdown / MDX (`.md`, `.mdx`)** \u2014 `state` field inside YAML frontmatter\n at the top of the file:\n ```\n ---\n state: canon\n ---\n ```\n- **HTML (`.html`, `.htm`)** \u2014 first-line HTML comment:\n `<!-- state: canon -->`\n- **YAML / JSON (`.yaml`, `.yml`, `.json`)** \u2014 a top-level `state` key.\n- **Plain text (`.txt`)** \u2014 `state: canon` as the very first line.\n\nFiles without inline state default to `draft`.\n\n**Policy when answering from the citadel:**\n\n1. **Prefer `canon` files** as the authoritative source of truth. When a\n `canon` file answers the question, cite it and stop there.\n2. **`draft` files are informational only.** Cite them when no `canon`\n alternative exists, but mark the citation explicitly: "(draft \u2014 work in\n progress)" alongside the file path so the user knows the source is not yet\n stable.\n3. **Never mix the two without labeling.** If you draw from both canon and\n draft files in one answer, separate the two and tell the user which fact\n came from which kind of source.\n';
@@ -1797,7 +1797,7 @@ function buildClaudeMaesterBlock(version) {
1797
1797
  PreToolUse: [
1798
1798
  {
1799
1799
  matcher: "Read|Glob|Grep",
1800
- hooks: [{ type: "command", command: "npx maester skill runtime preread" }]
1800
+ hooks: [{ type: "command", command: "npx -y baller-maester skill runtime preread" }]
1801
1801
  }
1802
1802
  ]
1803
1803
  }
@@ -2043,7 +2043,7 @@ function decideAction2(existing, previousVersion, newVersion, newContent) {
2043
2043
  }
2044
2044
 
2045
2045
  // src/core/skill/templates/content/connector-policy-fallback.md
2046
- var connector_policy_fallback_default = "## Connector tools (traveling maesters)\n\nThis citadel may expose one or more **traveling maesters** as connectors. Your\nagent platform does not speak MCP, so connector operations are reached via the\nfallback CLI:\n\n```\nnpx maester connector list\nnpx maester connector exec <connector-name> <operation> [--key value]...\n```\n\n- `connector list` prints the configured connectors and the operations they\n expose.\n- `connector exec` invokes an operation and writes a JSON envelope to stdout.\n Exit code `0` is success, `1` is a connector-level failure (auth, remote\n error, invalid args), `2` is an invocation-level error (no such connector,\n no citadel.yaml).\n\nTreat the data the same way as MCP tool output: live, point-in-time, cite\nspecific identifiers, flag freshness when it isn't `up-to-date`, and don't\nassume undocumented fields.\n";
2046
+ var connector_policy_fallback_default = "## Connector tools (traveling maesters)\n\nThis citadel may expose one or more **traveling maesters** as connectors. Your\nagent platform does not speak MCP, so connector operations are reached via the\nfallback CLI:\n\n```\nnpx baller-maester connector list\nnpx baller-maester connector exec <connector-name> <operation> [--key value]...\n```\n\n- `connector list` prints the configured connectors and the operations they\n expose.\n- `connector exec` invokes an operation and writes a JSON envelope to stdout.\n Exit code `0` is success, `1` is a connector-level failure (auth, remote\n error, invalid args), `2` is an invocation-level error (no such connector,\n no citadel.yaml).\n\nTreat the data the same way as MCP tool output: live, point-in-time, cite\nspecific identifiers, flag freshness when it isn't `up-to-date`, and don't\nassume undocumented fields.\n";
2047
2047
 
2048
2048
  // src/core/skill/templates/shells/agents-md.ts
2049
2049
  var PREAMBLE = `# AGENTS.md
@@ -2242,25 +2242,25 @@ async function readOrUndefined(filePath) {
2242
2242
  }
2243
2243
  }
2244
2244
  var CONFIG_FILE = path.join(".codex", "config.toml");
2245
- function maesterBlock(repoRoot, launch) {
2246
- return { command: launch.command, args: [...launch.args], cwd: repoRoot };
2245
+ function maesterBlock(launch) {
2246
+ return { command: launch.command, args: [...launch.args] };
2247
2247
  }
2248
2248
  async function writeCodexMcpEntry(repoRoot, options = {}) {
2249
2249
  const filePath = path.join(repoRoot, CONFIG_FILE);
2250
2250
  await promises.mkdir(path.dirname(filePath), { recursive: true });
2251
2251
  const existingText = await readOrUndefined2(filePath);
2252
2252
  const launch = options.launch ?? resolveMaesterLaunchCommand();
2253
- const newText = renderTomlWithMaesterBlock(existingText, repoRoot, launch);
2253
+ const newText = renderTomlWithMaesterBlock(existingText, launch);
2254
2254
  if (existingText === newText) {
2255
2255
  return { filePath, action: "unchanged" };
2256
2256
  }
2257
2257
  await promises.writeFile(filePath, newText, "utf8");
2258
2258
  return { filePath, action: "written" };
2259
2259
  }
2260
- function renderTomlWithMaesterBlock(existingText, repoRoot, launch) {
2260
+ function renderTomlWithMaesterBlock(existingText, launch) {
2261
2261
  const parsed = existingText && existingText.trim().length > 0 ? TOML.parse(existingText) : {};
2262
2262
  const mcpServers = isJsonMap(parsed.mcp_servers) ? { ...parsed.mcp_servers } : {};
2263
- mcpServers.maester = maesterBlock(repoRoot, launch);
2263
+ mcpServers.maester = maesterBlock(launch);
2264
2264
  const next = { ...parsed, mcp_servers: mcpServers };
2265
2265
  return TOML.stringify(next);
2266
2266
  }
@@ -2334,7 +2334,7 @@ async function runWriter(target, repoRoot) {
2334
2334
 
2335
2335
  // package.json
2336
2336
  var package_default = {
2337
- version: "0.4.0"};
2337
+ version: "0.4.2"};
2338
2338
  var PACKAGE_VERSION = package_default.version;
2339
2339
 
2340
2340
  // src/core/skill/version.ts