@archme/cli 0.5.4 → 0.6.0

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 (2) hide show
  1. package/dist/cli.js +33 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -12173,6 +12173,16 @@ var init_storyNaming = __esm({
12173
12173
  });
12174
12174
 
12175
12175
  // ../shared/scanPrompts.ts
12176
+ function buildStoryCoverageGate(opts) {
12177
+ const preWrite = opts.noChangeSignal ? `
12178
+
12179
+ **Decide before you write.** A write is durable once \`update_architecture\` returns; \`report_no_change\` retracts nothing and is rejected after a diff-phase write. The only correction is another call removing what you added \u2014 \`componentUpdates: [{ remove: ["<id>"] }]\`, plus any connection for it.` : "";
12180
+ return `**A component may only be added if it is part of a user story.** When code sits below the altitude any story describes, leave the component out.
12181
+
12182
+ **Never invent a user story to cover a component** if the user story is not true or architecturally significant. A contrived user story is permanent and degrades the graph. Omitting irrelevant user stories is desired behavior, not a concession: the graph holds what is architecturally relevant, not everything the code contains, and it is up to you to be a good steward of it.
12183
+
12184
+ **After researching, if still in doubt about architectural relevance or significance, err on the side of no changes.**${preWrite}`;
12185
+ }
12176
12186
  function buildFormatRefStories(opts) {
12177
12187
  const draftBlock = opts.persistentDrafts ? FORMAT_REF_DRAFT_STORIES_BLOCK : "";
12178
12188
  const uncoveredSubFlowRule = opts.persistentDrafts ? CROSS_REF_UNCOVERED_DRAFT_STUB : CROSS_REF_UNCOVERED_REAL_STORY;
@@ -12241,10 +12251,25 @@ storyUpdates targeting:
12241
12251
  - Remove: storyUpdates: [{remove: ["old_story"]}]
12242
12252
  - Combined: storyUpdates: [{under: "auth", add: [{id: "new_flow", ...}], remove: ["old_flow"]}]`;
12243
12253
  }
12244
- var ANCHOR_RULES, ANCHOR_DISCOVERY, ANCHOR_VERIFICATION, FORMAT_REF_COMPONENTS, FORMAT_REF_CONNECTIONS, FORMAT_REF_DRAFT_STORIES_BLOCK, CROSS_REF_UNCOVERED_DRAFT_STUB, CROSS_REF_UNCOVERED_REAL_STORY, FORMAT_REF_STORIES;
12254
+ var BUILD_METHODOLOGY, ANCHOR_RULES, ANCHOR_DISCOVERY, ANCHOR_VERIFICATION, FORMAT_REF_COMPONENTS, FORMAT_REF_CONNECTIONS, FORMAT_REF_DRAFT_STORIES_BLOCK, CROSS_REF_UNCOVERED_DRAFT_STUB, CROSS_REF_UNCOVERED_REAL_STORY, FORMAT_REF_STORIES;
12245
12255
  var init_scanPrompts = __esm({
12246
12256
  "../shared/scanPrompts.ts"() {
12247
12257
  init_storyNaming();
12258
+ BUILD_METHODOLOGY = `You are a build sub-agent. You are part of a multi-agent system that builds a comprehensive visual architecture of a codebase \u2014 components, connections, and user stories that trace data flow end-to-end. Your role is to translate research findings into actual architecture: creating components backed by real code references, wiring connections between them, and building story sequence diagrams that trace how data flows through the system.
12259
+
12260
+ # Rules
12261
+
12262
+ - Only build what the research findings and code evidence support. Do not invent components, connections, or user stories that aren't backed by real code. If findings are insufficient, flag gaps rather than guessing.
12263
+ - Every connection MUST have a non-empty method
12264
+ - Keep component hierarchies nested (e.g., backend > api > routes)
12265
+ - Use at: "parent" to target nested scopes for connectionUpdates
12266
+ - External services must be created as components with \`role: "external"\` (and \`kind: "human"\` for human actors), then referenced by dot-path in sequences like any other component
12267
+ - Small utility modules are implementation details \u2014 omit unless architecturally significant
12268
+ - Components must exist before non-draft stories can reference them. Add components first, then wire stories.
12269
+
12270
+ # Story Coverage Gate
12271
+
12272
+ ${buildStoryCoverageGate({ noChangeSignal: false })}`;
12248
12273
  ANCHOR_RULES = `Every component must have either \`anchors\` (non-empty array) or \`unanchored: true\`. No bare components.
12249
12274
 
12250
12275
  Pick the anchor kind based on how the component lives in code:
@@ -16107,7 +16132,9 @@ Whenever you perform multiple independent operations, invoke all relevant tools
16107
16132
  1. ${step1}
16108
16133
  2. Inspect the diff below and, if useful, read individual files from the local clone for additional context.
16109
16134
  3. **Decide scope.** If the change touches multiple stories or areas, dispatch sub-agents (see Sub-Agent Strategy below) to research and update them in parallel. For small, focused changes you can handle everything directly \u2014 use your judgement.
16110
- 4. Call \`update_architecture\` (or have build sub-agents call it) with the minimal additive changes that reflect the diff \u2014 components, connections, AND stories, not components alone. Update every affected story you confirmed above, and add a story via \`storyUpdates\` for any new user-facing behavior or journey (endpoint flow, UI feature, background workflow) that passes the granularity gate in New Story Guidance below. ${STORY_DESCRIPTION_EDIT_RULE} **Tag each write's \`phase\` (see Provenance below).**
16135
+ 4. Call \`update_architecture\` (or have build sub-agents call it) with the minimal additive changes that reflect the diff \u2014 components, connections, AND stories, never components alone \u2014 see the Story Coverage Gate below **before** composing the payload: a diff that changes no story means no call at all. Update every affected story you confirmed above, and add a story via \`storyUpdates\` for any new user-facing behavior or journey (endpoint flow, UI feature, background workflow) that passes the granularity gate in New Story Guidance below. ${STORY_DESCRIPTION_EDIT_RULE} **Tag each write's \`phase\` (see Provenance below).**
16136
+
16137
+ ${STORY_COVERAGE_GATE}
16111
16138
 
16112
16139
  ${NEW_STORY_GUIDANCE}
16113
16140
 
@@ -17230,7 +17257,7 @@ ${signal} received, shutting down`);
17230
17257
  process.on("SIGINT", () => shutdown("SIGINT"));
