arcbridge 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Achim Kuehn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # arcbridge
2
+
3
+ CLI for ArcBridge — architectural awareness for AI coding agents.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g arcbridge
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ### `arcbridge init`
14
+
15
+ Initialize ArcBridge in a project directory. Auto-detects project type from `package.json`.
16
+
17
+ ```bash
18
+ arcbridge init
19
+ arcbridge init --template react-vite --name my-app
20
+ arcbridge init --platform claude --platform copilot
21
+ arcbridge init --spec docs/requirements.md
22
+ ```
23
+
24
+ ### `arcbridge sync`
25
+
26
+ Run the full sync loop: refresh docs, reindex TypeScript symbols, detect drift, infer task statuses, verify quality scenarios, and update the git sync point.
27
+
28
+ ```bash
29
+ arcbridge sync
30
+ arcbridge sync --json # JSON output for CI
31
+ arcbridge sync --dir /path/to/project
32
+ ```
33
+
34
+ ### `arcbridge status`
35
+
36
+ Show project status: current phase, task progress, quality scenarios, building blocks, and drift.
37
+
38
+ ```bash
39
+ arcbridge status
40
+ arcbridge status --json
41
+ ```
42
+
43
+ ### `arcbridge drift`
44
+
45
+ Check for architecture drift between docs and code.
46
+
47
+ ```bash
48
+ arcbridge drift
49
+ arcbridge drift --json
50
+ ```
51
+
52
+ ### `arcbridge refresh`
53
+
54
+ Rebuild the SQLite database from YAML/markdown source files. Preserves task, phase, and scenario statuses.
55
+
56
+ ```bash
57
+ arcbridge refresh
58
+ arcbridge refresh --json
59
+ ```
60
+
61
+ ### `arcbridge update-task`
62
+
63
+ Update a task's status.
64
+
65
+ ```bash
66
+ arcbridge update-task task-1.1-setup done
67
+ arcbridge update-task task-1.2-auth in-progress
68
+ arcbridge update-task task-1.3-api blocked --json
69
+ ```
70
+
71
+ Valid statuses: `todo`, `in-progress`, `done`, `blocked`
72
+
73
+ ### `arcbridge generate-configs`
74
+
75
+ Regenerate platform agent configs (CLAUDE.md, Copilot instructions) from `.arcbridge/agents/`.
76
+
77
+ ```bash
78
+ arcbridge generate-configs
79
+ arcbridge generate-configs --json
80
+ ```
81
+
82
+ ## Global Options
83
+
84
+ | Option | Description |
85
+ |--------|-------------|
86
+ | `--dir <path>` | Project directory (default: current directory) |
87
+ | `--json` | JSON output for CI pipelines |
88
+ | `--help` | Show help |
89
+ | `--version` | Show version |
90
+
91
+ ## CI Integration
92
+
93
+ The `--json` flag on every command makes ArcBridge CI-friendly. A GitHub Action workflow is generated during `arcbridge init`:
94
+
95
+ ```yaml
96
+ # .github/workflows/arcbridge-sync.yml
97
+ - run: npx arcbridge sync --json
98
+ ```
99
+
100
+ ## License
101
+
102
+ [MIT](../../LICENSE)
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,822 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { resolve as resolve3 } from "path";
5
+ import { readFileSync as readFileSync2 } from "fs";
6
+ import { fileURLToPath } from "url";
7
+ import { dirname, join as join3 } from "path";
8
+
9
+ // src/commands/sync.ts
10
+ import {
11
+ indexProject,
12
+ detectDrift,
13
+ writeDriftLog,
14
+ inferTaskStatuses,
15
+ applyInferences,
16
+ getChangedFiles,
17
+ resolveRef,
18
+ getHeadSha,
19
+ setSyncCommit,
20
+ verifyScenarios,
21
+ loadConfig,
22
+ refreshFromDocs
23
+ } from "@arcbridge/core";
24
+
25
+ // src/project.ts
26
+ import { existsSync } from "fs";
27
+ import { join } from "path";
28
+ import { openDatabase, migrate } from "@arcbridge/core";
29
+ function openProjectDb(projectDir) {
30
+ const dbPath = join(projectDir, ".arcbridge", "index.db");
31
+ if (!existsSync(dbPath)) {
32
+ throw new Error(
33
+ `No ArcBridge project found at ${projectDir}. Run \`arcbridge_init_project\` via MCP first.`
34
+ );
35
+ }
36
+ const db = openDatabase(dbPath);
37
+ migrate(db);
38
+ return db;
39
+ }
40
+
41
+ // src/commands/sync.ts
42
+ async function sync(dir, json) {
43
+ const db = openProjectDb(dir);
44
+ try {
45
+ if (!json) console.log("Refreshing from docs...");
46
+ const docWarnings = refreshFromDocs(db, dir);
47
+ if (!json && docWarnings.length > 0) {
48
+ for (const w of docWarnings) console.log(` ${w}`);
49
+ }
50
+ if (!json) console.log("Reindexing...");
51
+ const indexResult = await indexProject(db, { projectRoot: dir });
52
+ if (!json)
53
+ console.log(
54
+ ` Indexed ${indexResult.filesProcessed} files, ${indexResult.symbolsIndexed} symbols, ${indexResult.dependenciesIndexed} deps`
55
+ );
56
+ if (!json) console.log("Checking drift...");
57
+ const configForDrift = loadConfig(dir);
58
+ const driftOpts = {
59
+ projectType: configForDrift.config?.project_type,
60
+ ignorePaths: configForDrift.config?.drift?.ignore_paths
61
+ };
62
+ const driftEntries = detectDrift(db, driftOpts);
63
+ writeDriftLog(db, driftEntries);
64
+ if (!json) {
65
+ if (driftEntries.length === 0) {
66
+ console.log(" No drift detected.");
67
+ } else {
68
+ console.log(` Found ${driftEntries.length} drift issue(s)`);
69
+ for (const e of driftEntries) {
70
+ const icon = e.severity === "error" ? "[ERROR]" : e.severity === "warning" ? "[WARN] " : "[INFO] ";
71
+ console.log(` ${icon} ${e.kind}: ${e.description}`);
72
+ }
73
+ }
74
+ }
75
+ if (!json) console.log("Inferring task statuses...");
76
+ const currentPhase = db.prepare("SELECT id FROM phases WHERE status = 'in-progress' LIMIT 1").get();
77
+ let inferences = [];
78
+ if (currentPhase) {
79
+ inferences = inferTaskStatuses(db, currentPhase.id);
80
+ if (inferences.length > 0) {
81
+ applyInferences(db, inferences, dir);
82
+ if (!json) {
83
+ console.log(` Updated ${inferences.length} task(s):`);
84
+ for (const inf of inferences) {
85
+ console.log(
86
+ ` ${inf.taskId}: ${inf.previousStatus} -> ${inf.inferredStatus} (${inf.reason})`
87
+ );
88
+ }
89
+ }
90
+ } else {
91
+ if (!json) console.log(" No task status changes inferred.");
92
+ }
93
+ } else {
94
+ if (!json) console.log(" No active phase \u2014 skipping task inference.");
95
+ }
96
+ let scenarios = [];
97
+ const configResult = loadConfig(dir);
98
+ if (configResult.config) {
99
+ const testCommand = configResult.config.testing.test_command;
100
+ const timeoutMs = configResult.config.testing.timeout_ms;
101
+ if (!json) console.log("Verifying quality scenarios...");
102
+ const verifyResult = verifyScenarios(db, dir, { testCommand, timeoutMs });
103
+ scenarios = verifyResult.results;
104
+ if (!json) {
105
+ if (scenarios.length === 0) {
106
+ console.log(" No testable scenarios found.");
107
+ } else {
108
+ const passing = scenarios.filter((r) => r.passed).length;
109
+ console.log(
110
+ ` ${scenarios.length} scenario(s) verified: ${passing} passing, ${scenarios.length - passing} failing`
111
+ );
112
+ }
113
+ }
114
+ } else {
115
+ if (!json) console.log(" No config found \u2014 skipping scenario verification.");
116
+ }
117
+ const warnings = [];
118
+ let changedFiles = [];
119
+ try {
120
+ const ref = resolveRef(dir, "last-sync", db);
121
+ changedFiles = getChangedFiles(dir, ref.sha);
122
+ if (!json && changedFiles.length > 0) {
123
+ console.log(`Changed files since ${ref.label}: ${changedFiles.length}`);
124
+ }
125
+ } catch {
126
+ const msg = "Could not determine changed files (git not available or no sync point).";
127
+ warnings.push(msg);
128
+ if (!json) console.log(` ${msg}`);
129
+ }
130
+ let syncCommit = null;
131
+ try {
132
+ const head = getHeadSha(dir);
133
+ if (head) {
134
+ syncCommit = head;
135
+ setSyncCommit(db, "last_sync_commit", head);
136
+ if (!json) console.log(`Sync point updated to ${head.slice(0, 7)}.`);
137
+ }
138
+ } catch {
139
+ const msg = "Could not update sync point (git not available).";
140
+ warnings.push(msg);
141
+ if (!json) console.log(` ${msg}`);
142
+ }
143
+ const result = {
144
+ reindex: {
145
+ files: indexResult.filesProcessed,
146
+ symbols: indexResult.symbolsIndexed,
147
+ dependencies: indexResult.dependenciesIndexed
148
+ },
149
+ drift: driftEntries,
150
+ inferences,
151
+ scenarios,
152
+ changedFiles,
153
+ syncCommit,
154
+ warnings
155
+ };
156
+ if (json) {
157
+ console.log(JSON.stringify(result, null, 2));
158
+ } else {
159
+ console.log("\nSync complete.");
160
+ const errors = driftEntries.filter((e) => e.severity === "error").length;
161
+ if (errors > 0) {
162
+ console.log(`WARNING: ${errors} drift error(s) would block phase completion.`);
163
+ process.exitCode = 1;
164
+ }
165
+ }
166
+ } finally {
167
+ db.close();
168
+ }
169
+ }
170
+
171
+ // src/commands/status.ts
172
+ async function status(dir, json) {
173
+ const db = openProjectDb(dir);
174
+ try {
175
+ const projectName = db.prepare(
176
+ "SELECT value FROM arcbridge_meta WHERE key = 'project_name'"
177
+ ).get()?.value ?? "Unknown";
178
+ const currentPhase = db.prepare(
179
+ "SELECT id, name, status FROM phases WHERE status = 'in-progress' LIMIT 1"
180
+ ).get();
181
+ const allTasks = db.prepare("SELECT status FROM tasks").all();
182
+ const tasks = {
183
+ total: allTasks.length,
184
+ done: allTasks.filter((t) => t.status === "done").length,
185
+ in_progress: allTasks.filter((t) => t.status === "in-progress").length,
186
+ blocked: allTasks.filter((t) => t.status === "blocked").length
187
+ };
188
+ const blockCount = db.prepare("SELECT COUNT(*) as c FROM building_blocks").get().c;
189
+ const symbolCount = db.prepare("SELECT COUNT(*) as c FROM symbols").get().c;
190
+ const currentTasks = currentPhase ? db.prepare(
191
+ "SELECT id, title, status FROM tasks WHERE phase_id = ? ORDER BY id"
192
+ ).all(currentPhase.id) : [];
193
+ const scenarioStatuses = db.prepare("SELECT status FROM quality_scenarios").all();
194
+ const quality = {
195
+ total: scenarioStatuses.length,
196
+ passing: scenarioStatuses.filter((s) => s.status === "passing").length,
197
+ failing: scenarioStatuses.filter((s) => s.status === "failing").length,
198
+ untested: scenarioStatuses.filter((s) => s.status === "untested").length
199
+ };
200
+ const driftEntries = db.prepare(
201
+ "SELECT severity FROM drift_log WHERE resolved_at IS NULL"
202
+ ).all();
203
+ const driftInfo = {
204
+ total: driftEntries.length,
205
+ errors: driftEntries.filter((d) => d.severity === "error").length,
206
+ warnings: driftEntries.filter((d) => d.severity === "warning").length
207
+ };
208
+ const result = {
209
+ project_name: projectName,
210
+ current_phase: currentPhase ?? null,
211
+ tasks,
212
+ current_tasks: currentTasks,
213
+ quality,
214
+ building_blocks: blockCount,
215
+ symbols: symbolCount,
216
+ drift: driftInfo
217
+ };
218
+ if (json) {
219
+ console.log(JSON.stringify(result, null, 2));
220
+ } else {
221
+ console.log(`Project: ${result.project_name}`);
222
+ console.log(
223
+ `Phase: ${result.current_phase ? `${result.current_phase.name} (${result.current_phase.status})` : "none active"}`
224
+ );
225
+ console.log(
226
+ `Tasks: ${result.tasks.done}/${result.tasks.total} done, ${result.tasks.in_progress} in-progress, ${result.tasks.blocked} blocked`
227
+ );
228
+ if (result.current_tasks.length > 0) {
229
+ console.log("");
230
+ console.log(`Current phase tasks:`);
231
+ for (const task of result.current_tasks) {
232
+ const icon = task.status === "done" ? "[x]" : task.status === "in-progress" ? "[~]" : task.status === "blocked" ? "[!]" : "[ ]";
233
+ console.log(` ${icon} ${task.title}`);
234
+ }
235
+ }
236
+ if (result.quality.total > 0) {
237
+ console.log("");
238
+ console.log(
239
+ `Quality: ${result.quality.passing} passing, ${result.quality.failing} failing, ${result.quality.untested} untested (${result.quality.total} total)`
240
+ );
241
+ }
242
+ console.log("");
243
+ console.log(`Blocks: ${result.building_blocks}`);
244
+ console.log(`Symbols: ${result.symbols}`);
245
+ if (result.drift.total > 0) {
246
+ console.log(
247
+ `Drift: ${result.drift.total} issues (${result.drift.errors} errors, ${result.drift.warnings} warnings)`
248
+ );
249
+ } else {
250
+ console.log(`Drift: none`);
251
+ }
252
+ }
253
+ } finally {
254
+ db.close();
255
+ }
256
+ }
257
+
258
+ // src/commands/drift.ts
259
+ import { detectDrift as detectDrift2, writeDriftLog as writeDriftLog2, loadConfig as loadConfig2 } from "@arcbridge/core";
260
+ async function drift(dir, json) {
261
+ const db = openProjectDb(dir);
262
+ try {
263
+ const configResult = loadConfig2(dir);
264
+ const driftOpts = {
265
+ projectType: configResult.config?.project_type,
266
+ ignorePaths: configResult.config?.drift?.ignore_paths
267
+ };
268
+ const entries = detectDrift2(db, driftOpts);
269
+ writeDriftLog2(db, entries);
270
+ if (json) {
271
+ console.log(JSON.stringify({ drift: entries }, null, 2));
272
+ } else {
273
+ if (entries.length === 0) {
274
+ console.log("No drift detected.");
275
+ } else {
276
+ console.log(`Found ${entries.length} drift issue(s):
277
+ `);
278
+ for (const e of entries) {
279
+ const icon = e.severity === "error" ? "[ERROR]" : e.severity === "warning" ? "[WARN] " : "[INFO] ";
280
+ console.log(` ${icon} ${e.kind}: ${e.description}`);
281
+ if (e.affectedBlock) {
282
+ console.log(` Block: ${e.affectedBlock}`);
283
+ }
284
+ if (e.affectedFile) {
285
+ console.log(` File: ${e.affectedFile}`);
286
+ }
287
+ }
288
+ const errors = entries.filter((e) => e.severity === "error").length;
289
+ if (errors > 0) {
290
+ console.log(`
291
+ ${errors} error(s) found \u2014 these block phase completion.`);
292
+ process.exitCode = 1;
293
+ }
294
+ }
295
+ }
296
+ } finally {
297
+ db.close();
298
+ }
299
+ }
300
+
301
+ // src/commands/init.ts
302
+ import { resolve, basename, join as join2 } from "path";
303
+ import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
304
+ import {
305
+ generateConfig,
306
+ generateArc42,
307
+ generatePlan,
308
+ generateAgentRoles,
309
+ generateDatabase,
310
+ generateSyncFiles,
311
+ indexProject as indexProject2,
312
+ discoverDotnetServices
313
+ } from "@arcbridge/core";
314
+ import { getAdapter } from "@arcbridge/adapters";
315
+ var VALID_TEMPLATES = [
316
+ "nextjs-app-router",
317
+ "react-vite",
318
+ "api-service",
319
+ "dotnet-webapi"
320
+ ];
321
+ function findCsproj(projectRoot) {
322
+ try {
323
+ const entries = readdirSync(projectRoot);
324
+ return entries.find((e) => e.endsWith(".csproj")) ?? null;
325
+ } catch {
326
+ return null;
327
+ }
328
+ }
329
+ function detectProjectInfo(projectRoot) {
330
+ const fallbackName = basename(projectRoot);
331
+ let name = fallbackName;
332
+ let nameSource = "directory name";
333
+ let template = "nextjs-app-router";
334
+ let templateSource = "default";
335
+ const entries = readdirSync(projectRoot);
336
+ const slnFile = entries.find((e) => e.endsWith(".sln"));
337
+ if (slnFile) {
338
+ name = slnFile.replace(".sln", "");
339
+ nameSource = ".sln file";
340
+ template = "dotnet-webapi";
341
+ templateSource = `detected (${slnFile} found)`;
342
+ const dotnetServices = discoverDotnetServices(projectRoot);
343
+ return { name, template, nameSource, templateSource, dotnetServices };
344
+ }
345
+ const csproj = findCsproj(projectRoot);
346
+ if (csproj) {
347
+ name = csproj.replace(".csproj", "");
348
+ nameSource = ".csproj file";
349
+ template = "dotnet-webapi";
350
+ templateSource = `detected (${csproj} found)`;
351
+ return { name, template, nameSource, templateSource };
352
+ }
353
+ const pkgPath = join2(projectRoot, "package.json");
354
+ if (existsSync2(pkgPath)) {
355
+ try {
356
+ const pkg2 = JSON.parse(readFileSync(pkgPath, "utf-8"));
357
+ if (pkg2.name) {
358
+ name = pkg2.name;
359
+ nameSource = "package.json";
360
+ }
361
+ const allDeps = {
362
+ ...pkg2.dependencies,
363
+ ...pkg2.devDependencies
364
+ };
365
+ if (allDeps["next"]) {
366
+ template = "nextjs-app-router";
367
+ templateSource = "detected (next in dependencies)";
368
+ } else if (allDeps["vite"] && allDeps["react"]) {
369
+ template = "react-vite";
370
+ templateSource = "detected (vite + react in dependencies)";
371
+ } else if (allDeps["express"] || allDeps["fastify"] || allDeps["hono"] || allDeps["@hono/node-server"]) {
372
+ template = "api-service";
373
+ templateSource = "detected (server framework in dependencies)";
374
+ }
375
+ } catch {
376
+ }
377
+ }
378
+ return { name, template, nameSource, templateSource };
379
+ }
380
+ async function init(dir, options, json) {
381
+ const projectRoot = resolve(dir);
382
+ if (existsSync2(join2(projectRoot, ".arcbridge", "config.yaml"))) {
383
+ const msg = "ArcBridge is already initialized in this directory. Use `arcbridge status` to see current state.";
384
+ if (json) {
385
+ console.log(JSON.stringify({ error: msg }));
386
+ } else {
387
+ console.error(msg);
388
+ }
389
+ process.exitCode = 1;
390
+ return;
391
+ }
392
+ const detected = detectProjectInfo(projectRoot);
393
+ const projectName = options.name ?? detected.name;
394
+ const templateStr = options.template ?? detected.template;
395
+ const platforms = options.platforms ?? ["claude"];
396
+ if (!VALID_TEMPLATES.includes(templateStr)) {
397
+ const msg = `Unknown template "${templateStr}". Valid values: ${VALID_TEMPLATES.join(", ")}`;
398
+ if (json) {
399
+ console.log(JSON.stringify({ error: msg }));
400
+ } else {
401
+ console.error(`Error: ${msg}`);
402
+ }
403
+ process.exitCode = 1;
404
+ return;
405
+ }
406
+ const template = templateStr;
407
+ if (!json) {
408
+ console.log(`Initializing ArcBridge in ${projectRoot}
409
+ `);
410
+ console.log(` Project: ${projectName} (${detected.nameSource})`);
411
+ console.log(` Template: ${template} (${detected.templateSource})`);
412
+ console.log(` Platform: ${platforms.join(", ")}`);
413
+ if (options.spec) {
414
+ console.log(` Spec: ${options.spec}`);
415
+ }
416
+ if (detected.dotnetServices && detected.dotnetServices.length > 1) {
417
+ const nonTest = detected.dotnetServices.filter((s) => !s.isTestProject);
418
+ const test = detected.dotnetServices.filter((s) => s.isTestProject);
419
+ console.log(` Services: ${nonTest.length} project(s) detected from solution`);
420
+ for (const svc of nonTest) {
421
+ console.log(` - ${svc.name} (${svc.path})`);
422
+ }
423
+ if (test.length > 0) {
424
+ console.log(` Tests: ${test.length} test project(s) (excluded from indexing)`);
425
+ }
426
+ }
427
+ console.log();
428
+ }
429
+ const nonTestServices = detected.dotnetServices?.filter((s) => !s.isTestProject);
430
+ const input = {
431
+ name: projectName,
432
+ template,
433
+ features: [],
434
+ quality_priorities: ["security", "performance", "accessibility"],
435
+ platforms,
436
+ dotnetServices: nonTestServices?.map((s) => ({ name: s.name, path: s.path }))
437
+ };
438
+ if (!json) console.log("Creating .arcbridge/config.yaml...");
439
+ const config = generateConfig(projectRoot, input);
440
+ if (!json) console.log("Creating arc42 documentation...");
441
+ generateArc42(projectRoot, input);
442
+ if (!json) console.log("Creating phase plan...");
443
+ generatePlan(projectRoot, input);
444
+ if (!json) console.log("Creating agent roles...");
445
+ const roles = generateAgentRoles(projectRoot, template);
446
+ if (!json) console.log("Initializing database...");
447
+ const { db, warnings } = generateDatabase(projectRoot, input);
448
+ if (!json) console.log("Creating sync triggers...");
449
+ const syncFiles = generateSyncFiles(projectRoot, config);
450
+ if (!json) console.log("Generating platform configs...");
451
+ const platformWarnings = [];
452
+ for (const platform of platforms) {
453
+ try {
454
+ const adapter = getAdapter(platform);
455
+ adapter.generateProjectConfig(projectRoot, config);
456
+ adapter.generateAgentConfigs(projectRoot, roles);
457
+ } catch (err) {
458
+ const msg = err instanceof Error ? err.message : String(err);
459
+ platformWarnings.push(`Platform '${platform}': ${msg}`);
460
+ }
461
+ }
462
+ if (options.spec) {
463
+ const specPath = resolve(options.spec);
464
+ if (existsSync2(specPath)) {
465
+ const specContent = readFileSync(specPath, "utf-8");
466
+ const { writeFileSync } = await import("fs");
467
+ writeFileSync(join2(projectRoot, ".arcbridge", "spec.md"), specContent, "utf-8");
468
+ if (!json) console.log("Copied spec file to .arcbridge/spec.md");
469
+ } else {
470
+ platformWarnings.push(`Spec file not found: ${specPath}`);
471
+ }
472
+ }
473
+ let indexResult = null;
474
+ try {
475
+ if (!json) console.log("Indexing codebase...");
476
+ const result = await indexProject2(db, { projectRoot });
477
+ indexResult = {
478
+ filesProcessed: result.filesProcessed,
479
+ symbolsIndexed: result.symbolsIndexed,
480
+ dependenciesIndexed: result.dependenciesIndexed,
481
+ componentsAnalyzed: result.componentsAnalyzed,
482
+ routesAnalyzed: result.routesAnalyzed
483
+ };
484
+ } catch {
485
+ }
486
+ const blockCount = db.prepare("SELECT COUNT(*) as count FROM building_blocks").get();
487
+ const scenarioCount = db.prepare("SELECT COUNT(*) as count FROM quality_scenarios").get();
488
+ const phaseCount = db.prepare("SELECT COUNT(*) as count FROM phases").get();
489
+ const taskCount = db.prepare("SELECT COUNT(*) as count FROM tasks").get();
490
+ db.close();
491
+ const allWarnings = [...warnings, ...platformWarnings];
492
+ if (json) {
493
+ console.log(
494
+ JSON.stringify(
495
+ {
496
+ name: projectName,
497
+ template,
498
+ platforms,
499
+ blocks: blockCount.count,
500
+ scenarios: scenarioCount.count,
501
+ phases: phaseCount.count,
502
+ tasks: taskCount.count,
503
+ roles: roles.length,
504
+ index: indexResult,
505
+ syncFiles,
506
+ warnings: allWarnings
507
+ },
508
+ null,
509
+ 2
510
+ )
511
+ );
512
+ } else {
513
+ console.log("\nArcBridge initialized successfully!\n");
514
+ console.log(` Building blocks: ${blockCount.count}`);
515
+ console.log(` Quality scenarios: ${scenarioCount.count}`);
516
+ console.log(` Phases: ${phaseCount.count}`);
517
+ console.log(` Tasks: ${taskCount.count}`);
518
+ console.log(` Agent roles: ${roles.length}`);
519
+ if (indexResult) {
520
+ console.log(
521
+ ` Indexed: ${indexResult.filesProcessed} files, ${indexResult.symbolsIndexed} symbols`
522
+ );
523
+ } else {
524
+ console.log(
525
+ input.template === "dotnet-webapi" ? " Indexed: skipped (ensure .NET SDK is installed and dotnet-indexer is built)" : " Indexed: skipped (no tsconfig.json)"
526
+ );
527
+ }
528
+ if (allWarnings.length > 0) {
529
+ console.log("\nWarnings:");
530
+ for (const w of allWarnings) {
531
+ console.log(` - ${w}`);
532
+ }
533
+ }
534
+ console.log("\nNext steps:");
535
+ console.log(" 1. Review .arcbridge/config.yaml and adjust as needed");
536
+ console.log(" 2. Start your AI agent (e.g. Claude Code) in this directory");
537
+ console.log(" 3. The agent will see the architecture context and can help");
538
+ console.log(" refine building blocks, quality scenarios, and the plan");
539
+ console.log(" 4. Run `arcbridge sync` periodically to keep docs in sync with code");
540
+ }
541
+ }
542
+
543
+ // src/commands/generate-configs.ts
544
+ import { resolve as resolve2 } from "path";
545
+ import { loadConfig as loadConfig3, loadRoles, generateAgentRoles as generateAgentRoles2 } from "@arcbridge/core";
546
+ import { getAdapter as getAdapter2 } from "@arcbridge/adapters";
547
+ async function generateConfigs(dir, json) {
548
+ const projectRoot = resolve2(dir);
549
+ const errors = [];
550
+ const { config, error: configError } = loadConfig3(projectRoot);
551
+ if (configError || !config) {
552
+ const msg = configError ?? "No .arcbridge/config.yaml found";
553
+ if (json) {
554
+ console.log(JSON.stringify({ error: msg }));
555
+ } else {
556
+ console.error(`Error: ${msg}`);
557
+ }
558
+ process.exitCode = 1;
559
+ return;
560
+ }
561
+ const loaded = loadRoles(projectRoot);
562
+ let roles = loaded.roles;
563
+ const roleErrors = loaded.errors;
564
+ let rolesSource = "custom";
565
+ if (roleErrors.length > 0) {
566
+ errors.push(...roleErrors);
567
+ }
568
+ if (roles.length === 0) {
569
+ if (!json) console.log("No custom roles found, generating built-in roles...");
570
+ roles = generateAgentRoles2(projectRoot);
571
+ rolesSource = "built-in";
572
+ }
573
+ const platforms = config.platforms ?? ["claude", "copilot"];
574
+ const generatedPlatforms = [];
575
+ for (const platform of platforms) {
576
+ try {
577
+ const adapter = getAdapter2(platform);
578
+ adapter.generateProjectConfig(projectRoot, config);
579
+ if (roles.length > 0) {
580
+ adapter.generateAgentConfigs(projectRoot, roles);
581
+ }
582
+ generatedPlatforms.push(platform);
583
+ } catch (err) {
584
+ errors.push(
585
+ `${platform}: ${err instanceof Error ? err.message : String(err)}`
586
+ );
587
+ }
588
+ }
589
+ const result = {
590
+ platforms: generatedPlatforms,
591
+ roles: roles.map((r) => r.role_id),
592
+ rolesSource,
593
+ errors
594
+ };
595
+ if (json) {
596
+ console.log(JSON.stringify(result, null, 2));
597
+ } else {
598
+ if (generatedPlatforms.length > 0) {
599
+ console.log(
600
+ `Generated configs for: ${generatedPlatforms.join(", ")}`
601
+ );
602
+ }
603
+ if (roles.length > 0) {
604
+ const source = rolesSource === "built-in" ? " (built-in)" : "";
605
+ console.log(
606
+ `Roles${source}: ${roles.map((r) => r.role_id).join(", ")}`
607
+ );
608
+ }
609
+ for (const err of errors) {
610
+ console.error(`Warning: ${err}`);
611
+ }
612
+ }
613
+ }
614
+
615
+ // src/commands/update-task.ts
616
+ import { syncTaskToYaml } from "@arcbridge/core";
617
+ var VALID_STATUSES = ["todo", "in-progress", "done", "blocked"];
618
+ async function updateTask(dir, taskId, newStatus, json) {
619
+ if (!VALID_STATUSES.includes(newStatus)) {
620
+ const msg = `Invalid status "${newStatus}". Valid values: ${VALID_STATUSES.join(", ")}`;
621
+ if (json) {
622
+ console.log(JSON.stringify({ error: msg }));
623
+ } else {
624
+ console.error(`Error: ${msg}`);
625
+ }
626
+ process.exitCode = 1;
627
+ return;
628
+ }
629
+ const db = openProjectDb(dir);
630
+ try {
631
+ const task = db.prepare("SELECT id, title, status, phase_id FROM tasks WHERE id = ?").get(taskId);
632
+ if (!task) {
633
+ const msg = `Task "${taskId}" not found`;
634
+ if (json) {
635
+ console.log(JSON.stringify({ error: msg }));
636
+ } else {
637
+ console.error(`Error: ${msg}`);
638
+ }
639
+ process.exitCode = 1;
640
+ return;
641
+ }
642
+ const previousStatus = task.status;
643
+ const now = (/* @__PURE__ */ new Date()).toISOString();
644
+ if (newStatus === "done") {
645
+ db.prepare("UPDATE tasks SET status = ?, completed_at = ? WHERE id = ?").run(newStatus, now, taskId);
646
+ } else {
647
+ db.prepare("UPDATE tasks SET status = ? WHERE id = ?").run(newStatus, taskId);
648
+ }
649
+ syncTaskToYaml(dir, task.phase_id, taskId, newStatus, newStatus === "done" ? now : null);
650
+ if (json) {
651
+ console.log(
652
+ JSON.stringify({
653
+ taskId: task.id,
654
+ title: task.title,
655
+ previousStatus,
656
+ newStatus
657
+ })
658
+ );
659
+ } else {
660
+ console.log(`${task.id}: ${previousStatus} \u2192 ${newStatus} (${task.title})`);
661
+ }
662
+ } finally {
663
+ db.close();
664
+ }
665
+ }
666
+
667
+ // src/commands/refresh.ts
668
+ import { refreshFromDocs as refreshFromDocs2 } from "@arcbridge/core";
669
+ async function refresh(dir, json) {
670
+ const db = openProjectDb(dir);
671
+ try {
672
+ const warnings = refreshFromDocs2(db, dir);
673
+ if (json) {
674
+ console.log(JSON.stringify({ refreshed: true, warnings }));
675
+ } else {
676
+ console.log("Database refreshed from YAML/markdown sources.");
677
+ if (warnings.length > 0) {
678
+ console.log(`
679
+ ${warnings.length} warning(s):`);
680
+ for (const w of warnings) {
681
+ console.log(` - ${w}`);
682
+ }
683
+ }
684
+ }
685
+ } finally {
686
+ db.close();
687
+ }
688
+ }
689
+
690
+ // src/index.ts
691
+ var __dirname = dirname(fileURLToPath(import.meta.url));
692
+ var pkg = JSON.parse(
693
+ readFileSync2(join3(__dirname, "..", "package.json"), "utf-8")
694
+ );
695
+ var USAGE = `Usage: arcbridge <command> [options]
696
+
697
+ Commands:
698
+ init Initialize ArcBridge in a project directory
699
+ sync Run the sync loop: reindex, detect drift, infer tasks, propose updates
700
+ status Show project status (phase, tasks, drift)
701
+ drift Check for architecture drift
702
+ refresh Rebuild the database from YAML/markdown sources
703
+ update-task Update a task's status (e.g. arcbridge update-task task-1.1 done)
704
+ generate-configs Regenerate platform agent configs from .arcbridge/agents/
705
+
706
+ Options:
707
+ --dir <path> Project directory (default: current directory)
708
+ --json Output as JSON (for CI integration)
709
+ --help Show this help message
710
+ --version Show version
711
+
712
+ Init options:
713
+ --name <name> Project name (default: auto-detect from package.json)
714
+ --template <type> Project template: nextjs-app-router, react-vite, api-service
715
+ --platform <name> Target platform (can be repeated, default: claude)
716
+ --spec <file> Path to a requirements/spec file to include
717
+ `;
718
+ function parseArgs(args) {
719
+ let command = null;
720
+ const positional = [];
721
+ let dir = process.cwd();
722
+ let json = false;
723
+ let name;
724
+ let template;
725
+ const platforms = [];
726
+ let spec;
727
+ for (let i = 0; i < args.length; i++) {
728
+ const arg = args[i];
729
+ if (arg === "--dir" && i + 1 < args.length) {
730
+ dir = resolve3(args[++i]);
731
+ } else if (arg === "--json") {
732
+ json = true;
733
+ } else if (arg === "--name" && i + 1 < args.length) {
734
+ name = args[++i];
735
+ } else if (arg === "--template" && i + 1 < args.length) {
736
+ template = args[++i];
737
+ } else if (arg === "--platform" && i + 1 < args.length) {
738
+ platforms.push(args[++i]);
739
+ } else if (arg === "--spec" && i + 1 < args.length) {
740
+ spec = args[++i];
741
+ } else if (arg === "--help" || arg === "-h") {
742
+ console.log(USAGE);
743
+ process.exit(0);
744
+ } else if (arg === "--version" || arg === "-v") {
745
+ console.log(`arcbridge ${pkg.version}`);
746
+ process.exit(0);
747
+ } else if (!arg.startsWith("-") && !command) {
748
+ command = arg;
749
+ } else if (!arg.startsWith("-") && command) {
750
+ positional.push(arg);
751
+ }
752
+ }
753
+ return {
754
+ command,
755
+ positional,
756
+ dir,
757
+ json,
758
+ name,
759
+ template,
760
+ platforms: platforms.length > 0 ? platforms : void 0,
761
+ spec
762
+ };
763
+ }
764
+ async function main() {
765
+ const parsed = parseArgs(process.argv.slice(2));
766
+ const { command, positional, dir, json } = parsed;
767
+ if (!command) {
768
+ console.log(USAGE);
769
+ process.exit(1);
770
+ }
771
+ try {
772
+ switch (command) {
773
+ case "init":
774
+ await init(dir, {
775
+ name: parsed.name,
776
+ template: parsed.template,
777
+ platforms: parsed.platforms,
778
+ spec: parsed.spec
779
+ }, json);
780
+ break;
781
+ case "sync":
782
+ await sync(dir, json);
783
+ break;
784
+ case "status":
785
+ await status(dir, json);
786
+ break;
787
+ case "drift":
788
+ await drift(dir, json);
789
+ break;
790
+ case "refresh":
791
+ await refresh(dir, json);
792
+ break;
793
+ case "update-task": {
794
+ const [taskId, taskStatus] = positional;
795
+ if (!taskId || !taskStatus) {
796
+ console.error("Usage: arcbridge update-task <task-id> <status>");
797
+ console.error("Status values: todo, in-progress, done, blocked");
798
+ process.exit(1);
799
+ }
800
+ await updateTask(dir, taskId, taskStatus, json);
801
+ break;
802
+ }
803
+ case "generate-configs":
804
+ await generateConfigs(dir, json);
805
+ break;
806
+ default:
807
+ console.error(`Unknown command: ${command}`);
808
+ console.log(USAGE);
809
+ process.exit(1);
810
+ }
811
+ } catch (err) {
812
+ const message = err instanceof Error ? err.message : String(err);
813
+ if (json) {
814
+ console.log(JSON.stringify({ error: message }));
815
+ } else {
816
+ console.error(`Error: ${message}`);
817
+ }
818
+ process.exit(1);
819
+ }
820
+ }
821
+ main();
822
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/sync.ts","../src/project.ts","../src/commands/status.ts","../src/commands/drift.ts","../src/commands/init.ts","../src/commands/generate-configs.ts","../src/commands/update-task.ts","../src/commands/refresh.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, join } from \"node:path\";\nimport { sync } from \"./commands/sync.js\";\nimport { status } from \"./commands/status.js\";\nimport { drift } from \"./commands/drift.js\";\nimport { init } from \"./commands/init.js\";\nimport { generateConfigs } from \"./commands/generate-configs.js\";\nimport { updateTask } from \"./commands/update-task.js\";\nimport { refresh } from \"./commands/refresh.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(\n readFileSync(join(__dirname, \"..\", \"package.json\"), \"utf-8\"),\n) as { version: string };\n\nconst USAGE = `Usage: arcbridge <command> [options]\n\nCommands:\n init Initialize ArcBridge in a project directory\n sync Run the sync loop: reindex, detect drift, infer tasks, propose updates\n status Show project status (phase, tasks, drift)\n drift Check for architecture drift\n refresh Rebuild the database from YAML/markdown sources\n update-task Update a task's status (e.g. arcbridge update-task task-1.1 done)\n generate-configs Regenerate platform agent configs from .arcbridge/agents/\n\nOptions:\n --dir <path> Project directory (default: current directory)\n --json Output as JSON (for CI integration)\n --help Show this help message\n --version Show version\n\nInit options:\n --name <name> Project name (default: auto-detect from package.json)\n --template <type> Project template: nextjs-app-router, react-vite, api-service\n --platform <name> Target platform (can be repeated, default: claude)\n --spec <file> Path to a requirements/spec file to include\n`;\n\ninterface ParsedArgs {\n command: string | null;\n positional: string[];\n dir: string;\n json: boolean;\n name?: string;\n template?: string;\n platforms?: string[];\n spec?: string;\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n let command: string | null = null;\n const positional: string[] = [];\n let dir = process.cwd();\n let json = false;\n let name: string | undefined;\n let template: string | undefined;\n const platforms: string[] = [];\n let spec: string | undefined;\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]!;\n if (arg === \"--dir\" && i + 1 < args.length) {\n dir = resolve(args[++i]!);\n } else if (arg === \"--json\") {\n json = true;\n } else if (arg === \"--name\" && i + 1 < args.length) {\n name = args[++i]!;\n } else if (arg === \"--template\" && i + 1 < args.length) {\n template = args[++i]!;\n } else if (arg === \"--platform\" && i + 1 < args.length) {\n platforms.push(args[++i]!);\n } else if (arg === \"--spec\" && i + 1 < args.length) {\n spec = args[++i]!;\n } else if (arg === \"--help\" || arg === \"-h\") {\n console.log(USAGE);\n process.exit(0);\n } else if (arg === \"--version\" || arg === \"-v\") {\n console.log(`arcbridge ${pkg.version}`);\n process.exit(0);\n } else if (!arg.startsWith(\"-\") && !command) {\n command = arg;\n } else if (!arg.startsWith(\"-\") && command) {\n positional.push(arg);\n }\n }\n\n return {\n command,\n positional,\n dir,\n json,\n name,\n template,\n platforms: platforms.length > 0 ? platforms : undefined,\n spec,\n };\n}\n\nasync function main(): Promise<void> {\n const parsed = parseArgs(process.argv.slice(2));\n const { command, positional, dir, json } = parsed;\n\n if (!command) {\n console.log(USAGE);\n process.exit(1);\n }\n\n try {\n switch (command) {\n case \"init\":\n await init(dir, {\n name: parsed.name,\n template: parsed.template,\n platforms: parsed.platforms,\n spec: parsed.spec,\n }, json);\n break;\n case \"sync\":\n await sync(dir, json);\n break;\n case \"status\":\n await status(dir, json);\n break;\n case \"drift\":\n await drift(dir, json);\n break;\n case \"refresh\":\n await refresh(dir, json);\n break;\n case \"update-task\": {\n const [taskId, taskStatus] = positional;\n if (!taskId || !taskStatus) {\n console.error(\"Usage: arcbridge update-task <task-id> <status>\");\n console.error(\"Status values: todo, in-progress, done, blocked\");\n process.exit(1);\n }\n await updateTask(dir, taskId, taskStatus, json);\n break;\n }\n case \"generate-configs\":\n await generateConfigs(dir, json);\n break;\n default:\n console.error(`Unknown command: ${command}`);\n console.log(USAGE);\n process.exit(1);\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n if (json) {\n console.log(JSON.stringify({ error: message }));\n } else {\n console.error(`Error: ${message}`);\n }\n process.exit(1);\n }\n}\n\nmain();\n","import {\n indexProject,\n detectDrift,\n writeDriftLog,\n inferTaskStatuses,\n applyInferences,\n getChangedFiles,\n resolveRef,\n getHeadSha,\n setSyncCommit,\n verifyScenarios,\n loadConfig,\n refreshFromDocs,\n type DriftEntry,\n type IndexResult,\n type TaskInferenceResult,\n type ChangedFile,\n type ScenarioTestResult,\n type DriftOptions,\n} from \"@arcbridge/core\";\nimport { openProjectDb } from \"../project.js\";\n\ninterface SyncResult {\n reindex: { files: number; symbols: number; dependencies: number };\n drift: DriftEntry[];\n inferences: TaskInferenceResult[];\n scenarios: ScenarioTestResult[];\n changedFiles: ChangedFile[];\n syncCommit: string | null;\n warnings: string[];\n}\n\nexport async function sync(dir: string, json: boolean): Promise<void> {\n const db = openProjectDb(dir);\n\n try {\n // Step 0: Refresh DB from arc42 docs (picks up manual edits to building blocks, scenarios, etc.)\n if (!json) console.log(\"Refreshing from docs...\");\n const docWarnings = refreshFromDocs(db, dir);\n if (!json && docWarnings.length > 0) {\n for (const w of docWarnings) console.log(` ${w}`);\n }\n\n // Step 1: Reindex\n if (!json) console.log(\"Reindexing...\");\n const indexResult: IndexResult = await indexProject(db, { projectRoot: dir });\n if (!json)\n console.log(\n ` Indexed ${indexResult.filesProcessed} files, ${indexResult.symbolsIndexed} symbols, ${indexResult.dependenciesIndexed} deps`,\n );\n\n // Step 2: Detect drift\n if (!json) console.log(\"Checking drift...\");\n const configForDrift = loadConfig(dir);\n const driftOpts: DriftOptions = {\n projectType: configForDrift.config?.project_type,\n ignorePaths: configForDrift.config?.drift?.ignore_paths,\n };\n const driftEntries = detectDrift(db, driftOpts);\n writeDriftLog(db, driftEntries);\n if (!json) {\n if (driftEntries.length === 0) {\n console.log(\" No drift detected.\");\n } else {\n console.log(` Found ${driftEntries.length} drift issue(s)`);\n for (const e of driftEntries) {\n const icon =\n e.severity === \"error\" ? \"[ERROR]\" : e.severity === \"warning\" ? \"[WARN] \" : \"[INFO] \";\n console.log(` ${icon} ${e.kind}: ${e.description}`);\n }\n }\n }\n\n // Step 3: Infer task statuses\n if (!json) console.log(\"Inferring task statuses...\");\n const currentPhase = db\n .prepare(\"SELECT id FROM phases WHERE status = 'in-progress' LIMIT 1\")\n .get() as { id: string } | undefined;\n\n let inferences: TaskInferenceResult[] = [];\n if (currentPhase) {\n inferences = inferTaskStatuses(db, currentPhase.id);\n if (inferences.length > 0) {\n applyInferences(db, inferences, dir);\n if (!json) {\n console.log(` Updated ${inferences.length} task(s):`);\n for (const inf of inferences) {\n console.log(\n ` ${inf.taskId}: ${inf.previousStatus} -> ${inf.inferredStatus} (${inf.reason})`,\n );\n }\n }\n } else {\n if (!json) console.log(\" No task status changes inferred.\");\n }\n } else {\n if (!json) console.log(\" No active phase — skipping task inference.\");\n }\n\n // Step 4: Verify quality scenarios with linked tests\n let scenarios: ScenarioTestResult[] = [];\n const configResult = loadConfig(dir);\n if (configResult.config) {\n const testCommand = configResult.config.testing.test_command;\n const timeoutMs = configResult.config.testing.timeout_ms;\n\n if (!json) console.log(\"Verifying quality scenarios...\");\n const verifyResult = verifyScenarios(db, dir, { testCommand, timeoutMs });\n scenarios = verifyResult.results;\n\n if (!json) {\n if (scenarios.length === 0) {\n console.log(\" No testable scenarios found.\");\n } else {\n const passing = scenarios.filter((r) => r.passed).length;\n console.log(\n ` ${scenarios.length} scenario(s) verified: ${passing} passing, ${scenarios.length - passing} failing`,\n );\n }\n }\n } else {\n if (!json) console.log(\" No config found — skipping scenario verification.\");\n }\n\n // Step 5: Get changed files since last sync\n const warnings: string[] = [];\n let changedFiles: ChangedFile[] = [];\n try {\n const ref = resolveRef(dir, \"last-sync\", db);\n changedFiles = getChangedFiles(dir, ref.sha);\n if (!json && changedFiles.length > 0) {\n console.log(`Changed files since ${ref.label}: ${changedFiles.length}`);\n }\n } catch {\n const msg = \"Could not determine changed files (git not available or no sync point).\";\n warnings.push(msg);\n if (!json) console.log(` ${msg}`);\n }\n\n // Step 6: Update sync point\n let syncCommit: string | null = null;\n try {\n const head = getHeadSha(dir);\n if (head) {\n syncCommit = head;\n setSyncCommit(db, \"last_sync_commit\", head);\n if (!json) console.log(`Sync point updated to ${head.slice(0, 7)}.`);\n }\n } catch {\n const msg = \"Could not update sync point (git not available).\";\n warnings.push(msg);\n if (!json) console.log(` ${msg}`);\n }\n\n // Summary\n const result: SyncResult = {\n reindex: {\n files: indexResult.filesProcessed,\n symbols: indexResult.symbolsIndexed,\n dependencies: indexResult.dependenciesIndexed,\n },\n drift: driftEntries,\n inferences,\n scenarios,\n changedFiles,\n syncCommit,\n warnings,\n };\n\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(\"\\nSync complete.\");\n const errors = driftEntries.filter((e) => e.severity === \"error\").length;\n if (errors > 0) {\n console.log(`WARNING: ${errors} drift error(s) would block phase completion.`);\n process.exitCode = 1;\n }\n }\n } finally {\n db.close();\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { openDatabase, migrate } from \"@arcbridge/core\";\nimport type Database from \"better-sqlite3\";\n\nexport function openProjectDb(projectDir: string): Database.Database {\n const dbPath = join(projectDir, \".arcbridge\", \"index.db\");\n if (!existsSync(dbPath)) {\n throw new Error(\n `No ArcBridge project found at ${projectDir}. Run \\`arcbridge_init_project\\` via MCP first.`,\n );\n }\n const db = openDatabase(dbPath);\n migrate(db);\n return db;\n}\n\nexport function ensureInitialized(projectDir: string): void {\n const configPath = join(projectDir, \".arcbridge\", \"config.yaml\");\n if (!existsSync(configPath)) {\n throw new Error(\n `No ArcBridge project found at ${projectDir}. Run \\`arcbridge_init_project\\` via MCP first.`,\n );\n }\n}\n","import { openProjectDb } from \"../project.js\";\n\ninterface TaskDetail {\n id: string;\n title: string;\n status: string;\n}\n\ninterface QualitySummary {\n total: number;\n passing: number;\n failing: number;\n untested: number;\n}\n\ninterface StatusResult {\n project_name: string;\n current_phase: { id: string; name: string; status: string } | null;\n tasks: { total: number; done: number; in_progress: number; blocked: number };\n current_tasks: TaskDetail[];\n quality: QualitySummary;\n building_blocks: number;\n symbols: number;\n drift: { total: number; errors: number; warnings: number };\n}\n\nexport async function status(dir: string, json: boolean): Promise<void> {\n const db = openProjectDb(dir);\n\n try {\n const projectName =\n (\n db\n .prepare(\n \"SELECT value FROM arcbridge_meta WHERE key = 'project_name'\",\n )\n .get() as { value: string } | undefined\n )?.value ?? \"Unknown\";\n\n const currentPhase = db\n .prepare(\n \"SELECT id, name, status FROM phases WHERE status = 'in-progress' LIMIT 1\",\n )\n .get() as { id: string; name: string; status: string } | undefined;\n\n const allTasks = db\n .prepare(\"SELECT status FROM tasks\")\n .all() as { status: string }[];\n const tasks = {\n total: allTasks.length,\n done: allTasks.filter((t) => t.status === \"done\").length,\n in_progress: allTasks.filter((t) => t.status === \"in-progress\").length,\n blocked: allTasks.filter((t) => t.status === \"blocked\").length,\n };\n\n const blockCount = (\n db.prepare(\"SELECT COUNT(*) as c FROM building_blocks\").get() as {\n c: number;\n }\n ).c;\n const symbolCount = (\n db.prepare(\"SELECT COUNT(*) as c FROM symbols\").get() as { c: number }\n ).c;\n\n // Current phase tasks\n const currentTasks: TaskDetail[] = currentPhase\n ? (db\n .prepare(\n \"SELECT id, title, status FROM tasks WHERE phase_id = ? ORDER BY id\",\n )\n .all(currentPhase.id) as TaskDetail[])\n : [];\n\n // Quality scenarios summary\n const scenarioStatuses = db\n .prepare(\"SELECT status FROM quality_scenarios\")\n .all() as { status: string }[];\n const quality: QualitySummary = {\n total: scenarioStatuses.length,\n passing: scenarioStatuses.filter((s) => s.status === \"passing\").length,\n failing: scenarioStatuses.filter((s) => s.status === \"failing\").length,\n untested: scenarioStatuses.filter((s) => s.status === \"untested\").length,\n };\n\n const driftEntries = db\n .prepare(\n \"SELECT severity FROM drift_log WHERE resolved_at IS NULL\",\n )\n .all() as { severity: string }[];\n const driftInfo = {\n total: driftEntries.length,\n errors: driftEntries.filter((d) => d.severity === \"error\").length,\n warnings: driftEntries.filter((d) => d.severity === \"warning\").length,\n };\n\n const result: StatusResult = {\n project_name: projectName,\n current_phase: currentPhase ?? null,\n tasks,\n current_tasks: currentTasks,\n quality,\n building_blocks: blockCount,\n symbols: symbolCount,\n drift: driftInfo,\n };\n\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`Project: ${result.project_name}`);\n console.log(\n `Phase: ${result.current_phase ? `${result.current_phase.name} (${result.current_phase.status})` : \"none active\"}`,\n );\n console.log(\n `Tasks: ${result.tasks.done}/${result.tasks.total} done, ${result.tasks.in_progress} in-progress, ${result.tasks.blocked} blocked`,\n );\n\n if (result.current_tasks.length > 0) {\n console.log(\"\");\n console.log(`Current phase tasks:`);\n for (const task of result.current_tasks) {\n const icon =\n task.status === \"done\"\n ? \"[x]\"\n : task.status === \"in-progress\"\n ? \"[~]\"\n : task.status === \"blocked\"\n ? \"[!]\"\n : \"[ ]\";\n console.log(` ${icon} ${task.title}`);\n }\n }\n\n if (result.quality.total > 0) {\n console.log(\"\");\n console.log(\n `Quality: ${result.quality.passing} passing, ${result.quality.failing} failing, ${result.quality.untested} untested (${result.quality.total} total)`,\n );\n }\n\n console.log(\"\");\n console.log(`Blocks: ${result.building_blocks}`);\n console.log(`Symbols: ${result.symbols}`);\n if (result.drift.total > 0) {\n console.log(\n `Drift: ${result.drift.total} issues (${result.drift.errors} errors, ${result.drift.warnings} warnings)`,\n );\n } else {\n console.log(`Drift: none`);\n }\n }\n } finally {\n db.close();\n }\n}\n","import { detectDrift, writeDriftLog, loadConfig, type DriftOptions } from \"@arcbridge/core\";\nimport { openProjectDb } from \"../project.js\";\n\nexport async function drift(dir: string, json: boolean): Promise<void> {\n const db = openProjectDb(dir);\n\n try {\n const configResult = loadConfig(dir);\n const driftOpts: DriftOptions = {\n projectType: configResult.config?.project_type,\n ignorePaths: configResult.config?.drift?.ignore_paths,\n };\n const entries = detectDrift(db, driftOpts);\n writeDriftLog(db, entries);\n\n if (json) {\n console.log(JSON.stringify({ drift: entries }, null, 2));\n } else {\n if (entries.length === 0) {\n console.log(\"No drift detected.\");\n } else {\n console.log(`Found ${entries.length} drift issue(s):\\n`);\n for (const e of entries) {\n const icon =\n e.severity === \"error\"\n ? \"[ERROR]\"\n : e.severity === \"warning\"\n ? \"[WARN] \"\n : \"[INFO] \";\n console.log(` ${icon} ${e.kind}: ${e.description}`);\n if (e.affectedBlock) {\n console.log(` Block: ${e.affectedBlock}`);\n }\n if (e.affectedFile) {\n console.log(` File: ${e.affectedFile}`);\n }\n }\n\n const errors = entries.filter((e) => e.severity === \"error\").length;\n if (errors > 0) {\n console.log(`\\n${errors} error(s) found — these block phase completion.`);\n process.exitCode = 1;\n }\n }\n }\n } finally {\n db.close();\n }\n}\n","import { resolve, basename, join } from \"node:path\";\nimport { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport {\n generateConfig,\n generateArc42,\n generatePlan,\n generateAgentRoles,\n generateDatabase,\n generateSyncFiles,\n indexProject,\n discoverDotnetServices,\n type InitProjectInput,\n} from \"@arcbridge/core\";\nimport { getAdapter } from \"@arcbridge/adapters\";\n\ninterface InitOptions {\n name?: string;\n template?: string;\n platforms?: string[];\n spec?: string;\n}\n\ntype ProjectTemplate = \"nextjs-app-router\" | \"react-vite\" | \"api-service\" | \"dotnet-webapi\";\n\ninterface DetectedInfo {\n name: string;\n template: ProjectTemplate;\n nameSource: string;\n templateSource: string;\n /** For .sln-based projects: services discovered from solution */\n dotnetServices?: Array<{ name: string; path: string; csprojPath: string; isTestProject: boolean }>;\n}\n\nconst VALID_TEMPLATES: ProjectTemplate[] = [\n \"nextjs-app-router\",\n \"react-vite\",\n \"api-service\",\n \"dotnet-webapi\",\n];\n\n/**\n * Find .csproj files in the project root (non-recursive, just top level).\n */\nfunction findCsproj(projectRoot: string): string | null {\n try {\n const entries = readdirSync(projectRoot);\n return entries.find((e) => e.endsWith(\".csproj\")) ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Auto-detect project info from package.json, .csproj, or directory structure.\n */\nfunction detectProjectInfo(projectRoot: string): DetectedInfo {\n const fallbackName = basename(projectRoot);\n let name = fallbackName;\n let nameSource = \"directory name\";\n let template: ProjectTemplate = \"nextjs-app-router\";\n let templateSource = \"default\";\n\n // Check for .NET solution first (multi-project)\n const entries = readdirSync(projectRoot);\n const slnFile = entries.find((e) => e.endsWith(\".sln\"));\n if (slnFile) {\n name = slnFile.replace(\".sln\", \"\");\n nameSource = \".sln file\";\n template = \"dotnet-webapi\";\n templateSource = `detected (${slnFile} found)`;\n const dotnetServices = discoverDotnetServices(projectRoot);\n return { name, template, nameSource, templateSource, dotnetServices };\n }\n\n // Check for single .NET project\n const csproj = findCsproj(projectRoot);\n if (csproj) {\n name = csproj.replace(\".csproj\", \"\");\n nameSource = \".csproj file\";\n template = \"dotnet-webapi\";\n templateSource = `detected (${csproj} found)`;\n return { name, template, nameSource, templateSource };\n }\n\n const pkgPath = join(projectRoot, \"package.json\");\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n\n if (pkg.name) {\n name = pkg.name;\n nameSource = \"package.json\";\n }\n\n const allDeps = {\n ...pkg.dependencies,\n ...pkg.devDependencies,\n };\n\n if (allDeps[\"next\"]) {\n template = \"nextjs-app-router\";\n templateSource = \"detected (next in dependencies)\";\n } else if (allDeps[\"vite\"] && allDeps[\"react\"]) {\n template = \"react-vite\";\n templateSource = \"detected (vite + react in dependencies)\";\n } else if (\n allDeps[\"express\"] ||\n allDeps[\"fastify\"] ||\n allDeps[\"hono\"] ||\n allDeps[\"@hono/node-server\"]\n ) {\n template = \"api-service\";\n templateSource = \"detected (server framework in dependencies)\";\n }\n } catch {\n // Ignore parse errors\n }\n }\n\n return { name, template, nameSource, templateSource };\n}\n\nexport async function init(\n dir: string,\n options: InitOptions,\n json: boolean,\n): Promise<void> {\n const projectRoot = resolve(dir);\n\n // Check if already initialized\n if (existsSync(join(projectRoot, \".arcbridge\", \"config.yaml\"))) {\n const msg = \"ArcBridge is already initialized in this directory. Use `arcbridge status` to see current state.\";\n if (json) {\n console.log(JSON.stringify({ error: msg }));\n } else {\n console.error(msg);\n }\n process.exitCode = 1;\n return;\n }\n\n // Detect project info\n const detected = detectProjectInfo(projectRoot);\n\n // Apply overrides from flags\n const projectName = options.name ?? detected.name;\n const templateStr = options.template ?? detected.template;\n const platforms = options.platforms ?? [\"claude\"];\n\n if (!VALID_TEMPLATES.includes(templateStr as ProjectTemplate)) {\n const msg = `Unknown template \"${templateStr}\". Valid values: ${VALID_TEMPLATES.join(\", \")}`;\n if (json) {\n console.log(JSON.stringify({ error: msg }));\n } else {\n console.error(`Error: ${msg}`);\n }\n process.exitCode = 1;\n return;\n }\n\n const template = templateStr as ProjectTemplate;\n\n // Show what we detected\n if (!json) {\n console.log(`Initializing ArcBridge in ${projectRoot}\\n`);\n console.log(` Project: ${projectName} (${detected.nameSource})`);\n console.log(` Template: ${template} (${detected.templateSource})`);\n console.log(` Platform: ${platforms.join(\", \")}`);\n if (options.spec) {\n console.log(` Spec: ${options.spec}`);\n }\n if (detected.dotnetServices && detected.dotnetServices.length > 1) {\n const nonTest = detected.dotnetServices.filter((s) => !s.isTestProject);\n const test = detected.dotnetServices.filter((s) => s.isTestProject);\n console.log(` Services: ${nonTest.length} project(s) detected from solution`);\n for (const svc of nonTest) {\n console.log(` - ${svc.name} (${svc.path})`);\n }\n if (test.length > 0) {\n console.log(` Tests: ${test.length} test project(s) (excluded from indexing)`);\n }\n }\n console.log();\n }\n\n // For multi-project .NET solutions, pass non-test services to the template\n const nonTestServices = detected.dotnetServices?.filter((s) => !s.isTestProject);\n\n const input: InitProjectInput = {\n name: projectName,\n template,\n features: [],\n quality_priorities: [\"security\", \"performance\", \"accessibility\"],\n platforms,\n dotnetServices: nonTestServices?.map((s) => ({ name: s.name, path: s.path })),\n };\n\n // 1. Generate config\n if (!json) console.log(\"Creating .arcbridge/config.yaml...\");\n const config = generateConfig(projectRoot, input);\n\n // 2. Generate arc42 documentation\n if (!json) console.log(\"Creating arc42 documentation...\");\n generateArc42(projectRoot, input);\n\n // 3. Generate phase plan\n if (!json) console.log(\"Creating phase plan...\");\n generatePlan(projectRoot, input);\n\n // 4. Generate agent roles\n if (!json) console.log(\"Creating agent roles...\");\n const roles = generateAgentRoles(projectRoot, template);\n\n // 5. Initialize database from generated files\n if (!json) console.log(\"Initializing database...\");\n const { db, warnings } = generateDatabase(projectRoot, input);\n\n // 6. Generate sync loop files\n if (!json) console.log(\"Creating sync triggers...\");\n const syncFiles = generateSyncFiles(projectRoot, config);\n\n // 7. Generate platform-specific configs\n if (!json) console.log(\"Generating platform configs...\");\n const platformWarnings: string[] = [];\n for (const platform of platforms) {\n try {\n const adapter = getAdapter(platform);\n adapter.generateProjectConfig(projectRoot, config);\n adapter.generateAgentConfigs(projectRoot, roles);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n platformWarnings.push(`Platform '${platform}': ${msg}`);\n }\n }\n\n // 8. Copy spec file into .arcbridge/ if provided\n if (options.spec) {\n const specPath = resolve(options.spec);\n if (existsSync(specPath)) {\n const specContent = readFileSync(specPath, \"utf-8\");\n const { writeFileSync } = await import(\"node:fs\");\n writeFileSync(join(projectRoot, \".arcbridge\", \"spec.md\"), specContent, \"utf-8\");\n if (!json) console.log(\"Copied spec file to .arcbridge/spec.md\");\n } else {\n platformWarnings.push(`Spec file not found: ${specPath}`);\n }\n }\n\n // 9. Index codebase\n let indexResult: {\n filesProcessed: number;\n symbolsIndexed: number;\n dependenciesIndexed: number;\n componentsAnalyzed: number;\n routesAnalyzed: number;\n } | null = null;\n try {\n if (!json) console.log(\"Indexing codebase...\");\n\n // Index the whole project/solution as a single unit.\n // For .NET solutions with multiple projects, all symbols are indexed together\n // under the default service (\"main\") to preserve cross-project dependency resolution.\n // Agents can filter by file_path prefix to scope queries to a specific project or layer.\n const result = await indexProject(db, { projectRoot });\n indexResult = {\n filesProcessed: result.filesProcessed,\n symbolsIndexed: result.symbolsIndexed,\n dependenciesIndexed: result.dependenciesIndexed,\n componentsAnalyzed: result.componentsAnalyzed,\n routesAnalyzed: result.routesAnalyzed,\n };\n } catch {\n // Indexing is optional — project may not have tsconfig.json yet\n }\n\n // Get counts\n const blockCount = db\n .prepare(\"SELECT COUNT(*) as count FROM building_blocks\")\n .get() as { count: number };\n const scenarioCount = db\n .prepare(\"SELECT COUNT(*) as count FROM quality_scenarios\")\n .get() as { count: number };\n const phaseCount = db\n .prepare(\"SELECT COUNT(*) as count FROM phases\")\n .get() as { count: number };\n const taskCount = db\n .prepare(\"SELECT COUNT(*) as count FROM tasks\")\n .get() as { count: number };\n\n db.close();\n\n const allWarnings = [...warnings, ...platformWarnings];\n\n if (json) {\n console.log(\n JSON.stringify(\n {\n name: projectName,\n template,\n platforms,\n blocks: blockCount.count,\n scenarios: scenarioCount.count,\n phases: phaseCount.count,\n tasks: taskCount.count,\n roles: roles.length,\n index: indexResult,\n syncFiles,\n warnings: allWarnings,\n },\n null,\n 2,\n ),\n );\n } else {\n console.log(\"\\nArcBridge initialized successfully!\\n\");\n console.log(` Building blocks: ${blockCount.count}`);\n console.log(` Quality scenarios: ${scenarioCount.count}`);\n console.log(` Phases: ${phaseCount.count}`);\n console.log(` Tasks: ${taskCount.count}`);\n console.log(` Agent roles: ${roles.length}`);\n if (indexResult) {\n console.log(\n ` Indexed: ${indexResult.filesProcessed} files, ${indexResult.symbolsIndexed} symbols`,\n );\n } else {\n console.log(\n input.template === \"dotnet-webapi\"\n ? \" Indexed: skipped (ensure .NET SDK is installed and dotnet-indexer is built)\"\n : \" Indexed: skipped (no tsconfig.json)\",\n );\n }\n\n if (allWarnings.length > 0) {\n console.log(\"\\nWarnings:\");\n for (const w of allWarnings) {\n console.log(` - ${w}`);\n }\n }\n\n console.log(\"\\nNext steps:\");\n console.log(\" 1. Review .arcbridge/config.yaml and adjust as needed\");\n console.log(\" 2. Start your AI agent (e.g. Claude Code) in this directory\");\n console.log(\" 3. The agent will see the architecture context and can help\");\n console.log(\" refine building blocks, quality scenarios, and the plan\");\n console.log(\" 4. Run `arcbridge sync` periodically to keep docs in sync with code\");\n }\n}\n","import { resolve } from \"node:path\";\nimport { loadConfig, loadRoles, generateAgentRoles } from \"@arcbridge/core\";\nimport { getAdapter } from \"@arcbridge/adapters\";\n\ninterface GenerateResult {\n platforms: string[];\n roles: string[];\n rolesSource: \"custom\" | \"built-in\";\n errors: string[];\n}\n\nexport async function generateConfigs(\n dir: string,\n json: boolean,\n): Promise<void> {\n const projectRoot = resolve(dir);\n const errors: string[] = [];\n\n // Load config\n const { config, error: configError } = loadConfig(projectRoot);\n if (configError || !config) {\n const msg = configError ?? \"No .arcbridge/config.yaml found\";\n if (json) {\n console.log(JSON.stringify({ error: msg }));\n } else {\n console.error(`Error: ${msg}`);\n }\n process.exitCode = 1;\n return;\n }\n\n // Load roles from files, fall back to generating built-in roles\n const loaded = loadRoles(projectRoot);\n let roles = loaded.roles;\n const roleErrors = loaded.errors;\n let rolesSource: \"custom\" | \"built-in\" = \"custom\";\n if (roleErrors.length > 0) {\n errors.push(...roleErrors);\n }\n if (roles.length === 0) {\n // No custom roles found — generate built-in role files and use them\n if (!json) console.log(\"No custom roles found, generating built-in roles...\");\n roles = generateAgentRoles(projectRoot);\n rolesSource = \"built-in\";\n }\n\n // Determine platforms from config\n const platforms = config.platforms ?? [\"claude\", \"copilot\"];\n const generatedPlatforms: string[] = [];\n\n for (const platform of platforms) {\n try {\n const adapter = getAdapter(platform);\n adapter.generateProjectConfig(projectRoot, config);\n if (roles.length > 0) {\n adapter.generateAgentConfigs(projectRoot, roles);\n }\n generatedPlatforms.push(platform);\n } catch (err) {\n errors.push(\n `${platform}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n const result: GenerateResult = {\n platforms: generatedPlatforms,\n roles: roles.map((r) => r.role_id),\n rolesSource,\n errors,\n };\n\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n if (generatedPlatforms.length > 0) {\n console.log(\n `Generated configs for: ${generatedPlatforms.join(\", \")}`,\n );\n }\n if (roles.length > 0) {\n const source = rolesSource === \"built-in\" ? \" (built-in)\" : \"\";\n console.log(\n `Roles${source}: ${roles.map((r) => r.role_id).join(\", \")}`,\n );\n }\n for (const err of errors) {\n console.error(`Warning: ${err}`);\n }\n }\n}\n","import { syncTaskToYaml } from \"@arcbridge/core\";\nimport { openProjectDb } from \"../project.js\";\n\ntype TaskStatus = \"todo\" | \"in-progress\" | \"done\" | \"blocked\";\n\nconst VALID_STATUSES: TaskStatus[] = [\"todo\", \"in-progress\", \"done\", \"blocked\"];\n\nexport async function updateTask(\n dir: string,\n taskId: string,\n newStatus: string,\n json: boolean,\n): Promise<void> {\n if (!VALID_STATUSES.includes(newStatus as TaskStatus)) {\n const msg = `Invalid status \"${newStatus}\". Valid values: ${VALID_STATUSES.join(\", \")}`;\n if (json) {\n console.log(JSON.stringify({ error: msg }));\n } else {\n console.error(`Error: ${msg}`);\n }\n process.exitCode = 1;\n return;\n }\n\n const db = openProjectDb(dir);\n\n try {\n const task = db\n .prepare(\"SELECT id, title, status, phase_id FROM tasks WHERE id = ?\")\n .get(taskId) as { id: string; title: string; status: string; phase_id: string } | undefined;\n\n if (!task) {\n const msg = `Task \"${taskId}\" not found`;\n if (json) {\n console.log(JSON.stringify({ error: msg }));\n } else {\n console.error(`Error: ${msg}`);\n }\n process.exitCode = 1;\n return;\n }\n\n const previousStatus = task.status;\n const now = new Date().toISOString();\n\n if (newStatus === \"done\") {\n db.prepare(\"UPDATE tasks SET status = ?, completed_at = ? WHERE id = ?\").run(newStatus, now, taskId);\n } else {\n db.prepare(\"UPDATE tasks SET status = ? WHERE id = ?\").run(newStatus, taskId);\n }\n\n // Write back to YAML\n syncTaskToYaml(dir, task.phase_id, taskId, newStatus, newStatus === \"done\" ? now : null);\n\n if (json) {\n console.log(\n JSON.stringify({\n taskId: task.id,\n title: task.title,\n previousStatus,\n newStatus,\n }),\n );\n } else {\n console.log(`${task.id}: ${previousStatus} → ${newStatus} (${task.title})`);\n }\n } finally {\n db.close();\n }\n}\n","import { refreshFromDocs } from \"@arcbridge/core\";\nimport { openProjectDb } from \"../project.js\";\n\nexport async function refresh(dir: string, json: boolean): Promise<void> {\n const db = openProjectDb(dir);\n\n try {\n const warnings = refreshFromDocs(db, dir);\n\n if (json) {\n console.log(JSON.stringify({ refreshed: true, warnings }));\n } else {\n console.log(\"Database refreshed from YAML/markdown sources.\");\n if (warnings.length > 0) {\n console.log(`\\n${warnings.length} warning(s):`);\n for (const w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Q,IAAI,KAAK;AACjB,gBAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,QAAI,MAAM;AACR,cAAQ,IAAI,KAAK,UAAU,EAAE,OAAO,QAAQ,CAAC,CAAC;AAAA,IAChD,OAAO;AACL,cAAQ,MAAM,UAAU,OAAO,EAAE;AAAA,IACnC;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,KAAK;","names":["resolve","readFileSync","join","detectDrift","writeDriftLog","loadConfig","loadConfig","detectDrift","writeDriftLog","join","existsSync","indexProject","pkg","resolve","loadConfig","generateAgentRoles","getAdapter","refreshFromDocs","refreshFromDocs","readFileSync","join","resolve"]}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "arcbridge",
3
+ "version": "0.1.0",
4
+ "description": "CLI for ArcBridge — architectural awareness for AI coding agents",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/bifteki-crew/arcbridge.git",
13
+ "directory": "packages/cli"
14
+ },
15
+ "keywords": [
16
+ "arcbridge",
17
+ "architecture",
18
+ "arc42",
19
+ "cli",
20
+ "ai-agents"
21
+ ],
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "bin": {
30
+ "arcbridge": "./dist/index.js"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "import": "./dist/index.js",
35
+ "types": "./dist/index.d.ts"
36
+ }
37
+ },
38
+ "dependencies": {
39
+ "@arcbridge/core": "0.1.0",
40
+ "@arcbridge/adapters": "0.1.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "clean": "rm -rf dist"
45
+ }
46
+ }