Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 6.49 KB

AGENTS.md

File metadata and controls

65 lines (50 loc) · 6.49 KB

Agent guidelines

Rules for AI agents (and humans) changing this repository. Keep them short; extend them when a mistake repeats.

Repository

  • AEM Content Manager (ACM): Maven multi-module AEM project (core, ui.apps, ui.config, ui.content, ui.frontend, all, ...), and TypeScript tools in tools/ (see tools/README.md and DEVELOPMENT.md).
  • ACM must work the same on AEM 6.5 on-premise, AMS and AEM as a Cloud Service, on Java 8, 11 and 21. Use only Java 8 language features and APIs, and nothing specific to one AEM flavour.
  • Build: sh mvnw clean install (Spotless with Palantir Java Format applies formatting). Local AEM: sh taskw setup, deploy: sh taskw develop:all.
  • Tools: npm install, then npm run build, npm run typecheck, npm run lint and npm test in tools/mcp-server or tools/vscode-extension.

Change discipline

  • Make the smallest change that solves the problem; no drive-by refactors or reformatting.
  • Follow existing conventions instead of adding overrides or special cases. If a convention does not fit, rename the new thing.
  • No dead code, compatibility shims or polyfills. Raise the minimum version (e.g. engines.vscode) instead of feature-detecting APIs.
  • Never use deprecated APIs; check the IDE diagnostics for deprecation warnings.
  • Comments state only what the code cannot show, in one short line.
  • Update the docs (README, tool READMEs, skill, CHANGELOG) in the same change as the behaviour.
  • Never bump versions by hand. sh taskw release:mcp-server -- <version> and sh taskw release:vscode-extension -- <version> bump package.json, package-lock.json (and server.json), then commit, tag and push. Only add the CHANGELOG section for the next version.
  • Do not commit, push or release unless asked.

Configuration

  • Everything users may need to tune is explicit and documented: OSGi configuration in ACM, settings in the VS Code extension (package.json contributes.configuration), the config document and environment variables of the MCP server (its README).
  • No hidden constants for timeouts, intervals or limits. Use sensible defaults and say in the description what the value bounds and what happens when it is exceeded.
  • The VS Code extension passes its settings to the bundled MCP server, so both behave the same.
  • Secrets never go to settings or logs: VS Code secret storage in the extension (it never writes them to files). The MCP server reads them from its config document — a literal, { "env": "NAME" } or { "file": "path" } per instance — and warns when a file holding literals is readable by others.

Security

  • Permissions use ACM features: nodes under /apps/acm/feature that users need jcr:read on, granted with repoinit. Never check group membership or user IDs in code.
  • Feature names follow the enum convention: CONSOLE_EXECUTE_NOHISTORY is the node console/execute/nohistory and the ID console.execute.nohistory. Use single-word segments.
  • Any endpoint that compiles or runs code (parse, check, describing inputs, running) counts as code execution and authorizes with Executor.authorizeCode. Stored scripts always run with their content from the repository, never with content sent by the client.
  • Runs without history require the console/execute/nohistory feature.
  • Guardrails in tools (read-only instances, confirmations) are conveniences; the real boundary is AEM permissions. Document it that way.

Logging

Log only what has value; ACM runs on busy instances and is called by editors and agents.

Level Use for
ERROR Real failures needing attention, with the exception. Never for expected outcomes (e.g. compile errors returned to the caller).
WARN Degraded but handled situations (locked, aborted).
INFO Lifecycle events and actions that leave no other trace (e.g. code run without history, see ExecutionAudit).
DEBUG Per-action details that history or responses already show.
TRACE High-frequency calls, e.g. compile checks sent on every edit.
  • Reads, polling and health checks log nothing on success.
  • No stack traces for expected errors; one line with the message is enough.
  • The audit trail goes to the dev.vml.es.acm.audit logger only.

Tools

  • tools/shared is source, not a package: no dependencies, no Node.js or VS Code APIs, no configuration loading. Tools import it as @acm/shared and bundle it.
  • The script API reference is generated by node tools/shared/codegen.mjs from core; commit the regenerated files with the Java change. Never edit api.json or api.md by hand.
  • The ACM Groovy scripting skill is the single source of guidance for agents writing scripts. Its ## Essentials section is sent as MCP server instructions; the templates/{target}/*.groovy files (manual, automatic, extension, mock, console for bare code) are the templates of ACM: New Script, each starting with a documentation header and listed in tools/shared/src/skill.ts; every target needs a template and SKILL.md links them.
  • Stored scripts start with a documentation header: a /* */ block with YAML frontmatter and a Markdown description, followed by a blank line.
  • Docs describe processes and contracts (command, environment variables, prompts for agents), not other tools' config files, locations or UI; those change and the tools' own agents know them. Link vendor documentation only where no process can be described.
  • Identifiers have one source: the extension's command, view, context key, setting and tree item names live in tools/vscode-extension/src/ids.ts (npm run check:manifest compares them with package.json), setting defaults only in package.json, API paths, MCP environment variables and ACM feature IDs in tools/shared. Never repeat such a string in code.
  • Keep UI and logic apart: anything that does not need vscode (queries, filters, polling, formatting) lives in tools/shared and is used by both tools; the extension only wires it to views, commands and prompts.
  • Never build query strings or SQL from request values without escaping them; a JCR-SQL2 string literal escapes ' as '' (see ExecutionQuery).
  • The VS Code extension uses native APIs only (settings, secret storage, tree views, output channels, MCP server definition provider) and bundles the MCP server from tools/mcp-server/src.
  • Release workflows are triggered by tags (v*, mcp-server-v*, vscode-extension-v*); npm trusted publishing is bound to the workflow file name, so do not rename release workflows.