17231
17258
  process.on("SIGTERM", () => shutdown("SIGTERM"));
17232
17259
  }
17233
- var HEARTBEAT_INTERVAL_MS, CLAUDE_TIMEOUT_MS, CLAUDE_LARGE_DIFF_TIMEOUT_MS, SAFETY_SWEEP_MS, LOG_STDOUT_CAP_BYTES, LOG_STDERR_CAP_BYTES, PRE_SPAWN_TOKEN_MIN_LIFETIME_MS, SUPABASE_URL, SUPABASE_ANON_KEY, ARCHME_DAEMON_CLIENT_ID, ARCHME_MCP_BASE_URL, CLONE_BASE_DIR, DAEMON_ID, LEASE_SECONDS, inFlight, cancelled, killReasons, activeCleanups, cloneMutex, shuttingDown, daemonVersion, pauseUntilMs, resumeTimer, currentSched, MAX_CONCURRENT_JOBS, ctxByJob, deviceByJob, DEFAULT_CLONE_BASE_DIR, INLINE_PATCH_BYTE_CAP, GIT_SHA_RE, CURATOR_PREAMBLE, CORE_PRINCIPLES, NEW_STORY_GUIDANCE, STORY_DESCRIPTION_EDIT_RULE, PHASE_GUIDANCE, BASE_RULES, DIFF_RULES, finite, channelSeq, MultipleAccountsError, __testDispatch;
17260
+ var HEARTBEAT_INTERVAL_MS, CLAUDE_TIMEOUT_MS, CLAUDE_LARGE_DIFF_TIMEOUT_MS, SAFETY_SWEEP_MS, LOG_STDOUT_CAP_BYTES, LOG_STDERR_CAP_BYTES, PRE_SPAWN_TOKEN_MIN_LIFETIME_MS, SUPABASE_URL, SUPABASE_ANON_KEY, ARCHME_DAEMON_CLIENT_ID, ARCHME_MCP_BASE_URL, CLONE_BASE_DIR, DAEMON_ID, LEASE_SECONDS, inFlight, cancelled, killReasons, activeCleanups, cloneMutex, shuttingDown, daemonVersion, pauseUntilMs, resumeTimer, currentSched, MAX_CONCURRENT_JOBS, ctxByJob, deviceByJob, DEFAULT_CLONE_BASE_DIR, INLINE_PATCH_BYTE_CAP, GIT_SHA_RE, CURATOR_PREAMBLE, CORE_PRINCIPLES, STORY_COVERAGE_GATE, NEW_STORY_GUIDANCE, STORY_DESCRIPTION_EDIT_RULE, PHASE_GUIDANCE, BASE_RULES, DIFF_RULES, finite, channelSeq, MultipleAccountsError, __testDispatch;
17234
17261
  var init_run = __esm({
17235
17262
  "src/daemon/run.ts"() {
17236
17263
  "use strict";
@@ -17297,6 +17324,9 @@ You are curating the architecture diagram, not just transcribing the change. The
17297
17324
 
17298
17325
  - **Code is the source of truth.** Docs, comments, READMEs, commit messages, and PR descriptions can point you at *where to look*, but every architectural claim must come from reading the actual code paths end-to-end. Do not spot-check or paraphrase what a doc says \u2014 verify the behavior by tracing the code itself. If the doc and the code disagree, the code wins; if you cannot find the code, treat the claim as not-present.
17299
17326
  - **Each edit lands in a diff view.** The user reviews every change in a diff, where a capitalized letter or a reworded sentence shows up just as loudly as a new component. Keep that lens on as you work: each edit is going to land in someone's review queue. Aim for changes that are worth their visual weight \u2014 if the meaning has not shifted, the words probably should not either. This is judgement, not a rule; missing a real change to avoid a small one is the worse failure.`;
17327
+ STORY_COVERAGE_GATE = `## Story Coverage Gate
17328
+
17329
+ ${buildStoryCoverageGate({ noChangeSignal: true })}`;
17300
17330
  NEW_STORY_GUIDANCE = `## New Story Guidance
17301
17331
  ${STORY_GRANULARITY_GUIDANCE}
17302
17332
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archme/cli",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Map your codebase into a living architecture diagram: run `archme init` in a repo to scan it, `archme daemon start` to keep it current on every commit.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",