create-foundry-workspace 1.0.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.
Files changed (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -0
  3. package/bin/index.js +2 -0
  4. package/dist/adapters/adapter.interface.d.ts +13 -0
  5. package/dist/adapters/adapter.interface.js +2 -0
  6. package/dist/adapters/agents.adapter.d.ts +10 -0
  7. package/dist/adapters/agents.adapter.js +16 -0
  8. package/dist/adapters/claude.adapter.d.ts +10 -0
  9. package/dist/adapters/claude.adapter.js +30 -0
  10. package/dist/adapters/codex.adapter.d.ts +10 -0
  11. package/dist/adapters/codex.adapter.js +33 -0
  12. package/dist/adapters/copilot.adapter.d.ts +10 -0
  13. package/dist/adapters/copilot.adapter.js +40 -0
  14. package/dist/adapters/cursor.adapter.d.ts +10 -0
  15. package/dist/adapters/cursor.adapter.js +41 -0
  16. package/dist/adapters/gemini.adapter.d.ts +10 -0
  17. package/dist/adapters/gemini.adapter.js +34 -0
  18. package/dist/adapters/generic.adapter.d.ts +10 -0
  19. package/dist/adapters/generic.adapter.js +34 -0
  20. package/dist/adapters/registry.d.ts +12 -0
  21. package/dist/adapters/registry.js +38 -0
  22. package/dist/bin.d.ts +3 -0
  23. package/dist/bin.js +7 -0
  24. package/dist/cli/command.d.ts +2 -0
  25. package/dist/cli/command.js +96 -0
  26. package/dist/cli/formatters.d.ts +5 -0
  27. package/dist/cli/formatters.js +30 -0
  28. package/dist/cli/prompts.d.ts +11 -0
  29. package/dist/cli/prompts.js +140 -0
  30. package/dist/config/defaults.d.ts +8 -0
  31. package/dist/config/defaults.js +7 -0
  32. package/dist/config/schema.d.ts +95 -0
  33. package/dist/config/schema.js +51 -0
  34. package/dist/core/context.d.ts +3 -0
  35. package/dist/core/context.js +16 -0
  36. package/dist/core/generator.d.ts +10 -0
  37. package/dist/core/generator.js +97 -0
  38. package/dist/core/interpolator.d.ts +6 -0
  39. package/dist/core/interpolator.js +13 -0
  40. package/dist/detection/detector.d.ts +13 -0
  41. package/dist/detection/detector.js +67 -0
  42. package/dist/detection/rules/go.d.ts +3 -0
  43. package/dist/detection/rules/go.js +19 -0
  44. package/dist/detection/rules/java.d.ts +3 -0
  45. package/dist/detection/rules/java.js +30 -0
  46. package/dist/detection/rules/node.d.ts +8 -0
  47. package/dist/detection/rules/node.js +36 -0
  48. package/dist/detection/rules/python.d.ts +3 -0
  49. package/dist/detection/rules/python.js +30 -0
  50. package/dist/detection/rules/rust.d.ts +3 -0
  51. package/dist/detection/rules/rust.js +19 -0
  52. package/dist/index.d.ts +12 -0
  53. package/dist/index.js +12 -0
  54. package/dist/io/paths.d.ts +11 -0
  55. package/dist/io/paths.js +21 -0
  56. package/dist/io/writer.d.ts +23 -0
  57. package/dist/io/writer.js +56 -0
  58. package/dist/templates/agents.d.ts +3 -0
  59. package/dist/templates/agents.js +41 -0
  60. package/dist/templates/ai-context.d.ts +3 -0
  61. package/dist/templates/ai-context.js +28 -0
  62. package/dist/templates/ai-dir/architecture.d.ts +3 -0
  63. package/dist/templates/ai-dir/architecture.js +13 -0
  64. package/dist/templates/ai-dir/context.d.ts +3 -0
  65. package/dist/templates/ai-dir/context.js +14 -0
  66. package/dist/templates/ai-dir/decisions.d.ts +3 -0
  67. package/dist/templates/ai-dir/decisions.js +21 -0
  68. package/dist/templates/ai-dir/rules.d.ts +3 -0
  69. package/dist/templates/ai-dir/rules.js +12 -0
  70. package/dist/templates/ai-dir/tasks.d.ts +3 -0
  71. package/dist/templates/ai-dir/tasks.js +31 -0
  72. package/dist/templates/app-types/api.d.ts +2 -0
  73. package/dist/templates/app-types/api.js +5 -0
  74. package/dist/templates/app-types/cli.d.ts +2 -0
  75. package/dist/templates/app-types/cli.js +5 -0
  76. package/dist/templates/app-types/data-ml.d.ts +2 -0
  77. package/dist/templates/app-types/data-ml.js +5 -0
  78. package/dist/templates/app-types/fullstack.d.ts +2 -0
  79. package/dist/templates/app-types/fullstack.js +5 -0
  80. package/dist/templates/app-types/index.d.ts +3 -0
  81. package/dist/templates/app-types/index.js +30 -0
  82. package/dist/templates/app-types/library.d.ts +2 -0
  83. package/dist/templates/app-types/library.js +5 -0
  84. package/dist/templates/app-types/mobile.d.ts +2 -0
  85. package/dist/templates/app-types/mobile.js +5 -0
  86. package/dist/templates/app-types/other.d.ts +2 -0
  87. package/dist/templates/app-types/other.js +5 -0
  88. package/dist/templates/app-types/web.d.ts +2 -0
  89. package/dist/templates/app-types/web.js +5 -0
  90. package/dist/templates/base/guardrails.d.ts +3 -0
  91. package/dist/templates/base/guardrails.js +20 -0
  92. package/dist/templates/contributing.d.ts +3 -0
  93. package/dist/templates/contributing.js +19 -0
  94. package/dist/templates/docs/architecture-doc.d.ts +3 -0
  95. package/dist/templates/docs/architecture-doc.js +22 -0
  96. package/dist/templates/docs/decisions-doc.d.ts +3 -0
  97. package/dist/templates/docs/decisions-doc.js +19 -0
  98. package/dist/templates/docs/development-doc.d.ts +3 -0
  99. package/dist/templates/docs/development-doc.js +21 -0
  100. package/dist/templates/docs/docs-readme.d.ts +3 -0
  101. package/dist/templates/docs/docs-readme.js +15 -0
  102. package/dist/templates/gitignore.d.ts +3 -0
  103. package/dist/templates/gitignore.js +109 -0
  104. package/dist/templates/guardrails-doc.d.ts +3 -0
  105. package/dist/templates/guardrails-doc.js +15 -0
  106. package/dist/templates/languages/go.d.ts +4 -0
  107. package/dist/templates/languages/go.js +11 -0
  108. package/dist/templates/languages/index.d.ts +7 -0
  109. package/dist/templates/languages/index.js +27 -0
  110. package/dist/templates/languages/java.d.ts +4 -0
  111. package/dist/templates/languages/java.js +11 -0
  112. package/dist/templates/languages/javascript.d.ts +4 -0
  113. package/dist/templates/languages/javascript.js +11 -0
  114. package/dist/templates/languages/other.d.ts +4 -0
  115. package/dist/templates/languages/other.js +11 -0
  116. package/dist/templates/languages/python.d.ts +4 -0
  117. package/dist/templates/languages/python.js +11 -0
  118. package/dist/templates/languages/rust.d.ts +4 -0
  119. package/dist/templates/languages/rust.js +11 -0
  120. package/dist/templates/languages/typescript.d.ts +4 -0
  121. package/dist/templates/languages/typescript.js +11 -0
  122. package/dist/templates/manifest.d.ts +3 -0
  123. package/dist/templates/manifest.js +17 -0
  124. package/dist/templates/readme.d.ts +3 -0
  125. package/dist/templates/readme.js +35 -0
  126. package/package.json +64 -0
@@ -0,0 +1,67 @@
1
+ import path from 'node:path';
2
+ import { DEFAULT_APP_TYPE, DEFAULT_LANGUAGE } from '../config/defaults.js';
3
+ import { detectGo } from './rules/go.js';
4
+ import { detectJava } from './rules/java.js';
5
+ import { detectNode } from './rules/node.js';
6
+ import { detectPython } from './rules/python.js';
7
+ import { detectRust } from './rules/rust.js';
8
+ /**
9
+ * Deterministically inspects target directory markers to infer project defaults.
10
+ * Completely decoupled from CLI prompt parsing.
11
+ */
12
+ export async function detectProjectEnvironment(targetDir) {
13
+ const fallbackName = path.basename(path.resolve(targetDir)) || 'my-workspace';
14
+ // Run detectors in priority order
15
+ const node = await detectNode(targetDir);
16
+ if (node) {
17
+ return {
18
+ name: node.name || fallbackName,
19
+ language: node.language || DEFAULT_LANGUAGE,
20
+ type: node.type || DEFAULT_APP_TYPE,
21
+ isDetected: true,
22
+ };
23
+ }
24
+ const rust = await detectRust(targetDir);
25
+ if (rust) {
26
+ return {
27
+ name: rust.name || fallbackName,
28
+ language: 'rust',
29
+ type: rust.type || 'cli',
30
+ isDetected: true,
31
+ };
32
+ }
33
+ const go = await detectGo(targetDir);
34
+ if (go) {
35
+ return {
36
+ name: go.name || fallbackName,
37
+ language: 'go',
38
+ type: go.type || 'api',
39
+ isDetected: true,
40
+ };
41
+ }
42
+ const python = await detectPython(targetDir);
43
+ if (python) {
44
+ return {
45
+ name: fallbackName,
46
+ language: 'python',
47
+ type: python.type || 'api',
48
+ isDetected: true,
49
+ };
50
+ }
51
+ const java = await detectJava(targetDir);
52
+ if (java) {
53
+ return {
54
+ name: fallbackName,
55
+ language: 'java',
56
+ type: java.type || 'api',
57
+ isDetected: true,
58
+ };
59
+ }
60
+ return {
61
+ name: fallbackName,
62
+ language: DEFAULT_LANGUAGE,
63
+ type: DEFAULT_APP_TYPE,
64
+ isDetected: false,
65
+ };
66
+ }
67
+ //# sourceMappingURL=detector.js.map
@@ -0,0 +1,3 @@
1
+ import { DetectionCandidate } from './node.js';
2
+ export declare function detectGo(targetDir: string): Promise<DetectionCandidate | null>;
3
+ //# sourceMappingURL=go.d.ts.map
@@ -0,0 +1,19 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ export async function detectGo(targetDir) {
4
+ const goMod = path.join(targetDir, 'go.mod');
5
+ try {
6
+ const raw = await fs.readFile(goMod, 'utf-8');
7
+ const match = raw.match(/module\s+([^\s]+)/);
8
+ const modName = match && match[1] ? path.basename(match[1]) : undefined;
9
+ return {
10
+ name: modName,
11
+ language: 'go',
12
+ type: 'api',
13
+ };
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ //# sourceMappingURL=go.js.map
@@ -0,0 +1,3 @@
1
+ import { DetectionCandidate } from './node.js';
2
+ export declare function detectJava(targetDir: string): Promise<DetectionCandidate | null>;
3
+ //# sourceMappingURL=java.d.ts.map
@@ -0,0 +1,30 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ export async function detectJava(targetDir) {
4
+ const pomXml = path.join(targetDir, 'pom.xml');
5
+ const gradle = path.join(targetDir, 'build.gradle');
6
+ const gradleKts = path.join(targetDir, 'build.gradle.kts');
7
+ let hasJava = false;
8
+ try {
9
+ await fs.access(pomXml);
10
+ hasJava = true;
11
+ }
12
+ catch { }
13
+ try {
14
+ await fs.access(gradle);
15
+ hasJava = true;
16
+ }
17
+ catch { }
18
+ try {
19
+ await fs.access(gradleKts);
20
+ hasJava = true;
21
+ }
22
+ catch { }
23
+ if (!hasJava)
24
+ return null;
25
+ return {
26
+ language: 'java',
27
+ type: 'api',
28
+ };
29
+ }
30
+ //# sourceMappingURL=java.js.map
@@ -0,0 +1,8 @@
1
+ import { AppType, Language } from '../../config/schema.js';
2
+ export interface DetectionCandidate {
3
+ name?: string;
4
+ language?: Language;
5
+ type?: AppType;
6
+ }
7
+ export declare function detectNode(targetDir: string): Promise<DetectionCandidate | null>;
8
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1,36 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ export async function detectNode(targetDir) {
4
+ const pkgPath = path.join(targetDir, 'package.json');
5
+ try {
6
+ const raw = await fs.readFile(pkgPath, 'utf-8');
7
+ const pkg = JSON.parse(raw);
8
+ const name = typeof pkg.name === 'string' ? pkg.name.replace(/^@[^/]+\//, '') : undefined;
9
+ let language = 'javascript';
10
+ // Check for TypeScript markers
11
+ if ((pkg.devDependencies && pkg.devDependencies.typescript) ||
12
+ (pkg.dependencies && pkg.dependencies.typescript)) {
13
+ language = 'typescript';
14
+ }
15
+ try {
16
+ await fs.access(path.join(targetDir, 'tsconfig.json'));
17
+ language = 'typescript';
18
+ }
19
+ catch { }
20
+ let type = 'fullstack';
21
+ if (pkg.bin) {
22
+ type = 'cli';
23
+ }
24
+ else if (pkg.dependencies && (pkg.dependencies.react || pkg.dependencies.vue || pkg.dependencies.svelte)) {
25
+ type = 'web';
26
+ }
27
+ else if (pkg.dependencies && (pkg.dependencies.express || pkg.dependencies.fastify || pkg.dependencies.hono)) {
28
+ type = 'api';
29
+ }
30
+ return { name, language, type };
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1,3 @@
1
+ import { DetectionCandidate } from './node.js';
2
+ export declare function detectPython(targetDir: string): Promise<DetectionCandidate | null>;
3
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1,30 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ export async function detectPython(targetDir) {
4
+ const pyproject = path.join(targetDir, 'pyproject.toml');
5
+ const requirements = path.join(targetDir, 'requirements.txt');
6
+ const setupPy = path.join(targetDir, 'setup.py');
7
+ let hasPython = false;
8
+ try {
9
+ await fs.access(pyproject);
10
+ hasPython = true;
11
+ }
12
+ catch { }
13
+ try {
14
+ await fs.access(requirements);
15
+ hasPython = true;
16
+ }
17
+ catch { }
18
+ try {
19
+ await fs.access(setupPy);
20
+ hasPython = true;
21
+ }
22
+ catch { }
23
+ if (!hasPython)
24
+ return null;
25
+ return {
26
+ language: 'python',
27
+ type: 'api',
28
+ };
29
+ }
30
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1,3 @@
1
+ import { DetectionCandidate } from './node.js';
2
+ export declare function detectRust(targetDir: string): Promise<DetectionCandidate | null>;
3
+ //# sourceMappingURL=rust.d.ts.map
@@ -0,0 +1,19 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ export async function detectRust(targetDir) {
4
+ const cargoToml = path.join(targetDir, 'Cargo.toml');
5
+ try {
6
+ const raw = await fs.readFile(cargoToml, 'utf-8');
7
+ const nameMatch = raw.match(/name\s*=\s*["']([^"']+)["']/);
8
+ const projName = nameMatch && nameMatch[1] ? nameMatch[1] : undefined;
9
+ return {
10
+ name: projName,
11
+ language: 'rust',
12
+ type: 'cli',
13
+ };
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ //# sourceMappingURL=rust.js.map
@@ -0,0 +1,12 @@
1
+ export * from './config/schema.js';
2
+ export * from './config/defaults.js';
3
+ export * from './detection/detector.js';
4
+ export * from './adapters/adapter.interface.js';
5
+ export * from './adapters/registry.js';
6
+ export * from './core/context.js';
7
+ export * from './core/generator.js';
8
+ export * from './core/interpolator.js';
9
+ export * from './io/paths.js';
10
+ export * from './io/writer.js';
11
+ export * from './cli/command.js';
12
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export * from './config/schema.js';
2
+ export * from './config/defaults.js';
3
+ export * from './detection/detector.js';
4
+ export * from './adapters/adapter.interface.js';
5
+ export * from './adapters/registry.js';
6
+ export * from './core/context.js';
7
+ export * from './core/generator.js';
8
+ export * from './core/interpolator.js';
9
+ export * from './io/paths.js';
10
+ export * from './io/writer.js';
11
+ export * from './cli/command.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes relative paths to POSIX format (forward slashes).
3
+ * Ensures cross-platform consistency across Windows, macOS, and Linux.
4
+ */
5
+ export declare function normalizeRelativePath(filePath: string): string;
6
+ /**
7
+ * Safely resolves target file path within target directory.
8
+ * Throws an error if target path traverses outside target directory.
9
+ */
10
+ export declare function resolveSafePath(baseDir: string, relativePath: string): string;
11
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1,21 @@
1
+ import path from 'node:path';
2
+ /**
3
+ * Normalizes relative paths to POSIX format (forward slashes).
4
+ * Ensures cross-platform consistency across Windows, macOS, and Linux.
5
+ */
6
+ export function normalizeRelativePath(filePath) {
7
+ return filePath.split(path.sep).join('/');
8
+ }
9
+ /**
10
+ * Safely resolves target file path within target directory.
11
+ * Throws an error if target path traverses outside target directory.
12
+ */
13
+ export function resolveSafePath(baseDir, relativePath) {
14
+ const resolvedBase = path.resolve(baseDir);
15
+ const resolvedTarget = path.resolve(resolvedBase, relativePath);
16
+ if (!resolvedTarget.startsWith(resolvedBase)) {
17
+ throw new Error(`Security Exception: Target path '${relativePath}' traverses outside base directory.`);
18
+ }
19
+ return resolvedTarget;
20
+ }
21
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1,23 @@
1
+ import { GeneratedFile } from '../adapters/adapter.interface.js';
2
+ export interface WriteOptions {
3
+ dryRun?: boolean;
4
+ force?: boolean;
5
+ abortOnCollision?: boolean;
6
+ }
7
+ export interface WriteResult {
8
+ files: GeneratedFile[];
9
+ written: string[];
10
+ skipped: string[];
11
+ collisions: string[];
12
+ dryRun: boolean;
13
+ }
14
+ /**
15
+ * Checks for existing files in target directory.
16
+ */
17
+ export declare function detectCollisions(targetDir: string, files: GeneratedFile[]): Promise<string[]>;
18
+ /**
19
+ * The ONLY function in the codebase permitted to perform filesystem writes.
20
+ * Implements safe-merge, force overwrite, dry-run, and collision handling.
21
+ */
22
+ export declare function writeWorkspace(targetDir: string, files: GeneratedFile[], options?: WriteOptions): Promise<WriteResult>;
23
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1,56 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { normalizeRelativePath, resolveSafePath } from './paths.js';
4
+ /**
5
+ * Checks for existing files in target directory.
6
+ */
7
+ export async function detectCollisions(targetDir, files) {
8
+ const collisions = [];
9
+ for (const file of files) {
10
+ const fullPath = resolveSafePath(targetDir, file.relativePath);
11
+ try {
12
+ await fs.access(fullPath);
13
+ collisions.push(normalizeRelativePath(file.relativePath));
14
+ }
15
+ catch {
16
+ // File does not exist, no collision
17
+ }
18
+ }
19
+ return collisions;
20
+ }
21
+ /**
22
+ * The ONLY function in the codebase permitted to perform filesystem writes.
23
+ * Implements safe-merge, force overwrite, dry-run, and collision handling.
24
+ */
25
+ export async function writeWorkspace(targetDir, files, options = {}) {
26
+ const { dryRun = false, force = false, abortOnCollision = false } = options;
27
+ const collisions = await detectCollisions(targetDir, files);
28
+ if (collisions.length > 0 && abortOnCollision && !force) {
29
+ throw new Error(`Aborted: Found ${collisions.length} existing files in '${targetDir}'. Use --force to overwrite.`);
30
+ }
31
+ const written = [];
32
+ const skipped = [];
33
+ for (const file of files) {
34
+ const normPath = normalizeRelativePath(file.relativePath);
35
+ const fullPath = resolveSafePath(targetDir, file.relativePath);
36
+ const isCollision = collisions.includes(normPath);
37
+ if (isCollision && !force) {
38
+ skipped.push(normPath);
39
+ continue;
40
+ }
41
+ if (!dryRun) {
42
+ const parentDir = path.dirname(fullPath);
43
+ await fs.mkdir(parentDir, { recursive: true });
44
+ await fs.writeFile(fullPath, file.content, 'utf-8');
45
+ }
46
+ written.push(normPath);
47
+ }
48
+ return {
49
+ files,
50
+ written,
51
+ skipped,
52
+ collisions,
53
+ dryRun,
54
+ };
55
+ }
56
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../config/schema.js';
2
+ export declare function renderAgentsDocument(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1,41 @@
1
+ export function renderAgentsDocument(context) {
2
+ const { config, commands, languageRules, appTypeRules, baseGuardrails } = context;
3
+ return `# ${config.project.name} — AI Development Contract (AGENTS.md)
4
+
5
+ Welcome to **${config.project.name}**. This file defines the core context, commands, and non-negotiable architectural boundaries for human engineers and AI coding assistants collaborating on this project.
6
+
7
+ ---
8
+
9
+ ## 1. Application Profile & Scope
10
+ - **Project Name:** ${config.project.name}
11
+ - **Application Type:** ${config.project.type}
12
+ - **Primary Language:** ${config.project.language}
13
+ - **Strictness Level:** ${config.strictness}
14
+
15
+ ---
16
+
17
+ ## 2. Standard Development Commands
18
+ - **Build:** \`${commands.build}\`
19
+ - **Test:** \`${commands.test}\`
20
+ - **Development Server / Entry:** \`${commands.dev}\`
21
+ - **Lint / Static Analysis:** \`${commands.lint}\`
22
+
23
+ Always run and verify tests and linting before marking tasks or issues as resolved.
24
+
25
+ ---
26
+
27
+ ## 3. Project Architecture & Standards
28
+ ${appTypeRules}
29
+
30
+ ---
31
+
32
+ ## 4. Language & Code Style Conventions
33
+ ${languageRules}
34
+
35
+ ---
36
+
37
+ ## 5. Architectural Guardrails
38
+ ${baseGuardrails}
39
+ `;
40
+ }
41
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../config/schema.js';
2
+ export declare function renderAiContext(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=ai-context.d.ts.map
@@ -0,0 +1,28 @@
1
+ export function renderAiContext(context) {
2
+ const { config, commands } = context;
3
+ return `# AI Context — ${config.project.name}
4
+
5
+ > High-priority system context for LLMs, coding agents, and developers.
6
+
7
+ ## Project Summary
8
+ - **Name:** ${config.project.name}
9
+ - **Type:** ${config.project.type}
10
+ - **Language:** ${config.project.language}
11
+ - **Repository:** ${config.repository}
12
+ - **Strictness:** ${config.strictness}
13
+
14
+ ## Critical Commands
15
+ - Build: \`${commands.build}\`
16
+ - Test: \`${commands.test}\`
17
+ - Dev: \`${commands.dev}\`
18
+ - Lint: \`${commands.lint}\`
19
+
20
+ ## Context Map
21
+ - Canonical rules: \`.ai/rules/00-core-rules.md\`
22
+ - Architecture: \`.ai/architecture/system-design.md\` and \`docs/ARCHITECTURE.md\`
23
+ - Decisions: \`.ai/decisions/\` and \`docs/DECISIONS.md\`
24
+ - Task tracking: \`.ai/tasks/task-backlog.md\`
25
+ - Guardrails: \`PROJECT_GUARDRAILS.md\`
26
+ `;
27
+ }
28
+ //# sourceMappingURL=ai-context.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../../config/schema.js';
2
+ export declare function renderAiDirArchitecture(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=architecture.d.ts.map
@@ -0,0 +1,13 @@
1
+ export function renderAiDirArchitecture(context) {
2
+ const { config, appTypeRules } = context;
3
+ return `# AI Architecture Overview — ${config.project.name}
4
+
5
+ ## Application Classification: ${config.project.type}
6
+
7
+ ${appTypeRules}
8
+
9
+ ## System Boundaries
10
+ AI coding assistants should consult this file before creating new modules, services, or structural changes to verify they fit within the planned architecture.
11
+ `;
12
+ }
13
+ //# sourceMappingURL=architecture.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../../config/schema.js';
2
+ export declare function renderAiDirContext(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1,14 @@
1
+ export function renderAiDirContext(context) {
2
+ const { config } = context;
3
+ return `# Project Context — ${config.project.name}
4
+
5
+ ## 1. Domain & Purpose
6
+ - Project: ${config.project.name}
7
+ - Type: ${config.project.type}
8
+ - Language: ${config.project.language}
9
+
10
+ ## 2. Key Concepts & Terminology
11
+ Document project-specific business concepts and domain models here so that AI assistants maintain consistent naming conventions across files.
12
+ `;
13
+ }
14
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../../config/schema.js';
2
+ export declare function renderAiDirDecisions(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=decisions.d.ts.map
@@ -0,0 +1,21 @@
1
+ export function renderAiDirDecisions(context) {
2
+ const { config } = context;
3
+ return `# ADR 0001: Initial AI Workspace Setup
4
+
5
+ - **Status:** Accepted
6
+ - **Deciders:** Project Author / Foundry Scaffolding Tool
7
+
8
+ ## Context
9
+ A new software development workspace is being initialized. To ensure consistent collaboration between human developers and AI assistants (Cursor, Claude Code, Copilot, etc.), an unambiguous workspace contract is required.
10
+
11
+ ## Decision
12
+ 1. Initialized workspace with application type \`${config.project.type}\` and language \`${config.project.language}\`.
13
+ 2. Established strictness level at \`${config.strictness}\`.
14
+ 3. Configured AI workflows: ${config.adapters.join(', ')}.
15
+
16
+ ## Consequences
17
+ - AI assistants will follow canonical project guidelines in \`.ai/\` and \`AGENTS.md\`.
18
+ - All architectural decisions must be recorded as ADRs in this directory.
19
+ `;
20
+ }
21
+ //# sourceMappingURL=decisions.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../../config/schema.js';
2
+ export declare function renderAiDirRules(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1,12 @@
1
+ export function renderAiDirRules(context) {
2
+ const { config, baseGuardrails, languageRules } = context;
3
+ return `# Core Workspace Rules — ${config.project.name}
4
+
5
+ ## Strictness Level: ${config.strictness}
6
+
7
+ ${baseGuardrails}
8
+
9
+ ${languageRules}
10
+ `;
11
+ }
12
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1,3 @@
1
+ import { ResolvedWorkspaceContext } from '../../config/schema.js';
2
+ export declare function renderAiDirTasks(context: ResolvedWorkspaceContext): string;
3
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1,31 @@
1
+ export function renderAiDirTasks(context) {
2
+ const { config } = context;
3
+ return `# AI Task Tracking — ${config.project.name}
4
+
5
+ Operational scratchpad for human engineers and AI coding assistants to queue, claim, verify, and complete discrete engineering tasks.
6
+
7
+ ---
8
+
9
+ ## Agent Task Execution Protocol
10
+ 1. **Claiming:** Before executing non-trivial edits, move or record the task under **Active Task (WIP)** with a brief implementation plan.
11
+ 2. **Verification:** Never move an item to **Completed Tasks** until all automated test suites, linting, and typechecks pass with zero errors.
12
+ 3. **Traceability:** Document significant architectural decisions in \`.ai/decisions/\`.
13
+
14
+ ---
15
+
16
+ ## Active Task (WIP)
17
+ <!-- Record the currently active task, planned steps, and validation checklist here -->
18
+ *(No active task. Select or add a task from the backlog before beginning work.)*
19
+
20
+ ---
21
+
22
+ ## Task Backlog
23
+ <!-- Queue upcoming features, enhancements, refactors, or bugfixes below -->
24
+
25
+ ---
26
+
27
+ ## Completed Tasks
28
+ - [x] Initialized AI Workspace via Foundry (\`create-foundry-workspace\`)
29
+ `;
30
+ }
31
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1,2 @@
1
+ export declare const apiRules = "### Backend API Architecture\n- Structure endpoints logically with strict request payload validation and response schemas.\n- Isolate business logic in domain services; keep controller/handler functions thin.\n- Implement centralized error handling, structured logging, and robust authentication middleware.";
2
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1,5 @@
1
+ export const apiRules = `### Backend API Architecture
2
+ - Structure endpoints logically with strict request payload validation and response schemas.
3
+ - Isolate business logic in domain services; keep controller/handler functions thin.
4
+ - Implement centralized error handling, structured logging, and robust authentication middleware.`;
5
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1,2 @@
1
+ export declare const cliRules = "### CLI Tool Architecture\n- Provide intuitive argument and flag parsing with comprehensive `--help` menus.\n- Support both interactive terminal prompts and non-interactive scripted/CI execution modes.\n- Implement structured exit codes and send human messages to stdout and diagnostics to stderr.";
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1,5 @@
1
+ export const cliRules = `### CLI Tool Architecture
2
+ - Provide intuitive argument and flag parsing with comprehensive \`--help\` menus.
3
+ - Support both interactive terminal prompts and non-interactive scripted/CI execution modes.
4
+ - Implement structured exit codes and send human messages to stdout and diagnostics to stderr.`;
5
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,2 @@
1
+ export declare const dataMlRules = "### Data & Machine Learning Architecture\n- Separate raw data ingestion, preprocessing pipelines, and model training/inference scripts.\n- Track model artifacts, dataset schemas, and hyperparameter configurations deterministically.\n- Implement automated validation checks for input tensor dimensions and data distribution shifts.";
2
+ //# sourceMappingURL=data-ml.d.ts.map
@@ -0,0 +1,5 @@
1
+ export const dataMlRules = `### Data & Machine Learning Architecture
2
+ - Separate raw data ingestion, preprocessing pipelines, and model training/inference scripts.
3
+ - Track model artifacts, dataset schemas, and hyperparameter configurations deterministically.
4
+ - Implement automated validation checks for input tensor dimensions and data distribution shifts.`;
5
+ //# sourceMappingURL=data-ml.js.map
@@ -0,0 +1,2 @@
1
+ export declare const fullstackRules = "### Full-Stack Architecture\n- Enforce clean separation between client-side presentation and server-side domain logic.\n- Share data contracts or type definitions across client and server boundaries to eliminate schema drift.\n- Ensure all mutation operations are fully validated on the server regardless of client validation.";
2
+ //# sourceMappingURL=fullstack.d.ts.map
@@ -0,0 +1,5 @@
1
+ export const fullstackRules = `### Full-Stack Architecture
2
+ - Enforce clean separation between client-side presentation and server-side domain logic.
3
+ - Share data contracts or type definitions across client and server boundaries to eliminate schema drift.
4
+ - Ensure all mutation operations are fully validated on the server regardless of client validation.`;
5
+ //# sourceMappingURL=fullstack.js.map
@@ -0,0 +1,3 @@
1
+ import { AppType } from '../../config/schema.js';
2
+ export declare function getAppTypeRules(type: AppType): string;
3
+ //# sourceMappingURL=index.d.ts.map