From 503cdf59afc412e62f4a479b4d6e310a0df28875 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:18:20 +0000 Subject: [PATCH 01/13] Initial plan for issue From 173e88cf8834be55bc50bbe415c0722bce31b7ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:25:52 +0000 Subject: [PATCH 02/13] Fix editLink organization issue for products from external repos Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index a699f7d..1220c2a 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -25,6 +25,7 @@ export default defineConfig({ return { params: { organization: repoData?.organization, + repository: repoData?.repository, } } @@ -156,8 +157,23 @@ export default defineConfig({ const relativePath = pageData.relativePath const organization = pageData.params?.organization; + const repository = pageData.params?.repository; + + // If we have repository info from params, use it directly + if (organization && repository) { + const [_, ...rest] = relativePath.split('/') + const restPath = rest.join('/') + + if (relativePath.startsWith('api/')) { + return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}` + } + + if (relativePath.startsWith('products/')) { + return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}` + } + } - // Common calculation for repo extraction from relativePath + // Fallback to old logic for paths that don't have repo info const [_, repoName, ...rest] = relativePath.split('/') const repoNamePath = repoName?.replace(/\d+-/g, '') || '' const restPath = rest.join('/') From 01cc92c2a8e68d9d8bad335a9471680dfeb206c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:47:10 +0000 Subject: [PATCH 03/13] Fix repository name extraction for products after rewrite - use split[0] instead of split[1] Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 1220c2a..e0dfc2d 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -19,7 +19,16 @@ export default defineConfig({ const repositories = JSON.parse(fs.readFileSync('repositories.json', 'utf-8')); const repositoriesMap: Map = new Map(repositories.map((repoData: RepoData) => [repoData.repository, repoData])); - const repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, ''); + // For products, after rewrite the repository name is in the first segment (index 0) + // For api, the repository name is in the second segment (index 1) + let repoName: string; + if (pageData.relativePath.startsWith('api/')) { + repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, '') || ''; + } else { + // For products and other paths, repository name is in the first segment + repoName = pageData.relativePath.split('/')[0]?.replace(/\d+-/g, '') || ''; + } + const repoData = repositoriesMap.get(repoName); return { @@ -165,11 +174,17 @@ export default defineConfig({ const restPath = rest.join('/') if (relativePath.startsWith('api/')) { - return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}` + return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}`; } - if (relativePath.startsWith('products/')) { - return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}` + // For product pages, check if path starts with known product directory names + // or if we have repository info (indicating it's a product page) + const repoNames = ['autumn', 'winow', 'annotations', 'extends', 'autumn-cli', 'autumn-collections', 'autumn-logos']; + const isProductPage = repoNames.some(name => relativePath.startsWith(name + '/')) || + relativePath.split('/')[0] === repository; + + if (isProductPage) { + return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}`; } } @@ -180,11 +195,11 @@ export default defineConfig({ const orgName = organization || 'autumn-library'; if (relativePath.startsWith('api/')) { - return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/api/${restPath}` + return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/api/${restPath}`; } if (relativePath.startsWith('products/')) { - return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/product/${restPath}` + return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/product/${restPath}`; } return '' From 857e1ccf81137abf24759c817a40ad61495ddab2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:00:24 +0000 Subject: [PATCH 04/13] Fix repository detection for autumn root paths (getting-started, framework-elements) Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index e0dfc2d..32f5578 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -19,14 +19,23 @@ export default defineConfig({ const repositories = JSON.parse(fs.readFileSync('repositories.json', 'utf-8')); const repositoriesMap: Map = new Map(repositories.map((repoData: RepoData) => [repoData.repository, repoData])); - // For products, after rewrite the repository name is in the first segment (index 0) - // For api, the repository name is in the second segment (index 1) let repoName: string; + if (pageData.relativePath.startsWith('api/')) { + // For API paths, repository name is in the second segment after rewrite repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, '') || ''; } else { - // For products and other paths, repository name is in the first segment - repoName = pageData.relativePath.split('/')[0]?.replace(/\d+-/g, '') || ''; + // Check if this is a root-level autumn path (after rewrite from products/autumn/) + const firstSegment = pageData.relativePath.split('/')[0]; + const autumnRootDirs = ['getting-started', 'framework-elements']; + + if (autumnRootDirs.includes(firstSegment)) { + // This is autumn documentation at root level + repoName = 'autumn'; + } else { + // For other products, repository name is in the first segment after rewrite + repoName = firstSegment?.replace(/\d+-/g, '') || ''; + } } const repoData = repositoriesMap.get(repoName); @@ -170,20 +179,26 @@ export default defineConfig({ // If we have repository info from params, use it directly if (organization && repository) { - const [_, ...rest] = relativePath.split('/') - const restPath = rest.join('/') - if (relativePath.startsWith('api/')) { + // For API paths, remove 'api/' and repository name from path + const [_, repoSegment, ...rest] = relativePath.split('/') + const restPath = rest.join('/') return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}`; } - // For product pages, check if path starts with known product directory names - // or if we have repository info (indicating it's a product page) - const repoNames = ['autumn', 'winow', 'annotations', 'extends', 'autumn-cli', 'autumn-collections', 'autumn-logos']; - const isProductPage = repoNames.some(name => relativePath.startsWith(name + '/')) || - relativePath.split('/')[0] === repository; + // For product pages + const firstSegment = relativePath.split('/')[0]; + const autumnRootDirs = ['getting-started', 'framework-elements']; - if (isProductPage) { + if (autumnRootDirs.includes(firstSegment)) { + // This is autumn documentation at root level - path after first segment + const [_, ...rest] = relativePath.split('/') + const restPath = rest.join('/') + return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}`; + } else { + // This is other repository documentation - path after first segment (repository name) + const [_, ...rest] = relativePath.split('/') + const restPath = rest.join('/') return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}`; } } From 311171ce23962aa7cdcf7cf3163f4fc376254938 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:11:47 +0000 Subject: [PATCH 05/13] Remove hardcoded autumn directories, use pageData.filePath instead Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 32f5578..b48ed43 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -25,15 +25,14 @@ export default defineConfig({ // For API paths, repository name is in the second segment after rewrite repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, '') || ''; } else { - // Check if this is a root-level autumn path (after rewrite from products/autumn/) - const firstSegment = pageData.relativePath.split('/')[0]; - const autumnRootDirs = ['getting-started', 'framework-elements']; - - if (autumnRootDirs.includes(firstSegment)) { - // This is autumn documentation at root level + // Use filePath to determine if this is autumn documentation + // pageData.filePath contains the original path before rewrites + if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) { + // This is autumn documentation at root level (after rewrite from products/000-autumn/) repoName = 'autumn'; } else { // For other products, repository name is in the first segment after rewrite + const firstSegment = pageData.relativePath.split('/')[0]; repoName = firstSegment?.replace(/\d+-/g, '') || ''; } } @@ -186,11 +185,8 @@ export default defineConfig({ return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}`; } - // For product pages - const firstSegment = relativePath.split('/')[0]; - const autumnRootDirs = ['getting-started', 'framework-elements']; - - if (autumnRootDirs.includes(firstSegment)) { + // For product pages - use filePath to determine if it's autumn docs + if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) { // This is autumn documentation at root level - path after first segment const [_, ...rest] = relativePath.split('/') const restPath = rest.join('/') From 5e7874d4d18748118e250f22de3bb37e7c9f7373 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Wed, 11 Jun 2025 18:12:40 +0200 Subject: [PATCH 06/13] Create copilot-setup-steps.yml --- .github/workflows/copilot-setup-steps.yml | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000..24fa8fa --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,30 @@ +name: "Coding Agent Environment Setup" + +# Allow testing of the setup steps from your repository's "Actions" tab. +on: workflow_dispatch + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Set the permissions to the lowest permissions possible needed for your steps. + # Copilot will be given its own token for its operations. + permissions: + # Clone the repository to install dependencies + contents: read + + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '23' # Use the Node.js version compatible with VitePress + + - name: Install dependencies + run: npm install + + - name: Fetch documentation contents + run: npm run sync + + - name: Build the site + run: npm run docs:build From 7eb46ea07f41335a25ccb48c80ffd2e1c8780e5d Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Wed, 11 Jun 2025 18:16:56 +0200 Subject: [PATCH 07/13] Create copilot-instructions.md --- .github/copilot-instructions.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..d6a3c74 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,4 @@ +Это сайт на vitepress для экосистемы Autumn. Он содержит как описание продуктов, так и описание их API. +Локально уже установлен node.js, зависимости. +Документация подчинённых проектов (repositories.json) синхронизирована в каталог sync. +Структура сайта собирается динамически, с активным использованием rewrite rules. From 6ecddc8db240196913d6860e49a7dc7b9641d149 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Wed, 11 Jun 2025 18:21:17 +0200 Subject: [PATCH 08/13] Update copilot-setup-steps.yml --- .github/workflows/copilot-setup-steps.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 24fa8fa..1df7e8f 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -15,6 +15,10 @@ jobs: contents: read steps: + + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup Node.js uses: actions/setup-node@v4 with: From 8f6637eea7255fbd9c8f19a95d2caae98e9e2dda Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:25:14 +0000 Subject: [PATCH 09/13] Remove fallback logic from editLink pattern, just return empty string Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index b48ed43..c04a76b 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -199,20 +199,6 @@ export default defineConfig({ } } - // Fallback to old logic for paths that don't have repo info - const [_, repoName, ...rest] = relativePath.split('/') - const repoNamePath = repoName?.replace(/\d+-/g, '') || '' - const restPath = rest.join('/') - const orgName = organization || 'autumn-library'; - - if (relativePath.startsWith('api/')) { - return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/api/${restPath}`; - } - - if (relativePath.startsWith('products/')) { - return `https://github.com/${orgName}/${repoNamePath}/edit/master/docs/product/${restPath}`; - } - return '' } }, From e9efca73e443383d39770343f427eeb51b975ce6 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Wed, 11 Jun 2025 18:26:24 +0200 Subject: [PATCH 10/13] Update copilot-instructions.md --- .github/copilot-instructions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index d6a3c74..c355b96 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -2,3 +2,5 @@ Локально уже установлен node.js, зависимости. Документация подчинённых проектов (repositories.json) синхронизирована в каталог sync. Структура сайта собирается динамически, с активным использованием rewrite rules. + +Проверяй свои действия, собирая сайт и проверяя результирующие html-файлы. Используй curl на локальный адрес сайта только при необходимости. From 780c011428ff7e02d2b5e56af04ce0ece56d7fc0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:34:08 +0000 Subject: [PATCH 11/13] Remove unnecessary replace operations from relativePath processing Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index c04a76b..50a0c00 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -23,7 +23,7 @@ export default defineConfig({ if (pageData.relativePath.startsWith('api/')) { // For API paths, repository name is in the second segment after rewrite - repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, '') || ''; + repoName = pageData.relativePath.split('/')[1] || ''; } else { // Use filePath to determine if this is autumn documentation // pageData.filePath contains the original path before rewrites @@ -32,8 +32,7 @@ export default defineConfig({ repoName = 'autumn'; } else { // For other products, repository name is in the first segment after rewrite - const firstSegment = pageData.relativePath.split('/')[0]; - repoName = firstSegment?.replace(/\d+-/g, '') || ''; + repoName = pageData.relativePath.split('/')[0] || ''; } } From 81275eff7edf05e7f2e3a341ce12c13055df189c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:43:54 +0000 Subject: [PATCH 12/13] Fix autumn edit links to use entire relativePath instead of skipping first segment Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 50a0c00..a0dcf58 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -186,9 +186,8 @@ export default defineConfig({ // For product pages - use filePath to determine if it's autumn docs if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) { - // This is autumn documentation at root level - path after first segment - const [_, ...rest] = relativePath.split('/') - const restPath = rest.join('/') + // This is autumn documentation at root level - use entire relativePath + const restPath = relativePath return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}`; } else { // This is other repository documentation - path after first segment (repository name) From c824520e4a54f13c2adde2bb75b62ea870bf39c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:59:57 +0000 Subject: [PATCH 13/13] Use filePath consistently for all repository detection instead of mixed approach Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com> --- .vitepress/config.mts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index a0dcf58..2d299a5 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -19,20 +19,20 @@ export default defineConfig({ const repositories = JSON.parse(fs.readFileSync('repositories.json', 'utf-8')); const repositoriesMap: Map = new Map(repositories.map((repoData: RepoData) => [repoData.repository, repoData])); - let repoName: string; + let repoName: string = ''; - if (pageData.relativePath.startsWith('api/')) { - // For API paths, repository name is in the second segment after rewrite - repoName = pageData.relativePath.split('/')[1] || ''; - } else { - // Use filePath to determine if this is autumn documentation - // pageData.filePath contains the original path before rewrites - if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) { - // This is autumn documentation at root level (after rewrite from products/000-autumn/) - repoName = 'autumn'; - } else { - // For other products, repository name is in the first segment after rewrite - repoName = pageData.relativePath.split('/')[0] || ''; + // Use filePath for all variants to extract repository name + if (pageData.filePath) { + if (pageData.filePath.startsWith('api/')) { + // For API paths: api/000-autumn/... or api/003-extends/... + const pathSegments = pageData.filePath.split('/'); + const repoSegment = pathSegments[1] || ''; + repoName = repoSegment.replace(/^\d+-/, ''); // Remove number prefix + } else if (pageData.filePath.startsWith('products/')) { + // For product paths: products/000-autumn/... or products/003-extends/... + const pathSegments = pageData.filePath.split('/'); + const repoSegment = pathSegments[1] || ''; + repoName = repoSegment.replace(/^\d+-/, ''); // Remove number prefix } } @@ -184,8 +184,8 @@ export default defineConfig({ return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}`; } - // For product pages - use filePath to determine if it's autumn docs - if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) { + // For product pages - determine path based on repository type + if (repository === 'autumn') { // This is autumn documentation at root level - use entire relativePath const restPath = relativePath return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}`;