@archinsight/cli 3.0.0-snapshot.1 → 3.0.0-snapshot.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.
Files changed (3) hide show
  1. package/README.md +13 -5
  2. package/build/index.js +225 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -62,12 +62,15 @@ The generic target writes a runtime-neutral guide:
62
62
  references/
63
63
  syntax.md
64
64
  layered-architecture.md
65
+ queries.md
65
66
  validation.md
66
67
  examples/
67
68
  layered-architecture.ai
69
+ c2-containers.aiq
68
70
  ```
69
71
 
70
- Codex and Claude targets package the same Insight reference as skill folders:
72
+ Codex and Claude targets package the same Insight reference directly into the
73
+ native skill folders:
71
74
 
72
75
  ```shell
73
76
  archinsight skill init --target codex
@@ -75,21 +78,26 @@ archinsight skill init --target claude
75
78
  ```
76
79
 
77
80
  ```text
78
- .archinsight/skills/codex/archinsight/
81
+ .codex/skills/archinsight/
79
82
  SKILL.md
80
83
  agents/openai.yaml
81
84
  references/
82
85
  examples/
83
86
 
84
- .archinsight/skills/claude/archinsight/
87
+ .claude/skills/archinsight/
85
88
  SKILL.md
86
89
  references/
87
90
  examples/
