@mytechtoday/augment-extensions 3.3.0 → 3.4.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 (87) hide show
  1. package/AGENTS.md +21 -16
  2. package/README.md +134 -5
  3. package/augment-extensions/workflows/cross-platform/README.md +120 -0
  4. package/augment-extensions/workflows/cross-platform/examples/end-to-end-session.md +196 -0
  5. package/augment-extensions/workflows/cross-platform/module.json +91 -0
  6. package/augment-extensions/workflows/cross-platform/rules/drift-resolution.md +126 -0
  7. package/augment-extensions/workflows/cross-platform/rules/export-guide.md +139 -0
  8. package/augment-extensions/workflows/cross-platform/rules/mcp-snippet-inlining.md +99 -0
  9. package/augment-extensions/workflows/cross-platform/rules/mirror-guide.md +139 -0
  10. package/augment-extensions/workflows/cross-platform/rules/windows-fallback.md +111 -0
  11. package/augment-extensions/workflows/decision-layer/README.md +40 -4
  12. package/augment-extensions/workflows/decision-layer/installation/augx-judgments/SKILL.md +14 -0
  13. package/augment-extensions/workflows/decision-layer/module.json +2 -2
  14. package/augment-extensions/workflows/decision-layer/rules/02-operation.md +2 -0
  15. package/augment-extensions/workflows/decision-layer/runtime/automatic.cjs +80 -0
  16. package/augment-extensions/workflows/decision-layer/runtime/chat-install.cjs +149 -0
  17. package/augment-extensions/workflows/decision-layer/runtime/chat-server.cjs +71 -0
  18. package/augment-extensions/workflows/decision-layer/runtime/contracts.d.ts +13 -0
  19. package/augment-extensions/workflows/decision-layer/runtime/install.cjs +16 -3
  20. package/augment-extensions/workflows/decision-layer/schemas/automatic-input.schema.json +40 -0
  21. package/augment-extensions/workflows/decision-layer/schemas/config.schema.json +12 -0
  22. package/augment-extensions/workflows/decision-layer/sources.md +9 -0
  23. package/cli/MODULES.md +22 -22
  24. package/cli/dist/cli.js +38 -7
  25. package/cli/dist/cli.js.map +1 -1
  26. package/cli/dist/commands/context.d.ts +8 -0
  27. package/cli/dist/commands/context.d.ts.map +1 -0
  28. package/cli/dist/commands/context.js +115 -0
  29. package/cli/dist/commands/context.js.map +1 -0
  30. package/cli/dist/commands/decision.d.ts.map +1 -1
  31. package/cli/dist/commands/decision.js +3 -1
  32. package/cli/dist/commands/decision.js.map +1 -1
  33. package/cli/dist/commands/gui-decision.d.ts.map +1 -1
  34. package/cli/dist/commands/gui-decision.js +23 -2
  35. package/cli/dist/commands/gui-decision.js.map +1 -1
  36. package/cli/dist/commands/gui-module-manager.d.ts.map +1 -1
  37. package/cli/dist/commands/gui-module-manager.js +2 -0
  38. package/cli/dist/commands/gui-module-manager.js.map +1 -1
  39. package/cli/dist/commands/show.d.ts.map +1 -1
  40. package/cli/dist/commands/show.js +5 -18
  41. package/cli/dist/commands/show.js.map +1 -1
  42. package/cli/dist/commands/skill.d.ts.map +1 -1
  43. package/cli/dist/commands/skill.js +3 -3
  44. package/cli/dist/commands/skill.js.map +1 -1
  45. package/cli/dist/commands/update.js +14 -7
  46. package/cli/dist/commands/update.js.map +1 -1
  47. package/cli/dist/core/compatibility-checker.d.ts.map +1 -1
  48. package/cli/dist/core/compatibility-checker.js +5 -2
  49. package/cli/dist/core/compatibility-checker.js.map +1 -1
  50. package/cli/dist/lib/context-hosts.d.ts +16 -0
  51. package/cli/dist/lib/context-hosts.d.ts.map +1 -0
  52. package/cli/dist/lib/context-hosts.js +395 -0
  53. package/cli/dist/lib/context-hosts.js.map +1 -0
  54. package/cli/dist/lib/context-refresh.d.ts +60 -0
  55. package/cli/dist/lib/context-refresh.d.ts.map +1 -0
  56. package/cli/dist/lib/context-refresh.js +630 -0
  57. package/cli/dist/lib/context-refresh.js.map +1 -0
  58. package/cli/dist/utils/decision-runner.d.ts +2 -0
  59. package/cli/dist/utils/decision-runner.d.ts.map +1 -1
  60. package/cli/dist/utils/decision-runner.js.map +1 -1
  61. package/cli/dist/utils/extensions-config.d.ts.map +1 -1
  62. package/cli/dist/utils/extensions-config.js +3 -1
  63. package/cli/dist/utils/extensions-config.js.map +1 -1
  64. package/cli/dist/utils/extractCommandHelp.d.ts.map +1 -1
  65. package/cli/dist/utils/extractCommandHelp.js +50 -20
  66. package/cli/dist/utils/extractCommandHelp.js.map +1 -1
  67. package/cli/dist/utils/mcp-integration.d.ts.map +1 -1
  68. package/cli/dist/utils/mcp-integration.js +5 -7
  69. package/cli/dist/utils/mcp-integration.js.map +1 -1
  70. package/cli/dist/utils/module-system.d.ts +12 -0
  71. package/cli/dist/utils/module-system.d.ts.map +1 -1
  72. package/cli/dist/utils/module-system.js +15 -0
  73. package/cli/dist/utils/module-system.js.map +1 -1
  74. package/cli/dist/utils/process.d.ts +14 -0
  75. package/cli/dist/utils/process.d.ts.map +1 -0
  76. package/cli/dist/utils/process.js +57 -0
  77. package/cli/dist/utils/process.js.map +1 -0
  78. package/cli/dist/utils/version.d.ts +2 -0
  79. package/cli/dist/utils/version.d.ts.map +1 -0
  80. package/cli/dist/utils/version.js +8 -0
  81. package/cli/dist/utils/version.js.map +1 -0
  82. package/cli/dist/utils/vscode-editor.d.ts.map +1 -1
  83. package/cli/dist/utils/vscode-editor.js +14 -8
  84. package/cli/dist/utils/vscode-editor.js.map +1 -1
  85. package/modules.md +17 -4
  86. package/package.json +7 -1
  87. package/scripts/check-wsl-augx.sh +63 -0
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "cross-platform",
3
+ "version": "1.0.0",
4
+ "displayName": "Cross-Platform Distribution Workflow",
5
+ "description": "Day-to-day guide for distributing Augx extension modules into Claude Code, Cursor, Windsurf, and GitHub Copilot via 'augx export' and 'augx link --mirror'. Covers per-tool target paths, drift resolution, Windows symlink fallback, and the MCP-first task-context contract.",
6
+ "type": "workflows",
7
+ "tags": [
8
+ "augx",
9
+ "cli",
10
+ "cross-platform",
11
+ "claude-code",
12
+ "cursor",
13
+ "windsurf",
14
+ "copilot",
15
+ "interoperability",
16
+ "export",
17
+ "mirror",
18
+ "symlink",
19
+ "workflow"
20
+ ],
21
+ "dependencies": [],
22
+ "augment": {
23
+ "characterCount": 40880,
24
+ "priority": "medium",
25
+ "category": "workflows",
26
+ "appliesTo": {
27
+ "filePatterns": [
28
+ "CLAUDE.md",
29
+ ".claude/rules/**/*",
30
+ ".cursor/rules/**/*",
31
+ ".windsurfrules",
32
+ ".windsurf/rules/**/*",
33
+ ".github/copilot-instructions.md",
34
+ ".github/instructions/**/*",
35
+ ".augment/coordination.json"
36
+ ],
37
+ "languages": ["markdown", "json"],
38
+ "domains": [
39
+ "website",
40
+ "web-app",
41
+ "os-application",
42
+ "linux",
43
+ "windows",
44
+ "dotnet",
45
+ "mobile",
46
+ "ai-prompt-helper"
47
+ ]
48
+ }
49
+ },
50
+ "installation": {
51
+ "required": false,
52
+ "steps": [
53
+ "Link module: augx link workflows/cross-platform",
54
+ "Read rules/export-guide.md for 'augx export' usage",
55
+ "Read rules/mirror-guide.md for 'augx link --mirror' usage",
56
+ "Read rules/drift-resolution.md when 'augx export' exits 3",
57
+ "Read rules/windows-fallback.md when running on Windows without Developer Mode"
58
+ ]
59
+ },
60
+ "features": {
61
+ "export_command": {
62
+ "enabled": true,
63
+ "description": "Aggregate linked modules into the native single-file format of Claude Code, Cursor, Windsurf, or GitHub Copilot."
64
+ },
65
+ "mirror_hook": {
66
+ "enabled": true,
67
+ "description": "Per-module materialization into each tool's per-module rules directory with symlink-or-copy semantics."
68
+ },
69
+ "drift_resolution": {
70
+ "enabled": true,
71
+ "description": "Playbook for resolving the 'exit 3 / hand-edited target' refusal from 'augx export'."
72
+ },
73
+ "windows_fallback": {
74
+ "enabled": true,
75
+ "description": "Documented EPERM/EACCES/ENOSYS fallback from symlink to copy, recorded once in coordination.mirrors."
76
+ },
77
+ "mcp_task_context": {
78
+ "enabled": true,
79
+ "description": "MCP-first contract: exported files contain zero live task data; agents query the Beads MCP server instead."
80
+ }
81
+ },
82
+ "contents": [
83
+ "README.md - Module overview, quick reference, per-tool target paths.",
84
+ "rules/export-guide.md - Day-to-day 'augx export' usage and flags.",
85
+ "rules/mirror-guide.md - Day-to-day 'augx link --mirror' usage and flags.",
86
+ "rules/drift-resolution.md - Recovering from 'exit 3' drift refusal.",
87
+ "rules/windows-fallback.md - Symlink-to-copy fallback behavior on Windows.",
88
+ "rules/mcp-snippet-inlining.md - When and how the Beads MCP snippet is inlined.",
89
+ "examples/end-to-end-session.md - Walkthrough of a full link -> mirror -> export -> unlink session."
90
+ ]
91
+ }
@@ -0,0 +1,126 @@
1
+ # Drift Resolution Playbook
2
+
3
+ ## Symptom
4
+
5
+ ```
6
+ $ augx export --target claude-code
7
+ error: CLAUDE.md has been hand-edited since the last 'augx export'.
8
+ (banner source-hash 'a1b2c3d4...' does not match body hash 'e5f6a7b8...')
9
+ Pass --force to overwrite, or edit module sources and re-run.
10
+ $ echo $?
11
+ 3
12
+ ```
13
+
14
+ `augx export` refuses to overwrite a target file when the banner's recorded `source-hash` does not match a freshly-computed hash of the body. This protects manual edits from being silently clobbered.
15
+
16
+ ## Why Drift Happens
17
+
18
+ | Cause | How It Got There |
19
+ |---|---|
20
+ | Local edit | A human (or another tool) modified the exported file directly. |
21
+ | Different `augx` version | A teammate ran `augx export` from a version with a different rendering pipeline; their banner hash will not match yours after upgrade. |
22
+ | Module mutation outside augx | Files under `augment-extensions/` were edited but `augx export` was not re-run on the original machine. |
23
+ | Merge conflict | A `git merge` left mixed content from two branches inside the exported file. |
24
+
25
+ ## Resolution Decision Tree
26
+
27
+ ```
28
+ Did the exported file change for a real reason?
29
+ ├── No (accidental save, stale clone)
30
+ │ └── git checkout HEAD -- <path-to-exported-file>
31
+ │ Then re-run 'augx export'.
32
+ │
33
+ ├── Yes, the edits should be reflected in modules
34
+ │ └── Move the edits into augment-extensions/<category>/<module>/rules/<file>.md
35
+ │ Run 'augx export' again.
36
+ │ The new banner hash will match the new body.
37
+ │
38
+ └── Yes, but the edits are intentionally local (one-off override)
39
+ └── Run 'augx export --force'.
40
+ Confirm the local edits are gone, then add the override
41
+ somewhere outside the augx-managed file (e.g., .augment/rules/).
42
+ ```
43
+
44
+ ## Recommended Sequence
45
+
46
+ ### Step 1: Inspect
47
+
48
+ ```bash
49
+ git diff CLAUDE.md
50
+ ```
51
+
52
+ Look at what changed. If git also shows changes under `augment-extensions/`, those are the upstream source; the exported diff is downstream.
53
+
54
+ ### Step 2: Decide where the change belongs
55
+
56
+ - **Belongs in a module**: move the edit into the module's `rules/*.md`, commit, then re-export.
57
+ - **Belongs nowhere** (a stray edit, copy/paste mistake): discard with `git checkout`.
58
+ - **Belongs only locally**: accept the loss by running with `--force`, then re-add the local override outside the augx-managed file.
59
+
60
+ ### Step 3: Re-export
61
+
62
+ ```bash
63
+ augx export --target claude-code
64
+ ```
65
+
66
+ Verify exit code 0. The new banner records the new source hash.
67
+
68
+ ### Step 4: Validate
69
+
70
+ ```bash
71
+ augx export --target claude-code --dry-run
72
+ ```
73
+
74
+ Should report `(no-op)` or zero bytes changed.
75
+
76
+ ## Bypassing Drift Detection
77
+
78
+ ```bash
79
+ augx export --target claude-code --force
80
+ ```
81
+
82
+ `--force` writes regardless of drift. Use only after one of:
83
+
84
+ - You have already moved the edits into modules and just want the canonical file to refresh.
85
+ - You are intentionally discarding the local edits.
86
+ - You are running in CI where the drift is known to be from an `augx` version bump.
87
+
88
+ Do NOT use `--force` reflexively. Drift refusal is a feature; it is the only thing standing between an `augx` re-run and silent data loss.
89
+
90
+ ## CI Recipe
91
+
92
+ In CI, the typical sequence is:
93
+
94
+ ```bash
95
+ augx export --target all --dry-run # see what would change
96
+ augx export --target all # write only if no drift
97
+ test $? -eq 0
98
+ ```
99
+
100
+ If CI hits exit 3, it should fail loudly rather than silently `--force`. Drift in CI usually means a stale checkout or a forgotten commit; investigate before forcing.
101
+
102
+ ## Per-Tool Considerations
103
+
104
+ | Tool | Drift Manifests As |
105
+ |---|---|
106
+ | `claude-code` (`CLAUDE.md`) | Comment-stripping by editors (some IDEs auto-format HTML comments). |
107
+ | `cursor` (`.cursor/rules/augx.mdc`) | YAML frontmatter being reformatted (key order changes). |
108
+ | `windsurf` (`.windsurfrules`) | Trailing-whitespace fixes from editor save-on-format. |
109
+ | `copilot` (`.github/copilot-instructions.md`) | GitHub's web editor adding a trailing newline. |
110
+
111
+ The banner is content-stable across whitespace edits **inside the body** (the hash is computed over the body excluding the banner), but a single character change does invalidate the recorded hash. If your editor cannot be told to leave the file alone, consider adding it to `.gitattributes`:
112
+
113
+ ```
114
+ CLAUDE.md text eol=lf -text-conversion
115
+ .cursor/rules/** text eol=lf -text-conversion
116
+ .windsurfrules text eol=lf -text-conversion
117
+ ```
118
+
119
+ ## When To Escalate
120
+
121
+ If `augx export` keeps exiting 3 on a clean checkout and a re-run from a known-good `augx` version, file a Beads task. The expected invariants:
122
+
123
+ - Two runs from the same `augx` version on the same modules MUST produce identical banner and body hashes.
124
+ - A no-op re-run MUST exit 0 with no writes.
125
+
126
+ A reproducible violation is a bug in the export pipeline, not a drift condition.
@@ -0,0 +1,139 @@
1
+ # `augx export` Day-to-Day Guide
2
+
3
+ ## Purpose
4
+
5
+ `augx export` collects every linked Augx module's `rules/` content and writes it into the **single aggregated file** that one or more target tools expect.
6
+
7
+ ## Grammar
8
+
9
+ ```
10
+ augx export --target <claude-code|cursor|windsurf|copilot|all>
11
+ [--output <path>]
12
+ [--dry-run]
13
+ [--force]
14
+ [--verbose]
15
+ ```
16
+
17
+ ## Flags
18
+
19
+ | Flag | Default | Purpose |
20
+ |---|---|---|
21
+ | `--target` | (reads `.augment/coordination.json.export.targets`) | Pick the destination tool. Use `all` to write every target in one invocation. |
22
+ | `--output` | per-target conventional path | Override the destination path. Valid only with a single `--target`. |
23
+ | `--dry-run` | `false` | Print the resolved file list, projected byte counts, and module counts. No writes. |
24
+ | `--force` | `false` | Overwrite even if drift is detected (exit code 3). Use only after reviewing the diff. |
25
+ | `--verbose` | `false` | Print per-module sizes and mirror/symlink decisions. |
26
+
27
+ If `--target` is omitted **and** `.augment/coordination.json.export.targets` is empty or missing, `augx export` exits non-zero with a usage error.
28
+
29
+ ## What Each Run Does
30
+
31
+ 1. Reads `.augment/coordination.json` (and `.vscode/mcp.json`, `.augment/mcp/servers.json` for the MCP snippet check).
32
+ 2. Loads every linked module, applies `export.ignore` glob patterns, computes a deterministic source hash.
33
+ 3. Renders the aggregated content for each requested target.
34
+ 4. Reads the existing target file (if any). If the banner's `source-hash` does not match the recomputed body hash, exits 3 (drift refusal). See `drift-resolution.md`.
35
+ 5. If the new content is byte-identical to the existing content, exits 0 without writing (no-op).
36
+ 6. Otherwise writes the new content with LF line endings.
37
+
38
+ ## Output Anatomy
39
+
40
+ Every exported file begins with a banner:
41
+
42
+ ```
43
+ <!-- GENERATED BY augx export - DO NOT EDIT -->
44
+ <!-- augx-version: <semver> -->
45
+ <!-- generated-at: <ISO-8601> -->
46
+ <!-- source-hash: <16-hex> -->
47
+ <!-- modules: <id>@<ver>, ... -->
48
+ ```
49
+
50
+ Followed (when the Beads MCP server is declared) by the inlined MCP snippet, then per-module sections in **alphabetical order by module ID**, then a footer.
51
+
52
+ For Cursor, a YAML frontmatter precedes the banner:
53
+
54
+ ```yaml
55
+ ---
56
+ description: Augx aggregated rules
57
+ alwaysApply: true
58
+ ---
59
+ ```
60
+
61
+ ## Typical Workflows
62
+
63
+ ### First export in a project
64
+
65
+ ```bash
66
+ augx link coding-standards/typescript
67
+ augx link workflows/cross-platform
68
+ augx export --target cursor
69
+ # writes .cursor/rules/augx.mdc with both modules
70
+ ```
71
+
72
+ ### Multi-target export
73
+
74
+ ```bash
75
+ augx export --target all
76
+ ```
77
+
78
+ Writes `CLAUDE.md`, `.cursor/rules/augx.mdc`, `.windsurfrules`, and `.github/copilot-instructions.md` in one pass. Each is computed independently; a failure on one target does not abort the others (per-target exit status is summarized at the end).
79
+
80
+ ### Preview before writing
81
+
82
+ ```bash
83
+ augx export --target all --dry-run
84
+ ```
85
+
86
+ Output:
87
+
88
+ ```
89
+ [dry-run] claude-code -> CLAUDE.md (12_345 bytes, 7 modules)
90
+ [dry-run] cursor -> .cursor/rules/augx.mdc (13_010 bytes, 7 modules)
91
+ [dry-run] windsurf -> .windsurfrules (12_120 bytes, 7 modules)
92
+ [dry-run] copilot -> .github/copilot-instructions.md (12_405 bytes, 7 modules)
93
+ ```
94
+
95
+ ### Default-target setup
96
+
97
+ Add to `.augment/coordination.json`:
98
+
99
+ ```json
100
+ {
101
+ "export": {
102
+ "targets": ["claude-code", "cursor"],
103
+ "ignore": ["**/examples/**", "**/CHANGELOG.md"]
104
+ }
105
+ }
106
+ ```
107
+
108
+ After this, plain `augx export` writes both files. `export.targets` is the canonical place to record team conventions.
109
+
110
+ ## Exit Codes
111
+
112
+ | Code | Meaning | Action |
113
+ |---|---|---|
114
+ | 0 | Success (including no-op) | Continue. |
115
+ | 1 | Usage error (missing/unknown `--target`, conflicting flags) | Fix the command. |
116
+ | 2 | Resolution error (no linked modules, broken module manifest) | Verify `augx list --linked`. |
117
+ | 3 | Drift refusal (target was hand-edited) | See `drift-resolution.md`. |
118
+ | 4 | I/O error (cannot write inside project root, permission denied) | Check filesystem permissions. |
119
+
120
+ ## Idempotency Invariants
121
+
122
+ - **Same inputs -> byte-identical output.** The timestamp in the banner is only refreshed when the source hash changes; a no-op run leaves the file untouched.
123
+ - **Module order is canonicalized.** Modules are sorted by ID before rendering, so reordering `augx link` calls does not change the output.
124
+ - **Paths in content are forward-slash** regardless of host OS.
125
+ - **Line endings are LF** regardless of host OS.
126
+
127
+ ## Safety Rules
128
+
129
+ - `augx export` never writes outside the project root.
130
+ - It never follows symlinks out of `augment-extensions/` while resolving sources.
131
+ - It does not call out to Beads, the MCP server, or the network.
132
+ - It never touches `.augment/` rules; the Augment Code surface stays as-is.
133
+
134
+ ## What `augx export` Does NOT Do
135
+
136
+ - Does not embed live task state (`bd-` IDs, statuses, dependency lists).
137
+ - Does not modify `augment-extensions/` content.
138
+ - Does not write per-module mirror files; that is `augx link --mirror`'s job.
139
+ - Does not delete files; only overwrites the target path or refuses (exit 3).
@@ -0,0 +1,99 @@
1
+ # MCP Snippet Inlining
2
+
3
+ ## What Gets Inlined
4
+
5
+ When `augx export` writes an aggregated file, it may inline a single tool-agnostic snippet describing how the consuming AI agent should query the **Beads MCP server** for live task state. The snippet body comes from `augment-extensions/workflows/mcp/templates/beads.md` and contains, at minimum:
6
+
7
+ - The server id (`beads`).
8
+ - The relevant public operations (`tasks/list`, `tasks/get`, `dependencies/list`, `status/get`).
9
+ - A reference to `augment-extensions/workflows/beads/` for the human-readable command guide.
10
+ - A directive that the consuming agent MUST query the MCP server for task context and NEVER rely on prose in the exported file.
11
+
12
+ The snippet contains **no** task IDs, statuses, dependency lists, endpoint URLs, secrets, or other live data. It is pure static guidance.
13
+
14
+ ## Trigger Condition
15
+
16
+ The snippet is inlined **only when** at least one of the following declares an MCP server with id `beads`:
17
+
18
+ - `.vscode/mcp.json`
19
+ - `.augment/mcp/servers.json`
20
+
21
+ When neither file exists, or neither declares the `beads` server, the snippet is omitted entirely. The exported file remains focused on the static module guidance and does not reference MCP at all.
22
+
23
+ This keeps the trigger explicit and auditable: presence of an MCP config that names `beads` is the sole signal.
24
+
25
+ ## Inlining Position
26
+
27
+ The snippet appears immediately after the generated banner (and, for Cursor, after the YAML frontmatter), before the first `## Module:` section header. Per-target adapters MAY wrap it in a single tool-specific line (e.g., a Cursor `> Note:` callout) but MUST NOT alter the substantive content.
28
+
29
+ ## What This Looks Like In Practice
30
+
31
+ `CLAUDE.md` (with `beads` declared in `.vscode/mcp.json`):
32
+
33
+ ```
34
+ <!-- GENERATED BY augx export - DO NOT EDIT -->
35
+ <!-- augx-version: 1.0.0 -->
36
+ <!-- generated-at: 2026-05-25T12:00:00.000Z -->
37
+ <!-- source-hash: a1b2c3d4e5f6a7b8 -->
38
+ <!-- modules: coding-standards/typescript@1.0.0, workflows/openspec@1.0.0 -->
39
+
40
+ ### Live Task Context via Beads MCP
41
+ ...
42
+
43
+ ## Module: coding-standards/typescript (v1.0.0)
44
+ ...
45
+ ```
46
+
47
+ `CLAUDE.md` (without `beads` declared anywhere):
48
+
49
+ ```
50
+ <!-- GENERATED BY augx export - DO NOT EDIT -->
51
+ <!-- augx-version: 1.0.0 -->
52
+ <!-- generated-at: 2026-05-25T12:00:00.000Z -->
53
+ <!-- source-hash: a1b2c3d4e5f6a7b8 -->
54
+ <!-- modules: coding-standards/typescript@1.0.0, workflows/openspec@1.0.0 -->
55
+
56
+ ## Module: coding-standards/typescript (v1.0.0)
57
+ ...
58
+ ```
59
+
60
+ The body bytes differ; the source hash will differ; the modules list is unchanged. Drift detection treats this correctly: removing the Beads MCP declaration and re-running `augx export` is a normal write, not a drift refusal.
61
+
62
+ ## Why MCP-First
63
+
64
+ The cross-platform feature is explicitly **MCP-first** for task context: exported files never embed live task data because:
65
+
66
+ 1. **Staleness**: a `bd-` ID baked into `CLAUDE.md` at export time may already be closed by the time an agent reads it.
67
+ 2. **Surface area**: spreading task data across four target files multiplies the surface where stale data can live.
68
+ 3. **Auditability**: a single MCP query point is far easier to audit than four divergent prose copies.
69
+ 4. **Privacy**: task descriptions sometimes contain sensitive references; the MCP server can scope responses, exported files cannot.
70
+
71
+ The static snippet is the agreed-upon "pointer", not the data itself.
72
+
73
+ ## When To Remove The Snippet
74
+
75
+ The snippet disappears from exported files on the next `augx export` run after either:
76
+
77
+ - The `beads` MCP server declaration is removed from both `.vscode/mcp.json` and `.augment/mcp/servers.json`.
78
+ - A future `--ignore-mcp` flag is passed to `augx export` (reserved for a later change, not in scope today).
79
+
80
+ ## Template Source
81
+
82
+ `augment-extensions/workflows/mcp/templates/beads.md` is the canonical template. It is versioned together with the `cross-platform` capability. Changes to the template (e.g., adding a new MCP operation like `comments/append`) cause the source hash to recompute on the next export run, which produces a normal write on every target.
83
+
84
+ ## What If A Project Declares A Different MCP Server?
85
+
86
+ Only the `beads` server triggers the snippet. A project may declare other MCP servers in `.vscode/mcp.json` or `.augment/mcp/servers.json` without affecting cross-platform export behavior. The trigger logic is a literal lookup for an entry whose key (or `id`) is `beads`; no fuzzy matching, no other server names recognized in this change.
87
+
88
+ Future capabilities may add per-server snippets (e.g., a `filesystem` MCP server template). Each would be opt-in and conditioned on its own declaration.
89
+
90
+ ## Validation
91
+
92
+ The template MUST satisfy a content check at build time (see `tests/mcp-template.test.ts`):
93
+
94
+ - Contains the string `Beads MCP server`.
95
+ - Contains all four operation names: `tasks/list`, `tasks/get`, `dependencies/list`, `status/get`.
96
+ - Contains NO `bd-` issue IDs.
97
+ - Contains NO status keywords used as data assertions.
98
+
99
+ This guarantees the snippet stays pure-guidance and never leaks data.
@@ -0,0 +1,139 @@
1
+ # `augx link --mirror` Day-to-Day Guide
2
+
3
+ ## Purpose
4
+
5
+ `augx link <module> --mirror <tool>[,<tool>...]` materializes one Augx module's `rules/` content into each target tool's **per-module** rules location, transparently and idempotently. The canonical source under `augment-extensions/` is never modified.
6
+
7
+ ## Grammar
8
+
9
+ ```
10
+ augx link <module> [--mirror <tool>[,<tool>...]] [--verbose]
11
+ ```
12
+
13
+ The pre-existing `augx link` behavior (resolve module, update coordination manifest, no per-tool materialization) is preserved when `--mirror` is omitted **and** `.augment/coordination.json.export.mirror` is not `true`.
14
+
15
+ ## Flags
16
+
17
+ | Flag | Default | Purpose |
18
+ |---|---|---|
19
+ | `--mirror` | none, or `export.mirror` from coordination.json when `true` | Comma-separated tool list: `claude-code`, `cursor`, `windsurf`, `copilot`. |
20
+ | `--force` | `false` | Overwrite drifted single-file mirrors after backing them up under `.augment/mirror-backups/`. |
21
+ | `--verbose` | `false` | Print the materialization mode (`symlink` vs `copy`) for each file. |
22
+
23
+ ## Per-Tool Target Paths
24
+
25
+ | Tool | Per-Module Destination |
26
+ |---|---|
27
+ | `claude-code` | `.claude/rules/<module>/...` (mirrors source layout) + one-line include stub appended to `CLAUDE.md` |
28
+ | `cursor` | `.cursor/rules/augx-<module>.mdc` (one file per module, frontmatter generated) |
29
+ | `windsurf` | `.windsurf/rules/augx-<module>.md` (one file per module) |
30
+ | `copilot` | `.github/instructions/augx-<module>.instructions.md` (one file per module) |
31
+
32
+ For Cursor, Windsurf, and Copilot, the per-module file is a concatenation of the module's `rules/*.md` content with a banner identical to the `augx export` banner, scoped to a single module.
33
+
34
+ For Claude Code, the source directory layout is preserved file-for-file under `.claude/rules/<module>/`, and `CLAUDE.md` receives an include stub:
35
+
36
+ ```
37
+ <!-- augx-include: .claude/rules/<module>/ -->
38
+ ```
39
+
40
+ When a single-file mirror already exists, augx compares its banner and body to the freshly rendered content before writing. Unmarked files and drifted files are refused unless `--force` is supplied. Forced overwrites first move the previous target into `.augment/mirror-backups/` so the prior state stays recoverable.
41
+
42
+ ## Materialization Strategy
43
+
44
+ For each rule file in the resolved module:
45
+
46
+ 1. Compute the destination path under the tool's convention.
47
+ 2. If `.augment/coordination.json.mirrors[<module>]` already records `mode: 'copy'` for that destination, skip directly to step 4.
48
+ 3. Try `symlink(source, destination)`.
49
+ 4. If symlink raises `EPERM`, `EACCES`, or `ENOSYS`, or succeeds but a subsequent read fails (Windows reparse misconfiguration), fall back to `copyFile(source, destination)`.
50
+ 5. Record `{ moduleId, tool, sourcePath, targetPath, mode: 'symlink' | 'copy' }` in `.augment/coordination.json.mirrors[<moduleId>]`.
51
+
52
+ See `windows-fallback.md` for the detailed Windows behavior.
53
+
54
+ ## Idempotency
55
+
56
+ On every invocation, the mirror hook computes the desired set of `(tool, targetPath)` tuples for the current module, compares against the tracked set in `mirrors[<module>]`, and reconciles:
57
+
58
+ | State | Action |
59
+ |---|---|
60
+ | Desired AND tracked AND same source | Leave alone. |
61
+ | Desired AND tracked AND different source | Update (re-symlink or re-copy). |
62
+ | Desired AND NOT tracked | Create. |
63
+ | NOT desired AND tracked | Prune (delete target, remove tracked entry). |
64
+
65
+ This guarantees that renaming, adding, or removing a module's rule files leaves the target tool's per-module rules clean and current with no stale artifacts.
66
+
67
+ ## Typical Workflows
68
+
69
+ ### Mirror a single module to one tool
70
+
71
+ ```bash
72
+ augx link coding-standards/typescript --mirror cursor
73
+ ```
74
+
75
+ Result:
76
+
77
+ ```
78
+ .cursor/rules/augx-typescript-standards.mdc
79
+ .augment/coordination.json.mirrors["coding-standards/typescript"] = [
80
+ { "tool": "cursor", "sourcePath": "...", "targetPath": ".cursor/rules/augx-typescript-standards.mdc", "mode": "symlink" }
81
+ ]
82
+ ```
83
+
84
+ ### Mirror to multiple tools at once
85
+
86
+ ```bash
87
+ augx link workflows/cross-platform --mirror claude-code,cursor,windsurf
88
+ ```
89
+
90
+ ### Default-mirror setup
91
+
92
+ Add to `.augment/coordination.json`:
93
+
94
+ ```json
95
+ {
96
+ "export": {
97
+ "targets": ["claude-code", "cursor"],
98
+ "mirror": true
99
+ }
100
+ }
101
+ ```
102
+
103
+ After this, `augx link <module>` (without `--mirror`) automatically mirrors into both `claude-code` and `cursor`. Use this when the project's policy is "always mirror everywhere by default".
104
+
105
+ ## Unlink Cleanup
106
+
107
+ ```bash
108
+ augx unlink <module>
109
+ ```
110
+
111
+ Reads `mirrors[<module>]` and, for each tracked entry:
112
+
113
+ 1. **Tracked symlink, still pointing to recorded source**: delete it.
114
+ 2. **Tracked copy, content matches recorded source hash**: delete it.
115
+ 3. **Hand-edited target** (content hash differs from recorded one): leave in place, emit a warning. User edits are never silently destroyed.
116
+
117
+ After processing, `mirrors[<module>]` is removed from the coordination manifest. For Claude Code, the include stub line is removed from `CLAUDE.md`.
118
+
119
+ If `mirrors` becomes empty after the unlink, the key itself is deleted from the manifest to keep the file clean.
120
+
121
+ ## Exit Codes
122
+
123
+ | Code | Meaning |
124
+ |---|---|
125
+ | 0 | Success (link + mirror complete) |
126
+ | 1 | Usage error (unknown tool name) |
127
+ | 2 | Module not found or unreadable |
128
+ | 4 | I/O error (permission denied, conflicting non-tracked file at destination) |
129
+
130
+ ## Safety Rules
131
+
132
+ - Never writes outside the project root.
133
+ - Never follows symlinks out of `augment-extensions/` while resolving sources.
134
+ - Refuses to overwrite a destination that exists and is neither a previously-tracked symlink nor a previously-tracked copy (exit 4); the conflicting path is reported.
135
+ - All stub content uses LF line endings and forward-slash paths.
136
+
137
+ ## Relationship to `augx export`
138
+
139
+ `augx export` produces one aggregated file per tool. `augx link --mirror` produces one file per module per tool. They write to disjoint paths (e.g., `.cursor/rules/augx.mdc` vs `.cursor/rules/augx-<module>.mdc`) and are safe to use together.