@groundnuty/macf 0.2.0-rc.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 (124) hide show
  1. package/dist/.build-info.json +4 -0
  2. package/dist/cli/build-info.d.ts +38 -0
  3. package/dist/cli/build-info.d.ts.map +1 -0
  4. package/dist/cli/build-info.js +119 -0
  5. package/dist/cli/build-info.js.map +1 -0
  6. package/dist/cli/claude-sh.d.ts +42 -0
  7. package/dist/cli/claude-sh.d.ts.map +1 -0
  8. package/dist/cli/claude-sh.js +247 -0
  9. package/dist/cli/claude-sh.js.map +1 -0
  10. package/dist/cli/commands/cd.d.ts +6 -0
  11. package/dist/cli/commands/cd.d.ts.map +1 -0
  12. package/dist/cli/commands/cd.js +17 -0
  13. package/dist/cli/commands/cd.js.map +1 -0
  14. package/dist/cli/commands/certs.d.ts +33 -0
  15. package/dist/cli/commands/certs.d.ts.map +1 -0
  16. package/dist/cli/commands/certs.js +233 -0
  17. package/dist/cli/commands/certs.js.map +1 -0
  18. package/dist/cli/commands/doctor.d.ts +91 -0
  19. package/dist/cli/commands/doctor.d.ts.map +1 -0
  20. package/dist/cli/commands/doctor.js +235 -0
  21. package/dist/cli/commands/doctor.js.map +1 -0
  22. package/dist/cli/commands/init.d.ts +37 -0
  23. package/dist/cli/commands/init.d.ts.map +1 -0
  24. package/dist/cli/commands/init.js +279 -0
  25. package/dist/cli/commands/init.js.map +1 -0
  26. package/dist/cli/commands/list.d.ts +5 -0
  27. package/dist/cli/commands/list.d.ts.map +1 -0
  28. package/dist/cli/commands/list.js +21 -0
  29. package/dist/cli/commands/list.js.map +1 -0
  30. package/dist/cli/commands/migrate-ca-key.d.ts +36 -0
  31. package/dist/cli/commands/migrate-ca-key.d.ts.map +1 -0
  32. package/dist/cli/commands/migrate-ca-key.js +92 -0
  33. package/dist/cli/commands/migrate-ca-key.js.map +1 -0
  34. package/dist/cli/commands/peers.d.ts +8 -0
  35. package/dist/cli/commands/peers.d.ts.map +1 -0
  36. package/dist/cli/commands/peers.js +45 -0
  37. package/dist/cli/commands/peers.js.map +1 -0
  38. package/dist/cli/commands/repo-init.d.ts +43 -0
  39. package/dist/cli/commands/repo-init.d.ts.map +1 -0
  40. package/dist/cli/commands/repo-init.js +304 -0
  41. package/dist/cli/commands/repo-init.js.map +1 -0
  42. package/dist/cli/commands/rules-refresh.d.ts +14 -0
  43. package/dist/cli/commands/rules-refresh.d.ts.map +1 -0
  44. package/dist/cli/commands/rules-refresh.js +67 -0
  45. package/dist/cli/commands/rules-refresh.js.map +1 -0
  46. package/dist/cli/commands/self-update.d.ts +14 -0
  47. package/dist/cli/commands/self-update.d.ts.map +1 -0
  48. package/dist/cli/commands/self-update.js +112 -0
  49. package/dist/cli/commands/self-update.js.map +1 -0
  50. package/dist/cli/commands/status.d.ts +9 -0
  51. package/dist/cli/commands/status.d.ts.map +1 -0
  52. package/dist/cli/commands/status.js +90 -0
  53. package/dist/cli/commands/status.js.map +1 -0
  54. package/dist/cli/commands/update.d.ts +25 -0
  55. package/dist/cli/commands/update.d.ts.map +1 -0
  56. package/dist/cli/commands/update.js +316 -0
  57. package/dist/cli/commands/update.js.map +1 -0
  58. package/dist/cli/config.d.ts +103 -0
  59. package/dist/cli/config.d.ts.map +1 -0
  60. package/dist/cli/config.js +224 -0
  61. package/dist/cli/config.js.map +1 -0
  62. package/dist/cli/index.d.ts +3 -0
  63. package/dist/cli/index.d.ts.map +1 -0
  64. package/dist/cli/index.js +245 -0
  65. package/dist/cli/index.js.map +1 -0
  66. package/dist/cli/plugin-fetcher.d.ts +20 -0
  67. package/dist/cli/plugin-fetcher.d.ts.map +1 -0
  68. package/dist/cli/plugin-fetcher.js +83 -0
  69. package/dist/cli/plugin-fetcher.js.map +1 -0
  70. package/dist/cli/prompt.d.ts +17 -0
  71. package/dist/cli/prompt.d.ts.map +1 -0
  72. package/dist/cli/prompt.js +109 -0
  73. package/dist/cli/prompt.js.map +1 -0
  74. package/dist/cli/registry-helper.d.ts +11 -0
  75. package/dist/cli/registry-helper.d.ts.map +1 -0
  76. package/dist/cli/registry-helper.js +18 -0
  77. package/dist/cli/registry-helper.js.map +1 -0
  78. package/dist/cli/rules.d.ts +39 -0
  79. package/dist/cli/rules.d.ts.map +1 -0
  80. package/dist/cli/rules.js +112 -0
  81. package/dist/cli/rules.js.map +1 -0
  82. package/dist/cli/settings-writer.d.ts +97 -0
  83. package/dist/cli/settings-writer.d.ts.map +1 -0
  84. package/dist/cli/settings-writer.js +270 -0
  85. package/dist/cli/settings-writer.js.map +1 -0
  86. package/dist/cli/version-resolver.d.ts +73 -0
  87. package/dist/cli/version-resolver.d.ts.map +1 -0
  88. package/dist/cli/version-resolver.js +238 -0
  89. package/dist/cli/version-resolver.js.map +1 -0
  90. package/dist/index.d.ts +19 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +22 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/plugin/bin/macf-plugin-cli.d.ts +13 -0
  95. package/dist/plugin/bin/macf-plugin-cli.d.ts.map +1 -0
  96. package/dist/plugin/bin/macf-plugin-cli.js +127 -0
  97. package/dist/plugin/bin/macf-plugin-cli.js.map +1 -0
  98. package/dist/plugin/lib/format.d.ts +40 -0
  99. package/dist/plugin/lib/format.d.ts.map +1 -0
  100. package/dist/plugin/lib/format.js +137 -0
  101. package/dist/plugin/lib/format.js.map +1 -0
  102. package/dist/plugin/lib/health.d.ts +2 -0
  103. package/dist/plugin/lib/health.d.ts.map +1 -0
  104. package/dist/plugin/lib/health.js +6 -0
  105. package/dist/plugin/lib/health.js.map +1 -0
  106. package/dist/plugin/lib/index.d.ts +7 -0
  107. package/dist/plugin/lib/index.d.ts.map +1 -0
  108. package/dist/plugin/lib/index.js +5 -0
  109. package/dist/plugin/lib/index.js.map +1 -0
  110. package/dist/plugin/lib/registry.d.ts +18 -0
  111. package/dist/plugin/lib/registry.d.ts.map +1 -0
  112. package/dist/plugin/lib/registry.js +17 -0
  113. package/dist/plugin/lib/registry.js.map +1 -0
  114. package/dist/plugin/lib/work.d.ts +13 -0
  115. package/dist/plugin/lib/work.d.ts.map +1 -0
  116. package/dist/plugin/lib/work.js +27 -0
  117. package/dist/plugin/lib/work.js.map +1 -0
  118. package/package.json +43 -0
  119. package/plugin/rules/coordination.md +224 -0
  120. package/scripts/check-gh-token.sh +102 -0
  121. package/scripts/macf-gh-token.sh +130 -0
  122. package/scripts/macf-whoami.sh +51 -0
  123. package/scripts/tmux-send-to-claude.sh +51 -0
  124. package/scripts/write-build-info.mjs +48 -0
