@vibe-forge/workspace-assets 0.11.1 → 0.11.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.
@@ -467,6 +467,7 @@
467
467
  ]
468
468
  },
469
469
  "options": {
470
+ "systemPrompt": "<system-prompt>\nThe project system rules are:\n# review\n\n> 必须检查发布改动的回归风险。\n\n# demo/security\n\n> Use when: 插件安全规则\n> Rule file path: node_modules/@vibe-forge/plugin-demo/rules/security.md\n> Only read this rule file when the task matches the scenario above.\n</system-prompt>\n\n\n<system-prompt>\nThe following skill modules are loaded for the project:\n# research\n\n> Skill description: 检索资料\n> Skill file path: .ai/skills/research/SKILL.md\n> Resolve relative paths in the resource content relative to the directory containing this skill file.\n\n<skill-content>\n先阅读 README.md,再补充结论。\n</skill-content>\n</system-prompt>\n\n\n<system-prompt>\nThe project includes the following entities:\n - architect: 负责拆解方案的实体\n\nWhen solving user problems, you may specify entities through `VibeForge.StartTasks` as needed and have them coordinate multiple entity types to complete the work; use `VibeForge.GetTaskInfo` and `wait` to track progress.\n</system-prompt>\n\n\n<system-prompt>\nYou are a professional project execution manager who can skillfully direct other entities to work toward your goal. Expectations:\n\n- Never complete code development work alone\n- You must coordinate other developers to complete tasks\n- You must keep them aligned with the goal and verify that their completion reports meet the requirements\n\nChoose the appropriate workflow based on the user's needs and the actual development goal, and use the workflow identifier to locate and load the corresponding definition.\n- Pass the identifier based on the actual need. This is not a path; use the standard workflow loading capability to resolve it.\n- Decide how to pass parameters based on their descriptions and actual usage scenarios.\nThe project includes the following workflows:\n- Workflow name: release\n - Description: 正式发布流程\n - Identifier: release\n - Parameters:\n - None\n\n- Workflow name: demo/release\n - Description: 插件发布流程\n - Identifier: demo/release\n - Parameters:\n - None\n\n</system-prompt>\n\n\n执行正式发布,并整理变更摘要。",
470
471
  "systemPrompt": "<system-prompt>\nThe project system rules are:\n# review\n\n> 必须检查发布改动的回归风险。\n\n# demo/security\n\n> Use when: 插件安全规则\n> Rule file path: node_modules/@vibe-forge/plugin-demo/rules/security.md\n> Only read this rule file when the task matches the scenario above.\n</system-prompt>\n\n\n<system-prompt>\nThe following skill modules are loaded for the project:\n# research\n\n> Skill description: 检索资料\n> Skill file path: .ai/skills/research/SKILL.md\n> Resolve relative paths in the resource content relative to the directory containing this skill file.\n\n<skill-content>\n先阅读 README.md,再补充结论。\n</skill-content>\n</system-prompt>\n\n\n<system-prompt>\nThe project includes the following entities:\n - architect: 负责拆解方案的实体\n\nWhen solving user problems, you may specify entities through `VibeForge.StartTasks` as needed and have them coordinate multiple entity types to complete the work; use `VibeForge.GetTaskInfo` and `wait` to track progress.\n</system-prompt>\n\n\n<system-prompt>\nYou are a professional project execution manager who can skillfully direct other entities to work toward your goal. Expectations:\n\n- Never complete code development work alone\n- You must coordinate other developers to complete tasks\n- You must keep them aligned with the goal and verify that their completion reports meet the requirements\n\nChoose the appropriate workflow based on the user's needs and the actual development goal, and use the workflow identifier to locate and load the corresponding definition.\n- Pass the identifier based on the actual need. This is not a path; use the standard workflow loading capability to resolve it.\n- Decide how to pass parameters based on their descriptions and actual usage scenarios.\nThe project includes the following workflows:\n- Workflow name: release\n - Description: 正式发布流程\n - Identifier: release\n - Parameters:\n - None\n\n- Workflow name: demo/release\n - Description: 插件发布流程\n - Identifier: demo/release\n - Parameters:\n - None\n\n</system-prompt>\n\n\n执行正式发布,并整理变更摘要。",
471
472
  "tools": {
472
473
  "include": [
@@ -68,6 +68,57 @@ describe('resolveWorkspaceAssetBundle', () => {
68
68
  ]))
69
69
  })
70
70
 