88
91
  ```
89
92
 
93
+ After generating a Codex or Claude skill into the default location, restart the
94
+ agent session so the skill is discovered. Pass `--out <dir>` to write the same
95
+ package somewhere else.
96
+
90
97
  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.
98
+ avoid guessing Insight syntax from other architecture DSLs, describe systems
99
+ layer by layer from context to containers, components, and deployment details,
100
+ and write custom `.aiq` diagram queries with the supported Cypher-style subset.
93
101
 
94
102
  ## Output Contract
95
103
 
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.1";
37463
+ var version = "3.0.0-snapshot.2";
37464
37464
 
37465
37465
  // src/index.ts
37466
37466
  var hiddenStructureTypes = /* @__PURE__ */ new Set(["List", "Nothing", "Text", "text"]);
@@ -37651,11 +37651,12 @@ async function runSkill(args) {
37651
37651
  }
37652
37652
  async function runSkillInit(args, skillPackage) {
37653
37653
  const projectRoot = path.resolve(projectPath(args));
37654
+ const usesDefaultOutput = args.output === void 0;
37654
37655
  const outputRoot = path.resolve(projectRoot, args.output ?? skillPackage.defaultOutput);
37655
37656
  for (const file of skillPackage.files) {
37656
37657
  await writeGeneratedFile(path.join(outputRoot, file.path), file.content, args.force);
37657
37658
  }
37658
- process.stdout.write(skillPackageSuccess(projectRoot, outputRoot, skillPackage));
37659
+ process.stdout.write(skillPackageSuccess(projectRoot, outputRoot, skillPackage, usesDefaultOutput));
37659
37660
  }
37660
37661
  async function loadProject(input) {
37661
37662
  const root = path.resolve(input);
@@ -37731,11 +37732,11 @@ async function sourceFiles(directory) {
37731
37732
  const entries = await readdir(directory, { withFileTypes: true });
37732
37733
  const result = [];
37733
37734
  for (const entry of entries) {
37734
- if (entry.name === "node_modules" || entry.name === ".git" || entry.name === ".archinsight" || entry.name === "build") {
37735
- continue;
37736
- }
37737
37735
  const entryPath = path.join(directory, entry.name);
37738
37736
  if (entry.isDirectory()) {
37737
+ if (isIgnoredSourceDirectory(entry.name)) {
37738
+ continue;
37739
+ }
37739
37740
  result.push(...await sourceFiles(entryPath));
37740
37741
  } else if (entry.isFile() && entry.name.endsWith(".ai")) {
37741
37742
  result.push(entryPath);
@@ -37743,6 +37744,9 @@ async function sourceFiles(directory) {
37743
37744
  }
37744
37745
  return result.sort((left, right) => left.localeCompare(right));
37745
37746
  }
37747
+ function isIgnoredSourceDirectory(name) {
37748
+ return name.startsWith(".") || name === "node_modules" || name === "build" || name === "dist";
37749
+ }
37746
37750
  async function renderSvg(dot) {
37747
37751
  const viz = await instance();
37748
37752
  const result = viz.render(dot, { format: "svg", engine: "dot" });
@@ -38115,6 +38119,7 @@ function genericSkillPackage() {
38115
38119
  target: "generic",
38116
38120
  defaultOutput: ".archinsight/agent",
38117
38121
  entrypoint: "archinsight.md",
38122
+ installedByDefault: false,
38118
38123
  files: [
38119
38124
  {
38120
38125
  path: "archinsight.md",
@@ -38127,8 +38132,9 @@ function genericSkillPackage() {
38127
38132
  function codexSkillPackage() {
38128
38133
  return {
38129
38134
  target: "codex",
38130
- defaultOutput: ".archinsight/skills/codex/archinsight",
38135
+ defaultOutput: ".codex/skills/archinsight",
38131
38136
  entrypoint: "SKILL.md",
38137
+ installedByDefault: true,
38132
38138
  files: [
38133
38139
  {
38134
38140
  path: "SKILL.md",
@@ -38145,8 +38151,9 @@ function codexSkillPackage() {
38145
38151
  function claudeSkillPackage() {
38146
38152
  return {
38147
38153
  target: "claude",
38148
- defaultOutput: ".archinsight/skills/claude/archinsight",
38154
+ defaultOutput: ".claude/skills/archinsight",
38149
38155
  entrypoint: "SKILL.md",
38156
+ installedByDefault: true,
38150
38157
  files: [
38151
38158
  {
38152
38159
  path: "SKILL.md",
@@ -38170,27 +38177,39 @@ function sharedSkillFiles() {
38170
38177
  path: "references/validation.md",
38171
38178
  content: genericValidationReference()
38172
38179
  },
38180
+ {
38181
+ path: "references/queries.md",
38182
+ content: genericQueriesReference()
38183
+ },
38173
38184
  {
38174
38185
  path: "examples/layered-architecture.ai",
38175
38186
  content: genericLayeredArchitectureExample()
38187
+ },
38188
+ {
38189
+ path: "examples/c2-containers.aiq",
38190
+ content: genericC2QueryExample()
38176
38191
  }
38177
38192
  ];
38178
38193
  }
38179
- function skillPackageSuccess(projectRoot, outputRoot, skillPackage) {
38194
+ function skillPackageSuccess(projectRoot, outputRoot, skillPackage, usesDefaultOutput) {
38180
38195
  const lines = [
38181
38196
  `Generated ${skillPackage.target} Archinsight agent guide: ${displayPath(process.cwd(), outputRoot)}`,
38182
- "",
38183
- "Next steps:"
38197
+ ""
38184
38198
  ];
38185
38199
  if (skillPackage.target === "generic") {
38200
+ lines.push("Next steps:");
38186
38201
  lines.push(` 1. Share ${displayPath(projectRoot, path.join(outputRoot, skillPackage.entrypoint))} with your AI agent.`);
38187
38202
  lines.push(" 2. Ask the agent to validate Insight edits with: archinsight link . --format text");
38188
38203
  lines.push(" 3. Keep project-specific conventions near the generated guide or pass them in the prompt.");
38204
+ } else if (skillPackage.installedByDefault && usesDefaultOutput) {
38205
+ lines.push(`Notice: restart the ${skillPackage.target} session so the Archinsight skill is discovered.`);
38189
38206
  } else if (skillPackage.target === "codex") {
38207
+ lines.push("Next steps:");
38190
38208
  lines.push(` 1. Install or copy ${displayPath(projectRoot, outputRoot)} as the archinsight skill in your Codex skills directory.`);
38191
38209
  lines.push(" 2. Invoke it explicitly as $archinsight when editing Insight .ai models.");
38192
38210
  lines.push(" 3. Ask Codex to validate Insight edits with: archinsight link . --format text");
38193
38211
  } else {
38212
+ lines.push("Next steps:");
38194
38213
  lines.push(` 1. Import or copy ${displayPath(projectRoot, outputRoot)} into your Claude skill runtime.`);
38195
38214
  lines.push(" 2. Ask Claude to use the Archinsight skill before editing Insight .ai models.");
38196
38215
  lines.push(" 3. Validate Insight edits with: archinsight link . --format text");
@@ -38232,6 +38251,8 @@ If \`archinsight\` is not available, ask the user to install or expose
38232
38251
  - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38233
38252
  - Read \`references/layered-architecture.md\` when decomposing a system across
38234
38253
  C1/C2/C3/C4-style layers.
38254
+ - Read \`references/queries.md\` when writing custom diagram queries or \`.aiq\`
38255
+ files.
38235
38256
  - Read \`references/validation.md\` before running checks, structure inspection,
38236
38257
  or rendering.
38237
38258
  - Use \`examples/layered-architecture.ai\` as a compact valid model.
@@ -38257,6 +38278,8 @@ Treat this \`SKILL.md\` as the entrypoint. Load reference files only when needed
38257
38278
  - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38258
38279
  - Read \`references/layered-architecture.md\` before decomposing a system across
38259
38280
  C1/C2/C3/C4-style layers.
38281
+ - Read \`references/queries.md\` before writing custom diagram queries or \`.aiq\`
38282
+ files.
38260
38283
  - Read \`references/validation.md\` before running checks, structure inspection,
38261
38284
  or rendering commands.
38262
38285
 
@@ -38295,6 +38318,8 @@ If \`archinsight\` is not available, ask the user to install or expose
38295
38318
  - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38296
38319
  - Read \`references/layered-architecture.md\` when decomposing a system across
38297
38320
  C1/C2/C3/C4-style layers.
38321
+ - Read \`references/queries.md\` when writing custom diagram queries or \`.aiq\`
38322
+ files.
38298
38323
  - Read \`references/validation.md\` before running checks, structure inspection,
38299
38324
  or rendering.
38300
38325
  - Use \`examples/layered-architecture.ai\` as a compact valid model.
@@ -38321,6 +38346,8 @@ they are needed:
38321
38346
  - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38322
38347
  - Read \`references/layered-architecture.md\` before decomposing a system across
38323
38348
  C1/C2/C3/C4-style layers.
38349
+ - Read \`references/queries.md\` before writing custom diagram queries or \`.aiq\`
38350
+ files.
38324
38351
  - Read \`references/validation.md\` before asking the user to run validation,
38325
38352
  structure inspection, or rendering commands.
38326
38353
 
@@ -38379,6 +38406,8 @@ sections of Insight unless the existing layering is already understood.
38379
38406
  - Read \`references/syntax.md\` before writing unfamiliar Insight syntax.
38380
38407
  - Read \`references/layered-architecture.md\` when decomposing a system across
38381
38408
  C1/C2/C3/C4-style layers.
38409
+ - Read \`references/queries.md\` when writing custom diagram queries or \`.aiq\`
38410
+ files.
38382
38411
  - Read \`references/validation.md\` before running checks, structure inspection,
38383
38412
  or rendering.
38384
38413
  - Use \`examples/layered-architecture.ai\` as a compact valid model.
@@ -38672,6 +38701,13 @@ archinsight render . -c <context-id> -v c1 -f svg -o diagram.svg
38672
38701
  archinsight render . -c <context-id> -v c2 -f svg -o diagram.svg
38673
38702
  \`\`\`
38674
38703
 
38704
+ Run a custom query from a file:
38705
+
38706
+ \`\`\`shell
38707
+ archinsight query . -c <context-id> -s <source.ai> -q query.aiq -f text
38708
+ archinsight render . -c <context-id> -s <source.ai> -q query.aiq -f svg -o diagram.svg
38709
+ \`\`\`
38710
+
38675
38711
  Useful built-in views:
38676
38712
 
38677
38713
  - \`c1\` for system context.
@@ -38686,6 +38722,173 @@ If the CLI is missing, do not silently install it. Ask the user to install or
38686
38722
  expose \`@archinsight/cli\`.
38687
38723
  `;
