archgraph-argo 0.6.0 → 0.6.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.
@@ -8,6 +8,8 @@ applyTo: "**"
8
8
  当你领取到某个Workpackage后,进行任何开发活动前,必须先完成自我武装,从该Workpackage关联的元素中,找到完成任务需要使用的SKILL、需要遵守的全局规则。
9
9
  1. 对于需要的SKILL,请在.github/skills下创建一个或多个[SKILL名称]/SKILL.md;
10
10
  2. 对于要遵守的全局规则,需要在.github下面增加一个或多个 *.instructions.md文件。
11
+ 3. 工作完成后,需要将上面生成的SKILL和RULE刷新到知识图谱中对应的架构元素上,确保下次领取到该Workpackage的Agent可以直接获取到这些SKILL和RULE。
12
+ 4. 最后需要从.github/skills和.github下删除这些SKILL和RULE文件,确保仓库中不残留这些文件。
11
13
  </Principle>
12
14
 
13
15
  <Principle>
@@ -27,6 +29,10 @@ applyTo: "**"
27
29
  6. 知识图谱中所有的验收用例必须采用GIVEN-WHEN-THEN的格式进行描述和实现,以便于人类阅读同时可以自动化执行。
28
30
  </Principle>
29
31
 
32
+ <Guideline>
33
+ 当你探索上下文时,采用小步探索的方式,每次查询的深度不要过大,每次查询后,你可以根据查询结果,决定下一步的探索方向。
34
+ </Guideline>
35
+
30
36
  <instruction>
31
37
  你必须通过ARGO MCP server提供的工具来进行意图架构的读写操作,禁止直接修改意图架构的源文件:
32
38
  1. getIntentElementContext: 用于获取意图架构元素的上下文信息,包括元素的属性、关联关系等。
