Skip to content

Commit 7724a73

Browse files
committed
feat: initial repository setup with comprehensive architecture
This commit establishes the foundational structure for bazel-file-ops-component: 🏗️ Repository Structure: - Complete Bazel workspace with MODULE.bazel and bzlmod support - Unified WIT interface with comprehensive operation definitions - Directory structure for TinyGo and Rust implementations - Astro documentation site infrastructure - GitHub Issues tracking implementation phases 🔧 Core Components: - WIT interface supporting both JSON batch and individual operations - Security model with WASM sandboxing and preopen directories - Dual implementation strategy (TinyGo for security, Rust for performance) - Component selection and toolchain integration framework 📚 Documentation: - Comprehensive README with architecture overview - Astro + Starlight documentation site setup - GitHub Issues for systematic implementation tracking - Apache 2.0 license and contribution guidelines 🎯 Implementation Phases: - Phase 1: Repository setup ✅ - Phase 2: TinyGo implementation (Issue #2) - Phase 3: Rust enhancement (Issue #3) - Phase 4: Bazel toolchain integration (Issue #4) - Phase 5: CI/CD and distribution (Issue #5) - Phase 6: rules_wasm_component integration (Issue #6) This architecture provides secure, cross-platform file operations for the entire Bazel ecosystem while maintaining backward compatibility with existing workflows.
0 parents  commit 7724a73

File tree

12 files changed

+1490
-0
lines changed

12 files changed

+1490
-0
lines changed

.bazelrc

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Bazel Configuration for File Operations Component
2+
3+
# Enable bzlmod (Bazel module system)
4+
common --enable_bzlmod
5+
6+
# Build configuration
7+
build --incompatible_strict_action_env
8+
build --host_force_python=PY3
9+
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
10+
11+
# Enable platform-specific toolchain selection
12+
build --incompatible_enable_cc_toolchain_resolution
13+
build --platforms=@platforms//os:linux,@platforms//cpu:x86_64
14+
15+
# WebAssembly specific settings
16+
build:wasm --platforms=@platforms//cpu:wasm32
17+
build:wasm --incompatible_enable_cc_toolchain_resolution
18+
19+
# TinyGo WebAssembly builds
20+
build:tinygo --config=wasm
21+
build:tinygo --define=GOOS=wasip1
22+
build:tinygo --define=GOARCH=wasm
23+
24+
# Rust WebAssembly builds
25+
build:rust-wasm --config=wasm
26+
build:rust-wasm --@rules_rust//rust/settings:experimental_use_cc_common_link=True
27+
28+
# Test configuration
29+
test --test_output=errors
30+
test --test_summary=detailed
31+
test --test_verbose_timeout_warnings
32+
33+
# Coverage configuration
34+
coverage --combined_report=lcov
35+
coverage --coverage_report_generator=@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main
36+
37+
# Documentation builds
38+
build:docs --@aspect_rules_js//js:node_options=--max-old-space-size=8192
39+
40+
# Performance optimizations
41+
build --experimental_reuse_sandbox_directories
42+
build --experimental_writable_outputs
43+
build --experimental_inmemory_jdeps_files
44+
build --experimental_inmemory_dotd_files
45+
46+
# Development settings
47+
build:dev --compilation_mode=fastbuild
48+
build:dev --strip=never
49+
build:dev --copt=-O0
50+
build:dev --copt=-g
51+
52+
# Release settings
53+
build:release --compilation_mode=opt
54+
build:release --strip=always
55+
build:release --copt=-O3
56+
build:release --copt=-DNDEBUG
57+
58+
# Security settings
59+
build --experimental_enable_runfiles_with_generated_files
60+
build --incompatible_run_shell_command_string=false
61+
62+
try-import %workspace%/.bazelrc.local

BUILD.bazel

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
"""Root BUILD file for bazel-file-ops-component
2+
3+
This package provides the main entry points and configurations for
4+
the file operations WebAssembly components.
5+
"""
6+
7+
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
8+
9+
package(default_visibility = ["//visibility:public"])
10+
11+
# Configuration flags for component selection
12+
string_flag(
13+
name = "implementation",
14+
build_setting_default = "auto",
15+
values = [
16+
"auto",
17+
"tinygo",
18+
"rust",
19+
],
20+
)
21+
22+
config_setting(
23+
name = "use_tinygo",
24+
flag_values = {
25+
":implementation": "tinygo",
26+
},
27+
)
28+
29+
config_setting(
30+
name = "use_rust",
31+
flag_values = {
32+
":implementation": "rust",
33+
},
34+
)
35+
36+
config_setting(
37+
name = "use_auto",
38+
flag_values = {
39+
":implementation": "auto",
40+
},
41+
)
42+
43+
# Security level configuration
44+
string_flag(
45+
name = "security_level",
46+
build_setting_default = "standard",
47+
values = [
48+
"standard",
49+
"high",
50+
"strict",
51+
],
52+
)
53+
54+
config_setting(
55+
name = "high_security",
56+
flag_values = {
57+
":security_level": "high",
58+
},
59+
)
60+
61+
config_setting(
62+
name = "strict_security",
63+
flag_values = {
64+
":security_level": "strict",
65+
},
66+
)
67+
68+
# Main component aliases that select implementation
69+
alias(
70+
name = "file_ops_component",
71+
actual = select({
72+
":use_tinygo": "//tinygo:file_ops_component",
73+
":use_rust": "//rust:file_ops_component",
74+
"//conditions:default": "//tinygo:file_ops_component", # Default to TinyGo
75+
}),
76+
)
77+
78+
# Toolchain registration
79+
toolchain_type(
80+
name = "file_ops_toolchain_type",
81+
visibility = ["//visibility:public"],
82+
)
83+
84+
# Export WIT interface
85+
filegroup(
86+
name = "wit_interface",
87+
srcs = ["//wit:file-operations.wit"],
88+
visibility = ["//visibility:public"],
89+
)
90+
91+
# Export examples for documentation
92+
filegroup(
93+
name = "examples",
94+
srcs = [
95+
"//examples:all_examples",
96+
],
97+
visibility = ["//visibility:public"],
98+
)
99+
100+
# License file
101+
exports_files([
102+
"LICENSE",
103+
"README.md",
104+
])

LICENSE

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction,
10+
and distribution as defined by Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity granting the License.
13+
14+
"Legal Entity" shall mean the union of the acting entity and all
15+
other entities that control, are controlled by, or are under common
16+
control with that entity. For the purposes of this definition,
17+
"control" means (i) the power, direct or indirect, to cause the
18+
direction or management of such entity, whether by contract or
19+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
20+
outstanding shares, or (iii) beneficial ownership of such entity.
21+
22+
"You" (or "Your") shall mean an individual or Legal Entity
23+
exercising permissions granted by this License.
24+
25+
"Source" form shall mean the preferred form for making modifications,
26+
including but not limited to software source code, documentation
27+
source, and configuration files.
28+
29+
"Object" form shall mean any form resulting from mechanical
30+
transformation or translation of a Source form, including but
31+
not limited to compiled object code, generated documentation,
32+
and conversions to other media types.
33+
34+
"Work" shall mean the work of authorship, which is provided
35+
under this License and made available under the License, as
36+
indicated by a copyright notice that is included in or attached
37+
to the work. (I disclaim that it is not appropriate to attach
38+
the copyright notice to the individual file; the Work includes
39+
all the files in the whole directory tree.)
40+
41+
"Derivative Works" shall mean any work, whether in Source or Object
42+
form, that is based upon (or derived from) the Work and for which the
43+
editorial revisions, annotations, elaborations, or other modifications
44+
represent, as a whole, an original work of authorship. For the purposes
45+
of this License, Derivative Works shall not include works that remain
46+
separable from, or merely link (or bind by name) to the interfaces of,
47+
the Work and derivative works thereof.
48+
49+
"Contribution" shall mean any work of authorship, including
50+
the original version of the Work and any modifications or additions
51+
to that Work or Derivative Works thereof, that is intentionally
52+
submitted to Licensor for inclusion in the Work by the copyright owner
53+
or by an individual or Legal Entity authorized to submit on behalf of
54+
the copyright owner. For the purposes of this definition, "submitted"
55+
means any form of electronic, verbal, or written communication sent
56+
to the Licensor or its representatives, including but not limited to
57+
communication on electronic mailing lists, source code control
58+
systems, and issue tracking systems that are managed by, or on behalf
59+
of, the Licensor for the purpose of discussing and improving the Work,
60+
but excluding communication that is conspicuously marked or otherwise
61+
designated in writing by the copyright owner as "Not a Contribution."
62+
63+
"Contributor" shall mean Licensor and any individual or Legal Entity
64+
on behalf of whom a Contribution has been received by Licensor and
65+
subsequently incorporated within the Work.
66+
67+
2. Grant of Copyright License. Subject to the terms and conditions of
68+
this License, each Contributor hereby grants to You a perpetual,
69+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70+
copyright license to use, reproduce, modify, distribute, sublicense,
71+
and/or sell copies of the Work, and to permit persons to whom the
72+
Work is furnished to do so, subject to the following conditions:
73+
74+
The above copyright notice and this permission notice shall be
75+
included in all copies or substantial portions of the Work.
76+
77+
3. Grant of Patent License. Subject to the terms and conditions of
78+
this License, each Contributor hereby grants to You a perpetual,
79+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80+
(except as stated in this section) patent license to make, have made,
81+
use, offer to sell, sell, import, and otherwise transfer the Work,
82+
where such license applies only to those patent claims licensable
83+
by such Contributor that are necessarily infringed by their
84+
Contribution(s) alone or by combination of their Contribution(s)
85+
with the Work to which such Contribution(s) was submitted. If You
86+
institute patent litigation against any entity (including a
87+
cross-claim or counterclaim in a lawsuit) alleging that the Work
88+
or a Contribution incorporated within the Work constitutes direct
89+
or contributory patent infringement, then any patent licenses
90+
granted to You under this License for that Work shall terminate
91+
as of the date such litigation is filed.
92+
93+
4. Redistribution. You may reproduce and distribute copies of the
94+
Work or Derivative Works thereof in any medium, with or without
95+
modifications, and in Source or Object form, provided that You
96+
meet the following conditions:
97+
98+
(a) You must give any other recipients of the Work or
99+
Derivative Works a copy of this License; and
100+
101+
(b) You must cause any modified files to carry prominent notices
102+
stating that You changed the files; and
103+
104+
(c) You must retain, in the Source form of any Derivative Works
105+
that You distribute, all copyright, trademark, patent,
106+
and attribution notices from the Source form of the Work,
107+
excluding those notices that do not pertain to any part of
108+
the Derivative Works; and
109+
110+
(d) If the Work includes a "NOTICE" file as part of its
111+
distribution, then any Derivative Works that You distribute must
112+
include a readable copy of the attribution notices contained
113+
within such NOTICE file, excluding those notices that do not
114+
pertain to any part of the Derivative Works, in at least one
115+
of the following places: within a NOTICE file distributed
116+
as part of the Derivative Works; within the Source form or
117+
documentation, if provided along with the Derivative Works; or,
118+
within a display generated by the Derivative Works, if and
119+
wherever such third-party notices normally appear. The contents
120+
of the NOTICE file are for informational purposes only and
121+
do not modify the License. You may add Your own attribution
122+
notices within Derivative Works that You distribute, alongside
123+
or as an addendum to the NOTICE text from the Work, provided
124+
that such additional attribution notices cannot be construed
125+
as modifying the License.
126+
127+
You may add Your own copyright notice to Your modifications and
128+
may provide additional or different license terms and conditions
129+
for use, reproduction, or distribution of Your modifications, or
130+
for any such Derivative Works as a whole, provided Your use,
131+
reproduction, and distribution of the Work otherwise complies with
132+
the conditions stated in this License.
133+
134+
5. Submission of Contributions. Unless You explicitly state otherwise,
135+
any Contribution intentionally submitted for inclusion in the Work
136+
by You to the Licensor shall be under the terms and conditions of
137+
this License, without any additional terms or conditions.
138+
Notwithstanding the above, nothing herein shall supersede or modify
139+
the terms of any separate license agreement you may have executed
140+
with Licensor regarding such Contributions.
141+
142+
6. Trademarks. This License does not grant permission to use the trade
143+
names, trademarks, service marks, or product names of the Licensor,
144+
except as required for reasonable and customary use in describing the
145+
origin of the Work and reproducing the content of the NOTICE file.
146+
147+
7. Disclaimer of Warranty. Unless required by applicable law or
148+
agreed to in writing, Licensor provides the Work (and each
149+
Contributor provides its Contributions) on an "AS IS" BASIS,
150+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151+
implied, including, without limitation, any warranties or conditions
152+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153+
PARTICULAR PURPOSE. You are solely responsible for determining the
154+
appropriateness of using or redistributing the Work and assume any
155+
risks associated with Your exercise of permissions under this License.
156+
157+
8. Limitation of Liability. In no event and under no legal theory,
158+
whether in tort (including negligence), contract, or otherwise,
159+
unless required by applicable law (such as deliberate and grossly
160+
negligent acts) or agreed to in writing, shall any Contributor be
161+
liable to You for damages, including any direct, indirect, special,
162+
incidental, or consequential damages of any character arising as a
163+
result of this License or out of the use or inability to use the
164+
Work (including but not limited to damages for loss of goodwill,
165+
work stoppage, computer failure or malfunction, or any and all
166+
other commercial damages or losses), even if such Contributor
167+
has been advised of the possibility of such damages.
168+
169+
9. Accepting Warranty or Support. When redistributing the Work or
170+
Derivative Works thereof, You may choose to offer, and charge a fee
171+
for, acceptance of support, warranty, indemnity, or other liability
172+
obligations and/or rights consistent with this License. However, in
173+
accepting such obligations, You may act only on Your own behalf and on
174+
Your sole responsibility, not on behalf of any other Contributor, and
175+
only if You agree to indemnify, defend, and hold each Contributor
176+
harmless for any liability incurred by, or claims asserted against,
177+
such Contributor by reason of your accepting any such warranty or support.
178+
179+
END OF TERMS AND CONDITIONS
180+
181+
Copyright 2025 Pulse Engine and Contributors
182+
183+
Licensed under the Apache License, Version 2.0 (the "License");
184+
you may not use this file except in compliance with the License.
185+
You may obtain a copy of the License at
186+
187+
http://www.apache.org/licenses/LICENSE-2.0
188+
189+
Unless required by applicable law or agreed to in writing, software
190+
distributed under the License is distributed on an "AS IS" BASIS,
191+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192+
See the License for the specific language governing permissions and
193+
limitations under the License.

0 commit comments

Comments
 (0)