From f61b8f74554c31eecacebf32c349319b525f41e9 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:07:19 +0000 Subject: [PATCH 1/3] feat(skills): add institutional project bootstrap and audit skill Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- skills/librecode-project-bootstrap/SKILL.md | 42 +++ .../agents/openai.yaml | 6 + .../assets/MIT.txt | 21 ++ .../references/contribution-and-review.md | 24 ++ .../references/documentation.md | 29 ++ .../references/evidence-ledger.md | 25 ++ .../references/github-governance.md | 36 ++ .../references/institutional-standards.md | 38 ++ .../references/language-profiles.md | 31 ++ .../references/security-and-supply-chain.md | 31 ++ .../scripts/audit_project.py | 119 +++++++ .../scripts/bootstrap.py | 332 ++++++++++++++++++ .../scripts/check_ci_results.py | 56 +++ .../scripts/tests/test_tools.py | 143 ++++++++ 14 files changed, 933 insertions(+) create mode 100644 skills/librecode-project-bootstrap/SKILL.md create mode 100644 skills/librecode-project-bootstrap/agents/openai.yaml create mode 100644 skills/librecode-project-bootstrap/assets/MIT.txt create mode 100644 skills/librecode-project-bootstrap/references/contribution-and-review.md create mode 100644 skills/librecode-project-bootstrap/references/documentation.md create mode 100644 skills/librecode-project-bootstrap/references/evidence-ledger.md create mode 100644 skills/librecode-project-bootstrap/references/github-governance.md create mode 100644 skills/librecode-project-bootstrap/references/institutional-standards.md create mode 100644 skills/librecode-project-bootstrap/references/language-profiles.md create mode 100644 skills/librecode-project-bootstrap/references/security-and-supply-chain.md create mode 100755 skills/librecode-project-bootstrap/scripts/audit_project.py create mode 100755 skills/librecode-project-bootstrap/scripts/bootstrap.py create mode 100755 skills/librecode-project-bootstrap/scripts/check_ci_results.py create mode 100644 skills/librecode-project-bootstrap/scripts/tests/test_tools.py diff --git a/skills/librecode-project-bootstrap/SKILL.md b/skills/librecode-project-bootstrap/SKILL.md new file mode 100644 index 0000000..4c14001 --- /dev/null +++ b/skills/librecode-project-bootstrap/SKILL.md @@ -0,0 +1,42 @@ +--- +name: librecode-project-bootstrap +description: Bootstrap or audit LibreCode Coop software repositories across PHP, Python, TypeScript, JavaScript, Go and other languages. Use for new repository creation, migration of existing project quality controls, GitHub governance alignment, CI/CD and supply-chain hardening, reusable test setup, or compliance gap assessments. Cross-check the live LibreCodeCoop/.github policies and workflows, adapt to the project's language and deployment model, execute checks, produce evidence, and prepare signed DCO pull requests only when authorized. +--- + + + + +# LibreCode project bootstrap + +Operate in **create** or **audit** mode. The skill is an engineering workflow, not a promise that generated files alone constitute compliance. + +## Intake and scope + +Record project name, purpose, owner/reviewers, programming language, supported runtime versions, application type (library, CLI, service, plugin, container or other), distribution channel, intended environment, license/SPDX identifier, and repository visibility. Identify data sensitivity, authentication, multi-tenant and migration boundaries. Request missing decisions that block safe execution; **never infer the license, production credentials, or a release policy**. Prefer a minimally viable project and avoid adding optional infrastructure. + +Read [institutional-standards.md](references/institutional-standards.md) to distinguish institutionally defined policy, repeated conventions, and product-specific requirements. Refresh against the live `LibreCodeCoop/.github` repository when connected: its configuration is authoritative over this dated evidence snapshot. Read [evidence-ledger.md](references/evidence-ledger.md) before claiming organization-wide adoption. + +## Create a project + +1. Inspect target directory and Git state. Refuse destructive overwrites; use a new working branch. Confirm user authorization before repository mutation. +2. Choose the smallest language toolchain from [language-profiles.md](references/language-profiles.md). For a simple CLI prototype, `python3 scripts/bootstrap.py --help` creates a dependency-free baseline; **it does not finish the engineering review**. For other application types, implement native project structure directly. Do not invent business endpoints, databases, Docker, or deployment assets. +3. Select and install lint, formatter, static analysis, unit/integration/negative tests, dependency audit and lock strategy appropriate to the runtime; use native tool configuration and package-manager scripts rather than long embedded workflow shell scripts. Run commands and repair real failures. Record unexecutable checks as pending, not passing. +4. Use [github-governance.md](references/github-governance.md) and [security-and-supply-chain.md](references/security-and-supply-chain.md). Adopt existing organizational workflows from `LibreCodeCoop/.github/workflow-templates/` where suitable, respecting catalog provenance, `.github/actions-lock.txt` and consumer `.patch` files. Adapt unsupported languages explicitly and do not submit unreviewed templates to the catalog. Use immutable SHA references, review upstream versions, and run policy checker, actionlint and zizmor when available. +5. Apply [documentation.md](references/documentation.md): produce only relevant README, contribution/security, licensing, architecture/development/operations documentation. Include synthetic examples, SPDX attribution and actual license text. A license identifier alone is not REUSE compliance. +6. Produce evidence: commands and exit codes, negative-test failures that are correctly rejected, build/package artifacts, dependency audit, workflow results, coverage interpretation, risks and residual gaps. Do not claim a green CI check before GitHub reports it. +7. Only when authorized, follow [contribution-and-review.md](references/contribution-and-review.md): conventional commit, DCO signoff, authenticated cryptographic signing, reviewed branch/PR. Do not merge, deploy, modify organization rulesets, publish releases, or expose credentials without separate authorization. + +## Audit an existing project + +1. Capture branch/HEAD, inventory manifests/workflows/docs/CI/rulesets and identify the actual runtime. Inspect recent relevant pull requests, not only checked-in files. +2. Run `python3 scripts/audit_project.py ` for read-only local heuristics; consider its UNKNOWN results explicitly. Verify actual GitHub checks, rulesets, CODEOWNERS effectiveness, coverage, security behavior and current template sync separately. Never mistake a present file for an operating control. +3. Compare against [institutional-standards.md](references/institutional-standards.md) with `required`, `recommended`, `conditional`, `product-specific` labels and evidence links. Separate *policy intent*, *observed implementation*, *enforcement*, and *audit judgment*. +4. Return a prioritized diff/plan. Do not overwrite local changes or reconfigure protection. If remediation is authorized, implement focused patches, run checks, and prepare a signed PR. + +## CI integrity and acceptance + +A `ci-required` job is legitimate only when it observes **all required jobs for the same effective revision**, including failures, cancellations, missing jobs and unapproved skips. `needs` cannot observe independent workflow runs. An unverified aggregator is an **unresolved governance gap**, never a fabricated green gate. See [github-governance.md](references/github-governance.md); `scripts/check_ci_results.py` only validates an explicit result manifest and is **not** a GitHub CI coordinator by itself. + +## Deliverable contract + +Report: repository and pinned HEAD; requested scope; selected controls and sources; executed commands and results; matrix of pass/fail/unknown/not-applicable with reasons; unverified or missing dependencies; signed commit and PR status (if applicable); follow-up approvals. Provide a rollback path for proposed changes. Never transform recommended or product-specific practices into universal institutional mandates without supporting governance evidence. diff --git a/skills/librecode-project-bootstrap/agents/openai.yaml b/skills/librecode-project-bootstrap/agents/openai.yaml new file mode 100644 index 0000000..1da3882 --- /dev/null +++ b/skills/librecode-project-bootstrap/agents/openai.yaml @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2026 LibreCode Coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +interface: + display_name: LibreCode Project Bootstrap + short_description: Bootstrap and audit LibreCode software projects with evidence-based engineering standards. + brand_color: '#21705C' diff --git a/skills/librecode-project-bootstrap/assets/MIT.txt b/skills/librecode-project-bootstrap/assets/MIT.txt new file mode 100644 index 0000000..b322a5a --- /dev/null +++ b/skills/librecode-project-bootstrap/assets/MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 LibreCode Coop and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/skills/librecode-project-bootstrap/references/contribution-and-review.md b/skills/librecode-project-bootstrap/references/contribution-and-review.md new file mode 100644 index 0000000..6df785c --- /dev/null +++ b/skills/librecode-project-bootstrap/references/contribution-and-review.md @@ -0,0 +1,24 @@ + + + +# Contribution, signing and review + +## Commit contract + +Use Conventional Commits (`feat(scope): ...`, `fix(scope): ...`, `ci(scope): ...`, `docs(scope): ...`). Every changed commit must have the author's DCO `Signed-off-by: Name ` trailer. A DCO trailer is **not** cryptographic signing. For this Skill, use the authorized **Git Signing MCP** when preparing remote changes; inspect its fixed identity and obtain a signed commit with checked base HEAD, then independently verify SHA, signature and DCO identity. Do not claim to sign as a different person. + +## Focused PR + +- Start from a reviewed HEAD and create a dedicated branch. Preserve unrelated work and refuse stale-base overwrites. Do not force-push or rebase other people's commits without authorization. +- PR description: motivation, scope, design choices and rejected alternatives, sources/policy, exact tests with status, security/licensing implications, migration/rollback, outstanding risks and approvals. +- Keep generated screenshots out of tracked files unless explicitly a product asset; link them from the PR description if requested. Do not expose internal infrastructure or personal data. +- Update the existing PR when the requested scope is the same. Review code, conflict resolution, new CI statuses and approvals; never infer merge-readiness from a green label alone. +- Preserve CODEOWNERS approvals, required checks, resolved conversations and branch recency; ask for independent review. A branch protection bypass is not an implicit user authorization. + +## Readiness labels + +- **Ready for review**: local required checks executed and pass; remote checks may still be pending; source review required. +- **Ready for merge**: remote mandatory checks on expected SHA pass, approvals/threads/rulesets satisfied, relevant risk documented; never self-merge with this Skill. +- **Blocked**: unavailable dependency, failing check, missing authorization, security/release concern or unverified gates. + +Review and approval are separate actions; publish, deploy, ruleset apply and merge require explicit authorization. diff --git a/skills/librecode-project-bootstrap/references/documentation.md b/skills/librecode-project-bootstrap/references/documentation.md new file mode 100644 index 0000000..741a0b0 --- /dev/null +++ b/skills/librecode-project-bootstrap/references/documentation.md @@ -0,0 +1,29 @@ + + + +# Documentation and licensing + +Generate only material needed for the project's distribution and operating model: + +| Document | Default | Acceptance criteria | +| --- | --- | --- | +| `README.md` | yes | Objective, install/preconditions, exact working test commands, supported runtime, license, support and run instructions | +| `CONTRIBUTING.md` | yes for collaborative repo | DCO and Conventional Commits, review/testing expectations and practical setup | +| `SECURITY.md` | public or security-sensitive projects | Private reporting channel actually owned, scope, no promised SLA without agreement | +| `LICENSES/.txt`, SPDX and `REUSE.toml` | if REUSE adopted | Correct canonical license text and file attribution; `reuse lint` passes | +| `docs/architecture.md` | multiple services/trust boundaries | System ownership, boundaries and significant tradeoffs, not speculative diagrams | +| `docs/development.md` | non-obvious dev setup | All reproducible tool/fixture commands | +| `docs/operations.md` | deployed service | Configuration, secrets handling, health, logs, backups, rollback and responsibilities | +| `CHANGELOG.md` | public versioned releases | Entries reflect actual releases, not a generated history | +| Examples/API specs | if exposed API/SDK | Executable examples, minimal synthetic fixtures, no production URLs/records | + +## Licensing decisions + +- Ask for an SPDX license identifier. Do **not** default every new project to AGPL, although the inspected LibreCode PHP projects use it. +- Verify legal compatibility of dependency licenses, assets and distribution method. Do not invent a new license from a short SPDX string. +- For code/text supporting comments use `SPDX-FileCopyrightText` and `SPDX-License-Identifier`; for JSON/binary files supply `REUSE.toml` annotations or `.license` files. Keep complete canonical license texts in `LICENSES/`. Validate with `reuse lint`, not mere existence checks. +- Existing `LibreCodeCoop/.github` content is licensed AGPL-3.0-or-later; introducing a Skill in that repository should follow its source file notices. Consumer output uses the explicitly selected project license, which can differ. + +## Avoid ephemeral noise + +Do not commit temporary incident logs, one-off investigation notes, screenshots generated for code review, giant audit dumps or per-PR plans that belong in the PR description or private workspace. Document durable behavior, constraints and decisions. Keep PR descriptions current rather than leaving many contradictory progress comments. Prefer reproducible tests and brief explanations over raw command transcripts. Avoid putting machine hostnames, operational IPs or tenant-specific data into public documentation. diff --git a/skills/librecode-project-bootstrap/references/evidence-ledger.md b/skills/librecode-project-bootstrap/references/evidence-ledger.md new file mode 100644 index 0000000..7de8e90 --- /dev/null +++ b/skills/librecode-project-bootstrap/references/evidence-ledger.md @@ -0,0 +1,25 @@ + + + +# Evidence ledger (2026-11-03 snapshot) + +This is an **observed sample**, not a certification of organization-wide rollout. URLs point to inspected default-branch files or review history. `main` links may move; retrieve the SHA and remote checks when applying the Skill. + +| Pattern / claim | Origin | Observation / adoption state | Limit or exception | +| --- | --- | --- | --- | +| Declarative branch and CI policies | [.github/governance.config.json](https://github.com/LibreCodeCoop/.github/blob/main/governance.config.json) | Active desired `protected-branches` for eligible repos; specific `organization-config-ci`, `governance-ci` | `required-ci-gate` **disabled**; no remote proof here | +| Ruleset plan/apply isolation | [.github PR #96](https://github.com/LibreCodeCoop/.github/pull/96) | Reviewed design separates read-only plan and protected environment apply | Does not authorize unattended ruleset mutation | +| Contract for real aggregate | [repository-governance.md](https://github.com/LibreCodeCoop/.github/blob/main/docs/repository-governance.md), [CI gate contract test](https://github.com/LibreCodeCoop/.github/blob/main/tests/test_governance_ci_gate_contract.py) | Explicit failure/cancellation/skips requirements | No verified cross-workflow coordinator in sampled consumers | +| Immutable Actions, version annotations, checkout creds | [workflow checker](https://github.com/LibreCodeCoop/.github/blob/main/scripts/check_workflow_policy.py), [negative tests](https://github.com/LibreCodeCoop/.github/blob/main/tests/test_workflow_policy.py), [nextcloud-docker PR #85](https://github.com/LibreCodeCoop/nextcloud-docker/pull/85) | Enforced for `.github` workflows, practical migration in Docker project | [akaunting-nfse Behat workflow](https://github.com/LibreCodeCoop/akaunting-nfse/blob/main/.github/workflows/behat.yml) still shows mutable `@v7` etc. Not universal | +| Managed workflow sync with consumer patches | [cross-repo automation](https://github.com/LibreCodeCoop/.github/blob/main/docs/cross-repository-automation.md), [sync template](https://github.com/LibreCodeCoop/.github/blob/main/workflow-templates/sync-workflow-templates.yml), [.github PR #104](https://github.com/LibreCodeCoop/.github/pull/104) | Catalog, actions-lock and optional `.patch`, opt-in | Compatibility/credentials need consumer verification | +| Dependency actor/approval policy | [dependency-update-policy.md](https://github.com/LibreCodeCoop/.github/blob/main/docs/dependency-update-policy.md) | Human review for major versions; scoped App tokens | Bot set and release branches remain contextual | +| PHP unit, static, style, DCO, Composer audit, smoke | [suitecrm-mcp workflows](https://github.com/LibreCodeCoop/suitecrm-mcp/tree/main/.github/workflows), [composer.json](https://github.com/LibreCodeCoop/suitecrm-mcp/blob/main/composer.json), [CONTRIBUTING](https://github.com/LibreCodeCoop/suitecrm-mcp/blob/main/CONTRIBUTING.md) | Repeatable composer check and PHP ecosystem tools | PHP 8.5 and OAuth tests are not generic requirements | +| Independently tested public scope, secrets, coverage | [akaunting-mcp scope](https://github.com/LibreCodeCoop/akaunting-mcp/blob/main/.github/workflows/scope.yml), [secrets](https://github.com/LibreCodeCoop/akaunting-mcp/blob/main/.github/workflows/secrets.yml), [PHPUnit](https://github.com/LibreCodeCoop/akaunting-mcp/blob/main/.github/workflows/phpunit.yml) | Self-tested release checker, Gitleaks tree/history, 77% project-specific threshold | 77% is not an organization-wide coverage target | +| Native dependency/tool isolation | [akaunting-mcp composer.json](https://github.com/LibreCodeCoop/akaunting-mcp/blob/main/composer.json), [AGENTS](https://github.com/LibreCodeCoop/akaunting-mcp/blob/main/AGENTS.md) | Composer bin plugin and vendor-bin, scripts prefer PHP | Not appropriate to blindly reproduce in Python/Go | +| PHP interfaces and behavioral HTTP tests | [akaunting-nfse Behat](https://github.com/LibreCodeCoop/akaunting-nfse/blob/main/.github/workflows/behat.yml), [PR #521](https://github.com/LibreCodeCoop/akaunting-nfse/pull/521) | Disposable test data; security negative tests and MySQL grant verification | Fiscal/tenant details are product-specific | +| Compatibility/minimum deps | [nfse-php minimum-dependencies workflow](https://github.com/LibreCodeCoop/nfse-php/blob/main/.github/workflows/minimum-dependencies.yml) | Tests lowest supported constraints against PHP matrix | Relevant principally for libraries | +| Frontend e2e/runtime matrices | [profile_fields package.json](https://github.com/LibreCodeCoop/profile_fields/blob/main/package.json), [workflows](https://github.com/LibreCodeCoop/profile_fields/tree/main/.github/workflows) | Vitest, Playwright, TypeScript, Psalm | Nextcloud-only dependency/tool versions are conditional | +| Shell/container regression | [nextcloud-docker Makefile](https://github.com/LibreCodeCoop/nextcloud-docker/blob/main/Makefile), [Docker workflow](https://github.com/LibreCodeCoop/nextcloud-docker/blob/main/.github/workflows/docker-image.yml), [PR #85](https://github.com/LibreCodeCoop/nextcloud-docker/pull/85) | Bats suites and image security tests, pinned Actions | Do not create Docker for plain libraries | +| Stable branches and controlled release | [release architecture](https://github.com/LibreCodeCoop/.github/blob/main/docs/release-workflow-architecture.md), [LibreSign PR #9321](https://github.com/LibreSign/libresign/pull/9321) | Pinned checked-out ref and independent integration verification | Only projects with supported version branches need backport/release graph | +| Licensing and SPDX | [REUSE template](https://github.com/LibreCodeCoop/.github/blob/main/workflow-templates/reuse.yml), [suitecrm-mcp REUSE.toml](https://github.com/LibreCodeCoop/suitecrm-mcp/blob/main/REUSE.toml) | Repeated SPDX/REUSE conventions and checks | No evidence AGPL universally mandated; select license explicitly | +| CODEOWNERS | [.github owners](https://github.com/LibreCodeCoop/.github/blob/main/.github/CODEOWNERS), [profile_fields owners](https://github.com/LibreCodeCoop/profile_fields/blob/main/.github/CODEOWNERS) | Present in two, limited mapping in profile_fields | Requested `.github/CODEOWNERS` paths absent in sampled suitecrm-mcp and akaunting-mcp; review effective settings | diff --git a/skills/librecode-project-bootstrap/references/github-governance.md b/skills/librecode-project-bootstrap/references/github-governance.md new file mode 100644 index 0000000..6bd944f --- /dev/null +++ b/skills/librecode-project-bootstrap/references/github-governance.md @@ -0,0 +1,36 @@ + + + +# GitHub governance and workflow distribution + +Sources: [governance configuration](https://github.com/LibreCodeCoop/.github/blob/main/governance.config.json), [repository governance](https://github.com/LibreCodeCoop/.github/blob/main/docs/repository-governance.md), [cross-repository automation](https://github.com/LibreCodeCoop/.github/blob/main/docs/cross-repository-automation.md), [dependency policy](https://github.com/LibreCodeCoop/.github/blob/main/docs/dependency-update-policy.md). + +## Authority and rollout + +- `LibreCodeCoop/.github` contains the organization configuration and the **workflow catalog**; the shared `github-governance` engine executes declarative synchronization. A merge to `.github` does not automatically apply a remote ruleset. +- `protected-branches` is declared active by default for eligible public, non-archived repos' default and `stable*` branches. It disallows deletion/force-push, requires one review, Code Owner review and resolved threads, and can dismiss stale approvals. Verify the **remote** ruleset and actual CODEOWNERS in each repo. +- `organization-config-ci` is active only for `.github` with required DCO/actionlint/zizmor. `governance-ci` is selected for `github-governance` with more checks. This is not evidence every consumer has those required contexts. +- `required-ci-gate` presently declares `enforcement: disabled`, selected only for `release-tool` and `nextcloud-docker-development`; it must not be enabled without producing/validating `ci-required` on those consumers. +- Ruleset sync: dry-run plan, human review of diff, protected environment authorization for explicit apply, remote verification, final drift check. This skill must never trigger apply automatically. + +## CI aggregator correctness + +1. List all *mandatory* jobs/check contexts, workflows, matrices and expected branch/ref; distinguish optional checks and allowed skips. +2. For jobs in one workflow, use a final `needs`-dependent job with `if: always()`; inspect every required `needs..result`. Treat `failure`, `cancelled`, `skipped` (unless an explicit and tested exemption), missing and unknown as blocking. The aggregate must not be successful because a dependency failed. +3. GitHub `needs` only reports jobs in the same workflow graph. Separate workflow runs need a tested coordinator that fetches correctly keyed check suites and handles not-yet-complete checks and reruns. Do not fake a green aggregate or depend on job presence alone. +4. Verify outcome on success, failure, cancellation, unexpected skip, rerun and fork PR; verify the context is attached to the SHA expected by branch protection. Test matrix failure and changes in mandatory job list. +5. Only after a real producer is stable may a separate authorized governance PR propose activation of required context. Do not modify governance config to accommodate a green placeholder. + +`scripts/check_ci_results.py` is an offline contract-testing helper. It is **not** a GitHub Actions job, check publisher or substitute for cross-workflow coordination. + +## Shared workflow adoption + +1. Inspect `workflow-templates/` and selected language/application runtime. Use only applicable templates. The catalog contains `reuse`, commit lint, TypeScript, PHP/Nextcloud, Node, release and synchronization templates; it is not a generic Python/Go CI library. +2. Follow `docs/cross-repository-automation.md`: install workflows and optional `sync-workflow-templates.yml`, choose approved auth, run synchronization, review resulting PR. Track `.github/actions-lock.txt`. Place consumer-specific transformations in `.github/workflows/.patch`; direct modifications to synced workflows will be treated as drift. +3. For selective enrollment, `include` must name an existing catalog workflow. Do not enroll all workflow templates blindly. Never assume sync is authorized to merge its own PR. +4. Templates derived from upstream use pinned manifest hash + downstream patch in the catalog; do not fork or edit the upstream copy independently. For local language-specific CI outside the catalog, document provenance and submit for architectural review before promotion. +5. New Actions `uses:` references require verified full 40-hex SHA and truthful adjacent upstream version comment; local `./` refs are exempt. For `actions/checkout`, set `persist-credentials: false`. Prefer explicit `permissions: contents: read`, scoped writes only for publishing jobs. Run `.github/scripts/check_workflow_policy.py` against consumer workflows or equivalent validated checker. Pin third-party containers by digest when feasible. + +## PR/change policy + +Never use `pull_request_target` to execute untrusted code with a write token. Privileged dependency automation verifies the bot actor, grants narrow permissions and does not approve arbitrary changes. Approved patch/minor auto-merge is separate from approval; **this skill never merges**. If adding CODEOWNERS, assign real consenting maintainers; organizational CODEOWNERS is not inherited by individual repositories. Avoid path filters that prevent a branch-required check from appearing on applicable PRs. diff --git a/skills/librecode-project-bootstrap/references/institutional-standards.md b/skills/librecode-project-bootstrap/references/institutional-standards.md new file mode 100644 index 0000000..bc09d36 --- /dev/null +++ b/skills/librecode-project-bootstrap/references/institutional-standards.md @@ -0,0 +1,38 @@ + + + +# Engineering standards decision matrix + +Snapshot: 2026-11-03, inspected on default branches. The source of truth for organization policies is `LibreCodeCoop/.github`, not this summary. **Policy intent, implementation, and active enforcement are different states.** + +Definitions: **Required** = explicit applicable governance rule or release/PR contract in this skill; **Recommended** = repeated, well-supported engineering practice but not universal enforcement; **Conditional** = applicability depends on code, runtime, threat model or distribution; **Product-specific** = do not transfer automatically. The following classification is a **proposed engineering baseline**, not an enacted organization-wide ruleset. + +| Control | Classification | Adoption / enforcement evidence | Verification or acceptance criterion | +| --- | --- | --- | --- | +| Reviewed PR, one approval, resolved threads, non-fast-forward protection on default/stable* | Required where `protected-branches` is applied | `governance.config.json` declares default active policy; application on a concrete repository must be queried | Inspect effective ruleset and PR approvals; no direct merge via this skill | +| CODEOWNERS with appropriate actual reviewer | Conditional operational prerequisite for effective owner review | `.github/CODEOWNERS` exists in org-config; only a narrow file rule confirmed in `profile_fields`; absent at observed `suitecrm-mcp`, `akaunting-mcp` paths | Check consumer's effective CODEOWNERS mapping; do not infer inheritance | +| Conventional Commits and DCO signoff | Required for commits created through this skill; recommended/adopted by several projects | `suitecrm-mcp`, `akaunting-mcp` PR checks; `nfse-php` commit workflow; organization-config CI declares DCO | Inspect every new commit trailer and PR checks, not only PR title | +| Cryptographically signed commits | Required for this skill's authorized writes; not proven to be enforced org-wide | `suitecrm-mcp/CONTRIBUTING.md` recommends; `akaunting-mcp/AGENTS.md` instructs signing | Git Signing MCP reports verified, DCO matches author; record SHA | +| GitHub Actions remote `uses:` pinned to full SHA and version comment | Required for newly created/changed workflows under LibreCode convention | `.github/docs/repository-governance.md`; executable `scripts/check_workflow_policy.py`; not all consumers yet migrated | Run authoritative checker, actionlint, zizmor; verify upstream version/commit | +| Least-privilege workflow `permissions` and checkout no persisted creds | Required for new workflows | `.github/scripts/check_workflow_policy.py` plus observed CI | Inspect effective job privileges; reject `write-all`; test untrusted PR paths | +| `ci-required` aggregate | Conditional: only if consumer explicitly uses it | Declared policy is **disabled** for named consumers until proven | Cover all mandatory jobs, failure/cancellation/missing/skip scenarios and commit matching; no dummy job | +| Language-native lint, static analysis, tests and formatting | Recommended baseline, tools conditional | PHPStan/PHPUnit/CS Fixer in two MCPs; Psalm, Behat/Playwright in NFSe/Nextcloud apps; Bats in Docker repo | Run exact local and CI commands; negative and integration tests where relevant | +| Dependency locking, reproducible install and audit | Conditional to language/dependencies, strongly recommended | Composer locks in MCPs, npm lock in profile_fields, Composer audit workflows | Reproduce locked installation and run native audit when applicable | +| Immutable container inputs, runtime smoke, secrets separation | Conditional to container/distribution | `suitecrm-mcp` Docker smoke; `nextcloud-docker` Bats and pinned digest management | Build + actual smoke, persistence verification, least privilege, image scan | +| REUSE/SPDX identifiers and complete license text | Required for repos using REUSE policy; proposed default for new repos | REUSE action catalog template, REUSE.toml/LICENSES in PHP repos | `reuse lint` with matching license files; manual licensing review | +| Project-specific license chosen explicitly | Required input, **not** universal AGPL | Observed project licenses include AGPL; no organization rule was found mandating it for all projects | SPDX value matches manifests, file headers, LICENSES and distribution | +| README and contribution/security reporting | Recommended, conditional depth | Repeated MCP/NFSe root docs; repo-specific SECURITY policies | Document actual setup, disclosure route, operational boundaries; test examples | +| Secrets and public release scope scanning | Conditional to public/distributed/sensitive repos; recommended | `akaunting-mcp` secret & source scope workflows | Scan tree and history where appropriate; synthetic fixtures, no production data | +| Release/tag/stable branch workflow | Conditional to distribution and support matrix | `.github/docs/release-workflow-architecture.md`, Nextcloud app templates | Package validated exact checked-out ref; explicit publish authorization | +| Fiscal/multi-tenant/Nextcloud product tests | Product-specific | `akaunting-nfse` API/MySQL/Behat/Playwright; LibreSign backports | Transfer contract-thinking, not their services, runtime or exact workflows | + +## Non-negotiable interpretation rules + +1. A documented desired rule does not prove effective remote branch protection. The active `required-ci-gate` option is disabled; do not activate on recommendation alone. +2. Catalog templates are a maintained source, not universal compatibility guarantees. A Nextcloud-specific Psalm template is not a generic PHP workflow. Do not fabricate a Python/Go/TypeScript template as already institutional. +3. Signed commits and Conventional Commits/DCO are distinct. A signed commit can fail DCO; a DCO trailer does not prove a cryptographic signature. +4. Testing one code path is not evidence of coverage adequacy, security or production readiness. Require meaningful assertions, negative cases and actual execution. +5. Contexts like `ci-required`, `DCO`, `actionlint` and `zizmor` must come from real checks covering the expected ref, not statuses manufactured for protection. +6. A local audit returns best-effort findings. Prove GitHub-side rulesets/checks with remote inspection before asserting conformance. + +Consult [evidence-ledger.md](evidence-ledger.md) for direct source URLs, observed vs. missing adoption, and known exceptions. diff --git a/skills/librecode-project-bootstrap/references/language-profiles.md b/skills/librecode-project-bootstrap/references/language-profiles.md new file mode 100644 index 0000000..1d7b237 --- /dev/null +++ b/skills/librecode-project-bootstrap/references/language-profiles.md @@ -0,0 +1,31 @@ + + + +# Language-specific verification profiles + +All commands are **candidates**: select a compatible current toolchain, install it, pin dependencies and run it on a real project. Do not add an unused configuration just because the profile lists a tool. PHP prototypes can run without Composer; that is a first verification stage, **not** a substitute for PHPStan/Psalm and a production test runner. + +| Language / use case | Native project setup | Quality and verification | Dependency/distribution | +| --- | --- | --- | --- | +| PHP library/service | `composer.json` PSR-4, supported PHP runtime; choose PHPUnit/Pest as justified | `php -l`; PHPUnit including negative/integration tests; PHPStan **or** Psalm; PHP-CS-Fixer; Composer scripts exposing checks | `composer validate --strict`, `composer install`, `composer audit`; commit `composer.lock` for applications, evaluate lock strategy for libraries | +| Python package/service | `pyproject.toml` and `src/` package, selected Python version | `python -m unittest discover` or pytest; Ruff lint/format and mypy/pyright where needed; `python -m compileall` syntax; integration tests | uv or pip-tools/lock solution selected explicitly, `pip-audit` or equivalent, build and install wheel before publishing | +| TypeScript | `package.json`, `tsconfig.json`, engines and package manager | `npm ci`, `npm run lint`, `npm run check-types`, `npm test`, `npm run build` after defining real scripts; Playwright for UI where justified | `package-lock.json` or project-standard lock, `npm audit`, immutable CI tool versions | +| JavaScript | Explicit Node runtime and module mode | Node `--test`, ESLint/formatter or equivalent; type checking optional for JS | `npm ci`, `npm audit` when dependencies exist | +| Go | `go.mod` and supported Go version | `go test ./...`, `go vet ./...`, `gofmt -l .`, optional `-race` where environment supports | `go mod verify`, `govulncheck` if available; reproducible build | +| Shell/containers | Avoid custom runtime when language-native tooling exists | `shellcheck`, Bats tests for nontrivial scripts, Docker build/smoke, compose validation | Review immutable image tags/digests, vulnerability and secrets scans | +| Other | Choose idiomatic manifest/build tool for that language | Equivalent formatter + static analysis + unit/integration/negative tests, package scan | Lock/pin dependencies, identify supported runtime matrix and release contract | + +## Scope-based selection + +1. For a **new minimal CLI**, start with a dependency-free language-native smoke/negative test; add a serious test framework and static analyzer once substantive behavior exists. An unused PHPUnit/Ruff/Playwright config is not progress. +2. For a **library**, test both lowest supported runtime/dependencies and supported latest runtime where feasible. For a **deployed service**, add integration, auth/error scenarios, health/readiness and safe migrations. +3. For a **plugin**, reuse host framework conventions and compatibility matrix (e.g. Nextcloud appinfo.xml and supported APIs), without importing host-only workflows into generic code. +4. For **security-sensitive interfaces**, test denial scenarios, tenant isolation, malformed input and transaction guarantees against synthetic fixtures. +5. For a **container image**, build for target architectures, test expected user, persistence, startup/health, and scan dependencies/images. Do not include deployment automation in library scaffolds. +6. Prefer package-manager task aliases (`composer check`, `npm run check`, `go test`) over large shell blocks in GitHub Actions; CI should orchestrate tested commands. + +## Local bootstrap helper + +`python3 scripts/bootstrap.py --name demo --language python --runtime 3.12 --kind cli --license MIT --distribution source --destination /tmp/demo` + +Supported deterministic minimal CLI stubs: `php`, `python`, `javascript`, `go`; for `typescript` and specialized application types, the Skill must assemble a proper package manifest/test/build via normal engineering work rather than emit an untested incomplete project. Every generated CLI has functional success and negative-argument tests; no production database or deployment infrastructure is added. Report missing third-party lint/static/toolchain checks explicitly until installed and run. diff --git a/skills/librecode-project-bootstrap/references/security-and-supply-chain.md b/skills/librecode-project-bootstrap/references/security-and-supply-chain.md new file mode 100644 index 0000000..b8635d5 --- /dev/null +++ b/skills/librecode-project-bootstrap/references/security-and-supply-chain.md @@ -0,0 +1,31 @@ + + + +# Security and supply chain controls + +## Baseline threat modeling + +Identify trust boundaries first: public pull requests, CI tokens, dependencies, runtime secrets, tenant boundaries, authentication, data retention, network entrypoints, release artifacts. Do not add Docker, a secret manager, a database, privileged GitHub token or public tunnel merely to match another project's architecture. + +| Control | How to verify | Notes | +| --- | --- | --- | +| Third-party Actions immutable refs | Run authoritative `LibreCodeCoop/.github/scripts/check_workflow_policy.py` and actionlint; compare SHA with published upstream release | `@vN` and shortened hashes are not acceptable for new LibreCode workflows; annotate true upstream version | +| Workflow privilege and untrusted PRs | Inspect `permissions`, checkout credential persistence, event and actor gates; run zizmor | `pull_request_target` is especially sensitive; no PR checkout/execution with write credentials | +| Secret exposure | Gitleaks or equivalent on files and Git history, review examples and logs | Scans cannot prove secret-free history; never paste secrets in reports | +| Dependencies | Native audit: `composer audit`, `npm audit`, `pip-audit`/`uv audit` where available, `govulncheck`; verify install from locked inputs | Tool availability and advisory freshness must be reported; do not replace locked install with untracked updates | +| Negative security tests | Attempt unauthorized access, cross-tenant access, invalid tokens, malicious URLs and corrupted data where applicable | No production accounts/data, no real fiscal transmissions | +| Container safety | `docker build`, `docker compose config --quiet`, test startup/readiness, permissions, volume persistence, vulnerability scan | Do not publish images as a smoke-test shortcut; explicit digest/architectures when useful | +| Public release scope | Whitelist expected source/config, scan distribution archive; reject `.env`, keys, internal hosts and local debug artifacts | `akaunting-mcp` includes a self-tested public-scope checker; not every project needs that implementation | +| Release integrity | Verify exact ref, protected branch, reproducible package/checksum, approval, published artifact comparison | Publishing is never implied by CI success | + +## Credential and deployment boundaries + +Use `.env.example` with placeholders only when configuration exists; never commit actual `.env`, credentials, customer exports, private incident reports, SSH keys or operational backup files. Keep production-only runbooks in an authorized private location if they contain sensitive infrastructure details. Separate source build from deployment credentials and mutable production operations. Ensure test environments use disposable synthetic records. + +## Dependency automation + +Prefer one updater per dependency ecosystem, avoiding overlapping Dependabot and Renovate ownership. For example, `suitecrm-mcp` uses Dependabot for Composer and GitHub Actions while Renovate manages Dockerfile/Compose; `akaunting-mcp` instead uses Dependabot for Docker as well. There is no universal single-bot rule. Major updates require human review by default; approved patch/minor automation must still pass required checks. Do not enable auto-merge on this skill's PRs. + +## Checklists are not checks + +Every item must map to a command, CI check, invariant test or explicit human signoff. `audit_project.py` may flag a missing config but cannot prove remote branch protection, secret-free history, or quality of business assertions. `check_ci_results.py` is only a unit-testable result evaluator and cannot publish `ci-required`. diff --git a/skills/librecode-project-bootstrap/scripts/audit_project.py b/skills/librecode-project-bootstrap/scripts/audit_project.py new file mode 100755 index 0000000..f22c6d0 --- /dev/null +++ b/skills/librecode-project-bootstrap/scripts/audit_project.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2026 LibreCode Coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +"""Read-only, conservative inventory of a project's observable local controls. + +A local audit cannot certify GitHub-side rulesets, approvals, action signing, +remote checks, dependency vulnerabilities or actual unit-test quality. +""" + +from __future__ import annotations + +import argparse +import json +import re +from dataclasses import asdict, dataclass +from pathlib import Path + +FULL_SHA = re.compile(r"^[0-9a-fA-F]{40}$") +USE = re.compile(r"^\s*(?:-\s*)?uses:\s*([^@\s]+)@([^\s#]+)(.*)$") +VERSION = re.compile(r"^#\s*v?\d+(?:\.\d+){0,2}(?:[-.][A-Za-z0-9.-]+)?\s*$") + + +@dataclass +class Finding: + id: str + severity: str + status: str + evidence: str + message: str + + +def inspect_workflow(path: Path, root: Path) -> list[Finding]: + findings = [] + lines = path.read_text(encoding="utf-8").splitlines() + rel = str(path.relative_to(root)) + for i, line in enumerate(lines): + if re.search(r"permissions:\s*write-all\b", line): + findings.append(Finding("workflow-least-privilege", "required", "FAIL", f"{rel}:{i+1}", "write-all is forbidden")) + match = USE.match(line) + if not match: + continue + action, revision, trailing = match.groups() + if action.startswith("./"): + continue + if not FULL_SHA.fullmatch(revision): + findings.append(Finding("workflow-immutable-uses", "required", "FAIL", f"{rel}:{i+1}", f"mutable or short revision: {action}@{revision}")) + continue + comment = trailing.strip() + if action.startswith(("LibreCodeCoop/", "LibreSign/")): + annotated = bool(re.fullmatch(r"#\s*\S(?:.*\S)?", comment)) + else: + annotated = bool(VERSION.fullmatch(comment)) + if not annotated: + findings.append(Finding("workflow-version-comment", "required", "FAIL", f"{rel}:{i+1}", "missing truthful upstream version/source comment")) + if action == "actions/checkout": + block = "\n".join(lines[i+1:i+8]) + if not re.search(r"persist-credentials:\s*false\b", block): + findings.append(Finding("checkout-credentials", "required", "FAIL", f"{rel}:{i+1}", "checkout does not set persist-credentials: false")) + return findings + + +def evaluate(root: Path) -> dict[str, object]: + if not root.is_dir(): + raise ValueError(f"not a directory: {root}") + f: list[Finding] = [] + + def record(id: str, severity: str, status: str, path: str, message: str) -> None: + f.append(Finding(id, severity, status, path, message)) + + files = {p.name for p in root.iterdir() if p.is_file()} + language = [] + for identifier, path in (("php", "composer.json"), ("python", "pyproject.toml"), ("javascript/typescript", "package.json"), ("go", "go.mod")): + if path in files: + language.append(identifier) + record("language-manifest", "conditional", "PASS" if language else "UNKNOWN", ", ".join(language), "detected manifest(s); verify the declared runtime and lockfile") + for required in ("README.md", "CONTRIBUTING.md"): + record("document-" + required.lower(), "recommended", "PASS" if required in files else "UNKNOWN", required, "presence does not prove content adequacy" if required in files else "not found locally") + if (root / "SECURITY.md").exists(): + record("security-reporting", "conditional", "PASS", "SECURITY.md", "reporting policy exists; verify private route is real") + else: + record("security-reporting", "conditional", "UNKNOWN", "SECURITY.md", "decide based on exposure and reporting needs") + license_files = list((root / "LICENSES").glob("*")) if (root / "LICENSES").exists() else [] + record("full-license-text", "required", "PASS" if license_files else "UNKNOWN", "LICENSES/", "verify canonical license content and SPDX mapping" if license_files else "no REUSE license texts found") + record("reuse-attribution", "recommended", "PASS" if (root / "REUSE.toml").exists() else "UNKNOWN", "REUSE.toml", "run external reuse lint; attribution not proven") + owner = [str(p.relative_to(root)) for p in [root / ".github/CODEOWNERS", root / "CODEOWNERS", root / "docs/CODEOWNERS"] if p.is_file()] + record("effective-codeowners", "conditional", "UNKNOWN", ", ".join(owner), "CODEOWNERS exists but reviewer coverage/remote enforcement must be verified" if owner else "no local CODEOWNERS found; repository review policy needs verification") + test_dirs = [p for p in (root / "tests", root / "test", root / "spec") if p.exists()] + record("unit-tests", "recommended", "UNKNOWN", ", ".join(str(p.relative_to(root)) for p in test_dirs), "tests found but execution/assertion quality unknown" if test_dirs else "tests directory not found; investigate language conventions") + + workflows_dir = root / ".github/workflows" + workflows = sorted([p for p in workflows_dir.glob("*.yml") if p.is_file()] + [p for p in workflows_dir.glob("*.yaml") if p.is_file()]) if workflows_dir.is_dir() else [] + if not workflows: + record("ci-producer", "conditional", "UNKNOWN", ".github/workflows/", "no local GitHub Actions producer found; verify externally required workflows and PR checks") + else: + for wf in workflows: + f.extend(inspect_workflow(wf, root)) + record("ci-producer", "conditional", "UNKNOWN", ".github/workflows/", f"{len(workflows)} local workflow(s); execution, mandatory status and scoped permissions unverified") + record("remote-governance", "required", "UNKNOWN", "GitHub rulesets/checks", "remote branch protection, DCO, CODEOWNERS approval, signatures and check SHA require GitHub inspection") + record("ci-required-integrity", "conditional", "UNKNOWN", "GitHub check suites", "if ci-required is enabled, test required job coverage, failure, cancellation, skip, rerun and SHA; never assume aggregate correctness") + record("dependency-supply-chain", "conditional", "UNKNOWN", "package manifests and CI", "locked installation and vulnerability scans not run by read-only auditor") + record("runtime-verification", "required", "UNKNOWN", "test/analysis commands", "execute language-native checks and record exit codes separately") + return {"project": str(root), "languages": language, "certification": "NOT_CERTIFIED", "findings": [asdict(x) for x in f], "summary": {status: sum(x.status == status for x in f) for status in ("PASS", "FAIL", "UNKNOWN")}} + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("project", type=Path) + parser.add_argument("--strict", action="store_true", help="nonzero if definite local policy violations were detected") + args = parser.parse_args() + try: + report = evaluate(args.project.expanduser().resolve()) + except (ValueError, OSError) as e: + parser.error(str(e)) + print(json.dumps(report, indent=2)) + return int(args.strict and report["summary"]["FAIL"] > 0) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/skills/librecode-project-bootstrap/scripts/bootstrap.py b/skills/librecode-project-bootstrap/scripts/bootstrap.py new file mode 100755 index 0000000..a384e10 --- /dev/null +++ b/skills/librecode-project-bootstrap/scripts/bootstrap.py @@ -0,0 +1,332 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2026 LibreCode Coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +"""Conservative, dependency-free CLI starter for LibreCode engineering experiments. + +This is intentionally not a replacement for project-specific architecture, +CI installation, dependency audit, or meaningful production tests. +""" + +from __future__ import annotations + +import argparse +import json +import re +from pathlib import Path +from datetime import date + +YEAR = date.today().year + +HERE = Path(__file__).resolve().parent.parent +NAME_RE = re.compile(r"^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$") +SPDX_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9.+-]*$") +RUNTIME_RE = re.compile(r"^[0-9]+(?:\.[0-9]+){0,2}$") +LANGUAGES = ("php", "python", "javascript", "go") + + +def source_header(language: str, copyright_holder: str, license_id: str) -> str: + prefix = "//" if language in {"php", "javascript", "go"} else "#" + return ( + f"{prefix} SPDX-FileCopyrightText: {YEAR} {copyright_holder}\n" + f"{prefix} SPDX-License-Identifier: {license_id}\n" + ) + + +def markdown_header(owner: str, license_id: str) -> str: + return ( + f"\n" + f"\n\n" + ) + + +def generic_files(name: str, language: str, runtime: str, license_id: str, owner: str) -> dict[str, str]: + text = markdown_header(owner, license_id) + root = { + "README.md": ( + text + f"# {name}\n\nMinimal {language} CLI starter. Replace the sample CLI " + "contract with real project behavior before a production release.\n\n" + f"Runtime: {language} {runtime}. Distribution: source.\n\n" + "## Verification\n\nSee the language-native test and syntax commands reported by " + "the bootstrap tool. Do not claim a complete quality gate until static analysis, " + "CI, dependency/security audits and relevant integration tests have run.\n\n" + f"## License\n\n{license_id}. See `LICENSES/`.\n" + ), + "CONTRIBUTING.md": ( + text + "# Contributing\n\nUse focused pull requests and conventional commit subjects. " + "Add DCO `Signed-off-by` trailers to commits. Run the project's verification " + "commands and report status and unresolved checks. Cryptographic signing " + "and review policies must follow the repository's current governance.\n" + ), + ".gitignore": source_header("python", owner, license_id), + } + return root + + +def python_files(name: str, runtime: str, owner: str, license_id: str) -> tuple[dict[str, str], list[str]]: + module = name.replace("-", "_") + header = source_header("python", owner, license_id) + files = { + f"src/{module}/__init__.py": header + '__version__ = "0.1.0"\n', + f"src/{module}/__main__.py": ( + header + "from .cli import main\n\nif __name__ == \"__main__\":\n raise SystemExit(main())\n" + ), + f"src/{module}/cli.py": ( + header + "import argparse\n\nfrom . import __version__\n\n\n" + "def main(args: list[str] | None = None) -> int:\n" + f" parser = argparse.ArgumentParser(prog={name!r})\n" + " parser.add_argument(\"--version\", action=\"store_true\")\n" + " options = parser.parse_args(args)\n" + " if options.version:\n" + f" print({name!r} + \" \" + __version__)\n" + " else:\n parser.print_help()\n" + " return 0\n" + ), + "tests/test_cli.py": ( + header + "import contextlib\nimport io\nimport sys\nimport unittest\n" + "from pathlib import Path\n\n" + "sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'src'))\n" + f"from {module}.cli import main\n\n\n" + "class CliTest(unittest.TestCase):\n" + " def test_version_output(self):\n" + " output = io.StringIO()\n" + " with contextlib.redirect_stdout(output):\n" + " self.assertEqual(main(['--version']), 0)\n" + f" self.assertEqual(output.getvalue(), {name!r} + ' 0.1.0\\n')\n\n" + " def test_rejects_unknown_argument(self):\n" + " with contextlib.redirect_stderr(io.StringIO()):\n" + " with self.assertRaises(SystemExit) as result:\n" + " main(['--invalid'])\n" + " self.assertEqual(result.exception.code, 2)\n" + ), + "pyproject.toml": ( + source_header("python", owner, license_id) + + "[build-system]\nrequires = ['setuptools>=75,<81']\n" + "build-backend = 'setuptools.build_meta'\n\n[project]\n" + f"name = {name!r}\nversion = '0.1.0'\n" + f"requires-python = '>={runtime}'\nlicense = {license_id!r}\n" + "dependencies = []\n\n[tool.setuptools.packages.find]\nwhere = ['src']\n" + ), + } + files[".gitignore"] = header + "__pycache__/\n.venv/\ndist/\n*.egg-info/\n" + return files, ["python3 -m compileall -q src tests", "python3 -m unittest discover -s tests -v"] + + +def php_files(name: str, runtime: str, owner: str, license_id: str) -> tuple[dict[str, str], list[str]]: + namespace = "LibreCode\\" + "".join(s.capitalize() for s in re.split(r"[-_]", name)) + header = source_header("php", owner, license_id) + open_php = "isFile() || $file->getExtension() !== 'php') {\n" + " continue;\n }\n" + " $cmd = escapeshellarg(PHP_BINARY) . ' -l ' . escapeshellarg($file->getPathname());\n" + " exec($cmd, $output, $status);\n" + " if ($status !== 0) {\n" + " fwrite(STDERR, implode(PHP_EOL, $output) . PHP_EOL);\n" + " exit($status);\n }\n" + " $output = [];\n }\n}\n" + "echo 'PHP syntax checks passed' . PHP_EOL;\n" + ), + "composer.json": json.dumps( + { + "name": "librecode/" + name, + "description": "Minimal CLI bootstrap; replace before release", + "type": "project", + "license": license_id, + "require": {"php": ">=" + runtime}, + "autoload": {"psr-4": {namespace + "\\": "src/"}}, + "scripts": { + "lint": "@php tools/lint.php", + "test": "@php tests/run.php", + "check": ["@lint", "@test"], + }, + "config": {"sort-packages": True}, + }, indent=2, + ) + "\n", + } + files[".gitignore"] = source_header("python", owner, license_id) + "/vendor/\n/build/\n" + return files, ["php tools/lint.php", "php tests/run.php"] + + +def javascript_files(name: str, runtime: str, owner: str, license_id: str) -> tuple[dict[str, str], list[str]]: + header = source_header("javascript", owner, license_id) + files = { + "src/cli.js": ( + header + "export function main(args = process.argv.slice(2), output = console.log) {\n" + " if (args.length === 1 && args[0] === '--version') {\n" + f" output('{name} 0.1.0');\n return 0;\n }}\n" + " if (args.length !== 0) return 2;\n" + f" output('Usage: {name} [--version]');\n return 0;\n}}\n" + ), + "tests/cli.test.js": ( + header + "import test from 'node:test';\nimport assert from 'node:assert/strict';\n" + "import { main } from '../src/cli.js';\n\n" + "test('version', () => {\n const output = [];\n" + " assert.equal(main(['--version'], (x) => output.push(x)), 0);\n" + f" assert.deepEqual(output, ['{name} 0.1.0']);\n}});\n" + "test('rejects unexpected arguments', () => assert.equal(main(['--invalid']), 2));\n" + ), + "package.json": json.dumps( + {"name": name, "version": "0.1.0", "private": True, "type": "module", + "license": license_id, "engines": {"node": ">=" + runtime}, + "scripts": {"lint:syntax": "node --check src/cli.js", "test": "node --test"}}, + indent=2, + ) + "\n", + } + files[".gitignore"] = source_header("python", owner, license_id) + "/node_modules/\n/coverage/\n" + return files, ["node --check src/cli.js", "node --test"] + + +def go_files(name: str, runtime: str, owner: str, license_id: str, module: str) -> tuple[dict[str, str], list[str]]: + header = source_header("go", owner, license_id) + files = { + "go.mod": header + f"module {module}\n\ngo {runtime}\n", + "main.go": ( + header + "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\n" + "func run(args []string) int {\n" + f"\tif len(args) == 1 && args[0] == \"--version\" {{\n\t\tfmt.Println(\"{name} 0.1.0\")\n\t\treturn 0\n\t}}\n" + "\tif len(args) != 0 {\n\t\treturn 2\n\t}\n" + f"\tfmt.Println(\"Usage: {name} [--version]\")\n\treturn 0\n}}\n\n" + "func main() { os.Exit(run(os.Args[1:])) }\n" + ), + "main_test.go": ( + header + "package main\n\nimport \"testing\"\n\n" + "func TestVersion(t *testing.T) { if run([]string{\"--version\"}) != 0 { t.Fatal(\"version\") } }\n" + "func TestUnexpectedArgs(t *testing.T) { if run([]string{\"--bad\"}) != 2 { t.Fatal(\"negative\") } }\n" + ), + } + files[".gitignore"] = source_header("python", owner, license_id) + "/bin/\n" + return files, ["gofmt -l .", "go vet ./...", "go test ./..."] + + +def create(args: argparse.Namespace) -> dict[str, object]: + name, language, license_id, owner, runtime = args.name, args.language, args.license, args.copyright, args.runtime + if not NAME_RE.fullmatch(name): + raise ValueError("name must be lowercase kebab-case or snake_case and start with a letter") + if not SPDX_RE.fullmatch(license_id): + raise ValueError("invalid SPDX identifier syntax") + if not RUNTIME_RE.fullmatch(runtime): + raise ValueError("runtime must be a numeric version such as 8.3, 3.12, 22 or 1.24") + if not owner.strip() or "\n" in owner or "\r" in owner: + raise ValueError("--copyright must identify the project's actual copyright holder") + if args.kind != "cli" or args.distribution not in {"source", "package"}: + raise ValueError("the deterministic helper covers CLI/source or CLI/package only; handle other types interactively") + destination = args.destination.expanduser().absolute() + if destination.is_symlink() or (destination.exists() and any(destination.iterdir())): + raise FileExistsError(f"refusing to overwrite existing files: {destination}") + if destination.exists() and not destination.is_dir(): + raise ValueError(f"destination is not a directory: {destination}") + if license_id == "MIT" and args.license_file is None: + license_text = (HERE / "assets/MIT.txt").read_text(encoding="utf-8").replace( + "Copyright (c) 2026 LibreCode Coop and contributors", + f"Copyright (c) {YEAR} {owner}", + ) + elif args.license_file is not None: + license_text = args.license_file.read_text(encoding="utf-8") + if len(license_text.strip()) < 100: + raise ValueError("provided license text looks incomplete") + else: + raise ValueError("provide --license-file containing the canonical full license text for non-MIT licenses") + code = {"python": python_files, "php": php_files, "javascript": javascript_files} + if language == "go": + if not args.module or not re.fullmatch(r"[a-zA-Z0-9.-]+(?:/[a-zA-Z0-9._-]+)+", args.module): + raise ValueError("Go projects require --module with the real module path") + lang_files, commands = go_files(name, runtime, owner, license_id, args.module) + else: + lang_files, commands = code[language](name, runtime, owner, license_id) + files = generic_files(name, language, runtime, license_id, owner) | lang_files + files["README.md"] = ( + files["README.md"].replace("Distribution: source.", f"Distribution: {args.distribution}.") + + "\n## Working local commands\n\n```sh\n" + + "\n".join(commands) + "\n```\n" + ) + files[f"LICENSES/{license_id}.txt"] = license_text + json_like = [p for p in files if p.endswith(".json")] + reuse_paths = sorted(json_like + [f"LICENSES/{license_id}.txt"]) + files["REUSE.toml"] = ( + f"# SPDX-FileCopyrightText: {YEAR} {owner}\n# SPDX-License-Identifier: {license_id}\n" + "version = 1\n\n[[annotations]]\n" + + "path = [" + ", ".join(json.dumps(p) for p in reuse_paths) + "]\n" + 'precedence = "aggregate"\n' + + "SPDX-FileCopyrightText = " + json.dumps(f"{YEAR} {owner}") + "\n" + + "SPDX-License-Identifier = " + json.dumps(license_id) + "\n" + ) + for p in files: + relative = Path(p) + if relative.is_absolute() or ".." in relative.parts: + raise ValueError("generated path escapes destination") + destination.mkdir(parents=True, exist_ok=True) + for name, content in sorted(files.items()): + target = destination / name + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(content, encoding="utf-8") + return { + "destination": str(destination), "language": language, "runtime": runtime, + "license": license_id, "files": sorted(files), "commands": commands, + "pending": [ + "project-specific static analysis/formatter not yet installed or exercised", + "project-specific integration/security/coverage checks not yet defined", + "REUSE external lint, vulnerability scanning and license review not yet executed", + "GitHub CI templates, branch ruleset and CODEOWNERS not yet verified", + "source-to-release packaging/release authorization not yet verified", + ], + "conformance": "NOT_CERTIFIED", + } + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--name", required=True) + parser.add_argument("--language", required=True, choices=LANGUAGES) + parser.add_argument("--runtime", required=True) + parser.add_argument("--kind", default="cli") + parser.add_argument("--license", required=True) + parser.add_argument("--license-file", type=Path) + parser.add_argument("--copyright", required=True) + parser.add_argument("--module", help="actual Go module path; mandatory for Go") + parser.add_argument("--distribution", default="source") + parser.add_argument("--destination", type=Path, required=True) + args = parser.parse_args() + try: + result = create(args) + except (ValueError, OSError) as exc: + parser.error(str(exc)) + print(json.dumps(result, indent=2)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/skills/librecode-project-bootstrap/scripts/check_ci_results.py b/skills/librecode-project-bootstrap/scripts/check_ci_results.py new file mode 100755 index 0000000..3f13a95 --- /dev/null +++ b/skills/librecode-project-bootstrap/scripts/check_ci_results.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2026 LibreCode Coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +"""Test a CI aggregate's explicit same-workflow `needs` result manifest. + +Never use this script to declare a real GitHub required context without a +separately validated coordinator and check-run identity/revision contract. +""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path + +KNOWN = {"success", "failure", "cancelled", "skipped", "pending", "in_progress"} + + +def check_results(required: list[str], actual: dict[str, object], allowed_skips: set[str] | None = None) -> list[str]: + if not required or len(required) != len(set(required)): + raise ValueError("required jobs must be a nonempty, unique list") + skips = allowed_skips or set() + if skips - set(required): + raise ValueError("allowed_skips must be a subset of required jobs") + failures = [] + for job in required: + record = actual.get(job) + result = record.get("result") if isinstance(record, dict) else None + if result not in KNOWN: + failures.append(f"{job}: missing or unknown result") + elif result == "success" or (result == "skipped" and job in skips): + continue + else: + failures.append(f"{job}: {result}") + return failures + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--manifest", type=Path, required=True, help="JSON with required, needs and optional allowed_skips") + args = parser.parse_args() + try: + payload = json.loads(args.manifest.read_text(encoding="utf-8")) + failures = check_results(payload["required"], payload["needs"], set(payload.get("allowed_skips", []))) + except (ValueError, KeyError, TypeError, OSError) as e: + parser.error(str(e)) + if failures: + for problem in failures: + print("BLOCKED: " + problem) + return 1 + print("Result manifest is consistent with explicit required jobs (not a remote CI certification).") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/skills/librecode-project-bootstrap/scripts/tests/test_tools.py b/skills/librecode-project-bootstrap/scripts/tests/test_tools.py new file mode 100644 index 0000000..fc398e7 --- /dev/null +++ b/skills/librecode-project-bootstrap/scripts/tests/test_tools.py @@ -0,0 +1,143 @@ +# SPDX-FileCopyrightText: 2026 LibreCode Coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +from __future__ import annotations + +import json +import shutil +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +SCRIPT_DIR = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(SCRIPT_DIR)) +from audit_project import evaluate, inspect_workflow # noqa: E402 +from check_ci_results import check_results # noqa: E402 + + +def run(*args: str, cwd: Path | None = None) -> subprocess.CompletedProcess[str]: + return subprocess.run(args, cwd=cwd, capture_output=True, text=True, check=False, timeout=90) + + +class BootstrapTest(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory(prefix="librecode-bootstrap-test-") + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name) + + def generate(self, language: str, runtime: str, name: str = "demo-project") -> tuple[Path, dict]: + directory = self.root / language + proc = run( + sys.executable, str(SCRIPT_DIR / "bootstrap.py"), + "--name", name, "--language", language, "--runtime", runtime, + "--license", "MIT", "--copyright", "Sample Project contributors", + "--kind", "cli", "--distribution", "source", "--destination", str(directory), + *( ["--module", "example.org/" + name] if language == "go" else [] ), + ) + self.assertEqual(proc.returncode, 0, proc.stderr) + return directory, json.loads(proc.stdout) + + def test_python_cli_and_negative_test(self): + project, summary = self.generate("python", "3.11") + self.assertEqual(summary["conformance"], "NOT_CERTIFIED") + import tomllib + self.assertEqual(tomllib.loads((project / "pyproject.toml").read_text())["project"]["license"], "MIT") + self.assertEqual(run(sys.executable, "-m", "compileall", "-q", "src", "tests", cwd=project).returncode, 0) + tests = run(sys.executable, "-m", "unittest", "discover", "-s", "tests", "-v", cwd=project) + self.assertEqual(tests.returncode, 0, tests.stderr) + self.assertIn("test_rejects_unknown_argument", tests.stderr) + self.assertFalse((project / "Dockerfile").exists()) + self.assertEqual(evaluate(project)["summary"]["FAIL"], 0) + + @unittest.skipUnless(shutil.which("php"), "PHP is not installed") + def test_php_cli_and_negative_test(self): + project, summary = self.generate("php", "8.2") + self.assertTrue((project / "composer.json").is_file()) + self.assertEqual(json.loads((project / "composer.json").read_text())["license"], "MIT") + lint = run("php", "tools/lint.php", cwd=project) + self.assertEqual(lint.returncode, 0, lint.stdout + lint.stderr) + tests = run("php", "tests/run.php", cwd=project) + self.assertEqual(tests.returncode, 0, tests.stdout + tests.stderr) + self.assertIn("2 PHP CLI assertions passed", tests.stdout) + self.assertIn("php tests/run.php", summary["commands"]) + self.assertFalse((project / "docker-compose.yml").exists()) + self.assertEqual(evaluate(project)["summary"]["FAIL"], 0) + + @unittest.skipUnless(shutil.which("node"), "Node is not installed") + def test_node_cli(self): + project, _ = self.generate("javascript", "22") + self.assertEqual(run("node", "--check", "src/cli.js", cwd=project).returncode, 0) + tests = run("node", "--test", cwd=project) + self.assertEqual(tests.returncode, 0, tests.stdout + tests.stderr) + + @unittest.skipUnless(shutil.which("go"), "Go is not installed") + def test_go_cli(self): + project, _ = self.generate("go", "1.23") + self.assertEqual(run("go", "vet", "./...", cwd=project).returncode, 0) + tests = run("go", "test", "./...", cwd=project) + self.assertEqual(tests.returncode, 0, tests.stdout + tests.stderr) + + def test_refuses_to_overwrite_existing_files(self): + project = self.root / "existing" + project.mkdir() + (project / "README.md").write_text("keep", encoding="utf-8") + proc = run(sys.executable, str(SCRIPT_DIR / "bootstrap.py"), + "--name", "demo", "--language", "python", "--runtime", "3.12", + "--license", "MIT", "--copyright", "Sample Project", + "--destination", str(project)) + self.assertNotEqual(proc.returncode, 0) + self.assertEqual((project / "README.md").read_text(), "keep") + + def test_does_not_infer_non_mit_license_text(self): + proc = run(sys.executable, str(SCRIPT_DIR / "bootstrap.py"), + "--name", "demo", "--language", "python", "--runtime", "3.12", + "--license", "AGPL-3.0-or-later", "--copyright", "Sample Project", + "--destination", str(self.root / "missing-license")) + self.assertNotEqual(proc.returncode, 0) + self.assertIn("--license-file", proc.stderr) + self.assertFalse((self.root / "missing-license").exists()) + + +class AuditTest(unittest.TestCase): + def test_detects_unsafe_workflow(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + path = root / "ci.yml" + path.write_text("name: Test\npermissions: write-all\nsteps:\n - uses: actions/checkout@v4\n", encoding="utf-8") + observations = inspect_workflow(path, root) + self.assertEqual(len([a for a in observations if a.status == "FAIL"]), 2) + self.assertIn("workflow-immutable-uses", [a.id for a in observations]) + + def test_accepts_pinned_action_with_credential_hardening(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + path = root / "ci.yml" + path.write_text("steps:\n - uses: actions/checkout@" + "a" * 40 + + " # v7.0.1\n with:\n persist-credentials: false\n", encoding="utf-8") + self.assertEqual(inspect_workflow(path, root), []) + + +class AggregateContractTest(unittest.TestCase): + def test_passing_required_jobs(self): + self.assertEqual(check_results(["build", "unit"], {"build": {"result": "success"}, "unit": {"result": "success"}}), []) + + def test_failure_cancellation_skip_and_missing_block(self): + for value in ["failure", "cancelled", "skipped", "pending", "in_progress"]: + with self.subTest(result=value): + self.assertTrue(check_results(["unit"], {"unit": {"result": value}})) + self.assertTrue(check_results(["unit"], {})) + self.assertTrue(check_results(["unit"], {"unit": {"result": "garbage"}})) + + def test_only_explicitly_allowed_skips_are_accepted(self): + actual = {"unit": {"result": "success"}, "optional-platform": {"result": "skipped"}} + self.assertEqual(check_results(["unit", "optional-platform"], actual, {"optional-platform"}), []) + self.assertTrue(check_results(["unit", "optional-platform"], actual)) + + def test_duplicate_required_jobs_rejected(self): + with self.assertRaises(ValueError): + check_results(["unit", "unit"], {"unit": {"result": "success"}}) + + +if __name__ == "__main__": + unittest.main() From 0d8eb76f0ee0ef9b095c38a7279cf115fadcc105 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:14:59 +0000 Subject: [PATCH 2/3] ci(skills): exercise bootstrap contracts in organization tests Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/tests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f21be76..6c3075b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,15 @@ jobs: - name: Run unit tests run: python3 -m unittest discover -s tests -p 'test_*.py' + - name: Verify bootstrap sample runtimes are installed + run: | + command -v php + command -v node + command -v go + + - name: Exercise project bootstrap skill and generated samples + run: python3 -m unittest discover -s skills/librecode-project-bootstrap/scripts/tests -p 'test_*.py' + - name: Verify vendored upstream sources run: python3 scripts/sync_upstream.py check upstream/sources.json From eda7b90a6cbfe7a721e04825e8120457dade9c23 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:32:38 +0000 Subject: [PATCH 3/3] fix(skills): default new LibreCode projects to AGPL-3.0-or-later Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- skills/librecode-project-bootstrap/SKILL.md | 2 +- .../assets/AGPL-3.0-or-later.txt | 661 ++++++++++++++++++ .../references/documentation.md | 4 +- .../references/evidence-ledger.md | 2 +- .../references/institutional-standards.md | 2 +- .../references/language-profiles.md | 2 +- .../scripts/bootstrap.py | 41 +- .../scripts/tests/test_tools.py | 48 +- 8 files changed, 738 insertions(+), 24 deletions(-) create mode 100644 skills/librecode-project-bootstrap/assets/AGPL-3.0-or-later.txt diff --git a/skills/librecode-project-bootstrap/SKILL.md b/skills/librecode-project-bootstrap/SKILL.md index 4c14001..240ef02 100644 --- a/skills/librecode-project-bootstrap/SKILL.md +++ b/skills/librecode-project-bootstrap/SKILL.md @@ -12,7 +12,7 @@ Operate in **create** or **audit** mode. The skill is an engineering workflow, n ## Intake and scope -Record project name, purpose, owner/reviewers, programming language, supported runtime versions, application type (library, CLI, service, plugin, container or other), distribution channel, intended environment, license/SPDX identifier, and repository visibility. Identify data sensitivity, authentication, multi-tenant and migration boundaries. Request missing decisions that block safe execution; **never infer the license, production credentials, or a release policy**. Prefer a minimally viable project and avoid adding optional infrastructure. +Record project name, purpose, owner/reviewers, programming language, supported runtime versions, application type (library, CLI, service, plugin, container or other), distribution channel, intended environment, license/SPDX identifier (default **AGPL-3.0-or-later** for new LibreCode-owned projects), and repository visibility. Identify data sensitivity, authentication, multi-tenant and migration boundaries. Apply the LibreCode AGPL default unless another license is explicitly selected and its rationale/compatibility reviewed; never silently relicense existing projects. Request missing decisions that block safe execution; **never infer production credentials or a release policy**. Prefer a minimally viable project and avoid adding optional infrastructure. Read [institutional-standards.md](references/institutional-standards.md) to distinguish institutionally defined policy, repeated conventions, and product-specific requirements. Refresh against the live `LibreCodeCoop/.github` repository when connected: its configuration is authoritative over this dated evidence snapshot. Read [evidence-ledger.md](references/evidence-ledger.md) before claiming organization-wide adoption. diff --git a/skills/librecode-project-bootstrap/assets/AGPL-3.0-or-later.txt b/skills/librecode-project-bootstrap/assets/AGPL-3.0-or-later.txt new file mode 100644 index 0000000..be3f7b2 --- /dev/null +++ b/skills/librecode-project-bootstrap/assets/AGPL-3.0-or-later.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/skills/librecode-project-bootstrap/references/documentation.md b/skills/librecode-project-bootstrap/references/documentation.md index 741a0b0..768f64a 100644 --- a/skills/librecode-project-bootstrap/references/documentation.md +++ b/skills/librecode-project-bootstrap/references/documentation.md @@ -19,10 +19,10 @@ Generate only material needed for the project's distribution and operating model ## Licensing decisions -- Ask for an SPDX license identifier. Do **not** default every new project to AGPL, although the inspected LibreCode PHP projects use it. +- For new LibreCode-owned projects, default to **AGPL-3.0-or-later**, consistently with the institutionally stated policy and observed licensing. An explicitly requested different SPDX license remains possible after recording the rationale, rights-holder approval and dependency/distribution compatibility. Do not silently relicense an existing project or claim this preference is an enforced GitHub ruleset. - Verify legal compatibility of dependency licenses, assets and distribution method. Do not invent a new license from a short SPDX string. - For code/text supporting comments use `SPDX-FileCopyrightText` and `SPDX-License-Identifier`; for JSON/binary files supply `REUSE.toml` annotations or `.license` files. Keep complete canonical license texts in `LICENSES/`. Validate with `reuse lint`, not mere existence checks. -- Existing `LibreCodeCoop/.github` content is licensed AGPL-3.0-or-later; introducing a Skill in that repository should follow its source file notices. Consumer output uses the explicitly selected project license, which can differ. +- Existing `LibreCodeCoop/.github` content is licensed AGPL-3.0-or-later; the Skill source follows the same notices. New LibreCode consumer output uses AGPL-3.0-or-later by default and a different license only when deliberately selected and reviewed. Preserve existing licenses in audit mode. ## Avoid ephemeral noise diff --git a/skills/librecode-project-bootstrap/references/evidence-ledger.md b/skills/librecode-project-bootstrap/references/evidence-ledger.md index 7de8e90..beaa204 100644 --- a/skills/librecode-project-bootstrap/references/evidence-ledger.md +++ b/skills/librecode-project-bootstrap/references/evidence-ledger.md @@ -21,5 +21,5 @@ This is an **observed sample**, not a certification of organization-wide rollout | Frontend e2e/runtime matrices | [profile_fields package.json](https://github.com/LibreCodeCoop/profile_fields/blob/main/package.json), [workflows](https://github.com/LibreCodeCoop/profile_fields/tree/main/.github/workflows) | Vitest, Playwright, TypeScript, Psalm | Nextcloud-only dependency/tool versions are conditional | | Shell/container regression | [nextcloud-docker Makefile](https://github.com/LibreCodeCoop/nextcloud-docker/blob/main/Makefile), [Docker workflow](https://github.com/LibreCodeCoop/nextcloud-docker/blob/main/.github/workflows/docker-image.yml), [PR #85](https://github.com/LibreCodeCoop/nextcloud-docker/pull/85) | Bats suites and image security tests, pinned Actions | Do not create Docker for plain libraries | | Stable branches and controlled release | [release architecture](https://github.com/LibreCodeCoop/.github/blob/main/docs/release-workflow-architecture.md), [LibreSign PR #9321](https://github.com/LibreSign/libresign/pull/9321) | Pinned checked-out ref and independent integration verification | Only projects with supported version branches need backport/release graph | -| Licensing and SPDX | [REUSE template](https://github.com/LibreCodeCoop/.github/blob/main/workflow-templates/reuse.yml), [suitecrm-mcp REUSE.toml](https://github.com/LibreCodeCoop/suitecrm-mcp/blob/main/REUSE.toml) | Repeated SPDX/REUSE conventions and checks | No evidence AGPL universally mandated; select license explicitly | +| Licensing and SPDX | [REUSE template](https://github.com/LibreCodeCoop/.github/blob/main/workflow-templates/reuse.yml), [suitecrm-mcp REUSE.toml](https://github.com/LibreCodeCoop/suitecrm-mcp/blob/main/REUSE.toml), [.github canonical AGPL LICENSE](https://github.com/LibreCodeCoop/.github/blob/main/LICENSE) | Organization maintainer confirmed AGPL-3.0-or-later as default for new LibreCode projects on 2026-11-03; repeated AGPL manifests and SPDX/REUSE checks | This is a preferred creation default, not evidence of active GitHub license enforcement or a universal ban on approved licensing exceptions | | CODEOWNERS | [.github owners](https://github.com/LibreCodeCoop/.github/blob/main/.github/CODEOWNERS), [profile_fields owners](https://github.com/LibreCodeCoop/profile_fields/blob/main/.github/CODEOWNERS) | Present in two, limited mapping in profile_fields | Requested `.github/CODEOWNERS` paths absent in sampled suitecrm-mcp and akaunting-mcp; review effective settings | diff --git a/skills/librecode-project-bootstrap/references/institutional-standards.md b/skills/librecode-project-bootstrap/references/institutional-standards.md index bc09d36..d5e5be4 100644 --- a/skills/librecode-project-bootstrap/references/institutional-standards.md +++ b/skills/librecode-project-bootstrap/references/institutional-standards.md @@ -20,7 +20,7 @@ Definitions: **Required** = explicit applicable governance rule or release/PR co | Dependency locking, reproducible install and audit | Conditional to language/dependencies, strongly recommended | Composer locks in MCPs, npm lock in profile_fields, Composer audit workflows | Reproduce locked installation and run native audit when applicable | | Immutable container inputs, runtime smoke, secrets separation | Conditional to container/distribution | `suitecrm-mcp` Docker smoke; `nextcloud-docker` Bats and pinned digest management | Build + actual smoke, persistence verification, least privilege, image scan | | REUSE/SPDX identifiers and complete license text | Required for repos using REUSE policy; proposed default for new repos | REUSE action catalog template, REUSE.toml/LICENSES in PHP repos | `reuse lint` with matching license files; manual licensing review | -| Project-specific license chosen explicitly | Required input, **not** universal AGPL | Observed project licenses include AGPL; no organization rule was found mandating it for all projects | SPDX value matches manifests, file headers, LICENSES and distribution | +| AGPL-3.0-or-later as default license for new LibreCode-owned projects | Institutional default (stated by maintainer; not proven enforced via GitHub ruleset), **not** a universal ban on exceptions | Organization maintainer explicitly confirmed AGPL default on 2026-11-03; sampled LibreCode projects and `.github` use AGPL. No declarative licensing rule was observed | On create: use AGPL by default with complete canonical text; if explicitly changed, record licensing decision and compatibility review. On audit: never silently relicense existing work | | README and contribution/security reporting | Recommended, conditional depth | Repeated MCP/NFSe root docs; repo-specific SECURITY policies | Document actual setup, disclosure route, operational boundaries; test examples | | Secrets and public release scope scanning | Conditional to public/distributed/sensitive repos; recommended | `akaunting-mcp` secret & source scope workflows | Scan tree and history where appropriate; synthetic fixtures, no production data | | Release/tag/stable branch workflow | Conditional to distribution and support matrix | `.github/docs/release-workflow-architecture.md`, Nextcloud app templates | Package validated exact checked-out ref; explicit publish authorization | diff --git a/skills/librecode-project-bootstrap/references/language-profiles.md b/skills/librecode-project-bootstrap/references/language-profiles.md index 1d7b237..89d2ded 100644 --- a/skills/librecode-project-bootstrap/references/language-profiles.md +++ b/skills/librecode-project-bootstrap/references/language-profiles.md @@ -26,6 +26,6 @@ All commands are **candidates**: select a compatible current toolchain, install ## Local bootstrap helper -`python3 scripts/bootstrap.py --name demo --language python --runtime 3.12 --kind cli --license MIT --distribution source --destination /tmp/demo` +`python3 scripts/bootstrap.py --name demo --language python --runtime 3.12 --kind cli --distribution source --copyright "LibreCode Coop and contributors" --destination /tmp/demo` (defaults to AGPL-3.0-or-later; use `--license MIT` only for a deliberate, documented exception) Supported deterministic minimal CLI stubs: `php`, `python`, `javascript`, `go`; for `typescript` and specialized application types, the Skill must assemble a proper package manifest/test/build via normal engineering work rather than emit an untested incomplete project. Every generated CLI has functional success and negative-argument tests; no production database or deployment infrastructure is added. Report missing third-party lint/static/toolchain checks explicitly until installed and run. diff --git a/skills/librecode-project-bootstrap/scripts/bootstrap.py b/skills/librecode-project-bootstrap/scripts/bootstrap.py index a384e10..b7c4527 100755 --- a/skills/librecode-project-bootstrap/scripts/bootstrap.py +++ b/skills/librecode-project-bootstrap/scripts/bootstrap.py @@ -12,6 +12,7 @@ import argparse import json import re +import sys from pathlib import Path from datetime import date @@ -249,7 +250,13 @@ def create(args: argparse.Namespace) -> dict[str, object]: raise FileExistsError(f"refusing to overwrite existing files: {destination}") if destination.exists() and not destination.is_dir(): raise ValueError(f"destination is not a directory: {destination}") - if license_id == "MIT" and args.license_file is None: + if license_id == "AGPL-3.0-or-later": + if args.license_file is not None: + raise ValueError("--license-file cannot replace the bundled canonical AGPL license") + license_text = (HERE / "assets/AGPL-3.0-or-later.txt").read_text(encoding="utf-8") + elif license_id == "MIT": + if args.license_file is not None: + raise ValueError("--license-file cannot replace the bundled MIT license") license_text = (HERE / "assets/MIT.txt").read_text(encoding="utf-8").replace( "Copyright (c) 2026 LibreCode Coop and contributors", f"Copyright (c) {YEAR} {owner}", @@ -259,7 +266,7 @@ def create(args: argparse.Namespace) -> dict[str, object]: if len(license_text.strip()) < 100: raise ValueError("provided license text looks incomplete") else: - raise ValueError("provide --license-file containing the canonical full license text for non-MIT licenses") + raise ValueError("provide --license-file containing the canonical full license text for this alternative license") code = {"python": python_files, "php": php_files, "javascript": javascript_files} if language == "go": if not args.module or not re.fullmatch(r"[a-zA-Z0-9.-]+(?:/[a-zA-Z0-9._-]+)+", args.module): @@ -274,16 +281,21 @@ def create(args: argparse.Namespace) -> dict[str, object]: + "\n".join(commands) + "\n```\n" ) files[f"LICENSES/{license_id}.txt"] = license_text - json_like = [p for p in files if p.endswith(".json")] - reuse_paths = sorted(json_like + [f"LICENSES/{license_id}.txt"]) + # REUSE recognizes LICENSES/ by convention: its texts retain their own authorship. + # Only JSON manifests need explicit annotations because JSON has no comment syntax. + json_manifests = sorted(p for p in files if p.endswith(".json")) files["REUSE.toml"] = ( f"# SPDX-FileCopyrightText: {YEAR} {owner}\n# SPDX-License-Identifier: {license_id}\n" - "version = 1\n\n[[annotations]]\n" - + "path = [" + ", ".join(json.dumps(p) for p in reuse_paths) + "]\n" - 'precedence = "aggregate"\n' - + "SPDX-FileCopyrightText = " + json.dumps(f"{YEAR} {owner}") + "\n" - + "SPDX-License-Identifier = " + json.dumps(license_id) + "\n" + "version = 1\n" ) + if json_manifests: + files["REUSE.toml"] += ( + "\n[[annotations]]\n" + + "path = [" + ", ".join(json.dumps(p) for p in json_manifests) + "]\n" + + 'precedence = "aggregate"\n' + + "SPDX-FileCopyrightText = " + json.dumps(f"{YEAR} {owner}") + "\n" + + "SPDX-License-Identifier = " + json.dumps(license_id) + "\n" + ) for p in files: relative = Path(p) if relative.is_absolute() or ".." in relative.parts: @@ -295,8 +307,11 @@ def create(args: argparse.Namespace) -> dict[str, object]: target.write_text(content, encoding="utf-8") return { "destination": str(destination), "language": language, "runtime": runtime, - "license": license_id, "files": sorted(files), "commands": commands, - "pending": [ + "license": license_id, + "license_selection": "institutional-default" if not args.license_specified else "explicit", + "files": sorted(files), "commands": commands, + "pending": (["Non-default license: document the explicit LibreCode licensing exception and dependency compatibility review"] + if license_id != "AGPL-3.0-or-later" else []) + [ "project-specific static analysis/formatter not yet installed or exercised", "project-specific integration/security/coverage checks not yet defined", "REUSE external lint, vulnerability scanning and license review not yet executed", @@ -313,13 +328,15 @@ def main() -> int: parser.add_argument("--language", required=True, choices=LANGUAGES) parser.add_argument("--runtime", required=True) parser.add_argument("--kind", default="cli") - parser.add_argument("--license", required=True) + parser.add_argument("--license", default="AGPL-3.0-or-later", + help="SPDX license ID (LibreCode default: AGPL-3.0-or-later; alternatives require explicit review)") parser.add_argument("--license-file", type=Path) parser.add_argument("--copyright", required=True) parser.add_argument("--module", help="actual Go module path; mandatory for Go") parser.add_argument("--distribution", default="source") parser.add_argument("--destination", type=Path, required=True) args = parser.parse_args() + args.license_specified = any(arg == "--license" or arg.startswith("--license=") for arg in sys.argv[1:]) try: result = create(args) except (ValueError, OSError) as exc: diff --git a/skills/librecode-project-bootstrap/scripts/tests/test_tools.py b/skills/librecode-project-bootstrap/scripts/tests/test_tools.py index fc398e7..ba5a4c4 100644 --- a/skills/librecode-project-bootstrap/scripts/tests/test_tools.py +++ b/skills/librecode-project-bootstrap/scripts/tests/test_tools.py @@ -26,12 +26,13 @@ def setUp(self): self.addCleanup(self.temp.cleanup) self.root = Path(self.temp.name) - def generate(self, language: str, runtime: str, name: str = "demo-project") -> tuple[Path, dict]: + def generate(self, language: str, runtime: str, name: str = "demo-project", license_id: str | None = None) -> tuple[Path, dict]: directory = self.root / language proc = run( sys.executable, str(SCRIPT_DIR / "bootstrap.py"), "--name", name, "--language", language, "--runtime", runtime, - "--license", "MIT", "--copyright", "Sample Project contributors", + *(["--license", license_id] if license_id else []), + "--copyright", "Sample Project contributors", "--kind", "cli", "--distribution", "source", "--destination", str(directory), *( ["--module", "example.org/" + name] if language == "go" else [] ), ) @@ -42,19 +43,24 @@ def test_python_cli_and_negative_test(self): project, summary = self.generate("python", "3.11") self.assertEqual(summary["conformance"], "NOT_CERTIFIED") import tomllib - self.assertEqual(tomllib.loads((project / "pyproject.toml").read_text())["project"]["license"], "MIT") + self.assertEqual(tomllib.loads((project / "pyproject.toml").read_text())["project"]["license"], "AGPL-3.0-or-later") + self.assertEqual(summary["license_selection"], "institutional-default") + self.assertEqual((project / "LICENSES/AGPL-3.0-or-later.txt").read_text(), + (SCRIPT_DIR.parent / "assets/AGPL-3.0-or-later.txt").read_text()) self.assertEqual(run(sys.executable, "-m", "compileall", "-q", "src", "tests", cwd=project).returncode, 0) tests = run(sys.executable, "-m", "unittest", "discover", "-s", "tests", "-v", cwd=project) self.assertEqual(tests.returncode, 0, tests.stderr) self.assertIn("test_rejects_unknown_argument", tests.stderr) self.assertFalse((project / "Dockerfile").exists()) + self.assertNotIn("LICENSES/AGPL-3.0-or-later.txt", (project / "REUSE.toml").read_text()) self.assertEqual(evaluate(project)["summary"]["FAIL"], 0) @unittest.skipUnless(shutil.which("php"), "PHP is not installed") def test_php_cli_and_negative_test(self): project, summary = self.generate("php", "8.2") self.assertTrue((project / "composer.json").is_file()) - self.assertEqual(json.loads((project / "composer.json").read_text())["license"], "MIT") + self.assertEqual(json.loads((project / "composer.json").read_text())["license"], "AGPL-3.0-or-later") + self.assertIn("SPDX-License-Identifier: AGPL-3.0-or-later", (project / "src/Application.php").read_text()) lint = run("php", "tools/lint.php", cwd=project) self.assertEqual(lint.returncode, 0, lint.stdout + lint.stderr) tests = run("php", "tests/run.php", cwd=project) @@ -67,6 +73,7 @@ def test_php_cli_and_negative_test(self): @unittest.skipUnless(shutil.which("node"), "Node is not installed") def test_node_cli(self): project, _ = self.generate("javascript", "22") + self.assertEqual(json.loads((project / "package.json").read_text())["license"], "AGPL-3.0-or-later") self.assertEqual(run("node", "--check", "src/cli.js", cwd=project).returncode, 0) tests = run("node", "--test", cwd=project) self.assertEqual(tests.returncode, 0, tests.stdout + tests.stderr) @@ -74,6 +81,7 @@ def test_node_cli(self): @unittest.skipUnless(shutil.which("go"), "Go is not installed") def test_go_cli(self): project, _ = self.generate("go", "1.23") + self.assertIn("SPDX-License-Identifier: AGPL-3.0-or-later", (project / "go.mod").read_text()) self.assertEqual(run("go", "vet", "./...", cwd=project).returncode, 0) tests = run("go", "test", "./...", cwd=project) self.assertEqual(tests.returncode, 0, tests.stdout + tests.stderr) @@ -89,15 +97,43 @@ def test_refuses_to_overwrite_existing_files(self): self.assertNotEqual(proc.returncode, 0) self.assertEqual((project / "README.md").read_text(), "keep") - def test_does_not_infer_non_mit_license_text(self): + def test_rejects_missing_text_for_other_license(self): proc = run(sys.executable, str(SCRIPT_DIR / "bootstrap.py"), "--name", "demo", "--language", "python", "--runtime", "3.12", - "--license", "AGPL-3.0-or-later", "--copyright", "Sample Project", + "--license", "Apache-2.0", "--copyright", "Sample Project", "--destination", str(self.root / "missing-license")) self.assertNotEqual(proc.returncode, 0) self.assertIn("--license-file", proc.stderr) self.assertFalse((self.root / "missing-license").exists()) + def test_explicit_mit_is_allowed_but_not_the_default(self): + project, summary = self.generate("python", "3.11", license_id="MIT") + import tomllib + self.assertEqual(tomllib.loads((project / "pyproject.toml").read_text())["project"]["license"], "MIT") + self.assertEqual(summary["license_selection"], "explicit") + self.assertTrue(any("Non-default license" in issue for issue in summary["pending"])) + self.assertTrue((project / "LICENSES/MIT.txt").is_file()) + + def test_equals_style_license_flag_records_explicit_override(self): + project = self.root / "equals-style" + proc = run(sys.executable, str(SCRIPT_DIR / "bootstrap.py"), + "--name", "equals-style", "--language", "python", "--runtime", "3.11", + "--license=MIT", "--copyright", "Sample Project", "--destination", str(project)) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertEqual(json.loads(proc.stdout)["license_selection"], "explicit") + + def test_cannot_override_bundled_agpl_text(self): + project = self.root / "unsafe-license" + custom = self.root / "fake-license.txt" + custom.write_text("INVALID " * 20) + proc = run(sys.executable, str(SCRIPT_DIR / "bootstrap.py"), + "--name", "unsafe-license", "--language", "python", "--runtime", "3.12", + "--license-file", str(custom), "--copyright", "Sample Project", + "--destination", str(project)) + self.assertNotEqual(proc.returncode, 0) + self.assertIn("cannot replace", proc.stderr) + self.assertFalse(project.exists()) + class AuditTest(unittest.TestCase): def test_detects_unsafe_workflow(self):