archrip 0.1.2
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/commands/build.d.ts +2 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +88 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +58 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +27 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/install/slash-commands.d.ts +6 -0
- package/dist/install/slash-commands.d.ts.map +1 -0
- package/dist/install/slash-commands.js +31 -0
- package/dist/install/slash-commands.js.map +1 -0
- package/dist/install/viewer.d.ts +5 -0
- package/dist/install/viewer.d.ts.map +1 -0
- package/dist/install/viewer.js +40 -0
- package/dist/install/viewer.js.map +1 -0
- package/dist/schema/architecture.schema.json +144 -0
- package/dist/templates/skeleton.json +15 -0
- package/dist/templates/slash-commands/claude/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/claude/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/claude/archrip-update.md +34 -0
- package/dist/templates/slash-commands/claude/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/claude/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/claude/archrips-update.md +18 -0
- package/dist/templates/slash-commands/codex/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/codex/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/codex/archrip-update.md +34 -0
- package/dist/templates/slash-commands/codex/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/codex/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/codex/archrips-update.md +18 -0
- package/dist/templates/slash-commands/gemini/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/gemini/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/gemini/archrip-update.md +34 -0
- package/dist/templates/slash-commands/gemini/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/gemini/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/gemini/archrips-update.md +18 -0
- package/dist/utils/detect-agents.d.ts +15 -0
- package/dist/utils/detect-agents.d.ts.map +1 -0
- package/dist/utils/detect-agents.js +29 -0
- package/dist/utils/detect-agents.js.map +1 -0
- package/dist/utils/gitignore.d.ts +5 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +21 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/layout.d.ts +17 -0
- package/dist/utils/layout.d.ts.map +1 -0
- package/dist/utils/layout.js +121 -0
- package/dist/utils/layout.js.map +1 -0
- package/dist/utils/layout.spec.d.ts +2 -0
- package/dist/utils/layout.spec.d.ts.map +1 -0
- package/dist/utils/layout.spec.js +176 -0
- package/dist/utils/layout.spec.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +28 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/project-info.d.ts +9 -0
- package/dist/utils/project-info.d.ts.map +1 -0
- package/dist/utils/project-info.js +86 -0
- package/dist/utils/project-info.js.map +1 -0
- package/dist/utils/validate.d.ts +88 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +238 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/utils/validate.spec.d.ts +2 -0
- package/dist/utils/validate.spec.d.ts.map +1 -0
- package/dist/utils/validate.spec.js +424 -0
- package/dist/utils/validate.spec.js.map +1 -0
- package/dist/utils/verbose.d.ts +3 -0
- package/dist/utils/verbose.d.ts.map +1 -0
- package/dist/utils/verbose.js +8 -0
- package/dist/utils/verbose.js.map +1 -0
- package/dist/viewer-template/index.html +15 -0
- package/dist/viewer-template/package-lock.json +2714 -0
- package/dist/viewer-template/package.json +26 -0
- package/dist/viewer-template/src/App.tsx +168 -0
- package/dist/viewer-template/src/components/DepthFilter.tsx +43 -0
- package/dist/viewer-template/src/components/DetailPanel.tsx +261 -0
- package/dist/viewer-template/src/components/Legend.tsx +41 -0
- package/dist/viewer-template/src/components/ThemeToggle.tsx +37 -0
- package/dist/viewer-template/src/components/UseCaseFilter.tsx +59 -0
- package/dist/viewer-template/src/components/nodes/ArchNode.tsx +37 -0
- package/dist/viewer-template/src/data/loader.ts +140 -0
- package/dist/viewer-template/src/hooks/useArchitecture.ts +32 -0
- package/dist/viewer-template/src/hooks/useDepthFilter.ts +37 -0
- package/dist/viewer-template/src/hooks/useTheme.ts +39 -0
- package/dist/viewer-template/src/hooks/useUseCaseFilter.ts +56 -0
- package/dist/viewer-template/src/index.css +130 -0
- package/dist/viewer-template/src/main.tsx +13 -0
- package/dist/viewer-template/src/types.ts +125 -0
- package/dist/viewer-template/tsconfig.app.json +24 -0
- package/dist/viewer-template/tsconfig.json +7 -0
- package/dist/viewer-template/tsconfig.node.json +22 -0
- package/dist/viewer-template/vite.config.ts +7 -0
- package/package.json +45 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAqDA,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAsD3C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { existsSync, writeFileSync, mkdirSync, cpSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { loadAndValidate, validateViewerDir } from '../utils/validate.js';
|
|
5
|
+
import { computeLayout } from '../utils/layout.js';
|
|
6
|
+
import { installViewer } from '../install/viewer.js';
|
|
7
|
+
import { updateGitignore } from '../utils/gitignore.js';
|
|
8
|
+
function writeProcessedArchitecture(viewerDir, data, layoutMap) {
|
|
9
|
+
const viewerPublic = join(viewerDir, 'public');
|
|
10
|
+
mkdirSync(viewerPublic, { recursive: true });
|
|
11
|
+
const processedData = {
|
|
12
|
+
...data,
|
|
13
|
+
_layout: layoutMap,
|
|
14
|
+
};
|
|
15
|
+
writeFileSync(join(viewerPublic, 'architecture.json'), JSON.stringify(processedData, null, 2));
|
|
16
|
+
console.log(' Wrote public/architecture.json (with layout data)');
|
|
17
|
+
}
|
|
18
|
+
function execSyncWithOutput(command, cwd) {
|
|
19
|
+
try {
|
|
20
|
+
execSync(command, { cwd, stdio: 'pipe' });
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (err instanceof Error && 'stderr' in err) {
|
|
24
|
+
const stderr = String(err.stderr).trim();
|
|
25
|
+
if (stderr) {
|
|
26
|
+
throw new Error(`Command "${command}" failed:\n${stderr}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Command "${command}" failed.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function runViewerBuild(viewerDir, distDir) {
|
|
33
|
+
console.log('Installing viewer dependencies...');
|
|
34
|
+
execSyncWithOutput('npm ci', viewerDir);
|
|
35
|
+
console.log('Building viewer...');
|
|
36
|
+
execSyncWithOutput('npm run build', viewerDir);
|
|
37
|
+
mkdirSync(distDir, { recursive: true });
|
|
38
|
+
const viewerDist = join(viewerDir, 'dist');
|
|
39
|
+
if (existsSync(viewerDist)) {
|
|
40
|
+
cpSync(viewerDist, distDir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export async function build() {
|
|
44
|
+
const projectDir = process.cwd();
|
|
45
|
+
const archripDir = join(projectDir, '.archrip');
|
|
46
|
+
const archJsonPath = join(archripDir, 'architecture.json');
|
|
47
|
+
const viewerDir = join(archripDir, 'viewer');
|
|
48
|
+
const distDir = join(archripDir, 'dist');
|
|
49
|
+
console.log('\narchrip build\n');
|
|
50
|
+
// 1. Check architecture.json exists
|
|
51
|
+
if (!existsSync(archJsonPath)) {
|
|
52
|
+
throw new Error('.archrip/architecture.json not found.\n'
|
|
53
|
+
+ 'Run /archrip-scan to generate it.');
|
|
54
|
+
}
|
|
55
|
+
// 2. Always overwrite viewer to prevent supply-chain attacks
|
|
56
|
+
console.log('Setting up viewer...');
|
|
57
|
+
mkdirSync(archripDir, { recursive: true });
|
|
58
|
+
installViewer(archripDir);
|
|
59
|
+
updateGitignore(projectDir);
|
|
60
|
+
validateViewerDir(viewerDir);
|
|
61
|
+
// 3. Validate architecture.json
|
|
62
|
+
console.log('Validating architecture.json...');
|
|
63
|
+
const { data, errors, warnings } = loadAndValidate(archJsonPath);
|
|
64
|
+
if (errors.length > 0) {
|
|
65
|
+
const details = errors.map((err) => ` - ${err.path}: ${err.message}`).join('\n');
|
|
66
|
+
throw new Error(`Validation errors:\n${details}`);
|
|
67
|
+
}
|
|
68
|
+
if (warnings.length > 0) {
|
|
69
|
+
for (const w of warnings) {
|
|
70
|
+
console.warn(` Warning: ${w.path}: ${w.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
console.log(` ${data.nodes.length} nodes, ${data.edges.length} edges, ${data.useCases?.length ?? 0} use cases`);
|
|
74
|
+
// 4. Compute dagre layout
|
|
75
|
+
console.log('Computing layout...');
|
|
76
|
+
const layout = computeLayout(data);
|
|
77
|
+
const layoutMap = {};
|
|
78
|
+
for (const node of layout.nodes) {
|
|
79
|
+
layoutMap[node.id] = { x: node.x, y: node.y };
|
|
80
|
+
}
|
|
81
|
+
// 5. Write processed data to viewer's public/
|
|
82
|
+
writeProcessedArchitecture(viewerDir, data, layoutMap);
|
|
83
|
+
// 6. Build viewer and copy dist
|
|
84
|
+
runViewerBuild(viewerDir, distDir);
|
|
85
|
+
console.log(`\nBuild complete! Output: .archrip/dist/`);
|
|
86
|
+
console.log('Run `npx archrip serve` to preview.');
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0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,CAAC,YAAY,CAAC,CAAC;IAEjH,0BAA0B;IAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,SAAS,GAA6C,EAAE,CAAC;IAC/D,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;IAChD,CAAC;IAED,8CAA8C;IAC9C,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAEvD,gCAAgC;IAChC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEnC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AASA,wBAAsB,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD5D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { detectAgents, getAllAgentTypes } from '../utils/detect-agents.js';
|
|
4
|
+
import { detectProjectInfo } from '../utils/project-info.js';
|
|
5
|
+
import { getTemplatesDir } from '../utils/paths.js';
|
|
6
|
+
import { installViewer } from '../install/viewer.js';
|
|
7
|
+
import { installSlashCommands } from '../install/slash-commands.js';
|
|
8
|
+
import { updateGitignore } from '../utils/gitignore.js';
|
|
9
|
+
export async function init(targetPath) {
|
|
10
|
+
const projectDir = resolve(targetPath);
|
|
11
|
+
console.log(`\narchrip init — ${projectDir}\n`);
|
|
12
|
+
// 1. Detect project info
|
|
13
|
+
const projectInfo = detectProjectInfo(projectDir);
|
|
14
|
+
console.log(`Detected: ${projectInfo.language}${projectInfo.framework ? ` / ${projectInfo.framework}` : ''}`);
|
|
15
|
+
// 2. Create .archrip/ directory
|
|
16
|
+
const archripDir = join(projectDir, '.archrip');
|
|
17
|
+
mkdirSync(archripDir, { recursive: true });
|
|
18
|
+
// 3. Write architecture.json skeleton
|
|
19
|
+
const archJsonPath = join(archripDir, 'architecture.json');
|
|
20
|
+
if (!existsSync(archJsonPath)) {
|
|
21
|
+
const templatesDir = getTemplatesDir();
|
|
22
|
+
const skeleton = JSON.parse(readFileSync(join(templatesDir, 'skeleton.json'), 'utf-8'));
|
|
23
|
+
const project = skeleton.project;
|
|
24
|
+
project.name = projectInfo.name;
|
|
25
|
+
project.language = projectInfo.language;
|
|
26
|
+
project.framework = projectInfo.framework;
|
|
27
|
+
writeFileSync(archJsonPath, JSON.stringify(skeleton, null, 2) + '\n');
|
|
28
|
+
console.log(' + .archrip/architecture.json (skeleton)');
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.log(' ~ .archrip/architecture.json (already exists, skipped)');
|
|
32
|
+
}
|
|
33
|
+
// 4. Copy viewer template
|
|
34
|
+
installViewer(archripDir);
|
|
35
|
+
// 5. Detect agents and install slash commands
|
|
36
|
+
const detected = detectAgents(projectDir);
|
|
37
|
+
if (detected.length > 0) {
|
|
38
|
+
console.log(`\nDetected AI agents: ${detected.map((a) => a.type).join(', ')}`);
|
|
39
|
+
for (const agent of detected) {
|
|
40
|
+
installSlashCommands(projectDir, agent.type);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log('\nNo AI agent config detected. Installing commands for all agents...');
|
|
45
|
+
for (const agentType of getAllAgentTypes()) {
|
|
46
|
+
installSlashCommands(projectDir, agentType);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// 6. Update .gitignore
|
|
50
|
+
updateGitignore(projectDir);
|
|
51
|
+
console.log(`
|
|
52
|
+
Done! Next steps:
|
|
53
|
+
1. Run /archrip-scan in your AI agent to analyze the codebase
|
|
54
|
+
2. Run: npx archrip build
|
|
55
|
+
3. Run: npx archrip serve
|
|
56
|
+
`);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAAkB;IAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,oBAAoB,UAAU,IAAI,CAAC,CAAC;IAEhD,yBAAyB;IACzB,MAAM,WAAW,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,aAAa,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,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C,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/E,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;QACpF,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE,EAAE,CAAC;YAC3C,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,uBAAuB;IACvB,eAAe,CAAC,UAAU,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC;;;;;CAKb,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAKA,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAwB3C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
import { build } from './build.js';
|
|
4
|
+
import { validateViewerDir } from '../utils/validate.js';
|
|
5
|
+
export async function serve() {
|
|
6
|
+
const projectDir = process.cwd();
|
|
7
|
+
const viewerDir = join(projectDir, '.archrip', 'viewer');
|
|
8
|
+
// Always rebuild to ensure layout reflects latest architecture.json
|
|
9
|
+
await build();
|
|
10
|
+
// Verify viewer origin before executing anything in that directory
|
|
11
|
+
validateViewerDir(viewerDir);
|
|
12
|
+
console.log('\narchrip serve — Starting preview server...\n');
|
|
13
|
+
// Use vite preview to serve the built files
|
|
14
|
+
try {
|
|
15
|
+
execSync('npm run preview -- --port 4173 --open', {
|
|
16
|
+
cwd: viewerDir,
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
// Ctrl+C (SIGINT) → status is null, exit silently
|
|
22
|
+
if (err instanceof Error && 'status' in err && err.status !== null) {
|
|
23
|
+
throw new Error('Failed to start preview server.');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAEzD,oEAAoE;IACpE,MAAM,KAAK,EAAE,CAAC;IAEd,mEAAmE;IACnE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAE7B,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAE9D,4CAA4C;IAC5C,IAAI,CAAC;QACH,QAAQ,CAAC,uCAAuC,EAAE;YAChD,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,kDAAkD;QAClD,IAAI,GAAG,YAAY,KAAK,IAAI,QAAQ,IAAI,GAAG,IAAK,GAAyD,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YAC1H,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { init } from './commands/init.js';
|
|
4
|
+
import { build } from './commands/build.js';
|
|
5
|
+
import { serve } from './commands/serve.js';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const pkg = require('../package.json');
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const command = args[0];
|
|
10
|
+
async function main() {
|
|
11
|
+
switch (command) {
|
|
12
|
+
case 'init':
|
|
13
|
+
await init(args[1] ?? '.');
|
|
14
|
+
break;
|
|
15
|
+
case 'build':
|
|
16
|
+
await build();
|
|
17
|
+
break;
|
|
18
|
+
case 'serve':
|
|
19
|
+
await serve();
|
|
20
|
+
break;
|
|
21
|
+
case '--version':
|
|
22
|
+
case '-v':
|
|
23
|
+
console.log(`archrip v${pkg.version}`);
|
|
24
|
+
break;
|
|
25
|
+
case '--help':
|
|
26
|
+
case '-h':
|
|
27
|
+
case undefined:
|
|
28
|
+
printUsage();
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
console.error(`Unknown command: ${command}`);
|
|
32
|
+
printUsage();
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function printUsage() {
|
|
37
|
+
console.log(`
|
|
38
|
+
archrip - Generate interactive architecture diagrams from your codebase
|
|
39
|
+
|
|
40
|
+
Usage:
|
|
41
|
+
archrip init [path] Initialize archrip in a project directory
|
|
42
|
+
archrip build Build the architecture viewer (static HTML)
|
|
43
|
+
archrip serve Preview the built viewer in browser
|
|
44
|
+
|
|
45
|
+
Options:
|
|
46
|
+
-v, --version Show version
|
|
47
|
+
-h, --help Show this help
|
|
48
|
+
|
|
49
|
+
Workflow:
|
|
50
|
+
1. /archrip-scan # AI scans codebase → architecture.json
|
|
51
|
+
2. npx archrip build # Build static HTML viewer (auto-installs viewer)
|
|
52
|
+
3. npx archrip serve # Preview in browser
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
main().catch((err) => {
|
|
56
|
+
if (err instanceof Error) {
|
|
57
|
+
console.error(`Error: ${err.message}`);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.error(err);
|
|
61
|
+
}
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAE9D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAExB,KAAK,UAAU,IAAI;IACjB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;YAC3B,MAAM;QACR,KAAK,OAAO;YACV,MAAM,KAAK,EAAE,CAAC;YACd,MAAM;QACR,KAAK,OAAO;YACV,MAAM,KAAK,EAAE,CAAC;YACd,MAAM;QACR,KAAK,WAAW,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACvC,MAAM;QACR,KAAK,QAAQ,CAAC;QACd,KAAK,IAAI,CAAC;QACV,KAAK,SAAS;YACZ,UAAU,EAAE,CAAC;YACb,MAAM;QACR;YACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;YAC7C,UAAU,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;CAgBb,CAAC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentType } from '../utils/detect-agents.js';
|
|
2
|
+
/**
|
|
3
|
+
* Copy slash command templates for a specific agent type.
|
|
4
|
+
*/
|
|
5
|
+
export declare function installSlashCommands(projectDir: string, agentType: AgentType): void;
|
|
6
|
+
//# sourceMappingURL=slash-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/install/slash-commands.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAwBnF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, copyFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { getTemplatesDir } from '../utils/paths.js';
|
|
4
|
+
/**
|
|
5
|
+
* Copy slash command templates for a specific agent type.
|
|
6
|
+
*/
|
|
7
|
+
export function installSlashCommands(projectDir, agentType) {
|
|
8
|
+
const templatesDir = getTemplatesDir();
|
|
9
|
+
const srcDir = join(templatesDir, 'slash-commands', agentType);
|
|
10
|
+
if (!existsSync(srcDir))
|
|
11
|
+
return;
|
|
12
|
+
const commandDirMap = {
|
|
13
|
+
claude: '.claude/commands',
|
|
14
|
+
gemini: '.gemini/commands',
|
|
15
|
+
codex: '.codex/commands',
|
|
16
|
+
};
|
|
17
|
+
const destDir = join(projectDir, commandDirMap[agentType]);
|
|
18
|
+
mkdirSync(destDir, { recursive: true });
|
|
19
|
+
const files = readdirSync(srcDir);
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const dest = join(destDir, file);
|
|
22
|
+
if (!existsSync(dest)) {
|
|
23
|
+
copyFileSync(join(srcDir, file), dest);
|
|
24
|
+
console.log(` + ${commandDirMap[agentType]}/${file}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.log(` ~ ${commandDirMap[agentType]}/${file} (already exists, skipped)`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=slash-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/install/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,WAA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AAIA;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAiBtD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, copyFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { getViewerDir } from '../utils/paths.js';
|
|
4
|
+
/**
|
|
5
|
+
* Copy the viewer template to .archrip/viewer/
|
|
6
|
+
*/
|
|
7
|
+
export function installViewer(archripDir) {
|
|
8
|
+
const viewerSrc = getViewerDir();
|
|
9
|
+
const viewerDest = join(archripDir, 'viewer');
|
|
10
|
+
if (!existsSync(viewerSrc)) {
|
|
11
|
+
console.log(' ! Viewer template not found (expected in monorepo). Skipping viewer copy.');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
mkdirSync(viewerDest, { recursive: true });
|
|
15
|
+
// Copy viewer files recursively, skipping node_modules and dist
|
|
16
|
+
copyDirRecursive(viewerSrc, viewerDest, ['node_modules', 'dist', '.tsbuildinfo']);
|
|
17
|
+
// Write marker file to verify viewer origin in build/serve
|
|
18
|
+
writeFileSync(join(viewerDest, '.archrip-viewer'), 'archrip-official-viewer\n');
|
|
19
|
+
console.log(' + .archrip/viewer/ (viewer template)');
|
|
20
|
+
}
|
|
21
|
+
function copyDirRecursive(src, dest, skipDirs) {
|
|
22
|
+
mkdirSync(dest, { recursive: true });
|
|
23
|
+
const entries = readdirSync(src, { withFileTypes: true });
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
if (skipDirs.includes(entry.name))
|
|
26
|
+
continue;
|
|
27
|
+
// Skip symlinks to prevent path traversal via symlink injection
|
|
28
|
+
if (entry.isSymbolicLink())
|
|
29
|
+
continue;
|
|
30
|
+
const srcPath = join(src, entry.name);
|
|
31
|
+
const destPath = join(dest, entry.name);
|
|
32
|
+
if (entry.isDirectory()) {
|
|
33
|
+
copyDirRecursive(srcPath, destPath, skipDirs);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
copyFileSync(srcPath, destPath);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../src/install/viewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC;QAC3F,OAAO;IACT,CAAC;IAED,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3C,gEAAgE;IAChE,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAElF,2DAA2D;IAC3D,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,IAAY,EAAE,QAAkB;IACrE,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,SAAS;QAC5C,gEAAgE;QAChE,IAAI,KAAK,CAAC,cAAc,EAAE;YAAE,SAAS;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/yida29/archrip/main/packages/cli/src/schema/architecture.schema.json",
|
|
4
|
+
"title": "archrip Architecture Schema",
|
|
5
|
+
"description": "Schema for architecture.json used by archrip to generate interactive architecture diagrams",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["version", "project", "nodes", "edges"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string" },
|
|
10
|
+
"version": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "1.0"
|
|
13
|
+
},
|
|
14
|
+
"project": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["name"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"name": { "type": "string", "description": "Project display name" },
|
|
19
|
+
"description": { "type": "string" },
|
|
20
|
+
"language": { "type": "string" },
|
|
21
|
+
"framework": { "type": "string" },
|
|
22
|
+
"sourceUrl": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "URL template for source links. Use {filePath} as placeholder. Example: https://github.com/org/repo/blob/main/{filePath}"
|
|
25
|
+
},
|
|
26
|
+
"layout": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["dagre", "concentric"],
|
|
29
|
+
"default": "dagre",
|
|
30
|
+
"description": "Layout algorithm: 'dagre' (top-to-bottom) or 'concentric' (onion/DDD ring layout)"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
"nodes": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": { "$ref": "#/$defs/node" }
|
|
38
|
+
},
|
|
39
|
+
"edges": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": { "$ref": "#/$defs/edge" }
|
|
42
|
+
},
|
|
43
|
+
"useCases": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": { "$ref": "#/$defs/useCase" }
|
|
46
|
+
},
|
|
47
|
+
"schemas": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": { "$ref": "#/$defs/tableSchema" }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"$defs": {
|
|
54
|
+
"node": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"required": ["id", "category", "label", "layer"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
|
|
59
|
+
"category": { "type": "string" },
|
|
60
|
+
"label": { "type": "string" },
|
|
61
|
+
"description": { "type": "string", "default": "" },
|
|
62
|
+
"filePath": { "type": "string", "default": "" },
|
|
63
|
+
"layer": { "type": "integer", "minimum": 0 },
|
|
64
|
+
"methods": { "type": "array", "items": { "type": "string" } },
|
|
65
|
+
"routes": { "type": "array", "items": { "type": "string" } },
|
|
66
|
+
"useCases": { "type": "array", "items": { "type": "string" } },
|
|
67
|
+
"schema": { "type": "string", "description": "Key into top-level schemas object" },
|
|
68
|
+
"implements": { "type": "string" },
|
|
69
|
+
"externalService": { "type": "string" },
|
|
70
|
+
"sqlExamples": { "type": "array", "items": { "type": "string" } },
|
|
71
|
+
"depth": { "type": "integer", "minimum": 0, "maximum": 2, "description": "Abstraction depth: 0=overview (boundary), 1=structure (internal), 2=detail (implementation). Auto-inferred from category if omitted." }
|
|
72
|
+
},
|
|
73
|
+
"additionalProperties": false
|
|
74
|
+
},
|
|
75
|
+
"edge": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"required": ["source", "target"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"source": { "type": "string" },
|
|
80
|
+
"target": { "type": "string" },
|
|
81
|
+
"label": { "type": ["string", "null"] },
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": ["dependency", "implements", "relation"],
|
|
85
|
+
"default": "dependency"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
},
|
|
90
|
+
"useCase": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"required": ["id", "name", "nodeIds"],
|
|
93
|
+
"properties": {
|
|
94
|
+
"id": { "type": "string" },
|
|
95
|
+
"name": { "type": "string" },
|
|
96
|
+
"description": { "type": "string", "default": "" },
|
|
97
|
+
"nodeIds": { "type": "array", "items": { "type": "string" } },
|
|
98
|
+
"flow": { "type": "array", "items": { "type": "string" } }
|
|
99
|
+
},
|
|
100
|
+
"additionalProperties": false
|
|
101
|
+
},
|
|
102
|
+
"tableSchema": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"required": ["tableName", "columns"],
|
|
105
|
+
"properties": {
|
|
106
|
+
"tableName": { "type": "string" },
|
|
107
|
+
"columns": {
|
|
108
|
+
"type": "array",
|
|
109
|
+
"items": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"required": ["name", "type"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"name": { "type": "string" },
|
|
114
|
+
"type": { "type": "string" },
|
|
115
|
+
"nullable": { "type": "boolean", "default": false },
|
|
116
|
+
"default": { "type": "string" },
|
|
117
|
+
"index": { "type": "string" },
|
|
118
|
+
"foreignKey": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"required": ["table", "column"],
|
|
121
|
+
"properties": {
|
|
122
|
+
"table": { "type": "string" },
|
|
123
|
+
"column": { "type": "string" },
|
|
124
|
+
"onDelete": { "type": "string" }
|
|
125
|
+
},
|
|
126
|
+
"additionalProperties": false
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"additionalProperties": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"indexes": { "type": "array", "items": { "type": "string" } },
|
|
133
|
+
"enumValues": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"additionalProperties": { "type": "string" }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"additionalProperties": false
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/yida29/archrip/main/packages/cli/src/schema/architecture.schema.json",
|
|
3
|
+
"version": "1.0",
|
|
4
|
+
"project": {
|
|
5
|
+
"name": "",
|
|
6
|
+
"description": "",
|
|
7
|
+
"language": "",
|
|
8
|
+
"framework": "",
|
|
9
|
+
"sourceUrl": ""
|
|
10
|
+
},
|
|
11
|
+
"nodes": [],
|
|
12
|
+
"edges": [],
|
|
13
|
+
"useCases": [],
|
|
14
|
+
"schemas": {}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip refine — Refine architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrip/architecture.json` and apply the user's requested changes:
|
|
8
|
+
- Add/remove/modify nodes
|
|
9
|
+
- Fix relationships
|
|
10
|
+
- Add/modify use cases
|
|
11
|
+
- Adjust layer assignments
|
|
12
|
+
- Add database schemas
|
|
13
|
+
- Improve descriptions
|
|
14
|
+
|
|
15
|
+
Write the updated `.archrip/architecture.json`.
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|