71
+ it('loads workspace assets from the env-configured ai base dir', async () => {
72
+ const workspace = await createWorkspace()
73
+ const previousBaseDir = process.env.__VF_PROJECT_AI_BASE_DIR__
74
+
75
+ try {
76
+ process.env.__VF_PROJECT_AI_BASE_DIR__ = '.vf'
77
+ await writeDocument(join(workspace, '.vf/rules/review.md'), '---\ndescription: 评审规则\n---\n必须检查风险')
78
+ await writeDocument(join(workspace, '.vf/skills/research/SKILL.md'), '---\ndescription: 检索资料\n---\n阅读 README.md')
79
+
80
+ const bundle = await resolveWorkspaceAssetBundle({
81
+ cwd: workspace,
82
+ configs: [undefined, undefined],
83
+ useDefaultVibeForgeMcpServer: false
84
+ })
85
+
86
+ expect(bundle.rules.map(asset => asset.displayName)).toEqual(['review'])
87
+ expect(bundle.skills.map(asset => asset.displayName)).toEqual(['research'])
88
+ } finally {
89
+ if (previousBaseDir == null) {
90
+ delete process.env.__VF_PROJECT_AI_BASE_DIR__
91
+ } else {
92
+ process.env.__VF_PROJECT_AI_BASE_DIR__ = previousBaseDir
93
+ }
94
+ }
95
+ })
96
+
97
+ it('loads workspace entities from the env-configured entities dir', async () => {
98
+ const workspace = await createWorkspace()
99
+ const previousEntitiesDir = process.env.__VF_PROJECT_AI_ENTITIES_DIR__
100
+
101
+ try {
102
+ process.env.__VF_PROJECT_AI_ENTITIES_DIR__ = 'agents'
103
+ await writeDocument(join(workspace, '.ai/agents/reviewer/README.md'), '---\ndescription: 负责代码评审\n---\n检查风险')
104
+
105
+ const bundle = await resolveWorkspaceAssetBundle({
106
+ cwd: workspace,
107
+ configs: [undefined, undefined],
108
+ useDefaultVibeForgeMcpServer: false
109
+ })
110
+
111
+ expect(bundle.entities.map(asset => asset.displayName)).toEqual(['reviewer'])
112
+ expect(bundle.entities[0]?.sourcePath).toContain('/.ai/agents/reviewer/README.md')
113
+ } finally {
114
+ if (previousEntitiesDir == null) {
115
+ delete process.env.__VF_PROJECT_AI_ENTITIES_DIR__
116
+ } else {
117
+ process.env.__VF_PROJECT_AI_ENTITIES_DIR__ = previousEntitiesDir
118
+ }
119
+ }
120
+ })
121
+
71
122
  it('auto-loads managed Claude plugins from .ai/plugins as directory plugins', async () => {
72
123
  const workspace = await createWorkspace()
73
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-forge/workspace-assets",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "Workspace asset resolution and adapter asset planning for Vibe Forge",
5
5
  "imports": {
6
6
  "#~/*.js": {
@@ -32,7 +32,7 @@
32
32
  "@vibe-forge/config": "^0.11.1",
33
33
  "@vibe-forge/definition-core": "^0.11.0",
34
34
  "@vibe-forge/types": "^0.11.2",
35
- "@vibe-forge/utils": "^0.11.1"
35
+ "@vibe-forge/utils": "^0.11.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/js-yaml": "^4.0.9"
@@ -9,7 +9,7 @@ import {
9
9
  resolveDefaultVibeForgeMcpServerConfig
10
10
  } from '@vibe-forge/config'
11
11
  import type { Config, Definition, Entity, PluginConfig, WorkspaceAsset, WorkspaceAssetKind } from '@vibe-forge/types'
12
- import { resolveRelativePath } from '@vibe-forge/utils'
12
+ import { resolveProjectAiBaseDir, resolveProjectAiEntitiesDir, resolveRelativePath } from '@vibe-forge/utils'
13
13
  import { listManagedPluginInstalls, toManagedPluginConfig } from '@vibe-forge/utils/managed-plugin'
14
14
  import {
15
15
  flattenPluginInstances,
@@ -217,13 +217,15 @@ const createOpenCodeOverlayAsset = <TKind extends OpenCodeOverlayKind>(params: {
217
217
  } as OpenCodeOverlayAsset<TKind>)
218
218
 
219
219
  const scanWorkspaceDocuments = async (cwd: string) => {
220
+ const aiBaseDir = resolveProjectAiBaseDir(cwd, process.env)
221
+ const entitiesDir = resolveProjectAiEntitiesDir(cwd, process.env)
220
222
  const [rulePaths, skillPaths, specPaths, entityDocPaths, entityJsonPaths, mcpPaths] = await Promise.all([
221
- glob(['.ai/rules/*.md'], { cwd, absolute: true }),
222
- glob(['.ai/skills/*/SKILL.md'], { cwd, absolute: true }),
223
- glob(['.ai/specs/*.md', '.ai/specs/*/index.md'], { cwd, absolute: true }),
224
- glob(['.ai/entities/*.md', '.ai/entities/*/README.md'], { cwd, absolute: true }),
225
- glob(['.ai/entities/*/index.json'], { cwd, absolute: true }),
226
- glob(['.ai/mcp/*.json', '.ai/mcp/*.yaml', '.ai/mcp/*.yml'], { cwd, absolute: true })
223
+ glob(['rules/*.md'], { cwd: aiBaseDir, absolute: true }),
224
+ glob(['skills/*/SKILL.md'], { cwd: aiBaseDir, absolute: true }),
225
+ glob(['specs/*.md', 'specs/*/index.md'], { cwd: aiBaseDir, absolute: true }),
226
+ glob(['*.md', '*/README.md'], { cwd: entitiesDir, absolute: true }),
227
+ glob(['*/index.json'], { cwd: entitiesDir, absolute: true }),
228
+ glob(['mcp/*.json', 'mcp/*.yaml', 'mcp/*.yml'], { cwd: aiBaseDir, absolute: true })
227
229
  ])
228
230
 
229
231
  return {
@@ -441,7 +443,7 @@ export async function collectWorkspaceAssets(params: {
441
443
  name: DEFAULT_VIBE_FORGE_MCP_SERVER_NAME,
442
444
  config: defaultVibeForgeMcpServer,
443
445
  origin: 'workspace',
444
- sourcePath: resolve(params.cwd, '.ai')
446
+ sourcePath: resolveProjectAiBaseDir(params.cwd, process.env)
445
447
  }))
446
448
  }
447
449
  }