sinapse-ai 1.12.2 → 1.14.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/.claude/CLAUDE.md +2 -2
- package/.claude/rules/agent-memory-imports.md +4 -0
- package/.sinapse-ai/cli/commands/pro/index.js +8 -48
- package/.sinapse-ai/constitution.md +6 -2
- package/.sinapse-ai/data/entity-registry.yaml +63 -429
- package/.sinapse-ai/development/agents/analyst/MEMORY.md +19 -0
- package/.sinapse-ai/development/agents/architect/MEMORY.md +52 -0
- package/.sinapse-ai/development/agents/data-engineer/MEMORY.md +55 -0
- package/.sinapse-ai/development/agents/developer/MEMORY.md +53 -0
- package/.sinapse-ai/development/agents/devops/MEMORY.md +56 -0
- package/.sinapse-ai/development/agents/product-lead/MEMORY.md +53 -0
- package/.sinapse-ai/development/agents/project-lead/MEMORY.md +53 -0
- package/.sinapse-ai/development/agents/quality-gate/MEMORY.md +52 -0
- package/.sinapse-ai/development/agents/snps-orqx.md +15 -0
- package/.sinapse-ai/development/agents/sprint-lead/MEMORY.md +53 -0
- package/.sinapse-ai/development/agents/squad-creator.md +15 -0
- package/.sinapse-ai/development/agents/ux/MEMORY.md +21 -0
- package/.sinapse-ai/development/templates/chrome-brain/knowledge-base/chrome-brain.md +2 -2
- package/.sinapse-ai/infrastructure/scripts/ide-sync/index.js +15 -0
- package/.sinapse-ai/infrastructure/scripts/validate-agents.js +159 -8
- package/.sinapse-ai/install-manifest.yaml +16 -152
- package/AGENTS.md +13 -2
- package/CHANGELOG.md +135 -3
- package/README.en.md +1 -1
- package/README.md +6 -26
- package/bin/cli.js +2 -7
- package/bin/commands/install.js +19 -257
- package/bin/commands/update.js +18 -78
- package/bin/lib/command-generator.js +261 -0
- package/bin/lib/prompts.js +2 -65
- package/bin/modules/chrome-brain-installer.js +2 -1
- package/bin/postinstall.js +6 -6
- package/docs/getting-started.md +0 -1
- package/docs/pt/getting-started.md +1 -1
- package/docs/security/dependabot-triage.md +17 -17
- package/package.json +6 -3
- package/packages/installer/src/wizard/i18n.js +3 -204
- package/packages/installer/src/wizard/index.js +1 -1
- package/packages/installer/src/wizard/questions.js +5 -368
- package/packages/installer/src/wizard/wizard.js +0 -9
- package/scripts/generate-install-manifest.js +6 -0
- package/scripts/validate-changelog-tags.js +97 -0
- package/scripts/validate-no-personal-leaks.js +184 -28
- package/scripts/validate-schemas.js +55 -10
- package/scripts/validate-story-meta.js +25 -12
- package/squads/claude-code-mastery/agents/claude-mastery-chief.md +15 -1
- package/squads/claude-code-mastery/agents/config-engineer.md +15 -0
- package/squads/claude-code-mastery/agents/hooks-architect.md +27 -20
- package/squads/claude-code-mastery/agents/mcp-integrator.md +15 -0
- package/squads/claude-code-mastery/agents/project-integrator.md +15 -0
- package/squads/claude-code-mastery/agents/roadmap-sentinel.md +15 -0
- package/squads/claude-code-mastery/agents/skill-craftsman.md +15 -0
- package/squads/claude-code-mastery/agents/swarm-orqx.md +15 -0
- package/squads/claude-code-mastery/tasks/audit-setup.md +1 -1
- package/squads/squad-animations/agents/animation-interpreter.md +15 -0
- package/squads/squad-animations/agents/animation-performance-engineer.md +15 -0
- package/squads/squad-animations/agents/animations-orqx.md +13 -0
- package/squads/squad-animations/agents/css-motion-artist.md +15 -0
- package/squads/squad-animations/agents/generative-particle-engineer.md +15 -0
- package/squads/squad-animations/agents/motion-choreographer.md +15 -0
- package/squads/squad-animations/agents/scroll-narrative-engineer.md +15 -0
- package/squads/squad-animations/agents/shader-artist.md +15 -0
- package/squads/squad-animations/agents/threejs-architect.md +15 -0
- package/squads/squad-brand/agents/brand-archetype-strategist.md +13 -0
- package/squads/squad-brand/agents/brand-auditor.md +15 -0
- package/squads/squad-brand/agents/brand-collateral-designer.md +15 -0
- package/squads/squad-brand/agents/brand-compiler.md +13 -0
- package/squads/squad-brand/agents/brand-creative-engineer.md +15 -0
- package/squads/squad-brand/agents/brand-culture-architect.md +15 -0
- package/squads/squad-brand/agents/brand-growth-strategist.md +15 -0
- package/squads/squad-brand/agents/brand-identity-designer.md +15 -0
- package/squads/squad-brand/agents/brand-motion-vfx.md +15 -0
- package/squads/squad-brand/agents/brand-naming-specialist.md +15 -0
- package/squads/squad-brand/agents/brand-orqx.md +13 -0
- package/squads/squad-brand/agents/brand-positioning-strategist.md +15 -0
- package/squads/squad-brand/agents/brand-sonic-designer.md +15 -0
- package/squads/squad-brand/agents/brand-strategist.md +15 -0
- package/squads/squad-brand/agents/brand-system-architect.md +15 -0
- package/squads/squad-cloning/agents/agent-forger.md +15 -0
- package/squads/squad-cloning/agents/cloning-orqx.md +15 -0
- package/squads/squad-cloning/agents/cognitive-extractor.md +15 -0
- package/squads/squad-cloning/agents/content-capturer.md +15 -0
- package/squads/squad-cloning/agents/kb-architect.md +15 -0
- package/squads/squad-cloning/agents/mind-synthesizer.md +15 -0
- package/squads/squad-cloning/agents/sop-extractor.md +15 -0
- package/squads/squad-cloning/agents/source-hunter.md +13 -0
- package/squads/squad-cloning/agents/squad-assembler.md +15 -0
- package/squads/squad-commercial/agents/commercial-orqx.md +13 -0
- package/squads/squad-commercial/agents/cs-business-auditor.md +15 -0
- package/squads/squad-commercial/agents/cs-client-success.md +15 -0
- package/squads/squad-commercial/agents/cs-crm-specialist.md +15 -0
- package/squads/squad-commercial/agents/cs-funnel-architect.md +15 -0
- package/squads/squad-commercial/agents/cs-lead-generation-strategist.md +15 -0
- package/squads/squad-commercial/agents/cs-offer-designer.md +15 -0
- package/squads/squad-commercial/agents/cs-revops-analyst.md +15 -0
- package/squads/squad-commercial/agents/cs-sales-closer.md +13 -0
- package/squads/squad-commercial/agents/cs-sales-enablement.md +15 -0
- package/squads/squad-content/agents/content-analyst.md +13 -0
- package/squads/squad-content/agents/content-engineer.md +15 -0
- package/squads/squad-content/agents/content-governor.md +13 -0
- package/squads/squad-content/agents/content-orqx.md +13 -0
- package/squads/squad-content/agents/editorial-strategist.md +15 -0
- package/squads/squad-content/agents/platform-specialist.md +15 -0
- package/squads/squad-content/agents/signal-intelligence.md +13 -0
- package/squads/squad-copy/agents/ad-copywriter.md +13 -0
- package/squads/squad-copy/agents/brand-voice-writer.md +15 -0
- package/squads/squad-copy/agents/conversion-writer.md +13 -0
- package/squads/squad-copy/agents/copy-editor.md +15 -0
- package/squads/squad-copy/agents/copy-orqx.md +13 -0
- package/squads/squad-copy/agents/copy-strategist.md +15 -0
- package/squads/squad-copy/agents/direct-response-writer.md +15 -0
- package/squads/squad-copy/agents/email-sequence-strategist.md +15 -0
- package/squads/squad-copy/agents/funnel-copywriter.md +15 -0
- package/squads/squad-copy/agents/headline-specialist.md +13 -0
- package/squads/squad-copy/agents/long-form-writer.md +15 -0
- package/squads/squad-copy/agents/persuasion-psychologist.md +15 -0
- package/squads/squad-copy/agents/proof-architect.md +15 -0
- package/squads/squad-council/agents/brene-brown.md +13 -0
- package/squads/squad-council/agents/charlie-munger.md +13 -0
- package/squads/squad-council/agents/council-orqx.md +13 -0
- package/squads/squad-council/agents/derek-sivers.md +13 -0
- package/squads/squad-council/agents/naval-ravikant.md +13 -0
- package/squads/squad-council/agents/patrick-lencioni.md +15 -0
- package/squads/squad-council/agents/peter-thiel.md +13 -0
- package/squads/squad-council/agents/ray-dalio.md +13 -0
- package/squads/squad-council/agents/reid-hoffman.md +13 -0
- package/squads/squad-council/agents/simon-sinek.md +15 -0
- package/squads/squad-council/agents/yvon-chouinard.md +13 -0
- package/squads/squad-courses/agents/assessment-creator.md +15 -0
- package/squads/squad-courses/agents/content-writer.md +15 -0
- package/squads/squad-courses/agents/courses-orqx.md +15 -0
- package/squads/squad-courses/agents/curriculum-designer.md +15 -0
- package/squads/squad-courses/agents/launch-strategist.md +15 -0
- package/squads/squad-courses/agents/lesson-architect.md +15 -0
- package/squads/squad-courses/agents/production-director.md +13 -0
- package/squads/squad-courses/agents/slide-designer.md +15 -0
- package/squads/squad-cybersecurity/agents/cloud-security-engineer.md +15 -0
- package/squads/squad-cybersecurity/agents/compliance-officer.md +15 -0
- package/squads/squad-cybersecurity/agents/cyber-orqx.md +15 -0
- package/squads/squad-cybersecurity/agents/incident-responder.md +15 -0
- package/squads/squad-cybersecurity/agents/network-security-engineer.md +15 -0
- package/squads/squad-cybersecurity/agents/penetration-tester.md +15 -0
- package/squads/squad-cybersecurity/agents/soc-analyst.md +15 -0
- package/squads/squad-cybersecurity/agents/threat-analyst.md +15 -0
- package/squads/squad-design/agents/cro-persuasion.md +15 -0
- package/squads/squad-design/agents/design-orqx.md +13 -0
- package/squads/squad-design/agents/design-system.md +15 -0
- package/squads/squad-design/agents/dx-accessibility-specialist.md +15 -0
- package/squads/squad-design/agents/dx-design-system-architect.md +15 -0
- package/squads/squad-design/agents/dx-frontend-engineer.md +15 -0
- package/squads/squad-design/agents/dx-interaction-designer.md +15 -0
- package/squads/squad-design/agents/dx-performance-engineer.md +15 -0
- package/squads/squad-design/agents/dx-ui-designer.md +15 -0
- package/squads/squad-design/agents/dx-ux-strategist.md +15 -0
- package/squads/squad-design/agents/platform-aesthetic-director.md +15 -0
- package/squads/squad-design/agents/premium-packaging-strategist.md +15 -0
- package/squads/squad-design/agents/product-surface-director.md +15 -0
- package/squads/squad-design/agents/ux-designer.md +15 -0
- package/squads/squad-finance/agents/budget-controller.md +15 -0
- package/squads/squad-finance/agents/cost-optimizer.md +15 -0
- package/squads/squad-finance/agents/finance-orqx.md +15 -0
- package/squads/squad-finance/agents/fiscal-compliance-br.md +15 -0
- package/squads/squad-finance/agents/forecast-strategist.md +15 -0
- package/squads/squad-finance/agents/pricing-strategist.md +15 -0
- package/squads/squad-finance/agents/profitability-analyst.md +15 -0
- package/squads/squad-finance/agents/revenue-analyst.md +15 -0
- package/squads/squad-growth/agents/ga-analytics-engineer.md +15 -0
- package/squads/squad-growth/agents/ga-campaign-analyst.md +15 -0
- package/squads/squad-growth/agents/ga-cro-specialist.md +15 -0
- package/squads/squad-growth/agents/ga-data-analyst.md +13 -0
- package/squads/squad-growth/agents/ga-growth-hacker.md +15 -0
- package/squads/squad-growth/agents/ga-seo-strategist.md +15 -0
- package/squads/squad-growth/agents/growth-orqx.md +15 -0
- package/squads/squad-paidmedia/agents/campaign-analyst.md +15 -0
- package/squads/squad-paidmedia/agents/creative-strategist.md +15 -0
- package/squads/squad-paidmedia/agents/cro-specialist.md +15 -0
- package/squads/squad-paidmedia/agents/google-ads-specialist.md +15 -0
- package/squads/squad-paidmedia/agents/meta-ads-specialist.md +15 -0
- package/squads/squad-paidmedia/agents/paidmedia-orqx.md +15 -0
- package/squads/squad-paidmedia/agents/performance-engineer.md +15 -0
- package/squads/squad-paidmedia/agents/pm-creative-performance-analyst.md +15 -0
- package/squads/squad-paidmedia/agents/pm-youtube-ads-specialist.md +15 -0
- package/squads/squad-product/agents/product-orqx.md +13 -1
- package/squads/squad-product/agents/ps-client-product-manager.md +13 -1
- package/squads/squad-product/agents/ps-delivery-manager.md +13 -1
- package/squads/squad-product/agents/ps-discovery-lead.md +15 -1
- package/squads/squad-product/agents/ps-product-analyst.md +15 -1
- package/squads/squad-product/agents/ps-product-ops-specialist.md +15 -1
- package/squads/squad-product/agents/ps-product-strategist.md +15 -1
- package/squads/squad-research/agents/audience-intelligence.md +15 -0
- package/squads/squad-research/agents/competitive-intelligence.md +15 -0
- package/squads/squad-research/agents/data-synthesizer.md +15 -0
- package/squads/squad-research/agents/deep-researcher.md +15 -0
- package/squads/squad-research/agents/market-analyst.md +15 -0
- package/squads/squad-research/agents/research-orqx.md +15 -0
- package/squads/squad-research/agents/trend-forecaster.md +15 -0
- package/squads/squad-storytelling/agents/blake-snyder.md +13 -0
- package/squads/squad-storytelling/agents/dan-harmon.md +13 -0
- package/squads/squad-storytelling/agents/joseph-campbell.md +13 -0
- package/squads/squad-storytelling/agents/keith-johnstone.md +13 -0
- package/squads/squad-storytelling/agents/kindra-hall.md +15 -0
- package/squads/squad-storytelling/agents/marshall-ganz.md +15 -0
- package/squads/squad-storytelling/agents/nancy-duarte.md +15 -0
- package/squads/squad-storytelling/agents/oren-klaff.md +15 -0
- package/squads/squad-storytelling/agents/park-howell.md +13 -0
- package/squads/squad-storytelling/agents/storytelling-orqx.md +13 -0
- package/.sinapse-ai/core/grounding/README.md +0 -83
- package/.sinapse-ai/core/grounding/brand.cjs +0 -29
- package/.sinapse-ai/core/grounding/config-loader.cjs +0 -52
- package/.sinapse-ai/core/grounding/design-system.cjs +0 -29
- package/.sinapse-ai/core/grounding/vault.cjs +0 -36
- package/.sinapse-ai/development/scripts/approval-workflow.js +0 -643
- package/.sinapse-ai/development/scripts/backup-manager.js +0 -607
- package/.sinapse-ai/development/scripts/branch-manager.js +0 -390
- package/.sinapse-ai/development/scripts/code-quality-improver.js +0 -1329
- package/.sinapse-ai/development/scripts/commit-message-generator.js +0 -850
- package/.sinapse-ai/development/scripts/conflict-resolver.js +0 -675
- package/.sinapse-ai/development/scripts/dependency-analyzer.js +0 -638
- package/.sinapse-ai/development/scripts/diff-generator.js +0 -352
- package/.sinapse-ai/development/scripts/git-wrapper.js +0 -462
- package/.sinapse-ai/development/scripts/modification-validator.js +0 -555
- package/.sinapse-ai/development/scripts/performance-analyzer.js +0 -758
- package/.sinapse-ai/development/scripts/refactoring-suggester.js +0 -1148
- package/.sinapse-ai/development/scripts/rollback-handler.js +0 -531
- package/.sinapse-ai/development/scripts/security-checker.js +0 -359
- package/.sinapse-ai/development/scripts/template-engine.js +0 -240
- package/.sinapse-ai/development/scripts/template-validator.js +0 -279
- package/.sinapse-ai/development/scripts/test-generator.js +0 -844
- package/.sinapse-ai/development/scripts/transaction-manager.js +0 -590
- package/.sinapse-ai/development/scripts/yaml-validator.js +0 -397
- package/.sinapse-ai/hooks/sinapse-brand-grounding.cjs +0 -162
- package/.sinapse-ai/hooks/sinapse-ds-grounding.cjs +0 -211
- package/.sinapse-ai/hooks/sinapse-vault-grounding.cjs +0 -194
- package/bin/lib/register-grounding-hooks.js +0 -145
- package/docs/guides/agents/traces/execution-traces.zip +0 -0
- package/docs/guides/grounding-setup.md +0 -154
- package/docs/guides/workflows/SINAPSE-WORKFLOWS.zip +0 -0
- package/packages/installer/src/pro/pro-scaffolder.js +0 -449
- package/packages/installer/src/wizard/grounding-config.js +0 -131
- package/packages/installer/src/wizard/pro-setup.js +0 -1439
- package/packages/installer/templates/README.md +0 -16
- package/packages/installer/templates/brand-routing.example.json +0 -12
- package/packages/installer/templates/ds-routing.example.json +0 -12
- package/packages/installer/templates/vault-routing.example.json +0 -12
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
const diffLib = require('diff');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const yaml = require('js-yaml');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generates visual diffs for component modifications
|
|
7
|
-
*/
|
|
8
|
-
class DiffGenerator {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.colors = {
|
|
11
|
-
added: chalk.green,
|
|
12
|
-
removed: chalk.red,
|
|
13
|
-
unchanged: chalk.gray,
|
|
14
|
-
header: chalk.cyan,
|
|
15
|
-
lineNumber: chalk.yellow
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generate a unified diff between two text contents
|
|
21
|
-
* @param {string} originalContent - Original file content
|
|
22
|
-
* @param {string} modifiedContent - Modified file content
|
|
23
|
-
* @param {string} fileName - Name of the file being diffed
|
|
24
|
-
* @param {Object} options - Diff options
|
|
25
|
-
* @returns {string} Formatted diff output
|
|
26
|
-
*/
|
|
27
|
-
generateUnifiedDiff(originalContent, modifiedContent, fileName, options = {}) {
|
|
28
|
-
const {
|
|
29
|
-
contextLines = 3,
|
|
30
|
-
showLineNumbers = true,
|
|
31
|
-
colorize = true
|
|
32
|
-
} = options;
|
|
33
|
-
|
|
34
|
-
const patch = diffLib.createPatch(
|
|
35
|
-
fileName,
|
|
36
|
-
originalContent,
|
|
37
|
-
modifiedContent,
|
|
38
|
-
'Current Version',
|
|
39
|
-
'Modified Version',
|
|
40
|
-
{ context: contextLines }
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
if (!colorize) {
|
|
44
|
-
return patch;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return this.colorizeDiff(patch, showLineNumbers);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Generate a diff specifically for YAML content
|
|
52
|
-
* @param {string} originalYaml - Original YAML content
|
|
53
|
-
* @param {string} modifiedYaml - Modified YAML content
|
|
54
|
-
* @param {string} componentName - Name of the component
|
|
55
|
-
* @returns {Object} Structured diff with sections
|
|
56
|
-
*/
|
|
57
|
-
generateYamlDiff(originalYaml, modifiedYaml, componentName) {
|
|
58
|
-
const original = yaml.load(originalYaml);
|
|
59
|
-
const modified = yaml.load(modifiedYaml);
|
|
60
|
-
|
|
61
|
-
const diff = {
|
|
62
|
-
component: componentName,
|
|
63
|
-
sections: {},
|
|
64
|
-
summary: {
|
|
65
|
-
added: [],
|
|
66
|
-
removed: [],
|
|
67
|
-
modified: []
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Compare top-level keys
|
|
72
|
-
const allKeys = new Set([...Object.keys(original), ...Object.keys(modified)]);
|
|
73
|
-
|
|
74
|
-
for (const key of allKeys) {
|
|
75
|
-
if (!original.hasOwnProperty(key)) {
|
|
76
|
-
diff.sections[key] = { status: 'added', value: modified[key] };
|
|
77
|
-
diff.summary.added.push(key);
|
|
78
|
-
} else if (!modified.hasOwnProperty(key)) {
|
|
79
|
-
diff.sections[key] = { status: 'removed', value: original[key] };
|
|
80
|
-
diff.summary.removed.push(key);
|
|
81
|
-
} else if (JSON.stringify(original[key]) !== JSON.stringify(modified[key])) {
|
|
82
|
-
diff.sections[key] = {
|
|
83
|
-
status: 'modified',
|
|
84
|
-
original: original[key],
|
|
85
|
-
modified: modified[key],
|
|
86
|
-
changes: this.compareValues(original[key], modified[key])
|
|
87
|
-
};
|
|
88
|
-
diff.summary.modified.push(key);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return diff;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Generate a structured diff for agents
|
|
97
|
-
* @param {string} originalContent - Original agent content
|
|
98
|
-
* @param {string} modifiedContent - Modified agent content
|
|
99
|
-
* @param {string} agentName - Name of the agent
|
|
100
|
-
* @returns {Object} Structured agent diff
|
|
101
|
-
*/
|
|
102
|
-
generateAgentDiff(originalContent, modifiedContent, agentName) {
|
|
103
|
-
// Split content into YAML and markdown sections
|
|
104
|
-
const originalParts = this.splitAgentContent(originalContent);
|
|
105
|
-
const modifiedParts = this.splitAgentContent(modifiedContent);
|
|
106
|
-
|
|
107
|
-
const yamlDiff = this.generateYamlDiff(
|
|
108
|
-
originalParts.yaml,
|
|
109
|
-
modifiedParts.yaml,
|
|
110
|
-
agentName
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const markdownDiff = this.generateUnifiedDiff(
|
|
114
|
-
originalParts.markdown,
|
|
115
|
-
modifiedParts.markdown,
|
|
116
|
-
`${agentName}.md`,
|
|
117
|
-
{ contextLines: 5 }
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
agent: agentName,
|
|
122
|
-
yamlChanges: yamlDiff,
|
|
123
|
-
markdownChanges: markdownDiff,
|
|
124
|
-
impactSummary: this.generateImpactSummary(yamlDiff)
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Generate a visual diff summary
|
|
130
|
-
* @param {Object} diff - Structured diff object
|
|
131
|
-
* @returns {string} Formatted summary
|
|
132
|
-
*/
|
|
133
|
-
generateDiffSummary(diff) {
|
|
134
|
-
const lines = [];
|
|
135
|
-
|
|
136
|
-
lines.push(this.colors.header('=== Modification Summary ==='));
|
|
137
|
-
lines.push('');
|
|
138
|
-
|
|
139
|
-
if (diff.summary) {
|
|
140
|
-
if (diff.summary.added.length > 0) {
|
|
141
|
-
lines.push(this.colors.added(`+ Added (${diff.summary.added.length}):`));
|
|
142
|
-
diff.summary.added.forEach(item => {
|
|
143
|
-
lines.push(this.colors.added(` + ${item}`));
|
|
144
|
-
});
|
|
145
|
-
lines.push('');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (diff.summary.modified.length > 0) {
|
|
149
|
-
lines.push(this.colors.header(`~ Modified (${diff.summary.modified.length}):`));
|
|
150
|
-
diff.summary.modified.forEach(item => {
|
|
151
|
-
lines.push(this.colors.header(` ~ ${item}`));
|
|
152
|
-
});
|
|
153
|
-
lines.push('');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (diff.summary.removed.length > 0) {
|
|
157
|
-
lines.push(this.colors.removed(`- Removed (${diff.summary.removed.length}):`));
|
|
158
|
-
diff.summary.removed.forEach(item => {
|
|
159
|
-
lines.push(this.colors.removed(` - ${item}`));
|
|
160
|
-
});
|
|
161
|
-
lines.push('');
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return lines.join('\n');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Split agent content into YAML and markdown sections
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
splitAgentContent(content) {
|
|
173
|
-
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
174
|
-
if (!match) {
|
|
175
|
-
throw new Error('Invalid agent content format');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
yaml: match[1],
|
|
180
|
-
markdown: match[2]
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Compare two values and generate change details
|
|
186
|
-
* @private
|
|
187
|
-
*/
|
|
188
|
-
compareValues(original, modified) {
|
|
189
|
-
const changes = [];
|
|
190
|
-
|
|
191
|
-
if (Array.isArray(original) && Array.isArray(modified)) {
|
|
192
|
-
const added = modified.filter(item => !original.includes(item));
|
|
193
|
-
const removed = original.filter(item => !modified.includes(item));
|
|
194
|
-
|
|
195
|
-
if (added.length > 0) {
|
|
196
|
-
changes.push({ type: 'added', items: added });
|
|
197
|
-
}
|
|
198
|
-
if (removed.length > 0) {
|
|
199
|
-
changes.push({ type: 'removed', items: removed });
|
|
200
|
-
}
|
|
201
|
-
} else if (typeof original === 'object' && typeof modified === 'object') {
|
|
202
|
-
const allKeys = new Set([...Object.keys(original), ...Object.keys(modified)]);
|
|
203
|
-
|
|
204
|
-
for (const key of allKeys) {
|
|
205
|
-
if (!original.hasOwnProperty(key)) {
|
|
206
|
-
changes.push({ type: 'added', key, value: modified[key] });
|
|
207
|
-
} else if (!modified.hasOwnProperty(key)) {
|
|
208
|
-
changes.push({ type: 'removed', key, value: original[key] });
|
|
209
|
-
} else if (JSON.stringify(original[key]) !== JSON.stringify(modified[key])) {
|
|
210
|
-
changes.push({
|
|
211
|
-
type: 'modified',
|
|
212
|
-
key,
|
|
213
|
-
original: original[key],
|
|
214
|
-
modified: modified[key]
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
} else {
|
|
219
|
-
changes.push({
|
|
220
|
-
type: 'value_changed',
|
|
221
|
-
original,
|
|
222
|
-
modified
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return changes;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Colorize a diff patch
|
|
231
|
-
* @private
|
|
232
|
-
*/
|
|
233
|
-
colorizeDiff(patch, showLineNumbers) {
|
|
234
|
-
const lines = patch.split('\n');
|
|
235
|
-
const colorized = [];
|
|
236
|
-
let lineNumOriginal = 0;
|
|
237
|
-
let lineNumModified = 0;
|
|
238
|
-
|
|
239
|
-
for (const line of lines) {
|
|
240
|
-
if (line.startsWith('@@')) {
|
|
241
|
-
// Parse line numbers from hunk header
|
|
242
|
-
const match = line.match(/@@ -(\d+),\d+ \+(\d+),\d+ @@/);
|
|
243
|
-
if (match) {
|
|
244
|
-
lineNumOriginal = parseInt(match[1]);
|
|
245
|
-
lineNumModified = parseInt(match[2]);
|
|
246
|
-
}
|
|
247
|
-
colorized.push(this.colors.header(line));
|
|
248
|
-
} else if (line.startsWith('+')) {
|
|
249
|
-
const lineNum = showLineNumbers ? `${lineNumModified.toString().padStart(4)}: ` : '';
|
|
250
|
-
colorized.push(this.colors.added(`+${lineNum}${line.substring(1)}`));
|
|
251
|
-
lineNumModified++;
|
|
252
|
-
} else if (line.startsWith('-')) {
|
|
253
|
-
const lineNum = showLineNumbers ? `${lineNumOriginal.toString().padStart(4)}: ` : '';
|
|
254
|
-
colorized.push(this.colors.removed(`-${lineNum}${line.substring(1)}`));
|
|
255
|
-
lineNumOriginal++;
|
|
256
|
-
} else if (line.startsWith(' ')) {
|
|
257
|
-
const lineNum = showLineNumbers ?
|
|
258
|
-
`${lineNumOriginal.toString().padStart(4)}: ` : '';
|
|
259
|
-
colorized.push(this.colors.unchanged(` ${lineNum}${line.substring(1)}`));
|
|
260
|
-
lineNumOriginal++;
|
|
261
|
-
lineNumModified++;
|
|
262
|
-
} else {
|
|
263
|
-
colorized.push(this.colors.header(line));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return colorized.join('\n');
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Generate impact summary from YAML diff
|
|
272
|
-
* @private
|
|
273
|
-
*/
|
|
274
|
-
generateImpactSummary(yamlDiff) {
|
|
275
|
-
const impacts = [];
|
|
276
|
-
|
|
277
|
-
// Check for dependency changes
|
|
278
|
-
if (yamlDiff.sections.dependencies) {
|
|
279
|
-
const changes = yamlDiff.sections.dependencies.changes || [];
|
|
280
|
-
for (const change of changes) {
|
|
281
|
-
if (change.type === 'added') {
|
|
282
|
-
impacts.push(`New dependency added: ${change.items.join(', ')}`);
|
|
283
|
-
} else if (change.type === 'removed') {
|
|
284
|
-
impacts.push(`Dependency removed: ${change.items.join(', ')}`);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Check for command changes
|
|
290
|
-
if (yamlDiff.sections.commands) {
|
|
291
|
-
impacts.push('Commands modified - users may need to update their workflows');
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// Check for persona changes
|
|
295
|
-
if (yamlDiff.sections.persona) {
|
|
296
|
-
impacts.push('Agent persona modified - behavior may change');
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return impacts;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Generate a side-by-side diff view
|
|
304
|
-
* @param {string} original - Original content
|
|
305
|
-
* @param {string} modified - Modified content
|
|
306
|
-
* @param {Object} options - Display options
|
|
307
|
-
* @returns {string} Side-by-side diff
|
|
308
|
-
*/
|
|
309
|
-
generateSideBySideDiff(original, modified, options = {}) {
|
|
310
|
-
const { width = 80, gutter = 3 } = options;
|
|
311
|
-
const columnWidth = Math.floor((width - gutter) / 2);
|
|
312
|
-
|
|
313
|
-
const originalLines = original.split('\n');
|
|
314
|
-
const modifiedLines = modified.split('\n');
|
|
315
|
-
const maxLines = Math.max(originalLines.length, modifiedLines.length);
|
|
316
|
-
|
|
317
|
-
const output = [];
|
|
318
|
-
output.push(this.colors.header('─'.repeat(width)));
|
|
319
|
-
output.push(
|
|
320
|
-
this.colors.header('Original'.padEnd(columnWidth)) +
|
|
321
|
-
' '.repeat(gutter) +
|
|
322
|
-
this.colors.header('Modified'.padEnd(columnWidth))
|
|
323
|
-
);
|
|
324
|
-
output.push(this.colors.header('─'.repeat(width)));
|
|
325
|
-
|
|
326
|
-
for (let i = 0; i < maxLines; i++) {
|
|
327
|
-
const origLine = (originalLines[i] || '').substring(0, columnWidth);
|
|
328
|
-
const modLine = (modifiedLines[i] || '').substring(0, columnWidth);
|
|
329
|
-
|
|
330
|
-
let coloredOrig = origLine.padEnd(columnWidth);
|
|
331
|
-
let coloredMod = modLine.padEnd(columnWidth);
|
|
332
|
-
|
|
333
|
-
if (origLine !== modLine) {
|
|
334
|
-
if (!originalLines[i]) {
|
|
335
|
-
coloredMod = this.colors.added(coloredMod);
|
|
336
|
-
} else if (!modifiedLines[i]) {
|
|
337
|
-
coloredOrig = this.colors.removed(coloredOrig);
|
|
338
|
-
} else {
|
|
339
|
-
coloredOrig = this.colors.removed(coloredOrig);
|
|
340
|
-
coloredMod = this.colors.added(coloredMod);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
output.push(coloredOrig + ' '.repeat(gutter) + coloredMod);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
output.push(this.colors.header('─'.repeat(width)));
|
|
348
|
-
return output.join('\n');
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
module.exports = DiffGenerator;
|