[{"data":1,"prerenderedAt":703},["ShallowReactive",2],{"/ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo/":3,"navigation-ja-jp":37,"banner-ja-jp":453,"footer-ja-jp":466,"Michael Friedrich":675,"next-steps-ja-jp":688},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"seo":8,"content":16,"config":27,"_id":30,"_type":31,"title":32,"_source":33,"_file":34,"_stem":35,"_extension":36},"/ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo","blog",false,"",{"title":9,"description":10,"ogTitle":9,"ogDescription":10,"noIndex":6,"ogImage":11,"ogUrl":12,"ogSiteName":13,"ogType":14,"canonicalUrls":12,"schema":15},"AI搭載のGitLab Duoでコードをモダンな言語にリファクタリング","この詳細なチュートリアルでは、デベロッパーがAIを活用し、コードを新しいプログラミング言語に移行してモダナイゼーションを進めるプロセスや、同じ言語における新機能についても学べる内容を紹介しています。","https://res.cloudinary.com/about-gitlab-com/image/upload/v1749662465/Blog/Hero%20Images/GitLab_Duo_Workflow_Unified_Data_Store__1_.png","https://about.gitlab.com/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo","https://about.gitlab.com","article","\n                        {\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"Article\",\n        \"headline\": \"AI搭載のGitLab Duoでコードをモダンな言語にリファクタリング\",\n        \"author\": [{\"@type\":\"Person\",\"name\":\"Michael Friedrich\"}],\n        \"datePublished\": \"2024-08-26\",\n      }",{"title":9,"description":10,"authors":17,"heroImage":11,"date":19,"body":20,"category":21,"tags":22,"updatedDate":26},[18],"Michael Friedrich","2024-08-26","コードベースやフレームワークのモダナイゼーションを行うために新しいプログラミング言語へ移行する必要があったり、同じ言語内の新しい機能の知識を深めたい場合は、AI搭載の[GitLab Duo](https://about.gitlab.com/gitlab-duo/)が有効です。ここでは、筆者が過去20年にわたるコーディングキャリアで培ったベストプラクティスをもとに、コードリファクタリングの際に直面する課題への効果的なアプローチ方法をご紹介します。\n\nこの記事では、VS CodeとJetBrains IDE（IntelliJ IDEA、PyCharm、CLion）を使用したプロンプトと例を紹介します。いずれのIDEにも[GitLab Duo拡張機能やプラグイン](https://docs.gitlab.com/ee/user/project/repository/code_suggestions/supported_extensions.html)がインストールされています。開発環境としてはGitLab.comが使用されています。ここでは大規模言語モデル（LLM）がAnthropic Claude 3.5にアップデートされており、GitLab Duoの[コード提案](https://docs.gitlab.com/ee/user/gitlab_duo/#code-suggestions)と[Duo Chat](https://docs.gitlab.com/ee/user/gitlab_duo/#gitlab-duo-chat)に適用されています。これらの機能は卓越したパフォーマンスと効率性を発揮します。\n\nこの記事では必要なセクションだけを確認しても良いですし、上から順を追って読んでも構いません。また、自己学習に役立つソースコードや演習問題も用意しています。\n\n- モダンなプログラミング言語標準に合わせたコードのリファクタリング\n    - Java 7のコードを生成し、Java 8にリファクタリング\n    - C++標準に基づいたリファクタリング\n        - 移行：C++03をC++14にリファクタリング\n        - ダウングレード：C++23をC++11にリファクタリング\n    - COBOLの説明とリファクタリング\n- 異なる言語間でのリファクタリング\n    - CをRustにリファクタリング\n    - PerlをPythonにリファクタリング\n- その他のリファクタリング実践例\n    - JavaScriptのリファクタリング\n    - BashをZSHやSHにリファクタリング\n    - その他のユースケースやチュートリアル\n- 重要なポイント\n\n## モダンなプログラミング言語標準に合わせたコードのリファクタリング\n\n次のセクションでは、特定のプログラミング言語におけるリファクタリングの方法、言語固有の違いの説明、および理解の仕方について解説します。\n\n### Java 7のコードを生成し、Java 8にリファクタリング\n\nあるお客様から、GitLab DuoがJava 7をサポートしているかどうかのご質問が寄せられました。Java 7固有のコードを生成するためのコード提案とGitLab Chatのプロンプトをテストしている際、移行支援についても考えました。Anthropic Claude 3.5と同様に、GitLab Duoも言語固有の違いを理解できます。\n\n次の例では、コード提案を使用してJava 7のコードを生成するプロンプトを示しています。\n\n```java\n// Generate a new class for a File Manager. Use Java 7 features only.\nimport java.io.*;\nimport java.nio.file.*;\nimport java.util.*;\n\npublic class FileManager {\n    private Path rootDirectory;\n\n    public FileManager(String rootPath) throws IOException {\n        this.rootDirectory = Paths.get(rootPath);\n        if (!Files.exists(rootDirectory)) {\n            Files.createDirectories(rootDirectory);\n        }\n    }\n\n    public void createFile(String fileName, String content) throws IOException {\n        Path filePath = rootDirectory.resolve(fileName);\n        Files.write(filePath, content.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);\n    }\n\n    public String readFile(String fileName) throws IOException {\n        Path filePath = rootDirectory.resolve(fileName);\n        return new String(Files.readAllBytes(filePath));\n    }\n\n    public void deleteFile(String fileName) throws IOException {\n        Path filePath = rootDirectory.resolve(fileName);\n        Files.delete(filePath);\n    }\n\n    public List\u003CString> listFiles() throws IOException {\n        List\u003CString> fileList = new ArrayList\u003C>();\n        try (DirectoryStream\u003CPath> stream = Files.newDirectoryStream(rootDirectory)) {\n            for (Path file : stream) {\n                fileList.add(file.getFileName().toString());\n            }\n        }\n        return fileList;\n    }\n\n    public void copyFile(String sourceFileName, String destinationFileName) throws IOException {\n        Path sourcePath = rootDirectory.resolve(sourceFileName);\n        Path destinationPath = rootDirectory.resolve(destinationFileName);\n        Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);\n    }\n\n    public void moveFile(String sourceFileName, String destinationFileName) throws IOException {\n        Path sourcePath = rootDirectory.resolve(sourceFileName);\n        Path destinationPath = rootDirectory.resolve(destinationFileName);\n        Files.move(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);\n    }\n\n    public long getFileSize(String fileName) throws IOException {\n        Path filePath = rootDirectory.resolve(fileName);\n        return Files.size(filePath);\n    }\n\n    public boolean fileExists(String fileName) {\n        Path filePath = rootDirectory.resolve(fileName);\n        return Files.exists(filePath);\n    }\n}\n```\n\nご自身のIDEで次の手順を進めてください。\n\n1. 生成されたコードを理解する：エディタでコード部分を選択（スクリーンショットの青色部分）し、GitLab Duo Chatに切り替えて、`/explain` スラッシュ(/) コマンドをプロンプトとして送信します。\n\n![GitLab Duo Chatで `/explain` スラッシュ(/) コマンドを使用して生成したコードを検証する](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/intellij_java7_generate_refactor.png)\n\n2. Java 7のコードをJava 8にリファクタリングする：エディタでコードを選択し、Chatに切り替えて、プロンプトを `/refactor using Java 8 features` に変更して送信します。\n3. リファクタリングの代替方法を練習する：新しいファイル `java8.java` を作成し、コード提案を使って `// Generate a new class for a File Manager. Use Java 8 features only.` というプロンプトでJava 8固有のコードを生成します。\n4. AI搭載のコード補完機能を使って、同じコンテキストでJava 8のコードの続きを記述します。\n\n次の録画ですべての手順をご覧になれます。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/XKRv6uBkD2I\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\nソースコードは[GitLab Duo Challenge - Generate and refactor Java 7 to 8 project ]( https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-generate-refactor-java-7-to-8)で取得できます。\n\n### C++標準に基づいたリファクタリング\n\nC++の標準には長い歴史があり、安定性と成熟度には信頼があります。ターゲットとなるアーキテクチャやプラットフォームに応じて、サポートされる標準はホストのオペレーティングシステム上のコンパイラに依存します。\n\n筆者は自身のキャリアを通して、25種類の異なるLinuxおよびWindowsディストリビューションをサポートするオープンソースプロジェクトに関わり、新しい言語機能やC++標準に対するコンパイラのサポートが多様であることを実感してきました。2015年にはC++11の機能を採用し、それ以降C++14やC++17に触れることはありませんでした。\n\n関数やアルゴリズムを新しいC++標準にリファクタリングするのには多大な労力がかかり、その違いを説明する支援が必要でした。当時は、リファクタリングの調べものを、書籍やオンライン検索、Stack Overflow、そして時にはツールの助けを借りて行っていました。\n\nしかし、AI搭載のアシストやGitLab Duoの登場で状況は変わりました。コード提案やDuo Chatに、特定のC++標準に準拠したソースコードを提示するよう指示したり、異なる出力を比較したりできるようになったのです。\nしかし、AI搭載のアシストやGitLab Duoの登場で状況は変わりました。コード提案やDuo Chatに、特定のC++標準に準拠したソースコードを提示するよう指示したり、異なる出力を比較したりできるようになったのです。\n\n次の例では、C++03標準に特化したプロンプトを使用してソースコードを生成しています。これは、`.ini` 構成フォーマット用のシンプルなコンフィグパーサー（configparser）を実装しています。\n\n```c++\n/* iniフォーマットを解析できるconfigparserを作成\nC++03標準のみを使用\n */\n\n#include \u003Ciostream>\n#include \u003Cfstream>\n#include \u003Cstring>\n#include \u003Cmap>\n#include \u003Csstream>\n\nclass ConfigParser {\nprivate:\n    std::map\u003Cstd::string, std::map\u003Cstd::string, std::string> > config;\n\npublic:\n    ConfigParser() {}\n\n    bool parse(const std::string& filename) {\n        std::ifstream file(filename.c_str());\n        if (!file.is_open()) {\n            return false;\n        }\n\n        std::string line;\n        std::string currentSection;\n\n        while (std::getline(file, line)) {\n            // Trim whitespace\n            size_t first = line.find_first_not_of(\" \\t\");\n            size_t last = line.find_last_not_of(\" \\t\");\n            if (first == std::string::npos) continue; // Skip empty lines\n            line = line.substr(first, (last - first + 1));\n\n            if (line[0] == '[' && line[line.length() - 1] == ']') {\n                // This is a section\n                currentSection = line.substr(1, line.length() - 2);\n            } else {\n                // This is a key-value pair\n                size_t delimiterPos = line.find('=');\n                if (delimiterPos != std::string::npos) {\n                    std::string key = line.substr(0, delimiterPos);\n                    std::string value = line.substr(delimiterPos + 1);\n                    config[currentSection][key] = value;\n                }\n            }\n        }\n\n        file.close();\n        return true;\n    }\n\n    std::string getValue(const std::string& section, const std::string& key) const {\n        std::map\u003Cstd::string, std::map\u003Cstd::string, std::string> >::const_iterator sectionIt = config.find(section);\n        if (sectionIt != config.end()) {\n            std::map\u003Cstd::string, std::string>::const_iterator keyIt = sectionIt->second.find(key);\n            if (keyIt != sectionIt->second.end()) {\n                return keyIt->second;\n            }\n        }\n        return \"\";\n    }\n\n    void printConfig() const {\n        std::map\u003Cstd::string, std::map\u003Cstd::string, std::string> >::const_iterator sectionIt;\n        for (sectionIt = config.begin(); sectionIt != config.end(); ++sectionIt) {\n            std::cout \u003C\u003C \"[\" \u003C\u003C sectionIt->first \u003C\u003C \"]\" \u003C\u003C std::endl;\n            std::map\u003Cstd::string, std::string>::const_iterator keyIt;\n            for (keyIt = sectionIt->second.begin(); keyIt != sectionIt->second.end(); ++keyIt) {\n                std::cout \u003C\u003C keyIt->first \u003C\u003C \" = \" \u003C\u003C keyIt->second \u003C\u003C std::endl;\n            }\n            std::cout \u003C\u003C std::endl;\n        }\n    }\n};\n\nint main() {\n    ConfigParser parser;\n    if (parser.parse(\"config.ini\")) {\n        std::cout \u003C\u003C \"Config file parsed successfully.\" \u003C\u003C std::endl;\n        parser.printConfig();\n\n        std::cout \u003C\u003C \"Value of 'key1' in 'section1': \" \u003C\u003C parser.getValue(\"section1\", \"key1\") \u003C\u003C std::endl;\n    } else {\n        std::cout \u003C\u003C \"Failed to parse config file.\" \u003C\u003C std::endl;\n    }\n    return 0;\n}\n```\n\n同じプロンプトを、[コードの説明](https://docs.gitlab.com/ee/user/gitlab_duo_chat/examples.html#explain-code-in-the-ide)、[テスト生成](https://docs.gitlab.com/ee/user/gitlab_duo_chat/examples.html#write-tests-in-the-ide)、さらには[コードのリファクタリング](https://docs.gitlab.com/ee/user/gitlab_duo_chat/examples.html#refactor-code-in-the-ide)にも適用できます。たとえば、`/explain focus on C++03 features`、`/tests for C++03 features`、`/refactor into C++03` などです。 \n\n次のC++標準は、GitLab Duoのコード提案を使用して動作を確認済みです。\n\n- C++03\n- C++11\n- C++14\n- C++17\n- C++20\n- C++23\n\nソースコードは、[Challenge - Refactor Cpp Standards Config Parser project](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-cpp-standards-config-parser)で取得できます。\n\nC++標準間でソースコードをリファクタリングする組み合わせは数多く存在します。次の例では、C++コードを最新バージョンにアップグレードするケースに焦点を当てています。一方、熱心なデベロッパーがC++20を使用したいものの、エンタープライズな顧客環境をサポートするためにC++11にダウングレードしなければならなかったというシナリオもテストしています。\n\n#### 移行：C++03をC++14にリファクタリング\n\nここでは、コードのモダナイゼーションを行い、C++03からC++14への変更点を理解することを目標とします。IDEで[03.cpp](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-cpp-standards-config-parser/-/blob/main/03.cpp?ref_type=heads)のソースコードを開き、選択した後、次のChatプロンプトを使用します。\n\n```markdown\n/refactor into C++14 and explain the changes\n（日本語訳：/C++14にリファクタリングし、変更を説明してください）\n```\n\nChatの回答例：\n\n```markdown\n…\n\n変更点の説明：\n\n1. デフォルトコンストラクタ: `ConfigParser() {}` を `ConfigParser() = default;` に変更し、デフォルトコンストラクタを使用しました。\n2. ファイルオープン: ファイルを開く際、`.c_str()` を削除しました。C++11以降では、`std::string` が直接サポートされています。\n3. ラムダ関数: 文字列のトリミング処理を行うラムダ関数trimを導入し、コードの可読性と再利用性を向上させました。\n4. 自動キーワード: 型推論のために様々な箇所で `auto` を使用し、コードの可読性を改善しました。\n5. 範囲ベースのforループ:  `printConfig` メソッド内で従来のforループを範囲ベースのforループに置き換え、より簡潔でエラーが少ない構造にしました。\n6. 構造化束縛: 範囲ベースのforループで構造化束縛を使用し、キーと値のペアに直接アクセスできるようにしました。\n7. 初期化付きif文: `getValue` メソッド内で、検索操作と条件チェックを1行で行える初期化付きif文を使用しました。\n8. 文字列メンバー関数: 文字列の最初と最後の文字を取得する際に、配列風のアクセスではなく `front()` と `back()` を使用しました。\n9. 初期化の統一: オブジェクトの生成時に `()` ではなく `{}` を使用する統一された初期化を採用しました。\n10. `std::endl` の削除： `std::endl` を `'\\n'` に置き換え、パフォーマンスを向上させました。`std::endl` は出力バッファーを強制的にフラッシュするためです。\n\nこれらの変更により、コードはよりモダンで簡潔になり、同じ機能を維持しつつ効率性が向上しています。\n\n```\n\n![コードに反映された変更](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/duo_refactor_cpp_clion_chat_cpp03_to_14_01.png)\n\n![コードに反映された変更2](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675060/Blog/Content%20Images/duo_refactor_cpp_clion_chat_cpp03_to_14_02.png)\n\n#### ダウングレード：C++23をC++11にリファクタリング\n\n時に、デベロッパーはC++20のようなモダンなC++標準で新しい機能の概念実証を開始しますが、エンタープライズな顧客環境で実際にサポートされているバージョンでは、C++11をサポートする古いコンパイラが必要になる場合があります。バージョンをダウングレードするにはコストがかかるほか、どの言語機能がまだサポートされているかを確認し、潜在的なデメリットを検討する必要があります。\n\nIDEで[23.cpp](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-cpp-standards-config-parser/-/blob/main/23.cpp?ref_type=heads)のソースコードを開き、選択した後、次のChatプロンプトを使用します。\n\n```markdown\n/refactor into C++11, explain the necessary changes and potential problems\n（日本語訳：/C++14にリファクタリングし、必要な変更点と潜在的な問題点を説明してください）\n```\n\nDuo Chatの回答例：\n\n```markdown\nこのコードをC++11に対応させるために必要な主な変更点は次の通りです：\n\n1. C++23標準のコメントを削除しました。これはもう適用されないためです。\n2. trim関数内で `std::string::find_first_not_of` と  `std::string::find_last_not_of` をC++11対応の代替方法に置き換えました。\n3. ループ変数には `auto` の代わりに `const auto&` を使用し、不要なコピーを避けました。\n\nオリジナルのコードにおける潜在的な問題点は次の通りです：\n\n1. オリジナルのコードはC++23の機能を使用しており、まだ広くサポートされていない可能性があります。\n2. `trim` 関数では `std::string::find_first_not_of` と `std::string::find_last_not_of` を使用しており、これらはC++11には存在しません。\n3. 一部のループで `const auto&` の代わりに `auto` を使用していないと、複雑なオブジェクトが不必要にコピーされる可能性があります。\n\nこれらの問題はリファクタリング版で解決されています。`trim` 関数は、C++11対応の場合と同じ結果を得るために、ラムダ関数を使った `std::find_if_not` を利用するように変更されました。また、 `const auto&` を使用することで、設定マップを反復処理する際に不要なコピーが行われないようにしました。\n```\n\n![`trim` 関数は、C++11に対応する形で、ラムダ関数を使った `std::find_if_not` を使用して同じ結果をもたらすようになりました](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/duo_refactor_cpp_clion_chat_cpp23_to_11_01.png)\n\n![`const auto&` を使用することで、configマップを反復処理する際の不要なコピーの生成を防ぎ、パフォーマンスを最適化できます](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/duo_refactor_cpp_clion_chat_cpp23_to_11_02.png)\n\n**非同期練習**：他のバージョンのリファクタリングシナリオをテストしてみましょう。\n\n### COBOLの説明とリファクタリング\n\nGitLab Duoを使用して、COBOLプログラムのソースコードを説明させたり、解析、修正、リファクタリングを実行してもらえます。筆者はCOBOLを書いたことも学んだこともありませんでしたが、この[COBOL Programming Course](https://github.com/openmainframeproject/cobol-programming-course)では豊富な例が紹介されていて有用だと感じました。\n\nその後、次のように、Chatに「COBOLの始め方」「COBOLプログラムの作成方法」「macOSでのCOBOLプログラムのコンパイル方法」について質問しました。\n\n```markdown\nPlease explain what COBOL is and its syntax\n（日本語訳：COBOLとは何か、その構文について説明してください。）\n\nPlease create a COBOL program that shows the first steps\n（日本語訳：COBOLプログラムを作成し、最初のステップを示してください。）\n\nTell me more about the COBOL compiler. Which system do I need? Can I do it on my macOS?\n（日本語訳：COBOLコンパイラについて教えてください。どのようなシステムが必要ですか？ macOSで実行できますか？）\n```\t\n\n![GitLab Duo Chatに説明とその構文を求める](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/vscode_chat_cobol_generate_example.png)\n\nCOBOLプログラムを開き、ソースコードを選択したら、Duo Chatに切り替えて、`/explain` プロンプトを送信し、目的や機能を説明してもらいましょう。\n\nまた、プロンプトをさらに洗練して、全体像をより反映したサマリーを取得することもできます。\n\n```markdown \n/explain like I am five\n（日本語訳：/explain ５歳児にもわかるように説明してください。）\n```\n\n> ヒント：プログラミング言語は、類似したアルゴリズムや機能を共有しています。COBOLについては、ChatによるPythonを介した説明が提供されたため、以降のプロンプトではPythonでの説明を求めるように調整しました。\n\n```markdown\n/explain in a different programming language\n（日本語訳：/explain 異なるプログラミング言語で説明してください。）\n```\n\nChatでは、`/refactor` スラッシュ（/）コマンドを使用して、コード品質の改善、潜在的な問題の修正、およびCOBOLのPythonへのリファクタリングを実行できます。\n\n```markdown\n/refactor fix the environment error\n（日本語訳：/refactor 環境上のエラーを修正してください。）\n\n/refactor fix potential problems\n（日本語訳：/refactor 潜在的な問題を修正してください。）\n\n/refactor into Python\n（日本語訳：/refactor Pythonにリファクタリングしてください。）\n```\n\n次の[GitLab Duo Coffee Chat - Challenge: Explain and Refactor COBOL programs](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-explain-refactor-cobol-program)の録画では、欠落しているピリオドの見つけ方など、すべての手順が実際のユースケースをもとに説明されています。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/pwlDmLQMMPo\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\n## 異なる言語間でのリファクタリング\n\nモダナイゼーションとコード品質の改善には、プログラミング言語の変更が必要になる場合があります。GitLab Duoのリファクタリングプロンプトを使用して、移行プロセスを迅速に進められますCOBOLとPythonの例は、エンタープライズ環境において一般的な要件のひとつに過ぎません。その他のユースケースを詳しく見ていきましょう。\n\n### CをRustにリファクタリング\n\n2024年初頭に、Cを始めとするいくつかのプログラミング言語は、メモリの安全性に問題があると指摘されました。今後のプロジェクトでは、Rustのような[メモリ安全な言語](https://about.gitlab.com/blog/memory-safe-vs-unsafe/)（英語）が推奨されています。ここでは、移行へのアプローチや、想定すべき課題について理解しましょう。\n\n簡単なCの例で試してみましょう。このコードはコード提案を使用して生成されており、オペレーティングシステムの基本情報（名前、バージョン、プラットフォームなど）を表示します。このCコードは、Windows、Linux、macOSでクロスプラットフォームにコンパイルできます。\n\n```c\n// OSファイルを読み込み、プラットフォーム、名前、バージョンを特定する\n// ターミナルに出力する\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n\n#ifdef _WIN32\n    #include \u003Cwindows.h>\n#elif __APPLE__\n    #include \u003Csys/utsname.h>\n#else\n    #include \u003Csys/utsname.h>\n#endif\n\nvoid get_os_info() {\n    #ifdef _WIN32\n        OSVERSIONINFOEX info;\n        ZeroMemory(&info, sizeof(OSVERSIONINFOEX));\n        info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);\n        GetVersionEx((OSVERSIONINFO*)&info);\n\n        printf(\"Platform: Windows\\n\");\n        printf(\"Version: %d.%d\\n\", info.dwMajorVersion, info.dwMinorVersion);\n        printf(\"Build: %d\\n\", info.dwBuildNumber);\n    #elif __APPLE__\n        struct utsname sys_info;\n        uname(&sys_info);\n\n        printf(\"Platform: macOS\\n\");\n        printf(\"Name: %s\\n\", sys_info.sysname);\n        printf(\"Version: %s\\n\", sys_info.release);\n    #else\n        struct utsname sys_info;\n        uname(&sys_info);\n\n        printf(\"Platform: %s\\n\", sys_info.sysname);\n        printf(\"Name: %s\\n\", sys_info.nodename);\n        printf(\"Version: %s\\n\", sys_info.release);\n    #endif\n}\n\nint main() {\n    get_os_info();\n    return 0;\n}\n```\n\nここでは、JetBrains CLionなどを使用して [`os.c`](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-c-to-rust/-/blob/897bf57a14bb7be07d842e7f044f93a61456d611/c/os.c) のソースコードを開きます。 ソースコードを選択し、Chatプロンプトで `/explain` を使用して目的や機能を説明します。次に、Chatプロンプトで `/refactor` を使用してCコードをリファクタリングし、さらに `/refactor into Rust` を使用してRustにリファクタリングします。\n\n新しいRustプロジェクトを初期化（ヒント：Duo Chatに質問してみましょう）し、生成されたソースコードを `src/main.rs` ファイルにコピーします。`cargo build` を実行してコードをコンパイルします。\n\n![新しいRustプロジェクトを初期化し、生成されたソースコードを `src/main.rs` ファイルにコピーします。`cargo build` を実行してコードをコンパイルします。](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/jetbrains_clion_c_rust.png)\n\n[GitLab Duo Coffee Chat: Challenge - Refactor C into Rust ]( https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-c-to-rust)の録画では、の録画では、すべての手順を確認できるほか、コンパイルエラーが発生し、それがChatと `/refactor` スラッシュ(/) コマンドによって修正される様子もご覧になれます。また、このセッションでは、新しいRustコードのメンテナンス性を向上させるために、エラーハンドリングを追加する方法も紹介されています。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/nf8g2ucqvkI\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\n### PerlをPythonにリファクタリング\n\n本番環境サーバーでジョブを実行するスクリプトがありますが、作成者は10年前に退社しており、誰もそのスクリプトに手を付けたがりません。この問題は、複数のスクリプトや、さらにはアプリケーション全体にも影響している可能性があります。そこで、すべてをモダンなPython 3に移行する決定が下されました。ここでは、コードのモダナイゼーションを行い、PerlからPythonへの変更点を理解することを目標とします。\n\n最近、GitLab Duoのワークショップに参加したお客様から、GitLab Duoを使って直接移行が可能かどうかという質問がありました。一言でお答えすれば、「可能」です。これを詳しく説明するならば、この記事にある他の例と同様に、洗練されたChatプロンプトを使用することで、PerlコードをPythonにリファクタリングすることができます。\n\n`script.pl` ソースコードをIDEで開き、選択して、Chatを開きます。\n\n```perl\n#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nopen my $md_fh, '\u003C', 'file.md' or die \"Could not open file.md: $!\";\n\nmy $l = 0;\nmy $e = 0;\nmy $h = 0;\n\nwhile (my $line = \u003C$md_fh>) {\n  $l++;\n  if ($line =~ /^\\s*$/) {\n    $e++;\n    next;\n  }\n  if ($line =~ /^#+\\s*(.+)/) {\n    print \"$1\\n\";\n    $h++; \n  }\n}\n\nprint \"\\nS:\\n\"; \nprint \"L: $l\\n\";\nprint \"E: $e\\n\"; \nprint \"H: $h\\n\";\n```\n\n次のプロンプトを使用できます：\n\n1. `/explain` でその目的を説明させ、 `/refactor` でコードを改善させます。\n2. `/refactor into Python`：実行可能なPythonスクリプトを取得します。\n\n![Pythonへのリファクタリング](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/pycharm_duo_refactor_perl_python.png)\n\n> ヒント：Perlコードは、より多くのターゲット言語にリファクタリングできます。[GitLab Duo Coffee Chat：チャレンジ - PerlからPythonへのリファクタリング](https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-perl-python)の録画では、PHP、Ruby、Rust、Go、Java、VB.NET、C#などの言語も取り上げています。\n>\n> Perlスクリプトの使用を継続するには、Duoのコード提案で[Perlを追加言語として](https://docs.gitlab.com/ee/user/project/repository/code_suggestions/supported_extensions.html#add-support-for-more-languages)設定できます。ChatはすでにPerlを理解しており、質問やスラッシュ（/） コマンドのプロンプトにも対応できます。次の録画でこれについて確認できます。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/03HGhxXg9lw\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\n## その他のリファクタリング実践例\n\n### JavaScriptのリファクタリング\n\nJavaScriptをリファクタリングしてコード品質を向上させたり、機能を追加したりする方法について、Eddie Jaoudeが実用的な例を交えて紹介しています。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/mHn8KOzpPNY\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\n### BashをZSHやSHにリファクタリング\n\n筆者はBashをShellとして20年間使用していましたが、最近になってmacOSのZSHに移行しました。この移行に伴い、スクリプトが機能しなくなったり、端末に不明なエラーが発生したりしました。リファクタリングの別のユースケースとして、Shellの制約があります。たとえば、一部のオペレーティングシステムやLinux/Unixディストリビューション（Alpineなど）では、Bashが提供されておらず、SHしか使用できません。\n\n![シェルスクリプトのリファクタリング](https://res.cloudinary.com/about-gitlab-com/image/upload/v1749675059/Blog/Content%20Images/intellj_refactor_shell_scripts.png)\n\n[GitLab Duo Coffee Chat: Challenge - Refactor Shell Scripts ]( https://gitlab.com/gitlab-da/use-cases/ai/ai-workflows/gitlab-duo-challenges/code-challenges/challenge-refactor-shell-scripts)では、syslogファイルを追跡するCプログラムと、Bashで記述されたビルドスクリプトの例が紹介されています。このチャレンジの中では、コードの改善を目的として、Chatに対して `/explain` や `/refactor` のプロンプトが使用されます。また、BashをPOSIX準拠のSHやZSHにリファクタリングすることもできます。セッションの最後では、Chatに5つの異なるShellスクリプトの実装を提供させ、そのサマリーについて説明するようリクエストしています。\n\n\u003C!-- 空白行 -->\n\u003Cfigure class=\"video_container\">\n  \u003Ciframe src=\"https://www.youtube.com/embed/mssqYjlKGzU\" frameborder=\"0\" allowfullscreen=\"true\"> \u003C/iframe>\n\u003C/figure>\n\u003C!-- 空白行 -->\n\n### その他のユースケースとチュートリアル\n\n- [ドキュメント：GitLab Duoのユースケース](https://docs.gitlab.com/ee/user/gitlab_duo/use_cases.html)\n- [チュートリアル：AI搭載のGitLab Duoチャットを使用するためのベストプラクティス【10選】](https://about.gitlab.com/blog/top-tips-for-efficient-ai-powered-code-suggestions-with-gitlab-duo/)\n- [チュートリアル：AI搭載のGitLab Duoチャットを使用するためのベストプラクティス【10選】](https://about.gitlab.com/ja-jp/blog/10-best-practices-for-using-ai-powered-gitlab-duo-chat/)\n\n## 重要なポイント\n\n1. GitLab Duoは、コードの説明やリファクタリングにおいて効率的なサポートを提供します。\n1. 言語標準間でコードをリファクタリングしたり、Chatで追加の質問をしたりできます。\n1. コード提案のプロンプトは、特定の言語標準に基づいたコードを生成できます。また、コード補完は現行のコードのコンテキストを尊重します。\n1. 新しいプログラミング言語へのリファクタリングは、長期的な移行プロセスやモダナイゼーションの計画に有効です。\n1. コードは、古いシステムがサポートする言語標準に「ダウングレード」することもできます。\n1. GitLab Duoは、複雑なコードやプログラミング言語について、異なるプログラミング言語の例を用いて説明できます。\n1. GitLab.comにおけるAnthropic Claude 3.5へのアップデートにより、コード提案およびChatの質と速度がさらに向上しました（Self-Managed版では17.3へのアップグレードを推奨しています）。\n1. 本番環境における問題がある場合を除き、ユースケースはアイデア次第で無限に広がります。\n\nコード提案とChatを活用した効率的なワークフローについて理解を深めましょう。GitLab DuoのAI搭載コードリファクタリングを、今すぐお試しいただけます。\n\n> [GitLab Duoのの無料トライアルを開始しましょう！](https://about.gitlab.com/ja-jp/solutions/gitlab-duo-pro/sales/?type=free-trial&toggle=gitlab-duo-pro_)\n\n*監修：知念 梨果 [@rikachinen](https://gitlab.com/rikachinen)* \u003Cbr>\n*（GitLab合同会社 カスタマーサクセス本部 カスタマーサクセスエンジニア）*\n","ai-ml",[23,24,25],"AI/ML","tutorial","DevSecOps","2025-02-10",{"slug":28,"featured":6,"template":29},"refactor-code-into-modern-languages-with-ai-powered-gitlab-duo","BlogPost","content:ja-jp:blog:refactor-code-into-modern-languages-with-ai-powered-gitlab-duo.yml","yaml","Refactor Code Into Modern Languages With Ai Powered Gitlab Duo","content","ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo.yml","ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo","yml",{"_path":38,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"data":40,"_id":449,"_type":31,"title":450,"_source":33,"_file":451,"_stem":452,"_extension":36},"/shared/ja-jp/main-navigation","ja-jp",{"logo":41,"freeTrial":46,"sales":51,"login":56,"items":61,"search":393,"minimal":427,"duo":440},{"config":42},{"href":43,"dataGaName":44,"dataGaLocation":45},"/ja-jp/","gitlab logo","header",{"text":47,"config":48},"無料トライアルを開始",{"href":49,"dataGaName":50,"dataGaLocation":45},"https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com&glm_content=default-saas-trial/","free trial",{"text":52,"config":53},"お問い合わせ",{"href":54,"dataGaName":55,"dataGaLocation":45},"/ja-jp/sales/","sales",{"text":57,"config":58},"サインイン",{"href":59,"dataGaName":60,"dataGaLocation":45},"https://gitlab.com/users/sign_in/","sign in",[62,106,205,210,315,375],{"text":63,"config":64,"cards":66,"footer":89},"プラットフォーム",{"dataNavLevelOne":65},"platform",[67,73,81],{"title":63,"description":68,"link":69},"最も包括的かつAIで強化されたDevSecOpsプラットフォーム",{"text":70,"config":71},"プラットフォームを詳しく見る",{"href":72,"dataGaName":65,"dataGaLocation":45},"/ja-jp/platform/",{"title":74,"description":75,"link":76},"GitLab Duo（AI）","開発のすべてのステージでAIを活用し、ソフトウェアをより迅速にビルド",{"text":77,"config":78},"GitLab Duoのご紹介",{"href":79,"dataGaName":80,"dataGaLocation":45},"/ja-jp/gitlab-duo/","gitlab duo ai",{"title":82,"description":83,"link":84},"GitLabが選ばれる理由","GitLabが大企業に選ばれる理由10選",{"text":85,"config":86},"詳細はこちら",{"href":87,"dataGaName":88,"dataGaLocation":45},"/ja-jp/why-gitlab/","why gitlab",{"title":90,"items":91},"利用を開始：",[92,97,102],{"text":93,"config":94},"プラットフォームエンジニアリング",{"href":95,"dataGaName":96,"dataGaLocation":45},"/ja-jp/solutions/platform-engineering/","platform engineering",{"text":98,"config":99},"開発者の経験",{"href":100,"dataGaName":101,"dataGaLocation":45},"/ja-jp/developer-experience/","Developer experience",{"text":103,"config":104},"MLOps",{"href":105,"dataGaName":103,"dataGaLocation":45},"/ja-jp/topics/devops/the-role-of-ai-in-devops/",{"text":107,"left":108,"config":109,"link":111,"lists":115,"footer":187},"製品",true,{"dataNavLevelOne":110},"solutions",{"text":112,"config":113},"すべてのソリューションを表示",{"href":114,"dataGaName":110,"dataGaLocation":45},"/ja-jp/solutions/",[116,142,165],{"title":117,"description":118,"link":119,"items":124},"自動化","CI/CDと自動化でデプロイを加速",{"config":120},{"icon":121,"href":122,"dataGaName":123,"dataGaLocation":45},"AutomatedCodeAlt","/solutions/delivery-automation/","automated software delivery",[125,129,133,138],{"text":126,"config":127},"CI/CD",{"href":128,"dataGaLocation":45,"dataGaName":126},"/ja-jp/solutions/continuous-integration/",{"text":130,"config":131},"AIアシストによる開発",{"href":79,"dataGaLocation":45,"dataGaName":132},"AI assisted development",{"text":134,"config":135},"ソースコード管理",{"href":136,"dataGaLocation":45,"dataGaName":137},"/ja-jp/solutions/source-code-management/","Source Code Management",{"text":139,"config":140},"自動化されたソフトウェアデリバリー",{"href":122,"dataGaLocation":45,"dataGaName":141},"Automated software delivery",{"title":143,"description":144,"link":145,"items":150},"セキュリティ","セキュリティを損なうことなくコードをより迅速に完成",{"config":146},{"href":147,"dataGaName":148,"dataGaLocation":45,"icon":149},"/ja-jp/solutions/security-compliance/","security and compliance","ShieldCheckLight",[151,156,161],{"text":152,"config":153},"Application Security Testing",{"href":154,"dataGaName":155,"dataGaLocation":45},"/solutions/application-security-testing/","Application security testing",{"text":157,"config":158},"ソフトウェアサプライチェーンの安全性",{"href":159,"dataGaLocation":45,"dataGaName":160},"/ja-jp/solutions/supply-chain/","Software supply chain security",{"text":162,"config":163},"Software Compliance",{"href":164,"dataGaName":162,"dataGaLocation":45},"/solutions/software-compliance/",{"title":166,"link":167,"items":172},"測定",{"config":168},{"icon":169,"href":170,"dataGaName":171,"dataGaLocation":45},"DigitalTransformation","/ja-jp/solutions/visibility-measurement/","visibility and measurement",[173,177,182],{"text":174,"config":175},"可視性と測定",{"href":170,"dataGaLocation":45,"dataGaName":176},"Visibility and Measurement",{"text":178,"config":179},"バリューストリーム管理",{"href":180,"dataGaLocation":45,"dataGaName":181},"/ja-jp/solutions/value-stream-management/","Value Stream Management",{"text":183,"config":184},"分析とインサイト",{"href":185,"dataGaLocation":45,"dataGaName":186},"/ja-jp/solutions/analytics-and-insights/","Analytics and insights",{"title":188,"items":189},"GitLabが活躍する場所",[190,195,200],{"text":191,"config":192},"Enterprise",{"href":193,"dataGaLocation":45,"dataGaName":194},"/ja-jp/enterprise/","enterprise",{"text":196,"config":197},"スモールビジネス",{"href":198,"dataGaLocation":45,"dataGaName":199},"/ja-jp/small-business/","small business",{"text":201,"config":202},"公共機関",{"href":203,"dataGaLocation":45,"dataGaName":204},"/ja-jp/solutions/public-sector/","public sector",{"text":206,"config":207},"価格",{"href":208,"dataGaName":209,"dataGaLocation":45,"dataNavLevelOne":209},"/ja-jp/pricing/","pricing",{"text":211,"config":212,"link":214,"lists":218,"feature":302},"関連リソース",{"dataNavLevelOne":213},"resources",{"text":215,"config":216},"すべてのリソースを表示",{"href":217,"dataGaName":213,"dataGaLocation":45},"/ja-jp/resources/",[219,252,274],{"title":220,"items":221},"はじめに",[222,227,232,237,242,247],{"text":223,"config":224},"インストール",{"href":225,"dataGaName":226,"dataGaLocation":45},"/ja-jp/install/","install",{"text":228,"config":229},"クイックスタートガイド",{"href":230,"dataGaName":231,"dataGaLocation":45},"/ja-jp/get-started/","quick setup checklists",{"text":233,"config":234},"学ぶ",{"href":235,"dataGaLocation":45,"dataGaName":236},"https://university.gitlab.com/","learn",{"text":238,"config":239},"製品ドキュメント",{"href":240,"dataGaName":241,"dataGaLocation":45},"https://docs.gitlab.com/","product documentation",{"text":243,"config":244},"ベストプラクティスビデオ",{"href":245,"dataGaName":246,"dataGaLocation":45},"/ja-jp/getting-started-videos/","best practice videos",{"text":248,"config":249},"インテグレーション",{"href":250,"dataGaName":251,"dataGaLocation":45},"/ja-jp/integrations/","integrations",{"title":253,"items":254},"検索する",[255,260,264,269],{"text":256,"config":257},"お客様成功事例",{"href":258,"dataGaName":259,"dataGaLocation":45},"/ja-jp/customers/","customer success stories",{"text":261,"config":262},"ブログ",{"href":263,"dataGaName":5,"dataGaLocation":45},"/ja-jp/blog/",{"text":265,"config":266},"リモート",{"href":267,"dataGaName":268,"dataGaLocation":45},"https://handbook.gitlab.com/handbook/company/culture/all-remote/","remote",{"text":270,"config":271},"TeamOps",{"href":272,"dataGaName":273,"dataGaLocation":45},"/ja-jp/teamops/","teamops",{"title":275,"items":276},"つなげる",[277,282,287,292,297],{"text":278,"config":279},"GitLabサービス",{"href":280,"dataGaName":281,"dataGaLocation":45},"/ja-jp/services/","services",{"text":283,"config":284},"コミュニティ",{"href":285,"dataGaName":286,"dataGaLocation":45},"/community/","community",{"text":288,"config":289},"フォーラム",{"href":290,"dataGaName":291,"dataGaLocation":45},"https://forum.gitlab.com/","forum",{"text":293,"config":294},"イベント",{"href":295,"dataGaName":296,"dataGaLocation":45},"/events/","events",{"text":298,"config":299},"パートナー",{"href":300,"dataGaName":301,"dataGaLocation":45},"/partners/","partners",{"backgroundColor":303,"textColor":304,"text":305,"image":306,"link":310},"#2f2a6b","#fff","ソフトウェア開発の未来への洞察",{"altText":307,"config":308},"ソースプロモカード",{"src":309},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758208064/dzl0dbift9xdizyelkk4.svg",{"text":311,"config":312},"最新情報を読む",{"href":313,"dataGaName":314,"dataGaLocation":45},"/ja-jp/the-source/","the source",{"text":316,"config":317,"lists":319},"Company",{"dataNavLevelOne":318},"company",[320],{"items":321},[322,327,333,335,340,345,350,355,360,365,370],{"text":323,"config":324},"GitLabについて",{"href":325,"dataGaName":326,"dataGaLocation":45},"/ja-jp/company/","about",{"text":328,"config":329,"footerGa":332},"採用情報",{"href":330,"dataGaName":331,"dataGaLocation":45},"/jobs/","jobs",{"dataGaName":331},{"text":293,"config":334},{"href":295,"dataGaName":296,"dataGaLocation":45},{"text":336,"config":337},"経営陣",{"href":338,"dataGaName":339,"dataGaLocation":45},"/company/team/e-group/","leadership",{"text":341,"config":342},"チーム",{"href":343,"dataGaName":344,"dataGaLocation":45},"/company/team/","team",{"text":346,"config":347},"ハンドブック",{"href":348,"dataGaName":349,"dataGaLocation":45},"https://handbook.gitlab.com/","handbook",{"text":351,"config":352},"投資家向け情報",{"href":353,"dataGaName":354,"dataGaLocation":45},"https://ir.gitlab.com/","investor relations",{"text":356,"config":357},"トラストセンター",{"href":358,"dataGaName":359,"dataGaLocation":45},"/ja-jp/security/","trust center",{"text":361,"config":362},"AI Transparency Center",{"href":363,"dataGaName":364,"dataGaLocation":45},"/ja-jp/ai-transparency-center/","ai transparency center",{"text":366,"config":367},"ニュースレター",{"href":368,"dataGaName":369,"dataGaLocation":45},"/company/contact/","newsletter",{"text":371,"config":372},"プレス",{"href":373,"dataGaName":374,"dataGaLocation":45},"/press/","press",{"text":52,"config":376,"lists":377},{"dataNavLevelOne":318},[378],{"items":379},[380,383,388],{"text":52,"config":381},{"href":54,"dataGaName":382,"dataGaLocation":45},"talk to sales",{"text":384,"config":385},"サポートを受ける",{"href":386,"dataGaName":387,"dataGaLocation":45},"/support/","get help",{"text":389,"config":390},"カスタマーポータル",{"href":391,"dataGaName":392,"dataGaLocation":45},"https://customers.gitlab.com/customers/sign_in/","customer portal",{"close":394,"login":395,"suggestions":402},"閉じる",{"text":396,"link":397},"リポジトリとプロジェクトを検索するには、次にログインします",{"text":398,"config":399},"GitLab.com",{"href":59,"dataGaName":400,"dataGaLocation":401},"search login","search",{"text":403,"default":404},"提案",[405,408,413,415,419,423],{"text":74,"config":406},{"href":79,"dataGaName":407,"dataGaLocation":401},"GitLab Duo (AI)",{"text":409,"config":410},"コード提案（AI）",{"href":411,"dataGaName":412,"dataGaLocation":401},"/ja-jp/solutions/code-suggestions/","Code Suggestions (AI)",{"text":126,"config":414},{"href":128,"dataGaName":126,"dataGaLocation":401},{"text":416,"config":417},"GitLab on AWS",{"href":418,"dataGaName":416,"dataGaLocation":401},"/ja-jp/partners/technology-partners/aws/",{"text":420,"config":421},"GitLab on Google Cloud",{"href":422,"dataGaName":420,"dataGaLocation":401},"/ja-jp/partners/technology-partners/google-cloud-platform/",{"text":424,"config":425},"GitLabを選ぶ理由",{"href":87,"dataGaName":426,"dataGaLocation":401},"Why GitLab?",{"freeTrial":428,"mobileIcon":432,"desktopIcon":437},{"text":47,"config":429},{"href":430,"dataGaName":50,"dataGaLocation":431},"https://gitlab.com/-/trials/new/","nav",{"altText":433,"config":434},"GitLabアイコン",{"src":435,"dataGaName":436,"dataGaLocation":431},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203874/jypbw1jx72aexsoohd7x.svg","gitlab icon",{"altText":433,"config":438},{"src":439,"dataGaName":436,"dataGaLocation":431},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203875/gs4c8p8opsgvflgkswz9.svg",{"freeTrial":441,"mobileIcon":445,"desktopIcon":447},{"text":442,"config":443},"GitLab Duoの詳細について",{"href":79,"dataGaName":444,"dataGaLocation":431},"gitlab duo",{"altText":433,"config":446},{"src":435,"dataGaName":436,"dataGaLocation":431},{"altText":433,"config":448},{"src":439,"dataGaName":436,"dataGaLocation":431},"content:shared:ja-jp:main-navigation.yml","Main Navigation","shared/ja-jp/main-navigation.yml","shared/ja-jp/main-navigation",{"_path":454,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"title":455,"button":456,"config":461,"_id":463,"_type":31,"_source":33,"_file":464,"_stem":465,"_extension":36},"/shared/ja-jp/banner","GitLab Duo Agent Platformがパブリックベータ版で利用可能になりました！",{"text":457,"config":458},"ベータ版を試す",{"href":459,"dataGaName":460,"dataGaLocation":45},"/ja-jp/gitlab-duo/agent-platform/","duo banner",{"layout":462},"release","content:shared:ja-jp:banner.yml","shared/ja-jp/banner.yml","shared/ja-jp/banner",{"_path":467,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"data":468,"_id":671,"_type":31,"title":672,"_source":33,"_file":673,"_stem":674,"_extension":36},"/shared/ja-jp/main-footer",{"text":469,"source":470,"edit":476,"contribute":481,"config":486,"items":491,"minimal":663},"GitはSoftware Freedom Conservancyの商標です。当社は「GitLab」をライセンスに基づいて使用しています",{"text":471,"config":472},"ページのソースを表示",{"href":473,"dataGaName":474,"dataGaLocation":475},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/","page source","footer",{"text":477,"config":478},"このページを編集",{"href":479,"dataGaName":480,"dataGaLocation":475},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/content/","web ide",{"text":482,"config":483},"ご協力をお願いします",{"href":484,"dataGaName":485,"dataGaLocation":475},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/CONTRIBUTING.md/","please contribute",{"twitter":487,"facebook":488,"youtube":489,"linkedin":490},"https://twitter.com/gitlab","https://www.facebook.com/gitlab","https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg","https://www.linkedin.com/company/gitlab-com",[492,515,569,601,635],{"title":63,"links":493,"subMenu":498},[494],{"text":495,"config":496},"DevSecOpsプラットフォーム",{"href":72,"dataGaName":497,"dataGaLocation":475},"devsecops platform",[499],{"title":206,"links":500},[501,505,510],{"text":502,"config":503},"プランの表示",{"href":208,"dataGaName":504,"dataGaLocation":475},"view plans",{"text":506,"config":507},"Premiumを選ぶ理由",{"href":508,"dataGaName":509,"dataGaLocation":475},"/ja-jp/pricing/premium/","why premium",{"text":511,"config":512},"Ultimateを選ぶ理由",{"href":513,"dataGaName":514,"dataGaLocation":475},"/ja-jp/pricing/ultimate/","why ultimate",{"title":516,"links":517},"ソリューション",[518,523,526,528,533,538,542,545,548,553,555,557,559,564],{"text":519,"config":520},"デジタルトランスフォーメーション",{"href":521,"dataGaName":522,"dataGaLocation":475},"/ja-jp/topics/digital-transformation/","digital transformation",{"text":524,"config":525},"セキュリティとコンプライアンス",{"href":154,"dataGaName":155,"dataGaLocation":475},{"text":139,"config":527},{"href":122,"dataGaName":123,"dataGaLocation":475},{"text":529,"config":530},"アジャイル開発",{"href":531,"dataGaName":532,"dataGaLocation":475},"/ja-jp/solutions/agile-delivery/","agile delivery",{"text":534,"config":535},"クラウドトランスフォーメーション",{"href":536,"dataGaName":537,"dataGaLocation":475},"/ja-jp/topics/cloud-native/","cloud transformation",{"text":539,"config":540},"SCM",{"href":136,"dataGaName":541,"dataGaLocation":475},"source code management",{"text":126,"config":543},{"href":128,"dataGaName":544,"dataGaLocation":475},"continuous integration & delivery",{"text":178,"config":546},{"href":180,"dataGaName":547,"dataGaLocation":475},"value stream management",{"text":549,"config":550},"GitOps",{"href":551,"dataGaName":552,"dataGaLocation":475},"/ja-jp/solutions/gitops/","gitops",{"text":191,"config":554},{"href":193,"dataGaName":194,"dataGaLocation":475},{"text":196,"config":556},{"href":198,"dataGaName":199,"dataGaLocation":475},{"text":201,"config":558},{"href":203,"dataGaName":204,"dataGaLocation":475},{"text":560,"config":561},"教育",{"href":562,"dataGaName":563,"dataGaLocation":475},"/ja-jp/solutions/education/","education",{"text":565,"config":566},"金融サービス",{"href":567,"dataGaName":568,"dataGaLocation":475},"/ja-jp/solutions/finance/","financial services",{"title":211,"links":570},[571,573,575,577,580,582,585,587,589,591,593,595,597,599],{"text":223,"config":572},{"href":225,"dataGaName":226,"dataGaLocation":475},{"text":228,"config":574},{"href":230,"dataGaName":231,"dataGaLocation":475},{"text":233,"config":576},{"href":235,"dataGaName":236,"dataGaLocation":475},{"text":238,"config":578},{"href":240,"dataGaName":579,"dataGaLocation":475},"docs",{"text":261,"config":581},{"href":263,"dataGaName":5},{"text":583,"config":584},"お客様の成功事例",{"href":258,"dataGaLocation":475},{"text":256,"config":586},{"href":258,"dataGaName":259,"dataGaLocation":475},{"text":265,"config":588},{"href":267,"dataGaName":268,"dataGaLocation":475},{"text":278,"config":590},{"href":280,"dataGaName":281,"dataGaLocation":475},{"text":270,"config":592},{"href":272,"dataGaName":273,"dataGaLocation":475},{"text":283,"config":594},{"href":285,"dataGaName":286,"dataGaLocation":475},{"text":288,"config":596},{"href":290,"dataGaName":291,"dataGaLocation":475},{"text":293,"config":598},{"href":295,"dataGaName":296,"dataGaLocation":475},{"text":298,"config":600},{"href":300,"dataGaName":301,"dataGaLocation":475},{"title":316,"links":602},[603,605,607,609,611,613,615,619,624,626,628,630],{"text":323,"config":604},{"href":325,"dataGaName":318,"dataGaLocation":475},{"text":328,"config":606},{"href":330,"dataGaName":331,"dataGaLocation":475},{"text":336,"config":608},{"href":338,"dataGaName":339,"dataGaLocation":475},{"text":341,"config":610},{"href":343,"dataGaName":344,"dataGaLocation":475},{"text":346,"config":612},{"href":348,"dataGaName":349,"dataGaLocation":475},{"text":351,"config":614},{"href":353,"dataGaName":354,"dataGaLocation":475},{"text":616,"config":617},"Sustainability",{"href":618,"dataGaName":616,"dataGaLocation":475},"/sustainability/",{"text":620,"config":621},"ダイバーシティ、インクルージョン、ビロンギング（DIB）",{"href":622,"dataGaName":623,"dataGaLocation":475},"/ja-jp/diversity-inclusion-belonging/","Diversity, inclusion and belonging",{"text":356,"config":625},{"href":358,"dataGaName":359,"dataGaLocation":475},{"text":366,"config":627},{"href":368,"dataGaName":369,"dataGaLocation":475},{"text":371,"config":629},{"href":373,"dataGaName":374,"dataGaLocation":475},{"text":631,"config":632},"現代奴隷制の透明性に関する声明",{"href":633,"dataGaName":634,"dataGaLocation":475},"https://handbook.gitlab.com/handbook/legal/modern-slavery-act-transparency-statement/","modern slavery transparency statement",{"title":52,"links":636},[637,639,641,643,648,653,658],{"text":52,"config":638},{"href":54,"dataGaName":55,"dataGaLocation":475},{"text":384,"config":640},{"href":386,"dataGaName":387,"dataGaLocation":475},{"text":389,"config":642},{"href":391,"dataGaName":392,"dataGaLocation":475},{"text":644,"config":645},"ステータス",{"href":646,"dataGaName":647,"dataGaLocation":475},"https://status.gitlab.com/","status",{"text":649,"config":650},"利用規約",{"href":651,"dataGaName":652,"dataGaLocation":475},"/terms/","terms of use",{"text":654,"config":655},"プライバシーに関する声明",{"href":656,"dataGaName":657,"dataGaLocation":475},"/ja-jp/privacy/","privacy statement",{"text":659,"config":660},"Cookieの設定",{"dataGaName":661,"dataGaLocation":475,"id":662,"isOneTrustButton":108},"cookie preferences","ot-sdk-btn",{"items":664},[665,667,669],{"text":649,"config":666},{"href":651,"dataGaName":652,"dataGaLocation":475},{"text":654,"config":668},{"href":656,"dataGaName":657,"dataGaLocation":475},{"text":659,"config":670},{"dataGaName":661,"dataGaLocation":475,"id":662,"isOneTrustButton":108},"content:shared:ja-jp:main-footer.yml","Main Footer","shared/ja-jp/main-footer.yml","shared/ja-jp/main-footer",[676],{"_path":677,"_dir":678,"_draft":6,"_partial":6,"_locale":7,"content":679,"config":683,"_id":685,"_type":31,"title":18,"_source":33,"_file":686,"_stem":687,"_extension":36},"/en-us/blog/authors/michael-friedrich","authors",{"name":18,"config":680},{"headshot":681,"ctfId":682},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1749659879/Blog/Author%20Headshots/dnsmichi-headshot.jpg","dnsmichi",{"template":684},"BlogAuthor","content:en-us:blog:authors:michael-friedrich.yml","en-us/blog/authors/michael-friedrich.yml","en-us/blog/authors/michael-friedrich",{"_path":689,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"header":690,"eyebrow":691,"blurb":692,"button":693,"secondaryButton":697,"_id":699,"_type":31,"title":700,"_source":33,"_file":701,"_stem":702,"_extension":36},"/shared/ja-jp/next-steps","より優れたソフトウェアをより速く提供","フォーチュン100企業の50%以上がGitLabを信頼","インテリジェントなDevSecOpsプラットフォームで\n\n\nチームの可能性を広げましょう。\n",{"text":47,"config":694},{"href":695,"dataGaName":50,"dataGaLocation":696},"https://gitlab.com/-/trial_registrations/new?glm_content=default-saas-trial&glm_source=about.gitlab.com/","feature",{"text":52,"config":698},{"href":54,"dataGaName":55,"dataGaLocation":696},"content:shared:ja-jp:next-steps.yml","Next Steps","shared/ja-jp/next-steps.yml","shared/ja-jp/next-steps",1758662351025]