@archinsight/cli 3.0.0-snapshot.0 → 3.0.0-snapshot.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +46 -0
  2. package/build/index.js +723 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,6 +13,7 @@ archinsight link [project-dir] [--format text|json] [--out file]
13
13
  archinsight structure [project-dir] [--format text|json] [--out file]
14
14
  archinsight query [project-dir] -c <context> [-s <source>] [-v c1|c2|c3|c4|no-filter] [-q query.aiq] [-f text|json] [-o file]
15
15
  archinsight render [project-dir] -c <context> [-s <source>] [-v c1|c2|c3|c4|no-filter] [-q query.aiq] [-f dot|svg|json] [-o file]
16
+ archinsight skill init [project-dir] [--target generic|codex|claude] [--out dir] [--force]
16
17
  ```
17
18
 
18
19
  `project-dir` defaults to the current directory.
@@ -27,6 +28,8 @@ archinsight render [project-dir] -c <context> [-s <source>] [-v c1|c2|c3|c4|no-f
27
28
  - `-f, --format <format>` - command output format.
28
29
  - `-o, --out <file>` - write payload output to a file instead of stdout.
29
30
  - `-t, --theme <theme>` - render theme; defaults to `light`.
31
+ - `--target <target>` - skill target for `skill init`: `generic`, `codex`, or `claude`.
32
+ - `--force` - replace existing generated skill files.
30
33
  - `-V, --version` - print version.
31
34
  - `-h, --help` - print help.
32
35
 
@@ -45,6 +48,49 @@ Render DOT for a context using the C2 built-in query:
45
48
  node archinsight-cli/build/index.js render examples -c demo -s main.ai -v c2 -f dot
46
49
  ```
47
50
 
51
+ Generate a portable AI-agent guide for an Insight project:
52
+
53
+ ```shell
54
+ archinsight skill init --target generic
55
+ ```
56
+
57
+ The generic target writes a runtime-neutral guide:
58
+
59
+ ```text
60
+ .archinsight/agent/
61
+ archinsight.md
62
+ references/
63
+ syntax.md
64
+ layered-architecture.md
65
+ validation.md
66
+ examples/
67
+ layered-architecture.ai
68
+ ```
69
+
70
+ Codex and Claude targets package the same Insight reference as skill folders:
71
+
72
+ ```shell
73
+ archinsight skill init --target codex
74
+ archinsight skill init --target claude
75
+ ```
76
+
77
+ ```text
78
+ .archinsight/skills/codex/archinsight/
79
+ SKILL.md
80
+ agents/openai.yaml
81
+ references/
82
+ examples/
83
+
84
+ .archinsight/skills/claude/archinsight/
85
+ SKILL.md
86
+ references/
87
+ examples/
88
+ ```
89
+
90
+ The guide tells agents to treat `archinsight` as the validation source of truth,
91
+ avoid guessing Insight syntax from other architecture DSLs, and describe systems
92
+ layer by layer from context to containers, components, and deployment details.
93
+
48
94
  ## Output Contract
49
95
 
50
96
  Payload output goes to stdout unless `--out` is supplied.
package/build/index.js CHANGED
@@ -37460,7 +37460,7 @@ var QueryParser = class {
37460
37460
  };
37461
37461
 
37462
37462
  // src/version.ts
37463
- var version = "3.0.0-snapshot.0";
37463
+ var version = "3.0.0-snapshot.1";
37464
37464
 
37465
37465
  // src/index.ts
37466
37466
  var hiddenStructureTypes = /* @__PURE__ */ new Set(["List", "Nothing", "Text", "text"]);
@@ -37547,6 +37547,9 @@ async function main() {
37547
37547
  case "structure":
37548
37548
  await runStructure(args);
37549
37549
  return;
37550
+ case "skill":
37551
+ await runSkill(args);
37552
+ return;
37550
37553
  }
37551
37554
  }
37552
37555
  async function runLink(args) {
@@ -37629,6 +37632,31 @@ async function runStructure(args) {
37629
37632
  }
37630
37633
  await writeOutput(args.output, formatStructure(structure));
37631
37634
  }
