@arcbridge/core 0.2.0 → 0.2.1

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/dist/index.d.ts CHANGED
@@ -933,6 +933,13 @@ declare function deleteTaskFromYaml(projectRoot: string, phaseId: string, taskId
933
933
  success: boolean;
934
934
  warning?: string;
935
935
  };
936
+ /**
937
+ * Delete a phase from phases.yaml and its associated task file.
938
+ */
939
+ declare function deletePhaseFromYaml(projectRoot: string, phaseId: string): {
940
+ success: boolean;
941
+ warning?: string;
942
+ };
936
943
 
937
944
  /**
938
945
  * Generate sync loop trigger files based on configured platforms.
@@ -1137,4 +1144,4 @@ declare function loadConfig(projectRoot: string): {
1137
1144
  error: string | null;
1138
1145
  };
1139
1146
 
1140
- export { type ActivityRow, type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type AggregatedRow, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type Database, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExportFormat, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type InsertActivityParams, type LatestQualitySnapshot, type LoadRolesResult, type MetricsResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type QueryMetricsParams, type ScenarioTestResult, type Service, type SessionTotals, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addPhaseToYaml, addTaskToYaml, applyInferences, deleteTaskFromYaml, detectDrift, detectProjectLanguage, discoverDotnetServices, exportMetrics, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getSessionTotals, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, insertActivity, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, queryMetrics, refreshFromDocs, resolveRef, scopeToProject, setSyncCommit, suppressSqliteWarning, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, transaction, verifyScenarios, writeDriftLog };
1147
+ export { type ActivityRow, type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type AggregatedRow, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type Database, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExportFormat, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type InsertActivityParams, type LatestQualitySnapshot, type LoadRolesResult, type MetricsResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type QueryMetricsParams, type ScenarioTestResult, type Service, type SessionTotals, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addPhaseToYaml, addTaskToYaml, applyInferences, deletePhaseFromYaml, deleteTaskFromYaml, detectDrift, detectProjectLanguage, discoverDotnetServices, exportMetrics, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getSessionTotals, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, insertActivity, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, queryMetrics, refreshFromDocs, resolveRef, scopeToProject, setSyncCommit, suppressSqliteWarning, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, transaction, verifyScenarios, writeDriftLog };
package/dist/index.js CHANGED
@@ -3557,14 +3557,41 @@ You are responsible for maintaining these sections in \`.arcbridge/arc42/\`. Upd
3557
3557
  - All ADRs and their status
3558
3558
  - Building block \u2192 code mapping
3559
3559
 
3560
+ ## Post-Init Tailoring (CRITICAL \u2014 Do This Before Writing Code)
3561
+
3562
+ The building blocks, quality scenarios, and phase tasks generated during init are a **generic starting template**, not a project-specific plan. Before writing any code, systematically tailor the generated content to the actual project:
3563
+
3564
+ 1. **Building blocks:** Review each generated block against the project description. Delete blocks that don't apply (e.g., "API Client" for a client-only app). Add blocks for the real modules/features you'll build. **Declare interfaces between blocks** to specify dependencies \u2014 drift detection and phase gates rely on this.
3565
+ 2. **Quality scenarios:** Review each scenario against the project's quality priorities. Delete irrelevant ones (e.g., "API response time" for a localStorage-only app). Add scenarios that reflect the actual requirements.
3566
+ 3. **Phase tasks:** Phase 0-1 tasks are ready to use. **Phase 2+ tasks are examples \u2014 delete them** and create tasks that match the features you're actually building. Keep phases small and focused (3-6 tasks per phase). Add more phases if needed using \`arcbridge_create_phase\` \u2014 6, 8, or 10 phases is fine for larger projects.
3567
+ 4. **Reindex** after making changes so drift detection picks up your tailored architecture.
3568
+
3569
+ The goal is that by the time you start Phase 0, the building blocks describe your architecture, the quality scenarios test your requirements, and the tasks reflect your build plan.
3570
+
3571
+ ### Building Block interfaces
3572
+
3573
+ Each building block in \`05-building-blocks.md\` should declare its dependencies on other blocks using the \`interfaces\` field. This is required for drift detection to catch undeclared cross-block dependencies at phase gates.
3574
+
3575
+ Format \u2014 within the \`blocks:\` array, list the IDs of other blocks this block depends on:
3576
+ \`\`\`yaml
3577
+ blocks:
3578
+ - id: canvas-engine
3579
+ name: Canvas Engine
3580
+ level: 1
3581
+ responsibility: "Render and manage collaborative canvas state"
3582
+ service: main
3583
+ code_paths:
3584
+ - "src/canvas/"
3585
+ interfaces:
3586
+ - workflow-model
3587
+ - shared-types
3588
+ \`\`\`
3589
+
3590
+ If your code imports across block boundaries without declaring the interface, \`arcbridge_check_drift\` will flag it and \`arcbridge_complete_phase\` will block the gate.
3591
+
3560
3592
  ## Project Planning
3561
3593
 
3562
- At the start of a project (after init), plan the full roadmap:
3563
- - **ArcBridge generates 4 phases as a starting template** (Setup, Foundation, Features, Polish). These are a baseline \u2014 adapt them to your project's actual scope and complexity.
3564
- - **For larger projects, add more phases** using \`arcbridge_create_phase\`. Split "Core Features" into multiple phases if needed (e.g., "Auth & Users", "Core Business Logic", "Integrations", "Polish").
3565
- - **Phase 0-1 tasks are ready to use** \u2014 they cover setup and foundation for this template
3566
- - **Phase 2+ tasks are examples** \u2014 replace them with real tasks derived from the project's requirements and specifications
3567
- - Review the phase plan with \`arcbridge_get_phase_plan\` and replace example tasks with project-specific ones
3594
+ - Review the phase plan with \`arcbridge_get_phase_plan\`
3568
3595
  - Create tasks using \`arcbridge_create_task\` with the phase ID shown in the plan
3569
3596
  - Keep each phase reasonably scoped \u2014 3-6 tasks per phase is ideal
3570
3597
  - Map tasks to building blocks so drift detection tracks coverage
@@ -7171,7 +7198,7 @@ function safeParseJson(value, fallback) {
7171
7198
 
7172
7199
  // src/sync/yaml-writer.ts
7173
7200
  import { join as join15 } from "path";
7174
- import { existsSync as existsSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "fs";
7201
+ import { existsSync as existsSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, unlinkSync } from "fs";
7175
7202
  import { parse as parse2, stringify as stringify4 } from "yaml";
7176
7203
  function syncTaskToYaml(projectRoot, phaseId, taskId, status, completedAt) {
7177
7204
  const taskPath = join15(
@@ -7355,6 +7382,41 @@ function deleteTaskFromYaml(projectRoot, phaseId, taskId) {
7355
7382
  };
7356
7383
  }
7357
7384
  }
7385
+ function deletePhaseFromYaml(projectRoot, phaseId) {
7386
+ try {
7387
+ const phasesPath = join15(projectRoot, ".arcbridge", "plan", "phases.yaml");
7388
+ if (!existsSync8(phasesPath)) {
7389
+ return { success: false, warning: "phases.yaml not found" };
7390
+ }
7391
+ const raw = readFileSync8(phasesPath, "utf-8");
7392
+ const result = PhasesFileSchema.safeParse(parse2(raw));
7393
+ if (!result.success) {
7394
+ return {
7395
+ success: false,
7396
+ warning: "Could not parse phases.yaml \u2014 phase may reappear after reindex"
7397
+ };
7398
+ }
7399
+ const phasesFile = result.data;
7400
+ const before = phasesFile.phases.length;
7401
+ phasesFile.phases = phasesFile.phases.filter((p) => p.id !== phaseId);
7402
+ if (phasesFile.phases.length === before) {
7403
+ return { success: false, warning: `Phase '${phaseId}' not found in phases.yaml` };
7404
+ }
7405
+ writeFileSync5(phasesPath, stringify4(phasesFile), "utf-8");
7406
+ const taskFilePath = join15(projectRoot, ".arcbridge", "plan", "tasks", `${phaseId}.yaml`);
7407
+ try {
7408
+ unlinkSync(taskFilePath);
7409
+ } catch (e) {
7410
+ if (e.code !== "ENOENT") throw e;
7411
+ }
7412
+ return { success: true };
7413
+ } catch (err) {
7414
+ return {
7415
+ success: false,
7416
+ warning: `YAML update failed: ${err instanceof Error ? err.message : String(err)}`
7417
+ };
7418
+ }
7419
+ }
7358
7420
 
7359
7421
  // src/sync/task-inference.ts
7360
7422
  function inferTaskStatuses(db, phaseId) {
@@ -8332,6 +8394,7 @@ export {
8332
8394
  addPhaseToYaml,
8333
8395
  addTaskToYaml,
8334
8396
  applyInferences,
8397
+ deletePhaseFromYaml,
8335
8398
  deleteTaskFromYaml,
8336
8399
  detectDrift,
8337
8400
  detectProjectLanguage,