@cubis/foundry 0.3.71 → 0.3.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cli/core.js +4 -18
- package/dist/cli/core.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/core.ts +4 -18
- package/workflows/powers/accessibility/POWER.md +83 -94
- package/workflows/powers/accessibility/SKILL.md +82 -94
- package/workflows/powers/agent-design/POWER.md +201 -0
- package/workflows/powers/agent-design/SKILL.md +198 -0
- package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
- package/workflows/powers/agent-design/references/skill-testing.md +164 -0
- package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
- package/workflows/powers/agentic-eval/POWER.md +62 -0
- package/workflows/powers/agentic-eval/SKILL.md +59 -0
- package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
- package/workflows/powers/api-designer/POWER.md +43 -71
- package/workflows/powers/api-designer/SKILL.md +43 -71
- package/workflows/powers/api-patterns/POWER.md +42 -56
- package/workflows/powers/api-patterns/SKILL.md +42 -57
- package/workflows/powers/architecture-designer/POWER.md +43 -60
- package/workflows/powers/architecture-designer/SKILL.md +43 -60
- package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
- package/workflows/powers/auth-architect/POWER.md +69 -0
- package/workflows/powers/auth-architect/SKILL.md +66 -0
- package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
- package/workflows/powers/behavioral-modes/POWER.md +100 -9
- package/workflows/powers/c-pro/POWER.md +105 -0
- package/workflows/powers/c-pro/SKILL.md +102 -0
- package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
- package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
- package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
- package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
- package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
- package/workflows/powers/changelog-generator/POWER.md +127 -63
- package/workflows/powers/changelog-generator/SKILL.md +126 -63
- package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
- package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
- package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
- package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
- package/workflows/powers/cli-developer/POWER.md +152 -95
- package/workflows/powers/cli-developer/SKILL.md +152 -95
- package/workflows/powers/cpp-pro/POWER.md +111 -0
- package/workflows/powers/cpp-pro/SKILL.md +108 -0
- package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
- package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
- package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
- package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
- package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
- package/workflows/powers/csharp-pro/POWER.md +47 -22
- package/workflows/powers/csharp-pro/SKILL.md +47 -22
- package/workflows/powers/dart-pro/POWER.md +68 -0
- package/workflows/powers/dart-pro/SKILL.md +65 -0
- package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
- package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
- package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
- package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
- package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
- package/workflows/powers/database-design/POWER.md +47 -33
- package/workflows/powers/database-design/SKILL.md +47 -33
- package/workflows/powers/database-optimizer/POWER.md +43 -64
- package/workflows/powers/database-optimizer/SKILL.md +43 -64
- package/workflows/powers/database-skills/POWER.md +59 -93
- package/workflows/powers/database-skills/SKILL.md +59 -93
- package/workflows/powers/debugging-strategies/POWER.md +69 -0
- package/workflows/powers/debugging-strategies/SKILL.md +66 -0
- package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
- package/workflows/powers/deep-research/POWER.md +67 -0
- package/workflows/powers/deep-research/SKILL.md +64 -0
- package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
- package/workflows/powers/design-system-builder/POWER.md +130 -116
- package/workflows/powers/design-system-builder/SKILL.md +130 -116
- package/workflows/powers/devops-engineer/POWER.md +120 -57
- package/workflows/powers/devops-engineer/SKILL.md +120 -57
- package/workflows/powers/docker-kubernetes/POWER.md +94 -0
- package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
- package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
- package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
- package/workflows/powers/documentation-templates/POWER.md +158 -127
- package/workflows/powers/documentation-templates/SKILL.md +158 -127
- package/workflows/powers/drizzle-expert/POWER.md +66 -0
- package/workflows/powers/drizzle-expert/SKILL.md +63 -0
- package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
- package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
- package/workflows/powers/error-ux-observability/POWER.md +144 -131
- package/workflows/powers/error-ux-observability/SKILL.md +143 -131
- package/workflows/powers/fastapi-expert/POWER.md +46 -60
- package/workflows/powers/fastapi-expert/SKILL.md +46 -60
- package/workflows/powers/firebase/POWER.md +65 -0
- package/workflows/powers/firebase/SKILL.md +62 -0
- package/workflows/powers/firebase/references/platform-routing.md +16 -0
- package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
- package/workflows/powers/flutter-design-system/POWER.md +63 -0
- package/workflows/powers/flutter-design-system/SKILL.md +60 -0
- package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
- package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
- package/workflows/powers/flutter-drift/POWER.md +65 -0
- package/workflows/powers/flutter-drift/SKILL.md +62 -0
- package/workflows/powers/flutter-drift/references/migrations.md +22 -0
- package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
- package/workflows/powers/flutter-feature/POWER.md +65 -0
- package/workflows/powers/flutter-feature/SKILL.md +62 -0
- package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
- package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
- package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
- package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
- package/workflows/powers/flutter-go-router/POWER.md +64 -0
- package/workflows/powers/flutter-go-router/SKILL.md +61 -0
- package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
- package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
- package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
- package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
- package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
- package/workflows/powers/flutter-repository/POWER.md +64 -0
- package/workflows/powers/flutter-repository/SKILL.md +61 -0
- package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
- package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
- package/workflows/powers/flutter-riverpod/POWER.md +70 -0
- package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
- package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
- package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
- package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
- package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
- package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
- package/workflows/powers/flutter-state-machine/POWER.md +62 -0
- package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
- package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
- package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
- package/workflows/powers/flutter-testing/POWER.md +64 -0
- package/workflows/powers/flutter-testing/SKILL.md +61 -0
- package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
- package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
- package/workflows/powers/frontend-code-review/POWER.md +137 -0
- package/workflows/powers/frontend-code-review/SKILL.md +134 -0
- package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
- package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
- package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
- package/workflows/powers/frontend-design/POWER.md +163 -362
- package/workflows/powers/frontend-design/SKILL.md +163 -362
- package/workflows/powers/game-development/POWER.md +57 -140
- package/workflows/powers/game-development/SKILL.md +57 -140
- package/workflows/powers/geo-fundamentals/POWER.md +64 -126
- package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
- package/workflows/powers/git-workflow/POWER.md +135 -0
- package/workflows/powers/git-workflow/SKILL.md +132 -0
- package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
- package/workflows/powers/golang-pro/POWER.md +46 -35
- package/workflows/powers/golang-pro/SKILL.md +46 -35
- package/workflows/powers/graphql-architect/POWER.md +44 -62
- package/workflows/powers/graphql-architect/SKILL.md +44 -62
- package/workflows/powers/i18n-localization/POWER.md +118 -103
- package/workflows/powers/i18n-localization/SKILL.md +118 -103
- package/workflows/powers/java-pro/POWER.md +47 -22
- package/workflows/powers/java-pro/SKILL.md +47 -22
- package/workflows/powers/javascript-pro/POWER.md +47 -34
- package/workflows/powers/javascript-pro/SKILL.md +47 -34
- package/workflows/powers/kotlin-pro/POWER.md +46 -23
- package/workflows/powers/kotlin-pro/SKILL.md +46 -23
- package/workflows/powers/legacy-modernizer/POWER.md +43 -60
- package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
- package/workflows/powers/mcp-builder/POWER.md +65 -0
- package/workflows/powers/mcp-builder/SKILL.md +62 -0
- package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
- package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
- package/workflows/powers/microservices-architect/POWER.md +43 -70
- package/workflows/powers/microservices-architect/SKILL.md +43 -70
- package/workflows/powers/mobile-design/POWER.md +110 -345
- package/workflows/powers/mobile-design/SKILL.md +110 -345
- package/workflows/powers/mongodb/POWER.md +67 -0
- package/workflows/powers/mongodb/SKILL.md +64 -0
- package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
- package/workflows/powers/mysql/POWER.md +67 -0
- package/workflows/powers/mysql/SKILL.md +64 -0
- package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
- package/workflows/powers/neki/POWER.md +67 -0
- package/workflows/powers/neki/SKILL.md +64 -0
- package/workflows/powers/neki/references/neki-checklist.md +18 -0
- package/workflows/powers/nestjs-expert/POWER.md +45 -91
- package/workflows/powers/nestjs-expert/SKILL.md +45 -91
- package/workflows/powers/nextjs-developer/POWER.md +51 -44
- package/workflows/powers/nextjs-developer/SKILL.md +51 -44
- package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
- package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
- package/workflows/powers/observability/POWER.md +109 -0
- package/workflows/powers/observability/SKILL.md +106 -0
- package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
- package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
- package/workflows/powers/openai-docs/POWER.md +61 -0
- package/workflows/powers/openai-docs/SKILL.md +58 -0
- package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
- package/workflows/powers/performance-profiling/POWER.md +61 -114
- package/workflows/powers/performance-profiling/SKILL.md +61 -114
- package/workflows/powers/php-pro/POWER.md +116 -0
- package/workflows/powers/php-pro/SKILL.md +113 -0
- package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
- package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
- package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
- package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
- package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
- package/workflows/powers/playwright-e2e/POWER.md +85 -0
- package/workflows/powers/playwright-e2e/SKILL.md +82 -0
- package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
- package/workflows/powers/postgres/POWER.md +67 -0
- package/workflows/powers/postgres/SKILL.md +64 -0
- package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
- package/workflows/powers/prompt-engineer/POWER.md +47 -30
- package/workflows/powers/prompt-engineer/SKILL.md +47 -30
- package/workflows/powers/python-pro/POWER.md +47 -36
- package/workflows/powers/python-pro/SKILL.md +47 -36
- package/workflows/powers/react-best-practices/POWER.md +56 -33
- package/workflows/powers/react-best-practices/SKILL.md +56 -33
- package/workflows/powers/react-expert/POWER.md +47 -37
- package/workflows/powers/react-expert/SKILL.md +47 -37
- package/workflows/powers/redis/POWER.md +67 -0
- package/workflows/powers/redis/SKILL.md +64 -0
- package/workflows/powers/redis/references/redis-checklist.md +19 -0
- package/workflows/powers/ruby-pro/POWER.md +118 -0
- package/workflows/powers/ruby-pro/SKILL.md +115 -0
- package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
- package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
- package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
- package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
- package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
- package/workflows/powers/rust-pro/POWER.md +45 -31
- package/workflows/powers/rust-pro/SKILL.md +45 -31
- package/workflows/powers/security-engineer/POWER.md +129 -0
- package/workflows/powers/security-engineer/SKILL.md +126 -0
- package/workflows/powers/seo-fundamentals/POWER.md +59 -102
- package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
- package/workflows/powers/serverless-patterns/POWER.md +171 -0
- package/workflows/powers/serverless-patterns/SKILL.md +168 -0
- package/workflows/powers/skill-creator/POWER.md +90 -0
- package/workflows/powers/skill-creator/SKILL.md +87 -0
- package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
- package/workflows/powers/skill-creator/references/schemas.md +430 -0
- package/workflows/powers/spec-miner/POWER.md +49 -57
- package/workflows/powers/spec-miner/SKILL.md +49 -57
- package/workflows/powers/sqlite/POWER.md +67 -0
- package/workflows/powers/sqlite/SKILL.md +64 -0
- package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
- package/workflows/powers/sre-engineer/POWER.md +123 -64
- package/workflows/powers/sre-engineer/SKILL.md +123 -64
- package/workflows/powers/static-analysis/POWER.md +121 -77
- package/workflows/powers/static-analysis/SKILL.md +121 -77
- package/workflows/powers/stripe-best-practices/POWER.md +140 -17
- package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
- package/workflows/powers/supabase/POWER.md +67 -0
- package/workflows/powers/supabase/SKILL.md +64 -0
- package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
- package/workflows/powers/swift-pro/POWER.md +118 -0
- package/workflows/powers/swift-pro/SKILL.md +115 -0
- package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
- package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
- package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
- package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
- package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
- package/workflows/powers/tailwind-patterns/POWER.md +71 -240
- package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
- package/workflows/powers/testing-patterns/POWER.md +155 -10
- package/workflows/powers/testing-patterns/SKILL.md +155 -10
- package/workflows/powers/typescript-pro/POWER.md +47 -38
- package/workflows/powers/typescript-pro/SKILL.md +47 -38
- package/workflows/powers/vitess/POWER.md +67 -0
- package/workflows/powers/vitess/SKILL.md +64 -0
- package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
- package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
- package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
- package/workflows/powers/web-perf/POWER.md +43 -170
- package/workflows/powers/web-perf/SKILL.md +43 -170
- package/workflows/powers/webapp-testing/POWER.md +43 -164
- package/workflows/powers/webapp-testing/SKILL.md +43 -164
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# POSIX and Platform APIs
|
|
2
|
+
|
|
3
|
+
## File I/O
|
|
4
|
+
|
|
5
|
+
```c
|
|
6
|
+
#include <fcntl.h>
|
|
7
|
+
#include <unistd.h>
|
|
8
|
+
#include <sys/stat.h>
|
|
9
|
+
|
|
10
|
+
// Open with explicit permissions
|
|
11
|
+
int fd = open("data.bin", O_RDWR | O_CREAT | O_TRUNC, 0644);
|
|
12
|
+
if (fd == -1) {
|
|
13
|
+
perror("open");
|
|
14
|
+
return -1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Read with retry on EINTR
|
|
18
|
+
ssize_t safe_read(int fd, void *buf, size_t count) {
|
|
19
|
+
ssize_t n;
|
|
20
|
+
do {
|
|
21
|
+
n = read(fd, buf, count);
|
|
22
|
+
} while (n == -1 && errno == EINTR);
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Write all bytes (handle partial writes)
|
|
27
|
+
ssize_t write_all(int fd, const void *buf, size_t count) {
|
|
28
|
+
const uint8_t *p = buf;
|
|
29
|
+
size_t remaining = count;
|
|
30
|
+
while (remaining > 0) {
|
|
31
|
+
ssize_t n = write(fd, p, remaining);
|
|
32
|
+
if (n == -1) {
|
|
33
|
+
if (errno == EINTR) continue;
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
p += n;
|
|
37
|
+
remaining -= n;
|
|
38
|
+
}
|
|
39
|
+
return count;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Always close file descriptors
|
|
43
|
+
close(fd);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Memory-Mapped I/O
|
|
47
|
+
|
|
48
|
+
```c
|
|
49
|
+
#include <sys/mman.h>
|
|
50
|
+
#include <sys/stat.h>
|
|
51
|
+
#include <fcntl.h>
|
|
52
|
+
|
|
53
|
+
// Map file for read-only access
|
|
54
|
+
void *map_file_readonly(const char *path, size_t *out_size) {
|
|
55
|
+
int fd = open(path, O_RDONLY);
|
|
56
|
+
if (fd == -1) return NULL;
|
|
57
|
+
|
|
58
|
+
struct stat st;
|
|
59
|
+
if (fstat(fd, &st) == -1) { close(fd); return NULL; }
|
|
60
|
+
|
|
61
|
+
void *addr = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
|
62
|
+
close(fd); // fd can be closed after mmap
|
|
63
|
+
if (addr == MAP_FAILED) return NULL;
|
|
64
|
+
|
|
65
|
+
*out_size = st.st_size;
|
|
66
|
+
return addr;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Clean up
|
|
70
|
+
munmap(addr, size);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Signal Handling
|
|
74
|
+
|
|
75
|
+
```c
|
|
76
|
+
#include <signal.h>
|
|
77
|
+
#include <stdatomic.h>
|
|
78
|
+
|
|
79
|
+
// Use sig_atomic_t or atomics for signal flags
|
|
80
|
+
static volatile sig_atomic_t shutdown_requested = 0;
|
|
81
|
+
|
|
82
|
+
void handle_signal(int sig) {
|
|
83
|
+
(void)sig;
|
|
84
|
+
shutdown_requested = 1;
|
|
85
|
+
// ONLY async-signal-safe functions are allowed here:
|
|
86
|
+
// write(), _exit(), signal(), abort()
|
|
87
|
+
// DO NOT use printf, malloc, free, etc.
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void setup_signals(void) {
|
|
91
|
+
struct sigaction sa = {
|
|
92
|
+
.sa_handler = handle_signal,
|
|
93
|
+
.sa_flags = 0,
|
|
94
|
+
};
|
|
95
|
+
sigemptyset(&sa.sa_mask);
|
|
96
|
+
sigaction(SIGTERM, &sa, NULL);
|
|
97
|
+
sigaction(SIGINT, &sa, NULL);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Main loop checks the flag
|
|
101
|
+
while (!shutdown_requested) {
|
|
102
|
+
process_next_item();
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Process and Fork
|
|
107
|
+
|
|
108
|
+
```c
|
|
109
|
+
#include <sys/wait.h>
|
|
110
|
+
|
|
111
|
+
// Fork with proper error handling
|
|
112
|
+
pid_t pid = fork();
|
|
113
|
+
if (pid == -1) {
|
|
114
|
+
perror("fork");
|
|
115
|
+
exit(EXIT_FAILURE);
|
|
116
|
+
} else if (pid == 0) {
|
|
117
|
+
// Child process
|
|
118
|
+
execvp(argv[0], argv); // replaces child image
|
|
119
|
+
perror("exec"); // only reached on error
|
|
120
|
+
_exit(127); // use _exit, not exit, in child after fork
|
|
121
|
+
} else {
|
|
122
|
+
// Parent process
|
|
123
|
+
int status;
|
|
124
|
+
waitpid(pid, &status, 0);
|
|
125
|
+
if (WIFEXITED(status)) {
|
|
126
|
+
int exit_code = WEXITSTATUS(status);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Socket Programming
|
|
132
|
+
|
|
133
|
+
```c
|
|
134
|
+
#include <sys/socket.h>
|
|
135
|
+
#include <netinet/in.h>
|
|
136
|
+
#include <arpa/inet.h>
|
|
137
|
+
|
|
138
|
+
// TCP server setup
|
|
139
|
+
int create_server(uint16_t port) {
|
|
140
|
+
int fd = socket(AF_INET, SOCK_STREAM, 0);
|
|
141
|
+
if (fd == -1) return -1;
|
|
142
|
+
|
|
143
|
+
int opt = 1;
|
|
144
|
+
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
|
145
|
+
|
|
146
|
+
struct sockaddr_in addr = {
|
|
147
|
+
.sin_family = AF_INET,
|
|
148
|
+
.sin_port = htons(port),
|
|
149
|
+
.sin_addr.s_addr = INADDR_ANY,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
|
153
|
+
close(fd);
|
|
154
|
+
return -1;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (listen(fd, SOMAXCONN) == -1) {
|
|
158
|
+
close(fd);
|
|
159
|
+
return -1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return fd;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Platform Abstraction Layer Pattern
|
|
167
|
+
|
|
168
|
+
```c
|
|
169
|
+
// platform.h — unified interface
|
|
170
|
+
#pragma once
|
|
171
|
+
|
|
172
|
+
typedef struct platform_file platform_file;
|
|
173
|
+
|
|
174
|
+
platform_file *platform_open(const char *path, int flags);
|
|
175
|
+
ssize_t platform_read(platform_file *f, void *buf, size_t count);
|
|
176
|
+
void platform_close(platform_file *f);
|
|
177
|
+
uint64_t platform_monotonic_time_ns(void);
|
|
178
|
+
|
|
179
|
+
// platform_posix.c — POSIX implementation
|
|
180
|
+
#if defined(__linux__) || defined(__APPLE__)
|
|
181
|
+
#include <time.h>
|
|
182
|
+
|
|
183
|
+
uint64_t platform_monotonic_time_ns(void) {
|
|
184
|
+
struct timespec ts;
|
|
185
|
+
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
186
|
+
return (uint64_t)ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
|
187
|
+
}
|
|
188
|
+
#endif
|
|
189
|
+
|
|
190
|
+
// platform_win32.c — Windows implementation
|
|
191
|
+
#if defined(_WIN32)
|
|
192
|
+
#include <windows.h>
|
|
193
|
+
|
|
194
|
+
uint64_t platform_monotonic_time_ns(void) {
|
|
195
|
+
LARGE_INTEGER freq, count;
|
|
196
|
+
QueryPerformanceFrequency(&freq);
|
|
197
|
+
QueryPerformanceCounter(&count);
|
|
198
|
+
return (uint64_t)(count.QuadPart * 1000000000LL / freq.QuadPart);
|
|
199
|
+
}
|
|
200
|
+
#endif
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Error Handling Patterns
|
|
204
|
+
|
|
205
|
+
```c
|
|
206
|
+
// Return error codes with context struct
|
|
207
|
+
typedef struct {
|
|
208
|
+
int code;
|
|
209
|
+
const char *message;
|
|
210
|
+
const char *file;
|
|
211
|
+
int line;
|
|
212
|
+
} error_t;
|
|
213
|
+
|
|
214
|
+
#define ERROR(code, msg) ((error_t){ (code), (msg), __FILE__, __LINE__ })
|
|
215
|
+
#define OK ((error_t){ 0, NULL, NULL, 0 })
|
|
216
|
+
|
|
217
|
+
error_t process_file(const char *path) {
|
|
218
|
+
int fd = open(path, O_RDONLY);
|
|
219
|
+
if (fd == -1) return ERROR(errno, "failed to open file");
|
|
220
|
+
|
|
221
|
+
// ...
|
|
222
|
+
close(fd);
|
|
223
|
+
return OK;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Goto-based cleanup (idiomatic C error handling)
|
|
227
|
+
int init_system(void) {
|
|
228
|
+
int ret = -1;
|
|
229
|
+
void *buf = malloc(BUF_SIZE);
|
|
230
|
+
if (!buf) goto out;
|
|
231
|
+
|
|
232
|
+
int fd = open("config", O_RDONLY);
|
|
233
|
+
if (fd == -1) goto cleanup_buf;
|
|
234
|
+
|
|
235
|
+
// ... use buf and fd ...
|
|
236
|
+
ret = 0;
|
|
237
|
+
|
|
238
|
+
close(fd);
|
|
239
|
+
cleanup_buf:
|
|
240
|
+
free(buf);
|
|
241
|
+
out:
|
|
242
|
+
return ret;
|
|
243
|
+
}
|
|
244
|
+
```
|
|
@@ -2,105 +2,169 @@
|
|
|
2
2
|
---
|
|
3
3
|
inclusion: manual
|
|
4
4
|
name: changelog-generator
|
|
5
|
-
description:
|
|
5
|
+
description: Generate changelogs from conventional commits, semantic versioning, release notes, and automated version management workflows.
|
|
6
|
+
license: Apache-2.0
|
|
7
|
+
metadata:
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
|
|
6
11
|
---
|
|
7
12
|
|
|
8
13
|
# Changelog Generator
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
## Purpose
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
Guide changelog generation, release notes writing, and version management using conventional commits and semantic versioning.
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
- Creating weekly or monthly product update summaries
|
|
16
|
-
- Documenting changes for customers
|
|
17
|
-
- Writing changelog entries for app store submissions
|
|
18
|
-
- Generating update notifications
|
|
19
|
-
- Creating internal release documentation
|
|
20
|
-
- Maintaining a public changelog/product updates page
|
|
19
|
+
## When to Use
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
- Generating a CHANGELOG.md from commit history
|
|
22
|
+
- Writing release notes for a new version
|
|
23
|
+
- Setting up automated versioning workflows
|
|
24
|
+
- Reviewing commit message format and conventions
|
|
25
|
+
- Planning a release with breaking changes
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
2. **Categorizes Changes**: Groups commits into logical categories (features, improvements, bug fixes, breaking changes, security)
|
|
26
|
-
3. **Translates Technical → User-Friendly**: Converts developer commits into customer language
|
|
27
|
-
4. **Formats Professionally**: Creates clean, structured changelog entries
|
|
28
|
-
5. **Filters Noise**: Excludes internal commits (refactoring, tests, etc.)
|
|
29
|
-
6. **Follows Best Practices**: Applies changelog guidelines and your brand voice
|
|
27
|
+
## Instructions
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
### Step 1 — Follow Conventional Commits
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
**Format**: `<type>(<scope>): <description>`
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
| Type | SemVer Bump | When |
|
|
34
|
+
| ---------- | ----------- | -------------------------------------- |
|
|
35
|
+
| `feat` | Minor | New feature for users |
|
|
36
|
+
| `fix` | Patch | Bug fix for users |
|
|
37
|
+
| `docs` | None | Documentation only |
|
|
38
|
+
| `style` | None | Formatting, no logic change |
|
|
39
|
+
| `refactor` | None | Code restructuring, no behavior change |
|
|
40
|
+
| `perf` | Patch | Performance improvement |
|
|
41
|
+
| `test` | None | Adding or fixing tests |
|
|
42
|
+
| `build` | None | Build system or dependencies |
|
|
43
|
+
| `ci` | None | CI/CD configuration |
|
|
44
|
+
| `chore` | None | Maintenance tasks |
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
Create a changelog from commits since last release
|
|
39
|
-
```
|
|
46
|
+
**Breaking changes**: Add `!` after type or `BREAKING CHANGE:` in footer:
|
|
40
47
|
|
|
41
48
|
```
|
|
42
|
-
|
|
43
|
-
```
|
|
49
|
+
feat!: remove deprecated API endpoints
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
Create release notes for version 2.5.0
|
|
51
|
+
BREAKING CHANGE: /v1/users endpoint has been removed. Use /v2/users instead.
|
|
47
52
|
```
|
|
48
53
|
|
|
49
|
-
###
|
|
54
|
+
### Step 2 — Generate Changelog
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```
|
|
56
|
+
**Changelog format** (Keep a Changelog style):
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
# Changelog
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
## [2.1.0] - 2025-01-15
|
|
56
62
|
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
- User profile image upload (#234)
|
|
66
|
+
- Dark mode support for dashboard (#256)
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- Login timeout on slow connections (#245)
|
|
71
|
+
- Currency formatting for Japanese Yen (#249)
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
|
|
75
|
+
- Increased password minimum length to 12 characters (#251)
|
|
76
|
+
|
|
77
|
+
## [2.0.0] - 2024-12-01
|
|
78
|
+
|
|
79
|
+
### Breaking Changes
|
|
80
|
+
|
|
81
|
+
- Removed deprecated /v1/users endpoint — use /v2/users (#230)
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- New user roles system with RBAC (#220)
|
|
57
86
|
```
|
|
58
|
-
Create a changelog for commits since v2.4.0, using my changelog
|
|
59
|
-
guidelines from CHANGELOG_STYLE.md
|
|
60
|
-
```
|
|
61
87
|
|
|
62
|
-
|
|
88
|
+
**Mapping rules**:
|
|
89
|
+
|
|
90
|
+
- `feat` → **Added**
|
|
91
|
+
- `fix` → **Fixed**
|
|
92
|
+
- `feat!` / `BREAKING CHANGE` → **Breaking Changes**
|
|
93
|
+
- `perf` → **Performance**
|
|
94
|
+
- `refactor` with user-visible changes → **Changed**
|
|
95
|
+
- `deprecate` → **Deprecated**
|
|
96
|
+
- `remove` → **Removed**
|
|
97
|
+
|
|
98
|
+
### Step 3 — Semantic Versioning
|
|
99
|
+
|
|
100
|
+
**MAJOR.MINOR.PATCH** (e.g., 2.1.3):
|
|
101
|
+
|
|
102
|
+
- **MAJOR**: Breaking changes (API removal, incompatible changes)
|
|
103
|
+
- **MINOR**: New features (backward-compatible additions)
|
|
104
|
+
- **PATCH**: Bug fixes (backward-compatible fixes)
|
|
105
|
+
|
|
106
|
+
**Pre-release versions**: `2.1.0-beta.1`, `2.1.0-rc.1`
|
|
107
|
+
|
|
108
|
+
**Rules**:
|
|
63
109
|
|
|
64
|
-
|
|
110
|
+
- Version 0.x.y is for initial development (anything may change)
|
|
111
|
+
- First stable release is 1.0.0
|
|
112
|
+
- Never change a released version — create a new one
|
|
113
|
+
|
|
114
|
+
### Step 4 — Write Release Notes
|
|
115
|
+
|
|
116
|
+
**Release notes structure**:
|
|
117
|
+
|
|
118
|
+
1. **Headline** — one sentence summarizing the release theme
|
|
119
|
+
2. **Highlights** — 2-3 most important changes with context
|
|
120
|
+
3. **Full changelog** — categorized list of all changes
|
|
121
|
+
4. **Migration guide** — for breaking changes, step-by-step upgrade instructions
|
|
122
|
+
5. **Contributors** — acknowledge contributors
|
|
123
|
+
|
|
124
|
+
**Good highlights**:
|
|
65
125
|
|
|
66
|
-
**Output**:
|
|
67
126
|
```markdown
|
|
68
|
-
|
|
127
|
+
### Highlights
|
|
69
128
|
|
|
70
|
-
|
|
129
|
+
**Dark Mode** — The dashboard now supports dark mode, automatically
|
|
130
|
+
matching your system preference. Toggle manually in Settings → Appearance.
|
|
71
131
|
|
|
72
|
-
|
|
73
|
-
|
|
132
|
+
**Faster Search** — Search results now load 3x faster thanks to a new
|
|
133
|
+
indexing strategy. No changes needed on your end.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Step 5 — Automate the Workflow
|
|
74
137
|
|
|
75
|
-
|
|
76
|
-
Navigate faster without touching your mouse.
|
|
138
|
+
**CI pipeline**:
|
|
77
139
|
|
|
78
|
-
|
|
140
|
+
1. Lint commit messages on PR (reject non-conventional)
|
|
141
|
+
2. On merge to main: determine version bump from commits
|
|
142
|
+
3. Generate changelog entry
|
|
143
|
+
4. Bump version in package.json / pyproject.toml
|
|
144
|
+
5. Create git tag
|
|
145
|
+
6. Create GitHub Release with release notes
|
|
146
|
+
7. Publish to package registry
|
|
79
147
|
|
|
80
|
-
|
|
81
|
-
|
|
148
|
+
## Output Format
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
## Version
|
|
152
|
+
[version number and bump reasoning]
|
|
82
153
|
|
|
83
|
-
##
|
|
154
|
+
## Changelog Entry
|
|
155
|
+
[formatted changelog in Keep a Changelog style]
|
|
84
156
|
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
- Corrected notification badge count
|
|
157
|
+
## Release Notes
|
|
158
|
+
[user-facing summary with highlights and migration guide]
|
|
88
159
|
```
|
|
89
160
|
|
|
90
|
-
|
|
161
|
+
## Examples
|
|
91
162
|
|
|
92
|
-
|
|
163
|
+
**User**: "Generate a changelog for our latest release"
|
|
93
164
|
|
|
94
|
-
|
|
95
|
-
- Specify date ranges for focused changelogs
|
|
96
|
-
- Use your CHANGELOG_STYLE.md for consistent formatting
|
|
97
|
-
- Review and adjust the generated changelog before publishing
|
|
98
|
-
- Save output directly to CHANGELOG.md
|
|
165
|
+
**Response approach**: Scan commits since last tag. Categorize by type. Generate changelog in Keep a Changelog format. Determine version bump (major/minor/patch). Write release highlights.
|
|
99
166
|
|
|
100
|
-
|
|
167
|
+
**User**: "We have breaking API changes — how do we release this?"
|
|
101
168
|
|
|
102
|
-
|
|
103
|
-
- Writing app store update descriptions
|
|
104
|
-
- Generating email updates for users
|
|
105
|
-
- Creating social media announcement posts
|
|
169
|
+
**Response approach**: Bump major version. Write migration guide with before/after examples. Add deprecation notices in the previous minor release if possible. Generate changelog with Breaking Changes section first.
|
|
106
170
|
````
|