@nac3/forge-cli 0.2.0-alpha.59z.121 → 0.2.0-alpha.59z.158
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/dist/agents/bridge.d.ts +69 -0
- package/dist/agents/bridge.d.ts.map +1 -0
- package/dist/agents/bridge.js +295 -0
- package/dist/agents/bridge.js.map +1 -0
- package/dist/agents/cli_real.d.ts +38 -0
- package/dist/agents/cli_real.d.ts.map +1 -0
- package/dist/agents/cli_real.js +46 -0
- package/dist/agents/cli_real.js.map +1 -0
- package/dist/agents/config_schema.d.ts +1 -1
- package/dist/agents/config_schema.d.ts.map +1 -1
- package/dist/agents/config_schema.js +16 -0
- package/dist/agents/config_schema.js.map +1 -1
- package/dist/agents/defaults.d.ts.map +1 -1
- package/dist/agents/defaults.js.map +1 -1
- package/dist/agents/delegate.d.ts +36 -0
- package/dist/agents/delegate.d.ts.map +1 -0
- package/dist/agents/delegate.js +68 -0
- package/dist/agents/delegate.js.map +1 -0
- package/dist/agents/iterative_step.d.ts +95 -0
- package/dist/agents/iterative_step.d.ts.map +1 -0
- package/dist/agents/iterative_step.js +249 -0
- package/dist/agents/iterative_step.js.map +1 -0
- package/dist/agents/llm_step.d.ts +50 -0
- package/dist/agents/llm_step.d.ts.map +1 -0
- package/dist/agents/llm_step.js +28 -0
- package/dist/agents/llm_step.js.map +1 -0
- package/dist/agents/real_step_factory.d.ts +95 -0
- package/dist/agents/real_step_factory.d.ts.map +1 -0
- package/dist/agents/real_step_factory.js +51 -0
- package/dist/agents/real_step_factory.js.map +1 -0
- package/dist/agents/runner.d.ts +14 -0
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +10 -1
- package/dist/agents/runner.js.map +1 -1
- package/dist/agents/runtime.d.ts +115 -0
- package/dist/agents/runtime.d.ts.map +1 -0
- package/dist/agents/runtime.js +429 -0
- package/dist/agents/runtime.js.map +1 -0
- package/dist/agents/system_prompt.d.ts +36 -0
- package/dist/agents/system_prompt.d.ts.map +1 -0
- package/dist/agents/system_prompt.js +101 -0
- package/dist/agents/system_prompt.js.map +1 -0
- package/dist/agents/types.d.ts +12 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/bin/yf.d.ts.map +1 -1
- package/dist/bin/yf.js +9 -0
- package/dist/bin/yf.js.map +1 -1
- package/dist/chat/claude_cli.d.ts +42 -0
- package/dist/chat/claude_cli.d.ts.map +1 -0
- package/dist/chat/claude_cli.js +299 -0
- package/dist/chat/claude_cli.js.map +1 -0
- package/dist/chat/graph_snapshot.d.ts +38 -0
- package/dist/chat/graph_snapshot.d.ts.map +1 -0
- package/dist/chat/graph_snapshot.js +159 -0
- package/dist/chat/graph_snapshot.js.map +1 -0
- package/dist/chat/ingest_session.d.ts +24 -4
- package/dist/chat/ingest_session.d.ts.map +1 -1
- package/dist/chat/ingest_session.js +139 -4
- package/dist/chat/ingest_session.js.map +1 -1
- package/dist/chat/panel.d.ts.map +1 -1
- package/dist/chat/panel.js +1358 -0
- package/dist/chat/panel.js.map +1 -1
- package/dist/chat/server.d.ts +21 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +904 -4
- package/dist/chat/server.js.map +1 -1
- package/dist/chat/tools/nac3_invoke.d.ts +5 -0
- package/dist/chat/tools/nac3_invoke.d.ts.map +1 -1
- package/dist/chat/tools/nac3_invoke.js +1 -0
- package/dist/chat/tools/nac3_invoke.js.map +1 -1
- package/dist/chat/tools.d.ts.map +1 -1
- package/dist/chat/tools.js +12 -0
- package/dist/chat/tools.js.map +1 -1
- package/dist/commands/agent.d.ts +12 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +92 -1
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/chat.d.ts +10 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +12 -1
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/director.d.ts +37 -0
- package/dist/commands/director.d.ts.map +1 -0
- package/dist/commands/director.js +290 -0
- package/dist/commands/director.js.map +1 -0
- package/dist/commands/keys_setup.d.ts +1 -0
- package/dist/commands/keys_setup.d.ts.map +1 -1
- package/dist/commands/keys_setup.js +61 -11
- package/dist/commands/keys_setup.js.map +1 -1
- package/dist/core/pilot_setup.d.ts +14 -1
- package/dist/core/pilot_setup.d.ts.map +1 -1
- package/dist/core/pilot_setup.js +62 -1
- package/dist/core/pilot_setup.js.map +1 -1
- package/dist/core/provider_keys.d.ts.map +1 -1
- package/dist/core/provider_keys.js +12 -5
- package/dist/core/provider_keys.js.map +1 -1
- package/dist/design/yujin_design_resolver.d.ts +77 -0
- package/dist/design/yujin_design_resolver.d.ts.map +1 -0
- package/dist/design/yujin_design_resolver.js +113 -0
- package/dist/design/yujin_design_resolver.js.map +1 -0
- package/dist/docs/doctrine/default-design-system.md +120 -0
- package/dist/docs/doctrine/language-sovereignty.md +143 -0
- package/dist/docs/doctrine/testing-policy.md +211 -0
- package/dist/nac3/approval_queue.d.ts +8 -0
- package/dist/nac3/approval_queue.d.ts.map +1 -1
- package/dist/nac3/approval_queue.js.map +1 -1
- package/dist/nac3/internal_manifest.d.ts.map +1 -1
- package/dist/nac3/internal_manifest.js +178 -0
- package/dist/nac3/internal_manifest.js.map +1 -1
- package/dist/office/excel.d.ts +22 -0
- package/dist/office/excel.d.ts.map +1 -1
- package/dist/office/excel.js +82 -0
- package/dist/office/excel.js.map +1 -1
- package/dist/qa/brain_matrix/fixtures/scenario_a11y_focus_after_open.json +22 -0
- package/dist/qa/brain_matrix/fixtures/scenario_a11y_label_unlabeled_button.json +26 -0
- package/dist/qa/brain_matrix/fixtures/scenario_agent_director_consults_workflow_before_dispatch.json +42 -0
- package/dist/qa/brain_matrix/fixtures/scenario_analyst_extracts_then_returns.json +28 -0
- package/dist/qa/brain_matrix/fixtures/scenario_coder_consults_nac_spec_before_writing.json +28 -0
- package/dist/qa/brain_matrix/fixtures/scenario_default_design_system_override_shadcn.json +45 -0
- package/dist/qa/brain_matrix/fixtures/scenario_default_design_system_use_card_template.json +44 -0
- package/dist/qa/brain_matrix/fixtures/scenario_director_delegates_to_analyst.json +26 -0
- package/dist/qa/brain_matrix/fixtures/scenario_director_no_self_delegation.json +20 -0
- package/dist/qa/brain_matrix/fixtures/scenario_director_terminal_done_marker.json +19 -0
- package/dist/qa/brain_matrix/fixtures/scenario_doctrine_discover_default_design_system.json +50 -0
- package/dist/qa/brain_matrix/fixtures/scenario_doctrine_discover_language_sovereignty.json +53 -0
- package/dist/qa/brain_matrix/fixtures/scenario_doctrine_discover_testing_policy.json +55 -0
- package/dist/qa/brain_matrix/fixtures/scenario_language_sovereignty_not_conducive_spa_python.json +61 -0
- package/dist/qa/brain_matrix/fixtures/scenario_language_sovereignty_user_picks_python.json +48 -0
- package/dist/qa/brain_matrix/fixtures/scenario_mcp_invoke_destructive_pauses_for_r8.json +42 -0
- package/dist/qa/brain_matrix/fixtures/scenario_mcp_invoke_happy_path_writes_pizarron.json +76 -0
- package/dist/qa/brain_matrix/fixtures/scenario_mcp_invoke_network_timeout_graceful.json +41 -0
- package/dist/qa/brain_matrix/fixtures/scenario_no_hardcoded_color_use_token.json +47 -0
- package/dist/qa/brain_matrix/fixtures/scenario_office_excel_update_cell_picks_right_verb.json +26 -0
- package/dist/qa/brain_matrix/fixtures/scenario_scaffolder_destructive_pauses_for_approval.json +23 -0
- package/dist/qa/brain_matrix/fixtures/scenario_sumie_icon_pick_from_catalog.json +56 -0
- package/dist/qa/brain_matrix/fixtures/scenario_tester_uses_shell_exec_only.json +27 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workflow/graph.d.ts +59 -0
- package/dist/workflow/graph.d.ts.map +1 -0
- package/dist/workflow/graph.js +137 -0
- package/dist/workflow/graph.js.map +1 -0
- package/dist/workflow/state.d.ts +34 -0
- package/dist/workflow/state.d.ts.map +1 -1
- package/dist/workflow/state.js.map +1 -1
- package/docs/doctrine/default-design-system.md +120 -0
- package/docs/doctrine/language-sovereignty.md +143 -0
- package/docs/doctrine/testing-policy.md +211 -0
- package/package.json +102 -100
- package/src/i18n/catalogs/ar.json +20 -1
- package/src/i18n/catalogs/de.json +20 -1
- package/src/i18n/catalogs/en.json +20 -21
- package/src/i18n/catalogs/es.json +20 -21
- package/src/i18n/catalogs/fr.json +20 -1
- package/src/i18n/catalogs/hi.json +20 -1
- package/src/i18n/catalogs/it.json +20 -1
- package/src/i18n/catalogs/ja.json +20 -1
- package/src/i18n/catalogs/pt.json +20 -1
- package/src/i18n/catalogs/zh.json +20 -1
- package/templates/sumi-context.template.md +57 -0
package/dist/core/pilot_setup.js
CHANGED
|
@@ -20,7 +20,63 @@
|
|
|
20
20
|
import { promises as fs } from 'node:fs';
|
|
21
21
|
import path from 'node:path';
|
|
22
22
|
const CONFIG = 'yujin.forge.json';
|
|
23
|
-
/**
|
|
23
|
+
/** Heuristic: detect whether `projectRoot` already contains an
|
|
24
|
+
* existing project. If it does, we skip the first-run Pilot setup
|
|
25
|
+
* (target/mode questions) because they are not relevant when the
|
|
26
|
+
* user is opening Forge against an existing codebase (bug fix,
|
|
27
|
+
* refactor, deploy, code review, doc gen, etc).
|
|
28
|
+
*
|
|
29
|
+
* An "existing project" is detected by the presence of ANY of the
|
|
30
|
+
* common dependency manifest files. Greenfield workspaces (empty
|
|
31
|
+
* dir or just a prompt.txt) do NOT match, so they still get the
|
|
32
|
+
* pilot setup -- preserving the F-series default for `yf new`.
|
|
33
|
+
*
|
|
34
|
+
* Added 2026-06-06 after the behavior-matrix run revealed that
|
|
35
|
+
* cloned existing repos were being misclassified as greenfield and
|
|
36
|
+
* intercepted by the warmup template, yielding "warmup-only" turns
|
|
37
|
+
* where Forge promised to read the codebase but only asked the two
|
|
38
|
+
* questions instead. */
|
|
39
|
+
const PROJECT_INDICATORS = [
|
|
40
|
+
'package.json',
|
|
41
|
+
'pyproject.toml',
|
|
42
|
+
'requirements.txt',
|
|
43
|
+
'Cargo.toml',
|
|
44
|
+
'go.mod',
|
|
45
|
+
'composer.json',
|
|
46
|
+
'Gemfile',
|
|
47
|
+
'mix.exs',
|
|
48
|
+
'pom.xml',
|
|
49
|
+
'build.gradle',
|
|
50
|
+
'build.gradle.kts',
|
|
51
|
+
'CMakeLists.txt',
|
|
52
|
+
'Makefile',
|
|
53
|
+
'pubspec.yaml',
|
|
54
|
+
];
|
|
55
|
+
export async function detectExistingProject(projectRoot) {
|
|
56
|
+
for (const indicator of PROJECT_INDICATORS) {
|
|
57
|
+
try {
|
|
58
|
+
await fs.access(path.join(projectRoot, indicator));
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
/* try next */
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
/** Read the current pilot setup state.
|
|
68
|
+
*
|
|
69
|
+
* Three branches:
|
|
70
|
+
* 1. `yujin.forge.json` exists -> trust the persisted `pilot_completed`.
|
|
71
|
+
* 2. No `yujin.forge.json`, but workspace IS an existing project (has
|
|
72
|
+
* `package.json`/`Cargo.toml`/etc) -> auto-skip warmup
|
|
73
|
+
* (`pilot_completed: true`). The user is opening Forge against a
|
|
74
|
+
* real codebase and wants Forge to start by discovering it, not
|
|
75
|
+
* by asking target/mode.
|
|
76
|
+
* 3. No `yujin.forge.json` and workspace is empty / greenfield ->
|
|
77
|
+
* trigger the warmup prompt (`pilot_completed: false`). This is
|
|
78
|
+
* the `yf new` path.
|
|
79
|
+
*/
|
|
24
80
|
export async function readPilotState(projectRoot) {
|
|
25
81
|
try {
|
|
26
82
|
const raw = await fs.readFile(path.join(projectRoot, CONFIG), 'utf-8');
|
|
@@ -36,6 +92,11 @@ export async function readPilotState(projectRoot) {
|
|
|
36
92
|
};
|
|
37
93
|
}
|
|
38
94
|
catch {
|
|
95
|
+
/* No config file. Decide between greenfield and existing-project. */
|
|
96
|
+
const existing = await detectExistingProject(projectRoot);
|
|
97
|
+
if (existing) {
|
|
98
|
+
return { pilot_completed: true, target_pending: false, mode_pending: false };
|
|
99
|
+
}
|
|
39
100
|
return { pilot_completed: false, target_pending: true, mode_pending: true };
|
|
40
101
|
}
|
|
41
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pilot_setup.js","sourceRoot":"","sources":["../../src/core/pilot_setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,MAAM,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pilot_setup.js","sourceRoot":"","sources":["../../src/core/pilot_setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAElC;;;;;;;;;;;;;;;yBAeyB;AACzB,MAAM,kBAAkB,GAAG;IACzB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,SAAS;IACT,SAAS;IACT,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,UAAU;IACV,cAAc;CACf,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,WAAmB;IAC7D,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,cAAc;QAChB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC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AAY,EAAE,CAAC;QACxE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider_keys.d.ts","sourceRoot":"","sources":["../../src/core/provider_keys.ts"],"names":[],"mappings":"AAkCA,QAAA,MAAM,aAAa,2OAyBT,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,wBAAgB,gBAAgB,IAAI,SAAS,MAAM,EAAE,CAEpD;AAgBD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,YAAY,CAM1D;AAqBD,+BAA+B;AAC/B,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAID;;;;eAIe;AACf,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC,
|
|
1
|
+
{"version":3,"file":"provider_keys.d.ts","sourceRoot":"","sources":["../../src/core/provider_keys.ts"],"names":[],"mappings":"AAkCA,QAAA,MAAM,aAAa,2OAyBT,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,wBAAgB,gBAAgB,IAAI,SAAS,MAAM,EAAE,CAEpD;AAgBD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,YAAY,CAM1D;AAqBD,+BAA+B;AAC/B,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAID;;;;eAIe;AACf,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC,CAoED;AAED;;kBAEkB;AAClB,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOjE;AAED,0DAA0D;AAC1D,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1F;AAED,qCAAqC;AACrC,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAK3D;AAED,oEAAoE;AACpE,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQnE;AAED;;;;6BAI6B;AAC7B,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAY/E"}
|
|
@@ -174,11 +174,18 @@ export async function migrateLegacyIfNeeded() {
|
|
|
174
174
|
skipped.push(slot);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
/*
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
/* alpha.59z.123 -- DO NOT rename the legacy file. The previous
|
|
178
|
+
* rename moved provider_keys.json to provider_keys.json.legacy.bak
|
|
179
|
+
* after importing the API keys, which silently dropped the
|
|
180
|
+
* brain_provider_preference + model overrides (those fields are
|
|
181
|
+
* never imported to the vault). The next `yf keys setup --show`
|
|
182
|
+
* would then read an empty legacy file and report all keys as
|
|
183
|
+
* "(none)" even though they were live in the vault. Worse, the
|
|
184
|
+
* worker's brain_provider_missing check uses the same legacy
|
|
185
|
+
* file. Keeping the legacy file in place fixes both: vault has
|
|
186
|
+
* the keys (canonical runtime), legacy keeps preference + model
|
|
187
|
+
* alias (until a future alpha promotes those to vault slots too).
|
|
188
|
+
* Re-imports are no-ops because vault.has() returns true. */
|
|
182
189
|
return { imported, skipped, legacy_present: true, vault_slots_migrated: vaultSlotsMigrated };
|
|
183
190
|
}
|
|
184
191
|
/** Read a BYOK key plaintext. Returns null when the slot is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider_keys.js","sourceRoot":"","sources":["../../src/core/provider_keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,aAAa,GAAG;IACpB;wCACoC;IACpC,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf;;gEAE4D;IAC5D,kBAAkB;IAClB,aAAa;IACb,iBAAiB;IACjB,gBAAgB;IAEhB,uDAAuD;IACvD,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IAEpB;;;kDAG8C;IAC9C,iBAAiB;CACT,CAAC;AAGX,MAAM,UAAU,gBAAgB;IAC9B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,qBAAqB,GAAsB;IAC/C,sCAAsC;CACvC,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,IAAK,aAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAClE;;uDAEmD;IACnD,OAAO,qBAAqB,CAAC,IAAI,CAAC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IAAI,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YAAC,CAAC;QACjF,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface DesignManifest {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description: string;
|
|
5
|
+
tokens: {
|
|
6
|
+
file: string;
|
|
7
|
+
format: string;
|
|
8
|
+
css: string;
|
|
9
|
+
count: number;
|
|
10
|
+
};
|
|
11
|
+
components: {
|
|
12
|
+
dir: string;
|
|
13
|
+
index: string;
|
|
14
|
+
count: number;
|
|
15
|
+
format: string;
|
|
16
|
+
};
|
|
17
|
+
icons: {
|
|
18
|
+
sumie: {
|
|
19
|
+
dir: string;
|
|
20
|
+
index: string;
|
|
21
|
+
count: number;
|
|
22
|
+
format: string;
|
|
23
|
+
tags: string[];
|
|
24
|
+
};
|
|
25
|
+
kanji: {
|
|
26
|
+
wordmarks: Record<string, string>;
|
|
27
|
+
single_chars: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
fonts: {
|
|
31
|
+
primary: {
|
|
32
|
+
family: string;
|
|
33
|
+
source: string;
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
36
|
+
japanese: {
|
|
37
|
+
family: string;
|
|
38
|
+
source: string;
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
monospace: {
|
|
42
|
+
family: string;
|
|
43
|
+
source: string;
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
policy: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface ComponentTemplate {
|
|
50
|
+
slug: string;
|
|
51
|
+
category: string;
|
|
52
|
+
nac3_id: string;
|
|
53
|
+
description: string;
|
|
54
|
+
html: string;
|
|
55
|
+
css: string;
|
|
56
|
+
variants: string[];
|
|
57
|
+
props: string[];
|
|
58
|
+
token_refs: string[];
|
|
59
|
+
sumie_icon_hint: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface SumieIcon {
|
|
62
|
+
slug: string;
|
|
63
|
+
tags: string[];
|
|
64
|
+
file: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ResolverOpts {
|
|
67
|
+
/** Override the package root for tests. */
|
|
68
|
+
dir?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare function getManifest(opts?: ResolverOpts): Promise<DesignManifest | null>;
|
|
71
|
+
export declare function listTemplates(opts?: ResolverOpts): Promise<ComponentTemplate[]>;
|
|
72
|
+
export declare function getTemplate(slug: string, opts?: ResolverOpts): Promise<ComponentTemplate | null>;
|
|
73
|
+
export declare function getTokens(opts?: ResolverOpts): Promise<unknown | null>;
|
|
74
|
+
export declare function listSumie(filterTag: string | null, opts?: ResolverOpts): Promise<SumieIcon[]>;
|
|
75
|
+
export declare function getSumieSvg(slug: string, opts?: ResolverOpts): Promise<string | null>;
|
|
76
|
+
export declare function _resetDesignCacheForTests(): void;
|
|
77
|
+
//# sourceMappingURL=yujin_design_resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yujin_design_resolver.d.ts","sourceRoot":"","sources":["../../src/design/yujin_design_resolver.ts"],"names":[],"mappings":"AAqDA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAO;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAA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,MAAM,EAAE,CAAC;IACzB,UAAU,EAAM,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID,wBAAsB,WAAW,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAIzF;AAED,wBAAsB,aAAa,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAazF;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAK1G;AAED,wBAAsB,SAAS,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAIhF;AAED,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAOvG;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAS/F;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Yujin Design System resolver (Director sprint phase II slice 12).
|
|
3
|
+
*
|
|
4
|
+
* Reads the package layout under yujin-design-system/ + exposes
|
|
5
|
+
* the catalog (tokens / components / sumi-e icons / kanji /
|
|
6
|
+
* fonts) to the NAC3 verb dispatcher + the chat.
|
|
7
|
+
*
|
|
8
|
+
* Failure mode: graceful. If the package directory is missing
|
|
9
|
+
* (consumer projects that haven't installed the substrate yet),
|
|
10
|
+
* the resolver returns { ok: false } so the verbs answer with a
|
|
11
|
+
* clean "not installed" instead of throwing.
|
|
12
|
+
*
|
|
13
|
+
* ASCII-only.
|
|
14
|
+
*/
|
|
15
|
+
import { promises as fs } from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = path.dirname(__filename);
|
|
20
|
+
/* The package lives at the repo root (sibling of src/). When
|
|
21
|
+
* forge runs from dist/, the bundle path is dist/../yujin-design-system.
|
|
22
|
+
* We probe a couple of locations to be portable. */
|
|
23
|
+
const DIR_HINTS = [
|
|
24
|
+
path.resolve(__dirname, '..', '..', '..', 'yujin-design-system'),
|
|
25
|
+
path.resolve(__dirname, '..', '..', 'yujin-design-system'),
|
|
26
|
+
path.resolve(__dirname, '..', 'yujin-design-system'),
|
|
27
|
+
path.resolve(process.cwd(), 'yujin-design-system'),
|
|
28
|
+
];
|
|
29
|
+
const _cache = {};
|
|
30
|
+
async function resolvePackageDir() {
|
|
31
|
+
for (const d of DIR_HINTS) {
|
|
32
|
+
try {
|
|
33
|
+
await fs.access(path.join(d, 'manifest.json'));
|
|
34
|
+
return d;
|
|
35
|
+
}
|
|
36
|
+
catch { /* not here */ }
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
async function readJson(p) {
|
|
41
|
+
try {
|
|
42
|
+
const raw = await fs.readFile(p, 'utf-8');
|
|
43
|
+
return JSON.parse(raw);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/* ============================================================ */
|
|
50
|
+
export async function getManifest(opts = {}) {
|
|
51
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
52
|
+
if (!dir)
|
|
53
|
+
return null;
|
|
54
|
+
return readJson(path.join(dir, 'manifest.json'));
|
|
55
|
+
}
|
|
56
|
+
export async function listTemplates(opts = {}) {
|
|
57
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
58
|
+
if (!dir)
|
|
59
|
+
return [];
|
|
60
|
+
const idx = await readJson(path.join(dir, 'components', '_index.json'));
|
|
61
|
+
if (!idx)
|
|
62
|
+
return [];
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const row of idx.components) {
|
|
65
|
+
const tpl = await readJson(path.join(dir, 'components', row.file));
|
|
66
|
+
if (tpl)
|
|
67
|
+
out.push(tpl);
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
export async function getTemplate(slug, opts = {}) {
|
|
72
|
+
if (!/^[a-z][a-z0-9-]{0,40}$/.test(slug))
|
|
73
|
+
return null;
|
|
74
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
75
|
+
if (!dir)
|
|
76
|
+
return null;
|
|
77
|
+
return readJson(path.join(dir, 'components', slug + '.yujin.json'));
|
|
78
|
+
}
|
|
79
|
+
export async function getTokens(opts = {}) {
|
|
80
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
81
|
+
if (!dir)
|
|
82
|
+
return null;
|
|
83
|
+
return readJson(path.join(dir, 'tokens', 'yujin-tokens.json'));
|
|
84
|
+
}
|
|
85
|
+
export async function listSumie(filterTag, opts = {}) {
|
|
86
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
87
|
+
if (!dir)
|
|
88
|
+
return [];
|
|
89
|
+
const idx = await readJson(path.join(dir, 'icons', 'sumie', 'manifest.json'));
|
|
90
|
+
if (!idx)
|
|
91
|
+
return [];
|
|
92
|
+
if (!filterTag)
|
|
93
|
+
return idx.icons;
|
|
94
|
+
return idx.icons.filter((i) => Array.isArray(i.tags) && i.tags.includes(filterTag));
|
|
95
|
+
}
|
|
96
|
+
export async function getSumieSvg(slug, opts = {}) {
|
|
97
|
+
if (!/^[a-z][a-z0-9-]{0,40}$/.test(slug))
|
|
98
|
+
return null;
|
|
99
|
+
const dir = opts.dir ?? await resolvePackageDir();
|
|
100
|
+
if (!dir)
|
|
101
|
+
return null;
|
|
102
|
+
try {
|
|
103
|
+
return await fs.readFile(path.join(dir, 'icons', 'sumie', slug + '.svg'), 'utf-8');
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export function _resetDesignCacheForTests() {
|
|
110
|
+
for (const k of Object.keys(_cache))
|
|
111
|
+
delete _cache[k];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=yujin_design_resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yujin_design_resolver.js","sourceRoot":"","sources":["../../src/design/yujin_design_resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5C;;oDAEoD;AACpD,MAAM,SAAS,GAAG;IAChB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,CAAC;IAChE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,qBAAqB,CAAC;IACpD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC;CACnD,CAAC;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: "componente", "modal", "sidebar", "card", "view",
|
|
5
|
+
"icon", "color", "fuente", "diseno", "interfaz", "UI", "form",
|
|
6
|
+
"button", "table", "kanban", "tabs"). Auto-injected on every
|
|
7
|
+
turn whose intent matches the UI heuristic.
|
|
8
|
+
|
|
9
|
+
## Rule (single source of truth)
|
|
10
|
+
|
|
11
|
+
The default front-end design system for any Forge-generated
|
|
12
|
+
project is **Yujin Design System** (`yujin-design-system/`). The
|
|
13
|
+
package ships with 258 DTCG-compliant tokens, 30 NAC3-attributed
|
|
14
|
+
component templates, 170 sumi-e icons + a kanji wordmark
|
|
15
|
+
catalog, and font references (Google Fonts CDN, no bundled
|
|
16
|
+
binaries).
|
|
17
|
+
|
|
18
|
+
When the user asks for a UI element, agents MUST:
|
|
19
|
+
|
|
20
|
+
1. Consult `yujin.design.list-templates` to see which Yujin
|
|
21
|
+
components cover the kind of element being requested.
|
|
22
|
+
2. Use `yujin.design.get-template({slug})` to retrieve the HTML
|
|
23
|
+
+ CSS + `nac3_attrs` + variants for the picked component.
|
|
24
|
+
3. Splice the template into the project; do NOT hand-roll an
|
|
25
|
+
equivalent layout from scratch.
|
|
26
|
+
4. Iconography: only pick from `yujin.design.list-sumie` (170
|
|
27
|
+
canonical icons). Use `yujin.design.get-icon({slug})` to
|
|
28
|
+
inline the SVG. Do NOT generate or import third-party icons
|
|
29
|
+
(no Material, no Font Awesome) unless the user explicitly
|
|
30
|
+
asks (override flow below).
|
|
31
|
+
5. Colors / typography / spacing: only via tokens from
|
|
32
|
+
`yujin.design.tokens()`. Do NOT hardcode `#3A4DBC` or
|
|
33
|
+
`font-family: Inter`; use `var(--color-accent)` and
|
|
34
|
+
`var(--font-family-sans)`.
|
|
35
|
+
|
|
36
|
+
## Override flow
|
|
37
|
+
|
|
38
|
+
The user CAN override the default ("usa shadcn", "use Material",
|
|
39
|
+
"this app needs Tailwind only", "I want my own brand colors"):
|
|
40
|
+
|
|
41
|
+
- Agent invokes `yujin.design.override({system_id, reason})`.
|
|
42
|
+
- This is `policy: 'approval_required'` so R8 opens a modal.
|
|
43
|
+
- The user confirms (or rejects); the choice persists in
|
|
44
|
+
`tenant_config.design_override`.
|
|
45
|
+
- Subsequent turns honor the override + the doctrine becomes a
|
|
46
|
+
soft suggestion ("Yujin DS is the Forge default, but this
|
|
47
|
+
tenant has overridden to <system>").
|
|
48
|
+
|
|
49
|
+
## Why this is the default
|
|
50
|
+
|
|
51
|
+
- Coherent visual language across every Forge-generated product
|
|
52
|
+
-- the user does not need to re-learn the look-and-feel per
|
|
53
|
+
product.
|
|
54
|
+
- 30 components are enough to compose every standard SaaS UX
|
|
55
|
+
(CRM, admin panel, marketing site, e-commerce, dashboard,
|
|
56
|
+
task tracker, settings).
|
|
57
|
+
- NAC3 attributes pre-applied -- every Yujin component is
|
|
58
|
+
voice-controllable + accessibility-ready out of the box.
|
|
59
|
+
- 170 sumi-e icons cover virtually every business concept
|
|
60
|
+
(finance, sales, support, manufacturing, quality, HR, mobile,
|
|
61
|
+
AI, comms, document, geo, weather, animal). One coherent
|
|
62
|
+
illustration style.
|
|
63
|
+
|
|
64
|
+
## Files in the package
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
yujin-design-system/
|
|
68
|
+
manifest.json catalog + version + license
|
|
69
|
+
tokens/
|
|
70
|
+
yujin-tokens.json 258 DTCG W3C tokens
|
|
71
|
+
yujin-tokens.css generated CSS (same source-of-truth)
|
|
72
|
+
components/
|
|
73
|
+
_index.json list of 30 components by category
|
|
74
|
+
button.yujin.json one file per component
|
|
75
|
+
card.yujin.json
|
|
76
|
+
... (30 total)
|
|
77
|
+
icons/
|
|
78
|
+
sumie/
|
|
79
|
+
manifest.json 170 icons with tags
|
|
80
|
+
branch-sakura.svg one SVG file per icon
|
|
81
|
+
... (170 total)
|
|
82
|
+
fonts/
|
|
83
|
+
README.md reference-only policy (Google Fonts CDN)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Six NAC3 verbs
|
|
87
|
+
|
|
88
|
+
| Verb | Returns | Policy |
|
|
89
|
+
|---------------------------------|----------------------------------------------------|--------------------|
|
|
90
|
+
| `yujin.design.list-templates` | `[{slug, category, description, variants}]` | safe |
|
|
91
|
+
| `yujin.design.get-template` | full ComponentTemplate (html, css, nac3, props) | safe |
|
|
92
|
+
| `yujin.design.list-sumie` | `[{slug, tags, file}]` (filtered by tag if given) | safe |
|
|
93
|
+
| `yujin.design.get-icon` | inline SVG string | safe |
|
|
94
|
+
| `yujin.design.tokens` | full DTCG token tree | safe |
|
|
95
|
+
| `yujin.design.override` | persists tenant_config.design_override | approval-required |
|
|
96
|
+
|
|
97
|
+
## What this doctrine does NOT cover
|
|
98
|
+
|
|
99
|
+
- Framework choice within TypeScript (Vue vs React vs Svelte).
|
|
100
|
+
See `docs/doctrine/language-sovereignty.md` -- the user
|
|
101
|
+
decides per slot, and the doctrine table records the choice.
|
|
102
|
+
- Build tooling (Vite vs Webpack vs esbuild). Out of scope.
|
|
103
|
+
- Theme switching per tenant. The override flow above persists
|
|
104
|
+
one choice per tenant; multi-theme support is a separate
|
|
105
|
+
feature.
|
|
106
|
+
|
|
107
|
+
## What the WORKERS (Analyst, Coder, Director) do with this
|
|
108
|
+
|
|
109
|
+
- **Analyst**: when extracting a spec that mentions UI elements
|
|
110
|
+
(forms, dashboards, modals), tag each one with the matching
|
|
111
|
+
Yujin component slug in `plan.components[]`. The Coder then
|
|
112
|
+
knows which template to pull.
|
|
113
|
+
- **Coder**: before writing ANY UI file, invoke
|
|
114
|
+
`yujin.design.list-templates` + `yujin.design.get-template`
|
|
115
|
+
for the components in the plan. Splice the templates. Apply
|
|
116
|
+
variants from the spec. Do NOT hand-write `.css` from
|
|
117
|
+
scratch.
|
|
118
|
+
- **Director**: when the user explicitly requests an override
|
|
119
|
+
("use shadcn"), invokes `yujin.design.override` instead of
|
|
120
|
+
silently accepting. The R8 modal confirms.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Language sovereignty -- the user picks, the Director suggests
|
|
2
|
+
|
|
3
|
+
Fetch when the user discusses programming language choice in
|
|
4
|
+
architecture / RFP / Arch / Design phases (workflow phases II
|
|
5
|
+
and III), OR when an Analyst extracts a spec that mentions a
|
|
6
|
+
language explicitly (signals: "in node", "with django", "react
|
|
7
|
+
native", "pure rust", "java backend", "swift app").
|
|
8
|
+
|
|
9
|
+
## Rule (single source of truth)
|
|
10
|
+
|
|
11
|
+
The user picks the programming language for each component. The
|
|
12
|
+
Director SUGGESTS during architecture (phase III specs / RFP)
|
|
13
|
+
but NEVER imposes. If the user insists on a language different
|
|
14
|
+
from the one the Director suggested, the Director performs a
|
|
15
|
+
SWITCH and persists the choice in `workflow.language_choices`
|
|
16
|
+
via `yujin.workflow.set`.
|
|
17
|
+
|
|
18
|
+
The ONLY exception is when the language the user requested is
|
|
19
|
+
not conducive to the component being developed (technical
|
|
20
|
+
incompatibility documentable from the table below). In that
|
|
21
|
+
case the Director replies with the exact row from this doctrine
|
|
22
|
+
+ the valid alternatives + waits for the next user decision. No
|
|
23
|
+
"I deny because I dislike", only "I deny because <component-kind>
|
|
24
|
+
cannot run on <language> because <technical reason>".
|
|
25
|
+
|
|
26
|
+
## Suitability table
|
|
27
|
+
|
|
28
|
+
The table is the single source of truth. The Director MUST read
|
|
29
|
+
from it and MUST NOT add opinions on top.
|
|
30
|
+
|
|
31
|
+
| Component kind | Conducive languages | NOT conducive (with reason) |
|
|
32
|
+
|-------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
|
|
33
|
+
| spa-web-frontend | ts, js, wasm-target (rust, go, c#), htmx-fragments | python, java, php, ruby (server-side runtimes, not a browser runtime) |
|
|
34
|
+
| mobile-native | swift (ios), kotlin (android), dart (flutter), ts+rn (expo) | python, php, c# (no fluid native mobile runtime); html-only (not native) |
|
|
35
|
+
| mobile-cross-platform | dart (flutter), ts+rn (expo), kotlin-multiplatform | jvm-only languages (not a mobile target), php, perl |
|
|
36
|
+
| backend-api | ts, js, python, go, rust, java, kotlin, c#, php, ruby, elixir | bash, asm (do not scale to productive HTTP servers); assembler (no http stack) |
|
|
37
|
+
| backend-realtime | go, rust, elixir, ts (node), kotlin, c# (signalr) | python (gil bottleneck for sustained ws), php (request-response model) |
|
|
38
|
+
| kernel-driver | c, rust, asm | ts, python, java, c# (managed runtimes do not touch metal) |
|
|
39
|
+
| embedded-firmware | c, rust, c++, micropython (mid-range), zig | java, ts, php (heavyweight runtimes for typical mcus) |
|
|
40
|
+
| data-pipeline | python, scala, java, go, sql, kotlin | js (poor batch ecosystem), php (no parallel data tooling) |
|
|
41
|
+
| ml-training | python, julia, r, c++ (kernels) | ts, php, ruby (no mature ml ecosystem comparable) |
|
|
42
|
+
| ml-inference | python, ts, c++, rust, go (onnx) | php, perl (no inference runtime) |
|
|
43
|
+
| db-stored-proc | sql, pl/pgsql, t-sql, pl/sql (oracle) | any general-purpose language (not the db engine model) |
|
|
44
|
+
| db-migration | sql + migration runner (any: rails, alembic, prisma, flyway) | -- |
|
|
45
|
+
| cli-tool | go, rust, ts (node), python, c (oneshot) | -- (almost any general-purpose lang works) |
|
|
46
|
+
| static-analysis-plugin | language of the target compiler | any unrelated language (no compiler integration point) |
|
|
47
|
+
| infra-as-code | terraform/hcl, pulumi (ts/python/go), cloudformation/yaml, cdk | bash one-offs (do not represent desired state) |
|
|
48
|
+
| iot-edge | rust, c, go, python (rpi-class), elixir (nerves) | jvm-only (mostly too heavy), php |
|
|
49
|
+
| build-system | go, rust, ts (node), make, bash | -- (almost any works; nuance is in ergonomics, not correctness) |
|
|
50
|
+
| docs-site | markdown + static site gen (any), mdx (react) | dynamic backends (overkill; not conducive to content-as-code) |
|
|
51
|
+
|
|
52
|
+
## Algorithm (Director executes this)
|
|
53
|
+
|
|
54
|
+
1. User input: "quiero X en LANG".
|
|
55
|
+
2. Director: `yujin.doctrine.discover({slugs:["language-sovereignty"]})`.
|
|
56
|
+
3. Director: lookup the row for `X` (component-kind). If
|
|
57
|
+
ambiguous, ASK the user one clarifying question (which kind
|
|
58
|
+
of component is X?) before proceeding. Do NOT guess.
|
|
59
|
+
4. If `LANG` is in `row.conducive`:
|
|
60
|
+
- switch: set `workflow.language_choices[X] = { lang: LANG,
|
|
61
|
+
decided_at: NOW, decided_by: "user" }` via
|
|
62
|
+
`yujin.workflow.set`.
|
|
63
|
+
- Reply briefly: "Listo, X en LANG. Sigo con el plan."
|
|
64
|
+
- Do NOT discuss the choice further unless the user asks.
|
|
65
|
+
5. If `LANG` is NOT in `row.conducive`:
|
|
66
|
+
- Reply with the exact row from this doctrine:
|
|
67
|
+
"LANG no es conducente para X porque <row.NOT_conducive_reason>.
|
|
68
|
+
Las opciones validas son: <row.conducive>. Cual preferis?"
|
|
69
|
+
- Do NOT switch. Wait for the next user decision.
|
|
70
|
+
6. If the user counter-argues with NEW technical information
|
|
71
|
+
("hay un transpiler de LANG a JS / WASM target / etc"):
|
|
72
|
+
- Director re-evaluates. If the new info is verifiable +
|
|
73
|
+
consistent with the table semantics (e.g. WASM target for
|
|
74
|
+
the kind), update the conducive set in memory for THIS
|
|
75
|
+
turn + switch.
|
|
76
|
+
- If the info is opinable / not verifiable, hold the negative
|
|
77
|
+
+ explain the gap (mismatched runtime model, no compiler
|
|
78
|
+
integration, etc).
|
|
79
|
+
|
|
80
|
+
## Defaults when the user has NOT expressed preference
|
|
81
|
+
|
|
82
|
+
When the user has not yet declared a language for a component
|
|
83
|
+
slot, the Director may suggest a default. Defaults are NOT
|
|
84
|
+
prescriptions; they exist so the conversation can move forward
|
|
85
|
+
without a 12-question survey.
|
|
86
|
+
|
|
87
|
+
| Slot | Default suggestion |
|
|
88
|
+
|---------------------|------------------------------|
|
|
89
|
+
| frontend | ts (react / typescript) |
|
|
90
|
+
| mobile | ts (react native + expo) |
|
|
91
|
+
| backend | ts (node) for crud-heavy; go for perf-sensitive; python for ml-heavy |
|
|
92
|
+
| data-pipeline | python |
|
|
93
|
+
| infra | terraform + hcl |
|
|
94
|
+
| db | postgres + sql migrations |
|
|
95
|
+
| ml | python |
|
|
96
|
+
|
|
97
|
+
The Director surfaces the default as a SUGGESTION ("propongo TS
|
|
98
|
+
para frontend y Python para el pipeline; te sirve?") and
|
|
99
|
+
proceeds if the user accepts or stays silent on it (silence is
|
|
100
|
+
acceptance of the default). The persisted `decided_by` field
|
|
101
|
+
records `"director_suggested"` so a future audit can distinguish
|
|
102
|
+
explicit choices from accepted defaults.
|
|
103
|
+
|
|
104
|
+
## Where the decision lives
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
yujin.forge.json -> workflow.language_choices: {
|
|
108
|
+
frontend: { lang: "ts", decided_at: "...", decided_by: "user" },
|
|
109
|
+
backend: { lang: "go", decided_at: "...", decided_by: "user" },
|
|
110
|
+
mobile: { lang: "dart", decided_at: "...", decided_by: "director_suggested" },
|
|
111
|
+
data_pipeline: { lang: "python", decided_at: "...", decided_by: "user" },
|
|
112
|
+
infra: { lang: "tf+hcl", decided_at: "...", decided_by: "director_suggested" }
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Read via `yujin.workflow.state`. Write via `yujin.workflow.set
|
|
117
|
+
{path: "language_choices.<slot>", value: {...}}`.
|
|
118
|
+
|
|
119
|
+
## What this doctrine does NOT cover
|
|
120
|
+
|
|
121
|
+
- Frameworks within a language (vue vs react vs svelte for ts
|
|
122
|
+
frontend). That is a separate user decision the Director
|
|
123
|
+
surfaces but does not constrain via this doctrine.
|
|
124
|
+
- Library choices (express vs fastify vs hono for ts backend).
|
|
125
|
+
Same: user decides.
|
|
126
|
+
- Build tooling (vite vs webpack vs esbuild). Same.
|
|
127
|
+
|
|
128
|
+
## What the WORKERS (Analyst, Coder, Tester, Scaffolder) read from this doctrine
|
|
129
|
+
|
|
130
|
+
- **Analyst**: when extracting a spec, capture explicit language
|
|
131
|
+
signals into `plan.language_signals[]`. The Director processes
|
|
132
|
+
them via the algorithm above.
|
|
133
|
+
- **Coder**: read `workflow.language_choices` before proposing
|
|
134
|
+
files. Match the chosen language; do NOT default to TS if the
|
|
135
|
+
table chose Go.
|
|
136
|
+
- **Tester**: detect the test framework FROM the chosen language
|
|
137
|
+
+ project manifest (`package.json` -> Vitest/Jest, `pyproject.toml`
|
|
138
|
+
-> pytest, `go.mod` -> go test, `Cargo.toml` -> cargo test,
|
|
139
|
+
`composer.json` -> PHPUnit). Do NOT prompt the user for the
|
|
140
|
+
framework when the manifest already says.
|
|
141
|
+
- **Scaffolder**: respect file extensions + import statements of
|
|
142
|
+
the chosen language stack. Do not write `.ts` files into a Go
|
|
143
|
+
module.
|