@uxmaltech/collab-cli 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.
Files changed (109) hide show
  1. package/README.md +227 -0
  2. package/bin/collab +10 -0
  3. package/dist/cli.js +34 -0
  4. package/dist/commands/canon/index.js +16 -0
  5. package/dist/commands/canon/rebuild.js +95 -0
  6. package/dist/commands/compose/generate.js +63 -0
  7. package/dist/commands/compose/index.js +18 -0
  8. package/dist/commands/compose/validate.js +53 -0
  9. package/dist/commands/doctor.js +153 -0
  10. package/dist/commands/index.js +27 -0
  11. package/dist/commands/infra/down.js +23 -0
  12. package/dist/commands/infra/index.js +20 -0
  13. package/dist/commands/infra/shared.js +59 -0
  14. package/dist/commands/infra/status.js +64 -0
  15. package/dist/commands/infra/up.js +29 -0
  16. package/dist/commands/init.js +830 -0
  17. package/dist/commands/mcp/index.js +20 -0
  18. package/dist/commands/mcp/shared.js +57 -0
  19. package/dist/commands/mcp/start.js +45 -0
  20. package/dist/commands/mcp/status.js +62 -0
  21. package/dist/commands/mcp/stop.js +23 -0
  22. package/dist/commands/seed.js +55 -0
  23. package/dist/commands/uninstall.js +36 -0
  24. package/dist/commands/up.js +78 -0
  25. package/dist/commands/update-canons.js +48 -0
  26. package/dist/commands/upgrade.js +54 -0
  27. package/dist/index.js +14 -0
  28. package/dist/lib/ai-client.js +317 -0
  29. package/dist/lib/ansi.js +58 -0
  30. package/dist/lib/canon-index-generator.js +64 -0
  31. package/dist/lib/canon-index-targets.js +68 -0
  32. package/dist/lib/canon-resolver.js +262 -0
  33. package/dist/lib/canon-scaffold.js +57 -0
  34. package/dist/lib/cli-detection.js +149 -0
  35. package/dist/lib/command-context.js +23 -0
  36. package/dist/lib/compose-defaults.js +47 -0
  37. package/dist/lib/compose-env.js +24 -0
  38. package/dist/lib/compose-paths.js +36 -0
  39. package/dist/lib/compose-renderer.js +134 -0
  40. package/dist/lib/compose-validator.js +56 -0
  41. package/dist/lib/config.js +195 -0
  42. package/dist/lib/credentials.js +63 -0
  43. package/dist/lib/docker-checks.js +73 -0
  44. package/dist/lib/docker-compose.js +15 -0
  45. package/dist/lib/docker-status.js +151 -0
  46. package/dist/lib/domain-gen.js +376 -0
  47. package/dist/lib/ecosystem.js +150 -0
  48. package/dist/lib/env-file.js +77 -0
  49. package/dist/lib/errors.js +30 -0
  50. package/dist/lib/executor.js +85 -0
  51. package/dist/lib/github-auth.js +204 -0
  52. package/dist/lib/hash.js +7 -0
  53. package/dist/lib/health-checker.js +140 -0
  54. package/dist/lib/logger.js +87 -0
  55. package/dist/lib/mcp-client.js +88 -0
  56. package/dist/lib/mode.js +36 -0
  57. package/dist/lib/model-listing.js +102 -0
  58. package/dist/lib/model-registry.js +55 -0
  59. package/dist/lib/npm-operations.js +69 -0
  60. package/dist/lib/orchestrator.js +170 -0
  61. package/dist/lib/parsers.js +42 -0
  62. package/dist/lib/port-resolver.js +57 -0
  63. package/dist/lib/preconditions.js +35 -0
  64. package/dist/lib/preflight.js +88 -0
  65. package/dist/lib/process.js +6 -0
  66. package/dist/lib/prompt.js +125 -0
  67. package/dist/lib/providers.js +117 -0
  68. package/dist/lib/repo-analysis-helpers.js +379 -0
  69. package/dist/lib/repo-scanner.js +195 -0
  70. package/dist/lib/service-health.js +79 -0
  71. package/dist/lib/shell.js +49 -0
  72. package/dist/lib/state.js +38 -0
  73. package/dist/lib/update-checker.js +130 -0
  74. package/dist/lib/version.js +27 -0
  75. package/dist/stages/agent-skills-setup.js +301 -0
  76. package/dist/stages/assistant-setup.js +325 -0
  77. package/dist/stages/canon-ingest.js +249 -0
  78. package/dist/stages/canon-rebuild-graph.js +33 -0
  79. package/dist/stages/canon-rebuild-indexes.js +40 -0
  80. package/dist/stages/canon-rebuild-snapshot.js +75 -0
  81. package/dist/stages/canon-rebuild-validate.js +57 -0
  82. package/dist/stages/canon-rebuild-vectors.js +30 -0
  83. package/dist/stages/canon-scaffold.js +15 -0
  84. package/dist/stages/canon-sync.js +49 -0
  85. package/dist/stages/ci-setup.js +56 -0
  86. package/dist/stages/domain-gen.js +363 -0
  87. package/dist/stages/graph-seed.js +26 -0
  88. package/dist/stages/repo-analysis-fileonly.js +111 -0
  89. package/dist/stages/repo-analysis.js +112 -0
  90. package/dist/stages/repo-scaffold.js +110 -0
  91. package/dist/templates/canon/contracts-readme.js +39 -0
  92. package/dist/templates/canon/domain-readme.js +40 -0
  93. package/dist/templates/canon/evolution/changelog.js +53 -0
  94. package/dist/templates/canon/governance/confidence-levels.js +38 -0
  95. package/dist/templates/canon/governance/implementation-process.js +34 -0
  96. package/dist/templates/canon/governance/review-process.js +29 -0
  97. package/dist/templates/canon/governance/schema-versioning.js +25 -0
  98. package/dist/templates/canon/governance/what-enters-the-canon.js +44 -0
  99. package/dist/templates/canon/index.js +28 -0
  100. package/dist/templates/canon/knowledge-readme.js +129 -0
  101. package/dist/templates/canon/system-prompt.js +101 -0
  102. package/dist/templates/ci/architecture-merge.js +29 -0
  103. package/dist/templates/ci/architecture-pr.js +26 -0
  104. package/dist/templates/ci/index.js +7 -0
  105. package/dist/templates/consolidated.js +114 -0
  106. package/dist/templates/infra.js +90 -0
  107. package/dist/templates/mcp.js +32 -0
  108. package/install.sh +455 -0
  109. package/package.json +48 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.repoScaffoldStage = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const PLACEHOLDER_MARKER = '<!-- AI-GENERATED: PLACEHOLDER -->';