@@ -0,0 +1,224 @@
1
+ import { z } from 'zod';
2
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
3
+ import { join, dirname, resolve } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+ import { RegistryConfigSchema } from '@groundnuty/macf-core';
6
+ // --- Paths ---
7
+ export const MACF_GLOBAL_DIR = join(homedir(), '.macf');
8
+ export const AGENTS_INDEX_PATH = join(MACF_GLOBAL_DIR, 'agents.json');
9
+ export const GLOBAL_CONFIG_PATH = join(MACF_GLOBAL_DIR, 'config.json');
10
+ /**
11
+ * Validate that a project name is safe for use as a filesystem directory.
12
+ * Allows alphanumeric, hyphen, underscore. Rejects slashes, dots, etc.
13
+ */
14
+ export function isValidProjectName(name) {
15
+ return /^[a-zA-Z0-9_-]+$/.test(name) && name.length > 0;
16
+ }
17
+ function assertValidProject(project) {
18
+ if (!isValidProjectName(project)) {
19
+ throw new Error(`Invalid project name "${project}": must match [a-zA-Z0-9_-]+`);
20
+ }
21
+ }
22
+ /**
23
+ * Per-project CA directory. One subdirectory per project prevents
24
+ * collisions when multiple MACF projects share a machine.
25
+ */
26
+ export function caDir(project) {
27
+ assertValidProject(project);
28
+ return join(MACF_GLOBAL_DIR, 'certs', project);
29
+ }
30
+ export function caCertPath(project) {
31
+ return join(caDir(project), 'ca-cert.pem');
32
+ }
33
+ export function caKeyPath(project) {
34
+ return join(caDir(project), 'ca-key.pem');
35
+ }
36
+ /**
37
+ * Extract TokenSource-compatible credentials from a loaded config.
38
+ * Resolves the relative key_path against the project directory so it's
39
+ * absolute when passed to `gh token generate`.
40
+ */
41
+ export function tokenSourceFromConfig(projectDir, config) {
42
+ return {
43
+ appId: config.github_app.app_id,
44
+ installId: config.github_app.install_id,
45
+ keyPath: resolve(projectDir, config.github_app.key_path),
46
+ };
47
+ }
48
+ /**
49
+ * Walk up from startDir looking for .macf/macf-agent.json.
50
+ * Returns the project root (the dir CONTAINING .macf/), or null if not found.
51
+ *
52
+ * Same pattern as git's discovery of .git/. Stops at the filesystem root.
53
+ */
54
+ export function findProjectRoot(startDir) {
55
+ let dir = resolve(startDir);
56
+ // Loop bounded by filesystem depth — terminates when dirname(dir) === dir (root).
57
+ for (;;) {
58
+ if (existsSync(join(dir, '.macf', 'macf-agent.json'))) {
59
+ return dir;
60
+ }
61
+ const parent = dirname(dir);
62
+ if (parent === dir)
63
+ return null;
64
+ dir = parent;
65
+ }
66
+ }
67
+ export function projectMacfDir(projectDir) {
68
+ return join(projectDir, '.macf');
69
+ }
70
+ export function agentConfigPath(projectDir) {
71
+ return join(projectMacfDir(projectDir), 'macf-agent.json');
72
+ }
73
+ export function agentStatePath(projectDir) {
74
+ return join(projectMacfDir(projectDir), 'macf-agent.state.json');
75
+ }
76
+ export function agentCertPath(projectDir) {
77
+ return join(projectMacfDir(projectDir), 'certs', 'agent-cert.pem');
78
+ }
79
+ export function agentKeyPath(projectDir) {
80
+ return join(projectMacfDir(projectDir), 'certs', 'agent-key.pem');
81
+ }
82
+ export function agentLogPath(projectDir) {
83
+ return join(projectMacfDir(projectDir), 'logs', 'channel.log');
84
+ }
85
+ // --- Agent config (macf-agent.json) ---
86
+ // Version pin schema — strings (not enums) so odd pins are allowed if user insists.
87
+ export const VersionPinsSchema = z.object({
88
+ cli: z.string(),
89
+ plugin: z.string(),
90
+ actions: z.string(),
91
+ });
92
+ export const MacfAgentConfigSchema = z.object({
93
+ project: z.string(),
94
+ agent_name: z.string(),
95
+ agent_role: z.string(),
96
+ agent_type: z.enum(['permanent', 'worker']),
97
+ // Registry union comes from registry/types.ts as the single source
98
+ // of truth — previously inlined here with looser constraints (no
99
+ // `.min(1)` on sub-fields). Import-based unifies the schema and
100
+ // adopts the stricter validation automatically. Ultrareview A9.
101
+ registry: RegistryConfigSchema,
102
+ github_app: z.object({
103
+ app_id: z.string(),
104
+ install_id: z.string(),
105
+ key_path: z.string(),
106
+ }),
107
+ // Host the agent advertises in its registry entry (written by the
108
+ // channel server on bind). When unset, claude.sh falls back to
109
+ // 127.0.0.1 — matches the plugin's existing default. Set this to a
110
+ // Tailscale IP / DNS name when the agent is routed-to by an off-box
111
+ // consumer (GHA runner, sibling agent on another machine). Flows to
112
+ // (a) MACF_ADVERTISE_HOST env in claude.sh, (b) SubjectAlternativeName
113
+ // on the agent's mTLS cert so hostname verification succeeds.
114
+ // See macf#178.
115
+ advertise_host: z.string().min(1).optional(),
116
+ // Tmux session + (optional) window for the on-notify wake path
117
+ // (macf#185). When set, the channel server's onNotify handler
118
+ // shells out to `tmux-send-to-claude.sh <session>:<window> <prompt>`
119
+ // after the MCP push, injecting the notification as the TUI's
120
+ // next input turn so a running Claude actually processes the
121
+ // new work. When unset, the wake path auto-detects from `$TMUX`
122
+ // if the server was launched inside a tmux pane; otherwise
123
+ // no-ops silently.
124
+ tmux_session: z.string().min(1).optional(),
125
+ tmux_window: z.string().min(1).optional(),
126
+ // Optional for backward compat: legacy configs (pre-P6) lack this field.
127
+ // `macf init --force` rewrites with resolved versions; `macf update` (PR #5) bumps.
128
+ versions: VersionPinsSchema.optional(),
129
+ });
130
+ // --- Agents index (agents.json) ---
131
+ export const AgentsIndexSchema = z.object({
132
+ agents: z.array(z.string()),
133
+ });
134
+ // --- Global config ---
135
+ export const GlobalConfigSchema = z.object({
136
+ default_org: z.string().optional(),
137
+ tailscale_hostname: z.string().optional(),
138
+ });
139
+ // --- Read/Write helpers ---
140
+ function ensureDir(filePath) {
141
+ const dir = dirname(filePath);
142
+ if (!existsSync(dir))
143
+ mkdirSync(dir, { recursive: true });
144
+ }
145
+ export function readAgentConfig(projectDir) {
146
+ const path = agentConfigPath(projectDir);
147
+ if (!existsSync(path))
148
+ return null;
149
+ const raw = JSON.parse(readFileSync(path, 'utf-8'));
150
+ const result = MacfAgentConfigSchema.safeParse(raw);
151
+ if (!result.success) {
152
+ // Previously returned null silently on schema mismatch. That's a
153
+ // silent upgrade cliff: a newer CLI expecting a new required
154
+ // field against an old workspace config yielded no diagnostic —
155
+ // operators saw "workspace skipped" with no explanation. Emit
156
+ // the Zod error to stderr so the schema drift is visible.
157
+ // Ultrareview finding (upgrade cliff).
158
+ const formatted = result.error.issues
159
+ .map(i => ` - ${i.path.join('.')}: ${i.message}`)
160
+ .join('\n');
161
+ process.stderr.write(`Warning: ${path} does not match current schema (run \`macf init --force\` to regenerate):\n${formatted}\n`);
162
+ return null;
163
+ }
164
+ if (!result.data.versions) {
165
+ process.stderr.write(`Warning: ${path} has no "versions" section (legacy config). Run \`macf init --force\` to resolve pins.\n`);
166
+ }
167
+ return result.data;
168
+ }
169
+ export function writeAgentConfig(projectDir, config) {
170
+ const path = agentConfigPath(projectDir);
171
+ ensureDir(path);
172
+ writeFileSync(path, JSON.stringify(config, null, 2) + '\n');
173
+ }
174
+ export function readAgentsIndex() {
175
+ if (!existsSync(AGENTS_INDEX_PATH))
176
+ return { agents: [] };
177
+ try {
178
+ const raw = JSON.parse(readFileSync(AGENTS_INDEX_PATH, 'utf-8'));
179
+ const result = AgentsIndexSchema.safeParse(raw);
180
+ return result.success ? result.data : { agents: [] };
181
+ }
182
+ catch {
183
+ return { agents: [] };
184
+ }
185
+ }
186
+ export function writeAgentsIndex(index) {
187
+ ensureDir(AGENTS_INDEX_PATH);
188
+ writeFileSync(AGENTS_INDEX_PATH, JSON.stringify(index, null, 2) + '\n');
189
+ }
190
+ export function addToAgentsIndex(projectDir) {
191
+ const absPath = resolve(projectDir);
192
+ const index = readAgentsIndex();
193
+ if (!index.agents.includes(absPath)) {
194
+ writeAgentsIndex({ agents: [...index.agents, absPath] });
195
+ }
196
+ }
197
+ export function readGlobalConfig() {
198
+ if (!existsSync(GLOBAL_CONFIG_PATH))
199
+ return {};
200
+ try {
201
+ const raw = JSON.parse(readFileSync(GLOBAL_CONFIG_PATH, 'utf-8'));
202
+ const result = GlobalConfigSchema.safeParse(raw);
203
+ return result.success ? result.data : {};
204
+ }
205
+ catch {
206
+ return {};
207
+ }
208
+ }
209
+ /**
210
+ * Load all agent configs from the global index.
211
+ * Skips entries with missing or invalid configs.
212
+ */
213
+ export function loadAllAgents() {
214
+ const index = readAgentsIndex();
215
+ const results = [];
216
+ for (const agentPath of index.agents) {
217
+ const config = readAgentConfig(agentPath);
218
+ if (config) {
219
+ results.push({ path: agentPath, config });
220
+ }
221
+ }
222
+ return results;
223
+ }
224
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,gBAAgB;AAEhB,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU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3 @@
1
+ #!/usr/bin/env node
2
+ import 'reflect-metadata';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,245 @@
1
+ #!/usr/bin/env node
2
+ import 'reflect-metadata';
3
+ import { existsSync } from 'node:fs';
4
+ import { join, resolve } from 'node:path';
5
+ import { Command } from 'commander';
6
+ import { listAgents } from './commands/list.js';
7
+ import { cdAgent } from './commands/cd.js';
8
+ import { initAgent } from './commands/init.js';
9
+ import { update } from './commands/update.js';
10
+ import { showStatus } from './commands/status.js';
11
+ import { listPeers } from './commands/peers.js';
12
+ import { certsInit, certsRecover, certsRotate, issueRoutingClient } from './commands/certs.js';
13
+ import { repoInit } from './commands/repo-init.js';
14
+ import { rulesRefresh } from './commands/rules-refresh.js';
15
+ import { runDoctor } from './commands/doctor.js';
16
+ import { selfUpdate } from './commands/self-update.js';
17
+ import { findProjectRoot } from './config.js';
18
+ import { findCliPackageRoot } from './rules.js';
19
+ /**
20
+ * Resolve the project directory for project-scoped commands.
21
+ * Walks up from cwd looking for .macf/macf-agent.json. Exits with a clear
22
+ * error if not found. Commands that bootstrap new projects (init, repo-init)
23
+ * use `--dir` or cwd directly instead of this.
24
+ */
25
+ function requireProjectRoot() {
26
+ const dir = findProjectRoot(process.cwd());
27
+ if (!dir) {
28
+ console.error('Not in a MACF project (no .macf/macf-agent.json found walking up from cwd).\n' +
29
+ 'Either cd into a project or run `macf init` first.');
30
+ process.exit(1);
31
+ }
32
+ return dir;
33
+ }
34
+ /**
35
+ * Validate an explicit --dir value: resolve and confirm it contains
36
+ * .macf/macf-agent.json. No walk-up — the user gave an exact path.
37
+ */
38
+ function validateProjectDir(path) {
39
+ const abs = resolve(path);
40
+ if (!existsSync(join(abs, '.macf', 'macf-agent.json'))) {
41
+ console.error(`Not a MACF project: ${abs} has no .macf/macf-agent.json`);
42
+ process.exit(1);
43
+ }
44
+ return abs;
45
+ }
46
+ /**
47
+ * Resolve the project directory from either --dir (explicit) or auto-discovery.
48
+ * Explicit --dir wins. Both paths exit with a clear error if no project is found.
49
+ */
50
+ function resolveProjectDir(optsDir) {
51
+ return optsDir ? validateProjectDir(optsDir) : requireProjectRoot();
52
+ }
53
+ const program = new Command();
54
+ program
55
+ .name('macf')
56
+ .description('Multi-Agent Coordination Framework CLI')
57
+ .version('0.2.0-rc.0')
58
+ .action(() => {
59
+ listAgents();
60
+ });
61
+ program
62
+ .command('init')
63
+ .description('Set up a project directory for an agent')
64
+ .requiredOption('--project <name>', 'Project name (e.g., macf)')
65
+ .requiredOption('--role <role>', 'Agent role (e.g., code-agent)')
66
+ .option('--name <name>', 'Agent name (defaults to role)')
67
+ .option('--type <type>', 'Agent type: permanent or worker', 'permanent')
68
+ .requiredOption('--app-id <id>', 'GitHub App ID')
69
+ .requiredOption('--install-id <id>', 'GitHub App Installation ID')
70
+ .requiredOption('--key-path <path>', 'Path to GitHub App private key')
71
+ .option('--registry-type <type>', 'Registry: org, profile, or repo', 'repo')
72
+ .option('--registry-org <org>', 'Org name (for org registry)')
73
+ .option('--registry-user <user>', 'User name (for profile registry)')
74
+ .option('--registry-repo <repo>', 'owner/repo (for repo registry)')
75
+ .option('--advertise-host <host>', 'Host the channel server advertises in its registry entry + includes in its cert SAN (e.g., Tailscale IP). Defaults to 127.0.0.1 when unset.')
76
+ .option('--tmux-session <name>', 'Tmux session name for on-notify wake (macf#185). When set, channel server\'s /notify handler injects the prompt into this tmux session via tmux-send-to-claude.sh after the MCP push. If unset, auto-detects from $TMUX.')
77
+ .option('--tmux-window <idx-or-name>', 'Tmux window index or name within the session (e.g., "0", "cv-architect"). Optional — defaults to the session\'s current window.')
78
+ .option('--cli-version <semver>', 'Pin @macf/cli version (e.g., 0.1.0)')
79
+ .option('--plugin-version <semver>', 'Pin macf-agent plugin version (e.g., 0.1.0)')
80
+ .option('--actions-version <tag>', 'Pin macf-actions version (e.g., v1, v1.0.0)')
81
+ .option('--dir <path>', 'Project directory (defaults to current working directory)')
82
+ .action(async (opts) => {
83
+ const projectDir = opts.dir ? resolve(opts.dir) : process.cwd();
84
+ await initAgent(projectDir, {
85
+ project: opts.project,
86
+ role: opts.role,
87
+ name: opts.name,
88
+ type: opts.type,
89
+ appId: opts.appId,
90
+ installId: opts.installId,
91
+ keyPath: opts.keyPath,
92
+ registryType: opts.registryType,
93
+ registryOrg: opts.registryOrg,
94
+ registryUser: opts.registryUser,
95
+ registryRepo: opts.registryRepo,
96
+ advertiseHost: opts.advertiseHost,
97
+ tmuxSession: opts.tmuxSession,
98
+ tmuxWindow: opts.tmuxWindow,
99
+ cliVersion: opts.cliVersion,
100
+ pluginVersion: opts.pluginVersion,
101
+ actionsVersion: opts.actionsVersion,
102
+ });
103
+ });
104
+ program
105
+ .command('update')
106
+ .description('Bump pinned versions in macf-agent.json (cli, plugin, actions)')
107
+ .option('--all', 'Bump all components non-interactively', false)
108
+ .option('--cli', 'Bump only the CLI pin', false)
109
+ .option('--plugin', 'Bump only the plugin pin', false)
110
+ .option('--actions', 'Bump only the actions pin', false)
111
+ .option('--yes', 'Skip confirmation prompts', false)
112
+ .option('--dry-run', 'Show the diff but do not write the config', false)
113
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
114
+ .action(async (opts) => {
115
+ const code = await update(resolveProjectDir(opts.dir), {
116
+ all: opts.all,
117
+ cli: opts.cli,
118
+ plugin: opts.plugin,
119
+ actions: opts.actions,
120
+ yes: opts.yes,
121
+ dryRun: opts.dryRun,
122
+ });
123
+ process.exitCode = code;
124
+ });
125
+ program
126
+ .command('status')
127
+ .description('Ping all agents and show status')
128
+ .option('--dir <path>', 'Scope to a specific project (defaults to all agents in global index)')
129
+ .action(async (opts) => {
130
+ const dir = opts.dir ? validateProjectDir(opts.dir) : undefined;
131
+ await showStatus(dir);
132
+ });
133
+ program
134
+ .command('peers')
135
+ .description('List peers from the registry')
136
+ .option('--dir <path>', 'Scope to a specific project (defaults to all agents in global index)')
137
+ .action(async (opts) => {
138
+ const dir = opts.dir ? validateProjectDir(opts.dir) : undefined;
139
+ await listPeers(dir);
140
+ });
141
+ const certs = program
142
+ .command('certs')
143
+ .description('Certificate management');
144
+ certs
145
+ .command('init')
146
+ .description('Create CA certificate and upload to registry')
147
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
148
+ .action(async (opts) => {
149
+ await certsInit(resolveProjectDir(opts.dir));
150
+ });
151
+ certs
152
+ .command('recover')
153
+ .description('Recover CA key from encrypted backup in registry')
154
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
155
+ .action(async (opts) => {
156
+ await certsRecover(resolveProjectDir(opts.dir));
157
+ });
158
+ certs
159
+ .command('rotate')
160
+ .description('Regenerate agent certificate with existing CA')
161
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
162
+ .action(async (opts) => {
163
+ await certsRotate(resolveProjectDir(opts.dir));
164
+ });
165
+ certs
166
+ .command('issue-routing-client')
167
+ .description('Mint a CA-signed client cert (CN=routing-action) for the routing Action (macf-actions#8)')
168
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
169
+ .option('--out-dir <path>', 'Write cert/key files here instead of printing to stdout')
170
+ .option('--validity-days <n>', 'Cert validity in days (default 365; warns above 730)')
171
+ .action(async (opts) => {
172
+ const validityDays = opts.validityDays ? Number(opts.validityDays) : undefined;
173
+ await issueRoutingClient(resolveProjectDir(opts.dir), {
174
+ outDir: opts.outDir,
175
+ validityDays,
176
+ });
177
+ });
178
+ program
179
+ .command('self-update')
180
+ .description('Pull origin/main + rebuild the installed CLI\'s dist/ (for npm-link dev installs). ' +
181
+ 'Note: this command only helps CLI versions >= 0.1.1 (#144); pre-#144 installs were silent.')
182
+ .action(() => {
183
+ try {
184
+ selfUpdate(findCliPackageRoot());
185
+ }
186
+ catch (err) {
187
+ console.error(`self-update failed: ${err instanceof Error ? err.message : String(err)}`);
188
+ process.exitCode = 1;
189
+ }
190
+ });
191
+ program
192
+ .command('doctor')
193
+ .description('Verify the workspace\'s bot token satisfies the MACF App permission doctrine (DR-019)')
194
+ .option('--dir <path>', 'Project directory (defaults to auto-discovery from cwd)')
195
+ .action(async (opts) => {
196
+ const code = await runDoctor(resolveProjectDir(opts.dir));
197
+ process.exitCode = code;
198
+ });
199
+ const rules = program
200
+ .command('rules')
201
+ .description('Canonical coordination rules distribution');
202
+ rules
203
+ .command('refresh')
204
+ .description('Copy canonical rules + helper scripts into a workspace\'s .claude/ (does NOT require macf init)')
205
+ .option('--dir <path>', 'Target workspace directory (defaults to current working directory)')
206
+ .action((opts) => {
207
+ const target = opts.dir ? resolve(opts.dir) : process.cwd();
208
+ try {
209
+ rulesRefresh(target);
210
+ }
211
+ catch (err) {
212
+ console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
213
+ process.exitCode = 1;
214
+ }
215
+ });
216
+ program
217
+ .command('cd <agent-name>')
218
+ .description('Print agent project path (for shell: cd $(macf cd code-agent))')
219
+ .action((agentName) => {
220
+ cdAgent(agentName);
221
+ });
222
+ program
223
+ .command('repo-init')
224
+ .description('Bootstrap a repo for MACF routing (generates workflow + config, creates labels)')
225
+ .option('--repo <owner/repo>', 'Target GitHub repo (defaults to current dir\'s origin remote)')
226
+ .option('--actions-version <version>', 'macf-actions tag to pin to', 'v1')
227
+ .option('--agents <list>', 'Comma-separated agent names to scaffold (e.g., code-agent,science-agent)')
228
+ .option('--session-name <name>', 'Shared tmux session name; when set with multiple --agents, each agent gets a window inside this session')
229
+ .option('--force', 'Overwrite existing files', false)
230
+ .option('--dir <path>', 'Target directory (defaults to current working directory)')
231
+ .action(async (opts) => {
232
+ const projectDir = opts.dir ? resolve(opts.dir) : process.cwd();
233
+ await repoInit(projectDir, {
234
+ repo: opts.repo,
235
+ actionsVersion: opts.actionsVersion,
236
+ agents: opts.agents,
237
+ sessionName: opts.sessionName,
238
+ force: opts.force,
239
+ });
240
+ });
241
+ program.parseAsync(process.argv).catch((err) => {
242
+ console.error(`Error: ${err.message}`);
243
+ process.exitCode = 1;
244
+ });
245
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;GAKG;AACH,SAAS,kBAAkB;IACzB,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG,EAAE,CAAC;Q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ing). */
3
+ readonly marketplaceUrl?: string;
4
+ /** Override the subdir inside the marketplace repo (for testing). */
5
+ readonly pluginSubdir?: string;
6
+ }
7
+ /**
8
+ * Path to the target plugin directory inside a workspace.
9
+ */
10
+ export declare function workspacePluginDir(workspaceDir: string): string;
11
+ /**
12
+ * Clone macf-marketplace at `v<version>`, extract the plugin subdir to
13
+ * `<workspace>/.macf/plugin/`. Idempotent: an existing plugin dir is
14
+ * removed before the new one is written, so re-running gives a clean
15
+ * replacement (no stale files from a previous version hanging around).
16
+ *
17
+ * Throws if the git clone fails (network down, tag missing, etc.).
18
+ */
19
+ export declare function fetchPluginToWorkspace(workspaceDir: string, version: string, options?: FetchPluginOptions): void;
20
+ //# sourceMappingURL=plugin-fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-fetcher.d.ts","sourceRoot":"","sources":["../../src/cli/plugin-fetcher.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,IAAI,CAoDN"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Fetch the macf-agent plugin from groundnuty/macf-marketplace at a pinned
3
+ * version and place it at <workspace>/.macf/plugin/.
4
+ *
5
+ * Per DR-013, each workspace gets its own copy of the plugin at a specific
6
+ * version; claude.sh invokes `claude --plugin-dir <workspace>/.macf/plugin`
7
+ * so each agent runs an independent, pinnable plugin. No user-scope install,
8
+ * no cross-project contamination.
9
+ *
10
+ * Mechanism: shallow git clone at the tag, copy the `macf-agent/` subdir
11
+ * into place, remove the clone. Uses `execFileSync` (no shell — safe against
12
+ * injection since args are list form) and `cpSync({recursive: true})` for
13
+ * the copy.
14
+ *
15
+ * Network failures during fetch surface as a thrown Error; callers decide
16
+ * whether to abort setup or warn-and-continue.
17
+ */
18
+ import { execFileSync } from 'node:child_process';
19
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
20
+ import { tmpdir } from 'node:os';
21
+ import { join, resolve } from 'node:path';
22
+ const DEFAULT_MARKETPLACE_URL = 'https://github.com/groundnuty/macf-marketplace';
23
+ const DEFAULT_PLUGIN_SUBDIR = 'macf-agent';
24
+ /**
25
+ * Path to the target plugin directory inside a workspace.
26
+ */
27
+ export function workspacePluginDir(workspaceDir) {
28
+ return join(resolve(workspaceDir), '.macf', 'plugin');
29
+ }
30
+ /**
31
+ * Clone macf-marketplace at `v<version>`, extract the plugin subdir to
32
+ * `<workspace>/.macf/plugin/`. Idempotent: an existing plugin dir is
33
+ * removed before the new one is written, so re-running gives a clean
34
+ * replacement (no stale files from a previous version hanging around).
35
+ *
36
+ * Throws if the git clone fails (network down, tag missing, etc.).
37
+ */
38
+ export function fetchPluginToWorkspace(workspaceDir, version, options = {}) {
39
+ const marketplaceUrl = options.marketplaceUrl ?? DEFAULT_MARKETPLACE_URL;
40
+ const pluginSubdir = options.pluginSubdir ?? DEFAULT_PLUGIN_SUBDIR;
41
+ const target = workspacePluginDir(workspaceDir);
42
+ // git tag for plugin versions is `v<semver>` (e.g. v0.1.0).
43
+ const tag = `v${version}`;
44
+ // Use a temp dir for the shallow clone so we can discard everything
45
+ // except the plugin subdir.
46
+ const tmpClone = mkdtempSync(join(tmpdir(), 'macf-plugin-clone-'));
47
+ try {
48
+ execFileSync('git', [
49
+ 'clone',
50
+ '--depth', '1',
51
+ '--branch', tag,
52
+ marketplaceUrl,
53
+ tmpClone,
54
+ ], {
55
+ stdio: ['ignore', 'ignore', 'pipe'],
56
+ });
57
+ const pluginSrc = join(tmpClone, pluginSubdir);
58
+ if (!existsSync(pluginSrc)) {
59
+ throw new Error(`Plugin subdir "${pluginSubdir}" not found in ${marketplaceUrl} at ${tag}. ` +
60
+ `Repo layout may have changed.`);
61
+ }
62
+ // Clean up any existing plugin dir so stale files from a previous
63
+ // version don't linger. Parent .macf/ is created by `macf init`
64
+ // already; we just manage the plugin/ child.
65
+ if (existsSync(target)) {
66
+ rmSync(target, { recursive: true, force: true });
67
+ }
68
+ mkdirSync(target, { recursive: true });
69
+ // Recursive copy. cpSync preserves timestamps and file modes.
70
+ cpSync(pluginSrc, target, { recursive: true });
71
+ }
72
+ catch (err) {
73
+ if (err instanceof Error && err.message.includes('Plugin subdir'))
74
+ throw err;
75
+ const msg = err instanceof Error ? err.message : String(err);
76
+ throw new Error(`Failed to fetch plugin from ${marketplaceUrl} at ${tag}: ${msg}. ` +
77
+ `Check network access and that the tag exists.`, { cause: err });
78
+ }
79
+ finally {
80
+ rmSync(tmpClone, { recursive: true, force: true });
81
+ }
82
+ }
83
+ //# sourceMappingURL=plugin-fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-fetcher.js","sourceRoot":"","sources":["../../src/cli/plugin-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,uBAAuB,GAAG,gDAAgD,CAAC;AACjF,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAS3C;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY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E,CAAC,CAAC;QAEvC,8DAA8D;QAC9D,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,MAAM,GAAG,CAAC;QAC7E,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,+BAA+B,cAAc,OAAO,GAAG,KAAK,GAAG,IAAI;YACnE,+CAA+C,EAC/C,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare class PromptCancelled extends Error {
2
+ constructor();
3
+ }
4
+ interface PromptOptions {
5
+ readonly message: string;
6
+ readonly input?: NodeJS.ReadStream;
7
+ readonly output?: NodeJS.WriteStream;
8
+ }
9
+ /**
10
+ * Prompt the user for a password, echoing '*' per character.
11
+ *
12
+ * Rejects with PromptCancelled on Ctrl+C. Restores TTY state on success,
13
+ * cancel, and error paths.
14
+ */
15
+ export declare function promptPassword(options: PromptOptions): Promise<string>;
16
+ export {};
17
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAaA,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAUD,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqFtE"}