azcodr 2.2.0 → 2.4.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 (78) hide show
  1. package/.agents/scripts/agent_guard.js +63 -0
  2. package/.agents/skills/lets-build/SKILL.md +1 -1
  3. package/.github/workflows/ci.yml +21 -0
  4. package/.github/workflows/publish.yml +7 -0
  5. package/CODE_OF_CONDUCT.md +122 -0
  6. package/CONTRIBUTING.md +85 -0
  7. package/README.md +73 -3
  8. package/SECURITY.md +32 -0
  9. package/data/memory.template +36 -0
  10. package/docs/rules/clean_code.md +13 -0
  11. package/docs/tipping-points.md +37 -0
  12. package/lib/agent-guard-command.d.ts +28 -0
  13. package/lib/agent-guard-command.d.ts.map +1 -0
  14. package/lib/agent-guard-command.js +103 -0
  15. package/lib/agent-guard-command.js.map +1 -0
  16. package/lib/agent-guard-file.d.ts +32 -0
  17. package/lib/agent-guard-file.d.ts.map +1 -0
  18. package/lib/agent-guard-file.js +77 -0
  19. package/lib/agent-guard-file.js.map +1 -0
  20. package/lib/agent-guard-tdd.d.ts +34 -0
  21. package/lib/agent-guard-tdd.d.ts.map +1 -0
  22. package/lib/agent-guard-tdd.js +77 -0
  23. package/lib/agent-guard-tdd.js.map +1 -0
  24. package/lib/agent-guard.d.ts +38 -0
  25. package/lib/agent-guard.d.ts.map +1 -0
  26. package/lib/agent-guard.js +80 -0
  27. package/lib/agent-guard.js.map +1 -0
  28. package/lib/boundaries.d.ts +41 -0
  29. package/lib/boundaries.d.ts.map +1 -0
  30. package/lib/boundaries.js +158 -0
  31. package/lib/boundaries.js.map +1 -0
  32. package/lib/cli-boundaries.d.ts +18 -0
  33. package/lib/cli-boundaries.d.ts.map +1 -0
  34. package/lib/cli-boundaries.js +46 -0
  35. package/lib/cli-boundaries.js.map +1 -0
  36. package/lib/cli-parse.d.ts +5 -0
  37. package/lib/cli-parse.d.ts.map +1 -1
  38. package/lib/cli-parse.js +35 -5
  39. package/lib/cli-parse.js.map +1 -1
  40. package/lib/cli.d.ts +17 -0
  41. package/lib/cli.d.ts.map +1 -1
  42. package/lib/cli.js +47 -5
  43. package/lib/cli.js.map +1 -1
  44. package/lib/guards.d.ts +6 -0
  45. package/lib/guards.d.ts.map +1 -1
  46. package/lib/guards.js +10 -1
  47. package/lib/guards.js.map +1 -1
  48. package/lib/index.d.ts +15 -0
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +12 -0
  51. package/lib/index.js.map +1 -1
  52. package/lib/repo.js +4 -4
  53. package/lib/repo.js.map +1 -1
  54. package/lib/scaffold.d.ts +2 -7
  55. package/lib/scaffold.d.ts.map +1 -1
  56. package/lib/scaffold.js +7 -10
  57. package/lib/scaffold.js.map +1 -1
  58. package/lib/validate.d.ts +33 -0
  59. package/lib/validate.d.ts.map +1 -0
  60. package/lib/validate.js +24 -0
  61. package/lib/validate.js.map +1 -0
  62. package/memory.md +24 -0
  63. package/package.json +10 -2
  64. package/scripts/validate/links.js +0 -1
  65. package/scripts/validate/root.js +1 -1
  66. package/src/agent-guard-command.ts +118 -0
  67. package/src/agent-guard-file.ts +107 -0
  68. package/src/agent-guard-tdd.ts +96 -0
  69. package/src/agent-guard.ts +123 -0
  70. package/src/boundaries.ts +198 -0
  71. package/src/cli-boundaries.ts +67 -0
  72. package/src/cli-parse.ts +40 -4
  73. package/src/cli.ts +57 -15
  74. package/src/guards.ts +11 -1
  75. package/src/index.ts +40 -0
  76. package/src/repo.ts +4 -4
  77. package/src/scaffold.ts +7 -10
  78. package/src/validate.ts +47 -0