@@ -51,6 +51,7 @@ const VALIDATOR_TOOL_NAMES = new Set([
51
51
  const SYSTEM_ARCHITECTURE_TOOL_NAMES = new Set([
52
52
  'getSystemArchitecture',
53
53
  'getIntentElementContext',
54
+ 'getArchitectureViewContext',
54
55
  'previewSystemArchitectureMutation',
55
56
  'applySystemArchitectureMutation',
56
57
  'addArchitectureElement',
@@ -213,6 +213,11 @@ const TOOLS = [
213
213
  description: 'read-only query that returns an intent subgraph context for one element. Uses ArchiMate semantic dependency traversal with dependencyDepth and dependentDepth, preserving native subgraph elements, relationships, and views.',
214
214
  inputSchema: intentElementContextInputSchema(),
215
215
  },
216
+ {
217
+ name: 'getArchitectureViewContext',
218
+ description: 'read-only query that resolves one view by view_id into its complete membership: the view object, every member element (from included_elements), every member relationship (from included_relationships), the parent element, and optionally child sub-views declared by member elements. Resolves ids into full canonical objects instead of returning raw id lists.',
219
+ inputSchema: viewContextInputSchema(),
220
+ },
216
221
  {
217
222
  name: 'generateArchitectureDiffPlantuml',
218
223
  description: 'Generate a timestamped PlantUML Markdown tree for current git diff changes in SystemArchitecture.json. The tool compares HEAD and working tree, extracts changed elements/relationships, and writes to .argo/temp/architecture_analysis/.',
@@ -397,6 +402,20 @@ function intentElementContextInputSchema() {
397
402
  };
398
403
  }
399
404
 
405
+ function viewContextInputSchema() {
406
+ return {
407
+ type: 'object',
408
+ required: ['view_id'],
409
+ properties: {
410
+ architecturePath: { type: 'string', description: `Default: ${DEFAULT_GRAPH_PATH}` },
411
+ view_id: { type: 'string', description: 'The id of the view to resolve.' },
412
+ includeParentElement: { type: 'boolean', description: 'Default: true. Resolve the parent element referenced by the view.' },
413
+ includeChildViews: { type: 'boolean', description: 'Default: false. Include child views declared by member elements through subdiagram_views.' },
414
+ },
415
+ additionalProperties: false,
416
+ };
417
+ }
418
+
400
419
  function mutationInputSchema() {
401
420
  return {
402
421
  type: 'object',
@@ -625,6 +644,87 @@ function buildIntentElementContext(context, args = {}) {
625
644
  };
626
645
  }
627
646
 
647
+ function buildViewContext(context, args = {}) {
648
+ const viewId = typeof args.view_id === 'string' ? args.view_id.trim() : '';
649
+ if (!viewId) {
650
+ return {
651
+ status: 'failed',
652
+ error: { category: 'VIEW_ID_REQUIRED', message: 'view_id is required' },
653
+ };
654
+ }
655
+
656
+ const document = context.document;
657
+ const view = findView(document.views, viewId);
658
+ if (!view) {
659
+ return {
660
+ status: 'failed',
661
+ error: { category: 'VIEW_NOT_FOUND', message: `View '${viewId}' does not exist` },
662
+ };
663
+ }
664
+
665
+ const elementById = new Map((document.elements || []).map(element => [element.id, element]));
666
+ const relationshipById = new Map((document.relationships || []).map(relationship => [relationship.id, relationship]));
667
+
668
+ const elements = [];
669
+ const missingElementIds = [];
670
+ for (const elementId of view.included_elements || []) {
671
+ const element = elementById.get(elementId);
672
+ if (element) {
673
+ elements.push(clone(element));
674
+ } else {
675
+ missingElementIds.push(elementId);
676
+ }
677
+ }
678
+
679
+ const relationships = [];
680
+ const missingRelationshipIds = [];
681
+ for (const relationshipId of view.included_relationships || []) {
682
+ const relationship = relationshipById.get(relationshipId);
683
+ if (relationship) {
684
+ relationships.push(clone(relationship));
685
+ } else {
686
+ missingRelationshipIds.push(relationshipId);
687
+ }
688
+ }
689
+
690
+ const includeParentElement = args.includeParentElement !== false;
691
+ let parentElement = null;
692
+ if (includeParentElement && view.parent_element_id) {
693
+ const parent = elementById.get(view.parent_element_id);
694
+ parentElement = parent ? clone(parent) : null;
695
+ }
696
+
697
+ const includeChildViews = args.includeChildViews === true;
698
+ const childViews = [];
699
+ if (includeChildViews) {
700
+ const childViewIds = new Set();
701
+ for (const element of elements) {
702
+ for (const subview of element.subdiagram_views || []) {
703
+ if (subview && subview.view_id) {
704
+ childViewIds.add(subview.view_id);
705
+ }
706
+ }
707
+ }
708
+ for (const entry of document.views || []) {
709
+ if (childViewIds.has(entry.view_id)) {
710
+ childViews.push(clone(entry));
711
+ }
712
+ }
713
+ }
714
+
715
+ return {
716
+ status: 'passed',
717
+ graphPath: context.graphPath.relativePath,
718
+ view: clone(view),
719
+ elements,
720
+ relationships,
721
+ missingElementIds,
722
+ missingRelationshipIds,
723
+ parentElement,
724
+ childViews,
725
+ };
726
+ }
727
+
628
728
  function resolveFocusElement(document, args) {
629
729
  if (args.elementId) {
630
730
  const element = (document.elements || []).find(entry => entry.id === args.elementId);
@@ -1820,6 +1920,11 @@ async function callTool(name, args = {}, dependencies = undefined) {
1820
1920
  return toolResult(attachContextWarnings(buildIntentElementContext(context, args), context));
1821
1921
  }
1822
1922
 
1923
+ if (name === 'getArchitectureViewContext') {
1924
+ const context = await loadContext(args);
1925
+ return toolResult(attachContextWarnings(buildViewContext(context, args), context));
1926
+ }
1927
+
1823
1928
  if (name === 'generateArchitectureDiffPlantuml') {
1824
1929
  return toolResult(architectureDiffPlantuml.generateArchitectureDiffPlantuml({
1825
1930
  workspaceRoot: resolveWorkspaceRoot(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {