diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0847db8..d25069f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -5,6 +5,4 @@ Preserve Existing Code: The current codebase is the source of truth and must be Minimal Necessary Changes: When adding a new feature or making a modification, alter the absolute minimum amount of existing code required to implement the change successfully. -Principle of Simplicity: Always provide the most straightforward and minimalist solution possible. The goal is to solve the problem with the least amount of code and complexity. Avoid premature optimization or over-engineering. - -Anytime someone asks about the business logic diagram, utilize the [Business Logic Diagram](../diag.mmd). \ No newline at end of file +Principle of Simplicity: Always provide the most straightforward and minimalist solution possible. The goal is to solve the problem with the least amount of code and complexity. Avoid premature optimization or over-engineering. \ No newline at end of file diff --git a/.github/instructions/c.instructions.md b/.github/instructions/c.instructions.md deleted file mode 100644 index 9dd1b25..0000000 --- a/.github/instructions/c.instructions.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -applyTo: "**.c" ---- -Always be sure to free up unused memory \ No newline at end of file diff --git a/.github/instructions/rust.instructions.md b/.github/instructions/rust.instructions.md deleted file mode 100644 index 79da6c8..0000000 --- a/.github/instructions/rust.instructions.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -applyTo: "**.rs" ---- -# Rust -Do not suggest using any external packages (i.e., dependencies). All rust code should only use the `std` library. \ No newline at end of file diff --git a/DotnetApp/Program.cs b/DotnetApp/Program.cs index 586449a..055fa8f 100644 --- a/DotnetApp/Program.cs +++ b/DotnetApp/Program.cs @@ -1,6 +1,4 @@ -using System.IO; -using System.Linq; -using Microsoft.Extensions.FileProviders; +using System.Linq; using DotnetApp.Services; using DotnetApp.Models; diff --git a/README.md b/README.md index 9099dc2..536d9e9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ World's most intelligent autocomplete! Copilot understands what your intent is via context, like file name, comment contents, surrounding code and other open files in your workspace. -1. `point.py` +1. `calculator.py` Copilot code completions even promotes best practices while you code as comments are one of the primary ways of prompting it! @@ -24,7 +24,7 @@ You can also interact with Copilot code completions (+ more) inside a file in ot ### Next Edit Suggestions -1. `point3D.py` +1. `calculator.py` ## [Copilot Chat](https://code.visualstudio.com/docs/copilot/chat/copilot-chat) No need to context switch! Everything I need, in my IDE. @@ -65,7 +65,7 @@ Best Practice: Only add the minimum context necessary to answer the question you 1. Do you see any security vulnerabilities in this code (`sql.py`)? 1. I'm looking to reduce tech debt across my codebase. Is there anything in my .NET app (`DotnetApp`) that I should consider improving or fixing? #### Understand -1. Can you explain what this file is doing (`server.rs`)? +1. Can you explain what this file is doing (`sql.py`)? #### Generate - Test data - Documentation diff --git a/cloud_infra.png b/cloud_infra.png deleted file mode 100644 index ab52c6e..0000000 Binary files a/cloud_infra.png and /dev/null differ diff --git a/cobol/CUSTPROC.cbl b/cobol/CUSTPROC.cbl deleted file mode 100644 index 9bc3c34..0000000 --- a/cobol/CUSTPROC.cbl +++ /dev/null @@ -1,112 +0,0 @@ - IDENTIFICATION DIVISION. - PROGRAM-ID. CUSTPROC. - AUTHOR. GITHUB-COPILOT. - DATE-WRITTEN. 2025-03-28. - - ENVIRONMENT DIVISION. - INPUT-OUTPUT SECTION. - FILE-CONTROL. - SELECT CUSTOMER-FILE - ASSIGN TO 'CUSTFILE' - ORGANIZATION IS SEQUENTIAL - ACCESS MODE IS SEQUENTIAL - FILE STATUS IS WS-FILE-STATUS. - SELECT REPORT-FILE - ASSIGN TO 'CUSTRPT' - ORGANIZATION IS SEQUENTIAL - ACCESS MODE IS SEQUENTIAL. - - DATA DIVISION. - FILE SECTION. - FD CUSTOMER-FILE - LABEL RECORDS ARE STANDARD. - 01 CUSTOMER-RECORD. - 05 CUST-ID PIC X(6). - 05 CUST-NAME PIC X(30). - 05 CUST-ADDRESS PIC X(50). - 05 CUST-PHONE PIC X(12). - 05 CUST-BALANCE PIC 9(7)V99. - - FD REPORT-FILE - LABEL RECORDS ARE STANDARD. - 01 REPORT-LINE PIC X(132). - - WORKING-STORAGE SECTION. - 01 WS-FILE-STATUS PIC X(2). - 01 WS-EOF-FLAG PIC X VALUE 'N'. - 88 END-OF-FILE VALUE 'Y'. - - 01 WS-COUNTERS. - 05 WS-READ-CTR PIC 9(6) VALUE ZERO. - 05 WS-VALID-CTR PIC 9(6) VALUE ZERO. - 05 WS-ERROR-CTR PIC 9(6) VALUE ZERO. - - 01 WS-HEADING-1. - 05 FILLER PIC X(20) VALUE 'Customer Report '. - 05 FILLER PIC X(20) VALUE 'Date: '. - 05 WS-CURR-DATE PIC X(10). - - 01 WS-DETAIL-LINE. - 05 WS-DL-CUSTID PIC X(6). - 05 FILLER PIC X(2) VALUE SPACES. - 05 WS-DL-NAME PIC X(30). - 05 FILLER PIC X(2) VALUE SPACES. - 05 WS-DL-BALANCE PIC $ZZZ,ZZ9.99. - - PROCEDURE DIVISION. - 0100-MAIN-PROCESS. - PERFORM 0200-INIT-ROUTINE - PERFORM 0300-PROCESS-RECORDS UNTIL END-OF-FILE - PERFORM 0900-CLOSE-ROUTINE - STOP RUN. - - 0200-INIT-ROUTINE. - OPEN INPUT CUSTOMER-FILE - OUTPUT REPORT-FILE - IF WS-FILE-STATUS NOT = '00' - DISPLAY 'Error opening files. Status: ' WS-FILE-STATUS - MOVE 'Y' TO WS-EOF-FLAG - END-IF - PERFORM 0250-WRITE-HEADERS. - - 0250-WRITE-HEADERS. - MOVE FUNCTION CURRENT-DATE(1:10) TO WS-CURR-DATE - WRITE REPORT-LINE FROM WS-HEADING-1 - WRITE REPORT-LINE FROM SPACES. - - 0300-PROCESS-RECORDS. - READ CUSTOMER-FILE - AT END - MOVE 'Y' TO WS-EOF-FLAG - NOT AT END - ADD 1 TO WS-READ-CTR - PERFORM 0400-VALIDATE-RECORD - END-READ. - - 0400-VALIDATE-RECORD. - IF CUST-BALANCE > 0 - PERFORM 0500-FORMAT-DETAIL - ADD 1 TO WS-VALID-CTR - ELSE - ADD 1 TO WS-ERROR-CTR - END-IF. - - 0500-FORMAT-DETAIL. - MOVE CUST-ID TO WS-DL-CUSTID - MOVE CUST-NAME TO WS-DL-NAME - MOVE CUST-BALANCE TO WS-DL-BALANCE - WRITE REPORT-LINE FROM WS-DETAIL-LINE. - - 0900-CLOSE-ROUTINE. - WRITE REPORT-LINE FROM SPACES - MOVE 'Total Records Read: ' TO REPORT-LINE - MOVE WS-READ-CTR TO REPORT-LINE(25:6) - WRITE REPORT-LINE - MOVE 'Valid Records: ' TO REPORT-LINE - MOVE WS-VALID-CTR TO REPORT-LINE(25:6) - WRITE REPORT-LINE - MOVE 'Error Records: ' TO REPORT-LINE - MOVE WS-ERROR-CTR TO REPORT-LINE(25:6) - WRITE REPORT-LINE - CLOSE CUSTOMER-FILE - REPORT-FILE. \ No newline at end of file diff --git a/diag.mmd b/diag.mmd deleted file mode 100644 index 3eb7a68..0000000 --- a/diag.mmd +++ /dev/null @@ -1,11 +0,0 @@ -flowchart TD - A[0100-MAIN-PROCESS] --> B[0200-INIT-ROUTINE] - B --> C[0250-WRITE-HEADERS] - C --> D[0300-PROCESS-RECORDS] - D -->|Read Record| E{END-OF-FILE?} - E -- No --> F[0400-VALIDATE-RECORD] - F -->|CUST-BALANCE > 0| G[0500-FORMAT-DETAIL] - G --> D - F -->|Else| D - E -- Yes --> H[0900-CLOSE-ROUTINE] - H --> I[STOP RUN] \ No newline at end of file diff --git a/docs/ADOPTION.md b/docs/ADOPTION.md deleted file mode 100644 index 8664321..0000000 --- a/docs/ADOPTION.md +++ /dev/null @@ -1,4 +0,0 @@ -# Driving Copilot Adoption - -## Options -- Champions Program \ No newline at end of file diff --git a/docs/COMPARISON.md b/docs/COMPARISON.md deleted file mode 100644 index 363bd9c..0000000 --- a/docs/COMPARISON.md +++ /dev/null @@ -1,3 +0,0 @@ -# Advantages of Copilot - -## \ No newline at end of file diff --git a/docs/SDD.md b/docs/SDD.md deleted file mode 100644 index a1a2f02..0000000 --- a/docs/SDD.md +++ /dev/null @@ -1,12 +0,0 @@ -# Spec-Driven Development (SDD) -- https://github.com/github/spec-kit - -## Steps -- /speckit.constitution - - Define your project's governing principles and development guidelines -- /speckit.specify - - Describe what you want to build -- /speckit.plan - - Provide your tech stack and architecture choices -- /speckit.tasks -- /speckit.implement \ No newline at end of file diff --git a/python/point.py b/python/point.py deleted file mode 100644 index e69de29..0000000 diff --git a/python/sql.py b/python/sql.py index bc2121e..0f57b63 100644 --- a/python/sql.py +++ b/python/sql.py @@ -3,22 +3,20 @@ def search_user(username): conn = mysql.connector.connect(user='root', password='password', host='localhost', database='users') cursor = conn.cursor() - query = "SELECT * FROM users WHERE username = '" + username + "'" + query = "SELECT * FROM users WHERE username = %s" - # Execute the query and process the results - cursor.execute(query) + cursor.execute(query, (username,)) result = cursor.fetchall() cursor.close() conn.close() return result def add_user(username, password): - conn = mysql.connector.connect + conn = mysql.connector.connect(user='root', password='password', host='localhost', database='users') cursor = conn.cursor() - query = "INSERT INTO users (username, password) VALUES ('" + username + "', '" + password + "')" + query = "INSERT INTO users (username, password) VALUES (%s, %s)" - # Execute the query - cursor.execute(query) + cursor.execute(query, (username, password)) conn.commit() cursor.close() conn.close() diff --git a/python/tests/test_calculator.py b/python/tests/test_calculator.py deleted file mode 100644 index e69de29..0000000 diff --git a/rust/server.rs b/rust/server.rs deleted file mode 100644 index ed273a5..0000000 --- a/rust/server.rs +++ /dev/null @@ -1,39 +0,0 @@ -// server.rs - -mod tcp; -// Removed the thread module import as it's no longer needed - -fn main() { - println!("LOG (MAIN): Starting server"); - - let address: &str = "127.0.0.1:8000"; - - let tcp_listener: std::net::TcpListener = match std::net::TcpListener::bind(address) { - Ok(tcp_listener) => tcp_listener, - Err(e) => panic!("ERROR (MAIN): Unable to bind to {}. Error: {}", address, e), - }; - - match tcp_listener.local_addr() { - Ok(local_addr) => println!("LOG (MAIN): Server is listening on {}", local_addr), - Err(e) => println!("WARNING (MAIN): Failed to log the local address: {}", e), - } - - for tcp_stream in tcp_listener.incoming() { - match tcp_stream { - Ok(tcp_stream) => { - match tcp_stream.local_addr() { - Ok(local_addr) => println!("\nLOG (MAIN): New TcpStream Received ({})", local_addr), - Err(e) => println!("WARNING (MAIN): Failed to log the local address: {}", e), - } - - // Spawn a new thread for each connection instead of using a thread pool - std::thread::spawn(move || { - tcp::handle_tcp_stream(tcp_stream); - }); - } - Err(e) => { - println!("ERROR (MAIN): TcpStream Error: {}", e); - } - } - } -} \ No newline at end of file diff --git a/scripts/find_json_string.py b/scripts/find_json_string.py deleted file mode 100644 index bc71e27..0000000 --- a/scripts/find_json_string.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python3 -""" -find_json_string.py - -Search a JSON file for occurrences of a string (or regex) and output the -1-based line numbers where matches occur. Works on the raw file text so it -doesn't require valid JSON and preserves line numbers. - -Usage: - python3 scripts/find_json_string.py path/to/file.json "needle" - -Options: - -i, --ignore-case Case-insensitive search - -r, --regex Treat the pattern as a regular expression - -w, --word Whole-word match (implies regex with word boundaries) - -N, --numbers-only Print only numbers, one per line (default) - -l, --list Print "line: content" for each matching line - -Examples: - python3 scripts/find_json_string.py data.json "user_id" - python3 scripts/find_json_string.py data.json "error .* timeout" -r -i -l - cat data.json | python3 scripts/find_json_string.py - "foo" -w -""" - -from __future__ import annotations - -import argparse -import re -import sys -from typing import Iterable, List - - -def iter_lines(path: str) -> Iterable[tuple[int, str]]: - if path == "-": - for i, line in enumerate(sys.stdin, start=1): - yield i, line.rstrip("\n") - return - try: - with open(path, "r", encoding="utf-8", errors="replace") as f: - for i, line in enumerate(f, start=1): - yield i, line.rstrip("\n") - except FileNotFoundError: - print(f"error: file not found: {path}", file=sys.stderr) - sys.exit(2) - except OSError as e: - print(f"error: cannot read {path}: {e}", file=sys.stderr) - sys.exit(2) - - -def find_matches( - lines: Iterable[tuple[int, str]], - pattern: str, - ignore_case: bool = False, - regex: bool = False, - whole_word: bool = False, -) -> List[int]: - flags = re.IGNORECASE if ignore_case else 0 - if whole_word: - regex = True - pattern = rf"\b{re.escape(pattern)}\b" - - compiled = None - if regex: - try: - compiled = re.compile(pattern, flags) - except re.error as e: - print(f"error: invalid regex: {e}", file=sys.stderr) - sys.exit(2) - - hits: List[int] = [] - if compiled is not None: - for ln, text in lines: - if compiled.search(text) is not None: - hits.append(ln) - else: - if ignore_case: - needle = pattern.lower() - for ln, text in lines: - if needle in text.lower(): - hits.append(ln) - else: - for ln, text in lines: - if pattern in text: - hits.append(ln) - - # De-duplicate while preserving order - seen = set() - unique_hits: List[int] = [] - for ln in hits: - if ln not in seen: - seen.add(ln) - unique_hits.append(ln) - return unique_hits - - -def main(argv: list[str] | None = None) -> int: - p = argparse.ArgumentParser( - description="Find lines in a JSON file containing a string or regex.", - ) - p.add_argument( - "path", - help="Path to JSON file, or '-' for stdin", - ) - p.add_argument( - "pattern", - help="Search string (or regex with -r)", - ) - p.add_argument( - "-i", - "--ignore-case", - action="store_true", - help="Case-insensitive search", - ) - p.add_argument( - "-r", - "--regex", - action="store_true", - help="Treat pattern as a regular expression", - ) - p.add_argument( - "-w", - "--word", - action="store_true", - help="Whole-word match (wraps pattern with word boundaries)", - ) - output = p.add_mutually_exclusive_group() - output.add_argument( - "-N", - "--numbers-only", - action="store_true", - help="Print only line numbers (default)", - ) - output.add_argument( - "-l", - "--list", - action="store_true", - help="Print 'line: content' for each matching line", - ) - - args = p.parse_args(argv) - - hits = find_matches( - iter_lines(args.path), - args.pattern, - ignore_case=args.ignore_case, - regex=args.regex, - whole_word=args.word, - ) - - if args.list: - # Re-iterate lines for printing content efficiently - line_set = set(hits) - for ln, text in iter_lines(args.path): - if ln in line_set: - print(f"{ln}: {text}") - else: - for ln in hits: - print(ln) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) - diff --git a/scripts/report_bofa_emu_versions.py b/scripts/report_bofa_emu_versions.py deleted file mode 100644 index 1e494da..0000000 --- a/scripts/report_bofa_emu_versions.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import csv -import os -import re -import sys -from collections import Counter, defaultdict -from pathlib import Path - - -def parse_surface(surface: str): - """ - Parse a Last Surface Used value like: - - "vscode/1.99.3/copilot-chat/0.26.7" - - "JetBrains-IC/251.26927.53/" - - "VisualStudio/17.8.21/copilot-vs/1.206.0.0" - - Returns (ide_name, ide_version, ext_name, ext_version) where ext_* can be None. - Whitespace is stripped; empty or 'None' values return (None, None, None, None). - """ - if surface is None: - return None, None, None, None - s = str(surface).strip() - if not s or s.lower() == "none": - return None, None, None, None - - # Split by '/', keep empty tokens to allow trailing slash patterns - parts = s.split('/') - parts = [p.strip() for p in parts] - parts = [p for p in parts if p != ''] # drop empty tokens from trailing '/' - - if len(parts) < 2: - return None, None, None, None - - ide_name, ide_version = parts[0], parts[1] - ext_name = ext_version = None - if len(parts) >= 4: - ext_name, ext_version = parts[2], parts[3] - - return ide_name, ide_version, ext_name, ext_version - - -from typing import Optional - - -def is_copilot_extension(name: Optional[str]) -> bool: - if not name: - return False - return name.lower().startswith("copilot") - - -def find_default_csv() -> Optional[Path]: - # Look for a bofa-emu CSV in ./scripts by default - cand_dir = Path(__file__).resolve().parent - matches = sorted(cand_dir.glob("bofa-emu-seat-activity-*.csv")) - if matches: - # Choose the lexicographically last; filename usually contains a timestamp - return matches[-1] - return None - - -def main(): - parser = argparse.ArgumentParser(description="Report counts of IDE versions and Copilot extension versions from bofa-emu CSV.") - parser.add_argument("csv_path", nargs="?", help="Path to CSV (defaults to scripts/bofa-emu-seat-activity-*.csv)") - parser.add_argument("--by-extension-name", action="store_true", help="Also break down Copilot counts by extension name (e.g., copilot, copilot-chat, copilot-intellij).") - parser.add_argument("--write-csv", action="store_true", help="Write results to CSV files alongside the input or to --out-dir.") - parser.add_argument("--out-dir", help="Directory to write CSV files. Defaults to the input CSV's directory.") - parser.add_argument("--prefix", help="Output filename prefix. Defaults to the input CSV filename stem.") - args = parser.parse_args() - - csv_path = args.csv_path - if not csv_path: - default = find_default_csv() - if not default: - print("No CSV provided and no default bofa-emu CSV found in scripts/", file=sys.stderr) - sys.exit(1) - csv_path = str(default) - - csv_file = Path(csv_path) - if not csv_file.exists(): - print(f"CSV not found: {csv_file}", file=sys.stderr) - sys.exit(1) - - ide_counts = Counter() - copilot_version_counts = Counter() - copilot_name_version_counts = Counter() # optional detailed breakdown - malformed_surfaces = 0 - empty_surfaces = 0 - - with csv_file.open(newline='') as f: - reader = csv.DictReader(f) - # try to detect the column name case-insensitively - header_map = {h.lower(): h for h in reader.fieldnames or []} - surface_col = None - for key in ("last surface used", "last_surface_used", "surface", "lastsurfaceused"): - if key in header_map: - surface_col = header_map[key] - break - if surface_col is None: - print("Could not find 'Last Surface Used' column in CSV headers.", file=sys.stderr) - sys.exit(1) - - for row in reader: - raw_surface = row.get(surface_col) - ide_name, ide_ver, ext_name, ext_ver = parse_surface(raw_surface) - if ide_name is None or ide_ver is None: - if raw_surface and raw_surface.strip().lower() != "none": - malformed_surfaces += 1 - else: - empty_surfaces += 1 - continue - - # Normalize IDE name to lower for grouping consistency - norm_ide_name = ide_name.lower() - ide_key = f"{norm_ide_name}/{ide_ver}" - ide_counts[ide_key] += 1 - - if is_copilot_extension(ext_name) and ext_ver: - copilot_version_counts[ext_ver] += 1 - name_ver_key = f"{ext_name.lower()}/{ext_ver}" - copilot_name_version_counts[name_ver_key] += 1 - - def print_counter(title: str, counter: Counter): - print(title) - for key, count in counter.most_common(): - print(f" {key}: {count}") - if not counter: - print(" (none)") - print() - - print(f"Source: {csv_file}") - print() - print_counter("IDE Versions (name/version):", ide_counts) - print_counter("Copilot Extension Versions (by version):", copilot_version_counts) - if args.by_extension_name: - print_counter("Copilot Extension Versions (by extension name/version):", copilot_name_version_counts) - - # Optionally write results to CSV files - if args.write_csv: - out_dir = Path(args.out_dir) if args.out_dir else csv_file.parent - out_dir.mkdir(parents=True, exist_ok=True) - prefix = args.prefix if args.prefix else csv_file.stem - - ide_out = out_dir / f"{prefix}_ide_versions.csv" - copilot_out = out_dir / f"{prefix}_copilot_versions.csv" - copilot_byname_out = out_dir / f"{prefix}_copilot_extname_versions.csv" - - # Write IDE versions as columns: ide_name, ide_version, count - with ide_out.open('w', newline='') as f: - w = csv.writer(f) - w.writerow(["ide_name", "ide_version", "count"]) - for key, count in ide_counts.most_common(): - ide_name, ide_version = key.split('/', 1) if '/' in key else (key, "") - w.writerow([ide_name, ide_version, count]) - - # Write Copilot versions as columns: extension_version, count - with copilot_out.open('w', newline='') as f: - w = csv.writer(f) - w.writerow(["extension_version", "count"]) - for ver, count in copilot_version_counts.most_common(): - w.writerow([ver, count]) - - # Optional: by extension name and version - if args.by_extension_name: - with copilot_byname_out.open('w', newline='') as f: - w = csv.writer(f) - w.writerow(["extension_name", "extension_version", "count"]) - for key, count in copilot_name_version_counts.most_common(): - ext_name, ext_version = key.split('/', 1) if '/' in key else (key, "") - w.writerow([ext_name, ext_version, count]) - - print("Written CSVs:") - print(f" {ide_out}") - print(f" {copilot_out}") - if args.by_extension_name: - print(f" {copilot_byname_out}") - - # Small diagnostic footer - if malformed_surfaces or empty_surfaces: - print("Notes:") - if empty_surfaces: - print(f" Rows with empty/None surface: {empty_surfaces}") - if malformed_surfaces: - print(f" Rows with unparseable surface: {malformed_surfaces}") - - -if __name__ == "__main__": - main() diff --git a/terraform/iac.tf b/terraform/iac.tf deleted file mode 100644 index e69de29..0000000