38688
38724
  }
38725
+ function genericQueriesReference() {
38726
+ return `# Insight Query Reference
38727
+
38728
+ Insight diagram queries use a small Cypher-style subset evaluated in memory.
38729
+ Use queries to select which linked model elements and relationships appear in a
38730
+ diagram.
38731
+
38732
+ ## CLI Shape
38733
+
38734
+ \`\`\`shell
38735
+ archinsight query . -c <context-id> -s <source.ai> -q query.aiq -f text
38736
+ archinsight render . -c <context-id> -s <source.ai> -q query.aiq -f svg -o diagram.svg
38737
+ \`\`\`
38738
+
38739
+ The scope variables are:
38740
+
38741
+ - \`$context\` - selected context id from \`--context\`.
38742
+ - \`$tab\` - selected source identity from \`--source\` / \`--tab\`.
38743
+
38744
+ Pass \`--source\` when a query uses \`$tab\`.
38745
+
38746
+ ## Query Shape
38747
+
38748
+ Supported clauses:
38749
+
38750
+ \`\`\`cypher
38751
+ MATCH ...
38752
+ OPTIONAL MATCH ...
38753
+ WHERE ...
38754
+ GROUP BY ...
38755
+ RETURN ...
38756
+ \`\`\`
38757
+
38758
+ \`MATCH\` clauses come first. \`GROUP BY\` is optional and appears before
38759
+ \`RETURN\`. \`RETURN\` must list the aliases that should be rendered.
38760
+
38761
+ ## Node Patterns
38762
+
38763
+ Select all nodes:
38764
+
38765
+ \`\`\`cypher
38766
+ MATCH (element)
38767
+ WHERE element.context = $context
38768
+ RETURN element
38769
+ \`\`\`
38770
+
38771
+ Select by type label:
38772
+
38773
+ \`\`\`cypher
38774
+ MATCH (service:Service)
38775
+ WHERE service.context = $context
38776
+ RETURN service
38777
+ \`\`\`
38778
+
38779
+ Labels are case-sensitive and match Insight types such as \`System\`,
38780
+ \`Container\`, \`Service\`, \`Component\`, \`ExternalSystem\`, and
38781
+ \`DeploymentElement\`.
38782
+
38783
+ Use properties in patterns for exact matches:
38784
+
38785
+ \`\`\`cypher
38786
+ MATCH (service:Service {id: 'checkout_api', context: $context})
38787
+ RETURN service
38788
+ \`\`\`
38789
+
38790
+ ## Relationships
38791
+
38792
+ Select real relationships:
38793
+
38794
+ \`\`\`cypher
38795
+ MATCH (source)-[link]->(target)
38796
+ WHERE source.context = $context
38797
+ RETURN source, link, target
38798
+ \`\`\`
38799
+
38800
+ Use \`OPTIONAL MATCH\` when nodes should still appear even if a relationship is
38801
+ missing:
38802
+
38803
+ \`\`\`cypher
38804
+ MATCH (container:ContainerElement)
38805
+ WHERE container.sourceIdentity = $tab
38806
+ OPTIONAL MATCH (container)-[link]->(target)
38807
+ RETURN container, link, target
38808
+ \`\`\`
38809
+
38810
+ Relationship aliases must be returned for edges to render.
38811
+
38812
+ ## Filtering
38813
+
38814
+ Supported filters include:
38815
+
38816
+ \`\`\`cypher
38817
+ WHERE node.context = $context
38818
+ WHERE node.sourceIdentity = $tab
38819
+ WHERE node IS External
38820
+ WHERE NOT node IS DeploymentElement
38821
+ WHERE edge.projected = 'true'
38822
+ WHERE node.id IN ['api', 'web_app']
38823
+ WHERE node.technology CONTAINS 'PostgreSQL'
38824
+ WHERE node.type <> 'Context'
38825
+ WHERE node.context = $context AND NOT node IS External
38826
+ \`\`\`
38827
+
38828
+ Use single quotes for string literals.
38829
+
38830
+ ## Relationship Selectors
38831
+
38832
+ Relationship selectors are boolean flags inside relationship braces:
38833
+
38834
+ \`\`\`cypher
38835
+ OPTIONAL MATCH (node)-[derivedLink {derived}]->(target)
38836
+ OPTIONAL MATCH (node)-[projectedLink {projected}]->(target)
38837
+ OPTIONAL MATCH ROLLUP (node)-[rollupLink {derived}]->(target)
38838
+ \`\`\`
38839
+
38840
+ Use \`{derived}\` for rolled-up edges from child relationships. Use
38841
+ \`{projected}\` for deployment/projected edges.
38842
+
38843
+ ## Grouping
38844
+
38845
+ \`GROUP BY\` controls diagram clusters. Group by parent for C2/C3 style views:
38846
+
38847
+ \`\`\`cypher
38848
+ MATCH (container:ContainerElement)
38849
+ WHERE container.sourceIdentity = $tab
38850
+ OPTIONAL MATCH (container)-[link]->(target)
38851
+ GROUP BY container.parent
38852
+ RETURN container, link, target
38853
+ \`\`\`
38854
+
38855
+ For deployment views, grouping by a typed reference attribute is valid:
38856
+
38857
+ \`\`\`cypher
38858
+ MATCH (node:Element)
38859
+ WHERE node.sourceIdentity = $tab
38860
+ OPTIONAL MATCH ROLLUP (node)-[projectedLink {projected, sourceIdentity: $tab}]->(target)
38861
+ GROUP BY node.runsOn
38862
+ RETURN node, projectedLink, target
38863
+ \`\`\`
38864
+
38865
+ Do not rely on implicit Graphviz clustering. Put grouping in the query when the
38866
+ diagram needs stable layout.
38867
+
38868
+ ## Built-In View Patterns
38869
+
38870
+ C1 usually selects systems in the selected context and rolls lower-level links
38871
+ up to system-level relationships.
38872
+
38873
+ C2 usually selects \`ContainerElement\` nodes in \`$tab\`, returns direct internal
38874
+ relationships, and includes external systems through optional/rollup matches.
38875
+
38876
+ C3 usually starts from \`(container:ContainerElement)-[:CONTAINS]->(component)\`
38877
+ and returns component relationships.
38878
+
38879
+ C4 usually selects deployment and container nodes from \`$tab\`, uses
38880
+ \`OPTIONAL MATCH ROLLUP\`, and returns projected relationships.
38881
+
38882
+ ## Authoring Rules
38883
+
38884
+ - Start from the view question: context, containers, components, or deployment.
38885
+ - Use domain variable names: \`system\`, \`container\`, \`component\`, \`externalSystem\`.
38886
+ - Return every node and relationship alias needed for rendering.
38887
+ - Add \`GROUP BY\` deliberately for diagrams with clusters.
38888
+ - Validate query files with \`archinsight query\` before rendering.
38889
+ - Keep custom queries in \`.aiq\` files when they are reused.
38890
+ `;
38891
+ }
38689
38892
  function genericLayeredArchitectureExample() {
38690
38893
  return `context shop
38691
38894
  name = Shop Platform
@@ -38738,6 +38941,18 @@ system storefront
38738
38941
  responsibility = Calls the payment provider and normalizes errors
38739
38942
  `;
38740
38943
  }
38944
+ function genericC2QueryExample() {
38945
+ return `MATCH (container:ContainerElement)
38946
+ WHERE container.sourceIdentity = $tab
38947
+ OPTIONAL MATCH (container)-[internalLink]->(targetContainer:ContainerElement)
38948
+ OPTIONAL MATCH (container)-[outboundLink]->(externalSystem:SystemElement)
38949
+ WHERE externalSystem IS External
38950
+ OPTIONAL MATCH (sourceSystem:SystemElement)-[inboundLink]->(container)
38951
+ WHERE sourceSystem IS External
38952
+ GROUP BY container.parent
38953
+ RETURN container, internalLink, targetContainer, outboundLink, externalSystem, inboundLink, sourceSystem
38954
+ `;
38955
+ }
38741
38956
  var CliError = class extends Error {
38742
38957
  };
38743
38958
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archinsight/cli",
3
- "version": "3.0.0-snapshot.1",
3
+ "version": "3.0.0-snapshot.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "repository": {