37635
+ async function runSkill(args) {
37636
+ if (args.skillAction !== "init") {
37637
+ throw new CliError("Usage: archinsight skill init [project-dir] [--target generic|codex|claude] [--out dir] [--force]");
37638
+ }
37639
+ const target = skillTarget(args.target);
37640
+ switch (target) {
37641
+ case "generic":
37642
+ await runSkillInit(args, genericSkillPackage());
37643
+ return;
37644
+ case "codex":
37645
+ await runSkillInit(args, codexSkillPackage());
37646
+ return;
37647
+ case "claude":
37648
+ await runSkillInit(args, claudeSkillPackage());
37649
+ return;
37650
+ }
37651
+ }
37652
+ async function runSkillInit(args, skillPackage) {
37653
+ const projectRoot = path.resolve(projectPath(args));
37654
+ const outputRoot = path.resolve(projectRoot, args.output ?? skillPackage.defaultOutput);
37655
+ for (const file of skillPackage.files) {
37656
+ await writeGeneratedFile(path.join(outputRoot, file.path), file.content, args.force);
37657
+ }
37658
+ process.stdout.write(skillPackageSuccess(projectRoot, outputRoot, skillPackage));
37659
+ }
37632
37660
  async function loadProject(input) {
37633
37661
  const root = path.resolve(input);
37634
37662
  const sources = await readSources(root);
@@ -37703,7 +37731,7 @@ async function sourceFiles(directory) {
37703
37731
  const entries = await readdir(directory, { withFileTypes: true });
37704
37732
  const result = [];
37705
37733
  for (const entry of entries) {
37706
- if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "build") {
37734
+ if (entry.name === "node_modules" || entry.name === ".git" || entry.name === ".archinsight" || entry.name === "build") {
37707
37735
  continue;
37708
37736
  }
37709
37737
  const entryPath = path.join(directory, entry.name);
@@ -37896,6 +37924,24 @@ async function writeOutput(file, content) {
37896
37924
  await mkdir(path.dirname(path.resolve(file)), { recursive: true });
37897
37925
  await writeFile(file, content);
37898
37926
  }
37927
+ async function writeGeneratedFile(file, content, force) {
37928
+ if (!force && await exists(file)) {
37929
+ throw new CliError(`Refusing to overwrite '${file}'. Pass --force to replace generated agent files.`);
37930
+ }
37931
+ await mkdir(path.dirname(file), { recursive: true });
37932
+ await writeFile(file, content);
37933
+ }
37934
+ async function exists(file) {
37935
+ try {
37936
+ await stat(file);
37937
+ return true;
37938
+ } catch (error) {
37939
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
37940
+ return false;
37941
+ }
37942
+ throw error;
37943
+ }
37944
+ }
37899
37945
  function parseArgs(argv) {
37900
37946
  const options = {};
37901
37947
  const positional = [];
@@ -37909,6 +37955,10 @@ function parseArgs(argv) {
37909
37955
  options.version = true;
37910
37956
  continue;
37911
37957
  }
37958
+ if (arg === "--force") {
37959
+ options.force = true;
37960
+ continue;
37961
+ }
37912
37962
  const key = optionKey(arg);
37913
37963
  if (key !== void 0) {
37914
37964
  const value = argv[index + 1];
@@ -37926,7 +37976,8 @@ function parseArgs(argv) {
37926
37976
  }
37927
37977
  return {
37928
37978
  command: command(positional[0]),
37929
- input: positional[1],
37979
+ skillAction: skillAction(positional[0], positional[1]),
37980
+ input: inputPath(positional),
37930
37981
  context: stringOption(options.context),
37931
37982
  tab: stringOption(options.tab),
37932
37983
  view: viewOption(options.view),
@@ -37934,8 +37985,10 @@ function parseArgs(argv) {
37934
37985
  output: stringOption(options.output),
37935
37986
  format: stringOption(options.format),
37936
37987
  theme: stringOption(options.theme),
37988
+ target: stringOption(options.target),
37937
37989
  help: options.help === true,
37938
- version: options.version === true
37990
+ version: options.version === true,
37991
+ force: options.force === true
37939
37992
  };
37940
37993
  }
37941
37994
  function optionKey(arg) {
@@ -37954,11 +38007,12 @@ function optionKey(arg) {
37954
38007
  "--format": "format",
37955
38008
  "-f": "format",
37956
38009
  "--theme": "theme",
37957
- "-t": "theme"
38010
+ "-t": "theme",
38011
+ "--target": "target"
37958
38012
  }[arg];
37959
38013
  }
37960
38014
  function command(value) {
37961
- if (value === "link" || value === "render" || value === "query" || value === "structure") {
38015
+ if (value === "link" || value === "render" || value === "query" || value === "structure" || value === "skill") {
37962
38016
  return value;
37963
38017
  }
37964
38018
  if (value === void 0) {
@@ -37966,6 +38020,30 @@ function command(value) {
37966
38020
  }
37967
38021
  throw new CliError(`Unknown command '${value}'`);
37968
38022
  }
38023
+ function skillAction(commandValue, value) {
38024
+ if (commandValue !== "skill") {
38025
+ return void 0;
38026
+ }
38027
+ if (value === "init") {
38028
+ return value;
38029
+ }
38030
+ if (value === void 0) {
38031
+ return void 0;
38032
+ }
38033
+ throw new CliError(`Unknown skill command '${value}'`);
38034
+ }
38035
+ function inputPath(positional) {
38036
+ return positional[0] === "skill" ? positional[2] : positional[1];
38037
+ }
38038
+ function skillTarget(value) {
38039
+ if (value === void 0 || value === "generic") {
38040
+ return "generic";
38041
+ }
38042
+ if (value === "codex" || value === "claude") {
38043
+ return value;
38044
+ }
38045
+ throw new CliError(`Unknown skill target '${value}'`);
38046
+ }
37969
38047
  function viewOption(value) {
37970
38048
  if (value === void 0) {
37971
38049
  return void 0;
@@ -37996,6 +38074,13 @@ function renderFormat(value, fallback) {
37996
38074
  function stringOption(value) {
37997
38075
  return typeof value === "string" ? value : void 0;
37998
38076
  }
38077
+ function displayPath(from, target) {
38078
+ const relative = path.relative(from, target);
38079
+ if (relative === "") {
38080
+ return ".";
38081
+ }
38082
+ return relative.startsWith("..") || path.isAbsolute(relative) ? target : relative;
38083
+ }
37999
38084
  function helpText() {
38000
38085
  return `Archinsight CLI ${version}
38001
38086
 
@@ -38004,6 +38089,7 @@ Usage:
38004
38089
  archinsight render [project-dir] -c <context> [-s <source>] [-v c1|c2|c3|c4|no-filter] [-q query.aiq] [-f dot|svg|json] [-o file]
38005
38090
  archinsight query [project-dir] -c <context> [-s <source>] [-v c1|c2|c3|c4|no-filter] [-q query.aiq] [-f text|json] [-o file]
38006
38091
  archinsight structure [project-dir] [--format text|json] [--out file]
38092
+ archinsight skill init [project-dir] [--target generic|codex|claude] [--out dir] [--force]
38007
38093
 
38008
38094
  Options:
38009
38095
  project-dir Project directory to scan recursively, default: current directory.
@@ -38013,8 +38099,10 @@ Options:
38013
38099
  -v, --view <name> Built-in view: c1, c2, c3, c4, no-filter.
38014
38100
  -q, --query <file> Query file; overrides --view.
38015
38101
  -f, --format <format> Output format.
38016
- -o, --out <file> Write output to file instead of stdout.
38102
+ -o, --out <file> Write output to file instead of stdout; for skill init, write the guide directory.
38017
38103
  -t, --theme <theme> Render theme, default: light.
38104
+ --target <target> Skill target: generic, codex, or claude.
38105
+ --force Replace existing generated skill files.
38018
38106
  -V, --version Print version.
38019
38107
  -h, --help Show help.
38020
38108
 
@@ -38022,6 +38110,634 @@ Diagnostics text format is TSV:
38022
38110
  level<TAB>code<TAB>source<TAB>line<TAB>column<TAB>message
38023
38111
  `;
38024
38112
  }
38113
+ function genericSkillPackage() {
38114
+ return {
38115
+ target: "generic",
38116
+ defaultOutput: ".archinsight/agent",
38117
+ entrypoint: "archinsight.md",
38118
+ files: [
38119
+ {
38120
+ path: "archinsight.md",
38121
+ content: genericSkillGuide()
38122
+ },
38123
+ ...sharedSkillFiles()
38124
+ ]
38125
+ };
38126
+ }
38127
+ function codexSkillPackage() {
38128
+ return {
38129
+ target: "codex",
38130
+ defaultOutput: ".archinsight/skills/codex/archinsight",
38131
+ entrypoint: "SKILL.md",
38132
+ files: [
38133
+ {
38134
+ path: "SKILL.md",
38135
+ content: codexSkillGuide()
38136
+ },
38137
+ {
38138
+ path: "agents/openai.yaml",
38139
+ content: codexOpenAiYaml()
38140
+ },
38141
+ ...sharedSkillFiles()
38142
+ ]
38143
+ };
38144
+ }
38145
+ function claudeSkillPackage() {
38146
+ return {
38147
+ target: "claude",
38148
+ defaultOutput: ".archinsight/skills/claude/archinsight",
38149
+ entrypoint: "SKILL.md",
38150
+ files: [
38151
+ {
38152
+ path: "SKILL.md",
38153
+ content: claudeSkillGuide()
38154
+ },
38155
+ ...sharedSkillFiles()
38156
+ ]
38157
+ };
38158
+ }
38159
+ function sharedSkillFiles() {
38160
+ return [
38161
+ {
38162
+ path: "references/syntax.md",
38163
+ content: genericSyntaxReference()
38164
+ },
38165
+ {
38166
+ path: "references/layered-architecture.md",
38167
+ content: genericLayeredArchitectureReference()
38168
+ },
38169
+ {
38170
+ path: "references/validation.md",
38171
+ content: genericValidationReference()
38172
+ },
38173
+ {
38174
+ path: "examples/layered-architecture.ai",
38175
+ content: genericLayeredArchitectureExample()
38176
+ }
38177
+ ];
38178
+ }
38179
+ function skillPackageSuccess(projectRoot, outputRoot, skillPackage) {
38180
+ const lines = [
38181
+ `Generated ${skillPackage.target} Archinsight agent guide: ${displayPath(process.cwd(), outputRoot)}`,
38182
+ "",
38183
+ "Next steps:"
38184
+ ];
38185
+ if (skillPackage.target === "generic") {
38186
+ lines.push(` 1. Share ${displayPath(projectRoot, path.join(outputRoot, skillPackage.entrypoint))} with your AI agent.`);
38187
+ lines.push(" 2. Ask the agent to validate Insight edits with: archinsight link . --format text");
38188
+ lines.push(" 3. Keep project-specific conventions near the generated guide or pass them in the prompt.");
38189
+ } else if (skillPackage.target === "codex") {
38190
+ lines.push(` 1. Install or copy ${displayPath(projectRoot, outputRoot)} as the archinsight skill in your Codex skills directory.`);
38191
+ lines.push(" 2. Invoke it explicitly as $archinsight when editing Insight .ai models.");
38192
+ lines.push(" 3. Ask Codex to validate Insight edits with: archinsight link . --format text");
38193
+ } else {
38194
+ lines.push(` 1. Import or copy ${displayPath(projectRoot, outputRoot)} into your Claude skill runtime.`);
38195
+ lines.push(" 2. Ask Claude to use the Archinsight skill before editing Insight .ai models.");
38196
+ lines.push(" 3. Validate Insight edits with: archinsight link . --format text");
38197
+ }
38198
+ lines.push("");
38199
+ return lines.join("\n");
38200
+ }
38201
+ function genericSkillGuide() {
38202
+ return `# Archinsight Agent Guide
38203
+
38204
+ Use this guide when creating or editing Insight \`.ai\` architecture models.
38205
+
38206
+ Insight is its own typed architecture-as-code language. Do not infer its syntax
38207
+ from YAML, Mermaid, PlantUML, Structurizr, or C4 DSL.
38208
+
38209
+ ## Required Tool
38210
+
38211
+ Use the Archinsight CLI as the validation source of truth:
38212
+
38213
+ \`\`\`shell
38214
+ archinsight --help
38215
+ archinsight link . --format text
38216
+ \`\`\`
38217
+
38218
+ If \`archinsight\` is not available, ask the user to install or expose
38219
+ \`@archinsight/cli\` before changing \`.ai\` files.
38220
+
38221
+ ## Workflow
38222
+
38223
+ 1. Read the existing \`.ai\` files before editing.
38224
+ 2. Preserve indentation and the project's existing naming style.
38225
+ 3. Model architecture from the outside inward: context, external actors/systems,
38226
+ systems, containers/services, components, and deployment details.
38227
+ 4. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38228
+ 5. Validate every Insight change with \`archinsight link . --format text\`.
38229
+
38230
+ ## References
38231
+
38232
+ - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38233
+ - Read \`references/layered-architecture.md\` when decomposing a system across
38234
+ C1/C2/C3/C4-style layers.
38235
+ - Read \`references/validation.md\` before running checks, structure inspection,
38236
+ or rendering.
38237
+ - Use \`examples/layered-architecture.ai\` as a compact valid model.
38238
+ `;
38239
+ }
38240
+ function codexSkillGuide() {
38241
+ return `---
38242
+ name: archinsight
38243
+ description: Create, edit, validate, inspect, and render Archinsight Insight architecture-as-code models. Use when working with .ai Insight files, C4-style architecture models, system/container/component diagrams, deployment projections, or when the user asks to model software architecture with Archinsight.
38244
+ ---
38245
+
38246
+ # Archinsight
38247
+
38248
+ Use this skill when creating or editing Insight \`.ai\` architecture models.
38249
+
38250
+ Insight is its own typed architecture-as-code language. Do not infer its syntax
38251
+ from YAML, Mermaid, PlantUML, Structurizr, or C4 DSL.
38252
+
38253
+ ## Codex Usage Notes
38254
+
38255
+ Treat this \`SKILL.md\` as the entrypoint. Load reference files only when needed:
38256
+
38257
+ - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38258
+ - Read \`references/layered-architecture.md\` before decomposing a system across
38259
+ C1/C2/C3/C4-style layers.
38260
+ - Read \`references/validation.md\` before running checks, structure inspection,
38261
+ or rendering commands.
38262
+
38263
+ Use Codex shell access to validate changes when available. Do not silently
38264
+ install global npm packages or change machine configuration. If \`archinsight\`
38265
+ is missing, ask the user whether they want to install or expose
38266
+ \`@archinsight/cli\`.
38267
+
38268
+ ## Required Tool
38269
+
38270
+ Use the Archinsight CLI as the validation source of truth:
38271
+
38272
+ \`\`\`shell
38273
+ archinsight --help
38274
+ archinsight link . --format text
38275
+ \`\`\`
38276
+
38277
+ If \`archinsight\` is not available, ask the user to install or expose
38278
+ \`@archinsight/cli\` before changing \`.ai\` files.
38279
+
38280
+ ## Workflow
38281
+
38282
+ 1. Read the existing \`.ai\` files before editing.
38283
+ 2. Preserve indentation and the project's existing naming style.
38284
+ 3. Model architecture from the outside inward: context, external actors/systems,
38285
+ systems, containers/services, components, and deployment details.
38286
+ 4. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38287
+ 5. Use \`archinsight structure . --format text\` before broad edits when the
38288
+ project shape is unclear.
38289
+ 6. Validate every Insight change with \`archinsight link . --format text\`.
38290
+ 7. If validation fails, fix the first real syntax/type/linking error before
38291
+ adding more model content.
38292
+
38293
+ ## References
38294
+
38295
+ - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38296
+ - Read \`references/layered-architecture.md\` when decomposing a system across
38297
+ C1/C2/C3/C4-style layers.
38298
+ - Read \`references/validation.md\` before running checks, structure inspection,
38299
+ or rendering.
38300
+ - Use \`examples/layered-architecture.ai\` as a compact valid model.
38301
+ `;
38302
+ }
38303
+ function claudeSkillGuide() {
38304
+ return `---
38305
+ name: archinsight
38306
+ description: Create, edit, validate, inspect, and render Archinsight Insight architecture-as-code models. Use when working with .ai Insight files, C4-style architecture models, system/container/component diagrams, deployment projections, or when the user asks to model software architecture with Archinsight.
38307
+ ---
38308
+
38309
+ # Archinsight
38310
+
38311
+ Use this skill when creating or editing Insight \`.ai\` architecture models.
38312
+
38313
+ Insight is its own typed architecture-as-code language. Do not infer its syntax
38314
+ from YAML, Mermaid, PlantUML, Structurizr, or C4 DSL.
38315
+
38316
+ ## Claude Usage Notes
38317
+
38318
+ Treat this \`SKILL.md\` as the entrypoint. Load the reference files only when
38319
+ they are needed:
38320
+
38321
+ - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38322
+ - Read \`references/layered-architecture.md\` before decomposing a system across
38323
+ C1/C2/C3/C4-style layers.
38324
+ - Read \`references/validation.md\` before asking the user to run validation,
38325
+ structure inspection, or rendering commands.
38326
+
38327
+ When Claude has direct shell access, run validation yourself. When Claude is
38328
+ embedded in an editor without shell access, ask the user to run the exact command
38329
+ and paste the output. Do not silently install npm packages or change machine
38330
+ configuration.
38331
+
38332
+ ## Required Tool
38333
+
38334
+ Use the Archinsight CLI as the validation source of truth:
38335
+
38336
+ \`\`\`shell
38337
+ archinsight --help
38338
+ archinsight link . --format text
38339
+ \`\`\`
38340
+
38341
+ If \`archinsight\` is not available in Claude's environment, ask the user to
38342
+ install or expose \`@archinsight/cli\` before changing \`.ai\` files.
38343
+
38344
+ ## Workflow
38345
+
38346
+ 1. Read the existing \`.ai\` files before editing.
38347
+ 2. Preserve indentation and the project's existing naming style.
38348
+ 3. Model architecture from the outside inward: context, external actors/systems,
38349
+ systems, containers/services, components, and deployment details.
38350
+ 4. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38351
+ 5. Use \`archinsight structure . --format text\` to inspect the current model
38352
+ before broad edits when the CLI is available.
38353
+ 6. Validate every Insight change with \`archinsight link . --format text\` when
38354
+ shell access is available; otherwise ask the user to run validation.
38355
+ 7. If validation fails, fix the first real syntax/type/linking error before
38356
+ adding more model content.
38357
+
38358
+ ## Communication
38359
+
38360
+ When shell access is unavailable, give the user short copy-pasteable commands:
38361
+
38362
+ \`\`\`shell
38363
+ archinsight link . --format text
38364
+ archinsight structure . --format text
38365
+ \`\`\`
38366
+
38367
+ If rendering is needed, ask for the context id and source file when they are not
38368
+ obvious:
38369
+
38370
+ \`\`\`shell
38371
+ archinsight render . -c <context-id> -s <source.ai> -v c2 -f svg -o diagram.svg
38372
+ \`\`\`
38373
+
38374
+ Report diagnostics by source, line, column, and message. Avoid rewriting large
38375
+ sections of Insight unless the existing layering is already understood.
38376
+
38377
+ ## References
38378
+
38379
+ - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38380
+ - Read \`references/layered-architecture.md\` when decomposing a system across
38381
+ C1/C2/C3/C4-style layers.
38382
+ - Read \`references/validation.md\` before running checks, structure inspection,
38383
+ or rendering.
38384
+ - Use \`examples/layered-architecture.ai\` as a compact valid model.
38385
+ `;
38386
+ }
38387
+ function codexOpenAiYaml() {
38388
+ return `interface:
38389
+ display_name: "Archinsight"
38390
+ short_description: "Work with Insight architecture models"
38391
+ default_prompt: "Use $archinsight to model or validate Insight architecture-as-code files."
38392
+
38393
+ policy:
38394
+ allow_implicit_invocation: true
38395
+ `;
38396
+ }
38397
+ function genericSyntaxReference() {
38398
+ return `# Insight Syntax Reference
38399
+
38400
+ ## Files and Contexts
38401
+
38402
+ Every model starts with a context:
38403
+
38404
+ \`\`\`insight
38405
+ context ecommerce
38406
+ name = E-commerce Platform
38407
+ \`\`\`
38408
+
38409
+ Use indentation to define ownership. Children belong to the nearest less-indented
38410
+ parent.
38411
+
38412
+ ## Common Elements
38413
+
38414
+ Use built-in constructors for C4-style architecture:
38415
+
38416
+ \`\`\`insight
38417
+ external actor customer
38418
+ name = Customer
38419
+ technology = Web browser
38420
+
38421
+ system storefront
38422
+ name = Storefront
38423
+ technology = SvelteKit, TypeScript
38424
+
38425
+ container web_app
38426
+ name = Web app
38427
+ technology = SvelteKit
38428
+
38429
+ service catalog_api
38430
+ name = Catalog API
38431
+ technology = Node.js, PostgreSQL
38432
+ \`\`\`
38433
+
38434
+ Useful built-ins include:
38435
+
38436
+ - \`context\` for a bounded architecture model.
38437
+ - \`external actor\` and \`external system\` for dependencies outside the owned system.
38438
+ - \`system\` for major systems in a context.
38439
+ - \`container\` for deployable or executable units.
38440
+ - \`service\` for backend/container services.
38441
+ - \`component\` for internals of a selected container or service.
38442
+
38443
+ ## Attributes
38444
+
38445
+ Attributes are named and typed:
38446
+
38447
+ \`\`\`insight
38448
+ name = Checkout API
38449
+ technology = Kotlin, PostgreSQL
38450
+ description = Handles cart pricing, order placement, and payment orchestration
38451
+ \`\`\`
38452
+
38453
+ Long text can continue on indented following lines:
38454
+
38455
+ \`\`\`insight
38456
+ description = Handles checkout orchestration and keeps payment provider details
38457
+ outside the storefront.
38458
+ \`\`\`
38459
+
38460
+ ## Relationships
38461
+
38462
+ Put relationships under \`links:\`.
38463
+
38464
+ \`\`\`insight
38465
+ links:
38466
+ -> checkout_api
38467
+ technology = HTTPS, JSON
38468
+ description = Places an order
38469
+ ~> analytics
38470
+ technology = Kafka
38471
+ description = Publishes order events
38472
+ \`\`\`
38473
+
38474
+ Use \`from <context-id>\` when linking to an imported element from another
38475
+ context:
38476
+
38477
+ \`\`\`insight
38478
+ import payments from context external_systems
38479
+
38480
+ links:
38481
+ -> payments from external_systems
38482
+ \`\`\`
38483
+
38484
+ ## Imports and Extensions
38485
+
38486
+ Split larger models across files by repeating the context id and extending
38487
+ existing elements:
38488
+
38489
+ \`\`\`insight
38490
+ context ecommerce
38491
+
38492
+ extend service checkout_api
38493
+ component payment_adapter
38494
+ name = Payment adapter
38495
+ technology = HTTP client
38496
+ \`\`\`
38497
+
38498
+ Use imports for elements from another context:
38499
+
38500
+ \`\`\`insight
38501
+ import stripe from context external_systems
38502
+ \`\`\`
38503
+
38504
+ ## Annotations
38505
+
38506
+ Annotations decorate the next declaration or link:
38507
+
38508
+ \`\`\`insight
38509
+ @planned
38510
+ external system warehouse
38511
+ name = Warehouse
38512
+
38513
+ links:
38514
+ @deprecated
38515
+ ~> legacy_erp
38516
+ \`\`\`
38517
+
38518
+ Use presentation definitions for durable visual styling. Avoid adding new
38519
+ Graphviz attributes directly unless the project already uses that convention.
38520
+
38521
+ ## Custom Types
38522
+
38523
+ Projects can extend the language with typed vocabulary:
38524
+
38525
+ \`\`\`insight
38526
+ define type Broker of InfrastructureComponent
38527
+ constructor broker
38528
+ \`\`\`
38529
+
38530
+ When adding custom types, follow the existing framework files and validate
38531
+ immediately. Do not invent constructors without checking whether the project
38532
+ already defines the needed type.
38533
+ `;
38534
+ }
38535
+ function genericLayeredArchitectureReference() {
38536
+ return `# Modeling Architecture by Layers
38537
+
38538
+ Describe architecture from broad intent to implementation detail. Keep every
38539
+ layer useful on its own.
38540
+
38541
+ ## C1: System Context
38542
+
38543
+ Start with the context, people, owned systems, and external dependencies.
38544
+
38545
+ \`\`\`insight
38546
+ context ecommerce
38547
+ name = E-commerce Platform
38548
+
38549
+ external actor customer
38550
+ name = Customer
38551
+ technology = Web browser
38552
+ links:
38553
+ -> storefront
38554
+
38555
+ external system payment_provider
38556
+ name = Payment Provider
38557
+ technology = HTTPS API
38558
+
38559
+ system storefront
38560
+ name = Storefront
38561
+ technology = Web app
38562
+ \`\`\`
38563
+
38564
+ At this layer, avoid implementation details. Explain who uses the system and
38565
+ which external systems matter.
38566
+
38567
+ ## C2: Containers and Services
38568
+
38569
+ Nest deployable units under the owned system:
38570
+
38571
+ \`\`\`insight
38572
+ system storefront
38573
+ name = Storefront
38574
+
38575
+ container web_app
38576
+ name = Web app
38577
+ technology = SvelteKit, TypeScript
38578
+ links:
38579
+ -> checkout_api
38580
+
38581
+ service checkout_api
38582
+ name = Checkout API
38583
+ technology = Node.js, PostgreSQL
38584
+ links:
38585
+ -> payment_provider from ecommerce
38586
+ \`\`\`
38587
+
38588
+ Use \`container\` for applications or deployable units. Use \`service\` for
38589
+ backend services. Add links that explain runtime collaboration.
38590
+
38591
+ ## C3: Components
38592
+
38593
+ Put component details in a separate file with \`extend\` when the service becomes
38594
+ interesting enough to decompose:
38595
+
38596
+ \`\`\`insight
38597
+ context ecommerce
38598
+
38599
+ extend service checkout_api
38600
+ component order_controller
38601
+ name = Order controller
38602
+ technology = REST
38603
+ responsibility = Accepts checkout requests and returns order status
38604
+ links:
38605
+ -> payment_client
38606
+
38607
+ component payment_client
38608
+ name = Payment client
38609
+ technology = HTTP client
38610
+ responsibility = Calls the external payment provider
38611
+ \`\`\`
38612
+
38613
+ Components should describe responsibilities, not every class or function.
38614
+
38615
+ ## C4 and Deployment
38616
+
38617
+ Use deployment profiles and infrastructure types when physical realization is
38618
+ important:
38619
+
38620
+ \`\`\`insight
38621
+ deploymentProfile production
38622
+ environments:
38623
+ eu
38624
+
38625
+ environment eu
38626
+ name = Europe
38627
+ \`\`\`
38628
+
38629
+ Attach deployment details to systems, containers, services, or links only when
38630
+ they clarify real runtime paths.
38631
+
38632
+ ## Layering Rules
38633
+
38634
+ - Model stable concepts first; avoid coding transient implementation details.
38635
+ - Keep identifiers short, lowercase, and stable.
38636
+ - Prefer \`name\` for display names and ids for references.
38637
+ - Use \`description\` for why a thing exists.
38638
+ - Use \`technology\` for concrete technical choices.
38639
+ - Use \`responsibility\` for components.
38640
+ - Split files by layer or subsystem once a file becomes hard to scan.
38641
+ - Validate after each layer before adding the next.
38642
+ `;
38643
+ }
38644
+ function genericValidationReference() {
38645
+ return `# Validation and Inspection
38646
+
38647
+ Run validation after every Insight edit:
38648
+
38649
+ \`\`\`shell
38650
+ archinsight link . --format text
38651
+ \`\`\`
38652
+
38653
+ The text output is TSV:
38654
+
38655
+ \`\`\`text
38656
+ level<TAB>code<TAB>source<TAB>line<TAB>column<TAB>message
38657
+ \`\`\`
38658
+
38659
+ Treat \`ERROR\` as blocking. \`WARNING\` and \`NOTE\` can still be useful design
38660
+ feedback.
38661
+
38662
+ Inspect project structure:
38663
+
38664
+ \`\`\`shell
38665
+ archinsight structure . --format text
38666
+ \`\`\`
38667
+
38668
+ Render a diagram when a context id is known:
38669
+
38670
+ \`\`\`shell
38671
+ archinsight render . -c <context-id> -v c1 -f svg -o diagram.svg
38672
+ archinsight render . -c <context-id> -v c2 -f svg -o diagram.svg
38673
+ \`\`\`
38674
+
38675
+ Useful built-in views:
38676
+
38677
+ - \`c1\` for system context.
38678
+ - \`c2\` for containers/services in the selected source.
38679
+ - \`c3\` for components in the selected source.
38680
+ - \`c4\` for deployment-oriented views.
38681
+ - \`no-filter\` for the full context.
38682
+
38683
+ When a render command depends on the active file, pass \`--source <file>\`.
38684
+
38685
+ If the CLI is missing, do not silently install it. Ask the user to install or
38686
+ expose \`@archinsight/cli\`.
38687
+ `;
38688
+ }
38689
+ function genericLayeredArchitectureExample() {
38690
+ return `context shop
38691
+ name = Shop Platform
38692
+
38693
+ external actor shopper
38694
+ name = Shopper
38695
+ technology = Browser
38696
+ description = Browses products and places orders
38697
+ links:
38698
+ -> storefront
38699
+
38700
+ external system payment_provider
38701
+ name = Payment Provider
38702
+ technology = HTTPS API
38703
+ description = Authorizes card payments
38704
+
38705
+ system storefront
38706
+ name = Storefront
38707
+ technology = Web application
38708
+ description = Customer-facing commerce experience
38709
+
38710
+ container web_app
38711
+ name = Web app
38712
+ technology = SvelteKit, TypeScript
38713
+ description = Renders product pages and checkout screens
38714
+ links:
38715
+ -> checkout_api
38716
+ technology = HTTPS, JSON
38717
+ description = Starts checkout and shows order status
38718
+
38719
+ service checkout_api
38720
+ name = Checkout API
38721
+ technology = Node.js, PostgreSQL
38722
+ description = Prices carts, creates orders, and coordinates payment
38723
+ links:
38724
+ -> payment_provider
38725
+ technology = HTTPS, JSON
38726
+ description = Requests payment authorization
38727
+
38728
+ component order_controller
38729
+ name = Order controller
38730
+ technology = REST
38731
+ responsibility = Accepts checkout requests and returns order status
38732
+ links:
38733
+ -> payment_client
38734
+
38735
+ component payment_client
38736
+ name = Payment client
38737
+ technology = HTTP client
38738
+ responsibility = Calls the payment provider and normalizes errors
38739
+ `;
38740
+ }
38025
38741
  var CliError = class extends Error {
38026
38742
  };
38027
38743
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archinsight/cli",
3
- "version": "3.0.0-snapshot.0",
3
+ "version": "3.0.0-snapshot.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "repository": {