@jaimevalasek/aioson 1.3.0
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 +456 -0
- package/CODE_OF_CONDUCT.md +12 -0
- package/CONTRIBUTING.md +13 -0
- package/LICENSE +21 -0
- package/README.md +254 -0
- package/bin/aioson.js +4 -0
- package/docs/en/cli-reference.md +398 -0
- package/docs/en/i18n.md +52 -0
- package/docs/en/json-schemas.md +41 -0
- package/docs/en/mcp.md +56 -0
- package/docs/en/parallel.md +82 -0
- package/docs/en/qa-browser.md +339 -0
- package/docs/en/release-flow.md +22 -0
- package/docs/en/release-notes-template.md +41 -0
- package/docs/en/release.md +28 -0
- package/docs/en/schemas/agent-prompt.schema.json +17 -0
- package/docs/en/schemas/agents.schema.json +32 -0
- package/docs/en/schemas/context-validate.schema.json +36 -0
- package/docs/en/schemas/doctor.schema.json +89 -0
- package/docs/en/schemas/error.schema.json +24 -0
- package/docs/en/schemas/i18n-add.schema.json +15 -0
- package/docs/en/schemas/index.json +116 -0
- package/docs/en/schemas/info.schema.json +39 -0
- package/docs/en/schemas/init.schema.json +48 -0
- package/docs/en/schemas/install.schema.json +60 -0
- package/docs/en/schemas/locale-apply.schema.json +30 -0
- package/docs/en/schemas/mcp-doctor.schema.json +95 -0
- package/docs/en/schemas/mcp-init.schema.json +122 -0
- package/docs/en/schemas/package-test.schema.json +24 -0
- package/docs/en/schemas/parallel-assign.schema.json +57 -0
- package/docs/en/schemas/parallel-doctor.schema.json +86 -0
- package/docs/en/schemas/parallel-init.schema.json +53 -0
- package/docs/en/schemas/parallel-status.schema.json +94 -0
- package/docs/en/schemas/setup-context.schema.json +39 -0
- package/docs/en/schemas/smoke.schema.json +23 -0
- package/docs/en/schemas/update.schema.json +48 -0
- package/docs/en/schemas/workflow-plan.schema.json +30 -0
- package/docs/en/web3.md +54 -0
- package/docs/pt/README.md +46 -0
- package/docs/pt/advisor-spec.md +335 -0
- package/docs/pt/agentes.md +453 -0
- package/docs/pt/cenarios.md +1230 -0
- package/docs/pt/clientes-ai.md +224 -0
- package/docs/pt/comandos-cli.md +511 -0
- package/docs/pt/genome-3.0-spec.md +296 -0
- package/docs/pt/guia-engineer.md +226 -0
- package/docs/pt/inicio-rapido.md +138 -0
- package/docs/pt/profiler-system.md +214 -0
- package/docs/pt/runtime-observability.md +72 -0
- package/docs/pt/squad-genoma.md +777 -0
- package/docs/pt/web3.md +797 -0
- package/docs/testing/genome-2.0-manual-regression.md +23 -0
- package/docs/testing/genome-2.0-matrix.md +36 -0
- package/docs/testing/genome-2.0-rollout.md +184 -0
- package/package.json +50 -0
- package/src/agents.js +56 -0
- package/src/cli.js +497 -0
- package/src/commands/agents.js +142 -0
- package/src/commands/cloud.js +1767 -0
- package/src/commands/config.js +90 -0
- package/src/commands/context-validate.js +91 -0
- package/src/commands/doctor.js +123 -0
- package/src/commands/genome-doctor.js +41 -0
- package/src/commands/genome-migrate.js +49 -0
- package/src/commands/i18n-add.js +56 -0
- package/src/commands/info.js +41 -0
- package/src/commands/init.js +75 -0
- package/src/commands/install.js +68 -0
- package/src/commands/locale-apply.js +51 -0
- package/src/commands/locale-diff.js +126 -0
- package/src/commands/mcp-doctor.js +406 -0
- package/src/commands/mcp-init.js +379 -0
- package/src/commands/package-e2e.js +273 -0
- package/src/commands/parallel-assign.js +403 -0
- package/src/commands/parallel-doctor.js +437 -0
- package/src/commands/parallel-init.js +249 -0
- package/src/commands/parallel-status.js +290 -0
- package/src/commands/qa-doctor.js +185 -0
- package/src/commands/qa-init.js +161 -0
- package/src/commands/qa-report.js +58 -0
- package/src/commands/qa-run.js +873 -0
- package/src/commands/qa-scan.js +337 -0
- package/src/commands/runtime.js +948 -0
- package/src/commands/scan-project.js +1107 -0
- package/src/commands/setup-context.js +650 -0
- package/src/commands/smoke.js +426 -0
- package/src/commands/squad-doctor.js +358 -0
- package/src/commands/squad-export.js +46 -0
- package/src/commands/squad-pipeline.js +97 -0
- package/src/commands/squad-repair-genomes.js +39 -0
- package/src/commands/squad-status.js +424 -0
- package/src/commands/squad-validate.js +230 -0
- package/src/commands/test-agents.js +194 -0
- package/src/commands/update.js +55 -0
- package/src/commands/workflow-next.js +594 -0
- package/src/commands/workflow-plan.js +108 -0
- package/src/constants.js +314 -0
- package/src/context-parse-reason.js +22 -0
- package/src/context-writer.js +150 -0
- package/src/context.js +217 -0
- package/src/detector.js +261 -0
- package/src/doctor.js +289 -0
- package/src/execution-gateway.js +461 -0
- package/src/genome-files.js +198 -0
- package/src/genome-format.js +442 -0
- package/src/genome-schema.js +215 -0
- package/src/genomes/bindings.js +281 -0
- package/src/genomes.js +467 -0
- package/src/i18n/index.js +103 -0
- package/src/i18n/messages/en.js +784 -0
- package/src/i18n/messages/es.js +718 -0
- package/src/i18n/messages/fr.js +725 -0
- package/src/i18n/messages/pt-BR.js +818 -0
- package/src/i18n/scaffold.js +64 -0
- package/src/installer.js +232 -0
- package/src/lib/genomes/compat.js +206 -0
- package/src/lib/genomes/migrate.js +90 -0
- package/src/lib/squads/genome-repair.js +49 -0
- package/src/locales.js +84 -0
- package/src/onboarding.js +305 -0
- package/src/parser.js +53 -0
- package/src/prompt-tool.js +20 -0
- package/src/qa-html-report.js +472 -0
- package/src/runtime-store.js +1527 -0
- package/src/squads/apply-genome.js +21 -0
- package/src/squads/genome-binding-service.js +154 -0
- package/src/updater.js +32 -0
- package/src/utils.js +46 -0
- package/src/version.js +50 -0
- package/template/.aioson/advisors/.gitkeep +1 -0
- package/template/.aioson/agents/analyst.md +225 -0
- package/template/.aioson/agents/architect.md +221 -0
- package/template/.aioson/agents/dev.md +201 -0
- package/template/.aioson/agents/discovery-design-doc.md +196 -0
- package/template/.aioson/agents/genoma.md +300 -0
- package/template/.aioson/agents/orchestrator.md +107 -0
- package/template/.aioson/agents/pm.md +89 -0
- package/template/.aioson/agents/product.md +361 -0
- package/template/.aioson/agents/profiler-enricher.md +266 -0
- package/template/.aioson/agents/profiler-forge.md +188 -0
- package/template/.aioson/agents/profiler-researcher.md +245 -0
- package/template/.aioson/agents/qa.md +344 -0
- package/template/.aioson/agents/setup.md +381 -0
- package/template/.aioson/agents/squad.md +837 -0
- package/template/.aioson/agents/ux-ui.md +416 -0
- package/template/.aioson/config.md +56 -0
- package/template/.aioson/context/.gitkeep +0 -0
- package/template/.aioson/context/parallel/.gitkeep +0 -0
- package/template/.aioson/context/spec.md.template +37 -0
- package/template/.aioson/genomas/.gitkeep +0 -0
- package/template/.aioson/locales/en/agents/analyst.md +214 -0
- package/template/.aioson/locales/en/agents/architect.md +210 -0
- package/template/.aioson/locales/en/agents/dev.md +187 -0
- package/template/.aioson/locales/en/agents/discovery-design-doc.md +27 -0
- package/template/.aioson/locales/en/agents/genoma.md +212 -0
- package/template/.aioson/locales/en/agents/orchestrator.md +105 -0
- package/template/.aioson/locales/en/agents/pm.md +77 -0
- package/template/.aioson/locales/en/agents/product.md +310 -0
- package/template/.aioson/locales/en/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/en/agents/qa.md +214 -0
- package/template/.aioson/locales/en/agents/setup.md +342 -0
- package/template/.aioson/locales/en/agents/squad.md +247 -0
- package/template/.aioson/locales/en/agents/ux-ui.md +320 -0
- package/template/.aioson/locales/es/agents/analyst.md +203 -0
- package/template/.aioson/locales/es/agents/architect.md +208 -0
- package/template/.aioson/locales/es/agents/dev.md +183 -0
- package/template/.aioson/locales/es/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/es/agents/genoma.md +102 -0
- package/template/.aioson/locales/es/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/es/agents/pm.md +81 -0
- package/template/.aioson/locales/es/agents/product.md +310 -0
- package/template/.aioson/locales/es/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/es/agents/qa.md +163 -0
- package/template/.aioson/locales/es/agents/setup.md +347 -0
- package/template/.aioson/locales/es/agents/squad.md +247 -0
- package/template/.aioson/locales/es/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/fr/agents/analyst.md +203 -0
- package/template/.aioson/locales/fr/agents/architect.md +208 -0
- package/template/.aioson/locales/fr/agents/dev.md +183 -0
- package/template/.aioson/locales/fr/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/fr/agents/genoma.md +102 -0
- package/template/.aioson/locales/fr/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/fr/agents/pm.md +81 -0
- package/template/.aioson/locales/fr/agents/product.md +310 -0
- package/template/.aioson/locales/fr/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/fr/agents/qa.md +163 -0
- package/template/.aioson/locales/fr/agents/setup.md +347 -0
- package/template/.aioson/locales/fr/agents/squad.md +247 -0
- package/template/.aioson/locales/fr/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/pt-BR/agents/analyst.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/architect.md +213 -0
- package/template/.aioson/locales/pt-BR/agents/dev.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/discovery-design-doc.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/genoma.md +297 -0
- package/template/.aioson/locales/pt-BR/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/pt-BR/agents/pm.md +81 -0
- package/template/.aioson/locales/pt-BR/agents/product.md +316 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/qa.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/setup.md +371 -0
- package/template/.aioson/locales/pt-BR/agents/squad.md +772 -0
- package/template/.aioson/locales/pt-BR/agents/ux-ui.md +322 -0
- package/template/.aioson/mcp/servers.md +24 -0
- package/template/.aioson/profiler-reports/.gitkeep +1 -0
- package/template/.aioson/schemas/content-blueprint.schema.json +30 -0
- package/template/.aioson/schemas/genome-meta.schema.json +150 -0
- package/template/.aioson/schemas/genome.schema.json +115 -0
- package/template/.aioson/schemas/readiness.schema.json +27 -0
- package/template/.aioson/schemas/squad-blueprint.schema.json +172 -0
- package/template/.aioson/schemas/squad-manifest.schema.json +276 -0
- package/template/.aioson/skills/dynamic/README.md +30 -0
- package/template/.aioson/skills/dynamic/cardano-docs.md +16 -0
- package/template/.aioson/skills/dynamic/ethereum-docs.md +17 -0
- package/template/.aioson/skills/dynamic/flux-ui-docs.md +13 -0
- package/template/.aioson/skills/dynamic/laravel-docs.md +41 -0
- package/template/.aioson/skills/dynamic/npm-packages.md +16 -0
- package/template/.aioson/skills/dynamic/solana-docs.md +16 -0
- package/template/.aioson/skills/references/premium-command-center-ui/master-application-prompt.md +79 -0
- package/template/.aioson/skills/references/premium-command-center-ui/operational-ux-playbook.md +253 -0
- package/template/.aioson/skills/references/premium-command-center-ui/quality-validation-checklist.md +82 -0
- package/template/.aioson/skills/references/premium-command-center-ui/visual-system-and-component-patterns.md +270 -0
- package/template/.aioson/skills/static/django-patterns.md +342 -0
- package/template/.aioson/skills/static/fastapi-patterns.md +344 -0
- package/template/.aioson/skills/static/filament-patterns.md +267 -0
- package/template/.aioson/skills/static/flux-ui-components.md +262 -0
- package/template/.aioson/skills/static/git-conventions.md +227 -0
- package/template/.aioson/skills/static/interface-design.md +372 -0
- package/template/.aioson/skills/static/jetstream-setup.md +200 -0
- package/template/.aioson/skills/static/laravel-conventions.md +491 -0
- package/template/.aioson/skills/static/nextjs-patterns.md +321 -0
- package/template/.aioson/skills/static/node-express-patterns.md +317 -0
- package/template/.aioson/skills/static/node-typescript-patterns.md +282 -0
- package/template/.aioson/skills/static/premium-command-center-ui.md +190 -0
- package/template/.aioson/skills/static/rails-conventions.md +307 -0
- package/template/.aioson/skills/static/react-motion-patterns.md +577 -0
- package/template/.aioson/skills/static/static-html-patterns.md +1935 -0
- package/template/.aioson/skills/static/tall-stack-patterns.md +286 -0
- package/template/.aioson/skills/static/ui-ux-modern.md +75 -0
- package/template/.aioson/skills/static/web3-cardano-patterns.md +337 -0
- package/template/.aioson/skills/static/web3-ethereum-patterns.md +310 -0
- package/template/.aioson/skills/static/web3-security-checklist.md +284 -0
- package/template/.aioson/skills/static/web3-solana-patterns.md +324 -0
- package/template/.aioson/squads/.artisan/.gitkeep +0 -0
- package/template/.aioson/squads/.gitkeep +0 -0
- package/template/.aioson/squads/memory.md +5 -0
- package/template/.aioson/tasks/squad-analyze.md +83 -0
- package/template/.aioson/tasks/squad-create.md +99 -0
- package/template/.aioson/tasks/squad-design.md +100 -0
- package/template/.aioson/tasks/squad-export.md +20 -0
- package/template/.aioson/tasks/squad-extend.md +68 -0
- package/template/.aioson/tasks/squad-pipeline.md +122 -0
- package/template/.aioson/tasks/squad-repair.md +85 -0
- package/template/.aioson/tasks/squad-validate.md +58 -0
- package/template/.aioson/templates/squads/content-basic/template.json +21 -0
- package/template/.aioson/templates/squads/media-channel/template.json +24 -0
- package/template/.aioson/templates/squads/research-analysis/template.json +22 -0
- package/template/.aioson/templates/squads/software-delivery/template.json +21 -0
- package/template/.claude/commands/aioson/analyst.md +5 -0
- package/template/.claude/commands/aioson/architect.md +5 -0
- package/template/.claude/commands/aioson/dev.md +5 -0
- package/template/.claude/commands/aioson/orchestrator.md +5 -0
- package/template/.claude/commands/aioson/pm.md +5 -0
- package/template/.claude/commands/aioson/qa.md +5 -0
- package/template/.claude/commands/aioson/setup.md +5 -0
- package/template/.claude/commands/aioson/ux-ui.md +5 -0
- package/template/.gemini/GEMINI.md +10 -0
- package/template/.gemini/commands/aios-analyst.toml +4 -0
- package/template/.gemini/commands/aios-architect.toml +7 -0
- package/template/.gemini/commands/aios-dev.toml +8 -0
- package/template/.gemini/commands/aios-discovery-design-doc.toml +4 -0
- package/template/.gemini/commands/aios-orchestrator.toml +8 -0
- package/template/.gemini/commands/aios-pm.toml +8 -0
- package/template/.gemini/commands/aios-product.toml +4 -0
- package/template/.gemini/commands/aios-qa.toml +6 -0
- package/template/.gemini/commands/aios-setup.toml +3 -0
- package/template/.gemini/commands/aios-ux-ui.toml +8 -0
- package/template/AGENTS.md +67 -0
- package/template/CLAUDE.md +31 -0
- package/template/OPENCODE.md +24 -0
- package/template/aioson-models.json +40 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Web3 Solana Patterns
|
|
2
|
+
|
|
3
|
+
> Anchor framework, PDAs, and account model. Rust programs that don't leak lamports.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Solana account model — understand before coding
|
|
8
|
+
|
|
9
|
+
Unlike Ethereum where contract storage is internal, **Solana programs are stateless**. All state lives in separate accounts that the program owns.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Program Account → executable code (your Anchor program)
|
|
13
|
+
Data Account → state storage (owned by the program)
|
|
14
|
+
Signer Account → user wallet (signs transactions)
|
|
15
|
+
System Account → system program (creates accounts, transfers SOL)
|
|
16
|
+
Token Account → holds SPL tokens (owned by Token Program)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**PDA (Program Derived Address):** A deterministic account address derived from seeds + program ID. No private key — only the program can sign for it.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Anchor program structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
programs/
|
|
27
|
+
my-program/
|
|
28
|
+
src/
|
|
29
|
+
lib.rs ← entry point, declare_id!, mod declarations
|
|
30
|
+
instructions/
|
|
31
|
+
initialize.rs ← one file per instruction
|
|
32
|
+
deposit.rs
|
|
33
|
+
withdraw.rs
|
|
34
|
+
state/
|
|
35
|
+
pool.rs ← account data structures
|
|
36
|
+
config.rs
|
|
37
|
+
errors.rs ← custom error codes
|
|
38
|
+
constants.rs ← seeds, limits, fees
|
|
39
|
+
Cargo.toml
|
|
40
|
+
tests/
|
|
41
|
+
my-program.ts ← Anchor TypeScript tests
|
|
42
|
+
Anchor.toml
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Account data structures
|
|
48
|
+
|
|
49
|
+
```rust
|
|
50
|
+
// state/pool.rs
|
|
51
|
+
use anchor_lang::prelude::*;
|
|
52
|
+
|
|
53
|
+
#[account]
|
|
54
|
+
#[derive(Default)]
|
|
55
|
+
pub struct Pool {
|
|
56
|
+
pub authority: Pubkey, // 32
|
|
57
|
+
pub token_mint: Pubkey, // 32
|
|
58
|
+
pub total_deposits: u64, // 8
|
|
59
|
+
pub fee_bps: u16, // 2
|
|
60
|
+
pub bump: u8, // 1 ← always store the PDA bump
|
|
61
|
+
pub _padding: [u8; 5], // 5 ← align to 8-byte boundary
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
impl Pool {
|
|
65
|
+
// Calculate space: discriminator (8) + fields
|
|
66
|
+
pub const LEN: usize = 8 + 32 + 32 + 8 + 2 + 1 + 5;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Instructions with account validation
|
|
73
|
+
|
|
74
|
+
```rust
|
|
75
|
+
// instructions/initialize.rs
|
|
76
|
+
use anchor_lang::prelude::*;
|
|
77
|
+
use crate::{state::Pool, constants::POOL_SEED, errors::ProtocolError};
|
|
78
|
+
|
|
79
|
+
#[derive(Accounts)]
|
|
80
|
+
pub struct Initialize<'info> {
|
|
81
|
+
#[account(
|
|
82
|
+
init,
|
|
83
|
+
payer = authority,
|
|
84
|
+
space = Pool::LEN,
|
|
85
|
+
seeds = [POOL_SEED, token_mint.key().as_ref()],
|
|
86
|
+
bump
|
|
87
|
+
)]
|
|
88
|
+
pub pool: Account<'info, Pool>,
|
|
89
|
+
|
|
90
|
+
pub token_mint: Account<'info, anchor_spl::token::Mint>,
|
|
91
|
+
|
|
92
|
+
#[account(mut)]
|
|
93
|
+
pub authority: Signer<'info>,
|
|
94
|
+
|
|
95
|
+
pub system_program: Program<'info, System>,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
pub fn handler(ctx: Context<Initialize>, fee_bps: u16) -> Result<()> {
|
|
99
|
+
require!(fee_bps <= 1_000, ProtocolError::FeeTooHigh); // max 10%
|
|
100
|
+
|
|
101
|
+
let pool = &mut ctx.accounts.pool;
|
|
102
|
+
pool.authority = ctx.accounts.authority.key();
|
|
103
|
+
pool.token_mint = ctx.accounts.token_mint.key();
|
|
104
|
+
pool.fee_bps = fee_bps;
|
|
105
|
+
pool.bump = ctx.bumps.pool; // store bump for future PDA signing
|
|
106
|
+
|
|
107
|
+
Ok(())
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## PDA signing (CPI with PDA as signer)
|
|
114
|
+
|
|
115
|
+
```rust
|
|
116
|
+
// When the program needs to sign on behalf of a PDA
|
|
117
|
+
pub fn withdraw(ctx: Context<Withdraw>, amount: u64) -> Result<()> {
|
|
118
|
+
let pool = &ctx.accounts.pool;
|
|
119
|
+
let token_mint_key = pool.token_mint.key();
|
|
120
|
+
|
|
121
|
+
// Seeds must match exactly what was used to derive the PDA
|
|
122
|
+
let seeds = &[
|
|
123
|
+
POOL_SEED,
|
|
124
|
+
token_mint_key.as_ref(),
|
|
125
|
+
&[pool.bump],
|
|
126
|
+
];
|
|
127
|
+
let signer_seeds = &[&seeds[..]];
|
|
128
|
+
|
|
129
|
+
// CPI transfer signed by the pool PDA
|
|
130
|
+
anchor_spl::token::transfer(
|
|
131
|
+
CpiContext::new_with_signer(
|
|
132
|
+
ctx.accounts.token_program.to_account_info(),
|
|
133
|
+
anchor_spl::token::Transfer {
|
|
134
|
+
from: ctx.accounts.pool_token_account.to_account_info(),
|
|
135
|
+
to: ctx.accounts.user_token_account.to_account_info(),
|
|
136
|
+
authority: ctx.accounts.pool.to_account_info(),
|
|
137
|
+
},
|
|
138
|
+
signer_seeds,
|
|
139
|
+
),
|
|
140
|
+
amount,
|
|
141
|
+
)?;
|
|
142
|
+
|
|
143
|
+
Ok(())
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Custom errors
|
|
150
|
+
|
|
151
|
+
```rust
|
|
152
|
+
// errors.rs
|
|
153
|
+
use anchor_lang::prelude::*;
|
|
154
|
+
|
|
155
|
+
#[error_code]
|
|
156
|
+
pub enum ProtocolError {
|
|
157
|
+
#[msg("Fee exceeds maximum allowed (10%)")]
|
|
158
|
+
FeeTooHigh,
|
|
159
|
+
|
|
160
|
+
#[msg("Insufficient balance for withdrawal")]
|
|
161
|
+
InsufficientBalance,
|
|
162
|
+
|
|
163
|
+
#[msg("Pool is currently paused")]
|
|
164
|
+
PoolPaused,
|
|
165
|
+
|
|
166
|
+
#[msg("Unauthorized: only pool authority can perform this action")]
|
|
167
|
+
Unauthorized,
|
|
168
|
+
|
|
169
|
+
#[msg("Arithmetic overflow")]
|
|
170
|
+
Overflow,
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Security validations
|
|
177
|
+
|
|
178
|
+
```rust
|
|
179
|
+
// Always validate: ownership, signer, mint, amounts
|
|
180
|
+
|
|
181
|
+
#[derive(Accounts)]
|
|
182
|
+
pub struct Deposit<'info> {
|
|
183
|
+
#[account(
|
|
184
|
+
mut,
|
|
185
|
+
seeds = [POOL_SEED, pool.token_mint.as_ref()],
|
|
186
|
+
bump = pool.bump, // validates PDA derivation
|
|
187
|
+
has_one = token_mint, // mint must match pool's mint
|
|
188
|
+
)]
|
|
189
|
+
pub pool: Account<'info, Pool>,
|
|
190
|
+
|
|
191
|
+
#[account(
|
|
192
|
+
mut,
|
|
193
|
+
associated_token::mint = token_mint,
|
|
194
|
+
associated_token::authority = user, // validates ownership
|
|
195
|
+
)]
|
|
196
|
+
pub user_token_account: Account<'info, TokenAccount>,
|
|
197
|
+
|
|
198
|
+
#[account(
|
|
199
|
+
mut,
|
|
200
|
+
associated_token::mint = token_mint,
|
|
201
|
+
associated_token::authority = pool, // pool owns this account
|
|
202
|
+
)]
|
|
203
|
+
pub pool_token_account: Account<'info, TokenAccount>,
|
|
204
|
+
|
|
205
|
+
pub token_mint: Account<'info, Mint>,
|
|
206
|
+
|
|
207
|
+
pub user: Signer<'info>, // must sign the transaction
|
|
208
|
+
pub token_program: Program<'info, Token>,
|
|
209
|
+
pub associated_token_program: Program<'info, AssociatedToken>,
|
|
210
|
+
pub system_program: Program<'info, System>,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
pub fn handler(ctx: Context<Deposit>, amount: u64) -> Result<()> {
|
|
214
|
+
require!(amount > 0, ProtocolError::InsufficientBalance);
|
|
215
|
+
require!(!ctx.accounts.pool.paused, ProtocolError::PoolPaused);
|
|
216
|
+
|
|
217
|
+
let pool = &mut ctx.accounts.pool;
|
|
218
|
+
|
|
219
|
+
// Safe arithmetic — use checked operations
|
|
220
|
+
pool.total_deposits = pool.total_deposits
|
|
221
|
+
.checked_add(amount)
|
|
222
|
+
.ok_or(ProtocolError::Overflow)?;
|
|
223
|
+
|
|
224
|
+
// ... transfer tokens
|
|
225
|
+
Ok(())
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Compute budget management
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
// client-side: add compute budget for complex instructions
|
|
235
|
+
import { ComputeBudgetProgram } from '@solana/web3.js';
|
|
236
|
+
|
|
237
|
+
const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
|
|
238
|
+
units: 400_000, // increase from default 200k for complex CPI chains
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
|
|
242
|
+
microLamports: 1_000, // priority fee for faster inclusion
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
const tx = new Transaction()
|
|
246
|
+
.add(modifyComputeUnits)
|
|
247
|
+
.add(addPriorityFee)
|
|
248
|
+
.add(yourInstruction);
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Anchor tests
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
import * as anchor from '@coral-xyz/anchor';
|
|
257
|
+
import { Program } from '@coral-xyz/anchor';
|
|
258
|
+
import { PublicKey, SystemProgram } from '@solana/web3.js';
|
|
259
|
+
import { TOKEN_PROGRAM_ID, createMint, createAssociatedTokenAccount, mintTo } from '@solana/spl-token';
|
|
260
|
+
import { MyProgram } from '../target/types/my_program';
|
|
261
|
+
import { expect } from 'chai';
|
|
262
|
+
|
|
263
|
+
describe('my-program', () => {
|
|
264
|
+
const provider = anchor.AnchorProvider.env();
|
|
265
|
+
anchor.setProvider(provider);
|
|
266
|
+
const program = anchor.workspace.MyProgram as Program<MyProgram>;
|
|
267
|
+
|
|
268
|
+
let tokenMint: PublicKey;
|
|
269
|
+
let [poolPda, poolBump]: [PublicKey, number];
|
|
270
|
+
|
|
271
|
+
before(async () => {
|
|
272
|
+
tokenMint = await createMint(provider.connection, provider.wallet.payer, provider.wallet.publicKey, null, 6);
|
|
273
|
+
[poolPda, poolBump] = PublicKey.findProgramAddressSync(
|
|
274
|
+
[Buffer.from('pool'), tokenMint.toBuffer()],
|
|
275
|
+
program.programId
|
|
276
|
+
);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('initializes pool with correct state', async () => {
|
|
280
|
+
const feeBps = 300; // 3%
|
|
281
|
+
|
|
282
|
+
await program.methods
|
|
283
|
+
.initialize(feeBps)
|
|
284
|
+
.accounts({
|
|
285
|
+
pool: poolPda,
|
|
286
|
+
tokenMint,
|
|
287
|
+
authority: provider.wallet.publicKey,
|
|
288
|
+
systemProgram: SystemProgram.programId,
|
|
289
|
+
})
|
|
290
|
+
.rpc();
|
|
291
|
+
|
|
292
|
+
const pool = await program.account.pool.fetch(poolPda);
|
|
293
|
+
expect(pool.feeBps).to.equal(feeBps);
|
|
294
|
+
expect(pool.bump).to.equal(poolBump);
|
|
295
|
+
expect(pool.authority.toString()).to.equal(provider.wallet.publicKey.toString());
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('rejects fee above maximum', async () => {
|
|
299
|
+
try {
|
|
300
|
+
await program.methods.initialize(1_001).accounts({ ... }).rpc();
|
|
301
|
+
expect.fail('Should have thrown');
|
|
302
|
+
} catch (err: any) {
|
|
303
|
+
expect(err.error.errorCode.code).to.equal('FeeTooHigh');
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## ALWAYS
|
|
312
|
+
- Store PDA bump in the account and use it for future CPI signing
|
|
313
|
+
- Use `has_one`, `constraint`, and `associated_token::authority` for account validation
|
|
314
|
+
- Validate all amounts are > 0 before operations
|
|
315
|
+
- Use `checked_add`, `checked_sub`, `checked_mul` — never plain arithmetic
|
|
316
|
+
- Derive PDAs client-side with `PublicKey.findProgramAddressSync` and pass as account
|
|
317
|
+
- One file per instruction in `instructions/`
|
|
318
|
+
|
|
319
|
+
## NEVER
|
|
320
|
+
- Trust user-provided account ownership — use Anchor constraints
|
|
321
|
+
- Use unbounded loops (Solana has compute unit limits)
|
|
322
|
+
- Skip PDA bump storage (you'll need it for CPI signing)
|
|
323
|
+
- Mix up `lamports` (SOL × 10⁹) and token amounts (token × 10^decimals)
|
|
324
|
+
- Deploy to mainnet without testing on devnet with realistic account sizes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Task: Squad Analyze
|
|
2
|
+
|
|
3
|
+
> Diagnostica um squad existente: cobertura, redundâncias, gaps, oportunidades.
|
|
4
|
+
|
|
5
|
+
## Quando usar
|
|
6
|
+
- `@squad analyze <slug>`
|
|
7
|
+
- Quando o usuário quer melhorar um squad existente
|
|
8
|
+
|
|
9
|
+
## Entrada
|
|
10
|
+
- slug do squad existente
|
|
11
|
+
|
|
12
|
+
## Processo
|
|
13
|
+
|
|
14
|
+
### Passo 1 — Inventário de componentes
|
|
15
|
+
Leia o squad.manifest.json e o filesystem real. Monte um inventário:
|
|
16
|
+
- Executores: quantos, quais, com/sem skills, com/sem genomes
|
|
17
|
+
- Skills: declaradas vs. instaladas em skills/
|
|
18
|
+
- Content blueprints: quantos, com/sem sections
|
|
19
|
+
- Templates: existem em templates/?
|
|
20
|
+
- Docs: design-doc.md existe? readiness.md existe?
|
|
21
|
+
- Output: há sessões HTML geradas?
|
|
22
|
+
|
|
23
|
+
### Passo 2 — Métricas de cobertura
|
|
24
|
+
Calcule:
|
|
25
|
+
- % de executores com skills declaradas
|
|
26
|
+
- % de executores com genomes
|
|
27
|
+
- % de content blueprints com sections completas
|
|
28
|
+
- % de docs presentes (design-doc, readiness)
|
|
29
|
+
- Consistency score: manifest vs filesystem (arquivos referenciados que existem)
|
|
30
|
+
|
|
31
|
+
### Passo 3 — Diagnóstico de problemas
|
|
32
|
+
Identifique:
|
|
33
|
+
- Sobreposição de responsabilidades entre executores (roles muito parecidos)
|
|
34
|
+
- Skills faltantes (executor sem nenhuma skill)
|
|
35
|
+
- Blueprints genéricos demais (sem sections ou com sections vazias)
|
|
36
|
+
- Readiness fraco (dimensões blocked ou partial)
|
|
37
|
+
- Excesso de complexidade (mais de 6 executores sem justificativa)
|
|
38
|
+
- Arquivos órfãos (existem no filesystem mas não no manifesto)
|
|
39
|
+
- Referências quebradas (no manifesto mas não no filesystem)
|
|
40
|
+
|
|
41
|
+
### Passo 4 — Sugestões priorizadas
|
|
42
|
+
Gere sugestões com prioridade (high/medium/low):
|
|
43
|
+
- high: referências quebradas, manifest inconsistente, executor sem role
|
|
44
|
+
- medium: skills faltantes, blueprints incompletos, docs ausentes
|
|
45
|
+
- low: readiness parcial, genomes não aplicados, output vazio
|
|
46
|
+
|
|
47
|
+
### Passo 5 — Relatório
|
|
48
|
+
Apresente com este formato:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
═══ Squad Analysis: <slug> ═══
|
|
52
|
+
|
|
53
|
+
Overview
|
|
54
|
+
Name: <name> | Mode: <mode> | Version: <version>
|
|
55
|
+
|
|
56
|
+
Components
|
|
57
|
+
Executors: <n> (<n> with skills, <n> with genomes)
|
|
58
|
+
Skills: <n> declared, <n> installed
|
|
59
|
+
Blueprints: <n> (<n> complete)
|
|
60
|
+
Docs: <status>
|
|
61
|
+
|
|
62
|
+
Coverage
|
|
63
|
+
Skills: ████░░░░░░ 40%
|
|
64
|
+
Genomes: ██████░░░░ 60%
|
|
65
|
+
Docs: ████████░░ 80%
|
|
66
|
+
Manifest: ██████████ 100%
|
|
67
|
+
|
|
68
|
+
Suggestions (<n>)
|
|
69
|
+
🔴 <high priority item>
|
|
70
|
+
🟡 <medium priority item>
|
|
71
|
+
🟢 <low priority item>
|
|
72
|
+
|
|
73
|
+
Next: @squad extend <slug> to address suggestions
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Saída
|
|
77
|
+
- Relatório no chat
|
|
78
|
+
- Se --format markdown: salvar em .aioson/squads/<slug>/docs/ANALYSIS.md
|
|
79
|
+
- Se --format json: saída JSON parseable
|
|
80
|
+
|
|
81
|
+
## Regras
|
|
82
|
+
- NÃO modifique nada — apenas diagnostique e recomende
|
|
83
|
+
- SEMPRE sugira o próximo comando concreto para cada problema
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Task: Squad Create
|
|
2
|
+
|
|
3
|
+
> Fase de criação do lifecycle. Gera o pacote completo a partir de um blueprint.
|
|
4
|
+
|
|
5
|
+
## Quando usar
|
|
6
|
+
- `@squad create <slug>` — invocação direta
|
|
7
|
+
- Automaticamente após `@squad design` ser aprovado
|
|
8
|
+
- `@squad` fluxo rápido (após design inline ser aprovado)
|
|
9
|
+
|
|
10
|
+
## Entrada
|
|
11
|
+
- Blueprint em `.aioson/squads/.designs/<slug>.blueprint.json`
|
|
12
|
+
- Se não existe blueprint: instrua o usuário a rodar `@squad design <slug>` primeiro
|
|
13
|
+
- OU: se o usuário chamou `@squad` sem subcomando, rode design + create em sequência
|
|
14
|
+
|
|
15
|
+
## Processo
|
|
16
|
+
|
|
17
|
+
### Passo 1 — Ler blueprint
|
|
18
|
+
Leia `.aioson/squads/.designs/<slug>.blueprint.json` e valide que os campos obrigatórios existem (slug, name, problem, goal, mode, executors).
|
|
19
|
+
|
|
20
|
+
### Passo 2 — Criar estrutura de diretórios
|
|
21
|
+
```
|
|
22
|
+
.aioson/squads/<slug>/
|
|
23
|
+
├── agents/
|
|
24
|
+
│ ├── agents.md # Manifesto textual
|
|
25
|
+
│ ├── orquestrador.md # Orquestrador
|
|
26
|
+
│ └── <executor-slug>.md # Um por executor
|
|
27
|
+
├── skills/
|
|
28
|
+
├── templates/
|
|
29
|
+
├── docs/
|
|
30
|
+
│ ├── design-doc.md
|
|
31
|
+
│ └── readiness.md
|
|
32
|
+
└── squad.manifest.json # Manifesto JSON formal
|
|
33
|
+
|
|
34
|
+
output/<slug>/ # Diretório de output
|
|
35
|
+
aios-logs/<slug>/ # Diretório de logs
|
|
36
|
+
media/<slug>/ # Diretório de mídia
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Passo 3 — Gerar squad.manifest.json
|
|
40
|
+
Monte o manifesto a partir do blueprint. O JSON deve seguir o schema `squad-manifest.schema.json`. Copie executors, skills, mcps, genomes, contentBlueprints do blueprint. Adicione package paths e rules.
|
|
41
|
+
|
|
42
|
+
### Passo 4 — Gerar agents.md (manifesto textual)
|
|
43
|
+
Siga o formato existente no squad.md atual:
|
|
44
|
+
```markdown
|
|
45
|
+
# Squad <name>
|
|
46
|
+
|
|
47
|
+
## Mission
|
|
48
|
+
[do blueprint.mission]
|
|
49
|
+
|
|
50
|
+
## Does
|
|
51
|
+
[derivado do scope]
|
|
52
|
+
|
|
53
|
+
## Does not do
|
|
54
|
+
[derivado do outOfScope]
|
|
55
|
+
|
|
56
|
+
## Permanent executors
|
|
57
|
+
- @orquestrador — [role]
|
|
58
|
+
- @<slug> — [role]
|
|
59
|
+
|
|
60
|
+
## Squad skills
|
|
61
|
+
## Squad MCPs
|
|
62
|
+
## Subagent policy
|
|
63
|
+
## Outputs and review
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Passo 5 — Gerar cada executor
|
|
67
|
+
Para cada executor no blueprint, crie `.aioson/squads/<slug>/agents/<executor-slug>.md` seguindo o template atual do squad.md (seção "Step 2 — Generate each specialist agent"):
|
|
68
|
+
- Header com `# Agent @<slug>` + bloco ACTIVATED
|
|
69
|
+
- Mission, Quick context, Active genomes, Focus, Response standard, Hard constraints, Output contract
|
|
70
|
+
|
|
71
|
+
### Passo 6 — Gerar orquestrador
|
|
72
|
+
Crie `.aioson/squads/<slug>/agents/orquestrador.md` seguindo o template atual (seção "Step 3 — Generate the orchestrator").
|
|
73
|
+
|
|
74
|
+
### Passo 7 — Gerar docs
|
|
75
|
+
- `docs/design-doc.md`: resumo do design derivado do blueprint
|
|
76
|
+
- `docs/readiness.md`: estado de readiness derivado do blueprint
|
|
77
|
+
|
|
78
|
+
### Passo 8 — Registrar nos gateways
|
|
79
|
+
Atualize `CLAUDE.md` e `AGENTS.md` no root do projeto conforme as regras existentes no squad.md.
|
|
80
|
+
|
|
81
|
+
### Passo 9 — Salvar metadata
|
|
82
|
+
Salve `.aioson/squads/<slug>/squad.md` no formato existente.
|
|
83
|
+
|
|
84
|
+
### Passo 10 — Rodar validate
|
|
85
|
+
Após criar tudo, execute mentalmente a task squad-validate (leia `.aioson/tasks/squad-validate.md`) para verificar que o pacote está consistente.
|
|
86
|
+
|
|
87
|
+
### Passo 11 — Warm-up round
|
|
88
|
+
Siga as regras existentes no squad.md: mostre cada especialista com problem reading, initial recommendation, main risk, suggested next step.
|
|
89
|
+
|
|
90
|
+
## Saída
|
|
91
|
+
- Pacote completo em `.aioson/squads/<slug>/`
|
|
92
|
+
- CLAUDE.md e AGENTS.md atualizados
|
|
93
|
+
- Warm-up round executado
|
|
94
|
+
|
|
95
|
+
## Regras
|
|
96
|
+
- SEMPRE leia o blueprint antes de gerar
|
|
97
|
+
- SIGA os templates de executor e orquestrador do squad.md original
|
|
98
|
+
- MANTENHA o HTML deliverable após cada rodada (regra existente)
|
|
99
|
+
- NÃO pule o warm-up — é mandatório
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Task: Squad Design
|
|
2
|
+
|
|
3
|
+
> Fase de design do lifecycle do squad. Produz um blueprint intermediário.
|
|
4
|
+
|
|
5
|
+
## Quando usar
|
|
6
|
+
- `@squad design <nome>` — invocação direta
|
|
7
|
+
- `@squad` sem subcomando quando não existe blueprint para o slug
|
|
8
|
+
|
|
9
|
+
## Entrada
|
|
10
|
+
- Contexto do usuário: domínio, objetivo, constraints, roles desejados
|
|
11
|
+
- Opcional: documentação fonte (arquivos `.md`, texto colado, screenshots)
|
|
12
|
+
- Opcional: domínio hint para guiar a análise
|
|
13
|
+
|
|
14
|
+
## Processo
|
|
15
|
+
|
|
16
|
+
### Passo 0 — Verificar artisan input e templates disponíveis
|
|
17
|
+
|
|
18
|
+
Se o usuário forneceu `--from-artisan <id>`:
|
|
19
|
+
1. Procure `.aioson/squads/.artisan/<id>.md`
|
|
20
|
+
2. Se encontrar, leia o Squad PRD
|
|
21
|
+
3. Extraia: domain, goal, mode, executors propostos, skills, constraints, content blueprints
|
|
22
|
+
4. Use como base para o blueprint — pule para o Passo 5 (calcular readiness)
|
|
23
|
+
5. Mostre ao usuário: "Li o PRD do Artisan. Posso gerar o blueprint com base nele — quer ajustar algo?"
|
|
24
|
+
|
|
25
|
+
Caso contrário, verifique templates:
|
|
26
|
+
Verifique se existe `.aioson/templates/squads/`. Se existir, liste os templates disponíveis e pergunte:
|
|
27
|
+
"Quer partir de um template? Opções: content-basic, research-analysis, software-delivery, media-channel — ou começar do zero."
|
|
28
|
+
Se o usuário escolher um template, leia o `template.json` e use como base para o blueprint (executores, content blueprints, mode).
|
|
29
|
+
|
|
30
|
+
### Passo 1 — Coletar contexto mínimo
|
|
31
|
+
Pergunte em um bloco só (não faça múltiplas rodadas):
|
|
32
|
+
1. Domínio ou tópico do squad
|
|
33
|
+
2. Problema principal ou objetivo
|
|
34
|
+
3. Tipo de output esperado (artigos, scripts, código, análise, etc.)
|
|
35
|
+
4. Constraints (audiência, tom, nível técnico, idioma)
|
|
36
|
+
5. (opcional) Roles específicos desejados
|
|
37
|
+
|
|
38
|
+
Se o usuário já forneceu contexto suficiente (texto, docs, imagens), infira as respostas e siga em frente. Pergunte somente se há lacunas materiais.
|
|
39
|
+
|
|
40
|
+
### Passo 2 — Derivar design-doc mental
|
|
41
|
+
Antes de definir executores, consolide:
|
|
42
|
+
- Problema que está sendo resolvido
|
|
43
|
+
- Objetivo prático do squad
|
|
44
|
+
- Scope e out-of-scope
|
|
45
|
+
- Risks e assumptions
|
|
46
|
+
- Skills e docs que precisam entrar no contexto
|
|
47
|
+
- Mode do squad (content | software | research | mixed)
|
|
48
|
+
|
|
49
|
+
### Passo 3 — Definir executores
|
|
50
|
+
Determine 3-5 roles especializados. Para cada executor, defina:
|
|
51
|
+
- slug (kebab-case)
|
|
52
|
+
- title
|
|
53
|
+
- role (uma frase)
|
|
54
|
+
- focus (3-5 bullets)
|
|
55
|
+
- skills que vai usar
|
|
56
|
+
- genomes que herda
|
|
57
|
+
|
|
58
|
+
Inclua sempre um `orquestrador`.
|
|
59
|
+
|
|
60
|
+
### Passo 4 — Definir content blueprints
|
|
61
|
+
Se o squad é content-oriented, defina pelo menos 1 content blueprint com:
|
|
62
|
+
- slug, contentType, layoutType
|
|
63
|
+
- sections com key, label, blockTypes
|
|
64
|
+
|
|
65
|
+
### Passo 5 — Calcular readiness
|
|
66
|
+
Avalie cada dimensão:
|
|
67
|
+
- contextReady: há contexto suficiente?
|
|
68
|
+
- blueprintReady: o blueprint está completo?
|
|
69
|
+
- generationReady: dá para gerar os executores?
|
|
70
|
+
|
|
71
|
+
### Passo 6 — Gerar blueprint JSON
|
|
72
|
+
Salve o blueprint em `.aioson/squads/.designs/<slug>.blueprint.json`
|
|
73
|
+
|
|
74
|
+
O JSON deve seguir o schema `squad-blueprint.schema.json`.
|
|
75
|
+
|
|
76
|
+
Gere um UUID para o campo `id`. Use `new Date().toISOString()` para `createdAt`.
|
|
77
|
+
|
|
78
|
+
### Passo 7 — Apresentar resumo
|
|
79
|
+
Mostre ao usuário:
|
|
80
|
+
- Executores propostos com roles
|
|
81
|
+
- Content blueprints definidos
|
|
82
|
+
- Assumptions feitas
|
|
83
|
+
- Risks identificados
|
|
84
|
+
- Readiness status
|
|
85
|
+
- Confidence score
|
|
86
|
+
|
|
87
|
+
Pergunte se quer ajustar algo antes de criar.
|
|
88
|
+
|
|
89
|
+
## Saída
|
|
90
|
+
- Arquivo: `.aioson/squads/.designs/<slug>.blueprint.json`
|
|
91
|
+
- Resumo no chat para review do usuário
|
|
92
|
+
|
|
93
|
+
## Próximo passo
|
|
94
|
+
- Se aprovado: `@squad create <slug>` (que lê o blueprint e gera o pacote)
|
|
95
|
+
- Se precisa ajuste: o usuário indica e o design é atualizado
|
|
96
|
+
|
|
97
|
+
## Regras
|
|
98
|
+
- NÃO crie o pacote do squad aqui — isso é responsabilidade da task create
|
|
99
|
+
- NÃO pule o blueprint — ele é obrigatório
|
|
100
|
+
- MANTENHA o blueprint leve — o LLM preenche lacunas na fase create
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Task: Squad Export
|
|
2
|
+
|
|
3
|
+
> Empacota um squad para reutilização em outro projeto.
|
|
4
|
+
|
|
5
|
+
## Quando usar
|
|
6
|
+
- `@squad export <slug>`
|
|
7
|
+
|
|
8
|
+
## Processo
|
|
9
|
+
|
|
10
|
+
1. Validar o squad (rodar validate)
|
|
11
|
+
2. Se inválido: abortar com sugestão de correção
|
|
12
|
+
3. Coletar todos os arquivos do pacote:
|
|
13
|
+
- .aioson/squads/<slug>/ (tudo)
|
|
14
|
+
- NÃO incluir: output/, aios-logs/, media/ (são dados de sessão)
|
|
15
|
+
4. Gerar archive: `.aioson/squads/exports/<slug>.aios-squad.tar.gz`
|
|
16
|
+
5. Incluir um `import-instructions.md` no archive
|
|
17
|
+
|
|
18
|
+
## Saída
|
|
19
|
+
- Arquivo .tar.gz portável
|
|
20
|
+
- Instruções de import no chat
|