package/src/scaffold.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import process from 'node:process';
4
- import { fileURLToPath } from 'node:url';
5
4
  import { ScaffoldError, ERROR_CODES } from './errors.js';
6
5
  import type { ScaffoldErrorCode, ScaffoldErrorShape } from './errors.js';
7
6
  import { runGit } from './git.js';
8
- import { assertInside, isProtectedTarget } from './guards.js';
7
+ import { assertInside, isProtectedTarget, getTemplateDir } from './guards.js';
9
8
  import { ensureSymlink, ensureSymlinkOrPointer, isSameCaseInsensitiveFile } from './links.js';
10
9
  import type { EnsureSymlinkOptions } from './links.js';
11
10
  import { makeScriptsExecutable } from './permissions.js';
12
11
  import { isInsideGitWorkTree, initGit } from './repo.js';
13
12
  import type { InitGitOptions } from './repo.js';
14
13
 
14
+ export { getTemplateDir };
15
+
15
16
  /**
16
17
  * Canonical list of template files and directories copied into a new workspace.
17
18
  */
@@ -68,14 +69,6 @@ export interface CopyTemplateOptions {
68
69
  dryRun?: boolean;
69
70
  }
70
71
 
71
- /**
72
- * Resolves the root filesystem directory of the azcodr template files.
73
- *
74
- * @returns Absolute filesystem path to the template root directory.
75
- */
76
- export function getTemplateDir(): string {
77
- return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
78
- }
79
72
 
80
73
  function rejectTemplateSelf(resolvedTarget: string, resolvedTemplate: string): void {
81
74
  if (resolvedTarget !== resolvedTemplate) return;
@@ -130,6 +123,10 @@ export function validateTarget(targetDir: string, options: ValidateTargetOptions
130
123
  }
131
124
 
132
125
  function resolveTemplateItem(resolvedTemplate: string, item: string): string {
126
+ if (item === 'memory.md') {
127
+ const memTpl = path.join(resolvedTemplate, 'data', 'memory.template');
128
+ if (fs.existsSync(memTpl)) return memTpl;
129
+ }
133
130
  let srcPath = path.join(resolvedTemplate, item);
134
131
  if (item === '.gitignore' && !fs.existsSync(srcPath)) {
135
132
  const npmIgnorePath = path.join(resolvedTemplate, '.npmignore');
@@ -0,0 +1,47 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath, pathToFileURL } from 'node:url';
3
+
4
+ export interface ValidationResult {
5
+ errors: number;
6
+ warnings: number;
7
+ validatedRules: number;
8
+ validatedSkills: number;
9
+ totalLinks: number;
10
+ brokenLinks: string[];
11
+ }
12
+
13
+ export interface ValidationReporter {
14
+ pass: (msg: string) => void;
15
+ warn: (msg: string) => void;
16
+ fail: (msg: string) => void;
17
+ log: (msg: string) => void;
18
+ heading: (msg: string) => void;
19
+ }
20
+
21
+ /**
22
+ * Validates the agentic architecture and governance files of a workspace.
23
+ *
24
+ * @param workspaceRoot - Path to the workspace directory (defaults to cwd).
25
+ * @param reporter - Optional custom reporter hooks.
26
+ * @returns Object containing error and warning tallies and validation counts.
27
+ */
28
+ export async function validate(
29
+ workspaceRoot: string = process.cwd(),
30
+ reporter?: ValidationReporter
31
+ ): Promise<ValidationResult> {
32
+ const baseDir = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
33
+ const scriptPath = path.resolve(baseDir, '../scripts/validate.js');
34
+ const mod = await import(pathToFileURL(scriptPath).href);
35
+ return mod.runValidation(path.resolve(workspaceRoot), reporter);
36
+ }
37
+
38
+ const noop = (): void => {};
39
+
40
+ /**
41
+ * Creates a silent reporter that suppresses all status reports.
42
+ */
43
+ export function createSilentReporter(): ValidationReporter {
44
+ return { pass: noop, warn: noop, fail: noop, log: noop, heading: noop };
45
+ }
46
+
47
+ export default { validate, createSilentReporter };