[{"data":1,"prerenderedAt":709},["ShallowReactive",2],{"/ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo":3,"navigation-ja-jp":37,"banner-ja-jp":452,"footer-ja-jp":465,"Michael Friedrich":675,"next-steps-ja-jp":688,"footer-source-/ja-jp/blog/refactor-code-into-modern-languages-with-ai-powered-gitlab-duo/":703},{"_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":448,"_type":31,"title":449,"_source":33,"_file":450,"_stem":451,"_extension":36},"/shared/ja-jp/main-navigation","ja-jp",{"logo":41,"freeTrial":46,"sales":51,"login":56,"items":61,"search":392,"minimal":426,"duo":439},{"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,204,209,314,374],{"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":186},"製品",true,{"dataNavLevelOne":110},"solutions",{"text":112,"config":113},"すべてのソリューションを表示",{"href":114,"dataGaName":110,"dataGaLocation":45},"/ja-jp/solutions/",[116,142,164],{"title":117,"description":118,"link":119,"items":124},"自動化","CI/CDと自動化でデプロイを加速",{"config":120},{"icon":121,"href":122,"dataGaName":123,"dataGaLocation":45},"AutomatedCodeAlt","/ja-jp/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/application-security-testing/","security and compliance","ShieldCheckLight",[151,155,160],{"text":152,"config":153},"Application Security Testing",{"href":147,"dataGaName":154,"dataGaLocation":45},"Application security testing",{"text":156,"config":157},"ソフトウェアサプライチェーンの安全性",{"href":158,"dataGaLocation":45,"dataGaName":159},"/ja-jp/solutions/supply-chain/","Software supply chain security",{"text":161,"config":162},"Software Compliance",{"href":163,"dataGaName":161,"dataGaLocation":45},"/ja-jp/solutions/software-compliance/",{"title":165,"link":166,"items":171},"測定",{"config":167},{"icon":168,"href":169,"dataGaName":170,"dataGaLocation":45},"DigitalTransformation","/ja-jp/solutions/visibility-measurement/","visibility and measurement",[172,176,181],{"text":173,"config":174},"可視性と測定",{"href":169,"dataGaLocation":45,"dataGaName":175},"Visibility and Measurement",{"text":177,"config":178},"バリューストリーム管理",{"href":179,"dataGaLocation":45,"dataGaName":180},"/ja-jp/solutions/value-stream-management/","Value Stream Management",{"text":182,"config":183},"分析とインサイト",{"href":184,"dataGaLocation":45,"dataGaName":185},"/ja-jp/solutions/analytics-and-insights/","Analytics and insights",{"title":187,"items":188},"GitLabが活躍する場所",[189,194,199],{"text":190,"config":191},"Enterprise",{"href":192,"dataGaLocation":45,"dataGaName":193},"/ja-jp/enterprise/","enterprise",{"text":195,"config":196},"スモールビジネス",{"href":197,"dataGaLocation":45,"dataGaName":198},"/ja-jp/small-business/","small business",{"text":200,"config":201},"公共機関",{"href":202,"dataGaLocation":45,"dataGaName":203},"/ja-jp/solutions/public-sector/","public sector",{"text":205,"config":206},"価格",{"href":207,"dataGaName":208,"dataGaLocation":45,"dataNavLevelOne":208},"/ja-jp/pricing/","pricing",{"text":210,"config":211,"link":213,"lists":217,"feature":301},"関連リソース",{"dataNavLevelOne":212},"resources",{"text":214,"config":215},"すべてのリソースを表示",{"href":216,"dataGaName":212,"dataGaLocation":45},"/ja-jp/resources/",[218,251,273],{"title":219,"items":220},"はじめに",[221,226,231,236,241,246],{"text":222,"config":223},"インストール",{"href":224,"dataGaName":225,"dataGaLocation":45},"/ja-jp/install/","install",{"text":227,"config":228},"クイックスタートガイド",{"href":229,"dataGaName":230,"dataGaLocation":45},"/ja-jp/get-started/","quick setup checklists",{"text":232,"config":233},"学ぶ",{"href":234,"dataGaLocation":45,"dataGaName":235},"https://university.gitlab.com/","learn",{"text":237,"config":238},"製品ドキュメント",{"href":239,"dataGaName":240,"dataGaLocation":45},"https://docs.gitlab.com/","product documentation",{"text":242,"config":243},"ベストプラクティスビデオ",{"href":244,"dataGaName":245,"dataGaLocation":45},"/ja-jp/getting-started-videos/","best practice videos",{"text":247,"config":248},"インテグレーション",{"href":249,"dataGaName":250,"dataGaLocation":45},"/ja-jp/integrations/","integrations",{"title":252,"items":253},"検索する",[254,259,263,268],{"text":255,"config":256},"お客様成功事例",{"href":257,"dataGaName":258,"dataGaLocation":45},"/ja-jp/customers/","customer success stories",{"text":260,"config":261},"ブログ",{"href":262,"dataGaName":5,"dataGaLocation":45},"/ja-jp/blog/",{"text":264,"config":265},"リモート",{"href":266,"dataGaName":267,"dataGaLocation":45},"https://handbook.gitlab.com/handbook/company/culture/all-remote/","remote",{"text":269,"config":270},"TeamOps",{"href":271,"dataGaName":272,"dataGaLocation":45},"/ja-jp/teamops/","teamops",{"title":274,"items":275},"つなげる",[276,281,286,291,296],{"text":277,"config":278},"GitLabサービス",{"href":279,"dataGaName":280,"dataGaLocation":45},"/ja-jp/services/","services",{"text":282,"config":283},"コミュニティ",{"href":284,"dataGaName":285,"dataGaLocation":45},"/community/","community",{"text":287,"config":288},"フォーラム",{"href":289,"dataGaName":290,"dataGaLocation":45},"https://forum.gitlab.com/","forum",{"text":292,"config":293},"イベント",{"href":294,"dataGaName":295,"dataGaLocation":45},"/events/","events",{"text":297,"config":298},"パートナー",{"href":299,"dataGaName":300,"dataGaLocation":45},"/ja-jp/partners/","partners",{"backgroundColor":302,"textColor":303,"text":304,"image":305,"link":309},"#2f2a6b","#fff","ソフトウェア開発の未来への洞察",{"altText":306,"config":307},"ソースプロモカード",{"src":308},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758208064/dzl0dbift9xdizyelkk4.svg",{"text":310,"config":311},"最新情報を読む",{"href":312,"dataGaName":313,"dataGaLocation":45},"/ja-jp/the-source/","the source",{"text":315,"config":316,"lists":318},"会社情報",{"dataNavLevelOne":317},"company",[319],{"items":320},[321,326,332,334,339,344,349,354,359,364,369],{"text":322,"config":323},"GitLabについて",{"href":324,"dataGaName":325,"dataGaLocation":45},"/ja-jp/company/","about",{"text":327,"config":328,"footerGa":331},"採用情報",{"href":329,"dataGaName":330,"dataGaLocation":45},"/jobs/","jobs",{"dataGaName":330},{"text":292,"config":333},{"href":294,"dataGaName":295,"dataGaLocation":45},{"text":335,"config":336},"経営陣",{"href":337,"dataGaName":338,"dataGaLocation":45},"/company/team/e-group/","leadership",{"text":340,"config":341},"チーム",{"href":342,"dataGaName":343,"dataGaLocation":45},"/company/team/","team",{"text":345,"config":346},"ハンドブック",{"href":347,"dataGaName":348,"dataGaLocation":45},"https://handbook.gitlab.com/","handbook",{"text":350,"config":351},"投資家向け情報",{"href":352,"dataGaName":353,"dataGaLocation":45},"https://ir.gitlab.com/","investor relations",{"text":355,"config":356},"トラストセンター",{"href":357,"dataGaName":358,"dataGaLocation":45},"/ja-jp/security/","trust center",{"text":360,"config":361},"AI Transparency Center",{"href":362,"dataGaName":363,"dataGaLocation":45},"/ja-jp/ai-transparency-center/","ai transparency center",{"text":365,"config":366},"ニュースレター",{"href":367,"dataGaName":368,"dataGaLocation":45},"/company/contact/","newsletter",{"text":370,"config":371},"プレス",{"href":372,"dataGaName":373,"dataGaLocation":45},"/press/","press",{"text":52,"config":375,"lists":376},{"dataNavLevelOne":317},[377],{"items":378},[379,382,387],{"text":52,"config":380},{"href":54,"dataGaName":381,"dataGaLocation":45},"talk to sales",{"text":383,"config":384},"サポートを受ける",{"href":385,"dataGaName":386,"dataGaLocation":45},"/support/","get help",{"text":388,"config":389},"カスタマーポータル",{"href":390,"dataGaName":391,"dataGaLocation":45},"https://customers.gitlab.com/customers/sign_in/","customer portal",{"close":393,"login":394,"suggestions":401},"閉じる",{"text":395,"link":396},"リポジトリとプロジェクトを検索するには、次にログインします",{"text":397,"config":398},"GitLab.com",{"href":59,"dataGaName":399,"dataGaLocation":400},"search login","search",{"text":402,"default":403},"提案",[404,407,412,414,418,422],{"text":74,"config":405},{"href":79,"dataGaName":406,"dataGaLocation":400},"GitLab Duo (AI)",{"text":408,"config":409},"コード提案（AI）",{"href":410,"dataGaName":411,"dataGaLocation":400},"/ja-jp/solutions/code-suggestions/","Code Suggestions (AI)",{"text":126,"config":413},{"href":128,"dataGaName":126,"dataGaLocation":400},{"text":415,"config":416},"GitLab on AWS",{"href":417,"dataGaName":415,"dataGaLocation":400},"/ja-jp/partners/technology-partners/aws/",{"text":419,"config":420},"GitLab on Google Cloud",{"href":421,"dataGaName":419,"dataGaLocation":400},"/ja-jp/partners/technology-partners/google-cloud-platform/",{"text":423,"config":424},"GitLabを選ぶ理由",{"href":87,"dataGaName":425,"dataGaLocation":400},"Why GitLab?",{"freeTrial":427,"mobileIcon":431,"desktopIcon":436},{"text":47,"config":428},{"href":429,"dataGaName":50,"dataGaLocation":430},"https://gitlab.com/-/trials/new/","nav",{"altText":432,"config":433},"GitLabアイコン",{"src":434,"dataGaName":435,"dataGaLocation":430},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203874/jypbw1jx72aexsoohd7x.svg","gitlab icon",{"altText":432,"config":437},{"src":438,"dataGaName":435,"dataGaLocation":430},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203875/gs4c8p8opsgvflgkswz9.svg",{"freeTrial":440,"mobileIcon":444,"desktopIcon":446},{"text":441,"config":442},"GitLab Duoの詳細について",{"href":79,"dataGaName":443,"dataGaLocation":430},"gitlab duo",{"altText":432,"config":445},{"src":434,"dataGaName":435,"dataGaLocation":430},{"altText":432,"config":447},{"src":438,"dataGaName":435,"dataGaLocation":430},"content:shared:ja-jp:main-navigation.yml","Main Navigation","shared/ja-jp/main-navigation.yml","shared/ja-jp/main-navigation",{"_path":453,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"title":454,"button":455,"config":460,"_id":462,"_type":31,"_source":33,"_file":463,"_stem":464,"_extension":36},"/shared/ja-jp/banner","GitLab Duo Agent Platformがパブリックベータ版で利用可能になりました！",{"text":456,"config":457},"ベータ版を試す",{"href":458,"dataGaName":459,"dataGaLocation":45},"/ja-jp/gitlab-duo/agent-platform/","duo banner",{"layout":461},"release","content:shared:ja-jp:banner.yml","shared/ja-jp/banner.yml","shared/ja-jp/banner",{"_path":466,"_dir":39,"_draft":6,"_partial":6,"_locale":7,"data":467,"_id":671,"_type":31,"title":672,"_source":33,"_file":673,"_stem":674,"_extension":36},"/shared/ja-jp/main-footer",{"text":468,"source":469,"edit":475,"contribute":480,"config":485,"items":490,"minimal":663},"GitはSoftware Freedom Conservancyの商標です。当社は「GitLab」をライセンスに基づいて使用しています",{"text":470,"config":471},"ページのソースを表示",{"href":472,"dataGaName":473,"dataGaLocation":474},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/","page source","footer",{"text":476,"config":477},"このページを編集",{"href":478,"dataGaName":479,"dataGaLocation":474},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/content/","web ide",{"text":481,"config":482},"ご協力をお願いします",{"href":483,"dataGaName":484,"dataGaLocation":474},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/CONTRIBUTING.md/","please contribute",{"twitter":486,"facebook":487,"youtube":488,"linkedin":489},"https://twitter.com/gitlab","https://www.facebook.com/gitlab","https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg","https://www.linkedin.com/company/gitlab-com",[491,514,568,600,635],{"title":63,"links":492,"subMenu":497},[493],{"text":494,"config":495},"DevSecOpsプラットフォーム",{"href":72,"dataGaName":496,"dataGaLocation":474},"devsecops platform",[498],{"title":205,"links":499},[500,504,509],{"text":501,"config":502},"プランの表示",{"href":207,"dataGaName":503,"dataGaLocation":474},"view plans",{"text":505,"config":506},"Premiumを選ぶ理由",{"href":507,"dataGaName":508,"dataGaLocation":474},"/ja-jp/pricing/premium/","why premium",{"text":510,"config":511},"Ultimateを選ぶ理由",{"href":512,"dataGaName":513,"dataGaLocation":474},"/ja-jp/pricing/ultimate/","why ultimate",{"title":515,"links":516},"ソリューション",[517,522,525,527,532,537,541,544,547,552,554,556,558,563],{"text":518,"config":519},"デジタルトランスフォーメーション",{"href":520,"dataGaName":521,"dataGaLocation":474},"/ja-jp/topics/digital-transformation/","digital transformation",{"text":523,"config":524},"セキュリティとコンプライアンス",{"href":147,"dataGaName":154,"dataGaLocation":474},{"text":139,"config":526},{"href":122,"dataGaName":123,"dataGaLocation":474},{"text":528,"config":529},"アジャイル開発",{"href":530,"dataGaName":531,"dataGaLocation":474},"/ja-jp/solutions/agile-delivery/","agile delivery",{"text":533,"config":534},"クラウドトランスフォーメーション",{"href":535,"dataGaName":536,"dataGaLocation":474},"/ja-jp/topics/cloud-native/","cloud transformation",{"text":538,"config":539},"SCM",{"href":136,"dataGaName":540,"dataGaLocation":474},"source code management",{"text":126,"config":542},{"href":128,"dataGaName":543,"dataGaLocation":474},"continuous integration & delivery",{"text":177,"config":545},{"href":179,"dataGaName":546,"dataGaLocation":474},"value stream management",{"text":548,"config":549},"GitOps",{"href":550,"dataGaName":551,"dataGaLocation":474},"/ja-jp/solutions/gitops/","gitops",{"text":190,"config":553},{"href":192,"dataGaName":193,"dataGaLocation":474},{"text":195,"config":555},{"href":197,"dataGaName":198,"dataGaLocation":474},{"text":200,"config":557},{"href":202,"dataGaName":203,"dataGaLocation":474},{"text":559,"config":560},"教育",{"href":561,"dataGaName":562,"dataGaLocation":474},"/ja-jp/solutions/education/","education",{"text":564,"config":565},"金融サービス",{"href":566,"dataGaName":567,"dataGaLocation":474},"/ja-jp/solutions/finance/","financial services",{"title":210,"links":569},[570,572,574,576,579,581,584,586,588,590,592,594,596,598],{"text":222,"config":571},{"href":224,"dataGaName":225,"dataGaLocation":474},{"text":227,"config":573},{"href":229,"dataGaName":230,"dataGaLocation":474},{"text":232,"config":575},{"href":234,"dataGaName":235,"dataGaLocation":474},{"text":237,"config":577},{"href":239,"dataGaName":578,"dataGaLocation":474},"docs",{"text":260,"config":580},{"href":262,"dataGaName":5},{"text":582,"config":583},"お客様の成功事例",{"href":257,"dataGaLocation":474},{"text":255,"config":585},{"href":257,"dataGaName":258,"dataGaLocation":474},{"text":264,"config":587},{"href":266,"dataGaName":267,"dataGaLocation":474},{"text":277,"config":589},{"href":279,"dataGaName":280,"dataGaLocation":474},{"text":269,"config":591},{"href":271,"dataGaName":272,"dataGaLocation":474},{"text":282,"config":593},{"href":284,"dataGaName":285,"dataGaLocation":474},{"text":287,"config":595},{"href":289,"dataGaName":290,"dataGaLocation":474},{"text":292,"config":597},{"href":294,"dataGaName":295,"dataGaLocation":474},{"text":297,"config":599},{"href":299,"dataGaName":300,"dataGaLocation":474},{"title":601,"links":602},"Company",[603,605,607,609,611,613,615,619,624,626,628,630],{"text":322,"config":604},{"href":324,"dataGaName":317,"dataGaLocation":474},{"text":327,"config":606},{"href":329,"dataGaName":330,"dataGaLocation":474},{"text":335,"config":608},{"href":337,"dataGaName":338,"dataGaLocation":474},{"text":340,"config":610},{"href":342,"dataGaName":343,"dataGaLocation":474},{"text":345,"config":612},{"href":347,"dataGaName":348,"dataGaLocation":474},{"text":350,"config":614},{"href":352,"dataGaName":353,"dataGaLocation":474},{"text":616,"config":617},"Sustainability",{"href":618,"dataGaName":616,"dataGaLocation":474},"/sustainability/",{"text":620,"config":621},"ダイバーシティ、インクルージョン、ビロンギング（DIB）",{"href":622,"dataGaName":623,"dataGaLocation":474},"/ja-jp/diversity-inclusion-belonging/","Diversity, inclusion and belonging",{"text":355,"config":625},{"href":357,"dataGaName":358,"dataGaLocation":474},{"text":365,"config":627},{"href":367,"dataGaName":368,"dataGaLocation":474},{"text":370,"config":629},{"href":372,"dataGaName":373,"dataGaLocation":474},{"text":631,"config":632},"現代奴隷制の透明性に関する声明",{"href":633,"dataGaName":634,"dataGaLocation":474},"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":474},{"text":383,"config":640},{"href":385,"dataGaName":386,"dataGaLocation":474},{"text":388,"config":642},{"href":390,"dataGaName":391,"dataGaLocation":474},{"text":644,"config":645},"ステータス",{"href":646,"dataGaName":647,"dataGaLocation":474},"https://status.gitlab.com/","status",{"text":649,"config":650},"利用規約",{"href":651,"dataGaName":652,"dataGaLocation":474},"/terms/","terms of use",{"text":654,"config":655},"プライバシーに関する声明",{"href":656,"dataGaName":657,"dataGaLocation":474},"/ja-jp/privacy/","privacy statement",{"text":659,"config":660},"Cookieの設定",{"dataGaName":661,"dataGaLocation":474,"id":662,"isOneTrustButton":108},"cookie preferences","ot-sdk-btn",{"items":664},[665,667,669],{"text":649,"config":666},{"href":651,"dataGaName":652,"dataGaLocation":474},{"text":654,"config":668},{"href":656,"dataGaName":657,"dataGaLocation":474},{"text":659,"config":670},{"dataGaName":661,"dataGaLocation":474,"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",{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"seo":704,"content":705,"config":708,"_id":30,"_type":31,"title":32,"_source":33,"_file":34,"_stem":35,"_extension":36},{"title":9,"description":10,"ogTitle":9,"ogDescription":10,"noIndex":6,"ogImage":11,"ogUrl":12,"ogSiteName":13,"ogType":14,"canonicalUrls":12,"schema":15},{"title":9,"description":10,"authors":706,"heroImage":11,"date":19,"body":20,"category":21,"tags":707,"updatedDate":26},[18],[23,24,25],{"slug":28,"featured":6,"template":29},1760039173294]