10
+ function buildRepoScaffoldEntries() {
11
+ return [
12
+ {
13
+ relativePath: 'knowledge/axioms/README.md',
14
+ content: [
15
+ '# Axioms',
16
+ '',
17
+ PLACEHOLDER_MARKER,
18
+ '',
19
+ 'Project-specific foundational truths. Generated by AI analysis or written manually.',
20
+ '',
21
+ '## Adding Axioms',
22
+ '',
23
+ 'Each axiom should have:',
24
+ '- A unique ID (e.g., `AX-001`)',
25
+ '- A confidence level (`experimental | provisional | verified`)',
26
+ '- A clear statement and rationale',
27
+ '',
28
+ ].join('\n'),
29
+ },
30
+ {
31
+ relativePath: 'knowledge/decisions/README.md',
32
+ content: [
33
+ '# Architecture Decision Records',
34
+ '',
35
+ PLACEHOLDER_MARKER,
36
+ '',
37
+ 'Project-specific ADRs. Follow the format:',
38
+ '',
39
+ '- **Context**: What prompted the decision',
40
+ '- **Decision**: What was decided',
41
+ '- **Consequences**: Trade-offs and outcomes',
42
+ '',
43
+ ].join('\n'),
44
+ },
45
+ {
46
+ relativePath: 'knowledge/conventions/README.md',
47
+ content: [
48
+ '# Conventions',
49
+ '',
50
+ PLACEHOLDER_MARKER,
51
+ '',
52
+ 'Project-specific naming, versioning, and code conventions.',
53
+ '',
54
+ ].join('\n'),
55
+ },
56
+ {
57
+ relativePath: 'knowledge/anti-patterns/README.md',
58
+ content: [
59
+ '# Anti-Patterns',
60
+ '',
61
+ PLACEHOLDER_MARKER,
62
+ '',
63
+ 'Documented violations and patterns to avoid in this project.',
64
+ '',
65
+ ].join('\n'),
66
+ },
67
+ {
68
+ relativePath: 'domains/README.md',
69
+ content: [
70
+ '# Domains',
71
+ '',
72
+ PLACEHOLDER_MARKER,
73
+ '',
74
+ 'Project-specific domain boundaries, responsibilities, and public APIs.',
75
+ '',
76
+ ].join('\n'),
77
+ },
78
+ ];
79
+ }
80
+ function generateRepoScaffold(ctx) {
81
+ const repoDir = ctx.config.repoDir;
82
+ const entries = buildRepoScaffoldEntries();
83
+ let created = 0;
84
+ let skipped = 0;
85
+ for (const entry of entries) {
86
+ const target = node_path_1.default.join(repoDir, entry.relativePath);
87
+ if (!ctx.executor.dryRun && node_fs_1.default.existsSync(target)) {
88
+ ctx.logger.debug(`Repo scaffold file already exists, skipping: ${entry.relativePath}`);
89
+ skipped++;
90
+ continue;
91
+ }
92
+ ctx.executor.ensureDirectory(node_path_1.default.dirname(target));
93
+ ctx.executor.writeFile(target, entry.content, {
94
+ description: `scaffold repo/${entry.relativePath}`,
95
+ });
96
+ created++;
97
+ }
98
+ ctx.logger.info(`Repo scaffold: ${created} file(s) created, ${skipped} existing file(s) preserved.`);
99
+ }
100
+ exports.repoScaffoldStage = {
101
+ id: 'repo-scaffold',
102
+ title: 'Generate project architecture scaffold',
103
+ recovery: [
104
+ 'Verify write permissions for docs/architecture/repo/ directory.',
105
+ 'Run collab init --resume to retry scaffold generation.',
106
+ ],
107
+ run: (ctx) => {
108
+ generateRepoScaffold(ctx);
109
+ },
110
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contractsReadme = void 0;
4
+ exports.contractsReadme = `# Contracts
5
+
6
+ > API contracts, interfaces, and integration boundaries.
7
+
8
+ This directory documents the contracts between domains, services, and
9
+ external systems.
10
+
11
+ ## Types of Contracts
12
+
13
+ - **Internal** — Interfaces between domains within the codebase.
14
+ - **External** — APIs exposed to or consumed from external systems.
15
+ - **Event** — Async message contracts (if applicable).
16
+
17
+ ## Format
18
+
19
+ \`\`\`markdown
20
+ # Contract: <Name>
21
+
22
+ **Type:** internal | external | event
23
+ **Confidence:** HIGH | MEDIUM | LOW
24
+
25
+ ## Parties
26
+
27
+ Who produces and who consumes this contract.
28
+
29
+ ## Specification
30
+
31
+ The contract details (endpoints, message formats, interfaces).
32
+
33
+ ## Guarantees
34
+
35
+ What invariants this contract maintains.
36
+ \`\`\`
37
+
38
+ <!-- AI-GENERATED: PLACEHOLDER -->
39
+ `;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.domainReadme = void 0;
4
+ exports.domainReadme = `# Domains
5
+
6
+ > Bounded contexts and domain boundaries identified in this codebase.
7
+
8
+ Each domain is documented in its own file describing:
9
+
10
+ - **Responsibilities** — What the domain owns.
11
+ - **Boundaries** — Where the domain starts and ends.
12
+ - **Dependencies** — Which other domains it depends on.
13
+ - **Public API** — How other domains interact with it.
14
+
15
+ ## Format
16
+
17
+ \`\`\`markdown
18
+ # Domain: <Name>
19
+
20
+ **Confidence:** HIGH | MEDIUM | LOW
21
+
22
+ ## Responsibilities
23
+
24
+ What this domain is responsible for.
25
+
26
+ ## Boundaries
27
+
28
+ Key directories, modules, or packages that belong to this domain.
29
+
30
+ ## Dependencies
31
+
32
+ Other domains this domain depends on and why.
33
+
34
+ ## Public API
35
+
36
+ Contracts or interfaces this domain exposes.
37
+ \`\`\`
38
+
39
+ <!-- AI-GENERATED: PLACEHOLDER -->
40
+ `;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deprecatedTemplate = exports.upgradeGuideTemplate = exports.changelogTemplate = void 0;
4
+ exports.changelogTemplate = `# Architecture Changelog
5
+
6
+ > Track of significant architectural changes over time.
7
+
8
+ ## Format
9
+
10
+ Entries are ordered newest-first, grouped by date.
11
+
12
+ ---
13
+
14
+ ## [Unreleased]
15
+
16
+ - Initial canonical architecture scaffold generated by \`collab init\`.
17
+ `;
18
+ exports.upgradeGuideTemplate = `# Upgrade Guide
19
+
20
+ > Instructions for migrating between canonical schema versions.
21
+
22
+ ## Current Version: 1.0.0
23
+
24
+ This is the initial version. No migrations needed.
25
+
26
+ ---
27
+
28
+ ## Future Migrations
29
+
30
+ When the schema version changes, migration instructions will be
31
+ documented here with before/after examples.
32
+ `;
33
+ exports.deprecatedTemplate = `# Deprecated Entries
34
+
35
+ > Canonical entries that have been superseded or invalidated.
36
+
37
+ When an axiom, decision, convention, or anti-pattern is no longer valid,
38
+ it is moved here with a rationale explaining why.
39
+
40
+ ## Format
41
+
42
+ \`\`\`markdown
43
+ ### <ID>: <Title>
44
+
45
+ **Deprecated:** YYYY-MM-DD
46
+ **Reason:** Why this entry was deprecated.
47
+ **Superseded by:** <new-ID> (if applicable)
48
+ \`\`\`
49
+
50
+ ---
51
+
52
+ _No deprecated entries yet._
53
+ `;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confidenceLevelsTemplate = void 0;
4
+ exports.confidenceLevelsTemplate = `# Confidence Levels
5
+
6
+ > How confidence is assigned to canonical entries.
7
+
8
+ ## Levels
9
+
10
+ ### HIGH
11
+
12
+ The entry is verified by multiple independent signals:
13
+
14
+ - Source code structure confirms the pattern.
15
+ - Tests exercise the behavior.
16
+ - Existing documentation corroborates the decision.
17
+
18
+ ### MEDIUM
19
+
20
+ The entry is verified by at least one signal:
21
+
22
+ - Code structure suggests the pattern.
23
+ - A single test or doc reference supports it.
24
+
25
+ ### LOW
26
+
27
+ The entry is inferred from indirect evidence:
28
+
29
+ - Code comments or naming conventions hint at the pattern.
30
+ - AI analysis identified it but no direct verification exists.
31
+
32
+ ## Promotion Rules
33
+
34
+ - Entries at **LOW** should be verified within 2 sprint cycles.
35
+ - If not verified, they move to \`evolution/deprecated.md\` with rationale.
36
+ - Entries at **MEDIUM** can be promoted to **HIGH** when additional
37
+ verification signals are added (tests, docs, or PR review confirmation).
38
+ `;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.implementationProcessTemplate = void 0;
4
+ exports.implementationProcessTemplate = `# Implementation Process
5
+
6
+ > GOV-R-001 — How canonical architecture documentation is maintained.
7
+
8
+ ## Process Overview
9
+
10
+ 1. **Analysis** — AI or developer analyzes the repository to identify
11
+ architectural patterns, decisions, and conventions.
12
+ 2. **Generation** — Canonical files are generated or updated in
13
+ \`docs/architecture/\`.
14
+ 3. **Review** — Changes go through the standard PR review process.
15
+ 4. **Merge** — Accepted changes are merged to the main branch.
16
+ 5. **Ingestion** (indexed mode only) — Merged files are ingested into the
17
+ vector and graph databases for retrieval.
18
+
19
+ ## PR Workflow
20
+
21
+ Every pull request that modifies source code SHOULD also update the
22
+ relevant canonical files:
23
+
24
+ - New architectural decisions → \`knowledge/decisions/ADR-NNN-*.md\`
25
+ - New conventions observed → \`knowledge/conventions/CN-NNN-*.md\`
26
+ - Anti-pattern fixes → \`knowledge/anti-patterns/AP-NNN-*.md\`
27
+ - Domain boundary changes → \`domains/*.md\`
28
+
29
+ ## Automation
30
+
31
+ - \`collab init\` generates the initial scaffold and runs AI analysis.
32
+ - CI workflows validate architecture consistency on PRs.
33
+ - Merge workflows trigger re-ingestion (indexed mode only).
34
+ `;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reviewProcessTemplate = void 0;
4
+ exports.reviewProcessTemplate = `# Review Process
5
+
6
+ > How changes to the canonical architecture are reviewed and approved.
7
+
8
+ ## Review Criteria
9
+
10
+ All changes to \`docs/architecture/\` MUST be reviewed for:
11
+
12
+ 1. **Accuracy** — Does the entry reflect the actual codebase?
13
+ 2. **Completeness** — Are all relevant aspects covered?
14
+ 3. **Consistency** — Does it follow the established formats (ID schemes,
15
+ confidence levels)?
16
+ 4. **Non-duplication** — Is it truly new knowledge, not a restatement?
17
+
18
+ ## Reviewers
19
+
20
+ - Architecture changes SHOULD be reviewed by at least one developer
21
+ familiar with the affected domain.
22
+ - AI-generated entries MUST be reviewed by a human before merge.
23
+
24
+ ## Merge Policy
25
+
26
+ - All canonical changes go through standard PR review.
27
+ - Auto-generated entries include an \`<!-- AI-GENERATED -->\` marker.
28
+ - Reviewers should focus on verifying accuracy, not style.
29
+ `;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schemaVersioningTemplate = void 0;
4
+ exports.schemaVersioningTemplate = `# Schema Versioning
5
+
6
+ > Policy for versioning the canonical architecture schema.
7
+
8
+ ## Version Format
9
+
10
+ The canonical schema follows semantic versioning: \`MAJOR.MINOR.PATCH\`
11
+
12
+ - **MAJOR** — Breaking changes to the directory structure or file formats.
13
+ - **MINOR** — New categories, fields, or optional sections added.
14
+ - **PATCH** — Clarifications, typo fixes, template updates.
15
+
16
+ ## Current Version
17
+
18
+ \`1.0.0\`
19
+
20
+ ## Compatibility
21
+
22
+ - Tools MUST check the schema version before processing canonical files.
23
+ - Older tools SHOULD gracefully handle unknown fields (ignore, don't fail).
24
+ - Migration guides live in \`evolution/upgrade-guide.md\`.
25
+ `;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.whatEntersTheCanonTemplate = void 0;
4
+ exports.whatEntersTheCanonTemplate = `# What Enters the Canon
5
+
6
+ > This document defines the governance rules for the canonical architecture
7
+ > documentation of this repository.
8
+
9
+ ## Purpose
10
+
11
+ The **canon** is the single source of truth for architecture knowledge.
12
+ Every statement that lives here MUST be verifiable against the actual codebase.
13
+
14
+ ## Entry Criteria
15
+
16
+ A piece of knowledge enters the canon when it meets ALL of the following:
17
+
18
+ 1. **Verifiable** — It can be confirmed by inspecting the source code.
19
+ 2. **Stable** — It reflects a deliberate decision, not an accident or WIP.
20
+ 3. **Impactful** — It affects how developers reason about or extend the system.
21
+
22
+ ## Categories
23
+
24
+ | Category | ID Format | Description |
25
+ |----------|-----------|-------------|
26
+ | Axioms | AX-NNN | Invariants that MUST always hold |
27
+ | Decisions | ADR-NNN | Architecture Decision Records |
28
+ | Conventions | CN-NNN | Coding and design conventions |
29
+ | Anti-patterns | AP-NNN | Known pitfalls to avoid |
30
+
31
+ ## Confidence Levels
32
+
33
+ Each entry carries a confidence level:
34
+
35
+ - **HIGH** — Verified by multiple signals (code, tests, docs).
36
+ - **MEDIUM** — Verified by at least one signal.
37
+ - **LOW** — Inferred, pending verification.
38
+
39
+ ## Lifecycle
40
+
41
+ 1. **Proposed** — Entry drafted (manually or by AI analysis).
42
+ 2. **Accepted** — Reviewed and merged via PR.
43
+ 3. **Deprecated** — Superseded; moved to \`evolution/deprecated.md\`.
44
+ `;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemPromptTemplate = exports.deprecatedTemplate = exports.upgradeGuideTemplate = exports.changelogTemplate = exports.contractsReadme = exports.domainReadme = exports.knowledgeAntiPatternsReadme = exports.knowledgeConventionsReadme = exports.knowledgeDecisionsReadme = exports.knowledgeAxiomsReadme = exports.reviewProcessTemplate = exports.confidenceLevelsTemplate = exports.schemaVersioningTemplate = exports.implementationProcessTemplate = exports.whatEntersTheCanonTemplate = void 0;
4
+ var what_enters_the_canon_1 = require("./governance/what-enters-the-canon");
5
+ Object.defineProperty(exports, "whatEntersTheCanonTemplate", { enumerable: true, get: function () { return what_enters_the_canon_1.whatEntersTheCanonTemplate; } });
6
+ var implementation_process_1 = require("./governance/implementation-process");
7
+ Object.defineProperty(exports, "implementationProcessTemplate", { enumerable: true, get: function () { return implementation_process_1.implementationProcessTemplate; } });
8
+ var schema_versioning_1 = require("./governance/schema-versioning");
9
+ Object.defineProperty(exports, "schemaVersioningTemplate", { enumerable: true, get: function () { return schema_versioning_1.schemaVersioningTemplate; } });
10
+ var confidence_levels_1 = require("./governance/confidence-levels");
11
+ Object.defineProperty(exports, "confidenceLevelsTemplate", { enumerable: true, get: function () { return confidence_levels_1.confidenceLevelsTemplate; } });
12
+ var review_process_1 = require("./governance/review-process");
13
+ Object.defineProperty(exports, "reviewProcessTemplate", { enumerable: true, get: function () { return review_process_1.reviewProcessTemplate; } });
14
+ var knowledge_readme_1 = require("./knowledge-readme");
15
+ Object.defineProperty(exports, "knowledgeAxiomsReadme", { enumerable: true, get: function () { return knowledge_readme_1.knowledgeAxiomsReadme; } });
16
+ Object.defineProperty(exports, "knowledgeDecisionsReadme", { enumerable: true, get: function () { return knowledge_readme_1.knowledgeDecisionsReadme; } });
17
+ Object.defineProperty(exports, "knowledgeConventionsReadme", { enumerable: true, get: function () { return knowledge_readme_1.knowledgeConventionsReadme; } });
18
+ Object.defineProperty(exports, "knowledgeAntiPatternsReadme", { enumerable: true, get: function () { return knowledge_readme_1.knowledgeAntiPatternsReadme; } });
19
+ var domain_readme_1 = require("./domain-readme");
20
+ Object.defineProperty(exports, "domainReadme", { enumerable: true, get: function () { return domain_readme_1.domainReadme; } });
21
+ var contracts_readme_1 = require("./contracts-readme");
22
+ Object.defineProperty(exports, "contractsReadme", { enumerable: true, get: function () { return contracts_readme_1.contractsReadme; } });
23
+ var changelog_1 = require("./evolution/changelog");
24
+ Object.defineProperty(exports, "changelogTemplate", { enumerable: true, get: function () { return changelog_1.changelogTemplate; } });
25
+ Object.defineProperty(exports, "upgradeGuideTemplate", { enumerable: true, get: function () { return changelog_1.upgradeGuideTemplate; } });
26
+ Object.defineProperty(exports, "deprecatedTemplate", { enumerable: true, get: function () { return changelog_1.deprecatedTemplate; } });
27
+ var system_prompt_1 = require("./system-prompt");
28
+ Object.defineProperty(exports, "systemPromptTemplate", { enumerable: true, get: function () { return system_prompt_1.systemPromptTemplate; } });
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.knowledgeAntiPatternsReadme = exports.knowledgeConventionsReadme = exports.knowledgeDecisionsReadme = exports.knowledgeAxiomsReadme = void 0;
4
+ exports.knowledgeAxiomsReadme = `# Axioms
5
+
6
+ > Invariants that MUST always hold in this codebase.
7
+
8
+ Axioms use the ID format \`AX-NNN\` and represent fundamental truths about
9
+ the system that should never be violated.
10
+
11
+ ## Format
12
+
13
+ Each axiom file follows this structure:
14
+
15
+ \`\`\`markdown
16
+ # AX-NNN: Short Title
17
+
18
+ **Confidence:** HIGH | MEDIUM | LOW
19
+ **Verified:** YYYY-MM-DD
20
+
21
+ ## Statement
22
+
23
+ One-sentence invariant.
24
+
25
+ ## Rationale
26
+
27
+ Why this axiom exists.
28
+
29
+ ## Verification
30
+
31
+ How to confirm this axiom holds.
32
+ \`\`\`
33
+
34
+ <!-- AI-GENERATED: PLACEHOLDER -->
35
+ `;
36
+ exports.knowledgeDecisionsReadme = `# Architectural Decisions
37
+
38
+ > ADRs documenting key architectural choices.
39
+
40
+ Decisions use the ID format \`ADR-NNN\` and follow a lightweight ADR format.
41
+
42
+ ## Format
43
+
44
+ Each decision file follows this structure:
45
+
46
+ \`\`\`markdown
47
+ # ADR-NNN: Short Title
48
+
49
+ **Status:** Proposed | Accepted | Deprecated | Superseded
50
+ **Date:** YYYY-MM-DD
51
+ **Confidence:** HIGH | MEDIUM | LOW
52
+
53
+ ## Context
54
+
55
+ What prompted this decision.
56
+
57
+ ## Decision
58
+
59
+ What was decided.
60
+
61
+ ## Consequences
62
+
63
+ What follows from this decision.
64
+ \`\`\`
65
+
66
+ <!-- AI-GENERATED: PLACEHOLDER -->
67
+ `;
68
+ exports.knowledgeConventionsReadme = `# Conventions
69
+
70
+ > Coding and design conventions followed in this codebase.
71
+
72
+ Conventions use the ID format \`CN-NNN\`.
73
+
74
+ ## Format
75
+
76
+ Each convention file follows this structure:
77
+
78
+ \`\`\`markdown
79
+ # CN-NNN: Short Title
80
+
81
+ **Confidence:** HIGH | MEDIUM | LOW
82
+ **Scope:** project | module | file
83
+
84
+ ## Convention
85
+
86
+ What the convention is.
87
+
88
+ ## Examples
89
+
90
+ Code examples demonstrating the convention.
91
+
92
+ ## Rationale
93
+
94
+ Why this convention exists.
95
+ \`\`\`
96
+
97
+ <!-- AI-GENERATED: PLACEHOLDER -->
98
+ `;
99
+ exports.knowledgeAntiPatternsReadme = `# Anti-Patterns
100
+
101
+ > Known pitfalls and patterns to avoid in this codebase.
102
+
103
+ Anti-patterns use the ID format \`AP-NNN\`.
104
+
105
+ ## Format
106
+
107
+ Each anti-pattern file follows this structure:
108
+
109
+ \`\`\`markdown
110
+ # AP-NNN: Short Title
111
+
112
+ **Confidence:** HIGH | MEDIUM | LOW
113
+ **Severity:** critical | warning | info
114
+
115
+ ## Problem
116
+
117
+ What the anti-pattern looks like.
118
+
119
+ ## Why It's Harmful
120
+
121
+ Why this pattern should be avoided.
122
+
123
+ ## Alternative
124
+
125
+ The preferred approach.
126
+ \`\`\`
127
+
128
+ <!-- AI-GENERATED: PLACEHOLDER -->
129
+ `;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemPromptTemplate = void 0;
4
+ exports.systemPromptTemplate = `You are an architecture analyst. Your task is to analyze a software repository
5
+ and generate canonical architecture documentation following the collab-architecture format.
6
+
7
+ ## Output Requirements
8
+
9
+ For each category, generate entries using the specified ID format:
10
+
11
+ ### Axioms (AX-NNN)
12
+ Identify invariants that MUST always hold in this codebase.
13
+ - Look for patterns enforced by types, assertions, or structural constraints.
14
+ - Each axiom should be a single verifiable statement.
15
+
16
+ ### Architectural Decisions (ADR-NNN)
17
+ Document key architectural choices visible in the code.
18
+ - Framework and library selections.
19
+ - Structural patterns (monolith, microservices, modular monolith).
20
+ - Data flow and state management approaches.
21
+
22
+ ### Conventions (CN-NNN)
23
+ Identify coding and design conventions consistently followed.
24
+ - Naming patterns, file organization, error handling strategies.
25
+ - Testing patterns, import conventions, module boundaries.
26
+
27
+ ### Anti-Patterns (AP-NNN)
28
+ Flag patterns that should be avoided based on the codebase context.
29
+ - Inconsistencies that suggest accidental complexity.
30
+ - Deprecated patterns still present that should be migrated.
31
+
32
+ ### Domains
33
+ Identify bounded contexts and domain boundaries.
34
+ - Group related functionality into logical domains.
35
+ - Map dependencies between domains.
36
+
37
+ ## Output Format
38
+
39
+ Return a JSON object with the following structure:
40
+
41
+ \`\`\`json
42
+ {
43
+ "axioms": [
44
+ {
45
+ "id": "AX-001",
46
+ "title": "Short title",
47
+ "confidence": "HIGH|MEDIUM|LOW",
48
+ "statement": "The invariant statement",
49
+ "rationale": "Why this axiom exists",
50
+ "verification": "How to verify this holds"
51
+ }
52
+ ],
53
+ "decisions": [
54
+ {
55
+ "id": "ADR-001",
56
+ "title": "Short title",
57
+ "status": "Accepted",
58
+ "confidence": "HIGH|MEDIUM|LOW",
59
+ "context": "What prompted this decision",
60
+ "decision": "What was decided",
61
+ "consequences": "What follows from this"
62
+ }
63
+ ],
64
+ "conventions": [
65
+ {
66
+ "id": "CN-001",
67
+ "title": "Short title",
68
+ "confidence": "HIGH|MEDIUM|LOW",
69
+ "scope": "project|module|file",
70
+ "convention": "What the convention is",
71
+ "examples": "Brief code example",
72
+ "rationale": "Why this convention exists"
73
+ }
74
+ ],
75
+ "antiPatterns": [
76
+ {
77
+ "id": "AP-001",
78
+ "title": "Short title",
79
+ "confidence": "HIGH|MEDIUM|LOW",
80
+ "severity": "critical|warning|info",
81
+ "problem": "What the anti-pattern looks like",
82
+ "harm": "Why it is harmful",
83
+ "alternative": "The preferred approach"
84
+ }
85
+ ],
86
+ "domains": [
87
+ {
88
+ "name": "Domain Name",
89
+ "confidence": "HIGH|MEDIUM|LOW",
90
+ "responsibilities": "What this domain owns",
91
+ "boundaries": "Key directories and modules",
92
+ "dependencies": "Other domains it depends on",
93
+ "publicApi": "Interfaces it exposes"
94
+ }
95
+ ]
96
+ }
97
+ \`\`\`
98
+
99
+ Be precise and factual. Only document what is verifiable in the code.
100
+ Assign confidence levels honestly — use LOW for inferences.
101
+ `;